aboutsummaryrefslogtreecommitdiff
path: root/gdb/language.c
diff options
context:
space:
mode:
authorAdam Fedor <fedor@gnu.org>2003-04-02 03:02:46 +0000
committerAdam Fedor <fedor@gnu.org>2003-04-02 03:02:46 +0000
commit9a3d7dfd2e56889dce422be422767465d3f0f06b (patch)
treef86ad9aba59abf9c3148e8b7596b96e36ba4c3bf /gdb/language.c
parent5eb7f2340accc91a9efeab18386f95f24dd9709e (diff)
downloadgdb-9a3d7dfd2e56889dce422be422767465d3f0f06b.zip
gdb-9a3d7dfd2e56889dce422be422767465d3f0f06b.tar.gz
gdb-9a3d7dfd2e56889dce422be422767465d3f0f06b.tar.bz2
* Makefile.in (c_lang.o, jv_lang.o, language.o): Add $(demangle_h).
* language.h (struct language_defn): Add la_demangle. (language_demangle): Declare. * language.c (language_demangle): New function. (unk_lang_demangle): Likewise. (unknown_language_defn, auto_language_defn, local_language_defn): Add ukn_lang_demangle. * ada-lang.c (ada_language_defn): Add NULL for la_demangle element. * f-lang.c, m2-lang.c, p-lang.c, scm-lang.c: Likewise. * c-lang.c (c_language_defn, asm_language_defn): Likewise. (cplus_language_defn): Add cplus_demangle for la_demangle element. * jv-lang.c (java_demangle): New function (java_language_defn): Use it for la_demangle element. * objc-lang.c (objc_demangle): Add options argument (objc_language_defn): Use objc_demangle for la_demangle element. * maint.c (maintenance_demangle): Replace switch with call to language_demangle. * utils.c (fprintf_symbol_filtered): Likewise.
Diffstat (limited to 'gdb/language.c')
-rw-r--r--gdb/language.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/gdb/language.c b/gdb/language.c
index 2b71d1f..0a65094 100644
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -44,6 +44,7 @@
#include "target.h"
#include "parser-defs.h"
#include "jv-lang.h"
+#include "demangle.h"
extern void _initialize_language (void);
@@ -1361,6 +1362,21 @@ skip_language_trampoline (CORE_ADDR pc)
return 0;
}
+/* Return demangled language symbol, or NULL.
+ FIXME: Options are only useful for certain languages and ignored
+ by others, so it would be better to remove them here and have a
+ more flexible demangler for the languages that need it.
+ FIXME: Sometimes the demangler is invoked when we don't know the
+ language, so we can't use this everywhere. */
+char *
+language_demangle (const struct language_defn *current_language,
+ const char *mangled, int options)
+{
+ if (current_language != NULL && current_language->la_demangle)
+ return current_language->la_demangle (mangled, options);
+ return NULL;
+}
+
/* Define the language that is no language. */
@@ -1428,6 +1444,13 @@ static CORE_ADDR unk_lang_trampoline (CORE_ADDR pc)
return 0;
}
+/* Unknown languages just use the cplus demangler. */
+static char *unk_lang_demangle (const char *mangled, int options)
+{
+ return cplus_demangle (mangled, options);
+}
+
+
static struct type **const (unknown_builtin_types[]) =
{
0
@@ -1456,6 +1479,7 @@ const struct language_defn unknown_language_defn =
unk_lang_val_print, /* Print a value using appropriate syntax */
unk_lang_value_print, /* Print a top-level value */
unk_lang_trampoline, /* Language specific skip_trampoline */
+ unk_lang_demangle, /* Language specific symbol demangler */
{"", "", "", ""}, /* Binary format info */
{"0%lo", "0", "o", ""}, /* Octal format info */
{"%ld", "", "d", ""}, /* Decimal format info */
@@ -1487,6 +1511,7 @@ const struct language_defn auto_language_defn =
unk_lang_val_print, /* Print a value using appropriate syntax */
unk_lang_value_print, /* Print a top-level value */
unk_lang_trampoline, /* Language specific skip_trampoline */
+ unk_lang_demangle, /* Language specific symbol demangler */
{"", "", "", ""}, /* Binary format info */
{"0%lo", "0", "o", ""}, /* Octal format info */
{"%ld", "", "d", ""}, /* Decimal format info */
@@ -1517,6 +1542,7 @@ const struct language_defn local_language_defn =
unk_lang_val_print, /* Print a value using appropriate syntax */
unk_lang_value_print, /* Print a top-level value */
unk_lang_trampoline, /* Language specific skip_trampoline */
+ unk_lang_demangle, /* Language specific symbol demangler */
{"", "", "", ""}, /* Binary format info */
{"0%lo", "0", "o", ""}, /* Octal format info */
{"%ld", "", "d", ""}, /* Decimal format info */