mirror of
https://github.com/JakeHillion/drgn.git
synced 2024-12-23 17:53:07 +00:00
e5874ad18a
libdwfl is the elfutils "DWARF frontend library". It has high-level functionality for looking up symbols, walking stack traces, etc. In order to use this functionality, we need to report our debugging information through libdwfl. For userspace programs, libdwfl has a much better implementation than drgn for automatically finding debug information from a core dump or PID. However, for the kernel, libdwfl has a few issues: - It only supports finding debug information for the running kernel, not vmcores. - It determines the vmlinux address range by reading /proc/kallsyms, which is slow (~70ms on my machine). - If separate debug information isn't available for a kernel module, it finds it by walking /lib/modules/$(uname -r)/kernel; this is repeated for every module. - It doesn't find kernel modules with names containing both dashes and underscores (e.g., aes-x86_64). Luckily, drgn already solved all of these problems, and with some effort, we can keep doing it ourselves and report it to libdwfl. The conversion replaces a bunch of code for dealing with userspace core dump notes, /proc/$pid/maps, and relocations.
29 lines
722 B
C
29 lines
722 B
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_memory_reader;
|
|
struct vmcoreinfo;
|
|
|
|
struct drgn_error *parse_vmcoreinfo(const char *desc, size_t descsz,
|
|
struct vmcoreinfo *ret);
|
|
|
|
struct drgn_error *read_vmcoreinfo_fallback(struct drgn_memory_reader *reader,
|
|
bool have_non_zero_phys_addr,
|
|
struct vmcoreinfo *ret);
|
|
|
|
struct drgn_error *
|
|
linux_kernel_load_debug_info(struct drgn_program *prog, const char **paths,
|
|
size_t n);
|
|
|
|
struct drgn_error *
|
|
linux_kernel_load_default_debug_info(struct drgn_program *prog);
|
|
|
|
#endif /* DRGN_LINUX_KERNEL_H */
|