mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-26 05:34:13 +08:00
66051720b8
This is probably the most useful helper when debugging kernel modules: lx-symbols first reloads vmlinux. Then it searches recursively for *.ko files in the specified paths and the current directory. Finally it walks the kernel's module list, issuing the necessary add-symbol-file command for each loaded module so that gdb knows which module symbol corresponds to which address. It also looks up variable sections (bss, data, rodata) and appends their address to the add-symbole-file command line. This allows to access global module variables just like any other variable. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Jason Wessel <jason.wessel@windriver.com> Cc: Andi Kleen <andi@firstfloor.org> Cc: Ben Widawsky <ben@bwidawsk.net> Cc: Borislav Petkov <bp@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
27 lines
556 B
Python
27 lines
556 B
Python
#
|
|
# gdb helper commands and functions for Linux kernel debugging
|
|
#
|
|
# loader module
|
|
#
|
|
# Copyright (c) Siemens AG, 2012, 2013
|
|
#
|
|
# Authors:
|
|
# Jan Kiszka <jan.kiszka@siemens.com>
|
|
#
|
|
# This work is licensed under the terms of the GNU GPL version 2.
|
|
#
|
|
|
|
import os
|
|
|
|
sys.path.insert(0, os.path.dirname(__file__) + "/scripts/gdb")
|
|
|
|
try:
|
|
gdb.parse_and_eval("0")
|
|
gdb.execute("", to_string=True)
|
|
except:
|
|
gdb.write("NOTE: gdb 7.2 or later required for Linux helper scripts to "
|
|
"work.\n")
|
|
else:
|
|
import linux.utils
|
|
import linux.symbols
|