stack_trace.h 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
  2. // This source code is licensed under both the GPLv2 (found in the
  3. // COPYING file in the root directory) and Apache 2.0 License
  4. // (found in the LICENSE.Apache file in the root directory).
  5. //
  6. #pragma once
  7. #include "rocksdb/rocksdb_namespace.h"
  8. namespace ROCKSDB_NAMESPACE {
  9. namespace port {
  10. // Install a signal handler to print callstack on the following signals:
  11. // SIGILL SIGSEGV SIGBUS SIGABRT
  12. // And also (Linux ony for now) overrides security settings to allow outside
  13. // processes to attach to this one as a debugger. ONLY USE FOR NON-SECURITY
  14. // CRITICAL PROCESSES such as unit tests or benchmarking tools.
  15. // Currently supports only some POSIX implementations. No-op otherwise.
  16. void InstallStackTraceHandler();
  17. // Prints stack, skips skip_first_frames frames
  18. void PrintStack(int first_frames_to_skip = 0);
  19. // Prints the given callstack
  20. void PrintAndFreeStack(void* callstack, int num_frames);
  21. // Save the current callstack
  22. void* SaveStack(int* num_frame, int first_frames_to_skip = 0);
  23. } // namespace port
  24. } // namespace ROCKSDB_NAMESPACE