* [PATCH v2] disass: Add /x modifier to print offsets in hex
@ 2020-09-23 10:19 fam
2020-09-23 10:39 ` Andreas Schwab
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: fam @ 2020-09-23 10:19 UTC (permalink / raw)
To: gdb-patches; +Cc: fam
From: Fam Zheng <famzheng@amazon.com>
Backtrace messages printed by Linux kernel and Xen have hex offsets,
e.g.:
(XEN) Xen call trace:
(XEN) [<ffff82d0402eefbb>] R guest_walk_tables_2_levels+0x189/0x66d
(XEN) [<ffff82d0402edbbd>] F hap_p2m_ga_to_gfn_2_levels+0x112/0x25b
(XEN) [<ffff82d0402edd22>] F hap_gva_to_gfn_2_levels+0x1c/0x1e
(XEN) [<ffff82d0402f832e>] F paging_gva_to_gfn+0x14a/0x167
Having this modifier saves converting between hex values from the
backtrace log and offsets in gdb disass output.
---
v2: Drop a overlooked change on file header.
---
gdb/cli/cli-cmds.c | 17 ++++++++++++-----
gdb/disasm.c | 6 +++++-
gdb/disasm.h | 1 +
gdb/record.c | 3 +++
4 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index e3965fea07..2266f67695 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -1456,12 +1456,12 @@ disassemble_current_function (gdb_disassembly_flags flags)
/* Dump a specified section of assembly code.
Usage:
- disassemble [/mrs]
+ disassemble [/mrsx]
- dump the assembly code for the function of the current pc
- disassemble [/mrs] addr
+ disassemble [/mrsx] addr
- dump the assembly code for the function at ADDR
- disassemble [/mrs] low,high
- disassemble [/mrs] low,+length
+ disassemble [/mrsx] low,high
+ disassemble [/mrsx] low,+length
- dump the assembly code in the range [LOW,HIGH), or [LOW,LOW+length)
A /m modifier will include source code with the assembly in a
@@ -1472,6 +1472,8 @@ disassemble_current_function (gdb_disassembly_flags flags)
A /r modifier will include raw instructions in hex with the assembly.
+ A /x modifier will print offsets in hex.
+
A /s modifier will include source code with the assembly, like /m, with
two important differences:
1) The output is still in pc address order.
@@ -1510,6 +1512,9 @@ disassemble_command (const char *arg, int from_tty)
case 'r':
flags |= DISASSEMBLY_RAW_INSN;
break;
+ case 'x':
+ flags |= DISASSEMBLY_HEX_OFFSET;
+ break;
case 's':
flags |= DISASSEMBLY_SOURCE;
break;
@@ -2535,7 +2540,7 @@ can be shown using \"show listsize\"."));
c = add_com ("disassemble", class_vars, disassemble_command, _("\
Disassemble a specified section of memory.\n\
-Usage: disassemble[/m|/r|/s] START [, END]\n\
+Usage: disassemble[/m|/r|/s|/r] START [, END]\n\
Default is the function surrounding the pc of the selected frame.\n\
\n\
With a /s modifier, source lines are included (if available).\n\
@@ -2551,6 +2556,8 @@ in favor of /s.\n\
\n\
With a /r modifier, raw instructions in hex are included.\n\
\n\
+With a /x modifier, offsets are printed as hex.\n\
+\n\
With a single argument, the function surrounding that address is dumped.\n\
Two arguments (separated by a comma) are taken as a range of memory to dump,\n\
in the form of \"start,end\", or \"start,+length\".\n\
diff --git a/gdb/disasm.c b/gdb/disasm.c
index e45c840068..47936e54f1 100644
--- a/gdb/disasm.c
+++ b/gdb/disasm.c
@@ -201,6 +201,7 @@ gdb_pretty_print_disassembler::pretty_print_insn (const struct disasm_insn *insn
int size;
CORE_ADDR pc;
struct gdbarch *gdbarch = arch ();
+ char offset_buf[32];
{
ui_out_emit_tuple tuple_emitter (m_uiout, NULL);
@@ -250,7 +251,10 @@ gdb_pretty_print_disassembler::pretty_print_insn (const struct disasm_insn *insn
the offset takes the place of the "+" here. */
if (offset >= 0)
m_uiout->text ("+");
- m_uiout->field_signed ("offset", offset);
+ snprintf(offset_buf, sizeof(offset_buf),
+ flags & DISASSEMBLY_HEX_OFFSET ? "0x%x" : "%d",
+ offset);
+ m_uiout->field_string("offset", offset_buf);
m_uiout->text (">:\t");
}
else
diff --git a/gdb/disasm.h b/gdb/disasm.h
index b0f535eaa2..fb293650de 100644
--- a/gdb/disasm.h
+++ b/gdb/disasm.h
@@ -31,6 +31,7 @@ enum gdb_disassembly_flag
DISASSEMBLY_OMIT_PC = (0x1 << 4),
DISASSEMBLY_SOURCE = (0x1 << 5),
DISASSEMBLY_SPECULATIVE = (0x1 << 6),
+ DISASSEMBLY_HEX_OFFSET = (0x1 << 7),
};
DEF_ENUM_FLAGS_TYPE (enum gdb_disassembly_flag, gdb_disassembly_flags);
diff --git a/gdb/record.c b/gdb/record.c
index 759395d5bc..44591e8cf0 100644
--- a/gdb/record.c
+++ b/gdb/record.c
@@ -494,6 +494,9 @@ get_insn_history_modifiers (const char **arg)
case 'r':
modifiers |= DISASSEMBLY_RAW_INSN;
break;
+ case 'x':
+ modifiers |= DISASSEMBLY_HEX_OFFSET;
+ break;
case 'f':
modifiers |= DISASSEMBLY_OMIT_FNAME;
break;
--
2.25.1
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH v2] disass: Add /x modifier to print offsets in hex
2020-09-23 10:19 [PATCH v2] disass: Add /x modifier to print offsets in hex fam
@ 2020-09-23 10:39 ` Andreas Schwab
2020-09-23 11:12 ` Fam Zheng
2020-09-24 3:25 ` Simon Marchi
2020-09-24 11:05 ` Andrew Burgess
2 siblings, 1 reply; 8+ messages in thread
From: Andreas Schwab @ 2020-09-23 10:39 UTC (permalink / raw)
To: fam; +Cc: gdb-patches
On Sep 23 2020, fam@euphon.net wrote:
> @@ -2535,7 +2540,7 @@ can be shown using \"show listsize\"."));
>
> c = add_com ("disassemble", class_vars, disassemble_command, _("\
> Disassemble a specified section of memory.\n\
> -Usage: disassemble[/m|/r|/s] START [, END]\n\
> +Usage: disassemble[/m|/r|/s|/r] START [, END]\n\
/r twice.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH v2] disass: Add /x modifier to print offsets in hex
2020-09-23 10:39 ` Andreas Schwab
@ 2020-09-23 11:12 ` Fam Zheng
0 siblings, 0 replies; 8+ messages in thread
From: Fam Zheng @ 2020-09-23 11:12 UTC (permalink / raw)
To: Andreas Schwab; +Cc: gdb-patches
On Wed, 23 Sep 2020, 11:39 Andreas Schwab, <schwab@linux-m68k.org> wrote:
> On Sep 23 2020, fam@euphon.net wrote:
>
> > @@ -2535,7 +2540,7 @@ can be shown using \"show listsize\"."));
> >
> > c = add_com ("disassemble", class_vars, disassemble_command, _("\
> > Disassemble a specified section of memory.\n\
> > -Usage: disassemble[/m|/r|/s] START [, END]\n\
> > +Usage: disassemble[/m|/r|/s|/r] START [, END]\n\
>
> /r twice.
>
> Andreas.
>
Oops, that's a typo, thank you.
If there's no objection to the interface, I'll respin with texinfo in next
rev.
Thanks,
Fam
> --
> Andreas Schwab, schwab@linux-m68k.org
> GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
> "And now for something completely different."
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] disass: Add /x modifier to print offsets in hex
2020-09-23 10:19 [PATCH v2] disass: Add /x modifier to print offsets in hex fam
2020-09-23 10:39 ` Andreas Schwab
@ 2020-09-24 3:25 ` Simon Marchi
2020-09-24 7:26 ` Fam Zheng
2020-09-24 11:05 ` Andrew Burgess
2 siblings, 1 reply; 8+ messages in thread
From: Simon Marchi @ 2020-09-24 3:25 UTC (permalink / raw)
To: fam, gdb-patches
Hi,
That looks reasonable to me.
- This probably deserves a NEWS entry.
- There's probably some doc to update (doc/gdb.texinfo) for the affected
commands.
- Could you add a test for this? You probably don't need a new file,
just enhance some existing basic disasm test.
> @@ -2535,7 +2540,7 @@ can be shown using \"show listsize\"."));
>
> c = add_com ("disassemble", class_vars, disassemble_command, _("\
> Disassemble a specified section of memory.\n\
> -Usage: disassemble[/m|/r|/s] START [, END]\n\
> +Usage: disassemble[/m|/r|/s|/r] START [, END]\n\
> Default is the function surrounding the pc of the selected frame.\n\
> \n\
> With a /s modifier, source lines are included (if available).\n\
> @@ -2551,6 +2556,8 @@ in favor of /s.\n\
> \n\
> With a /r modifier, raw instructions in hex are included.\n\
> \n\
> +With a /x modifier, offsets are printed as hex.\n\
Really a nit, but just above we say "in hex", so it would be nice to be
consistent and say "in hex" here too.
> @@ -250,7 +251,10 @@ gdb_pretty_print_disassembler::pretty_print_insn (const struct disasm_insn *insn
> the offset takes the place of the "+" here. */
> if (offset >= 0)
> m_uiout->text ("+");
> - m_uiout->field_signed ("offset", offset);
> + snprintf(offset_buf, sizeof(offset_buf),
> + flags & DISASSEMBLY_HEX_OFFSET ? "0x%x" : "%d",
> + offset);
> + m_uiout->field_string("offset", offset_buf);
You could skip the temporary buffer with:
m_uiout->field_fmt ("offset",
((flags & DISASSEMBLY_HEX_OFFSET) != 0
? "0x%x" : "%d"),
offset);
Note that the GNU coding style requires a space before parentheses in
function (and function-like) calls.
Simon
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH v2] disass: Add /x modifier to print offsets in hex
2020-09-24 3:25 ` Simon Marchi
@ 2020-09-24 7:26 ` Fam Zheng
0 siblings, 0 replies; 8+ messages in thread
From: Fam Zheng @ 2020-09-24 7:26 UTC (permalink / raw)
To: Simon Marchi; +Cc: gdb-patches
On Thu, Sep 24, 2020 at 3:25 AM Simon Marchi <simark@simark.ca> wrote:
>
>
> Hi,
Hi Simon,
>
> That looks reasonable to me.
>
> - This probably deserves a NEWS entry.
> - There's probably some doc to update (doc/gdb.texinfo) for the affected
> commands.
> - Could you add a test for this? You probably don't need a new file,
> just enhance some existing basic disasm test.
All make sense!
>
> > @@ -2535,7 +2540,7 @@ can be shown using \"show listsize\"."));
> >
> > c = add_com ("disassemble", class_vars, disassemble_command, _("\
> > Disassemble a specified section of memory.\n\
> > -Usage: disassemble[/m|/r|/s] START [, END]\n\
> > +Usage: disassemble[/m|/r|/s|/r] START [, END]\n\
> > Default is the function surrounding the pc of the selected frame.\n\
> > \n\
> > With a /s modifier, source lines are included (if available).\n\
> > @@ -2551,6 +2556,8 @@ in favor of /s.\n\
> > \n\
> > With a /r modifier, raw instructions in hex are included.\n\
> > \n\
> > +With a /x modifier, offsets are printed as hex.\n\
>
> Really a nit, but just above we say "in hex", so it would be nice to be
> consistent and say "in hex" here too.
Okay, will change.
>
> > @@ -250,7 +251,10 @@ gdb_pretty_print_disassembler::pretty_print_insn (const struct disasm_insn *insn
> > the offset takes the place of the "+" here. */
> > if (offset >= 0)
> > m_uiout->text ("+");
> > - m_uiout->field_signed ("offset", offset);
> > + snprintf(offset_buf, sizeof(offset_buf),
> > + flags & DISASSEMBLY_HEX_OFFSET ? "0x%x" : "%d",
> > + offset);
> > + m_uiout->field_string("offset", offset_buf);
>
> You could skip the temporary buffer with:
>
> m_uiout->field_fmt ("offset",
> ((flags & DISASSEMBLY_HEX_OFFSET) != 0
> ? "0x%x" : "%d"),
> offset);
>
> Note that the GNU coding style requires a space before parentheses in
> function (and function-like) calls.
Thanks, will send v3 later addressing above.
Fam
>
> Simon
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] disass: Add /x modifier to print offsets in hex
2020-09-23 10:19 [PATCH v2] disass: Add /x modifier to print offsets in hex fam
2020-09-23 10:39 ` Andreas Schwab
2020-09-24 3:25 ` Simon Marchi
@ 2020-09-24 11:05 ` Andrew Burgess
2020-09-24 12:20 ` Pedro Alves
2 siblings, 1 reply; 8+ messages in thread
From: Andrew Burgess @ 2020-09-24 11:05 UTC (permalink / raw)
To: fam; +Cc: gdb-patches
* fam@euphon.net <fam@euphon.net> [2020-09-23 10:19:06 +0000]:
> From: Fam Zheng <famzheng@amazon.com>
>
> Backtrace messages printed by Linux kernel and Xen have hex offsets,
> e.g.:
>
> (XEN) Xen call trace:
> (XEN) [<ffff82d0402eefbb>] R guest_walk_tables_2_levels+0x189/0x66d
> (XEN) [<ffff82d0402edbbd>] F hap_p2m_ga_to_gfn_2_levels+0x112/0x25b
> (XEN) [<ffff82d0402edd22>] F hap_gva_to_gfn_2_levels+0x1c/0x1e
> (XEN) [<ffff82d0402f832e>] F paging_gva_to_gfn+0x14a/0x167
>
> Having this modifier saves converting between hex values from the
> backtrace log and offsets in gdb disass output.
>
> ---
>
> v2: Drop a overlooked change on file header.
> ---
> gdb/cli/cli-cmds.c | 17 ++++++++++++-----
> gdb/disasm.c | 6 +++++-
> gdb/disasm.h | 1 +
> gdb/record.c | 3 +++
> 4 files changed, 21 insertions(+), 6 deletions(-)
>
> diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
> index e3965fea07..2266f67695 100644
> --- a/gdb/cli/cli-cmds.c
> +++ b/gdb/cli/cli-cmds.c
> @@ -1456,12 +1456,12 @@ disassemble_current_function (gdb_disassembly_flags flags)
> /* Dump a specified section of assembly code.
>
> Usage:
> - disassemble [/mrs]
> + disassemble [/mrsx]
> - dump the assembly code for the function of the current pc
> - disassemble [/mrs] addr
> + disassemble [/mrsx] addr
> - dump the assembly code for the function at ADDR
> - disassemble [/mrs] low,high
> - disassemble [/mrs] low,+length
> + disassemble [/mrsx] low,high
> + disassemble [/mrsx] low,+length
> - dump the assembly code in the range [LOW,HIGH), or [LOW,LOW+length)
>
> A /m modifier will include source code with the assembly in a
> @@ -1472,6 +1472,8 @@ disassemble_current_function (gdb_disassembly_flags flags)
>
> A /r modifier will include raw instructions in hex with the assembly.
>
> + A /x modifier will print offsets in hex.
Shouldn't this be 'An /x modified ...' ? Saying it out loud it
certainly seems that way.
> +
> A /s modifier will include source code with the assembly, like /m, with
> two important differences:
> 1) The output is still in pc address order.
> @@ -1510,6 +1512,9 @@ disassemble_command (const char *arg, int from_tty)
> case 'r':
> flags |= DISASSEMBLY_RAW_INSN;
> break;
> + case 'x':
> + flags |= DISASSEMBLY_HEX_OFFSET;
> + break;
> case 's':
> flags |= DISASSEMBLY_SOURCE;
> break;
> @@ -2535,7 +2540,7 @@ can be shown using \"show listsize\"."));
>
> c = add_com ("disassemble", class_vars, disassemble_command, _("\
> Disassemble a specified section of memory.\n\
> -Usage: disassemble[/m|/r|/s] START [, END]\n\
> +Usage: disassemble[/m|/r|/s|/r] START [, END]\n\
> Default is the function surrounding the pc of the selected frame.\n\
> \n\
> With a /s modifier, source lines are included (if available).\n\
> @@ -2551,6 +2556,8 @@ in favor of /s.\n\
> \n\
> With a /r modifier, raw instructions in hex are included.\n\
> \n\
> +With a /x modifier, offsets are printed as hex.\n\
Same I think.
Thanks, Andrew
> +\n\
> With a single argument, the function surrounding that address is dumped.\n\
> Two arguments (separated by a comma) are taken as a range of memory to dump,\n\
> in the form of \"start,end\", or \"start,+length\".\n\
> diff --git a/gdb/disasm.c b/gdb/disasm.c
> index e45c840068..47936e54f1 100644
> --- a/gdb/disasm.c
> +++ b/gdb/disasm.c
> @@ -201,6 +201,7 @@ gdb_pretty_print_disassembler::pretty_print_insn (const struct disasm_insn *insn
> int size;
> CORE_ADDR pc;
> struct gdbarch *gdbarch = arch ();
> + char offset_buf[32];
>
> {
> ui_out_emit_tuple tuple_emitter (m_uiout, NULL);
> @@ -250,7 +251,10 @@ gdb_pretty_print_disassembler::pretty_print_insn (const struct disasm_insn *insn
> the offset takes the place of the "+" here. */
> if (offset >= 0)
> m_uiout->text ("+");
> - m_uiout->field_signed ("offset", offset);
> + snprintf(offset_buf, sizeof(offset_buf),
> + flags & DISASSEMBLY_HEX_OFFSET ? "0x%x" : "%d",
> + offset);
> + m_uiout->field_string("offset", offset_buf);
> m_uiout->text (">:\t");
> }
> else
> diff --git a/gdb/disasm.h b/gdb/disasm.h
> index b0f535eaa2..fb293650de 100644
> --- a/gdb/disasm.h
> +++ b/gdb/disasm.h
> @@ -31,6 +31,7 @@ enum gdb_disassembly_flag
> DISASSEMBLY_OMIT_PC = (0x1 << 4),
> DISASSEMBLY_SOURCE = (0x1 << 5),
> DISASSEMBLY_SPECULATIVE = (0x1 << 6),
> + DISASSEMBLY_HEX_OFFSET = (0x1 << 7),
> };
> DEF_ENUM_FLAGS_TYPE (enum gdb_disassembly_flag, gdb_disassembly_flags);
>
> diff --git a/gdb/record.c b/gdb/record.c
> index 759395d5bc..44591e8cf0 100644
> --- a/gdb/record.c
> +++ b/gdb/record.c
> @@ -494,6 +494,9 @@ get_insn_history_modifiers (const char **arg)
> case 'r':
> modifiers |= DISASSEMBLY_RAW_INSN;
> break;
> + case 'x':
> + modifiers |= DISASSEMBLY_HEX_OFFSET;
> + break;
> case 'f':
> modifiers |= DISASSEMBLY_OMIT_FNAME;
> break;
> --
> 2.25.1
>
>
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH v2] disass: Add /x modifier to print offsets in hex
2020-09-24 11:05 ` Andrew Burgess
@ 2020-09-24 12:20 ` Pedro Alves
2020-09-24 13:22 ` Andrew Burgess
0 siblings, 1 reply; 8+ messages in thread
From: Pedro Alves @ 2020-09-24 12:20 UTC (permalink / raw)
To: Andrew Burgess, fam; +Cc: gdb-patches
On 9/24/20 12:05 PM, Andrew Burgess wrote:
> * fam@euphon.net <fam@euphon.net> [2020-09-23 10:19:06 +0000]:
>
>> From: Fam Zheng <famzheng@amazon.com>
>>
>> Backtrace messages printed by Linux kernel and Xen have hex offsets,
>> e.g.:
>>
>> (XEN) Xen call trace:
>> (XEN) [<ffff82d0402eefbb>] R guest_walk_tables_2_levels+0x189/0x66d
>> (XEN) [<ffff82d0402edbbd>] F hap_p2m_ga_to_gfn_2_levels+0x112/0x25b
>> (XEN) [<ffff82d0402edd22>] F hap_gva_to_gfn_2_levels+0x1c/0x1e
>> (XEN) [<ffff82d0402f832e>] F paging_gva_to_gfn+0x14a/0x167
>>
>> Having this modifier saves converting between hex values from the
>> backtrace log and offsets in gdb disass output.
>>
>> ---
>>
>> v2: Drop a overlooked change on file header.
>> ---
>> gdb/cli/cli-cmds.c | 17 ++++++++++++-----
>> gdb/disasm.c | 6 +++++-
>> gdb/disasm.h | 1 +
>> gdb/record.c | 3 +++
>> 4 files changed, 21 insertions(+), 6 deletions(-)
>>
>> diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
>> index e3965fea07..2266f67695 100644
>> --- a/gdb/cli/cli-cmds.c
>> +++ b/gdb/cli/cli-cmds.c
>> @@ -1456,12 +1456,12 @@ disassemble_current_function (gdb_disassembly_flags flags)
>> /* Dump a specified section of assembly code.
>>
>> Usage:
>> - disassemble [/mrs]
>> + disassemble [/mrsx]
>> - dump the assembly code for the function of the current pc
>> - disassemble [/mrs] addr
>> + disassemble [/mrsx] addr
>> - dump the assembly code for the function at ADDR
>> - disassemble [/mrs] low,high
>> - disassemble [/mrs] low,+length
>> + disassemble [/mrsx] low,high
>> + disassemble [/mrsx] low,+length
>> - dump the assembly code in the range [LOW,HIGH), or [LOW,LOW+length)
>>
>> A /m modifier will include source code with the assembly in a
>> @@ -1472,6 +1472,8 @@ disassemble_current_function (gdb_disassembly_flags flags)
>>
>> A /r modifier will include raw instructions in hex with the assembly.
>>
>> + A /x modifier will print offsets in hex.
>
> Shouldn't this be 'An /x modified ...' ? Saying it out loud it
> certainly seems that way.
Not if you read it as "a slash x modifier".
I would guess that that's why it's also written "A /r" and "A /m modifier"?
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] disass: Add /x modifier to print offsets in hex
2020-09-24 12:20 ` Pedro Alves
@ 2020-09-24 13:22 ` Andrew Burgess
0 siblings, 0 replies; 8+ messages in thread
From: Andrew Burgess @ 2020-09-24 13:22 UTC (permalink / raw)
To: Pedro Alves; +Cc: fam, gdb-patches
* Pedro Alves <pedro@palves.net> [2020-09-24 13:20:56 +0100]:
> On 9/24/20 12:05 PM, Andrew Burgess wrote:
> > * fam@euphon.net <fam@euphon.net> [2020-09-23 10:19:06 +0000]:
> >
> >> From: Fam Zheng <famzheng@amazon.com>
> >>
> >> Backtrace messages printed by Linux kernel and Xen have hex offsets,
> >> e.g.:
> >>
> >> (XEN) Xen call trace:
> >> (XEN) [<ffff82d0402eefbb>] R guest_walk_tables_2_levels+0x189/0x66d
> >> (XEN) [<ffff82d0402edbbd>] F hap_p2m_ga_to_gfn_2_levels+0x112/0x25b
> >> (XEN) [<ffff82d0402edd22>] F hap_gva_to_gfn_2_levels+0x1c/0x1e
> >> (XEN) [<ffff82d0402f832e>] F paging_gva_to_gfn+0x14a/0x167
> >>
> >> Having this modifier saves converting between hex values from the
> >> backtrace log and offsets in gdb disass output.
> >>
> >> ---
> >>
> >> v2: Drop a overlooked change on file header.
> >> ---
> >> gdb/cli/cli-cmds.c | 17 ++++++++++++-----
> >> gdb/disasm.c | 6 +++++-
> >> gdb/disasm.h | 1 +
> >> gdb/record.c | 3 +++
> >> 4 files changed, 21 insertions(+), 6 deletions(-)
> >>
> >> diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
> >> index e3965fea07..2266f67695 100644
> >> --- a/gdb/cli/cli-cmds.c
> >> +++ b/gdb/cli/cli-cmds.c
> >> @@ -1456,12 +1456,12 @@ disassemble_current_function (gdb_disassembly_flags flags)
> >> /* Dump a specified section of assembly code.
> >>
> >> Usage:
> >> - disassemble [/mrs]
> >> + disassemble [/mrsx]
> >> - dump the assembly code for the function of the current pc
> >> - disassemble [/mrs] addr
> >> + disassemble [/mrsx] addr
> >> - dump the assembly code for the function at ADDR
> >> - disassemble [/mrs] low,high
> >> - disassemble [/mrs] low,+length
> >> + disassemble [/mrsx] low,high
> >> + disassemble [/mrsx] low,+length
> >> - dump the assembly code in the range [LOW,HIGH), or [LOW,LOW+length)
> >>
> >> A /m modifier will include source code with the assembly in a
> >> @@ -1472,6 +1472,8 @@ disassemble_current_function (gdb_disassembly_flags flags)
> >>
> >> A /r modifier will include raw instructions in hex with the assembly.
> >>
> >> + A /x modifier will print offsets in hex.
> >
> > Shouldn't this be 'An /x modified ...' ? Saying it out loud it
> > certainly seems that way.
>
> Not if you read it as "a slash x modifier".
>
> I would guess that that's why it's also written "A /r" and "A /m modifier"?
I withdraw my suggestion then.
Sorry for the noise.
Andrew
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2020-09-24 13:22 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-23 10:19 [PATCH v2] disass: Add /x modifier to print offsets in hex fam
2020-09-23 10:39 ` Andreas Schwab
2020-09-23 11:12 ` Fam Zheng
2020-09-24 3:25 ` Simon Marchi
2020-09-24 7:26 ` Fam Zheng
2020-09-24 11:05 ` Andrew Burgess
2020-09-24 12:20 ` Pedro Alves
2020-09-24 13:22 ` Andrew Burgess
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox