summaryrefslogtreecommitdiff
path: root/src/analysis
diff options
context:
space:
mode:
Diffstat (limited to 'src/analysis')
-rw-r--r--src/analysis/disass/disassembler.c28
-rw-r--r--src/analysis/disass/fetch.c20
2 files changed, 48 insertions, 0 deletions
diff --git a/src/analysis/disass/disassembler.c b/src/analysis/disass/disassembler.c
index 283914e..046f936 100644
--- a/src/analysis/disass/disassembler.c
+++ b/src/analysis/disass/disassembler.c
@@ -38,6 +38,9 @@
#include "../../decomp/lang/asm.h"
#include "../../format/format.h"
#include "../../glibext/delayed-int.h"
+#ifdef DEBUG
+# include "../../panels/log.h"
+#endif
@@ -196,6 +199,13 @@ static GDelayedDisassembly *g_delayed_disassembly_new(const GOpenidaBinary *bina
static void g_delayed_disassembly_process(GDelayedDisassembly *disass, GtkExtStatusBar *statusbar)
{
+#ifdef DEBUG
+ unsigned int valid; /* Instructions traduites */
+ unsigned int db; /* Instructions non décodées */
+ unsigned int valid_sum; /* Instructions traduites */
+ unsigned int instr_sum; /* Instructions totales */
+ size_t i; /* Boucle de parcours */
+#endif
GBinRoutine **routines; /* Liste des routines trouvées */
size_t routines_count; /* Nombre de ces routines */
guint id; /* Identifiant de statut */
@@ -211,6 +221,24 @@ static void g_delayed_disassembly_process(GDelayedDisassembly *disass, GtkExtSta
gtk_extended_status_bar_remove(statusbar, id);
+#ifdef DEBUG
+
+ valid_sum = 0;
+ instr_sum = 0;
+
+ for (i = 0; i < disass->count; i++)
+ {
+ g_binary_part_get_checkup(disass->parts[i], &valid, &db);
+ valid_sum += valid;
+ instr_sum += (valid + db);
+ }
+
+ log_variadic_message(LMT_WARNING, _("Disassembled instructions : %u %% (%u / %d)"),
+ (valid_sum * 100) / instr_sum,
+ valid_sum, instr_sum);
+
+#endif
+
/* Seconde étape */
id = gtk_extended_status_bar_push(statusbar, _("Establishing links..."), true);
diff --git a/src/analysis/disass/fetch.c b/src/analysis/disass/fetch.c
index 575eb06..5f93eba 100644
--- a/src/analysis/disass/fetch.c
+++ b/src/analysis/disass/fetch.c
@@ -23,6 +23,10 @@
#include "fetch.h"
+#ifdef DEBUG
+# include "../../arch/artificial.h"
+#endif
+
/******************************************************************************
@@ -50,6 +54,10 @@ GArchInstruction *disassemble_binary_parts(const GOpenidaBinary *binary, GBinPar
size_t i; /* Boucle de parcours #1 */
off_t sum; /* Somme de toutes les tailles */
off_t done; /* Quantité déjà traitée */
+#ifdef DEBUG
+ unsigned int valid; /* Instructions traduites */
+ unsigned int db; /* Instructions non décodées */
+#endif
off_t pos; /* Début d'une zone binaire */
off_t len; /* Taille de cette même zone */
vmpa_t base; /* Adresse de la zone binaire */
@@ -83,6 +91,11 @@ GArchInstruction *disassemble_binary_parts(const GOpenidaBinary *binary, GBinPar
/* Décodage des instructions */
+#ifdef DEBUG
+ valid = 0;
+ db = 0;
+#endif
+
start = pos;
pos = 0;
@@ -94,11 +107,18 @@ GArchInstruction *disassemble_binary_parts(const GOpenidaBinary *binary, GBinPar
&pos, len, start, addr);
g_arch_instruction_add_to_list(&result, instr);
+#ifdef DEBUG
+ if (G_IS_DB_INSTRUCTION(instr)) db++;
+ else valid++;
+#endif
+
if (pos < len)
gtk_extended_status_bar_update_activity(statusbar, id, (done + pos) * 1.0 / sum);
}
+ g_binary_part_set_checkup(parts[i], valid, db);
+
done += len;
gtk_extended_status_bar_update_activity(statusbar, id, done * 1.0 / sum);