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

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

Commit Message

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


gdb/doc/ChangeLog:

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

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

-- 
2.25.1

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.