summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Jacobowitz <dan@debian.org>2004-01-13 18:30:53 +0000
committerDaniel Jacobowitz <dan@debian.org>2004-01-13 18:30:53 +0000
commite75e4141b0d8ec021587fb45de82c7f046f3357c (patch)
treea12dc3e1f217a8228c5df41f98f9873bbe6a6f19
parent64cd5cfe9e9645971416ab62b6626030a0d19070 (diff)
downloadgdb-e75e4141b0d8ec021587fb45de82c7f046f3357c.tar.gz
* Makefile.in (cp_demangle_h): Remove.
(libiberty_h): Add. (cp-names.tab.o, cp-names-main.tab.o, cp-support.o): Update dependencies. * cp-support.c: Don't include "cp-demangle.h". (d_left, d_right): New macros. (cp_canonicalize_string, class_name_from_physname, method_name_from_physname): Fix types and component names. * cp-support.h (demangled_name_to_comp, mangled_name_to_comp) (cp_comp_to_string): Update prototypes.
-rw-r--r--gdb/ChangeLog.cplus13
-rw-r--r--gdb/Makefile.in8
-rw-r--r--gdb/cp-support.c94
-rw-r--r--gdb/cp-support.h16
4 files changed, 73 insertions, 58 deletions
diff --git a/gdb/ChangeLog.cplus b/gdb/ChangeLog.cplus
index cf3e3a50ba4..c17e4c6367f 100644
--- a/gdb/ChangeLog.cplus
+++ b/gdb/ChangeLog.cplus
@@ -1,3 +1,16 @@
+2003-01-13 Daniel Jacobowitz <drow@mvista.com>
+
+ * Makefile.in (cp_demangle_h): Remove.
+ (libiberty_h): Add.
+ (cp-names.tab.o, cp-names-main.tab.o, cp-support.o): Update
+ dependencies.
+ * cp-support.c: Don't include "cp-demangle.h".
+ (d_left, d_right): New macros.
+ (cp_canonicalize_string, class_name_from_physname,
+ method_name_from_physname): Fix types and component names.
+ * cp-support.h (demangled_name_to_comp, mangled_name_to_comp)
+ (cp_comp_to_string): Update prototypes.
+
2004-01-13 Daniel Jacobowitz <drow@mvista.com>
* cp-names.y: Don't include "cp-demangle.h". Convert all references
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index af681337c14..ed1da00a2ab 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -579,13 +579,13 @@ coff_sym_h = $(INCLUDE_DIR)/coff/sym.h
coff_symconst_h = $(INCLUDE_DIR)/coff/symconst.h
coff_ecoff_h = $(INCLUDE_DIR)/coff/ecoff.h
coff_internal_h = $(INCLUDE_DIR)/coff/internal.h
-cp_demangle_h = $(INCLUDE_DIR)/cp-demangle.h
dis_asm_h = $(INCLUDE_DIR)/dis-asm.h $(bfd_h)
elf_reloc_macros_h = $(INCLUDE_DIR)/elf/reloc-macros.h
elf_sh_h = $(INCLUDE_DIR)/elf/sh.h
elf_arm_h = $(INCLUDE_DIR)/elf/arm.h $(elf_reloc_macros_h)
elf_bfd_h = $(BFD_SRC)/elf-bfd.h
libaout_h = $(BFD_SRC)/libaout.h
+libiberty_h = $(INCLUDE_DIR)/libiberty.h
libbfd_h = $(BFD_SRC)/libbfd.h
remote_sim_h = $(INCLUDE_DIR)/gdb/remote-sim.h
demangle_h = $(INCLUDE_DIR)/demangle.h
@@ -1441,9 +1441,9 @@ c-exp.tab.c: c-exp.y
-rm c-exp.tmp
mv c-exp.new ./c-exp.tab.c
-cp-names.tab.o: cp-names.tab.c $(safe_ctype_h) $(cp_demangle_h)
+cp-names.tab.o: cp-names.tab.c $(safe_ctype_h) $(libiberty_h) $(demangle_h)
-cp-names-main.tab.o: cp-names.tab.c $(safe_ctype_h) $(cp_demangle_h)
+cp-names-main.tab.o: cp-names.tab.c $(safe_ctype_h) $(libiberty_h) $(demangle_h)
$(CC) -c $(INTERNAL_CFLAGS) -DTEST_CPNAMES \
-o cp-names-main.tab.o cp-names.tab.c
test-cpnames: cp-names-main.tab.o $(LIBIBERTY)
@@ -1709,7 +1709,7 @@ cp-namespace.o: cp-namespace.c $(defs_h) $(cp_support_h) $(gdb_obstack_h) \
cp-support.o: cp-support.c $(defs_h) $(cp_support_h) $(gdb_string_h) \
$(demangle_h) $(gdb_assert_h) $(gdbcmd_h) $(dictionary_h) \
$(objfiles_h) $(frame_h) $(symtab_h) $(block_h) $(complaints_h) \
- $(cp_demangle_h)
+ $(demangle_h)
cpu32bug-rom.o: cpu32bug-rom.c $(defs_h) $(gdbcore_h) $(target_h) \
$(monitor_h) $(serial_h) $(regcache_h) $(m68k_tdep_h)
cp-valprint.o: cp-valprint.c $(defs_h) $(gdb_obstack_h) $(symtab_h) \
diff --git a/gdb/cp-support.c b/gdb/cp-support.c
index 4f2c37acd8b..102e51b79ea 100644
--- a/gdb/cp-support.c
+++ b/gdb/cp-support.c
@@ -35,8 +35,8 @@
#include "complaints.h"
#include "gdbtypes.h"
-#define IN_GDB
-#include "cp-demangle.h"
+#define d_left(dc) (dc)->u.s_binary.left
+#define d_right(dc) (dc)->u.s_binary.right
/* Functions related to demangled name parsing. */
@@ -75,20 +75,20 @@ static void first_component_command (char *arg, int from_tty);
char *
cp_canonicalize_string (const char *string)
{
- struct d_info *di;
- struct d_comp *ret_comp;
+ void *storage;
+ struct demangle_component *ret_comp;
char *ret;
int len = strlen (string);
len = len + len / 8;
- ret_comp = demangled_name_to_comp (string, &di);
+ ret_comp = demangled_name_to_comp (string, &storage);
if (ret_comp == NULL)
return NULL;
ret = cp_comp_to_string (ret_comp, len);
- xfree (di);
+ xfree (storage);
return ret;
}
@@ -98,12 +98,13 @@ cp_canonicalize_string (const char *string)
char *
class_name_from_physname (const char *physname)
{
- struct d_info *di;
+ void *storage;
char *demangled_name = NULL, *ret;
- struct d_comp *ret_comp, *prev_comp;
+ struct demangle_component *ret_comp, *prev_comp;
int done;
- ret_comp = mangled_name_to_comp (physname, DMGL_ANSI, &di, &demangled_name);
+ ret_comp = mangled_name_to_comp (physname, DMGL_ANSI, &storage,
+ &demangled_name);
if (ret_comp == NULL)
return NULL;
@@ -112,31 +113,31 @@ class_name_from_physname (const char *physname)
while (!done)
switch (ret_comp->type)
{
- case D_COMP_TYPED_NAME:
+ case DEMANGLE_COMPONENT_TYPED_NAME:
prev_comp = NULL;
ret_comp = d_right (ret_comp);
break;
- case D_COMP_QUAL_NAME:
- case D_COMP_LOCAL_NAME:
+ case DEMANGLE_COMPONENT_QUAL_NAME:
+ case DEMANGLE_COMPONENT_LOCAL_NAME:
prev_comp = ret_comp;
ret_comp = d_right (ret_comp);
break;
- case D_COMP_CONST:
- case D_COMP_RESTRICT:
- case D_COMP_VOLATILE:
- case D_COMP_CONST_THIS:
- case D_COMP_RESTRICT_THIS:
- case D_COMP_VOLATILE_THIS:
- case D_COMP_VENDOR_TYPE_QUAL:
+ case DEMANGLE_COMPONENT_CONST:
+ case DEMANGLE_COMPONENT_RESTRICT:
+ case DEMANGLE_COMPONENT_VOLATILE:
+ case DEMANGLE_COMPONENT_CONST_THIS:
+ case DEMANGLE_COMPONENT_RESTRICT_THIS:
+ case DEMANGLE_COMPONENT_VOLATILE_THIS:
+ case DEMANGLE_COMPONENT_VENDOR_TYPE_QUAL:
prev_comp = NULL;
ret_comp = d_left (ret_comp);
break;
- case D_COMP_NAME:
- case D_COMP_TEMPLATE:
- case D_COMP_CTOR:
- case D_COMP_DTOR:
- case D_COMP_OPERATOR:
- case D_COMP_EXTENDED_OPERATOR:
+ case DEMANGLE_COMPONENT_NAME:
+ case DEMANGLE_COMPONENT_TEMPLATE:
+ case DEMANGLE_COMPONENT_CTOR:
+ case DEMANGLE_COMPONENT_DTOR:
+ case DEMANGLE_COMPONENT_OPERATOR:
+ case DEMANGLE_COMPONENT_EXTENDED_OPERATOR:
done = 1;
break;
default:
@@ -154,7 +155,7 @@ class_name_from_physname (const char *physname)
ret = cp_comp_to_string (prev_comp, 10);
}
- xfree (di);
+ xfree (storage);
if (demangled_name)
xfree (demangled_name);
return ret;
@@ -165,12 +166,13 @@ class_name_from_physname (const char *physname)
char *
method_name_from_physname (const char *physname)
{
- struct d_info *di;
+ void *storage;
char *demangled_name = NULL, *ret;
- struct d_comp *ret_comp;
+ struct demangle_component *ret_comp;
int done;
- ret_comp = mangled_name_to_comp (physname, DMGL_ANSI, &di, &demangled_name);
+ ret_comp = mangled_name_to_comp (physname, DMGL_ANSI, &storage,
+ &demangled_name);
if (ret_comp == NULL)
return NULL;
@@ -178,26 +180,26 @@ method_name_from_physname (const char *physname)
while (!done)
switch (ret_comp->type)
{
- case D_COMP_QUAL_NAME:
- case D_COMP_LOCAL_NAME:
- case D_COMP_TYPED_NAME:
+ case DEMANGLE_COMPONENT_QUAL_NAME:
+ case DEMANGLE_COMPONENT_LOCAL_NAME:
+ case DEMANGLE_COMPONENT_TYPED_NAME:
ret_comp = d_right (ret_comp);
break;
- case D_COMP_CONST:
- case D_COMP_RESTRICT:
- case D_COMP_VOLATILE:
- case D_COMP_CONST_THIS:
- case D_COMP_RESTRICT_THIS:
- case D_COMP_VOLATILE_THIS:
- case D_COMP_VENDOR_TYPE_QUAL:
+ case DEMANGLE_COMPONENT_CONST:
+ case DEMANGLE_COMPONENT_RESTRICT:
+ case DEMANGLE_COMPONENT_VOLATILE:
+ case DEMANGLE_COMPONENT_CONST_THIS:
+ case DEMANGLE_COMPONENT_RESTRICT_THIS:
+ case DEMANGLE_COMPONENT_VOLATILE_THIS:
+ case DEMANGLE_COMPONENT_VENDOR_TYPE_QUAL:
ret_comp = d_left (ret_comp);
break;
- case D_COMP_NAME:
- case D_COMP_TEMPLATE:
- case D_COMP_CTOR:
- case D_COMP_DTOR:
- case D_COMP_OPERATOR:
- case D_COMP_EXTENDED_OPERATOR:
+ case DEMANGLE_COMPONENT_NAME:
+ case DEMANGLE_COMPONENT_TEMPLATE:
+ case DEMANGLE_COMPONENT_CTOR:
+ case DEMANGLE_COMPONENT_DTOR:
+ case DEMANGLE_COMPONENT_OPERATOR:
+ case DEMANGLE_COMPONENT_EXTENDED_OPERATOR:
done = 1;
break;
default:
@@ -211,7 +213,7 @@ method_name_from_physname (const char *physname)
/* The ten is completely arbitrary; we don't have a good estimate. */
ret = cp_comp_to_string (ret_comp, 10);
- xfree (di);
+ xfree (storage);
if (demangled_name)
xfree (demangled_name);
return ret;
diff --git a/gdb/cp-support.h b/gdb/cp-support.h
index deebb1df28c..956dac865d4 100644
--- a/gdb/cp-support.h
+++ b/gdb/cp-support.h
@@ -35,7 +35,7 @@ struct obstack;
struct block;
struct objfile;
struct type;
-struct d_comp;
+struct demangle_component;
struct d_info;
/* This struct is designed to store data from using directives. It
@@ -114,15 +114,15 @@ extern void cp_check_possible_namespace_symbols (const char *name,
/* Functions from cp-names.y. */
-extern struct d_comp *demangled_name_to_comp (const char *demangled_name,
- struct d_info **di_p);
+extern struct demangle_component *demangled_name_to_comp
+ (const char *demangled_name, void **memory_p);
-extern struct d_comp *mangled_name_to_comp (const char *mangled_name,
- int options,
- struct d_info **di_p,
- char **demangled_p);
+extern struct demangle_component *mangled_name_to_comp
+ (const char *mangled_name, int options, void **memory_p,
+ char **demangled_name_p);
-extern char *cp_comp_to_string (struct d_comp *result, int estimated_len);
+extern char *cp_comp_to_string (struct demangle_component *result,
+ int estimated_len);
/* The list of "maint cplus" commands. */