diff options
Diffstat (limited to 'src/analysis/disass')
| -rw-r--r-- | src/analysis/disass/fetch.c | 6 | ||||
| -rw-r--r-- | src/analysis/disass/output.c | 78 | 
2 files changed, 77 insertions, 7 deletions
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));  | 
