mirror of
				https://github.com/torvalds/linux.git
				synced 2025-10-31 16:48:26 +02:00 
			
		
		
		
	 b7235d6bb5
			
		
	
	
		b7235d6bb5
		
	
	
	
	
		
			
			Linux makes use of the Radix Tree data structure to store pointers indexed
by integer values.  This structure is utilised across many structures in
the kernel including the IRQ descriptor tables, and several filesystems.
This module provides a method to lookup values from a structure given its
head node.
Usage:
The function lx_radix_tree_lookup, must be given a symbol of type struct
radix_tree_root, and an index into that tree.
The object returned is a generic integer value, and must be cast correctly
to the type based on the storage in the data structure.
For example, to print the irq descriptor in the sparse irq_desc_tree at
index 18, try the following:
(gdb) print (struct irq_desc)$lx_radix_tree_lookup(irq_desc_tree, 18)
This script previously existed under commit
e127a73d41 ("scripts/gdb: add a Radix Tree
Parser") and was later reverted with
b447e02548a3304c47b78b5e2d75a4312a8f17e1i (Revert "scripts/gdb: add a
Radix Tree Parser").
This version expects the XArray based radix tree implementation and has
been verified using QEMU/x86 on Linux 6.3-rc5.
[f.fainelli@gmail.com: revive and update for xarray implementation]
[f.fainelli@gmail.com: guard against a NULL node in the while loop]
  Link: https://lkml.kernel.org/r/20230405222743.1191674-1-f.fainelli@gmail.com
Link: https://lkml.kernel.org/r/20230404214049.1016811-1-f.fainelli@gmail.com
Signed-off-by: Kieran Bingham <kieran.bingham@linaro.org>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Cc: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Kieran Bingham <kbingham@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
		
	
			
		
			
				
	
	
		
			41 lines
		
	
	
	
		
			928 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			41 lines
		
	
	
	
		
			928 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(os.path.abspath(__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
 | |
|     import linux.modules
 | |
|     import linux.dmesg
 | |
|     import linux.tasks
 | |
|     import linux.config
 | |
|     import linux.cpus
 | |
|     import linux.lists
 | |
|     import linux.rbtree
 | |
|     import linux.proc
 | |
|     import linux.constants
 | |
|     import linux.timerlist
 | |
|     import linux.clk
 | |
|     import linux.genpd
 | |
|     import linux.device
 | |
|     import linux.mm
 | |
|     import linux.radixtree
 |