Files
MINGW-packages/mingw-w64-gdb/gdb-py3-fixes.patch
2018-01-31 08:06:47 +03:00

28 lines
853 B
Diff

--- gdb-8.0.1/gdb/python/python.c.orig 2018-01-29 17:17:16.030537500 +0100
+++ gdb-8.0.1/gdb/python/python.c 2018-01-29 17:17:25.135058300 +0100
@@ -351,6 +351,9 @@
/* Because we have a string for a filename, and are using Python to
open the file, we need to expand any tilde in the path first. */
+
+#ifndef IS_PY3K
+
gdb::unique_xmalloc_ptr<char> full_path (tilde_expand (filename));
gdbpy_ref<> python_file (PyFile_FromString (full_path.get (), (char *) "r"));
if (python_file == NULL)
@@ -361,6 +364,14 @@
PyRun_SimpleFile (PyFile_AsFile (python_file.get ()), filename);
+#else
+
+ /* Python 3 no loner exposes FILE structs, so we are out of luck */
+ gdb::unique_xmalloc_ptr<char> full_path (tilde_expand (filename));
+ PyRun_SimpleFile (fopen (full_path.get(), "r"), filename);
+
+#endif
+
#endif /* _WIN32 */
}