This is the mail archive of the
archer@sourceware.org
mailing list for the Archer project.
[python][rfc] Rename gdb.current_frame to gdb.newest_frame.
- From: Thiago Jung Bauermann <bauerman at br dot ibm dot com>
- To: archer ml <archer at sourceware dot org>
- Date: Tue, 16 Dec 2008 20:20:39 -0200
- Subject: [python][rfc] Rename gdb.current_frame to gdb.newest_frame.
Hi,
I'm documenting gdb.Frame. In the process, I realized that
gdb.current_frame is not a good name for what it really provides. I
decided to call it gdb.newest_frame, to maintain consistency with the
gdb.Frame.older and gdb.Frame.newer methods. What do you think?
Also, it seems to me that caller_is and caller_matches should call
gdb.selected_frame instead of gdb.newest_frame, but I'm not really sure.
This patch makes the change. What do you think?
--
[]'s
Thiago Jung Bauermann
IBM Linux Technology Center
2008-12-16 Thiago Jung Bauermann <bauerman@br.ibm.com>
* python/python-frame.c (gdbpy_current_frame): Rename to ...
(gdbpy_newest_frame): ... this.
* python/python-internal.h (gdbpy_current_frame): Rename prototype
to ...
(gdbpy_newest_frame): ... this.
* python/python.c (GdbMethods): Rename `current_frame' function to
`newest_frame'.
* python/lib/gdb/command/backtrace.py: Change to use gdb.newest_frame.
* python/lib/gdb/function/caller_is.py: Change to use
gdb.selected_frame instead of gdb.current_frame.
diff --git a/gdb/python/lib/gdb/command/backtrace.py b/gdb/python/lib/gdb/command/backtrace.py
index 1de9725..957b306 100644
--- a/gdb/python/lib/gdb/command/backtrace.py
+++ b/gdb/python/lib/gdb/command/backtrace.py
@@ -173,9 +173,9 @@ Use of the 'raw' qualifier avoids any filtering by loadable modules.
count = int (word)
# FIXME: provide option to start at selected frame
- # However, should still number as if starting from current
+ # However, should still number as if starting from newest
iter = itertools.imap (FrameWrapper,
- FrameIterator (gdb.current_frame ()))
+ FrameIterator (gdb.newest_frame ()))
if filter:
iter = gdb.backtrace.create_frame_filter (iter)
diff --git a/gdb/python/lib/gdb/function/caller_is.py b/gdb/python/lib/gdb/function/caller_is.py
index cf18afb..2b9c5c7 100644
--- a/gdb/python/lib/gdb/function/caller_is.py
+++ b/gdb/python/lib/gdb/function/caller_is.py
@@ -30,7 +30,7 @@ to traverse to find the calling function. The default is 1."""
super (CallerIs, self).__init__ ("caller_is")
def invoke (self, name, nframes = 1):
- frame = gdb.current_frame ()
+ frame = gdb.selected_frame ()
while nframes > 0:
frame = frame.older ()
nframes = nframes - 1
@@ -48,7 +48,7 @@ to traverse to find the calling function. The default is 1."""
super (CallerMatches, self).__init__ ("caller_matches")
def invoke (self, name, nframes = 1):
- frame = gdb.current_frame ()
+ frame = gdb.selected_frame ()
while nframes > 0:
frame = frame.older ()
nframes = nframes - 1
diff --git a/gdb/python/python-frame.c b/gdb/python/python-frame.c
index e6f2ada..d4c5243 100644
--- a/gdb/python/python-frame.c
+++ b/gdb/python/python-frame.c
@@ -403,7 +403,7 @@ gdbpy_frames (PyObject *self, PyObject *args)
}
PyObject *
-gdbpy_current_frame (PyObject *self, PyObject *args)
+gdbpy_newest_frame (PyObject *self, PyObject *args)
{
struct frame_info *frame;
frame_object *frame_obj = NULL; /* Initialize to appease gcc warning. */
diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h
index 7e56784..bd85f88 100644
--- a/gdb/python/python-internal.h
+++ b/gdb/python/python-internal.h
@@ -73,7 +73,7 @@ extern PyTypeObject symbol_object_type;
PyObject *gdbpy_history (PyObject *self, PyObject *args);
PyObject *gdbpy_breakpoints (PyObject *, PyObject *);
PyObject *gdbpy_frames (PyObject *, PyObject *);
-PyObject *gdbpy_current_frame (PyObject *, PyObject *);
+PyObject *gdbpy_newest_frame (PyObject *, PyObject *);
PyObject *gdbpy_frame_stop_reason_string (PyObject *, PyObject *);
PyObject *gdbpy_lookup_symbol (PyObject *self, PyObject *args);
PyObject *gdbpy_selected_frame (PyObject *self, PyObject *args);
diff --git a/gdb/python/python.c b/gdb/python/python.c
index 02e5c61..e4ae68d 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -1545,8 +1545,8 @@ static PyMethodDef GdbMethods[] =
{ "frames", gdbpy_frames, METH_NOARGS,
"Return a tuple of all frame objects" },
- { "current_frame", gdbpy_current_frame, METH_NOARGS,
- "Return the current frame object" },
+ { "newest_frame", gdbpy_newest_frame, METH_NOARGS,
+ "Return the newest frame object" },
{ "selected_frame", gdbpy_selected_frame, METH_NOARGS,
"Return the selected frame object" },
{ "frame_stop_reason_string", gdbpy_frame_stop_reason_string,