Skip to content

Commit 2964af5

Browse files
committed
src: treat embeded builtins as V8 functions
On Node.js v12 most builtins are compiled during build time and embeded in the binary. Because of that, LLDB will think it knows how to handle these frames (especially JavaScript frames). To correctly handle those frames, we check the function name, if it starts with `Builtins_` we'll handle it as a JIT function. This method should be safe since any C++ function coming from V8 or Node.js will be mangled, thus beginning with `_Z...`. There might be a better way to handle this, but for now this check should be enough. PR-URL: #301 Reviewed-By: Colin Ihrig <[email protected]>
1 parent 2c4c99c commit 2964af5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/llnode.cc

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

72-
if (!frame.GetSymbol().IsValid()) {
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) {
7378
Error err;
7479
v8::JSFrame v8_frame(llv8_, static_cast<int64_t>(frame.GetFP()));
7580
Printer printer(llv8_);

0 commit comments

Comments
 (0)