aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2013-05-20 20:37:06 +0000
committerTom Tromey <tromey@redhat.com>2013-05-20 20:37:06 +0000
commitdcf87832340eb5156dc68b34af3d233b0e672ae1 (patch)
tree7cc6043922266a602bd4cfa2f60efc782bdd5817 /gdb
parentaa36459a9256a0e74bba08842e9ff6d10cab543d (diff)
downloadgdb-dcf87832340eb5156dc68b34af3d233b0e672ae1.zip
gdb-dcf87832340eb5156dc68b34af3d233b0e672ae1.tar.gz
gdb-dcf87832340eb5156dc68b34af3d233b0e672ae1.tar.bz2
* python/py-frame.c (frapy_older, frapy_newer, gdbpy_newest_frame)
(gdbpy_selected_frame): Move object-construction code out of TRY_CATCH.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/python/py-frame.c46
2 files changed, 28 insertions, 24 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 8804d8e..b388db2 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
2013-05-20 Tom Tromey <tromey@redhat.com>
+ * python/py-frame.c (frapy_older, frapy_newer, gdbpy_newest_frame)
+ (gdbpy_selected_frame): Move object-construction code
+ out of TRY_CATCH.
+
+2013-05-20 Tom Tromey <tromey@redhat.com>
+
* python/py-arch.c (gdbpy_initialize_arch): Use
gdb_pymodule_addobject.
* python/py-block.c (gdbpy_initialize_blocks): Use
diff --git a/gdb/python/py-frame.c b/gdb/python/py-frame.c
index 8d7e1e4..cf7cc27 100644
--- a/gdb/python/py-frame.c
+++ b/gdb/python/py-frame.c
@@ -338,7 +338,7 @@ frame_info_to_frame_object (struct frame_info *frame)
static PyObject *
frapy_older (PyObject *self, PyObject *args)
{
- struct frame_info *frame, *prev;
+ struct frame_info *frame, *prev = NULL;
volatile struct gdb_exception except;
PyObject *prev_obj = NULL; /* Initialize to appease gcc warning. */
@@ -347,16 +347,17 @@ frapy_older (PyObject *self, PyObject *args)
FRAPY_REQUIRE_VALID (self, frame);
prev = get_prev_frame (frame);
- if (prev)
- prev_obj = (PyObject *) frame_info_to_frame_object (prev);
- else
- {
- Py_INCREF (Py_None);
- prev_obj = Py_None;
- }
}
GDB_PY_HANDLE_EXCEPTION (except);
+ if (prev)
+ prev_obj = (PyObject *) frame_info_to_frame_object (prev);
+ else
+ {
+ Py_INCREF (Py_None);
+ prev_obj = Py_None;
+ }
+
return prev_obj;
}
@@ -367,7 +368,7 @@ frapy_older (PyObject *self, PyObject *args)
static PyObject *
frapy_newer (PyObject *self, PyObject *args)
{
- struct frame_info *frame, *next;
+ struct frame_info *frame, *next = NULL;
volatile struct gdb_exception except;
PyObject *next_obj = NULL; /* Initialize to appease gcc warning. */
@@ -376,16 +377,17 @@ frapy_newer (PyObject *self, PyObject *args)
FRAPY_REQUIRE_VALID (self, frame);
next = get_next_frame (frame);
- if (next)
- next_obj = (PyObject *) frame_info_to_frame_object (next);
- else
- {
- Py_INCREF (Py_None);
- next_obj = Py_None;
- }
}
GDB_PY_HANDLE_EXCEPTION (except);
+ if (next)
+ next_obj = (PyObject *) frame_info_to_frame_object (next);
+ else
+ {
+ Py_INCREF (Py_None);
+ next_obj = Py_None;
+ }
+
return next_obj;
}
@@ -520,18 +522,16 @@ frapy_select (PyObject *self, PyObject *args)
PyObject *
gdbpy_newest_frame (PyObject *self, PyObject *args)
{
- struct frame_info *frame;
- PyObject *frame_obj = NULL; /* Initialize to appease gcc warning. */
+ struct frame_info *frame = NULL;
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;
+ return frame_info_to_frame_object (frame);
}
/* Implementation of gdb.selected_frame () -> gdb.Frame.
@@ -540,18 +540,16 @@ gdbpy_newest_frame (PyObject *self, PyObject *args)
PyObject *
gdbpy_selected_frame (PyObject *self, PyObject *args)
{
- struct frame_info *frame;
- PyObject *frame_obj = NULL; /* Initialize to appease gcc warning. */
+ struct frame_info *frame = NULL;
volatile struct gdb_exception except;
TRY_CATCH (except, RETURN_MASK_ALL)
{
frame = get_selected_frame ("No frame is currently selected.");
- frame_obj = frame_info_to_frame_object (frame);
}
GDB_PY_HANDLE_EXCEPTION (except);
- return frame_obj;
+ return frame_info_to_frame_object (frame);
}
/* Implementation of gdb.stop_reason_string (Integer) -> String.