Skip to content

Commit d8fa2cd

Browse files
committed
[BOLT] Basic exception unwinding test
1 parent 53a3cea commit d8fa2cd

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// REQUIRES: system-linux,bolt-runtime
2+
3+
// RUN: %clangxx --target=aarch64-unknown-linux-gnu \
4+
// RUN: -mbranch-protection=pac-ret -Wl,-q %s -o %t.exe
5+
// RUN: llvm-bolt %t.exe -o %t.bolt.exe --allow-experimental-pacret
6+
// RUN: %t.bolt.exe | FileCheck %s
7+
8+
// CHECK: Exception caught: Exception from bar().
9+
10+
#include <cstdio>
11+
#include <stdexcept>
12+
13+
void bar() { throw std::runtime_error("Exception from bar()."); }
14+
15+
void foo() {
16+
try {
17+
bar();
18+
} catch (const std::exception &e) {
19+
printf("Exception caught: %s\n", e.what());
20+
}
21+
}
22+
23+
int main() {
24+
foo();
25+
return 0;
26+
}

0 commit comments

Comments
 (0)