aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Gingold <tristan.gingold@adacore.com>2014-03-21 09:25:05 +0100
committerTristan Gingold <tristan.gingold@adacore.com>2014-03-24 10:18:52 +0100
commitaa9fa1e22a61f60c51ef7886cb297bfbad3cc305 (patch)
treea319e7b1051883783c7de49dde1a1e1bd197680e
parent31ae9d245c409ce407c32a36034acf89fdc23a5f (diff)
downloadgdb-aa9fa1e22a61f60c51ef7886cb297bfbad3cc305.zip
gdb-aa9fa1e22a61f60c51ef7886cb297bfbad3cc305.tar.gz
gdb-aa9fa1e22a61f60c51ef7886cb297bfbad3cc305.tar.bz2
Fix stack offset in Mach-O output for -P compact_unwind.
Minor fix in compact unwind output: to be more readable, the stack offset for indirect compact unwind entries are mutiplied by its factor (4 or 8). binutils/ * od-macho.c (dump_unwind_encoding_x86): Set the factor. (dump_exe_compact_unwind): Change the condition. Improve indentation.
-rw-r--r--binutils/ChangeLog6
-rw-r--r--binutils/od-macho.c11
2 files changed, 12 insertions, 5 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 0f2707b..98ecae0 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,9 @@
+2014-03-24 Tristan Gingold <gingold@adacore.com>
+
+ * od-macho.c (dump_unwind_encoding_x86): Set the factor.
+ (dump_exe_compact_unwind): Change the condition. Improve
+ indentation.
+
2014-03-20 Nick Clifton <nickc@redhat.com>
* readelf.c (process_version_sections): Fix off-by-one error in
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++;