Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Unified Diff: gdb/python/py-exitedevent.c

Issue 124383005: GDB 7.6.50 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@upstream
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gdb/python/py-evts.c ('k') | gdb/python/py-finishbreakpoint.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gdb/python/py-exitedevent.c
diff --git a/gdb/python/py-exitedevent.c b/gdb/python/py-exitedevent.c
index 272fd30395d25a71f0e60d49220fde8d42d019fe..49c3100c6588e9d0a2f219684baedf8e63fbdbb4 100644
--- a/gdb/python/py-exitedevent.c
+++ b/gdb/python/py-exitedevent.c
@@ -1,6 +1,6 @@
/* Python interface to inferior exit events.
- Copyright (C) 2009-2012 Free Software Foundation, Inc.
+ Copyright (C) 2009-2013 Free Software Foundation, Inc.
This file is part of GDB.
@@ -17,38 +17,51 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
+#include "defs.h"
#include "py-event.h"
-static PyTypeObject exited_event_object_type;
+static PyTypeObject exited_event_object_type
+ CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object");
static PyObject *
create_exited_event_object (const LONGEST *exit_code, struct inferior *inf)
{
PyObject *exited_event;
- PyObject *inf_obj;
+ PyObject *inf_obj = NULL;
exited_event = create_event_object (&exited_event_object_type);
if (!exited_event)
goto fail;
- if (exit_code
- && evpy_add_attribute (exited_event,
- "exit_code",
- PyLong_FromLongLong (*exit_code)) < 0)
- goto fail;
+ if (exit_code)
+ {
+ PyObject *exit_code_obj = PyLong_FromLongLong (*exit_code);
+ int failed;
+
+ if (exit_code_obj == NULL)
+ goto fail;
+
+ failed = evpy_add_attribute (exited_event, "exit_code",
+ exit_code_obj) < 0;
+ Py_DECREF (exit_code_obj);
+ if (failed)
+ goto fail;
+ }
inf_obj = inferior_to_inferior_object (inf);
if (!inf_obj || evpy_add_attribute (exited_event,
"inferior",
inf_obj) < 0)
goto fail;
+ Py_DECREF (inf_obj);
return exited_event;
- fail:
- Py_XDECREF (exited_event);
- return NULL;
+ fail:
+ Py_XDECREF (inf_obj);
+ Py_XDECREF (exited_event);
+ return NULL;
}
/* Callback that is used when an exit event occurs. This function
« no previous file with comments | « gdb/python/py-evts.c ('k') | gdb/python/py-finishbreakpoint.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698