summaryrefslogtreecommitdiff
path: root/src/arch/dalvik/operands
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2017-10-18 20:50:10 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2017-10-18 20:50:10 (GMT)
commitdce9d9cdfef1d37ef11a987a21f36e83b6b1944f (patch)
tree830623ade20e892954fcbddd3b7b05d09aac1dd7 /src/arch/dalvik/operands
parent1e7c7de85438749d3faf7b76984b86a9c088fbc1 (diff)
Created plugins for the Dex and Dalvik support.
Diffstat (limited to 'src/arch/dalvik/operands')
-rw-r--r--src/arch/dalvik/operands/Makefile.am17
-rw-r--r--src/arch/dalvik/operands/args.c330
-rw-r--r--src/arch/dalvik/operands/args.h67
-rw-r--r--src/arch/dalvik/operands/pool.c455
-rw-r--r--src/arch/dalvik/operands/pool.h80
-rw-r--r--src/arch/dalvik/operands/register.c363
-rw-r--r--src/arch/dalvik/operands/register.h73
7 files changed, 0 insertions, 1385 deletions
diff --git a/src/arch/dalvik/operands/Makefile.am b/src/arch/dalvik/operands/Makefile.am
deleted file mode 100644
index e7ad751..0000000
--- a/src/arch/dalvik/operands/Makefile.am
+++ /dev/null
@@ -1,17 +0,0 @@
-
-noinst_LTLIBRARIES = libarchdalvikoperands.la
-
-libarchdalvikoperands_la_SOURCES = \
- args.h args.c \
- pool.h pool.c \
- register.h register.c
-
-libarchdalvik_la_CFLAGS = $(AM_CFLAGS)
-
-
-AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS)
-
-AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS)
-
-
-SUBDIRS =
diff --git a/src/arch/dalvik/operands/args.c b/src/arch/dalvik/operands/args.c
deleted file mode 100644
index f33f887..0000000
--- a/src/arch/dalvik/operands/args.c
+++ /dev/null
@@ -1,330 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * args.c - listes d'opérandes rassemblées en arguments
- *
- * Copyright (C) 2010-2017 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 Foobar. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#include "args.h"
-
-
-#include <assert.h>
-#include <malloc.h>
-
-
-#include "../../operand-int.h"
-#include "../../../common/sort.h"
-
-
-
-/* Définition d'un opérande visant une liste d'opérandes Dalvik (instance) */
-struct _GDalvikArgsOperand
-{
- GArchOperand parent; /* Instance parente */
-
- GArchOperand **args; /* Liste d'arguments */
- size_t count; /* Taille de cette liste */
-
-};
-
-
-/* Définition d'un opérande visant une liste d'opérandes Dalvik (classe) */
-struct _GDalvikArgsOperandClass
-{
- GArchOperandClass parent; /* Classe parente */
-
-};
-
-
-/* Initialise la classe des listes d'opérandes Dalvik. */
-static void g_dalvik_args_operand_class_init(GDalvikArgsOperandClass *);
-
-/* Initialise une instance de liste d'opérandes Dalvik. */
-static void g_dalvik_args_operand_init(GDalvikArgsOperand *);
-
-/* Supprime toutes les références externes. */
-static void g_dalvik_args_operand_dispose(GDalvikArgsOperand *);
-
-/* Procède à la libération totale de la mémoire. */
-static void g_dalvik_args_operand_finalize(GDalvikArgsOperand *);
-
-/* Compare un opérande avec un autre. */
-static int g_dalvik_args_operand_compare(const GDalvikArgsOperand *, const GDalvikArgsOperand *);
-
-/* Traduit un opérande en version humainement lisible. */
-static void g_dalvik_args_operand_print(const GDalvikArgsOperand *, GBufferLine *, AsmSyntax);
-
-
-
-/* Indique le type défini par la GLib pour une liste d'arguments Dalvik. */
-G_DEFINE_TYPE(GDalvikArgsOperand, g_dalvik_args_operand, G_TYPE_ARCH_OPERAND);
-
-
-/******************************************************************************
-* *
-* Paramètres : klass = classe à initialiser. *
-* *
-* Description : Initialise la classe des listes d'opérandes Dalvik. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_dalvik_args_operand_class_init(GDalvikArgsOperandClass *klass)
-{
- GObjectClass *object; /* Autre version de la classe */
- GArchOperandClass *operand; /* Version de classe parente */
-
- object = G_OBJECT_CLASS(klass);
- operand = G_ARCH_OPERAND_CLASS(klass);
-
- object->dispose = (GObjectFinalizeFunc/* ! */)g_dalvik_args_operand_dispose;
- object->finalize = (GObjectFinalizeFunc)g_dalvik_args_operand_finalize;
-
- operand->compare = (operand_compare_fc)g_dalvik_args_operand_compare;
- operand->print = (operand_print_fc)g_dalvik_args_operand_print;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : operand = instance à initialiser. *
-* *
-* Description : Initialise une instance de liste d'opérandes Dalvik. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_dalvik_args_operand_init(GDalvikArgsOperand *operand)
-{
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : operand = instance d'objet GLib à traiter. *
-* *
-* Description : Supprime toutes les références externes. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_dalvik_args_operand_dispose(GDalvikArgsOperand *operand)
-{
- size_t i;
-
- for (i = 0; i < operand->count; i++)
- g_object_unref(G_OBJECT(operand->args[i]));
-
- G_OBJECT_CLASS(g_dalvik_args_operand_parent_class)->dispose(G_OBJECT(operand));
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : operand = instance d'objet GLib à traiter. *
-* *
-* Description : Procède à la libération totale de la mémoire. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_dalvik_args_operand_finalize(GDalvikArgsOperand *operand)
-{
- G_OBJECT_CLASS(g_dalvik_args_operand_parent_class)->finalize(G_OBJECT(operand));
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : a = premier opérande à consulter. *
-* b = second opérande à consulter. *
-* *
-* Description : Compare un opérande avec un autre. *
-* *
-* Retour : Bilan de la comparaison. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static int g_dalvik_args_operand_compare(const GDalvikArgsOperand *a, const GDalvikArgsOperand *b)
-{
- int result; /* Bilan à renvoyer */
- size_t i; /* Boucle de parcours */
-
- /* Création de l'objet... */
- if (b == NULL)
- result = 1;
-
- else
- {
- result = sort_unsigned_long(a->count, b->count);
-
- for (i = 0; i < a->count && result == 0; i++)
- result = g_arch_operand_compare(a->args[i], b->args[i]);
-
- }
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : operand = opérande à traiter. *
-* line = ligne tampon où imprimer l'opérande donné. *
-* syntax = type de représentation demandée. *
-* *
-* Description : Traduit un opérande en version humainement lisible. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_dalvik_args_operand_print(const GDalvikArgsOperand *operand, GBufferLine *line, AsmSyntax syntax)
-{
- size_t i; /* Boucle de parcours */
-
- g_buffer_line_append_text(line, BLC_ASSEMBLY, "{", 1, RTT_HOOK, NULL);
-
- if (operand->count > 0)
- {
- g_arch_operand_print(operand->args[0], line, syntax);
-
- for (i = 1; i < operand->count; i++)
- {
- g_buffer_line_append_text(line, BLC_ASSEMBLY, ",", 1, RTT_PUNCT, NULL);
- g_buffer_line_append_text(line, BLC_ASSEMBLY, " ", 1, RTT_RAW, NULL);
-
- g_arch_operand_print(operand->args[i], line, syntax);
-
- }
-
- }
-
- g_buffer_line_append_text(line, BLC_ASSEMBLY, "}", 1, RTT_HOOK, NULL);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : - *
-* *
-* Description : Crée un réceptacle pour opérandes Dalvik servant d'arguments.*
-* *
-* Retour : Opérande mis en place. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GArchOperand *g_dalvik_args_operand_new(void)
-{
- GArchOperand *result; /* Structure à retourner */
-
- result = g_object_new(G_TYPE_DALVIK_ARGS_OPERAND, NULL);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : operand = opérande à compléter. *
-* arg = nouvel argument pour un appel. *
-* *
-* Description : Ajoute un élément à la liste d'arguments Dalvik. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void g_dalvik_args_operand_add(GDalvikArgsOperand *operand, GArchOperand *arg)
-{
-
- operand->count++;
- operand->args = (GArchOperand **)realloc(operand->args, operand->count * sizeof(GArchOperand *));
-
- operand->args[operand->count - 1] = arg;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : operand = opérande à compléter. *
-* *
-* Description : Fournit le nombre d'arguments pris en charge. *
-* *
-* Retour : Nombre positif ou nul. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-size_t g_dalvik_args_count(const GDalvikArgsOperand *operand)
-{
- return operand->count;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : operand = opérande à compléter. *
-* index = indice de l'argument recherché. *
-* *
-* Description : Founit un élément de la liste d'arguments Dalvik. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GArchOperand *g_dalvik_args_operand_get(const GDalvikArgsOperand *operand, size_t index)
-{
- assert(index < operand->count);
-
- return operand->args[index];
-
-}
diff --git a/src/arch/dalvik/operands/args.h b/src/arch/dalvik/operands/args.h
deleted file mode 100644
index 993e551..0000000
--- a/src/arch/dalvik/operands/args.h
+++ /dev/null
@@ -1,67 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * args.h - prototypes pour les listes d'opérandes rassemblées en arguments
- *
- * Copyright (C) 2010-2012x 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 Foobar. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#ifndef _ARCH_DALVIK_OPERANDS_ARGS_H
-#define _ARCH_DALVIK_OPERANDS_ARGS_H
-
-
-#include <glib-object.h>
-
-
-#include "../../operand.h"
-
-
-
-#define G_TYPE_DALVIK_ARGS_OPERAND g_dalvik_args_operand_get_type()
-#define G_DALVIK_ARGS_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_dalvik_args_operand_get_type(), GDalvikArgsOperand))
-#define G_IS_DALVIK_ARGS_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_dalvik_args_operand_get_type()))
-#define G_DALVIK_ARGS_OPERAND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_DALVIK_ARGS_OPERAND, GDalvikArgsOperandClass))
-#define G_IS_DALVIK_ARGS_OPERAND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_DALVIK_ARGS_OPERAND))
-#define G_DALVIK_ARGS_OPERAND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_DALVIK_ARGS_OPERAND, GDalvikArgsOperandClass))
-
-
-/* Définition d'un opérande visant une liste d'opérandes Dalvik (instance) */
-typedef struct _GDalvikArgsOperand GDalvikArgsOperand;
-
-/* Définition d'un opérande visant une liste d'opérandes Dalvik (classe) */
-typedef struct _GDalvikArgsOperandClass GDalvikArgsOperandClass;
-
-
-/* Indique le type défini par la GLib pour une liste d'arguments Dalvik. */
-GType g_dalvik_args_operand_get_type(void);
-
-/* Crée un réceptacle pour opérandes Dalvik servant d'arguments. */
-GArchOperand *g_dalvik_args_operand_new(void);
-
-/* Ajoute un élément à la liste d'arguments Dalvik. */
-void g_dalvik_args_operand_add(GDalvikArgsOperand *, GArchOperand *);
-
-/* Fournit le nombre d'arguments pris en charge. */
-size_t g_dalvik_args_count(const GDalvikArgsOperand *);
-
-/* Founit un élément de la liste d'arguments Dalvik. */
-GArchOperand *g_dalvik_args_operand_get(const GDalvikArgsOperand *, size_t);
-
-
-
-#endif /* _ARCH_DALVIK_OPERANDS_ARGS_H */
diff --git a/src/arch/dalvik/operands/pool.c b/src/arch/dalvik/operands/pool.c
deleted file mode 100644
index d4d3a51..0000000
--- a/src/arch/dalvik/operands/pool.c
+++ /dev/null
@@ -1,455 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * pool.c - opérandes pointant vers la table des constantes
- *
- * Copyright (C) 2010-2017 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 Foobar. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#include "pool.h"
-
-
-#include <stdio.h>
-#include <string.h>
-
-
-#include <i18n.h>
-
-
-#include "../../operand-int.h"
-#include "../../../common/sort.h"
-#include "../../../format/dex/pool.h"
-
-
-
-/* Définition d'un opérande visant un élément de table de constantes Dalvik (instance) */
-struct _GDalvikPoolOperand
-{
- GArchOperand parent; /* Instance parente */
-
- GDexFormat *format; /* Lien vers le contenu réel */
- DalvikPoolType type; /* Type de table visée */
- uint32_t index; /* Indice de l'élément visé */
-
-};
-
-
-/* Définition d'un opérande visant un élément de table de constantes Dalvik (classe) */
-struct _GDalvikPoolOperandClass
-{
- GArchOperandClass parent; /* Classe parente */
-
-};
-
-
-/* Initialise la classe des opérandes de constante Dalvik. */
-static void g_dalvik_pool_operand_class_init(GDalvikPoolOperandClass *);
-
-/* Initialise une instance d'opérande de constante Dalvik. */
-static void g_dalvik_pool_operand_init(GDalvikPoolOperand *);
-
-/* Supprime toutes les références externes. */
-static void g_dalvik_pool_operand_dispose(GDalvikPoolOperand *);
-
-/* Procède à la libération totale de la mémoire. */
-static void g_dalvik_pool_operand_finalize(GDalvikPoolOperand *);
-
-/* Compare un opérande avec un autre. */
-static int g_dalvik_pool_operand_compare(const GDalvikPoolOperand *, const GDalvikPoolOperand *);
-
-/* Traduit un opérande en version humainement lisible. */
-static void g_dalvik_pool_operand_print(const GDalvikPoolOperand *, GBufferLine *, AsmSyntax);
-
-
-
-/* Indique le type défini par la GLib pour un un élément de table de constantes Dalvik. */
-G_DEFINE_TYPE(GDalvikPoolOperand, g_dalvik_pool_operand, G_TYPE_ARCH_OPERAND);
-
-
-/******************************************************************************
-* *
-* Paramètres : klass = classe à initialiser. *
-* *
-* Description : Initialise la classe des opérandes de constante Dalvik. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_dalvik_pool_operand_class_init(GDalvikPoolOperandClass *klass)
-{
- GObjectClass *object; /* Autre version de la classe */
- GArchOperandClass *operand; /* Version de classe parente */
-
- object = G_OBJECT_CLASS(klass);
-
- object->dispose = (GObjectFinalizeFunc/* ! */)g_dalvik_pool_operand_dispose;
- object->finalize = (GObjectFinalizeFunc)g_dalvik_pool_operand_finalize;
-
- operand = G_ARCH_OPERAND_CLASS(klass);
-
- operand->compare = (operand_compare_fc)g_dalvik_pool_operand_compare;
- operand->print = (operand_print_fc)g_dalvik_pool_operand_print;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : operand = instance à initialiser. *
-* *
-* Description : Initialise une instance d'opérande de constante Dalvik. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_dalvik_pool_operand_init(GDalvikPoolOperand *operand)
-{
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : binary = instance d'objet GLib à traiter. *
-* *
-* Description : Supprime toutes les références externes. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_dalvik_pool_operand_dispose(GDalvikPoolOperand *operand)
-{
- g_object_unref(G_OBJECT(operand->format));
-
- G_OBJECT_CLASS(g_dalvik_pool_operand_parent_class)->dispose(G_OBJECT(operand));
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : binary = instance d'objet GLib à traiter. *
-* *
-* Description : Procède à la libération totale de la mémoire. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_dalvik_pool_operand_finalize(GDalvikPoolOperand *operand)
-{
- G_OBJECT_CLASS(g_dalvik_pool_operand_parent_class)->finalize(G_OBJECT(operand));
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : a = premier opérande à consulter. *
-* b = second opérande à consulter. *
-* *
-* Description : Compare un opérande avec un autre. *
-* *
-* Retour : Bilan de la comparaison. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static int g_dalvik_pool_operand_compare(const GDalvikPoolOperand *a, const GDalvikPoolOperand *b)
-{
- int result; /* Bilan à renvoyer */
-
- result = sort_unsigned_long((unsigned long)a->format, (unsigned long)b->format);
-
- if (result == 0)
- result = sort_unsigned_long(a->type, b->type);
-
- if (result == 0)
- result = sort_unsigned_long(a->index, b->index);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : operand = opérande à traiter. *
-* line = ligne tampon où imprimer l'opérande donné. *
-* syntax = type de représentation demandée. *
-* *
-* Description : Traduit un opérande en version humainement lisible. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_dalvik_pool_operand_print(const GDalvikPoolOperand *operand, GBufferLine *line, AsmSyntax syntax)
-{
- const char *string; /* Chaîne de caractères #1 */
- GDataType *type; /* Type à représenter */
- size_t len; /* Taille du texte à créer */
- char *tmp; /* Chaîne de caractères #2 */
- GBinVariable *field; /* Champ à représenter */
- GDexMethod *method; /* Méthode à retrouver */
- GBinRoutine *routine; /* Routine à représenter */
-
- switch (operand->type)
- {
- case DPT_NONE:
- g_buffer_line_append_text(line, BLC_ASSEMBLY, "????", 4, RTT_ERROR, NULL);
- break;
-
- case DPT_STRING:
-
- string = get_string_from_dex_pool(operand->format, operand->index, NULL);
-
- if (string != NULL)
- {
- g_buffer_line_append_text(line, BLC_ASSEMBLY, "\"", 1, RTT_STRING, NULL);
-
- len = strlen(string);
-
- if (len > 0)
- g_buffer_line_append_text(line, BLC_ASSEMBLY, string, len, RTT_STRING, NULL);
-
- g_buffer_line_append_text(line, BLC_ASSEMBLY, "\"", 1, RTT_STRING, NULL);
-
- }
- else
- {
- len = strlen(_("<bad string index (%d)>")) + 10 /* 4294967295U */ + 1;
- tmp = calloc(len, sizeof(char));
- snprintf(tmp, len, _("<bad string index (%d)>"), operand->index);
-
- g_buffer_line_append_text(line, BLC_ASSEMBLY, tmp, len - 1, RTT_ERROR, NULL);
-
- free(tmp);
-
- }
-
- break;
-
- case DPT_TYPE:
-
- type = get_type_from_dex_pool(operand->format, operand->index);
-
- if (type != NULL)
- {
- tmp = g_data_type_to_string(type);
- g_object_unref(G_OBJECT(type));
-
- g_buffer_line_append_text(line, BLC_ASSEMBLY, "<", 1, RTT_HOOK, NULL);
- g_buffer_line_append_text(line, BLC_ASSEMBLY, tmp, strlen(tmp), RTT_VAR_NAME, NULL);
- g_buffer_line_append_text(line, BLC_ASSEMBLY, ">", 1, RTT_HOOK, NULL);
-
- }
- else
- {
- len = strlen(_("<bad type index (%d)>")) + 10 /* 4294967295U */ + 1;
- tmp = calloc(len, sizeof(char));
- snprintf(tmp, len, _("<bad type index (%d)>"), operand->index);
-
- g_buffer_line_append_text(line, BLC_ASSEMBLY, tmp, len - 1, RTT_ERROR, NULL);
-
- }
-
- free(tmp);
-
- break;
-
- case DPT_PROTO:
- g_buffer_line_append_text(line, BLC_ASSEMBLY, "proto(/*TODO*/)", 5, RTT_SECTION, NULL);
- break;
-
- case DPT_FIELD:
-
- field = get_field_from_dex_pool(operand->format, operand->index);
-
- if (field != NULL)
- {
- tmp = g_binary_variable_to_string(field, false);
- g_object_unref(G_OBJECT(field));
-
- g_buffer_line_append_text(line, BLC_ASSEMBLY, "<", 1, RTT_HOOK, NULL);
- g_buffer_line_append_text(line, BLC_ASSEMBLY, tmp, strlen(tmp), RTT_VAR_NAME, NULL);
- g_buffer_line_append_text(line, BLC_ASSEMBLY, ">", 1, RTT_HOOK, NULL);
-
- }
- else
- {
- len = strlen(_("<bad field index (%d)>")) + 10 /* 4294967295U */ + 1;
- tmp = calloc(len, sizeof(char));
- snprintf(tmp, len, _("<bad field index (%d)>"), operand->index);
-
- g_buffer_line_append_text(line, BLC_ASSEMBLY, tmp, len - 1, RTT_ERROR, NULL);
-
- }
-
- free(tmp);
-
- break;
-
- case DPT_METHOD:
-
- method = get_method_from_dex_pool(operand->format, operand->index);
-
- if (method != NULL)
- routine = g_dex_method_get_routine(method);
- else
- routine = NULL;
-
- if (routine != NULL)
- {
- tmp = g_binary_routine_to_string(routine);
- g_object_unref(G_OBJECT(routine));
-
- g_buffer_line_append_text(line, BLC_ASSEMBLY, "<", 1, RTT_HOOK, NULL);
- g_buffer_line_append_text(line, BLC_ASSEMBLY, tmp, strlen(tmp), RTT_VAR_NAME, NULL);
- g_buffer_line_append_text(line, BLC_ASSEMBLY, ">", 1, RTT_HOOK, NULL);
-
- }
- else
- {
- len = strlen(_("<bad method index (%d)>")) + 10 /* 4294967295U */ + 1;
- tmp = calloc(len, sizeof(char));
- snprintf(tmp, len, _("<bad method index (%d)>"), operand->index);
-
- g_buffer_line_append_text(line, BLC_ASSEMBLY, tmp, len - 1, RTT_ERROR, NULL);
-
- }
-
- free(tmp);
-
- if (method != NULL)
- g_object_unref(G_OBJECT(method));
-
- break;
-
- }
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : format = format du fichier contenant le code. *
-* type = type de table visée avec la référence. *
-* content = flux de données à analyser. *
-* pos = position courante dans ce flux. [OUT] *
-* size = taille de l'opérande, et donc du registre. *
-* endian = ordre des bits dans la source. *
-* *
-* Description : Crée un opérande visant un élément constant Dalvik. *
-* *
-* Retour : Opérande mis en place. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GArchOperand *g_dalvik_pool_operand_new(GDexFormat *format, DalvikPoolType type, const GBinContent *content, vmpa2t *pos, MemoryDataSize size, SourceEndian endian)
-{
- GDalvikPoolOperand *result; /* Structure à retourner */
- uint8_t index8; /* Indice sur 8 bits */
- uint16_t index16; /* Indice sur 16 bits */
- bool test; /* Bilan de lecture */
-
- switch (size)
- {
- case MDS_8_BITS:
- test = g_binary_content_read_u8(content, pos, &index8);
- break;
- case MDS_16_BITS:
- test = g_binary_content_read_u16(content, pos, endian, &index16);
- break;
- default:
- test = false;
- break;
- }
-
- if (!test)
- goto gdpon_exit;
-
- result = g_object_new(G_TYPE_DALVIK_POOL_OPERAND, NULL);
-
- g_object_ref(G_OBJECT(format));
-
- result->format = format;
- result->type = type;
- result->index = (size == MDS_8_BITS ? index8 : index16);
-
- return G_ARCH_OPERAND(result);
-
- gdpon_exit:
-
- return NULL;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : operand = opérande à consulter. *
-* *
-* Description : Indique la nature de la table de constantes visée ici. *
-* *
-* Retour : Type de table constantes visée. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-DalvikPoolType g_dalvik_pool_operand_get_pool_type(const GDalvikPoolOperand *operand)
-{
- return operand->type;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : operand = opérande à consulter. *
-* *
-* Description : Indique l'indice de l'élément dans la table de constantes. *
-* *
-* Retour : Indice de l'élément visé dans la table de constantes. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-uint32_t g_dalvik_pool_operand_get_index(const GDalvikPoolOperand *operand)
-{
- return operand->index;
-
-}
diff --git a/src/arch/dalvik/operands/pool.h b/src/arch/dalvik/operands/pool.h
deleted file mode 100644
index 3319f66..0000000
--- a/src/arch/dalvik/operands/pool.h
+++ /dev/null
@@ -1,80 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * pool.h - prototypes pour les opérandes pointant vers la table des constantes
- *
- * Copyright (C) 2010-2017 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 Foobar. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#ifndef _ARCH_DALVIK_OPERANDS_POOL_H
-#define _ARCH_DALVIK_OPERANDS_POOL_H
-
-
-#include <glib-object.h>
-#include <stdint.h>
-
-
-#include "../../operand.h"
-#include "../../../common/endianness.h"
-#include "../../../format/dex/pool.h"
-
-
-
-#define G_TYPE_DALVIK_POOL_OPERAND g_dalvik_pool_operand_get_type()
-#define G_DALVIK_POOL_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_DALVIK_POOL_OPERAND, GDalvikPoolOperand))
-#define G_IS_DALVIK_POOL_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_DALVIK_POOL_OPERAND))
-#define G_DALVIK_POOL_OPERAND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_DALVIK_POOL_OPERAND, GDalvikPoolOperandClass))
-#define G_IS_DALVIK_POOL_OPERAND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_DALVIK_POOL_OPERAND))
-#define G_DALVIK_POOL_OPERAND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_DALVIK_POOL_OPERAND, GDalvikPoolOperandClass))
-
-
-/* Définition d'un opérande visant un élément de table de constantes Dalvik (instance) */
-typedef struct _GDalvikPoolOperand GDalvikPoolOperand;
-
-/* Définition d'un opérande visant un élément de table de constantes Dalvik (classe) */
-typedef struct _GDalvikPoolOperandClass GDalvikPoolOperandClass;
-
-
-/* Type de table de constantes */
-typedef enum _DalvikPoolType
-{
- DPT_NONE = 0x0,
- DPT_STRING = 0x1,
- DPT_TYPE = 0x2,
- DPT_PROTO = 0x3,
- DPT_FIELD = 0x4,
- DPT_METHOD = 0x5
-
-} DalvikPoolType;
-
-
-/* Indique le type défini par la GLib pour un un élément de table de constantes Dalvik. */
-GType g_dalvik_pool_operand_get_type(void);
-
-/* Crée un opérande visant un élément constant Dalvik. */
-GArchOperand *g_dalvik_pool_operand_new(GDexFormat *, DalvikPoolType, const GBinContent *, vmpa2t *, MemoryDataSize, SourceEndian);
-
-/* Indique la nature de la table de constantes visée ici. */
-DalvikPoolType g_dalvik_pool_operand_get_pool_type(const GDalvikPoolOperand *);
-
-/* Indique l'indice de l'élément dans la table de constantes. */
-uint32_t g_dalvik_pool_operand_get_index(const GDalvikPoolOperand *);
-
-
-
-#endif /* _ARCH_DALVIK_OPERANDS_POOL_H */
diff --git a/src/arch/dalvik/operands/register.c b/src/arch/dalvik/operands/register.c
deleted file mode 100644
index 1516e8e..0000000
--- a/src/arch/dalvik/operands/register.c
+++ /dev/null
@@ -1,363 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * register.c - opérandes visant un registre Dalvik
- *
- * Copyright (C) 2010-2017 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 Foobar. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#include "register.h"
-
-
-#include "../../operand-int.h"
-#include "../../register.h"
-
-
-
-/* Définition d'un opérande visant un registre Dalvik (instance) */
-struct _GDalvikRegisterOperand
-{
- GArchOperand parent; /* Instance parente */
-
- const GDalvikRegister *reg; /* Registre représenté */
- bool is_written; /* Changement de contenu */
-
-};
-
-
-/* Définition d'un opérande visant un registre Dalvik (classe) */
-struct _GDalvikRegisterOperandClass
-{
- GArchOperandClass parent; /* Classe parente */
-
-};
-
-
-/* Initialise la classe des opérandes de registre Dalvik. */
-static void g_dalvik_register_operand_class_init(GDalvikRegisterOperandClass *);
-
-/* Initialise une instance d'opérande de registre Dalvik. */
-static void g_dalvik_register_operand_init(GDalvikRegisterOperand *);
-
-/* Supprime toutes les références externes. */
-static void g_dalvik_register_operand_dispose(GDalvikRegisterOperand *);
-
-/* Procède à la libération totale de la mémoire. */
-static void g_dalvik_register_operand_finalize(GDalvikRegisterOperand *);
-
-/* Compare un opérande avec un autre. */
-static int g_dalvik_register_operand_compare(const GDalvikRegisterOperand *, const GDalvikRegisterOperand *);
-
-/* Traduit un opérande en version humainement lisible. */
-static void g_dalvik_register_operand_print(const GDalvikRegisterOperand *, GBufferLine *, AsmSyntax);
-
-
-
-/* Indique le type défini par la GLib pour un opérande de registre Dalvik. */
-G_DEFINE_TYPE(GDalvikRegisterOperand, g_dalvik_register_operand, G_TYPE_ARCH_OPERAND);
-
-
-/******************************************************************************
-* *
-* Paramètres : klass = classe à initialiser. *
-* *
-* Description : Initialise la classe des opérandes de registre Dalvik. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_dalvik_register_operand_class_init(GDalvikRegisterOperandClass *klass)
-{
- GObjectClass *object; /* Autre version de la classe */
- GArchOperandClass *operand; /* Version de classe parente */
-
- object = G_OBJECT_CLASS(klass);
-
- object->dispose = (GObjectFinalizeFunc/* ! */)g_dalvik_register_operand_dispose;
- object->finalize = (GObjectFinalizeFunc)g_dalvik_register_operand_finalize;
-
- operand = G_ARCH_OPERAND_CLASS(klass);
-
- operand->compare = (operand_compare_fc)g_dalvik_register_operand_compare;
- operand->print = (operand_print_fc)g_dalvik_register_operand_print;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : operand = instance à initialiser. *
-* *
-* Description : Initialise une instance d'opérande de registre Dalvik. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_dalvik_register_operand_init(GDalvikRegisterOperand *operand)
-{
- operand->is_written = false;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : operand = instance d'objet GLib à traiter. *
-* *
-* Description : Supprime toutes les références externes. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_dalvik_register_operand_dispose(GDalvikRegisterOperand *operand)
-{
- G_OBJECT_CLASS(g_dalvik_register_operand_parent_class)->dispose(G_OBJECT(operand));
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : operand = instance d'objet GLib à traiter. *
-* *
-* Description : Procède à la libération totale de la mémoire. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_dalvik_register_operand_finalize(GDalvikRegisterOperand *operand)
-{
- G_OBJECT_CLASS(g_dalvik_register_operand_parent_class)->finalize(G_OBJECT(operand));
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : a = premier opérande à consulter. *
-* b = second opérande à consulter. *
-* *
-* Description : Compare un opérande avec un autre. *
-* *
-* Retour : Bilan de la comparaison. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static int g_dalvik_register_operand_compare(const GDalvikRegisterOperand *a, const GDalvikRegisterOperand *b)
-{
- int result; /* Bilan à retourner */
-
- result = g_dalvik_register_compare(a->reg, b->reg);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : operand = opérande à traiter. *
-* line = ligne tampon où imprimer l'opérande donné. *
-* syntax = type de représentation demandée. *
-* *
-* Description : Traduit un opérande en version humainement lisible. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_dalvik_register_operand_print(const GDalvikRegisterOperand *operand, GBufferLine *line, AsmSyntax syntax)
-{
- g_arch_register_print(G_ARCH_REGISTER(operand->reg), line, syntax);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : content = flux de données à analyser. *
-* pos = position courante dans ce flux. [OUT] *
-* low = position éventuelle des 4 bits visés. [OUT] *
-* size = taille de l'opérande, et donc du registre. *
-* endian = ordre des bits dans la source. *
-* *
-* Description : Crée un opérande visant un registre Dalvik. *
-* *
-* Retour : Opérande mis en place. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GArchOperand *g_dalvik_register_operand_new(const GBinContent *content, vmpa2t *pos, bool *low, MemoryDataSize size, SourceEndian endian)
-{
- GArchOperand *result; /* Structure à retourner */
- uint8_t index8; /* Indice sur 8 bits */
- uint16_t index16; /* Indice sur 16 bits */
- bool test; /* Bilan de lecture */
- GDalvikRegister *reg; /* Registre à représenter */
-
- result = NULL;
-
- switch (size)
- {
- case MDS_4_BITS:
- test = g_binary_content_read_u4(content, pos, low, &index8);
- break;
- case MDS_8_BITS:
- test = g_binary_content_read_u8(content, pos, &index8);
- break;
- case MDS_16_BITS:
- test = g_binary_content_read_u16(content, pos, endian, &index16);
- break;
- default:
- test = false;
- break;
- }
-
- if (!test)
- goto gdron_exit;
-
- switch (size)
- {
- case MDS_4_BITS:
- case MDS_8_BITS:
- reg = g_dalvik_register_new(index8);
- break;
- case MDS_16_BITS:
- reg = g_dalvik_register_new(index16);
- break;
- default:
- reg = NULL;
- break;
- }
-
- if (reg != NULL)
- {
- result = g_dalvik_register_operand_new_from_existing(reg);
-
- if (result == NULL)
- g_object_unref(G_OBJECT(reg));
-
- }
-
- return result;
-
- gdron_exit:
-
- return NULL;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : reg = registre déjà en place. *
-* *
-* Description : Crée un opérande visant un registre Dalvik. *
-* *
-* Retour : Opérande mis en place. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GArchOperand *g_dalvik_register_operand_new_from_existing(GDalvikRegister *reg)
-{
- GDalvikRegisterOperand *result; /* Structure à retourner */
-
- result = g_object_new(G_TYPE_DALVIK_REGISTER_OPERAND, NULL);
-
- result->reg = reg;
-
- return G_ARCH_OPERAND(result);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : operand = opérande représentant un registre. *
-* *
-* Description : Fournit le registre Dalvik associé à l'opérande. *
-* *
-* Retour : Représentation interne du registre. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-const GDalvikRegister *g_dalvik_register_operand_get(const GDalvikRegisterOperand *operand)
-{
- return operand->reg;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : operand = opérande représentant un registre à mettre à jour. *
-* *
-* Description : Marque l'opérande comme étant écrit plutôt que consulté. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void g_dalvik_register_operand_mark_as_written(GDalvikRegisterOperand *operand)
-{
- operand->is_written = true;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : operand = opérande représentant un registre à consulter. *
-* *
-* Description : Indique le type d'accès réalisé sur l'opérande. *
-* *
-* Retour : Type d'accès : true en cas d'écriture, false sinon. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-bool g_dalvik_register_operand_is_written(const GDalvikRegisterOperand *operand)
-{
- return operand->is_written;
-
-}
diff --git a/src/arch/dalvik/operands/register.h b/src/arch/dalvik/operands/register.h
deleted file mode 100644
index 5798e5c..0000000
--- a/src/arch/dalvik/operands/register.h
+++ /dev/null
@@ -1,73 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * register.h - prototypes pour les opérandes visant un registre Dalvik
- *
- * Copyright (C) 2010-2017 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 Foobar. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#ifndef _ARCH_DALVIK_OPERANDS_REGISTER_H
-#define _ARCH_DALVIK_OPERANDS_REGISTER_H
-
-
-#include <glib-object.h>
-#include <stdbool.h>
-
-
-#include "../register.h"
-#include "../../operand.h"
-#include "../../../analysis/content.h"
-
-
-
-#define G_TYPE_DALVIK_REGISTER_OPERAND g_dalvik_register_operand_get_type()
-#define G_DALVIK_REGISTER_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_DALVIK_REGISTER_OPERAND, GDalvikRegisterOperand))
-#define G_IS_DALVIK_REGISTER_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_DALVIK_REGISTER_OPERAND))
-#define G_DALVIK_REGISTER_OPERAND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_DALVIK_REGISTER_OPERAND, GDalvikRegisterOperandClass))
-#define G_IS_DALVIK_REGISTER_OPERAND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_DALVIK_REGISTER_OPERAND))
-#define G_DALVIK_REGISTER_OPERAND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_DALVIK_REGISTER_OPERAND, GDalvikRegisterOperandClass))
-
-
-/* Définition d'un opérande visant un registre Dalvik (instance) */
-typedef struct _GDalvikRegisterOperand GDalvikRegisterOperand;
-
-/* Définition d'un opérande visant un registre Dalvik (classe) */
-typedef struct _GDalvikRegisterOperandClass GDalvikRegisterOperandClass;
-
-
-/* Indique le type défini par la GLib pour un opérande de registre Dalvik. */
-GType g_dalvik_register_operand_get_type(void);
-
-/* Crée un opérande visant un registre Dalvik. */
-GArchOperand *g_dalvik_register_operand_new(const GBinContent *, vmpa2t *, bool *, MemoryDataSize, SourceEndian);
-
-/* Crée un opérande visant un registre Dalvik. */
-GArchOperand *g_dalvik_register_operand_new_from_existing(GDalvikRegister *);
-
-/* Fournit le registre Dalvik associé à l'opérande. */
-const GDalvikRegister *g_dalvik_register_operand_get(const GDalvikRegisterOperand *);
-
-/* Marque l'opérande comme étant écrit plutôt que consulté. */
-void g_dalvik_register_operand_mark_as_written(GDalvikRegisterOperand *);
-
-/* Indique le type d'accès réalisé sur l'opérande. */
-bool g_dalvik_register_operand_is_written(const GDalvikRegisterOperand *);
-
-
-
-#endif /* _ARCH_DALVIK_OPERANDS_REGISTER_H */