From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22694 invoked by alias); 8 Jun 2010 02:42:33 -0000 Received: (qmail 22666 invoked by uid 22791); 8 Jun 2010 02:42:33 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mail-pz0-f186.google.com (HELO mail-pz0-f186.google.com) (209.85.222.186) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 08 Jun 2010 02:42:26 +0000 Received: by pzk16 with SMTP id 16so2943936pzk.19 for ; Mon, 07 Jun 2010 19:42:25 -0700 (PDT) Received: by 10.142.207.13 with SMTP id e13mr11471142wfg.21.1275964945104; Mon, 07 Jun 2010 19:42:25 -0700 (PDT) MIME-Version: 1.0 Received: by 10.142.57.15 with HTTP; Mon, 7 Jun 2010 19:42:05 -0700 (PDT) In-Reply-To: <201006071928.19374.pedro@codesourcery.com> References: <4C0D3636.8040206@vmware.com> <201006071928.19374.pedro@codesourcery.com> From: Hui Zhu Date: Tue, 08 Jun 2010 02:42:00 -0000 Message-ID: Subject: Re: [RFA] fix crasher on detach command To: Pedro Alves , Michael Snyder Cc: gdb-patches@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-06/txt/msg00198.txt.bz2 On Tue, Jun 8, 2010 at 02:28, 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. =A0Remote.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. =A0This 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? =A0I 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 =3D find_inferior_pid (pid);" Thanks, Hui