Import libcxxrt e64e93fe5bba67a6d52cbe5a97f8770c054bfa65
Implements __cxa_throw_bad_array_new_length, which is generated by gcc 4.9 and later. Also, some demangle support and fixes.
This commit is contained in:
parent
5169502213
commit
fec583f48b
@ -75,3 +75,8 @@ extern "C" void __cxa_deleted_virtual()
|
|||||||
{
|
{
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" void __cxa_throw_bad_array_new_length()
|
||||||
|
{
|
||||||
|
throw std::bad_array_new_length();
|
||||||
|
}
|
||||||
|
18
external/bsd/libc++/dist/libcxxrt/src/dwarf_eh.h
vendored
18
external/bsd/libc++/dist/libcxxrt/src/dwarf_eh.h
vendored
@ -218,15 +218,17 @@ static int64_t read_sleb128(dw_eh_ptr_t *data)
|
|||||||
static uint64_t read_value(char encoding, dw_eh_ptr_t *data)
|
static uint64_t read_value(char encoding, dw_eh_ptr_t *data)
|
||||||
{
|
{
|
||||||
enum dwarf_data_encoding type = get_encoding(encoding);
|
enum dwarf_data_encoding type = get_encoding(encoding);
|
||||||
uint64_t v;
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
// Read fixed-length types
|
// Read fixed-length types
|
||||||
#define READ(dwarf, type) \
|
#define READ(dwarf, type) \
|
||||||
case dwarf:\
|
case dwarf:\
|
||||||
v = static_cast<uint64_t>(*reinterpret_cast<type*>(*data));\
|
{\
|
||||||
*data += sizeof(type);\
|
type t;\
|
||||||
break;
|
memcpy(&t, *data, sizeof t);\
|
||||||
|
*data += sizeof t;\
|
||||||
|
return static_cast<uint64_t>(t);\
|
||||||
|
}
|
||||||
READ(DW_EH_PE_udata2, uint16_t)
|
READ(DW_EH_PE_udata2, uint16_t)
|
||||||
READ(DW_EH_PE_udata4, uint32_t)
|
READ(DW_EH_PE_udata4, uint32_t)
|
||||||
READ(DW_EH_PE_udata8, uint64_t)
|
READ(DW_EH_PE_udata8, uint64_t)
|
||||||
@ -237,15 +239,11 @@ static uint64_t read_value(char encoding, dw_eh_ptr_t *data)
|
|||||||
#undef READ
|
#undef READ
|
||||||
// Read variable-length types
|
// Read variable-length types
|
||||||
case DW_EH_PE_sleb128:
|
case DW_EH_PE_sleb128:
|
||||||
v = read_sleb128(data);
|
return read_sleb128(data);
|
||||||
break;
|
|
||||||
case DW_EH_PE_uleb128:
|
case DW_EH_PE_uleb128:
|
||||||
v = read_uleb128(data);
|
return read_uleb128(data);
|
||||||
break;
|
|
||||||
default: abort();
|
default: abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
return v;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -59,7 +59,7 @@ struct vector_str {
|
|||||||
|
|
||||||
enum type_qualifier {
|
enum type_qualifier {
|
||||||
TYPE_PTR, TYPE_REF, TYPE_CMX, TYPE_IMG, TYPE_EXT, TYPE_RST, TYPE_VAT,
|
TYPE_PTR, TYPE_REF, TYPE_CMX, TYPE_IMG, TYPE_EXT, TYPE_RST, TYPE_VAT,
|
||||||
TYPE_CST
|
TYPE_CST, TYPE_VEC
|
||||||
};
|
};
|
||||||
|
|
||||||
struct vector_type_qualifier {
|
struct vector_type_qualifier {
|
||||||
@ -397,6 +397,8 @@ static int cpp_demangle_read_array(struct cpp_demangle_data *);
|
|||||||
static int cpp_demangle_read_encoding(struct cpp_demangle_data *);
|
static int cpp_demangle_read_encoding(struct cpp_demangle_data *);
|
||||||
static int cpp_demangle_read_expr_primary(struct cpp_demangle_data *);
|
static int cpp_demangle_read_expr_primary(struct cpp_demangle_data *);
|
||||||
static int cpp_demangle_read_expression(struct cpp_demangle_data *);
|
static int cpp_demangle_read_expression(struct cpp_demangle_data *);
|
||||||
|
static int cpp_demangle_read_expression_flat(struct cpp_demangle_data *,
|
||||||
|
char **);
|
||||||
static int cpp_demangle_read_expression_binary(struct cpp_demangle_data *,
|
static int cpp_demangle_read_expression_binary(struct cpp_demangle_data *,
|
||||||
const char *, size_t);
|
const char *, size_t);
|
||||||
static int cpp_demangle_read_expression_unary(struct cpp_demangle_data *,
|
static int cpp_demangle_read_expression_unary(struct cpp_demangle_data *,
|
||||||
@ -408,8 +410,12 @@ static int cpp_demangle_read_function(struct cpp_demangle_data *, int *,
|
|||||||
static int cpp_demangle_local_source_name(struct cpp_demangle_data *ddata);
|
static int cpp_demangle_local_source_name(struct cpp_demangle_data *ddata);
|
||||||
static int cpp_demangle_read_local_name(struct cpp_demangle_data *);
|
static int cpp_demangle_read_local_name(struct cpp_demangle_data *);
|
||||||
static int cpp_demangle_read_name(struct cpp_demangle_data *);
|
static int cpp_demangle_read_name(struct cpp_demangle_data *);
|
||||||
|
static int cpp_demangle_read_name_flat(struct cpp_demangle_data *,
|
||||||
|
char**);
|
||||||
static int cpp_demangle_read_nested_name(struct cpp_demangle_data *);
|
static int cpp_demangle_read_nested_name(struct cpp_demangle_data *);
|
||||||
static int cpp_demangle_read_number(struct cpp_demangle_data *, long *);
|
static int cpp_demangle_read_number(struct cpp_demangle_data *, long *);
|
||||||
|
static int cpp_demangle_read_number_as_string(struct cpp_demangle_data *,
|
||||||
|
char **);
|
||||||
static int cpp_demangle_read_nv_offset(struct cpp_demangle_data *);
|
static int cpp_demangle_read_nv_offset(struct cpp_demangle_data *);
|
||||||
static int cpp_demangle_read_offset(struct cpp_demangle_data *);
|
static int cpp_demangle_read_offset(struct cpp_demangle_data *);
|
||||||
static int cpp_demangle_read_offset_number(struct cpp_demangle_data *);
|
static int cpp_demangle_read_offset_number(struct cpp_demangle_data *);
|
||||||
@ -423,6 +429,8 @@ static int cpp_demangle_read_tmpl_arg(struct cpp_demangle_data *);
|
|||||||
static int cpp_demangle_read_tmpl_args(struct cpp_demangle_data *);
|
static int cpp_demangle_read_tmpl_args(struct cpp_demangle_data *);
|
||||||
static int cpp_demangle_read_tmpl_param(struct cpp_demangle_data *);
|
static int cpp_demangle_read_tmpl_param(struct cpp_demangle_data *);
|
||||||
static int cpp_demangle_read_type(struct cpp_demangle_data *, int);
|
static int cpp_demangle_read_type(struct cpp_demangle_data *, int);
|
||||||
|
static int cpp_demangle_read_type_flat(struct cpp_demangle_data *,
|
||||||
|
char **);
|
||||||
static int cpp_demangle_read_uqname(struct cpp_demangle_data *);
|
static int cpp_demangle_read_uqname(struct cpp_demangle_data *);
|
||||||
static int cpp_demangle_read_v_offset(struct cpp_demangle_data *);
|
static int cpp_demangle_read_v_offset(struct cpp_demangle_data *);
|
||||||
static char *decode_fp_to_double(const char *, size_t);
|
static char *decode_fp_to_double(const char *, size_t);
|
||||||
@ -601,17 +609,18 @@ cpp_demangle_push_fp(struct cpp_demangle_data *ddata,
|
|||||||
fp = ddata->cur;
|
fp = ddata->cur;
|
||||||
while (*ddata->cur != 'E')
|
while (*ddata->cur != 'E')
|
||||||
++ddata->cur;
|
++ddata->cur;
|
||||||
++ddata->cur;
|
|
||||||
|
|
||||||
if ((f = decoder(fp, ddata->cur - fp)) == NULL)
|
if ((f = decoder(fp, ddata->cur - fp)) == NULL)
|
||||||
return (0);
|
return (0);
|
||||||
|
|
||||||
rtn = 0;
|
rtn = 0;
|
||||||
if ((len = strlen(f)) > 0)
|
if ((len = strlen(f)) > 0)
|
||||||
rtn = cpp_demangle_push_str(ddata, f, len);
|
rtn = cpp_demangle_push_str(ddata, f, len);
|
||||||
|
|
||||||
free(f);
|
free(f);
|
||||||
|
|
||||||
|
++ddata->cur;
|
||||||
|
|
||||||
return (rtn);
|
return (rtn);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -695,7 +704,8 @@ cpp_demangle_push_type_qualifier(struct cpp_demangle_data *ddata,
|
|||||||
if (type_str != NULL) {
|
if (type_str != NULL) {
|
||||||
if (!vector_str_push(&subst_v, "*", 1))
|
if (!vector_str_push(&subst_v, "*", 1))
|
||||||
goto clean;
|
goto clean;
|
||||||
if (!cpp_demangle_push_subst_v(ddata, &subst_v))
|
if (!cpp_demangle_push_subst_v(ddata,
|
||||||
|
&subst_v))
|
||||||
goto clean;
|
goto clean;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -706,7 +716,8 @@ cpp_demangle_push_type_qualifier(struct cpp_demangle_data *ddata,
|
|||||||
if (type_str != NULL) {
|
if (type_str != NULL) {
|
||||||
if (!vector_str_push(&subst_v, "&", 1))
|
if (!vector_str_push(&subst_v, "&", 1))
|
||||||
goto clean;
|
goto clean;
|
||||||
if (!cpp_demangle_push_subst_v(ddata, &subst_v))
|
if (!cpp_demangle_push_subst_v(ddata,
|
||||||
|
&subst_v))
|
||||||
goto clean;
|
goto clean;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -717,7 +728,8 @@ cpp_demangle_push_type_qualifier(struct cpp_demangle_data *ddata,
|
|||||||
if (type_str != NULL) {
|
if (type_str != NULL) {
|
||||||
if (!vector_str_push(&subst_v, " complex", 8))
|
if (!vector_str_push(&subst_v, " complex", 8))
|
||||||
goto clean;
|
goto clean;
|
||||||
if (!cpp_demangle_push_subst_v(ddata, &subst_v))
|
if (!cpp_demangle_push_subst_v(ddata,
|
||||||
|
&subst_v))
|
||||||
goto clean;
|
goto clean;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -726,23 +738,26 @@ cpp_demangle_push_type_qualifier(struct cpp_demangle_data *ddata,
|
|||||||
if (!cpp_demangle_push_str(ddata, " imaginary", 10))
|
if (!cpp_demangle_push_str(ddata, " imaginary", 10))
|
||||||
goto clean;
|
goto clean;
|
||||||
if (type_str != NULL) {
|
if (type_str != NULL) {
|
||||||
if (!vector_str_push(&subst_v, " imaginary", 10))
|
if (!vector_str_push(&subst_v, " imaginary",
|
||||||
|
10))
|
||||||
goto clean;
|
goto clean;
|
||||||
if (!cpp_demangle_push_subst_v(ddata, &subst_v))
|
if (!cpp_demangle_push_subst_v(ddata,
|
||||||
|
&subst_v))
|
||||||
goto clean;
|
goto clean;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_EXT:
|
case TYPE_EXT:
|
||||||
if (e_idx > v->ext_name.size - 1)
|
if (v->ext_name.size == 0 ||
|
||||||
|
e_idx > v->ext_name.size - 1)
|
||||||
goto clean;
|
goto clean;
|
||||||
if ((e_len = strlen(v->ext_name.container[e_idx])) == 0)
|
if ((e_len = strlen(v->ext_name.container[e_idx])) ==
|
||||||
|
0)
|
||||||
goto clean;
|
goto clean;
|
||||||
if ((buf = malloc(sizeof(char) * (e_len + 1))) == NULL)
|
if ((buf = malloc(e_len + 2)) == NULL)
|
||||||
goto clean;
|
goto clean;
|
||||||
|
snprintf(buf, e_len + 2, " %s",
|
||||||
memcpy(buf, " ", 1);
|
v->ext_name.container[e_idx]);
|
||||||
memcpy(buf + 1, v->ext_name.container[e_idx], e_len);
|
|
||||||
|
|
||||||
if (!cpp_demangle_push_str(ddata, buf, e_len + 1)) {
|
if (!cpp_demangle_push_str(ddata, buf, e_len + 1)) {
|
||||||
free(buf);
|
free(buf);
|
||||||
@ -755,7 +770,8 @@ cpp_demangle_push_type_qualifier(struct cpp_demangle_data *ddata,
|
|||||||
free(buf);
|
free(buf);
|
||||||
goto clean;
|
goto clean;
|
||||||
}
|
}
|
||||||
if (!cpp_demangle_push_subst_v(ddata, &subst_v)) {
|
if (!cpp_demangle_push_subst_v(ddata,
|
||||||
|
&subst_v)) {
|
||||||
free(buf);
|
free(buf);
|
||||||
goto clean;
|
goto clean;
|
||||||
}
|
}
|
||||||
@ -770,7 +786,8 @@ cpp_demangle_push_type_qualifier(struct cpp_demangle_data *ddata,
|
|||||||
if (type_str != NULL) {
|
if (type_str != NULL) {
|
||||||
if (!vector_str_push(&subst_v, " restrict", 9))
|
if (!vector_str_push(&subst_v, " restrict", 9))
|
||||||
goto clean;
|
goto clean;
|
||||||
if (!cpp_demangle_push_subst_v(ddata, &subst_v))
|
if (!cpp_demangle_push_subst_v(ddata,
|
||||||
|
&subst_v))
|
||||||
goto clean;
|
goto clean;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -781,7 +798,8 @@ cpp_demangle_push_type_qualifier(struct cpp_demangle_data *ddata,
|
|||||||
if (type_str != NULL) {
|
if (type_str != NULL) {
|
||||||
if (!vector_str_push(&subst_v, " volatile", 9))
|
if (!vector_str_push(&subst_v, " volatile", 9))
|
||||||
goto clean;
|
goto clean;
|
||||||
if (!cpp_demangle_push_subst_v(ddata, &subst_v))
|
if (!cpp_demangle_push_subst_v(ddata,
|
||||||
|
&subst_v))
|
||||||
goto clean;
|
goto clean;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -792,11 +810,42 @@ cpp_demangle_push_type_qualifier(struct cpp_demangle_data *ddata,
|
|||||||
if (type_str != NULL) {
|
if (type_str != NULL) {
|
||||||
if (!vector_str_push(&subst_v, " const", 6))
|
if (!vector_str_push(&subst_v, " const", 6))
|
||||||
goto clean;
|
goto clean;
|
||||||
if (!cpp_demangle_push_subst_v(ddata, &subst_v))
|
if (!cpp_demangle_push_subst_v(ddata,
|
||||||
|
&subst_v))
|
||||||
goto clean;
|
goto clean;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case TYPE_VEC:
|
||||||
|
if (v->ext_name.size == 0 ||
|
||||||
|
e_idx > v->ext_name.size - 1)
|
||||||
|
goto clean;
|
||||||
|
if ((e_len = strlen(v->ext_name.container[e_idx])) ==
|
||||||
|
0)
|
||||||
|
goto clean;
|
||||||
|
if ((buf = malloc(e_len + 12)) == NULL)
|
||||||
|
goto clean;
|
||||||
|
snprintf(buf, e_len + 12, " __vector(%s)",
|
||||||
|
v->ext_name.container[e_idx]);
|
||||||
|
if (!cpp_demangle_push_str(ddata, buf, e_len + 11)) {
|
||||||
|
free(buf);
|
||||||
|
goto clean;
|
||||||
|
}
|
||||||
|
if (type_str != NULL) {
|
||||||
|
if (!vector_str_push(&subst_v, buf,
|
||||||
|
e_len + 11)) {
|
||||||
|
free(buf);
|
||||||
|
goto clean;
|
||||||
|
}
|
||||||
|
if (!cpp_demangle_push_subst_v(ddata,
|
||||||
|
&subst_v)) {
|
||||||
|
free(buf);
|
||||||
|
goto clean;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
free(buf);
|
||||||
|
++e_idx;
|
||||||
|
break;
|
||||||
};
|
};
|
||||||
--idx;
|
--idx;
|
||||||
}
|
}
|
||||||
@ -947,10 +996,14 @@ cpp_demangle_read_expr_primary(struct cpp_demangle_data *ddata)
|
|||||||
|
|
||||||
switch (*ddata->cur) {
|
switch (*ddata->cur) {
|
||||||
case 'b':
|
case 'b':
|
||||||
|
if (*(ddata->cur + 2) != 'E')
|
||||||
|
return (0);
|
||||||
switch (*(++ddata->cur)) {
|
switch (*(++ddata->cur)) {
|
||||||
case '0':
|
case '0':
|
||||||
|
ddata->cur += 2;
|
||||||
return (cpp_demangle_push_str(ddata, "false", 5));
|
return (cpp_demangle_push_str(ddata, "false", 5));
|
||||||
case '1':
|
case '1':
|
||||||
|
ddata->cur += 2;
|
||||||
return (cpp_demangle_push_str(ddata, "true", 4));
|
return (cpp_demangle_push_str(ddata, "true", 4));
|
||||||
default:
|
default:
|
||||||
return (0);
|
return (0);
|
||||||
@ -999,7 +1052,8 @@ cpp_demangle_read_expr_primary(struct cpp_demangle_data *ddata)
|
|||||||
++ddata->cur;
|
++ddata->cur;
|
||||||
}
|
}
|
||||||
++ddata->cur;
|
++ddata->cur;
|
||||||
return (cpp_demangle_push_str(ddata, num, ddata->cur - num));
|
return (cpp_demangle_push_str(ddata, num,
|
||||||
|
ddata->cur - num - 1));
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return (0);
|
return (0);
|
||||||
@ -1290,6 +1344,38 @@ cpp_demangle_read_expression(struct cpp_demangle_data *ddata)
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
cpp_demangle_read_expression_flat(struct cpp_demangle_data *ddata, char **str)
|
||||||
|
{
|
||||||
|
struct vector_str *output;
|
||||||
|
size_t i, p_idx, idx, exp_len;
|
||||||
|
char *exp;
|
||||||
|
|
||||||
|
output = ddata->push_head > 0 ? &ddata->output_tmp :
|
||||||
|
&ddata->output;
|
||||||
|
|
||||||
|
p_idx = output->size;
|
||||||
|
|
||||||
|
if (!cpp_demangle_read_expression(ddata))
|
||||||
|
return (0);
|
||||||
|
|
||||||
|
if ((exp = vector_str_substr(output, p_idx, output->size - 1,
|
||||||
|
&exp_len)) == NULL)
|
||||||
|
return (0);
|
||||||
|
|
||||||
|
idx = output->size;
|
||||||
|
for (i = p_idx; i < idx; ++i) {
|
||||||
|
if (!vector_str_pop(output)) {
|
||||||
|
free(exp);
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*str = exp;
|
||||||
|
|
||||||
|
return (1);
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
cpp_demangle_read_expression_binary(struct cpp_demangle_data *ddata,
|
cpp_demangle_read_expression_binary(struct cpp_demangle_data *ddata,
|
||||||
const char *name, size_t len)
|
const char *name, size_t len)
|
||||||
@ -1419,12 +1505,65 @@ cpp_demangle_read_function(struct cpp_demangle_data *ddata, int *ext_c,
|
|||||||
static int
|
static int
|
||||||
cpp_demangle_read_encoding(struct cpp_demangle_data *ddata)
|
cpp_demangle_read_encoding(struct cpp_demangle_data *ddata)
|
||||||
{
|
{
|
||||||
|
char *name, *type, *num_str;
|
||||||
|
long offset;
|
||||||
|
int rtn;
|
||||||
|
|
||||||
if (ddata == NULL || *ddata->cur == '\0')
|
if (ddata == NULL || *ddata->cur == '\0')
|
||||||
return (0);
|
return (0);
|
||||||
|
|
||||||
/* special name */
|
/* special name */
|
||||||
switch (SIMPLE_HASH(*ddata->cur, *(ddata->cur + 1))) {
|
switch (SIMPLE_HASH(*ddata->cur, *(ddata->cur + 1))) {
|
||||||
|
case SIMPLE_HASH('G', 'A'):
|
||||||
|
if (!cpp_demangle_push_str(ddata, "hidden alias for ", 17))
|
||||||
|
return (0);
|
||||||
|
ddata->cur += 2;
|
||||||
|
if (*ddata->cur == '\0')
|
||||||
|
return (0);
|
||||||
|
return (cpp_demangle_read_encoding(ddata));
|
||||||
|
|
||||||
|
case SIMPLE_HASH('G', 'R'):
|
||||||
|
if (!cpp_demangle_push_str(ddata, "reference temporary #", 21))
|
||||||
|
return (0);
|
||||||
|
ddata->cur += 2;
|
||||||
|
if (*ddata->cur == '\0')
|
||||||
|
return (0);
|
||||||
|
if (!cpp_demangle_read_name_flat(ddata, &name))
|
||||||
|
return (0);
|
||||||
|
rtn = 0;
|
||||||
|
if (!cpp_demangle_read_number_as_string(ddata, &num_str))
|
||||||
|
goto clean1;
|
||||||
|
if (!cpp_demangle_push_str(ddata, num_str, strlen(num_str)))
|
||||||
|
goto clean2;
|
||||||
|
if (!cpp_demangle_push_str(ddata, " for ", 5))
|
||||||
|
goto clean2;
|
||||||
|
if (!cpp_demangle_push_str(ddata, name, strlen(name)))
|
||||||
|
goto clean2;
|
||||||
|
rtn = 1;
|
||||||
|
clean2:
|
||||||
|
free(num_str);
|
||||||
|
clean1:
|
||||||
|
free(name);
|
||||||
|
return (rtn);
|
||||||
|
|
||||||
|
case SIMPLE_HASH('G', 'T'):
|
||||||
|
ddata->cur += 2;
|
||||||
|
if (*ddata->cur == '\0')
|
||||||
|
return (0);
|
||||||
|
switch (*ddata->cur) {
|
||||||
|
case 'n':
|
||||||
|
if (!cpp_demangle_push_str(ddata,
|
||||||
|
"non-transaction clone for ", 26))
|
||||||
|
return (0);
|
||||||
|
case 't':
|
||||||
|
default:
|
||||||
|
if (!cpp_demangle_push_str(ddata,
|
||||||
|
"transaction clone for ", 22))
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
++ddata->cur;
|
||||||
|
return (cpp_demangle_read_encoding(ddata));
|
||||||
|
|
||||||
case SIMPLE_HASH('G', 'V'):
|
case SIMPLE_HASH('G', 'V'):
|
||||||
/* sentry object for 1 time init */
|
/* sentry object for 1 time init */
|
||||||
if (!cpp_demangle_push_str(ddata, "guard variable for ", 20))
|
if (!cpp_demangle_push_str(ddata, "guard variable for ", 20))
|
||||||
@ -1446,14 +1585,49 @@ cpp_demangle_read_encoding(struct cpp_demangle_data *ddata)
|
|||||||
return (0);
|
return (0);
|
||||||
return (cpp_demangle_read_encoding(ddata));
|
return (cpp_demangle_read_encoding(ddata));
|
||||||
|
|
||||||
|
case SIMPLE_HASH('T', 'C'):
|
||||||
|
/* construction vtable */
|
||||||
|
if (!cpp_demangle_push_str(ddata, "construction vtable for ",
|
||||||
|
24))
|
||||||
|
return (0);
|
||||||
|
ddata->cur += 2;
|
||||||
|
if (*ddata->cur == '\0')
|
||||||
|
return (0);
|
||||||
|
if (!cpp_demangle_read_type_flat(ddata, &type))
|
||||||
|
return (0);
|
||||||
|
rtn = 0;
|
||||||
|
if (!cpp_demangle_read_number(ddata, &offset))
|
||||||
|
goto clean3;
|
||||||
|
if (*ddata->cur++ != '_')
|
||||||
|
goto clean3;
|
||||||
|
if (!cpp_demangle_read_type(ddata, 0))
|
||||||
|
goto clean3;
|
||||||
|
if (!cpp_demangle_push_str(ddata, "-in-", 4))
|
||||||
|
goto clean3;
|
||||||
|
if (!cpp_demangle_push_str(ddata, type, strlen(type)))
|
||||||
|
goto clean3;
|
||||||
|
rtn = 1;
|
||||||
|
clean3:
|
||||||
|
free(type);
|
||||||
|
return (rtn);
|
||||||
|
|
||||||
case SIMPLE_HASH('T', 'D'):
|
case SIMPLE_HASH('T', 'D'):
|
||||||
/* typeinfo common proxy */
|
/* typeinfo common proxy */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case SIMPLE_HASH('T', 'F'):
|
||||||
|
/* typeinfo fn */
|
||||||
|
if (!cpp_demangle_push_str(ddata, "typeinfo fn for ", 16))
|
||||||
|
return (0);
|
||||||
|
ddata->cur += 2;
|
||||||
|
if (*ddata->cur == '\0')
|
||||||
|
return (0);
|
||||||
|
return (cpp_demangle_read_type(ddata, 0));
|
||||||
|
|
||||||
case SIMPLE_HASH('T', 'h'):
|
case SIMPLE_HASH('T', 'h'):
|
||||||
/* virtual function non-virtual override thunk */
|
/* virtual function non-virtual override thunk */
|
||||||
if (cpp_demangle_push_str(ddata,
|
if (!cpp_demangle_push_str(ddata,
|
||||||
"virtual function non-virtual override ", 38) == 0)
|
"virtual function non-virtual override ", 38))
|
||||||
return (0);
|
return (0);
|
||||||
ddata->cur += 2;
|
ddata->cur += 2;
|
||||||
if (*ddata->cur == '\0')
|
if (*ddata->cur == '\0')
|
||||||
@ -1462,24 +1636,51 @@ cpp_demangle_read_encoding(struct cpp_demangle_data *ddata)
|
|||||||
return (0);
|
return (0);
|
||||||
return (cpp_demangle_read_encoding(ddata));
|
return (cpp_demangle_read_encoding(ddata));
|
||||||
|
|
||||||
case SIMPLE_HASH('T', 'I'):
|
case SIMPLE_HASH('T', 'H'):
|
||||||
/* typeinfo structure */
|
/* TLS init function */
|
||||||
/* FALLTHROUGH */
|
if (!cpp_demangle_push_str(ddata, "TLS init function for ",
|
||||||
case SIMPLE_HASH('T', 'S'):
|
22))
|
||||||
/* RTTI name (NTBS) */
|
|
||||||
if (!cpp_demangle_push_str(ddata, "typeinfo for ", 14))
|
|
||||||
return (0);
|
return (0);
|
||||||
ddata->cur += 2;
|
ddata->cur += 2;
|
||||||
if (*ddata->cur == '\0')
|
if (*ddata->cur == '\0')
|
||||||
return (0);
|
return (0);
|
||||||
return (cpp_demangle_read_type(ddata, 1));
|
break;
|
||||||
|
|
||||||
|
case SIMPLE_HASH('T', 'I'):
|
||||||
|
/* typeinfo structure */
|
||||||
|
if (!cpp_demangle_push_str(ddata, "typeinfo for ", 13))
|
||||||
|
return (0);
|
||||||
|
ddata->cur += 2;
|
||||||
|
if (*ddata->cur == '\0')
|
||||||
|
return (0);
|
||||||
|
return (cpp_demangle_read_type(ddata, 0));
|
||||||
|
|
||||||
|
case SIMPLE_HASH('T', 'J'):
|
||||||
|
/* java class */
|
||||||
|
if (!cpp_demangle_push_str(ddata, "java Class for ", 15))
|
||||||
|
return (0);
|
||||||
|
ddata->cur += 2;
|
||||||
|
if (*ddata->cur == '\0')
|
||||||
|
return (0);
|
||||||
|
return (cpp_demangle_read_type(ddata, 0));
|
||||||
|
|
||||||
|
case SIMPLE_HASH('T', 'S'):
|
||||||
|
/* RTTI name (NTBS) */
|
||||||
|
if (!cpp_demangle_push_str(ddata, "typeinfo name for ", 18))
|
||||||
|
return (0);
|
||||||
|
ddata->cur += 2;
|
||||||
|
if (*ddata->cur == '\0')
|
||||||
|
return (0);
|
||||||
|
return (cpp_demangle_read_type(ddata, 0));
|
||||||
|
|
||||||
case SIMPLE_HASH('T', 'T'):
|
case SIMPLE_HASH('T', 'T'):
|
||||||
/* VTT table */
|
/* VTT table */
|
||||||
if (!cpp_demangle_push_str(ddata, "VTT for ", 8))
|
if (!cpp_demangle_push_str(ddata, "VTT for ", 8))
|
||||||
return (0);
|
return (0);
|
||||||
ddata->cur += 2;
|
ddata->cur += 2;
|
||||||
return (cpp_demangle_read_type(ddata, 1));
|
if (*ddata->cur == '\0')
|
||||||
|
return (0);
|
||||||
|
return (cpp_demangle_read_type(ddata, 0));
|
||||||
|
|
||||||
case SIMPLE_HASH('T', 'v'):
|
case SIMPLE_HASH('T', 'v'):
|
||||||
/* virtual function virtual override thunk */
|
/* virtual function virtual override thunk */
|
||||||
@ -1500,7 +1701,17 @@ cpp_demangle_read_encoding(struct cpp_demangle_data *ddata)
|
|||||||
ddata->cur += 2;
|
ddata->cur += 2;
|
||||||
if (*ddata->cur == '\0')
|
if (*ddata->cur == '\0')
|
||||||
return (0);
|
return (0);
|
||||||
return (cpp_demangle_read_type(ddata, 1));
|
return (cpp_demangle_read_type(ddata, 0));
|
||||||
|
|
||||||
|
case SIMPLE_HASH('T', 'W'):
|
||||||
|
/* TLS wrapper function */
|
||||||
|
if (!cpp_demangle_push_str(ddata, "TLS wrapper function for ",
|
||||||
|
25))
|
||||||
|
return (0);
|
||||||
|
ddata->cur += 2;
|
||||||
|
if (*ddata->cur == '\0')
|
||||||
|
return (0);
|
||||||
|
break;
|
||||||
};
|
};
|
||||||
|
|
||||||
return (cpp_demangle_read_name(ddata));
|
return (cpp_demangle_read_name(ddata));
|
||||||
@ -1617,6 +1828,38 @@ clean:
|
|||||||
return (rtn);
|
return (rtn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
cpp_demangle_read_name_flat(struct cpp_demangle_data *ddata, char **str)
|
||||||
|
{
|
||||||
|
struct vector_str *output;
|
||||||
|
size_t i, p_idx, idx, name_len;
|
||||||
|
char *name;
|
||||||
|
|
||||||
|
output = ddata->push_head > 0 ? &ddata->output_tmp :
|
||||||
|
&ddata->output;
|
||||||
|
|
||||||
|
p_idx = output->size;
|
||||||
|
|
||||||
|
if (!cpp_demangle_read_name(ddata))
|
||||||
|
return (0);
|
||||||
|
|
||||||
|
if ((name = vector_str_substr(output, p_idx, output->size - 1,
|
||||||
|
&name_len)) == NULL)
|
||||||
|
return (0);
|
||||||
|
|
||||||
|
idx = output->size;
|
||||||
|
for (i = p_idx; i < idx; ++i) {
|
||||||
|
if (!vector_str_pop(output)) {
|
||||||
|
free(name);
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*str = name;
|
||||||
|
|
||||||
|
return (1);
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
cpp_demangle_read_nested_name(struct cpp_demangle_data *ddata)
|
cpp_demangle_read_nested_name(struct cpp_demangle_data *ddata)
|
||||||
{
|
{
|
||||||
@ -1742,6 +1985,24 @@ cpp_demangle_read_number(struct cpp_demangle_data *ddata, long *rtn)
|
|||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
cpp_demangle_read_number_as_string(struct cpp_demangle_data *ddata, char **str)
|
||||||
|
{
|
||||||
|
long n;
|
||||||
|
|
||||||
|
if (!cpp_demangle_read_number(ddata, &n)) {
|
||||||
|
*str = NULL;
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (asprintf(str, "%ld", n) < 0) {
|
||||||
|
*str = NULL;
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (1);
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
cpp_demangle_read_nv_offset(struct cpp_demangle_data *ddata)
|
cpp_demangle_read_nv_offset(struct cpp_demangle_data *ddata)
|
||||||
{
|
{
|
||||||
@ -1877,11 +2138,11 @@ cpp_demangle_read_sname(struct cpp_demangle_data *ddata)
|
|||||||
len <= 0)
|
len <= 0)
|
||||||
return (0);
|
return (0);
|
||||||
|
|
||||||
if (len == 12 && (memcmp("_GLOBAL__N_1", ddata->cur, 12) == 0))
|
if (len == 12 && (memcmp("_GLOBAL__N_1", ddata->cur, 12) == 0))
|
||||||
err = cpp_demangle_push_str(ddata, "(anonymous namespace)", 21);
|
err = cpp_demangle_push_str(ddata, "(anonymous namespace)", 21);
|
||||||
else
|
else
|
||||||
err = cpp_demangle_push_str(ddata, ddata->cur, len);
|
err = cpp_demangle_push_str(ddata, ddata->cur, len);
|
||||||
|
|
||||||
if (err == 0)
|
if (err == 0)
|
||||||
return (0);
|
return (0);
|
||||||
|
|
||||||
@ -2232,7 +2493,7 @@ cpp_demangle_read_type(struct cpp_demangle_data *ddata, int delimit)
|
|||||||
size_t p_idx, type_str_len;
|
size_t p_idx, type_str_len;
|
||||||
int extern_c, is_builtin;
|
int extern_c, is_builtin;
|
||||||
long len;
|
long len;
|
||||||
char *type_str;
|
char *type_str, *exp_str, *num_str;
|
||||||
|
|
||||||
if (ddata == NULL)
|
if (ddata == NULL)
|
||||||
return (0);
|
return (0);
|
||||||
@ -2274,7 +2535,7 @@ cpp_demangle_read_type(struct cpp_demangle_data *ddata, int delimit)
|
|||||||
extern_c = 0;
|
extern_c = 0;
|
||||||
is_builtin = 1;
|
is_builtin = 1;
|
||||||
p_idx = output->size;
|
p_idx = output->size;
|
||||||
type_str = NULL;
|
type_str = exp_str = num_str = NULL;
|
||||||
again:
|
again:
|
||||||
/* builtin type */
|
/* builtin type */
|
||||||
switch (*ddata->cur) {
|
switch (*ddata->cur) {
|
||||||
@ -2320,6 +2581,82 @@ again:
|
|||||||
++ddata->cur;
|
++ddata->cur;
|
||||||
goto rtn;
|
goto rtn;
|
||||||
|
|
||||||
|
case 'D':
|
||||||
|
++ddata->cur;
|
||||||
|
switch (*ddata->cur) {
|
||||||
|
case 'd':
|
||||||
|
/* IEEE 754r decimal floating point (64 bits) */
|
||||||
|
if (!cpp_demangle_push_str(ddata, "decimal64", 9))
|
||||||
|
goto clean;
|
||||||
|
++ddata->cur;
|
||||||
|
break;
|
||||||
|
case 'e':
|
||||||
|
/* IEEE 754r decimal floating point (128 bits) */
|
||||||
|
if (!cpp_demangle_push_str(ddata, "decimal128", 10))
|
||||||
|
goto clean;
|
||||||
|
++ddata->cur;
|
||||||
|
break;
|
||||||
|
case 'f':
|
||||||
|
/* IEEE 754r decimal floating point (32 bits) */
|
||||||
|
if (!cpp_demangle_push_str(ddata, "decimal32", 9))
|
||||||
|
goto clean;
|
||||||
|
++ddata->cur;
|
||||||
|
break;
|
||||||
|
case 'h':
|
||||||
|
/* IEEE 754r half-precision floating point (16 bits) */
|
||||||
|
if (!cpp_demangle_push_str(ddata, "half", 4))
|
||||||
|
goto clean;
|
||||||
|
++ddata->cur;
|
||||||
|
break;
|
||||||
|
case 'i':
|
||||||
|
/* char32_t */
|
||||||
|
if (!cpp_demangle_push_str(ddata, "char32_t", 8))
|
||||||
|
goto clean;
|
||||||
|
++ddata->cur;
|
||||||
|
break;
|
||||||
|
case 'n':
|
||||||
|
/* std::nullptr_t (i.e., decltype(nullptr)) */
|
||||||
|
if (!cpp_demangle_push_str(ddata, "decltype(nullptr)",
|
||||||
|
17))
|
||||||
|
goto clean;
|
||||||
|
++ddata->cur;
|
||||||
|
break;
|
||||||
|
case 's':
|
||||||
|
/* char16_t */
|
||||||
|
if (!cpp_demangle_push_str(ddata, "char16_t", 8))
|
||||||
|
goto clean;
|
||||||
|
++ddata->cur;
|
||||||
|
break;
|
||||||
|
case 'v':
|
||||||
|
/* gcc vector_size extension. */
|
||||||
|
++ddata->cur;
|
||||||
|
if (*ddata->cur == '_') {
|
||||||
|
++ddata->cur;
|
||||||
|
if (!cpp_demangle_read_expression_flat(ddata,
|
||||||
|
&exp_str))
|
||||||
|
goto clean;
|
||||||
|
if (!vector_str_push(&v.ext_name, exp_str,
|
||||||
|
strlen(exp_str)))
|
||||||
|
goto clean;
|
||||||
|
} else {
|
||||||
|
if (!cpp_demangle_read_number_as_string(ddata,
|
||||||
|
&num_str))
|
||||||
|
goto clean;
|
||||||
|
if (!vector_str_push(&v.ext_name, num_str,
|
||||||
|
strlen(num_str)))
|
||||||
|
goto clean;
|
||||||
|
}
|
||||||
|
if (*ddata->cur != '_')
|
||||||
|
goto clean;
|
||||||
|
++ddata->cur;
|
||||||
|
if (!vector_type_qualifier_push(&v, TYPE_VEC))
|
||||||
|
goto clean;
|
||||||
|
goto again;
|
||||||
|
default:
|
||||||
|
goto clean;
|
||||||
|
}
|
||||||
|
goto rtn;
|
||||||
|
|
||||||
case 'e':
|
case 'e':
|
||||||
/* long double */
|
/* long double */
|
||||||
if (!cpp_demangle_push_str(ddata, "long double", 11))
|
if (!cpp_demangle_push_str(ddata, "long double", 11))
|
||||||
@ -2414,7 +2751,7 @@ again:
|
|||||||
|
|
||||||
case 'o':
|
case 'o':
|
||||||
/* unsigned __int128 */
|
/* unsigned __int128 */
|
||||||
if (!cpp_demangle_push_str(ddata, "unsigned _;int128", 17))
|
if (!cpp_demangle_push_str(ddata, "unsigned __int128", 17))
|
||||||
goto clean;
|
goto clean;
|
||||||
++ddata->cur;
|
++ddata->cur;
|
||||||
goto rtn;
|
goto rtn;
|
||||||
@ -2485,6 +2822,8 @@ again:
|
|||||||
if (!vector_str_push(&v.ext_name, ddata->cur, len))
|
if (!vector_str_push(&v.ext_name, ddata->cur, len))
|
||||||
return (0);
|
return (0);
|
||||||
ddata->cur += len;
|
ddata->cur += len;
|
||||||
|
if (!vector_type_qualifier_push(&v, TYPE_EXT))
|
||||||
|
goto clean;
|
||||||
goto again;
|
goto again;
|
||||||
|
|
||||||
case 'v':
|
case 'v':
|
||||||
@ -2549,6 +2888,8 @@ rtn:
|
|||||||
goto clean;
|
goto clean;
|
||||||
|
|
||||||
free(type_str);
|
free(type_str);
|
||||||
|
free(exp_str);
|
||||||
|
free(num_str);
|
||||||
vector_type_qualifier_dest(&v);
|
vector_type_qualifier_dest(&v);
|
||||||
|
|
||||||
if (ddata->push_head > 0) {
|
if (ddata->push_head > 0) {
|
||||||
@ -2580,11 +2921,45 @@ rtn:
|
|||||||
return (1);
|
return (1);
|
||||||
clean:
|
clean:
|
||||||
free(type_str);
|
free(type_str);
|
||||||
|
free(exp_str);
|
||||||
|
free(num_str);
|
||||||
vector_type_qualifier_dest(&v);
|
vector_type_qualifier_dest(&v);
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
cpp_demangle_read_type_flat(struct cpp_demangle_data *ddata, char **str)
|
||||||
|
{
|
||||||
|
struct vector_str *output;
|
||||||
|
size_t i, p_idx, idx, type_len;
|
||||||
|
char *type;
|
||||||
|
|
||||||
|
output = ddata->push_head > 0 ? &ddata->output_tmp :
|
||||||
|
&ddata->output;
|
||||||
|
|
||||||
|
p_idx = output->size;
|
||||||
|
|
||||||
|
if (!cpp_demangle_read_type(ddata, 0))
|
||||||
|
return (0);
|
||||||
|
|
||||||
|
if ((type = vector_str_substr(output, p_idx, output->size - 1,
|
||||||
|
&type_len)) == NULL)
|
||||||
|
return (0);
|
||||||
|
|
||||||
|
idx = output->size;
|
||||||
|
for (i = p_idx; i < idx; ++i) {
|
||||||
|
if (!vector_str_pop(output)) {
|
||||||
|
free(type);
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*str = type;
|
||||||
|
|
||||||
|
return (1);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* read unqualified-name, unqualified name are operator-name, ctor-dtor-name,
|
* read unqualified-name, unqualified name are operator-name, ctor-dtor-name,
|
||||||
* source-name
|
* source-name
|
||||||
@ -3008,39 +3383,38 @@ cpp_demangle_read_uqname(struct cpp_demangle_data *ddata)
|
|||||||
if (ELFTC_ISDIGIT(*ddata->cur) != 0)
|
if (ELFTC_ISDIGIT(*ddata->cur) != 0)
|
||||||
return (cpp_demangle_read_sname(ddata));
|
return (cpp_demangle_read_sname(ddata));
|
||||||
|
|
||||||
|
/* local source name */
|
||||||
/* local source name */
|
if (*ddata->cur == 'L')
|
||||||
if (*ddata->cur == 'L')
|
return (cpp_demangle_local_source_name(ddata));
|
||||||
return (cpp_demangle_local_source_name(ddata));
|
|
||||||
|
|
||||||
return (1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Read local source name.
|
|
||||||
*
|
|
||||||
* References:
|
|
||||||
* http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31775
|
|
||||||
* http://gcc.gnu.org/viewcvs?view=rev&revision=124467
|
|
||||||
*/
|
|
||||||
static int
|
|
||||||
cpp_demangle_local_source_name(struct cpp_demangle_data *ddata)
|
|
||||||
{
|
|
||||||
/* L */
|
|
||||||
if (ddata == NULL || *ddata->cur != 'L')
|
|
||||||
return (0);
|
|
||||||
++ddata->cur;
|
|
||||||
|
|
||||||
/* source name */
|
return (1);
|
||||||
if (!cpp_demangle_read_sname(ddata))
|
}
|
||||||
return (0);
|
|
||||||
|
|
||||||
/* discriminator */
|
/*
|
||||||
if (*ddata->cur == '_') {
|
* Read local source name.
|
||||||
++ddata->cur;
|
*
|
||||||
while (ELFTC_ISDIGIT(*ddata->cur) != 0)
|
* References:
|
||||||
++ddata->cur;
|
* http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31775
|
||||||
}
|
* http://gcc.gnu.org/viewcvs?view=rev&revision=124467
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
cpp_demangle_local_source_name(struct cpp_demangle_data *ddata)
|
||||||
|
{
|
||||||
|
/* L */
|
||||||
|
if (ddata == NULL || *ddata->cur != 'L')
|
||||||
|
return (0);
|
||||||
|
++ddata->cur;
|
||||||
|
|
||||||
|
/* source name */
|
||||||
|
if (!cpp_demangle_read_sname(ddata))
|
||||||
|
return (0);
|
||||||
|
|
||||||
|
/* discriminator */
|
||||||
|
if (*ddata->cur == '_') {
|
||||||
|
++ddata->cur;
|
||||||
|
while (ELFTC_ISDIGIT(*ddata->cur) != 0)
|
||||||
|
++ddata->cur;
|
||||||
|
}
|
||||||
|
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
@ -82,5 +82,18 @@ const char* bad_typeid::what() const throw()
|
|||||||
return "std::bad_typeid";
|
return "std::bad_typeid";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bad_array_new_length::bad_array_new_length() throw() {}
|
||||||
|
bad_array_new_length::~bad_array_new_length() {}
|
||||||
|
bad_array_new_length::bad_array_new_length(const bad_array_new_length&) throw() {}
|
||||||
|
bad_array_new_length& bad_array_new_length::operator=(const bad_array_new_length&) throw()
|
||||||
|
{
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* bad_array_new_length::what() const throw()
|
||||||
|
{
|
||||||
|
return "std::bad_array_new_length";
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace std
|
} // namespace std
|
||||||
|
|
||||||
|
@ -81,6 +81,15 @@ namespace std
|
|||||||
virtual const char* what() const throw();
|
virtual const char* what() const throw();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class bad_array_new_length: public bad_alloc
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
bad_array_new_length() throw();
|
||||||
|
bad_array_new_length(const bad_array_new_length&) throw();
|
||||||
|
bad_array_new_length& operator=(const bad_array_new_length&) throw();
|
||||||
|
virtual ~bad_array_new_length();
|
||||||
|
virtual const char *what() const throw();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
} // namespace std
|
} // namespace std
|
||||||
|
Loading…
Reference in New Issue
Block a user