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: Benedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51053}
This commit is contained in:
Georg Neis 2018-02-01 20:17:45 +01:00 committed by Commit Bot
parent 6bf8885290
commit fc1b29c985
2 changed files with 22 additions and 3 deletions

View File

@ -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;

View File

@ -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_; }