xref: /llvm-project/llvm/test/tools/llvm-xray/AArch64/extract-instrmap.test (revision 9b96b0865df158a73767c3cfdd0380f86d5dde21)
1## This test makes sure we can extract the instrumentation map from an
2## XRay-instrumented PIE file.
3
4# RUN: yaml2obj %S/Inputs/elf64-pic.yaml -o %t.so
5# RUN: llvm-xray extract %t.so -s | FileCheck %s
6# RUN: llvm-xray extract %t.so --no-demangle --demangle -s | FileCheck %s
7
8# CHECK:      ---
9# CHECK-NEXT: - { id: 1, address: 0x420, function: 0x420, kind: function-enter, always-instrument: true, function-name: 'foo()' }
10# CHECK-NEXT: - { id: 1, address: 0x440, function: 0x420, kind: function-exit, always-instrument: true, function-name: 'foo()' }
11# CHECK-NEXT: - { id: 2, address: 0x464, function: 0x464, kind: function-enter, always-instrument: true, function-name: 'bar()' }
12# CHECK-NEXT: - { id: 2, address: 0x484, function: 0x464, kind: function-exit, always-instrument: true, function-name: 'bar()' }
13# CHECK-NEXT: - { id: 3, address: 0x4A8, function: 0x4A8, kind: function-enter, always-instrument: true, function-name: 'jar()' }
14# CHECK-NEXT: - { id: 3, address: 0x4C8, function: 0x4A8, kind: function-exit, always-instrument: true, function-name: 'jar()' }
15# CHECK-NEXT: ...
16
17# RUN: llvm-xray extract -s --no-demangle %t.so | FileCheck --check-prefix=MANGLED %s
18# RUN: llvm-xray extract -s --demangle --no-demangle %t.so | FileCheck --check-prefix=MANGLED %s
19
20# MANGLED:      ---
21# MANGLED-NEXT: - { id: 1, address: 0x420, function: 0x420, kind: function-enter, always-instrument: true, function-name: _Z3foov }
22# MANGLED-NEXT: - { id: 1, address: 0x440, function: 0x420, kind: function-exit, always-instrument: true, function-name: _Z3foov }
23# MANGLED-NEXT: - { id: 2, address: 0x464, function: 0x464, kind: function-enter, always-instrument: true, function-name: _Z3barv }
24# MANGLED-NEXT: - { id: 2, address: 0x484, function: 0x464, kind: function-exit, always-instrument: true, function-name: _Z3barv }
25# MANGLED-NEXT: - { id: 3, address: 0x4A8, function: 0x4A8, kind: function-enter, always-instrument: true, function-name: _Z3jarv }
26# MANGLED-NEXT: - { id: 3, address: 0x4C8, function: 0x4A8, kind: function-exit, always-instrument: true, function-name: _Z3jarv }
27# MANGLED-NEXT: ...
28