From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6727 invoked by alias); 18 Oct 2013 20:49:51 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 6657 invoked by uid 89); 18 Oct 2013 20:49:51 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS,UNWANTED_LANGUAGE_BODY autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 18 Oct 2013 20:49:43 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r9IKngBV019753 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 18 Oct 2013 16:49:42 -0400 Received: from barimba.redhat.com (ovpn-113-54.phx2.redhat.com [10.3.113.54]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r9IKnbip002849; Fri, 18 Oct 2013 16:49:41 -0400 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH v2 08/17] simple changes in gdb.base Date: Fri, 18 Oct 2013 20:49:00 -0000 Message-Id: <1382129374-18344-9-git-send-email-tromey@redhat.com> In-Reply-To: <1382129374-18344-1-git-send-email-tromey@redhat.com> References: <1382129374-18344-1-git-send-email-tromey@redhat.com> X-SW-Source: 2013-10/txt/msg00588.txt.bz2 This makes more changes in gdb.base to make it parallel-safe. I think the changes in this particular patch are relatively straightforward, so I've grouped them all together. * gdb.base/advance.exp: Use standard_testfile and prepare_for_testing. * gdb.base/bigcore.exp: Use standard_output_file. "cd" to appropriate directory when local. * gdb.base/dump.exp: Use standard_output_file. Update all "dump" and "restore" filenames. * gdb.base/interact.exp: Use standard_output_file. * gdb.base/jit-so.exp: Don't download file when local. * gdb.base/jit.exp (compile_jit_test): Don't download file when local. * gdb.base/list.exp: Use gdb_remote_download. * gdb.base/maint.exp: Use standard_output_file. * gdb.base/prelink.exp: Use standard_output_file. * gdb.base/save-bp.exp: Use standard_output_file. * gdb.base/sepdebug.exp: Use standard_testfile, standard_output_file. (test_different_dir): Don't declare objdir. * gdb.base/solib-search.exp: Use standard_output_file. * gdb.base/step-line.exp: Use gdb_remote_download. * gdb.base/trace-commands.exp: Use standard_output_file. --- gdb/testsuite/gdb.base/advance.exp | 14 +-- gdb/testsuite/gdb.base/bigcore.exp | 14 ++- gdb/testsuite/gdb.base/dump.exp | 157 ++++++++++++++++++------------ gdb/testsuite/gdb.base/interact.exp | 9 +- gdb/testsuite/gdb.base/jit-so.exp | 6 +- gdb/testsuite/gdb.base/jit.exp | 6 +- gdb/testsuite/gdb.base/list.exp | 2 +- gdb/testsuite/gdb.base/maint.exp | 6 +- gdb/testsuite/gdb.base/prelink.exp | 12 +-- gdb/testsuite/gdb.base/save-bp.exp | 11 ++- gdb/testsuite/gdb.base/sepdebug.exp | 41 ++++---- gdb/testsuite/gdb.base/solib-search.exp | 35 ++++--- gdb/testsuite/gdb.base/step-line.exp | 2 +- gdb/testsuite/gdb.base/trace-commands.exp | 9 +- 14 files changed, 185 insertions(+), 139 deletions(-) diff --git a/gdb/testsuite/gdb.base/advance.exp b/gdb/testsuite/gdb.base/advance.exp index a4bcfe6..bd59387 100644 --- a/gdb/testsuite/gdb.base/advance.exp +++ b/gdb/testsuite/gdb.base/advance.exp @@ -15,21 +15,13 @@ # advance.exp -- Expect script to test 'advance' in gdb -set testfile advance -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} +standard_testfile -remote_exec build "rm -f ${binfile}" -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - untested advance.exp +if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} { + untested $testfile.exp return -1 } -gdb_exit -gdb_start -gdb_reinitialize_dir $srcdir/$subdir -gdb_load ${binfile} - if ![runto_main] then { fail "Can't run to main" return 0 diff --git a/gdb/testsuite/gdb.base/bigcore.exp b/gdb/testsuite/gdb.base/bigcore.exp index ac3c5fb..8464195 100644 --- a/gdb/testsuite/gdb.base/bigcore.exp +++ b/gdb/testsuite/gdb.base/bigcore.exp @@ -47,7 +47,7 @@ if { [istarget "*-*-*irix*"] } { } standard_testfile .c -set corefile ${binfile}.corefile +set corefile [standard_output_file ${binfile}.corefile] if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { untested bigcore.exp @@ -60,6 +60,12 @@ clean_restart ${binfile} gdb_test_no_output "set print sevenbit-strings" gdb_test_no_output "set width 0" +# Get the core into the output directory. +if {![is_remote host]} { + gdb_test "cd [file dirname $corefile]" "Working directory .*" \ + "cd to test directory" +} + if { ![runto_main] } then { gdb_suppress_tests } @@ -139,7 +145,7 @@ set timeout $oldtimeout # Find the corefile set file "" foreach pat [list core.${inferior_pid} ${testfile}.core core] { - set names [glob -nocomplain $pat] + set names [glob -nocomplain [standard_output_file $pat]] if {[llength $names] == 1} { set file [lindex $names 0] remote_exec build "mv $file $corefile" @@ -188,7 +194,9 @@ if {! $core_ok} { # Now load up that core file set test "load corefile" -gdb_test_multiple "core $corefile" "$test" { +# We use [file tail] because gdb is still "cd"d to the +# output directory. +gdb_test_multiple "core [file tail $corefile]" "$test" { -re "A program is being debugged already. Kill it. .y or n. " { send_gdb "y\n" exp_continue diff --git a/gdb/testsuite/gdb.base/dump.exp b/gdb/testsuite/gdb.base/dump.exp index eb9be90..ccdf82b 100644 --- a/gdb/testsuite/gdb.base/dump.exp +++ b/gdb/testsuite/gdb.base/dump.exp @@ -63,7 +63,28 @@ if {${data_address} > ${max_32bit_address}} then { # Clean up any stale output files from previous test runs -remote_exec build "rm -f intarr1.bin intarr1b.bin intarr1.ihex intarr1.srec intarr1.tekhex intarr2.bin intarr2b.bin intarr2.ihex intarr2.srec intarr2.tekhex intstr1.bin intstr1b.bin intstr1.ihex intstr1.srec intstr1.tekhex intstr2.bin intstr2b.bin intstr2.ihex intstr2.srec intstr2.tekhex intarr3.srec" +set filenames {} +set all_files { + intarr1.bin intarr1b.bin intarr1.ihex + intarr1.srec intarr1.tekhex intarr2.bin intarr2b.bin intarr2.ihex + intarr2.srec intarr2.tekhex intstr1.bin intstr1b.bin intstr1.ihex + intstr1.srec intstr1.tekhex intstr2.bin intstr2b.bin intstr2.ihex + intstr2.srec intstr2.tekhex intarr3.srec +} + +# This loop sets variables dynamically -- each name listed in +# $ALL_FILES is both a file name and a variable name. +foreach file $all_files { + if {[is_remote host]} { + set this_name $file + } else { + set this_name [standard_output_file $file] + } + + lappend filenames [set ${file} $this_name] +} + +remote_exec host "rm -f $filenames" # Test help (FIXME:) @@ -96,34 +117,34 @@ proc make_dump_file { command msg } { } } -make_dump_file "dump val intarr1.bin intarray" \ +make_dump_file "dump val [set intarr1.bin] intarray" \ "dump array as value, default" -make_dump_file "dump val intstr1.bin intstruct" \ +make_dump_file "dump val [set intstr1.bin] intstruct" \ "dump struct as value, default" -make_dump_file "dump bin val intarr1b.bin intarray" \ +make_dump_file "dump bin val [set intarr1b.bin] intarray" \ "dump array as value, binary" -make_dump_file "dump bin val intstr1b.bin intstruct" \ +make_dump_file "dump bin val [set intstr1b.bin] intstruct" \ "dump struct as value, binary" -make_dump_file "dump srec val intarr1.srec intarray" \ +make_dump_file "dump srec val [set intarr1.srec] intarray" \ "dump array as value, srec" -make_dump_file "dump srec val intstr1.srec intstruct" \ +make_dump_file "dump srec val [set intstr1.srec] intstruct" \ "dump struct as value, srec" -make_dump_file "dump ihex val intarr1.ihex intarray" \ +make_dump_file "dump ihex val [set intarr1.ihex] intarray" \ "dump array as value, intel hex" -make_dump_file "dump ihex val intstr1.ihex intstruct" \ +make_dump_file "dump ihex val [set intstr1.ihex] intstruct" \ "dump struct as value, intel hex" -make_dump_file "dump tekhex val intarr1.tekhex intarray" \ +make_dump_file "dump tekhex val [set intarr1.tekhex] intarray" \ "dump array as value, tekhex" -make_dump_file "dump tekhex val intstr1.tekhex intstruct" \ +make_dump_file "dump tekhex val [set intstr1.tekhex] intstruct" \ "dump struct as value, tekhex" proc capture_value { expression args } { @@ -191,39 +212,39 @@ set struct_val [capture_value "intstruct"] set array_ptr_type [capture_pointer_with_type "&intarray"] set struct_ptr_type [capture_pointer_with_type "&intstruct"] -make_dump_file "dump mem intarr2.bin $array_start $array_end" \ +make_dump_file "dump mem [set intarr2.bin] $array_start $array_end" \ "dump array as memory, default" -make_dump_file "dump mem intstr2.bin $struct_start $struct_end" \ +make_dump_file "dump mem [set intstr2.bin] $struct_start $struct_end" \ "dump struct as memory, default" -make_dump_file "dump bin mem intarr2b.bin $array_start $array_end" \ +make_dump_file "dump bin mem [set intarr2b.bin] $array_start $array_end" \ "dump array as memory, binary" -make_dump_file "dump bin mem intstr2b.bin $struct_start $struct_end" \ +make_dump_file "dump bin mem [set intstr2b.bin] $struct_start $struct_end" \ "dump struct as memory, binary" -make_dump_file "dump srec mem intarr2.srec $array_start $array_end" \ +make_dump_file "dump srec mem [set intarr2.srec] $array_start $array_end" \ "dump array as memory, srec" -make_dump_file "dump srec mem intstr2.srec $struct_start $struct_end" \ +make_dump_file "dump srec mem [set intstr2.srec] $struct_start $struct_end" \ "dump struct as memory, srec" -make_dump_file "dump ihex mem intarr2.ihex $array_start $array_end" \ +make_dump_file "dump ihex mem [set intarr2.ihex] $array_start $array_end" \ "dump array as memory, ihex" -make_dump_file "dump ihex mem intstr2.ihex $struct_start $struct_end" \ +make_dump_file "dump ihex mem [set intstr2.ihex] $struct_start $struct_end" \ "dump struct as memory, ihex" -make_dump_file "dump tekhex mem intarr2.tekhex $array_start $array_end" \ +make_dump_file "dump tekhex mem [set intarr2.tekhex] $array_start $array_end" \ "dump array as memory, tekhex" -make_dump_file "dump tekhex mem intstr2.tekhex $struct_start $struct_end" \ +make_dump_file "dump tekhex mem [set intstr2.tekhex] $struct_start $struct_end" \ "dump struct as memory, tekhex" # test complex expressions make_dump_file \ - "dump srec mem intarr3.srec &intarray \(char *\) &intarray + sizeof intarray" \ + "dump srec mem [set intarr3.srec] &intarray \(char *\) &intarray + sizeof intarray" \ "dump array as mem, srec, expressions" proc test_restore_saved_value { restore_args msg oldval newval } { @@ -244,70 +265,70 @@ if ![string compare $is64bitonly "no"] then { gdb_test "print zero_all ()" ".*" - test_restore_saved_value "intarr1.srec" "array as value, srec" \ + test_restore_saved_value "[set intarr1.srec]" "array as value, srec" \ $array_val "intarray" - test_restore_saved_value "intstr1.srec" "struct as value, srec" \ + test_restore_saved_value "[set intstr1.srec]" "struct as value, srec" \ $struct_val "intstruct" gdb_test "print zero_all ()" "void" "zero all" - test_restore_saved_value "intarr2.srec" "array as memory, srec" \ + test_restore_saved_value "[set intarr2.srec]" "array as memory, srec" \ $array_val "intarray" - test_restore_saved_value "intstr2.srec" "struct as memory, srec" \ + test_restore_saved_value "[set intstr2.srec]" "struct as memory, srec" \ $struct_val "intstruct" gdb_test "print zero_all ()" ".*" - test_restore_saved_value "intarr1.ihex" "array as value, ihex" \ + test_restore_saved_value "[set intarr1.ihex]" "array as value, ihex" \ $array_val "intarray" - test_restore_saved_value "intstr1.ihex" "struct as value, ihex" \ + test_restore_saved_value "[set intstr1.ihex]" "struct as value, ihex" \ $struct_val "intstruct" gdb_test "print zero_all ()" ".*" - test_restore_saved_value "intarr2.ihex" "array as memory, ihex" \ + test_restore_saved_value "[set intarr2.ihex]" "array as memory, ihex" \ $array_val "intarray" - test_restore_saved_value "intstr2.ihex" "struct as memory, ihex" \ + test_restore_saved_value "[set intstr2.ihex]" "struct as memory, ihex" \ $struct_val "intstruct" gdb_test "print zero_all ()" ".*" - test_restore_saved_value "intarr1.tekhex" "array as value, tekhex" \ + test_restore_saved_value "[set intarr1.tekhex]" "array as value, tekhex" \ $array_val "intarray" - test_restore_saved_value "intstr1.tekhex" "struct as value, tekhex" \ + test_restore_saved_value "[set intstr1.tekhex]" "struct as value, tekhex" \ $struct_val "intstruct" gdb_test "print zero_all ()" ".*" - test_restore_saved_value "intarr2.tekhex" "array as memory, tekhex" \ + test_restore_saved_value "[set intarr2.tekhex]" "array as memory, tekhex" \ $array_val "intarray" - test_restore_saved_value "intstr2.tekhex" "struct as memory, tekhex" \ + test_restore_saved_value "[set intstr2.tekhex]" "struct as memory, tekhex" \ $struct_val "intstruct" } gdb_test "print zero_all ()" ".*" -test_restore_saved_value "intarr1.bin binary $array_start" \ +test_restore_saved_value "[set intarr1.bin] binary $array_start" \ "array as value, binary" \ $array_val "intarray" -test_restore_saved_value "intstr1.bin binary $struct_start" \ +test_restore_saved_value "[set intstr1.bin] binary $struct_start" \ "struct as value, binary" \ $struct_val "intstruct" gdb_test "print zero_all ()" ".*" -test_restore_saved_value "intarr2.bin binary $array_start" \ +test_restore_saved_value "[set intarr2.bin] binary $array_start" \ "array as memory, binary" \ $array_val "intarray" -test_restore_saved_value "intstr2.bin binary $struct_start" \ +test_restore_saved_value "[set intstr2.bin] binary $struct_start" \ "struct as memory, binary" \ $struct_val "intstruct" @@ -324,42 +345,42 @@ gdb_test "print zero_all ()" ".*" if ![string compare $is64bitonly "no"] then { - test_restore_saved_value "intarr1.srec $array2_offset" \ + test_restore_saved_value "[set intarr1.srec] $array2_offset" \ "array copy, srec" \ $array_val "intarray2" - test_restore_saved_value "intstr1.srec $struct2_offset" \ + test_restore_saved_value "[set intstr1.srec] $struct2_offset" \ "struct copy, srec" \ $struct_val "intstruct2" gdb_test "print zero_all ()" ".*" - test_restore_saved_value "intarr1.ihex $array2_offset" \ + test_restore_saved_value "[set intarr1.ihex] $array2_offset" \ "array copy, ihex" \ $array_val "intarray2" - test_restore_saved_value "intstr1.ihex $struct2_offset" \ + test_restore_saved_value "[set intstr1.ihex] $struct2_offset" \ "struct copy, ihex" \ $struct_val "intstruct2" gdb_test "print zero_all ()" ".*" - test_restore_saved_value "intarr1.tekhex $array2_offset" \ + test_restore_saved_value "[set intarr1.tekhex] $array2_offset" \ "array copy, tekhex" \ $array_val "intarray2" - test_restore_saved_value "intstr1.tekhex $struct2_offset" \ + test_restore_saved_value "[set intstr1.tekhex] $struct2_offset" \ "struct copy, tekhex" \ $struct_val "intstruct2" } gdb_test "print zero_all ()" ".*" -test_restore_saved_value "intarr1.bin binary $array2_start" \ +test_restore_saved_value "[set intarr1.bin] binary $array2_start" \ "array copy, binary" \ $array_val "intarray2" -test_restore_saved_value "intstr1.bin binary $struct2_start" \ +test_restore_saved_value "[set intstr1.bin] binary $struct2_start" \ "struct copy, binary" \ $struct_val "intstruct2" @@ -382,7 +403,7 @@ set element4_offset \ if ![string compare $is64bitonly "no"] then { gdb_test "print zero_all ()" ".*" - test_restore_saved_value "intarr1.srec 0 $element3_start $element4_start" \ + test_restore_saved_value "[set intarr1.srec] 0 $element3_start $element4_start" \ "array partial, srec" 4 "intarray\[3\]" gdb_test "print intarray\[2\] == 0" " = 1" "element 2 not changed - 1" @@ -390,7 +411,7 @@ if ![string compare $is64bitonly "no"] then { gdb_test "print zero_all ()" ".*" - test_restore_saved_value "intarr1.ihex 0 $element3_start $element4_start" \ + test_restore_saved_value "[set intarr1.ihex] 0 $element3_start $element4_start" \ "array partial, ihex" 4 "intarray\[3\]" gdb_test "print intarray\[2\] == 0" " = 1" "element 2 not changed - 2" @@ -398,7 +419,7 @@ if ![string compare $is64bitonly "no"] then { gdb_test "print zero_all ()" ".*" - test_restore_saved_value "intarr1.tekhex 0 $element3_start $element4_start" \ + test_restore_saved_value "[set intarr1.tekhex] 0 $element3_start $element4_start" \ "array partial, tekhex" 4 "intarray\[3\]" gdb_test "print intarray\[2\] == 0" " = 1" "element 2 not changed - 3" @@ -408,7 +429,7 @@ if ![string compare $is64bitonly "no"] then { gdb_test "print zero_all ()" ".*" test_restore_saved_value \ - "intarr1.bin binary $array_start $element3_offset $element4_offset" \ + "[set intarr1.bin] binary $array_start $element3_offset $element4_offset" \ "array partial, binary" 4 "intarray\[3\]" gdb_test "print intarray\[2\] == 0" " = 1" "element 2 not changed - 4" @@ -419,7 +440,7 @@ if ![string compare $is64bitonly "no"] then { # restore with expressions test_restore_saved_value \ - "intarr3.srec (char*)${array2_start}-(char*)${array_start} &intarray\[3\] &intarray\[4\]" \ + "[set intarr3.srec] (char*)${array2_start}-(char*)${array_start} &intarray\[3\] &intarray\[4\]" \ "array partial with expressions" 4 "intarray2\[3\]" gdb_test "print intarray2\[2\] == 0" " = 1" "element 2 not changed, == 4" @@ -471,41 +492,49 @@ proc test_reload_saved_value { filename msg oldval newval } { # srec format can not be loaded for 64-bit-only platforms if ![string compare $is64bitonly "no"] then { - test_reload_saved_value "intarr1.srec" "reload array as value, srec" \ + test_reload_saved_value "[set intarr1.srec]" "reload array as value, srec" \ $array_val "\*$array_ptr_type" - test_reload_saved_value "intstr1.srec" "reload struct as value, srec" \ + test_reload_saved_value "[set intstr1.srec]" "reload struct as value, srec" \ $struct_val "\*$struct_ptr_type" - test_reload_saved_value "intarr2.srec" "reload array as memory, srec" \ + test_reload_saved_value "[set intarr2.srec]" "reload array as memory, srec" \ $array_val "\*$array_ptr_type" - test_reload_saved_value "intstr2.srec" "reload struct as memory, srec" \ + test_reload_saved_value "[set intstr2.srec]" "reload struct as memory, srec" \ $struct_val "\*$struct_ptr_type" } # ihex format can not be loaded for 64-bit-only platforms if ![string compare $is64bitonly "no"] then { - test_reload_saved_value "intarr1.ihex" "reload array as value, intel hex" \ + test_reload_saved_value "[set intarr1.ihex]" \ + "reload array as value, intel hex" \ $array_val "\*$array_ptr_type" - test_reload_saved_value "intstr1.ihex" "reload struct as value, intel hex" \ + test_reload_saved_value "[set intstr1.ihex]" \ + "reload struct as value, intel hex" \ $struct_val "\*$struct_ptr_type" - test_reload_saved_value "intarr2.ihex" "reload array as memory, intel hex" \ + test_reload_saved_value "[set intarr2.ihex]" \ + "reload array as memory, intel hex" \ $array_val "\*$array_ptr_type" - test_reload_saved_value "intstr2.ihex" "reload struct as memory, intel hex" \ + test_reload_saved_value "[set intstr2.ihex]" \ + "reload struct as memory, intel hex" \ $struct_val "\*$struct_ptr_type" } # tekhex format can not be loaded for 64-bit-only platforms if ![string compare $is64bitonly "no"] then { - test_reload_saved_value "intarr1.tekhex" "reload array as value, tekhex" \ + test_reload_saved_value "[set intarr1.tekhex]" \ + "reload array as value, tekhex" \ $array_val "\*$array_ptr_type" - test_reload_saved_value "intstr1.tekhex" "reload struct as value, tekhex" \ + test_reload_saved_value "[set intstr1.tekhex]" \ + "reload struct as value, tekhex" \ $struct_val "\*$struct_ptr_type" - test_reload_saved_value "intarr2.tekhex" "reload array as memory, tekhex" \ + test_reload_saved_value "[set intarr2.tekhex]" \ + "reload array as memory, tekhex" \ $array_val "\*$array_ptr_type" - test_reload_saved_value "intstr2.tekhex" "reload struct as memory, tekhex" \ + test_reload_saved_value "[set intstr2.tekhex]" \ + "reload struct as memory, tekhex" \ $struct_val "\*$struct_ptr_type" } # clean up files -remote_exec build "rm -f intarr1.bin intarr1b.bin intarr1.ihex intarr1.srec intarr1.tekhex intarr2.bin intarr2b.bin intarr2.ihex intarr2.srec intarr2.tekhex intstr1.bin intstr1b.bin intstr1.ihex intstr1.srec intstr1.tekhex intstr2.bin intstr2b.bin intstr2.ihex intstr2.srec intstr2.tekhex intarr3.srec" +remote_exec host "rm -f $filenames" diff --git a/gdb/testsuite/gdb.base/interact.exp b/gdb/testsuite/gdb.base/interact.exp index eb0d999..f0f0354 100644 --- a/gdb/testsuite/gdb.base/interact.exp +++ b/gdb/testsuite/gdb.base/interact.exp @@ -15,7 +15,8 @@ # Create a GDB script that we can source. The script needs to generate # some output, to allow us to verify that it is executed properly. -set fd [open "zzz-gdbscript" "w"] +set script [standard_output_file zzz-gdbscript] +set fd [open $script "w"] puts $fd "print 1" puts $fd "print 2" close $fd @@ -32,7 +33,7 @@ gdb_start # Verify that evaluating the script does not cause an unexpected # change of the interactive-mode setting. gdb_test_no_output "set interactive-mode auto" -gdb_test "source zzz-gdbscript" "$script_output" \ +gdb_test "source $script" "$script_output" \ "source script with interactive-mode auto" gdb_test "print 3" "= 3" "sanity check with interactive-mode auto" gdb_test "show interactive-mode" \ @@ -43,7 +44,7 @@ gdb_test "show interactive-mode" \ # Verify that evaluating the script does not cause an unexpected # change of the interactive-mode setting. gdb_test_no_output "set interactive-mode on" -gdb_test "source zzz-gdbscript" "$script_output" \ +gdb_test "source $script" "$script_output" \ "source script with interactive-mode on" gdb_test "print 4" "= 4" "sanity check with interactive-mode on" gdb_test "show interactive-mode" \ @@ -54,7 +55,7 @@ gdb_test "show interactive-mode" \ # Verify that evaluating the script does not cause an unexpected # change of the interactive-mode setting. gdb_test_no_output "set interactive-mode off" -gdb_test "source zzz-gdbscript" "$script_output" \ +gdb_test "source $script" "$script_output" \ "source script with interactive-mode off" gdb_test "print 5" "= 5" "sanity check with interactive-mode off" gdb_test "show interactive-mode" \ diff --git a/gdb/testsuite/gdb.base/jit-so.exp b/gdb/testsuite/gdb.base/jit-so.exp index 70f2a7d..67682cf 100644 --- a/gdb/testsuite/gdb.base/jit-so.exp +++ b/gdb/testsuite/gdb.base/jit-so.exp @@ -61,7 +61,11 @@ if { [gdb_compile_shlib ${solib_srcfile} ${solib_binfile} {}] != "" } { return -1 } -set solib_binfile_target [gdb_download ${solib_binfile}] +if {[is_remote target]} { + set solib_binfile_target [gdb_download ${solib_binfile}] +} else { + set solib_binfile_target $solib_binfile +} proc one_jit_test {count match_str} { with_test_prefix "one_jit_test-$count" { diff --git a/gdb/testsuite/gdb.base/jit.exp b/gdb/testsuite/gdb.base/jit.exp index e5151c6..d04f176 100644 --- a/gdb/testsuite/gdb.base/jit.exp +++ b/gdb/testsuite/gdb.base/jit.exp @@ -56,7 +56,11 @@ proc compile_jit_test {testname options} { return -1 } - set solib_binfile_target [gdb_download ${solib_binfile}] + if {[is_remote target]} { + set solib_binfile_target [gdb_download ${solib_binfile}] + } else { + set solib_binfile_target $solib_binfile + } return 0 } diff --git a/gdb/testsuite/gdb.base/list.exp b/gdb/testsuite/gdb.base/list.exp index 62504d1..c3cdc6b 100644 --- a/gdb/testsuite/gdb.base/list.exp +++ b/gdb/testsuite/gdb.base/list.exp @@ -19,7 +19,7 @@ standard_testfile list0.c list1.c # Need to download the header to the host. -remote_download host ${srcdir}/${subdir}/list0.h list0.h +gdb_remote_download host ${srcdir}/${subdir}/list0.h if {[prepare_for_testing $testfile.exp $testfile [list $srcfile $srcfile2] \ {debug}]} { diff --git a/gdb/testsuite/gdb.base/maint.exp b/gdb/testsuite/gdb.base/maint.exp index 3093aae..9425f2b 100644 --- a/gdb/testsuite/gdb.base/maint.exp +++ b/gdb/testsuite/gdb.base/maint.exp @@ -278,11 +278,11 @@ gdb_expect { # Check that maint print msymbols allows relative pathnames set mydir [pwd] -gdb_test "cd ${objdir}" \ - "Working directory [string_to_regexp ${objdir}]\..*" \ +gdb_test "cd [standard_output_file {}]" \ + "Working directory .*\..*" \ "cd to objdir" -gdb_test_multiple "maint print msymbols msymbols_output2 ${subdir}/${testfile}" "maint print msymbols" { +gdb_test_multiple "maint print msymbols msymbols_output2 ${testfile}" "maint print msymbols" { -re "^maint print msymbols msymbols_output2 \[^\n\]*\r\n$gdb_prompt $" { gdb_test_multiple "shell ls msymbols_output2" "maint print msymbols" { -re "msymbols_output2\r\n$gdb_prompt $" { diff --git a/gdb/testsuite/gdb.base/prelink.exp b/gdb/testsuite/gdb.base/prelink.exp index ac70726..0043e3a 100644 --- a/gdb/testsuite/gdb.base/prelink.exp +++ b/gdb/testsuite/gdb.base/prelink.exp @@ -36,7 +36,7 @@ load_lib prelink-support.exp set testfile "prelink" set libsrcfile ${testfile}-lib.c -set libfile ${objdir}/${subdir}/${testfile}.so +set libfile [standard_output_file ${testfile}.so] # Use -soname so that the new library gets copied by build_executable_own_libs. @@ -47,7 +47,7 @@ if { [gdb_compile_shlib "${srcdir}/${subdir}/${libsrcfile}" "${libfile}" [list d set srcfile ${testfile}.c set executable ${testfile}t -set binfile ${objdir}/${subdir}/${executable} +set binfile [standard_output_file ${executable}] set prelink_args [build_executable_own_libs ${testfile}.exp $executable $srcfile [list debug "ldflags=-Wl,${libfile},-rpath,[file dirname ${libfile}]"]] if {$prelink_args == ""} { return -1 @@ -66,13 +66,13 @@ if ![prelink_yes $prelink_args] { } set found 0 -set coredir "${objdir}/${subdir}/coredir.[getpid]" +set coredir "[standard_output_file coredir.[getpid]]" file mkdir $coredir catch "system \"(cd ${coredir}; ulimit -c unlimited; ${binfile}; true) >/dev/null 2>&1\"" foreach i "${coredir}/core ${coredir}/core.coremaker.c ${binfile}.core" { if [remote_file build exists $i] { - remote_exec build "mv $i ${objdir}/${subdir}/prelink.core" + remote_exec build "mv $i [standard_output_file prelink.core]" set found 1 } } @@ -81,7 +81,7 @@ if { $found == 0 } { set names [glob -nocomplain -directory $coredir core.*] if {[llength $names] == 1} { set corefile [file join $coredir [lindex $names 0]] - remote_exec build "mv $corefile ${objdir}/${subdir}/prelink.core" + remote_exec build "mv $corefile [standard_output_file prelink.core]" set found 1 } } @@ -107,6 +107,6 @@ clean_restart $executable # Print the "adjusting expectations" message. gdb_test_no_output "set verbose on" -gdb_test "core-file $objdir/$subdir/prelink.core" "Using PIC \\(Position Independent Code\\) prelink displacement 0x\[^0\]\[0-9a-f\]* for \[^\r\n\]*[file tail ${libfile}].*" "seen displacement message" +gdb_test "core-file [standard_output_file prelink.core]" "Using PIC \\(Position Independent Code\\) prelink displacement 0x\[^0\]\[0-9a-f\]* for \[^\r\n\]*[file tail ${libfile}].*" "seen displacement message" gdb_test "p &bssvar == bssvarp" " = 1" ".dynbss vs. .bss address shift" diff --git a/gdb/testsuite/gdb.base/save-bp.exp b/gdb/testsuite/gdb.base/save-bp.exp index 64df0f7..9afe127 100644 --- a/gdb/testsuite/gdb.base/save-bp.exp +++ b/gdb/testsuite/gdb.base/save-bp.exp @@ -48,8 +48,13 @@ gdb_test "commands\nsilent\nend" "End with.*" "add breakpoint commands" gdb_test "dprintf ${srcfile}:${loc_bp5},\"At foo entry\\n\"" "Dprintf .*" # Now, save the breakpoints into a file... -remote_file host delete "bps" -gdb_test "save breakpoint bps" +if {[is_remote host]} { + set bps bps +} else { + set bps [standard_output_file bps] +} +remote_file host delete "$bps" +gdb_test "save breakpoint $bps" "" "save breakpoint bps" # Now start a new debugger session... clean_restart $testfile @@ -62,7 +67,7 @@ if ![runto_main] { delete_breakpoints # ... and restore the breakpoints. -gdb_test "source bps" +gdb_test "source $bps" "" "source bps" # Now, verify that all breakpoints have been created correctly... set bp_row_start "\[0-9\]+ +breakpoint +keep +y +0x\[0-9a-f\]+ +in" diff --git a/gdb/testsuite/gdb.base/sepdebug.exp b/gdb/testsuite/gdb.base/sepdebug.exp index 9e956c7..632a43e 100644 --- a/gdb/testsuite/gdb.base/sepdebug.exp +++ b/gdb/testsuite/gdb.base/sepdebug.exp @@ -29,9 +29,7 @@ # test running programs # -set testfile "sepdebug" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile}${EXEEXT} +standard_testfile .c if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } { untested sepdebug.exp @@ -54,14 +52,15 @@ if [gdb_gnu_strip_debug $binfile] { # PR gdb/9538. Verify that symlinked executable still finds the separate # debuginfo. # -set old_subdir ${subdir} -set subdir ${subdir}/pr9538 +set old_subdir $subdir +set subdir [file join ${old_subdir} pr9538] # Cleanup any stale state. -remote_exec build "rm -rf ${subdir}" +set new_name [standard_output_file ${testfile}${EXEEXT}] +remote_exec build "rm -rf [file dirname $new_name]" -remote_exec build "mkdir ${subdir}" -remote_exec build "ln -s ${binfile} ${subdir}" +remote_exec build "mkdir [file dirname $new_name]" +remote_exec build "ln -s ${binfile} $new_name" clean_restart ${testfile}${EXEEXT} if { $gdb_file_cmd_debug_info != "debug" } then { fail "No debug information found." @@ -650,7 +649,7 @@ test_next_with_recursion proc test_different_dir {type test_different_dir xfail} { with_test_prefix "$type" { - global srcdir subdir objdir binfile srcfile timeout gdb_prompt + global srcdir subdir binfile srcfile timeout gdb_prompt global bp_location6 decimal hex gdb_exit @@ -750,11 +749,11 @@ proc test_different_dir {type test_different_dir xfail} { # now move the .debug file to a different location so that we can test # the "set debug-file-directory" command. -set different_dir "${objdir}/${subdir}/${testfile}.dir" -set debugfile "${different_dir}/${objdir}/${subdir}/${testfile}.debug" +set different_dir [standard_output_file ${testfile}.dir] +set debugfile "${different_dir}/[standard_output_file ${testfile}.debug]" remote_exec build "rm -rf $different_dir" remote_exec build "mkdir -p [file dirname $debugfile]" -remote_exec build "mv -f ${objdir}/${subdir}/${testfile}.debug $debugfile" +remote_exec build "mv -f [standard_output_file ${testfile}.debug] $debugfile" test_different_dir debuglink $different_dir 0 @@ -762,17 +761,17 @@ test_different_dir debuglink $different_dir 0 # Test CRC mismatch is reported. if {[build_executable sepdebug.exp sepdebug2 sepdebug2.c debug] != -1 - && ![gdb_gnu_strip_debug ${objdir}/${subdir}/sepdebug2]} { + && ![gdb_gnu_strip_debug [standard_output_file sepdebug2]]} { - remote_exec build "cp ${debugfile} ${objdir}/${subdir}/sepdebug2.debug" + remote_exec build "cp ${debugfile} [standard_output_file sepdebug2.debug]" gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir - set escapedobjdirsubdir [string_to_regexp ${objdir}/${subdir}] + set escapedobjdirsubdir [string_to_regexp [standard_output_file {}]] - gdb_test "file ${objdir}/${subdir}/sepdebug2" "warning: the debug information found in \"${escapedobjdirsubdir}/sepdebug2\\.debug\" does not match \"${escapedobjdirsubdir}/sepdebug2\" \\(CRC mismatch\\)\\..*\\(no debugging symbols found\\).*" "CRC mismatch is reported" + gdb_test "file [standard_output_file sepdebug2]" "warning: the debug information found in \"${escapedobjdirsubdir}/sepdebug2\\.debug\" does not match \"${escapedobjdirsubdir}/sepdebug2\" \\(CRC mismatch\\)\\..*\\(no debugging symbols found\\).*" "CRC mismatch is reported" } @@ -797,17 +796,17 @@ if ![string compare $build_id_debug_filename ""] then { pass $test } - file mkdir [file dirname ${objdir}/${subdir}/${build_id_debug_filename}] - remote_exec build "mv $debugfile ${objdir}/${subdir}/${build_id_debug_filename}" + file mkdir [file dirname [standard_output_file ${build_id_debug_filename}]] + remote_exec build "mv $debugfile [standard_output_file ${build_id_debug_filename}]" - test_different_dir build-id "${objdir}/${subdir}" $xfail + test_different_dir build-id [standard_output_file {}] $xfail # Test also multiple directories can be specified. Without the build-id # reference GDB would find the separate debug info just at the same # location as the executable file. - test_different_dir multiple-dirs "/doesnotexist:${objdir}/${subdir}" $xfail + test_different_dir multiple-dirs "/doesnotexist:[standard_output_file {}]" $xfail # Spare debug files may confuse testsuite runs in the future. - remote_exec build "rm -f ${objdir}/${subdir}/${build_id_debug_filename}" + remote_exec build "rm -f [standard_output_file ${build_id_debug_filename}]" } diff --git a/gdb/testsuite/gdb.base/solib-search.exp b/gdb/testsuite/gdb.base/solib-search.exp index 9b10664..c3298d8 100644 --- a/gdb/testsuite/gdb.base/solib-search.exp +++ b/gdb/testsuite/gdb.base/solib-search.exp @@ -35,33 +35,35 @@ set right_lib_subdir "solib-search-right" # First library file. set libname1 "solib-search-lib1" set srcfile1_lib ${srcdir}/${subdir}/${libname1}.c -set wrong_binfile1_lib ${objdir}/${subdir}/${wrong_lib_subdir}/${libname1}.so -set right_binfile1_lib ${objdir}/${subdir}/${right_lib_subdir}/${libname1}.so +set wrong_binfile1_lib \ + [standard_output_file ${wrong_lib_subdir}/${libname1}.so] +set right_binfile1_lib \ + [standard_output_file ${right_lib_subdir}/${libname1}.so] # Second library file. set libname2 "solib-search-lib2" set srcfile2_lib ${srcdir}/${subdir}/${libname2}.c -set wrong_binfile2_lib ${objdir}/${subdir}/${wrong_lib_subdir}/${libname2}.so -set right_binfile2_lib ${objdir}/${subdir}/${right_lib_subdir}/${libname2}.so +set wrong_binfile2_lib \ + [standard_output_file ${wrong_lib_subdir}/${libname2}.so] +set right_binfile2_lib \ + [standard_output_file ${right_lib_subdir}/${libname2}.so] # Link with the library that lives here. # This is so that we can replace what gdb sees with the wrong copy, # and then tell gdb to use the right copy that lives someplace else. -set binfile1_lib ${objdir}/${subdir}/${libname1}.so -set binfile2_lib ${objdir}/${subdir}/${libname2}.so +set binfile1_lib [standard_output_file ${libname1}.so] +set binfile2_lib [standard_output_file ${libname2}.so] set lib_flags [list debug ldflags=-Wl,-Bsymbolic] set wrong_lib_flags "$lib_flags additional_flags=-DARRAY_SIZE=1" set right_lib_flags "$lib_flags additional_flags=-DARRAY_SIZE=8192 -DRIGHT" # Binary file. -set testfile "solib-search" -set srcfile ${srcdir}/${subdir}/${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} +standard_testfile .c set bin_flags [list debug shlib=${binfile1_lib} shlib=${binfile2_lib}] -remote_exec build "rm -rf ${subdir}/${wrong_lib_subdir}" -remote_exec build "rm -rf ${subdir}/${right_lib_subdir}" -remote_exec build "mkdir ${subdir}/${wrong_lib_subdir}" -remote_exec build "mkdir ${subdir}/${right_lib_subdir}" +remote_exec build "rm -rf [standard_output_file ${wrong_lib_subdir}]" +remote_exec build "rm -rf [standard_output_file ${right_lib_subdir}]" +remote_exec build "mkdir [standard_output_file ${wrong_lib_subdir}]" +remote_exec build "mkdir [standard_output_file ${right_lib_subdir}]" if { [gdb_compile_shlib ${srcfile1_lib} ${wrong_binfile1_lib} $wrong_lib_flags] != "" || [gdb_compile_shlib ${srcfile2_lib} ${wrong_binfile2_lib} $wrong_lib_flags] != "" @@ -74,7 +76,8 @@ if { [gdb_compile_shlib ${srcfile1_lib} ${wrong_binfile1_lib} $wrong_lib_flags] # Build the test binary using the right copies of the libraries. remote_exec build "ln -sf ${right_lib_subdir}/${libname1}.so ${binfile1_lib}" remote_exec build "ln -sf ${right_lib_subdir}/${libname2}.so ${binfile2_lib}" -if { [gdb_compile ${srcfile} ${binfile} executable $bin_flags] != "" } { +if { [gdb_compile $srcdir/$subdir/${srcfile} ${binfile} \ + executable $bin_flags] != "" } { untested "Could not compile $binfile." return -1 } @@ -89,7 +92,7 @@ if { ![runto_main] } { gdb_breakpoint "break_here" gdb_continue "break_here" -set corefile "${objdir}/${subdir}/solib-search.core" +set corefile [standard_output_file solib-search.core] set core_supported [gdb_gcore_cmd "$corefile" "save a corefile"] if {!$core_supported} { @@ -175,7 +178,7 @@ test_backtrace 1 remote_exec build "rm -f ${binfile1_lib}" remote_exec build "rm -f ${binfile2_lib}" # Set solib-search-path to use the correct copies of libraries. -gdb_test "set solib-search-path ${objdir}/${subdir}/${right_lib_subdir}" \ +gdb_test "set solib-search-path [standard_output_file ${right_lib_subdir}]" \ "" \ "set solib-search-path" diff --git a/gdb/testsuite/gdb.base/step-line.exp b/gdb/testsuite/gdb.base/step-line.exp index bc8f2bc..73113c7 100644 --- a/gdb/testsuite/gdb.base/step-line.exp +++ b/gdb/testsuite/gdb.base/step-line.exp @@ -33,7 +33,7 @@ if ![runto_main] then { return 0 } -set remote_linefile [remote_download host ${srcdir}/${subdir}/${linefile}] +set remote_linefile [gdb_remote_download host ${srcdir}/${subdir}/${linefile}] gdb_test "break f1" ".*Breakpoint 2 at .* file .*step-line.c.*" "break f1" gdb_test "continue" \ diff --git a/gdb/testsuite/gdb.base/trace-commands.exp b/gdb/testsuite/gdb.base/trace-commands.exp index ed49049..0ec77a0 100644 --- a/gdb/testsuite/gdb.base/trace-commands.exp +++ b/gdb/testsuite/gdb.base/trace-commands.exp @@ -20,7 +20,8 @@ gdb_exit gdb_start # Create a file to source -set fd [open "tracecommandsscript" w] +set tracecommandsscript [standard_output_file tracecommandsscript] +set fd [open "$tracecommandsscript" w] puts $fd "\ echo in tracecommandsscript\\n define func @@ -44,7 +45,7 @@ gdb_test "show trace-commands" "State of GDB CLI command tracing is off\\." \ "show trace-commands says off" # Source the script with verbose mode. -gdb_test_sequence "source -v tracecommandsscript" "source -v" { +gdb_test_sequence "source -v $tracecommandsscript" "source -v" { {[\r\n]\+echo in tracecommandsscript\\n} {[\r\n]\+define func} {[\r\n]\+if 1} @@ -91,13 +92,13 @@ gdb_test_sequence "if 1\nset \$i = 0\nwhile \$i < 5\nfunc \$i\nset \$i += 1\nend } # Function with source works -gdb_test_sequence "define topfunc\nsource tracecommandsscript\nend" \ +gdb_test_sequence "define topfunc\nsource $tracecommandsscript\nend" \ "define user command" { {[\r\n]\+define topfunc} } gdb_test_sequence "topfunc" "nested trace-commands test with source" { {[\r\n]\+topfunc} - {[\r\n]\+\+source tracecommandsscript} + {[\r\n]\+\+source .*/tracecommandsscript} {[\r\n]\+\+echo in tracecommandsscript\\n} {[\r\n]\+\+define func} {[\r\n]\+\+if 1} -- 1.8.1.4