Debian Codegraph @

libdrgn/linux_kernel.h

raw
1 // Copyright (c) Meta Platforms, Inc. and affiliates.
2 // SPDX-License-Identifier: LGPL-2.1-or-later
3
4 #ifndef DRGN_LINUX_KERNEL_H
5 #define DRGN_LINUX_KERNEL_H
6
7 #include "drgn_internal.h"
8
9 struct drgn_debug_info_options;
10 struct drgn_standard_debug_info_find_state;
11
12 struct drgn_error *drgn_program_finish_set_kernel(struct drgn_program *prog);
13
14 struct drgn_error *read_memory_via_pgtable(void *buf, uint64_t address,
15 size_t count, uint64_t offset,
16 void *arg, bool physical);
17
18 struct drgn_error *drgn_program_parse_vmcoreinfo(struct drgn_program *prog,
19 const char *desc,
20 size_t descsz);
21
22 struct drgn_error *proc_kallsyms_symbol_addr(const char *name,
23 unsigned long *ret);
24
25 struct drgn_error *read_vmcoreinfo_fallback(struct drgn_program *prog);
26
27 struct drgn_error *
28 linux_kernel_loaded_module_iterator_create(struct drgn_program *prog,
29 struct drgn_module_iterator **ret);
30
31 struct drgn_error *
32 drgn_module_try_vmlinux_files(struct drgn_module *module,
33 const struct drgn_debug_info_options *options);
34
35 struct drgn_error *
36 drgn_module_try_linux_kmod_files(struct drgn_module *module,
37 const struct drgn_debug_info_options *options,
38 struct drgn_standard_debug_info_find_state *state);
39
40 struct drgn_error *
41 drgn_program_is_irq_regs(struct drgn_program *prog, uint64_t addr,
42 bool *ret);
43
44 #define KDUMP_SIGNATURE "KDUMP "
45 #define KDUMP_SIG_LEN (sizeof(KDUMP_SIGNATURE) - 1)
46
47 // For the makedumpfile flattened format, the signature is "makedumpfile"
48 // null-padded to 16 bytes (the string literal has an implicit null terminator)
49 #define FLATTENED_SIGNATURE "makedumpfile\0\0\0"
50 #define FLATTENED_SIG_LEN sizeof(FLATTENED_SIGNATURE)
51
52 #ifdef WITH_LIBKDUMPFILE
53 struct drgn_error *drgn_program_cache_kdump_threads(struct drgn_program *prog);
54 struct drgn_error *drgn_program_set_kdump(struct drgn_program *prog);
55 #else
56 static inline struct drgn_error *
57 drgn_program_set_kdump(struct drgn_program *prog)
58 {
59 return drgn_error_create(DRGN_ERROR_INVALID_ARGUMENT,
60 "drgn was built without libkdumpfile support");
61 }
62 #endif
63
64 #endif /* DRGN_LINUX_KERNEL_H */