Skip to content

Commit af71e60

Browse files
committed
fix cr comments
1 parent b881a2e commit af71e60

File tree

3 files changed

+46
-52
lines changed

3 files changed

+46
-52
lines changed

test/other/test_symbol_map.cpp

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#include <emscripten.h>
2+
3+
EM_JS(int, out_to_js, (), {
4+
out(new Error().stack);
5+
return 0;
6+
});
7+
8+
namespace Namespace {
9+
10+
class ClassA{};
11+
class ClassB{};
12+
13+
void __attribute__((noinline)) foo(ClassA v) {
14+
out_to_js();
15+
}
16+
17+
template <typename T>
18+
void __attribute__((noinline)) bar(ClassB t) {
19+
__builtin_trap();
20+
}
21+
22+
}; // endof Namespace
23+
24+
EMSCRIPTEN_KEEPALIVE
25+
extern "C" void middle() {
26+
if (out_to_js()) {
27+
// fake recursion that is never reached, to avoid inlining in binaryen and LLVM
28+
middle();
29+
30+
Namespace::foo({});
31+
Namespace::bar<Namespace::ClassA>(Namespace::ClassB{});
32+
}
33+
}
34+
35+
int main() {
36+
EM_ASM({ _middle() });
37+
return 0;
38+
}

test/other/test_symbolmap.cpp

Lines changed: 0 additions & 25 deletions
This file was deleted.

test/test_other.py

Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5705,27 +5705,7 @@ def guess_symbols_file_type(symbols_file):
57055705
UNMINIFIED_MIDDLE = 'function middle'
57065706

57075707
self.clear()
5708-
create_file('src.c', r'''
5709-
#include <emscripten.h>
5710-
5711-
EM_JS(int, run_js, (), {
5712-
out(new Error().stack);
5713-
return 0;
5714-
});
5715-
5716-
EMSCRIPTEN_KEEPALIVE
5717-
void middle() {
5718-
if (run_js()) {
5719-
// fake recursion that is never reached, to avoid inlining in binaryen and LLVM
5720-
middle();
5721-
}
5722-
}
5723-
5724-
int main() {
5725-
EM_ASM({ _middle() });
5726-
}
5727-
''')
5728-
cmd = [EMCC, 'src.c', '--emit-symbol-map'] + opts
5708+
cmd = [EMXX, test_file('other/test_symbol_map.cpp'), '--emit-symbol-map'] + opts
57295709
if wasm != 1:
57305710
cmd.append(f'-sWASM={wasm}')
57315711
self.run_process(cmd)
@@ -11032,17 +11012,18 @@ def check_symbolmap_info(address, func):
1103211012
check_symbolmap_info(unreachable_addr, '__original_main')
1103311013

1103411014
# 3. Test symbol map on C++ name mangling
11035-
self.run_process([EMCC, test_file('other/test_symbolmap.cpp'),
11036-
'-O1', '--emit-symbol-map', '-o', 'test_symbolmap.js'])
11037-
self.assertExists('test_symbolmap.js.symbols')
11015+
self.run_process([EMXX, test_file('other/test_symbol_map.cpp'),
11016+
'-O1', '--emit-symbol-map', '-o', 'test_symbol_map.js'])
11017+
self.assertExists('test_symbol_map.js.symbols')
1103811018

11039-
out_to_js_call_addr = self.get_instr_addr('call\t0', 'test_symbolmap.wasm')
11040-
unreachable_addr = self.get_instr_addr('unreachable', 'test_symbolmap.wasm')
11019+
out_to_js_call_addr = self.get_instr_addr('call\t0', 'test_symbol_map.wasm')
11020+
unreachable_addr = self.get_instr_addr('unreachable', 'test_symbol_map.wasm')
1104111021

1104211022
def check_cpp_symbolmap_info(address, func):
11043-
out = self.run_process([emsymbolizer, '--source=symbolmap', '-f', 'test_symbolmap.js.symbols', 'test_symbolmap.wasm', address], stdout=PIPE).stdout
11023+
out = self.run_process([emsymbolizer, '--source=symbolmap', '-f', 'test_symbol_map.js.symbols', 'test_symbol_map.wasm', address], stdout=PIPE).stdout
1104411024
self.assertIn(func, out)
1104511025

11026+
check_cpp_symbolmap_info(0, 'out_to_js') # the function name
1104611027
check_cpp_symbolmap_info(out_to_js_call_addr, 'Namespace::foo') # the function name
1104711028
check_cpp_symbolmap_info(out_to_js_call_addr, 'Namespace::ClassA') # the parameter
1104811029
check_cpp_symbolmap_info(unreachable_addr, 'Namespace::bar') # the function name

0 commit comments

Comments
 (0)