From: Pedro Alves <palves@redhat.com>
To: Tom Tromey <tromey@redhat.com>
Cc: Joel Brobecker <brobecker@adacore.com>, gdb-patches@sourceware.org
Subject: Re: [RFC] Document replacement for frame_register_read (deprecated).
Date: Fri, 09 Nov 2012 00:10:00 -0000 [thread overview]
Message-ID: <509C49E0.8070404@redhat.com> (raw)
In-Reply-To: <87objtf6mu.fsf@fleche.redhat.com>
On 10/23/2012 06:19 PM, Tom Tromey wrote:
>>>>>> "Joel" == Joel Brobecker <brobecker@adacore.com> writes:
>
> Joel> This is inspired by a discussion from a long time ago:
> Joel> http://www.sourceware.org/ml/gdb-patches/2011-03/msg01095.html
>
> Joel> If you agree with the patch, we will also have to update the ARI
> Joel> script to mention get_frame_register_value as the alternative.
>
> Joel> And we might also want to rename the function as well. I don't think
> Joel> we can rely on the ARI alone to avoid new uses of this function.
> Joel> And once new uses are in, it's much harder to make sure we undo them.
>
> Joel> Thoughts?
>
> The patch seems reasonable to me.
Me too.
>
> Renaming seems like a decent idea, since there is a use in jit.c, which
> was added long after this was deprecated.
Yeah.
> I count 22 mentions (including the declaration) of frame_register_read
> in the tree right now. Getting rid of all of them doesn't seem so
> difficult, aside from the testing. This would be clearly better...
>
> At least one of the current uses seems suspicious since it ignores the
> result. I assume I'm missing some context though.
I took a look too.
> frame.c:775:do_frame_register_read (void *src, int regnum, gdb_byte *buf)
> frame.c:777: if (!frame_register_read (src, regnum, buf))
Probably innocuous, but need to check if there's a path that calls
this for frames other than #0, or if possible to get here for cores and
tracing (IIRC, this is used for infcalls, which can't work on those cases).
If so, since failure always maps to REG_UNAVAILABLE, we're losing info here.
> frame.c:1218: frame_register_read (frame, regnum, buf);
A read-modify-write that doesn't take in account whether the read
was successful. Can't be good.
> i386-tdep.c:1748: && frame_register_read (this_frame, cache->saved_sp_reg, buf))
I think it's okay.
> infcmd.c:2052: if (! frame_register_read (frame, i, value_contents_raw (val)))
I guess we should be saying "*optimized out*" if the register is not saved, and
leave "*value not available*" for the case where we can't get at it because it's
missing from the truncated core or from the tracebuffer.
> jit.c:1056: value->defined = frame_register_read (priv->this_frame, gdb_reg,
No idea.
> mips-tdep.c:4606: if (!frame_register_read (frame, regno, raw_buffer))
> mips-tdep.c:4643: if (!frame_register_read (frame, regno, rare_buffer))
> mips-tdep.c:4879: if (!frame_register_read (frame, regnum, raw_buffer))
> mt-tdep.c:688: frame_register_read (frame, regnum, buff);
> mt-tdep.c:713: frame_register_read (frame, MT_COPRO_REGNUM, buf);
> mt-tdep.c:734: frame_register_read (frame, MT_MAC_REGNUM, buf);
> mt-tdep.c:740: frame_register_read (frame, MT_EXMAC_REGNUM, buf);
> sh64-tdep.c:2054: if (!frame_register_read (frame, regnum, raw_buffer))
> sh64-tdep.c:2170: if (!frame_register_read (frame, regnum, raw_buffer))
All these should be fixed to handle unavailableness gracefully. It just
hasn't been pressing no target with with arch can do tracepoints,
AFAIK (though there are other ways the registers could be missing).
--
Pedro Alves
next prev parent reply other threads:[~2012-11-09 0:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-22 21:38 Joel Brobecker
2012-10-23 17:19 ` Tom Tromey
2012-11-09 0:10 ` Pedro Alves [this message]
2012-11-12 21:32 ` Joel Brobecker
2012-11-12 22:01 ` Joel Brobecker
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=509C49E0.8070404@redhat.com \
--to=palves@redhat.com \
--cc=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=tromey@redhat.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