[gnome-builder/wip/chergert/bug1: 46/69] breakpoints: more incremental breakpoint sync work
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/chergert/bug1: 46/69] breakpoints: more incremental breakpoint sync work
- Date: Sat, 2 Sep 2017 02:05:38 +0000 (UTC)
commit 28aca4a7aab1964f407043b83742f333fbd4b38a
Author: Christian Hergert <chergert redhat com>
Date: Wed Aug 30 19:50:06 2017 -0700
breakpoints: more incremental breakpoint sync work
libide/debugger/ide-debug-manager.c | 69 +++++++++++++++++++++++++++-
libide/debugger/ide-debugger-breakpoints.c | 30 ++++++++++++
libide/debugger/ide-debugger-breakpoints.h | 3 +
3 files changed, 100 insertions(+), 2 deletions(-)
---
diff --git a/libide/debugger/ide-debug-manager.c b/libide/debugger/ide-debug-manager.c
index 94f079f..fba5e77 100644
--- a/libide/debugger/ide-debug-manager.c
+++ b/libide/debugger/ide-debug-manager.c
@@ -182,6 +182,19 @@ ide_debug_manager_breakpoint_removed (IdeDebugManager *self,
}
static void
+ide_debug_manager_breakpoint_modified (IdeDebugManager *self,
+ IdeDebuggerBreakpoint *breakpoint,
+ IdeDebugger *debugger)
+{
+ g_assert (IDE_IS_DEBUG_MANAGER (self));
+ g_assert (IDE_IS_DEBUGGER_BREAKPOINT (breakpoint));
+ g_assert (IDE_IS_DEBUGGER (debugger));
+
+ ide_debug_manager_breakpoint_removed (self, breakpoint, debugger);
+ ide_debug_manager_breakpoint_added (self, breakpoint, debugger);
+}
+
+static void
ide_debug_manager_finalize (GObject *object)
{
IdeDebugManager *self = (IdeDebugManager *)object;
@@ -292,6 +305,11 @@ ide_debug_manager_init (IdeDebugManager *self)
self);
dzl_signal_group_connect_swapped (self->debugger_signals,
+ "breakpoint-modified",
+ G_CALLBACK (ide_debug_manager_breakpoint_modified),
+ self);
+
+ dzl_signal_group_connect_swapped (self->debugger_signals,
"breakpoint-removed",
G_CALLBACK (ide_debug_manager_breakpoint_removed),
self);
@@ -380,6 +398,53 @@ ide_debug_manager_runner_exited (IdeDebugManager *self,
g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_DEBUGGER]);
}
+static void
+ide_debug_manager_sync_breakpoints_cb (gpointer item,
+ gpointer user_data)
+{
+ IdeDebugManager *self = user_data;
+ IdeDebuggerBreakpoint *breakpoint = item;
+
+ g_assert (IDE_IS_DEBUGGER_BREAKPOINT (breakpoint));
+ g_assert (IDE_IS_DEBUG_MANAGER (self));
+ g_assert (self->debugger != NULL);
+
+ /* TODO */
+}
+
+static void
+ide_debug_manager_sync_breakpoints (IdeDebugManager *self)
+{
+ GHashTableIter iter;
+ gpointer value;
+
+ IDE_ENTRY;
+
+ g_assert (IDE_IS_DEBUG_MANAGER (self));
+ g_assert (self->debugger != NULL);
+
+ g_hash_table_iter_init (&iter, self->breakpoints);
+
+ while (g_hash_table_iter_next (&iter, NULL, &value))
+ {
+ IdeDebuggerBreakpoints *breakpoints = value;
+
+ g_assert (IDE_IS_DEBUGGER_BREAKPOINTS (breakpoints));
+
+ /*
+ * TODO: We probably want to steal the breakpoint so that
+ * then "breakpoint-added" signal will populate the
+ * breakpoint with more information.
+ */
+
+ ide_debugger_breakpoints_foreach (breakpoints,
+ ide_debug_manager_sync_breakpoints_cb,
+ self);
+ }
+
+ IDE_EXIT;
+}
+
/**
* ide_debug_manager_start:
* @self: an #IdeDebugManager
@@ -430,9 +495,9 @@ ide_debug_manager_start (IdeDebugManager *self,
ide_debug_manager_set_active (self, TRUE);
- g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_DEBUGGER]);
+ ide_debug_manager_sync_breakpoints (self);
- /* TODO: Synchronize breakpoints */
+ g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_DEBUGGER]);
ret = TRUE;
diff --git a/libide/debugger/ide-debugger-breakpoints.c b/libide/debugger/ide-debugger-breakpoints.c
index 74f3021..1c29f98 100644
--- a/libide/debugger/ide-debugger-breakpoints.c
+++ b/libide/debugger/ide-debugger-breakpoints.c
@@ -356,3 +356,33 @@ ide_debugger_breakpoints_get_file (IdeDebuggerBreakpoints *self)
return self->file;
}
+
+/**
+ * ide_debugger_breakpoints_foreach:
+ * @self: a #IdeDebuggerBreakpoints
+ * @func: (scope call) (closure user_data): A #GFunc to call
+ * @user_data: user data for @func
+ *
+ * Call @func for every #IdeDebuggerBreakpoint in @self.
+ *
+ * Since: 3.26
+ */
+void
+ide_debugger_breakpoints_foreach (IdeDebuggerBreakpoints *self,
+ GFunc func,
+ gpointer user_data)
+{
+ g_return_if_fail (IDE_IS_DEBUGGER_BREAKPOINTS (self));
+ g_return_if_fail (func != NULL);
+
+ if (self->lines != NULL)
+ {
+ for (guint i = 0; i < self->lines->len; i++)
+ {
+ const LineInfo *info = &g_array_index (self->lines, LineInfo, i);
+
+ if (info->breakpoint)
+ func (info->breakpoint, user_data);
+ }
+ }
+}
diff --git a/libide/debugger/ide-debugger-breakpoints.h b/libide/debugger/ide-debugger-breakpoints.h
index d15bb03..77d7e72 100644
--- a/libide/debugger/ide-debugger-breakpoints.h
+++ b/libide/debugger/ide-debugger-breakpoints.h
@@ -34,5 +34,8 @@ IdeDebuggerBreakMode ide_debugger_breakpoints_get_line_mode (IdeDebuggerBreakp
guint line);
IdeDebuggerBreakpoint *ide_debugger_breakpoints_get_line (IdeDebuggerBreakpoints *self,
guint line);
+void ide_debugger_breakpoints_foreach (IdeDebuggerBreakpoints *self,
+ GFunc func,
+ gpointer user_data);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]