6 Star 0 Fork 44

src-openEuler/gdb

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
gdb-rhbz2250652-avoid-PyOS_ReadlineTState.patch 1.88 KB
一键复制 编辑 原始数据 按行查看 历史
SuperSix173 提交于 2024-01-24 15:15 +08:00 . upgrade GDB version to 14.1
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alexandra=20H=C3=A1jkov=C3=A1?= <ahajkova@redhat.com>
Date: Mon, 8 Jan 2024 13:24:05 +0100
Subject: gdb-rhbz2250652-avoid-PyOS_ReadlineTState.patch
gdb/python: avoid use of _PyOS_ReadlineTState
In python/py-gdb-readline.c we make use of _PyOS_ReadlineTState,
however, this variable is no longer public in Python 3.13, and so GDB
no longer builds.
We are making use of _PyOS_ReadlineTState in order to re-acquire the
Python Global Interpreter Lock (GIL). The _PyOS_ReadlineTState
variable is set in Python's outer readline code prior to calling the
user (GDB) supplied readline callback function, which for us is
gdbpy_readline_wrapper. The gdbpy_readline_wrapper function is called
without the GIL held.
Instead of using _PyOS_ReadlineTState, I propose that we switch to
calling PyGILState_Ensure() and PyGILState_Release(). These functions
will acquire the GIL based on the current thread. I think this should
be sufficient; I can't imagine why we'd be running
gdbpy_readline_wrapper on one thread on behalf of a different Python
thread.... that would be unexpected I think.
Approved-By: Tom Tromey <tom@tromey.com>
diff --git a/gdb/python/py-gdb-readline.c b/gdb/python/py-gdb-readline.c
--- a/gdb/python/py-gdb-readline.c
+++ b/gdb/python/py-gdb-readline.c
@@ -56,13 +56,11 @@ gdbpy_readline_wrapper (FILE *sys_stdin, FILE *sys_stdout,
if (except.reason == RETURN_QUIT)
return NULL;
- /* The thread state is nulled during gdbpy_readline_wrapper,
- with the original value saved in the following undocumented
- variable (see Python's Parser/myreadline.c and
- Modules/readline.c). */
- PyEval_RestoreThread (_PyOS_ReadlineTState);
+
+ /* This readline callback is called without the GIL held. */
+ gdbpy_gil gil;
+
gdbpy_convert_exception (except);
- PyEval_SaveThread ();
return NULL;
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/gdb.git
git@gitee.com:src-openeuler/gdb.git
src-openeuler
gdb
gdb
master

搜索帮助