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.
This commit is contained in:
Elena Zannoni 2003-08-07 17:55:41 +00:00
parent 5710a1afa9
commit e0f353ceed
7 changed files with 38 additions and 21 deletions

View file

@ -1,3 +1,10 @@
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> 2003-08-07 Elena Zannoni <ezannoni@redhat.com>
* configure.in: Don't generate config.h from config.hin. * configure.in: Don't generate config.h from config.hin.

View file

@ -45,6 +45,7 @@ set srcfile ${testfile}.c
set srcfile2 ${testfile}2.c set srcfile2 ${testfile}2.c
set binfile ${objdir}/${subdir}/${testfile} set binfile ${objdir}/${subdir}/${testfile}
set binfile2 ${objdir}/${subdir}/${testfile}2 set binfile2 ${objdir}/${subdir}/${testfile}2
set escapedbinfile [string_to_regexp ${objdir}/${subdir}/${testfile}]
set cleanupfile ${objdir}/${subdir}/${testfile}.awk set cleanupfile ${objdir}/${subdir}/${testfile}.awk
#execute_anywhere "rm -f ${binfile} ${binfile2}" #execute_anywhere "rm -f ${binfile} ${binfile2}"
@ -76,6 +77,7 @@ if [get_compiler_info ${binfile}] {
proc do_attach_tests {} { proc do_attach_tests {} {
global gdb_prompt global gdb_prompt
global binfile global binfile
global escapedbinfile
global srcfile global srcfile
global testfile global testfile
global objdir global objdir
@ -157,13 +159,13 @@ proc do_attach_tests {} {
-re "Load new symbol table from.*y or n.*$" { -re "Load new symbol table from.*y or n.*$" {
send_gdb "y\n" send_gdb "y\n"
gdb_expect { gdb_expect {
-re "Reading symbols from $binfile\.\.\.*done.*$gdb_prompt $"\ -re "Reading symbols from $escapedbinfile\.\.\.*done.*$gdb_prompt $"\
{pass "(re)set file, before attach1"} {pass "(re)set file, before attach1"}
-re "$gdb_prompt $" {fail "(re)set file, before attach1"} -re "$gdb_prompt $" {fail "(re)set file, before attach1"}
timeout {fail "(timeout) (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"} {pass "set file, before attach1"}
-re "$gdb_prompt $" {fail "set file, before attach1"} -re "$gdb_prompt $" {fail "set file, before attach1"}
timeout {fail "(timeout) set file, before attach1"} timeout {fail "(timeout) set file, before attach1"}
@ -171,7 +173,7 @@ proc do_attach_tests {} {
send_gdb "attach $testpid\n" send_gdb "attach $testpid\n"
gdb_expect { 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"} {pass "attach1, after setting file"}
-re "$gdb_prompt $" {fail "attach1, after setting file"} -re "$gdb_prompt $" {fail "attach1, after setting file"}
timeout {fail "(timeout) attach1, after setting file"} timeout {fail "(timeout) attach1, after setting file"}
@ -192,7 +194,7 @@ proc do_attach_tests {} {
# #
send_gdb "detach\n" send_gdb "detach\n"
gdb_expect { gdb_expect {
-re "Detaching from program: .*$binfile.*$gdb_prompt $"\ -re "Detaching from program: .*$escapedbinfile.*$gdb_prompt $"\
{pass "attach1 detach"} {pass "attach1 detach"}
-re "$gdb_prompt $" {fail "attach1 detach"} -re "$gdb_prompt $" {fail "attach1 detach"}
timeout {fail "(timeout) attach1 detach"} timeout {fail "(timeout) attach1 detach"}
@ -234,7 +236,7 @@ proc do_attach_tests {} {
# #
send_gdb "attach $testpid\n" send_gdb "attach $testpid\n"
gdb_expect { 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"} {pass "attach2"}
-re "$gdb_prompt $" {fail "attach2"} -re "$gdb_prompt $" {fail "attach2"}
timeout {fail "(timeout) attach2"} timeout {fail "(timeout) attach2"}
@ -335,7 +337,7 @@ proc do_attach_tests {} {
send_gdb "attach $testpid\n" send_gdb "attach $testpid\n"
gdb_expect { 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"} {pass "attach when process' a.out not in cwd"}
-re "$gdb_prompt $" {fail "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"} timeout {fail "(timeout) attach when process' a.out not in cwd"}

View file

@ -40,6 +40,7 @@ if [is_remote target] then {
set testfile "attach" set testfile "attach"
set srcfile ${testfile}.c set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile} set binfile ${objdir}/${subdir}/${testfile}
set escapedbinfile [string_to_regexp ${objdir}/${subdir}/${testfile}]
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { 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." 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 {} { proc do_detach_tests {} {
global srcdir global srcdir
global binfile global binfile
global escapedbinfile
global subdir global subdir
global pass global pass
runto_main runto_main
gdb_test "set should_exit = 1" "" "set should_exit, $pass" 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 # Start with a fresh gdb

View file

@ -104,8 +104,10 @@ set pre_corefile_local_array \
set pre_corefile_extern_array \ set pre_corefile_extern_array \
[capture_command_output "print extern_array" "$print_prefix"] [capture_command_output "print extern_array" "$print_prefix"]
set escapedfilename [string_to_regexp ${objdir}/${subdir}/gcore.test]
gdb_test "gcore ${objdir}/${subdir}/gcore.test" \ gdb_test "gcore ${objdir}/${subdir}/gcore.test" \
"Saved corefile ${objdir}/${subdir}/gcore.test" \ "Saved corefile ${escapedfilename}" \
"save a corefile" "save a corefile"
# Now restart gdb and load the corefile. # Now restart gdb and load the corefile.

View file

@ -40,6 +40,9 @@ if [mi_gdb_start] {
set testfile "basics" set testfile "basics"
set srcfile ${testfile}.c set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile} 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}] != "" } { 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." 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
# -environment-directory -r # -environment-directory -r
#exp_internal 1 set envirodir [string_to_regexp ${srcdir}/${subdir}]
mi_gdb_test "202-environment-directory ${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" "environment-directory arg operation"
mi_gdb_test "203-environment-directory" \ mi_gdb_test "203-environment-directory" \
"\\\^done,source-path=\"${srcdir}/${subdir}.\\\$cdir.\\\$cwd\"" \ "\\\^done,source-path=\"${envirodir}.\\\$cdir.\\\$cwd\"" \
"environment-directory empty-string operation" "environment-directory empty-string operation"
mi_gdb_test "204-environment-directory -r" \ mi_gdb_test "204-environment-directory -r" \
"\\\^done,source-path=\"\\\$cdir.\\\$cwd\"" \ "\\\^done,source-path=\"\\\$cdir.\\\$cwd\"" \
"environment-directory operation" "environment-directory operation"
#exp_internal 0
} }
proc test_cwd_specification {} { proc test_cwd_specification {} {
global mi_gdb_prompt global mi_gdb_prompt
global objdir global objdir
global escapedobjdir
global subdir global subdir
# Change the working directory, then print the current working directory # Change the working directory, then print the current working directory
@ -185,7 +188,7 @@ proc test_cwd_specification {} {
"environment-cd arg operation" "environment-cd arg operation"
mi_gdb_test "206-environment-pwd" \ mi_gdb_test "206-environment-pwd" \
"\\\^done,cwd=\"${objdir}\"" \ "\\\^done,cwd=\"${escapedobjdir}\"" \
"environment-pwd operation" "environment-pwd operation"
} }
@ -194,6 +197,8 @@ proc test_path_specification {} {
global orig_path global orig_path
global objdir global objdir
global srcdir global srcdir
global escapedobjdir
global escapedsrcdir
# Add to the path, display, then reset # Add to the path, display, then reset
# Tests: # Tests:
@ -202,8 +207,6 @@ proc test_path_specification {} {
# -environment-path -r dir # -environment-path -r dir
# -environment-path -r # -environment-path -r
#exp_internal 1
send_gdb "-environment-path\n" send_gdb "-environment-path\n"
gdb_expect 20 { gdb_expect 20 {
-re "\\\^done,path=\"\(.*\)\"\r\n$mi_gdb_prompt" { -re "\\\^done,path=\"\(.*\)\"\r\n$mi_gdb_prompt" {
@ -220,18 +223,17 @@ proc test_path_specification {} {
"environment-path no-args operation" "environment-path no-args operation"
mi_gdb_test "208-environment-path $srcdir $objdir" \ 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" "environment-path dir1 dir2 operation"
mi_gdb_test "209-environment-path -r $objdir" \ mi_gdb_test "209-environment-path -r $objdir" \
"\\\^done,path=\"$objdir.$orig_path\"" \ "\\\^done,path=\"$escapedobjdir.$orig_path\"" \
"environment-path -r dir operation" "environment-path -r dir operation"
mi_gdb_test "210-environment-path -r" \ mi_gdb_test "210-environment-path -r" \
"\\\^done,path=\"$orig_path\"" \ "\\\^done,path=\"$orig_path\"" \
"environment-path -r operation" "environment-path -r operation"
#exp_internal 0
} }
if [test_mi_interpreter_selection] { if [test_mi_interpreter_selection] {

View file

@ -103,9 +103,10 @@ delete_breakpoints
gdb_breakpoint "thread2" gdb_breakpoint "thread2"
gdb_test "continue" "Continuing.*Breakpoint.* thread2 .*" "thread 2 is running" gdb_test "continue" "Continuing.*Breakpoint.* thread2 .*" "thread 2 is running"
set escapedfilename [string_to_regexp ${objdir}/${subdir}/gcore.test]
# Drop corefile # Drop corefile
gdb_test "gcore ${objdir}/${subdir}/gcore.test" \ gdb_test "gcore ${objdir}/${subdir}/gcore.test" \
"Saved corefile ${objdir}/${subdir}/gcore.test" \ "Saved corefile ${escapedfilename}" \
"save a corefile" "save a corefile"
# Now restart gdb and load the corefile. # Now restart gdb and load the corefile.

View file

@ -145,9 +145,10 @@ remote_file host delete savetrace.tr
# 10.3 repeat with a path to the file # 10.3 repeat with a path to the file
set escapedfilename [string_to_regexp $objdir/savetrace.tr]
remote_file host delete $objdir/savetrace.tr remote_file host delete $objdir/savetrace.tr
gdb_test "save-tracepoints $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" "10.3: save tracepoint definitions, full path"
gdb_delete_tracepoints gdb_delete_tracepoints