Make GDB compile with Python 3 on MinGW
authorChristian Biesinger <cbiesinger@google.com>
Tue, 13 Aug 2019 19:48:05 +0000 (14:48 -0500)
committerChristian Biesinger <cbiesinger@google.com>
Thu, 22 Aug 2019 22:44:58 +0000 (17:44 -0500)
commit272044897e178835f596c96740c5a1800ec6f9fb
treebd40b72b2b650526a3f3dbbc53e96ccd2ca67bac
parent395fad095c9cbc5a8b10557443da981cc3f61885
Make GDB compile with Python 3 on MinGW

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-22  Christian Biesinger  <cbiesinger@google.com>

* python/lib/gdb/__init__.py (_execute_file): New function.
* python/python.c (python_run_simple_file): Call gdb._execute_file
on Windows.
gdb/ChangeLog
gdb/python/lib/gdb/__init__.py
gdb/python/python.c
This page took 0.024956 seconds and 4 git commands to generate.