Index: test/cctest/wasm/test-wasm-stack.cc |
diff --git a/test/cctest/wasm/test-wasm-stack.cc b/test/cctest/wasm/test-wasm-stack.cc |
index 3915e43c813d4b774fcb7d02971ac3a52f9be351..2e5e08e8bcaa1181c0e586fbdc0dcef9bb1172b9 100644 |
--- a/test/cctest/wasm/test-wasm-stack.cc |
+++ b/test/cctest/wasm/test-wasm-stack.cc |
@@ -23,10 +23,11 @@ namespace { |
do { \ |
const char* exp_ = (exp); \ |
const char* found_ = (found); \ |
- if (V8_UNLIKELY(strcmp(exp_, found_) != 0)) { \ |
+ DCHECK_NOT_NULL(exp); \ |
+ if (V8_UNLIKELY(found_ == nullptr || strcmp(exp_, found_) != 0)) { \ |
V8_Fatal(__FILE__, __LINE__, \ |
"Check failed: (%s) != (%s) ('%s' vs '%s').", #exp, #found, \ |
- exp_, found_); \ |
+ exp_, found_ ? found_ : "<null>"); \ |
} \ |
} while (0) |
@@ -34,12 +35,18 @@ void PrintStackTrace(v8::Local<v8::StackTrace> stack) { |
printf("Stack Trace (length %d):\n", stack->GetFrameCount()); |
for (int i = 0, e = stack->GetFrameCount(); i != e; ++i) { |
v8::Local<v8::StackFrame> frame = stack->GetFrame(i); |
- v8::Local<v8::String> script = frame->GetScriptName(); |
v8::Local<v8::String> func = frame->GetFunctionName(); |
- printf("[%d] (%s) %s:%d:%d\n", i, |
- script.IsEmpty() ? "<null>" : *v8::String::Utf8Value(script), |
- func.IsEmpty() ? "<null>" : *v8::String::Utf8Value(func), |
- frame->GetLineNumber(), frame->GetColumn()); |
+ if (frame->IsWasm()) { |
+ printf("[%d] (<WASM>) %s:%d\n", i, |
+ func.IsEmpty() ? "<null>" : *v8::String::Utf8Value(func), |
+ frame->GetWasmByteOffset()); |
+ } else { |
+ v8::Local<v8::String> script = frame->GetScriptName(); |
+ printf("[%d] (%s) %s:%d:%d\n", i, |
+ script.IsEmpty() ? "<null>" : *v8::String::Utf8Value(script), |
+ func.IsEmpty() ? "<null>" : *v8::String::Utf8Value(func), |
+ frame->GetLineNumber(), frame->GetColumn()); |
+ } |
} |
} |
@@ -108,10 +115,10 @@ TEST(CollectDetailedWasmStack_ExplicitThrowFromJs) { |
// Line number is 1-based, with 0 == kNoLineNumberInfo. |
ExceptionInfo expected_exceptions[] = { |
- {"a", 3}, // Comment to prevent clang-format complaints |
- {"js", 4}, // - |
- {"<WASM>", 0}, // - |
- {"<WASM>", 0}, // - |
+ {"a", 3}, // Comment to prevent clang-format complaints |
+ {"js", 4}, // - |
+ {"<WASM UNNAMED>", 0}, // - |
+ {"<WASM UNNAMED>", 0}, // - |
{"callFn", 1}}; |
CheckExceptionInfos(isolate, maybe_exc.ToHandleChecked(), |
expected_exceptions); |
@@ -150,8 +157,8 @@ TEST(CollectDetailedWasmStack_WasmError) { |
// Line number is 1-based, with 0 == kNoLineNumberInfo. |
ExceptionInfo expected_exceptions[] = { |
- {"<WASM>", 0}, // Comment to prevent clang-format complaints. |
- {"<WASM>", 0}, |
+ {"exec_unreachable", 0}, // Comment to prevent clang-format complaints. |
+ {"call_exec_unreachable", 0}, |
{"callFn", 1}}; |
CheckExceptionInfos(isolate, maybe_exc.ToHandleChecked(), |
expected_exceptions); |