WebAssembly: see if "-d symbols" can be improved
haberman opened this issue · comments
Issue #184 indicates that -d symbols
is sometimes returning not very useful information like:
FILE SIZE VM SIZE
-------------- --------------
63.8% 313Ki NAN% 0 [538 Others]
4.1% 20.3Ki NAN% 0 func[482]
3.5% 17.3Ki NAN% 0 [section Data]
3.2% 15.9Ki NAN% 0 func[514]
3.0% 14.9Ki NAN% 0 func[503]
2.3% 11.5Ki NAN% 0 func[528]
2.3% 11.0Ki NAN% 0 func[47]
1.6% 7.91Ki NAN% 0 func[513]
1.6% 7.67Ki NAN% 0 func[494]
1.6% 7.65Ki NAN% 0 func[505]
1.5% 7.59Ki NAN% 0 func[324]
1.4% 6.70Ki NAN% 0 func[323]
1.3% 6.16Ki NAN% 0 func[509]
1.2% 5.90Ki NAN% 0 func[523]
1.2% 5.84Ki NAN% 0 func[499]
1.2% 5.67Ki NAN% 0 func[418]
1.1% 5.61Ki NAN% 0 func[524]
1.1% 5.41Ki NAN% 0 func[478]
1.1% 5.36Ki NAN% 0 func[526]
0.9% 4.57Ki NAN% 0 func[507]
0.9% 4.56Ki NAN% 0 func[403]
100.0% 490Ki 100.0% 0 TOTAL
We want to get real function names here, instead func[47]
. We should investigate whether these function names are available somewhere in the binary, whether in a symbol table or in DWARF debug info.
This shouldn't be an issue (at least anymore). The only reason that user could've gotten such function names is if their Wasm was stripped of debug info. When running on Wasm with the names
section preserved, I'm getting function names as expected:
...
0.4% 21.2Ki NAN% 0 vips_math_buffer
0.3% 19.8Ki NAN% 0 vips_boolean_const_buffer
0.3% 17.2Ki NAN% 0 vips_linear_buffer
0.3% 17.1Ki NAN% 0 vips_relational_buffer
0.3% 16.3Ki NAN% 0 vips_hist_find_scan
0.3% 16.2Ki NAN% 0 rgb_rgb_convert
0.3% 15.7Ki NAN% 0 vips_interpolate_bilinear_interpolate
...
Of course, other Wasm improvements (such as in PRs by @dschuff as well as DWARF support tracked in #188) are still necessary and would be welcome.