From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32034 invoked by alias); 22 Aug 2019 22:24:07 -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 31834 invoked by uid 89); 22 Aug 2019 22:24:05 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 spammy=HX-Languages-Length:1102, our X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 22 Aug 2019 22:24:04 +0000 Received: from [172.16.2.176] (wsip-184-188-36-2.sd.sd.cox.net [184.188.36.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 1AE791E636; Thu, 22 Aug 2019 18:23:59 -0400 (EDT) Subject: Re: [PATCH v4] Make GDB compile with Python 3 on MinGW To: Christian Biesinger , gdb-patches@sourceware.org References: <20190815184942.19371-1-cbiesinger@google.com> From: Simon Marchi Message-ID: Date: Thu, 22 Aug 2019 22:24:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190815184942.19371-1-cbiesinger@google.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2019-08/txt/msg00540.txt.bz2 On 2019-08-15 2:49 p.m., Christian Biesinger via gdb-patches wrote: > PyFile_FromString and PyFile_AsFile have been removed in Python 3. > There is no obvious replacement that works here, and we can't just > pass our FILE* to a DLL in Windows because it may use a different > C runtime. > > So we just call a Python function which reads and executes file > contents. Care must be taken to execute it in the context of > __main__. > > Tested by inverting the ifdef and running the testsuite on Debian > Linux (even without the patch, I failed at running the testsuite > on Windows). I did test with both Python 2 and 3. > > gdb/ChangeLog: > > 2019-08-13 Christian Biesinger > > * python/lib/gdb/__init__.py: Add an execute_file function. This can be written as: * python/lib/gdb/__init__.py (_execute_file): New function. > * python/python.c (python_run_simple_file): Call gdb.execute_file > on Windows. Please update "execute_file" to "_execute_file" in both entries. The patch LGTM with this fixed. Thanks, Simon