From patchwork Sun Jun 22 10:25:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Wielaard X-Patchwork-Id: 1650 Received: (qmail 5377 invoked by alias); 22 Jun 2014 10:25:41 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 5349 invoked by uid 89); 22 Jun 2014 10:25:38 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, SPF_PASS autolearn=ham version=3.3.2 X-HELO: gnu.wildebeest.org Received: from wildebeest.demon.nl (HELO gnu.wildebeest.org) (212.238.236.112) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Sun, 22 Jun 2014 10:25:35 +0000 From: Mark Wielaard To: gdb-patches@sourceware.org Cc: Tom Tromey , Mark Wielaard Subject: [PATCH] DWARFv5. Handle DW_TAG_atomic_type _Atomic type modifier. Date: Sun, 22 Jun 2014 12:25:16 +0200 Message-Id: <1403432716-8344-1-git-send-email-mjw@redhat.com> X-Spam-Score: -2.9 (--) This prototype patch matches the experimental patch to GCC: https://gcc.gnu.org/ml/gcc-patches/2014-06/msg01677.html The same questions apply to this patch: The following is just a prototype to try out a new qualifier type tag proposed for DWARFv5. There is not even a draft yet of DWARFv5, so this is just based on a proposal that might or might not be adopted and/or changed http://dwarfstd.org/ShowIssue.php?issue=131112.1 Since there is not even a draft of DWARFv5 I don't recommend adopting this patch. All details may change in the future. I am mainly doing it to give better feedback on the DWARFv5 proposals (in this case the feedback would be that it is unfortunate we cannot easily do this as a vendor extension with DW_TAG_GNU_atomic_type since that would break backward compatibility). Feedback on the patch is of course still very welcome. Is there a recommended way for doing/keeping these kind of speculative patches? I'll keep a local git branch with my experiments that I'll rebase against master for larger updates. And would like to send out new patches to the list for review even if we won't adopt them for now. But if there is a better way/best practice for this kind of experimental changes based on just ideas for a next version of a not yet public standard please let me know. gdb/ChangeLog * 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. gdb/testsuite/ChangeLog * 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. include/ChangeLog * dwarf2.def: Add DW_TAG_atomic_type. --- gdb/ChangeLog | 14 + gdb/c-typeprint.c | 11 + gdb/dwarf2read.c | 23 ++- gdb/gdbtypes.c | 15 + gdb/gdbtypes.h | 35 ++- gdb/testsuite/ChangeLog | 7 + gdb/testsuite/gdb.dwarf2/dw2-atomic.S | 330 ++++++++++++++++++++ gdb/testsuite/gdb.dwarf2/dw2-atomic.c | 28 ++ .../gdb.dwarf2/{dw2-error.exp => dw2-atomic.exp} | 27 +- gdb/testsuite/gdb.dwarf2/dw2-error.exp | 2 +- include/ChangeLog | 4 + include/dwarf2.def | 2 + 12 files changed, 464 insertions(+), 34 deletions(-) create mode 100644 gdb/testsuite/gdb.dwarf2/dw2-atomic.S create mode 100644 gdb/testsuite/gdb.dwarf2/dw2-atomic.c copy gdb/testsuite/gdb.dwarf2/{dw2-error.exp => dw2-atomic.exp} (55%) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 734b910..6284ad4 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,17 @@ +2014-06-22 Mark Wielaard + + * 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 Fix --with-system-readline with readline-6.3 patch 5. diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c index 305f92d..72effce 100644 --- a/gdb/c-typeprint.c +++ b/gdb/c-typeprint.c @@ -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) diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index ba64256..50bc194 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -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'"), diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index d0c002f..42ff588 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -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"); diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index bb6352d..03468f8 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -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 *); diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 1e7ef7f..f44881f 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2014-06-22 Mark Wielaard + + * 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 * gdb.arch/i386-avx.exp: Fix include file location. diff --git a/gdb/testsuite/gdb.dwarf2/dw2-atomic.S b/gdb/testsuite/gdb.dwarf2/dw2-atomic.S new file mode 100644 index 0000000..17e7b3d --- /dev/null +++ b/gdb/testsuite/gdb.dwarf2/dw2-atomic.S @@ -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 . + + 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 diff --git a/gdb/testsuite/gdb.dwarf2/dw2-atomic.c b/gdb/testsuite/gdb.dwarf2/dw2-atomic.c new file mode 100644 index 0000000..a22513b --- /dev/null +++ b/gdb/testsuite/gdb.dwarf2/dw2-atomic.c @@ -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 . */ + +int f (const _Atomic char * volatile _Atomic x) +{ + return x[0]; +} + +_Atomic const char * _Atomic volatile hipsters; + +int main() +{ + return f(hipsters); +} diff --git a/gdb/testsuite/gdb.dwarf2/dw2-error.exp b/gdb/testsuite/gdb.dwarf2/dw2-atomic.exp similarity index 55% copy from gdb/testsuite/gdb.dwarf2/dw2-error.exp copy to gdb/testsuite/gdb.dwarf2/dw2-atomic.exp index 65eac6d..43c7db5 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-error.exp +++ b/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\\)" diff --git a/gdb/testsuite/gdb.dwarf2/dw2-error.exp b/gdb/testsuite/gdb.dwarf2/dw2-error.exp index 65eac6d..260765e 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-error.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-error.exp @@ -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. diff --git a/include/ChangeLog b/include/ChangeLog index 96ae31d..23f27a9 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,7 @@ +2014-06-22 Mark Wielaard + + * dwarf2.def: Add DW_TAG_atomic_type. + 2014-06-13 Alan Modra * bfdlink.h (struct bfd_link_hash_table): Add hash_table_free field. diff --git a/include/dwarf2.def b/include/dwarf2.def index 71a37b3..6941922 100644 --- a/include/dwarf2.def +++ b/include/dwarf2.def @@ -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)