diff options
author | Guido van Rossum <guido@python.org> | 2003-04-09 19:06:21 +0000 |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2003-04-09 19:06:21 +0000 |
commit | a12fe4e81fa3221458e16225e76ec7b8a05820ee (patch) | |
tree | 05f9ba6e5dab68aa1627e340aa1b6f2437c8e302 /Python/sysmodule.c | |
parent | 12dd7b12c6bce882a7e789173760abab62c80304 (diff) | |
download | cpython-git-a12fe4e81fa3221458e16225e76ec7b8a05820ee.tar.gz |
- New function sys.call_tracing() allows pdb to debug code
recursively.
- pdb has a new command, "debug", which lets you step through
arbitrary code from the debugger's (pdb) prompt.
Diffstat (limited to 'Python/sysmodule.c')
-rw-r--r-- | Python/sysmodule.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c index fa7f3c4a54..50b99127a0 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -17,6 +17,7 @@ Data members: #include "Python.h" #include "compile.h" #include "frameobject.h" +#include "eval.h" #include "osdefs.h" @@ -609,6 +610,23 @@ sys_getframe(PyObject *self, PyObject *args) return (PyObject*)f; } +PyDoc_STRVAR(call_tracing_doc, +"call_tracing(func, args) -> object\n\ +\n\ +Call func(*args), while tracing is enabled. The tracing state is\n\ +saved, and restored afterwards. This is intended to be called from\n\ +a debugger from a checkpoint, to recursively debug some other code." +); + +static PyObject * +sys_call_tracing(PyObject *self, PyObject *args) +{ + PyObject *func, *funcargs; + if (!PyArg_ParseTuple(args, "OO:call_tracing", &func, &funcargs)) + return NULL; + return _PyEval_CallTracing(func, funcargs); +} + PyDoc_STRVAR(callstats_doc, "callstats() -> tuple of integers\n\ \n\ @@ -700,6 +718,7 @@ static PyMethodDef sys_methods[] = { {"setrecursionlimit", sys_setrecursionlimit, METH_VARARGS, setrecursionlimit_doc}, {"settrace", sys_settrace, METH_O, settrace_doc}, + {"call_tracing", sys_call_tracing, METH_VARARGS, call_tracing_doc}, {NULL, NULL} /* sentinel */ }; |