diff options
author | Gary Benson <gbenson@redhat.com> | 2016-02-24 11:31:58 +0000 |
---|---|---|
committer | Gary Benson <gbenson@redhat.com> | 2016-02-24 11:31:58 +0000 |
commit | bf74e428bca61022bd5cdf6bf28789a184748b4d (patch) | |
tree | d31114c6d16ec7349e2e73201da00507891be4f0 /gdb/exec.c | |
parent | 6735952f7c0f5f1f69a94c2d92c26e452a196da6 (diff) | |
download | binutils-gdb-bf74e428bca61022bd5cdf6bf28789a184748b4d.tar.gz |
Fix logic in exec_file_locate_attach
This commit fixes an error in exec_file_locate_attach where
the main executable could be loaded from outside the sysroot
if a nonempty, non-"target:" sysroot was set but the discovered
executable filename did not exist in that sysroot and did exist
on the main filesystem.
gdb/ChangeLog:
* exec.c (exec_file_locate_attach): Do not attempt to
locate main executable locally if not found in sysroot.
gdb/testsuite/ChangeLog:
* gdb.base/attach-pie-noexec.exp: Do not expect an error
message on attach.
Diffstat (limited to 'gdb/exec.c')
-rw-r--r-- | gdb/exec.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/gdb/exec.c b/gdb/exec.c index 0b8c0777f52..90811c081d3 100644 --- a/gdb/exec.c +++ b/gdb/exec.c @@ -156,9 +156,12 @@ exec_file_locate_attach (int pid, int from_tty) /* If gdb_sysroot is not empty and the discovered filename is absolute then prefix the filename with gdb_sysroot. */ if (*gdb_sysroot != '\0' && IS_ABSOLUTE_PATH (exec_file)) - full_exec_path = exec_file_find (exec_file, NULL); - - if (full_exec_path == NULL) + { + full_exec_path = exec_file_find (exec_file, NULL); + if (full_exec_path == NULL) + return; + } + else { /* It's possible we don't have a full path, but rather just a filename. Some targets, such as HP-UX, don't provide the |