[gnome-builder] debugger: add action to remove all breakpoints



commit b6a14a608ceb81ecb124d037a692bb30faab53f7
Author: Venkatesh <zhac358 live rhul ac uk>
Date:   Sun Dec 27 23:27:13 2020 +0000

    debugger: add action to remove all breakpoints

 src/libide/debugger/ide-debugger-actions.c | 43 +++++++++++++++++++++++++-----
 1 file changed, 37 insertions(+), 6 deletions(-)
---
diff --git a/src/libide/debugger/ide-debugger-actions.c b/src/libide/debugger/ide-debugger-actions.c
index 99e7194ea..478503e5e 100644
--- a/src/libide/debugger/ide-debugger-actions.c
+++ b/src/libide/debugger/ide-debugger-actions.c
@@ -98,13 +98,44 @@ ide_debugger_actions_stop (IdeDebugger                  *self,
   ide_debugger_interrupt_async (self, NULL, NULL, NULL, NULL);
 }
 
+static void
+ide_debugger_actions_clear_breakpoints (IdeDebugger                  *self,
+                                        const IdeDebuggerActionEntry *entry,
+                                        GVariant                     *param)
+{
+  g_autoptr (GPtrArray) breakpoints = NULL;
+  GListModel *breakpoint_list_model;
+  guint n_elements;
+
+  g_assert (IDE_IS_DEBUGGER (self));
+  g_assert (entry != NULL);
+
+  breakpoint_list_model = ide_debugger_get_breakpoints (self);
+  n_elements = g_list_model_get_n_items (breakpoint_list_model);
+  g_debug ("Number of breakpoints: %d", n_elements);
+
+  breakpoints = g_ptr_array_new_with_free_func (g_object_unref);
+
+  for (guint i = 0; i < n_elements; i++)
+    {
+      g_ptr_array_add (breakpoints, g_list_model_get_item (breakpoint_list_model, i));
+    }
+
+  for (guint i = 0; i < n_elements; i++)
+    {
+      ide_debugger_remove_breakpoint_async (self, g_ptr_array_index (breakpoints, i),
+                                            NULL, NULL, NULL);
+    }
+}
+
 static IdeDebuggerActionEntry action_info[] = {
-  { "start",     ide_debugger_actions_movement, IDE_DEBUGGER_MOVEMENT_START,     RUNNING_NOT_STARTED },
-  { "stop",      ide_debugger_actions_stop,     -1,                              RUNNING_STARTED | 
RUNNING_ACTIVE },
-  { "continue",  ide_debugger_actions_movement, IDE_DEBUGGER_MOVEMENT_CONTINUE,  RUNNING_STARTED | 
RUNNING_NOT_ACTIVE },
-  { "step-in",   ide_debugger_actions_movement, IDE_DEBUGGER_MOVEMENT_STEP_IN,   RUNNING_STARTED | 
RUNNING_NOT_ACTIVE },
-  { "step-over", ide_debugger_actions_movement, IDE_DEBUGGER_MOVEMENT_STEP_OVER, RUNNING_STARTED | 
RUNNING_NOT_ACTIVE },
-  { "finish",    ide_debugger_actions_movement, IDE_DEBUGGER_MOVEMENT_FINISH,    RUNNING_STARTED | 
RUNNING_NOT_ACTIVE },
+  { "start",                ide_debugger_actions_movement,          IDE_DEBUGGER_MOVEMENT_START,     
RUNNING_NOT_STARTED },
+  { "stop",                 ide_debugger_actions_stop,              -1,                              
RUNNING_STARTED | RUNNING_ACTIVE },
+  { "continue",             ide_debugger_actions_movement,          IDE_DEBUGGER_MOVEMENT_CONTINUE,  
RUNNING_STARTED | RUNNING_NOT_ACTIVE },
+  { "step-in",              ide_debugger_actions_movement,          IDE_DEBUGGER_MOVEMENT_STEP_IN,   
RUNNING_STARTED | RUNNING_NOT_ACTIVE },
+  { "step-over",            ide_debugger_actions_movement,          IDE_DEBUGGER_MOVEMENT_STEP_OVER, 
RUNNING_STARTED | RUNNING_NOT_ACTIVE },
+  { "finish",               ide_debugger_actions_movement,          IDE_DEBUGGER_MOVEMENT_FINISH,    
RUNNING_STARTED | RUNNING_NOT_ACTIVE },
+  { "clear-breakpoints",    ide_debugger_actions_clear_breakpoints, -1,                              
RUNNING_STARTED | RUNNING_NOT_ACTIVE },
 };
 
 static gboolean


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]