aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/scripts/gdb/linux/stackdepot.py
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.com>2024-11-18 21:29:33 +0100
committerJiri Kosina <jkosina@suse.com>2024-11-18 21:29:33 +0100
commitf33e46a0c6bddd341d0989484a2546bba7ac4a3c (patch)
tree4918985ab00890205c8d77d0553472e12e01cd55 /scripts/gdb/linux/stackdepot.py
parentHID: hyperv: streamline driver probe to avoid devres issues (diff)
parentHID: wacom: Set eraser status when either 'Eraser' or 'Invert' usage is set (diff)
downloadwireguard-linux-f33e46a0c6bddd341d0989484a2546bba7ac4a3c.tar.xz
wireguard-linux-f33e46a0c6bddd341d0989484a2546bba7ac4a3c.zip
Merge branch 'for-6.13/wacom' into for-linus
- Sanitization of BTN_TOOL_RUBBER handling (Jason Gerecke)
Diffstat (limited to '')
-rw-r--r--scripts/gdb/linux/stackdepot.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/scripts/gdb/linux/stackdepot.py b/scripts/gdb/linux/stackdepot.py
index bb3a0f843931..37313a5a51a0 100644
--- a/scripts/gdb/linux/stackdepot.py
+++ b/scripts/gdb/linux/stackdepot.py
@@ -13,6 +13,13 @@ if constants.LX_CONFIG_STACKDEPOT:
stack_record_type = utils.CachedType('struct stack_record')
DEPOT_STACK_ALIGN = 4
+def help():
+ t = """Usage: lx-stack_depot_lookup [Hex handle value]
+ Example:
+ lx-stack_depot_lookup 0x00c80300\n"""
+ gdb.write("Unrecognized command\n")
+ raise gdb.GdbError(t)
+
def stack_depot_fetch(handle):
global DEPOT_STACK_ALIGN
global stack_record_type
@@ -57,3 +64,23 @@ def stack_depot_print(handle):
gdb.execute("x /i 0x%x" % (int(entries[i])))
except Exception as e:
gdb.write("%s\n" % e)
+
+class StackDepotLookup(gdb.Command):
+ """Search backtrace by handle"""
+
+ def __init__(self):
+ if constants.LX_CONFIG_STACKDEPOT:
+ super(StackDepotLookup, self).__init__("lx-stack_depot_lookup", gdb.COMMAND_SUPPORT)
+
+ def invoke(self, args, from_tty):
+ if not constants.LX_CONFIG_STACKDEPOT:
+ raise gdb.GdbError('CONFIG_STACKDEPOT is not set')
+
+ argv = gdb.string_to_argv(args)
+ if len(argv) == 1:
+ handle = int(argv[0], 16)
+ stack_depot_print(gdb.Value(handle).cast(utils.get_uint_type()))
+ else:
+ help()
+
+StackDepotLookup()