Re: [PATCH] Delete program spaces directly when removing inferiors

Pedro Alves
2015-07-08T18:51:06Z

On 07/08/2015 07:40 PM, Simon Marchi wrote:
> On 15-07-08 02:17 PM, Pedro Alves wrote:
>> Hmm, I think it'll fix a bug, actually. There should always
>> be an inferior. And that deletes it. So I assume
>> that after closing the monitor target, GDB crashes as soon as
>> it refers to the current inferior...
>>
>> In the original multi-process support (~7.0), that was not the
>> case -- if you were not debugging a process, there's be
>> no inferior. Seems like this code has bit rotten.
>
> Ok, I had this intuition as well (about deleting the last inferior).
>
>> I guess this suggests that no one's been using these monitor
>> targets for a long while?
>
> Or they don't mind/notice that it crashes at exit.
>
>>>
>>> Is there any way to test that code path relatively easily on x86?
>>>
>>
>> Don't think so. You could stick a:
>>
>> delete_inferior_silent (ptid_get_pid (monitor_ptid));
>>
>> call in remote.c:remote_close and see what happens there though.
>
> I tried something similar (monitor_ptid is not available there), and
> bad things happen indeed.
>
> I'll try to update my patch to use discard_all_inferiors, but it will
> be a "theoretical" fix, since there's no way to test.

The patch is preapproved. Meanwhile I sent a mail to gdb@ about
deleting monitor.c and friends.

Thanks,
Pedro Alves