summaryrefslogtreecommitdiff
path: root/src/analysis
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2010-05-13 12:32:03 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2010-05-13 12:32:03 (GMT)
commit118a668adbf6ca9d4c549618e54f58330f46ce58 (patch)
tree10e75f1a7e83ab48aba82a5a595441a065a6037e /src/analysis
parente56b4db3aae87f0458319019635dea4968a5c529 (diff)
Supported Dalvik VM / DEX (partially).
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@155 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/analysis')
-rw-r--r--src/analysis/binary.c4
-rw-r--r--src/analysis/exporter.c17
-rw-r--r--src/analysis/exporter.h1
-rw-r--r--src/analysis/routine.c33
-rw-r--r--src/analysis/routine.h3
-rw-r--r--src/analysis/type.c41
-rw-r--r--src/analysis/type.h3
7 files changed, 99 insertions, 3 deletions
diff --git a/src/analysis/binary.c b/src/analysis/binary.c
index d518328..10acfb6 100644
--- a/src/analysis/binary.c
+++ b/src/analysis/binary.c
@@ -719,8 +719,12 @@ GOpenidaBinary *g_openida_binary_new_from_file(const char *filename)
goto lbf_error;
}
+ /* FIXME : à déplacer dans arch/... */
switch (g_exe_format_get_target_machine(result->format))
{
+ case FTM_DALVIK:
+ log_simple_message(LMT_INFO, _("Detected architecture: Dalvik Virtual Machine"));
+ break;
case FTM_JVM:
log_simple_message(LMT_INFO, _("Detected architecture: Java Virtual Machine"));
break;
diff --git a/src/analysis/exporter.c b/src/analysis/exporter.c
index 9de5fbc..edff9d8 100644
--- a/src/analysis/exporter.c
+++ b/src/analysis/exporter.c
@@ -129,6 +129,23 @@ static void g_content_exporter_class_init(GContentExporterClass *klass)
klass->attribs[RTT_LTGT] = pango_attr_list_new();
+ /* RTT_SECTION */
+
+ klass->attribs[RTT_SECTION] = pango_attr_list_new();
+
+ attrib = pango_attr_foreground_new(51200, 2560, 2560);
+ pango_attr_list_insert(klass->attribs[RTT_SECTION], attrib);
+
+ /*
+ attrib = pango_attr_foreground_new(56832, 26880, 43008);
+ pango_attr_list_insert(klass->attribs[RTT_SECTION], attrib);
+
+ attrib = pango_attr_weight_new(PANGO_WEIGHT_BOLD);
+ pango_attr_list_insert(klass->attribs[RTT_SECTION], attrib);
+ */
+
+ /* RTT_SEGMENT */
+
klass->attribs[RTT_SEGMENT] = pango_attr_list_new();
klass->attribs[RTT_STRING] = pango_attr_list_new();
diff --git a/src/analysis/exporter.h b/src/analysis/exporter.h
index 7c90cad..56ad2ab 100644
--- a/src/analysis/exporter.h
+++ b/src/analysis/exporter.h
@@ -52,6 +52,7 @@ typedef enum _RenderingTagType
RTT_SIGNS, /* Signes '+', '-' et '*' */
RTT_LTGT, /* Caractères '<' et '>' */
+ RTT_SECTION, /* Identifiant de section */
RTT_SEGMENT, /* Indication de segment */
RTT_STRING, /* Chaîne de caractères avec " */
diff --git a/src/analysis/routine.c b/src/analysis/routine.c
index cfa7cd5..c5bf056 100644
--- a/src/analysis/routine.c
+++ b/src/analysis/routine.c
@@ -45,6 +45,7 @@ struct _GBinRoutine
GOpenidaType *ret_type; /* Type retourné */
+ GOpenidaType *namespace; /* Espace de noms / classe */
char *name; /* Désignation humaine */
GOpenidaType *full_name; /* Désignation très complète */
@@ -319,6 +320,26 @@ void g_binary_routine_set_type(GBinRoutine *routine, RoutineType type)
/******************************************************************************
* *
+* Paramètres : routine = routine à mettre à jour. *
+* namespace = instance d'appartenance. *
+* *
+* Description : Définit le groupe d'appartenance d'une routine donnée. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void g_binary_routine_set_namespace(GBinRoutine *routine, GOpenidaType *namespace)
+{
+ routine->namespace = namespace;
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : routine = routine à mettre à jour. *
* name = désignation humainement lisible. *
* *
@@ -575,6 +596,7 @@ size_t g_binary_routine_get_var_index_from_offset(const GBinRoutine *routine, si
char *g_binary_routine_to_string(const GBinRoutine *routine)
{
char *result; /* Chaîne à renvoyer */
+ char *namespace; /* Groupe d'appartenance */
size_t i; /* Boucle de parcours */
char *typestr; /* Stockage de nom temporaire */
@@ -607,6 +629,17 @@ char *g_binary_routine_to_string(const GBinRoutine *routine)
/* Nom de la routine */
+ if (routine->namespace != NULL)
+ {
+ namespace = g_openida_type_to_string(routine->namespace);
+
+ result = stradd(result, namespace);
+ result = stradd(result, "::");
+
+ free(namespace);
+
+ }
+
result = stradd(result, g_binary_routine_get_name(routine));
/* Liste des arguments */
diff --git a/src/analysis/routine.h b/src/analysis/routine.h
index 1a2b493..0b673f7 100644
--- a/src/analysis/routine.h
+++ b/src/analysis/routine.h
@@ -85,6 +85,9 @@ off_t g_binary_routine_get_size(const GBinRoutine *);
/* Définit le type d'une routine. */
void g_binary_routine_set_type(GBinRoutine *, RoutineType);
+/* Définit le groupe d'appartenance d'une routine donnée. */
+void g_binary_routine_set_namespace(GBinRoutine *, GOpenidaType *);
+
/* Définit le nom humain d'une routine. */
void g_binary_routine_set_name(GBinRoutine *, char *);
diff --git a/src/analysis/type.c b/src/analysis/type.c
index c113499..3282e2b 100644
--- a/src/analysis/type.c
+++ b/src/analysis/type.c
@@ -52,6 +52,7 @@ struct _GOpenidaType
type_dup_fc dup; /* Copie d'instance existante */
type_to_string_fc to_string; /* Conversion au format texte */
+ GOpenidaType *namespace; /* Espace de noms / classe */
TypeQualifier qualifiers; /* Eventuels qualificatifs */
GTypesManager *manager; /* Gestionnaire global */
@@ -343,6 +344,28 @@ GOpenidaType *g_openida_type_dup(const GOpenidaType *type)
/******************************************************************************
* *
+* Paramètres : type = type à mettre à jour. *
+* namespace = instance d'appartenance. *
+* *
+* Description : Définit le groupe d'appartenance d'un type donné. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void g_openida_type_set_namespace(GOpenidaType *type, GOpenidaType *namespace)
+{
+ g_object_ref(G_OBJECT(namespace));
+
+ type->namespace = namespace;
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : type = type à convertir. *
* *
* Description : Décrit le type fourni sous forme de caractères. *
@@ -356,17 +379,29 @@ GOpenidaType *g_openida_type_dup(const GOpenidaType *type)
char *g_openida_type_to_string(const GOpenidaType *type)
{
char *result; /* Chaîne à retourner */
+ char *namespace; /* Groupe d'appartenance */
result = type->to_string(type);
+ if (type->namespace != NULL)
+ {
+ namespace = g_openida_type_to_string(type->namespace);
+
+ result = strprep(result, "::");
+ result = strprep(result, namespace);
+
+ free(namespace);
+
+ }
+
if (type->qualifiers & TQF_RESTRICT)
- strprep(result, "restrict ");
+ result = strprep(result, "restrict ");
if (type->qualifiers & TQF_VOLATILE)
- strprep(result, "volatile ");
+ result = strprep(result, "volatile ");
if (type->qualifiers & TQF_CONST)
- strprep(result, "const ");
+ result = strprep(result, "const ");
return result;
diff --git a/src/analysis/type.h b/src/analysis/type.h
index b127eb3..2662235 100644
--- a/src/analysis/type.h
+++ b/src/analysis/type.h
@@ -68,6 +68,9 @@ GType g_openida_type_get_type(void);
/* Crée un copie d'un type existant. */
GOpenidaType *g_openida_type_dup(const GOpenidaType *);
+/* Définit le groupe d'appartenance d'un type donné. */
+void g_openida_type_set_namespace(GOpenidaType *, GOpenidaType *);
+
/* Décrit le type fourni sous forme de caractères. */
char *g_openida_type_to_string(const GOpenidaType *);