From patchwork Wed Jun 4 18:16:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Brobecker X-Patchwork-Id: 1316 Received: (qmail 28791 invoked by alias); 4 Jun 2014 18:17:13 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 28780 invoked by uid 89); 4 Jun 2014 18:17:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Wed, 04 Jun 2014 18:17:11 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 33A4C116196; Wed, 4 Jun 2014 14:17:10 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id obc8Zn1d7hTA; Wed, 4 Jun 2014 14:17:10 -0400 (EDT) Received: from kwai.gnat.com (kwai.gnat.com [205.232.38.4]) by rock.gnat.com (Postfix) with ESMTP id 2512E116194; Wed, 4 Jun 2014 14:17:10 -0400 (EDT) Received: by kwai.gnat.com (Postfix, from userid 4233) id 2110791976; Wed, 4 Jun 2014 14:17:10 -0400 (EDT) From: Joel Brobecker To: gdb-patches@sourceware.org Cc: Pedro Alves Subject: [RFA] gdbserver crash if the_target->supports_z_point_type is NULL Date: Wed, 4 Jun 2014 14:16:45 -0400 Message-Id: <1401905805-22408-1-git-send-email-brobecker@adacore.com> In-Reply-To: <538F5E3A.8010507@redhat.com> References: <538F5E3A.8010507@redhat.com> Hello, When debugging on LynxOS targets (and probably on SPU targets as well), inserting a breakpoint and resuming the program's execution causes GDBserver to crash. The crash occurs while handling the Z0 packet sent by GDB to insert our breakpoint, because z_type_supported calls the_target->supports_z_point_type without checking that it is not NULL This patch fixes the issue by making z_type_supported return false if the_target->supports_z_point_type is NULL. gdb/gdbserver/ChangeLog: PR server/17023 * mem-break.c (z_type_supported): Return zero if THE_TARGET->SUPPORTS_Z_POINT_TYPE is NULL. Tested on ppx-lynx5. I haven't tested on GNU/Linux, but I feel sufficiently confident since supports_z_point_type is defined there, and I am eager to take a look at Windows next. But I can do it if people think it would be best. OK to push? Thanks, diff --git a/gdb/gdbserver/mem-break.c b/gdb/gdbserver/mem-break.c index 71876f7..2ce3ab2 100644 --- a/gdb/gdbserver/mem-break.c +++ b/gdb/gdbserver/mem-break.c @@ -897,6 +897,7 @@ static int z_type_supported (char z_type) { return (z_type >= '0' && z_type <= '4' + && the_target->supports_z_point_type != NULL && the_target->supports_z_point_type (z_type)); }