drgn/libdrgn/linux_kernel.h
Omar Sandoval 23574e59d5 libdrgn: add /proc/kcore physical segments on old kernels
Before Linux v4.11, /proc/kcore didn't have valid physical addresses, so
it's currently not possible to read from physical memory on old kernels.
However, if we can figure out the address of the direct mapping, then we
can determine the corresponding physical addresses for the segments and
add them.
2020-05-04 13:20:27 -07:00

51 lines
1.5 KiB
C

// Copyright 2018-2019 - Omar Sandoval
// SPDX-License-Identifier: GPL-3.0+
#ifndef DRGN_LINUX_KERNEL_H
#define DRGN_LINUX_KERNEL_H
#include <elfutils/libdwfl.h>
#include "drgn.h"
struct drgn_dwarf_index;
struct drgn_memory_reader;
struct vmcoreinfo;
struct drgn_error *parse_vmcoreinfo(const char *desc, size_t descsz,
struct vmcoreinfo *ret);
struct drgn_error *proc_kallsyms_symbol_addr(const char *name,
unsigned long *ret);
struct drgn_error *read_vmcoreinfo_fallback(struct drgn_memory_reader *reader,
struct vmcoreinfo *ret);
struct drgn_error *linux_kernel_object_find(const char *name, size_t name_len,
const char *filename,
enum drgn_find_object_flags flags,
void *arg, struct drgn_object *ret);
struct drgn_error *
linux_kernel_report_debug_info(struct drgn_program *prog,
struct drgn_dwarf_index *dindex,
const char **paths, size_t n,
bool report_default, bool report_main);
#define KDUMP_SIGNATURE "KDUMP "
#define KDUMP_SIG_LEN (sizeof(KDUMP_SIGNATURE) - 1)
#ifdef WITH_LIBKDUMPFILE
struct drgn_error *drgn_program_cache_prstatus_kdump(struct drgn_program *prog);
struct drgn_error *drgn_program_set_kdump(struct drgn_program *prog);
#else
static inline struct drgn_error *
drgn_program_set_kdump(struct drgn_program *prog)
{
return drgn_error_create(DRGN_ERROR_INVALID_ARGUMENT,
"drgn was built without libkdumpfile support");
}
#endif
#endif /* DRGN_LINUX_KERNEL_H */