]>
git.saurik.com Git - apple/libpthread.git/blob - tests/main_stack_legacy.c
3 #include <darwintest.h>
4 #include <machine/vmparam.h>
6 T_DECL(main_stack_legacy
, "tests the reported values for a custom main thread stack",
7 T_META_CHECK_LEAKS(NO
))
9 T_EXPECT_LT((uintptr_t)0, pthread_get_stacksize_np(pthread_self()), NULL
);
11 const uintptr_t stackaddr
= (uintptr_t)pthread_get_stackaddr_np(pthread_self());
12 size_t stacksize
= pthread_get_stacksize_np(pthread_self());
13 T_LOG("stack: %zx -> %zx (+%zx)", stackaddr
- stacksize
, stackaddr
, stacksize
);
14 T_EXPECT_LT((uintptr_t)__builtin_frame_address(0), stackaddr
, NULL
);
15 T_EXPECT_GT((uintptr_t)__builtin_frame_address(0), stackaddr
- stacksize
, NULL
);