@@ -1,3 +1,17 @@
+2014-06-22 Mark Wielaard <mjw@redhat.com>
+
+ * c-typeprint.c (cp_type_print_method_args): Handle '_Atomic'.
+ (c_type_print_modifier): Likewise.
+ * dwarf2read.c (error_check_comp_unit_head): Accept version 5.
+ (read_tag_atomic_type): New function.
+ (read_type_die_1): Handle DW_TAG_atomic_type.
+ * gdbtypes.c (make_atomic_type): New function.
+ (recursive_dump_type): Handle TYPE_ATOMIC.
+ * gdbtypes.h (enum type_flag_values): Renumber.
+ (enum type_instance_flag_value): Add TYPE_INSTANCE_FLAG_ATOMIC.
+ (TYPE_ATOMIC): New macro.
+ (make_atomic_type): Declare.
+
2014-06-20 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix --with-system-readline with readline-6.3 patch 5.
@@ -272,6 +272,9 @@ cp_type_print_method_args (struct type *mtype, const char *prefix,
if (TYPE_RESTRICT (domain))
fprintf_filtered (stream, " restrict");
+
+ if (TYPE_ATOMIC (domain))
+ fprintf_filtered (stream, " _Atomic");
}
}
@@ -433,6 +436,14 @@ c_type_print_modifier (struct type *type, struct ui_file *stream,
did_print_modifier = 1;
}
+ if (TYPE_ATOMIC (type))
+ {
+ if (did_print_modifier || need_pre_space)
+ fprintf_filtered (stream, " ");
+ fprintf_filtered (stream, "_Atomic");
+ did_print_modifier = 1;
+ }
+
address_space_id = address_space_int_to_name (get_type_arch (type),
TYPE_INSTANCE_FLAGS (type));
if (address_space_id)
@@ -4286,9 +4286,9 @@ error_check_comp_unit_head (struct comp_unit_head *header,
bfd *abfd = get_section_bfd_owner (section);
const char *filename = get_section_file_name (section);
- if (header->version != 2 && header->version != 3 && header->version != 4)
+ if (header->version < 2 || header->version > 5)
error (_("Dwarf Error: wrong version in compilation unit header "
- "(is %d, should be 2, 3, or 4) [in module %s]"), header->version,
+ "(is %d, should be 2, 3, 4 or 5) [in module %s]"), header->version,
filename);
if (header->abbrev_offset.sect_off
@@ -14160,6 +14160,22 @@ read_tag_restrict_type (struct die_info *die, struct dwarf2_cu *cu)
return set_die_type (die, cv_type, cu);
}
+static struct type *
+read_tag_atomic_type (struct die_info *die, struct dwarf2_cu *cu)
+{
+ struct type *base_type, *cv_type;
+
+ base_type = die_type (die, cu);
+
+ /* The die_type call above may have already set the type for this DIE. */
+ cv_type = get_die_type (die, cu);
+ if (cv_type)
+ return cv_type;
+
+ cv_type = make_atomic_type (base_type);
+ return set_die_type (die, cv_type, cu);
+}
+
/* 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
@@ -18489,6 +18505,9 @@ read_type_die_1 (struct die_info *die, struct dwarf2_cu *cu)
case DW_TAG_module:
this_type = read_module_type (die, cu);
break;
+ case DW_TAG_atomic_type:
+ this_type = read_tag_atomic_type (die, cu);
+ break;
default:
complaint (&symfile_complaints,
_("unexpected tag in read_type_die: '%s'"),
@@ -706,6 +706,17 @@ make_restrict_type (struct type *type)
NULL);
}
+/* Make a '_Atomic'-qualified version of TYPE. */
+
+struct type *
+make_atomic_type (struct type *type)
+{
+ return make_qualified_type (type,
+ (TYPE_INSTANCE_FLAGS (type)
+ | TYPE_INSTANCE_FLAG_ATOMIC),
+ NULL);
+}
+
/* Replace the contents of ntype with the type *type. This changes the
contents, rather than the pointer for TYPE_MAIN_TYPE (ntype); thus
the changes are propogated to all types in the TYPE_CHAIN.
@@ -3785,6 +3796,10 @@ recursive_dump_type (struct type *type, int spaces)
{
puts_filtered (" TYPE_FLAG_RESTRICT");
}
+ if (TYPE_ATOMIC (type))
+ {
+ puts_filtered (" TYPE_FLAG_ATOMIC");
+ }
puts_filtered ("\n");
printfi_filtered (spaces, "flags");
@@ -203,18 +203,18 @@ enum type_code
enum type_flag_value
{
- TYPE_FLAG_UNSIGNED = (1 << 8),
- TYPE_FLAG_NOSIGN = (1 << 9),
- TYPE_FLAG_STUB = (1 << 10),
- TYPE_FLAG_TARGET_STUB = (1 << 11),
- TYPE_FLAG_STATIC = (1 << 12),
- TYPE_FLAG_PROTOTYPED = (1 << 13),
- TYPE_FLAG_INCOMPLETE = (1 << 14),
- TYPE_FLAG_VARARGS = (1 << 15),
- TYPE_FLAG_VECTOR = (1 << 16),
- TYPE_FLAG_FIXED_INSTANCE = (1 << 17),
- TYPE_FLAG_STUB_SUPPORTED = (1 << 18),
- TYPE_FLAG_GNU_IFUNC = (1 << 19),
+ TYPE_FLAG_UNSIGNED = (1 << 9),
+ TYPE_FLAG_NOSIGN = (1 << 10),
+ TYPE_FLAG_STUB = (1 << 11),
+ TYPE_FLAG_TARGET_STUB = (1 << 12),
+ TYPE_FLAG_STATIC = (1 << 13),
+ TYPE_FLAG_PROTOTYPED = (1 << 14),
+ TYPE_FLAG_INCOMPLETE = (1 << 15),
+ TYPE_FLAG_VARARGS = (1 << 16),
+ TYPE_FLAG_VECTOR = (1 << 17),
+ TYPE_FLAG_FIXED_INSTANCE = (1 << 18),
+ TYPE_FLAG_STUB_SUPPORTED = (1 << 19),
+ TYPE_FLAG_GNU_IFUNC = (1 << 20),
/* * Used for error-checking. */
TYPE_FLAG_MIN = TYPE_FLAG_UNSIGNED
@@ -233,7 +233,8 @@ enum type_instance_flag_value
TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1 = (1 << 4),
TYPE_INSTANCE_FLAG_ADDRESS_CLASS_2 = (1 << 5),
TYPE_INSTANCE_FLAG_NOTTEXT = (1 << 6),
- TYPE_INSTANCE_FLAG_RESTRICT = (1 << 7)
+ TYPE_INSTANCE_FLAG_RESTRICT = (1 << 7),
+ TYPE_INSTANCE_FLAG_ATOMIC = (1 << 8)
};
/* * Unsigned integer type. If this is not set for a TYPE_CODE_INT,
@@ -365,6 +366,12 @@ enum type_instance_flag_value
#define TYPE_RESTRICT(t) \
(TYPE_INSTANCE_FLAGS (t) & TYPE_INSTANCE_FLAG_RESTRICT)
+/* * Atomic type. If this is set, the corresponding type has an
+ _Atomic modifier. */
+
+#define TYPE_ATOMIC(t) \
+ (TYPE_INSTANCE_FLAGS (t) & TYPE_INSTANCE_FLAG_ATOMIC)
+
/* * Instruction-space delimited type. This is for Harvard architectures
which have separate instruction and data address spaces (and perhaps
others).
@@ -1627,6 +1634,8 @@ extern struct type *make_cv_type (int, int, struct type *, struct type **);
extern struct type *make_restrict_type (struct type *);
+extern struct type *make_atomic_type (struct type *);
+
extern void replace_type (struct type *, struct type *);
extern int address_space_name_to_int (struct gdbarch *, char *);
@@ -1,3 +1,10 @@
+2014-06-22 Mark Wielaard <mjw@redhat.com>
+
+ * gdb.dwarf2/dw2-error.exp: Adjust for new error message.
+ * gdb.dwarf2/dw2-atomic.S: New file.
+ * gdb.dwarf2/dw2-atomic.c: New file.
+ * gdb.dwarf2/dw2-atomic.exp: New file.
+
2014-06-20 Gary Benson <gbenson@redhat.com>
* gdb.arch/i386-avx.exp: Fix include file location.
new file mode 100644
@@ -0,0 +1,330 @@
+/* Copyright (C) 2014 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ This was created using gcc -S -std=c11 -gdwarf-5 dw2-atomic.c.
+
+ */
+
+ .file "dw2-atomic.c"
+ .text
+.Ltext0:
+ .globl f
+ .type f, @function
+f:
+.LFB0:
+ .file 1 "dw2-atomic.c"
+ .loc 1 19 0
+ .cfi_startproc
+ pushq %rbp
+ .cfi_def_cfa_offset 16
+ .cfi_offset 6, -16
+ movq %rsp, %rbp
+ .cfi_def_cfa_register 6
+ movq %rdi, -24(%rbp)
+ .loc 1 20 0
+ movq -24(%rbp), %rax
+ movzbl (%rax), %eax
+ movb %al, -1(%rbp)
+ movzbl -1(%rbp), %eax
+ movsbl %al, %eax
+ .loc 1 21 0
+ popq %rbp
+ .cfi_def_cfa 7, 8
+ ret
+ .cfi_endproc
+.LFE0:
+ .size f, .-f
+ .comm hipsters,8,8
+ .globl main
+ .type main, @function
+main:
+.LFB1:
+ .loc 1 26 0
+ .cfi_startproc
+ pushq %rbp
+ .cfi_def_cfa_offset 16
+ .cfi_offset 6, -16
+ movq %rsp, %rbp
+ .cfi_def_cfa_register 6
+ subq $16, %rsp
+ .loc 1 27 0
+ movq hipsters(%rip), %rax
+ movq %rax, -8(%rbp)
+ movq -8(%rbp), %rax
+ movq %rax, %rdi
+ call f
+ .loc 1 28 0
+ leave
+ .cfi_def_cfa 7, 8
+ ret
+ .cfi_endproc
+.LFE1:
+ .size main, .-main
+.Letext0:
+ .section .debug_info,"",@progbits
+.Ldebug_info0:
+ .long 0xb0
+ .value 0x5
+ .long .Ldebug_abbrev0
+ .byte 0x8
+ .uleb128 0x1
+ .long .LASF1
+ .byte 0x1
+ .long .LASF2
+ .long .LASF3
+ .quad .Ltext0
+ .quad .Letext0-.Ltext0
+ .long .Ldebug_line0
+ .uleb128 0x2
+ .string "f"
+ .byte 0x1
+ .byte 0x12
+ .long 0x59
+ .quad .LFB0
+ .quad .LFE0-.LFB0
+ .uleb128 0x1
+ .byte 0x9c
+ .long 0x59
+ .uleb128 0x3
+ .string "x"
+ .byte 0x1
+ .byte 0x12
+ .long 0x60
+ .uleb128 0x2
+ .byte 0x91
+ .sleb128 -40
+ .byte 0
+ .uleb128 0x4
+ .byte 0x4
+ .byte 0x5
+ .string "int"
+ .uleb128 0x5
+ .long 0x65
+ .uleb128 0x6
+ .long 0x6a
+ .uleb128 0x7
+ .byte 0x8
+ .long 0x70
+ .uleb128 0x5
+ .long 0x75
+ .uleb128 0x8
+ .long 0x7a
+ .uleb128 0x9
+ .byte 0x1
+ .byte 0x6
+ .long .LASF0
+ .uleb128 0xa
+ .long .LASF4
+ .byte 0x1
+ .byte 0x19
+ .long 0x59
+ .quad .LFB1
+ .quad .LFE1-.LFB1
+ .uleb128 0x1
+ .byte 0x9c
+ .uleb128 0xb
+ .long .LASF5
+ .byte 0x1
+ .byte 0x17
+ .long 0x60
+ .uleb128 0x9
+ .byte 0x3
+ .quad hipsters
+ .byte 0
+ .section .debug_abbrev,"",@progbits
+.Ldebug_abbrev0:
+ .uleb128 0x1
+ .uleb128 0x11
+ .byte 0x1
+ .uleb128 0x25
+ .uleb128 0xe
+ .uleb128 0x13
+ .uleb128 0xb
+ .uleb128 0x3
+ .uleb128 0xe
+ .uleb128 0x1b
+ .uleb128 0xe
+ .uleb128 0x11
+ .uleb128 0x1
+ .uleb128 0x12
+ .uleb128 0x7
+ .uleb128 0x10
+ .uleb128 0x17
+ .byte 0
+ .byte 0
+ .uleb128 0x2
+ .uleb128 0x2e
+ .byte 0x1
+ .uleb128 0x3f
+ .uleb128 0x19
+ .uleb128 0x3
+ .uleb128 0x8
+ .uleb128 0x3a
+ .uleb128 0xb
+ .uleb128 0x3b
+ .uleb128 0xb
+ .uleb128 0x27
+ .uleb128 0x19
+ .uleb128 0x49
+ .uleb128 0x13
+ .uleb128 0x11
+ .uleb128 0x1
+ .uleb128 0x12
+ .uleb128 0x7
+ .uleb128 0x40
+ .uleb128 0x18
+ .uleb128 0x2117
+ .uleb128 0x19
+ .uleb128 0x1
+ .uleb128 0x13
+ .byte 0
+ .byte 0
+ .uleb128 0x3
+ .uleb128 0x5
+ .byte 0
+ .uleb128 0x3
+ .uleb128 0x8
+ .uleb128 0x3a
+ .uleb128 0xb
+ .uleb128 0x3b
+ .uleb128 0xb
+ .uleb128 0x49
+ .uleb128 0x13
+ .uleb128 0x2
+ .uleb128 0x18
+ .byte 0
+ .byte 0
+ .uleb128 0x4
+ .uleb128 0x24
+ .byte 0
+ .uleb128 0xb
+ .uleb128 0xb
+ .uleb128 0x3e
+ .uleb128 0xb
+ .uleb128 0x3
+ .uleb128 0x8
+ .byte 0
+ .byte 0
+ .uleb128 0x5
+ .uleb128 0x47
+ .byte 0
+ .uleb128 0x49
+ .uleb128 0x13
+ .byte 0
+ .byte 0
+ .uleb128 0x6
+ .uleb128 0x35
+ .byte 0
+ .uleb128 0x49
+ .uleb128 0x13
+ .byte 0
+ .byte 0
+ .uleb128 0x7
+ .uleb128 0xf
+ .byte 0
+ .uleb128 0xb
+ .uleb128 0xb
+ .uleb128 0x49
+ .uleb128 0x13
+ .byte 0
+ .byte 0
+ .uleb128 0x8
+ .uleb128 0x26
+ .byte 0
+ .uleb128 0x49
+ .uleb128 0x13
+ .byte 0
+ .byte 0
+ .uleb128 0x9
+ .uleb128 0x24
+ .byte 0
+ .uleb128 0xb
+ .uleb128 0xb
+ .uleb128 0x3e
+ .uleb128 0xb
+ .uleb128 0x3
+ .uleb128 0xe
+ .byte 0
+ .byte 0
+ .uleb128 0xa
+ .uleb128 0x2e
+ .byte 0
+ .uleb128 0x3f
+ .uleb128 0x19
+ .uleb128 0x3
+ .uleb128 0xe
+ .uleb128 0x3a
+ .uleb128 0xb
+ .uleb128 0x3b
+ .uleb128 0xb
+ .uleb128 0x49
+ .uleb128 0x13
+ .uleb128 0x11
+ .uleb128 0x1
+ .uleb128 0x12
+ .uleb128 0x7
+ .uleb128 0x40
+ .uleb128 0x18
+ .uleb128 0x2116
+ .uleb128 0x19
+ .byte 0
+ .byte 0
+ .uleb128 0xb
+ .uleb128 0x34
+ .byte 0
+ .uleb128 0x3
+ .uleb128 0xe
+ .uleb128 0x3a
+ .uleb128 0xb
+ .uleb128 0x3b
+ .uleb128 0xb
+ .uleb128 0x49
+ .uleb128 0x13
+ .uleb128 0x3f
+ .uleb128 0x19
+ .uleb128 0x2
+ .uleb128 0x18
+ .byte 0
+ .byte 0
+ .byte 0
+ .section .debug_aranges,"",@progbits
+ .long 0x2c
+ .value 0x2
+ .long .Ldebug_info0
+ .byte 0x8
+ .byte 0
+ .value 0
+ .value 0
+ .quad .Ltext0
+ .quad .Letext0-.Ltext0
+ .quad 0
+ .quad 0
+ .section .debug_line,"",@progbits
+.Ldebug_line0:
+ .section .debug_str,"MS",@progbits,1
+.LASF2:
+ .string "dw2-atomic.c"
+.LASF4:
+ .string "main"
+.LASF3:
+ .string "/home/mark/src/binutils-gdb/gdb/testsuite/gdb.dwarf2"
+.LASF5:
+ .string "hipsters"
+.LASF0:
+ .string "char"
+.LASF1:
+ .string "GNU C 4.10.0 20140618 (experimental) -mtune=generic -march=x86-64 -gdwarf-5 -std=c11"
+ .ident "GCC: (GNU) 4.10.0 20140618 (experimental)"
+ .section .note.GNU-stack,"",@progbits
new file mode 100644
@@ -0,0 +1,28 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2014 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+int f (const _Atomic char * volatile _Atomic x)
+{
+ return x[0];
+}
+
+_Atomic const char * _Atomic volatile hipsters;
+
+int main()
+{
+ return f(hipsters);
+}
similarity index 55%
copy from gdb/testsuite/gdb.dwarf2/dw2-error.exp
copy to gdb/testsuite/gdb.dwarf2/dw2-atomic.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2014 Free Software Foundation, Inc.
+# Copyright 2014 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,27 +17,18 @@ load_lib dwarf.exp
# This test can only be run on targets which support DWARF-2 and use gas.
if {![dwarf2_support]} {
- return 0
+ return 0
+}
+
+# This test can only be run on x86-64 targets.
+if {![istarget x86_64-*] || ![is_lp64_target]} {
+ return 0
}
standard_testfile .S
-# We can't use prepare_for_testing here because we need to check the
-# 'file' command's output.
-if {[build_executable $testfile.exp $testfile $srcfile {nodebug}]} {
+if {[prepare_for_testing $testfile.exp $testfile $srcfile {nodebug}]} {
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-
-gdb_test_no_output "set breakpoint pending off"
-
-# First test that reading symbols fails.
-gdb_test "file $binfile" \
- "Reading symbols.*Dwarf Error: wrong version in compilation unit header .is 153, should be 2, 3, or 4.*" \
- "file $testfile"
-
-# Now check that we can still break given the minimal symbol.
-gdb_test "break main" "Breakpoint $decimal.*"
+gdb_test "ptype f" "int \\(const _Atomic char \\\* volatile _Atomic\\)"
@@ -36,7 +36,7 @@ gdb_test_no_output "set breakpoint pending off"
# First test that reading symbols fails.
gdb_test "file $binfile" \
- "Reading symbols.*Dwarf Error: wrong version in compilation unit header .is 153, should be 2, 3, or 4.*" \
+ "Reading symbols.*Dwarf Error: wrong version in compilation unit header .is 153, should be 2, 3, 4 or 5.*" \
"file $testfile"
# Now check that we can still break given the minimal symbol.
@@ -1,3 +1,7 @@
+2014-06-22 Mark Wielaard <mjw@redhat.com>
+
+ * dwarf2.def: Add DW_TAG_atomic_type.
+
2014-06-13 Alan Modra <amodra@gmail.com>
* bfdlink.h (struct bfd_link_hash_table): Add hash_table_free field.
@@ -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)