Skip to content

Commit

Permalink
src: fix source list on V8 7.4
Browse files Browse the repository at this point in the history
PR-URL: #316
Reviewed-By: Colin Ihrig <[email protected]>
  • Loading branch information
mmarchini committed Oct 8, 2019
1 parent a79a008 commit ec01604
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/llnode.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,7 @@ bool BacktraceCmd::DoExecute(SBDebugger d, char** cmd,
const char star = (frame == selected_frame ? '*' : ' ');
const uint64_t pc = frame.GetPC();

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

bool reset_line = false;
if (line_switch) {
Expand All @@ -274,8 +268,7 @@ bool ListCmd::DoExecute(SBDebugger d, char** cmd,
reset_line = true;
}
last_frame = frame;
// C++ symbol
if (symbol.IsValid()) {
if (!v8::JSFrame::MightBeV8Frame(frame)) {
SBCommandInterpreter interpreter = d.GetCommandInterpreter();
std::string cmd = "source list ";
cmd += full_cmd;
Expand Down
10 changes: 10 additions & 0 deletions src/llv8.cc
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,16 @@ Smi JSFrame::FromFrameMarker(Value value) const {
return Smi(value);
}


bool JSFrame::MightBeV8Frame(lldb::SBFrame& frame) {
// TODO(mmarchini): There might be a better way to check for V8 builtins
// embedded in the binary.
auto c_function_name = frame.GetFunctionName();
std::string function_name(c_function_name != nullptr ? c_function_name : "");

return !frame.GetSymbol().IsValid() || function_name.find("Builtins_") == 0;
}

std::string JSFunction::GetDebugLine(std::string args, Error& err) {
SharedFunctionInfo info = Info(err);
if (err.Fail()) return std::string();
Expand Down
2 changes: 2 additions & 0 deletions src/llv8.h
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,8 @@ class JSFrame : public Value {
uint32_t line_limit, std::string lines[],
uint32_t& lines_found, Error& err);

static bool MightBeV8Frame(lldb::SBFrame& frame);

private:
Smi FromFrameMarker(Value value) const;
friend class llnode::Printer;
Expand Down

0 comments on commit ec01604

Please sign in to comment.