+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
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;
unsigned char * ranges;
unsigned long length;
unsigned long address;
+ int excess;
external = (DWARF2_External_ARange *) start;
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);
}