Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use frame pointer unwinding for v8-based application (#1836)
We can't unwind nodejs and other v8-base applications as we can't continue unwinding after the first AoT frame: ``` [...] current pc: 7fb0cf84904a current sp: 7fff93701498 current bp: 7fff937014d8 [debug] Unwinding JITed stacks [debug] Within unwinding machinery loop current pc: 157a329 current sp: 7fff937014e8 current bp: 7fff93701548 ~about to check shards found=1 ~checking shards now [info] found chunk le offset: 0 ========== left 0 right 249997 .done => table_index: 206094 => adjusted pc: 157a329 cfa type: 4, offset: 0 (row pc: 156f656) [info] PC 157a329 not contained in the unwind info, found marker [warn] mapping not added yet rbp 7fff93701548 pid 227936 tgid 227936 ``` Turns out this AoT function doesn't have the corresponding DWARF unwind information: ``` $ dist/eh-frame --executable /home/javierhonduco/.nvm/versions/node/v16.13.0/bin/node | grep 157a3 $ ``` After cross-validating the output with `bpftrace`'s and checking v8's source code it was clear why this is happening: ``` 157a32a Builtins_InterpreterEntryTrampoline+202 (/home/javierhonduco/.nvm/versions/node/v16.13.0/bin/node) 157a32a Builtins_InterpreterEntryTrampoline+202 (/home/javierhonduco/.nvm/versions/node/v16.13.0/bin/node) 157a32a Builtins_InterpreterEntryTrampoline+202 (/home/javierhonduco/.nvm/versions/node/v16.13.0/bin/node) 1578538 Builtins_JSEntryTrampoline+88 (/home/javierhonduco/.nvm/versions/node/v16.13.0/bin/node) 15782c3 Builtins_JSEntry+131 (/home/javierhonduco/.nvm/versions/node/v16.13.0/bin/node) [...] 7f65c5e29510 __libc_start_call_main+128 (/usr/lib64/libc.so.6) ``` The `Builtins_` functions above seem to be emmited via a custom code generator[0]. No special linker `.cfi` directives are used, so this is effectively like writting raw assembly with frame pointers set up, but without telling the rest of the tooling how to produce unwidn information it. Test Plan ========= - node: https://pprof.me/95f85d0 - basic-cpp-no-fp: https://pprof.me/a6099f2 - ruby: https://pprof.me/4ecf047 - [0]: https://github.com/v8/v8/blob/e554f1e97e30f6e4cf6eef2c5049c17ca708e103/src/builtins/x64/builtins-x64.cc
- Loading branch information
Showing
3 changed files
with
61 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters