From e0f353ceed204d98f0581a17e84d33dd18c65ec5 Mon Sep 17 00:00:00 2001 From: Elena Zannoni Date: Thu, 7 Aug 2003 17:55:41 +0000 Subject: [PATCH] 2003-08-07 Elena Zannoni * gdb.base/attach.exp, gdb.base/detach.exp, gdb.base/gcore.exp, gdb.mi/mi-basics.exp, gdb.threads/gcore-thread.exp, gdb.trace/save-trace.exp: Make sure that full pathnames are escaped correctly. --- gdb/testsuite/ChangeLog | 7 +++++++ gdb/testsuite/gdb.base/attach.exp | 14 +++++++------ gdb/testsuite/gdb.base/detach.exp | 4 +++- gdb/testsuite/gdb.base/gcore.exp | 4 +++- gdb/testsuite/gdb.mi/mi-basics.exp | 24 ++++++++++++---------- gdb/testsuite/gdb.threads/gcore-thread.exp | 3 ++- gdb/testsuite/gdb.trace/save-trace.exp | 3 ++- 7 files changed, 38 insertions(+), 21 deletions(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 2167894b42c..a77e19d6488 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2003-08-07 Elena Zannoni + + * gdb.base/attach.exp, gdb.base/detach.exp, gdb.base/gcore.exp, + gdb.mi/mi-basics.exp, gdb.threads/gcore-thread.exp, + gdb.trace/save-trace.exp: Make sure that full pathnames are + escaped correctly. + 2003-08-07 Elena Zannoni * configure.in: Don't generate config.h from config.hin. diff --git a/gdb/testsuite/gdb.base/attach.exp b/gdb/testsuite/gdb.base/attach.exp index 66e9f0ec311..ea11087f8af 100644 --- a/gdb/testsuite/gdb.base/attach.exp +++ b/gdb/testsuite/gdb.base/attach.exp @@ -45,6 +45,7 @@ set srcfile ${testfile}.c set srcfile2 ${testfile}2.c set binfile ${objdir}/${subdir}/${testfile} set binfile2 ${objdir}/${subdir}/${testfile}2 +set escapedbinfile [string_to_regexp ${objdir}/${subdir}/${testfile}] set cleanupfile ${objdir}/${subdir}/${testfile}.awk #execute_anywhere "rm -f ${binfile} ${binfile2}" @@ -76,6 +77,7 @@ if [get_compiler_info ${binfile}] { proc do_attach_tests {} { global gdb_prompt global binfile + global escapedbinfile global srcfile global testfile global objdir @@ -157,13 +159,13 @@ proc do_attach_tests {} { -re "Load new symbol table from.*y or n.*$" { send_gdb "y\n" gdb_expect { - -re "Reading symbols from $binfile\.\.\.*done.*$gdb_prompt $"\ + -re "Reading symbols from $escapedbinfile\.\.\.*done.*$gdb_prompt $"\ {pass "(re)set file, before attach1"} -re "$gdb_prompt $" {fail "(re)set file, before attach1"} timeout {fail "(timeout) (re)set file, before attach1"} } } - -re "Reading symbols from $binfile\.\.\.*done.*$gdb_prompt $"\ + -re "Reading symbols from $escapedbinfile\.\.\.*done.*$gdb_prompt $"\ {pass "set file, before attach1"} -re "$gdb_prompt $" {fail "set file, before attach1"} timeout {fail "(timeout) set file, before attach1"} @@ -171,7 +173,7 @@ proc do_attach_tests {} { send_gdb "attach $testpid\n" gdb_expect { - -re "Attaching to program.*`?$binfile'?, process $testpid.*main.*at .*$srcfile:.*$gdb_prompt $"\ + -re "Attaching to program.*`?$escapedbinfile'?, process $testpid.*main.*at .*$srcfile:.*$gdb_prompt $"\ {pass "attach1, after setting file"} -re "$gdb_prompt $" {fail "attach1, after setting file"} timeout {fail "(timeout) attach1, after setting file"} @@ -192,7 +194,7 @@ proc do_attach_tests {} { # send_gdb "detach\n" gdb_expect { - -re "Detaching from program: .*$binfile.*$gdb_prompt $"\ + -re "Detaching from program: .*$escapedbinfile.*$gdb_prompt $"\ {pass "attach1 detach"} -re "$gdb_prompt $" {fail "attach1 detach"} timeout {fail "(timeout) attach1 detach"} @@ -234,7 +236,7 @@ proc do_attach_tests {} { # send_gdb "attach $testpid\n" gdb_expect { - -re "Attaching to process $testpid.*Reading symbols from $binfile.*main.*at .*$gdb_prompt $"\ + -re "Attaching to process $testpid.*Reading symbols from $escapedbinfile.*main.*at .*$gdb_prompt $"\ {pass "attach2"} -re "$gdb_prompt $" {fail "attach2"} timeout {fail "(timeout) attach2"} @@ -335,7 +337,7 @@ proc do_attach_tests {} { send_gdb "attach $testpid\n" gdb_expect { - -re "Attaching to process $testpid.*Reading symbols from $binfile.*main.*at .*$gdb_prompt $"\ + -re "Attaching to process $testpid.*Reading symbols from $escapedbinfile.*main.*at .*$gdb_prompt $"\ {pass "attach when process' a.out not in cwd"} -re "$gdb_prompt $" {fail "attach when process' a.out not in cwd"} timeout {fail "(timeout) attach when process' a.out not in cwd"} diff --git a/gdb/testsuite/gdb.base/detach.exp b/gdb/testsuite/gdb.base/detach.exp index 1556cf9cb53..1f86fecfca1 100644 --- a/gdb/testsuite/gdb.base/detach.exp +++ b/gdb/testsuite/gdb.base/detach.exp @@ -40,6 +40,7 @@ if [is_remote target] then { set testfile "attach" set srcfile ${testfile}.c set binfile ${objdir}/${subdir}/${testfile} +set escapedbinfile [string_to_regexp ${objdir}/${subdir}/${testfile}] if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." @@ -48,12 +49,13 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb proc do_detach_tests {} { global srcdir global binfile + global escapedbinfile global subdir global pass runto_main gdb_test "set should_exit = 1" "" "set should_exit, $pass" - gdb_test "detach" "Detaching from program: .*$binfile, .*" "detach, $pass" + gdb_test "detach" "Detaching from program: .*$escapedbinfile, .*" "detach, $pass" } # Start with a fresh gdb diff --git a/gdb/testsuite/gdb.base/gcore.exp b/gdb/testsuite/gdb.base/gcore.exp index f8d5baac614..8c0ae8eb5c4 100644 --- a/gdb/testsuite/gdb.base/gcore.exp +++ b/gdb/testsuite/gdb.base/gcore.exp @@ -104,8 +104,10 @@ set pre_corefile_local_array \ set pre_corefile_extern_array \ [capture_command_output "print extern_array" "$print_prefix"] +set escapedfilename [string_to_regexp ${objdir}/${subdir}/gcore.test] + gdb_test "gcore ${objdir}/${subdir}/gcore.test" \ - "Saved corefile ${objdir}/${subdir}/gcore.test" \ + "Saved corefile ${escapedfilename}" \ "save a corefile" # Now restart gdb and load the corefile. diff --git a/gdb/testsuite/gdb.mi/mi-basics.exp b/gdb/testsuite/gdb.mi/mi-basics.exp index 98ffe1d2acf..9377baf9e6c 100644 --- a/gdb/testsuite/gdb.mi/mi-basics.exp +++ b/gdb/testsuite/gdb.mi/mi-basics.exp @@ -40,6 +40,9 @@ if [mi_gdb_start] { set testfile "basics" set srcfile ${testfile}.c set binfile ${objdir}/${subdir}/${testfile} +set escapedobjdir [string_to_regexp ${objdir}] +set escapedsrcdir [string_to_regexp ${srcdir}] + if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } { gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } @@ -154,25 +157,25 @@ proc test_dir_specification {} { # -environment-directory # -environment-directory -r -#exp_internal 1 + set envirodir [string_to_regexp ${srcdir}/${subdir}] + mi_gdb_test "202-environment-directory ${srcdir}/${subdir}" \ - "\\\^done,source-path=\"${srcdir}/${subdir}.\\\$cdir.\\\$cwd\"" \ + "\\\^done,source-path=\"${envirodir}.\\\$cdir.\\\$cwd\"" \ "environment-directory arg operation" mi_gdb_test "203-environment-directory" \ - "\\\^done,source-path=\"${srcdir}/${subdir}.\\\$cdir.\\\$cwd\"" \ + "\\\^done,source-path=\"${envirodir}.\\\$cdir.\\\$cwd\"" \ "environment-directory empty-string operation" mi_gdb_test "204-environment-directory -r" \ "\\\^done,source-path=\"\\\$cdir.\\\$cwd\"" \ "environment-directory operation" - -#exp_internal 0 } proc test_cwd_specification {} { global mi_gdb_prompt global objdir + global escapedobjdir global subdir # Change the working directory, then print the current working directory @@ -185,7 +188,7 @@ proc test_cwd_specification {} { "environment-cd arg operation" mi_gdb_test "206-environment-pwd" \ - "\\\^done,cwd=\"${objdir}\"" \ + "\\\^done,cwd=\"${escapedobjdir}\"" \ "environment-pwd operation" } @@ -194,6 +197,8 @@ proc test_path_specification {} { global orig_path global objdir global srcdir + global escapedobjdir + global escapedsrcdir # Add to the path, display, then reset # Tests: @@ -202,8 +207,6 @@ proc test_path_specification {} { # -environment-path -r dir # -environment-path -r -#exp_internal 1 - send_gdb "-environment-path\n" gdb_expect 20 { -re "\\\^done,path=\"\(.*\)\"\r\n$mi_gdb_prompt" { @@ -220,18 +223,17 @@ proc test_path_specification {} { "environment-path no-args operation" mi_gdb_test "208-environment-path $srcdir $objdir" \ - "\\\^done,path=\"$srcdir.$objdir.$orig_path\"" \ + "\\\^done,path=\"$escapedsrcdir.$escapedobjdir.$orig_path\"" \ "environment-path dir1 dir2 operation" mi_gdb_test "209-environment-path -r $objdir" \ - "\\\^done,path=\"$objdir.$orig_path\"" \ + "\\\^done,path=\"$escapedobjdir.$orig_path\"" \ "environment-path -r dir operation" mi_gdb_test "210-environment-path -r" \ "\\\^done,path=\"$orig_path\"" \ "environment-path -r operation" -#exp_internal 0 } if [test_mi_interpreter_selection] { diff --git a/gdb/testsuite/gdb.threads/gcore-thread.exp b/gdb/testsuite/gdb.threads/gcore-thread.exp index 8184fa52d0b..5cb80bd7c79 100644 --- a/gdb/testsuite/gdb.threads/gcore-thread.exp +++ b/gdb/testsuite/gdb.threads/gcore-thread.exp @@ -103,9 +103,10 @@ delete_breakpoints gdb_breakpoint "thread2" gdb_test "continue" "Continuing.*Breakpoint.* thread2 .*" "thread 2 is running" +set escapedfilename [string_to_regexp ${objdir}/${subdir}/gcore.test] # Drop corefile gdb_test "gcore ${objdir}/${subdir}/gcore.test" \ - "Saved corefile ${objdir}/${subdir}/gcore.test" \ + "Saved corefile ${escapedfilename}" \ "save a corefile" # Now restart gdb and load the corefile. diff --git a/gdb/testsuite/gdb.trace/save-trace.exp b/gdb/testsuite/gdb.trace/save-trace.exp index b461ad85940..a5b7cf0ccde 100644 --- a/gdb/testsuite/gdb.trace/save-trace.exp +++ b/gdb/testsuite/gdb.trace/save-trace.exp @@ -145,9 +145,10 @@ remote_file host delete savetrace.tr # 10.3 repeat with a path to the file +set escapedfilename [string_to_regexp $objdir/savetrace.tr] remote_file host delete $objdir/savetrace.tr gdb_test "save-tracepoints $objdir/savetrace.tr" \ - "Tracepoints saved to file '$objdir/savetrace.tr'." \ + "Tracepoints saved to file '${escapedfilename}'." \ "10.3: save tracepoint definitions, full path" gdb_delete_tracepoints -- 2.30.2