Enable debug info with flag in command build

Sergej Kostjucenko requested to merge github/fork/patractlabs/cmd/debug into master

Created by: clearloop

Desc

Currently cargo-contract trims name section by default while building contracts, strip_custom_sections, wasm-opt and an operation in parity-wasm(https://github.com/paritytech/parity-wasm/pull/300) will remove name section, which makes it hard to debug contracts.

We are trying to set up a flag --debug to keep name section in this PR, we have kept the name section after strip_custom_sections but not in wasm_opt(not sure if it is a bug, name section optimized even passing debug_info: true to binaryen, but wasm-opt works fine using the same arguments in command-line wasm-opt -O3 -s 1 --debuginfo contract.wasm)

Instead, we left target/ink/<contract>.src.wasm after the process, which contains name section.

Refs

#169 (closed)

Merge request reports