From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22647 invoked by alias); 20 Nov 2008 15:06:42 -0000 Received: (qmail 22572 invoked by uid 22791); 20 Nov 2008 15:06:41 -0000 X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 20 Nov 2008 15:06:06 +0000 Received: (qmail 8773 invoked from network); 20 Nov 2008 15:06:04 -0000 Received: from unknown (HELO orlando.local) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 20 Nov 2008 15:06:04 -0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: Re: Fix foll-fork.exp foll-vfork.exp fork-child-threads.exp Date: Fri, 21 Nov 2008 01:35:00 -0000 User-Agent: KMail/1.9.10 Cc: "Ulrich Weigand" References: <200811201428.mAKESPGZ013059@d12av02.megacenter.de.ibm.com> In-Reply-To: <200811201428.mAKESPGZ013059@d12av02.megacenter.de.ibm.com> MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_czXJJvTZznDvQ/H" Message-Id: <200811201506.04087.pedro@codesourcery.com> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-11/txt/msg00560.txt.bz2 --Boundary-00=_czXJJvTZznDvQ/H Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Content-length: 435 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 --Boundary-00=_czXJJvTZznDvQ/H Content-Type: text/x-diff; charset="iso 8859-15"; name="foll_fork_dang2.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="foll_fork_dang2.diff" Content-length: 1241 2008-11-20 Pedro Alves * 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: --Boundary-00=_czXJJvTZznDvQ/H--