1## Checking crashes against injected binary functions created by patch 2## entries pass and debug info turned on. In these cases, we were 3## trying to fetch input to output maps on injected functions and 4## crashing. 5 6REQUIRES: system-linux 7 8RUN: %clang %cflags -no-pie -g %p/Inputs/patch-entries.c -fuse-ld=lld -o %t.exe \ 9RUN: -Wl,-q -I%p/../Inputs 10RUN: llvm-bolt -relocs %t.exe -o %t.out --update-debug-sections --force-patch \ 11RUN: --enable-bat 12 13## Check that patched functions can be disassembled (override FDE from the 14## original function) 15# PREAGG: B X:0 #foo.org.0# 1 0 16RUN: link_fdata %s %t.out %t.preagg PREAGG 17RUN: perf2bolt %t.out -p %t.preagg --pa -o %t.yaml --profile-format=yaml \ 18RUN: -print-disasm -print-only=foo.org.0/1 2>&1 | FileCheck %s 19CHECK-NOT: BOLT-WARNING: sizes differ for function foo.org.0/1 20CHECK: Binary Function "foo.org.0/1(*2)" after disassembly { 21 22## Check the expected eh_frame contents 23RUN: llvm-nm --print-size %t.out > %t.foo 24RUN: llvm-objdump %t.out --dwarf=frames >> %t.foo 25RUN: FileCheck %s --input-file %t.foo --check-prefix=CHECK-FOO 26CHECK-FOO: 0000000000[[#%x,FOO:]] [[#%x,OPTSIZE:]] t foo 27CHECK-FOO: 0000000000[[#%x,ORG:]] [[#%x,ORGSIZE:]] t foo.org.0 28## patched FDE comes first 29CHECK-FOO: FDE {{.*}} pc=00[[#%x,ORG]]...00[[#%x,ORG+ORGSIZE]] 30## original FDE comes second 31CHECK-FOO: FDE {{.*}} pc=00[[#%x,ORG]]...00[[#%x,ORG+OPTSIZE]] 32