36 #if !defined(GLOG_OS_WINDOWS)
50 template<
bool STRICT_UNWINDING>
52 void **new_sp =
static_cast<void **
>(*old_sp);
56 if (STRICT_UNWINDING) {
59 if (new_sp <= old_sp)
return NULL;
61 if ((uintptr_t)new_sp - (uintptr_t)old_sp > 100000)
return NULL;
65 if (new_sp == old_sp)
return NULL;
68 && ((uintptr_t)new_sp - (uintptr_t)old_sp > 1000000))
return NULL;
70 if ((uintptr_t)new_sp & (
sizeof(
void *) - 1))
return NULL;
75 if ((uintptr_t)new_sp >= 0xffffe000)
return NULL;
77 #if !defined(GLOG_OS_WINDOWS)
78 if (!STRICT_UNWINDING) {
84 static int page_size = getpagesize();
85 void *new_sp_aligned = (
void *)((uintptr_t)new_sp & ~(page_size - 1));
86 if (msync(new_sp_aligned, page_size, MS_ASYNC) == -1) {
99 #if __GNUC__ * 100 + __GNUC_MINOR__ >= 402
100 #define USE_BUILTIN_FRAME_ADDRESS
104 #ifdef USE_BUILTIN_FRAME_ADDRESS
105 sp =
reinterpret_cast<void**
>(__builtin_frame_address(0));
106 #elif defined(__i386__)
112 sp = (
void **)&result - 2;
113 #elif defined(__x86_64__)
123 __asm__
volatile (
"mov %%rbp, %0" :
"=r" (rbp));
130 while (sp &&
n < max_depth) {
131 if (*(sp+1) == (
void *)0) {
136 if (skip_count > 0) {
139 result[
n++] = *(sp+1);
142 sp = NextStackFrame<true>(sp);
147 _END_GOOGLE_NAMESPACE_