Date: Sun, 18 Oct 2020 21:43:25 +0000 (UTC) From: Luca Pizzamiglio <pizzamig@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r552706 - in head/devel/gdb: . files Message-ID: <202010182143.09ILhPvG035211@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: pizzamig Date: Sun Oct 18 21:43:24 2020 New Revision: 552706 URL: https://svnweb.freebsd.org/changeset/ports/552706 Log: devel/gdb: Fix python 3.9 support Add an already upstreamed patch to fix python 3.9 support Submitted by: kib (via email) Added: head/devel/gdb/files/patch-commit-c47bae859 (contents, props changed) Modified: head/devel/gdb/Makefile Modified: head/devel/gdb/Makefile ============================================================================== --- head/devel/gdb/Makefile Sun Oct 18 21:16:44 2020 (r552705) +++ head/devel/gdb/Makefile Sun Oct 18 21:43:24 2020 (r552706) @@ -3,7 +3,7 @@ PORTNAME= gdb PORTVERSION= 9.2 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= devel MASTER_SITES= GNU Added: head/devel/gdb/files/patch-commit-c47bae859 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/gdb/files/patch-commit-c47bae859 Sun Oct 18 21:43:24 2020 (r552706) @@ -0,0 +1,99 @@ +commit c47bae859a5af0d95224d90000df0e529f7c5aa0 +Author: Kevin Buettner <kevinb@redhat.com> +Date: Wed May 27 20:05:40 2020 -0700 + +diff --git a/gdb/python/python.c b/gdb/python/python.c +index 67f362b852..4bdd2201ab 100644 +--- gdb/python/python.c ++++ gdb/python/python.c +@@ -238,6 +238,30 @@ gdbpy_enter::~gdbpy_enter () + PyGILState_Release (m_state); + } + ++/* A helper class to save and restore the GIL, but without touching ++ the other globals that are handled by gdbpy_enter. */ ++ ++class gdbpy_gil ++{ ++public: ++ ++ gdbpy_gil () ++ : m_state (PyGILState_Ensure ()) ++ { ++ } ++ ++ ~gdbpy_gil () ++ { ++ PyGILState_Release (m_state); ++ } ++ ++ DISABLE_COPY_AND_ASSIGN (gdbpy_gil); ++ ++private: ++ ++ PyGILState_STATE m_state; ++}; ++ + /* Set the quit flag. */ + + static void +@@ -251,6 +275,10 @@ gdbpy_set_quit_flag (const struct extension_language_defn *extlang) + static int + gdbpy_check_quit_flag (const struct extension_language_defn *extlang) + { ++ if (!gdb_python_initialized) ++ return 0; ++ ++ gdbpy_gil gil; + return PyOS_InterruptOccurred (); + } + +@@ -943,30 +971,6 @@ gdbpy_source_script (const struct extension_language_defn *extlang, + + /* Posting and handling events. */ + +-/* A helper class to save and restore the GIL, but without touching +- the other globals that are handled by gdbpy_enter. */ +- +-class gdbpy_gil +-{ +-public: +- +- gdbpy_gil () +- : m_state (PyGILState_Ensure ()) +- { +- } +- +- ~gdbpy_gil () +- { +- PyGILState_Release (m_state); +- } +- +- DISABLE_COPY_AND_ASSIGN (gdbpy_gil); +- +-private: +- +- PyGILState_STATE m_state; +-}; +- + /* A single event. */ + struct gdbpy_event + { +@@ -1616,6 +1620,7 @@ finalize_python (void *ignore) + + Py_Finalize (); + ++ gdb_python_initialized = false; + restore_active_ext_lang (previous_active); + } + +@@ -1785,8 +1790,7 @@ do_start_initialization () + return false; + + /* Release the GIL while gdb runs. */ +- PyThreadState_Swap (NULL); +- PyEval_ReleaseLock (); ++ PyEval_SaveThread (); + + make_final_cleanup (finalize_python, NULL); +
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202010182143.09ILhPvG035211>