This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] fix crasher on detach command
- From: Hui Zhu <teawater at gmail dot com>
- To: Pedro Alves <pedro at codesourcery dot com>, Michael Snyder <msnyder at vmware dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Tue, 8 Jun 2010 10:42:05 +0800
- Subject: Re: [RFA] fix crasher on detach command
- References: <4C0D3636.8040206@vmware.com> <201006071928.19374.pedro@codesourcery.com>
On Tue, Jun 8, 2010 at 02:28, Pedro Alves <pedro@codesourcery.com> 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?
>
> What's the backtrace like at the time of the crash? ?I assume
> the remove_breakpoints_pid call is coming from within target_detach?
>
>>
>> The patch just adds a test for NULL.
>>
>>
>
>
> --
> Pedro Alves
>
I suggest we have a gdb_assert after this "struct inferior *inf =
find_inferior_pid (pid);"
Thanks,
Hui