This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH, updated] Add support for setting disassembler-options in GDB for POWER, ARM and S390
- From: Yao Qi <qiyaoltc at gmail dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: Peter Bergner <bergner at vnet dot ibm dot com>, "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>, Alan Modra <amodra at gmail dot com>, Ulrich Weigand <uweigand at de dot ibm dot com>, Eli Zaretskii <eliz at gnu dot org>, Nick Clifton <nickc at redhat dot com>, binutils <binutils at sourceware dot org>
- Date: Tue, 14 Feb 2017 17:21:12 +0000
- Subject: Re: [PATCH, updated] Add support for setting disassembler-options in GDB for POWER, ARM and S390
- Authentication-results: sourceware.org; auth=none
- References: <beb0d776-c509-ab82-755a-0b4ff8a7a41a@vnet.ibm.com> <867f4uccky.fsf@gmail.com> <72237b44-c785-c22d-5664-a87c28a9678a@redhat.com>
On Mon, Feb 13, 2017 at 4:58 PM, Pedro Alves <palves@redhat.com> wrote:
> On 02/13/2017 03:52 PM, Yao Qi wrote:
>> These options should be modeled as per-architecture data. We need to
>> define a key to access that data dynamically. grep
>> "static struct gdbarch_data *" in *.c.
>
> If I understand the suggestion correctly, that would make all the different
> POWER (etc.) gdbarch instances have their own instance of the option string.
Hi Pedro,
Peter's patch makes each gdbarch instance has its own instance of
option string set by GDB. Peter's patch adds two things in gdbarch,
+# Functions for allowing a target to modify its disassembler options.
+v:char *:disassembler_options:::0:0::0:pstring (gdbarch->disassembler_options)
+v:const disasm_options_t
*:disassembler_options_arch:::0:0::0:host_address_to_string
(gdbarch->disassembler_options_arch->name
The former one is a string, and it is per-gdbarch-instance. The latter is a
function, which provides all valid options for an arch. Different gdbarch
instances for powerpc, for example, have the same valid options, but each
gdbarch instance will have its own setting (set by GDB command).
With Peter's patch applied,
(gdb) set architecture powerpc:403
The target architecture is assumed to be powerpc:403
(gdb) set disassembler-options ppc32
(gdb) show disassembler-options
The current disassembler options are 'ppc32'
The following disassembler options are supported for use with
the 'set disassembler-options <option>[,<option>...]' command:
403, 405, 440, 464, 476, 601, 603, 604, 620, 7400, 7410, 7450, 7455, 750cl
821, 850, 860, a2, altivec, any, booke, booke32, cell, com, e200z4, e300, e500
e500mc, e500mc64, e5500, e6500, e500x2, efs, power4, power5, power6, power7
power8, power9, ppc, ppc32, 32, ppc64, 64, ppc64bridge, ppcps, pwr, pwr2, pwr4
pwr5, pwr5x, pwr6, pwr7, pwr8, pwr9, pwrx, spe, titan, vle, vsx, htm
/* I changed disassembler options to 'ppc32' for one gdbarch */
/* Then, I switch to a different gdbarch */
(gdb) set architecture powerpc:603
The target architecture is assumed to be powerpc:603
(gdb) show disassembler-options
The current disassembler options are ''
The following disassembler options are supported for use with
the 'set disassembler-options <option>[,<option>...]' command:
403, 405, 440, 464, 476, 601, 603, 604, 620, 7400, 7410, 7450, 7455, 750cl
821, 850, 860, a2, altivec, any, booke, booke32, cell, com, e200z4, e300, e500
e500mc, e500mc64, e5500, e6500, e500x2, efs, power4, power5, power6, power7
power8, power9, ppc, ppc32, 32, ppc64, 64, ppc64bridge, ppcps, pwr, pwr2, pwr4
pwr5, pwr5x, pwr6, pwr7, pwr8, pwr9, pwrx, spe, titan, vle, vsx, htm
(gdb) set disassembler-options ppc64
(gdb) show disassembler-options
The current disassembler options are 'ppc64'
The following disassembler options are supported for use with
the 'set disassembler-options <option>[,<option>...]' command:
403, 405, 440, 464, 476, 601, 603, 604, 620, 7400, 7410, 7450, 7455, 750cl
821, 850, 860, a2, altivec, any, booke, booke32, cell, com, e200z4, e300, e500
e500mc, e500mc64, e5500, e6500, e500x2, efs, power4, power5, power6, power7
power8, power9, ppc, ppc32, 32, ppc64, 64, ppc64bridge, ppcps, pwr, pwr2, pwr4
pwr5, pwr5x, pwr6, pwr7, pwr8, pwr9, pwrx, spe, titan, vle, vsx, htm
> I.e., the POWER gdbarch instance determined for the objfile before the program
> is run or GDB connects to a target would have a different set of options than
> the gdbarch instance created based on the POWER-based XML target description
> returned by the (e.g.), remote server, because those are different
> gdbarch object instances. As a result "set disassembler-options" would
> show different options before and after run/connection (and in other
> situations that use different gdbarch objects).
>
> What Alan's implementation achieves instead is that there's only one option
> value string for the whole family of gdbarchs of a given architecture, like
> POWER vs MIPS, vs x86, etc, so that the disassembler options active persist
> across internal uses of all the different gdbarch instances that
> model variants of the same CPU architecture.
>
My suggestion about using "struct gdbarch_data *" doesn't change the
the behaviour.
--
Yao (齐尧)