[gnome-builder: 83/139] gdb: port to libide-debugger



commit 357aff9b8c2282f4cea47c475b2bdbea584d3313
Author: Christian Hergert <chergert redhat com>
Date:   Wed Jan 9 17:21:16 2019 -0800

    gdb: port to libide-debugger

 src/plugins/gdb/gbp-gdb-debugger.c                 | 44 +++++++++++-----------
 src/plugins/gdb/gbp-gdb-debugger.h                 |  2 +-
 src/plugins/gdb/{gbp-gdb-plugin.c => gdb-plugin.c} | 13 +++++--
 src/plugins/gdb/gdb.gresource.xml                  |  2 +-
 src/plugins/gdb/gdb.plugin                         | 13 ++++---
 src/plugins/gdb/meson.build                        | 19 +++++-----
 6 files changed, 49 insertions(+), 44 deletions(-)
---
diff --git a/src/plugins/gdb/gbp-gdb-debugger.c b/src/plugins/gdb/gbp-gdb-debugger.c
index 9c1a4d30f..df5e9416e 100644
--- a/src/plugins/gdb/gbp-gdb-debugger.c
+++ b/src/plugins/gdb/gbp-gdb-debugger.c
@@ -21,10 +21,10 @@
 #define G_LOG_DOMAIN "gbp-gdb-debugger"
 
 #include <dazzle.h>
+#include <libide-io.h>
 #include <string.h>
 
 #include "gbp-gdb-debugger.h"
-#include "util/ide-glib.h"
 
 #define READ_BUFFER_LEN 4096
 
@@ -79,35 +79,35 @@ G_DEFINE_TYPE (GbpGdbDebugger, gbp_gdb_debugger, IDE_TYPE_DEBUGGER)
   } G_STMT_END
 
 static void
-gbp_gdb_debugger_set_context (IdeObject  *object,
-                              IdeContext *context)
+gbp_gdb_debugger_parent_set (IdeObject *object,
+                             IdeObject *parent)
 {
   GbpGdbDebugger *self = (GbpGdbDebugger *)object;
+  IdeBuildManager *build_manager;
+  IdeBuildPipeline *pipeline;
+  const gchar *builddir;
+  IdeContext *context;
 
   g_assert (GBP_IS_GDB_DEBUGGER (self));
-  g_assert (!context || IDE_IS_CONTEXT (context));
+  g_assert (!parent || IDE_IS_OBJECT (parent));
 
-  IDE_OBJECT_CLASS (gbp_gdb_debugger_parent_class)->set_context (object, context);
+  if (parent == NULL)
+    return;
 
-  if (context != NULL)
-    {
-      IdeBuildManager *build_manager;
-      IdeBuildPipeline *pipeline;
-      const gchar *builddir;
+  context = ide_object_get_context (parent);
 
-      /*
-       * We need to save the build directory so that we can translate
-       * relative paths coming from gdb into the path within the project
-       * source tree.
-       */
+  /*
+   * We need to save the build directory so that we can translate
+   * relative paths coming from gdb into the path within the project
+   * source tree.
+   */
 
-      build_manager = ide_context_get_build_manager (context);
-      pipeline = ide_build_manager_get_pipeline (build_manager);
-      builddir = ide_build_pipeline_get_builddir (pipeline);
+  build_manager = ide_build_manager_from_context (context);
+  pipeline = ide_build_manager_get_pipeline (build_manager);
+  builddir = ide_build_pipeline_get_builddir (pipeline);
 
-      g_clear_object (&self->builddir);
-      self->builddir = g_file_new_for_path (builddir);
-    }
+  g_clear_object (&self->builddir);
+  self->builddir = g_file_new_for_path (builddir);
 }
 
 static gchar *
@@ -2534,7 +2534,7 @@ gbp_gdb_debugger_class_init (GbpGdbDebuggerClass *klass)
   object_class->dispose = gbp_gdb_debugger_dispose;
   object_class->finalize = gbp_gdb_debugger_finalize;
 
-  ide_object_class->set_context = gbp_gdb_debugger_set_context;
+  ide_object_class->parent_set = gbp_gdb_debugger_parent_set;
 
   debugger_class->supports_runner = gbp_gdb_debugger_supports_runner;
   debugger_class->prepare = gbp_gdb_debugger_prepare;
diff --git a/src/plugins/gdb/gbp-gdb-debugger.h b/src/plugins/gdb/gbp-gdb-debugger.h
index cc6ca153f..b03116859 100644
--- a/src/plugins/gdb/gbp-gdb-debugger.h
+++ b/src/plugins/gdb/gbp-gdb-debugger.h
@@ -20,7 +20,7 @@
 
 #pragma once
 
