From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7657 invoked by alias); 8 Jun 2013 00:22:37 -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 7532 invoked by uid 89); 8 Jun 2013 00:22:30 -0000 X-Spam-SWARE-Status: No, score=-4.6 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,TW_EG autolearn=ham version=3.3.1 Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Sat, 08 Jun 2013 00:22:29 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1Ul6vL-0002RZ-51 from Yao_Qi@mentor.com ; Fri, 07 Jun 2013 17:22:27 -0700 Received: from SVR-ORW-FEM-02.mgc.mentorg.com ([147.34.96.206]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Fri, 7 Jun 2013 17:22:26 -0700 Received: from qiyao.dyndns.org (147.34.91.1) by svr-orw-fem-02.mgc.mentorg.com (147.34.96.168) with Microsoft SMTP Server id 14.2.247.3; Fri, 7 Jun 2013 17:22:26 -0700 Message-ID: <51B27970.4090209@codesourcery.com> Date: Sat, 08 Jun 2013 01:53:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 To: Pedro Alves CC: Subject: Re: [PATCH] Move some code into get_register. References: <1370608997-20957-1-git-send-email-yao@codesourcery.com> <51B2367C.4090104@redhat.com> In-Reply-To: <51B2367C.4090104@redhat.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-SW-Source: 2013-06/txt/msg00185.txt.bz2 On 06/08/2013 03:37 AM, Pedro Alves wrote: > s/it/this/. > Fixed. > Add something like: > > (output_register): ... This. Output the register's > "number" ui_out tuple here. > >> >-/* Output one register's contents in the desired format. */ >> >+/* Output one register REGNUM's contents in the desired FORMAT. */ > You're naming the register now, so, s/one//. > "one" is removed. > Okay with those fixes. Patch below is what I committed. -- Yao (齐尧) Index: ChangeLog =================================================================== RCS file: /cvs/src/src/gdb/ChangeLog,v retrieving revision 1.15698 diff -u -r1.15698 ChangeLog --- ChangeLog 7 Jun 2013 14:39:30 -0000 1.15698 +++ ChangeLog 8 Jun 2013 00:18:14 -0000 @@ -1,3 +1,14 @@ +2013-06-08 Pedro Alves + Yao Qi + + * mi/mi-main.c (get_register): Remove declaration. + (output_register): Declare. + (mi_cmd_data_list_register_values): Remove local variable + 'tuple_cleanup'. Move some code into output_register. + (get_register): Renamed to ... + (output_register): ... this. Output the register's + "number" ui_out tuple here. + 2013-06-07 Pedro Alves * darwin-nat.c: Fix formating in copyright header. Index: mi/mi-main.c =================================================================== RCS file: /cvs/src/src/gdb/mi/mi-main.c,v retrieving revision 1.232 diff -u -r1.232 mi-main.c --- mi/mi-main.c 30 May 2013 17:04:47 -0000 1.232 +++ mi/mi-main.c 8 Jun 2013 00:18:15 -0000 @@ -103,7 +103,7 @@ char **argv, int argc); static int register_changed_p (int regnum, struct regcache *, struct regcache *); -static void get_register (struct frame_info *, int regnum, int format); +static void output_register (struct frame_info *, int regnum, int format); /* Command implementations. FIXME: Is this libgdb? No. This is the MI layer that calls libgdb. Any operation used in the below should be @@ -1072,7 +1072,7 @@ struct gdbarch *gdbarch; int regnum, numregs, format; int i; - struct cleanup *list_cleanup, *tuple_cleanup; + struct cleanup *list_cleanup; /* Note that the test for a valid register must include checking the gdbarch_register_name because gdbarch_num_regs may be allocated @@ -1103,10 +1103,8 @@ if (gdbarch_register_name (gdbarch, regnum) == NULL || *(gdbarch_register_name (gdbarch, regnum)) == '\0') continue; - tuple_cleanup = make_cleanup_ui_out_tuple_begin_end (uiout, NULL); - ui_out_field_int (uiout, "number", regnum); - get_register (frame, regnum, format); - do_cleanups (tuple_cleanup); + + output_register (frame, regnum, format); } } @@ -1119,26 +1117,25 @@ && regnum < numregs && gdbarch_register_name (gdbarch, regnum) != NULL && *gdbarch_register_name (gdbarch, regnum) != '\000') - { - tuple_cleanup = make_cleanup_ui_out_tuple_begin_end (uiout, NULL); - ui_out_field_int (uiout, "number", regnum); - get_register (frame, regnum, format); - do_cleanups (tuple_cleanup); - } + output_register (frame, regnum, format); else error (_("bad register number")); } do_cleanups (list_cleanup); } -/* Output one register's contents in the desired format. */ +/* Output register REGNUM's contents in the desired FORMAT. */ static void -get_register (struct frame_info *frame, int regnum, int format) +output_register (struct frame_info *frame, int regnum, int format) { struct gdbarch *gdbarch = get_frame_arch (frame); struct ui_out *uiout = current_uiout; struct value *val; + struct cleanup *tuple_cleanup; + + tuple_cleanup = make_cleanup_ui_out_tuple_begin_end (uiout, NULL); + ui_out_field_int (uiout, "number", regnum); if (format == 'N') format = 0; @@ -1184,6 +1181,8 @@ ui_out_field_stream (uiout, "value", stb); do_cleanups (old_chain); } + + do_cleanups (tuple_cleanup); } /* Write given values into registers. The registers and values are