Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Paul Pluzhnikov <ppluzhnikov@google.com>
To: Michael Snyder <msnyder@vmware.com>, Eli Zaretskii <eliz@gnu.org>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [RFA] [patch] 'info symbol' to print more info
Date: Sat, 15 Nov 2008 23:16:00 -0000	[thread overview]
Message-ID: <8ac60eac0811150842x78206050t435c6f8c89ddc8ae@mail.gmail.com> (raw)
In-Reply-To: <491E08BF.2050609@vmware.com>

[-- Attachment #1: Type: text/plain, Size: 925 bytes --]

On Fri, Nov 14, 2008 at 3:24 PM, Michael Snyder <msnyder@vmware.com> 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 <eliz@gnu.org> 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  <ppluzhnikov@google.com>

        * 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  <ppluzhnikov@google.com>

        * gdb.texinfo (Symbols): Mention printing containing
	image name in "info symbol".
        (Maint translate-address): Likewise.

[-- Attachment #2: gdb-info-sym-20081115.txt --]
[-- Type: text/plain, Size: 3782 bytes --]

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

  reply	other threads:[~2008-11-15 16:42 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-15 16:15 Paul Pluzhnikov
2008-11-15 17:00 ` Michael Snyder
2008-11-15 17:22   ` Paul Pluzhnikov
2008-11-15 18:51     ` Michael Snyder
2008-11-15 23:16       ` Paul Pluzhnikov [this message]
2008-11-15 23:35         ` Andreas Schwab
2008-11-16  1:35         ` Eli Zaretskii
2008-11-16  1:38           ` Paul Pluzhnikov
2008-11-16  8:20             ` Joel Brobecker
2008-11-17 22:37               ` Paul Pluzhnikov
2008-11-17 23:35                 ` Daniel Jacobowitz
2008-11-18 16:07                   ` Paul Pluzhnikov
2008-11-18 19:55                     ` Eli Zaretskii
2008-11-19  4:20                     ` Joel Brobecker
2008-11-19 12:45                       ` Paul Pluzhnikov
2008-11-15 17:40 ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8ac60eac0811150842x78206050t435c6f8c89ddc8ae@mail.gmail.com \
    --to=ppluzhnikov@google.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=msnyder@vmware.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox