开发者

How to debug specific file with gdb?

开发者 https://www.devze.com 2023-04-10 12:14 出处:网络
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).

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>.

0

精彩评论

暂无评论...
验证码 换一张
取 消