I can't find a way for cgdb to disassemble a binary and show the assembly code with the current instruction in the code window. Is this possible and what command should I use? I'm using Mac OS X and got cgdb from the homebrew repository.
display/i $pc
shows disassembly always for the current instruction, in the console window.
To show disassembly for more instructions, prefix i
with the number of instructions.
For example,
display/5i $pc
shows disassembly always for the next 5 instructions.
A recent update (Feb 2017) to cgdb makes it possible to do this. You will need cgdb version 0.7.0 or newer. (At the time of writing this is the latest release). You may need to compile this from source yourself given how recent it is.
More details on adding disassembly support can be found here: https://github.com/cgdb/cgdb/issues/44
To view the disassembly in cgdb hit esc and type :set dis
enter.
To go back to the source (if available), repeat this, except type :set nodis
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With