Skip to content

Commit ec01604

Browse files
committed
src: fix source list on V8 7.4
PR-URL: #316 Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
1 parent a79a008 commit ec01604

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

src/llnode.cc

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,7 @@ bool BacktraceCmd::DoExecute(SBDebugger d, char** cmd,
6969
const char star = (frame == selected_frame ? '*' : ' ');
7070
const uint64_t pc = frame.GetPC();
7171

72-
// TODO(mmarchini): There might be a better way to check for V8 builtins
73-
// embedded in the binary.
74-
auto c_function_name = frame.GetFunctionName();
75-
std::string function_name(c_function_name != nullptr ? c_function_name
76-
: "");
77-
if (!frame.GetSymbol().IsValid() || function_name.find("Builtins_") == 0) {
72+
if (v8::JSFrame::MightBeV8Frame(frame)) {
7873
Error err;
7974
v8::JSFrame v8_frame(llv8_, static_cast<int64_t>(frame.GetFP()));
8075
Printer printer(llv8_);
@@ -263,7 +258,6 @@ bool ListCmd::DoExecute(SBDebugger d, char** cmd,
263258
// Load V8 constants from postmortem data
264259
llv8_->Load(target);
265260
SBFrame frame = thread.GetSelectedFrame();
266-
SBSymbol symbol = frame.GetSymbol();
267261

268262
bool reset_line = false;
269263
if (line_switch) {
@@ -274,8 +268,7 @@ bool ListCmd::DoExecute(SBDebugger d, char** cmd,
274268
reset_line = true;
275269
}
276270
last_frame = frame;
277-
// C++ symbol
278-
if (symbol.IsValid()) {
271+
if (!v8::JSFrame::MightBeV8Frame(frame)) {
279272
SBCommandInterpreter interpreter = d.GetCommandInterpreter();
280273
std::string cmd = "source list ";
281274
cmd += full_cmd;

src/llv8.cc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,16 @@ Smi JSFrame::FromFrameMarker(Value value) const {
293293
return Smi(value);
294294
}
295295

296+
297+
bool JSFrame::MightBeV8Frame(lldb::SBFrame& frame) {
298+
// TODO(mmarchini): There might be a better way to check for V8 builtins
299+
// embedded in the binary.
300+
auto c_function_name = frame.GetFunctionName();
301+
std::string function_name(c_function_name != nullptr ? c_function_name : "");
302+
303+
return !frame.GetSymbol().IsValid() || function_name.find("Builtins_") == 0;
304+
}
305+
296306
std::string JSFunction::GetDebugLine(std::string args, Error& err) {
297307
SharedFunctionInfo info = Info(err);
298308
if (err.Fail()) return std::string();

src/llv8.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,8 @@ class JSFrame : public Value {
590590
uint32_t line_limit, std::string lines[],
591591
uint32_t& lines_found, Error& err);
592592

593+
static bool MightBeV8Frame(lldb::SBFrame& frame);
594+
593595
private:
594596
Smi FromFrameMarker(Value value) const;
595597
friend class llnode::Printer;

0 commit comments

Comments
 (0)