| 1 |
// Copyright (c) 2024 Oracle and/or its affiliates |
| 2 |
// SPDX-License-Identifier: LGPL-2.1-or-later |
| 3 |
|
| 4 |
/** |
| 5 |
* @file |
| 6 |
* |
| 7 |
* Kallsyms data handling |
| 8 |
* |
| 9 |
* See @ref Kallsyms |
| 10 |
*/ |
| 11 |
|
| 12 |
#ifndef DRGN_KALLSYMS_H |
| 13 |
#define DRGN_KALLSYMS_H |
| 14 |
|
| 15 |
#include <stdint.h> |
| 16 |
#include <sys/types.h> |
| 17 |
|
| 18 |
#include "hash_table.h" |
| 19 |
#include "symbol.h" |
| 20 |
|
| 21 |
struct kallsyms_locations { |
| 22 |
uint64_t kallsyms_names; |
| 23 |
uint64_t kallsyms_token_table; |
| 24 |
uint64_t kallsyms_token_index; |
| 25 |
uint64_t kallsyms_num_syms; |
| 26 |
uint64_t kallsyms_offsets; |
| 27 |
uint64_t kallsyms_relative_base; |
| 28 |
uint64_t kallsyms_addresses; |
| 29 |
uint64_t _stext; |
| 30 |
}; |
| 31 |
|
| 32 |
/** |
| 33 |
* Initialize a symbol index containing symbols from /proc/kallsyms |
| 34 |
*/ |
| 35 |
struct drgn_error *drgn_load_proc_kallsyms(const char *filename, bool modules, |
| 36 |
struct drgn_symbol_index *ret); |
| 37 |
|
| 38 |
/** |
| 39 |
* Initialize a symbol index containing symbols from built-in kallsyms tables |
| 40 |
*/ |
| 41 |
struct drgn_error * |
| 42 |
drgn_load_builtin_kallsyms(struct drgn_program *prog, |
| 43 |
struct kallsyms_locations *loc, |
| 44 |
struct drgn_symbol_index *ret); |
| 45 |
|
| 46 |
#endif // DRGN_KALLSYMS_H |