Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] [patch] 'info symbol' to print more info
@ 2008-11-15 16:15 Paul Pluzhnikov
  2008-11-15 17:00 ` Michael Snyder
  2008-11-15 17:40 ` Eli Zaretskii
  0 siblings, 2 replies; 16+ messages in thread
From: Paul Pluzhnikov @ 2008-11-15 16:15 UTC (permalink / raw)
  To: gdb-patches; +Cc: ppluzhnikov

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?

Thanks,

--
Paul Pluzhnikov

2008-11-14  Paul Pluzhnikov  <ppluzhnikov@google.com>

	* 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");
       }
   }


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2008-11-18 21:32 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-15 16:15 [RFA] [patch] 'info symbol' to print more info 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
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox