summaryrefslogtreecommitdiff
path: root/src/format/dex
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2016-09-26 18:24:23 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2016-09-26 18:24:23 (GMT)
commit7972f2da7d0e363fe918992cb5661b17ee3577d7 (patch)
tree6bf42830f32315d01f90c551778b47cc62bba639 /src/format/dex
parent79f384b20e00977f8450920a8a8983b818d302f8 (diff)
Defined a proper cache for routine names with their packages.
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;