How to display instructions around the current instuction?
Eli Zaretskii
eliz@gnu.org
Fri Jan 29 07:18:35 GMT 2021
> Date: Thu, 28 Jan 2021 19:58:11 -0600
> From: Peng Yu via Gdb <gdb@sourceware.org>
> Cc: gdb@sourceware.org
>
> >> display/10i $rip
> >>
> >
> > From gdb/NEWS:
> >
> > ~~~~
> > *** Changes in GDB 7.12
> >
> > * GDB now supports a negative repeat count in the 'x' command to examine
> > memory backward from the given address. For example:
> >
> > ...
> > (gdb) x/-5i 0x0000000000400580
> > 0x40056a <main(int, char**)+8>: mov %edi,-0x4(%rbp)
> > 0x40056d <main(int, char**)+11>: mov %rsi,-0x10(%rbp)
> > 0x400571 <main(int, char**)+15>: mov $0x40061c,%esi
> > 0x400576 <main(int, char**)+20>: mov $0x2a,%edi
> > 0x40057b <main(int, char**)+25>:
> > callq 0x400536 <Func1(int, char const*)>
> > ~~~~
>
> Is there a documentation problem in gdb regarding this feature. I
> don't see this feature is documented.
You are looking up help on a wrong command. Pedro suggested to use
x/-5i ADDRESS
And the help for 'x' says:
The specified number of objects of the specified size are printed
according to the format. If a negative number is specified, memory is
examined backward from the address.
Note the last sentence.
More information about the Gdb
mailing list