[gnome-builder/wip/chergert/debugger: 12/16] debugger: add various properties/signals to interface
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/chergert/debugger: 12/16] debugger: add various properties/signals to interface
- Date: Fri, 24 Mar 2017 00:18:46 +0000 (UTC)
commit c7407429edd2b8d4c59f7f2e584cc2e86abe269c
Author: Christian Hergert <chergert redhat com>
Date: Wed Mar 22 16:39:53 2017 -0700
debugger: add various properties/signals to interface
libide/Makefile.am | 1 +
libide/debugger/ide-debugger.c | 60 ++++++++++++++++++++++++++++++++++++++++
libide/debugger/ide-debugger.h | 32 ++++++++++++++++-----
libide/ide-enums.c.in | 1 +
plugins/gdb/gdb_plugin.py | 15 ++++------
5 files changed, 92 insertions(+), 17 deletions(-)
---
diff --git a/libide/Makefile.am b/libide/Makefile.am
index 30cab42..ed2d294 100644
--- a/libide/Makefile.am
+++ b/libide/Makefile.am
@@ -666,6 +666,7 @@ glib_enum_headers = \
buffers/ide-buffer.h \
buildsystem/ide-build-log.h \
buildsystem/ide-build-pipeline.h \
+ debugger/ide-debugger.h \
devices/ide-device.h \
diagnostics/ide-diagnostic.h \
doap/ide-doap.h \
diff --git a/libide/debugger/ide-debugger.c b/libide/debugger/ide-debugger.c
index f6016ee..c2644fa 100644
--- a/libide/debugger/ide-debugger.c
+++ b/libide/debugger/ide-debugger.c
@@ -18,13 +18,22 @@
#define G_LOG_DOMAIN "ide-debugger"
+#include "ide-enums.h"
#include "ide-debug.h"
#include "debugger/ide-debugger.h"
+#include "diagnostics/ide-source-location.h"
#include "runner/ide-runner.h"
G_DEFINE_INTERFACE (IdeDebugger, ide_debugger, IDE_TYPE_OBJECT)
+enum {
+ STOPPED,
+ N_SIGNALS
+};
+
+static guint signals [N_SIGNALS];
+
gchar *
ide_debugger_real_get_name (IdeDebugger *self)
{
@@ -44,6 +53,46 @@ ide_debugger_default_init (IdeDebuggerInterface *iface)
{
iface->get_name = ide_debugger_real_get_name;
iface->supports_runner = ide_debugger_real_supports_runner;
+
+ g_object_interface_install_property (iface,
+ g_param_spec_boolean ("can-step-in",
+ "Can Step In",
+ "If we can advance the debugger, stepping into
any function call in the line",
+ FALSE,
+ (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)));
+
+ g_object_interface_install_property (iface,
+ g_param_spec_boolean ("can-step-over",
+ "Can Step Over",
+ "If we can advance the debugger, stepping over
any function calls in the line",
+ FALSE,
+ (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)));
+
+ g_object_interface_install_property (iface,
+ g_param_spec_boolean ("can-continue",
+ "Can Continue",
+ "If we can advance the debugger to the next
breakpoint",
+ FALSE,
+ (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)));
+
+ /**
+ * IdeDebugger::stopped:
+ * @self: An #IdeDebugger
+ * @reason: An #IdeDebuggerStopReason for why the stop occurred
+ * @location: An #IdeSourceLocation of where the debugger has stopped
+ *
+ * The "stopped" signal should be emitted when the debugger has stopped at a
+ * new location. @reason indicates the reson for the stop, and @location is
+ * the location where the stop has occurred.
+ */
+ signals [STOPPED] =
+ g_signal_new ("stopped",
+ G_TYPE_FROM_INTERFACE (iface),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (IdeDebuggerInterface, stopped),
+ NULL, NULL, NULL,
+ G_TYPE_NONE,
+ 2, IDE_TYPE_DEBUGGER_STOP_REASON, IDE_TYPE_SOURCE_LOCATION);
}
/**
@@ -102,3 +151,14 @@ ide_debugger_get_name (IdeDebugger *self)
return ret;
}
+
+void
+ide_debugger_emit_stopped (IdeDebugger *self,
+ IdeDebuggerStopReason reason,
+ IdeSourceLocation *location)
+{
+ g_return_if_fail (IDE_IS_DEBUGGER (self));
+ g_return_if_fail (location != NULL);
+
+ g_signal_emit (self, signals [STOPPED], 0, reason, location);
+}
diff --git a/libide/debugger/ide-debugger.h b/libide/debugger/ide-debugger.h
index 5b50365..9c4e844 100644
--- a/libide/debugger/ide-debugger.h
+++ b/libide/debugger/ide-debugger.h
@@ -27,20 +27,36 @@ G_BEGIN_DECLS
G_DECLARE_INTERFACE (IdeDebugger, ide_debugger, IDE, DEBUGGER, IdeObject)
+typedef enum
+{
+ IDE_DEBUGGER_STOP_UNDEFINED = 0,
+ IDE_DEBUGGER_STOP_BREAKPOINT,
+ IDE_DEBUGGER_STOP_WATCHPOINT,
+ IDE_DEBUGGER_STOP_EXITED_FROM_SIGNAL,
+ IDE_DEBUGGER_STOP_EXITED_NORMALLY,
+ IDE_DEBUGGER_STOP_SIGNALED,
+} IdeDebuggerStopReason;
+
struct _IdeDebuggerInterface
{
GTypeInterface parent_iface;
- gchar *(*get_name) (IdeDebugger *self);
- gboolean (*supports_runner) (IdeDebugger *self,
- IdeRunner *runner,
- gint *priority);
+ gchar *(*get_name) (IdeDebugger *self);
+ gboolean (*supports_runner) (IdeDebugger *self,
+ IdeRunner *runner,
+ gint *priority);
+ void (*stopped) (IdeDebugger *self,
+ IdeDebuggerStopReason reason,
+ IdeSourceLocation *location);
};
-gchar *ide_debugger_get_name (IdeDebugger *self);
-gboolean ide_debugger_supports_runner (IdeDebugger *self,
- IdeRunner *runner,
- gint *priority);
+gchar *ide_debugger_get_name (IdeDebugger *self);
+gboolean ide_debugger_supports_runner (IdeDebugger *self,
+ IdeRunner *runner,
+ gint *priority);
+void ide_debugger_emit_stopped (IdeDebugger *self,
+ IdeDebuggerStopReason reason,
+ IdeSourceLocation *location);
G_END_DECLS
diff --git a/libide/ide-enums.c.in b/libide/ide-enums.c.in
index 5013750..dcddc2a 100644
--- a/libide/ide-enums.c.in
+++ b/libide/ide-enums.c.in
@@ -7,6 +7,7 @@
#include "buffers/ide-buffer.h"
#include "buildsystem/ide-build-log.h"
#include "buildsystem/ide-build-pipeline.h"
+#include "debugger/ide-debugger.h"
#include "devices/ide-device.h"
#include "diagnostics/ide-diagnostic.h"
#include "doap/ide-doap.h"
diff --git a/plugins/gdb/gdb_plugin.py b/plugins/gdb/gdb_plugin.py
index 0949e94..cf14cf0 100644
--- a/plugins/gdb/gdb_plugin.py
+++ b/plugins/gdb/gdb_plugin.py
@@ -24,19 +24,16 @@ from gi.repository import GObject
from gi.repository import Ide
class GdbDebugger(Ide.Object, Ide.Debugger):
+ can_step_in = GObject.Property('can-step-in', type=bool, default=False)
+ can_step_over = GObject.Property('can-step-over', type=bool, default=False)
+ can_continue = GObject.Property('can-continue', type=bool, default=False)
+
def do_get_name(self):
return 'GNU Debugger'
def do_supports_runner(self, runner):
- """
- Checks to see if we support running this program.
-
- TODO: We should check if it is an ELF binary.
-
- For now, we just always return True, but with a priority that
- allows other debuggers to take priority.
- """
- if runner.get_runtime().contains_program('gdb'):
+ if runner.get_runtime().contains_program_in_path('gdb'):
return (True, GLib.MAXINT)
else:
return (False, 0)
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]