Skip to content

Commit

Permalink
Fix use of deprecated methods removed in V8 7.0
Browse files Browse the repository at this point in the history
StackFrame::GetFrame(uint32_t index) was deprecated in V8 6.9 and
removed in V8 7.0.

Refs: nodejs/node#22531
Refs: nodejs#116
  • Loading branch information
richardlau committed Dec 21, 2018
1 parent 8246487 commit 8486893
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/node_report.cc
Expand Up @@ -509,7 +509,11 @@ static void PrintJavaScriptErrorStack(std::ostream& out, Isolate* isolate, Maybe
}
// Print the stack trace, samples are not available as the exception isn't from the current stack.
for (int i = 0; i < stack->GetFrameCount(); i++) {
PrintStackFrame(out, isolate, stack->GetFrame(i), i, nullptr);
PrintStackFrame(out, isolate, stack->GetFrame(
#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION >= 7)
isolate,
#endif
i), i, nullptr);
}
}

Expand Down Expand Up @@ -545,9 +549,17 @@ static void PrintStackFromStackTrace(std::ostream& out, Isolate* isolate, DumpEv
// Print the stack trace, adding in the pc values from GetStackSample() if available
for (int i = 0; i < stack->GetFrameCount(); i++) {
if (static_cast<size_t>(i) < info.frames_count) {
PrintStackFrame(out, isolate, stack->GetFrame(i), i, samples[i]);
PrintStackFrame(out, isolate, stack->GetFrame(
#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION >= 7)
isolate,
#endif
i), i, samples[i]);
} else {
PrintStackFrame(out, isolate, stack->GetFrame(i), i, nullptr);
PrintStackFrame(out, isolate, stack->GetFrame(
#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION >= 7)
isolate,
#endif
i), i, nullptr);
}
}
}
Expand Down

0 comments on commit 8486893

Please sign in to comment.