From: David Miller <davem@davemloft.net>
To: gdb-patches@sourceware.org
Subject: [PATCH] Fix regcache_restore() handling of unavailable regs.
Date: Tue, 11 Oct 2011 06:40:00 -0000 [thread overview]
Message-ID: <20111011.024027.2269565520682513251.davem@davemloft.net> (raw)
Across inferior dummy calls, regcache entries which were "unavailable"
were restored incorrectly after such dummy calls. The problem is
incorrect interpretation of cooked_read()'s return value in
regcache_restore().
Ok to commit?
BTW, regcache_restore() seems to not be used outside of regcache.c
any more. We should probably mark it static and remove the extern
from regcache.h
gdb/
* regcache.c (regcache_restore): Do not write unavailable regs.
diff --git a/gdb/regcache.c b/gdb/regcache.c
index 37092f8..3fb6811 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -351,9 +351,10 @@ regcache_restore (struct regcache *dst,
{
if (gdbarch_register_reggroup_p (gdbarch, regnum, restore_reggroup))
{
- int valid = cooked_read (cooked_read_context, regnum, buf);
+ enum register_status status;
- if (valid)
+ status = cooked_read (cooked_read_context, regnum, buf);
+ if (status == REG_VALID)
regcache_cooked_write (dst, regnum, buf);
}
}
next reply other threads:[~2011-10-11 6:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-11 6:40 David Miller [this message]
2011-10-11 10:45 ` Pedro Alves
2011-10-11 18:28 ` David Miller
2011-10-11 10:50 ` Pedro Alves
2011-10-11 18:28 ` David Miller
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=20111011.024027.2269565520682513251.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=gdb-patches@sourceware.org \
/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