[RFA]: printing symbols with > 32 bit addrs.

Michael Snyder msnyder@cygnus.com
Wed Feb 28 20:33:00 GMT 2001


Andrew Cagney wrote:
> 
> Michael Snyder wrote:
> >
> >
> >
> >   ------------------------------------------------------------------------
> > Oddly enough, info functions seems to fail to print addresses of
> > non-debugging symbols when addresses are greater than 32 bits.
> > This patch seems a bit crude, so I'm wondering if anyone has
> > a better suggestion.
> 
> And non portable :-)
> 
> > 2001-02-15  Michael Snyder  <msnyder@mvstp600e.cygnus.com>
> >
> >         * symtab.c (print_msymbol_info): Print addresses > 32 bits.
> 
> (Kevin B has a useful cheat sheet of the int->text functions that he
> posted).  At a guess paddr().

OK, how about this modification?
2001-02-28  Michael Snyder  <msnyder@mvstp600e.cygnus.com>

	* symtab.c (print_msymbol_info): Print addresses by portable method
	longest_local_hex_string_custom.  Allow for 64-bit addresses.

Index: symtab.c
===================================================================
RCS file: /cvs/src/src/gdb/symtab.c,v
retrieving revision 1.31
diff -c -3 -p -r1.31 symtab.c
*** symtab.c	2001/02/27 21:57:09	1.31
--- symtab.c	2001/03/01 04:31:15
*************** print_symbol_info (namespace_enum kind, 
*** 2652,2660 ****
  static void
  print_msymbol_info (struct minimal_symbol *msymbol)
  {
!   printf_filtered ("	%08lx  %s\n",
! 		   (unsigned long) SYMBOL_VALUE_ADDRESS (msymbol),
! 		   SYMBOL_SOURCE_NAME (msymbol));
  }
  
  /* This is the guts of the commands "info functions", "info types", and
--- 2652,2667 ----
  static void
  print_msymbol_info (struct minimal_symbol *msymbol)
  {
!   char *tmp;
! 
!   if (TARGET_ADDR_BIT <= 32)
!     tmp = longest_local_hex_string_custom (SYMBOL_VALUE_ADDRESS (msymbol),
! 					   "08l");
!   else
!     tmp = longest_local_hex_string_custom (SYMBOL_VALUE_ADDRESS (msymbol),
! 					   "016l");
!   printf_filtered ("%s  %s\n",
! 		   tmp, SYMBOL_SOURCE_NAME (msymbol));
  }
  
  /* This is the guts of the commands "info functions", "info types", and


More information about the Gdb-patches mailing list