GDB (API)
/home/stan/gdb/src/gdb/python/py-signalevent.c
Go to the documentation of this file.
00001 /* Python interface to inferior signal stop events.
00002 
00003    Copyright (C) 2009-2013 Free Software Foundation, Inc.
00004 
00005    This file is part of GDB.
00006 
00007    This program is free software; you can redistribute it and/or modify
00008    it under the terms of the GNU General Public License as published by
00009    the Free Software Foundation; either version 3 of the License, or
00010    (at your option) any later version.
00011 
00012    This program is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015    GNU General Public License for more details.
00016 
00017    You should have received a copy of the GNU General Public License
00018    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
00019 
00020 #include "defs.h"
00021 #include "py-stopevent.h"
00022 
00023 static PyTypeObject signal_event_object_type
00024     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object");
00025 
00026 PyObject *
00027 create_signal_event_object (enum gdb_signal stop_signal)
00028 {
00029   const char *signal_name;
00030   PyObject *signal_name_obj = NULL;
00031   PyObject *signal_event_obj =
00032       create_stop_event_object (&signal_event_object_type);
00033 
00034   if (!signal_event_obj)
00035     goto fail;
00036 
00037   signal_name = gdb_signal_to_name (stop_signal);
00038 
00039   signal_name_obj = PyString_FromString (signal_name);
00040   if (signal_name_obj == NULL)
00041     goto fail;
00042   if (evpy_add_attribute (signal_event_obj,
00043                           "stop_signal",
00044                           signal_name_obj) < 0)
00045     goto fail;
00046   Py_DECREF (signal_name_obj);
00047 
00048   return signal_event_obj;
00049 
00050  fail:
00051   Py_XDECREF (signal_name_obj);
00052   Py_XDECREF (signal_event_obj);
00053   return NULL;
00054 }
00055 
00056 GDBPY_NEW_EVENT_TYPE (signal,
00057                       "gdb.SignalEvent",
00058                       "SignalEvent",
00059                       "GDB signal event object",
00060                       stop_event_object_type,
00061                       static);
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines