This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [Regression] Segfault on native-extended-gdbserver + fork
On Monday, January 29 2018, Simon Marchi wrote:
> On 2018-01-29 11:00, Pedro Alves wrote:
>> On 01/28/2018 04:50 PM, Simon Marchi wrote:
>>> On 2018-01-28 01:32, Sergio Durigan Junior wrote:
>>> This means (I just tried it) that it won't show the "[Inferior %d
>>> detached]\n" message in that case. So what I would suggest is
>>> putting
>>>
>>> if (print_inferior_events)
>>> printf_unfiltered (_("[Inferior %d detached]\n"), pid);
>>>
>>> in its own function, called by both versions of detach_inferior for
>>> now (bonus, it de-duplicates the printing of the message). In the
>>> multi-target branch, remote_target::follow_fork (renamed from
>>> remote_follow_fork) can call this function in the case where we
>>> don't have an inferior object.
>>
>> But why would we want to print that? We will have already printed
>>
>> "Detaching after fork from child process PID."
>>
>> from the common code. When native debugging, in this scenario,
>> we don't call detach_inferior either, right? Can't see why
>> we'd want to call it for remote.
>
> It's true that it's a bit of a lie to say "[Inferior PID detached]" if
> there never actually was an inferior for that PID. Since we never
> print "[Inferior PID detached]" on native in that case, I am fine with
> removing the call from remote.c. Sergio, that would fix the crash you
> found I think?
I was also unsure about printing the message in this case, because
there's no real detach happening. I'm fine with not printing it. And
yes, removing the call to "detach_inferior" also fixes the problem.
I'll prepare a patch.
--
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF 31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
http://sergiodj.net/