Add DWARF 2.1 attributes
authorNick Clifton <nickc@redhat.com>
Fri, 29 Jun 2001 14:17:31 +0000 (14:17 +0000)
committerNick Clifton <nickc@redhat.com>
Fri, 29 Jun 2001 14:17:31 +0000 (14:17 +0000)
binutils/ChangeLog
binutils/readelf.c
include/elf/ChangeLog
include/elf/dwarf2.h

index f273483..4885444 100644 (file)
@@ -1,3 +1,7 @@
+2001-06-29  James Cownie <jcownie@etnus.com>
+
+       * readelf.c: Support DWARF 2.1 attributes.
+
 2001-06-28  Alan Modra  <amodra@bigpond.net.au>
 
        * readelf.c (GET_DATA_ALLOC): Remove.
index 9fea077..027c916 100644 (file)
@@ -2,7 +2,7 @@
    Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
 
    Originally developed by Eric Youngdale <eric@andante.jic.com>
-   Modifications by Nick Clifton <nickc@cygnus.com>
+   Modifications by Nick Clifton <nickc@redhat.com>
 
    This file is part of GNU Binutils.
 
@@ -6015,6 +6015,20 @@ get_AT_name (attribute)
     case DW_AT_variable_parameter: return "DW_AT_variable_parameter";
     case DW_AT_virtuality: return "DW_AT_virtuality";
     case DW_AT_vtable_elem_location: return "DW_AT_vtable_elem_location";
+      /* DWARF 2.1 values.  */
+    case DW_AT_allocated: return "DW_AT_allocated";
+    case DW_AT_associated: return "DW_AT_associated";
+    case DW_AT_data_location: return "DW_AT_data_location";
+    case DW_AT_stride: return "DW_AT_stride";
+    case DW_AT_entry_pc: return "DW_AT_entry_pc";
+    case DW_AT_use_UTF8: return "DW_AT_use_UTF8";
+    case DW_AT_extension: return "DW_AT_extension";
+    case DW_AT_ranges: return "DW_AT_ranges";
+    case DW_AT_trampoline: return "DW_AT_trampoline";
+    case DW_AT_call_column: return "DW_AT_call_column";
+    case DW_AT_call_file: return "DW_AT_call_file";
+    case DW_AT_call_line: return "DW_AT_call_line";
+      /* SGI/MIPS extensions.  */
     case DW_AT_MIPS_fde: return "DW_AT_MIPS_fde";
     case DW_AT_MIPS_loop_begin: return "DW_AT_MIPS_loop_begin";
     case DW_AT_MIPS_tail_loop_begin: return "DW_AT_MIPS_tail_loop_begin";
@@ -6026,6 +6040,7 @@ get_AT_name (attribute)
     case DW_AT_MIPS_abstract_name: return "DW_AT_MIPS_abstract_name";
     case DW_AT_MIPS_clone_origin: return "DW_AT_MIPS_clone_origin";
     case DW_AT_MIPS_has_inlines: return "DW_AT_MIPS_has_inlines";
+      /* GNU extensions.  */
     case DW_AT_sf_names: return "DW_AT_sf_names";
     case DW_AT_src_info: return "DW_AT_src_info";
     case DW_AT_mac_info: return "DW_AT_mac_info";
@@ -6591,6 +6606,22 @@ decode_location_expression (data, pointer_size, length)
          printf ("DW_OP_nop");
          break;
 
+         /* DWARF 2.1 extensions.  */
+       case DW_OP_push_object_address:
+         printf ("DW_OP_push_object_address");
+         break;
+       case DW_OP_call2:
+         printf ("DW_OP_call2: <%lx>", (long) byte_get (data, 2));
+         data += 2;
+         break;
+       case DW_OP_call4:
+         printf ("DW_OP_call4: <%lx>", (long) byte_get (data, 4));
+         data += 4;
+         break;
+       case DW_OP_calli:
+         printf ("DW_OP_calli");
+         break;
+
        default:
          if (op >= DW_OP_lo_user
              && op <= DW_OP_hi_user)
