-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Fix #24982: emsymbolizer failed to parse symbol map from C++ project #24994
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
base: main
Are you sure you want to change the base?
Fix #24982: emsymbolizer failed to parse symbol map from C++ project #24994
Conversation
c81e65c
to
d93eb85
Compare
…en-core#24982 1. fix symbol map line parse 2. unescape ascii code 3. update tests: test/runner "other.test_emsymbolizer*"
d93eb85
to
f20fd5e
Compare
549ccad
to
d792fa6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm otherwise
Is there some reason we cannot or should not just update the symbol map to avoid this mangling in the first place. What is the source of the mangling in the first place? What style of mangling is |
I don't know what kind of mangling that is; it doesn't exactly match others that I'm familiar with. |
I'd be tempted to make that change to the symbol map to include fully demanged symbols. @kripken do you remember why we have these strange escape codes in the map file? |
I'm not sure. But isn't the symbol map just copying the name section? It should contain whatever is there iirc. |
So maybe the issue is that the name section is broken? |
The name sections is fine. The problem seems to stem from the I think we should file a binaryen bug, or maybe just avoid binaryen for this purpose (since we don't need to run process the whole wasm file, only the name section. |
@sbc100 do you want this PR to wait until we figure that out, or can this land? |
I don't think we we should land this since it would only act to further lock in the strange escaping behavior |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should go with #25053 instead
Oh, I think the first part of this PR is still important though:
That handles splitting when the line contains We can refocus this PR on just that? |
Ah, yes that could make sense. |
3a59a68
to
b881a2e
Compare
Thanks guys! The name escape part has been reverted. Please review 🌹 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall, just a couple of nits on the test.
af71e60
to
b2ffeb2
Compare
Some |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you merge the PR to the tip of the main branch, the code size test failures should go away. And you'll have to do that anyway, since you have a conflict.
@@ -11031,6 +11011,29 @@ def check_symbolmap_info(address, func): | |||
# The name section will not show bar, as it's inlined into main | |||
check_symbolmap_info(unreachable_addr, '__original_main') | |||
|
|||
# 3. Test symbol map on C++ name mangling |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# 3. Test symbol map on C++ name mangling | |
# 3. Test symbol map on demangled C++ names |
@@ -218,12 +218,19 @@ def symbolize_address_sourcemap(module, address, force_file): | |||
|
|||
def symbolize_address_symbolmap(module, address, symbol_map_file): | |||
"""Symbolize using a symbol map file.""" | |||
|
|||
def split_symbolmap_line(line): | |||
index = line.find(':') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can just do return line.split(':', 1)
If you want and explicit error you could also add assert ':' in line, 'f'invalid symbolmap line: {line}'
check_cpp_symbolmap_info(unreachable_addr, 'Namespace::bar') # the function name | ||
check_cpp_symbolmap_info(unreachable_addr, 'Namespace::ClassA') # the type parameter | ||
check_cpp_symbolmap_info(unreachable_addr, 'Namespace::ClassB') # the parameter | ||
check_symbol_map_contains('out_to_js') # the imported function |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I think maybe we should be making test_symbol_map any more complex by including emsymbolizer stuff too. Can we go back adding this to a new or existing test_emsymboliser_xx test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or... could we just turn test_dwarf.c into a c++ test and then have the existing symbol map test include C++ symbols? that would make this a very small increment over the existing test.
This PR fixes #24982