From patchwork Tue Mar 11 17:44:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergio Durigan Junior X-Patchwork-Id: 40 Return-Path: X-Original-To: siddhesh@wilcox.dreamhost.com Delivered-To: siddhesh@wilcox.dreamhost.com Received: from homiemail-mx23.g.dreamhost.com (caibbdcaabja.dreamhost.com [208.113.200.190]) by wilcox.dreamhost.com (Postfix) with ESMTP id E67FC360083 for ; Tue, 11 Mar 2014 10:44:53 -0700 (PDT) Received: by homiemail-mx23.g.dreamhost.com (Postfix, from userid 14314964) id 957AA61C2D726; Tue, 11 Mar 2014 10:44:53 -0700 (PDT) X-Original-To: gdb@patchwork.siddhesh.in Delivered-To: x14314964@homiemail-mx23.g.dreamhost.com Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by homiemail-mx23.g.dreamhost.com (Postfix) with ESMTPS id 70CA161C28CA7 for ; Tue, 11 Mar 2014 10:44:53 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:references:date:in-reply-to :message-id:mime-version:content-type; q=dns; s=default; b=g4tuj XAvK61561rJGH+jh35w42i+abqzz96sV7Ui1ZccFrF0JEi8ofNTQ+Qj/vZIXInyd bWu70dtphhkCOFd+s3jWkkdlkKeGYM5DkAS4dsP2S4A+999RxfnXq2pmyGmKsYz6 9scTEsgUayTXVNfO7hPcRqbzbsxzhFJf0TW84k= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:references:date:in-reply-to :message-id:mime-version:content-type; s=default; bh=hJztgSlzRh9 CSBLqlR/ny6GA+mk=; b=W2z13cvZ595MhLSaha7cfTUC6L3cuI0iS5qbCJg0Hqk wMKiZJNYphT2OJ6Ipv3/bXMr0gehkF5DW9fOfzK4JNdsVBsXbExLJkK+YJOwgiH4 EtiLxYoIB5GS2g0TK4+i0aO5otG0TbRp8T1WtmYEEjcT7rOAhypMbbGPqA+ErijM = Received: (qmail 20905 invoked by alias); 11 Mar 2014 17:44:51 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 20893 invoked by uid 89); 11 Mar 2014 17:44:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.4 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 11 Mar 2014 17:44:49 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s2BHimkl029999 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 11 Mar 2014 13:44:48 -0400 Received: from psique (ovpn-113-62.phx2.redhat.com [10.3.113.62]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s2BHiiQM027039 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Tue, 11 Mar 2014 13:44:46 -0400 From: Sergio Durigan Junior To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: [RFC] fix probe-related internal error on AIX References: <1394125335-19182-1-git-send-email-tromey@redhat.com> X-URL: http://www.redhat.com Date: Tue, 11 Mar 2014 14:44:43 -0300 In-Reply-To: <1394125335-19182-1-git-send-email-tromey@redhat.com> (Tom Tromey's message of "Thu, 6 Mar 2014 10:02:15 -0700") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux) MIME-Version: 1.0 X-IsSubscribed: yes X-DH-Original-To: gdb@patchwork.siddhesh.in On Thursday, March 06 2014, Tom Tromey wrote: > While testing on AIX, I happened to notice an internal error coming > from parse_probes. This happens because there are no probes defined > on this platform. This patch fixes the problem by changing an assert > into an ordinary error, and then changing the relevant caller to cope. > > This fixes a few tests on AIX; also regtested on x86-64 Fedora 18. Ouch, thanks for testing on other platforms! By reading the patch (and the original code), I found it a little bit obscure, so I took the liberty to try to improve it. Here's the patch. Could you please take a look and see if it works on AIX (and also if you like the approach)? Thanks, 2014-03-06 Tom Tromey Sergio Durigan Junior * probe.c (parse_probes): Turn assert into an ordinary error. * break-catch-throw.c (re_set_exception_catchpoint): Ignore exceptions when parsing probes. Rearrange the code for clarity. diff --git a/gdb/break-catch-throw.c b/gdb/break-catch-throw.c index 7283490..9831d96 100644 --- a/gdb/break-catch-throw.c +++ b/gdb/break-catch-throw.c @@ -207,29 +207,32 @@ re_set_exception_catchpoint (struct breakpoint *self) volatile struct gdb_exception e; struct cleanup *cleanup; enum exception_event_kind kind = classify_exception_breakpoint (self); - int pass; - for (pass = 0; sals.sals == NULL && pass < 2; ++pass) + /* We first try to use the probe interface. */ + TRY_CATCH (e, RETURN_MASK_ERROR) { - TRY_CATCH (e, RETURN_MASK_ERROR) + char *spec = ASTRDUP (exception_functions[kind].probe); + + sals = parse_probes (&spec, NULL); + } + + if (e.reason < 0) + { + volatile struct gdb_exception ex; + + /* Using the probe interface failed. Let's fallback to the normal + catchpoint mode. */ + TRY_CATCH (ex, RETURN_MASK_ERROR) { - char *spec; - - if (pass == 0) - { - spec = ASTRDUP (exception_functions[kind].probe); - sals = parse_probes (&spec, NULL); - } - else - { - spec = ASTRDUP (exception_functions[kind].function); - self->ops->decode_linespec (self, &spec, &sals); - } + char *spec = ASTRDUP (exception_functions[kind].function); + + self->ops->decode_linespec (self, &spec, &sals); } + /* NOT_FOUND_ERROR just means the breakpoint will be pending, so let it through. */ - if (e.reason < 0 && e.error != NOT_FOUND_ERROR) - throw_exception (e); + if (ex.reason < 0 && ex.error != NOT_FOUND_ERROR) + throw_exception (ex); } cleanup = make_cleanup (xfree, sals.sals); diff --git a/gdb/probe.c b/gdb/probe.c index 623f65c..838d9f9 100644 --- a/gdb/probe.c +++ b/gdb/probe.c @@ -59,7 +59,8 @@ parse_probes (char **argptr, struct linespec_result *canonical) cs = *argptr; probe_ops = probe_linespec_to_ops (&cs); - gdb_assert (probe_ops != NULL); + if (probe_ops == NULL) + error (_("'%s' is not a probe linespec"), arg_start); arg = (char *) cs; arg = skip_spaces (arg);