* dwarf2.c (read_abbrevs): Use _raw_size directly rather than
[deliverable/binutils-gdb.git] / bfd / dwarf2.c
index 143c3fa1d8cd91e22a28c4d38713cebd4b94aeb2..5710d1adbd0d00b1c09fd2a0572e661adc997ab4 100644 (file)
@@ -1,5 +1,5 @@
 /* DWARF 2 support.
-   Copyright 1994, 95, 96, 97, 98, 1999 Free Software Foundation, Inc.
+   Copyright 1994, 95, 96, 97, 98, 99, 2000 Free Software Foundation, Inc.
 
    Adapted from gdb/dwarf2read.c by Gavin Koch of Cygnus Solutions
    (gavin@cygnus.com).
@@ -336,15 +336,17 @@ read_address (unit, buf)
      struct comp_unit* unit;
      char *buf;
 {
-  bfd_vma retval = 0;
-
-  if (unit->addr_size == 4)
+  switch (unit->addr_size)
     {
-      retval = bfd_get_32 (unit->abfd, (bfd_byte *) buf);
-    } else {
-      retval = bfd_get_64 (unit->abfd, (bfd_byte *) buf);
+    case 8:
+      return bfd_get_64 (unit->abfd, (bfd_byte *) buf);
+    case 4:
+      return bfd_get_32 (unit->abfd, (bfd_byte *) buf);
+    case 2:
+      return bfd_get_16 (unit->abfd, (bfd_byte *) buf);
+    default:
+      abort ();
     }
-  return retval;
 }
 
 
@@ -429,7 +431,7 @@ read_abbrevs (abfd, offset)
          return 0;
        }
       
-      stash->dwarf_abbrev_size = bfd_get_section_size_before_reloc (msec);
+      stash->dwarf_abbrev_size = msec->_raw_size;
       stash->dwarf_abbrev_buffer = (char*) bfd_alloc (abfd, stash->dwarf_abbrev_size);
       if (! stash->dwarf_abbrev_buffer)
          return 0;
@@ -611,6 +613,10 @@ read_attribute (attr, abbrev, unit, info_ptr)
       DW_UNSND (attr) = read_4_bytes (abfd, info_ptr);
       info_ptr += 4;
       break;
+    case DW_FORM_ref8:
+      DW_UNSND (attr) = read_8_bytes (abfd, info_ptr);
+      info_ptr += 8;
+      break;
     case DW_FORM_ref_udata:
       DW_UNSND (attr) = read_unsigned_leb128 (abfd, info_ptr, &bytes_read);
       info_ptr += bytes_read;
@@ -787,7 +793,7 @@ decode_line_info (unit)
          return 0;
        }
       
-      size = bfd_get_section_size_before_reloc (msec);
+      size = msec->_raw_size;
       stash->dwarf_line_buffer = (char *) bfd_alloc (abfd, size);
       if (! stash->dwarf_line_buffer)
        return 0;
@@ -1273,9 +1279,9 @@ parse_comp_unit (abfd, info_ptr, end_ptr, abbrev_length)
       return 0;
     }
 
-  if (addr_size != 4 && addr_size != 8)
+  if (addr_size != 2 && addr_size != 4 && addr_size != 8)
     {
-      (*_bfd_error_handler) ("Dwarf Error: found address size '%u', this reader can only handle address sizes '4' and '8'.", addr_size );
+      (*_bfd_error_handler) ("Dwarf Error: found address size '%u', this reader can only handle address sizes '2', '4' and '8'.", addr_size );
       bfd_set_error (bfd_error_bad_value);
       return 0;
     }
@@ -1512,7 +1518,7 @@ _bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
          return false;
        }
 
-      size = bfd_get_section_size_before_reloc (msec);
+      size = msec->_raw_size;
       if (size == 0)
        return false;
       
This page took 0.024859 seconds and 4 git commands to generate.