11diff --git a/gdb/Makefile.in b/gdb/Makefile.in
2- index fa7c81a..258cc35 100644
2+ index fa7c81a0fab..258cc35ac88 100644
33--- a/gdb/Makefile.in
44+++ b/gdb/Makefile.in
55@@ -771,6 +771,7 @@ ALL_TARGET_OBS = \
@@ -12,7 +12,7 @@ index fa7c81a..258cc35 100644
1212 bfin-linux-tdep.o \
1313diff --git a/gdb/arm-vita-tdep.c b/gdb/arm-vita-tdep.c
1414new file mode 100644
15- index 0000000..5fdcea0
15+ index 00000000000..5fdcea08b5d
1616--- /dev/null
1717+++ b/gdb/arm-vita-tdep.c
1818@@ -0,0 +1,53 @@
@@ -70,7 +70,7 @@ index 0000000..5fdcea0
7070+ arm_vita_init_abi);
7171+ }
7272diff --git a/gdb/configure.tgt b/gdb/configure.tgt
73- index e84e222..61202f9 100644
73+ index e84e222ba0d..61202f9e3ae 100644
7474--- a/gdb/configure.tgt
7575+++ b/gdb/configure.tgt
7676@@ -198,6 +198,10 @@ arm*-*-openbsd*)
@@ -85,7 +85,7 @@ index e84e222..61202f9 100644
8585 # Target: ARM embedded system
8686 gdb_target_obs="arm-pikeos-tdep.o"
8787diff --git a/gdb/osabi.c b/gdb/osabi.c
88- index d18802a..8bc8f8b 100644
88+ index d18802ac3a4..8bc8f8bbbb4 100644
8989--- a/gdb/osabi.c
9090+++ b/gdb/osabi.c
9191@@ -82,6 +82,7 @@ static const struct osabi_names gdb_osabi_names[] =
@@ -97,7 +97,7 @@ index d18802a..8bc8f8b 100644
9797 { "<invalid>", NULL }
9898 };
9999diff --git a/gdb/osabi.h b/gdb/osabi.h
100- index 35f14ec..14504ce 100644
100+ index 35f14ec433c..14504ce650f 100644
101101--- a/gdb/osabi.h
102102+++ b/gdb/osabi.h
103103@@ -46,6 +46,7 @@ enum gdb_osabi
@@ -108,3 +108,95 @@ index 35f14ec..14504ce 100644
108108
109109 GDB_OSABI_INVALID /* keep this last */
110110 };
111+ diff --git a/gdb/python/py-gdb-readline.c b/gdb/python/py-gdb-readline.c
112+ index ea0f78c9ad8..4aa270b41ac 100644
113+ --- a/gdb/python/py-gdb-readline.c
114+ +++ b/gdb/python/py-gdb-readline.c
115+ @@ -52,13 +52,11 @@ gdbpy_readline_wrapper (FILE *sys_stdin, FILE *sys_stdout,
116+ if (except.reason == RETURN_QUIT)
117+ return NULL;
118+
119+ - /* The thread state is nulled during gdbpy_readline_wrapper,
120+ - with the original value saved in the following undocumented
121+ - variable (see Python's Parser/myreadline.c and
122+ - Modules/readline.c). */
123+ - PyEval_RestoreThread (_PyOS_ReadlineTState);
124+ +
125+ + /* This readline callback is called without the GIL held. */
126+ + gdbpy_gil gil;
127+ +
128+ gdbpy_convert_exception (except);
129+ - PyEval_SaveThread ();
130+ return NULL;
131+ }
132+
133+ diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h
134+ index c41a43bac96..96c0008ae25 100644
135+ --- a/gdb/python/python-internal.h
136+ +++ b/gdb/python/python-internal.h
137+ @@ -706,6 +706,30 @@ class gdbpy_allow_threads
138+ PyThreadState *m_save;
139+ };
140+
141+ + /* A helper class to save and restore the GIL, but without touching
142+ + the other globals that are handled by gdbpy_enter. */
143+ +
144+ + class gdbpy_gil
145+ + {
146+ + public:
147+ +
148+ + gdbpy_gil ()
149+ + : m_state (PyGILState_Ensure ())
150+ + {
151+ + }
152+ +
153+ + ~gdbpy_gil ()
154+ + {
155+ + PyGILState_Release (m_state);
156+ + }
157+ +
158+ + DISABLE_COPY_AND_ASSIGN (gdbpy_gil);
159+ +
160+ + private:
161+ +
162+ + PyGILState_STATE m_state;
163+ + };
164+ +
165+ /* Use this after a TRY_EXCEPT to throw the appropriate Python
166+ exception. */
167+ #define GDB_PY_HANDLE_EXCEPTION(Exception) \
168+ diff --git a/gdb/python/python.c b/gdb/python/python.c
169+ index 9d558119e09..4e0692abed8 100644
170+ --- a/gdb/python/python.c
171+ +++ b/gdb/python/python.c
172+ @@ -255,30 +255,6 @@ gdbpy_enter::finalize ()
173+ python_gdbarch = target_gdbarch ();
174+ }
175+
176+ - /* A helper class to save and restore the GIL, but without touching
177+ - the other globals that are handled by gdbpy_enter. */
178+ -
179+ - class gdbpy_gil
180+ - {
181+ - public:
182+ -
183+ - gdbpy_gil ()
184+ - : m_state (PyGILState_Ensure ())
185+ - {
186+ - }
187+ -
188+ - ~gdbpy_gil ()
189+ - {
190+ - PyGILState_Release (m_state);
191+ - }
192+ -
193+ - DISABLE_COPY_AND_ASSIGN (gdbpy_gil);
194+ -
195+ - private:
196+ -
197+ - PyGILState_STATE m_state;
198+ - };
199+ -
200+ /* Set the quit flag. */
201+
202+ static void
0 commit comments