Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[question] demangleAll + regexp + "_Z" #18578

Open
harsszegi opened this issue Jan 23, 2023 · 4 comments
Open

[question] demangleAll + regexp + "_Z" #18578

harsszegi opened this issue Jan 23, 2023 · 4 comments

Comments

@harsszegi
Copy link

Hi,

I have an issue with WASM loading in Angular. During WASM loading there are certain expected errors to happen (like around Errno handling). In Angular my callstack contains "_ZoneDelegate", which means that the binding code matches to it, because of the following function:

function demangleAll(text) {
var regex = /\b_Z[\w\d_]+/g;
return text.replace(regex, function(x) {
var y = demangle(x);
return x === y ? x : y + " [" + x + "]";
});
}

This has a disastrous effect as __cxa_demangle will not be found in my module and loading the WASM fails because of this:

assert(__cxa_demangle_func);

Any hint how to overcome this?
Thanks,

@sbc100
Copy link
Collaborator

sbc100 commented Jan 23, 2023

It looks like that assert(__cxa_demangle_func) is wrapped in $if DEMANGLE_SUPPORT.. so the compiler seems to think that demangle support is enabled. Are you setting -sDEMANGLE_SUPPORT on the command line?

@harsszegi
Copy link
Author

Yeah I’m setting this, because I’d like to have demangled names in exceptions coming from C++ land, though in this specific case the exception came from JS land. Although I have to state that I have no clue why it didn’t find the cxa_demangle symbol in the image (regardless that it wasn’t a c++ function that failed). I’ll try to see what is tge cxa_demangle signature in my wasm

@sbc100
Copy link
Collaborator

sbc100 commented Jan 23, 2023

I created #18579 which should at least make it impossible for __cxa_demangle to be missing here.

@harsszegi
Copy link
Author

Lame question. Doing wasm2wat on my file it states that cxa_demangle is within the WASM

(func $__cxa_demangle (type 8) (param i32 i32 i32 i32) (result i32)

However Module appears to be missing it runtime. How can that be?
Thanks,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants