From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6911 invoked by alias); 18 Jul 2010 14:51:24 -0000 Received: (qmail 6902 invoked by uid 22791); 18 Jul 2010 14:51:23 -0000 X-SWARE-Spam-Status: No, hits=-5.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 18 Jul 2010 14:51:19 +0000 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o6IEpHEK030775 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sun, 18 Jul 2010 10:51:17 -0400 Received: from host1.dyn.jankratochvil.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o6IEpFE4029936 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sun, 18 Jul 2010 10:51:17 -0400 Received: from host1.dyn.jankratochvil.net (localhost [127.0.0.1]) by host1.dyn.jankratochvil.net (8.14.4/8.14.4) with ESMTP id o6IEpEUH017124 for ; Sun, 18 Jul 2010 16:51:14 +0200 Received: (from jkratoch@localhost) by host1.dyn.jankratochvil.net (8.14.4/8.14.4/Submit) id o6IEpDih017123 for gdb-patches@sourceware.org; Sun, 18 Jul 2010 16:51:13 +0200 Date: Sun, 18 Jul 2010 14:51:00 -0000 From: Jan Kratochvil To: gdb-patches@sourceware.org Subject: [patch] Fix linux-nat.c {,lp->}status typo Message-ID: <20100718145110.GA16697@host1.dyn.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-12-10) 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: 2010-07/txt/msg00270.txt.bz2 Hi, while reading the code I found this suspicious code, IMO a typo. if (WIFSTOPPED (lp->status)) { if (WSTOPSIG (lp->status) != SIGSTOP) [...] } else if (WIFEXITED (status) || WIFSIGNALED (status)) [...] STATUS value is not filtered by linux_nat_filter_event. LP->STATUS is. That "status = 0;" would be better as some __deinitiailize_var (status) but there is no such GCC extension. The DEBUG_LINUX_NAT print could be possibly still STATUS, it depends on the opinion IMO. No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu. (I haven't tried to find an impact of this bug.) Thanks, Jan 2010-07-18 Jan Kratochvil * linux-nat.c (linux_nat_wait_1): Reset STATUS after calling linux_nat_wait_1. Use always LP->STATUS afterwards. --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -3365,6 +3365,9 @@ retry: lp = linux_nat_filter_event (lwpid, status, options); + /* STATUS is now no longer valid, use LP->STATUS instead. */ + status = 0; + if (lp && ptid_is_pid (ptid) && ptid_get_pid (lp->ptid) != ptid_get_pid (ptid)) @@ -3373,7 +3376,7 @@ retry: if (debug_linux_nat) fprintf (stderr, "LWP %ld got an event %06x, leaving pending.\n", - ptid_get_lwp (lp->ptid), status); + ptid_get_lwp (lp->ptid), lp->status); if (WIFSTOPPED (lp->status)) { @@ -3410,7 +3413,7 @@ retry: lp->signalled = 0; } } - else if (WIFEXITED (status) || WIFSIGNALED (status)) + else if (WIFEXITED (lp->status) || WIFSIGNALED (lp->status)) { if (debug_linux_nat) fprintf (stderr, "Process %ld exited while stopping LWPs\n",