diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2012-07-29 21:41:52 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2012-07-29 21:41:52 (GMT) |
commit | 8e1f2335773a9025cd46d45a33261725707af3ba (patch) | |
tree | 6001a1095985514bbde3c8ec49b4dd5d32182fc8 /src/format/dex/method.c | |
parent | 8b35a66464636d0c46237af7490a6ca6866ecc4d (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/format/dex/method.c')
-rw-r--r-- | src/format/dex/method.c | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/src/format/dex/method.c b/src/format/dex/method.c index 233ecb1..c22c11f 100644 --- a/src/format/dex/method.c +++ b/src/format/dex/method.c @@ -228,6 +228,69 @@ GBinPart *g_dex_method_as_part(const GDexMethod *method) /****************************************************************************** * * +* Paramètres : method = représentation interne du format DEX à consulter. * +* * +* Description : Indique la position de la méthode au sein du binaire. * +* * +* Retour : Localisation dans le contenu binaire. * +* * +* Remarques : - * +* * +******************************************************************************/ + +off_t g_dex_method_get_offset(const GDexMethod *method) +{ + return method->offset; +} + + +/****************************************************************************** +* * +* Paramètres : method = représentation interne du format DEX à consulter. * +* index = indice de base comme seul indice. * +* * +* Description : Fournit des indications sur la nature d'une variable donnée. * +* * +* Retour : Indentifiant complet d'une variable utilisée. * +* * +* Remarques : - * +* * +******************************************************************************/ + +DexVariableIndex g_dex_method_get_variable(const GDexMethod *method, uint32_t index) +{ + const encoded_method *info; /* Propriétés de la méthode */ + const code_item *body; /* Corps de la méthode */ + uint32_t pivot; /* Bascule pour les arguments */ + + info = &method->info; + body = &method->body; + + /* S'agit-il d'un argument ? */ + + pivot = body->registers_size - body->ins_size; + + if (!(method->info.access_flags & ACC_STATIC)) + pivot++; + + if (index >= pivot) + return (index - pivot) | DVI_ARGUMENT; + + /* S'agit-il de "this" ? */ + + if (!(method->info.access_flags & ACC_STATIC) + && index == (body->registers_size - body->ins_size)) + return DVI_THIS; + + /* Alors il s'agit d'une variable locale... */ + + return index | DVI_LOCAL; + +} + + +/****************************************************************************** +* * * Paramètres : method = informations chargées à consulter. * * lang = langage à utiliser pour la sortie humaine. * * buffer = tampon mis à disposition pour la sortie. * |