summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog15
-rw-r--r--gdb/c-typeprint.c11
-rw-r--r--gdb/dwarf2read.c21
-rw-r--r--gdb/gdbtypes.c15
-rw-r--r--gdb/gdbtypes.h33
-rw-r--r--gdb/testsuite/ChangeLog6
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-restrict.S426
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-restrict.c26
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-restrict.exp29
9 files changed, 570 insertions, 12 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 9897c9bbff3..9173b579261 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,20 @@
2013-01-14 Tom Tromey <tromey@redhat.com>
+ PR symtab/14442:
+ * c-typeprint.c (cp_type_print_method_args): Handle 'restrict'.
+ (c_type_print_modifier): Likewise.
+ * dwarf2read.c (read_tag_restrict_type): New function.
+ (read_type_die_1): Handle DW_TAG_restrict_type.
+ * gdbtypes.c (make_restrict_type): New function.
+ (recursive_dump_type): Handle TYPE_RESTRICT.
+ * gdbtypes.h (enum type_flag_values): Renumber.
+ (enum type_instance_flag_value): Add
+ TYPE_INSTANCE_FLAG_RESTRICT.
+ (TYPE_RESTRICT): New macro.
+ (make_restrict_type): Declare.
+
+2013-01-14 Tom Tromey <tromey@redhat.com>
+
PR symtab/14931:
* psymtab.c (struct psymtab_state): New.
(discard_psymtabs_upto, make_cleanup_discard_psymtabs): New
diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c
index cb75a4e2764..a6db16290ef 100644
--- a/gdb/c-typeprint.c
+++ b/gdb/c-typeprint.c
@@ -269,6 +269,9 @@ cp_type_print_method_args (struct type *mtype, const char *prefix,
if (TYPE_VOLATILE (domain))
fprintf_filtered (stream, " volatile");
+
+ if (TYPE_RESTRICT (domain))
+ fprintf_filtered (stream, " restrict");
}
}
@@ -422,6 +425,14 @@ c_type_print_modifier (struct type *type, struct ui_file *stream,
did_print_modifier = 1;
}
+ if (TYPE_RESTRICT (type))
+ {
+ if (did_print_modifier || need_pre_space)
+ fprintf_filtered (stream, " ");
+ fprintf_filtered (stream, "restrict");
+ 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 88efbf5aab7..0e636b4d4c0 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -12383,6 +12383,24 @@ read_tag_volatile_type (struct die_info *die, struct dwarf2_cu *cu)
return set_die_type (die, cv_type, cu);
}
+/* Handle DW_TAG_restrict_type. */
+
+static struct type *
+read_tag_restrict_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_restrict_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
@@ -16548,6 +16566,9 @@ read_type_die_1 (struct die_info *die, struct dwarf2_cu *cu)
case DW_TAG_volatile_type:
this_type = read_tag_volatile_type (die, cu);
break;
+ case DW_TAG_restrict_type:
+ this_type = read_tag_restrict_type (die, cu);
+ break;
case DW_TAG_string_type:
this_type = read_tag_string_type (die, cu);
break;
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 85ffbf1c128..588524195a5 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -676,6 +676,17 @@ make_cv_type (int cnst, int voltl,
return ntype;
}
+/* Make a 'restrict'-qualified version of TYPE. */
+
+struct type *
+make_restrict_type (struct type *type)
+{
+ return make_qualified_type (type,
+ (TYPE_INSTANCE_FLAGS (type)
+ | TYPE_INSTANCE_FLAG_RESTRICT),
+ 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.
@@ -3194,6 +3205,10 @@ recursive_dump_type (struct type *type, int spaces)
{
puts_filtered (" TYPE_FLAG_ADDRESS_CLASS_2");
}
+ if (TYPE_RESTRICT (type))
+ {
+ puts_filtered (" TYPE_FLAG_RESTRICT");
+ }
puts_filtered ("\n");
printfi_filtered (spaces, "flags");
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index 8899ef46ac9..8b340a32bca 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -169,18 +169,18 @@ enum type_code
enum type_flag_value
{
- TYPE_FLAG_UNSIGNED = (1 << 7),
- TYPE_FLAG_NOSIGN = (1 << 8),
- TYPE_FLAG_STUB = (1 << 9),
- TYPE_FLAG_TARGET_STUB = (1 << 10),
- TYPE_FLAG_STATIC = (1 << 11),
- TYPE_FLAG_PROTOTYPED = (1 << 12),
- TYPE_FLAG_INCOMPLETE = (1 << 13),
- TYPE_FLAG_VARARGS = (1 << 14),
- TYPE_FLAG_VECTOR = (1 << 15),
- TYPE_FLAG_FIXED_INSTANCE = (1 << 16),
- TYPE_FLAG_STUB_SUPPORTED = (1 << 17),
- TYPE_FLAG_GNU_IFUNC = (1 << 18),
+ 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),
/* Used for error-checking. */
TYPE_FLAG_MIN = TYPE_FLAG_UNSIGNED
@@ -198,6 +198,7 @@ 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)
};
/* Unsigned integer type. If this is not set for a TYPE_CODE_INT, the
@@ -319,6 +320,12 @@ enum type_instance_flag_value
#define TYPE_VOLATILE(t) \
(TYPE_INSTANCE_FLAGS (t) & TYPE_INSTANCE_FLAG_VOLATILE)
+/* Restrict type. If this is set, the corresponding type has a
+ restrict modifier. */
+
+#define TYPE_RESTRICT(t) \
+ (TYPE_INSTANCE_FLAGS (t) & TYPE_INSTANCE_FLAG_RESTRICT)
+
/* Instruction-space delimited type. This is for Harvard architectures
which have separate instruction and data address spaces (and perhaps
others).
@@ -1471,6 +1478,8 @@ extern struct type *make_reference_type (struct type *, struct type **);
extern struct type *make_cv_type (int, int, struct type *, struct type **);
+extern struct type *make_restrict_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 2d3bc160181..e894bcecdde 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,11 @@
2013-01-14 Tom Tromey <tromey@redhat.com>
+ * gdb.dwarf2/dw2-restrict.S: New file.
+ * gdb.dwarf2/dw2-restrict.c: New file.
+ * gdb.dwarf2/dw2-restrict.exp: New file.
+
+2013-01-14 Tom Tromey <tromey@redhat.com>
+
* gdb.dwarf2/dw2-error.exp: New file.
* gdb.dwarf2/dw2-error.c: New file.
* gdb.dwarf2/dw2-error.S: New file.
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-restrict.S b/gdb/testsuite/gdb.dwarf2/dw2-restrict.S
new file mode 100644
index 00000000000..81f7fce5e39
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-restrict.S
@@ -0,0 +1,426 @@
+/* Copyright (C) 2012 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 clang -g -S dw2-restrict.c.
+
+ */
+
+ .file "dw2-restrict.c"
+ .section .debug_frame,"",@progbits
+.Lsection_debug_frame:
+ .section .debug_info,"",@progbits
+.Lsection_info:
+ .section .debug_abbrev,"",@progbits
+.Lsection_abbrev:
+ .section .debug_aranges,"",@progbits
+ .section .debug_macinfo,"",@progbits
+ .section .debug_line,"",@progbits
+.Lsection_line:
+ .section .debug_loc,"",@progbits
+ .section .debug_pubnames,"",@progbits
+ .section .debug_pubtypes,"",@progbits
+ .section .debug_str,"",@progbits
+.Lsection_str:
+ .section .debug_ranges,"",@progbits
+.Ldebug_range:
+ .section .debug_loc,"",@progbits
+.Lsection_debug_loc:
+ .text
+.Ltext_begin:
+ .data
+ .file 1 "dw2-restrict.c"
+ .text
+ .globl f
+ .align 16, 0x90
+ .type f,@function
+f: # @f
+.Leh_func_begin0:
+.Lfunc_begin0:
+ .loc 1 19 0
+.Ltmp0:
+# BB#0:
+ movq %rdi, -8(%rsp)
+ .loc 1 20 3
+.Ltmp1:
+ movq -8(%rsp), %rdi # dw2-restrict.c:20:3
+ movsbl (%rdi), %eax # dw2-restrict.c:20:3
+ ret # dw2-restrict.c:20:3
+.Ltmp2:
+.Ltmp3:
+ .size f, .Ltmp3-f
+.Lfunc_end0:
+.Leh_func_end0:
+
+ .globl main
+ .align 16, 0x90
+ .type main,@function
+main: # @main
+.Leh_func_begin1:
+.Lfunc_begin1:
+ .loc 1 24 0
+.Ltmp7:
+# BB#0:
+ pushq %rbp
+.Ltmp4:
+ movq %rsp, %rbp
+.Ltmp5:
+ subq $16, %rsp
+.Ltmp6:
+ leaq .L.str, %rdi
+ movl $0, -4(%rbp)
+ .loc 1 25 3
+.Ltmp8:
+ callq f # dw2-restrict.c:25:3
+ addq $16, %rsp # dw2-restrict.c:25:3
+ popq %rbp # dw2-restrict.c:25:3
+ ret # dw2-restrict.c:25:3
+.Ltmp9:
+.Ltmp10:
+ .size main, .Ltmp10-main
+.Lfunc_end1:
+.Leh_func_end1:
+
+ .type .L.str,@object # @.str
+ .section .rodata.str1.1,"aMS",@progbits,1
+.L.str:
+ .asciz "hi bob"
+ .size .L.str, 7
+
+ .section .eh_frame,"a",@progbits
+.LEH_frame0:
+.Lsection_eh_frame0:
+.Leh_frame_common0:
+.Lset0 = .Leh_frame_common_end0-.Leh_frame_common_begin0 # Length of Common Information Entry
+ .long .Lset0
+.Leh_frame_common_begin0:
+ .long 0 # CIE Identifier Tag
+ .byte 1 # DW_CIE_VERSION
+ .asciz "zR" # CIE Augmentation
+ .byte 1 # CIE Code Alignment Factor
+ .byte 120 # CIE Data Alignment Factor
+ .byte 16 # CIE Return Address Column
+ .byte 1 # Augmentation Size
+ .byte 3 # FDE Encoding = udata4
+ .byte 12 # DW_CFA_def_cfa
+ .byte 7 # Register
+ .byte 8 # Offset
+ .byte 144 # DW_CFA_offset + Reg (16)
+ .byte 1 # Offset
+ .align 8
+.Leh_frame_common_end0:
+.Lf.eh:
+.Lset1 = .Leh_frame_end0-.Leh_frame_begin0 # Length of Frame Information Entry
+ .long .Lset1
+.Leh_frame_begin0:
+.Lset2 = .Leh_frame_begin0-.Leh_frame_common0 # FDE CIE offset
+ .long .Lset2
+ .long .Leh_func_begin0 # FDE initial location
+.Lset3 = .Leh_func_end0-.Leh_func_begin0 # FDE address range
+ .long .Lset3
+ .byte 0 # Augmentation size
+ .align 8
+.Leh_frame_end0:
+
+.Lmain.eh:
+.Lset4 = .Leh_frame_end1-.Leh_frame_begin1 # Length of Frame Information Entry
+ .long .Lset4
+.Leh_frame_begin1:
+.Lset5 = .Leh_frame_begin1-.Leh_frame_common0 # FDE CIE offset
+ .long .Lset5
+ .long .Leh_func_begin1 # FDE initial location
+.Lset6 = .Leh_func_end1-.Leh_func_begin1 # FDE address range
+ .long .Lset6
+ .byte 0 # Augmentation size
+ .byte 4 # DW_CFA_advance_loc4
+.Lset7 = .Ltmp4-.Leh_func_begin1
+ .long .Lset7
+ .byte 14 # DW_CFA_def_cfa_offset
+ .byte 16 # Offset
+ .byte 134 # DW_CFA_offset + Reg (6)
+ .byte 2 # Offset
+ .byte 4 # DW_CFA_advance_loc4
+.Lset8 = .Ltmp5-.Ltmp4
+ .long .Lset8
+ .byte 13 # DW_CFA_def_cfa_register
+ .byte 6 # Register
+ .align 8
+.Leh_frame_end1:
+
+ .text
+.Ltext_end:
+ .data
+.Ldata_end:
+ .text
+.Lsection_end1:
+ .section .debug_frame,"",@progbits
+.Ldebug_frame_common:
+.Lset9 = .Ldebug_frame_common_end-.Ldebug_frame_common_begin # Length of Common Information Entry
+ .long .Lset9
+.Ldebug_frame_common_begin:
+ .long -1 # CIE Identifier Tag
+ .byte 1 # CIE Version
+ .byte 0 # CIE Augmentation
+ .byte 1 # CIE Code Alignment Factor
+ .byte 120 # CIE Data Alignment Factor
+ .byte 16 # CIE RA Column
+ .byte 12 # DW_CFA_def_cfa
+ .byte 7 # Register
+ .byte 8 # Offset
+ .byte 144 # DW_CFA_offset + Reg (16)
+ .byte 1 # Offset
+ .align 4
+.Ldebug_frame_common_end:
+.Lset10 = .Ldebug_frame_end0-.Ldebug_frame_begin0 # Length of Frame Information Entry
+ .long .Lset10
+.Ldebug_frame_begin0:
+ .long .Ldebug_frame_common # FDE CIE offset
+ .quad .Lfunc_begin0 # FDE initial location
+.Lset11 = .Lfunc_end0-.Lfunc_begin0 # FDE address range
+ .quad .Lset11
+ .align 4
+.Ldebug_frame_end0:
+.Lset12 = .Ldebug_frame_end1-.Ldebug_frame_begin1 # Length of Frame Information Entry
+ .long .Lset12
+.Ldebug_frame_begin1:
+ .long .Ldebug_frame_common # FDE CIE offset
+ .quad .Lfunc_begin1 # FDE initial location
+.Lset13 = .Lfunc_end1-.Lfunc_begin1 # FDE address range
+ .quad .Lset13
+ .byte 4 # DW_CFA_advance_loc4
+.Lset14 = .Ltmp4-.Lfunc_begin1
+ .long .Lset14
+ .byte 14 # DW_CFA_def_cfa_offset
+ .byte 16 # Offset
+ .byte 134 # DW_CFA_offset + Reg (6)
+ .byte 2 # Offset
+ .byte 4 # DW_CFA_advance_loc4
+.Lset15 = .Ltmp5-.Ltmp4
+ .long .Lset15
+ .byte 13 # DW_CFA_def_cfa_register
+ .byte 6 # Register
+ .align 4
+.Ldebug_frame_end1:
+ .section .debug_info,"",@progbits
+.Linfo_begin1:
+ .long 197 # Length of Compilation Unit Info
+ .short 2 # DWARF version number
+ .long .Labbrev_begin # Offset Into Abbrev. Section
+ .byte 8 # Address Size (in bytes)
+ .byte 1 # Abbrev [1] 0xb:0xba DW_TAG_compile_unit
+ .ascii "clang version 2.9 (tags/RELEASE_29/final)" # DW_AT_producer
+ .byte 0
+ .short 12 # DW_AT_language
+ .ascii "dw2-restrict.c" # DW_AT_name
+ .byte 0
+ .quad 0 # DW_AT_entry_pc
+ .quad .Lsection_line # DW_AT_stmt_list
+ .ascii "/tmp" # DW_AT_comp_dir
+ .byte 0
+ .byte 2 # Abbrev [2] 0x5c:0x7 DW_TAG_base_type
+ .byte 5 # DW_AT_encoding
+ .ascii "int" # DW_AT_name
+ .byte 0
+ .byte 4 # DW_AT_byte_size
+ .byte 3 # Abbrev [3] 0x63:0x2f DW_TAG_subprogram
+ .long 146 # DW_AT_sibling
+ .byte 102 # DW_AT_name
+ .byte 0
+ .byte 1 # DW_AT_decl_file
+ .byte 19 # DW_AT_decl_line
+ .byte 1 # DW_AT_prototyped
+ .long 92 # DW_AT_type
+ .byte 1 # DW_AT_external
+ .quad .Lfunc_begin0 # DW_AT_low_pc
+ .quad .Lfunc_end0 # DW_AT_high_pc
+ .byte 1 # DW_AT_frame_base
+ .byte 87
+ .byte 1 # DW_AT_APPLE_omit_frame_ptr
+ .byte 4 # Abbrev [4] 0x85:0xc DW_TAG_formal_parameter
+ .byte 120 # DW_AT_name
+ .byte 0
+ .byte 1 # DW_AT_decl_file
+ .byte 18 # DW_AT_decl_line
+ .long 191 # DW_AT_type
+ .byte 2 # DW_AT_location
+ .byte 145
+ .byte 120
+ .byte 0 # End Of Children Mark
+ .byte 5 # Abbrev [5] 0x92:0x1f DW_TAG_subprogram
+ .ascii "main" # DW_AT_name
+ .byte 0
+ .byte 1 # DW_AT_decl_file
+ .byte 24 # DW_AT_decl_line
+ .long 92 # DW_AT_type
+ .byte 1 # DW_AT_external
+ .quad .Lfunc_begin1 # DW_AT_low_pc
+ .quad .Lfunc_end1 # DW_AT_high_pc
+ .byte 1 # DW_AT_frame_base
+ .byte 86
+ .byte 2 # Abbrev [2] 0xb1:0x8 DW_TAG_base_type
+ .byte 6 # DW_AT_encoding
+ .ascii "char" # DW_AT_name
+ .byte 0
+ .byte 1 # DW_AT_byte_size
+ .byte 6 # Abbrev [6] 0xb9:0x6 DW_TAG_pointer_type
+ .long 177 # DW_AT_type
+ .byte 8 # DW_AT_byte_size
+ .byte 7 # Abbrev [7] 0xbf:0x5 DW_TAG_restrict_type
+ .long 185 # DW_AT_type
+ .byte 0 # End Of Children Mark
+ .byte 0 # 4 extra padding bytes for GDB
+ .byte 0
+ .byte 0
+ .byte 0
+.Linfo_end1:
+ .section .debug_abbrev,"",@progbits
+.Labbrev_begin:
+ .byte 1 # Abbreviation Code
+ .byte 17 # DW_TAG_compile_unit
+ .byte 1 # DW_CHILDREN_yes
+ .byte 37 # DW_AT_producer
+ .byte 8 # DW_FORM_string
+ .byte 19 # DW_AT_language
+ .byte 5 # DW_FORM_data2
+ .byte 3 # DW_AT_name
+ .byte 8 # DW_FORM_string
+ .byte 82 # DW_AT_entry_pc
+ .byte 1 # DW_FORM_addr
+ .byte 16 # DW_AT_stmt_list
+ .byte 1 # DW_FORM_addr
+ .byte 27 # DW_AT_comp_dir
+ .byte 8 # DW_FORM_string
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 2 # Abbreviation Code
+ .byte 36 # DW_TAG_base_type
+ .byte 0 # DW_CHILDREN_no
+ .byte 62 # DW_AT_encoding
+ .byte 11 # DW_FORM_data1
+ .byte 3 # DW_AT_name
+ .byte 8 # DW_FORM_string
+ .byte 11 # DW_AT_byte_size
+ .byte 11 # DW_FORM_data1
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 3 # Abbreviation Code
+ .byte 46 # DW_TAG_subprogram
+ .byte 1 # DW_CHILDREN_yes
+ .byte 1 # DW_AT_sibling
+ .byte 19 # DW_FORM_ref4
+ .byte 3 # DW_AT_name
+ .byte 8 # DW_FORM_string
+ .byte 58 # DW_AT_decl_file
+ .byte 11 # DW_FORM_data1
+ .byte 59 # DW_AT_decl_line
+ .byte 11 # DW_FORM_data1
+ .byte 39 # DW_AT_prototyped
+ .byte 12 # DW_FORM_flag
+ .byte 73 # DW_AT_type
+ .byte 19 # DW_FORM_ref4
+ .byte 63 # DW_AT_external
+ .byte 12 # DW_FORM_flag
+ .byte 17 # DW_AT_low_pc
+ .byte 1 # DW_FORM_addr
+ .byte 18 # DW_AT_high_pc
+ .byte 1 # DW_FORM_addr
+ .byte 64 # DW_AT_frame_base
+ .byte 10 # DW_FORM_block1
+ .ascii "\347\177" # DW_AT_APPLE_omit_frame_ptr
+ .byte 12 # DW_FORM_flag
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 4 # Abbreviation Code
+ .byte 5 # DW_TAG_formal_parameter
+ .byte 0 # DW_CHILDREN_no
+ .byte 3 # DW_AT_name
+ .byte 8 # DW_FORM_string
+ .byte 58 # DW_AT_decl_file
+ .byte 11 # DW_FORM_data1
+ .byte 59 # DW_AT_decl_line
+ .byte 11 # DW_FORM_data1
+ .byte 73 # DW_AT_type
+ .byte 19 # DW_FORM_ref4
+ .byte 2 # DW_AT_location
+ .byte 10 # DW_FORM_block1
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 5 # Abbreviation Code
+ .byte 46 # DW_TAG_subprogram
+ .byte 0 # DW_CHILDREN_no
+ .byte 3 # DW_AT_name
+ .byte 8 # DW_FORM_string
+ .byte 58 # DW_AT_decl_file
+ .byte 11 # DW_FORM_data1
+ .byte 59 # DW_AT_decl_line
+ .byte 11 # DW_FORM_data1
+ .byte 73 # DW_AT_type
+ .byte 19 # DW_FORM_ref4
+ .byte 63 # DW_AT_external
+ .byte 12 # DW_FORM_flag
+ .byte 17 # DW_AT_low_pc
+ .byte 1 # DW_FORM_addr
+ .byte 18 # DW_AT_high_pc
+ .byte 1 # DW_FORM_addr
+ .byte 64 # DW_AT_frame_base
+ .byte 10 # DW_FORM_block1
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 6 # Abbreviation Code
+ .byte 15 # DW_TAG_pointer_type
+ .byte 0 # DW_CHILDREN_no
+ .byte 73 # DW_AT_type
+ .byte 19 # DW_FORM_ref4
+ .byte 11 # DW_AT_byte_size
+ .byte 11 # DW_FORM_data1
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 7 # Abbreviation Code
+ .byte 55 # DW_TAG_restrict_type
+ .byte 0 # DW_CHILDREN_no
+ .byte 73 # DW_AT_type
+ .byte 19 # DW_FORM_ref4
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 0 # EOM(3)
+.Labbrev_end:
+ .section .debug_pubnames,"",@progbits
+.Lset16 = .Lpubnames_end1-.Lpubnames_begin1 # Length of Public Names Info
+ .long .Lset16
+.Lpubnames_begin1:
+ .short 2 # DWARF Version
+ .long .Linfo_begin1 # Offset of Compilation Unit Info
+.Lset17 = .Linfo_end1-.Linfo_begin1 # Compilation Unit Length
+ .long .Lset17
+ .long 146 # DIE offset
+ .asciz "main" # External Name
+ .long 99 # DIE offset
+ .asciz "f" # External Name
+ .long 0 # End Mark
+.Lpubnames_end1:
+ .section .debug_pubtypes,"",@progbits
+.Lset18 = .Lpubtypes_end1-.Lpubtypes_begin1 # Length of Public Types Info
+ .long .Lset18
+.Lpubtypes_begin1:
+ .short 2 # DWARF Version
+ .long .Linfo_begin1 # Offset of Compilation Unit Info
+.Lset19 = .Linfo_end1-.Linfo_begin1 # Compilation Unit Length
+ .long .Lset19
+ .long 0 # End Mark
+.Lpubtypes_end1:
+ .section .debug_aranges,"",@progbits
+ .section .debug_ranges,"",@progbits
+ .section .debug_macinfo,"",@progbits
+
+ .section ".note.GNU-stack","",@progbits
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-restrict.c b/gdb/testsuite/gdb.dwarf2/dw2-restrict.c
new file mode 100644
index 00000000000..9568a3e1aa5
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-restrict.c
@@ -0,0 +1,26 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2012 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 (char * restrict x)
+{
+ return x[0];
+}
+
+int main()
+{
+ return f("hi bob");
+}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-restrict.exp b/gdb/testsuite/gdb.dwarf2/dw2-restrict.exp
new file mode 100644
index 00000000000..e6f3fe88e4f
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-restrict.exp
@@ -0,0 +1,29 @@
+# Copyright 2012 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/>.
+
+load_lib dwarf.exp
+
+# This test can only be run on targets which support DWARF-2 and use gas.
+if {![dwarf2_support]} {
+ return 0
+}
+
+standard_testfile .S
+
+if {[prepare_for_testing $testfile.exp $testfile $srcfile {nodebug}]} {
+ return -1
+}
+
+gdb_test "ptype f" "int \\(char \\\* restrict\\)"