summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2020-03-03 23:32:42 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2020-03-03 23:33:38 (GMT)
commitd0314437fcad499f45a4bdb93d085100cee2c70b (patch)
tree8c77605d56f0d603de73d5f24be0aba972db5959 /src
parent0c638aecff9482b93621d77279ac77a8788584e9 (diff)
Handled destructors properly when demangling C++ Itanium names.
Diffstat (limited to 'src')
-rw-r--r--src/analysis/routine.c33
-rw-r--r--src/analysis/type.c23
-rw-r--r--src/analysis/type.h3
3 files changed, 51 insertions, 8 deletions
diff --git a/src/analysis/routine.c b/src/analysis/routine.c
index 8c38ff1..240004f 100644
--- a/src/analysis/routine.c
+++ b/src/analysis/routine.c
@@ -826,12 +826,11 @@ char *g_binary_routine_to_string(const GBinRoutine *routine, bool include)
{
case RTT_CONSTRUCTOR:
result = g_binary_routine_get_label(routine);
- result = stradd(result, "." /* FIXME */);
+ result = stradd(result, " *");
break;
case RTT_DESTRUCTOR:
- result = g_binary_routine_get_label(routine);
- result = stradd(result, "::~");
+ result = strdup("void ");
break;
default: /* Pour gcc */
@@ -863,17 +862,35 @@ char *g_binary_routine_to_string(const GBinRoutine *routine, bool include)
}
if (routine->full_name != NULL)
- {
name = g_data_type_to_string(routine->full_name, true);
- result = stradd(result, name);
+ else if (routine->name != NULL)
+ name = routine->name;
- free(name);
+ switch (routine->type)
+ {
+ case RTT_CONSTRUCTOR:
+ result = stradd(result, name);
+ result = stradd(result, routine->ns_sep);
+ result = stradd(result, name);
+ break;
+
+ case RTT_DESTRUCTOR:
+ result = stradd(result, name);
+ result = stradd(result, routine->ns_sep);
+ result = stradd(result, "~");
+ result = stradd(result, name);
+ break;
+
+ default: /* Pour gcc */
+ case RTT_CLASSIC:
+ result = stradd(result, name);
+ break;
}
- else if (routine->name != NULL)
- result = stradd(result, routine->name);
+ if (routine->full_name != NULL)
+ free(name);
/* Liste des arguments */
diff --git a/src/analysis/type.c b/src/analysis/type.c
index ddc068f..5bcb0e2 100644
--- a/src/analysis/type.c
+++ b/src/analysis/type.c
@@ -281,6 +281,29 @@ GDataType *g_data_type_get_namespace(const GDataType *type)
/******************************************************************************
* *
+* Paramètres : type = type à consulter. *
+* *
+* Description : Fournit la chaîne de séparation entre deux entités. *
+* *
+* Retour : Eventuelle chaîne de séparation ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+const char *g_data_type_get_namespace_separator(const GDataType *type)
+{
+ char *result; /* Séparateur à retourner */
+
+ result = type->ns_sep;
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : type = instance à mettre à jour. *
* qualifiers = nouveaux qualificatifs pour la variable. *
* *
diff --git a/src/analysis/type.h b/src/analysis/type.h
index 96c8835..431c080 100644
--- a/src/analysis/type.h
+++ b/src/analysis/type.h
@@ -75,6 +75,9 @@ void g_data_type_set_namespace(GDataType *, GDataType *, char *);
/* Fournit le groupe d'appartenance d'un type donné. */
GDataType *g_data_type_get_namespace(const GDataType *);
+/* Fournit la chaîne de séparation entre deux entités. */
+const char *g_data_type_get_namespace_separator(const GDataType *);
+
/* Définit l'ensemble des qualificatifs d'une instance de type. */
void g_data_type_set_qualifiers(GDataType *, TypeQualifier);