diff options
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/gdb.ada/operator_call.exp | 6 | ||||
-rw-r--r-- | gdb/testsuite/gdb.dwarf2/debug-names-non-ascending-cu.exp | 81 | ||||
-rw-r--r-- | gdb/testsuite/gdb.dwarf2/dw-form-ref-addr-with-type-units.exp | 109 | ||||
-rw-r--r-- | gdb/testsuite/gdb.dwarf2/varval.exp | 2 | ||||
-rw-r--r-- | gdb/testsuite/gdb.gdb/python-helper.exp | 20 | ||||
-rw-r--r-- | gdb/testsuite/lib/tuiterm.exp | 2 |
6 files changed, 136 insertions, 84 deletions
diff --git a/gdb/testsuite/gdb.ada/operator_call.exp b/gdb/testsuite/gdb.ada/operator_call.exp index e96107b..dc7f679 100644 --- a/gdb/testsuite/gdb.ada/operator_call.exp +++ b/gdb/testsuite/gdb.ada/operator_call.exp @@ -71,6 +71,12 @@ proc test_with_menu {command result} { fail $command } } + "Argument to arithmetic operation not a number or boolean." { + fail $command + } + -re "No definition of \".*\" in current context." { + fail $command + } timeout { fail "$command (timeout)" } diff --git a/gdb/testsuite/gdb.dwarf2/debug-names-non-ascending-cu.exp b/gdb/testsuite/gdb.dwarf2/debug-names-non-ascending-cu.exp deleted file mode 100644 index d86b5c4..0000000 --- a/gdb/testsuite/gdb.dwarf2/debug-names-non-ascending-cu.exp +++ /dev/null @@ -1,81 +0,0 @@ -# Copyright 2022-2025 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. -require dwarf2_support - -standard_testfile _start.c debug-names.S - -set func_info_vars \ - [get_func_info _start [list debug additional_flags=-nostartfiles]] - -# Create the DWARF. -set asm_file [standard_output_file $srcfile2] -Dwarf::assemble { - filename $asm_file - add_dummy_cus 0 -} { - global func_info_vars - foreach var $func_info_vars { - global $var - } - - cu { label cu_label } { - compile_unit {{language @DW_LANG_C}} { - subprogram { - {DW_AT_name _start} - {DW_AT_low_pc $_start_start DW_FORM_addr} - {DW_AT_high_pc $_start_end DW_FORM_addr} - } - } - } - - cu { label cu_label_2 } { - compile_unit {{language @DW_LANG_C}} { - base_type { - {name int} - {byte_size 4 sdata} - {encoding @DW_ATE_signed} - } - } - } - - debug_names {} { - cu cu_label_2 - cu cu_label - name _start subprogram cu_label 0xEDDB6232 - name int base_type cu_label 0xB888030 - } -} - -if [prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}" \ - [list additional_flags=-nostartfiles]] { - return -1 -} - -# Check for warning. -set re \ - [list \ - "warning:" \ - "Section .debug_names has incorrect entry in CU table," \ - "ignoring .debug_names."] -set re [join $re] -gdb_assert {[regexp $re $gdb_file_cmd_msg]} "warning" - -# Verify that .debug_names section is ignored. -set index [have_index $binfile] -gdb_assert { [string equal $index ""] } ".debug_names not used" diff --git a/gdb/testsuite/gdb.dwarf2/dw-form-ref-addr-with-type-units.exp b/gdb/testsuite/gdb.dwarf2/dw-form-ref-addr-with-type-units.exp new file mode 100644 index 0000000..6253629 --- /dev/null +++ b/gdb/testsuite/gdb.dwarf2/dw-form-ref-addr-with-type-units.exp @@ -0,0 +1,109 @@ +# Copyright 2025 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 is a reproducer for PR 29518: +# +# https://sourceware.org/bugzilla/show_bug.cgi?id=29518 +# +# The root cause for the problem was that function +# dwarf2_find_containing_comp_unit was searching the whole "all_units" vector, +# containing both compile units and type units, causing it to sometimes +# erroneously return a type unit. It should have been restricted to searching +# compile units. +# +# To get dwarf2_find_containing_comp_unit to be called and reproduce the +# original bug, we need a value with form DW_FORM_ref_addr pointing to a +# different compile unit. This is produced by `%$int_type` below. + +load_lib dwarf.exp +require dwarf2_support +standard_testfile main.c .S + +set asm_file [standard_output_file $srcfile2] + +Dwarf::assemble $asm_file { + global srcfile + declare_labels int_type + + # The source CU. + cu {version 4} { + compile_unit { + } { + subprogram { + {MACRO_AT_func {main}} + {type %$int_type} + } + } + } + + # Create a bunch of empty / dummy CUs, to make the offset of int_type a bit + # higher. + for {set i 1} {$i < 10} {incr i} { + cu {version 4} { + compile_unit {} {} + } + } + + # The target CU. + cu {version 4} { + compile_unit { + } { + int_type: DW_TAG_base_type { + {DW_AT_byte_size 4 DW_FORM_sdata} + {DW_AT_encoding @DW_ATE_signed} + {DW_AT_name int} + } + } + } + + # Create many TUs. + # + # We need enough type units in the "all_units" vector in order to steer the + # binary search in dwarf2_find_containing_comp_unit towards the type units + # region of the array. + for {set i 1} {$i < 20} {incr i} { + tu {version 4} $i the_type_i { + type_unit {} { + declare_labels dummy_int_type + + the_type_i: structure_type { + {name s} + {byte_size 4 sdata} + } { + member { + {name i} + {type :$dummy_int_type} + } + } + + dummy_int_type: base_type { + {name int} + {encoding @DW_ATE_signed} + {byte_size 4 sdata} + } + } + } + } +} + +if { [prepare_for_testing "failed to prepare" ${testfile} \ + [list $srcfile $asm_file] {nodebug}] } { + return -1 +} + +# Without the corresponding fix, we get an internal error: +# +# gdb/dwarf2/read.c:3940: internal-error: load_full_comp_unit: Assertion `! this_cu->is_debug_types' failed. +gdb_test "p main" " = {int \\(void\\)} $hex <main>" diff --git a/gdb/testsuite/gdb.dwarf2/varval.exp b/gdb/testsuite/gdb.dwarf2/varval.exp index 0693f43..6846ecb 100644 --- a/gdb/testsuite/gdb.dwarf2/varval.exp +++ b/gdb/testsuite/gdb.dwarf2/varval.exp @@ -348,6 +348,6 @@ if ![runto_main] { } gdb_test "print badval" "value has been optimized out" gdb_test "print bad_die_val1" \ - "invalid dwarf2 offset 0xabcdef11" + {DWARF Error: could not find unit containing offset 0xabcdef11 \[in module .*/varval\]} gdb_test "print bad_die_val2" \ "Bad DW_OP_GNU_variable_value DIE\\." diff --git a/gdb/testsuite/gdb.gdb/python-helper.exp b/gdb/testsuite/gdb.gdb/python-helper.exp index 4b9adb0..8126740 100644 --- a/gdb/testsuite/gdb.gdb/python-helper.exp +++ b/gdb/testsuite/gdb.gdb/python-helper.exp @@ -264,10 +264,28 @@ proc test_python_helper {} { gdb_test -prompt $outer_prompt_re "print varobj_table" \ "htab_t with ${::decimal} elements" + set inferior_list_supported 1 + set inferior_list_unsupported_re "type = intrusive_list" + gdb_test_multiple "what inferior_list" "" -prompt $outer_prompt_re { + -re -wrap $inferior_list_unsupported_re { + set inferior_list_supported 0 + pass $gdb_test_name + } + -re -wrap "" { + pass $gdb_test_name + } + } + # Test the intrusive_list pretty-printer. A bug occurred in the # pretty-printer for lists with more than one element. Verify that # we see both elements of the inferior_list list being printed. - gdb_test -prompt $outer_prompt_re "print inferior_list" "intrusive list of inferior = {.*, num = 1,.*, num = 2,.*}" + set test "print inferior_list" + if { $inferior_list_supported } { + gdb_test -prompt $outer_prompt_re $test \ + "intrusive list of inferior = {.*, num = 1,.*, num = 2,.*}" + } else { + unsupported $test + } return 0 } diff --git a/gdb/testsuite/lib/tuiterm.exp b/gdb/testsuite/lib/tuiterm.exp index cc8e852..b83b8af 100644 --- a/gdb/testsuite/lib/tuiterm.exp +++ b/gdb/testsuite/lib/tuiterm.exp @@ -1291,7 +1291,7 @@ namespace eval Term { for {set y 0} {$y < $_rows} {incr y} { set fmt [format %5d $y] - verbose -log "$fmt [get_line_1 $y "" $attrs]" + verbose -log "$fmt [get_line_1 $y {} $attrs]" } } |