public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Yao Qi <qiyaoltc@gmail.com>
Cc: Peter Bergner <bergner@vnet.ibm.com>,
	       "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
	       Alan Modra <amodra@gmail.com>,
	Ulrich Weigand <uweigand@de.ibm.com>,
	       Eli Zaretskii <eliz@gnu.org>,
	Nick Clifton <nickc@redhat.com>,
	       binutils <binutils@sourceware.org>
Subject: Re: [PATCH, updated] Add support for setting disassembler-options in GDB for POWER, ARM and S390
Date: Tue, 14 Feb 2017 17:35:00 -0000	[thread overview]
Message-ID: <727ccb3d-29d3-02ef-7993-2a720d244f06@redhat.com> (raw)
In-Reply-To: <CAH=s-PORT5jzW+xsQzNmFLNrpGyLefuBmbZd8SQhujb6t6LtuA@mail.gmail.com>

On 02/14/2017 05:21 PM, Yao Qi wrote:
> 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).

Then I'm a bit surprised, since that was not what was discussed
earlier, here <https://sourceware.org/ml/gdb-patches/2016-11/msg00043.html>:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> I didn't realize we could have multiple gdbarchs for the same
> arch live at the same time.  Do you have a suggestion on how
> to fix this?  Maybe each arch will have its own *-tdep.c global
> var to hold it and maybe store a pointer to that in the gdbarch?

Yeah, that sounds like the simplest way to handle it.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In order to implement the above, the gdbarch should be storing
a "char **", but it is storing a "char *" instead:

  +v:char *:disassembler_options:::0:0::0:pstring (gdbarch->disassembler_options)

So I don't know why the current patch is doing it differently,
and I was going by that earlier discussion.

> My suggestion about using "struct gdbarch_data *" doesn't change the
> the behaviour.

Thanks for checking.  So the question now is why does the
current patch want to behave like that.  :-)

Thanks,
Pedro Alves

  reply	other threads:[~2017-02-14 17:35 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-08 21:03 Peter Bergner
2017-02-13 15:53 ` Yao Qi
2017-02-13 16:31   ` Peter Bergner
2017-02-13 16:58   ` Pedro Alves
2017-02-13 17:32     ` Peter Bergner
2017-02-14 17:21     ` Yao Qi
2017-02-14 17:35       ` Pedro Alves [this message]
2017-02-13 17:08   ` Peter Bergner
2017-02-13 18:48   ` Peter Bergner
2017-02-14 20:01     ` Pedro Alves
2017-02-15 23:14       ` Peter Bergner
2017-02-15 23:48         ` Alan Modra
2017-02-16  0:21         ` Pedro Alves
2017-02-16  1:59           ` Peter Bergner
2017-02-16  2:09             ` Pedro Alves
2017-02-13 18:52 ` Peter Bergner

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=727ccb3d-29d3-02ef-7993-2a720d244f06@redhat.com \
    --to=palves@redhat.com \
    --cc=amodra@gmail.com \
    --cc=bergner@vnet.ibm.com \
    --cc=binutils@sourceware.org \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=nickc@redhat.com \
    --cc=qiyaoltc@gmail.com \
    --cc=uweigand@de.ibm.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).