开发者

Cannot place breakpoint in gdb in emacs

开发者 https://www.devze.com 2022-12-29 16:36 出处:网络
I\'m trying to debug a small program I\'ve written in C. I open up the file in emacs, M-x gdb, give the program filename (a.out). When i switch to the source file in the emacs pane, and try to place a

I'm trying to debug a small program I've written in C. I open up the file in emacs, M-x gdb, give the program filename (a.out). When i switch to the source file in the emacs pane, and try to place a breakpoint in the main function, I get the message "No defau开发者_开发知识库lt breakpoint address now." and the breakpoint doesn't place, so I can't debug the program. I'm compiling the program with the options gcc -Wall -ansi -pedantic-errors -Werror. Any ideas?


to debug in gdb you have to use the -g option, this will let gdb work with your output file by adding debugging symbols to your binary

gcc -g file.cpp
0

精彩评论

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