This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 5/5] Update exec_file_find callers


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(-)

diff --git a/gdb/exec.c b/gdb/exec.c
index bbb7798..dcfa971 100644
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -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)
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 445a612..0b4f867 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -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);
 
-- 
1.7.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]