diff options
Diffstat (limited to 'gdb/python/py-frame.c')
-rw-r--r-- | gdb/python/py-frame.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/gdb/python/py-frame.c b/gdb/python/py-frame.c index c8eab52..ee57eb1 100644 --- a/gdb/python/py-frame.c +++ b/gdb/python/py-frame.c @@ -577,6 +577,27 @@ frapy_select (PyObject *self, PyObject *args) Py_RETURN_NONE; } +/* The stack frame level for this frame. */ + +static PyObject * +frapy_level (PyObject *self, PyObject *args) +{ + struct frame_info *fi; + + try + { + FRAPY_REQUIRE_VALID (self, fi); + + return gdb_py_object_from_longest (frame_relative_level (fi)).release (); + } + catch (const gdb_exception &except) + { + GDB_PY_HANDLE_EXCEPTION (except); + } + + Py_RETURN_NONE; +} + /* Implementation of gdb.newest_frame () -> gdb.Frame. Returns the newest frame object. */ @@ -748,6 +769,8 @@ Return the frame's symtab and line." }, Return the value of the variable in this frame." }, { "select", frapy_select, METH_NOARGS, "Select this frame as the user's current frame." }, + { "level", frapy_level, METH_NOARGS, + "The stack level of this frame." }, {NULL} /* Sentinel */ }; |