How to debug specific file with gdb?
I have to cpp files (main and functions) and I make them to bui开发者_开发问答ld a exe file (code) and two object files (main.o and functions.o).
How can I debug specific file "functions.cpp" from gdb command line?
You need to compile your files with gcc's -g3
option. After this start gdb <exename>
. You can then set breakpoint in your file inside gdb by something like b functions.cpp:36
if you want the exe to break on line 36 of functions.cpp. You can set breakpoints to particular function calls as well, such as b func()
. Then run the program using r <options that exename takes>
.
精彩评论