@@ -6600,6 +6631,9 @@ decode_location_expression (data, pointer_size, length)
          /* No way to tell where the next op is, so just bail.  */
          return;
        }
+
+      /* Separate the ops.  */
+      printf ("; ");
     }
 }
 
@@ -6844,10 +6878,25 @@ read_and_display_attr (attribute, form, data, cu_offset, pointer_size)
        }
       break;
 
+    case DW_AT_ordering:
+      switch (uvalue)
+       {
+       case -1: printf ("(undefined)"); break;
+       case 0:  printf ("(row major)"); break;
+       case 1:  printf ("(column major)"); break;
+       }
+      break;
+
     case DW_AT_frame_base:
     case DW_AT_location:
     case DW_AT_data_member_location:
     case DW_AT_vtable_elem_location:
+    case DW_AT_allocated:
+    case DW_AT_associated:
+    case DW_AT_data_location:
+    case DW_AT_stride:
+    case DW_AT_upper_bound:
+    case DW_AT_lower_bound:
       if (block_start)
        {
          printf ("(");
index f7b20dd..4565fe2 100644 (file)
@@ -1,3 +1,7 @@
+2001-06-29  James Cownie <jcownie@etnus.com>
+
+       * dwarf2.h: Add DWARF 2.1 attribues.
+
 2001-06-15  Per Bothner  <per@bothner.com>
 
        * dwarf2.h:  Partial merge with gcc version.
index 365b1dc..06fec21 100644 (file)
@@ -1,6 +1,7 @@
 /* Declarations and definitions of codes relating to the DWARF2 symbolic
    debugging information format.
-   Copyright 1992, 1993, 1995, 1996, 1999, 2000 Free Software Foundation, Inc.
+   Copyright 1992, 1993, 1995, 1996, 1999, 2000, 2001
+   Free Software Foundation, Inc.
 
    Written by Gary Funck (gary@intrepid.com) The Ada Joint Program
    Office (AJPO), Florida State Unviversity and Silicon Graphics Inc.
@@ -29,7 +30,9 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  *
    Revision 2.0.0 (July 27, 1993) developed by the UNIX International
    Programming Languages Special Interest Group (UI/PLSIG) and distributed
    by UNIX International.  Copies of this specification are available from
-   UNIX International, 20 Waterview Boulevard, Parsippany, NJ, 07054.  */
+   UNIX International, 20 Waterview Boulevard, Parsippany, NJ, 07054.
+
+   This file also now contains definitions from the DWARF 2.1 specification.  */
 
 /* This file is shared between GCC and GDB, and should not contain
    prototypes.  */
@@ -124,7 +127,6 @@ DWARF2_Internal_ARange;
 
 
 /* Tag names and codes.  */
-
 enum dwarf_tag
   {
     DW_TAG_padding = 0x00,
@@ -175,10 +177,10 @@ enum dwarf_tag
     DW_TAG_variant_part = 0x33,
     DW_TAG_variable = 0x34,
     DW_TAG_volatile_type = 0x35,
-    /* SGI/MIPS Extensions */
+    /* SGI/MIPS Extensions */
     DW_TAG_MIPS_loop = 0x4081,
-    /* GNU extensions */
-    DW_TAG_format_label = 0x4101,      /* for FORTRAN 77 and Fortran 90 */
+    /* GNU extensions */
+    DW_TAG_format_label = 0x4101,      /* For FORTRAN 77 and Fortran 90.  */
     DW_TAG_function_template = 0x4102, /* for C++ */
     DW_TAG_class_template = 0x4103,    /* for C++ */
     DW_TAG_GNU_BINCL = 0x4104,
@@ -188,7 +190,7 @@ enum dwarf_tag
 #define DW_TAG_lo_user 0x4080
 #define DW_TAG_hi_user 0xffff
 
-/* flag that tells whether entry has a child or not */
+/* Flag that tells whether entry has a child or not.  */
 #define DW_children_no   0
 #define        DW_children_yes  1
 
@@ -284,7 +286,20 @@ enum dwarf_attribute
     DW_AT_variable_parameter = 0x4b,
     DW_AT_virtuality = 0x4c,
     DW_AT_vtable_elem_location = 0x4d,
-    /* SGI/MIPS Extensions */
+   /* DWARF 2.1 values.  */
+    DW_AT_allocated     = 0x4e,
+    DW_AT_associated    = 0x4f,
+    DW_AT_data_location = 0x50,
+    DW_AT_stride        = 0x51,
+    DW_AT_entry_pc      = 0x52,
+    DW_AT_use_UTF8      = 0x53,
+    DW_AT_extension     = 0x54,
+    DW_AT_ranges        = 0x55,
+    DW_AT_trampoline    = 0x56,
+    DW_AT_call_column   = 0x57,
+    DW_AT_call_file     = 0x58,
+    DW_AT_call_line     = 0x59,
+    /* SGI/MIPS Extensions.  */
     DW_AT_MIPS_fde = 0x2001,
     DW_AT_MIPS_loop_begin = 0x2002,
     DW_AT_MIPS_tail_loop_begin = 0x2003,
@@ -297,19 +312,18 @@ enum dwarf_attribute
     DW_AT_MIPS_clone_origin = 0x200a,
     DW_AT_MIPS_has_inlines = 0x200b,
     /* GNU extensions.  */
-    DW_AT_sf_names = 0x2101,
-    DW_AT_src_info = 0x2102,
-    DW_AT_mac_info = 0x2103,
+    DW_AT_sf_names   = 0x2101,
+    DW_AT_src_info   = 0x2102,
+    DW_AT_mac_info   = 0x2103,
     DW_AT_src_coords = 0x2104,
     DW_AT_body_begin = 0x2105,
-    DW_AT_body_end = 0x2106
+    DW_AT_body_end   = 0x2106
   };
 
-#define DW_AT_lo_user  0x2000  /* implementation-defined range start */
-#define DW_AT_hi_user  0x3ff0  /* implementation-defined range end */
+#define DW_AT_lo_user  0x2000  /* Implementation-defined range start.  */
+#define DW_AT_hi_user  0x3ff0  /* Implementation-defined range end.  */
 
 /* Location atom names and codes.  */
-
 enum dwarf_location_atom
   {
     DW_OP_addr = 0x03,
@@ -456,14 +470,18 @@ enum dwarf_location_atom
     DW_OP_piece = 0x93,
     DW_OP_deref_size = 0x94,
     DW_OP_xderef_size = 0x95,
-    DW_OP_nop = 0x96
+    DW_OP_nop = 0x96,
+    /* DWARF 2.1 extensions.  */
+    DW_OP_push_object_address = 0x97,
+    DW_OP_call2 = 0x98, /* 1 2-byte offset of DIE.  */
+    DW_OP_call4 = 0x99, /* 1 4-byte offset of DIE.  */
+    DW_OP_calli = 0x9a
   };
 
-#define DW_OP_lo_user  0x80    /* implementation-defined range start */
-#define DW_OP_hi_user  0xff    /* implementation-defined range end */
+#define DW_OP_lo_user  0x80    /* Implementation-defined range start.  */
+#define DW_OP_hi_user  0xff    /* Implementation-defined range end.  */
 
 /* Type encodings.  */
-
 enum dwarf_type
   {
     DW_ATE_void = 0x0,
@@ -487,7 +505,7 @@ enum dwarf_array_dim_ordering
     DW_ORD_col_major = 1
   };
 
-/* access attribute */
+/* Access attribute.  */
 enum dwarf_access_attribute
   {
     DW_ACCESS_public = 1,
@@ -495,7 +513,7 @@ enum dwarf_access_attribute
     DW_ACCESS_private = 3
   };
 
-/* visibility */
+/* Visibility.  */
 enum dwarf_visibility_attribute
   {
     DW_VIS_local = 1,
@@ -503,7 +521,7 @@ enum dwarf_visibility_attribute
     DW_VIS_qualified = 3
   };
 
-/* virtuality */
+/* Virtuality.  */
 enum dwarf_virtuality_attribute
   {
     DW_VIRTUALITY_none = 0,
@@ -511,7 +529,7 @@ enum dwarf_virtuality_attribute
     DW_VIRTUALITY_pure_virtual = 2
   };
 
-/* case sensitivity */
+/* Case sensitivity.  */
 enum dwarf_id_case
   {
     DW_ID_case_sensitive = 0,
@@ -520,7 +538,7 @@ enum dwarf_id_case
     DW_ID_case_insensitive = 3
   };
 
-/* calling convention */
+/* Calling convention.  */
 enum dwarf_calling_convention
   {
     DW_CC_normal = 0x1,
@@ -531,7 +549,7 @@ enum dwarf_calling_convention
 #define DW_CC_lo_user 0x40
 #define DW_CC_hi_user 0xff
 
-/* inline attribute */
+/* Inline attribute.  */
 enum dwarf_inline_attribute
   {
     DW_INL_not_inlined = 0,
@@ -540,14 +558,14 @@ enum dwarf_inline_attribute
     DW_INL_declared_inlined = 3
   };
 
-/* discriminant lists */
+/* Discriminant lists.  */
 enum dwarf_discrim_list
   {
     DW_DSC_label = 0,
     DW_DSC_range = 1
   };
 
-/* line number opcodes */
+/* Line number opcodes.  */
 enum dwarf_line_number_ops
   {
     DW_LNS_extended_op = 0,
@@ -562,7 +580,7 @@ enum dwarf_line_number_ops
     DW_LNS_fixed_advance_pc = 9
   };
 
-/* line number extended opcodes */
+/* Line number extended opcodes.  */
 enum dwarf_line_number_x_ops
   {
     DW_LNE_end_sequence = 1,
@@ -570,7 +588,7 @@ enum dwarf_line_number_x_ops
     DW_LNE_define_file = 3
   };
 
-/* call frame information */
+/* Call frame information.  */
 enum dwarf_call_frame_info
   {
     DW_CFA_advance_loc = 0x40,
@@ -593,15 +611,15 @@ enum dwarf_call_frame_info
     DW_CFA_def_cfa_offset = 0x0e,
     DW_CFA_def_cfa_expression = 0x0f,
     DW_CFA_expression = 0x10,
-    /* Dwarf 2.1 */
+    /* Dwarf 2.1 */
     DW_CFA_offset_extended_sf = 0x11,
     DW_CFA_def_cfa_sf = 0x12,
     DW_CFA_def_cfa_offset_sf = 0x13,
 
-    /* SGI/MIPS specific */
+    /* SGI/MIPS specific */
     DW_CFA_MIPS_advance_loc8 = 0x1d,
 
-    /* GNU extensions */
+    /* GNU extensions */
     DW_CFA_GNU_window_save = 0x2d,
     DW_CFA_GNU_args_size = 0x2e,
     DW_CFA_GNU_negative_offset_extended = 0x2f
@@ -620,7 +638,6 @@ enum dwarf_call_frame_info
 #define DW_ADDR_none           0
 
 /* Source language names and codes.  */
-
 enum dwarf_source_language
   {
     DW_LANG_C89 = 0x0001,
@@ -638,11 +655,10 @@ enum dwarf_source_language
   };
 
 
-#define DW_LANG_lo_user 0x8000 /* implementation-defined range start */
-#define DW_LANG_hi_user 0xffff /* implementation-defined range start */
+#define DW_LANG_lo_user 0x8000 /* implementation-defined range start */
+#define DW_LANG_hi_user 0xffff /* implementation-defined range start */
 
 /* Names and codes for macro information.  */
-
 enum dwarf_macinfo_record_type
   {
     DW_MACINFO_define = 1,