Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: Hui Zhu <teawater@gmail.com>
Cc: gdb-patches ml <gdb-patches@sourceware.org>
Subject: Re: Add a new modifier /c to "disassemble" command to make it output  	binary code
Date: Thu, 09 Jul 2009 19:22:00 -0000	[thread overview]
Message-ID: <m3fxd5n46v.fsf@fleche.redhat.com> (raw)
In-Reply-To: <daef60380907082335j78b9ae35jaf552124a65022a3@mail.gmail.com> (Hui Zhu's message of "Thu\, 9 Jul 2009 14\:35\:54 +0800")

>>>>> ">" == Hui Zhu <teawater@gmail.com> writes:

>> 2009-07-09  Hui Zhu  <teawater@gmail.com>
>> 	* cli/cli-cmds.c (disassemble_command): Add a new modifier /c
>> 	to "disassemble" command to make it output binary code.
>> 	(init_cli_cmds): Ditto.
>> 	(print_disassembly): Add a new argument "code" to make sure
>> 	output binary code or not.
>> 	(disassemble_current_function): Ditto.
>> 	* mi/mi-cmd-disas.c (mi_cmd_disassemble): Ditto.
>> 	* stack.c (gdb_disassembly_stub): Ditto.
>> 	* disasm.h (gdb_disassembly): Ditto.
>> 	* disasm.c (do_mixed_source_and_assembly): Ditto.
>> 	(do_mixed_source_and_assembly): Ditto.
>> 	(do_assembly_only): Ditto.
>> 	(gdb_disassembly): Ditto.
>> 	(dump_insns): Output the binary code if "code" is true.

I think this patch looks good.

>>  static void
>>  print_disassembly (struct gdbarch *gdbarch, const char *name,
>> -		   CORE_ADDR low, CORE_ADDR high, int mixed)
>> +		   CORE_ADDR low, CORE_ADDR high, int mixed, int code)

I'm slightly more of a fan of the "flags" approach, so that we can
easily add more flags later if we want.  But it isn't a big deal.

>> +With a /c modifier, binary code are included.\n\

I think this would be better as:

With a /c modifier, print the instruction in hex as well as
in symbolic form.

(This is what the objdump documentation says, and I think it is
clearer, by virtue of being more explicit.)

>> +              ui_out_message (uiout, 0, " %02x", (unsigned)data);

I wasn't sure about ui_out_message, and reading the internals docs was
not really enlightening on the subject.  I guess it is probably ok,
but if somebody else knows for sure, I'd like to be better informed.

I think this also needs a change to NEWS.  We mention disassemble/m
there, we ought to mention /c as well.

Please fix the help text; and after a doc review, if nobody has
responded about the ui_out_message thing, I will approve this.

Tom


  reply	other threads:[~2009-07-09 17:42 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-09 12:22 Hui Zhu
2009-07-09 19:22 ` Tom Tromey [this message]
2009-07-09 19:40   ` Eli Zaretskii
2009-07-11  9:28   ` Hui Zhu
2009-07-11 12:42     ` Eli Zaretskii
2009-07-11 14:15       ` Hui Zhu
2009-07-11 17:54         ` Eli Zaretskii
2009-07-11 17:59           ` Hui Zhu
2009-07-11 18:16             ` Regression for mi-disassemble.exp [Re: Add a new modifier /c to "disassemble" command to make it output binary code] Jan Kratochvil
2009-07-17 17:09               ` [commit] Fix mi-disassemble.exp regression Ulrich Weigand
2009-07-18  5:45                 ` Hui Zhu
2009-07-09 19:53 ` Add a new modifier /c to "disassemble" command to make it output binary code Eli Zaretskii
2009-07-09 22:00 ` Michael Snyder
2009-07-09 23:44 ` Doug Evans
2009-07-10  9:33   ` Eli Zaretskii
2009-07-10 14:34   ` Mark Kettenis

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=m3fxd5n46v.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=teawater@gmail.com \
    /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