This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Defer breakpoint reset when cloning progspace for fork child
- From: Pedro Alves <palves at redhat dot com>
- To: Simon Marchi <simon dot marchi at polymtl dot ca>, gdb-patches at sourceware dot org
- Date: Sat, 7 Apr 2018 19:43:46 +0100
- Subject: Re: [PATCH] Defer breakpoint reset when cloning progspace for fork child
- References: <20180330190132.20823-1-simon.marchi@polymtl.ca> <790ab9233396d15d8227212fb3e33993@polymtl.ca>
On 04/07/2018 06:52 PM, Simon Marchi wrote:
>> This issue happens only with position-independent executables. Adding
>> the main objfile for the new inferior (the fork child) causes GDB to try
>> to reset the breakpoints. However, that new objfile has not been
>> relocated yet. So the breakpoint on "break_here" resolves to an
>> unrelocated address, from which we are trying to read/write to set a
>> breakpoint. Passing SYMFILE_DEFER_BP_RESET avoids that problem. The
>> executable is relocated just after, in the follow_fork_inferior
>> function.
>>
>> The buildbot seems happy with this patch. I don't think it's necessary
>> to add a new test. Just changing this made many tests go from FAIL to
>> PASS on my machine, where gcc produces PIE executables by default. If
>> anything, I think we would need to add a board file that produces
>> position-independent executables, so that we can run all the tests with
>> PIE, even on machines where that is not the default.
>
> I pushed this patch.
Thanks for the fix.
I'm not sure I agree with no test, though. I think a simple test
that tries both pie and not-pie would be useful, because
defaults vary depending on distro/system and they change over
time -- having a smoke test like the one described above covering both
pie and non-pie ensures no developer or testing environment where pie
might be relevant ever misses the problem in the future.
Thanks,
Pedro Alves