aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-11-12 08:31:11 -0800
committerAlon Zakai <alonzakai@gmail.com>2013-11-12 08:31:11 -0800
commita3903de867a0cff0854ea8e195469a48d11b9c9e (patch)
tree4d6a25d039e922b6f6eddfe6a5e64f0cf3a5922b
parent93b48cd720995297f9ec27a8af0d5cbb065f4a9a (diff)
demangle constructors
-rw-r--r--src/preamble.js9
-rw-r--r--tests/test_other.py2
2 files changed, 9 insertions, 2 deletions
diff --git a/src/preamble.js b/src/preamble.js
index deabd29a..a91d16f1 100644
--- a/src/preamble.js
+++ b/src/preamble.js
@@ -682,7 +682,7 @@ function demangle(func) {
var subs = [];
function parseNested() {
i++;
- if (func[i] === 'K') i++;
+ if (func[i] === 'K') i++; // ignore const
var parts = [];
while (func[i] !== 'E') {
if (func[i] === 'S') { // substitution
@@ -693,6 +693,11 @@ function demangle(func) {
i = next+1;
continue;
}
+ if (func[i] === 'C') { // constructor
+ parts.push(parts[parts.length-1]);
+ i += 2;
+ continue;
+ }
var size = parseInt(func.substr(i));
var pre = size.toString().length;
if (!size || !pre) { i--; break; } // counter i++ below us
@@ -713,7 +718,7 @@ function demangle(func) {
var name;
if (func[i] !== 'N') {
// not namespaced
- if (func[i] === 'K') i++;
+ if (func[i] === 'K') i++; // ignore const
var size = parseInt(func.substr(i));
if (size) {
var pre = size.toString().length;
diff --git a/tests/test_other.py b/tests/test_other.py
index c79d9e5f..a2a1448f 100644
--- a/tests/test_other.py
+++ b/tests/test_other.py
@@ -1937,6 +1937,7 @@ done.
EM_ASM(Module.print(demangle('__Z9parsewordRPKciRi')));
EM_ASM(Module.print(demangle('__Z5multiwahtjmxyz')));
EM_ASM(Module.print(demangle('__Z1aA32_iPA5_c')));
+ EM_ASM(Module.print(demangle('__ZN21FWakaGLXFleeflsMarfooC2EjjjPKvbjj')));
one(17);
return 0;
}
@@ -1958,6 +1959,7 @@ __cxxabiv1::__si_class_type_info::search_below_dst(__cxxabiv1::__dynamic_cast_in
parseword(char*&, int, int&)
multi(wchar_t, signed char, unsigned char, unsigned short, unsigned int, unsigned long, long long, unsigned long long, ...)
a(int [32], char [5]*)
+FWakaGLXFleeflsMarfoo::FWakaGLXFleeflsMarfoo(unsigned int, unsigned int, unsigned int, void*, bool, unsigned int, unsigned int)
''', output)
# test for multiple functions in one stack trace
assert 'one(int)' in output