blob: 393369131f1e540946abaf7a8223d16f8adf8b6d [file] [log] [blame]
Austin Schuh36244a12019-09-21 17:52:38 -07001//
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
17#ifndef ABSL_DEBUGGING_INTERNAL_EXAMINE_STACK_H_
18#define ABSL_DEBUGGING_INTERNAL_EXAMINE_STACK_H_
19
Austin Schuhb4691e92020-12-31 12:37:18 -080020#include "absl/base/config.h"
21
Austin Schuh36244a12019-09-21 17:52:38 -070022namespace absl {
Austin Schuhb4691e92020-12-31 12:37:18 -080023ABSL_NAMESPACE_BEGIN
Austin Schuh36244a12019-09-21 17:52:38 -070024namespace debugging_internal {
25
26// Returns the program counter from signal context, or nullptr if
27// unknown. `vuc` is a ucontext_t*. We use void* to avoid the use of
28// ucontext_t on non-POSIX systems.
29void* GetProgramCounter(void* vuc);
30
31// Uses `writerfn` to dump the program counter, stack trace, and stack
32// frame sizes.
33void DumpPCAndFrameSizesAndStackTrace(
34 void* pc, void* const stack[], int frame_sizes[], int depth,
35 int min_dropped_frames, bool symbolize_stacktrace,
36 void (*writerfn)(const char*, void*), void* writerfn_arg);
37
38} // namespace debugging_internal
Austin Schuhb4691e92020-12-31 12:37:18 -080039ABSL_NAMESPACE_END
Austin Schuh36244a12019-09-21 17:52:38 -070040} // namespace absl
41
42#endif // ABSL_DEBUGGING_INTERNAL_EXAMINE_STACK_H_