From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14637 invoked by alias); 14 Nov 2008 21:45:15 -0000 Received: (qmail 14525 invoked by uid 22791); 14 Nov 2008 21:45:13 -0000 X-Spam-Check-By: sourceware.org Received: from smtp-outbound-2.vmware.com (HELO smtp-outbound-2.vmware.com) (65.115.85.73) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 14 Nov 2008 21:44:38 +0000 Received: from mailhost2.vmware.com (mailhost2.vmware.com [10.16.67.167]) by smtp-outbound-2.vmware.com (Postfix) with ESMTP id 136652B012; Fri, 14 Nov 2008 13:44:36 -0800 (PST) Received: from [10.20.92.59] (promb-2s-dhcp59.eng.vmware.com [10.20.92.59]) by mailhost2.vmware.com (Postfix) with ESMTP id EFE578E597; Fri, 14 Nov 2008 13:44:35 -0800 (PST) Message-ID: <491DF12A.5090903@vmware.com> Date: Sat, 15 Nov 2008 17:00:00 -0000 From: Michael Snyder User-Agent: Thunderbird 1.5.0.12 (X11/20080411) MIME-Version: 1.0 To: Paul Pluzhnikov CC: "gdb-patches@sourceware.org" Subject: Re: [RFA] [patch] 'info symbol' to print more info References: <20081114204617.A4A533A6B15@localhost> In-Reply-To: <20081114204617.A4A533A6B15@localhost> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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: 2008-11/txt/msg00375.txt.bz2 Paul Pluzhnikov wrote: > Greetings, > > Currently, 'info symbol' and 'maintenance translate-address' print > just the symbol+offset: > > (gdb) maint translate-address 0x2aaaac1f5880 > exit+0 > (gdb) info symbol 0x2aaaac1f5880 > exit in section .text > > That's nice, but when I have 100s of shared libraries loaded, > I want to know more. > > Attached patch results in: > > (gdb) maint translate-address 0x2aaaac1f5880 > exit+0 section .text in /usr/lib64/libc.so.6 > (gdb) info symbol 0x2aaaac1f5880 > exit in section .text of /usr/lib64/libc.so.6 > > Regtested on x86_64 with no failures. > > Ok to commit? I like it! Just one suggestion (and suggestion only) -- since the exec_file is sort of the default/common case, do you think it would be a good idea to check if it's the exec_file, and omit the objfile information if so? > 2008-11-14 Paul Pluzhnikov > > * printcmd.c (sym_info): Print object name. > * maint.c (maintenance_translate_address): Likewise. > > > Index: gdb/maint.c > =================================================================== > RCS file: /cvs/src/src/gdb/maint.c,v > retrieving revision 1.68 > diff -u -p -u -r1.68 maint.c > --- gdb/maint.c 30 Oct 2008 20:35:30 -0000 1.68 > +++ gdb/maint.c 14 Nov 2008 20:39:48 -0000 > @@ -484,9 +484,18 @@ maintenance_translate_address (char *arg > sym = lookup_minimal_symbol_by_pc (address); > > if (sym) > - printf_filtered ("%s+%s\n", > - SYMBOL_PRINT_NAME (sym), > - pulongest (address - SYMBOL_VALUE_ADDRESS (sym))); > + { > + printf_filtered ("%s+%s", > + SYMBOL_PRINT_NAME (sym), > + pulongest (address - SYMBOL_VALUE_ADDRESS (sym))); > + if ((sect = SYMBOL_OBJ_SECTION(sym))) > + { > + printf_filtered (_(" section %s"), sect->the_bfd_section->name); > + if (sect->objfile && sect->objfile->name) > + printf_filtered (_(" in %s"), sect->objfile->name); > + } > + printf_filtered (_("\n")); > + } > else if (sect) > printf_filtered (_("no symbol at %s:0x%s\n"), > sect->the_bfd_section->name, paddr (address)); > Index: gdb/printcmd.c > =================================================================== > RCS file: /cvs/src/src/gdb/printcmd.c,v > retrieving revision 1.136 > diff -u -p -u -r1.136 printcmd.c > --- gdb/printcmd.c 13 Nov 2008 22:26:15 -0000 1.136 > +++ gdb/printcmd.c 14 Nov 2008 20:39:48 -0000 > @@ -1026,6 +1026,8 @@ sym_info (char *arg, int from_tty) > printf_filtered (_("%s overlay "), > section_is_mapped (osect) ? "mapped" : "unmapped"); > printf_filtered (_("section %s"), osect->the_bfd_section->name); > + if (osect->objfile && osect->objfile->name) > + printf_filtered (_(" of %s"), osect->objfile->name); > printf_filtered ("\n"); > } > }