Skip to content

Commit 240c6bb

Browse files
authored
Add -g/--debuginfo flag to wasm-emscripten-finalize (#1584)
This brings this tool into parity with the existing s2wasm
1 parent 408b816 commit 240c6bb

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/tools/wasm-emscripten-finalize.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ int main(int argc, const char *argv[]) {
3939
std::string infile;
4040
std::string outfile;
4141
bool emitBinary = true;
42+
bool debugInfo = false;
4243
unsigned numReservedFunctionPointers = 0;
4344
uint64_t globalBase;
4445
Options options("wasm-emscripten-finalize",
@@ -50,6 +51,12 @@ int main(int argc, const char *argv[]) {
5051
outfile = argument;
5152
Colors::disable();
5253
})
54+
.add("--debuginfo", "-g",
55+
"Emit names section in wasm binary (or full debuginfo in wast)",
56+
Options::Arguments::Zero,
57+
[&debugInfo](Options *, const std::string &) {
58+
debugInfo = true;
59+
})
5360
.add("--emit-text", "-S", "Emit text instead of binary for the output file",
5461
Options::Arguments::Zero,
5562
[&emitBinary](Options*, const std::string& ) {
@@ -123,9 +130,8 @@ int main(int argc, const char *argv[]) {
123130
auto outputBinaryFlag = emitBinary ? Flags::Binary : Flags::Text;
124131
Output output(outfile, outputBinaryFlag, Flags::Release);
125132
ModuleWriter writer;
126-
// writer.setDebug(options.debug);
127-
writer.setDebugInfo(true);
128-
// writer.setDebugInfo(options.passOptions.debugInfo);
133+
writer.setDebug(options.debug);
134+
writer.setDebugInfo(debugInfo);
129135
// writer.setSymbolMap(symbolMap);
130136
writer.setBinary(emitBinary);
131137
// if (emitBinary) {

0 commit comments

Comments
 (0)