summaryrefslogtreecommitdiff
path: root/src/analysis/disass/routines.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/analysis/disass/routines.c')
-rw-r--r--src/analysis/disass/routines.c43
1 files changed, 24 insertions, 19 deletions
diff --git a/src/analysis/disass/routines.c b/src/analysis/disass/routines.c
index 32a2259..1150f08 100644
--- a/src/analysis/disass/routines.c
+++ b/src/analysis/disass/routines.c
@@ -41,7 +41,7 @@ struct _GRoutinesStudy
GBinPortion *portions; /* Couches de binaire bornées */
- GBinRoutine **routines; /* Liste de routines à traiter */
+ GBinSymbol **symbols; /* Liste de symboles à traiter */
size_t count; /* Taille de cette liste */
rtn_fallback_cb fallback; /* Routine de traitement finale*/
@@ -175,7 +175,7 @@ static void g_routines_study_finalize(GRoutinesStudy *study)
* *
* Paramètres : proc = ensemble d'instructions désassemblées. *
* portions = ensemble de couches binaires bornées. *
-* routines = prototypes existants à insérer. *
+* symbols = liste de symboles à parcourir. *
* count = quantité de ces prototypes. *
* begin = point de départ du parcours de liste. *
* end = point d'arrivée exclu du parcours. *
@@ -190,7 +190,7 @@ static void g_routines_study_finalize(GRoutinesStudy *study)
* *
******************************************************************************/
-GRoutinesStudy *g_routines_study_new(GArchProcessor *proc, GBinPortion *portions, GBinRoutine **routines, size_t count, size_t begin, size_t end, activity_id_t id, rtn_fallback_cb fallback)
+GRoutinesStudy *g_routines_study_new(GArchProcessor *proc, GBinPortion *portions, GBinSymbol **symbols, size_t count, size_t begin, size_t end, activity_id_t id, rtn_fallback_cb fallback)
{
GRoutinesStudy *result; /* Tâche à retourner */
@@ -201,7 +201,7 @@ GRoutinesStudy *g_routines_study_new(GArchProcessor *proc, GBinPortion *portions
result->portions = portions;
g_object_ref(G_OBJECT(portions));
- result->routines = routines;
+ result->symbols = symbols;
result->count = count;
result->fallback = fallback;
@@ -231,10 +231,14 @@ GRoutinesStudy *g_routines_study_new(GArchProcessor *proc, GBinPortion *portions
static void g_routines_study_process(GRoutinesStudy *study, GtkStatusStack *status)
{
size_t i; /* Boucle de parcours */
+ GBinRoutine *routine; /* Routine à traiter */
for (i = study->begin; i < study->end; i++)
{
- study->fallback(study, i);
+ routine = g_binary_symbol_get_routine(study->symbols[i]);
+
+ if (routine != NULL)
+ study->fallback(study, routine, i);
gtk_status_stack_update_activity_value(status, study->id, 1);
@@ -245,8 +249,9 @@ static void g_routines_study_process(GRoutinesStudy *study, GtkStatusStack *stat
/******************************************************************************
* *
-* Paramètres : study = étude de routines à mener. *
-* index = indice de l'insruction visée. *
+* Paramètres : study = étude de routines à mener. *
+* routine = routine à traiter. *
+* index = indice de l'insruction visée. *
* *
* Description : Détermine si besoin est les bornes des routines. *
* *
@@ -256,15 +261,17 @@ static void g_routines_study_process(GRoutinesStudy *study, GtkStatusStack *stat
* *
******************************************************************************/
-void g_routines_study_compute_limits(GRoutinesStudy *study, size_t index)
+void g_routines_study_compute_limits(GRoutinesStudy *study, GBinRoutine *routine, size_t index)
{
- GBinRoutine *routine; /* Routine à traiter */
- GBinRoutine *next; /* Routine suivante éventuelle */
-
- routine = study->routines[index];
+ const mrange_t *range; /* Zone du symbole suivant */
+ const vmpa2t *next; /* Début de la zone suivante */
if ((index + 1) < study->count)
- next = study->routines[index + 1];
+ {
+ range = g_binary_symbol_get_range(study->symbols[index + 1]);
+ next = get_mrange_addr(range);
+ }
+
else
next = NULL;
@@ -275,8 +282,9 @@ void g_routines_study_compute_limits(GRoutinesStudy *study, size_t index)
/******************************************************************************
* *
-* Paramètres : study = étude de routines à mener. *
-* index = indice de l'insruction visée. *
+* Paramètres : study = étude de routines à mener. *
+* routine = routine à traiter. *
+* index = indice de l'insruction visée. *
* *
* Description : Procède au traitement des blocs de routines. *
* *
@@ -286,17 +294,14 @@ void g_routines_study_compute_limits(GRoutinesStudy *study, size_t index)
* *
******************************************************************************/
-void g_routines_study_handle_blocks(GRoutinesStudy *study, size_t index)
+void g_routines_study_handle_blocks(GRoutinesStudy *study, GBinRoutine *routine, size_t index)
{
- GBinRoutine *routine; /* Routine à traiter */
const mrange_t *range; /* Couverture d'une routine */
const vmpa2t *start; /* Adresse de départ */
const instr_coverage *coverage; /* Instructions couvertes */
dragon_knight *knight; /* Complexité de code posée */
GBlockList *blocks; /* Liste de blocs basiques */
- routine = study->routines[index];
-
/* Préparatifs communs */
range = g_binary_routine_get_range(routine);