This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v2] Make only user-specified executable and symbol filenames sticky
- From: Philippe Waroquiers <philippe dot waroquiers at skynet dot be>
- To: Gary Benson <gbenson at redhat dot com>
- Cc: gdb-patches at sourceware dot org, Pedro Alves <palves at redhat dot com>, Joel Brobecker <brobecker at adacore dot com>, Doug Evans <dje at google dot com>, Don Breazeal <donb at codesourcery dot com>
- Date: Sun, 07 Jun 2015 13:41:05 +0200
- Subject: Re: [PATCH v2] Make only user-specified executable and symbol filenames sticky
- Authentication-results: sourceware.org; auth=none
- References: <20150603172339 dot GA24958 at adacore dot com> <1433503346-22517-1-git-send-email-gbenson at redhat dot com>
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
exec-file.
I bypassed this problem by ignoring fake_pid_p in remote.c:
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -1624,9 +1624,13 @@ remote_add_inferior (int fake_pid_p, int pid, int
attached,
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);
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.
Philippe