Re: gdbarch_init, ABI, and registers

Tim Newsome <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <CAGDihek6x2QrFBJPHbzA4JxW56wFpAVp_c3CE+EzOjwOoZJhXA@mail.gmail.com>
On Fri, Dec 8, 2017 at 4:20 AM, Ulrich Weigand <[email protected]> wrote:

> No, this doesn't look correct to me.  Note that it is normal during
> GDB operation that several different gdbarch objects are in use,
> which have somewhat different contents and are used for different
> purposes.
>

Ah! This is super helpful, and what I was missing. I'm adding it as a
comment to `struct gdbarch`.

Am I right in that riscv_gdbarch_init() can differentiate these two cases
based on whether a target description is passed in or not? Eg. if there is
a target description, register structures need to be set up, and if there
isn't then that's not necessary?

I guess I still haven't quite understood why exactly any of this
> is causing a problem for you.  Yes, gdbarch objects returned from
> gdbarch_from_bfd will not have correct register info.  But those
> objects also should never be used in any context where registers
> matter.  Can you be more specific what the actual problem you're
> seeing is?
>

The problem I was seeing is that registers were showing up which shouldn't.
The reason (as I understand it now) is that I was depending on global
variables in riscv-tdep.c instead of putting them in gdbarch.data. I'll
make that change, and hopefully then everything will be better.

Thank you,
Tim
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.