| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181 |
- --- readline/Makefile.in 2019-04-16 20:10:40.000000000 +0300
- +++ readline/Makefile-patched.in 2019-04-16 20:20:11.000000000 +0300
- @@ -219,6 +219,7 @@
- ## readline along with GDB. GDB links statically against readline,
- ## so it doesn't depend on us installing it on the system.
-
- +install-strip:
- install:
-
- #install: $(INSTALL_TARGETS)
- --- gdb/configure 2020-06-14 20:40:38.430076716 +0300
- +++ gdb/configure-patched 2020-06-14 20:40:29.175000000 +0300
- @@ -9039,7 +9039,7 @@
- ac_res=-l$ac_lib
- LIBS="-l$ac_lib $ac_func_search_save_LIBS"
- fi
- - if ac_fn_c_try_link "$LINENO"; then :
- + if ac_fn_c_try_run "$LINENO"; then :
- ac_cv_search_tgetent=$ac_res
- fi
- rm -f core conftest.err conftest.$ac_objext \
- diff --git bfd/Makefile.am bfd/Makefile.am
- index a9191555..e0c24d5e 100644
- --- bfd/Makefile.am
- +++ bfd/Makefile.am
- @@ -965,7 +965,7 @@ bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in
- fi ;\
- $(SED) -e "s,@bfd_version@,$$bfd_version," \
- -e "s,@bfd_version_string@,$$bfd_version_string," \
- - -e "s,@bfd_version_package@,$$bfd_version_package," \
- + -e "s|@bfd_version_package@|$$bfd_version_package|" \
- -e "s,@report_bugs_to@,$$report_bugs_to," \
- < $(srcdir)/version.h > $@; \
- echo "$${bfd_soversion}" > libtool-soversion
- diff --git bfd/Makefile.in bfd/Makefile.in
- index 896df520..8e184d3e 100644
- --- bfd/Makefile.in
- +++ bfd/Makefile.in
- @@ -2080,7 +2080,7 @@ bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in
- fi ;\
- $(SED) -e "s,@bfd_version@,$$bfd_version," \
- -e "s,@bfd_version_string@,$$bfd_version_string," \
- - -e "s,@bfd_version_package@,$$bfd_version_package," \
- + -e "s|@bfd_version_package@|$$bfd_version_package|" \
- -e "s,@report_bugs_to@,$$report_bugs_to," \
- < $(srcdir)/version.h > $@; \
- echo "$${bfd_soversion}" > libtool-soversion
- diff --git gdb/python/lib/gdb/__init__.py gdb/python/lib/gdb/__init__.py
- index af74df80..afe5b08f 100644
- --- gdb/python/lib/gdb/__init__.py
- +++ gdb/python/lib/gdb/__init__.py
- @@ -106,6 +106,32 @@ def execute_unwinders(pending_frame):
-
- return None
-
- +def _execute_file(filepath):
- + """This function is used to replace Python 2's PyRun_SimpleFile.
- +
- + Loads and executes the given file.
- +
- + We could use the runpy module, but its documentation says:
- + "Furthermore, any functions and classes defined by the executed code are
- + not guaranteed to work correctly after a runpy function has returned."
- + """
- + globals = sys.modules['__main__'].__dict__
- + set_file = False
- + # Set file (if not set) so that the imported file can use it (e.g. to
- + # access file-relative paths). This matches what PyRun_SimpleFile does.
- + if not hasattr(globals, '__file__'):
- + globals['__file__'] = filepath
- + set_file = True
- + try:
- + with open(filepath, 'rb') as file:
- + # We pass globals also as locals to match what Python does
- + # in PyRun_SimpleFile.
- + compiled = compile(file.read(), filepath, 'exec')
- + exec(compiled, globals, globals)
- + finally:
- + if set_file:
- + del globals['__file__']
- +
-
- # Convenience variable to GDB's python directory
- PYTHONDIR = os.path.dirname(os.path.dirname(__file__))
- diff --git gdb/python/python-config.py gdb/python/python-config.py
- index 3e60b86a..1e04f6cf 100644
- --- gdb/python/python-config.py
- +++ gdb/python/python-config.py
- @@ -3,6 +3,7 @@
-
- import sys
- import os
- +import platform
- import getopt
- from distutils import sysconfig
-
- @@ -45,16 +46,29 @@ def to_unix_path(path):
-
- for opt in opt_flags:
- if opt == '--prefix':
- - print (to_unix_path(sysconfig.PREFIX))
- + prefix=os.environ.get('CONFIG_PYTHON_PREFIX')
- + if prefix and prefix.strip():
- + sys.stderr.write ("%s -> [%s]\n" % (opt, prefix.strip()))
- + print (prefix.strip())
- + else:
- + sys.stderr.write ("%s -> [%s]\n" % (opt, to_unix_path(sysconfig.PREFIX)))
- + print (to_unix_path(sysconfig.PREFIX))
-
- elif opt == '--exec-prefix':
- - print (to_unix_path(sysconfig.EXEC_PREFIX))
- + prefix=os.environ.get('CONFIG_PYTHON_PREFIX')
- + if prefix and prefix.strip():
- + sys.stderr.write ("%s -> [%s]\n" % (opt, prefix.strip()))
- + print (prefix.strip())
- + else:
- + sys.stderr.write ("%s -> [%s]\n" % (opt, to_unix_path(sysconfig.EXEC_PREFIX)))
- + print (to_unix_path(sysconfig.EXEC_PREFIX))
-
- elif opt in ('--includes', '--cflags'):
- flags = ['-I' + sysconfig.get_python_inc(),
- '-I' + sysconfig.get_python_inc(plat_specific=True)]
- if opt == '--cflags':
- flags.extend(getvar('CFLAGS').split())
- + sys.stderr.write ("%s -> [%s]\n" % (opt, to_unix_path(' '.join(flags))))
- print (to_unix_path(' '.join(flags)))
-
- elif opt in ('--libs', '--ldflags'):
- @@ -73,5 +87,7 @@ for opt in opt_flags:
- libs.insert(0, '-L' + sysconfig.PREFIX + '/libs')
- if getvar('LINKFORSHARED') is not None:
- libs.extend(getvar('LINKFORSHARED').split())
- - print (to_unix_path(' '.join(libs)))
- + tmp = to_unix_path(' '.join(libs))
- + sys.stderr.write ("%s -> [%s]\n" % (opt, tmp))
- + print (tmp)
-
- diff --git gdb/python/python.c gdb/python/python.c
- index c23db2c1..fe1da107 100644
- --- gdb/python/python.c
- +++ gdb/python/python.c
- @@ -323,9 +323,8 @@ python_interactive_command (const char *arg, int from_tty)
- A FILE * from one runtime does not necessarily operate correctly in
- the other runtime.
-
- - To work around this potential issue, we create on Windows hosts the
- - FILE object using Python routines, thus making sure that it is
- - compatible with the Python library. */
- + To work around this potential issue, we run code in Python to load
- + the script. */
-
- static void
- python_run_simple_file (FILE *file, const char *filename)
- @@ -339,15 +338,21 @@ python_run_simple_file (FILE *file, const char *filename)
- /* 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. */
- 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)
- +
- + if (gdb_python_module == nullptr
- + || ! PyObject_HasAttrString (gdb_python_module, "_execute_file"))
- + error (_("Installation error: gdb._execute_file function is missing"));
- +
- + gdbpy_ref<> return_value
- + (PyObject_CallMethod (gdb_python_module, "_execute_file", "s",
- + full_path.get ()));
- + if (return_value == nullptr)
- {
- - gdbpy_print_stack ();
- - error (_("Error while opening file: %s"), full_path.get ());
- + /* Use PyErr_PrintEx instead of gdbpy_print_stack to better match the
- + behavior of the non-Windows codepath. */
- + PyErr_PrintEx(0);
- }
-
- - PyRun_SimpleFile (PyFile_AsFile (python_file.get ()), filename);
- -
- #endif /* _WIN32 */
- }
-
|