From: Leonard Crestez Date: Tue, 14 May 2019 22:46:11 +0000 (-0700) Subject: scripts/gdb: add $lx_clk_core_lookup function X-Git-Tag: v5.4-rc1~985^2~21 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=988b2686159759401a4549d0fc30ff9a8758391a;p=platform%2Fkernel%2Flinux-rpi.git scripts/gdb: add $lx_clk_core_lookup function Finding an individual clk_core requires walking the tree which can be quite complicated so add a helper for easy access. (gdb) print *(struct clk_scu*)$lx_clk_core_lookup("uart0_clk")->hw Link: http://lkml.kernel.org/r/Message-ID: Signed-off-by: Leonard Crestez Cc: Jan Kiszka Cc: Jason Wessel Cc: Kieran Bingham Cc: Stephen Boyd Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/scripts/gdb/linux/clk.py b/scripts/gdb/linux/clk.py index a9129d8..6bf7197 100644 --- a/scripts/gdb/linux/clk.py +++ b/scripts/gdb/linux/clk.py @@ -44,3 +44,26 @@ class LxClkSummary(gdb.Command): LxClkSummary() + + +class LxClkCoreLookup(gdb.Function): + """Find struct clk_core by name""" + + def __init__(self): + super(LxClkCoreLookup, self).__init__("lx_clk_core_lookup") + + def lookup_hlist(self, hlist_head, name): + for child in clk_core_for_each_child(hlist_head): + if child['name'].string() == name: + return child + result = self.lookup_hlist(child['children'], name) + if result: + return result + + def invoke(self, name): + name = name.string() + return (self.lookup_hlist(gdb.parse_and_eval("clk_root_list"), name) or + self.lookup_hlist(gdb.parse_and_eval("clk_orphan_list"), name)) + + +LxClkCoreLookup()