Skip to content

Commit f7bd8c9

Browse files
committed
Renames paramenters from binarymap to sourcemap.
1 parent 9fcdc20 commit f7bd8c9

File tree

9 files changed

+98
-97
lines changed

9 files changed

+98
-97
lines changed

auto_update_tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
actual = run_command(cmd)
4343
with open(os.path.join('test', wasm), 'w') as o: o.write(actual)
4444
if 'debugInfo' in asm:
45-
cmd += ['--binarymap-file', os.path.join('test', wasm + '.map'), '-o', 'a.wasm']
45+
cmd += ['--source-map', os.path.join('test', wasm + '.map'), '-o', 'a.wasm']
4646
run_command(cmd)
4747

4848

check.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,8 @@ def do_asm2wasm_test():
192192
# verify debug info
193193
if 'debugInfo' in asm:
194194
jsmap = 'a.wasm.map'
195-
cmd += ['--binarymap-file', jsmap,
196-
'--binarymap-url', 'http://example.org/' + jsmap,
195+
cmd += ['--source-map', jsmap,
196+
'--source-map-url', 'http://example.org/' + jsmap,
197197
'-o', 'a.wasm']
198198
run_command(cmd)
199199
if not os.path.isfile(jsmap):
@@ -266,7 +266,7 @@ def do_asm2wasm_test():
266266
print '..', t
267267
t = os.path.join(options.binaryen_test, t)
268268
cmd = WASM_DIS + [t]
269-
if os.path.isfile(t + '.map'): cmd += ['-bm', t + '.map']
269+
if os.path.isfile(t + '.map'): cmd += ['--source-map', t + '.map']
270270

271271
actual = run_command(cmd)
272272

src/tools/asm2wasm.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ int main(int argc, const char *argv[]) {
3636
bool legalizeJavaScriptFFI = true;
3737
Asm2WasmBuilder::TrapMode trapMode = Asm2WasmBuilder::TrapMode::JS;
3838
bool wasmOnly = false;
39-
std::string binaryMapFile;
40-
std::string binaryMapUrl;
39+
std::string sourceMapFilename;
40+
std::string sourceMapUrl;
4141
std::string symbolMap;
4242
bool emitBinary = true;
4343

@@ -104,12 +104,12 @@ int main(int argc, const char *argv[]) {
104104
.add("--debuginfo", "-g", "Emit names section in wasm binary (or full debuginfo in wast)",
105105
Options::Arguments::Zero,
106106
[&](Options *o, const std::string &arguments) { options.passOptions.debugInfo = true; })
107-
.add("--binarymap-file", "-bm", "Emit binary map (if using binary output) to the specified file",
107+
.add("--source-map", "-sm", "Emit source map (if using binary output) to the specified file",
108108
Options::Arguments::One,
109-
[&binaryMapFile](Options *o, const std::string &argument) { binaryMapFile = argument; })
110-
.add("--binarymap-url", "-bu", "Use specified string as binary map URL",
109+
[&sourceMapFilename](Options *o, const std::string &argument) { sourceMapFilename = argument; })
110+
.add("--source-map-url", "-su", "Use specified string as source map URL",
111111
Options::Arguments::One,
112-
[&binaryMapUrl](Options *o, const std::string &argument) { binaryMapUrl = argument; })
112+
[&sourceMapUrl](Options *o, const std::string &argument) { sourceMapUrl = argument; })
113113
.add("--symbolmap", "-s", "Emit a symbol map (indexes => names)",
114114
Options::Arguments::One,
115115
[&](Options *o, const std::string &argument) { symbolMap = argument; })
@@ -146,7 +146,7 @@ int main(int argc, const char *argv[]) {
146146
Asm2WasmPreProcessor pre;
147147
// wasm binaries can contain a names section, but not full debug info --
148148
// debug info is disabled if a map file is not specified with wasm binary
149-
pre.debugInfo = options.passOptions.debugInfo && (!emitBinary || binaryMapFile.size());
149+
pre.debugInfo = options.passOptions.debugInfo && (!emitBinary || sourceMapFilename.size());
150150
auto input(
151151
read_file<std::vector<char>>(options.extra["infile"], Flags::Text, options.debug ? Flags::Debug : Flags::Release));
152152
char *start = pre.process(input.data());
@@ -214,8 +214,8 @@ int main(int argc, const char *argv[]) {
214214
writer.setSymbolMap(symbolMap);
215215
writer.setBinary(emitBinary);
216216
if (emitBinary) {
217-
writer.setBinaryMapFilename(binaryMapFile);
218-
writer.setBinaryMapUrl(binaryMapUrl);
217+
writer.setSourceMapFilename(sourceMapFilename);
218+
writer.setSourceMapUrl(sourceMapUrl);
219219
}
220220
writer.write(wasm, options.extra["output"]);
221221

src/tools/wasm-as.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ using namespace wasm;
3030
int main(int argc, const char *argv[]) {
3131
bool debugInfo = false;
3232
std::string symbolMap;
33-
std::string binaryMapFilename;
34-
std::string binaryMapUrl;
33+
std::string sourceMapFilename;
34+
std::string sourceMapUrl;
3535
Options options("wasm-as", "Assemble a .wast (WebAssembly text format) into a .wasm (WebAssembly binary format)");
3636
options.extra["validate"] = "wasm";
3737
options
@@ -53,12 +53,12 @@ int main(int argc, const char *argv[]) {
5353
.add("--debuginfo", "-g", "Emit names section and debug info",
5454
Options::Arguments::Zero,
5555
[&](Options *o, const std::string &arguments) { debugInfo = true; })
56-
.add("--binarymap-file", "-bm", "Emit binary map to the specified file",
56+
.add("--source-map", "-sm", "Emit source map to the specified file",
5757
Options::Arguments::One,
58-
[&binaryMapFilename](Options *o, const std::string &argument) { binaryMapFilename = argument; })
59-
.add("--binarymap-url", "-bu", "Use specified string as binary map URL",
58+
[&sourceMapFilename](Options *o, const std::string &argument) { sourceMapFilename = argument; })
59+
.add("--source-map-url", "-su", "Use specified string as source map URL",
6060
Options::Arguments::One,
61-
[&binaryMapUrl](Options *o, const std::string &argument) { binaryMapUrl = argument; })
61+
[&sourceMapUrl](Options *o, const std::string &argument) { sourceMapUrl = argument; })
6262
.add("--symbolmap", "-s", "Emit a symbol map (indexes => names)",
6363
Options::Arguments::One,
6464
[&](Options *o, const std::string &argument) { symbolMap = argument; })
@@ -96,20 +96,20 @@ int main(int argc, const char *argv[]) {
9696
WasmBinaryWriter writer(&wasm, buffer, options.debug);
9797
// if debug info is used, then we want to emit the names section
9898
writer.setNamesSection(debugInfo);
99-
std::unique_ptr<std::ofstream> binaryMapStream = nullptr;
100-
if (binaryMapFilename.size()) {
101-
binaryMapStream = make_unique<std::ofstream>();
102-
binaryMapStream->open(binaryMapFilename);
103-
writer.setBinaryMap(binaryMapStream.get(), binaryMapUrl);
99+
std::unique_ptr<std::ofstream> sourceMapStream = nullptr;
100+
if (sourceMapFilename.size()) {
101+
sourceMapStream = make_unique<std::ofstream>();
102+
sourceMapStream->open(sourceMapFilename);
103+
writer.setSourceMap(sourceMapStream.get(), sourceMapUrl);
104104
}
105105
if (symbolMap.size() > 0) writer.setSymbolMap(symbolMap);
106106
writer.write();
107107

108108
if (options.debug) std::cerr << "writing to output..." << std::endl;
109109
Output output(options.extra["output"], Flags::Binary, options.debug ? Flags::Debug : Flags::Release);
110110
buffer.writeTo(output);
111-
if (binaryMapStream) {
112-
binaryMapStream->close();
111+
if (sourceMapStream) {
112+
sourceMapStream->close();
113113
}
114114

115115
if (options.debug) std::cerr << "Done." << std::endl;

src/tools/wasm-dis.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,17 @@ using namespace cashew;
2828
using namespace wasm;
2929

3030
int main(int argc, const char *argv[]) {
31-
std::string binaryMapFilename;
31+
std::string sourceMapFilename;
3232
Options options("wasm-dis", "Un-assemble a .wasm (WebAssembly binary format) into a .wast (WebAssembly text format)");
3333
options.add("--output", "-o", "Output file (stdout if not specified)",
3434
Options::Arguments::One,
3535
[](Options *o, const std::string &argument) {
3636
o->extra["output"] = argument;
3737
Colors::disable();
3838
})
39-
.add("--binarymap-file", "-bm", "Consume binary map from the specified file to add location information",
39+
.add("--source-map", "-sm", "Consume source map from the specified file to add location information",
4040
Options::Arguments::One,
41-
[&binaryMapFilename](Options *o, const std::string &argument) { binaryMapFilename = argument; })
41+
[&sourceMapFilename](Options *o, const std::string &argument) { sourceMapFilename = argument; })
4242
.add_positional("INFILE", Options::Arguments::One,
4343
[](Options *o, const std::string &argument) {
4444
o->extra["infile"] = argument;
@@ -50,16 +50,16 @@ int main(int argc, const char *argv[]) {
5050
if (options.debug) std::cerr << "parsing binary..." << std::endl;
5151
Module wasm;
5252
try {
53-
std::unique_ptr<std::ifstream> binaryMapStream;
53+
std::unique_ptr<std::ifstream> sourceMapStream;
5454
WasmBinaryBuilder parser(wasm, input, options.debug);
55-
if (binaryMapFilename.size()) {
56-
binaryMapStream = make_unique<std::ifstream>();
57-
binaryMapStream->open(binaryMapFilename);
58-
parser.setDebugLocations(binaryMapStream.get());
55+
if (sourceMapFilename.size()) {
56+
sourceMapStream = make_unique<std::ifstream>();
57+
sourceMapStream->open(sourceMapFilename);
58+
parser.setDebugLocations(sourceMapStream.get());
5959
}
6060
parser.read();
61-
if (binaryMapStream) {
62-
binaryMapStream->close();
61+
if (sourceMapStream) {
62+
sourceMapStream->close();
6363
}
6464
} catch (ParseException& p) {
6565
p.dump(std::cerr);

src/wasm-binary.h

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -538,8 +538,8 @@ class WasmBinaryWriter : public Visitor<WasmBinaryWriter, void> {
538538
Function* currFunction = nullptr;
539539
bool debug;
540540
bool debugInfo = true;
541-
std::ostream* binaryMap = nullptr;
542-
std::string binaryMapUrl;
541+
std::ostream* sourceMap = nullptr;
542+
std::string sourceMapUrl;
543543
std::string symbolMap;
544544

545545
MixedArena allocator;
@@ -551,9 +551,9 @@ class WasmBinaryWriter : public Visitor<WasmBinaryWriter, void> {
551551
}
552552

553553
void setNamesSection(bool set) { debugInfo = set; }
554-
void setBinaryMap(std::ostream* set, std::string url) {
555-
binaryMap = set;
556-
binaryMapUrl = url;
554+
void setSourceMap(std::ostream* set, std::string url) {
555+
sourceMap = set;
556+
sourceMapUrl = url;
557557
}
558558
void setSymbolMap(std::string set) { symbolMap = set; }
559559

@@ -593,8 +593,8 @@ class WasmBinaryWriter : public Visitor<WasmBinaryWriter, void> {
593593
void writeSourceMapUrl();
594594
void writeSymbolMap();
595595

596-
void writeBinaryMapProlog();
597-
void writeBinaryMapEpilog();
596+
void writeSourceMapProlog();
597+
void writeSourceMapEpilog();
598598
void writeDebugLocation(size_t offset, const Function::DebugLocation& loc);
599599

600600
// helpers
@@ -623,8 +623,8 @@ class WasmBinaryWriter : public Visitor<WasmBinaryWriter, void> {
623623
size_t lastBytecodeOffset;
624624

625625
void visit(Expression* curr) {
626-
if (binaryMap && currFunction) {
627-
// Dump the binaryMap debug info
626+
if (sourceMap && currFunction) {
627+
// Dump the sourceMap debug info
628628
auto& debugLocations = currFunction->debugLocations;
629629
auto iter = debugLocations.find(curr);
630630
if (iter != debugLocations.end() && iter->second != lastDebugLocation) {
@@ -668,7 +668,7 @@ class WasmBinaryBuilder {
668668
MixedArena& allocator;
669669
std::vector<char>& input;
670670
bool debug;
671-
std::istream* binaryMap;
671+
std::istream* sourceMap;
672672
std::pair<uint32_t, Function::DebugLocation> nextDebugLocation;
673673

674674
size_t pos = 0;
@@ -678,7 +678,7 @@ class WasmBinaryBuilder {
678678
std::set<BinaryConsts::Section> seenSections;
679679

680680
public:
681-
WasmBinaryBuilder(Module& wasm, std::vector<char>& input, bool debug) : wasm(wasm), allocator(wasm.allocator), input(input), debug(debug), binaryMap(nullptr), nextDebugLocation(0, { 0, 0, 0 }), useDebugLocation(false) {}
681+
WasmBinaryBuilder(Module& wasm, std::vector<char>& input, bool debug) : wasm(wasm), allocator(wasm.allocator), input(input), debug(debug), sourceMap(nullptr), nextDebugLocation(0, { 0, 0, 0 }), useDebugLocation(false) {}
682682

683683
void read();
684684
void readUserSection(size_t payloadLen);
@@ -768,13 +768,13 @@ class WasmBinaryBuilder {
768768
void readNames(size_t);
769769

770770
// Debug information reading helpers
771-
void setDebugLocations(std::istream* binaryMap_) {
772-
binaryMap = binaryMap_;
771+
void setDebugLocations(std::istream* sourceMap_) {
772+
sourceMap = sourceMap_;
773773
}
774774
Function::DebugLocation debugLocation;
775775
std::unordered_map<std::string, Index> debugInfoFileIndices;
776776
void readNextDebugLocation();
777-
void readBinaryMapHeader();
777+
void readSourceMapHeader();
778778

779779
// AST reading
780780
int depth = 0; // only for debugging

src/wasm-io.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,15 @@ class ModuleWriter : public ModuleIO {
4848
bool binary = true;
4949
bool debugInfo = false;
5050
std::string symbolMap;
51-
std::string binaryMapFilename;
52-
std::string binaryMapUrl;
51+
std::string sourceMapFilename;
52+
std::string sourceMapUrl;
5353

5454
public:
5555
void setBinary(bool binary_) { binary = binary_; }
5656
void setDebugInfo(bool debugInfo_) { debugInfo = debugInfo_; }
5757
void setSymbolMap(std::string symbolMap_) { symbolMap = symbolMap_; }
58-
void setBinaryMapFilename(std::string binaryMapFilename_) { binaryMapFilename = binaryMapFilename_; }
59-
void setBinaryMapUrl(std::string binaryMapUrl_) { binaryMapUrl = binaryMapUrl_; }
58+
void setSourceMapFilename(std::string sourceMapFilename_) { sourceMapFilename = sourceMapFilename_; }
59+
void setSourceMapUrl(std::string sourceMapUrl_) { sourceMapUrl = sourceMapUrl_; }
6060

6161
// write text
6262
void writeText(Module& wasm, std::string filename);

0 commit comments

Comments
 (0)