From 7f31823120ba25075d783df863f6be536543f805 Mon Sep 17 00:00:00 2001 From: Thomas Lively <7121787+tlively@users.noreply.github.com> Date: Tue, 25 May 2021 15:32:39 -0700 Subject: [wasm-split] Add an option to emit only the module names (#3901) Even when other names are stripped, it can be useful for wasm-split to preserve the module name so that the split modules can be differentiated in stack traces. Adding this option to wasm-split requires adding similar options to ModuleWriter and WasmBinaryWriter. --- src/wasm-binary.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/wasm-binary.h') diff --git a/src/wasm-binary.h b/src/wasm-binary.h index b2f681b6e..6852c42ab 100644 --- a/src/wasm-binary.h +++ b/src/wasm-binary.h @@ -1170,7 +1170,11 @@ public: std::vector functionBodies; } tableOfContents; - void setNamesSection(bool set) { debugInfo = set; } + void setNamesSection(bool set) { + debugInfo = set; + emitModuleName = set; + } + void setEmitModuleName(bool set) { emitModuleName = set; } void setSourceMap(std::ostream* set, std::string url) { sourceMap = set; sourceMapUrl = url; @@ -1265,6 +1269,13 @@ private: std::vector types; bool debugInfo = true; + + // TODO: Remove `emitModuleName` in the future once there are better ways to + // ensure modules have meaningful names in stack traces.For example, using + // ObjectURLs works in FireFox, but not Chrome. See + // https://bugs.chromium.org/p/v8/issues/detail?id=11808. + bool emitModuleName = true; + std::ostream* sourceMap = nullptr; std::string sourceMapUrl; std::string symbolMap; -- cgit v1.2.3