summaryrefslogtreecommitdiff
path: root/src/analysis
diff options
context:
space:
mode:
Diffstat (limited to 'src/analysis')
-rw-r--r--src/analysis/binary.c34
-rw-r--r--src/analysis/binary.h3
2 files changed, 37 insertions, 0 deletions
diff --git a/src/analysis/binary.c b/src/analysis/binary.c
index f6f56c7..e004d4f 100644
--- a/src/analysis/binary.c
+++ b/src/analysis/binary.c
@@ -337,6 +337,7 @@ static void g_delayed_disassembly_process(GDelayedDisassembly *disass, GtkExtSta
static GRenderingLine *disassemble_binary_parts(GDelayedDisassembly *disass, GBinRoutine **routines, size_t count, GtkExtStatusBar *statusbar, guint id)
{
GRenderingLine *result; /* Ligne de rendu à retourner */
+ GArchInstruction *first; /* Première instruction vue */
GArchProcessor *proc; /* Architecture du binaire */
GRenderingOptions *options; /* Options de désassemblage */
bin_t *bin_data; /* Données binaires à lire */
@@ -356,6 +357,8 @@ static GRenderingLine *disassemble_binary_parts(GDelayedDisassembly *disass, GBi
result = NULL;
+ first = NULL;
+
proc = get_arch_processor_from_format(g_openida_binary_get_format(disass->binary));
options = g_openida_binary_get_options(disass->binary);
bin_data = g_openida_binary_get_data(disass->binary, NULL);
@@ -392,6 +395,7 @@ static GRenderingLine *disassemble_binary_parts(GDelayedDisassembly *disass, GBi
instr = g_arch_processor_decode_instruction(proc, &bin_data[start],
&pos, len, start, addr);
+ g_arch_instruction_add_to_list(&first, instr);
line = g_code_line_new(addr, instr, options);
g_rendering_line_add_to_lines(&result, line);
@@ -1305,8 +1309,38 @@ GRenderingLine *g_openida_binary_get_lines(const GOpenidaBinary *binary)
}
+/******************************************************************************
+* *
+* Paramètres : binary = élément binaire à consulter. *
+* *
+* Description : Fournit les instructions issues du désassemblage. *
+* *
+* Retour : Instructions issues du désassemblage. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+GArchInstruction *g_openida_binary_get_instructions(const GOpenidaBinary *binary)
+{
+ GArchInstruction *result; /* Liste à renvoyer */
+ GRenderingLine *iter; /* Boucle de parcours */
+
+ result = NULL;
+
+ for (iter = binary->lines;
+ iter != NULL;
+ iter = g_rendering_line_get_next_iter(binary->lines, iter, NULL))
+ {
+ if (!G_IS_CODE_LINE(iter)) break;
+ }
+
+ if (iter != NULL)
+ result = g_code_line_get_instruction(G_CODE_LINE(iter));
+ return result;
+
+}
diff --git a/src/analysis/binary.h b/src/analysis/binary.h
index 3869cae..da0bcf7 100644
--- a/src/analysis/binary.h
+++ b/src/analysis/binary.h
@@ -105,6 +105,9 @@ GRenderingLine **g_openida_binary_get_lines_root(const GOpenidaBinary *);
/* Fournit les lignes de rendu issues du désassemblage. */
GRenderingLine *g_openida_binary_get_lines(const GOpenidaBinary *);
+/* Fournit les instructions issues du désassemblage. */
+GArchInstruction *g_openida_binary_get_instructions(const GOpenidaBinary *);
+
/* ------------------------------ ELEMENTS DE DEBOGAGE ------------------------------ */