Skip to content

Commit

Permalink
scripts/gdb: add version command
Browse files Browse the repository at this point in the history
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.

[[email protected]: remove blank line from help output and fix pep8 warning]
Signed-off-by: Kieran Bingham <[email protected]>
Signed-off-by: Jan Kiszka <[email protected]>
Cc: Jason Wessel <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
kbingham authored and torvalds committed Mar 22, 2016
1 parent 5c9a875 commit 2d061d9
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
28 changes: 28 additions & 0 deletions scripts/gdb/linux/proc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#
# gdb helper commands and functions for Linux kernel debugging
#
# Kernel proc information reader
#
# Copyright (c) 2016 Linaro Ltd
#
# Authors:
# Kieran Bingham <[email protected]>
#
# This work is licensed under the terms of the GNU GPL version 2.
#

import gdb


class LxVersion(gdb.Command):
""" Report the Linux Version of the current kernel.
Equivalent to cat /proc/version on a running target"""

def __init__(self):
super(LxVersion, self).__init__("lx-version", gdb.COMMAND_DATA)

def invoke(self, arg, from_tty):
# linux_banner should contain a newline
gdb.write(gdb.parse_and_eval("linux_banner").string())

LxVersion()
1 change: 1 addition & 0 deletions scripts/gdb/vmlinux-gdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@
import linux.tasks
import linux.cpus
import linux.lists
import linux.proc

0 comments on commit 2d061d9

Please sign in to comment.