public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* PATCH: printing scalars with objdump --debugging
@ 2008-01-07 16:22 Greg McGary
  2008-01-08  8:39 ` Alan Modra
  0 siblings, 1 reply; 2+ messages in thread
From: Greg McGary @ 2008-01-07 16:22 UTC (permalink / raw)
  To: binutils

"objdump --debugging" represents scalars with the type VMA.  If VMA fits
within a host's long, scalars are printf'ed with "%lx", "%lu" or "%ld"
according to type.   If VMA doesn't fit in the host's long, scalars are
all printed as full-width hex.  This causes trouble for scripts that
digest the output, since output format depends on the cross-host where
objdump runs, e.g. ix86 vs. x86_64.  This patch takes advantage of "%ll"
formats, if available.

OK to commmit?
(I have CVS permissions and copyright assignments on file with FSF)

Greg


2008-01-04  Greg McGary  <greg@mcgary.org>

	* prdbg.c (print_vma): Print as long long, if host supports it.

 
Index: binutils/prdbg.c
===================================================================
RCS file: /cvs/src/src/binutils/prdbg.c,v
retrieving revision 1.19
diff -u -p -r1.19 prdbg.c
--- binutils/prdbg.c	5 Jul 2007 16:54:45 -0000	1.19
+++ binutils/prdbg.c	4 Jan 2008 18:14:03 -0000
@@ -1,5 +1,5 @@
 /* prdbg.c -- Print out generic debugging information.
-   Copyright 1995, 1996, 1999, 2002, 2003, 2004, 2006, 2007
+   Copyright 1995, 1996, 1999, 2002, 2003, 2004, 2006, 2007, 2008
    Free Software Foundation, Inc.
    Written by Ian Lance Taylor <ian@cygnus.com>.
    Tags style generation written by Salvador E. Tropea <set@computer.org>.
@@ -499,6 +499,17 @@ print_vma (bfd_vma vma, char *buf, bfd_b
       else
 	sprintf (buf, "%ld", (long) vma);
     }
+#if BFD_HOST_64BIT_LONG_LONG
+  else if (sizeof (vma) <= sizeof (unsigned long long))
+    {
+      if (hexp)
+	sprintf (buf, "0x%llx", (unsigned long long) vma);
+      else if (unsignedp)
+	sprintf (buf, "%llu", (unsigned long long) vma);
+      else
+	sprintf (buf, "%lld", (long long) vma);
+    }
+#endif
   else
     {
       buf[0] = '0';

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

* Re: PATCH: printing scalars with objdump --debugging
  2008-01-07 16:22 PATCH: printing scalars with objdump --debugging Greg McGary
@ 2008-01-08  8:39 ` Alan Modra
  0 siblings, 0 replies; 2+ messages in thread
From: Alan Modra @ 2008-01-08  8:39 UTC (permalink / raw)
  To: Greg McGary; +Cc: binutils

On Fri, Jan 04, 2008 at 11:23:12AM -0700, Greg McGary wrote:
> 	* prdbg.c (print_vma): Print as long long, if host supports it.

OK.

-- 
Alan Modra
Australia Development Lab, IBM

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

end of thread, other threads:[~2008-01-07  8:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-07 16:22 PATCH: printing scalars with objdump --debugging Greg McGary
2008-01-08  8:39 ` Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).