summaryrefslogtreecommitdiff
path: root/src/analysis/routine.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2010-12-02 00:59:53 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2010-12-02 00:59:53 (GMT)
commit957f50b657456c4c7da2778197c144548eded8cd (patch)
tree9aea0e8ffb4dc62b23fd324b55910916cef95167 /src/analysis/routine.c
parentf2d479c16a427696790441fa1459e7194f49bb6a (diff)
Improved the rendering of decompiled Dex code.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@196 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/analysis/routine.c')
-rw-r--r--src/analysis/routine.c61
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);
+
+ }
+
+}