Commit 23b1a789 by Jan Kratochvil Committed by Tom Tromey

demangle.h (enum demangle_component_type…

demangle.h (enum demangle_component_type <DEMANGLE_COMPONENT_GLOBAL_CONSTRUCTORS>) (enum demangle_component_type <DEMANGLE_COMPONENT_GLOBAL_DESTRUCTORS>): New.

include
2009-07-17  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* demangle.h
	(enum demangle_component_type <DEMANGLE_COMPONENT_GLOBAL_CONSTRUCTORS>)
	(enum demangle_component_type <DEMANGLE_COMPONENT_GLOBAL_DESTRUCTORS>):
	New.
libiberty
2009-07-17  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* cp-demangle.c (d_print_comp <DEMANGLE_COMPONENT_GLOBAL_CONSTRUCTORS>)
	(d_print_comp <DEMANGLE_COMPONENT_GLOBAL_DESTRUCTORS): New.
	(d_make_comp <DEMANGLE_COMPONENT_GLOBAL_CONSTRUCTORS>)
	(d_make_comp <DEMANGLE_COMPONENT_GLOBAL_DESTRUCTORS): New.
	(d_demangle_callback): The variable type is now declared as enum.
	Replace parser of _GLOBAL_ symbols by a d_make_comp call.

From-SVN: r149756
parent a0ce0e6e
2009-07-17 Jan Kratochvil <jan.kratochvil@redhat.com>
* demangle.h
(enum demangle_component_type <DEMANGLE_COMPONENT_GLOBAL_CONSTRUCTORS>)
(enum demangle_component_type <DEMANGLE_COMPONENT_GLOBAL_DESTRUCTORS>):
New.
2009-07-09 Jakub Jelinek <jakub@redhat.com> 2009-07-09 Jakub Jelinek <jakub@redhat.com>
* dwarf2.h (enum dwarf_location_atom): Add DW_OP_implicit_value * dwarf2.h (enum dwarf_location_atom): Add DW_OP_implicit_value
......
...@@ -377,6 +377,10 @@ enum demangle_component_type ...@@ -377,6 +377,10 @@ enum demangle_component_type
DEMANGLE_COMPONENT_CHARACTER, DEMANGLE_COMPONENT_CHARACTER,
/* A decltype type. */ /* A decltype type. */
DEMANGLE_COMPONENT_DECLTYPE, DEMANGLE_COMPONENT_DECLTYPE,
/* Global constructors keyed to name. */
DEMANGLE_COMPONENT_GLOBAL_CONSTRUCTORS,
/* Global destructors keyed to name. */
DEMANGLE_COMPONENT_GLOBAL_DESTRUCTORS,
/* A pack expansion. */ /* A pack expansion. */
DEMANGLE_COMPONENT_PACK_EXPANSION DEMANGLE_COMPONENT_PACK_EXPANSION
}; };
......
2009-07-17 Jan Kratochvil <jan.kratochvil@redhat.com>
* cp-demangle.c (d_print_comp <DEMANGLE_COMPONENT_GLOBAL_CONSTRUCTORS>)
(d_print_comp <DEMANGLE_COMPONENT_GLOBAL_DESTRUCTORS): New.
(d_make_comp <DEMANGLE_COMPONENT_GLOBAL_CONSTRUCTORS>)
(d_make_comp <DEMANGLE_COMPONENT_GLOBAL_DESTRUCTORS): New.
(d_demangle_callback): The variable type is now declared as enum.
Replace parser of _GLOBAL_ symbols by a d_make_comp call.
2009-06-21 Jakub Jelinek <jakub@redhat.com> 2009-06-21 Jakub Jelinek <jakub@redhat.com>
* hashtab.c (htab_traverse): Don't call htab_expand for * hashtab.c (htab_traverse): Don't call htab_expand for
......
...@@ -819,6 +819,8 @@ d_make_comp (struct d_info *di, enum demangle_component_type type, ...@@ -819,6 +819,8 @@ d_make_comp (struct d_info *di, enum demangle_component_type type,
case DEMANGLE_COMPONENT_JAVA_RESOURCE: case DEMANGLE_COMPONENT_JAVA_RESOURCE:
case DEMANGLE_COMPONENT_DECLTYPE: case DEMANGLE_COMPONENT_DECLTYPE:
case DEMANGLE_COMPONENT_PACK_EXPANSION: case DEMANGLE_COMPONENT_PACK_EXPANSION:
case DEMANGLE_COMPONENT_GLOBAL_CONSTRUCTORS:
case DEMANGLE_COMPONENT_GLOBAL_DESTRUCTORS:
if (left == NULL) if (left == NULL)
return NULL; return NULL;
break; break;
...@@ -4054,6 +4056,16 @@ d_print_comp (struct d_print_info *dpi, ...@@ -4054,6 +4056,16 @@ d_print_comp (struct d_print_info *dpi,
return; return;
} }
case DEMANGLE_COMPONENT_GLOBAL_CONSTRUCTORS:
d_append_string (dpi, "global constructors keyed to ");
d_print_comp (dpi, dc->u.s_binary.left);
return;
case DEMANGLE_COMPONENT_GLOBAL_DESTRUCTORS:
d_append_string (dpi, "global destructors keyed to ");
d_print_comp (dpi, dc->u.s_binary.left);
return;
default: default:
d_print_error (dpi); d_print_error (dpi);
return; return;
...@@ -4484,33 +4496,30 @@ static int ...@@ -4484,33 +4496,30 @@ static int
d_demangle_callback (const char *mangled, int options, d_demangle_callback (const char *mangled, int options,
demangle_callbackref callback, void *opaque) demangle_callbackref callback, void *opaque)
{ {
int type; enum
{
DCT_TYPE,
DCT_MANGLED,
DCT_GLOBAL_CTORS,
DCT_GLOBAL_DTORS
}
type;
struct d_info di; struct d_info di;
struct demangle_component *dc; struct demangle_component *dc;
int status; int status;
if (mangled[0] == '_' && mangled[1] == 'Z') if (mangled[0] == '_' && mangled[1] == 'Z')
type = 0; type = DCT_MANGLED;
else if (strncmp (mangled, "_GLOBAL_", 8) == 0 else if (strncmp (mangled, "_GLOBAL_", 8) == 0
&& (mangled[8] == '.' || mangled[8] == '_' || mangled[8] == '$') && (mangled[8] == '.' || mangled[8] == '_' || mangled[8] == '$')
&& (mangled[9] == 'D' || mangled[9] == 'I') && (mangled[9] == 'D' || mangled[9] == 'I')
&& mangled[10] == '_') && mangled[10] == '_')
{ type = mangled[9] == 'I' ? DCT_GLOBAL_CTORS : DCT_GLOBAL_DTORS;
const char *intro;
intro = (mangled[9] == 'I')
? "global constructors keyed to "
: "global destructors keyed to ";
callback (intro, strlen (intro), opaque);
callback (mangled + 11, strlen (mangled + 11), opaque);
return 1;
}
else else
{ {
if ((options & DMGL_TYPES) == 0) if ((options & DMGL_TYPES) == 0)
return 0; return 0;
type = 1; type = DCT_TYPE;
} }
cplus_demangle_init_info (mangled, options, strlen (mangled), &di); cplus_demangle_init_info (mangled, options, strlen (mangled), &di);
...@@ -4527,10 +4536,26 @@ d_demangle_callback (const char *mangled, int options, ...@@ -4527,10 +4536,26 @@ d_demangle_callback (const char *mangled, int options,
di.subs = alloca (di.num_subs * sizeof (*di.subs)); di.subs = alloca (di.num_subs * sizeof (*di.subs));
#endif #endif
if (type) switch (type)
dc = cplus_demangle_type (&di); {
else case DCT_TYPE:
dc = cplus_demangle_mangled_name (&di, 1); dc = cplus_demangle_type (&di);
break;
case DCT_MANGLED:
dc = cplus_demangle_mangled_name (&di, 1);
break;
case DCT_GLOBAL_CTORS:
case DCT_GLOBAL_DTORS:
d_advance (&di, 11);
dc = d_make_comp (&di,
(type == DCT_GLOBAL_CTORS
? DEMANGLE_COMPONENT_GLOBAL_CONSTRUCTORS
: DEMANGLE_COMPONENT_GLOBAL_DESTRUCTORS),
d_make_name (&di, d_str (&di), strlen (d_str (&di))),
NULL);
d_advance (&di, strlen (d_str (&di)));
break;
}
/* If DMGL_PARAMS is set, then if we didn't consume the entire /* If DMGL_PARAMS is set, then if we didn't consume the entire
mangled string, then we didn't successfully demangle it. If mangled string, then we didn't successfully demangle it. If
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment