From 84868938e67300c6acb4ba81513782f1cad5aab3 Mon Sep 17 00:00:00 2001 From: Richard Lau Date: Fri, 21 Dec 2018 10:15:05 -0500 Subject: [PATCH] Fix use of deprecated methods removed in V8 7.0 StackFrame::GetFrame(uint32_t index) was deprecated in V8 6.9 and removed in V8 7.0. Refs: https://github.com/nodejs/node/pull/22531 Refs: https://github.com/nodejs/node-report/issues/116 --- src/node_report.cc | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/node_report.cc b/src/node_report.cc index 5777a61..f660abd 100644 --- a/src/node_report.cc +++ b/src/node_report.cc @@ -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); } } @@ -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(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); } } }