Debugging with gdb
When programming with C on Unix systems, the debugger of choice is gdb. It provides a robust command-line interface, allowing you to run a program while maintaining full control. For example, you may set breakpoints in the execution of the program and monitor the contents of memory or registers at any point you like. For this reason, debuggers like gdb are invaluable to programmers and hackers alike.
gdb Basics
Commonly used commands in gdb are shown in Table 6-6.
Command | Description |
---|---|
b function | Sets a breakpoint at function |
b *mem | Sets a breakpoint at absolute memory location |
info b | Displays information about breakpoints |
delete b | Removes a breakpoint |
umrun <args> | Starts debugging program from within gdb ... |
Get Gray Hat Hacking, Second Edition, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.