![](/style/images/good.png)
![](/style/images/bad.png)
Quick Intro to gdb
source link: https://www.youtube.com/watch?v=xQ0ONbt-qPs
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
964 subscribers
Just a quick overview of some often-used gdb (and related) commands, including:
gcc -g to compile a program and include debugging information start - begin exexuting your program
list - examine your source code from within the debugger
step - execute the next line of your program next - execute the next line of your program, but if it's a subroutine call, treat the entire subroutine as a single line
print - examine the contents of a variable x - examine memory directly
watch, rwatch - set a watch for when a variable is written or read: return to the debugger once this happens break - set a breakpoint: return to the debugger when this line of code is about to be executed info watch - show info on watchpoints info break - show info on breakpoints delete # - delete watchpoint or breakpoint "#"
cont - continue from a breakpoint, watchpoint, step, next, etc.; basically begin running your program from where it left off
set var name=value set the value of variable "name" to "value"
bt - show the call frames for your program frame # - set the current frame to #. Variables you reference etc. will be those within that context.
quit - leave the debugger
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK