From patchwork Fri Dec 8 20:40:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergio Durigan Junior X-Patchwork-Id: 24831 Received: (qmail 65877 invoked by alias); 8 Dec 2017 20:40:23 -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 65863 invoked by uid 89); 8 Dec 2017 20:40:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= 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; Fri, 08 Dec 2017 20:40:22 +0000 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5D65D4903D for ; Fri, 8 Dec 2017 20:40:21 +0000 (UTC) Received: from psique.yyz.redhat.com (unused-10-15-17-193.yyz.redhat.com [10.15.17.193]) by smtp.corp.redhat.com (Postfix) with ESMTP id 07BAC60BEC; Fri, 8 Dec 2017 20:40:20 +0000 (UTC) From: Sergio Durigan Junior To: GDB Patches Cc: Pedro Alves , Sergio Durigan Junior Subject: [pushed] Fix thinko on dtrace-probe.c:dtrace_process_dof_probe Date: Fri, 8 Dec 2017 15:40:19 -0500 Message-Id: <20171208204019.29724-1-sergiodj@redhat.com> X-IsSubscribed: yes While investigating PR gdb/22557 ("Regression: gdb.base/dtrace-probe.exp"), I noticed that the code is wrongly declaring a new "expression_up" variable inside the TRY block in "dtrace_process_dof_probe". This causes the outter "expr" variable to be empty, which may have an impact later when evaluating the expression. This commit fixes that. Unfortunately the script used to test DTrace probes (gdb/testsuite/lib/pdtrace.in) is not very reliable so I cannot say whether this commit fixes the PR mentioned above. Nonetheless, it's an obvious fix and should go in. gdb/ChangeLog: 2017-12-08 Sergio Durigan Junior * dtrace-probe.c (dtrace_process_dof_probe): Do not declare a new "expression_up" inside the TRY block. --- gdb/ChangeLog | 5 +++++ gdb/dtrace-probe.c | 9 ++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 7d061c807c..26cf18edb8 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2017-12-08 Sergio Durigan Junior + + * dtrace-probe.c (dtrace_process_dof_probe): Do not declare a new + "expression_up" inside the TRY block. + 2017-12-08 Yao Qi * breakpoint.c (update_watchpoint): Call diff --git a/gdb/dtrace-probe.c b/gdb/dtrace-probe.c index 1c88f89054..3314445f98 100644 --- a/gdb/dtrace-probe.c +++ b/gdb/dtrace-probe.c @@ -486,17 +486,16 @@ dtrace_process_dof_probe (struct objfile *objfile, TRY { - expression_up expr - = parse_expression_with_language (type_str.c_str (), - language_c); + expr = parse_expression_with_language (type_str.c_str (), + language_c); } CATCH (ex, RETURN_MASK_ERROR) { } END_CATCH - if (expr != NULL && expr->elts[0].opcode == OP_TYPE) - type = expr->elts[1].type; + if (expr != NULL && expr.get ()->elts[0].opcode == OP_TYPE) + type = expr.get ()->elts[1].type; args.emplace_back (type, std::move (type_str), std::move (expr)); }