summaryrefslogtreecommitdiff
path: root/src/analysis/routine.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2010-08-10 00:17:32 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2010-08-10 00:17:32 (GMT)
commit088a489002fd1c9a62d5cafe693dc73cc271ee18 (patch)
treea147acd77fab3b66d541326349d08dae29ec0e8c /src/analysis/routine.c
parentbcfcb4ec8b4cf9a35b77e93d172e7dae81e8872a (diff)
Improved Itanium demangling.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@179 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/analysis/routine.c')
-rw-r--r--src/analysis/routine.c90
1 files changed, 89 insertions, 1 deletions
diff --git a/src/analysis/routine.c b/src/analysis/routine.c
index 7709fa4..0c8d83a 100644
--- a/src/analysis/routine.c
+++ b/src/analysis/routine.c
@@ -437,7 +437,7 @@ void g_binary_routine_set_name_from_type(GBinRoutine *routine, GOpenidaType *typ
* *
******************************************************************************/
-const GOpenidaType *g_binary_routine_get_type_from_name(const GBinRoutine *routine)
+GOpenidaType *g_binary_routine_get_type_from_name(const GBinRoutine *routine)
{
return routine->full_name;
@@ -472,6 +472,25 @@ void g_binary_routine_set_return_type(GBinRoutine *routine, GOpenidaType *type)
/******************************************************************************
* *
+* Paramètres : routine = routine à consulter. *
+* *
+* Description : Fournit le type de retour d'une routine. *
+* *
+* Retour : Indication sur le type de retour en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GOpenidaType *g_binary_routine_get_return_type(const GBinRoutine *routine)
+{
+ return routine->ret_type;
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : routine = routine à mettre à jour. *
* var = variable représentant un argument supplémentaire. *
* *
@@ -490,6 +509,7 @@ void g_binary_routine_add_arg(GBinRoutine *routine, GBinVariable *var)
routine->args = (GBinVariable **)realloc(routine->args,
routine->args_count * sizeof(GBinVariable *));
+ g_object_ref(G_OBJECT(var));
routine->args[routine->args_count - 1] = var;
}
@@ -497,6 +517,74 @@ void g_binary_routine_add_arg(GBinRoutine *routine, GBinVariable *var)
/******************************************************************************
* *
+* Paramètres : routine = routine à mettre à consulter. *
+* *
+* Description : Indique le nombre d'arguments associés à une routine. *
+* *
+* Retour : Nombre d'arguments présents. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+size_t g_binary_routine_get_args_count(const GBinRoutine *routine)
+{
+ return routine->args_count;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : routine = routine à consulter. *
+* index = indice de l'argument demandé. *
+* *
+* Description : Fournit un argument d'une routine. *
+* *
+* Retour : Argument demandé. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GBinVariable *g_binary_routine_get_arg(GBinRoutine *routine, size_t index)
+{
+ return routine->args[index];
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : routine = routine à mettre à jour. *
+* index = indice de l'argument à retirer; *
+* *
+* Description : Retire un argument d'une routine. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void g_binary_routine_remove_arg(GBinRoutine *routine, size_t index)
+{
+ g_object_unref(G_OBJECT(routine->args[index]));
+
+ if ((index + 1) < routine->args_count)
+ memmove(&routine->args[index], &routine->args[index + 1],
+ (routine->args_count - index - 1) * sizeof(GBinVariable *));
+
+ routine->args_count--;
+
+ routine->args = (GBinVariable **)realloc(routine->args,
+ routine->args_count * sizeof(GBinVariable *));
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : routine = routine à mettre à jour. *
* offset = position abstraite à retrouver. *
* local = indique le type de variable à manipuler. *