Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Tim Newsome <tim@sifive.com>
To: Ulrich Weigand <uweigand@de.ibm.com>
Cc: gdb <gdb@sourceware.org>
Subject: Re: gdbarch_init, ABI, and registers
Date: Fri, 08 Dec 2017 20:03:00 -0000	[thread overview]
Message-ID: <CAGDihek6x2QrFBJPHbzA4JxW56wFpAVp_c3CE+EzOjwOoZJhXA@mail.gmail.com> (raw)
In-Reply-To: <20171208122016.B8336D8043A@oc3748833570.ibm.com>

On Fri, Dec 8, 2017 at 4:20 AM, Ulrich Weigand <uweigand@de.ibm.com> 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


  reply	other threads:[~2017-12-08 20:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-06 20:21 Tim Newsome
2017-12-07 14:21 ` Handling language trampoline Dmitry Antipov
2017-12-07 14:58   ` Pedro Alves
2017-12-08  6:39     ` Dmitry Antipov
2017-12-08 11:12       ` Pedro Alves
2017-12-07 21:22 ` gdbarch_init, ABI, and registers Tim Newsome
2017-12-08 12:20   ` Ulrich Weigand
2017-12-08 20:03     ` Tim Newsome [this message]
2017-12-09 11:27       ` Ulrich Weigand

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=CAGDihek6x2QrFBJPHbzA4JxW56wFpAVp_c3CE+EzOjwOoZJhXA@mail.gmail.com \
    --to=tim@sifive.com \
    --cc=gdb@sourceware.org \
    --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