From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7333 invoked by alias); 7 Jun 2010 18:11:12 -0000 Received: (qmail 7304 invoked by uid 22791); 7 Jun 2010 18:11:11 -0000 X-SWARE-Spam-Status: No, hits=-1.1 required=5.0 tests=AWL,BAYES_20,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp-outbound-1.vmware.com (HELO smtp-outbound-1.vmware.com) (65.115.85.69) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 07 Jun 2010 18:11:04 +0000 Received: from mailhost3.vmware.com (mailhost3.vmware.com [10.16.27.45]) by smtp-outbound-1.vmware.com (Postfix) with ESMTP id 5F2031307F for ; Mon, 7 Jun 2010 11:11:02 -0700 (PDT) Received: from msnyder-server.eng.vmware.com (promd-2s-dhcp138.eng.vmware.com [10.20.124.138]) by mailhost3.vmware.com (Postfix) with ESMTP id 54C6FCD926 for ; Mon, 7 Jun 2010 11:11:02 -0700 (PDT) Message-ID: <4C0D3636.8040206@vmware.com> Date: Mon, 07 Jun 2010 18:11:00 -0000 From: Michael Snyder User-Agent: Thunderbird 2.0.0.22 (X11/20090609) MIME-Version: 1.0 To: "gdb-patches@sourceware.org" Subject: [RFA] fix crasher on detach command Content-Type: multipart/mixed; boundary="------------030808060504020003050503" 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/msg00179.txt.bz2 This is a multi-part message in MIME format. --------------030808060504020003050503 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 273 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. The patch just adds a test for NULL. --------------030808060504020003050503 Content-Type: text/plain; name="null.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="null.txt" Content-length: 637 2010-06-07 Michael Snyder * breakpoint.c (remove_breakpoints_pid): Check for null. Index: breakpoint.c =================================================================== RCS file: /cvs/src/src/gdb/breakpoint.c,v retrieving revision 1.488 diff -u -p -r1.488 breakpoint.c --- breakpoint.c 7 Jun 2010 13:38:25 -0000 1.488 +++ breakpoint.c 7 Jun 2010 18:05:28 -0000 @@ -2041,6 +2041,9 @@ remove_breakpoints_pid (int pid) int val; struct inferior *inf = find_inferior_pid (pid); + if (inf == NULL) /* bail out */ + return 0; + ALL_BP_LOCATIONS (b, b_tmp) { if (b->pspace != inf->pspace) --------------030808060504020003050503--