diff options
Diffstat (limited to 'absl/debugging')
36 files changed, 392 insertions, 274 deletions
diff --git a/absl/debugging/BUILD.bazel b/absl/debugging/BUILD.bazel index e1e7fced..a8ebaea4 100644 --- a/absl/debugging/BUILD.bazel +++ b/absl/debugging/BUILD.bazel @@ -149,6 +149,7 @@ cc_library( copts = ABSL_DEFAULT_COPTS, deps = [ "//absl/base", + "//absl/base:core_headers", "//absl/base:dynamic_annotations", ], ) diff --git a/absl/debugging/CMakeLists.txt b/absl/debugging/CMakeLists.txt index 4af2ec8a..f66688ba 100644 --- a/absl/debugging/CMakeLists.txt +++ b/absl/debugging/CMakeLists.txt @@ -14,204 +14,297 @@ # limitations under the License. # -list(APPEND DEBUGGING_PUBLIC_HEADERS - "failure_signal_handler.h" - "leak_check.h" - "stacktrace.h" - "symbolize.h" -) - -# TODO(cohenjon) The below is all kinds of wrong. Make this match what we do in -# Bazel -list(APPEND DEBUGGING_INTERNAL_HEADERS - "internal/address_is_readable.h" - "internal/demangle.h" - "internal/elf_mem_image.h" - "internal/examine_stack.h" - "internal/stacktrace_config.h" - "internal/symbolize.h" - "internal/vdso_support.h" -) - -list(APPEND DEBUGGING_INTERNAL_SRC - "internal/address_is_readable.cc" - "internal/elf_mem_image.cc" - "internal/vdso_support.cc" -) - - -list(APPEND STACKTRACE_SRC - "stacktrace.cc" - ${DEBUGGING_INTERNAL_SRC} - ${DEBUGGING_PUBLIC_HEADERS} - ${DEBUGGING_INTERNAL_HEADERS} +absl_cc_library( + NAME + stacktrace + HDRS + "stacktrace.h" + SRCS + "stacktrace.cc" + COPTS + ${ABSL_DEFAULT_COPTS} + DEPS + absl::debugging_internal + absl::base + absl::core_headers + PUBLIC ) -list(APPEND SYMBOLIZE_SRC - "symbolize.cc" - "symbolize_elf.inc" - "symbolize_unimplemented.inc" - "symbolize_win32.inc" - "internal/demangle.cc" - ${DEBUGGING_PUBLIC_HEADERS} - ${DEBUGGING_INTERNAL_HEADERS} - ${DEBUGGING_INTERNAL_SRC} +absl_cc_library( + NAME + symbolize + HDRS + "symbolize.h" + "internal/symbolize.h" + SRCS + "symbolize.cc" + "symbolize_elf.inc" + "symbolize_unimplemented.inc" + "symbolize_win32.inc" + COPTS + ${ABSL_DEFAULT_COPTS} + DEPS + absl::debugging_internal + absl::demangle_internal + absl::base + absl::core_headers + absl::malloc_internal + PUBLIC ) -list(APPEND FAILURE_SIGNAL_HANDLER_SRC - "failure_signal_handler.cc" - ${DEBUGGING_PUBLIC_HEADERS} +absl_cc_test( + NAME + symbolize_test + SRCS + "symbolize_test.cc" + COPTS + ${ABSL_TEST_COPTS} + DEPS + absl::stack_consumption + absl::symbolize + absl::base + absl::core_headers + absl::memory + gmock ) -list(APPEND EXAMINE_STACK_SRC - "internal/examine_stack.cc" - ${DEBUGGING_PUBLIC_HEADERS} - ${DEBUGGING_INTERNAL_HEADERS} +absl_cc_library( + NAME + examine_stack + HDRS + "internal/examine_stack.h" + SRCS + "internal/examine_stack.cc" + COPTS + ${ABSL_DEFAULT_COPTS} + DEPS + absl::stacktrace + absl::symbolize + absl::base + absl::core_headers ) -absl_library( - TARGET - absl_stacktrace - SOURCES - ${STACKTRACE_SRC} - EXPORT_NAME - stacktrace +absl_cc_library( + NAME + failure_signal_handler + HDRS + "failure_signal_handler.h" + SRCS + "failure_signal_handler.cc" + COPTS + ${ABSL_DEFAULT_COPTS} + DEPS + absl::examine_stack + absl::stacktrace + absl::base + absl::config + absl::core_headers + PUBLIC ) -absl_library( - TARGET - absl_symbolize - SOURCES - ${SYMBOLIZE_SRC} - PUBLIC_LIBRARIES +absl_cc_test( + NAME + failure_signal_handler_test + SRCS + "failure_signal_handler_test.cc" + COPTS + ${ABSL_TEST_COPTS} + DEPS + absl::failure_signal_handler + absl::stacktrace + absl::symbolize absl::base - absl_malloc_internal - EXPORT_NAME - symbolize + absl::strings + Threads::Threads + gmock ) -absl_library( - TARGET - absl_failure_signal_handler - SOURCES - ${FAILURE_SIGNAL_HANDLER_SRC} - PUBLIC_LIBRARIES - absl_base absl::examine_stack absl::stacktrace absl_synchronization - EXPORT_NAME - failure_signal_handler +absl_cc_library( + NAME + debugging_internal + HDRS + "internal/address_is_readable.h" + "internal/elf_mem_image.h" + "internal/stacktrace_aarch64-inl.inc" + "internal/stacktrace_arm-inl.inc" + "internal/stacktrace_config.h" + "internal/stacktrace_generic-inl.inc" + "internal/stacktrace_powerpc-inl.inc" + "internal/stacktrace_unimplemented-inl.inc" + "internal/stacktrace_win32-inl.inc" + "internal/stacktrace_x86-inl.inc" + "internal/vdso_support.h" + SRCS + "internal/address_is_readable.cc" + "internal/elf_mem_image.cc" + "internal/vdso_support.cc" + COPTS + ${ABSL_DEFAULT_COPTS} + DEPS + absl::base + absl::core_headers + absl::dynamic_annotations ) -# Internal-only. Projects external to Abseil should not depend -# directly on this library. -absl_library( - TARGET - absl_examine_stack - SOURCES - ${EXAMINE_STACK_SRC} - EXPORT_NAME - examine_stack +absl_cc_library( + NAME + demangle_internal + HDRS + "internal/demangle.h" + SRCS + "internal/demangle.cc" + COPTS + ${ABSL_DEFAULT_COPTS} + DEPS + absl::base + absl::core_headers + PUBLIC ) -list(APPEND LEAK_CHECK_SRC - "leak_check.cc" +absl_cc_test( + NAME + demangle_test + SRCS + "internal/demangle_test.cc" + COPTS + ${ABSL_TEST_COPTS} + DEPS + absl::demangle_internal + absl::stack_consumption + absl::base + absl::core_headers + absl::memory + gmock_main ) - -# leak_check library -absl_library( - TARGET - absl_leak_check - SOURCES - ${LEAK_CHECK_SRC} - PUBLIC_LIBRARIES - absl_base - EXPORT_NAME +absl_cc_library( + NAME leak_check + HDRS + "$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:leak_check.h>" + SRCS + "$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:leak_check.cc>" + COPTS + ${ABSL_DEFAULT_COPTS} + DEPS + absl::core_headers + PUBLIC ) - -# component target -absl_header_library( - TARGET - absl_debugging - PUBLIC_LIBRARIES - absl_stacktrace absl_leak_check - EXPORT_NAME - debugging +absl_cc_library( + NAME + leak_check_disable + SRCS + "leak_check_disable.cc" + PUBLIC ) -# -## TESTS -# +# TODO(cohenjon) Move into the copts code. +if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + set(ABSL_LSAN_LINKOPTS "-fsanitize=leak") +endif() -list(APPEND STACK_CONSUMPTION_SRC - "internal/stack_consumption.cc" - "internal/stack_consumption.h" +absl_cc_library( + NAME + leak_check_api_enabled_for_testing + HDRS + "leak_check.h" + SRCS + "leak_check.cc" + COPTS + $<$<BOOL:${ABSL_USING_CLANG}>:-DLEAK_SANITIZER> + TESTONLY ) -absl_library( - TARGET - absl_stack_consumption - SOURCES - ${STACK_CONSUMPTION_SRC} +absl_cc_library( + NAME + leak_check_api_disabled_for_testing + HDRS + "leak_check.h" + SRCS + "leak_check.cc" + COPTS + "-ULEAK_SANITIZER" + TESTONLY ) -absl_test( - TARGET - absl_stack_consumption_test - SOURCES - "internal/stack_consumption_test.cc" - PUBLIC_LIBRARIES - absl_stack_consumption +absl_cc_test( + NAME + leak_check_test + SRCS + "leak_check_test.cc" + COPTS + "$<$<CXX_COMPILER_ID:Clang>:-DABSL_EXPECT_LEAK_SANITIZER>" + LINKOPTS + "${ABSL_LSAN_LINKOPTS}" + DEPS + absl::leak_check_api_enabled_for_testing absl::base + gmock_main ) -list(APPEND DEMANGLE_TEST_SRC "internal/demangle_test.cc") - -absl_test( - TARGET - demangle_test - SOURCES - ${DEMANGLE_TEST_SRC} - PUBLIC_LIBRARIES - absl_symbolize absl_stack_consumption +absl_cc_test( + NAME + leak_check_no_lsan_test + SRCS + "leak_check_test.cc" + COPTS + "-UABSL_EXPECT_LEAK_SANITIZER" + DEPS + absl::leak_check_api_disabled_for_testing + absl::base + gmock_main ) -list(APPEND SYMBOLIZE_TEST_SRC "symbolize_test.cc") - -absl_test( - TARGET - symbolize_test - SOURCES - ${SYMBOLIZE_TEST_SRC} - PUBLIC_LIBRARIES - absl::base absl::memory absl_symbolize absl_stack_consumption +absl_cc_test( + NAME + disabled_leak_check_test + SRCS + "leak_check_fail_test.cc" + LINKOPTS + "${ABSL_LSAN_LINKOPTS}" + DEPS + absl::leak_check_api_enabled_for_testing + absl::leak_check_disable + absl::base + gmock_main ) -list(APPEND FAILURE_SIGNAL_HANDLER_TEST_SRC "failure_signal_handler_test.cc") - -absl_test( - TARGET - failure_signal_handler_test - SOURCES - ${FAILURE_SIGNAL_HANDLER_TEST_SRC} - PUBLIC_LIBRARIES - absl_examine_stack - absl_failure_signal_handler - absl_stacktrace - absl_symbolize +absl_cc_library( + NAME + stack_consumption + HDRS + "internal/stack_consumption.h" + SRCS + "internal/stack_consumption.cc" + COPTS + ${ABSL_DEFAULT_COPTS} + DEPS absl::base - absl::strings + absl::core_headers + TESTONLY ) -# test leak_check_test -list(APPEND LEAK_CHECK_TEST_SRC "leak_check_test.cc") +absl_cc_test( + NAME + stack_consumption_test + SRCS + "internal/stack_consumption_test.cc" + COPTS + ${ABSL_TEST_COPTS} + DEPS + absl::stack_consumption + absl::base + absl::core_headers + gmock_main +) -absl_test( - TARGET - leak_check_test - SOURCES - ${LEAK_CHECK_TEST_SRC} - PUBLIC_LIBRARIES - absl_leak_check +# component target +absl_cc_library( + NAME + debugging + DEPS + absl::stacktrace + absl::leak_check + PUBLIC ) diff --git a/absl/debugging/failure_signal_handler.cc b/absl/debugging/failure_signal_handler.cc index b2035148..a3a36f64 100644 --- a/absl/debugging/failure_signal_handler.cc +++ b/absl/debugging/failure_signal_handler.cc @@ -47,7 +47,7 @@ #endif namespace absl { -inline namespace lts_2018_06_20 { +inline namespace lts_2018_12_18 { ABSL_CONST_INIT static FailureSignalHandlerOptions fsh_options; @@ -120,7 +120,11 @@ const char* FailureSignalToString(int signo) { #ifndef _WIN32 static bool SetupAlternateStackOnce() { +#if defined(__wasm__) || defined (__asjms__) const size_t page_mask = getpagesize() - 1; +#else + const size_t page_mask = sysconf(_SC_PAGESIZE) - 1; +#endif size_t stack_size = (std::max(SIGSTKSZ, 65536) + page_mask) & ~page_mask; #if defined(ADDRESS_SANITIZER) || defined(MEMORY_SANITIZER) || \ defined(THREAD_SANITIZER) @@ -253,7 +257,7 @@ ABSL_ATTRIBUTE_NOINLINE static void WriteStackTrace( depth, min_dropped_frames, symbolize_stacktrace, writerfn, writerfn_arg); } -// Called by FailureSignalHandler() to write the failure info. It is +// Called by AbslFailureSignalHandler() to write the failure info. It is // called once with writerfn set to WriteToStderr() and then possibly // with writerfn set to the user provided function. static void WriteFailureInfo(int signo, void* ucontext, @@ -279,9 +283,9 @@ static void PortableSleepForSeconds(int seconds) { } #ifdef ABSL_HAVE_ALARM -// FailureSignalHandler() installs this as a signal handler for +// AbslFailureSignalHandler() installs this as a signal handler for // SIGALRM, then sets an alarm to be delivered to the program after a -// set amount of time. If FailureSignalHandler() hangs for more than +// set amount of time. If AbslFailureSignalHandler() hangs for more than // the alarm timeout, ImmediateAbortSignalHandler() will abort the // program. static void ImmediateAbortSignalHandler(int) { @@ -295,11 +299,10 @@ using GetTidType = decltype(absl::base_internal::GetTID()); ABSL_CONST_INIT static std::atomic<GetTidType> failed_tid(0); #ifndef ABSL_HAVE_SIGACTION -static void FailureSignalHandler(int signo) { +static void AbslFailureSignalHandler(int signo) { void* ucontext = nullptr; #else -static void FailureSignalHandler(int signo, siginfo_t*, - void* ucontext) { +static void AbslFailureSignalHandler(int signo, siginfo_t*, void* ucontext) { #endif const GetTidType this_tid = absl::base_internal::GetTID(); @@ -309,10 +312,10 @@ static void FailureSignalHandler(int signo, siginfo_t*, std::memory_order_acq_rel, std::memory_order_relaxed)) { ABSL_RAW_LOG( ERROR, - "Signal %d raised at PC=%p while already in FailureSignalHandler()", + "Signal %d raised at PC=%p while already in AbslFailureSignalHandler()", signo, absl::debugging_internal::GetProgramCounter(ucontext)); if (this_tid != previous_failed_tid) { - // Another thread is already in FailureSignalHandler(), so wait + // Another thread is already in AbslFailureSignalHandler(), so wait // a bit for it to finish. If the other thread doesn't kill us, // we do so after sleeping. PortableSleepForSeconds(3); @@ -350,9 +353,9 @@ static void FailureSignalHandler(int signo, siginfo_t*, void InstallFailureSignalHandler(const FailureSignalHandlerOptions& options) { fsh_options = options; for (auto& it : failure_signal_data) { - InstallOneFailureHandler(&it, FailureSignalHandler); + InstallOneFailureHandler(&it, AbslFailureSignalHandler); } } -} // inline namespace lts_2018_06_20 +} // inline namespace lts_2018_12_18 } // namespace absl diff --git a/absl/debugging/failure_signal_handler.h b/absl/debugging/failure_signal_handler.h index fb4de102..0aeb287f 100644 --- a/absl/debugging/failure_signal_handler.h +++ b/absl/debugging/failure_signal_handler.h @@ -45,7 +45,7 @@ #define ABSL_DEBUGGING_FAILURE_SIGNAL_HANDLER_H_ namespace absl { -inline namespace lts_2018_06_20 { +inline namespace lts_2018_12_18 { // FailureSignalHandlerOptions // @@ -113,7 +113,7 @@ namespace debugging_internal { const char* FailureSignalToString(int signo); } // namespace debugging_internal -} // inline namespace lts_2018_06_20 +} // inline namespace lts_2018_12_18 } // namespace absl #endif // ABSL_DEBUGGING_FAILURE_SIGNAL_HANDLER_H_ diff --git a/absl/debugging/internal/address_is_readable.cc b/absl/debugging/internal/address_is_readable.cc index 6282bd6a..2a83f4c8 100644 --- a/absl/debugging/internal/address_is_readable.cc +++ b/absl/debugging/internal/address_is_readable.cc @@ -20,14 +20,14 @@ #if !defined(__linux__) || defined(__ANDROID__) namespace absl { -inline namespace lts_2018_06_20 { +inline namespace lts_2018_12_18 { namespace debugging_internal { // On platforms other than Linux, just return true. bool AddressIsReadable(const void* /* addr */) { return true; } } // namespace debugging_internal -} // inline namespace lts_2018_06_20 +} // inline namespace lts_2018_12_18 } // namespace absl #else @@ -42,7 +42,7 @@ bool AddressIsReadable(const void* /* addr */) { return true; } #include "absl/base/internal/raw_logging.h" namespace absl { -inline namespace lts_2018_06_20 { +inline namespace lts_2018_12_18 { namespace debugging_internal { // Pack a pid and two file descriptors into a 64-bit word, @@ -131,7 +131,7 @@ bool AddressIsReadable(const void *addr) { } } // namespace debugging_internal -} // inline namespace lts_2018_06_20 +} // inline namespace lts_2018_12_18 } // namespace absl #endif diff --git a/absl/debugging/internal/address_is_readable.h b/absl/debugging/internal/address_is_readable.h index 7e58ce55..3942f44b 100644 --- a/absl/debugging/internal/address_is_readable.h +++ b/absl/debugging/internal/address_is_readable.h @@ -17,7 +17,7 @@ #define ABSL_DEBUGGING_INTERNAL_ADDRESS_IS_READABLE_H_ namespace absl { -inline namespace lts_2018_06_20 { +inline namespace lts_2018_12_18 { namespace debugging_internal { // Return whether the byte at *addr is readable, without faulting. @@ -25,7 +25,7 @@ namespace debugging_internal { bool AddressIsReadable(const void *addr); } // namespace debugging_internal -} // inline namespace lts_2018_06_20 +} // inline namespace lts_2018_12_18 } // namespace absl #endif // ABSL_DEBUGGING_INTERNAL_ADDRESS_IS_READABLE_H_ diff --git a/absl/debugging/internal/demangle.cc b/absl/debugging/internal/demangle.cc index 15b7c7c3..57b9393f 100644 --- a/absl/debugging/internal/demangle.cc +++ b/absl/debugging/internal/demangle.cc @@ -24,7 +24,7 @@ #include <limits> namespace absl { -inline namespace lts_2018_06_20 { +inline namespace lts_2018_12_18 { namespace debugging_internal { typedef struct { @@ -341,7 +341,7 @@ static bool ZeroOrMore(ParseFunc parse_func, State *state) { } // Append "str" at "out_cur_idx". If there is an overflow, out_cur_idx is -// set to out_end_idx+1. The output std::string is ensured to +// set to out_end_idx+1. The output string is ensured to // always terminate with '\0' as long as there is no overflow. static void Append(State *state, const char *const str, const int length) { for (int i = 0; i < length; ++i) { @@ -841,7 +841,7 @@ static bool ParseNumber(State *state, int *number_out) { } // Floating-point literals are encoded using a fixed-length lowercase -// hexadecimal std::string. +// hexadecimal string. static bool ParseFloatNumber(State *state) { ComplexityGuard guard(state); if (guard.IsTooComplex()) return false; @@ -1637,6 +1637,15 @@ static bool ParseExpression(State *state) { } state->parse_state = copy; + // Pointer-to-member access expressions. This parses the same as a binary + // operator, but it's implemented separately because "ds" shouldn't be + // accepted in other contexts that parse an operator name. + if (ParseTwoCharToken(state, "ds") && ParseExpression(state) && + ParseExpression(state)) { + return true; + } + state->parse_state = copy; + // Parameter pack expansion if (ParseTwoCharToken(state, "sp") && ParseExpression(state)) { return true; @@ -1860,5 +1869,5 @@ bool Demangle(const char *mangled, char *out, int out_size) { } } // namespace debugging_internal -} // inline namespace lts_2018_06_20 +} // inline namespace lts_2018_12_18 } // namespace absl diff --git a/absl/debugging/internal/demangle.h b/absl/debugging/internal/demangle.h index 7faa5a2f..1f8722c7 100644 --- a/absl/debugging/internal/demangle.h +++ b/absl/debugging/internal/demangle.h @@ -54,7 +54,7 @@ #define ABSL_DEBUGGING_INTERNAL_DEMANGLE_H_ namespace absl { -inline namespace lts_2018_06_20 { +inline namespace lts_2018_12_18 { namespace debugging_internal { // Demangle `mangled`. On success, return true and write the @@ -63,7 +63,7 @@ namespace debugging_internal { bool Demangle(const char *mangled, char *out, int out_size); } // namespace debugging_internal -} // inline namespace lts_2018_06_20 +} // inline namespace lts_2018_12_18 } // namespace absl #endif // ABSL_DEBUGGING_INTERNAL_DEMANGLE_H_ diff --git a/absl/debugging/internal/demangle_test.cc b/absl/debugging/internal/demangle_test.cc index 5ff64a37..fa89fb80 100644 --- a/absl/debugging/internal/demangle_test.cc +++ b/absl/debugging/internal/demangle_test.cc @@ -23,7 +23,7 @@ #include "absl/memory/memory.h" namespace absl { -inline namespace lts_2018_06_20 { +inline namespace lts_2018_12_18 { namespace debugging_internal { namespace { @@ -189,5 +189,5 @@ TEST(DemangleRegression, DeeplyNestedArrayType) { } // namespace } // namespace debugging_internal -} // inline namespace lts_2018_06_20 +} // inline namespace lts_2018_12_18 } // namespace absl diff --git a/absl/debugging/internal/elf_mem_image.cc b/absl/debugging/internal/elf_mem_image.cc index a2bea919..e7e35e9c 100644 --- a/absl/debugging/internal/elf_mem_image.cc +++ b/absl/debugging/internal/elf_mem_image.cc @@ -38,7 +38,7 @@ #define VERSYM_VERSION 0x7fff namespace absl { -inline namespace lts_2018_06_20 { +inline namespace lts_2018_12_18 { namespace debugging_internal { namespace { @@ -376,7 +376,7 @@ void ElfMemImage::SymbolIterator::Update(int increment) { } } // namespace debugging_internal -} // inline namespace lts_2018_06_20 +} // inline namespace lts_2018_12_18 } // namespace absl #endif // ABSL_HAVE_ELF_MEM_IMAGE diff --git a/absl/debugging/internal/elf_mem_image.h b/absl/debugging/internal/elf_mem_image.h index ea4f5f0c..0adb5f5d 100644 --- a/absl/debugging/internal/elf_mem_image.h +++ b/absl/debugging/internal/elf_mem_image.h @@ -39,7 +39,7 @@ #include <link.h> // for ElfW namespace absl { -inline namespace lts_2018_06_20 { +inline namespace lts_2018_12_18 { namespace debugging_internal { // An in-memory ELF image (may not exist on disk). @@ -124,7 +124,7 @@ class ElfMemImage { }; } // namespace debugging_internal -} // inline namespace lts_2018_06_20 +} // inline namespace lts_2018_12_18 } // namespace absl #endif // ABSL_HAVE_ELF_MEM_IMAGE diff --git a/absl/debugging/internal/examine_stack.cc b/absl/debugging/internal/examine_stack.cc index 1a2b7a42..4764355a 100644 --- a/absl/debugging/internal/examine_stack.cc +++ b/absl/debugging/internal/examine_stack.cc @@ -30,7 +30,7 @@ #include "absl/debugging/symbolize.h" namespace absl { -inline namespace lts_2018_06_20 { +inline namespace lts_2018_12_18 { namespace debugging_internal { // Returns the program counter from signal context, nullptr if @@ -53,6 +53,10 @@ void* GetProgramCounter(void* vuc) { return reinterpret_cast<void*>(context->uc_mcontext.gp_regs[32]); #elif defined(__powerpc__) return reinterpret_cast<void*>(context->uc_mcontext.regs->nip); +#elif defined(__s390__) && !defined(__s390x__) + return reinterpret_cast<void*>(context->uc_mcontext.psw.addr & 0x7fffffff); +#elif defined(__s390__) && defined(__s390x__) + return reinterpret_cast<void*>(context->uc_mcontext.psw.addr); #elif defined(__x86_64__) if (16 < ABSL_ARRAYSIZE(context->uc_mcontext.gregs)) return reinterpret_cast<void*>(context->uc_mcontext.gregs[16]); @@ -147,5 +151,5 @@ void DumpPCAndFrameSizesAndStackTrace( } } // namespace debugging_internal -} // inline namespace lts_2018_06_20 +} // inline namespace lts_2018_12_18 } // namespace absl diff --git a/absl/debugging/internal/examine_stack.h b/absl/debugging/internal/examine_stack.h index a51a8b35..474fdd5e 100644 --- a/absl/debugging/internal/examine_stack.h +++ b/absl/debugging/internal/examine_stack.h @@ -18,7 +18,7 @@ #define ABSL_DEBUGGING_INTERNAL_EXAMINE_STACK_H_ namespace absl { -inline namespace lts_2018_06_20 { +inline namespace lts_2018_12_18 { namespace debugging_internal { // Returns the program counter from signal context, or nullptr if @@ -34,7 +34,7 @@ void DumpPCAndFrameSizesAndStackTrace( void (*writerfn)(const char*, void*), void* writerfn_arg); } // namespace debugging_internal -} // inline namespace lts_2018_06_20 +} // inline namespace lts_2018_12_18 } // namespace absl #endif // ABSL_DEBUGGING_INTERNAL_EXAMINE_STACK_H_ diff --git a/absl/debugging/internal/stack_consumption.cc b/absl/debugging/internal/stack_consumption.cc index 8724007d..94b43e1d 100644 --- a/absl/debugging/internal/stack_consumption.cc +++ b/absl/debugging/internal/stack_consumption.cc @@ -27,7 +27,7 @@ #include "absl/base/internal/raw_logging.h" namespace absl { -inline namespace lts_2018_06_20 { +inline namespace lts_2018_12_18 { namespace debugging_internal { namespace { @@ -168,7 +168,7 @@ int GetSignalHandlerStackConsumption(void (*signal_handler)(int)) { } } // namespace debugging_internal -} // inline namespace lts_2018_06_20 +} // inline namespace lts_2018_12_18 } // namespace absl #endif // ABSL_INTERNAL_HAVE_DEBUGGING_STACK_CONSUMPTION diff --git a/absl/debugging/internal/stack_consumption.h b/absl/debugging/internal/stack_consumption.h index 584a4aa9..2defdf0d 100644 --- a/absl/debugging/internal/stack_consumption.h +++ b/absl/debugging/internal/stack_consumption.h @@ -27,7 +27,7 @@ #define ABSL_INTERNAL_HAVE_DEBUGGING_STACK_CONSUMPTION 1 namespace absl { -inline namespace lts_2018_06_20 { +inline namespace lts_2018_12_18 { namespace debugging_internal { // Returns the stack consumption in bytes for the code exercised by @@ -39,7 +39,7 @@ namespace debugging_internal { int GetSignalHandlerStackConsumption(void (*signal_handler)(int)); } // namespace debugging_internal -} // inline namespace lts_2018_06_20 +} // inline namespace lts_2018_12_18 } // namespace absl #endif // ABSL_INTERNAL_HAVE_DEBUGGING_STACK_CONSUMPTION diff --git a/absl/debugging/internal/stack_consumption_test.cc b/absl/debugging/internal/stack_consumption_test.cc index 4f1351b3..022e508a 100644 --- a/absl/debugging/internal/stack_consumption_test.cc +++ b/absl/debugging/internal/stack_consumption_test.cc @@ -23,7 +23,7 @@ #include "absl/base/internal/raw_logging.h" namespace absl { -inline namespace lts_2018_06_20 { +inline namespace lts_2018_12_18 { namespace debugging_internal { namespace { @@ -44,7 +44,7 @@ TEST(SignalHandlerStackConsumptionTest, MeasuresStackConsumption) { } // namespace } // namespace debugging_internal -} // inline namespace lts_2018_06_20 +} // inline namespace lts_2018_12_18 } // namespace absl #endif // ABSL_INTERNAL_HAVE_DEBUGGING_STACK_CONSUMPTION diff --git a/absl/debugging/internal/stacktrace_aarch64-inl.inc b/absl/debugging/internal/stacktrace_aarch64-inl.inc index 0e3fda57..2ed7ae1f 100644 --- a/absl/debugging/internal/stacktrace_aarch64-inl.inc +++ b/absl/debugging/internal/stacktrace_aarch64-inl.inc @@ -180,13 +180,13 @@ static int UnwindImpl(void** result, int* sizes, int max_depth, int skip_count, } namespace absl { -inline namespace lts_2018_06_20 { +inline namespace lts_2018_12_18 { namespace debugging_internal { bool StackTraceWorksForTest() { return true; } } // namespace debugging_internal -} // inline namespace lts_2018_06_20 +} // inline namespace lts_2018_12_18 } // namespace absl #endif // ABSL_DEBUGGING_INTERNAL_STACKTRACE_AARCH64_INL_H_ diff --git a/absl/debugging/internal/stacktrace_arm-inl.inc b/absl/debugging/internal/stacktrace_arm-inl.inc index ef76782c..eb8ca77c 100644 --- a/absl/debugging/internal/stacktrace_arm-inl.inc +++ b/absl/debugging/internal/stacktrace_arm-inl.inc @@ -113,13 +113,13 @@ static int UnwindImpl(void** result, int* sizes, int max_depth, int skip_count, } namespace absl { -inline namespace lts_2018_06_20 { +inline namespace lts_2018_12_18 { namespace debugging_internal { bool StackTraceWorksForTest() { return false; } } // namespace debugging_internal -} // inline namespace lts_2018_06_20 +} // inline namespace lts_2018_12_18 } // namespace absl #endif // ABSL_DEBUGGING_INTERNAL_STACKTRACE_ARM_INL_H_ diff --git a/absl/debugging/internal/stacktrace_config.h b/absl/debugging/internal/stacktrace_config.h index 48adfccc..578e4968 100644 --- a/absl/debugging/internal/stacktrace_config.h +++ b/absl/debugging/internal/stacktrace_config.h @@ -21,26 +21,16 @@ #ifndef ABSL_DEBUGGING_INTERNAL_STACKTRACE_CONFIG_H_ #define ABSL_DEBUGGING_INTERNAL_STACKTRACE_CONFIG_H_ -// First, test platforms which only support a stub. -#if ABSL_STACKTRACE_INL_HEADER +#if defined(ABSL_STACKTRACE_INL_HEADER) #error ABSL_STACKTRACE_INL_HEADER cannot be directly set -#elif defined(__native_client__) || defined(__APPLE__) || \ - defined(__FreeBSD__) || defined(__ANDROID__) || defined(__myriad2__) || \ - defined(__asmjs__) || defined(__wasm__) || defined(__Fuchsia__) -#define ABSL_STACKTRACE_INL_HEADER \ - "absl/debugging/internal/stacktrace_unimplemented-inl.inc" -// Next, test for Mips and Windows. -// TODO(marmstrong): Mips case, remove the check for ABSL_STACKTRACE_INL_HEADER -#elif defined(__mips__) && !defined(ABSL_STACKTRACE_INL_HEADER) -#define ABSL_STACKTRACE_INL_HEADER \ - "absl/debugging/internal/stacktrace_unimplemented-inl.inc" -#elif defined(_WIN32) // windows +#elif defined(_WIN32) #define ABSL_STACKTRACE_INL_HEADER \ "absl/debugging/internal/stacktrace_win32-inl.inc" -// Finally, test NO_FRAME_POINTER. -#elif !defined(NO_FRAME_POINTER) +#elif defined(__linux__) && !defined(__ANDROID__) + +#if !defined(NO_FRAME_POINTER) # if defined(__i386__) || defined(__x86_64__) #define ABSL_STACKTRACE_INL_HEADER \ "absl/debugging/internal/stacktrace_x86-inl.inc" @@ -51,24 +41,30 @@ #define ABSL_STACKTRACE_INL_HEADER \ "absl/debugging/internal/stacktrace_aarch64-inl.inc" # elif defined(__arm__) +// Note: When using glibc this may require -funwind-tables to function properly. #define ABSL_STACKTRACE_INL_HEADER \ - "absl/debugging/internal/stacktrace_arm-inl.inc" + "absl/debugging/internal/stacktrace_generic-inl.inc" +# else +#define ABSL_STACKTRACE_INL_HEADER \ + "absl/debugging/internal/stacktrace_unimplemented-inl.inc" # endif #else // defined(NO_FRAME_POINTER) # if defined(__i386__) || defined(__x86_64__) || defined(__aarch64__) #define ABSL_STACKTRACE_INL_HEADER \ - "absl/debugging/internal/stacktrace_unimplemented-inl.inc" + "absl/debugging/internal/stacktrace_generic-inl.inc" # elif defined(__ppc__) || defined(__PPC__) -// Use glibc's backtrace. #define ABSL_STACKTRACE_INL_HEADER \ "absl/debugging/internal/stacktrace_generic-inl.inc" -# elif defined(__arm__) -# error stacktrace without frame pointer is not supported on ARM +# else +#define ABSL_STACKTRACE_INL_HEADER \ + "absl/debugging/internal/stacktrace_unimplemented-inl.inc" # endif #endif // NO_FRAME_POINTER -#if !defined(ABSL_STACKTRACE_INL_HEADER) -#error Not supported yet +#else +#define ABSL_STACKTRACE_INL_HEADER \ + "absl/debugging/internal/stacktrace_unimplemented-inl.inc" + #endif #endif // ABSL_DEBUGGING_INTERNAL_STACKTRACE_CONFIG_H_ diff --git a/absl/debugging/internal/stacktrace_generic-inl.inc b/absl/debugging/internal/stacktrace_generic-inl.inc index 5d7492a4..823942af 100644 --- a/absl/debugging/internal/stacktrace_generic-inl.inc +++ b/absl/debugging/internal/stacktrace_generic-inl.inc @@ -19,6 +19,7 @@ template <bool IS_STACK_FRAMES, bool IS_WITH_CONTEXT> static int UnwindImpl(void** result, int* sizes, int max_depth, int skip_count, const void *ucp, int *min_dropped_frames) { + static_cast<void>(ucp); // Unused. static const int kStackLength = 64; void * stack[kStackLength]; int size; @@ -49,13 +50,13 @@ static int UnwindImpl(void** result, int* sizes, int max_depth, int skip_count, } namespace absl { -inline namespace lts_2018_06_20 { +inline namespace lts_2018_12_18 { namespace debugging_internal { bool StackTraceWorksForTest() { return true; } } // namespace debugging_internal -} // inline namespace lts_2018_06_20 +} // inline namespace lts_2018_12_18 } // namespace absl #endif // ABSL_DEBUGGING_INTERNAL_STACKTRACE_GENERIC_INL_H_ diff --git a/absl/debugging/internal/stacktrace_powerpc-inl.inc b/absl/debugging/internal/stacktrace_powerpc-inl.inc index 86ac8534..aff2d516 100644 --- a/absl/debugging/internal/stacktrace_powerpc-inl.inc +++ b/absl/debugging/internal/stacktrace_powerpc-inl.inc @@ -31,6 +31,8 @@ #include <cstdint> #include <cstdio> +#include "absl/base/attributes.h" +#include "absl/base/optimization.h" #include "absl/base/port.h" #include "absl/debugging/stacktrace.h" #include "absl/debugging/internal/address_is_readable.h" @@ -150,8 +152,9 @@ static void **NextStackFrame(void **old_sp, const void *uc) { } // This ensures that absl::GetStackTrace sets up the Link Register properly. -void StacktracePowerPCDummyFunction() __attribute__((noinline)); -void StacktracePowerPCDummyFunction() { __asm__ volatile(""); } +ABSL_ATTRIBUTE_NOINLINE static void AbslStacktracePowerPCDummyFunction() { + ABSL_BLOCK_TAIL_CALL_OPTIMIZATION(); +} template <bool IS_STACK_FRAMES, bool IS_WITH_CONTEXT> ABSL_ATTRIBUTE_NO_SANITIZE_ADDRESS // May read random elements from stack. @@ -176,7 +179,7 @@ static int UnwindImpl(void** result, int* sizes, int max_depth, int skip_count, // want here. While the compiler will always(?) set up LR for // subroutine calls, it may not for leaf functions (such as this one). // This routine forces the compiler (at least gcc) to push it anyway. - StacktracePowerPCDummyFunction(); + AbslStacktracePowerPCDummyFunction(); // The LR save area is used by the callee, so the top entry is bogus. skip_count++; @@ -233,13 +236,13 @@ static int UnwindImpl(void** result, int* sizes, int max_depth, int skip_count, } namespace absl { -inline namespace lts_2018_06_20 { +inline namespace lts_2018_12_18 { namespace debugging_internal { bool StackTraceWorksForTest() { return true; } } // namespace debugging_internal -} // inline namespace lts_2018_06_20 +} // inline namespace lts_2018_12_18 } // namespace absl #endif // ABSL_DEBUGGING_INTERNAL_STACKTRACE_POWERPC_INL_H_ diff --git a/absl/debugging/internal/stacktrace_unimplemented-inl.inc b/absl/debugging/internal/stacktrace_unimplemented-inl.inc index 8c3ed4d7..65345efc 100644 --- a/absl/debugging/internal/stacktrace_unimplemented-inl.inc +++ b/absl/debugging/internal/stacktrace_unimplemented-inl.inc @@ -12,13 +12,13 @@ static int UnwindImpl(void** /* result */, int* /* sizes */, } namespace absl { -inline namespace lts_2018_06_20 { +inline namespace lts_2018_12_18 { namespace debugging_internal { bool StackTraceWorksForTest() { return false; } } // namespace debugging_internal -} // inline namespace lts_2018_06_20 +} // inline namespace lts_2018_12_18 } // namespace absl #endif // ABSL_DEBUGGING_INTERNAL_STACKTRACE_UNIMPLEMENTED_INL_H_ diff --git a/absl/debugging/internal/stacktrace_win32-inl.inc b/absl/debugging/internal/stacktrace_win32-inl.inc index ceca299d..59e72785 100644 --- a/absl/debugging/internal/stacktrace_win32-inl.inc +++ b/absl/debugging/internal/stacktrace_win32-inl.inc @@ -73,13 +73,13 @@ static int UnwindImpl(void** result, int* sizes, int max_depth, int skip_count, } namespace absl { -inline namespace lts_2018_06_20 { +inline namespace lts_2018_12_18 { namespace debugging_internal { bool StackTraceWorksForTest() { return false; } } // namespace debugging_internal -} // inline namespace lts_2018_06_20 +} // inline namespace lts_2018_12_18 } // namespace absl #endif // ABSL_DEBUGGING_INTERNAL_STACKTRACE_WIN32_INL_H_ diff --git a/absl/debugging/internal/stacktrace_x86-inl.inc b/absl/debugging/internal/stacktrace_x86-inl.inc index 13afce7b..d29cd84b 100644 --- a/absl/debugging/internal/stacktrace_x86-inl.inc +++ b/absl/debugging/internal/stacktrace_x86-inl.inc @@ -327,13 +327,13 @@ static int UnwindImpl(void **result, int *sizes, int max_depth, int skip_count, } namespace absl { -inline namespace lts_2018_06_20 { +inline namespace lts_2018_12_18 { namespace debugging_internal { bool StackTraceWorksForTest() { return true; } } // namespace debugging_internal -} // inline namespace lts_2018_06_20 +} // inline namespace lts_2018_12_18 } // namespace absl #endif // ABSL_DEBUGGING_INTERNAL_STACKTRACE_X86_INL_INC_ diff --git a/absl/debugging/internal/symbolize.h b/absl/debugging/internal/symbolize.h index fd10a637..2791105e 100644 --- a/absl/debugging/internal/symbolize.h +++ b/absl/debugging/internal/symbolize.h @@ -34,7 +34,7 @@ #include <string> namespace absl { -inline namespace lts_2018_06_20 { +inline namespace lts_2018_12_18 { namespace debugging_internal { // Iterates over all sections, invoking callback on each with the section name @@ -53,13 +53,13 @@ bool GetSectionHeaderByName(int fd, const char *name, size_t name_len, ElfW(Shdr) *out); } // namespace debugging_internal -} // inline namespace lts_2018_06_20 +} // inline namespace lts_2018_12_18 } // namespace absl #endif // ABSL_INTERNAL_HAVE_ELF_SYMBOLIZE namespace absl { -inline namespace lts_2018_06_20 { +inline namespace lts_2018_12_18 { namespace debugging_internal { struct SymbolDecoratorArgs { @@ -121,7 +121,7 @@ bool GetFileMappingHint(const void** start, const char** filename); } // namespace debugging_internal -} // inline namespace lts_2018_06_20 +} // inline namespace lts_2018_12_18 } // namespace absl #endif // ABSL_DEBUGGING_INTERNAL_SYMBOLIZE_H_ diff --git a/absl/debugging/internal/vdso_support.cc b/absl/debugging/internal/vdso_support.cc index fd1fb05e..85b52bc8 100644 --- a/absl/debugging/internal/vdso_support.cc +++ b/absl/debugging/internal/vdso_support.cc @@ -38,7 +38,7 @@ #endif namespace absl { -inline namespace lts_2018_06_20 { +inline namespace lts_2018_12_18 { namespace debugging_internal { ABSL_CONST_INIT @@ -188,7 +188,7 @@ static class VDSOInitHelper { } vdso_init_helper; } // namespace debugging_internal -} // inline namespace lts_2018_06_20 +} // inline namespace lts_2018_12_18 } // namespace absl #endif // ABSL_HAVE_VDSO_SUPPORT diff --git a/absl/debugging/internal/vdso_support.h b/absl/debugging/internal/vdso_support.h index 7fdd7527..035e5964 100644 --- a/absl/debugging/internal/vdso_support.h +++ b/absl/debugging/internal/vdso_support.h @@ -53,7 +53,7 @@ #endif namespace absl { -inline namespace lts_2018_06_20 { +inline namespace lts_2018_12_18 { namespace debugging_internal { // NOTE: this class may be used from within tcmalloc, and can not @@ -150,7 +150,7 @@ class VDSOSupport { int GetCPU(); } // namespace debugging_internal -} // inline namespace lts_2018_06_20 +} // inline namespace lts_2018_12_18 } // namespace absl #endif // ABSL_HAVE_ELF_MEM_IMAGE diff --git a/absl/debugging/leak_check.cc b/absl/debugging/leak_check.cc index 7eaaf495..cf65280a 100644 --- a/absl/debugging/leak_check.cc +++ b/absl/debugging/leak_check.cc @@ -20,14 +20,14 @@ #ifndef LEAK_SANITIZER namespace absl { -inline namespace lts_2018_06_20 { +inline namespace lts_2018_12_18 { bool HaveLeakSanitizer() { return false; } void DoIgnoreLeak(const void*) { } void RegisterLivePointers(const void*, size_t) { } void UnRegisterLivePointers(const void*, size_t) { } LeakCheckDisabler::LeakCheckDisabler() { } LeakCheckDisabler::~LeakCheckDisabler() { } -} // inline namespace lts_2018_06_20 +} // inline namespace lts_2018_12_18 } // namespace absl #else @@ -35,7 +35,7 @@ LeakCheckDisabler::~LeakCheckDisabler() { } #include <sanitizer/lsan_interface.h> namespace absl { -inline namespace lts_2018_06_20 { +inline namespace lts_2018_12_18 { bool HaveLeakSanitizer() { return true; } void DoIgnoreLeak(const void* ptr) { __lsan_ignore_object(ptr); } void RegisterLivePointers(const void* ptr, size_t size) { @@ -46,7 +46,7 @@ void UnRegisterLivePointers(const void* ptr, size_t size) { } LeakCheckDisabler::LeakCheckDisabler() { __lsan_disable(); } LeakCheckDisabler::~LeakCheckDisabler() { __lsan_enable(); } -} // inline namespace lts_2018_06_20 +} // inline namespace lts_2018_12_18 } // namespace absl #endif // LEAK_SANITIZER diff --git a/absl/debugging/leak_check.h b/absl/debugging/leak_check.h index ddded2ae..f5e4fd87 100644 --- a/absl/debugging/leak_check.h +++ b/absl/debugging/leak_check.h @@ -33,7 +33,7 @@ #include <cstddef> namespace absl { -inline namespace lts_2018_06_20 { +inline namespace lts_2018_12_18 { // HaveLeakSanitizer() // @@ -105,7 +105,7 @@ void RegisterLivePointers(const void* ptr, size_t size); // `RegisterLivePointers()`, enabling leak checking of those pointers. void UnRegisterLivePointers(const void* ptr, size_t size); -} // inline namespace lts_2018_06_20 +} // inline namespace lts_2018_12_18 } // namespace absl #endif // ABSL_DEBUGGING_LEAK_CHECK_H_ diff --git a/absl/debugging/stacktrace.cc b/absl/debugging/stacktrace.cc index 55edad83..e991fc59 100644 --- a/absl/debugging/stacktrace.cc +++ b/absl/debugging/stacktrace.cc @@ -56,7 +56,7 @@ #endif namespace absl { -inline namespace lts_2018_06_20 { +inline namespace lts_2018_12_18 { namespace { typedef int (*Unwinder)(void**, int*, int, int, const void*, int*); @@ -81,25 +81,29 @@ ABSL_ATTRIBUTE_ALWAYS_INLINE inline int Unwind(void** result, int* sizes, } // anonymous namespace -int GetStackFrames(void** result, int* sizes, int max_depth, int skip_count) { +ABSL_ATTRIBUTE_NOINLINE ABSL_ATTRIBUTE_NO_TAIL_CALL int GetStackFrames( + void** result, int* sizes, int max_depth, int skip_count) { return Unwind<true, false>(result, sizes, max_depth, skip_count, nullptr, nullptr); } -int GetStackFramesWithContext(void** result, int* sizes, int max_depth, - int skip_count, const void* uc, - int* min_dropped_frames) { +ABSL_ATTRIBUTE_NOINLINE ABSL_ATTRIBUTE_NO_TAIL_CALL int +GetStackFramesWithContext(void** result, int* sizes, int max_depth, + int skip_count, const void* uc, + int* min_dropped_frames) { return Unwind<true, true>(result, sizes, max_depth, skip_count, uc, min_dropped_frames); } -int GetStackTrace(void** result, int max_depth, int skip_count) { +ABSL_ATTRIBUTE_NOINLINE ABSL_ATTRIBUTE_NO_TAIL_CALL int GetStackTrace( + void** result, int max_depth, int skip_count) { return Unwind<false, false>(result, nullptr, max_depth, skip_count, nullptr, nullptr); } -int GetStackTraceWithContext(void** result, int max_depth, int skip_count, - const void* uc, int* min_dropped_frames) { +ABSL_ATTRIBUTE_NOINLINE ABSL_ATTRIBUTE_NO_TAIL_CALL int +GetStackTraceWithContext(void** result, int max_depth, int skip_count, + const void* uc, int* min_dropped_frames) { return Unwind<false, true>(result, nullptr, max_depth, skip_count, uc, min_dropped_frames); } @@ -131,5 +135,5 @@ int DefaultStackUnwinder(void** pcs, int* sizes, int depth, int skip, return n; } -} // inline namespace lts_2018_06_20 +} // inline namespace lts_2018_12_18 } // namespace absl diff --git a/absl/debugging/stacktrace.h b/absl/debugging/stacktrace.h index a6213cf4..7baf83bc 100644 --- a/absl/debugging/stacktrace.h +++ b/absl/debugging/stacktrace.h @@ -32,7 +32,7 @@ #define ABSL_DEBUGGING_STACKTRACE_H_ namespace absl { -inline namespace lts_2018_06_20 { +inline namespace lts_2018_12_18 { // GetStackFrames() // @@ -221,7 +221,7 @@ namespace debugging_internal { // working. extern bool StackTraceWorksForTest(); } // namespace debugging_internal -} // inline namespace lts_2018_06_20 +} // inline namespace lts_2018_12_18 } // namespace absl #endif // ABSL_DEBUGGING_STACKTRACE_H_ diff --git a/absl/debugging/symbolize.h b/absl/debugging/symbolize.h index 6198b1fd..fc606e87 100644 --- a/absl/debugging/symbolize.h +++ b/absl/debugging/symbolize.h @@ -55,7 +55,7 @@ #include "absl/debugging/internal/symbolize.h" namespace absl { -inline namespace lts_2018_06_20 { +inline namespace lts_2018_12_18 { // InitializeSymbolizer() // @@ -93,7 +93,7 @@ void InitializeSymbolizer(const char* argv0); // } bool Symbolize(const void *pc, char *out, int out_size); -} // inline namespace lts_2018_06_20 +} // inline namespace lts_2018_12_18 } // namespace absl #endif // ABSL_DEBUGGING_SYMBOLIZE_H_ diff --git a/absl/debugging/symbolize_elf.inc b/absl/debugging/symbolize_elf.inc index b8dc23b7..37f77ca6 100644 --- a/absl/debugging/symbolize_elf.inc +++ b/absl/debugging/symbolize_elf.inc @@ -76,7 +76,7 @@ #include "absl/debugging/internal/vdso_support.h" namespace absl { -inline namespace lts_2018_06_20 { +inline namespace lts_2018_12_18 { // Value of argv[0]. Used by MaybeInitializeObjFile(). static char *argv0_value = nullptr; @@ -334,7 +334,11 @@ static std::atomic<Symbolizer *> g_cached_symbolizer; } // namespace static int SymbolizerSize() { +#if defined(__wasm__) || defined(__asmjs__) int pagesize = getpagesize(); +#else + int pagesize = sysconf(_SC_PAGESIZE); +#endif return ((sizeof(Symbolizer) - 1) / pagesize + 1) * pagesize; } @@ -1471,5 +1475,5 @@ bool Symbolize(const void *pc, char *out, int out_size) { return ok; } -} // inline namespace lts_2018_06_20 +} // inline namespace lts_2018_12_18 } // namespace absl diff --git a/absl/debugging/symbolize_test.cc b/absl/debugging/symbolize_test.cc index 5f2af47e..8029fbe9 100644 --- a/absl/debugging/symbolize_test.cc +++ b/absl/debugging/symbolize_test.cc @@ -321,7 +321,7 @@ TEST(Symbolize, SymbolizeWithMultipleMaps) { } } -// Appends std::string(*args->arg) to args->symbol_buf. +// Appends string(*args->arg) to args->symbol_buf. static void DummySymbolDecorator( const absl::debugging_internal::SymbolDecoratorArgs *args) { std::string *message = static_cast<std::string *>(args->arg); diff --git a/absl/debugging/symbolize_unimplemented.inc b/absl/debugging/symbolize_unimplemented.inc index 26dec0fb..874a4228 100644 --- a/absl/debugging/symbolize_unimplemented.inc +++ b/absl/debugging/symbolize_unimplemented.inc @@ -17,7 +17,7 @@ #include "absl/base/internal/raw_logging.h" namespace absl { -inline namespace lts_2018_06_20 { +inline namespace lts_2018_12_18 { namespace debugging_internal { @@ -33,5 +33,5 @@ bool RegisterFileMappingHint(const void *, const void *, uint64_t, const char *) void InitializeSymbolizer(const char*) {} bool Symbolize(const void *, char *, int) { return false; } -} // inline namespace lts_2018_06_20 +} // inline namespace lts_2018_12_18 } // namespace absl diff --git a/absl/debugging/symbolize_win32.inc b/absl/debugging/symbolize_win32.inc index 549b995a..ee8fd55c 100644 --- a/absl/debugging/symbolize_win32.inc +++ b/absl/debugging/symbolize_win32.inc @@ -25,7 +25,7 @@ #include "absl/base/internal/raw_logging.h" namespace absl { -inline namespace lts_2018_06_20 { +inline namespace lts_2018_12_18 { static HANDLE process = NULL; @@ -72,5 +72,5 @@ bool Symbolize(const void *pc, char *out, int out_size) { return true; } -} // inline namespace lts_2018_06_20 +} // inline namespace lts_2018_12_18 } // namespace absl |