public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [committed, darwin]: adjust output of -P compact_unwind
@ 2014-03-24  9:18 Tristan Gingold
  0 siblings, 0 replies; only message in thread
From: Tristan Gingold @ 2014-03-24  9:18 UTC (permalink / raw)
  To: binutils@sourceware.org Development

Hello,

this is a minor patch for objdump -P compact_unwind on Mach-O: the stack offset of indirect
entries is now multiplied by the factor so that the displayed output can be directly
interpreted.

Committed on trunk.

Tristan.

binutils/
	* od-macho.c (dump_unwind_encoding_x86): Set the factor.
	(dump_exe_compact_unwind): Change the condition.  Improve
	indentation.

diff --git a/binutils/od-macho.c b/binutils/od-macho.c
index 7754f36..3cd2cf0 100644
--- a/binutils/od-macho.c
+++ b/binutils/od-macho.c
@@ -1157,7 +1157,7 @@ dump_unwind_encoding_x86 (unsigned int encoding, unsigned int sz,
 
 	    stack_adj =
 	      (encoding & MACH_O_UNWIND_X86_64_FRAMELESS_STACK_ADJUST) >> 13;
-	    printf (" size at 0x%03x + 0x%02x", stack_size, stack_adj);
+	    printf (" size at 0x%03x + 0x%02x", stack_size, stack_adj * sz);
 	  }
 	/* Registers are coded using arithmetic compression: the register
 	   is indexed in range 0-6, the second in range 0-5, the third in
@@ -1359,12 +1359,13 @@ dump_exe_compact_unwind (bfd *abfd,
       const unsigned char *level2;
       unsigned int kind;
 
-      if (i == index_count - 1)
-	break;
-
       func_offset = bfd_get_32 (abfd, index_entry->function_offset);
       level2_offset = bfd_get_32 (abfd, index_entry->second_level_offset);
 
+      /* No level-2 for this index (should be the last index).  */
+      if (level2_offset == 0)
+	continue;
+
       level2 = content + level2_offset;
       kind = bfd_get_32 (abfd, level2);
       switch (kind)
@@ -1477,7 +1478,7 @@ dump_exe_compact_unwind (bfd *abfd,
 	nbr_lsda = (next_lsda_offset - lsda_offset) / sizeof (*lsda);
 	for (j = 0; j < nbr_lsda; j++)
 	  {
-	    printf ("   lsda %-3u: function 0x%08x lsda 0x%08x\n",
+	    printf ("   lsda %3u: function 0x%08x lsda 0x%08x\n",
 		    j, (unsigned int) bfd_get_32 (abfd, lsda->function_offset),
 		    (unsigned int) bfd_get_32 (abfd, lsda->lsda_offset));
 	    lsda++;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-03-24  9:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-24  9:18 [committed, darwin]: adjust output of -P compact_unwind Tristan Gingold

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).