Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions scripts/fuzz_opt.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,9 @@ def pick_initial_contents():
# and also see the --dce workaround below that also links to those issues.
V8_UNINITIALIZED_NONDEF_LOCAL = 'uninitialized non-defaultable local'

# JS exceptions are logged as exception thrown: REASON
EXCEPTION_PREFIX = 'exception thrown: '


# given a call line that includes FUZZ_EXEC_CALL_PREFIX, return the export that
# is called
Expand Down Expand Up @@ -584,7 +587,7 @@ def fix_double(x):
out = re.sub(r'f64\.const (-?[nanN:abcdefxIity\d+-.]+)', fix_double, out)

# mark traps from wasm-opt as exceptions, even though they didn't run in a vm
out = out.replace(TRAP_PREFIX, 'exception: ' + TRAP_PREFIX)
out = out.replace(TRAP_PREFIX, EXCEPTION_PREFIX + TRAP_PREFIX)

# funcref(0) has the index of the function in it, and optimizations can
# change that index, so ignore it
Expand All @@ -594,6 +597,9 @@ def fix_double(x):
# to "N".
out = re.sub(r'i31ref\((-?\d+)\)', r'\1', out)

# Tag names may change due to opts, so canonicalize them.
out = re.sub(r' tag\$\d+', ' tag', out)

lines = out.splitlines()
for i in range(len(lines)):
line = lines[i]
Expand All @@ -603,7 +609,7 @@ def fix_double(x):
# developer can see it.
print(line)
lines[i] = None
elif 'exception' in line:
elif EXCEPTION_PREFIX in line:
# exceptions may differ when optimizing, but an exception should
# occur, so ignore their types (also js engines print them out
# slightly differently)
Expand Down
4 changes: 2 additions & 2 deletions scripts/fuzz_shell.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ var instance;
try {
instance = new WebAssembly.Instance(module, imports);
} catch (e) {
console.log('exception: failed to instantiate module');
console.log('exception thrown: failed to instantiate module');
quit();
}

Expand Down Expand Up @@ -143,7 +143,7 @@ for (var e in exports) {
console.log('[fuzz-exec] note result: ' + e + ' => ' + printed(result));
}
} catch (e) {
console.log('exception!');// + [e, e.stack]);
console.log('exception thrown: ' + e);
}
}