Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/bsd/libc++/dist/libcxxrt/src Import libcxxrt e64e93...
details: https://anonhg.NetBSD.org/src/rev/93a945633165
branches: trunk
changeset: 340539:93a945633165
user: pooka <pooka%NetBSD.org@localhost>
date: Fri Sep 11 11:19:58 2015 +0000
description:
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.
diffstat:
external/bsd/libc++/dist/libcxxrt/src/auxhelper.cc | 5 +
external/bsd/libc++/dist/libcxxrt/src/dwarf_eh.h | 18 +-
external/bsd/libc++/dist/libcxxrt/src/libelftc_dem_gnu3.c | 508 ++++++++++++-
external/bsd/libc++/dist/libcxxrt/src/stdexcept.cc | 13 +
external/bsd/libc++/dist/libcxxrt/src/stdexcept.h | 9 +
5 files changed, 476 insertions(+), 77 deletions(-)
diffs (truncated from 883 to 300 lines):
diff -r e8e7e00c5fd3 -r 93a945633165 external/bsd/libc++/dist/libcxxrt/src/auxhelper.cc
--- a/external/bsd/libc++/dist/libcxxrt/src/auxhelper.cc Fri Sep 11 10:35:44 2015 +0000
+++ b/external/bsd/libc++/dist/libcxxrt/src/auxhelper.cc Fri Sep 11 11:19:58 2015 +0000
@@ -75,3 +75,8 @@
{
abort();
}
+
+extern "C" void __cxa_throw_bad_array_new_length()
+{
+ throw std::bad_array_new_length();
+}
diff -r e8e7e00c5fd3 -r 93a945633165 external/bsd/libc++/dist/libcxxrt/src/dwarf_eh.h
--- a/external/bsd/libc++/dist/libcxxrt/src/dwarf_eh.h Fri Sep 11 10:35:44 2015 +0000
+++ b/external/bsd/libc++/dist/libcxxrt/src/dwarf_eh.h Fri Sep 11 11:19:58 2015 +0000
@@ -218,15 +218,17 @@
static uint64_t read_value(char encoding, dw_eh_ptr_t *data)
{
enum dwarf_data_encoding type = get_encoding(encoding);
- uint64_t v;
switch (type)
{
// Read fixed-length types
#define READ(dwarf, type) \
case dwarf:\
- v = static_cast<uint64_t>(*reinterpret_cast<type*>(*data));\
- *data += sizeof(type);\
- break;
+ {\
+ type t;\
+ 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_udata4, uint32_t)
READ(DW_EH_PE_udata8, uint64_t)
@@ -237,15 +239,11 @@
#undef READ
// Read variable-length types
case DW_EH_PE_sleb128:
- v = read_sleb128(data);
- break;
+ return read_sleb128(data);
case DW_EH_PE_uleb128:
- v = read_uleb128(data);
- break;
+ return read_uleb128(data);
default: abort();
}
-
- return v;
}
/**
diff -r e8e7e00c5fd3 -r 93a945633165 external/bsd/libc++/dist/libcxxrt/src/libelftc_dem_gnu3.c
--- a/external/bsd/libc++/dist/libcxxrt/src/libelftc_dem_gnu3.c Fri Sep 11 10:35:44 2015 +0000
+++ b/external/bsd/libc++/dist/libcxxrt/src/libelftc_dem_gnu3.c Fri Sep 11 11:19:58 2015 +0000
@@ -59,7 +59,7 @@
enum type_qualifier {
TYPE_PTR, TYPE_REF, TYPE_CMX, TYPE_IMG, TYPE_EXT, TYPE_RST, TYPE_VAT,
- TYPE_CST
+ TYPE_CST, TYPE_VEC
};
struct vector_type_qualifier {
@@ -397,6 +397,8 @@
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_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 *,
const char *, size_t);
static int cpp_demangle_read_expression_unary(struct cpp_demangle_data *,
@@ -408,8 +410,12 @@
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_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_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_offset(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_args(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_flat(struct cpp_demangle_data *,
+ char **);
static int cpp_demangle_read_uqname(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);
@@ -601,17 +609,18 @@
fp = ddata->cur;
while (*ddata->cur != 'E')
++ddata->cur;
- ++ddata->cur;
if ((f = decoder(fp, ddata->cur - fp)) == NULL)
return (0);
rtn = 0;
if ((len = strlen(f)) > 0)
- rtn = cpp_demangle_push_str(ddata, f, len);
+ rtn = cpp_demangle_push_str(ddata, f, len);
free(f);
+ ++ddata->cur;
+
return (rtn);
}
@@ -695,7 +704,8 @@
if (type_str != NULL) {
if (!vector_str_push(&subst_v, "*", 1))
goto clean;
- if (!cpp_demangle_push_subst_v(ddata, &subst_v))
+ if (!cpp_demangle_push_subst_v(ddata,
+ &subst_v))
goto clean;
}
break;
@@ -706,7 +716,8 @@
if (type_str != NULL) {
if (!vector_str_push(&subst_v, "&", 1))
goto clean;
- if (!cpp_demangle_push_subst_v(ddata, &subst_v))
+ if (!cpp_demangle_push_subst_v(ddata,
+ &subst_v))
goto clean;
}
break;
@@ -717,7 +728,8 @@
if (type_str != NULL) {
if (!vector_str_push(&subst_v, " complex", 8))
goto clean;
- if (!cpp_demangle_push_subst_v(ddata, &subst_v))
+ if (!cpp_demangle_push_subst_v(ddata,
+ &subst_v))
goto clean;
}
break;
@@ -726,23 +738,26 @@
if (!cpp_demangle_push_str(ddata, " imaginary", 10))
goto clean;
if (type_str != NULL) {
- if (!vector_str_push(&subst_v, " imaginary", 10))
+ if (!vector_str_push(&subst_v, " imaginary",
+ 10))
goto clean;
- if (!cpp_demangle_push_subst_v(ddata, &subst_v))
+ if (!cpp_demangle_push_subst_v(ddata,
+ &subst_v))
goto clean;
}
break;
case TYPE_EXT:
- if (e_idx > v->ext_name.size - 1)
- goto clean;
- if ((e_len = strlen(v->ext_name.container[e_idx])) == 0)
+ if (v->ext_name.size == 0 ||
+ e_idx > v->ext_name.size - 1)
goto clean;
- if ((buf = malloc(sizeof(char) * (e_len + 1))) == NULL)
+ if ((e_len = strlen(v->ext_name.container[e_idx])) ==
+ 0)
goto clean;
-
- memcpy(buf, " ", 1);
- memcpy(buf + 1, v->ext_name.container[e_idx], e_len);
+ if ((buf = malloc(e_len + 2)) == NULL)
+ goto clean;
+ snprintf(buf, e_len + 2, " %s",
+ v->ext_name.container[e_idx]);
if (!cpp_demangle_push_str(ddata, buf, e_len + 1)) {
free(buf);
@@ -755,7 +770,8 @@
free(buf);
goto clean;
}
- if (!cpp_demangle_push_subst_v(ddata, &subst_v)) {
+ if (!cpp_demangle_push_subst_v(ddata,
+ &subst_v)) {
free(buf);
goto clean;
}
@@ -770,7 +786,8 @@
if (type_str != NULL) {
if (!vector_str_push(&subst_v, " restrict", 9))
goto clean;
- if (!cpp_demangle_push_subst_v(ddata, &subst_v))
+ if (!cpp_demangle_push_subst_v(ddata,
+ &subst_v))
goto clean;
}
break;
@@ -781,7 +798,8 @@
if (type_str != NULL) {
if (!vector_str_push(&subst_v, " volatile", 9))
goto clean;
- if (!cpp_demangle_push_subst_v(ddata, &subst_v))
+ if (!cpp_demangle_push_subst_v(ddata,
+ &subst_v))
goto clean;
}
break;
@@ -792,11 +810,42 @@
if (type_str != NULL) {
if (!vector_str_push(&subst_v, " const", 6))
goto clean;
- if (!cpp_demangle_push_subst_v(ddata, &subst_v))
+ if (!cpp_demangle_push_subst_v(ddata,
+ &subst_v))
goto clean;
}
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;
}
@@ -947,10 +996,14 @@
switch (*ddata->cur) {
case 'b':
+ if (*(ddata->cur + 2) != 'E')
+ return (0);
switch (*(++ddata->cur)) {
case '0':
+ ddata->cur += 2;
return (cpp_demangle_push_str(ddata, "false", 5));
case '1':
+ ddata->cur += 2;
return (cpp_demangle_push_str(ddata, "true", 4));
default:
return (0);
@@ -999,7 +1052,8 @@
++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:
return (0);
@@ -1291,6 +1345,38 @@
}
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))
Home |
Main Index |
Thread Index |
Old Index