diff options
Diffstat (limited to 'src/debug/debuggers.c')
-rw-r--r-- | src/debug/debuggers.c | 197 |
1 files changed, 197 insertions, 0 deletions
diff --git a/src/debug/debuggers.c b/src/debug/debuggers.c new file mode 100644 index 0000000..a9537c3 --- /dev/null +++ b/src/debug/debuggers.c @@ -0,0 +1,197 @@ + +/* OpenIDA - Outil d'analyse de fichiers binaires + * debugger.sc - gestion des différents débogueurs + * + * Copyright (C) 2008 Cyrille Bagard + * + * This file is part of OpenIDA. + * + * OpenIDA 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. + * + * OpenIDA 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 Foobar. If not, see <http://www.gnu.org/licenses/>. + */ + + +#include "debuggers.h" + +#include "debugger-int.h" +#include "ptrace/ptrace.h" +#include "../gtkext/iodamarshal.h" + + + +/* Initialise la classe de base des débogueurs. */ +static void g_binary_debugger_class_init(GBinaryDebuggerClass *); + +/* Initialise une instance de base d'un débogueur. */ +static void g_binary_debugger_init(GBinaryDebugger *); + + + +/* Indique le type définit pour une ligne de représentation. */ +G_DEFINE_TYPE(GBinaryDebugger, g_binary_debugger, G_TYPE_OBJECT); + + + +/****************************************************************************** +* * +* Paramètres : klass = classe à initialiser. * +* * +* Description : Initialise la classe de base des débogueurs. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void g_binary_debugger_class_init(GBinaryDebuggerClass *klass) +{ + g_signal_new("debugger-stopped", + G_TYPE_BINARY_DEBUGGER, + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(GBinaryDebuggerClass, debugger_stopped), + NULL, NULL, + g_cclosure_user_marshal_VOID__UINT64_UINT64, + G_TYPE_NONE, 2, G_TYPE_UINT64, G_TYPE_UINT64); + +} + + +/****************************************************************************** +* * +* Paramètres : debugger = instance à initialiser. * +* * +* Description : Initialise une instance de base d'un débogueur. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void g_binary_debugger_init(GBinaryDebugger *debugger) +{ + +} + + +/****************************************************************************** +* * +* Paramètres : type = type de débigueur choisi pour l'opération. * +* binary = binaire devant être débogué. * +* * +* Description : Crée un nouveau débogueur. * +* * +* Retour : Composant GObject mis en place ou NULL. * +* * +* Remarques : - * +* * +******************************************************************************/ + +GBinaryDebugger *g_new_binary_debugger(DebuggerType type, openida_binary *binary) +{ + GBinaryDebugger *result; + + switch (type) + { + case DGT_PTRACE: + result = g_object_new(G_TYPE_PTRACE_DEBUGGER, NULL); + break; + default: + result = NULL; + break; + } + + if (result != NULL) + result->binary = binary; + + return result; + +} + + +/****************************************************************************** +* * +* Paramètres : debugger = débogueur à manipuler ici. * +* * +* Description : Démarre une procédure de débogage. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +void g_binary_debugger_run(GBinaryDebugger *debugger) +{ + debugger->run(debugger); + +} + + +/****************************************************************************** +* * +* Paramètres : debugger = débogueur à manipuler ici. * +* * +* Description : Reprend une procédure de débogage. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +void g_binary_debugger_resume(GBinaryDebugger *debugger) +{ + debugger->resume(debugger); + +} + + +/****************************************************************************** +* * +* Paramètres : debugger = débogueur à manipuler ici. * +* * +* Description : Tue une procédure de débogage. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +void g_binary_debugger_kill(GBinaryDebugger *debugger) +{ + debugger->kill(debugger); + +} + + +/****************************************************************************** +* * +* Paramètres : debugger = débogueur à manipuler ici. * +* count = nombre de transmissions effetuées. * +* * +* Description : Fournit la valeur des registres de l'architecture. * +* * +* Retour : Tableau de valeurs transmises à libérer de la mémoire / NULL.* +* * +* Remarques : - * +* * +******************************************************************************/ + +register_value *g_binary_debugger_get_registers(GBinaryDebugger *debugger, size_t *count) +{ + return debugger->get_reg_values(debugger, count); + +} |