Skip to content

Commit

Permalink
emit full debug info when -g and emitting text; when -g and emitting …
Browse files Browse the repository at this point in the history
…binary, all we can do is the Names section
  • Loading branch information
kripken committed Feb 3, 2017
1 parent 55b7289 commit ff420e1
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/tools/asm2wasm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ int main(int argc, const char *argv[]) {
[&wasmOnly](Options *o, const std::string &) {
wasmOnly = true;
})
.add("--debuginfo", "-g", "Emit names section and debug info (you must emit text, -S, for this to work)",
.add("--debuginfo", "-g", "Emit names section and debug info (for debug info you must emit text, -S, for this to work)",
Options::Arguments::Zero,
[&](Options *o, const std::string &arguments) { debugInfo = true; })
.add("--symbolmap", "-s", "Emit a symbol map (indexes => names)",
Expand All @@ -104,10 +104,6 @@ int main(int argc, const char *argv[]) {
// when no output file is specified, we emit text to stdout
emitBinary = false;
}
if (emitBinary) {
// wasm binaries can't contain debug info yet
debugInfo = false;
}

const auto &tm_it = options.extra.find("total memory");
size_t totalMemory =
Expand All @@ -119,7 +115,8 @@ int main(int argc, const char *argv[]) {
}

Asm2WasmPreProcessor pre;
pre.debugInfo = debugInfo;
// wasm binaries can contain a names section, but not full debug info
pre.debugInfo = debugInfo && !emitBinary;
auto input(
read_file<std::vector<char>>(options.extra["infile"], Flags::Text, options.debug ? Flags::Debug : Flags::Release));
char *start = pre.process(input.data());
Expand Down

0 comments on commit ff420e1

Please sign in to comment.