diff mbox

[v2] Make only user-specified executable and symbol filenames sticky

Message ID 1433677265.2933.20.camel@soleil
State New
Headers show

Commit Message

Philippe Waroquiers June 7, 2015, 11:41 a.m. UTC
On Fri, 2015-06-05 at 12:22 +0100, Gary Benson wrote:
> Built and regtested on RHEL6.6 x86_64.
I tested with the last SVN version of the Valgrind gdbserver (that
supports qXfer:exec-file:read+).

The patch introduces a regression:
with the patch, GDB does not anymore automatically load the

I bypassed this problem by ignoring fake_pid_p in remote.c:
Effectively, the printf shows that with Valgrind gdbsrv,
fake_pid_p value is 1.

When ignoring fake_pid_p, GDB can properly attach
to different Valgrind gdbsrv, and changes of executable
as expected.

diff mbox


--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -1624,9 +1624,13 @@  remote_add_inferior (int fake_pid_p, int pid, int
   inf->attach_flag = attached;
   inf->fake_pid_p = fake_pid_p;
-  /* If no main executable is currently open then attempt to
-     open the file that was executed to create this inferior.  */
-  if (try_open_exec && get_exec_file (0) == NULL)
+  /* Attempt to open the file that was executed to create this
+     inferior.  If the user has explicitly specified executable
+     and/or symbol files then warn the user if their choices do
+     not match.  Otherwise, set exec_file and symfile_objfile to
+     the new file.  */
+  printf("fake_pid_p %d\n", fake_pid_p);
+  if (try_open_exec)// && !fake_pid_p)
     exec_file_locate_attach (pid, 1);