[gnome-builder/wip/chergert/bug1] debugger: allow reseting breakpoints
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/chergert/bug1] debugger: allow reseting breakpoints
- Date: Thu, 31 Aug 2017 07:27:50 +0000 (UTC)
commit 19052900a298e677121bde0af526e26e0a81badb
Author: Christian Hergert <chergert redhat com>
Date: Thu Aug 31 00:08:51 2017 -0700
debugger: allow reseting breakpoints
this is indented to reset the state that the debugger might need to
be able to re-insret the breakpoint on the next debugger session.
libide/debugger/ide-debugger-breakpoint.c | 47 +++++++++++++++++++++++++++++
libide/debugger/ide-debugger-breakpoint.h | 2 +
libide/debugger/ide-debugger-private.h | 1 +
3 files changed, 50 insertions(+), 0 deletions(-)
---
diff --git a/libide/debugger/ide-debugger-breakpoint.c b/libide/debugger/ide-debugger-breakpoint.c
index 27cbdbf..ae70113 100644
--- a/libide/debugger/ide-debugger-breakpoint.c
+++ b/libide/debugger/ide-debugger-breakpoint.c
@@ -55,9 +55,26 @@ enum {
N_PROPS
};
+enum {
+ RESET,
+ N_SIGNALS
+};
+
G_DEFINE_TYPE_WITH_PRIVATE (IdeDebuggerBreakpoint, ide_debugger_breakpoint, G_TYPE_OBJECT)
static GParamSpec *properties [N_PROPS];
+static guint signals [N_SIGNALS];
+
+static void
+ide_debugger_breakpoint_real_reset (IdeDebuggerBreakpoint *self)
+{
+ IdeDebuggerBreakpointPrivate *priv = ide_debugger_breakpoint_get_instance_private (self);
+
+ g_assert (IDE_IS_DEBUGGER_BREAKPOINT (self));
+
+ g_clear_pointer (&priv->id, g_free);
+ g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_ID]);
+}
static void
ide_debugger_breakpoint_finalize (GObject *object)
@@ -202,6 +219,8 @@ ide_debugger_breakpoint_class_init (IdeDebuggerBreakpointClass *klass)
object_class->get_property = ide_debugger_breakpoint_get_property;
object_class->set_property = ide_debugger_breakpoint_set_property;
+ klass->reset = ide_debugger_breakpoint_real_reset;
+
/**
* IdeDebuggerBreakpoint:address:
*
@@ -381,6 +400,26 @@ ide_debugger_breakpoint_class_init (IdeDebuggerBreakpointClass *klass)
(G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS));
g_object_class_install_properties (object_class, N_PROPS, properties);
+
+ /**
+ * IdeDebuggerBreakpoint::reset:
+ * @self: An #IdeDebuggerBreakpoint
+ *
+ * The "reset" signal is emitted after the debugger has exited so that the
+ * breakpoint can reset any internal state. This allows the breakpoint to be
+ * propagated to the next debugger instance, allowing the user to move
+ * between debugger sessions without loosing state.
+ *
+ * Since: 3.26
+ */
+ signals [RESET] =
+ g_signal_new ("reset",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (IdeDebuggerBreakpointClass, reset),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
}
static void
@@ -907,3 +946,11 @@ ide_debugger_breakpoint_compare (IdeDebuggerBreakpoint *a,
return g_strcmp0 (priv_a->id, priv_b->id);
}
+
+void
+_ide_debugger_breakpoint_reset (IdeDebuggerBreakpoint *self)
+{
+ g_return_if_fail (IDE_IS_DEBUGGER_BREAKPOINT (self));
+
+ g_signal_emit (self, signals [RESET], 0);
+}
diff --git a/libide/debugger/ide-debugger-breakpoint.h b/libide/debugger/ide-debugger-breakpoint.h
index a79cb3a..1291ade 100644
--- a/libide/debugger/ide-debugger-breakpoint.h
+++ b/libide/debugger/ide-debugger-breakpoint.h
@@ -33,6 +33,8 @@ struct _IdeDebuggerBreakpointClass
{
GObjectClass parent_class;
+ void (*reset) (IdeDebuggerBreakpoint *self);
+
gpointer _reserved1;
gpointer _reserved2;
gpointer _reserved3;
diff --git a/libide/debugger/ide-debugger-private.h b/libide/debugger/ide-debugger-private.h
index bc2a39b..4750ac1 100644
--- a/libide/debugger/ide-debugger-private.h
+++ b/libide/debugger/ide-debugger-private.h
@@ -28,6 +28,7 @@ void _ide_debug_manager_add_breakpoint (IdeDebugMan
IdeDebuggerBreakpoint
*breakpoint);
void _ide_debug_manager_remove_breakpoint (IdeDebugManager *self,
IdeDebuggerBreakpoint
*breakpoint);
+void _ide_debugger_breakpoint_reset (IdeDebuggerBreakpoint *self);
void _ide_debugger_breakpoints_add (IdeDebuggerBreakpoints *self,
IdeDebuggerBreakpoint
*breakpoint);
void _ide_debugger_breakpoints_remove (IdeDebuggerBreakpoints *self,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]