diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2013-01-17 22:21:03 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2013-01-17 22:21:03 (GMT) |
commit | a9bbd894bd25f7c2bb72fb7d4064b19377d90c6d (patch) | |
tree | d430c135864caa960c71ed86c5713507de66f708 /src/arch/dalvik | |
parent | 2ab78407e9f73b6508afc281400a7c3fc018217f (diff) |
Forked the decompilation context when needed.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@325 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/arch/dalvik')
-rw-r--r-- | src/arch/dalvik/context.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/arch/dalvik/context.c b/src/arch/dalvik/context.c index f1af7e9..e80ead3 100644 --- a/src/arch/dalvik/context.c +++ b/src/arch/dalvik/context.c @@ -120,6 +120,9 @@ static void g_dalvik_dcontext_dispose(GDalvikDContext *); /* Procède à la libération totale de la mémoire. */ static void g_dalvik_dcontext_finalize(GDalvikDContext *); +/* Duplique un contexte de compilation. */ +static GDalvikDContext *g_dalvik_dcontext_dup(GDalvikDContext *); + /* Convertit un registre machine en un pseudo-registre. */ static GDecInstruction *g_dalvik_dcontext_convert_register(GDalvikDContext *, GDalvikRegisterOperand *, bool); @@ -331,6 +334,7 @@ static void g_dalvik_dcontext_init(GDalvikDContext *ctx) parent = G_DEC_CONTEXT(ctx); + parent->dup = (dup_dec_context_fc)g_dalvik_dcontext_dup; parent->convert_reg = (convert_register_fc)g_dalvik_dcontext_convert_register; } @@ -402,6 +406,43 @@ GDalvikDContext *g_dalvik_dcontext_new(void) /****************************************************************************** * * +* Paramètres : orig = contexte de compilation à copier. * +* * +* Description : Duplique un contexte de compilation. * +* * +* Retour : Contexte de décompilation prêt à emploi. * +* * +* Remarques : - * +* * +******************************************************************************/ + +static GDalvikDContext *g_dalvik_dcontext_dup(GDalvikDContext *orig) +{ + GDalvikDContext *result; /* Structure à retourner */ + + result = g_object_new(G_TYPE_DALVIK_DCONTEXT, NULL); + + //g_object_unref(G_OBJECT(result->args)); + //g_object_unref(G_OBJECT(result->locals)); + + _g_dec_context_dup(G_DEC_CONTEXT(result), G_DEC_CONTEXT(orig)); + + if (orig->this != NULL) g_object_ref(G_OBJECT(orig->this)); + //g_object_ref(G_OBJECT(orig->args)); + //g_object_ref(G_OBJECT(orig->locals)); + + result->this = orig->this; + result->args = orig->args; + result->locals = orig->locals; + result->locals_count = orig->locals_count; + + return result; + +} + + +/****************************************************************************** +* * * Paramètres : ctx = instance à consulter, voire mettre à jour. * * operand = opérande représentant un registre quelconque. * * assign = précise le sort prochain du registre. * |