aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/py-frame.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2011-01-06 21:10:53 +0000
committerTom Tromey <tromey@redhat.com>2011-01-06 21:10:53 +0000
commitd8e227793f4a8ce420f2b4a068844b5b6ec39490 (patch)
treeafc91da0a4286a456cde5288ec85184acbf3f61e /gdb/python/py-frame.c
parenta255712f6589e84469ad702e4f9a53bec250fb9f (diff)
downloadgdb-d8e227793f4a8ce420f2b4a068844b5b6ec39490.zip
gdb-d8e227793f4a8ce420f2b4a068844b5b6ec39490.tar.gz
gdb-d8e227793f4a8ce420f2b4a068844b5b6ec39490.tar.bz2
gdb
PR python/12367: * NEWS: Add item. * python/python.c (GdbMethods): Add "newest_frame" method. * python/python-internal.h (gdbpy_newest_frame): Declare. * python/py-frame.c (gdbpy_newest_frame): New function. gdb/doc * gdb.texinfo (Frames In Python): Document gdb.newest_thread. gdb/testsuite * gdb.python/py-frame.exp: Test gdb.newest_frame.
Diffstat (limited to 'gdb/python/py-frame.c')
-rw-r--r--gdb/python/py-frame.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/gdb/python/py-frame.c b/gdb/python/py-frame.c
index 3e11db1..a52c8c7 100644
--- a/gdb/python/py-frame.c
+++ b/gdb/python/py-frame.c
@@ -498,6 +498,26 @@ frapy_select (PyObject *self, PyObject *args)
Py_RETURN_NONE;
}
+/* Implementation of gdb.newest_frame () -> gdb.Frame.
+ Returns the newest frame object. */
+
+PyObject *
+gdbpy_newest_frame (PyObject *self, PyObject *args)
+{
+ struct frame_info *frame;
+ PyObject *frame_obj = NULL; /* Initialize to appease gcc warning. */
+ volatile struct gdb_exception except;
+
+ TRY_CATCH (except, RETURN_MASK_ALL)
+ {
+ frame = get_current_frame ();
+ frame_obj = frame_info_to_frame_object (frame);
+ }
+ GDB_PY_HANDLE_EXCEPTION (except);
+
+ return frame_obj;
+}
+
/* Implementation of gdb.selected_frame () -> gdb.Frame.
Returns the selected frame object. */