aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.multi/multi-arch-exec.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/testsuite/gdb.multi/multi-arch-exec.c')
-rw-r--r--gdb/testsuite/gdb.multi/multi-arch-exec.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/gdb/testsuite/gdb.multi/multi-arch-exec.c b/gdb/testsuite/gdb.multi/multi-arch-exec.c
index 864e264..168b484 100644
--- a/gdb/testsuite/gdb.multi/multi-arch-exec.c
+++ b/gdb/testsuite/gdb.multi/multi-arch-exec.c
@@ -18,12 +18,23 @@
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
+#include <limits.h>
+#include <string.h>
int
-main ()
+main (int argc, char ** argv)
{
- execl (BASEDIR "/multi-arch-exec-hello",
- BASEDIR "/multi-arch-exec-hello",
+ char prog[PATH_MAX];
+ int len;
+
+ strcpy (prog, argv[0]);
+ len = strlen (prog);
+ /* Replace "multi-arch-exec" with "multi-arch-exec-hello". */
+ memcpy (prog + len - 15, "multi-arch-exec-hello", 21);
+ prog[len + 6] = 0;
+
+ execl (prog,
+ prog,
(char *) NULL);
perror ("execl failed");
exit (1);