diff options
author | Nathan Binkert <nate@binkert.org> | 2008-10-10 10:15:01 -0700 |
---|---|---|
committer | Nathan Binkert <nate@binkert.org> | 2008-10-10 10:15:01 -0700 |
commit | b25e56b32a3af5d11680b465f6443c73156ddf86 (patch) | |
tree | cb64ef712db4b113b4d6bfda883cf41bc1346911 /src/sim | |
parent | 70dbe61ffc8dae4fc2ecc252f963a760a4387517 (diff) | |
download | gem5-b25e56b32a3af5d11680b465f6443c73156ddf86.tar.xz |
gdb: add a debugging function that enters the python interpreter.
Diffstat (limited to 'src/sim')
-rw-r--r-- | src/sim/debug.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/sim/debug.cc b/src/sim/debug.cc index 3684f6767..57ca0458c 100644 --- a/src/sim/debug.cc +++ b/src/sim/debug.cc @@ -29,6 +29,7 @@ * Steve Reinhardt */ +#include <Python.h> #include <sys/types.h> #include <signal.h> #include <unistd.h> @@ -106,6 +107,21 @@ eventqDump() warn("need to dump all queues"); } +void +py_interact() +{ + PyObject *globals; + PyObject *locals; + + globals = PyEval_GetGlobals(); + Py_INCREF(globals); + locals = PyDict_New(); + PyRun_String("import code", Py_file_input, globals, locals); + PyRun_String("code.interact(local=globals())", Py_file_input, + globals, locals); + Py_DECREF(globals); + Py_DECREF(locals); +} int remote_gdb_base_port = 7000; |