Compiler projects using llvm
## This test makes sure we can extract the instrumentation map from an
## XRay-instrumented PIE file.

# RUN: yaml2obj %S/Inputs/elf64-pic.yaml -o %t.so
# RUN: llvm-xray extract %t.so -s | FileCheck %s
# RUN: llvm-xray extract %t.so --no-demangle --demangle -s | FileCheck %s

# CHECK:      ---
# CHECK-NEXT: - { id: 1, address: 0x420, function: 0x420, kind: function-enter, always-instrument: true, function-name: 'foo()' }
# CHECK-NEXT: - { id: 1, address: 0x440, function: 0x420, kind: function-exit, always-instrument: true, function-name: 'foo()' }
# CHECK-NEXT: - { id: 2, address: 0x464, function: 0x464, kind: function-enter, always-instrument: true, function-name: 'bar()' }
# CHECK-NEXT: - { id: 2, address: 0x484, function: 0x464, kind: function-exit, always-instrument: true, function-name: 'bar()' }
# CHECK-NEXT: - { id: 3, address: 0x4A8, function: 0x4A8, kind: function-enter, always-instrument: true, function-name: 'jar()' }
# CHECK-NEXT: - { id: 3, address: 0x4C8, function: 0x4A8, kind: function-exit, always-instrument: true, function-name: 'jar()' }
# CHECK-NEXT: ...

# RUN: llvm-xray extract -s --no-demangle %t.so | FileCheck --check-prefix=MANGLED %s
# RUN: llvm-xray extract -s --demangle --no-demangle %t.so | FileCheck --check-prefix=MANGLED %s

# MANGLED:      ---
# MANGLED-NEXT: - { id: 1, address: 0x420, function: 0x420, kind: function-enter, always-instrument: true, function-name: _Z3foov }
# MANGLED-NEXT: - { id: 1, address: 0x440, function: 0x420, kind: function-exit, always-instrument: true, function-name: _Z3foov }
# MANGLED-NEXT: - { id: 2, address: 0x464, function: 0x464, kind: function-enter, always-instrument: true, function-name: _Z3barv }
# MANGLED-NEXT: - { id: 2, address: 0x484, function: 0x464, kind: function-exit, always-instrument: true, function-name: _Z3barv }
# MANGLED-NEXT: - { id: 3, address: 0x4A8, function: 0x4A8, kind: function-enter, always-instrument: true, function-name: _Z3jarv }
# MANGLED-NEXT: - { id: 3, address: 0x4C8, function: 0x4A8, kind: function-exit, always-instrument: true, function-name: _Z3jarv }
# MANGLED-NEXT: ...