aboutsummaryrefslogtreecommitdiff
path: root/gdb/infrun.c
diff options
context:
space:
mode:
authorGary Benson <gbenson@redhat.com>2015-04-28 12:21:32 +0100
committerGary Benson <gbenson@redhat.com>2015-04-28 12:21:32 +0100
commitff862be47e7acf51e4abaf0f121d5961adb1845a (patch)
tree27a64c2e92dc0972a76fd477fc6d430f03c319a0 /gdb/infrun.c
parentda7119c99c41f60cb178b0b9729d9f7880f33c86 (diff)
downloadgdb-ff862be47e7acf51e4abaf0f121d5961adb1845a.zip
gdb-ff862be47e7acf51e4abaf0f121d5961adb1845a.tar.gz
gdb-ff862be47e7acf51e4abaf0f121d5961adb1845a.tar.bz2
Use exec_file_find to prepend gdb_sysroot in follow_exec
This commit updates follow_exec to use exec_file_find to prefix the new executable's filename with gdb_sysroot rather than doing it longhand. gdb/ChangeLog: * infrun.c (solist.h): New include. (follow_exec): Use exec_file_find to prefix execd_pathname with gdb_sysroot.
Diffstat (limited to 'gdb/infrun.c')
-rw-r--r--gdb/infrun.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 7870f70..f09e2da 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -60,6 +60,7 @@
#include "target-descriptions.h"
#include "target-dcache.h"
#include "terminal.h"
+#include "solist.h"
/* Prototypes for local functions */
@@ -1133,15 +1134,18 @@ follow_exec (ptid_t ptid, char *execd_pathname)
breakpoint_init_inferior (inf_execd);
- if (gdb_sysroot && *gdb_sysroot)
+ if (gdb_sysroot != NULL && *gdb_sysroot != '\0')
{
- char *name = alloca (strlen (gdb_sysroot)
- + strlen (execd_pathname)
- + 1);
+ int fd = -1;
+ char *name;
- strcpy (name, gdb_sysroot);
- strcat (name, execd_pathname);
- execd_pathname = name;
+ name = exec_file_find (execd_pathname, &fd);
+ if (fd >= 0)
+ close (fd);
+
+ execd_pathname = alloca (strlen (name) + 1);
+ strcpy (execd_pathname, name);
+ xfree (name);
}
/* Reset the shared library package. This ensures that we get a