Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: Siva Chandra <sivachandra@google.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFC] Fix for gdb.parameter('architecture') returning empty string
Date: Fri, 02 Nov 2012 16:59:00 -0000	[thread overview]
Message-ID: <87r4ocosah.fsf@fleche.redhat.com> (raw)
In-Reply-To: <CAGyQ6gwrvdUmUzmxbt89EFvmbSwau9Pw_vGBShwcOuw0TJheZg@mail.gmail.com>	(Siva Chandra's message of "Fri, 2 Nov 2012 06:44:43 -0700")

>>>>> "Siva" == Siva Chandra <sivachandra@google.com> writes:

Tom> I suspect this means that gdb.parameter('architecture') will not always
Tom> show the same result as "show architecture".

Siva> I do not understand this completely. In my patch, show_architecture
Siva> only prints 'architecture_string'. Hence,
Siva> gdb.parameter('architecture') and "show architecture" should always
Siva> show the same result. Did I miss something?

Ok, I see.  Your patch removes the call to get_current_arch.
I missed that somehow before, sorry about that.

I think this just means that "show architecture" will now show incorrect
results, though.

Tom> But from what I can tell, the architecture-change observer is not
Tom> notified in every situation that might cause that function to return a
Tom> different result.

Siva> Pardon my ignorance here, does target arch change between frames?

I'm reasonably ignorant here myself.  I believe the answer is "yes",
albeit AFAIK just on SPU systems.

Tom> I think a better approach might be to address the problem of "auto" gdb
Tom> parameters more globally.  For example, we could add a method to the
Tom> appropriate CLI object so that the Python could call this to get the
Tom> correct current value.

Siva> Do you mean that the CLI object should have a method (which can
Siva> evaluate the property value on the go), rather than a property like
Siva> 'architecture_string' and 'endian_string'? If yes, do you envision
Siva> that Python make use of the method if it exists, otherwise use the
Siva> property?

Yes.  In this example, the method would resemble the current
show_architecture, but it would just return the name of the current
architecture, rather than all the surrounding text.

This method is only needed for "auto-capable" parameters.

One wrinkle in this plan is that the method in question would have to
return a union type, since parameters have different underlying
representations.


BTW, what is it you are using this for?  I think in many cases it is
preferable for us to expose more API directly rather than rely on CLI
settings.  E.g., if your code needs the architecture, find a way to
intelligently expose gdbarch on frames, types, etc.

Tom


  reply	other threads:[~2012-11-02 16:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-13 23:43 Siva Chandra
2012-10-14  7:53 ` Andreas Schwab
2012-10-14  8:37   ` Siva Chandra
2012-10-22  7:16     ` Siva Chandra
2012-11-01 20:19 ` Tom Tromey
2012-11-02 13:44   ` Siva Chandra
2012-11-02 16:59     ` Tom Tromey [this message]
2012-11-02 18:45       ` Siva Chandra
2012-11-02 19:52         ` Tom Tromey
2012-11-05 10:39         ` Phil Muldoon

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=87r4ocosah.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=sivachandra@google.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