| 1 |
// Copyright (c) Meta Platforms, Inc. and affiliates. |
| 2 |
// SPDX-License-Identifier: LGPL-2.1-or-later |
| 3 |
|
| 4 |
/** |
| 5 |
* @file |
| 6 |
* |
| 7 |
* Stack trace internals |
| 8 |
* |
| 9 |
* See @ref StackTraceInternals. |
| 10 |
*/ |
| 11 |
|
| 12 |
#ifndef DRGN_STACK_TRACE_H |
| 13 |
#define DRGN_STACK_TRACE_H |
| 14 |
|
| 15 |
#include <elfutils/libdw.h> |
| 16 |
#include <stddef.h> |
| 17 |
|
| 18 |
/** |
| 19 |
* @ingroup Internals |
| 20 |
* |
| 21 |
* @defgroup StackTraceInternals Stack traces |
| 22 |
* |
| 23 |
* Stack trace internals. |
| 24 |
* |
| 25 |
* This provides the internal data structures used for stack traces. |
| 26 |
* |
| 27 |
* @{ |
| 28 |
*/ |
| 29 |
|
| 30 |
struct drgn_stack_frame { |
| 31 |
struct drgn_register_state *regs; |
| 32 |
Dwarf_Die *scopes; |
| 33 |
size_t num_scopes; |
| 34 |
size_t function_scope; |
| 35 |
}; |
| 36 |
|
| 37 |
struct drgn_stack_trace { |
| 38 |
struct drgn_program *prog; |
| 39 |
size_t num_frames; |
| 40 |
struct drgn_stack_frame frames[]; |
| 41 |
}; |
| 42 |
|
| 43 |
// This is only exposed for tests. |
| 44 |
struct drgn_error *drgn_parse_addr2line(const char *address_str, |
| 45 |
const char **sym_name_ret, |
| 46 |
size_t *sym_name_len_ret, |
| 47 |
unsigned long long *offset_ret); |
| 48 |
|
| 49 |
/** @} */ |
| 50 |
|
| 51 |
#endif /* DRGN_STACK_TRACE_H */ |