From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id f1unLv6WrV+bVwAAWB0awg (envelope-from ) for ; Thu, 12 Nov 2020 15:11:42 -0500 Received: by simark.ca (Postfix, from userid 112) id B2AD11F08B; Thu, 12 Nov 2020 15:11:42 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=0.4 required=5.0 tests=DKIM_SIGNED,MAILING_LIST_MULTI, RCVD_IN_BL_SPAMCOP_NET,T_DKIM_INVALID,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 590EA1E552 for ; Thu, 12 Nov 2020 15:11:42 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 131F3385800F; Thu, 12 Nov 2020 20:11:42 +0000 (GMT) Received: from gateway23.websitewelcome.com (gateway23.websitewelcome.com [192.185.50.107]) by sourceware.org (Postfix) with ESMTPS id 1B5D1385800F for ; Thu, 12 Nov 2020 20:11:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1B5D1385800F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=tom@tromey.com Received: from cm16.websitewelcome.com (cm16.websitewelcome.com [100.42.49.19]) by gateway23.websitewelcome.com (Postfix) with ESMTP id 247B8299F3 for ; Thu, 12 Nov 2020 14:11:37 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id dIwTkN3JqosA0dIwTkz9GU; Thu, 12 Nov 2020 14:11:37 -0600 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=LlprJj95o8QKf9razVFZI0IgzrCDsQHs85g/XH058Vk=; b=dyxBtDD+alHpuF/8dnNk909AJa TD7nQUCooAexZ/6GRMFV2skk2os4XFZDVIQIS12xOWsoX9k9G4wTGD141luzSrC3hQ71eLYIAzvgJ wWUkfk6zmGlAbpExpOPdivEbi; Received: from 97-122-89-243.hlrn.qwest.net ([97.122.89.243]:37122 helo=murgatroyd) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1kdIwS-0022js-PZ; Thu, 12 Nov 2020 13:11:36 -0700 From: Tom Tromey To: Zoran Zaric Subject: Re: [PATCH v2] Replace the symbol needs evaluator with a parser References: <20201007172613.21868-1-Zoran.Zaric@amd.com> X-Attribution: Tom Date: Thu, 12 Nov 2020 13:11:35 -0700 In-Reply-To: <20201007172613.21868-1-Zoran.Zaric@amd.com> (Zoran Zaric's message of "Wed, 7 Oct 2020 18:26:13 +0100") Message-ID: <87eekycp3c.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 97.122.89.243 X-Source-L: No X-Exim-ID: 1kdIwS-0022js-PZ X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-89-243.hlrn.qwest.net (murgatroyd) [97.122.89.243]:37122 X-Source-Auth: tom+tromey.com X-Email-Count: 4 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: gdb-patches@sourceware.org Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" >>>>> "Zoran" == Zoran Zaric writes: Zoran> The problem here is that faking results of target interactions can yield Zoran> an incorrect evaluation result. ... Zoran> This is clearly a wrong result and it causes the debugger to crash. Zoran> + /* The DWARF expression might have a bug causing an infinite Zoran> + loop. In that case, quitting is the only way out. */ Zoran> + QUIT; Can this really occur in this scanner? For evaluation I can understand it, but this scanner seems to just walk the bytecode once, so I don't see how it is possible. For gimli (again) we have a maximum operation count to avoid this kind of problem. gdb could do this as well. Meanwhile, about the linear scan -- it seems to me that nothing in DWARF requires (1) that the expression not contain embedded garbage, and (2) that it not be possible to branch to the middle of some other instruction. (If there is text along these lines, I'd like to hear about it; I looked in the past and couldn't find it.) This is pathological, of course. But on the other hand, if the motivation is to avoid crashes, it seems bad to, say, let this function pass through some bytecode that would then be interpreted a different way by the actual evaluator. Personally I'd be fine with rejecting this bad stuff from the evaluator as well. But anyway the difficulty is that they have to be in sync, and aren't. Another approach would be to record which offsets are branched to; and to pop from such a list when an unconditional branch is encountered. This would solve both problems as well. Tom