[5/5] Update exec_file_find callers
Commit Message
This commit updates the two callers of exec_file_find to make the call
regardless of what gdb_sysroot is set to.
Also, one of the callers used exec_file_find for absolute filenames
only, but the other used it in all cases. The latter is probably
wrong, and has been updated to only use exec_file_find for absolute
filenames.
gdb/ChangeLog:
* exec.c (exec_file_locate_attach): Use exec_file_find
regardless of what gdb_sysroot is set to.
* infrun.c (follow_exec): Likewise, but only if the new
filename is absolute.
---
gdb/ChangeLog | 7 +++++++
gdb/exec.c | 6 +++---
gdb/infrun.c | 5 ++++-
3 files changed, 14 insertions(+), 4 deletions(-)
@@ -152,9 +152,9 @@ exec_file_locate_attach (int pid, int from_tty)
if (exec_file == NULL)
return;
- /* 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))
+ /* If the discovered filename is absolute then prefix the filename
+ with the target prefix (if necessary) and gdb_sysroot. */
+ if (IS_ABSOLUTE_PATH (exec_file))
full_exec_path = exec_file_find (exec_file, NULL);
if (full_exec_path == NULL)
@@ -61,6 +61,7 @@
#include "target-dcache.h"
#include "terminal.h"
#include "solist.h"
+#include "filenames.h"
/* Prototypes for local functions */
@@ -1133,7 +1134,9 @@ follow_exec (ptid_t ptid, char *execd_pathname)
breakpoint_init_inferior (inf_execd);
- if (*gdb_sysroot != '\0')
+ /* If the discovered filename is absolute then prefix the filename
+ with the target prefix (if necessary) and gdb_sysroot. */
+ if (IS_ABSOLUTE_PATH (execd_pathname))
{
char *name = exec_file_find (execd_pathname, NULL);