summaryrefslogtreecommitdiff
path: root/src/analysis
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2014-08-25 21:03:25 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2014-08-25 21:03:25 (GMT)
commit90a79bf4c2c21715e5ef9d8a370928d218c08784 (patch)
tree57afefc5caa098f4c34ac2d382d085f736245990 /src/analysis
parentdd51bdbc51abec252ad5169d722a8b6faa53c1ac (diff)
Loaded lots of ELF header information as symbols.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@393 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/analysis')
-rw-r--r--src/analysis/binary.h2
-rw-r--r--src/analysis/disass/fetch.c6
-rw-r--r--src/analysis/disass/output.c78
3 files changed, 78 insertions, 8 deletions
diff --git a/src/analysis/binary.h b/src/analysis/binary.h
index 2a7e7d9..17da200 100644
--- a/src/analysis/binary.h
+++ b/src/analysis/binary.h
@@ -116,7 +116,7 @@ void g_loaded_binary_set_storage(GLoadedBinary *, DBFeatures, DBStorage);
/* Trouve une collection assurant une fonctionnalité donnée. */
-GDbCollection *g_loaded_binary_find_collection(GLoadedBinary *, DBFeatures );
+GDbCollection *g_loaded_binary_find_collection(GLoadedBinary *, DBFeatures);
/* Demande l'intégration d'une modification dans une collection. */
bool g_loaded_binary_add_to_collection(GLoadedBinary *, DBFeatures, GDbItem *);
diff --git a/src/analysis/disass/fetch.c b/src/analysis/disass/fetch.c
index 9ef6f29..73474b3 100644
--- a/src/analysis/disass/fetch.c
+++ b/src/analysis/disass/fetch.c
@@ -189,8 +189,8 @@ GArchInstruction *disassemble_binary_content(const GLoadedBinary *binary, GtkExt
g_object_ref(G_OBJECT(instr));
border = g_arch_instruction_get_location2(instr, &length);
- length = 4;
-
+ // Utiliser : ???
+ // const vmpa2t *g_binary_symbol_get_address2(const GBinSymbol *symbol)
break;
@@ -218,8 +218,6 @@ GArchInstruction *disassemble_binary_content(const GLoadedBinary *binary, GtkExt
advance_vmpa(last, length);
- printf("length :: %d\n", length);
-
}
/* Raccord final ? */
diff --git a/src/analysis/disass/output.c b/src/analysis/disass/output.c
index 97f9989..927088f 100644
--- a/src/analysis/disass/output.c
+++ b/src/analysis/disass/output.c
@@ -25,6 +25,7 @@
#include "../../arch/processor.h"
+#include "../../common/extstr.h"
#include "../../decomp/lang/asm.h"
#include "../../format/format.h"
@@ -58,11 +59,42 @@ void print_disassembled_instructions(GCodeBuffer *buffer, const GExeFormat *form
vmpa_t end; /* Adresse de fin */
const GArchInstruction *iter; /* Boucle de parcours #1 */
size_t i; /* Boucle de parcours #2 */
- vmpa_t iaddr; /* Adresse d'instruction */
- vmpa_t raddr; /* Adresse de routine */
+ const vmpa2t *iaddr; /* Adresse d'instruction */
+ const vmpa2t *saddr; /* Adresse de symbole */
+
+ GBufferLine *line;
+
+
+ GBinSymbol **symbols; /* Symboles à représenter */
+ size_t sym_count; /* Qté de symboles présents */
+
+
+ size_t sym_index; /* Prochain symbole non traité */
+
+
+ GDbComment *comment; /* Commentaire à ajouter */
+
+
+
+ const char *text;
+
+ char *prefixed;
+
+
output = g_asm_output_new();
+
+ symbols = g_binary_format_get_symbols(format, &sym_count);
+
+ sym_index = 0;
+
+
+ //GDbCollection *g_loaded_binary_find_collection(GLoadedBinary *, DBFeatures);
+
+
+
+
proc = get_arch_processor_from_format(format);
msize = g_arch_processor_get_memory_size(proc);
@@ -90,7 +122,47 @@ void print_disassembled_instructions(GCodeBuffer *buffer, const GExeFormat *form
}
#endif
- g_arch_instruction_print(iter, buffer, msize, content, ASX_INTEL);
+
+
+
+ line = g_arch_instruction_print(iter, buffer, msize, content, ASX_INTEL);
+
+ if (sym_index < sym_count)
+ {
+ iaddr = g_arch_instruction_get_location2(iter, NULL);
+ saddr = g_binary_symbol_get_address2(symbols[sym_index]);
+
+ if (cmp_vmpa_by_phy(iaddr, saddr) == 0)
+ {
+
+
+ comment = g_binary_symbol_get_comment(symbols[sym_index]);
+
+ if (comment != NULL)
+ {
+
+ text = g_db_comment_get_text(comment);
+
+
+ prefixed = strdup("; ");
+ prefixed = stradd(prefixed, text);
+
+
+
+ g_buffer_line_insert_text(line, BLC_COMMENTS, prefixed, strlen(prefixed), RTT_COMMENT);
+
+
+ free(prefixed);
+
+ }
+
+ sym_index++;
+
+
+ }
+
+ }
+
//gtk_extended_status_bar_update_activity(statusbar, id, (iaddr - start) * 1.0 / (end - start));