Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: fam@euphon.net
To: gdb-patches@sourceware.org
Cc: fam@euphon.net, Andreas Schwab <schwab@linux-m68k.org>,
	Simon Marchi <simark@simark.ca>
Subject: [PATCH v6 3/3] disass: Add texinfo doc for the /x modifier
Date: Sat, 26 Sep 2020 08:35:39 +0100	[thread overview]
Message-ID: <20200926073539.981936-4-fam@euphon.net> (raw)
In-Reply-To: <20200926073539.981936-1-fam@euphon.net>

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(-)

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.
-- 
2.25.1



  parent reply	other threads:[~2020-09-26  7:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-26  7:35 [PATCH v6 0/3] disass: Add " fam
2020-09-26  7:35 ` [PATCH v6 1/3] disass: Add /x modifier to print offsets in hex fam
2020-09-26  7:35 ` [PATCH v6 2/3] disass: Add test for /x mode fam
2020-09-26  7:35 ` fam [this message]
2020-09-26  8:18   ` [PATCH v6 3/3] disass: Add texinfo doc for the /x modifier Eli Zaretskii via Gdb-patches
2020-09-26  8:49     ` Fam Zheng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200926073539.981936-4-fam@euphon.net \
    --to=fam@euphon.net \
    --cc=gdb-patches@sourceware.org \
    --cc=schwab@linux-m68k.org \
    --cc=simark@simark.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox