1 # Copyright 2014-2024 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 # Some coverage testing of DWARF operators for the compiler
19 load_lib compile-support.exp
22 # This test can only be run on targets which support DWARF-2 and use gas.
23 require dwarf2_support
25 require is_c_compiler_gcc
27 standard_testfile .c -dbg.S
30 # A port of the pr10770.c test code to the DWARF assembler format.
38 set assert_tos_0 [subst {
176 # Divide is signed truncating toward zero.
189 # Modulo is unsigned.
208 # Signed modulo can be implemented using 'over over div mul minus'.
354 # Finally some result.
358 if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
362 # Make some DWARF for the test.
363 set asm_file [standard_output_file $srcfile2]
364 Dwarf::assemble $asm_file {
366 # Find start, end, and length of "func".
369 # Creating a CU with 4-byte addresses lets this test link on both
370 # 32- and 64-bit machines.
373 declare_labels int_label
377 {language @DW_LANG_C}
378 {low_pc $func_start addr}
379 {high_pc $func_end addr}
383 int_label: base_type {
386 {encoding @DW_ATE_signed}
392 {low_pc $func_start addr}
393 {high_pc $func_end addr}
397 {variable_parameter 1 flag}
399 {location $program SPECIAL_expr}
404 {variable_parameter 1 flag}
412 if { [prepare_for_testing "failed to prepare" ${testfile} \
413 [list $srcfile $asm_file] {nodebug}] } {
421 if {[skip_compile_feature_untested]} {
425 # If we have a bug, this will hang.
426 gdb_test_no_output "compile code (void) param"
428 # We can't access optimized-out variables, but their presence should
429 # not affect compilations that don't refer to them.
430 gdb_test "compile code optimized_out" \
431 ".*optimized out.*Compilation failed."