+2017-09-11 Tom Tromey <tom@tromey.com>
+
+ * python/py-threadevent.c (create_thread_event_object): Return
+ gdbpy_ref.
+ * python/py-stopevent.h (create_stop_event_object)
+ (create_breakpoint_event_object, create_signal_event_object):
+ Update.
+ * python/py-stopevent.c (create_stop_event_object): Return
+ gdbpy_ref.
+ (emit_stop_event): Update.
+ * python/py-signalevent.c (create_signal_event_object): Return
+ gdbpy_ref.
+ * python/py-infevents.c (create_inferior_call_event_object):
+ Update.
+ * python/py-event.h (create_event_object)
+ (create_thread_event_object): Update.
+ * python/py-event.c (create_event_object): Return gdbpy_ref.
+ * python/py-continueevent.c: Return gdbpy_ref.
+ * python/py-bpevent.c (create_breakpoint_event_object): Return
+ gdbpy_ref.
+
2017-09-11 Tom Tromey <tom@tromey.com>
PR python/15622:
/* Create and initialize a BreakpointEvent object. This acquires new
references to BREAKPOINT_LIST and FIRST_BP. */
-PyObject *
+gdbpy_ref<>
create_breakpoint_event_object (PyObject *breakpoint_list, PyObject *first_bp)
{
gdbpy_ref<> breakpoint_event_obj
breakpoint_list) < 0)
return NULL;
- return breakpoint_event_obj.release ();
+ return breakpoint_event_obj;
}
GDBPY_NEW_EVENT_TYPE (breakpoint,
extern PyTypeObject continue_event_object_type
CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object");
-static PyObject *
+static gdbpy_ref<>
create_continue_event_object (void)
{
return create_thread_event_object (&continue_event_object_type);
Py_TYPE (self)->tp_free (self);
}
-PyObject *
+gdbpy_ref<>
create_event_object (PyTypeObject *py_type)
{
gdbpy_ref<event_object> event_obj (PyObject_New (event_object, py_type));
if (!event_obj->dict)
return NULL;
- return (PyObject*) event_obj.release ();
+ return gdbpy_ref<> ((PyObject *) event_obj.release ());
}
/* Add the attribute ATTR to the event object EVENT. In
extern int evpy_emit_event (PyObject *event,
eventregistry_object *registry);
-extern PyObject *create_event_object (PyTypeObject *py_type);
-extern PyObject *create_thread_event_object (PyTypeObject *py_type,
- PyObject *thread = nullptr);
+extern gdbpy_ref<> create_event_object (PyTypeObject *py_type);
+extern gdbpy_ref<> create_thread_event_object (PyTypeObject *py_type,
+ PyObject *thread = nullptr);
extern int emit_new_objfile_event (struct objfile *objfile);
extern int emit_clear_objfiles_event (void);
switch (flag)
{
case INFERIOR_CALL_PRE:
- event.reset (create_event_object (&inferior_call_pre_event_object_type));
+ event = create_event_object (&inferior_call_pre_event_object_type);
break;
case INFERIOR_CALL_POST:
- event.reset (create_event_object (&inferior_call_post_event_object_type));
+ event = create_event_object (&inferior_call_post_event_object_type);
break;
default:
gdb_assert_not_reached ("invalid inferior_call_kind");
extern PyTypeObject signal_event_object_type
CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object");
-PyObject *
+gdbpy_ref<>
create_signal_event_object (enum gdb_signal stop_signal)
{
const char *signal_name;
signal_name_obj.get ()) < 0)
return NULL;
- return signal_event_obj.release ();
+ return signal_event_obj;
}
GDBPY_NEW_EVENT_TYPE (signal,
#include "defs.h"
#include "py-stopevent.h"
-PyObject *
+gdbpy_ref<>
create_stop_event_object (PyTypeObject *py_type)
{
return create_thread_event_object (py_type);
if (list != NULL)
{
- stop_event_obj.reset (create_breakpoint_event_object (list.get (),
- first_bp));
+ stop_event_obj = create_breakpoint_event_object (list.get (),
+ first_bp);
if (stop_event_obj == NULL)
return -1;
}
if (stop_signal != GDB_SIGNAL_0
&& stop_signal != GDB_SIGNAL_TRAP)
{
- stop_event_obj.reset (create_signal_event_object (stop_signal));
+ stop_event_obj = create_signal_event_object (stop_signal);
if (stop_event_obj == NULL)
return -1;
}
be known and this should eventually be unused. */
if (stop_event_obj == NULL)
{
- stop_event_obj.reset (create_stop_event_object (&stop_event_object_type));
+ stop_event_obj = create_stop_event_object (&stop_event_object_type);
if (stop_event_obj == NULL)
return -1;
}
#include "py-event.h"
-extern PyObject *create_stop_event_object (PyTypeObject *py_type);
+extern gdbpy_ref<> create_stop_event_object (PyTypeObject *py_type);
extern void stop_evpy_dealloc (PyObject *self);
extern int emit_stop_event (struct bpstats *bs,
enum gdb_signal stop_signal);
-extern PyObject *create_breakpoint_event_object (PyObject *breakpoint_list,
- PyObject *first_bp);
+extern gdbpy_ref<> create_breakpoint_event_object (PyObject *breakpoint_list,
+ PyObject *first_bp);
-extern PyObject *create_signal_event_object (enum gdb_signal stop_signal);
+extern gdbpy_ref<> create_signal_event_object (enum gdb_signal stop_signal);
#endif /* GDB_PY_STOPEVENT_H */
return thread;
}
-PyObject *
+gdbpy_ref<>
create_thread_event_object (PyTypeObject *py_type, PyObject *thread)
{
gdbpy_ref<> thread_event_obj (create_event_object (py_type));
thread) < 0)
return NULL;
- return thread_event_obj.release ();
+ return thread_event_obj;
}
GDBPY_NEW_EVENT_TYPE (thread,