Skip to content
Commit e24d337e authored by Bruno Larsen's avatar Bruno Larsen
Browse files

gdb: add 'maintenance print record-instruction' command



While chasing some reverse debugging bugs, I found myself wondering what
was recorded by GDB to undo and redo a certain instruction. This commit
implements a simple way of printing that information.

If there isn't enough history to print the desired instruction (such as
when the user hasn't started recording yet or when they request 2
instructions back but only 1 was recorded), GDB warns the user like so:

(gdb) maint print record-instruction
Not enough recorded history

If there is enough, GDB prints the instruction like so:

(gdb) maint print record-instruction
4 bytes of memory at address 0x00007fffffffd5dc changed from: 01 00 00 00
Register eflags changed: [ IF ]
Register rip changed: (void (*)()) 0x401115 <main+15>

Approved-by: default avatarEli Zaretskii <eliz@gnu.org>
Reviewed-by: default avatarAlexandra Hajkova <ahajkova@redhat.com>
Reviewed-by: default avatarLancelot Six <lsix@lancelotsix.com>
Approved-by: default avatarTom Tromey <tom@tromey.com>
parent 502c7218
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment