+2003-08-07 Elena Zannoni <ezannoni@redhat.com>
+
+ * 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 <ezannoni@redhat.com>
* configure.in: Don't generate config.h from config.hin.
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}"
proc do_attach_tests {} {
global gdb_prompt
global binfile
+ global escapedbinfile
global srcfile
global testfile
global objdir
-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"}
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"}
#
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"}
#
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"}
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"}
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."
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
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.
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."
}
# -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
"environment-cd arg operation"
mi_gdb_test "206-environment-pwd" \
- "\\\^done,cwd=\"${objdir}\"" \
+ "\\\^done,cwd=\"${escapedobjdir}\"" \
"environment-pwd operation"
}
global orig_path
global objdir
global srcdir
+ global escapedobjdir
+ global escapedsrcdir
# Add to the path, display, then reset
# Tests:
# -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" {
"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] {
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.
# 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