summaryrefslogtreecommitdiff
path: root/src/analysis/disass
diff options
context:
space:
mode:
Diffstat (limited to 'src/analysis/disass')
-rw-r--r--src/analysis/disass/area.c21
-rw-r--r--src/analysis/disass/limit.c8
-rw-r--r--src/analysis/disass/limit.h4
-rw-r--r--src/analysis/disass/routines.c20
-rw-r--r--src/analysis/disass/routines.h1
5 files changed, 31 insertions, 23 deletions
diff --git a/src/analysis/disass/area.c b/src/analysis/disass/area.c
index 352069c..e19a4c0 100644
--- a/src/analysis/disass/area.c
+++ b/src/analysis/disass/area.c
@@ -32,7 +32,8 @@
#include <i18n.h>
-#include "../../analysis/contents/restricted.h"
+#include "../routine.h"
+#include "../contents/restricted.h"
#include "../../arch/raw.h"
#include "../../common/bits.h"
#include "../../common/sort.h"
@@ -654,27 +655,25 @@ static void update_address_as_routine(GBinFormat *format, const vmpa2t *addr)
if (!found || (found && wrong_type))
{
+ if (found)
+ g_binary_format_remove_symbol(format, symbol);
+
init_mrange(&range, addr, 0);
vmpa2_virt_to_string(addr, MDS_UNDEFINED, loc, NULL);
snprintf(name, sizeof(name), "sub_%s", loc + 2);
routine = g_binary_routine_new();
- g_binary_routine_set_name(routine, strdup(name));
+ symbol = G_BIN_SYMBOL(routine);
- g_binary_routine_set_range(routine, &range);
+ g_binary_routine_set_name(routine, strdup(name));
+ g_binary_symbol_set_range(symbol, &range);
- if (!found)
- {
- symbol = g_binary_symbol_new(STP_ROUTINE);
- g_binary_symbol_attach_routine(symbol, routine);
- g_binary_format_add_symbol(format, symbol);
- }
- else _g_binary_symbol_attach_routine(symbol, routine, STP_ROUTINE);
+ g_binary_format_add_symbol(format, symbol);
}
- if (found)
+ else
g_object_unref(G_OBJECT(symbol));
}
diff --git a/src/analysis/disass/limit.c b/src/analysis/disass/limit.c
index df9f23c..bcc594f 100644
--- a/src/analysis/disass/limit.c
+++ b/src/analysis/disass/limit.c
@@ -27,7 +27,7 @@
/******************************************************************************
* *
-* Paramètres : routine = routine dont les frontières sont à fixer. *
+* Paramètres : symbol = routine dont les frontières sont à fixer. *
* next = adresse du prochain symbole présent. *
* proc = ensemble d'instructions désassemblées. *
* portions = ensemble de couches binaires bornées. *
@@ -40,7 +40,7 @@
* *
******************************************************************************/
-void compute_routine_limit(GBinRoutine *routine, const vmpa2t *next, GArchProcessor *proc, GBinPortion *portions)
+void compute_routine_limit(GBinSymbol *symbol, const vmpa2t *next, GArchProcessor *proc, GBinPortion *portions)
{
const mrange_t *range; /* Emplacement courant */
vmpa2t addr; /* Adresse à conserver */
@@ -49,7 +49,7 @@ void compute_routine_limit(GBinRoutine *routine, const vmpa2t *next, GArchProces
GBinPortion *portion; /* Conteneur avec limites */
mrange_t new; /* Nouvel emplacement taillé */
- range = g_binary_routine_get_range(routine);
+ range = g_binary_symbol_get_range(symbol);
if (get_mrange_length(range) > 0) goto crl_skip;
copy_vmpa(&addr, get_mrange_addr(range));
@@ -91,7 +91,7 @@ void compute_routine_limit(GBinRoutine *routine, const vmpa2t *next, GArchProces
init_mrange(&new, &addr, diff);
- g_binary_routine_set_range(routine, &new);
+ g_binary_symbol_set_range(symbol, &new);
crl_skip:
diff --git a/src/analysis/disass/limit.h b/src/analysis/disass/limit.h
index c26b450..ce76a43 100644
--- a/src/analysis/disass/limit.h
+++ b/src/analysis/disass/limit.h
@@ -25,14 +25,14 @@
#define _ANALYSIS_DISASS_LIMIT_H
-#include "../routine.h"
#include "../../arch/processor.h"
#include "../../format/executable.h"
+#include "../../format/symbol.h"
/* S'assure qu'une routine est bien bornée. */
-void compute_routine_limit(GBinRoutine *, const vmpa2t *, GArchProcessor *, GBinPortion *);
+void compute_routine_limit(GBinSymbol *, const vmpa2t *, GArchProcessor *, GBinPortion *);
diff --git a/src/analysis/disass/routines.c b/src/analysis/disass/routines.c
index 1150f08..5d6dc42 100644
--- a/src/analysis/disass/routines.c
+++ b/src/analysis/disass/routines.c
@@ -231,14 +231,16 @@ 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 */
+ GBinSymbol *symbol; /* Commodité d'accès */
+ SymbolType type; /* Type de symbole rencontré */
for (i = study->begin; i < study->end; i++)
{
- routine = g_binary_symbol_get_routine(study->symbols[i]);
+ symbol = study->symbols[i];
+ type = g_binary_symbol_get_target_type(symbol);
- if (routine != NULL)
- study->fallback(study, routine, i);
+ if (type == STP_ROUTINE || type == STP_ENTRY_POINT)
+ study->fallback(study, G_BIN_ROUTINE(symbol), i);
gtk_status_stack_update_activity_value(status, study->id, 1);
@@ -263,9 +265,12 @@ static void g_routines_study_process(GRoutinesStudy *study, GtkStatusStack *stat
void g_routines_study_compute_limits(GRoutinesStudy *study, GBinRoutine *routine, size_t index)
{
+ GBinSymbol *symbol; /* Version alternative */
const mrange_t *range; /* Zone du symbole suivant */
const vmpa2t *next; /* Début de la zone suivante */
+ symbol = G_BIN_SYMBOL(routine);
+
if ((index + 1) < study->count)
{
range = g_binary_symbol_get_range(study->symbols[index + 1]);
@@ -275,7 +280,7 @@ void g_routines_study_compute_limits(GRoutinesStudy *study, GBinRoutine *routine
else
next = NULL;
- compute_routine_limit(routine, next, study->proc, study->portions);
+ compute_routine_limit(symbol, next, study->proc, study->portions);
}
@@ -296,6 +301,7 @@ void g_routines_study_compute_limits(GRoutinesStudy *study, GBinRoutine *routine
void g_routines_study_handle_blocks(GRoutinesStudy *study, GBinRoutine *routine, size_t index)
{
+ GBinSymbol *symbol; /* Version alternative */
const mrange_t *range; /* Couverture d'une routine */
const vmpa2t *start; /* Adresse de départ */
const instr_coverage *coverage; /* Instructions couvertes */
@@ -304,7 +310,9 @@ void g_routines_study_handle_blocks(GRoutinesStudy *study, GBinRoutine *routine,
/* Préparatifs communs */
- range = g_binary_routine_get_range(routine);
+ symbol = G_BIN_SYMBOL(routine);
+
+ range = g_binary_symbol_get_range(symbol);
start = get_mrange_addr(range);
coverage = g_arch_processor_find_coverage_by_address(study->proc, start);
diff --git a/src/analysis/disass/routines.h b/src/analysis/disass/routines.h
index dc81bb1..4b3efa9 100644
--- a/src/analysis/disass/routines.h
+++ b/src/analysis/disass/routines.h
@@ -25,6 +25,7 @@
#define _ANALYSIS_DISASS_ROUTINES_H
+#include "../routine.h"
#include "../../arch/processor.h"
#include "../../format/executable.h"
#include "../../format/symbol.h"