#include <sys/wait.h>
#include <errno.h>
-/* Expects 4 arguments:
+/* Expects 3 arguments:
1. Either 'standard' or 'detached', where 'standard' tests
a general gcore script spawn with its controlling terminal available
and 'detached' tests gcore script spawn without its controlling
terminal available.
- 2. Path to the gcore script.
- 3. Path to the data-directory to pass to the gcore script.
- 4. The core file output name. */
+ 2. The command to invoke gcore (path to the gcore script and any necessary
+ flags).
+ 3. The core file output name. */
int
main (int argc, char **argv)
char buf[1024*2 + 500];
int gotint, res;
- assert (argc == 5);
+ assert (argc == 4);
pid = fork ();
if (strcmp (argv[1], "detached") == 0)
setpgrp ();
ppid = getppid ();
- gotint = snprintf (buf, sizeof (buf), "%s -d %s -o %s %d",
- argv[2], argv[3], argv[4], (int) ppid);
+ gotint = snprintf (buf, sizeof (buf), "%s -o %s %d",
+ argv[2], argv[3], (int) ppid);
assert (gotint < sizeof (buf));
res = system (buf);
assert (res != -1);
global GDB_DATA_DIRECTORY
# We can't use gdb_test_multiple here because GDB is not started.
- set res [remote_spawn target "$binfile $detached $GCORE $GDB_DATA_DIRECTORY $corefile"]
+ set gcore_cmd $GCORE
+ if {$GDB_DATA_DIRECTORY ne ""} {
+ set gcore_cmd "$gcore_cmd -d '$GDB_DATA_DIRECTORY'"
+ }
+ set res [remote_spawn target "$binfile $detached \"$gcore_cmd\" $corefile"]
if { ![gdb_assert { ![expr {$res < 0 || $res == ""}] } \
"spawned gcore"] } {
return
load_lib memory.exp
load_lib check-test-names.exp
-# The path to the GCORE script to test.
-global GCORE
-if {![info exists GCORE]} {
- set GCORE [findfile $base_dir/../../gdb/gcore]
-}
-verbose "using GCORE = $GCORE" 2
-
-# Return 0 if the gcore scipt is missing.
-proc has_gcore_script {} {
- global GCORE
- if {$GCORE == ""} {
- return 0
- } else {
- return 1
- }
-}
-
# The path to the GDB binary to test.
global GDB
}
verbose "using GDB_DATA_DIRECTORY = $GDB_DATA_DIRECTORY" 2
+# The path to the GCORE script to test.
+global GCORE
+if {![info exists GCORE]} {
+ set GCORE [file join [file dirname $GDB] [transform gcore]]
+}
+verbose "using GCORE = $GCORE" 2
+
+# Return 0 if the gcore scipt is missing.
+proc has_gcore_script {} {
+ global GCORE
+ if {$GCORE == ""} {
+ return 0
+ } else {
+ return 1
+ }
+}
+
# GDBFLAGS is available for the user to set on the command line.
# E.g. make check RUNTESTFLAGS=GDBFLAGS=mumble
# Testcases may use it to add additional flags, but they must: