Python gdb Disassembly Extension 1.20
Ive released version 1.20 of my Python gdb Debugging Extensions, which I have now renamed to pygdbdis.The introductory page for the extensions is here if you want to refresh your memory on what it does.
For a basic overview: The extensions are intended for those of us who use gdb to debug applications without the source - e.g. for reverse engineering, exploit development, etc. They contain a number of helper functions that allow you to easily view the program state in a familiar and easy to use fashion, with string reading, hexdump memory reading, stack viewing, register printout with pointer dereferencing, etc.
The extensions are tested to work on Mac OSX and Linux with a version of gdb that supports Python (get the macports version of gdb for OSX). The supported targets are x86 and amd_x86_64 processes. Use the 'printextensionhelp' command to show valid commands. Use 'source /path/to/pygdbdis-1.20.py' in gdb to load the extensions, and you can now autoload them by placing this same line in your gdbinit file (e.g. ~/.gdbinit).
To use the 'fifodisplay' command display to get contextual information about the debugees execution state whenever gdb stops, have a multi paned terminal app with at least three other open terminals, then run the 'fifodisplay' command and follow the prompts to create listeners for the various fifos in the other terminals.
Heres a screenshot of what the fifodisplay output looks like using iTerm2 on OSX. In the top left pane is the disassembly display fifo, the top right is the register display fifo and the bottom right is the stack display fifo.
The changes in this version:
- Numerous bug fixes
- Name change
- Improvements to the output and functioning of search commands. I still haven't been able to get rid of the memory read warnings, they seem to be a gdb 'feature' you cant disable, although I have moved all of the useful output of the commands to after the warnings appear
- Exposed a number of user configurable settings that can be changed and viewed with the 'changeextensionsetting' and 'printextensionsettings' commands
- Cleaned up fifodisplay output to hopefully prevent inappropriate line wrapping in the fifo displays. The fifo output can also be managed to some extent using height and width parameters exposed as user configurable settings
- Added a by default option to not remove fifodisplay fifos on restart/exit. This functionality was introduced in version 1.10, and can be re-enabled using 'changeextensionsetting'
- Added a 'setbreakpointatentry' command to set a breakpoint at the entry point of the program. By default this action is also performed automatically when a new objfile is loaded into the debugger, but this can be disabled if you desire
- Made the 'printextensionhelp' command autodocument the configure gdb commands in the program using the class docstrings. This means if you add a new command of your own it will be automatically listed in 'printextensionhelp' output with a description defined by the class docstring
- Removed the ns command, as it was buggy and largely unnecessary
- Improved the initialisation process for the script, now allowing the extension to be loaded from .gdbinit and allowing reconfiguration of the architecture specific settings if a new objfile is loaded