examine_stack.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. //
  2. // Copyright 2018 The Abseil Authors.
  3. //
  4. // Licensed under the Apache License, Version 2.0 (the "License");
  5. // you may not use this file except in compliance with the License.
  6. // You may obtain a copy of the License at
  7. //
  8. // https://www.apache.org/licenses/LICENSE-2.0
  9. //
  10. // Unless required by applicable law or agreed to in writing, software
  11. // distributed under the License is distributed on an "AS IS" BASIS,
  12. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. // See the License for the specific language governing permissions and
  14. // limitations under the License.
  15. //
  16. #ifndef ABSL_DEBUGGING_INTERNAL_EXAMINE_STACK_H_
  17. #define ABSL_DEBUGGING_INTERNAL_EXAMINE_STACK_H_
  18. #include "absl/base/config.h"
  19. namespace absl {
  20. ABSL_NAMESPACE_BEGIN
  21. namespace debugging_internal {
  22. // Returns the program counter from signal context, or nullptr if
  23. // unknown. `vuc` is a ucontext_t*. We use void* to avoid the use of
  24. // ucontext_t on non-POSIX systems.
  25. void* GetProgramCounter(void* vuc);
  26. // Uses `writerfn` to dump the program counter, stack trace, and stack
  27. // frame sizes.
  28. void DumpPCAndFrameSizesAndStackTrace(
  29. void* pc, void* const stack[], int frame_sizes[], int depth,
  30. int min_dropped_frames, bool symbolize_stacktrace,
  31. void (*writerfn)(const char*, void*), void* writerfn_arg);
  32. } // namespace debugging_internal
  33. ABSL_NAMESPACE_END
  34. } // namespace absl
  35. #endif // ABSL_DEBUGGING_INTERNAL_EXAMINE_STACK_H_