From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 110392 invoked by alias); 27 Sep 2016 04:52:51 -0000 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 Received: (qmail 110367 invoked by uid 89); 27 Sep 2016 04:52:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=no version=3.3.2 spammy=H*RU:10.0.90.82, Hx-spam-relays-external:CMOut01, H*r:CMOut01, H*RU:CMOut01 X-HELO: gproxy10-pub.mail.unifiedlayer.com Received: from gproxy10-pub.mail.unifiedlayer.com (HELO gproxy10-pub.mail.unifiedlayer.com) (69.89.20.226) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with SMTP; Tue, 27 Sep 2016 04:52:47 +0000 Received: (qmail 22607 invoked by uid 0); 27 Sep 2016 04:52:45 -0000 Received: from unknown (HELO CMOut01) (10.0.90.82) by gproxy10.mail.unifiedlayer.com with SMTP; 27 Sep 2016 04:52:45 -0000 Received: from box522.bluehost.com ([74.220.219.122]) by CMOut01 with id oUsh1t0052f2jeq01Uskju; Mon, 26 Sep 2016 22:52:44 -0600 X-Authority-Analysis: v=2.1 cv=OPq0g0qB c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=GW1xBdLrtEIA:10 a=zstS-IiYAAAA:8 a=dO8I-g5uWDr250bxGykA:9 a=4G6NA9xxw8l3yy4pmD5M:22 Received: from 71-218-192-86.hlrn.qwest.net ([71.218.192.86]:56110 helo=bapiya.Home) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.86_1) (envelope-from ) id 1bojhT-0006Nj-FG; Mon, 26 Sep 2016 22:08:59 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA 10/22] Remove some cleanups in MI Date: Tue, 27 Sep 2016 04:52:00 -0000 Message-Id: <1474949330-4307-11-git-send-email-tom@tromey.com> In-Reply-To: <1474949330-4307-1-git-send-email-tom@tromey.com> References: <1474949330-4307-1-git-send-email-tom@tromey.com> X-BWhitelist: no X-Exim-ID: 1bojhT-0006Nj-FG X-Source-Sender: 71-218-192-86.hlrn.qwest.net (bapiya.Home) [71.218.192.86]:56110 X-Source-Auth: tom+tromey.com X-Email-Count: 23 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== X-SW-Source: 2016-09/txt/msg00359.txt.bz2 This patch removes a couple of cleanups from MI. 2016-09-26 Tom Tromey * mi/mi-main.c (mi_cmd_data_read_memory): Use std::vector. Remove some cleanups. --- gdb/ChangeLog | 5 +++++ gdb/mi/mi-main.c | 11 ++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 954d658..704de48 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2016-09-26 Tom Tromey + * mi/mi-main.c (mi_cmd_data_read_memory): Use std::vector. Remove + some cleanups. + +2016-09-26 Tom Tromey + * tui/tui-interp.c (tui_on_normal_stop, tui_on_signal_received) (tui_on_end_stepping_range, tui_on_signal_exited, tui_on_exited) (tui_on_no_history): Update. diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index c6c7067..50d82f1 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -56,6 +56,7 @@ #include #include "gdb_sys_time.h" +#include #if defined HAVE_SYS_RESOURCE_H #include @@ -1403,7 +1404,6 @@ mi_cmd_data_read_memory (char *command, char **argv, int argc) { struct gdbarch *gdbarch = get_current_arch (); struct ui_out *uiout = current_uiout; - struct cleanup *cleanups = make_cleanup (null_cleanup, NULL); CORE_ADDR addr; long total_bytes, nr_cols, nr_rows; char word_format; @@ -1411,7 +1411,6 @@ mi_cmd_data_read_memory (char *command, char **argv, int argc) long word_size; char word_asize; char aschar; - gdb_byte *mbuf; int nr_bytes; long offset = 0; int oind = 0; @@ -1496,13 +1495,12 @@ mi_cmd_data_read_memory (char *command, char **argv, int argc) /* Create a buffer and read it in. */ total_bytes = word_size * nr_rows * nr_cols; - mbuf = XCNEWVEC (gdb_byte, total_bytes); - make_cleanup (xfree, mbuf); + std::vector mbuf (total_bytes); /* Dispatch memory reads to the topmost target, not the flattened current_target. */ nr_bytes = target_read (current_target.beneath, - TARGET_OBJECT_MEMORY, NULL, mbuf, + TARGET_OBJECT_MEMORY, NULL, mbuf.data (), addr, total_bytes); if (nr_bytes <= 0) error (_("Unable to read memory.")); @@ -1556,7 +1554,7 @@ mi_cmd_data_read_memory (char *command, char **argv, int argc) else { ui_file_rewind (stream); - print_scalar_formatted (mbuf + col_byte, word_type, &opts, + print_scalar_formatted (&mbuf[col_byte], word_type, &opts, word_asize, stream); ui_out_field_stream (uiout, NULL, stream); } @@ -1583,7 +1581,6 @@ mi_cmd_data_read_memory (char *command, char **argv, int argc) } do_cleanups (cleanup_stream); } - do_cleanups (cleanups); } void -- 2.7.4