diff options
Diffstat (limited to 'absl/debugging/internal/stacktrace_x86-inl.inc')
-rw-r--r-- | absl/debugging/internal/stacktrace_x86-inl.inc | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/absl/debugging/internal/stacktrace_x86-inl.inc b/absl/debugging/internal/stacktrace_x86-inl.inc index ff0fd31f..bc320ff7 100644 --- a/absl/debugging/internal/stacktrace_x86-inl.inc +++ b/absl/debugging/internal/stacktrace_x86-inl.inc @@ -36,6 +36,8 @@ #include "absl/base/internal/raw_logging.h" +using absl::debugging_internal::AddressIsReadable; + #if defined(__linux__) && defined(__i386__) // Count "push %reg" instructions in VDSO __kernel_vsyscall(), // preceeding "syscall" or "sysenter". @@ -81,7 +83,7 @@ static int CountPushInstructions(const unsigned char *const addr) { // "mov reg,reg" if (addr[i + 1] == 0xE5) { // Found "mov %esp,%ebp". - return 0; + return 0; } ++i; // Skip register encoding byte. } else if (addr[i] == 0x0F && @@ -171,6 +173,7 @@ static void **NextStackFrame(void **old_fp, const void *uc) { static const unsigned char *kernel_rt_sigreturn_address = nullptr; static const unsigned char *kernel_vsyscall_address = nullptr; if (num_push_instructions == -1) { +#ifdef ABSL_HAVE_VDSO_SUPPORT absl::debugging_internal::VDSOSupport vdso; if (vdso.IsPresent()) { absl::debugging_internal::VDSOSupport::SymbolInfo @@ -199,6 +202,9 @@ static void **NextStackFrame(void **old_fp, const void *uc) { } else { num_push_instructions = 0; } +#else // ABSL_HAVE_VDSO_SUPPORT + num_push_instructions = 0; +#endif // ABSL_HAVE_VDSO_SUPPORT } if (num_push_instructions != 0 && kernel_rt_sigreturn_address != nullptr && old_fp[1] == kernel_rt_sigreturn_address) { @@ -222,7 +228,7 @@ static void **NextStackFrame(void **old_fp, const void *uc) { // "double fault" in case we hit the first fault due to e.g. stack // corruption. void *const reg_esp2 = reg_esp[num_push_instructions - 1]; - if (absl::debugging_internal::AddressIsReadable(reg_esp2)) { + if (AddressIsReadable(reg_esp2)) { // Alleged %esp is readable, use it for further unwinding. new_fp = reinterpret_cast<void **>(reg_esp2); } @@ -274,7 +280,7 @@ static void **NextStackFrame(void **old_fp, const void *uc) { // Note: NextStackFrame<false>() is only called while the program // is already on its last leg, so it's ok to be slow here. - if (!absl::debugging_internal::AddressIsReadable(new_fp)) { + if (!AddressIsReadable(new_fp)) { return nullptr; } } @@ -328,13 +334,13 @@ static int UnwindImpl(void **result, int *sizes, int max_depth, int skip_count, } namespace absl { -inline namespace lts_2019_08_08 { +ABSL_NAMESPACE_BEGIN namespace debugging_internal { bool StackTraceWorksForTest() { return true; } } // namespace debugging_internal -} // inline namespace lts_2019_08_08 +ABSL_NAMESPACE_END } // namespace absl #endif // ABSL_DEBUGGING_INTERNAL_STACKTRACE_X86_INL_INC_ |