From: Pedro Alves <pedro@codesourcery.com>
To: gdb-patches@sourceware.org
Cc: "Ulrich Weigand" <uweigand@de.ibm.com>
Subject: Re: Fix foll-fork.exp foll-vfork.exp fork-child-threads.exp
Date: Fri, 21 Nov 2008 01:35:00 -0000 [thread overview]
Message-ID: <200811201506.04087.pedro@codesourcery.com> (raw)
In-Reply-To: <200811201428.mAKESPGZ013059@d12av02.megacenter.de.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 435 bytes --]
On Thursday 20 November 2008 14:28:24, Ulrich Weigand wrote:
> I guess the "regcache" and "gdbarch" variables now also contain stale
> information. That's not an actual problem right now, as regcache is
> (currently) not used after this point, and gdbarch (today) will never
> actually change -- but in order to reduce potential future problems,
> I think those should also be reset.
Right, how about the attached?
--
Pedro Alves
[-- Attachment #2: foll_fork_dang2.diff --]
[-- Type: text/x-diff, Size: 1241 bytes --]
2008-11-20 Pedro Alves <pedro@codesourcery.com>
* infrun.c (resume): If following a fork, also reset regcache,
gdbarch and pc.
---
gdb/infrun.c | 6 ++++++
1 file changed, 6 insertions(+)
Index: src/gdb/infrun.c
===================================================================
--- src.orig/gdb/infrun.c 2008-11-20 14:59:05.000000000 +0000
+++ src/gdb/infrun.c 2008-11-20 15:03:21.000000000 +0000
@@ -965,10 +965,13 @@ resume (int step, enum target_signal sig
{
int should_resume = 1;
struct cleanup *old_cleanups = make_cleanup (resume_cleanups, 0);
+
+ /* Note that these must be reset if we follow a fork below. */
struct regcache *regcache = get_current_regcache ();
struct gdbarch *gdbarch = get_regcache_arch (regcache);
struct thread_info *tp = inferior_thread ();
CORE_ADDR pc = regcache_read_pc (regcache);
+
QUIT;
if (debug_infrun)
@@ -1057,6 +1060,9 @@ a command like `return' or `jump' to con
/* Following a child fork will change our notion of current
thread. */
tp = inferior_thread ();
+ regcache = get_current_regcache ();
+ gdbarch = get_regcache_arch (regcache);
+ pc = regcache_read_pc (regcache);
break;
case TARGET_WAITKIND_EXECD:
next prev parent reply other threads:[~2008-11-20 15:06 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-20 19:15 Pedro Alves
2008-11-20 23:52 ` Ulrich Weigand
2008-11-21 1:35 ` Pedro Alves [this message]
2008-11-21 1:49 ` Ulrich Weigand
2008-11-21 2:09 ` Pedro Alves
2008-11-21 11:40 ` Ulrich Weigand
2008-11-21 12:58 ` Pedro Alves
2008-12-01 19:01 ` Michael Snyder
2008-12-01 20:56 ` Daniel Jacobowitz
2008-12-01 22:36 ` Michael Snyder
2008-12-01 21:06 ` Pedro Alves
2008-12-01 22:38 ` Michael Snyder
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=200811201506.04087.pedro@codesourcery.com \
--to=pedro@codesourcery.com \
--cc=gdb-patches@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