| # Copyright 2023 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/>. |
| |
| require allow_ctf_tests |
| |
| standard_testfile .c -2.c |
| |
| set objfile [standard_output_file ${testfile}.o] |
| set objfile2 [standard_output_file ${testfile}-2.o] |
| |
| set s1 ${srcdir}/${subdir}/${srcfile} |
| set s2 ${srcdir}/${subdir}/${srcfile2} |
| |
| set opts {} |
| lappend opts debug |
| if { [gdb_compile $s1 ${objfile} object $opts] != "" } { |
| untested "failed to compile" |
| return -1 |
| } |
| |
| set opts {} |
| lappend opts "additional_flags=-gctf" |
| if { [gdb_compile $s2 ${objfile2} object $opts] != "" } { |
| untested "failed to compile" |
| return -1 |
| } |
| |
| set opts {} |
| lappend opts "additional_flags=-Wl,-ctf-variables" |
| if { [gdb_compile [list ${objfile} ${objfile2}] $binfile executable $opts] != "" } { |
| unsupported "failed to link" |
| return -1 |
| } |
| |
| clean_restart |
| |
| gdb_test_no_output "set always-read-ctf on" |
| |
| gdb_load $binfile |
| |
| gdb_test "print var_dwarf" " = 1" |
| gdb_test "print var_ctf" " = 2" |