This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Make only user-specified executable filenames sticky
- From: Pedro Alves <palves at redhat dot com>
- To: Gary Benson <gbenson at redhat dot com>, Philippe Waroquiers <philippe dot waroquiers at skynet dot be>
- Cc: gdb-patches at sourceware dot org
- Date: Mon, 11 May 2015 14:58:16 +0100
- Subject: Re: [PATCH] Make only user-specified executable filenames sticky
- Authentication-results: sourceware.org; auth=none
- References: <20150505151448 dot GA1417 at blade dot nx> <1430907977-30605-1-git-send-email-gbenson at redhat dot com> <1430923587 dot 2177 dot 4 dot camel at soleil> <20150506154138 dot GA24836 at blade dot nx>
On 05/06/2015 04:41 PM, Gary Benson wrote:
> Philippe Waroquiers wrote:
>> On Wed, 2015-05-06 at 11:26 +0100, Gary Benson wrote:
>>> In GDB some executable files are supplied by the user (e.g. using
>>> a "file" command) and some are determined by GDB (e.g. while
>>> processing an "attach" command). GDB will not attempt to
>>> determine a filename if one has been set. This causes problems if
>>> you attach to one process and then attach to another: GDB will not
>>> attempt to discover the main executable on the second attach. If
>>> the two processes have different main executable files then the
>>> symbols will now be wrong.
>>>
>>> This commit updates GDB to keep track of which executable
>>> filenames were supplied by the user. When GDB might attempt to
>>> determine an executable filename and one is already set, filenames
>>> determined by GDB may be overridden but user-supplied filenames
>>> will not.
>>
>> If not overriding the file set by the user, maybe GDB could/should
>> give a warning when the exec-file reported by the target does not
>> match the file as set by the user ?
Giving a warning may be be good. Note sure whether basing it
on file name alone would be noisy. Basing the warning on GNU build-id
as suggested on PR 16266 would be bullet proof.
>
> I'm wondering whether we should always override the executable file,
> and treat the symbol file as the special one. Pedro?
Not sure about that. Sounds like "file program1" +
"attach program2" would end up with the symbol file pointing
to program1? Not seeing how that would be useful, but
maybe if you detail the idea it gets clearer.
Thanks,
Pedro Alves