From patchwork Wed Oct 18 04:06:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 23657 Received: (qmail 109576 invoked by alias); 18 Oct 2017 04:06:58 -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 109472 invoked by uid 89); 18 Oct 2017 04:06:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: gproxy8-pub.mail.unifiedlayer.com Received: from gproxy8-pub.mail.unifiedlayer.com (HELO gproxy8-pub.mail.unifiedlayer.com) (67.222.33.93) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 18 Oct 2017 04:06:56 +0000 Received: from cmgw4 (unknown [10.0.90.85]) by gproxy8.mail.unifiedlayer.com (Postfix) with ESMTP id 191131AB3B7 for ; Tue, 17 Oct 2017 22:06:55 -0600 (MDT) Received: from box522.bluehost.com ([74.220.219.122]) by cmgw4 with id Ns6r1w00Z2f2jeq01s6uNM; Tue, 17 Oct 2017 22:06:55 -0600 X-Authority-Analysis: v=2.2 cv=JNNLi4Cb c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=02M-m0pO-4AA:10 a=zstS-IiYAAAA:8 a=_X9Va745QuxbAEF9CocA:9 a=4G6NA9xxw8l3yy4pmD5M:22 Received: from 184-96-33-178.hlrn.qwest.net ([184.96.33.178]:51166 helo=bapiya.localdomain) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.87) (envelope-from ) id 1e4fd5-001Wr2-IF; Tue, 17 Oct 2017 22:06:51 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA 2/3] Remove cleanup from call_function_by_hand_dummy Date: Tue, 17 Oct 2017 22:06:44 -0600 Message-Id: <20171018040645.7212-2-tom@tromey.com> In-Reply-To: <20171018040645.7212-1-tom@tromey.com> References: <20171018040645.7212-1-tom@tromey.com> X-BWhitelist: no X-Exim-ID: 1e4fd5-001Wr2-IF X-Source-Sender: 184-96-33-178.hlrn.qwest.net (bapiya.localdomain) [184.96.33.178]:51166 X-Source-Auth: tom+tromey.com X-Email-Count: 2 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== X-Local-Domain: yes This changes call_function_by_hand_dummy to use std::string, removing a cleanup. ChangeLog 2017-10-17 Tom Tromey * infcall.c (call_function_by_hand_dummy): Use std::string. --- gdb/ChangeLog | 4 ++++ gdb/infcall.c | 14 ++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/gdb/infcall.c b/gdb/infcall.c index d384d16c29..03749f3dc2 100644 --- a/gdb/infcall.c +++ b/gdb/infcall.c @@ -1308,10 +1308,8 @@ When the function is done executing, GDB will silently stop."), { /* Make a copy as NAME may be in an objfile freed by dummy_frame_pop. */ - char *name = xstrdup (get_function_name (funaddr, - name_buf, sizeof (name_buf))); - make_cleanup (xfree, name); - + std::string name = get_function_name (funaddr, name_buf, + sizeof (name_buf)); if (stopped_by_random_signal) { @@ -1339,7 +1337,7 @@ GDB has restored the context to what it was before the call.\n\ To change this behavior use \"set unwindonsignal off\".\n\ Evaluation of the expression containing the function\n\ (%s) will be abandoned."), - name); + name.c_str ()); } else { @@ -1358,7 +1356,7 @@ To change this behavior use \"set unwindonsignal on\".\n\ Evaluation of the expression containing the function\n\ (%s) will be abandoned.\n\ When the function is done executing, GDB will silently stop."), - name); + name.c_str ()); } } @@ -1380,7 +1378,7 @@ context to its original state before the call.\n\ To change this behaviour use \"set unwind-on-terminating-exception off\".\n\ Evaluation of the expression containing the function (%s)\n\ will be abandoned."), - name); + name.c_str ()); } else if (stop_stack_dummy == STOP_NONE) { @@ -1404,7 +1402,7 @@ The program being debugged stopped while in a function called from GDB.\n\ Evaluation of the expression containing the function\n\ (%s) will be abandoned.\n\ When the function is done executing, GDB will silently stop."), - name); + name.c_str ()); } }