Reputation: 19130
I know two modes of GDB disassembly:
First command be used to show instructions as well as raw byte, but it seems to not accept number of instructions to disassemble — only memory range:
disas/r $pc,+30
Second command can disassemble exactly N instructions, like follows, but without raw bytes:
x/10i $pc
I'd like to have a hybrid of these two modes: make the raw bytes visible as in disas/r
and be able to specify exact number of instructions to disassemble as in x/10i
. Can I do it with GDB?
Upvotes: 0
Views: 932
Reputation: 22539
There's no built-in way to do this. (As an aside, it seems to me that this is a bit of an oversight and perhaps a bug report requesting that x/i
be able to show the bytes would be good.)]
If you really need this, there is a way to implement it yourself. The basic idea is to write a new command in Python. This command could wrap the disassemble
command (using gdb.execute
with the to_string
parameter), and then limit its output to N
instructions.
Upvotes: 1