aboutsummaryrefslogtreecommitdiff
path: root/test/standalone/stack_iterator/shared_lib.c
diff options
context:
space:
mode:
authorJakub Konka <kubkon@jakubkonka.com>2023-07-21 17:37:22 +0200
committerGitHub <noreply@github.com>2023-07-21 17:37:22 +0200
commit61d5b7c957e63239f1ebbdbfb94105d53f2dbaa4 (patch)
treea49da9a773faff32301383f9bffaed99852c26f6 /test/standalone/stack_iterator/shared_lib.c
parentc43ee5bb22298eefc3fae919807f5da8f7be70f1 (diff)
parentb1d86db7b45c57b2a9d48655738bce8d77327438 (diff)
downloadzig-61d5b7c957e63239f1ebbdbfb94105d53f2dbaa4.tar.gz
zig-61d5b7c957e63239f1ebbdbfb94105d53f2dbaa4.zip
Merge pull request #15823 from kcbanner/dwarf_unwind
Add DWARF unwinding, and an external debug info loader for ELF
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);
+}
+