Skip to content

Commit 3a59a68

Browse files
committed
revert symbol name escape, keep only the symbolmap parse logic
1 parent 113b1aa commit 3a59a68

File tree

3 files changed

+11
-21
lines changed

3 files changed

+11
-21
lines changed

emsymbolizer.py

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -223,21 +223,7 @@ def split_symbolmap_line(line):
223223
index = line.find(':')
224224
if index == -1:
225225
raise ValueError(f'invalid symbolmap line: {line}')
226-
return line[:index], unescape_ascii_codes(line[index + 1:])
227-
228-
def unescape_ascii_codes(input_str):
229-
"""
230-
input: std::out_of_range::~out_of_range\28\29
231-
output: std::out_of_range::~out_of_range()
232-
"""
233-
def replace_match(match):
234-
code = match.group(1)
235-
try:
236-
return chr(int(code, 16))
237-
except ValueError:
238-
return match.group(0)
239-
pattern = r'\\([\da-zA-Z]{1,2})'
240-
return re.sub(pattern, replace_match, input_str)
226+
return line[:index], line[index + 1:]
241227

242228
func_names = {}
243229

test/other/test_symbolmap.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,22 @@ namespace Namespace {
44

55
EM_JS(int, out_to_js, (int x), {})
66

7-
class SomeClass{};
7+
class ClassA{};
8+
class ClassB{};
89

9-
void __attribute__((noinline)) foo(SomeClass v) {
10+
void __attribute__((noinline)) foo(ClassA v) {
1011
out_to_js(0);
1112
}
1213

1314
template <typename T>
14-
void __attribute__((noinline)) bar(T t) {
15+
void __attribute__((noinline)) bar(ClassB t) {
1516
__builtin_trap();
1617
}
1718

1819
}; // endof Namespace
1920

2021
int main() {
2122
Namespace::foo({});
22-
Namespace::bar(Namespace::SomeClass{});
23+
Namespace::bar<Namespace::ClassA>(Namespace::ClassB{});
2324
return 0;
2425
}

test/test_other.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11043,8 +11043,11 @@ def check_cpp_symbolmap_info(address, func):
1104311043
out = self.run_process([emsymbolizer, '--source=symbolmap', '-f', 'test_symbolmap.js.symbols', 'test_symbolmap.wasm', address], stdout=PIPE).stdout
1104411044
self.assertIn(func, out)
1104511045

11046-
check_cpp_symbolmap_info(out_to_js_call_addr, 'Namespace::foo(Namespace::SomeClass)')
11047-
check_cpp_symbolmap_info(unreachable_addr, 'void Namespace::bar<Namespace::SomeClass>(Namespace::SomeClass)')
11046+
check_cpp_symbolmap_info(out_to_js_call_addr, 'Namespace::foo') # the function name
11047+
check_cpp_symbolmap_info(out_to_js_call_addr, 'Namespace::ClassA') # the parameter
11048+
check_cpp_symbolmap_info(unreachable_addr, 'Namespace::bar') # the function name
11049+
check_cpp_symbolmap_info(unreachable_addr, 'Namespace::ClassA') # the type parameter
11050+
check_cpp_symbolmap_info(unreachable_addr, 'Namespace::ClassB') # the parameter
1104811051

1104911052
def test_separate_dwarf(self):
1105011053
self.run_process([EMCC, test_file('hello_world.c'), '-g'])

0 commit comments

Comments
 (0)