EmadGirgis
asked on
How to set break point in a method in a class and other questions?
New to gdb !!! I have trouble in few issues.
1) Is it possible to browse source code from inside gdb?
2) How to set a break point in a function in a class?
3) How to set a break point in constructor?
4) How to switch between threads?
Thanks
Emad
1) Is it possible to browse source code from inside gdb?
2) How to set a break point in a function in a class?
3) How to set a break point in constructor?
4) How to switch between threads?
Thanks
Emad
ASKER
Thanks!!
So,
If I need a file name of myclass.cpp
I use :myclass.cpp:101
or myclass.h:101
Do I need to provide a path for the file source?
========================== ========== ========== ========== =========
can you say
b myclass::myfunction
========================== ==========
can you give me a little definition on trace and how to do it in couple of steps?
========================== ==
So,
If I need a file name of myclass.cpp
I use :myclass.cpp:101
or myclass.h:101
Do I need to provide a path for the file source?
==========================
can you say
b myclass::myfunction
==========================
can you give me a little definition on trace and how to do it in couple of steps?
==========================
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Browse as in code navigation - No ... But you can trace through the code ... n takes you to next statement and s steps into it
A basic primer
http://www.cs.princeton.edu/~benjasik/gdb/gdbtut.html
>2) How to set a break point in a function in a class?
b function_name
OR
b filename:lineno
b stands for brakpoint
>3) How to set a break point in constructor?
gdb ./a.out
b filename:lineno
run
>4) How to switch between threads?
info threads
this will display all current threads ... note down the thread number that you wish to switch to
thread <thread no>