From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2769 invoked by alias); 18 Feb 2011 16:48:47 -0000 Received: (qmail 2739 invoked by uid 22791); 18 Feb 2011 16:48:44 -0000 X-SWARE-Spam-Status: No, hits=-1.3 required=5.0 tests=AWL,BAYES_00,MSGID_MULTIPLE_AT X-Spam-Check-By: sourceware.org Received: from mailhost.u-strasbg.fr (HELO mailhost.u-strasbg.fr) (130.79.200.153) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 18 Feb 2011 16:48:39 +0000 Received: from md2.u-strasbg.fr (md2.u-strasbg.fr [IPv6:2001:660:2402::187]) by mailhost.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id p1IGmNn1045242 ; Fri, 18 Feb 2011 17:48:24 +0100 (CET) (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from mailserver.u-strasbg.fr (ms8.u-strasbg.fr [130.79.204.17]) by md2.u-strasbg.fr (8.14.4/jtpda-5.5pre1) with ESMTP id p1IGmMfA064280 ; Fri, 18 Feb 2011 17:48:22 +0100 (CET) (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from E6510Muller (gw-ics.u-strasbg.fr [130.79.210.225]) (user=mullerp mech=LOGIN) by mailserver.u-strasbg.fr (8.14.4/jtpda-5.5pre1) with ESMTP id p1IGmKtT040639 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO) ; Fri, 18 Feb 2011 17:48:21 +0100 (CET) (envelope-from pierre.muller@ics-cnrs.unistra.fr) From: "Pierre Muller" To: "'Keith Seitz'" , "'Michael Snyder'" Cc: , References: <4D5C71F6.80208@vmware.com> <4D5C7552.4010708@vmware.com> <4D5C8312.4030701@vmware.com> <4D5D6D83.8030302@vmware.com> <4D5D8974.5030205@redhat.com> In-Reply-To: <4D5D8974.5030205@redhat.com> Subject: [RFA] Fix for testsuite errors with gdbserver (remote) Date: Fri, 18 Feb 2011 16:50:00 -0000 Message-ID: <000901cbcf8b$a7e35b50$f7aa11f0$@muller@ics-cnrs.unistra.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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: 2011-02/txt/msg00474.txt.bz2 > Nonetheless, if you pass target_gdbarch instead to ensure_python_env in > python_inferior_exit (in python/py_inferior.c), things will behave much > better. Once again, I don't know if this is strictly correct, but it > should at least get you going with gdbserver again. > > I hope this leads someone to a better solution. I investigated a little further and it seems to me that the problem is that instead of a null_ptid, the TARGET_WAITKIND_EXITED event has a (pid,0,0) form, which is also not a valid thread, but doesn't get filtered out yet by has_stack_frames before calling is_exited. I first wanted to add a test "lwp == 0 && tid == 0" inside has_stack_frames, but as I was not sure that other target could not have valid thread with a zero identifier, I thought it would be safer to look for a fix inside remote specific code. Inverting two lines in remote_close fixes hopefully this issue. At least using --target_board=native_gdbsderver.exp works again! Is this patch OK? 2011-02-18 Pierre Muller * remote.c (remote_close): Reset INFERIOR_PTID to NULL_PTID before calling discard_all_inferiors. Index: src/gdb/remote.c =================================================================== RCS file: /cvs/src/src/gdb/remote.c,v retrieving revision 1.434 diff -u -p -r1.434 remote.c --- src/gdb/remote.c 14 Feb 2011 11:22:29 -0000 1.434 +++ src/gdb/remote.c 18 Feb 2011 16:41:42 -0000 @@ -2908,9 +2908,11 @@ remote_close (int quitting) remote_desc = NULL; /* We don't have a connection to the remote stub anymore. Get rid - of all the inferiors and their threads we were controlling. */ - discard_all_inferiors (); + of all the inferiors and their threads we were controlling. + Reset inferior_ptid to null_ptid first, as otherwise has_stack_frames + will be unable to find the thread corresponding to (pid, 0, 0). */ inferior_ptid = null_ptid; + discard_all_inferiors (); /* We're no longer interested in any of these events. */ discard_pending_stop_replies (-1);