[gdb/testsuite] Use MACRO_AT_{func,range}
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.dwarf2 / typedef-void-finish.exp
CommitLineData
b811d2c2 1# Copyright 2019-2020 Free Software Foundation, Inc.
f097f5ad
TT
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
16# PR gdb/21855 concerns a crash in "finish" where the function's
17# return type is a typedef of void.
18
19load_lib dwarf.exp
20load_lib gdb-python.exp
21
22# This test can only be run on targets which support DWARF-2 and use gas.
23if {![dwarf2_support]} {
24 return 0
25}
26
27standard_testfile void-type.c typedef-void-finish.S
28
29# Make some DWARF for the test.
30set asm_file [standard_output_file $srcfile2]
31Dwarf::assemble $asm_file {
f097f5ad
TT
32 cu {} {
33 DW_TAG_compile_unit {
34 {DW_AT_producer "GNU C 8.1"}
35 {DW_AT_language @DW_LANG_C}
36 {DW_AT_name void-type.c}
37 {DW_AT_comp_dir /tmp}
38 } {
39 declare_labels main_type void_typedef
40
41 main_type: DW_TAG_base_type {
42 {DW_AT_byte_size 4 DW_FORM_sdata}
43 {DW_AT_encoding @DW_ATE_signed}
44 }
45
46 void_typedef: DW_TAG_typedef {
47 {name foo}
48 }
49
50 DW_TAG_subprogram {
90c3ec2d 51 {MACRO_AT_func {func}}
f097f5ad
TT
52 {type :$void_typedef}
53 }
54 DW_TAG_subprogram {
90c3ec2d 55 {MACRO_AT_func {main}}
f097f5ad
TT
56 {type :$main_type}
57 }
58 }
59 }
60}
61
62if { [prepare_for_testing "failed to prepare" ${testfile} \
63 [list $srcfile $asm_file] {nodebug}] } {
64 return -1
65}
66
67if {![runto_main]} {
68 return -1
69}
70
71gdb_test "break func" "Breakpoint .*" \
72 "set breakpoint in func"
73gdb_continue_to_breakpoint "continue to func"
74
75set skip_python [skip_python_tests]
76if {!$skip_python} {
77 gdb_test "python finishbp = gdb.FinishBreakpoint()" \
78 "Temporary breakpoint.*" "set FinishBreakpoint"
79}
80
81gdb_test "finish" [multi_line \
82 "Run till exit from #0 $hex in func \\\(\\\)" \
83 ".*$hex in main \\\(\\\)"]
84
85if {!$skip_python} {
86 gdb_test "python print (finishbp.return_value)" "None" \
87 "check that return_value is None"
88}
This page took 0.238625 seconds and 4 git commands to generate.