From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12834 invoked by alias); 18 Mar 2010 19:38:18 -0000 Received: (qmail 12821 invoked by uid 22791); 18 Mar 2010 19:38:17 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=BAYES_00,SARE_MSGID_LONG40,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.44.51) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 18 Mar 2010 19:38:13 +0000 Received: from wpaz33.hot.corp.google.com (wpaz33.hot.corp.google.com [172.24.198.97]) by smtp-out.google.com with ESMTP id o2IJcBDu001041 for ; Thu, 18 Mar 2010 12:38:11 -0700 Received: from wwf26 (wwf26.prod.google.com [10.241.242.90]) by wpaz33.hot.corp.google.com with ESMTP id o2IJcAFT027741 for ; Thu, 18 Mar 2010 12:38:10 -0700 Received: by wwf26 with SMTP id 26so398280wwf.15 for ; Thu, 18 Mar 2010 12:38:10 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.87.130 with SMTP id y2mr17724wee.51.1268941089863; Thu, 18 Mar 2010 12:38:09 -0700 (PDT) In-Reply-To: <20100318192535.GA25322@host0.dyn.jankratochvil.net> References: <20100318173015.6765784413@ruffy.mtv.corp.google.com> <201003181747.29518.pedro@codesourcery.com> <201003181855.o2IIthRb027235@glazunov.sibelius.xs4all.nl> <20100318192535.GA25322@host0.dyn.jankratochvil.net> Date: Thu, 18 Mar 2010 19:38:00 -0000 Message-ID: Subject: Re: [RFC] Why does ui_out_field_core_addr pad with leading zeroes? From: Doug Evans To: Jan Kratochvil Cc: Mark Kettenis , pedro@codesourcery.com, gdb-patches@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-System-Of-Record: true X-IsSubscribed: yes 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 X-SW-Source: 2010-03/txt/msg00687.txt.bz2 On Thu, Mar 18, 2010 at 12:25 PM, Jan Kratochvil wrote: > On Thu, 18 Mar 2010 20:19:11 +0100, Doug Evans wrote: >> Having stared at both alignments, I don't see aligning the address to >> the right as being easier to read than aligning them to the left, and >> even less so. >> >> Right Aligned >> >> (gdb) i b >> Num =A0 =A0 Type =A0 =A0 =A0 =A0 =A0 Disp Enb =A0 =A0 =A0 =A0 =A0 =A0Add= ress What >> 2 =A0 =A0 =A0 breakpoint =A0 =A0 keep y =A0 =A0 =A0 =A0 =A0 =A0 0x40049c= in main at hello.c:6 >> 3 =A0 =A0 =A0 breakpoint =A0 =A0 keep y =A0 =A0 =A0 0x7ffff7acbe40 >> (gdb) >> >> Left Aligned >> >> (gdb) i b >> Num =A0 =A0 Type =A0 =A0 =A0 =A0 =A0 Disp Enb Address =A0 =A0 =A0 =A0 = =A0 =A0What >> 2 =A0 =A0 =A0 breakpoint =A0 =A0 keep y =A0 0x40049c =A0 =A0 =A0 =A0 =A0= in main at hello.c:6 >> 3 =A0 =A0 =A0 breakpoint =A0 =A0 keep y =A0 0x7ffff7acbe40 =A0 =A0 >> (gdb) > > I am definitely for the "Right Aligned" one and against the "Left Aligned" > one. =A0While analyzing various crash dumps one looks for the same last t= hree > digits (ignoring PIC/PIE different PAGE_SIZE-aligned placement). =A0Also > sometimes sorting addresses from various sources by hand to find out the > memory layout and having to additionally re-align even the GDB dump itsel= f is > not helpful. [It seemed like ui-out should make this easy, and voila.] 2010-03-18 Doug Evans * ui-out.c (ui_out_field_core_addr): Don't pad address with leading zeroes. * breakpoint.c (breakpoint_1): Right align breakpoint addresses. Index: ui-out.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/src/src/gdb/ui-out.c,v retrieving revision 1.45 diff -u -p -r1.45 ui-out.c --- ui-out.c 12 Jan 2010 21:40:24 -0000 1.45 +++ ui-out.c 18 Mar 2010 17:19:07 -0000 @@ -498,12 +498,8 @@ ui_out_field_core_addr (struct ui_out *u address &=3D ((CORE_ADDR) 1 << addr_bit) - 1; /* FIXME: cagney/2002-05-03: Need local_address_string() function - that returns the language localized string formatted to a width - based on gdbarch_addr_bit. */ - if (addr_bit <=3D 32) - strcpy (addstr, hex_string_custom (address, 8)); - else - strcpy (addstr, hex_string_custom (address, 16)); + that returns the language localized string. */ + strcpy (addstr, hex_string (address)); ui_out_field_string (uiout, fldname, addstr); } Index: breakpoint.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/src/src/gdb/breakpoint.c,v retrieving revision 1.462 diff -u -p -r1.462 breakpoint.c --- breakpoint.c 16 Mar 2010 08:42:20 -0000 1.462 +++ breakpoint.c 18 Mar 2010 19:35:08 -0000 @@ -4743,9 +4743,9 @@ breakpoint_1 (int bnum, int allflag) if (nr_printable_breakpoints > 0) annotate_field (4); if (print_address_bits <=3D 32) - ui_out_table_header (uiout, 10, ui_left, "addr", "Address");/* = 5 */ + ui_out_table_header (uiout, 10, ui_right, "addr", "Address");/*= 5 */ else - ui_out_table_header (uiout, 18, ui_left, "addr", "Address");/* = 5 */ + ui_out_table_header (uiout, 18, ui_right, "addr", "Address");/*= 5 */ } if (nr_printable_breakpoints > 0) annotate_field (5);