]>
Commit | Line | Data |
---|---|---|
1d506c26 | 1 | # Copyright 2011-2024 Free Software Foundation, Inc. |
22c05d8a JK |
2 | |
3 | # This program is free software; you can redistribute it and/or modify | |
4 | # it under the terms of the GNU General Public License as published by | |
5 | # the Free Software Foundation; either version 3 of the License, or | |
6 | # (at your option) any later version. | |
7 | # | |
8 | # This program is distributed in the hope that it will be useful, | |
9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
11 | # GNU General Public License for more details. | |
12 | # | |
13 | # You should have received a copy of the GNU General Public License | |
14 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
15 | load_lib dwarf.exp | |
16 | ||
17 | # This test can only be run on targets which support DWARF-2 and use gas. | |
ce8d533e | 18 | require dwarf2_support |
22c05d8a | 19 | |
f166b542 | 20 | standard_testfile main.c .S |
22c05d8a | 21 | set executable ${testfile} |
22c05d8a | 22 | |
f166b542 YQ |
23 | # Create the DWARF. |
24 | set asm_file [standard_output_file $srcfile2] | |
25 | Dwarf::assemble $asm_file { | |
26 | cu { version 3 addr_size 4 } { | |
27 | compile_unit { | |
28 | {producer "GNU C 4.4.3"} | |
29 | {language @DW_LANG_C89} | |
30 | {name 1.c} | |
31 | } { | |
32 | declare_labels int_label struct_label pointer_label variable_label | |
33 | ||
34 | int_label: base_type { | |
35 | {byte_size 4 sdata} | |
36 | {encoding @DW_ATE_signed} | |
37 | {name int} | |
38 | } | |
39 | ||
40 | struct_label: structure_type { | |
41 | {name s} | |
42 | {byte_size 4 sdata} | |
43 | } { | |
44 | member { | |
45 | {name f} | |
46 | {type :$int_label} | |
47 | {data_member_location 0 data1} | |
48 | } | |
49 | } | |
50 | ||
51 | subprogram { | |
10da644d | 52 | {MACRO_AT_func { main }} |
f166b542 YQ |
53 | {type :$int_label} |
54 | {external 1 flag} | |
55 | } { | |
56 | pointer_label: pointer_type { | |
57 | {byte_size 4 sdata} | |
58 | {type :$struct_label} | |
59 | } | |
60 | ||
61 | variable_label: DW_TAG_variable { | |
62 | {name v} | |
63 | {location {} DW_FORM_block1} | |
64 | {type :$struct_label} | |
65 | } | |
66 | ||
67 | DW_TAG_variable { | |
68 | {name p} | |
69 | {location { | |
70 | GNU_implicit_pointer $variable_label 0 | |
71 | } SPECIAL_expr} | |
72 | {type :$pointer_label} | |
73 | } | |
74 | } | |
75 | } | |
76 | } | |
77 | } | |
78 | ||
5b362f04 | 79 | if [prepare_for_testing "failed to prepare" $executable "${asm_file} ${srcfile}" {}] { |
22c05d8a JK |
80 | return -1 |
81 | } | |
82 | ||
83 | # DW_OP_GNU_implicit_pointer implementation requires a valid frame. | |
84 | if ![runto_main] { | |
85 | return -1 | |
86 | } | |
87 | ||
88 | gdb_test "p p->f" " = <optimized out>" |