@@ -1,3 +1,13 @@
+2014-06-22 Mark Wielaard <mjw@redhat.com>
+
+ * dwarf2out.h (enum dw_mod_flag): Add dw_mod_atomic.
+ * dwarf2out.c (dw_mod_decl_flags): Handle TYPE_ATOMIC.
+ (dw_mod_type_flags): Likewise.
+ (dw_mods_to_quals): Likewise.
+ (dw_mod_qualified_type): Likewise.
+ (modified_type_die): Likewise.
+ opts.c (common_handle_option): Accept -gdwarf-5.
+
2014-06-20 Mark Wielaard <mjw@redhat.com>
PR debug/59051
@@ -10507,7 +10507,8 @@ dw_mod_decl_flags (const_tree decl)
| (TREE_THIS_VOLATILE (decl) ? dw_mod_volatile : dw_mod_none)
| ((POINTER_TYPE_P (TREE_TYPE (decl))
&& TYPE_RESTRICT (TREE_TYPE (decl)))
- ? dw_mod_restrict : dw_mod_none));
+ ? dw_mod_restrict : dw_mod_none)
+ | (TYPE_ATOMIC (TREE_TYPE (decl)) ? dw_mod_atomic : dw_mod_none));
}
static int
@@ -10516,7 +10517,8 @@ dw_mod_type_flags (const_tree type)
return ((TYPE_READONLY (type) ? dw_mod_const : dw_mod_none)
| (TYPE_VOLATILE (type) ? dw_mod_volatile : dw_mod_none)
| ((POINTER_TYPE_P (type) && TYPE_RESTRICT (type))
- ? dw_mod_restrict : dw_mod_none));
+ ? dw_mod_restrict : dw_mod_none)
+ | (TYPE_ATOMIC (type) ? dw_mod_atomic : dw_mod_none));
}
static int
@@ -10524,7 +10526,8 @@ dw_mods_to_quals (int mods)
{
return (((mods & dw_mod_const) ? TYPE_QUAL_CONST : 0)
| ((mods & dw_mod_volatile) ? TYPE_QUAL_VOLATILE : 0)
- | ((mods & dw_mod_restrict) ? TYPE_QUAL_RESTRICT : 0));
+ | ((mods & dw_mod_restrict) ? TYPE_QUAL_RESTRICT : 0)
+ | ((mods & dw_mod_atomic) ? TYPE_QUAL_ATOMIC : 0));
}
/* Returns true if there is a qualified type with at least one
@@ -10549,6 +10552,9 @@ dw_mod_qualified_type (tree type, int mods)
if (mods & dw_mod_restrict)
return dw_mod_qualified_type (type, mods & ~dw_mod_restrict);
+ if (mods & dw_mod_atomic)
+ return dw_mod_qualified_type (type, mods & ~dw_mod_atomic);
+
gcc_unreachable ();
}
@@ -10575,6 +10581,10 @@ modified_type_die (tree type, int mods, dw_die_ref context_die)
if (dwarf_version < 3)
mods &= ~dw_mod_restrict;
+ /* Likewise for DW_TAG_atomic_type for DWARFv5. */
+ if (dwarf_version < 5)
+ mods &= ~dw_mod_atomic;
+
/* See if we already have the appropriately qualified variant of
this type. */
qualified_type = get_qualified_type (type, dw_mods_to_quals (mods));
@@ -10618,9 +10628,11 @@ modified_type_die (tree type, int mods, dw_die_ref context_die)
else if ((mods & dw_mod_const) < TYPE_READONLY (dtype)
|| (mods & dw_mod_volatile) < TYPE_VOLATILE (dtype)
|| (mods & dw_mod_restrict) < TYPE_RESTRICT (dtype)
+ || (mods & dw_mod_atomic) < TYPE_ATOMIC (dtype)
|| ((mods & dw_mod_const) <= TYPE_READONLY (dtype)
&& (mods & dw_mod_volatile) <= TYPE_VOLATILE (dtype)
&& (mods & dw_mod_restrict) <= TYPE_RESTRICT (dtype)
+ && (mods & dw_mod_atomic) <= TYPE_ATOMIC (dtype)
&& DECL_ORIGINAL_TYPE (name) != type))
/* cv-unqualified version of named type. Just use the unnamed
type to which it refers. */
@@ -10649,11 +10661,19 @@ modified_type_die (tree type, int mods, dw_die_ref context_die)
mod_type_die = new_die (DW_TAG_volatile_type, mod_scope, type);
sub_die = modified_type_die (type, mods & ~dw_mod_volatile, context_die);
}
- else if (mods & dw_mod_restrict)
+ else if ((mods & dw_mod_restrict)
+ && (((mods & ~dw_mod_restrict) == dw_mod_none)
+ || get_qualified_type (type, dw_mods_to_quals (mods)) == NULL_TREE
+ || dw_mod_qualified_type (type, mods & ~dw_mod_restrict)))
{
mod_type_die = new_die (DW_TAG_restrict_type, mod_scope, type);
sub_die = modified_type_die (type, mods & ~dw_mod_restrict, context_die);
}
+ else if (mods & dw_mod_atomic)
+ {
+ mod_type_die = new_die (DW_TAG_atomic_type, mod_scope, type);
+ sub_die = modified_type_die (type, mods & ~dw_mod_atomic, context_die);
+ }
else if (code == POINTER_TYPE)
{
mod_type_die = new_die (DW_TAG_pointer_type, mod_scope, type);
@@ -52,7 +52,8 @@ enum dw_mod_flag {
dw_mod_none = 0,
dw_mod_restrict = 1,
dw_mod_const = 1 << 1,
- dw_mod_volatile = 1 << 2
+ dw_mod_volatile = 1 << 2,
+ dw_mod_atomic = 1 << 3
};
typedef union GTY(()) {
@@ -1839,7 +1839,7 @@ common_handle_option (struct gcc_options *opts,
/* FALLTHRU */
case OPT_gdwarf_:
- if (value < 2 || value > 4)
+ if (value < 2 || value > 5)
error_at (loc, "dwarf version %d is not supported", value);
else
opts->x_dwarf_version = value;
@@ -1,3 +1,9 @@
+2014-06-22 Mark Wielaard <mjw@redhat.com>
+
+ * lib/gcc-gdb-test.exp (gdb-test): Catch '<unknown type in ' to
+ recognize older gdb versions.
+ * gcc.dg/guality/atomic.c: New test.
+
2014-06-20 Mark Wielaard <mjw@redhat.com>
* gcc.dg/guality/restrict.c: New test.
new file mode 100644
@@ -0,0 +1,13 @@
+/* debuginfo tests for the _Atomic type qualifier. */
+/* { dg-do run } */
+/* { dg-options "-std=c11 -gdwarf-5" } */
+
+volatile _Atomic int * const _Atomic hwaddr = (void *) 0x1234;
+
+int
+main (int argc, char **argv)
+{
+ return hwaddr == (void *) argv[0];
+}
+
+/* { dg-final { gdb-test 10 "type:hwaddr" "volatile _Atomic int * const _Atomic" } } */
@@ -83,7 +83,7 @@ proc gdb-test { args } {
remote_expect target [timeout_value] {
# Too old GDB
- -re "Unhandled dwarf expression|Error in sourced command file" {
+ -re "Unhandled dwarf expression|Error in sourced command file|<unknown type in " {
unsupported "$testname"
remote_close target
file delete $cmd_file
@@ -1,3 +1,7 @@
+2014-06-22 Mark Wielaard <mjw@redhat.com>
+
+ * dwarf2.def: Add DWARFv5 DW_TAG_atomic_type.
+
2014-06-10 Thomas Schwinge <thomas@codesourcery.com>
PR lto/61334
@@ -133,6 +133,8 @@ DW_TAG (DW_TAG_shared_type, 0x40)
DW_TAG (DW_TAG_type_unit, 0x41)
DW_TAG (DW_TAG_rvalue_reference_type, 0x42)
DW_TAG (DW_TAG_template_alias, 0x43)
+/* DWARF 5. */
+DW_TAG (DW_TAG_atomic_type, 0x47)
DW_TAG_DUP (DW_TAG_lo_user, 0x4080)
DW_TAG_DUP (DW_TAG_hi_user, 0xffff)