summaryrefslogtreecommitdiff
path: root/src/format/dex/method.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/format/dex/method.c')
-rw-r--r--src/format/dex/method.c63
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. *