Debian Codegraph @

libdrgn/elf_symtab.h

raw
1 // Copyright (c) Meta Platforms, Inc. and affiliates.
2 // SPDX-License-Identifier: LGPL-2.1-or-later
3
4 /**
5 * @file
6 *
7 * ELF symbol tables.
8 *
9 * See @ref ElfSymtab.
10 */
11
12 #ifndef DRGN_ELF_SYMBOL_H
13 #define DRGN_ELF_SYMBOL_H
14
15 #include "drgn_internal.h"
16
17 struct drgn_elf_file;
18
19 /**
20 * @ingroup Internals
21 *
22 * @defgroup ElfSymtab ELF symbol tables
23 *
24 * ELF symbol table lookups.
25 *
26 * @{
27 */
28
29 /** Symbol table from an ELF file. */
30 struct drgn_elf_symbol_table {
31 /** File containing symbol table. @c NULL if not found yet. */
32 struct drgn_elf_file *file;
33 /** Bias to apply to addresses from the file. */
34 uint64_t bias;
35 /** Symbol table section data. */
36 const char *data;
37 /** Number of symbols in table. */
38 size_t num_symbols;
39 /** Number of local symbols in table. */
40 size_t num_local_symbols;
41 /** String table section used by symbol table. */
42 Elf_Data *strtab;
43 /** Optional `SHT_SYMTAB_SHNDX` section used by symbol table. */
44 Elf_Data *shndx;
45 };
46
47 /** Find matching ELF symbols in a specific module. */
48 struct drgn_error *
49 drgn_module_elf_symbols_search(struct drgn_module *module, const char *name,
50 uint64_t addr, enum drgn_find_symbol_flags flags,
51 struct drgn_symbol_result_builder *builder);
52
53 /** @} */
54
55 #endif /* DRGN_ELF_SYMBOL_H */