-
Notifications
You must be signed in to change notification settings - Fork 121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable debug info with flag in command build #131
Conversation
I think as long as it is still guaranteed that non- |
let mut flags = | ||
"-C link-arg=-z -C link-arg=stack-size=65536 -C link-arg=--import-memory".to_string(); | ||
if debug { | ||
flags.push_str(" -C opt-level=1"); | ||
} | ||
std::env::set_var("RUSTFLAGS", flags); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure using the rustc flag or building debug wasm binary under --debug
@@ -339,30 +375,32 @@ pub(crate) fn execute_with_crate_metadata( | |||
optimize_contract: bool, | |||
build_artifact: BuildArtifacts, | |||
unstable_flags: UnstableFlags, | |||
) -> Result<(Option<PathBuf>, Option<OptimizationResult>)> { | |||
debug: bool, | |||
) -> Result<(Option<PathBuf>, Option<PathBuf>, Option<OptimizationResult>)> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This modification is quite dirty, would you mind offering some advice if this PR is welcome in the next days? @Robbepop
The code in this PR is a mess, it works, but I'm not satisfied even myself.
Desc
Currently
cargo-contract
trimsname section
by default while building contracts,strip_custom_sections
,wasm-opt
and an operation inparity-wasm
(paritytech/parity-wasm#300) will removename section
, which makes it hard to debug contracts.We are trying to set up a flag
--debug
to keepname section
in this PR, we have kept thename section
afterstrip_custom_sections
but not inwasm_opt
(not sure if it is a bug,name section
optimized even passingdebug_info: true
tobinaryen
, butwasm-opt
works fine using the same arguments in command-linewasm-opt -O3 -s 1 --debuginfo contract.wasm
)Instead, we left
target/ink/<contract>.src.wasm
after the process, which contains name section.Refs
#169