summaryrefslogtreecommitdiff
path: root/src/analysis/routine.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/analysis/routine.c')
-rw-r--r--src/analysis/routine.c120
1 files changed, 37 insertions, 83 deletions
diff --git a/src/analysis/routine.c b/src/analysis/routine.c
index c916c66..b882428 100644
--- a/src/analysis/routine.c
+++ b/src/analysis/routine.c
@@ -45,8 +45,6 @@ struct _GBinRoutine
{
GBinSymbol parent; /* A laisser en premier */
- mrange_t range; /* Couverture mémoire */
-
RoutineType type; /* Type de routine */
GDataType *ret_type; /* Type retourné */
@@ -88,6 +86,9 @@ static void g_bin_routine_init(GBinRoutine *);
/* Vide le cache des descriptions humaines. */
static void g_binary_routine_reset_declarator(GBinRoutine *, bool);
+/* Fournit une étiquette pour viser une routine. */
+static const char *g_binary_routine_get_label(GBinRoutine *);
+
/* Indique le type définit pour une représentation de routine. */
@@ -108,6 +109,11 @@ G_DEFINE_TYPE(GBinRoutine, g_bin_routine, G_TYPE_BIN_SYMBOL);
static void g_bin_routine_class_init(GBinRoutineClass *klass)
{
+ GBinSymbolClass *symbol; /* Autre version de la classe */
+
+ symbol = G_BIN_SYMBOL_CLASS(klass);
+
+ symbol->get_label = (get_symbol_label_fc)g_binary_routine_get_label;
}
@@ -126,6 +132,11 @@ static void g_bin_routine_class_init(GBinRoutineClass *klass)
static void g_bin_routine_init(GBinRoutine *routine)
{
+ GBinSymbol *symbol; /* Autre version de l'instance */
+
+ symbol = G_BIN_SYMBOL(routine);
+
+ g_binary_symbol_set_target_type(symbol, STP_ROUTINE);
}
@@ -212,85 +223,6 @@ void g_binary_routine_finalize(GBinRoutine *routine)
/******************************************************************************
* *
-* Paramètres : a = premières informations à consulter. *
-* b = secondes informations à consulter. *
-* *
-* Description : Etablit la comparaison ascendante entre deux routines. *
-* *
-* Retour : Bilan : -1 (a < b), 0 (a == b) ou 1 (a > b). *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-int g_binary_routine_compare(const GBinRoutine **a, const GBinRoutine **b)
-{
- return cmp_mrange(&(*a)->range, &(*b)->range);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : a = premières informations à consulter. *
-* b = secondes informations à consulter. *
-* *
-* Description : Etablit la comparaison descendante entre deux routines. *
-* *
-* Retour : Bilan : 1 (a < b), 0 (a == b) ou -1 (a > b). *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-int g_binary_routine_rcompare(const GBinRoutine **a, const GBinRoutine **b)
-{
- return (-1) * cmp_mrange(&(*a)->range, &(*b)->range);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : routine = routine à mettre à jour. *
-* range = plage mémoire ou physique déclarée. *
-* *
-* Description : Définit la couverture physique / en mémoire d'une routine. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void g_binary_routine_set_range(GBinRoutine *routine, const mrange_t *range)
-{
- copy_mrange(&routine->range, range);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : routine = routine à consulter. *
-* *
-* Description : Fournit la couverture physique / en mémoire d'une routine. *
-* *
-* Retour : Plage mémoire ou physique déclarée. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-const mrange_t *g_binary_routine_get_range(const GBinRoutine *routine)
-{
- return &routine->range;
-
-}
-
-
-/******************************************************************************
-* *
* Paramètres : routine = routine à mettre à jour. *
* type = type de routine spécifié. *
* *
@@ -699,6 +631,25 @@ const char *g_binary_routine_get_declarator(GBinRoutine *routine, bool full)
/******************************************************************************
* *
+* Paramètres : routine = routine à manipuler. *
+* *
+* Description : Fournit une étiquette pour viser une routine. *
+* *
+* Retour : Désignation humainement lisible ou NULL si non définie. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static const char *g_binary_routine_get_label(GBinRoutine *routine)
+{
+ return g_binary_routine_get_declarator(routine, false);
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : routine = routine à mettre à jour. *
* offset = position abstraite à retrouver. *
* local = indique le type de variable à manipuler. *
@@ -1125,6 +1076,7 @@ char *g_binary_routine_build_tooltip(const GBinRoutine *routine, const GLoadedBi
char *string_info; /* Détails des chaînes */
GArchProcessor *proc; /* Architecture utilisée */
GBufferCache *cache; /* Tampon de désassemblage */
+ const mrange_t *srange; /* Couverture de la routine */
instr_iter_t *iter; /* Parcours local d'adresses */
GArchInstruction *instr; /* Instruction correspondante */
size_t dcount; /* Nombre de liens de dest. */
@@ -1163,10 +1115,12 @@ char *g_binary_routine_build_tooltip(const GBinRoutine *routine, const GLoadedBi
/* Parcours des instructions */
- iter = g_arch_processor_get_iter_from_address(proc, get_mrange_addr(&routine->range));
+ srange = g_binary_symbol_get_range(G_BIN_SYMBOL(routine));
+
+ iter = g_arch_processor_get_iter_from_address(proc, get_mrange_addr(srange));
if (iter == NULL) goto gbrbt_no_iter;
- restrict_instruction_iterator(iter, &routine->range);
+ restrict_instruction_iterator(iter, srange);
for (instr = get_instruction_iterator_current(iter);
instr != NULL;