-#include <ide.h>
+#include <libide-debugger.h>
 
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wredundant-decls"
diff --git a/src/plugins/gdb/gbp-gdb-plugin.c b/src/plugins/gdb/gdb-plugin.c
similarity index 71%
rename from src/plugins/gdb/gbp-gdb-plugin.c
rename to src/plugins/gdb/gdb-plugin.c
index 86b3d7170..40ef19ace 100644
--- a/src/plugins/gdb/gbp-gdb-plugin.c
+++ b/src/plugins/gdb/gdb-plugin.c
@@ -1,4 +1,4 @@
-/* gbp-gdb-plugin.c
+/* gdb-plugin.c
  *
  * Copyright 2017-2019 Christian Hergert <chergert redhat com>
  *
@@ -18,12 +18,17 @@
  * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
+#include "config.h"
+
 #include <libpeas/peas.h>
+#include <libide-debugger.h>
 
 #include "gbp-gdb-debugger.h"
 
-void
-gbp_gdb_register_types (PeasObjectModule *module)
+_IDE_EXTERN void
+_gbp_gdb_register_types (PeasObjectModule *module)
 {
-  peas_object_module_register_extension_type (module, IDE_TYPE_DEBUGGER, GBP_TYPE_GDB_DEBUGGER);
+  peas_object_module_register_extension_type (module,
+                                              IDE_TYPE_DEBUGGER,
+                                              GBP_TYPE_GDB_DEBUGGER);
 }
diff --git a/src/plugins/gdb/gdb.gresource.xml b/src/plugins/gdb/gdb.gresource.xml
index a899d1f22..16f6006cf 100644
--- a/src/plugins/gdb/gdb.gresource.xml
+++ b/src/plugins/gdb/gdb.gresource.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <gresources>
-  <gresource prefix="/org/gnome/builder/plugins">
+  <gresource prefix="/plugins/gdb">
     <file>gdb.plugin</file>
   </gresource>
 </gresources>
diff --git a/src/plugins/gdb/gdb.plugin b/src/plugins/gdb/gdb.plugin
index 2406f9a81..90600c78f 100644
--- a/src/plugins/gdb/gdb.plugin
+++ b/src/plugins/gdb/gdb.plugin
@@ -1,10 +1,11 @@
 [Plugin]
-Module=gdb-plugin
-Name=Gdb
-Description=Provides integration with the GNU Debugger
 Authors=Christian Hergert <chergert redhat com>
-Copyright=Copyright © 2017 Christian Hergert
-Depends=debugger;editor;terminal;
 Builtin=true
-Embedded=gbp_gdb_register_types
+Copyright=Copyright © 2017-2018 Christian Hergert
+Depends=editor;terminal;buildui;debuggerui;
+Description=Provides integration with the GNU Debugger
+Embedded=_gbp_gdb_register_types
+Hidden=true
+Module=gdb
+Name=Gdb
 X-Debugger-Languages=c,chdr,cpp,cpphdr,fortran,rust,vala,asm
diff --git a/src/plugins/gdb/meson.build b/src/plugins/gdb/meson.build
index 06273593c..804213497 100644
--- a/src/plugins/gdb/meson.build
+++ b/src/plugins/gdb/meson.build
@@ -1,16 +1,17 @@
-if get_option('with_gdb')
+if get_option('plugin_gdb')
 
-gdb_resources = gnome.compile_resources(
+plugins_sources += files([
+  'gbp-gdb-debugger.c',
+  'gdb-plugin.c',
+])
+
+plugin_gdb_resources = gnome.compile_resources(
   'gdb-resources',
   'gdb.gresource.xml',
   c_name: 'gbp_gdb',
 )
 
-gdb_sources = [
-  'gbp-gdb-debugger.c',
-  'gbp-gdb-debugger.h',
-  'gbp-gdb-plugin.c',
-]
+plugins_sources += plugin_gdb_resources[0]
 
 gdbwire = static_library('gdbwire', ['gdbwire.c'],
   c_args: [ '-Wno-redundant-decls',
@@ -20,8 +21,6 @@ gdbwire = static_library('gdbwire', ['gdbwire.c'],
             '-Wno-declaration-after-statement' ],
 )
 
-gnome_builder_plugins_sources += files(gdb_sources)
-gnome_builder_plugins_sources += gdb_resources[0]
-gnome_builder_plugins_link_with += gdbwire
+plugins_link_with += gdbwire
 
 endif


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