1c50c785cSJohn Marino /* Python interface to inferior breakpoint stop events.
2c50c785cSJohn Marino 
3*ef5ccd6cSJohn Marino    Copyright (C) 2009-2013 Free Software Foundation, Inc.
4c50c785cSJohn Marino 
5c50c785cSJohn Marino    This file is part of GDB.
6c50c785cSJohn Marino 
7c50c785cSJohn Marino    This program is free software; you can redistribute it and/or modify
8c50c785cSJohn Marino    it under the terms of the GNU General Public License as published by
9c50c785cSJohn Marino    the Free Software Foundation; either version 3 of the License, or
10c50c785cSJohn Marino    (at your option) any later version.
11c50c785cSJohn Marino 
12c50c785cSJohn Marino    This program is distributed in the hope that it will be useful,
13c50c785cSJohn Marino    but WITHOUT ANY WARRANTY; without even the implied warranty of
14c50c785cSJohn Marino    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15c50c785cSJohn Marino    GNU General Public License for more details.
16c50c785cSJohn Marino 
17c50c785cSJohn Marino    You should have received a copy of the GNU General Public License
18c50c785cSJohn Marino    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
19c50c785cSJohn Marino 
20*ef5ccd6cSJohn Marino #include "defs.h"
21c50c785cSJohn Marino #include "py-stopevent.h"
22c50c785cSJohn Marino 
23c50c785cSJohn Marino static PyTypeObject breakpoint_event_object_type;
24c50c785cSJohn Marino 
25*ef5ccd6cSJohn Marino /* Create and initialize a BreakpointEvent object.  This acquires new
26*ef5ccd6cSJohn Marino    references to BREAKPOINT_LIST and FIRST_BP.  */
27c50c785cSJohn Marino 
28c50c785cSJohn Marino PyObject *
create_breakpoint_event_object(PyObject * breakpoint_list,PyObject * first_bp)29a45ae5f8SJohn Marino create_breakpoint_event_object (PyObject *breakpoint_list, PyObject *first_bp)
30c50c785cSJohn Marino {
31c50c785cSJohn Marino   PyObject *breakpoint_event_obj =
32c50c785cSJohn Marino       create_stop_event_object (&breakpoint_event_object_type);
33c50c785cSJohn Marino 
34c50c785cSJohn Marino   if (!breakpoint_event_obj)
35c50c785cSJohn Marino     goto fail;
36c50c785cSJohn Marino 
37c50c785cSJohn Marino   if (evpy_add_attribute (breakpoint_event_obj,
38c50c785cSJohn Marino                           "breakpoint",
39a45ae5f8SJohn Marino                           first_bp) < 0)
40a45ae5f8SJohn Marino     goto fail;
41a45ae5f8SJohn Marino   if (evpy_add_attribute (breakpoint_event_obj,
42a45ae5f8SJohn Marino                           "breakpoints",
43a45ae5f8SJohn Marino                           breakpoint_list) < 0)
44c50c785cSJohn Marino     goto fail;
45c50c785cSJohn Marino 
46c50c785cSJohn Marino   return breakpoint_event_obj;
47c50c785cSJohn Marino 
48c50c785cSJohn Marino  fail:
49c50c785cSJohn Marino   Py_XDECREF (breakpoint_event_obj);
50c50c785cSJohn Marino   return NULL;
51c50c785cSJohn Marino }
52c50c785cSJohn Marino 
53c50c785cSJohn Marino GDBPY_NEW_EVENT_TYPE (breakpoint,
54c50c785cSJohn Marino                       "gdb.BreakpointEvent",
55c50c785cSJohn Marino                       "BreakpointEvent",
56c50c785cSJohn Marino                       "GDB breakpoint stop event object",
57c50c785cSJohn Marino                       stop_event_object_type,
58c50c785cSJohn Marino                       static);
59