This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Add a new modifier /c to "disassemble" command to make it output binary code

>>>>> ">" == Hui Zhu <> writes:

>> 2009-07-09  Hui Zhu  <>
>> 	* 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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]