Files
clang-p2996/llvm/test/tools/llvm-profgen/Inputs/external-address.perfscript
wlei 3dcb60db9a [CSSPGO][llvm-profgen] Fix external address issues of perf reader (leading external LBR part)
We can have the sampling just hit into the external addresses, in that case, both the top stack frame and the latest LBR target are external addresses. For example:
```
	        ffffffff
 0x4006c8/0xffffffff/P/-/-/0  0x40069b/0x400670/M/-/-/0

 	          ffffffff
	          40067e
0xffffffff/0xffffffff/P/-/-/0  0x4006c8/0xffffffff/P/-/-/0  0x40069b/0x400670/M/-/-/0
```
Before we will ignore the entire samples. However, we found there exists some internal LBRs in the remaining part of sample, the range between them is still a valid range, we will lose some valid LBRs. Those LBRs will be unwinded based on a empty(context-less) call stack.

This change tries to fix it, instead of ignoring the entire sample, we only ignore the leading external addresses.

Note that the first outgoing LBR is useful since there is a valid range between it's source and next LBR's target.

Reviewed By: hoy, wenlei

Differential Revision: https://reviews.llvm.org/D115538
2021-12-14 16:40:53 -08:00

40 lines
1.0 KiB
Plaintext

PERF_RECORD_MMAP2 2854748/2854748: [0x400000(0x1000) @ 0 00:1d 123291722 526021]: r-xp /home/inline-cs-noprobe.perfbin
; Test for an external top address, should only ignore the call stack and keep unwinding the LBR
; Valid LBR. The first 4006d7 will be kept for unwinding, the second will be truncated.
ffffffff
ffffffff
4006d7
ffffffff
4006d7
ffffffff
0x4006c8/0x40067e/P/-/-/0 0x40069b/0x400670/M/-/-/0
; Valid LBR
ffffffff
0x4006c8/0x40067e/P/-/-/0 0x40069b/0x400670/M/-/-/0
; Valid LBR
ffffffff
0x4006c8/0xffffffff/P/-/-/0 0x40069b/0x400670/M/-/-/0
; Valid LBR
40067e
0x4006c8/0xffffffff/P/-/-/0 0x40069b/0x400670/M/-/-/0
; Valid LBR
ffffffff
5541f689495641d7
0xffffffff/0xffffffff/P/-/-/0 0x4006c8/0xffffffff/P/-/-/0 0x40069b/0x400670/M/-/-/0
; Empty sample
ffffffff
5541f689495641d7
0xffffffff/0xffffffff/P/-/-/0 0xffffffff/0xffffffff/P/-/-/0
; Invalid LBR
ffffffff
0xffffffff/0xffffffff/P/-/-/0 0x40069b/0x400670/M/-/-/0