2021-11-21 23:59:44 +00:00
|
|
|
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
2022-11-02 00:05:16 +00:00
|
|
|
// SPDX-License-Identifier: LGPL-2.1-or-later
|
2021-11-08 23:39:39 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
*
|
|
|
|
* ORC unwinder support.
|
|
|
|
*
|
|
|
|
* See @ref DebugInfo.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef DRGN_ORC_INFO_H
|
|
|
|
#define DRGN_ORC_INFO_H
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#include "cfi.h"
|
|
|
|
|
2022-04-26 22:30:08 +01:00
|
|
|
struct drgn_module;
|
2021-11-08 23:39:39 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @ingroup DebugInfo
|
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
2022-04-26 22:30:08 +01:00
|
|
|
/** ORC unwinder data for a @ref drgn_module. */
|
|
|
|
struct drgn_module_orc_info {
|
2021-11-08 23:39:39 +00:00
|
|
|
/**
|
|
|
|
* Base for calculating program counter corresponding to an ORC unwinder
|
|
|
|
* entry.
|
|
|
|
*
|
|
|
|
* This is the address of the `.orc_unwind_ip` ELF section.
|
|
|
|
*
|
2022-04-26 22:30:08 +01:00
|
|
|
* @sa drgn_module_orc_info::entries
|
2021-11-08 23:39:39 +00:00
|
|
|
*/
|
|
|
|
uint64_t pc_base;
|
|
|
|
/**
|
|
|
|
* Offsets for calculating program counter corresponding to an ORC
|
|
|
|
* unwinder entry.
|
|
|
|
*
|
|
|
|
* This is the contents of the `.orc_unwind_ip` ELF section, byte
|
|
|
|
* swapped to the host's byte order if necessary.
|
|
|
|
*
|
2022-04-26 22:30:08 +01:00
|
|
|
* @sa drgn_module_orc_info::entries
|
2021-11-08 23:39:39 +00:00
|
|
|
*/
|
|
|
|
int32_t *pc_offsets;
|
|
|
|
/**
|
|
|
|
* ORC unwinder entries.
|
|
|
|
*
|
|
|
|
* This is the contents of the `.orc_unwind` ELF section, byte swapped
|
2023-06-21 23:21:41 +01:00
|
|
|
* to the host's byte order and normalized to the latest version of the
|
|
|
|
* format if necessary.
|
2021-11-08 23:39:39 +00:00
|
|
|
*
|
|
|
|
* Entry `i` specifies how to unwind the stack if
|
|
|
|
* `orc_pc(i) <= PC < orc_pc(i + 1)`, where
|
|
|
|
* `orc_pc(i) = pc_base + 4 * i + pc_offsets[i]`.
|
|
|
|
*/
|
|
|
|
struct drgn_orc_entry *entries;
|
|
|
|
/** Number of ORC unwinder entries. */
|
2023-06-22 21:43:28 +01:00
|
|
|
unsigned int num_entries;
|
2023-06-21 23:21:41 +01:00
|
|
|
/** Version of the ORC format. See @ref orc.h. */
|
|
|
|
int version;
|
2021-11-08 23:39:39 +00:00
|
|
|
};
|
|
|
|
|
2022-04-26 22:30:08 +01:00
|
|
|
void drgn_module_orc_info_deinit(struct drgn_module *module);
|
2021-11-08 23:39:39 +00:00
|
|
|
|
|
|
|
struct drgn_error *
|
2022-10-18 22:34:03 +01:00
|
|
|
drgn_module_find_orc_cfi(struct drgn_module *module, uint64_t pc,
|
|
|
|
struct drgn_cfi_row **row_ret, bool *interrupted_ret,
|
|
|
|
drgn_register_number *ret_addr_regno_ret);
|
2021-11-08 23:39:39 +00:00
|
|
|
|
|
|
|
/** @} */
|
|
|
|
|
|
|
|
#endif /* DRGN_ORC_INFO_H */
|