diff options
Diffstat (limited to 'src/analysis')
-rw-r--r-- | src/analysis/binary.c | 6 | ||||
-rw-r--r-- | src/analysis/disass/disassembler.c | 87 | ||||
-rw-r--r-- | src/analysis/disass/disassembler.h | 5 | ||||
-rw-r--r-- | src/analysis/disass/output.c | 9 | ||||
-rw-r--r-- | src/analysis/disass/routines.c | 8 |
5 files changed, 48 insertions, 67 deletions
diff --git a/src/analysis/binary.c b/src/analysis/binary.c index f028cd6..15ec403 100644 --- a/src/analysis/binary.c +++ b/src/analysis/binary.c @@ -1624,6 +1624,7 @@ static bool g_loaded_binary_analyze(GLoadedBinary *binary, wgroup_id_t gid, GtkS GBinFormat *format; /* Format lié au binaire */ const char *arch; /* Architecture d'exécution */ const char *desc; /* Description humaine associée*/ + GProcContext *context; /* Contexte de suivi dédié */ /* Interprétation du format associé */ @@ -1657,10 +1658,13 @@ static bool g_loaded_binary_analyze(GLoadedBinary *binary, wgroup_id_t gid, GtkS g_loaded_binary_connect_internal(binary); - disassemble_binary(binary, gid, status, &binary->disass_cache); + disassemble_binary(binary, gid, status, &context); g_binary_format_complete_analysis(format, gid, status); + if (!is_batch_mode()) + output_disassembly(binary, context, status, &binary->disass_cache); + result = true; glba_exit: diff --git a/src/analysis/disass/disassembler.c b/src/analysis/disass/disassembler.c index efe50e1..0995b63 100644 --- a/src/analysis/disass/disassembler.c +++ b/src/analysis/disass/disassembler.c @@ -56,9 +56,6 @@ static void process_all_routines(wgroup_id_t, GtkStatusStack *, const char *, rt /* Réalise un désassemblage effectif. */ static void compute_disassembly(GLoadedBinary *, GProcContext *, wgroup_id_t, GtkStatusStack *); -/* Imprime le résultat d'un désassemblage. */ -static void output_disassembly(GLoadedBinary *, GProcContext *, GtkStatusStack *, GBufferCache **); - /****************************************************************************** @@ -339,6 +336,44 @@ static void compute_disassembly(GLoadedBinary *binary, GProcContext *context, wg /****************************************************************************** * * * Paramètres : binary = représentation de binaire chargé. * +* gid = groupe de travail dédié. * +* status = barre de statut à tenir informée. * +* context = contexte de désassemblage. [OUT] * +* * +* Description : Procède au désassemblage d'un contenu binaire donné. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +void disassemble_binary(GLoadedBinary *binary, wgroup_id_t gid, GtkStatusStack *status, GProcContext **context) +{ + GArchProcessor *proc; /* Architecture du binaire */ + + /* Préparatifs */ + + process_disassembly_event(PGA_DISASSEMBLY_STARTED, binary); + + proc = g_loaded_binary_get_processor(binary); + + *context = g_arch_processor_get_context(proc); + + g_object_unref(G_OBJECT(proc)); + + /* Lancement des opérations ! */ + + compute_disassembly(binary, *context, gid, status); + + process_disassembly_event(PGA_DISASSEMBLY_ENDED, binary); + +} + + +/****************************************************************************** +* * +* Paramètres : binary = représentation de binaire chargé. * * context = contexte de désassemblage utilisé. * * status = barre de statut à tenir informée. * * cache = tampon de code mis en place. [OUT] * @@ -351,7 +386,7 @@ static void compute_disassembly(GLoadedBinary *binary, GProcContext *context, wg * * ******************************************************************************/ -static void output_disassembly(GLoadedBinary *binary, GProcContext *context, GtkStatusStack *status, GBufferCache **cache) +void output_disassembly(GLoadedBinary *binary, GProcContext *context, GtkStatusStack *status, GBufferCache **cache) { GBinFormat *format; /* Format associé au binaire */ GBinContent *content; /* Contenu bianire manipulé */ @@ -428,50 +463,6 @@ static void output_disassembly(GLoadedBinary *binary, GProcContext *context, Gtk g_object_unref(G_OBJECT(content)); g_object_unref(G_OBJECT(format)); -} - - -/****************************************************************************** -* * -* Paramètres : binary = représentation de binaire chargé. * -* gid = groupe de travail dédié. * -* status = barre de statut à tenir informée. * -* cache = tampon de code mis en place. [OUT] * -* * -* Description : Procède au désassemblage d'un contenu binaire donné. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -void disassemble_binary(GLoadedBinary *binary, wgroup_id_t gid, GtkStatusStack *status, GBufferCache **cache) -{ - GArchProcessor *proc; /* Architecture du binaire */ - GProcContext *context; /* Contexte de suivi dédié */ - - /* Préparatifs */ - - process_disassembly_event(PGA_DISASSEMBLY_STARTED, binary); - - proc = g_loaded_binary_get_processor(binary); - - context = g_arch_processor_get_context(proc); - - /* Lancement des opérations ! */ - - compute_disassembly(binary, context, gid, status); - - process_disassembly_event(PGA_DISASSEMBLY_ENDED, binary); - - if (!is_batch_mode()) - output_disassembly(binary, context, status, cache); - - /* Nettoyage final et sortie ! */ - g_object_unref(G_OBJECT(context)); - g_object_unref(G_OBJECT(proc)); - } diff --git a/src/analysis/disass/disassembler.h b/src/analysis/disass/disassembler.h index 1adc9a1..87008c6 100644 --- a/src/analysis/disass/disassembler.h +++ b/src/analysis/disass/disassembler.h @@ -31,7 +31,10 @@ /* Procède au désassemblage d'un contenu binaire donné. */ -void disassemble_binary(GLoadedBinary *, wgroup_id_t, GtkStatusStack *, GBufferCache **); +void disassemble_binary(GLoadedBinary *, wgroup_id_t, GtkStatusStack *, GProcContext **); + +/* Imprime le résultat d'un désassemblage. */ +void output_disassembly(GLoadedBinary *, GProcContext *, GtkStatusStack *, GBufferCache **); diff --git a/src/analysis/disass/output.c b/src/analysis/disass/output.c index 9f532e6..73f5d3d 100644 --- a/src/analysis/disass/output.c +++ b/src/analysis/disass/output.c @@ -81,7 +81,6 @@ void print_disassembled_instructions(GBufferCache *cache, GCodingLanguage *lang, GBorderGenerator *border; /* Délimitation de routine */ const vmpa2t *paddr; /* Adresse de portion */ GLineGenerator *generator; /* Générateur de contenu ajouté*/ - SymbolStatus sym_status; /* Visibilité du symbole obtenu*/ const vmpa2t *saddr; /* Adresse de symbole */ int compared; /* Bilan d'une comparaison */ char *errmsg; /* Description d'une erreur */ @@ -214,14 +213,6 @@ void print_disassembled_instructions(GBufferCache *cache, GCodingLanguage *lang, for ( ; symbol != NULL; symbol = get_symbol_iterator_next(siter)) { - sym_status = g_binary_symbol_get_status(symbol); - - if (sym_status == SSS_IMPORTED) - { - g_object_unref(G_OBJECT(symbol)); - continue; - } - saddr = get_mrange_addr(g_binary_symbol_get_range(symbol)); compared = cmp_vmpa(iaddr, saddr); diff --git a/src/analysis/disass/routines.c b/src/analysis/disass/routines.c index 4393c6e..b1bc8c8 100644 --- a/src/analysis/disass/routines.c +++ b/src/analysis/disass/routines.c @@ -241,18 +241,12 @@ static void g_routines_study_process(GRoutinesStudy *study, GtkStatusStack *stat { size_t i; /* Boucle de parcours */ GBinSymbol *symbol; /* Commodité d'accès */ - SymbolStatus sym_status; /* Visibilité du symbole obtenu*/ SymbolType type; /* Type de symbole rencontré */ for (i = study->begin; i < study->end; i++) { symbol = g_binary_format_get_symbol(study->format, i); - sym_status = g_binary_symbol_get_status(symbol); - - if (sym_status == SSS_IMPORTED) - goto grsp_next; - type = g_binary_symbol_get_target_type(symbol); if (type == STP_ROUTINE || type == STP_ENTRY_POINT) @@ -260,8 +254,6 @@ static void g_routines_study_process(GRoutinesStudy *study, GtkStatusStack *stat gtk_status_stack_update_activity_value(status, study->id, 1); - grsp_next: - g_object_unref(G_OBJECT(symbol)); } |