py_interact.cc (11793:ef606668d247) py_interact.cc (11808:f254d8a17da9)
1/*
2 * Copyright (c) 2003-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 15 unchanged lines hidden (view full) ---

24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * Authors: Nathan Binkert
29 * Steve Reinhardt
30 */
31
1/*
2 * Copyright (c) 2003-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 15 unchanged lines hidden (view full) ---

24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * Authors: Nathan Binkert
29 * Steve Reinhardt
30 */
31
32#include "sim/py_interact.hh"
33
34#include <Python.h>
35
32#include <Python.h>
33
34#include "sim/py_interact.hh"
35
36void
37py_interact()
38{
39 PyObject *globals;
40 PyObject *locals;
41
42 globals = PyEval_GetGlobals();
43 Py_INCREF(globals);
44 locals = PyDict_New();
45 PyRun_String("import code", Py_file_input, globals, locals);
46 PyRun_String("code.interact(local=globals())", Py_file_input,
47 globals, locals);
48 Py_DECREF(globals);
49 Py_DECREF(locals);
50}
51
36void
37py_interact()
38{
39 PyObject *globals;
40 PyObject *locals;
41
42 globals = PyEval_GetGlobals();
43 Py_INCREF(globals);
44 locals = PyDict_New();
45 PyRun_String("import code", Py_file_input, globals, locals);
46 PyRun_String("code.interact(local=globals())", Py_file_input,
47 globals, locals);
48 Py_DECREF(globals);
49 Py_DECREF(locals);
50}
51