aboutsummaryrefslogtreecommitdiff
path: root/test/standalone/stack_iterator/shared_lib.c
diff options
context:
space:
mode:
authorkcbanner <kcbanner@gmail.com>2023-07-13 01:14:31 -0400
committerkcbanner <kcbanner@gmail.com>2023-07-20 22:58:16 -0400
commitec96095efd8671ae280df15eaf73f63bf029fbfa (patch)
tree06308ef842ad3f6984f673d607fabebcbed28a7b /test/standalone/stack_iterator/shared_lib.c
parent7d8b4234774200ff071103399613ed444280a8d0 (diff)
downloadzig-ec96095efd8671ae280df15eaf73f63bf029fbfa.tar.gz
zig-ec96095efd8671ae280df15eaf73f63bf029fbfa.zip
compilation: pass omit_frame_pointer through to builtin.zig
Renamed dwarf_unwinding -> stack_iterator to better reflect that it's not just DWARF unwinding. Added a test for unwinding with a frame pointer.
Diffstat (limited to 'test/standalone/stack_iterator/shared_lib.c')
-rw-r--r--test/standalone/stack_iterator/shared_lib.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/standalone/stack_iterator/shared_lib.c b/test/standalone/stack_iterator/shared_lib.c
new file mode 100644
index 0000000000..c3170f2dc0
--- /dev/null
+++ b/test/standalone/stack_iterator/shared_lib.c
@@ -0,0 +1,22 @@
+#include <stdint.h>
+
+#ifndef LIB_API
+#define LIB_API
+#endif
+
+__attribute__((noinline)) void frame1(
+ void** expected,
+ void** unwound,
+ void (*frame2)(void** expected, void** unwound)) {
+ expected[3] = __builtin_extract_return_addr(__builtin_return_address(0));
+ frame2(expected, unwound);
+}
+
+LIB_API void frame0(
+ void** expected,
+ void** unwound,
+ void (*frame2)(void** expected, void** unwound)) {
+ expected[4] = __builtin_extract_return_addr(__builtin_return_address(0));
+ frame1(expected, unwound, frame2);
+}
+