diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2012-07-01 11:52:52 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2012-07-01 11:52:52 (GMT) |
commit | 5dcd05f19ac62f6ff922176cd0ae6f8839910f2e (patch) | |
tree | 6fbf5798a57ab6874b68b6ea523619481013c814 /src/analysis | |
parent | 51dff92af8ca82ac1cce3f74be70c3705ca88683 (diff) |
Built the graph view when defining a target address.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@247 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/analysis')
-rw-r--r-- | src/analysis/binary.c | 20 | ||||
-rw-r--r-- | src/analysis/disass/disassembler.c | 5 | ||||
-rw-r--r-- | src/analysis/disass/disassembler.h | 4 |
3 files changed, 9 insertions, 20 deletions
diff --git a/src/analysis/binary.c b/src/analysis/binary.c index 53da917..45e6d31 100644 --- a/src/analysis/binary.c +++ b/src/analysis/binary.c @@ -96,6 +96,7 @@ struct _GOpenidaBinary GRenderingLine *lines; /* Lignes de rendu en place */ GRenderingOptions *options; /* Options de désassemblage */ + GArchInstruction *instrs; /* Instructions d'assemblage */ GCodeBuffer *disass_buffer; /* Instructions lisibles */ GCodeBuffer **dec_buffers; /* Sources sous forme de texte */ size_t decbuf_count; /* Taille des tableaux */ @@ -834,7 +835,7 @@ void g_openida_binary_analyse(GOpenidaBinary *binary) } } - binary->disass_buffer = disassemble_binary(binary, parts, parts_count); + binary->disass_buffer = disassemble_binary(binary, parts, parts_count, &binary->instrs); /* TODO : remme ! */ ack_completed_disassembly(NULL, binary); @@ -993,22 +994,7 @@ GRenderingLine *g_openida_binary_get_lines(const GOpenidaBinary *binary) 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; + return binary->instrs; } diff --git a/src/analysis/disass/disassembler.c b/src/analysis/disass/disassembler.c index c270389..5a866c0 100644 --- a/src/analysis/disass/disassembler.c +++ b/src/analysis/disass/disassembler.c @@ -368,6 +368,7 @@ static void build_disass_prologue(GCodeBuffer *buffer, const char *filename, con * Paramètres : binary = représentation de binaire chargé. * * parts = parties binaires à désassembler. * * count = nombre de parties à traiter. * +* instrs = liste des instructions chargées. [OUT] * * * * Description : Procède au désassemblage d'un contenu binaire donné. * * * @@ -377,7 +378,7 @@ static void build_disass_prologue(GCodeBuffer *buffer, const char *filename, con * * ******************************************************************************/ -GCodeBuffer *disassemble_binary(const GOpenidaBinary *binary, GBinPart **parts, size_t parts_count) +GCodeBuffer *disassemble_binary(const GOpenidaBinary *binary, GBinPart **parts, size_t parts_count, GArchInstruction **instrs) { GCodeBuffer *result; /* Tampon constitué à renvoyer */ const uint8_t *data; /* Données binaires brutes */ @@ -397,6 +398,8 @@ GCodeBuffer *disassemble_binary(const GOpenidaBinary *binary, GBinPart **parts, g_delayed_work_wait_for_completion(G_DELAYED_WORK(disass)); + *instrs = disass->instrs; + g_object_unref(G_OBJECT(disass)); return result; diff --git a/src/analysis/disass/disassembler.h b/src/analysis/disass/disassembler.h index 7cfdcc5..2a0f72a 100644 --- a/src/analysis/disass/disassembler.h +++ b/src/analysis/disass/disassembler.h @@ -2,7 +2,7 @@ /* OpenIDA - Outil d'analyse de fichiers binaires * disassembler.h - prototypes pour l'encadrement des phases de désassemblage * - * Copyright (C) 2010 Cyrille Bagard + * Copyright (C) 2010-2012 Cyrille Bagard * * This file is part of OpenIDA. * @@ -31,7 +31,7 @@ /* Procède à la décompilation des routines d'un fichier donné. */ -GCodeBuffer *disassemble_binary(const GOpenidaBinary *, GBinPart **parts, size_t parts_count); +GCodeBuffer *disassemble_binary(const GOpenidaBinary *, GBinPart **parts, size_t parts_count, GArchInstruction **); |