From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: bergner@vnet.ibm.com (Peter Bergner)
Cc: palves@redhat.com (Pedro Alves), amodra@gmail.com (Alan Modra),
gdb-patches@sourceware.org,
binutils@sourceware.org (binutils)
Subject: Re: [PATCH, RFC] Add support for choosing disassembler cpu in GDB for POWER.
Date: Fri, 28 Oct 2016 12:32:00 -0000 [thread overview]
Message-ID: <20161028123236.51A6210B91A@oc8523832656.ibm.com> (raw)
In-Reply-To: <ba2c8e0f-eb8e-d0b9-313c-022c61ebb9ab@vnet.ibm.com> from "Peter Bergner" at Oct 26, 2016 07:04:12 PM
Peter Bergner wrote:
> > Another option might be to refactor the way disassembler options
> > output is done in opcodes, e.g. by having platform-specific code
> > only provide an array of tuples of option names and explanatory
> > strings, and move the actual printing to common code. Then those
> > arrays could be exported to and reused by GDB. (In particular,
> > there's really no way to do a completer without such information.)
>
> How about what I implemented below?
Mostly yes. However, I had been thinking of moving more of this
stuff to common code. In particular, once the gdbarch has provided
a list of supported options, then all this:
> +static void
> +set_disassembler_options (char *args, int from_tty, struct cmd_list_element *c)
> +{
> + struct gdbarch *gdbarch = get_current_arch ();
> + if (gdbarch_set_disassembler_options_p (gdbarch))
> + {
> + gdbarch_set_disassembler_options (gdbarch, args, from_tty, c);
> + return;
> + }
> + fprintf_filtered (gdb_stdlog, _("\
> +'set disassembler' is not supported on this architecture.\n"));
> +}
> +
> +static void
> +show_disassembler_options (struct ui_file *file, int from_tty,
> + struct cmd_list_element *c, const char *value)
> +{
> + struct gdbarch *gdbarch = get_current_arch ();
> + if (gdbarch_show_disassembler_options_p (gdbarch))
> + {
> + gdbarch_show_disassembler_options (gdbarch, file, from_tty, c, value);
> + return;
> + }
> + fprintf_filtered (gdb_stdlog, _("\
> +'show disassembler' is not supported on this architecture.\n"));
> +}
> +
> +/* A completion function for "set disassembler". */
> +
> +static VEC (char_ptr) *
> +disassembler_options_completer (struct cmd_list_element *ignore,
> + const char *text, const char *word)
> +{
> + struct gdbarch *gdbarch = get_current_arch ();
> + if (gdbarch_disassembler_options_completer_p (gdbarch))
> + return gdbarch_disassembler_options_completer (gdbarch, ignore, text, word);
> + return NULL;
> +}
really can be handled generically in common code, right? I.e.
set_disassembler_options verifies the string is a comma-separated
list of words from the supported option list, show_disassembler_options
simply displays the supported option list, etc.
In fact, once the option processing is done in common code, we don't
even really need the per-gdbarch disassemble_init_for_target option
any more, since common code could simply set the disassembler_options
string before calling disassemble_init_for_target.
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU/Linux compilers and toolchain
Ulrich.Weigand@de.ibm.com
next prev parent reply other threads:[~2016-10-28 12:32 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-30 2:14 Peter Bergner
2016-09-30 17:55 ` Ulrich Weigand
2016-10-03 20:25 ` Peter Bergner
2016-10-03 22:25 ` Alan Modra
2016-10-06 3:00 ` Peter Bergner
2016-10-06 4:44 ` Alan Modra
2016-10-06 9:52 ` Pedro Alves
2016-10-06 19:26 ` Peter Bergner
2016-10-07 19:21 ` Ulrich Weigand
2016-10-07 21:01 ` Peter Bergner
2016-10-08 14:39 ` Ulrich Weigand
2016-10-10 23:28 ` Peter Bergner
2016-10-12 8:08 ` Ulrich Weigand
2016-10-12 10:46 ` Pedro Alves
2016-10-11 0:09 ` Pedro Alves
2016-10-11 18:49 ` Peter Bergner
2016-10-12 8:25 ` Ulrich Weigand
2016-10-27 0:04 ` Peter Bergner
2016-10-27 9:40 ` Pedro Alves
2016-10-28 13:47 ` Peter Bergner
2016-10-28 14:10 ` Pedro Alves
2016-10-28 14:24 ` Peter Bergner
2016-10-28 14:30 ` Pedro Alves
2016-10-28 14:53 ` Peter Bergner
2016-11-03 11:01 ` Pedro Alves
2016-11-03 15:02 ` Peter Bergner
2016-11-03 15:06 ` Peter Bergner
2016-11-03 16:41 ` Ulrich Weigand
2016-11-03 16:49 ` Peter Bergner
2016-10-28 12:32 ` Ulrich Weigand [this message]
2016-10-28 13:45 ` Peter Bergner
2016-10-28 14:15 ` Ulrich Weigand
2016-10-28 15:02 ` Peter Bergner
2016-10-28 18:47 ` Ulrich Weigand
2016-11-02 23:28 ` Peter Bergner
2016-10-12 19:35 ` Pedro Alves
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=20161028123236.51A6210B91A@oc8523832656.ibm.com \
--to=uweigand@de.ibm.com \
--cc=amodra@gmail.com \
--cc=bergner@vnet.ibm.com \
--cc=binutils@sourceware.org \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.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