1 # Copyright 2019-2022 Free Software Foundation, Inc.
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.
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.
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/>.
16 # PR gdb/21855 concerns a crash in "finish" where the function's
17 # return type is a typedef of void.
20 load_lib gdb-python.exp
22 # This test can only be run on targets which support DWARF-2 and use gas.
23 if {![dwarf2_support]} {
27 standard_testfile void-type.c .S
29 # Make some DWARF for the test.
30 set asm_file [standard_output_file $srcfile2]
31 Dwarf::assemble $asm_file {
36 {DW_AT_producer "GNU C 8.1"}
37 {DW_AT_language @DW_LANG_C}
41 declare_labels main_type void_typedef
43 main_type: DW_TAG_base_type {
44 {DW_AT_byte_size 4 DW_FORM_sdata}
45 {DW_AT_encoding @DW_ATE_signed}
48 void_typedef: DW_TAG_typedef {
53 {MACRO_AT_func {func}}
57 {MACRO_AT_func {main}}
64 if { [prepare_for_testing "failed to prepare" ${testfile} \
65 [list $srcfile $asm_file] {nodebug}] } {
73 gdb_test "break func" "Breakpoint .*" \
74 "set breakpoint in func"
75 gdb_continue_to_breakpoint "continue to func"
77 set skip_python [skip_python_tests]
79 gdb_test "python finishbp = gdb.FinishBreakpoint()" \
80 "Temporary breakpoint.*" "set FinishBreakpoint"
83 gdb_test "finish" [multi_line \
84 "Run till exit from #0 $hex in func \\\(\\\)" \
85 ".*$hex in main \\\(\\\)"]
88 gdb_test "python print (finishbp.return_value)" "None" \
89 "check that return_value is None"