aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/Makefile.in15
-rw-r--r--gdb/cp-name-parser.y135
-rw-r--r--gdb/yy-remap.h4
3 files changed, 1 insertions, 153 deletions
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 234d005..265c086 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -2152,16 +2152,6 @@ uninstall: force $(CONFIG_UNINSTALL)
rm -f $(DESTDIR)$(bindir)/$$transformed_name
@$(MAKE) DO=uninstall "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do
-# The C++ name parser can be built standalone for testing.
-test-cp-name-parser.o: cp-name-parser.c
- $(COMPILE) -DTEST_CPNAMES cp-name-parser.c
- $(POSTCOMPILE)
-
-test-cp-name-parser$(EXEEXT): test-cp-name-parser.o $(LIBIBERTY)
- $(ECHO_CXXLD) $(CC_LD) $(INTERNAL_LDFLAGS) \
- -o test-cp-name-parser$(EXEEXT) test-cp-name-parser.o \
- $(LIBIBERTY)
-
# We do this by grepping through sources. If that turns out to be too slow,
# maybe we could just require every .o file to have an initialization routine
# of a given name (top.o -> _initialize_top, etc.).
@@ -2173,7 +2163,6 @@ test-cp-name-parser$(EXEEXT): test-cp-name-parser.o $(LIBIBERTY)
# computing the list of source files from the list of object files.
INIT_FILES_FILTER_OUT = \
- cp-name-parser.o \
init.o \
version.o \
xml-builtin.o \
@@ -2249,7 +2238,6 @@ clean mostlyclean: $(CONFIG_CLEAN)
rm -f init.c stamp-init version.c stamp-version
rm -f gdb$(EXEEXT) core make.log
rm -f gdb[0-9]$(EXEEXT)
- rm -f test-cp-name-parser$(EXEEXT)
rm -f xml-builtin.c stamp-xml
rm -f $(DEPDIR)/*
for i in $(CONFIG_SRC_SUBDIR); do \
@@ -2682,8 +2670,7 @@ endif
# A list of all the objects we might care about in this build, for
# dependency tracking.
-all_object_files = gdb.o $(LIBGDB_OBS) gdbtk-main.o \
- test-cp-name-parser.o
+all_object_files = gdb.o $(LIBGDB_OBS) gdbtk-main.o
# All the .deps files to include.
all_deps_files = $(foreach dep,$(patsubst %.o,%.Po,$(all_object_files)),\
diff --git a/gdb/cp-name-parser.y b/gdb/cp-name-parser.y
index e944276..7820053 100644
--- a/gdb/cp-name-parser.y
+++ b/gdb/cp-name-parser.y
@@ -171,11 +171,6 @@ cpname_state::d_grab ()
#define INT_SIGNED (1 << 4)
#define INT_UNSIGNED (1 << 5)
-/* Enable yydebug for the stand-alone parser. */
-#ifdef TEST_CPNAMES
-# define YYDEBUG 1
-#endif
-
/* Helper functions. These wrap the demangler tree interface, handle
allocation from our global store, and return the allocated component. */
@@ -2047,133 +2042,3 @@ cp_demangled_name_to_comp (const char *demangled_name,
return result;
}
-
-#ifdef TEST_CPNAMES
-
-static void
-cp_print (struct demangle_component *result)
-{
- char *str;
- size_t err = 0;
-
- str = gdb_cplus_demangle_print (DMGL_PARAMS | DMGL_ANSI, result, 64, &err);
- if (str == NULL)
- return;
-
- fputs (str, stdout);
-
- free (str);
-}
-
-static char
-trim_chars (char *lexptr, char **extra_chars)
-{
- char *p = (char *) symbol_end (lexptr);
- char c = 0;
-
- if (*p)
- {
- c = *p;
- *p = 0;
- *extra_chars = p + 1;
- }
-
- return c;
-}
-
-/* When this file is built as a standalone program, xmalloc comes from
- libiberty --- in which case we have to provide xfree ourselves. */
-
-void
-xfree (void *ptr)
-{
- if (ptr != NULL)
- {
- /* Literal `free' would get translated back to xfree again. */
- CONCAT2 (fr,ee) (ptr);
- }
-}
-
-/* GDB normally defines internal_error itself, but when this file is built
- as a standalone program, we must also provide an implementation. */
-
-void
-internal_error (const char *file, int line, const char *fmt, ...)
-{
- va_list ap;
-
- va_start (ap, fmt);
- fprintf (stderr, "%s:%d: internal error: ", file, line);
- vfprintf (stderr, fmt, ap);
- exit (1);
-}
-
-int
-main (int argc, char **argv)
-{
- char *str2, *extra_chars, c;
- char buf[65536];
- int arg;
-
- arg = 1;
- if (argv[arg] && strcmp (argv[arg], "--debug") == 0)
- {
- yydebug = 1;
- arg++;
- }
-
- if (argv[arg] == NULL)
- while (fgets (buf, 65536, stdin) != NULL)
- {
- buf[strlen (buf) - 1] = 0;
- /* Use DMGL_VERBOSE to get expanded standard substitutions. */
- c = trim_chars (buf, &extra_chars);
- str2 = cplus_demangle (buf, DMGL_PARAMS | DMGL_ANSI | DMGL_VERBOSE);
- if (str2 == NULL)
- {
- printf ("Demangling error\n");
- if (c)
- printf ("%s%c%s\n", buf, c, extra_chars);
- else
- printf ("%s\n", buf);
- continue;
- }
-
- std::string errmsg;
- std::unique_ptr<demangle_parse_info> result
- = cp_demangled_name_to_comp (str2, &errmsg);
- if (result == NULL)
- {
- fputs (errmsg.c_str (), stderr);
- fputc ('\n', stderr);
- continue;
- }
-
- cp_print (result->tree);
-
- free (str2);
- if (c)
- {
- putchar (c);
- fputs (extra_chars, stdout);
- }
- putchar ('\n');
- }
- else
- {
- std::string errmsg;
- std::unique_ptr<demangle_parse_info> result
- = cp_demangled_name_to_comp (argv[arg], &errmsg);
- if (result == NULL)
- {
- fputs (errmsg.c_str (), stderr);
- fputc ('\n', stderr);
- return 0;
- }
- cp_print (result->tree);
- putchar ('\n');
- }
- return 0;
-}
-
-#endif
diff --git a/gdb/yy-remap.h b/gdb/yy-remap.h
index d52a59d..e32ce39 100644
--- a/gdb/yy-remap.h
+++ b/gdb/yy-remap.h
@@ -93,8 +93,4 @@
# define YYDEBUG 1 /* Default to yydebug support */
#endif
-#ifndef TEST_CPNAMES
-# define YYFPRINTF parser_fprintf
-#endif
-
#endif /* YY_REMAP_H */