Commit fc1b29c9 authored by Georg Neis's avatar Georg Neis Committed by Commit Bot

Provide default Print() for StackFrame.

For stack frame types that don't provide their own Print function, we
used to print nothing at all. Now we print at least the type and the pc.

Bug: 
Change-Id: I8453d705589bc83c284ce4eb4e981f2ad32ee901
Reviewed-on: https://chromium-review.googlesource.com/897425
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51053}
parent 6bf88852
......@@ -702,8 +702,28 @@ void PrintIndex(StringStream* accumulator, StackFrame::PrintMode mode,
int index) {
accumulator->Add((mode == StackFrame::OVERVIEW) ? "%5d: " : "[%d]: ", index);
}
const char* StringForStackFrameType(StackFrame::Type type) {
switch (type) {
#define CASE(value, name) \
case StackFrame::value: \
return #name;
STACK_FRAME_TYPE_LIST(CASE)
#undef CASE
default:
UNREACHABLE();
}
}
} // namespace
void StackFrame::Print(StringStream* accumulator, PrintMode mode,
int index) const {
DisallowHeapAllocation no_gc;
PrintIndex(accumulator, mode, index);
accumulator->Add(StringForStackFrameType(type()));
accumulator->Add(" [pc: %p]\n", pc());
}
void BuiltinExitFrame::Print(StringStream* accumulator, PrintMode mode,
int index) const {
DisallowHeapAllocation no_gc;
......
......@@ -289,9 +289,8 @@ class StackFrame BASE_EMBEDDED {
// Printing support.
enum PrintMode { OVERVIEW, DETAILS };
virtual void Print(StringStream* accumulator,
PrintMode mode,
int index) const { }
virtual void Print(StringStream* accumulator, PrintMode mode,
int index) const;
Isolate* isolate() const { return isolate_; }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment