aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandra Hájková <ahajkova@redhat.com>2023-12-06 17:17:25 +0100
committerAlexandra Hájková <ahajkova@redhat.com>2023-12-13 10:46:39 +0100
commit7ae9ecfd80104a793ed1d836fd4dc0aa1a9c7832 (patch)
tree7883613b285070e95ec84213d6003b604dccc453
parent5c5e642dc0f6b223c2339d8dee64fbc63eee8e1a (diff)
downloadgdb-7ae9ecfd80104a793ed1d836fd4dc0aa1a9c7832.zip
gdb-7ae9ecfd80104a793ed1d836fd4dc0aa1a9c7832.tar.gz
gdb-7ae9ecfd80104a793ed1d836fd4dc0aa1a9c7832.tar.bz2
gdb: move gdbpy_gil into python-internal.h
Move gdbpy_gil class into python-internal.h, the next commit wants to make use of this class from a file other than python.c. Approved-By: Tom Tromey <tom@tromey.com>
-rw-r--r--gdb/python/python-internal.h24
-rw-r--r--gdb/python/python.c24
2 files changed, 24 insertions, 24 deletions
diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h
index 86eb543..14e1557 100644
--- a/gdb/python/python-internal.h
+++ b/gdb/python/python-internal.h
@@ -772,6 +772,30 @@ private:
PyThreadState *m_save;
};
+/* 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;
+};
+
/* Use this after a TRY_EXCEPT to throw the appropriate Python
exception. */
#define GDB_PY_HANDLE_EXCEPTION(Exception) \
diff --git a/gdb/python/python.c b/gdb/python/python.c
index 832f374..2ca3c50 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -264,30 +264,6 @@ gdbpy_enter::finalize ()
python_gdbarch = current_inferior ()->arch ();
}
-/* 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