From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12920 invoked by alias); 25 Jul 2010 18:55:38 -0000 Received: (qmail 12911 invoked by uid 22791); 25 Jul 2010 18:55:38 -0000 X-SWARE-Spam-Status: No, hits=-6.0 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, 25 Jul 2010 18:55:23 +0000 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o6PItFtC017421 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 25 Jul 2010 14:55:15 -0400 Received: from host1.dyn.jankratochvil.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o6PItDJ2008623 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 25 Jul 2010 14:55:14 -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 o6PItClm030014; Sun, 25 Jul 2010 20:55:12 +0200 Received: (from jkratoch@localhost) by host1.dyn.jankratochvil.net (8.14.4/8.14.4/Submit) id o6PItCPM030013; Sun, 25 Jul 2010 20:55:12 +0200 Date: Sun, 25 Jul 2010 18:55:00 -0000 From: Jan Kratochvil To: Pedro Alves Cc: gdb-patches@sourceware.org Subject: Re: [patch] Fix linux-ia64 on SIGILL for deleted breakpoint [cleanup] Message-ID: <20100725185512.GA29794@host1.dyn.jankratochvil.net> References: <20100719085817.GA24395@host1.dyn.jankratochvil.net> <201007201428.59184.pedro@codesourcery.com> <20100723221935.GA7020@host1.dyn.jankratochvil.net> <201007242326.05269.pedro@codesourcery.com> <20100725185217.GA24476@host1.dyn.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100725185217.GA24476@host1.dyn.jankratochvil.net> 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/msg00388.txt.bz2 Hi Pedro, add-on patch to make the code less magic a bit. No regressions on {x86_64,x86_64-m32,i686}-fedora13-linux-gnu. Tested gdb.threads/ia64-sigill.exp on ia64-rhel55-linux-gnu. Thanks, Jan gdb/ 2010-07-25 Jan Kratochvil * linux-nat.c (linux_nat_lp_status_is_event): New function. (count_events_callback, select_event_lwp_callback) (cancel_breakpoints_callback, linux_nat_wait_1): Use it. --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -2617,6 +2617,20 @@ sigtrap_is_event (int status) static int (*linux_nat_status_is_event) (int status) = sigtrap_is_event; +/* Check for SIGTRAP-like events in LP. */ + +static int +linux_nat_lp_status_is_event (struct lwp_info *lp) +{ + /* We check for lp->waitstatus in addition to lp->status, because we can + have pending process exits recorded in lp->status + and W_EXITCODE(0,0) == 0. We should probably have an additional + lp->status_p flag. */ + + return (lp->waitstatus.kind == TARGET_WAITKIND_IGNORE + && linux_nat_status_is_event (lp->status)); +} + /* Set altarnative SIGTRAP-like events recognizer. If breakpoint_inserted_here_p there then gdbarch_decr_pc_after_break will be applied. */ @@ -2823,8 +2837,7 @@ count_events_callback (struct lwp_info *lp, void *data) gdb_assert (count != NULL); /* Count only resumed LWPs that have a SIGTRAP event pending. */ - if (lp->status != 0 && lp->resumed - && linux_nat_status_is_event (lp->status)) + if (lp->resumed && linux_nat_lp_status_is_event (lp)) (*count)++; return 0; @@ -2851,8 +2864,7 @@ select_event_lwp_callback (struct lwp_info *lp, void *data) gdb_assert (selector != NULL); /* Select only resumed LWPs that have a SIGTRAP event pending. */ - if (lp->status != 0 && lp->resumed - && linux_nat_status_is_event (lp->status)) + if (lp->resumed && linux_nat_lp_status_is_event (lp)) if ((*selector)-- == 0) return 1; @@ -2912,9 +2924,7 @@ cancel_breakpoints_callback (struct lwp_info *lp, void *data) delete or disable the breakpoint, but the LWP will have already tripped on it. */ - if (lp->waitstatus.kind == TARGET_WAITKIND_IGNORE - && lp->status != 0 - && linux_nat_status_is_event (lp->status) + if (linux_nat_lp_status_is_event (lp) && cancel_breakpoint (lp)) /* Throw away the SIGTRAP. */ lp->status = 0; @@ -3433,8 +3443,7 @@ retry: always cancels breakpoint hits in all threads. */ if (non_stop - && lp->waitstatus.kind == TARGET_WAITKIND_IGNORE - && linux_nat_status_is_event (lp->status) + && linux_nat_lp_status_is_event (lp) && cancel_breakpoint (lp)) { /* Throw away the SIGTRAP. */