# SPDX-License-Identifier: GPL-2.0 # # gdb helper commands and functions for Linux kernel debugging # # Kernel proc information reader # # Copyright (c) 2016 Linaro Ltd # # Authors: # Kieran Bingham <kieran.bingham@linaro.org> # # This work is licensed under the terms of the GNU GPL version 2. #
import gdb from linux import constants from linux import utils from linux import tasks from linux import lists from linux import vfs from linux import rbtree from struct import *
class LxCmdLine(gdb.Command): """ Report the Linux Commandline used in the current kernel.
Equivalent to cat /proc/cmdline on a running target"""
# Equivalent to proc_namespace.c:show_vfsmnt # However, that has the ability to call into s_op functions # whereas we cannot and must make do with the information we can obtain. def invoke(self, arg, from_tty):
argv = gdb.string_to_argv(arg) if len(argv) >= 1: try:
pid = int(argv[0]) except gdb.error: raise gdb.GdbError("Provide a PID as integer value") else:
pid = 1
task = tasks.get_task_by_pid(pid) ifnot task: raise gdb.GdbError("Couldn't find a process with PID {}"
.format(pid))
namespace = task['nsproxy']['mnt_ns'] ifnot namespace: raise gdb.GdbError("No namespace for current process")
for mnt in rbtree.rb_inorder_for_each_entry(namespace['mounts'], mount_ptr_type, "mnt_node"):
devname = mnt['mnt_devname'].string()
devname = devname if devname else"none"
class LxFdtDump(gdb.Command): """Output Flattened Device Tree header and dump FDT blob to the filename
specified as the command argument. Equivalent to 'cat /proc/fdt > fdtdump.dtb' on a running target"""
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.