This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] Fix for gdb.parameter('architecture') returning empty string


On Fri, Nov 2, 2012 at 9:58 AM, Tom Tromey <tromey@redhat.com> wrote:

> 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.

This is for my understanding: Can you give an example where this can
give incorrect results. Is it only for the case when the arch can
change from frame to frame? I have tested for all cases that I could
think of and it seems fine.

> 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.

For now, I have been using gdb.execute("show architecture",
to_string=True) and getting the value from the resulting string. I am
trying to tidy that up by using gdb.parameter(...). And, for my work,
exposing arch from frames will work as I need the arch during an
active frame only. I see two items here then:

1. Fix gdb.parameter by the way of using methods on CLI objects.
2. Expose current frame arch through the gdb.Frame class.

Do they seem reasonable?

Thanks,
Siva Chandra


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]