From 9c2c346137eeca000840023b6d9340274da7a905 Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Fri, 3 Mar 2023 16:51:57 +0100 Subject: [PATCH] [gdb/testsuite] Use set always-read-ctf on instead of --strip-debug Use "set always-read-ctf on" instead of --strip-debug in the ctf test-cases. Tested on x86_64-linux. --- gdb/testsuite/gdb.base/ctf-constvars.exp | 7 +++++-- gdb/testsuite/gdb.base/ctf-ptype.exp | 5 ++++- gdb/testsuite/gdb.base/cvexpr.exp | 7 +++++-- gdb/testsuite/gdb.base/whatis.exp | 7 +++++-- gdb/testsuite/gdb.ctf/cross-tu-cyclic.exp | 7 +++++-- gdb/testsuite/gdb.ctf/funcreturn.exp | 7 +++++-- gdb/testsuite/gdb.ctf/multi.exp | 7 +++++-- 7 files changed, 34 insertions(+), 13 deletions(-) diff --git a/gdb/testsuite/gdb.base/ctf-constvars.exp b/gdb/testsuite/gdb.base/ctf-constvars.exp index 7b3c0f69da8..67f2b5c4a36 100644 --- a/gdb/testsuite/gdb.base/ctf-constvars.exp +++ b/gdb/testsuite/gdb.base/ctf-constvars.exp @@ -31,15 +31,18 @@ standard_testfile .c # Using `-gctf` generates full-fledged CTF debug information. set opts {} lappend opts additional_flags=-gctf -lappend opts ldflags=-Wl,--strip-debug lappend opts ldflags=-Wl,--ctf-variables lappend opts nowarnings -if { [prepare_for_testing "failed to prepare" ${testfile} \ +if { [build_executable "failed to prepare" ${testfile} \ [list $srcfile] $opts] } { return 0 } +clean_restart +gdb_test_no_output "set always-read-ctf on" +gdb_load $binfile + # # set it up at a breakpoint so we can play with the variable values # diff --git a/gdb/testsuite/gdb.base/ctf-ptype.exp b/gdb/testsuite/gdb.base/ctf-ptype.exp index 4a81993628e..587caee0cf1 100644 --- a/gdb/testsuite/gdb.base/ctf-ptype.exp +++ b/gdb/testsuite/gdb.base/ctf-ptype.exp @@ -25,7 +25,6 @@ standard_testfile .c # Using `-gctf` generates full-fledged CTF debug information. set opts {} lappend opts additional_flags=-gctf -lappend opts ldflags=-Wl,--strip-debug lappend opts ldflags=-Wl,--ctf-variables lappend opts nowarnings @@ -34,6 +33,10 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \ return 0 } +clean_restart +gdb_test_no_output "set always-read-ctf on" +gdb_load $binfile + # Test ptype of unnamed enumeration members before any action causes # the partial symbol table to be expanded to full symbols. This fails # with stabs compilers which fail to use a nameless stab (such as diff --git a/gdb/testsuite/gdb.base/cvexpr.exp b/gdb/testsuite/gdb.base/cvexpr.exp index bbaa7d4983b..0163787402f 100644 --- a/gdb/testsuite/gdb.base/cvexpr.exp +++ b/gdb/testsuite/gdb.base/cvexpr.exp @@ -26,11 +26,15 @@ proc do_test {dir options} { global srcfile testfile set binfile [standard_output_file ${dir}/${testfile}] - if { [prepare_for_testing "failed to prepare" ${binfile} \ + if { [build_executable "failed to prepare" ${binfile} \ [list $srcfile] $options] } { return 0 } + clean_restart + gdb_test_no_output "set always-read-ctf on" + gdb_load $binfile + gdb_test_no_output "set print sevenbit-strings" gdb_test_no_output "set print address off" gdb_test_no_output "set width 0" @@ -493,7 +497,6 @@ proc do_test {dir options} { set ctf_opts {} lappend ctf_opts additional_flags=-gctf -lappend ctf_opts ldflags=-Wl,--strip-debug # Build up the set of debug formats for which we will run this test. set specs { {dwarf {debug}} } diff --git a/gdb/testsuite/gdb.base/whatis.exp b/gdb/testsuite/gdb.base/whatis.exp index 3736e78bbdc..75484207780 100644 --- a/gdb/testsuite/gdb.base/whatis.exp +++ b/gdb/testsuite/gdb.base/whatis.exp @@ -49,11 +49,15 @@ proc do_test {dir options} { global srcfile testfile gcc_compiled set binfile [standard_output_file ${dir}/${testfile}] - if { [prepare_for_testing "failed to prepare" ${binfile} \ + if { [build_executable "failed to prepare" ${binfile} \ [list $srcfile] $options] } { return 0 } + clean_restart + gdb_test_no_output "set always-read-ctf on" + gdb_load $binfile + # # Test whatis command with basic C types # @@ -587,7 +591,6 @@ proc do_test {dir options} { set ctf_opts {} lappend ctf_opts additional_flags=-gctf -lappend ctf_opts ldflags=-Wl,--strip-debug lappend ctf_opts ldflags=-Wl,--ctf-variables # Build up the set of debug formats for which we will run this test. diff --git a/gdb/testsuite/gdb.ctf/cross-tu-cyclic.exp b/gdb/testsuite/gdb.ctf/cross-tu-cyclic.exp index 0292e394646..68b5beec157 100644 --- a/gdb/testsuite/gdb.ctf/cross-tu-cyclic.exp +++ b/gdb/testsuite/gdb.ctf/cross-tu-cyclic.exp @@ -24,15 +24,18 @@ standard_testfile cross-tu-cyclic-1.c cross-tu-cyclic-2.c \ set opts {} lappend opts additional_flags=-gctf lappend opts ldflags=-Wl,--export-dynamic -lappend opts ldflags=-Wl,--strip-debug lappend opts nowarning -if { [prepare_for_testing "failed to prepare" ${testfile} \ +if { [build_executable "failed to prepare" ${testfile} \ [list $srcfile $srcfile2 $srcfile3 $srcfile4] \ $opts] } { return 0 } +clean_restart +gdb_test_no_output "set always-read-ctf on" +gdb_load $binfile + # Same thing with struct and union. gdb_test "ptype struct A" "type = struct A \{\[\r\n\]+\[ \t\]+struct B \\*foo;\[\r\n\]+\}.*" "ptype structure A" gdb_test "ptype struct B" "type = struct B \{\[\r\n\]+\[ \t\]+struct B \\*next;\[\r\n\]+\}.*" "ptype structure B" diff --git a/gdb/testsuite/gdb.ctf/funcreturn.exp b/gdb/testsuite/gdb.ctf/funcreturn.exp index 64ed031f693..ef1fe90e527 100644 --- a/gdb/testsuite/gdb.ctf/funcreturn.exp +++ b/gdb/testsuite/gdb.ctf/funcreturn.exp @@ -30,14 +30,17 @@ standard_testfile whatis.c set opts {} lappend opts additional_flags=-gctf lappend opts ldflags=-Wl,--export-dynamic -lappend opts ldflags=-Wl,--strip-debug lappend opts nowarning -if { [prepare_for_testing "failed to prepare" ${testfile} \ +if { [build_executable "failed to prepare" ${testfile} \ [list $srcfile] $opts] } { return 0 } +clean_restart +gdb_test_no_output "set always-read-ctf on" +gdb_load $binfile + # test print command with functions return type set void "(void|)" gdb_test "print v_char_func" \ diff --git a/gdb/testsuite/gdb.ctf/multi.exp b/gdb/testsuite/gdb.ctf/multi.exp index c82d1b952e3..0bb66cd2432 100644 --- a/gdb/testsuite/gdb.ctf/multi.exp +++ b/gdb/testsuite/gdb.ctf/multi.exp @@ -23,15 +23,18 @@ standard_testfile ctf-a.c ctf-b.c ctf-c.c set opts {} lappend opts additional_flags=-gctf lappend opts ldflags=-Wl,--export-dynamic -lappend opts ldflags=-Wl,--strip-debug lappend opts nowarning -if { [prepare_for_testing "failed to prepare" ${testfile} \ +if { [build_executable "failed to prepare" ${testfile} \ [list $srcfile $srcfile2 $srcfile3] \ $opts] } { return 0 } +clean_restart +gdb_test_no_output "set always-read-ctf on" +gdb_load $binfile + # Same thing with struct and union. gdb_test "ptype struct A" "type = struct A \{\[\r\n\]+\[ \t\]+struct B \\*b;\[\r\n\]+\[ \t\]+struct A \\*next;\[\r\n\]+\}.*" "ptype structure A" gdb_test "ptype struct B" "type = struct B \{\[\r\n\]+\[ \t\]+struct C \\*c;\[\r\n\]+\[ \t\]+int \\wombat;\[\r\n\]+\}.*" "ptype structure B" -- 2.30.2