Chromium Code Reviews| Index: src/frames.cc |
| diff --git a/src/frames.cc b/src/frames.cc |
| index 5920bfda8c4bb6484c1c06162db6e3f1ba4ccdc1..9f46d8e8b5cb0687daf4361fafdaf34c46516e23 100644 |
| --- a/src/frames.cc |
| +++ b/src/frames.cc |
| @@ -1487,7 +1487,28 @@ void StackFrame::PrintIndex(StringStream* accumulator, |
| void WasmFrame::Print(StringStream* accumulator, PrintMode mode, |
| int index) const { |
| - accumulator->Add("wasm frame"); |
| + PrintIndex(accumulator, mode, index); |
| + accumulator->Add("WASM ["); |
| + Script* script = this->script(); |
| + accumulator->PrintName(script->name()); |
| + int pc = static_cast<int>(this->pc() - LookupCode()->instruction_start()); |
| + Vector<const uint8_t> raw_func_name; |
| + Object* instance_or_undef = this->wasm_instance(); |
| + if (instance_or_undef->IsUndefined(this->isolate())) { |
| + raw_func_name = STATIC_CHAR_VECTOR("<undefined>"); |
| + } else { |
| + raw_func_name = WasmInstanceObject::cast(instance_or_undef) |
| + ->get_compiled_module() |
| + ->GetRawFunctionName(this->function_index()); |
| + } |
| + const int kMaxPrintedFunctionName = 64; |
| + char func_name[kMaxPrintedFunctionName + 1]; |
| + int func_name_len = std::min(kMaxPrintedFunctionName, raw_func_name.length()); |
| + memcpy(func_name, raw_func_name.start(), func_name_len); |
| + func_name[func_name_len] = '\0'; |
| + accumulator->Add("], function #%u ('%s'), pc=%p, pos=%d\n", |
|
titzer
2016/11/18 10:38:21
Does the accumulator pass the format string to pri
Clemens Hammacher
2016/11/18 12:01:27
No, unfortunately not. It does the formatting inte
|
| + this->function_index(), func_name, pc, this->position()); |
| + if (mode != OVERVIEW) accumulator->Add("\n"); |
| } |
| Code* WasmFrame::unchecked_code() const { |