- Enable the core file
% ulimit -c 500000
Set maximum core file size to 500K.
- List all proc information and function list
(gdb) info functions
- Disasseeble
- Display and clear breakpoints
(gdb) delete breakpoints 1
- Watching it live
(gdb) commands 1
print variable
continue
end
Note: break at 188 lines and then set a group of commands at break point 1.
- Break when a specific address is accessed. Refer to this article.
- Define in macro and alias in ~/.gdbinit A good article about it.
define cls
shell clear
end
document cls
clears screen for gdb
end
Example Macros for STL debugging.
- Handle Signal
(gdb) i signal
(gdb) handle SIG32 nostop print pass
- Multiple threads
- Remote debugging
Client side: gdb program
(gdb) handle SIGTRAP nonstop noprint pass
(gdb) target remote gdbserverip:9999
- Store history
(gdb) set $table=*table_ptr
(gdb) show conv
Checkpoint
(gdb) checkpoint
(gdb) i checkpoint
(gdb) restart checkpoint-id
- See Macros in program
- Why the program is stopped
- exit a loop
- print, info, show
info: show things about the program being debugged
show: show things about the debugger
No comments:
Post a Comment