aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>1999-08-27 10:34:58 +0000
committerNick Clifton <nickc@redhat.com>1999-08-27 10:34:58 +0000
commit7a4b7442d49a7f4ac3da7fc5a1ce2f92e37e8a08 (patch)
tree7e237244677bf964f4c9375b0527384aa9109771
parentcb30237e0f71d61782030d14f41b5827cb2cbe1b (diff)
downloadgdb-7a4b7442d49a7f4ac3da7fc5a1ce2f92e37e8a08.zip
gdb-7a4b7442d49a7f4ac3da7fc5a1ce2f92e37e8a08.tar.gz
gdb-7a4b7442d49a7f4ac3da7fc5a1ce2f92e37e8a08.tar.bz2
Patch from Jim Wilson - more bug fixes for line table decoding.
-rw-r--r--binutils/ChangeLog7
-rw-r--r--binutils/readelf.c15
2 files changed, 18 insertions, 4 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index cbfae90..d863c73 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,5 +1,12 @@
1999-08-27 Jim Wilson <wilson@cygnus.com>
+ * readelf.c (display_debug_lines): Use i-1 not i in standard_opcodes
+ access.
+ (display_debug_aranges): New local excess. Use for calculating padding
+ and add that into ranges. Break from loop only if length is also 0.
+
+1999-08-27 Jim Wilson <wilson@cygnus.com>
+
* readelf.c (display_debug_lines, case DW_LNS_const_add_pc): Multiply
adv by info.li_min_insn_length.
diff --git a/binutils/readelf.c b/binutils/readelf.c
index c785a49..00c71a3 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -4262,7 +4262,7 @@ display_debug_lines (section, start, file)
printf (_("\n Opcodes:\n"));
for (i = 1; i < info.li_opcode_base; i++)
- printf (_(" Opcode %d has %d args\n"), i, standard_opcodes[i]);
+ printf (_(" Opcode %d has %d args\n"), i, standard_opcodes[i - 1]);
/* Display the contents of the Directory table. */
data = standard_opcodes + info.li_opcode_base - 1;
@@ -5754,6 +5754,7 @@ display_debug_aranges (section, start, file)
unsigned char * ranges;
unsigned long length;
unsigned long address;
+ int excess;
external = (DWARF2_External_ARange *) start;
@@ -5773,19 +5774,25 @@ display_debug_aranges (section, start, file)
ranges = start + sizeof (* external);
+ /* Must pad to an alignment boundary that is twice the pointer size. */
+ excess = sizeof (*external) % (2 * arange.ar_pointer_size);
+ if (excess)
+ ranges += (2 * arange.ar_pointer_size) - excess;
+
for (;;)
{
address = byte_get (ranges, arange.ar_pointer_size);
- if (address == 0)
- break;
-
ranges += arange.ar_pointer_size;
length = byte_get (ranges, arange.ar_pointer_size);
ranges += arange.ar_pointer_size;
+ /* A pair of zeros marks the end of the list. */
+ if (address == 0 && length == 0)
+ break;
+
printf (" %8.8lx %lu\n", address, length);
}