[RFA] fix crasher on detach command

Michael Snyder msnyder@vmware.com
Mon Jun 7 19:00:00 GMT 2010


Pedro Alves wrote:
> On Monday 07 June 2010 19:31:26, Michael Snyder wrote:
>> Pedro Alves wrote:
>>> On Monday 07 June 2010 19:11:02, Michael Snyder wrote:
>>>> Hi,
>>>>
>>>> The circumstances are, detach from a remote target that doesn't have
>>>> threads.  Remote.c leaves the PID arbitrarily as "42000", and
>>>> target_detach calls remove_breakpoints_pid, which crashes because
>>>> find_inferior_pid returns NULL.
>>> It shouldn't matter that the PID is arbitrary; there should be an
>>> inferior with that PID in the inferior list.  This probably means
>>> that the inferior got its PID cleared to 0 already when you get here?
>>> How?
>> It was a bad connect, which aborted part way through.
>> So yes, we're in an inconsistent internal state.
> 
> Then we need to fix that, instead of adding workarounds in other
> areas.

I'm not sure how feasible that is.  At this point I've had to use a
^C^C to get out of a failing attach (target remote), and I'm hoping to
use the "detach" to cancel out any remaining inconsistent state.
The ^C^C handler can't necessarily do it by itself, 'cause from its
point of view, you don't really know what state you're in or what
state you want to be in.



More information about the Gdb-patches mailing list