gdb - GNU debugger
Start gdb:
gdb program_name
Set the screen width for gdb:
(gdb) set width 70
Set a breakpoint:
(gdb) break m4_changequote
Using the run command, we start running the program under gdb control; as long as control does not reach the m4_changequote subroutine, the program runs as usual:
(gdb) run
Advance to the next line:
(gdb) n
Step into:
(gdb) s
Display the stack:
(gdb) bt
Display the value of a variable:
(gdb) p varname
To look at some context, we can display ten lines of source surrounding the current line with the l (list) command:
(gdb) l
To change the value of a variable:
(gdb) p len_lquote=strlen(lquote)
To continue:
(gdb) c
To quit gdb:
(gdb) quit
To start gdb with a program and its core file:
gdb program_name core_file
To debug a running process:
gdb program_name PID
page_revision: 5, last_edited: 1221518343|%e %b %Y, %H:%M %Z (%O ago)





