summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/debug
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-12-07 21:04:46 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-12-07 21:04:46 (GMT)
commit648bf475951e6d588d13539441d8a0e54eab2706 (patch)
treeb654558a0c6bb4bc9d15eb9d65c124acb8a3522a /plugins/pychrysalide/debug
parentc980546e8bca6f1c0c340634a4c3640e14fd1228 (diff)
Moved some core features into plugins.
Diffstat (limited to 'plugins/pychrysalide/debug')
-rw-r--r--plugins/pychrysalide/debug/Makefile.am5
-rw-r--r--plugins/pychrysalide/debug/gdbrsp/Makefile.am19
-rw-r--r--plugins/pychrysalide/debug/gdbrsp/gdb.c173
-rw-r--r--plugins/pychrysalide/debug/gdbrsp/gdb.h42
-rw-r--r--plugins/pychrysalide/debug/gdbrsp/module.c94
-rw-r--r--plugins/pychrysalide/debug/gdbrsp/module.h42
-rw-r--r--plugins/pychrysalide/debug/module.c5
7 files changed, 2 insertions, 378 deletions
diff --git a/plugins/pychrysalide/debug/Makefile.am b/plugins/pychrysalide/debug/Makefile.am
index a5d7da3..3586321 100644
--- a/plugins/pychrysalide/debug/Makefile.am
+++ b/plugins/pychrysalide/debug/Makefile.am
@@ -5,8 +5,7 @@ libpychrysadebug_la_SOURCES = \
debugger.h debugger.c \
module.h module.c
-libpychrysadebug_la_LIBADD = \
- gdbrsp/libpychrysadebuggdbrsp.la
+libpychrysadebug_la_LIBADD =
libpychrysadebug_la_LDFLAGS =
@@ -21,4 +20,4 @@ AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) $(LIBPYTHON_CFLAGS) $(LIBPYGOBJE
AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS)
-SUBDIRS = gdbrsp
+SUBDIRS =
diff --git a/plugins/pychrysalide/debug/gdbrsp/Makefile.am b/plugins/pychrysalide/debug/gdbrsp/Makefile.am
deleted file mode 100644
index 8ece12b..0000000
--- a/plugins/pychrysalide/debug/gdbrsp/Makefile.am
+++ /dev/null
@@ -1,19 +0,0 @@
-
-noinst_LTLIBRARIES = libpychrysadebuggdbrsp.la
-
-libpychrysadebuggdbrsp_la_SOURCES = \
- gdb.h gdb.c \
- module.h module.c
-
-libpychrysadebuggdbrsp_la_LDFLAGS =
-
-
-devdir = $(includedir)/chrysalide-$(subdir)
-
-dev_HEADERS = $(libpychrysadebuggdbrsp_la_SOURCES:%c=)
-
-
-AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) $(LIBPYTHON_CFLAGS) $(LIBPYGOBJECT_CFLAGS) \
- -I$(top_srcdir)/src
-
-AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS)
diff --git a/plugins/pychrysalide/debug/gdbrsp/gdb.c b/plugins/pychrysalide/debug/gdbrsp/gdb.c
deleted file mode 100644
index 77b72b0..0000000
--- a/plugins/pychrysalide/debug/gdbrsp/gdb.c
+++ /dev/null
@@ -1,173 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * gdb.c - équivalent Python du fichier "debug/gdbrsp/gdb.c"
- *
- * Copyright (C) 2016 Cyrille Bagard
- *
- * This file is part of Chrysalide.
- *
- * Chrysalide is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Chrysalide is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-
-#include "gdb.h"
-
-
-#include <pygobject.h>
-
-
-#include <i18n.h>
-
-
-#include <debug/gdbrsp/gdb.h>
-
-
-#include "../debugger.h"
-#include "../../access.h"
-#include "../../helpers.h"
-#include "../../analysis/binary.h"
-
-
-
-/* Crée un nouvel objet Python de type 'GdbDebugger'. */
-static PyObject *py_gdb_debugger_new(PyTypeObject *, PyObject *, PyObject *);
-
-
-
-/******************************************************************************
-* *
-* Paramètres : type = type de l'objet à instancier. *
-* args = arguments fournis à l'appel. *
-* kwds = arguments de type key=val fournis. *
-* *
-* Description : Crée un nouvel objet Python de type 'GdbDebugger'. *
-* *
-* Retour : Instance Python mise en place. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_gdb_debugger_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
- PyObject *result; /* Instance à retourner */
- PyObject *binary_obj; /* Objet pour le binaire lié */
- const char *server; /* Nom du serveur à contacter */
- unsigned short port; /* Port de connexion */
- int ret; /* Bilan de lecture des args. */
- GLoadedBinary *binary; /* Binaire chargé en mémoire */
- GBinaryDebugger *debugger; /* Création GLib à transmettre */
-
- ret = PyArg_ParseTuple(args, "OsH", &binary_obj, &server, &port);
- if (!ret) return NULL;
-
- ret = PyObject_IsInstance(binary_obj, (PyObject *)get_python_loaded_binary_type());
- if (!ret)
- {
- PyErr_SetString(PyExc_TypeError, _("The first argument must be an instance of LoadedBinary."));
- return NULL;
- }
-
- binary = G_LOADED_BINARY(pygobject_get(binary_obj));
-
- debugger = g_gdb_debugger_new(binary, server, port);
-
- result = pygobject_new(G_OBJECT(debugger));
-
- g_object_unref(debugger);
-
- return (PyObject *)result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : - *
-* *
-* Description : Fournit un accès à une définition de type à diffuser. *
-* *
-* Retour : Définition d'objet pour Python. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-PyTypeObject *get_python_gdb_debugger_type(void)
-{
- static PyMethodDef py_gdb_debugger_methods[] = {
- { NULL }
- };
-
- static PyGetSetDef py_gdb_debugger_getseters[] = {
- { NULL }
- };
-
- static PyTypeObject py_gdb_debugger_type = {
-
- PyVarObject_HEAD_INIT(NULL, 0)
-
- .tp_name = "pychrysalide.debug.gdbrsp.GdbDebugger",
- .tp_basicsize = sizeof(PyGObject),
-
- .tp_flags = Py_TPFLAGS_DEFAULT,
-
- .tp_doc = "PyChrysalide GDB debugger",
-
- .tp_methods = py_gdb_debugger_methods,
- .tp_getset = py_gdb_debugger_getseters,
- .tp_new = py_gdb_debugger_new
-
- };
-
- return &py_gdb_debugger_type;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : module = module dont la définition est à compléter. *
-* *
-* Description : Prend en charge l'objet 'pychrysalide....gdbrsp.GdbDebugger'.*
-* *
-* Retour : Bilan de l'opération. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-bool ensure_python_gdb_debugger_is_registered(void)
-{
- PyTypeObject *type; /* Type Python 'GdbDebugger' */
- PyObject *module; /* Module à recompléter */
- PyObject *dict; /* Dictionnaire du module */
-
- type = get_python_gdb_debugger_type();
-
- if (!PyType_HasFeature(type, Py_TPFLAGS_READY))
- {
- module = get_access_to_python_module("pychrysalide.debug.gdbrsp");
-
- dict = PyModule_GetDict(module);
-
- if (!register_class_for_pygobject(dict, G_TYPE_GDB_DEBUGGER, type, get_python_binary_debugger_type()))
- return false;
-
- }
-
- return true;
-
-}
diff --git a/plugins/pychrysalide/debug/gdbrsp/gdb.h b/plugins/pychrysalide/debug/gdbrsp/gdb.h
deleted file mode 100644
index 057a38d..0000000
--- a/plugins/pychrysalide/debug/gdbrsp/gdb.h
+++ /dev/null
@@ -1,42 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * gdb.h - prototypes pour l'équivalent Python du fichier "debug/gdbrsp/gdb.h"
- *
- * Copyright (C) 2016 Cyrille Bagard
- *
- * This file is part of Chrysalide.
- *
- * Chrysalide is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Chrysalide is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-
-#ifndef _PLUGINS_PYCHRYSALIDE_DEBUG_GDBRSP_DEBUGGER_H
-#define _PLUGINS_PYCHRYSALIDE_DEBUG_GDBRSP_DEBUGGER_H
-
-
-#include <Python.h>
-#include <stdbool.h>
-
-
-
-/* Fournit un accès à une définition de type à diffuser. */
-PyTypeObject *get_python_gdb_debugger_type(void);
-
-/* Prend en charge l'objet 'pychrysalide.debug.gdbrsp.GdbDebugger'. */
-bool ensure_python_gdb_debugger_is_registered(void);
-
-
-
-#endif /* _PLUGINS_PYCHRYSALIDE_DEBUG_GDBRSP_DEBUGGER_H */
diff --git a/plugins/pychrysalide/debug/gdbrsp/module.c b/plugins/pychrysalide/debug/gdbrsp/module.c
deleted file mode 100644
index c077aa7..0000000
--- a/plugins/pychrysalide/debug/gdbrsp/module.c
+++ /dev/null
@@ -1,94 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * module.c - intégration du répertoire gdbrsp en tant que module
- *
- * Copyright (C) 2012 Cyrille Bagard
- *
- * This file is part of Chrysalide.
- *
- * Chrysalide is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Chrysalide is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-
-#include "module.h"
-
-
-#include "gdb.h"
-#include "../../helpers.h"
-
-
-
-/******************************************************************************
-* *
-* Paramètres : super = module dont la définition est à compléter. *
-* *
-* Description : Ajoute le module 'debug.gdbresp' à un module Python. *
-* *
-* Retour : Bilan de l'opération. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-bool add_debug_gdbresp_module(PyObject *super)
-{
- bool result; /* Bilan à retourner */
- PyObject *module; /* Sous-module mis en place */
-
- static PyModuleDef py_chrysalide_debug_gdbresp_module = {
-
- .m_base = PyModuleDef_HEAD_INIT,
-
- .m_name = "pychrysalide.debug.gdbrsp",
- .m_doc = "Python module for Chrysalide.debug.gdbrsp",
-
- .m_size = -1,
-
- };
-
- module = build_python_module(super, &py_chrysalide_debug_gdbresp_module);
-
- result = (module != NULL);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : - *
-* *
-* Description : Intègre les objets du module 'debug.gdbresp'. *
-* *
-* Retour : Bilan de l'opération. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-bool populate_debug_gdbresp_module(void)
-{
- bool result; /* Bilan à retourner */
-
- result = true;
-
- if (result) result = ensure_python_gdb_debugger_is_registered();
-
- assert(result);
-
- return result;
-
-}
diff --git a/plugins/pychrysalide/debug/gdbrsp/module.h b/plugins/pychrysalide/debug/gdbrsp/module.h
deleted file mode 100644
index 0ed3719..0000000
--- a/plugins/pychrysalide/debug/gdbrsp/module.h
+++ /dev/null
@@ -1,42 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * module.h - prototypes pour l'intégration du répertoire gdbrsp en tant que module
- *
- * Copyright (C) 2012-2016 Cyrille Bagard
- *
- * This file is part of Chrysalide.
- *
- * Chrysalide is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Chrysalide is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-
-#ifndef _PLUGINS_PYCHRYSALIDE_DEBUG_GDBRSP_MODULE_H
-#define _PLUGINS_PYCHRYSALIDE_DEBUG_GDBRSP_MODULE_H
-
-
-#include <Python.h>
-#include <stdbool.h>
-
-
-
-/* Ajoute le module 'debug.gdbresp' à un module Python. */
-bool add_debug_gdbresp_module(PyObject *);
-
-/* Intègre les objets du module 'debug.gdbresp'. */
-bool populate_debug_gdbresp_module(void);
-
-
-
-#endif /* _PLUGINS_PYCHRYSALIDE_DEBUG_GDBRSP_MODULE_H */
diff --git a/plugins/pychrysalide/debug/module.c b/plugins/pychrysalide/debug/module.c
index a2df8bf..1ce4fe8 100644
--- a/plugins/pychrysalide/debug/module.c
+++ b/plugins/pychrysalide/debug/module.c
@@ -26,7 +26,6 @@
#include "debugger.h"
-#include "gdbrsp/module.h"
#include "../helpers.h"
@@ -63,8 +62,6 @@ bool add_debug_module(PyObject *super)
result = (module != NULL);
- if (result) result = add_debug_gdbresp_module(module);
-
if (!result)
Py_XDECREF(module);
@@ -93,8 +90,6 @@ bool populate_debug_module(void)
if (result) result = ensure_python_binary_debugger_is_registered();
- if (result) result = populate_debug_gdbresp_module();
-
assert(result);
return result;