From b25e56b32a3af5d11680b465f6443c73156ddf86 Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Fri, 10 Oct 2008 10:15:01 -0700 Subject: [PATCH] gdb: add a debugging function that enters the python interpreter. --- src/sim/debug.cc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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 #include #include #include @@ -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;