summaryrefslogtreecommitdiff
path: root/src/analysis
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-03-11 21:57:05 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-03-11 21:57:05 (GMT)
commit8088f1cbb4304c686ff41520099707a333084a4e (patch)
tree147411c3f90097dc1ae950ec390df2dfccf07ad7 /src/analysis
parenta33dd28e763e3a8b04145fb549aca9320e100a4b (diff)
Defined a new Dex demangler with MUTF-8 support as plugin.
Diffstat (limited to 'src/analysis')
-rw-r--r--src/analysis/routine.c6
-rw-r--r--src/analysis/types/cse.c4
-rw-r--r--src/analysis/types/cse.h2
-rw-r--r--src/analysis/types/encaps.c47
-rw-r--r--src/analysis/types/encaps.h7
5 files changed, 62 insertions, 4 deletions
diff --git a/src/analysis/routine.c b/src/analysis/routine.c
index 557e9aa..bf2b589 100644
--- a/src/analysis/routine.c
+++ b/src/analysis/routine.c
@@ -857,6 +857,7 @@ char *_g_binary_routine_to_string(const GBinRoutine *routine, Routine2StringOpti
{
char *result; /* Chaîne à renvoyer */
char *namespace; /* Groupe d'appartenance */
+ const char *name; /* Désignation de la routine */
size_t i; /* Boucle de parcours */
char *typestr; /* Stockage de nom temporaire */
@@ -900,7 +901,10 @@ char *_g_binary_routine_to_string(const GBinRoutine *routine, Routine2StringOpti
}
- result = stradd(result, g_binary_routine_get_name(routine));
+ name = g_binary_routine_get_name(routine);
+
+ if (name != NULL)
+ result = stradd(result, name);
/* Liste des arguments */
diff --git a/src/analysis/types/cse.c b/src/analysis/types/cse.c
index 1421112..8e2e021 100644
--- a/src/analysis/types/cse.c
+++ b/src/analysis/types/cse.c
@@ -102,14 +102,14 @@ static void g_class_enum_type_init(GClassEnumType *type)
* *
******************************************************************************/
-GDataType *g_class_enum_type_new(ClassEnumType type, const char *name)
+GDataType *g_class_enum_type_new(ClassEnumType type, char *name)
{
GClassEnumType *result; /* Structure à retourner */
result = g_object_new(G_TYPE_CLASS_ENUM_TYPE, NULL);
result->type = type;
- result->name = strdup(name);
+ result->name = name;
return G_DATA_TYPE(result);
diff --git a/src/analysis/types/cse.h b/src/analysis/types/cse.h
index dde91a2..0d59743 100644
--- a/src/analysis/types/cse.h
+++ b/src/analysis/types/cse.h
@@ -62,7 +62,7 @@ typedef enum _ClassEnumType
GType g_class_enum_type_get_type(void);
/* Crée une représentation de classe, structure ou énumération. */
-GDataType *g_class_enum_type_new(ClassEnumType, const char *);
+GDataType *g_class_enum_type_new(ClassEnumType, char *);
diff --git a/src/analysis/types/encaps.c b/src/analysis/types/encaps.c
index c3cf3ce..0dfc3af 100644
--- a/src/analysis/types/encaps.c
+++ b/src/analysis/types/encaps.c
@@ -39,6 +39,8 @@ struct _GEncapsulatedType
GDataType *child; /* Sous-type encadré */
GBinRoutine *routine; /* Routine pointée */
+ size_t dimension; /* Dimension quand applicable */
+
};
/* Description de type encapsulé (classe) */
@@ -208,6 +210,7 @@ static GDataType *g_encapsulated_type_dup(const GEncapsulatedType *type)
static char *g_encapsulated_type_to_string(const GEncapsulatedType *type)
{
char *result; /* Chaîne finale à renvoyer */
+ size_t i; /* Boucle de parcours */
switch (type->type)
{
@@ -234,6 +237,11 @@ static char *g_encapsulated_type_to_string(const GEncapsulatedType *type)
break;
+ case ECT_ARRAY:
+ result = stradd(result, " ");
+ for (i = 0; i < type->dimension; i++)
+ result = stradd(result, "[]");
+ break;
case ECT_REFERENCE:
result = stradd(result, " &");
break;
@@ -339,3 +347,42 @@ void g_encapsulated_type_get_item(const GEncapsulatedType *type, ...)
va_end(ap);
}
+
+
+/******************************************************************************
+* *
+* Paramètres : type = type à consulter. *
+* *
+* Description : Fournit la dimension éventuellement associée au type. *
+* *
+* Retour : Dimension positive ou nulle. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+size_t g_encapsulated_type_get_dimension(const GEncapsulatedType *type)
+{
+ return type->dimension;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : type = type à consulter. *
+* dim = dimension positive ou nulle. *
+* *
+* Description : Définit la dimension éventuellement associée au type. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void g_encapsulated_type_set_dimension(GEncapsulatedType *type, size_t dim)
+{
+ type->dimension = dim;
+
+}
diff --git a/src/analysis/types/encaps.h b/src/analysis/types/encaps.h
index d677e56..4cd74d2 100644
--- a/src/analysis/types/encaps.h
+++ b/src/analysis/types/encaps.h
@@ -51,6 +51,7 @@ typedef struct _GEncapsulatedTypeClass GEncapsulatedTypeClass;
typedef enum _EncapsulationType
{
ECT_POINTER, /* Pointeur */
+ ECT_ARRAY, /* Tableau */
ECT_REFERENCE, /* Référence */
ECT_RVALUE_REF, /* Référence ?? (C++0x) */
ECT_COMPLEX, /* Complexe (C 2000) */
@@ -73,6 +74,12 @@ EncapsulationType g_encapsulated_type_get_etype(const GEncapsulatedType *);
/* Fournit la routine encapsulée dans le type. */
void g_encapsulated_type_get_item(const GEncapsulatedType *, ...);
+/* Fournit la dimension éventuellement associée au type. */
+size_t g_encapsulated_type_get_dimension(const GEncapsulatedType *);
+
+/* Définit la dimension éventuellement associée au type. */
+void g_encapsulated_type_set_dimension(GEncapsulatedType *, size_t);
+
#endif /* _ANALYSIS_TYPES_ENCAPS_H */