-/* Decode a DW_AT_ranges attribute for 64bit DWARF3 . */
-
-static void
-decode_64bit_range (unsigned long offset, bfd_vma base_address)
-{
- const char * start = debug_range_contents + offset;
- const char * end = debug_range_contents + debug_range_size;
-
- do
- {
- bfd_vma a;
- bfd_vma b;
-
- a = byte_get ((unsigned char *) start, 8);
- b = byte_get ((unsigned char *) start + 8, 8);
-
- if (a == 0xffffffff)
- {
- base_address = b;
- }
- else if (a == 0 && b == 0)
- break;
- else if (a > b)
- printf (_(" [corrupt: start > end]"));
- else
- {
- printf (" ");
- print_vma (base_address + a, PREFIX_HEX);
- printf (" - ");
- print_vma (base_address + b, PREFIX_HEX);
- printf (", ");
- }
-
- start += 16;
- }
- while (start < end);
-}
-
-/* Decode a DW_AT_ranges attribute. */
-
-static void
-decode_range (unsigned long offset, bfd_vma base_address)
-{
- const char * start;
- const char * end;
-
- if (offset >= (debug_range_size - 8))
- {
- printf (_("[corrupt: offset is outside the .debug_ranges section]"));
- return;
- }
-
- /* Since all entries in the .debug_ranges section are pairs of either
- 4-byte integers (32-bit DWARF3) or 8-byte integers (64-bit DWARF3)
- the offset should always be a multiple of 8 bytes. */
- if (offset % 8)
- {
- printf (_("[corrupt: offset is not a multiple of 8]"));
- return;
- }
-
- start = debug_range_contents + offset;
-
- if (offset > 0
- /* Be paranoid - check to see if the previous
- two words were and end-of-range marker. */
- && (byte_get ((unsigned char *) start - 4, 4) != 0
- || byte_get ((unsigned char *) start - 8, 4) != 0))
- {
- printf (_("[corrupt: offset is not at the start of a range]"));
- return;
- }
-
- end = debug_range_contents + debug_range_size;
-
- printf ("(");
- do
- {
- unsigned long a;
- unsigned long b;
-
- a = byte_get ((unsigned char *) start, 4);
- b = byte_get ((unsigned char *) start + 4, 4);
-
- if (a == 0xffffffff)
- {
- if (b == 0xffffffff)
- {
- decode_64bit_range (offset, base_address);
- return;
- }
-
- base_address = b;
- }
- else if (a == 0 && b == 0)
- break;
- else if (a > b)
- printf (_("[corrupt: start > end]"));
- else
- {
- if (start > debug_range_contents + offset)
- printf (", ");
-
- printf (_("0x%lx - 0x%lx"),
- (unsigned long) base_address + a,
- (unsigned long) base_address + b);
- }
-
- start += 8;
- }
- while (start < end);
- printf (")");
-}
-