[PATCH] stack: -b, --build-id shows module build-id, load address and pc offset.

Mark Wielaard mjw at redhat.com
Thu Jan 2 23:01:13 UTC 2014


On Thu, Jan 02, 2014 at 09:14:28PM +0100, Jan Kratochvil wrote:
> On Mon, 23 Dec 2013 11:21:52 +0100, Mark Wielaard wrote:
> [...]
> > +	    {
> > +	      printf ("\n    [");
> > +	      do
> > +		printf ("%02" PRIx8, *id++);
> > +	      while (--id_len > 0);
> > +	      printf ("]@0x%0" PRIx64 "+%" PRIx64, start, pc_adjusted - start);
> why not:
>    	      printf ("]@0x%0" PRIx64 "+0x%" PRIx64, start, pc_adjusted - start);
> > +	    }
> 
> Example output:
> #63 0x000000000040054e bt
>     [dc2908a524b82c19b6f26e66803193d54d394b33]@0x400000+54d
> why not:
>     [dc2908a524b82c19b6f26e66803193d54d394b33]@0x400000+0x54d
> 
> I would find it easier to handle by copy-pastes, for example for address
> computations in GDB (or what other tool people use for computing addresseS).

Agreed that is a better looking and more consistent output.

Thanks,

Mark
-------------- next part --------------
>From 36490c9e861b6ba93d839d2c09f6dc66d60ed87e Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mjw at redhat.com>
Date: Thu, 2 Jan 2014 23:59:41 +0100
Subject: [PATCH] stack.c (print_frames): Print 0x before build-id hex-offset.

Signed-off-by: Mark Wielaard <mjw at redhat.com>
---
 src/ChangeLog | 4 ++++
 src/stack.c   | 3 ++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/ChangeLog b/src/ChangeLog
index 6a915a1..8f1df36 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,9 @@
 2014-01-02  Mark Wielaard  <mjw at redhat.com>
 
+	* stack.c (print_frames): Print 0x before build-id hex-offset.
+
+2014-01-02  Mark Wielaard  <mjw at redhat.com>
+
 	* stack.c (maxframes): Increase to 2048.
 	(struct frames): Add allocated field.
 	(frame_callback): If frames used is frames allocated, realloc.
diff --git a/src/stack.c b/src/stack.c
index f9f964a..623dc5f 100644
--- a/src/stack.c
+++ b/src/stack.c
@@ -255,7 +255,8 @@ print_frames (struct frames *frames, pid_t tid, int dwflerr, const char *what)
 	      do
 		printf ("%02" PRIx8, *id++);
 	      while (--id_len > 0);
-	      printf ("]@0x%0" PRIx64 "+%" PRIx64, start, pc_adjusted - start);
+	      printf ("]@0x%0" PRIx64 "+0x%" PRIx64,
+		      start, pc_adjusted - start);
 	    }
 	}
 
-- 
1.8.4.2



More information about the elfutils-devel mailing list