From patchwork Sat Sep 9 00:41:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 22774 Received: (qmail 28731 invoked by alias); 9 Sep 2017 00:41:43 -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 28586 invoked by uid 89); 9 Sep 2017 00:41:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1892 X-HELO: outbound-ss-1812.hostmonster.com Received: from gproxy1-pub.mail.unifiedlayer.com (HELO outbound-ss-1812.hostmonster.com) (69.89.25.95) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 09 Sep 2017 00:41:40 +0000 Received: from cmgw2 (cmgw3 [10.0.90.83]) by gproxy1.mail.unifiedlayer.com (Postfix) with ESMTP id 60AB2175AAB for ; Fri, 8 Sep 2017 18:41:39 -0600 (MDT) Received: from box522.bluehost.com ([74.220.219.122]) by cmgw2 with id 7Chc1w01V2f2jeq01ChfUw; Fri, 08 Sep 2017 18:41:39 -0600 X-Authority-Analysis: v=2.2 cv=dZfw5Tfe c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=2JCJgTwv5E4A:10 a=zstS-IiYAAAA:8 a=20KFwNOVAAAA:8 a=UAmIqixDI-Rr4GCWyPoA:9 a=4G6NA9xxw8l3yy4pmD5M:22 Received: from 75-166-76-94.hlrn.qwest.net ([75.166.76.94]:58538 helo=bapiya.Home) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.87) (envelope-from ) id 1dqTq4-000TWc-6n; Fri, 08 Sep 2017 18:41:36 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA 1/4] Use gdb::def_vector in func_command Date: Fri, 8 Sep 2017 18:41:26 -0600 Message-Id: <20170909004129.28782-2-tom@tromey.com> In-Reply-To: <20170909004129.28782-1-tom@tromey.com> References: <20170909004129.28782-1-tom@tromey.com> X-BWhitelist: no X-Exim-ID: 1dqTq4-000TWc-6n X-Source-Sender: 75-166-76-94.hlrn.qwest.net (bapiya.Home) [75.166.76.94]:58538 X-Source-Auth: tom+tromey.com X-Email-Count: 6 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== X-Local-Domain: yes This changes func_command to use gdb::def_vector, removing a cleanup. gdb/ChangeLog 2017-09-08 Tom Tromey * stack.c (func_command): Use gdb::def_vector. --- gdb/ChangeLog | 4 ++++ gdb/stack.c | 7 ++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 96369d5..b7f83a4 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2017-09-08 Tom Tromey + + * stack.c (func_command): Use gdb::def_vector. + 2017-09-08 Keith Seitz * dwarf2read.c (struct field_info) : Remove unused diff --git a/gdb/stack.c b/gdb/stack.c index 8a066b2..36c1e46 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -52,6 +52,7 @@ #include "symfile.h" #include "extension.h" #include "observer.h" +#include "common/def-vector.h" /* The possible choices of "set print frame-arguments", and the value of this setting. */ @@ -2521,7 +2522,6 @@ func_command (char *arg, int from_tty) struct frame_info *frame; int found = 0; int level = 1; - struct function_bounds *func_bounds = NULL; if (arg == NULL) return; @@ -2529,8 +2529,7 @@ func_command (char *arg, int from_tty) frame = get_current_frame (); std::vector sals = decode_line_with_current_source (arg, DECODE_LINE_FUNFIRSTLINE); - func_bounds = XNEWVEC (struct function_bounds, sals.size ()); - struct cleanup *cleanups = make_cleanup (xfree, func_bounds); + gdb::def_vector func_bounds (sals.size ()); for (size_t i = 0; (i < sals.size () && !found); i++) { if (sals[i].pspace != current_program_space) @@ -2557,8 +2556,6 @@ func_command (char *arg, int from_tty) } while (!found && level == 0); - do_cleanups (cleanups); - if (!found) printf_filtered (_("'%s' not within current stack frame.\n"), arg); else if (frame != get_selected_frame (NULL))