From 14a2c6dab00ab8ffff4c37b6d088d332bc6abd6c Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Mon, 7 May 2018 17:57:38 +0200 Subject: Kept methods of annotated classes during loading. --- plugins/dex/class.c | 5 ----- plugins/dex/method.c | 9 ++++++++- plugins/dex/python/method.c | 9 ++++++++- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/plugins/dex/class.c b/plugins/dex/class.c index fded32c..a674b98 100644 --- a/plugins/dex/class.c +++ b/plugins/dex/class.c @@ -290,11 +290,6 @@ GDexClass *g_dex_class_new(GDexFormat *format, const class_def_item *def) * Chargement des méthodes de classe. */ - /** - * On évite ici les méthodes (virtuelles) non définies. - */ - if (def->access_flags & ACC_ANNOTATION) goto gdcn_done; - ctype = get_type_from_dex_pool(format, def->class_idx); if (ctype == NULL) goto gdcn_unknown_type; diff --git a/plugins/dex/method.c b/plugins/dex/method.c index 4013436..5b7b30e 100644 --- a/plugins/dex/method.c +++ b/plugins/dex/method.c @@ -24,6 +24,7 @@ #include "method.h" +#include #include #include @@ -43,7 +44,11 @@ struct _GDexMethod GBinRoutine *routine; /* Représentation interne */ - /* FIXME : méthode interne seulement */ + /** + * Les champs suivants ne sont renseignés que pour les objets mis + * en place à partir du constructeur g_dex_method_new_defined(). + */ + encoded_method info; /* Propriétés de la méthode */ bool has_body; /* Indication de présence */ code_item body; /* Corps de la méthode */ @@ -439,6 +444,8 @@ DexVariableIndex g_dex_method_get_variable(const GDexMethod *method, uint32_t in const code_item *body; /* Corps de la méthode */ uint32_t pivot; /* Bascule pour les arguments */ + assert(method->has_body); + info = &method->info; body = &method->body; diff --git a/plugins/dex/python/method.c b/plugins/dex/python/method.c index 4f35e1a..5a06403 100644 --- a/plugins/dex/python/method.c +++ b/plugins/dex/python/method.c @@ -100,7 +100,14 @@ static PyObject *py_dex_method_get_code_item(PyObject *self, void *closure) body = g_dex_method_get_dex_body(method); - result = translate_dex_method_body_to_python(body); + if (body == NULL) + { + result = Py_None; + Py_INCREF(result); + } + + else + result = translate_dex_method_body_to_python(body); return result; -- cgit v0.11.2-87-g4458