summaryrefslogtreecommitdiff
path: root/src/analysis/decomp/decompiler.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2012-07-29 21:41:52 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2012-07-29 21:41:52 (GMT)
commit8e1f2335773a9025cd46d45a33261725707af3ba (patch)
tree6001a1095985514bbde3c8ec49b4dd5d32182fc8 /src/analysis/decomp/decompiler.c
parent8b35a66464636d0c46237af7490a6ca6866ecc4d (diff)
Updated all decompiled instructions using right pseudo registers.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@253 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/analysis/decomp/decompiler.c')
-rw-r--r--src/analysis/decomp/decompiler.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/analysis/decomp/decompiler.c b/src/analysis/decomp/decompiler.c
index b144846..24cd242 100644
--- a/src/analysis/decomp/decompiler.c
+++ b/src/analysis/decomp/decompiler.c
@@ -130,16 +130,19 @@ static void build_decomp_prologue(GCodeBuffer *buffer, const char *filename)
static void prepare_all_routines_for_decomp(const GOpenidaBinary *binary, const char *filename)
{
GExeFormat *format; /* Format du binaire fourni */
+ GArchProcessor *proc; /* Architecture du binaire */
GBinRoutine **routines;
size_t count;
size_t i;
+ GDecContext *context; /* Contexte pour la décompil. */
GDecInstruction *instr;
format = g_openida_binary_get_format(binary);
-
+ proc = get_arch_processor_from_format(G_EXE_FORMAT(format));
+
routines = g_binary_format_get_routines(G_BIN_FORMAT(format), &count);
@@ -147,16 +150,14 @@ static void prepare_all_routines_for_decomp(const GOpenidaBinary *binary, const
for (i = 0; i < count; i++)
{
- printf(" -- %s --\n", g_binary_routine_get_name(routines[i]));
+ context = g_arch_processor_get_decomp_context(proc);
- //if (strcmp("fib2", g_binary_routine_get_name(routines[i])) == 0)
- {
-
- printf("...\n");
+ printf(" -- %s --\n", g_binary_routine_get_name(routines[i]));
- instr = g_binary_format_decompile_routine(G_BIN_FORMAT(format), routines[i]);
+ instr = g_binary_format_decompile_routine(G_BIN_FORMAT(format), routines[i], context);
- }
+ if (context != NULL)
+ g_object_unref(context);
}