Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: fix source list on V8 7.4 #316

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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