From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16447 invoked by alias); 15 Nov 2008 16:42:55 -0000 Received: (qmail 16327 invoked by uid 22791); 15 Nov 2008 16:42:53 -0000 X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.45.13) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sat, 15 Nov 2008 16:42:18 +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 mAFGgFuH013779 for ; Sat, 15 Nov 2008 08:42:15 -0800 Received: from wa-out-1112.google.com (wahj40.prod.google.com [10.114.236.40]) by wpaz33.hot.corp.google.com with ESMTP id mAFGgDiM030574 for ; Sat, 15 Nov 2008 08:42:13 -0800 Received: by wa-out-1112.google.com with SMTP id j40so1386676wah.1 for ; Sat, 15 Nov 2008 08:42:13 -0800 (PST) MIME-Version: 1.0 Received: by 10.114.81.1 with SMTP id e1mr1330837wab.212.1226767332624; Sat, 15 Nov 2008 08:42:12 -0800 (PST) In-Reply-To: <491E08BF.2050609@vmware.com> References: <20081114204617.A4A533A6B15@localhost> <491DF12A.5090903@vmware.com> <8ac60eac0811141406h4bb126c0sbd898e7d612f46dd@mail.gmail.com> <491E08BF.2050609@vmware.com> Date: Sat, 15 Nov 2008 23:16:00 -0000 Message-ID: <8ac60eac0811150842x78206050t435c6f8c89ddc8ae@mail.gmail.com> Subject: Re: [RFA] [patch] 'info symbol' to print more info From: Paul Pluzhnikov To: Michael Snyder , Eli Zaretskii Cc: "gdb-patches@sourceware.org" Content-Type: multipart/mixed; boundary=0016364177e1154874045bbd07f7 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/msg00388.txt.bz2 --0016364177e1154874045bbd07f7 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-length: 925 On Fri, Nov 14, 2008 at 3:24 PM, Michael Snyder wrote: > Paul Pluzhnikov wrote: >> if (ojbect_files->next) >> /* there is only one object, so don't print its name ... */ Obviously I meant the opposite of what I said :( > Yeah, that's suitable. A new patch attached. On Fri, Nov 14, 2008 at 2:54 PM, Eli Zaretskii wrote: > Please also fix the places in the > manual where these two commands are described. Done. Ok to commit? Thanks, -- Paul Pluzhnikov 2008-11-15 Paul Pluzhnikov * objfiles.h: New MULTI_OBJFILE_P macro. * printcmd.c (sym_info): Print object name. * maint.c (maintenance_translate_address): Likewise. doc/ChangeLog 2008-11-15 Paul Pluzhnikov * gdb.texinfo (Symbols): Mention printing containing image name in "info symbol". (Maint translate-address): Likewise. --0016364177e1154874045bbd07f7 Content-Type: text/plain; name="gdb-info-sym-20081115.txt" Content-Disposition: attachment; filename="gdb-info-sym-20081115.txt" Content-Transfer-Encoding: 7bit X-Attachment-Id: f_fnkeay2k0 Content-length: 3782 Index: maint.c =================================================================== RCS file: /cvs/src/src/gdb/maint.c,v retrieving revision 1.68 diff -u -p -u -r1.68 maint.c --- maint.c 30 Oct 2008 20:35:30 -0000 1.68 +++ maint.c 15 Nov 2008 15:01:17 -0000 @@ -484,9 +484,19 @@ 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 (_(" in section %s"), sect->the_bfd_section->name); + if (MULTI_OBJFILE_P () + && sect->objfile && sect->objfile->name) + printf_filtered (_(" of %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: objfiles.h =================================================================== RCS file: /cvs/src/src/gdb/objfiles.h,v retrieving revision 1.56 diff -u -p -u -r1.56 objfiles.h --- objfiles.h 1 Oct 2008 17:21:06 -0000 1.56 +++ objfiles.h 15 Nov 2008 15:01:17 -0000 @@ -583,4 +583,8 @@ extern void *objfile_data (struct objfil uninitialized section index. */ #define SECT_OFF_BSS(objfile) (objfile)->sect_index_bss +/* Answer whether there is more than one object file loaded. */ + +#define MULTI_OBJFILE_P() (object_files && object_files->next) + #endif /* !defined (OBJFILES_H) */ Index: printcmd.c =================================================================== RCS file: /cvs/src/src/gdb/printcmd.c,v retrieving revision 1.136 diff -u -p -u -r1.136 printcmd.c --- printcmd.c 13 Nov 2008 22:26:15 -0000 1.136 +++ printcmd.c 15 Nov 2008 15:01:17 -0000 @@ -1026,6 +1026,9 @@ 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 (MULTI_OBJFILE_P () + && osect->objfile && osect->objfile->name) + printf_filtered (_(" of %s"), osect->objfile->name); printf_filtered ("\n"); } } Index: doc/gdb.texinfo =================================================================== RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v retrieving revision 1.532 diff -u -p -u -r1.532 gdb.texinfo --- doc/gdb.texinfo 24 Oct 2008 21:04:22 -0000 1.532 +++ doc/gdb.texinfo 15 Nov 2008 15:01:18 -0000 @@ -11866,6 +11866,16 @@ _initialize_vx + 396 in section .text This is the opposite of the @code{info address} command. You can use it to find out the name of a variable or a function given its address. +For dynamically linked executables, the name of executable or shared +library containing the symbol is also printed: + +@smallexample +(@value{GDBP}) info symbol 0x400225 +_start + 5 in section .text of /tmp/a.out +(@value{GDBP}) info symbol 0x2aaaac2811cf +__read_nocancel + 6 in section .text of /usr/lib64/libc.so.6 +@end smallexample + @kindex whatis @item whatis [@var{arg}] Print the data type of @var{arg}, which can be either an expression or @@ -24608,6 +24618,10 @@ the symbol's location to the specified a the @code{info address} command (@pxref{Symbols}), except that this command also allows to find symbols in other sections. +If section was not specified, the section in which the symbol was found +is also printed. For dynamically linked executables, the name of +executable or shared library containing the symbol is printed as well. + @end table The following command is useful for non-interactive invocations of --0016364177e1154874045bbd07f7--