aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/preamble.js37
-rw-r--r--tests/test_other.py1
2 files changed, 18 insertions, 20 deletions
diff --git a/src/preamble.js b/src/preamble.js
index e495c548..63fab34e 100644
--- a/src/preamble.js
+++ b/src/preamble.js
@@ -658,8 +658,8 @@ function demangle(func) {
'f': 'float',
'd': 'double'
};
- function debug(x) {
- return;
+ function dump(x) {
+ //return;
if (x) Module.print(x);
Module.print(func);
var pre = '';
@@ -669,12 +669,17 @@ function demangle(func) {
var subs = [];
function parseNested() {
i++;
- if (func[i] === 'K') {
- suffix = ' const';
- i++;
- }
+ if (func[i] === 'K') i++;
var parts = [];
while (func[i] !== 'E') {
+ if (func[i] === 'S') { // substitution
+ i++;
+ var next = func.indexOf('_', i);
+ var num = func.substring(i, next) || 0;
+ parts.push(subs[num] || '?');
+ i = next+1;
+ continue;
+ }
var size = parseInt(func.substr(i));
var pre = size.toString().length;
if (!size || !pre) { i--; break; } // counter i++ below us
@@ -692,13 +697,10 @@ function demangle(func) {
function flushList() {
return '(' + list.join(', ') + ')';
}
- var name, suffix = '';
+ var name;
if (func[i] !== 'N') {
// not namespaced
- if (func[i] === 'K') {
- suffix = ' const';
- i++;
- }
+ if (func[i] === 'K') i++;
var size = parseInt(func.substr(i));
if (size) {
var pre = size.toString().length;
@@ -708,8 +710,9 @@ function demangle(func) {
} else {
// namespaced N-E
name = parseNested().join('::');
+ limit--;
+ if (limit === 0) return rawList ? [name] : name;
}
-
if (func[i] === 'I') {
i++;
var iList = parse(true);
@@ -719,19 +722,13 @@ function demangle(func) {
ret = name;
}
paramLoop: while (i < func.length && limit-- > 0) {
+ //dump('paramLoop');
var c = func[i++];
if (c in basicTypes) {
list.push(basicTypes[c]);
} else {
switch (c) {
case 'P': list.push(parse(true, 1, true)[0] + '*'); break; // pointer
- case 'S': { // substitution
- var next = func.indexOf('_', i);
- var num = func.substring(i, next) || 0;
- list.push(subs[num] || '?');
- i = next+1;
- break;
- }
case 'L': { // literal
i++; // skip basic type
var end = func.indexOf('E', i);
@@ -746,7 +743,7 @@ function demangle(func) {
}
}
if (!allowVoid && list.length === 1 && list[0] === 'void') list = []; // avoid (void)
- return rawList ? list : ret + flushList() + suffix;
+ return rawList ? list : ret + flushList();
}
return parse();
} catch(e) {
diff --git a/tests/test_other.py b/tests/test_other.py
index b032a185..2d3dde3f 100644
--- a/tests/test_other.py
+++ b/tests/test_other.py
@@ -1936,5 +1936,6 @@ Waka::f::a23412341234::point()
void Foo<int>()
void Foo<int, double>(int)
void Foo::Bar<5>()
+__cxxabiv1::__si_class_type_info::search_below_dst(__cxxabiv1::__dynamic_cast_info*, void*, int, bool)
''', run_js('a.out.js'))