xref: /dflybsd-src/contrib/gdb-7/gdb/python/py-continueevent.c (revision de8e141f24382815c10a4012d209bbbf7abf1112)
1c50c785cSJohn Marino /* Python interface to inferior continue 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-event.h"
22c50c785cSJohn Marino 
23c50c785cSJohn Marino static PyTypeObject continue_event_object_type;
24c50c785cSJohn Marino 
25*ef5ccd6cSJohn Marino static PyObject *
create_continue_event_object(void)26c50c785cSJohn Marino create_continue_event_object (void)
27c50c785cSJohn Marino {
28c50c785cSJohn Marino   return create_thread_event_object (&continue_event_object_type);
29c50c785cSJohn Marino }
30c50c785cSJohn Marino 
31c50c785cSJohn Marino /* Callback function which notifies observers when a continue event occurs.
32c50c785cSJohn Marino    This function will create a new Python continue event object.
33c50c785cSJohn Marino    Return -1 if emit fails.  */
34c50c785cSJohn Marino 
35c50c785cSJohn Marino int
emit_continue_event(ptid_t ptid)36c50c785cSJohn Marino emit_continue_event (ptid_t ptid)
37c50c785cSJohn Marino {
38c50c785cSJohn Marino   PyObject *event;
39c50c785cSJohn Marino 
40c50c785cSJohn Marino   if (evregpy_no_listeners_p (gdb_py_events.cont))
41c50c785cSJohn Marino     return 0;
42c50c785cSJohn Marino 
43c50c785cSJohn Marino   event = create_continue_event_object ();
44c50c785cSJohn Marino   if (event)
45c50c785cSJohn Marino     return evpy_emit_event (event, gdb_py_events.cont);
46c50c785cSJohn Marino   return -1;
47c50c785cSJohn Marino }
48c50c785cSJohn Marino 
49c50c785cSJohn Marino GDBPY_NEW_EVENT_TYPE (continue,
50c50c785cSJohn Marino                       "gdb.ContinueEvent",
51c50c785cSJohn Marino                       "ContinueEvent",
52c50c785cSJohn Marino                       "GDB continue event object",
53c50c785cSJohn Marino                       thread_event_object_type,
54c50c785cSJohn Marino                       static);
55