diff options
Diffstat (limited to 'src/analysis/routine.c')
-rw-r--r-- | src/analysis/routine.c | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/src/analysis/routine.c b/src/analysis/routine.c index ad82407..fd3d206 100644 --- a/src/analysis/routine.c +++ b/src/analysis/routine.c @@ -857,3 +857,64 @@ void g_binary_routine_set_decomp_instructions(GBinRoutine *routine, GDecInstruct routine->dinstr = instr; } + + +/****************************************************************************** +* * +* Paramètres : routine = routine à mettre à jour. * +* lang = langage à utiliser pour la sortie humaine. * +* buffer = tampon mis à disposition pour la sortie. * +* body = indique le type d'impression attendu. * +* * +* Description : Procède à l'impression de la décompilation d'une routine. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +void g_binary_routine_print_code(const GBinRoutine *routine, GLangOutput *lang, GCodeBuffer *buffer, bool body) +{ + GBufferLine *line; /* Adresse d'une ligne nouvelle*/ + const char *name; /* Nom humain de la routine */ + size_t len; /* Taille de ce nom */ + + /* Type de retour */ + + line = g_lang_output_start_routine_prototype(lang, buffer, routine->ret_type); + + g_buffer_line_insert_text(line, BLC_ASSEMBLY_HEAD, " ", 1, RTT_RAW); + + /* Nom de la routine */ + + name = g_binary_routine_get_name(routine); + if (name != NULL) len = strlen(name); + else + { + name = "???"; + len = 3; + } + + g_buffer_line_insert_text(line, BLC_ASSEMBLY_HEAD, name, len, RTT_RAW); + + + + + /* Corps de la routine ? */ + + if (!body) + g_lang_output_end_routine_prototype(lang, buffer, line); + + else + { + g_lang_output_start_routine_body(lang, buffer, line); + + if (routine->dinstr != NULL) + g_dec_instruction_print(routine->dinstr, buffer, NULL, lang); + + g_lang_output_end_routine_body(lang, buffer); + + } + +} |