Ad

C++ Entry Points Not Showing Up In Node.js Profiling Output

- 1 answer

When running node --prof <command>, then later node --prof-process on macOS, my profiling output no-longer shows any of the C++ entry points, leading to a lot of unaccounted-for gaps in my profiling data. Changed around the same time, I now just see the node binary in these profiling trees where it wasn't showing up before, so it's like the profiler is no-longer able to "dive in" to the internals of node.

I think this started when trying to improve dtrace permissions with csrutil, but I've restored things back to their factory settings and this still happens.

What causes C++ entry points to not show up in traces? Is there a way to fix the issue?

Update:

Just tried turning off SIP entirely with csrutil disable (which is a bad thing to do), and the problem persists, so maybe SIP is a red herring here.

Ad

Answer

The amazing wizards in the node.js github issues figured this out.

In short, I learned that two commands are used by the profiler on macOS: c++filt and nm. When I tried reporting which versions of those commands I had installed, I got this message back for nm:

» nm --version                                                                                                                                           
Agreeing to the Xcode/iOS license requires admin privileges, please run “sudo xcodebuild -license” and then retry this command.

Apparently the requirement of accepting the license was added, perhaps after an upgrade, and this was blocking the ability for the profiler to look up and demangle C++ symbols. After I accepted the license, the profiler started working normally again.

Hopefully this helps others running across the same scenario.

Ad
source: stackoverflow.com
Ad