Commit f37230f0 by Jason Merrill

tweak

From-SVN: r12976
parent 29a5d7cc
...@@ -637,6 +637,7 @@ static void decls_for_scope (); ...@@ -637,6 +637,7 @@ static void decls_for_scope ();
static void gen_decl_die (); static void gen_decl_die ();
static unsigned lookup_filename (); static unsigned lookup_filename ();
static int constant_size PROTO((long unsigned)); static int constant_size PROTO((long unsigned));
static enum dwarf_form value_format PROTO((dw_val_ref));
/* Definitions of defaults for assembler-dependent names of various /* Definitions of defaults for assembler-dependent names of various
pseudo-ops and section names. pseudo-ops and section names.
...@@ -2775,14 +2776,8 @@ build_abbrev_table (die) ...@@ -2775,14 +2776,8 @@ build_abbrev_table (die)
while (a_attr != NULL && d_attr != NULL) while (a_attr != NULL && d_attr != NULL)
{ {
if ((a_attr->dw_attr != d_attr->dw_attr) if ((a_attr->dw_attr != d_attr->dw_attr)
|| (a_attr->dw_attr_val.val_class || (value_format (&a_attr->dw_attr_val)
!= d_attr->dw_attr_val.val_class) != value_format (&d_attr->dw_attr_val)))
|| (a_attr->dw_attr_val.val_class
== dw_val_class_unsigned_const
&& (constant_size (a_attr->dw_attr_val
.v.val_unsigned)
!= constant_size (d_attr->dw_attr_val
.v.val_unsigned))))
{ {
break; break;
} }
...@@ -2979,6 +2974,17 @@ size_of_loc_descr (loc) ...@@ -2979,6 +2974,17 @@ size_of_loc_descr (loc)
return size; return size;
} }
/* Return the size of a series of location descriptors. */
static unsigned long
size_of_locs (loc)
register dw_loc_descr_ref loc;
{
register unsigned long size = 0;
for (; loc != NULL; loc = loc->dw_loc_next)
size += size_of_loc_descr (loc);
return size;
}
/* Return the power-of-two number of bytes necessary to represent VALUE. */ /* Return the power-of-two number of bytes necessary to represent VALUE. */
static int static int
constant_size (value) constant_size (value)
...@@ -3015,13 +3021,14 @@ size_of_die (die) ...@@ -3015,13 +3021,14 @@ size_of_die (die)
size += PTR_SIZE; size += PTR_SIZE;
break; break;
case dw_val_class_loc: case dw_val_class_loc:
/* Block length. */ {
size += 2; register unsigned long lsize
for (loc = a->dw_attr_val.v.val_loc; loc != NULL; = size_of_locs (a->dw_attr_val.v.val_loc);
loc = loc->dw_loc_next)
{ /* Block length. */
size += size_of_loc_descr (loc); size += constant_size (lsize);
} size += lsize;
}
break; break;
case dw_val_class_const: case dw_val_class_const:
size += 4; size += 4;
...@@ -3321,63 +3328,64 @@ output_sleb128 (value) ...@@ -3321,63 +3328,64 @@ output_sleb128 (value)
while (more); while (more);
} }
/* Output the encoding of an attribute value. */ /* Select the encoding of an attribute value. */
static void static enum dwarf_form
output_value_format (v) value_format (v)
dw_val_ref v; dw_val_ref v;
{ {
enum dwarf_form form;
switch (v->val_class) switch (v->val_class)
{ {
case dw_val_class_addr: case dw_val_class_addr:
form = DW_FORM_addr; return DW_FORM_addr;
break;
case dw_val_class_loc: case dw_val_class_loc:
form = DW_FORM_block2; switch (constant_size (size_of_locs (v->v.val_loc)))
break; {
case 1:
return DW_FORM_block1;
case 2:
return DW_FORM_block2;
default:
abort ();
}
case dw_val_class_const: case dw_val_class_const:
form = DW_FORM_data4; return DW_FORM_data4;
break;
case dw_val_class_unsigned_const: case dw_val_class_unsigned_const:
switch (constant_size (v->v.val_unsigned)) switch (constant_size (v->v.val_unsigned))
{ {
case 1: case 1:
form = DW_FORM_data1; return DW_FORM_data1;
break;
case 2: case 2:
form = DW_FORM_data2; return DW_FORM_data2;
break;
case 4: case 4:
form = DW_FORM_data4; return DW_FORM_data4;
break;
default: default:
abort (); abort ();
} }
break;
case dw_val_class_double_const: case dw_val_class_double_const:
form = DW_FORM_data8; return DW_FORM_data8;
break;
case dw_val_class_flag: case dw_val_class_flag:
form = DW_FORM_flag; return DW_FORM_flag;
break;
case dw_val_class_die_ref: case dw_val_class_die_ref:
form = DW_FORM_ref; return DW_FORM_ref;
break;
case dw_val_class_fde_ref: case dw_val_class_fde_ref:
form = DW_FORM_data; return DW_FORM_data;
break;
case dw_val_class_lbl_id: case dw_val_class_lbl_id:
form = DW_FORM_addr; return DW_FORM_addr;
break;
case dw_val_class_section_offset: case dw_val_class_section_offset:
form = DW_FORM_data; return DW_FORM_data;
break;
case dw_val_class_str: case dw_val_class_str:
form = DW_FORM_string; return DW_FORM_string;
break;
default: default:
abort (); abort ();
} }
}
/* Output the encoding of an attribute value. */
static void
output_value_format (v)
dw_val_ref v;
{
enum dwarf_form form = value_format (v);
output_uleb128 (form); output_uleb128 (form);
if (flag_verbose_asm) if (flag_verbose_asm)
{ {
...@@ -3604,14 +3612,19 @@ output_die (die) ...@@ -3604,14 +3612,19 @@ output_die (die)
a->dw_attr_val.v.val_addr); a->dw_attr_val.v.val_addr);
break; break;
case dw_val_class_loc: case dw_val_class_loc:
size = 0; size = size_of_locs (a->dw_attr_val.v.val_loc);
for (loc = a->dw_attr_val.v.val_loc; loc != NULL; /* Output the block length for this list of location operations. */
loc = loc->dw_loc_next) switch (constant_size (size))
{ {
size += size_of_loc_descr (loc); case 1:
ASM_OUTPUT_DWARF_DATA1 (asm_out_file, size);
break;
case 2:
ASM_OUTPUT_DWARF_DATA2 (asm_out_file, size);
break;
default:
abort ();
} }
/* Output the block length for this list of location operations. */
ASM_OUTPUT_DWARF_DATA2 (asm_out_file, size);
if (flag_verbose_asm) if (flag_verbose_asm)
{ {
fprintf (asm_out_file, "\t%s %s", fprintf (asm_out_file, "\t%s %s",
......
...@@ -2077,13 +2077,18 @@ location_attribute (rtl) ...@@ -2077,13 +2077,18 @@ location_attribute (rtl)
(See the `bit_offset_attribute' function below.) */ (See the `bit_offset_attribute' function below.) */
static void static void
data_member_location_attribute (decl) data_member_location_attribute (t)
register tree decl; register tree t;
{ {
register unsigned object_offset_in_bytes = field_byte_offset (decl); register unsigned object_offset_in_bytes;
char begin_label[MAX_ARTIFICIAL_LABEL_BYTES]; char begin_label[MAX_ARTIFICIAL_LABEL_BYTES];
char end_label[MAX_ARTIFICIAL_LABEL_BYTES]; char end_label[MAX_ARTIFICIAL_LABEL_BYTES];
if (TREE_CODE (t) == TREE_VEC)
object_offset_in_bytes = TREE_INT_CST_LOW (BINFO_OFFSET (t));
else
object_offset_in_bytes = field_byte_offset (t);
ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_location); ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_location);
sprintf (begin_label, LOC_BEGIN_LABEL_FMT, current_dienum); sprintf (begin_label, LOC_BEGIN_LABEL_FMT, current_dienum);
sprintf (end_label, LOC_END_LABEL_FMT, current_dienum); sprintf (end_label, LOC_END_LABEL_FMT, current_dienum);
...@@ -3580,6 +3585,33 @@ output_string_type_die (arg) ...@@ -3580,6 +3585,33 @@ output_string_type_die (arg)
} }
static void static void
output_inheritance_die (arg)
register void *arg;
{
register tree binfo = arg;
ASM_OUTPUT_DWARF_TAG (asm_out_file, TAG_inheritance);
sibling_attribute ();
type_attribute (BINFO_TYPE (binfo), 0, 0);
data_member_location_attribute (binfo);
if (TREE_VIA_VIRTUAL (binfo))
{
ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_virtual);
ASM_OUTPUT_DWARF_STRING (asm_out_file, "");
}
if (TREE_VIA_PUBLIC (binfo))
{
ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_public);
ASM_OUTPUT_DWARF_STRING (asm_out_file, "");
}
else if (TREE_VIA_PROTECTED (binfo))
{
ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_protected);
ASM_OUTPUT_DWARF_STRING (asm_out_file, "");
}
}
static void
output_structure_type_die (arg) output_structure_type_die (arg)
register void *arg; register void *arg;
{ {
...@@ -4184,10 +4216,21 @@ output_type (type, containing_scope) ...@@ -4184,10 +4216,21 @@ output_type (type, containing_scope)
if (TYPE_SIZE (type)) if (TYPE_SIZE (type))
{ {
/* First output info about the base classes. */
if (TYPE_BINFO (type) && TYPE_BINFO_BASETYPES (type))
{
register tree bases = TYPE_BINFO_BASETYPES (type);
register int n_bases = TREE_VEC_LENGTH (bases);
register int i;
for (i = 0; i < n_bases; i++)
output_die (output_inheritance_die, TREE_VEC_ELT (bases, i));
}
{ {
register tree normal_member; register tree normal_member;
/* First output info about the data members and type members. */ /* Now output info about the data members and type members. */
for (normal_member = TYPE_FIELDS (type); for (normal_member = TYPE_FIELDS (type);
normal_member; normal_member;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment