History

scripts/gdb: add version command

lx-version Report the Linux Version of the current kernel. Add a command to identify the version specified by the banner in the debugged kernel. This lets the user identify the kernel of the running kernel, and will let later scripts compare the banner of the attached kernel against the banner in the vmlinux symbols files to verify that the files are correct. [jan.kiszka@siemens.com: remove blank line from help output and fix pep8 warning] Signed-off-by: Kieran Bingham <kieran.bingham@linaro.org> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Cc: Jason Wessel <jason.wessel@windriver.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Kieran Bingham committed 10 years ago

Commit 2d061d91 parent 5c9a8752 files · +29 −0Browse files

Unified · Split

2 files
  1. scripts/gdb/linux/proc.py +28 −0
  2. scripts/gdb/vmlinux-gdb.py +1 −0
scripts/gdb/linux/proc.py+28−0
@@ -0,0 +1,28 @@
1#
2# gdb helper commands and functions for Linux kernel debugging
3#
4# Kernel proc information reader
5#
6# Copyright (c) 2016 Linaro Ltd
7#
8# Authors:
9# Kieran Bingham <kieran.bingham@linaro.org>
10#
11# This work is licensed under the terms of the GNU GPL version 2.
12#
13
14import gdb
15
16
17class LxVersion(gdb.Command):
18 """ Report the Linux Version of the current kernel.
19 Equivalent to cat /proc/version on a running target"""
20
21 def __init__(self):
22 super(LxVersion, self).__init__("lx-version", gdb.COMMAND_DATA)
23
24 def invoke(self, arg, from_tty):
25 # linux_banner should contain a newline
26 gdb.write(gdb.parse_and_eval("linux_banner").string())
27
28LxVersion()
scripts/gdb/vmlinux-gdb.py+1−0
@@ -29,3 +29,4 @@ else: · 28 unmodified lines
29 import linux.tasks29 import linux.tasks
30 import linux.cpus30 import linux.cpus
31 import linux.lists31 import linux.lists
32 import linux.proc