[llvm-dev] Source locations missing when using xray-account

Dean Michael Berris via llvm-dev llvm-dev at lists.llvm.org
Thu Dec 13 14:13:57 PST 2018



> On 14 Dec 2018, at 03:46, Matthew Pickering <matthewtpickering at gmail.com> wrote:
> 
> 3. Compiling with `-O0`, the verifier succeeds and then using
> llvm-stack, the complete call hierarchy is completely flat
> (an example run for loading into chrome://tracing -
> https://gist.githubusercontent.com/mpickering/a6dbaaeaa281b812cf3064a45e73a043/raw/9e5cdfffca1eb1ad269892af6bf7681ff195499e/chrome-tracing.json)
> 
> output of llvm-xray stack:
> https://gist.github.com/715859a15c088108a8114fcbf68926a5
> 
> log.yaml if that helps. https://gist.github.com/86fa7d8252967f6951b63d7a220f2846
> 
> Notice that level is 0 for all the entries. Any ideas what could cause this?
> 

This looks like it’s caused by tail-call optimisation, which XRay accurately captures in the trace:

```
---
header:          
  version:         3
  type:            0
  constant-tsc:    true
  nonstop-tsc:     true
  cycle-frequency: 3800000000
records:         
  - { type: 0, func-id: 295, function: '295', cpu: 4, thread: 27847, process: 27847, kind: function-enter, tsc: 283087507139077 }
  - { type: 0, func-id: 295, function: '295', cpu: 4, thread: 27847, process: 27847, kind: function-tail-exit, tsc: 283087507173976 }
  - { type: 0, func-id: 185, function: '185', cpu: 4, thread: 27847, process: 27847, kind: function-enter, tsc: 283087536533129 }
  - { type: 0, func-id: 185, function: '185', cpu: 4, thread: 27847, process: 27847, kind: function-tail-exit, tsc: 283087536561925 }
...
```

Note that the output shows you have no actual stacks preserved because the functions tail-exit into other functions.

It could be that we need to change the tools to handle tail exits into other instrumented functions better, but that’s much harder to reason about when a function tail-exits into a non-instrumented function (and we don’t know when that function returns to the caller).

I’m a bit reluctant to say that this is, maybe unfortunately, working as intended. :/

Cheers

-- Dean



More information about the llvm-dev mailing list