summaryrefslogtreecommitdiff
path: root/gnu/egcs/libiberty
diff options
context:
space:
mode:
authorFederico G. Schwindt <fgsch@cvs.openbsd.org>2002-05-11 13:05:09 +0000
committerFederico G. Schwindt <fgsch@cvs.openbsd.org>2002-05-11 13:05:09 +0000
commit5218c878764121c93f369f9de64d3d11b8ac0df1 (patch)
treeec6254cfc45e5a781b0e1ffc118c89487821ea7f /gnu/egcs/libiberty
parent6d40c0976b902c20ea4075f8887c7204d3947853 (diff)
pull a few demangler functions needed by new binutils. enable getpwd as
well; espie@ ok.
Diffstat (limited to 'gnu/egcs/libiberty')
-rw-r--r--gnu/egcs/libiberty/Makefile.bsd-wrapper12
-rw-r--r--gnu/egcs/libiberty/cplus-dem.c77
2 files changed, 83 insertions, 6 deletions
diff --git a/gnu/egcs/libiberty/Makefile.bsd-wrapper b/gnu/egcs/libiberty/Makefile.bsd-wrapper
index 9071d4fd4ca..0cd81583d54 100644
--- a/gnu/egcs/libiberty/Makefile.bsd-wrapper
+++ b/gnu/egcs/libiberty/Makefile.bsd-wrapper
@@ -1,7 +1,7 @@
-# $OpenBSD: Makefile.bsd-wrapper,v 1.9 2001/06/09 22:02:01 espie Exp $
+# $OpenBSD: Makefile.bsd-wrapper,v 1.10 2002/05/11 13:05:08 fgsch Exp $
LIB= iberty
-CPPFLAGS+= -I$(.CURDIR) -I$(.CURDIR)/../include -I$(.OBJDIR)
+CPPFLAGS+= -DHAVE_CONFIG_H -I$(.CURDIR) -I$(.CURDIR)/../include -I$(.OBJDIR)
# XXX -- GNUism
# As we need to fill variables with contents of dynamically created files
@@ -17,10 +17,10 @@ HOST_FILES!= cat $(.OBJDIR)/needed-list
.endif
SRCS= argv.c choose-temp.c concat.c cplus-dem.c dyn-string.c \
- fdmatch.c getopt.c getopt1.c getruntime.c hashtab.c hex.c \
- floatformat.c objalloc.c obstack.c pexecute.c spaces.c \
- splay-tree.c strerror.c strsignal.c xatexit.c xexit.c \
- xmalloc.c xstrerror.c xstrdup.c \
+ fdmatch.c getopt.c getopt1.c getpwd.c getruntime.c \
+ hashtab.c hex.c floatformat.c objalloc.c obstack.c \
+ pexecute.c spaces.c splay-tree.c strerror.c strsignal.c \
+ xatexit.c xexit.c xmalloc.c xstrerror.c xstrdup.c \
$(HOST_FILES)
# choose-temp.c fnmatch.c objalloc.c pexecute.c xstrdup.c \
diff --git a/gnu/egcs/libiberty/cplus-dem.c b/gnu/egcs/libiberty/cplus-dem.c
index 6d51710685c..ff6625244df 100644
--- a/gnu/egcs/libiberty/cplus-dem.c
+++ b/gnu/egcs/libiberty/cplus-dem.c
@@ -246,6 +246,49 @@ typedef enum type_kind_t
tk_real
} type_kind_t;
+struct demangler_engine libiberty_demanglers[] =
+{
+ {
+ AUTO_DEMANGLING_STYLE_STRING,
+ auto_demangling,
+ "Automatic selection based on executable"
+ }
+ ,
+ {
+ GNU_DEMANGLING_STYLE_STRING,
+ gnu_demangling,
+ "GNU (g++) style demangling"
+ }
+ ,
+ {
+ LUCID_DEMANGLING_STYLE_STRING,
+ lucid_demangling,
+ "Lucid (lcc) style demangling"
+ }
+ ,
+ {
+ ARM_DEMANGLING_STYLE_STRING,
+ arm_demangling,
+ "ARM style demangling"
+ }
+ ,
+ {
+ HP_DEMANGLING_STYLE_STRING,
+ hp_demangling,
+ "HP (aCC) style demangling"
+ }
+ ,
+ {
+ EDG_DEMANGLING_STYLE_STRING,
+ edg_demangling,
+ "EDG style demangling"
+ }
+ ,
+ {
+ NULL, unknown_demangling, NULL
+ }
+};
+
#define STRING_EMPTY(str) ((str) -> b == (str) -> p)
#define PREPEND_BLANK(str) {if (!STRING_EMPTY(str)) \
string_prepend(str, " ");}
@@ -730,6 +773,40 @@ cplus_mangle_opname (opname, options)
return (0);
}
+/* Add a routine to set the demangling style to be sure it is valid and
+ allow for any demangler initialization that maybe necessary. */
+
+enum demangling_styles
+cplus_demangle_set_style (style)
+ enum demangling_styles style;
+{
+ struct demangler_engine *demangler = libiberty_demanglers;
+
+ for (; demangler->demangling_style != unknown_demangling; ++demangler)
+ if (style == demangler->demangling_style)
+ {
+ current_demangling_style = style;
+ return current_demangling_style;
+ }
+
+ return unknown_demangling;
+}
+
+/* Do string name to style translation */
+
+enum demangling_styles
+cplus_demangle_name_to_style (name)
+ const char *name;
+{
+ struct demangler_engine *demangler = libiberty_demanglers;
+
+ for (; demangler->demangling_style != unknown_demangling; ++demangler)
+ if (strcmp (name, demangler->demangling_style_name) == 0)
+ return demangler->demangling_style;
+
+ return unknown_demangling;
+}
+
/* char *cplus_demangle (const char *mangled, int options)
If MANGLED is a mangled function name produced by GNU C++, then