From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gateway34.websitewelcome.com (gateway34.websitewelcome.com [192.185.149.13]) by sourceware.org (Postfix) with ESMTPS id 03B1E3846020 for ; Fri, 12 Mar 2021 14:19:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 03B1E3846020 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 cm13.websitewelcome.com (cm13.websitewelcome.com [100.42.49.6]) by gateway34.websitewelcome.com (Postfix) with ESMTP id 178114BB92B5 for ; Fri, 12 Mar 2021 08:19:47 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id Kidnlxeq54HRaKidnltQYE; Fri, 12 Mar 2021 08:19:47 -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=y3cWGrS3WljKT9tIho2CBRUByA7piImXZxIXgQRZdnQ=; b=cwaE30gFge2HgJVjtu4Pyc/XiE 1V2SWBsSPnSWHTe2ktjmMXBf5T+UARJeW9Y01KEDuRarTVbZ6ItSXKYkCwA+iEx0vXJ5TYZnHQT9U Nd0wyWiF+YeOgFiePn5QnbUKB; Received: from 71-211-137-228.hlrn.qwest.net ([71.211.137.228]:36374 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 1lKidn-0049tG-4z; Fri, 12 Mar 2021 07:19:47 -0700 From: Tom Tromey To: Andrew Burgess Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] gdb: use make_scoped_restore to restore gdbpy_current_objfile References: <20210312122217.2883834-1-andrew.burgess@embecosm.com> X-Attribution: Tom Date: Fri, 12 Mar 2021 07:19:46 -0700 In-Reply-To: <20210312122217.2883834-1-andrew.burgess@embecosm.com> (Andrew Burgess's message of "Fri, 12 Mar 2021 12:22:17 +0000") Message-ID: <875z1w4fp9.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (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: 71.211.137.228 X-Source-L: No X-Exim-ID: 1lKidn-0049tG-4z X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 71-211-137-228.hlrn.qwest.net (murgatroyd) [71.211.137.228]:36374 X-Source-Auth: tom+tromey.com X-Email-Count: 9 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Status: No, score=-3023.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, JMQ_SPF_NEUTRAL, RCVD_IN_ABUSEAT, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_NEUTRAL, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org 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: , X-List-Received-Date: Fri, 12 Mar 2021 14:20:00 -0000 >>>>> "Andrew" == Andrew Burgess writes: Andrew> The current mechanism by which the Python gdb.current_objfile is Andrew> maintained does not allow for nested auto-load events. It is assumed Andrew> that one an auto-load script has finished loading then the current Andrew> objfile should be set back to NULL. In a nested situation, we should Andrew> be restoring the previous value. Andrew> We already have an RAII class to handle save/restore type behaviour, Andrew> so lets just switch to use that. Andrew> The test is a little contrived, but is simple enough, and triggers the Andrew> bug. The real use case might involve the auto-load script calling Andrew> functions (either in the just-loaded object file, or in the main Andrew> executable), which in turn trigger further auto-loads to occur. That test sure looks like a lot of work :-) Andrew> * python/python.c (gdbpy_source_objfile_script): Use Andrew> make_scoped_restore to restore gdbpy_current_objfile. Andrew> (gdbpy_execute_objfile_script): Likewise. This looks good to me. Tom