This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Patch objdump prefix hexadecimal numbers with 0x


All

The attached patch changes objdump_print_value to add a 
0x prefix to the hexadecimal value printed.

Graham

ChangeLog

	* objdump.c (objdump_print_value): Add 0x prefix to the
	value printed.

	(objdump_print_addr_with_sym): Remove Ox prefix.
	(objdump_print_addr_with_sym): Likewise.
	(objdump_print_addr): Likewise.
	(disassemble_bytes): Likewise.
	(disassemble_bytes): Add two spaces to align addresses
	in the output.
Index: objdump.c
===================================================================
RCS file: /cvs/cvsfiles/devo/binutils/objdump.c,v
retrieving revision 1.228
diff -c -p -r1.228 objdump.c
*** objdump.c	2001/08/11 21:56:29	1.228
--- objdump.c	2001/09/26 09:25:55
*************** objdump_print_value (vma, info, skip_zer
*** 621,627 ****
        if (*p == '\0')
  	--p;
      }
!   (*info->fprintf_func) (info->stream, "%s", p);
  }
  
  /* Print the name of a symbol.  */
--- 621,627 ----
        if (*p == '\0')
  	--p;
      }
!   (*info->fprintf_func) (info->stream, "0x%s", p);
  }
  
  /* Print the name of a symbol.  */
*************** objdump_print_addr_with_sym (abfd, sec, 
*** 810,821 ****
        secaddr = bfd_get_section_vma (abfd, sec);
        if (vma < secaddr)
  	{
! 	  (*info->fprintf_func) (info->stream, "-0x");
  	  objdump_print_value (secaddr - vma, info, true);
  	}
        else if (vma > secaddr)
  	{
! 	  (*info->fprintf_func) (info->stream, "+0x");
  	  objdump_print_value (vma - secaddr, info, true);
  	}
        (*info->fprintf_func) (info->stream, ">");
--- 810,821 ----
        secaddr = bfd_get_section_vma (abfd, sec);
        if (vma < secaddr)
  	{
! 	  (*info->fprintf_func) (info->stream, "-");
  	  objdump_print_value (secaddr - vma, info, true);
  	}
        else if (vma > secaddr)
  	{
! 	  (*info->fprintf_func) (info->stream, "+");
  	  objdump_print_value (vma - secaddr, info, true);
  	}
        (*info->fprintf_func) (info->stream, ">");
*************** objdump_print_addr_with_sym (abfd, sec, 
*** 826,837 ****
        objdump_print_symname (abfd, info, sym);
        if (bfd_asymbol_value (sym) > vma)
  	{
! 	  (*info->fprintf_func) (info->stream, "-0x");
  	  objdump_print_value (bfd_asymbol_value (sym) - vma, info, true);
  	}
        else if (vma > bfd_asymbol_value (sym))
  	{
! 	  (*info->fprintf_func) (info->stream, "+0x");
  	  objdump_print_value (vma - bfd_asymbol_value (sym), info, true);
  	}
        (*info->fprintf_func) (info->stream, ">");
--- 826,837 ----
        objdump_print_symname (abfd, info, sym);
        if (bfd_asymbol_value (sym) > vma)
  	{
! 	  (*info->fprintf_func) (info->stream, "-");
  	  objdump_print_value (bfd_asymbol_value (sym) - vma, info, true);
  	}
        else if (vma > bfd_asymbol_value (sym))
  	{
! 	  (*info->fprintf_func) (info->stream, "+");
  	  objdump_print_value (vma - bfd_asymbol_value (sym), info, true);
  	}
        (*info->fprintf_func) (info->stream, ">");
*************** objdump_print_addr (vma, info, skip_zero
*** 852,858 ****
  
    if (sorted_symcount < 1)
      {
-       (*info->fprintf_func) (info->stream, "0x");
        objdump_print_value (vma, info, skip_zeroes);
        return;
      }
--- 852,857 ----
*************** disassemble_bytes (info, disassemble_fn,
*** 1291,1297 ****
  		*s = ' ';
  	      if (*s == '\0')
  		*--s = '0';
! 	      printf ("%s:\t", buf + skip_addr_chars);
  	    }
  	  else
  	    {
--- 1290,1296 ----
  		*s = ' ';
  	      if (*s == '\0')
  		*--s = '0';
! 	      printf ("  %s:\t", buf + skip_addr_chars);
  	    }
  	  else
  	    {
*************** disassemble_bytes (info, disassemble_fn,
*** 1428,1434 ****
  		    *s = ' ';
  		  if (*s == '\0')
  		    *--s = '0';
! 		  printf ("%s:\t", buf + skip_addr_chars);
  
  		  pb += octets_per_line;
  		  if (pb > octets)
--- 1427,1433 ----
  		    *s = ' ';
  		  if (*s == '\0')
  		    *--s = '0';
! 		  printf ("  %s:\t", buf + skip_addr_chars);
  
  		  pb += octets_per_line;
  		  if (pb > octets)
*************** disassemble_bytes (info, disassemble_fn,
*** 1510,1516 ****
  
  	      if (q->addend)
  		{
! 		  printf ("+0x");
  		  objdump_print_value (q->addend, info, true);
  		}
  
--- 1509,1515 ----
  
  	      if (q->addend)
  		{
! 		  printf ("+");
  		  objdump_print_value (q->addend, info, true);
  		}
  

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]