Skip to content

Add `--keep-symbols` flag

Sergej Kostjucenko requested to merge at-keep-symbols into master

Created by: athei

In order to properly analyze a contract binary we need to keep the wasm name section alive so that we can see what is going on. Using the non post processed wasm file is of no use because we are interested in the fully optimized binary when doing an analysis. To that end I added a new --keep-symbols flag to the build command which prevents wasm-opt from removing the debug section.

I needed to make some other changes to make this work, too. Most notable I removed the call to pwasm_utils::optimize which unconditionally removes all custom sections. We don't need this anyways because wasm-opt does the same optimizations and more. It sufficed to remove all exports from the module (but call and deploy) to have the same result without pwasm_utils::optimize. I argue that having one less pass involved is a good thing.

Merge request reports