From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 108824 invoked by alias); 12 Sep 2018 22:39:24 -0000 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 Received: (qmail 108815 invoked by uid 89); 12 Sep 2018 22:39:23 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.4 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: sessmg23.ericsson.net Received: from sessmg23.ericsson.net (HELO sessmg23.ericsson.net) (193.180.251.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 12 Sep 2018 22:39:22 +0000 DKIM-Signature: v=1; a=rsa-sha256; d=ericsson.com; s=mailgw201801; c=relaxed/simple; q=dns/txt; i=@ericsson.com; t=1536791959; h=From:Sender:Reply-To:Subject:Date:Message-Id:To:CC:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=SHCGSHUmpW6dztQHm4PSXyUgoWDTiQkglCVGIGxIxN0=; b=f5FvOdFt7h63+MzhM4Y8L6tueOUzg/HoSzjL6VD7mXTicrEPR5qcuyyoJaAGOLWJ wf5qlH1n1zVlG71qlgP9yOcvXeCIQrFTjjsn1LrYGU7BXaKv93t6So0Co6uiyQEU GrLEGSw6fYWXJatyy2d4xxxG/MuU92qFU0JClXND8Cw=; Received: from ESESBMB501.ericsson.se (Unknown_Domain [153.88.183.114]) by sessmg23.ericsson.net (Symantec Mail Security) with SMTP id 54.69.22015.795999B5; Thu, 13 Sep 2018 00:39:19 +0200 (CEST) Received: from ESESBMB502.ericsson.se (153.88.183.169) by ESESBMB501.ericsson.se (153.88.183.168) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Thu, 13 Sep 2018 00:39:19 +0200 Received: from NAM04-SN1-obe.outbound.protection.outlook.com (153.88.183.157) by ESESBMB502.ericsson.se (153.88.183.169) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3 via Frontend Transport; Thu, 13 Sep 2018 00:39:18 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericsson.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2w2b/G1qGKLs5P7MLRlwa2Z5LE7FqO3cuxaUaS4e8jc=; b=EsvJ1HqwPJPJqkySHYV+MOfK/Yz73h5sb7tR1ObyysdupYot46XzIbxkoHy/cub0nLCLM8FfkaDGfk8jVeCxFjsYd5VyQEmZ3b1dxZUR7xkzZZYnZk8kqVqZWwq1b87T5zweSX/sxLi2cgTXJ7DXFygUdyC06h2EhRE4cvMedM8= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=simon.marchi@ericsson.com; Received: from elxacz23q12.ericsson.se (192.176.1.81) by BN7PR15MB2385.namprd15.prod.outlook.com (2603:10b6:406:8c::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1122.17; Wed, 12 Sep 2018 22:39:14 +0000 From: Simon Marchi To: CC: Simon Marchi Subject: [pushed] python: Add tests for trying to use an invalid Inferior object Date: Wed, 12 Sep 2018 22:39:00 -0000 Message-Id: <20180912223840.6141-1-simon.marchi@ericsson.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain Return-Path: simon.marchi@ericsson.com Received-SPF: None (protection.outlook.com: ericsson.com does not designate permitted sender hosts) X-IsSubscribed: yes X-SW-Source: 2018-09/txt/msg00383.txt.bz2 This patch adds tests for trying to use property or methods on a gdb.Inferior object that represents an inferior that does not exist anymore. We expect an exception to be thrown. gdb/testsuite/ChangeLog: * gdb.python/py-inferior.exp: Test using an invalid gdb.Inferior object. --- gdb/testsuite/ChangeLog | 5 +++++ gdb/testsuite/gdb.python/py-inferior.exp | 13 +++++++++++++ 2 files changed, 18 insertions(+) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index db5369de651..949f1ae210a 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-09-12 Simon Marchi + + * gdb.python/py-inferior.exp: Test using an invalid gdb.Inferior + object. + 2018-09-12 Alan Hayward * lib/gdb.exp (gdb_can_simple_compile): Add proc. diff --git a/gdb/testsuite/gdb.python/py-inferior.exp b/gdb/testsuite/gdb.python/py-inferior.exp index a943d5f214e..055dd87c6d8 100644 --- a/gdb/testsuite/gdb.python/py-inferior.exp +++ b/gdb/testsuite/gdb.python/py-inferior.exp @@ -253,6 +253,19 @@ with_test_prefix "is_valid" { gdb_test "python print (my_inferior_count)" "1" \ "test inferior-deleted event handler" + + # Test that other properties and methods handle the removed inferior + # correctly. + gdb_test "python print (inf_list\[1\].num)" \ + "RuntimeError: Inferior no longer exists.*" + gdb_test "python print (inf_list\[1\].pid)" \ + "RuntimeError: Inferior no longer exists.*" + gdb_test "python print (inf_list\[1\].was_attached)" \ + "RuntimeError: Inferior no longer exists.*" + gdb_test "python print (inf_list\[1\].threads ())" \ + "RuntimeError: Inferior no longer exists.*" + gdb_test "python print (inf_list\[1\].thread_from_thread_handle (1))" \ + "RuntimeError: Inferior no longer exists.*" } # Test gdb.selected_inferior() -- 2.19.0