summaryrefslogtreecommitdiff
path: root/src/analysis
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2014-12-14 23:32:23 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2014-12-14 23:32:23 (GMT)
commita1c2bc0c3b6f4b4fda9c50beeb09a1f699419e2a (patch)
tree7856d9bc8fd702d0499f8a09156a555406eaaea9 /src/analysis
parent16d37d997b84c75c1f9b877fe446b3b3e5ce2495 (diff)
Shown label of loaded symbols when possible.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@441 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/analysis')
-rw-r--r--src/analysis/disass/output.c60
1 files changed, 58 insertions, 2 deletions
diff --git a/src/analysis/disass/output.c b/src/analysis/disass/output.c
index 2007f48..97924cd 100644
--- a/src/analysis/disass/output.c
+++ b/src/analysis/disass/output.c
@@ -80,6 +80,9 @@ void print_disassembled_instructions(GCodeBuffer *buffer, const GExeFormat *form
const vmpa2t *paddr; /* Adresse de portion */
+
+ const char *label; /* Etiquette ciblant un symbole*/
+
GDbComment *comment; /* Commentaire à ajouter */
@@ -89,7 +92,6 @@ void print_disassembled_instructions(GCodeBuffer *buffer, const GExeFormat *form
char *prefixed;
-
output = g_asm_output_new();
@@ -100,8 +102,20 @@ void print_disassembled_instructions(GCodeBuffer *buffer, const GExeFormat *form
symbols = g_binary_format_get_symbols(format, &sym_count);
sym_index = 0;
+#if 0
+ for (i = 0; i < sym_count; i++)
+ {
+ saddr = get_mrange_addr(g_binary_symbol_get_range(symbols[i]));
+ if (saddr == NULL) continue;
+
+ //if (g_binary_symbol_to_string(symbols[i]) == NULL) continue;
+ printf(" <symbol> '%s' -> 0x%08lx\n",
+ "g_binary_symbol_to_string(symbols[i])",
+ saddr->virtual);
+ }
+#endif
//GDbCollection *g_loaded_binary_find_collection(GLoadedBinary *, DBFeatures);
@@ -157,6 +171,39 @@ void print_disassembled_instructions(GCodeBuffer *buffer, const GExeFormat *form
+
+ if (sym_index < sym_count)
+ {
+ iaddr = get_mrange_addr(g_arch_instruction_get_range(iter));
+ saddr = get_mrange_addr(g_binary_symbol_get_range(symbols[sym_index]));
+
+ if (cmp_vmpa_by_virt(iaddr, saddr) == 0)
+ {
+ /* Etiquette ? */
+
+ label = g_binary_symbol_get_label(symbols[sym_index]);
+
+ if (label != NULL)
+ {
+ line = g_code_buffer_append_new_line(buffer, g_binary_symbol_get_range(symbols[sym_index]));
+ g_buffer_line_fill_mrange(line, msize, msize);
+
+ g_buffer_line_start_merge_at(line, BLC_ASSEMBLY_HEAD);
+ g_buffer_line_insert_text(line, BLC_ASSEMBLY_HEAD, label, strlen(label), RTT_COMMENT);
+ g_buffer_line_insert_text(line, BLC_ASSEMBLY_HEAD, ":", 1, RTT_PUNCT);
+
+
+ }
+
+ }
+
+ }
+
+
+
+
+
+
line = g_arch_instruction_print(iter, buffer, msize, content, ASX_INTEL);
if (sym_index < sym_count)
@@ -164,9 +211,18 @@ void print_disassembled_instructions(GCodeBuffer *buffer, const GExeFormat *form
iaddr = get_mrange_addr(g_arch_instruction_get_range(iter));
saddr = get_mrange_addr(g_binary_symbol_get_range(symbols[sym_index]));
- if (cmp_vmpa_by_phy(iaddr, saddr) == 0)
+ /*
+ if (saddr->virtual == 0x8590)
{
+ printf("instr = 0x%08x sym = 0x%08x\n", iaddr->virtual, saddr->virtual);
+ printf("COMP :: %d\n", cmp_vmpa_by_virt(iaddr, saddr));
+ if (cmp_vmpa_by_virt(iaddr, saddr) == 0) exit(0);
+ }
+ */
+ if (cmp_vmpa_by_virt(iaddr, saddr) == 0)
+ {
+ /* Commentaire ? */
comment = g_binary_symbol_get_comment(symbols[sym_index]);