This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH, RFC] Add support for choosing disassembler cpu in GDB for POWER.
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: bergner at vnet dot ibm dot com (Peter Bergner)
- Cc: amodra at gmail dot com (Alan Modra), gdb-patches at sourceware dot org, binutils at sourceware dot org (binutils)
- Date: Fri, 30 Sep 2016 18:19:08 +0200 (CEST)
- Subject: Re: [PATCH, RFC] Add support for choosing disassembler cpu in GDB for POWER.
- Authentication-results: sourceware.org; auth=none
Peter Bergner wrote:
> This patch adds the new GDB commands "set disassembler-cpu <CPU>" and
> "show disassembler-cpu". It also splits the one huge GDB test case into
> multiple test cases without the unneeded file offsets.
>
> Alan and Uli, does this patch look like something we'd like? If we do want
> this, what do you think of the "disassembler-cpu" command name? Is there
> something better to use? Thoughts?
I agree that this looks like a feature that would be nice to have.
The implementation in the patch does appear to be a bit ad-hoc, however :-)
Why would we want to pass that information via a new global variable, if
there is already an element "disassembler_options" in the struct
disassemble_info that GDB passes to bfd? See e.g. i386_print_insn.
I'm also not really happy about the tight integration of opcode/ppc.h
and the ppc_opts struct into GDB code ... Can't we ask a BFD routine
whether a particular CPU option is valid? E.g. by just making a "test"
call to print_insn_* and see if it succeeds?
Apart from those implementation details, I'm wondering whether we might
want to generalize the feature to allow setting any disassembler option,
not just CPU levels. Also, this could really be useful on any platform,
not just Power :-) But I see that some other architectures already use
info->disassembler_options to pass some special options, which might
make the generic solution more complex. Therefore I'd be OK with just
doing the Power implementation for now.
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU/Linux compilers and toolchain
Ulrich.Weigand@de.ibm.com