Re: How to display instructions around the current instuction?

Eli Zaretskii via Gdb <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <[email protected]>
> Date: Thu, 28 Jan 2021 19:58:11 -0600
> From: Peng Yu via Gdb <[email protected]>
> Cc: [email protected]
> 
> >> 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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.