summaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.base/foll-vfork.exp
diff options
context:
space:
mode:
authorYao Qi <yao.qi@linaro.org>2016-02-04 15:46:37 +0000
committerYao Qi <yao.qi@linaro.org>2016-02-04 15:46:37 +0000
commit31d913c7e4e84edf88b4324c3a9a8fb31c8206ec (patch)
tree8392dee4304d43954d85d3285c4003a23e4f4d38 /gdb/testsuite/gdb.base/foll-vfork.exp
parente42e5352d1d1e8a262178f606a5df3d0d988f78a (diff)
[testsuite] Remove BASEDIR
BASEDIR was added by https://sourceware.org/ml/gdb-patches/2013-10/msg00587.html in order to handle the different directory layout in serial testing and parallel testing. BASEDIR is "gdb.base" in serial testing and is "outputs/gdb.base/TESTNAME" in parallel testing. However, it doesn't work if the GDBserver is in remote target, like this, $ make check RUNTESTFLAGS='--target_board=remote-gdbserver-on-localhost foll-vfork.exp foll-exec.exp' FAIL: gdb.base/foll-exec.exp: continue to first exec catchpoint (the program exited) FAIL: gdb.base/foll-vfork.exp: exec: vfork and exec child follow, to main bp: continue to bp (the program exited) FAIL: gdb.base/foll-vfork.exp: exec: vfork child follow, finish after tcatch vfork: finish (the program exited) FAIL: gdb.base/foll-vfork.exp: exec: vfork relations in info inferiors: continue to bp (the program exited) these tests fail because the executable can't be found. With target board native-gdbserver, the program is spawned this way, spawn ../gdbserver/gdbserver --once :2347 /scratch/yao/gdb/build-git/x86_64/gdb/testsuite/gdb.base/foll-vfork so BASEDIR is correct. However, with target board remote-gdbserver-on-localhost, the program is spawned spawn /usr/bin/ssh -l yao localhost /scratch/yao/gdb/build-git/x86_64/gdb/testsuite/../gdbserver/gdbserver --once :2346 /scratch/yao/gdb/build-git/x86_64/gdb/testsuite/gdb.base/foll-vfork so BASEDIR (either "gdb.base" or "outputs/gdb.base/TESTNAME") makes no sense. I had a fix that pass absolute directory to BASEDIR, but it assumes that directory structure is the same on build and target, and it doesn't work in remote host case. The current fix in this patch is to get the directory from argv[0]. In any case, the program to be exec'ed is at the same directory with the main program. Note that these tests do "next N" to let program stop at the desired line, but it is fragile, because GDB for different targets may skip function prologue slightly differently, so I replace some of them by "tbreak on LINE NUMBER and continue". gdb/testsuite: 2016-02-04 Yao Qi <yao.qi@linaro.org> * gdb.base/foll-exec-mode.c: Include limits.h. (main): Add parameters argc and argv. Get directory from argv[0]. * gdb.base/foll-exec-mode.exp: Don't pass -DBASEDIR in compilation. * gdb.base/foll-exec.c: Include limits.h. (main): Add parameters argc and argv. Get directory from argv[0]. * gdb.base/foll-exec.exp: Don't pass -DBASEDIR in compilation. Adjust tests on the number of lines as source code changed. * gdb.base/foll-vfork-exit.c: Include limits.h. (main): Add one line of statement before vfork. * gdb.base/foll-vfork.c: Include limits.h and string.h. (main): Add parameters argc and argv. Get directory from argv[0]. * gdb.base/foll-vfork.exp: Don't pass -DBASEDIR in compilation. (setup_gdb): Set tbreak to skip some source lines. * gdb.multi/bkpt-multi-exec.c: Include limits.h. (main): Add parameters argc and argv. Get directory from argv[0]. * gdb.multi/bkpt-multi-exec.exp: Don't pass -DBASEDIR in compilation. * gdb.multi/multi-arch-exec.c: Include limits.h and string.h. (main): Add parameters argc and argv. Get directory from argv[0]. * gdb.multi/multi-arch-exec.exp: Don't pass -DBASEDIR in compilation.
Diffstat (limited to 'gdb/testsuite/gdb.base/foll-vfork.exp')
-rw-r--r--gdb/testsuite/gdb.base/foll-vfork.exp8
1 files changed, 5 insertions, 3 deletions
diff --git a/gdb/testsuite/gdb.base/foll-vfork.exp b/gdb/testsuite/gdb.base/foll-vfork.exp
index bf9b89349b..481dcb7d6e 100644
--- a/gdb/testsuite/gdb.base/foll-vfork.exp
+++ b/gdb/testsuite/gdb.base/foll-vfork.exp
@@ -28,8 +28,6 @@ if {![istarget "*-linux*"]} then {
standard_testfile
set compile_options debug
-set dirname [relative_filename [pwd] [file dirname $binfile]]
-lappend compile_options "additional_flags=-DBASEDIR=\"$dirname\""
if {[build_executable $testfile.exp $testfile $srcfile $compile_options] == -1} {
untested "failed to compile $testfile"
@@ -53,7 +51,7 @@ set timeout [expr "$timeout + 10"]
# error, behave as "return", so we don't try to continue testing with
# a borked session.
proc setup_gdb {} {
- global testfile
+ global testfile srcfile
clean_restart $testfile
@@ -64,6 +62,10 @@ proc setup_gdb {} {
if ![runto_main] {
return -code return
}
+
+ set tbreak_line [gdb_get_line_number " VFORK " $srcfile]
+ gdb_test "tbreak ${tbreak_line}"
+ gdb_continue_to_breakpoint ".*"
}
proc check_vfork_catchpoints {} {