This is the mail archive of the gdb-patches@sourceware.cygnus.com mailing list for the GDB project. See the GDB home page for more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Patch for DW_TAG_packed_type


This patch adds support for DW_TAG_packed_type which is generated by Aonix
ObjectAda.


Mon May  3 16:03:38 1999 Brian Nettleton <bn@aonix.com>

	* dwarf2read.c: Added read_packed_type for DW_TAG_packed_type.


Index: gdb/dwarf2read.c
*** ../gdb-4.17.patch/gdb/dwarf2read.c	Mon May  3 15:56:52 1999
--- gdb/dwarf2read.c	Mon May  3 16:00:20 1999
*************** static void read_tag_const_type PARAMS (
*** 700,705 ****
--- 700,708 ----
  static void read_tag_volatile_type PARAMS ((struct die_info *,
  					    struct objfile *));
  
+ static void read_tag_packed_type PARAMS ((struct die_info *,
+                                           struct objfile *));
+ 
  static void read_tag_string_type PARAMS ((struct die_info *,
  					  struct objfile *));
  
*************** process_die (die, objfile)
*** 1449,1454 ****
--- 1452,1460 ----
  	  new_symbol (die, die->type, objfile);
  	}
        break;
+     case DW_TAG_packed_type:
+       read_tag_packed_type (die, objfile);
+       break;
      case DW_TAG_common_block:
        read_common_block (die, objfile);
        break;
*************** read_tag_volatile_type (die, objfile)
*** 2914,2919 ****
--- 2920,2964 ----
    die->type = die_type (die, objfile);
  }
  
+ /* Extract all information from a DW_TAG_packed_type DIE and add to
+    the user defined type vector.  */
+ 
+ static void
+ read_tag_packed_type (die, objfile)
+      struct die_info *die;
+      struct objfile *objfile;
+ {
+   struct type *type;
+   struct attribute *attr;
+ 
+   if (die->type)
+     {
+       return;
+     }
+ 
+   type = alloc_type(objfile);
+   memcpy(type, die_type (die, objfile), sizeof(struct type));
+   attr = dwarf_attr (die, DW_AT_name);
+   if (attr && DW_STRING (attr))
+     {
+       TYPE_TAG_NAME (type) = obsavestring (check_case(DW_STRING (attr)),
+                                            strlen (DW_STRING (attr)),
+                                            &objfile->type_obstack);
+     }
+   else
+     {
+       TYPE_TAG_NAME (type) = "";
+     }
+ 
+   attr = dwarf_attr (die, DW_AT_byte_size);
+   if (attr)
+     {
+       TYPE_LENGTH (type) = DW_UNSND (attr);
+     }
+ 
+   die->type = type;
+ }
+ 
  /* Extract all information from a DW_TAG_string_type DIE and add to
     the user defined type vector.  It isn't really a user defined type,
     but it behaves like one, with other DIE's using an AT_user_def_type
*************** read_type_die (die, objfile)
*** 4696,4701 ****
--- 4741,4749 ----
        break;
      case DW_TAG_subrange_type:
        read_subrange_type (die, objfile);
+       break;
+     case DW_TAG_packed_type:
+       read_tag_packed_type (die, objfile);
        break;
      default:
        complain (&dwarf2_unexpected_tag, dwarf_tag_name (die->tag));