aboutsummaryrefslogtreecommitdiff
path: root/test/standalone/stack_iterator/shared_lib.c
blob: c3170f2dc0f5674be45c525ff90e674b018d3031 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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);
}