public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [commit][python] source_python_script doesn't set python_gdbarch
@ 2010-04-08  5:06 Doug Evans
  0 siblings, 0 replies; only message in thread
From: Doug Evans @ 2010-04-08  5:06 UTC (permalink / raw)
  To: gdb-patches

Hi.

While reading python.c I noticed that source_python_script doesn't
use ensure_python_env.  I then tried this experiment:

$ cat foo.py:
import gdb
print gdb.target_charset()

(gdb) source foo.py
../../../src/gdb/gdbarch.c:3632: internal-error: gdbarch_auto_charset: Assertion `gdbarch != NULL' failed.
A problem internal to GDB has been detected,
[...]

Part of what ensure_python_env does is set python_gdbarch.
I've checked this patch in to fix it.

2010-04-07  Doug Evans  <dje@google.com>

	* python/python.c (source_python_script): Use ensure_python_env
	to prepare environment for script.

Index: python.c
===================================================================
RCS file: /cvs/src/src/gdb/python/python.c,v
retrieving revision 1.27
diff -u -p -r1.27 python.c
--- python.c	5 Mar 2010 20:18:17 -0000	1.27
+++ python.c	8 Apr 2010 04:51:02 -0000
@@ -367,14 +367,14 @@ gdbpy_parse_and_eval (PyObject *self, Py
 void
 source_python_script (FILE *stream, char *file)
 {
-  PyGILState_STATE state;
+  struct cleanup *cleanup;
 
-  state = PyGILState_Ensure ();
+  cleanup = ensure_python_env (get_current_arch (), current_language);
 
   PyRun_SimpleFile (stream, file);
 
   fclose (stream);
-  PyGILState_Release (state);
+  do_cleanups (cleanup);
 }
 
 \f

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-04-08  5:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-08  5:06 [commit][python] source_python_script doesn't set python_gdbarch Doug Evans

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).