* dwarfread.c (struct dieinfo): Add has_at_byte_size.
authorFred Fish <fnf@specifix.com>
Sun, 9 Aug 1992 06:14:59 +0000 (06:14 +0000)
committerFred Fish <fnf@specifix.com>
Sun, 9 Aug 1992 06:14:59 +0000 (06:14 +0000)
* dwarfread.c (struct_type):  In absence of AT_byte_size for
bitfield, use size of object of member's type for the size of
the anonymous object containing the bit field.
* dwarfread.c (completedieinfo):  Set has_at_byte_size when
an AT_byte_size attribute is seen.
* mipsread.c (psymtab_to_symtab_1):  Fix misspelled cast to
union aux_ext (was aux_ent).
* i386-pinsn.c (print_insn):  Cast 2'nd arg to read_memory from
unsigned char* to char*, for Lucid compiler.
* i386-tdep.c (codestream_fill):  Fix cast of 2'nd arg to read_memory
to be correct type (from unsigned char* to char*).
* valprint.c (type_print_derivation_info):  Minor tweak to placement
of commas in derived class printing.
* xcoffread.c (builtin_type):  Fix misspelling in fatal message.

gdb/ChangeLog
gdb/dwarfread.c
gdb/i386-pinsn.c
gdb/xcoffread.c

index 331ae339aecd5aef31753b85671f6b76c46212c0..9b49a9c6dbf02f2fcf5a8d3416acbd68d73e916d 100644 (file)
@@ -1,3 +1,21 @@
+Sat Aug  8 23:12:22 1992  Fred Fish  (fnf@cygnus.com)
+
+       * dwarfread.c (struct dieinfo):  Add has_at_byte_size.
+       * dwarfread.c (struct_type):  In absence of AT_byte_size for
+       bitfield, use size of object of member's type for the size of
+       the anonymous object containing the bit field.
+       * dwarfread.c (completedieinfo):  Set has_at_byte_size when
+       an AT_byte_size attribute is seen.
+       * mipsread.c (psymtab_to_symtab_1):  Fix misspelled cast to
+       union aux_ext (was aux_ent).
+       * i386-pinsn.c (print_insn):  Cast 2'nd arg to read_memory from
+       unsigned char* to char*, for Lucid compiler.
+       * i386-tdep.c (codestream_fill):  Fix cast of 2'nd arg to read_memory
+       to be correct type (from unsigned char* to char*).
+       * valprint.c (type_print_derivation_info):  Minor tweak to placement
+       of commas in derived class printing.
+       * xcoffread.c (builtin_type):  Fix misspelling in fatal message.
+
 Fri Aug  7 11:18:23 1992  Steve Chamberlain  (sac@thepub.cygnus.com)
 
        * xm-go32.h: Define LSEEK_NOT_LINEAR
index fde32e64527e47e2798d9470605e0b012f77f0be..82ee4167cc19f6eba02eb1bd7099c3031c9de3b7 100644 (file)
@@ -204,6 +204,7 @@ struct dieinfo {
   char *               at_prototyped;
   unsigned int         has_at_low_pc:1;
   unsigned int         has_at_stmt_list:1;
+  unsigned int         has_at_byte_size:1;
   unsigned int         short_element_list:1;
 };
 
@@ -807,6 +808,7 @@ struct_type (dip, thisdie, enddie, objfile)
   char *tpart1;
   struct dieinfo mbr;
   char *nextdie;
+  int anonymous_size;
   
   if ((type = lookup_utype (dip -> die_ref)) == NULL)
     {
@@ -841,10 +843,12 @@ struct_type (dip, thisdie, enddie, objfile)
       TYPE_NAME (type) = obconcat (&objfile -> type_obstack,
                                   tpart1, " ", dip -> at_name);
     }
-  if (dip -> at_byte_size != 0)
-    {
-      TYPE_LENGTH (type) = dip -> at_byte_size;
-    }
+  /* Use whatever size is known.  Zero is a valid size.  We might however
+     wish to check has_at_byte_size to make sure that some byte size was
+     given explicitly, but DWARF doesn't specify that explicit sizes of
+     zero have to present, so complaining about missing sizes should 
+     probably not be the default. */
+  TYPE_LENGTH (type) = dip -> at_byte_size;
   thisdie += dip -> die_length;
   while (thisdie < enddie)
     {
@@ -892,8 +896,22 @@ struct_type (dip, thisdie, enddie, objfile)
             itself.  The result is the bit offset of the LSB of the field. */
          if (mbr.at_bit_size > 0)
            {
+             if (mbr.has_at_byte_size)
+               {
+                 /* The size of the anonymous object containing the bit field
+                    is explicit, so use the indicated size (in bytes). */
+                 anonymous_size = mbr.at_byte_size;
+               }
+             else
+               {
+                 /* The size of the anonymous object containing the bit field
+                    matches the size of an object of the bit field's type.
+                    DWARF allows at_byte_size to be left out in such cases,
+                    as a debug information size optimization. */
+                 anonymous_size = TYPE_LENGTH (list -> field.type);
+               }
              list -> field.bitpos +=
-               mbr.at_byte_size * 8 - mbr.at_bit_offset - mbr.at_bit_size;
+               anonymous_size * 8 - mbr.at_bit_offset - mbr.at_bit_size;
            }
 #endif
          nfields++;
@@ -3224,6 +3242,7 @@ completedieinfo (dip, objfile)
        case AT_byte_size:
          dip -> at_byte_size = target_to_host (diep, nbytes, GET_UNSIGNED,
                                                objfile);
+         dip -> has_at_byte_size = 1;
          break;
        case AT_bit_size:
          dip -> at_bit_size = target_to_host (diep, nbytes, GET_UNSIGNED,
index c6ecaa6ecf1a6eebcb468a4bed1f6c2caec16609..bbc622f281d6cbad2e1c16c9d91dceffcfaa3421 100644 (file)
@@ -1890,7 +1890,7 @@ print_insn (memaddr, stream)
 {
   unsigned char buffer[MAXLEN];
   
-  read_memory (memaddr, buffer, MAXLEN);
+  read_memory (memaddr, (char *) buffer, MAXLEN);
   
   return (i386dis ((int)memaddr, buffer, stream));
 }
index fb1ccac9fe248eb528164480c0cdf641ceac3f68..77197855e753fc0df3f512bce3b1f9e68f8caf1d 100644 (file)
@@ -2383,6 +2383,6 @@ struct type *
 builtin_type (ignore)
 char **ignore;
 {
-    fatal ("GDB internal eror: builtin_type called on non-RS/6000!");
+    fatal ("GDB internal error: builtin_type called on non-RS/6000!");
 }
 #endif /* IBM6000_HOST */
This page took 0.031846 seconds and 4 git commands to generate.