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

v8 bt skips some frames #99

Closed
brendangregg opened this issue Jun 19, 2017 · 3 comments · Fixed by #104
Closed

v8 bt skips some frames #99

brendangregg opened this issue Jun 19, 2017 · 3 comments · Fixed by #104
Labels

Comments

@brendangregg
Copy link
Contributor

Maybe there's a good reason for this, but notice we're skipping frames 1-4:

(lldb) v8 bt
 * thread #1: tid = 13, 0x00007fda23874d44 libpthread.so.0`__GI___pthread_mutex_lock + 4, name = 'node', stop reason = signal SIGSEGV
  * frame #0: 0x00007fda23874d44 libpthread.so.0`__GI___pthread_mutex_lock + 4
    frame #5: 0x00007fda20ffe212 node`v8::internal::FunctionCallbackArguments::Call(void (*)(v8::FunctionCallbackInfo<v8::Value> const&)) + 290
[...]

They do show up with the normal bt:

(lldb) bt
* thread #1, name = 'node', stop reason = signal SIGSEGV
  * frame #0: 0x00007fda23874d44 libpthread.so.0`__GI___pthread_mutex_lock + 4
    frame #1: 0x00007fda20b0ed19 node
    frame #2: 0x00007fda20ac5e39 node
    frame #3: 0x00007fda20a9dd4b node
    frame #4: 0x00007fda20a9c9f6 node
    frame #5: 0x00007fda20ffe212 node`v8::internal::FunctionCallbackArguments::Call(void (*)(v8::FunctionCallbackInfo<v8::Value> const&)) + 290
[...]

Should "v8 bt" be skipping them?

@bnoordhuis
Copy link
Member

I've been looking at this. llnode skips frames it can't link to either a C++ symbol or a JS stack frame.

It's easy to change but then stack frames for V8 builtins also show up (because llnode does not know how to identify them) and there are often a great number of them.

I added a heuristic to skip frames whose PC is inside a WX memory segment on the assumption that it's almost certainly jitted code. The only problem is that it depends on SBProcess::GetMemoryRegions() so I don't think it's going to work with older lldb versions.

Before I move on with this, does anyone have a better idea?

@bnoordhuis bnoordhuis added the bug label Jun 20, 2017
@rnchamberlain
Copy link
Contributor

We had a brief discussion on skipped frames last year, and there was interest in seeing all frames, even if the information available was minimal, eg V8 transition frames.

Re dependency on GetMemoryRegions(), as that API is in lldb 3.9, which is the stable release now, I don't think that should be a worry.

@bnoordhuis
Copy link
Member

Sounds good. I've opened #104, it prints them as <builtin>.

hhellyer pushed a commit that referenced this issue Jun 29, 2017
* src: use explicit imports
Replace `using namespace lldb` with explicit `using lldb::<name>`
imports.

* test: fix scan-test.js with node >= 8.1.0
The object change that commit b73e042 ("src,test: support node.js >= 8")
from April addressed has been reverted again in 8.1.0.  Update the test.
Refs: nodejs/node#13374

* src: print builtins and unnamed stack frames
Previously, `v8 bt` would exclude frames that didn't map to a C++ symbol
or a JS stack frame.  llnode does not currently know how to identify the
stack frames of V8 builtins so those were omitted as well.

This commit makes those stack frames visible and introduces a heuristic
(in lldb >= 3.9) where frames whose PC is inside a WX memory segment are
assumed to belong to V8 builtins.

Fixes: #99
* fixup! SBMemoryRegionInfo is lldb >= 3.9

Fix: #99
PR-URL: #104
Reviewed-By: Fedor Indutny <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants