summaryrefslogtreecommitdiff
path: root/src/format/dex
diff options
context:
space:
mode:
Diffstat (limited to 'src/format/dex')
-rw-r--r--src/format/dex/class.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/format/dex/class.c b/src/format/dex/class.c
index a88f3f2..454cc40 100644
--- a/src/format/dex/class.c
+++ b/src/format/dex/class.c
@@ -24,6 +24,7 @@
#include "class.h"
+#include <assert.h>
#include <malloc.h>
@@ -194,6 +195,7 @@ GDexClass *g_dex_class_new(GDexFormat *format, const class_def_item *def)
GDexClass *result; /* Composant à retourner */
vmpa2t addr; /* Tête de lecture générique */
class_data_item data; /* Contenu de la classe */
+ GDataType *ctype; /* Type créé par la classe */
uleb128_t index; /* Conservation du dernier id */
uleb128_t i; /* Boucle de parcours */
GDexMethod *method; /* Méthode chargée */
@@ -230,6 +232,9 @@ GDexClass *g_dex_class_new(GDexFormat *format, const class_def_item *def)
*/
if (def->access_flags & ACC_ANNOTATION) goto gdcn_done;
+ ctype = get_type_from_dex_pool(format, def->class_idx);
+ assert(ctype != NULL);
+
index = 0;
result->dmethods_count = data.direct_methods_size;
@@ -246,6 +251,9 @@ GDexClass *g_dex_class_new(GDexFormat *format, const class_def_item *def)
routine = g_dex_method_get_routine(method);
+ g_object_ref(G_OBJECT(ctype));
+ g_binary_routine_set_namespace(routine, ctype, ".");
+
symbol = g_binary_symbol_new(STP_ROUTINE);
g_binary_symbol_attach_routine(symbol, routine);
@@ -269,6 +277,9 @@ GDexClass *g_dex_class_new(GDexFormat *format, const class_def_item *def)
routine = g_dex_method_get_routine(method);
+ g_object_ref(G_OBJECT(ctype));
+ g_binary_routine_set_namespace(routine, ctype, ".");
+
symbol = g_binary_symbol_new(STP_ROUTINE);
g_binary_symbol_attach_routine(symbol, routine);
@@ -276,13 +287,18 @@ GDexClass *g_dex_class_new(GDexFormat *format, const class_def_item *def)
}
+ g_object_unref(G_OBJECT(ctype));
+
gdcn_done:
return result;
- gdcn_bad_item:
gdcn_bad_method:
+ g_object_unref(G_OBJECT(ctype));
+
+ gdcn_bad_item:
+
g_object_unref(G_OBJECT(result));
return NULL;