From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19948 invoked by alias); 28 Jun 2018 16:03:22 -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 19921 invoked by uid 89); 28 Jun 2018 16:03:21 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-7.7 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_1 autolearn=ham version=3.3.2 spammy=emaisin X-HELO: sesbmg23.ericsson.net Received: from sesbmg23.ericsson.net (HELO sesbmg23.ericsson.net) (193.180.251.37) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 28 Jun 2018 16:03:20 +0000 DKIM-Signature: v=1; a=rsa-sha256; d=ericsson.com; s=mailgw201801; c=relaxed/simple; q=dns/txt; i=@ericsson.com; t=1530201797; 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=JjrAaY+6Z1R+KE4dcj3rUSt/3W4alqCN10bsurM8y0A=; b=EtRkEWm51aUHh0ES9Jcqu4Z1z4BiH0axtvTBiCky5Y6EBRSlW8v4vHg43U+nQtOK pkea9wONrrvB7WAyYvkrQkj8fAdZkBNOdQgB3oWLoLpuK38m3ZciJ9J7F2nKvHts EQGH8Xgbqpsr7LU1laOIKi0KqktX1Mte2pCy4O9fjyo=; Received: from ESESSMB501.ericsson.se (Unknown_Domain [153.88.183.119]) by sesbmg23.ericsson.net (Symantec Mail Security) with SMTP id C0.66.25360.5C6053B5; Thu, 28 Jun 2018 18:03:17 +0200 (CEST) Received: from ESESBMB504.ericsson.se (153.88.183.171) by ESESSMB501.ericsson.se (153.88.183.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Thu, 28 Jun 2018 18:03:16 +0200 Received: from NAM04-BN3-obe.outbound.protection.outlook.com (153.88.183.157) by ESESBMB504.ericsson.se (153.88.183.171) 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, 28 Jun 2018 18:03:16 +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=ahIL2u3mQKdl6Rw0l2YWOnE+E5ZiLaQ8zAYK6lN4KWQ=; b=G9MFKWg1hcVSIXipziZu8jvHn4nIqh08cs0fZ3XdDUJ020SgkKjKXiEh6eV26GzFvx4//xOdbN1oA4KCB3pSu3An97Yz6+xeA5El8OW26MnlQIrhLZfxPDG6IF3k8WfPWJENRnAbrpEgqtCvbzPMWliVU2MwDU/UKLZFsON5Wk4= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=simon.marchi@ericsson.com; Received: from [142.133.60.250] (192.75.88.130) by SN6PR15MB2398.namprd15.prod.outlook.com (2603:10b6:805:24::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.884.23; Thu, 28 Jun 2018 16:03:13 +0000 Subject: Re: [PATCH v3] Fix segfault when invoking -var-info-path-expression on a dynamic varobj To: Jan Vrany , References: <20180628151736.21681-1-jan.vrany@fit.cvut.cz> From: Simon Marchi Message-ID: Date: Thu, 28 Jun 2018 16:03:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180628151736.21681-1-jan.vrany@fit.cvut.cz> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit 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-06/txt/msg00688.txt.bz2 On 2018-06-28 11:17 AM, Jan Vrany wrote: > Invoking -var-info-path-expression on a dynamic varobj lead either in wrong > (nonsense) result or to a segmentation fault in cplus_describe_child(). > This was caused by the fact that varobj_get_path_expr() called > cplus_path_expr_of_child() ignoring the fact the parent of the variable > is dynamic. Then, cplus_describe_child() accessed the underlaying C type > members by index, causing (i) either wrong (nonsense) expression being > returned (since dynamic child may be completely arbibtrary value) > or (ii) segmentation fault (in case the index higher than number of > underlaying C type members. > > This fixes the problem by checking whether a varobj is a child of a dynamic > varobj and, if so, reporting an error as described in documentation. Hi Jan, Thanks, this builds fine now. The test doesn't pass here though. Does it pass on your side? $ make check TESTS="gdb.python/py-mi-var-info-path-expression.exp" ... FAIL: gdb.python/py-mi-var-info-path-expression.exp: -var-create c1 * &c1 (unexpected output) FAIL: gdb.python/py-mi-var-info-path-expression.exp: -var-list-children c1 (unexpected output) FAIL: gdb.python/py-mi-var-info-path-expression.exp: -var-list-children c1.cdr (unexpected output) FAIL: gdb.python/py-mi-var-info-path-expression.exp: -var-list-children c1.car (unexpected output) FAIL: gdb.python/py-mi-var-info-path-expression.exp: -var-list-children c1.car.atom (unexpected output) I'm seeing some Python exception in testsuite/gdb.log, I didn't dig more than that: -var-create c1 * &c1 &"Traceback (most recent call last):\n" &" File \"/home/emaisin/src/binutils-gdb/gdb/testsuite/gdb.python/py-mi-var-info-path-expression.py\", line 24, in to_string\n" &" if int(self._val) == 0:\n" &"gdb.error: Cannot convert value to int.\n" &"Traceback (most recent call last):\n" &" File \"/home/emaisin/src/binutils-gdb/gdb/testsuite/gdb.python/py-mi-var-info-path-expression.py\", line 32, in children\n" &" if int(self._val) == 0:\n" &"gdb.error: Cannot convert value to int.\n" ^error,msg="Null value returned for children" (gdb) FAIL: gdb.python/py-mi-var-info-path-expression.exp: -var-create c1 * &c1 (unexpected output) Simon