[v6,3/3] disass: Add texinfo doc for the /x modifier

Message ID 20200926073539.981936-4-fam@euphon.net
State Superseded
Headers show
Series
  • disass: Add /x modifier
Related show

Commit Message

Fam Zheng Sept. 26, 2020, 7:35 a.m.
From: Fam Zheng <famzheng@amazon.com>


gdb/doc/ChangeLog:

2020-09-25  Fam Zheng  <famzheng@amazon.com>

	* gdb.texinfo (disassemble): Document /x modifier of disass
	command.
---
 gdb/doc/gdb.texinfo | 38 +++++++++++++++++++++++++++++---------
 1 file changed, 29 insertions(+), 9 deletions(-)

-- 
2.25.1

Comments

Lancelot SIX via Gdb-patches Sept. 26, 2020, 8:18 a.m. | #1
> From: fam@euphon.net

> Cc: Simon Marchi <simark@simark.ca>,

> 	Pedro Alves <pedro@palves.net>,

> 	Andrew Burgess <andrew.burgess@embecosm.com>,

> 	Andreas Schwab <schwab@linux-m68k.org>,

> 	fam@euphon.net,

> 	Eli Zaretskii <eliz@gnu.org>

> Date: Sat, 26 Sep 2020 08:35:39 +0100

> 

> From: Fam Zheng <famzheng@amazon.com>

> 

> gdb/doc/ChangeLog:

> 

> 2020-09-25  Fam Zheng  <famzheng@amazon.com>

> 

> 	* gdb.texinfo (disassemble): Document /x modifier of disass

> 	command.


The name of that node is "Machine Code", not "disassemble".  You can
see the name by looking backward for a @node directive.  Or just use
Emacs's add-change-log-entry-* commands, they will do that for you.

Thanks.
Fam Zheng Sept. 26, 2020, 8:49 a.m. | #2
On Sat, Sep 26, 2020 at 8:18 AM Eli Zaretskii <eliz@gnu.org> wrote:
>

> > From: fam@euphon.net

> > Cc: Simon Marchi <simark@simark.ca>,

> >       Pedro Alves <pedro@palves.net>,

> >       Andrew Burgess <andrew.burgess@embecosm.com>,

> >       Andreas Schwab <schwab@linux-m68k.org>,

> >       fam@euphon.net,

> >       Eli Zaretskii <eliz@gnu.org>

> > Date: Sat, 26 Sep 2020 08:35:39 +0100

> >

> > From: Fam Zheng <famzheng@amazon.com>

> >

> > gdb/doc/ChangeLog:

> >

> > 2020-09-25  Fam Zheng  <famzheng@amazon.com>

> >

> >       * gdb.texinfo (disassemble): Document /x modifier of disass

> >       command.

>

> The name of that node is "Machine Code", not "disassemble".  You can

> see the name by looking backward for a @node directive.  Or just use

> Emacs's add-change-log-entry-* commands, they will do that for you.


OK, no problem, it should be easy to fix. I just looked at git blame
in the context and copied 9b117ef31f which did the same. But I think
you're right.

I don't use Emacs, so I cannot take that benefit. :(

Thanks for the review and quick response!

Fam

Patch

diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 8bff27c940..4dad72a34f 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -9514,16 +9514,20 @@  line.
 @itemx disassemble /m
 @itemx disassemble /s
 @itemx disassemble /r
-This specialized command dumps a range of memory as machine
-instructions.  It can also print mixed source+disassembly by specifying
-the @code{/m} or @code{/s} modifier and print the raw instructions in hex
-as well as in symbolic form by specifying the @code{/r} modifier.
-The default memory range is the function surrounding the
-program counter of the selected frame.  A single argument to this
+@itemx disassemble /x
+This specialized command dumps a range of memory as machine instructions.
+If the address of an instruction resolves to a symbol, such as a function
+name, the symbol name and the offset are printed following the instruction
+address.  The offset is in decimal by default and in hex if @code{/x} is
+modifier is used.  It can also print mixed source+disassembly by
+specifying the @code{/m} or @code{/s} modifier and print the raw
+instructions in hex as well as in symbolic form by specifying the
+@code{/r} modifier.  The default memory range is the function surrounding
+the program counter of the selected frame.  A single argument to this
 command is a program counter value; @value{GDBN} dumps the function
-surrounding this value.  When two arguments are given, they should
-be separated by a comma, possibly surrounded by whitespace.  The
-arguments specify a range of addresses to dump, in one of two forms:
+surrounding this value.  When two arguments are given, they should be
+separated by a comma, possibly surrounded by whitespace.  The arguments
+specify a range of addresses to dump, in one of two forms:
 
 @table @code
 @item @var{start},@var{end}
@@ -9561,6 +9565,22 @@  Dump of assembler code from 0x32c4 to 0x32e4:
 End of assembler dump.
 @end smallexample
 
+@code{/x} could be used to show offsets in hex:
+
+@smallexample
+(@value{GDBP}) disas /x 0x32c4, 0x32e4
+Dump of assembler code from 0x32c4 to 0x32e4:
+   0x32c4 <main+0xcc>:      addil 0,dp
+   0x32c8 <main+0xd0>:      ldw 0x22c(sr0,r1),r26
+   0x32cc <main+0xd4>:      ldil 0x3000,r31
+   0x32d0 <main+0xd8>:      ble 0x3f8(sr4,r31)
+   0x32d4 <main+0xdc>:      ldo 0(r31),rp
+   0x32d8 <main+0xe0>:      addil -0x800,dp
+   0x32dc <main+0xe4>:      ldo 0x588(r1),r26
+   0x32e0 <main+0xe8>:      ldil 0x3000,r31
+End of assembler dump.
+@end smallexample
+
 Here is an example showing mixed source+assembly for Intel x86
 with @code{/m} or @code{/s}, when the program is stopped just after
 function prologue in a non-optimized function with no inline code.