[lkml]   [2019]   [Apr]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH 3/3] scripts/gdb: Add $lx_clk_core_lookup function
On 4/22/2019 11:18 PM, Stephen Boyd wrote:
> Quoting Leonard Crestez (2019-04-22 01:26:57)
>> diff --git a/scripts/gdb/linux/ b/scripts/gdb/linux/
>> +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:
> Do you need to do the .string() for comparison? Or does it work just as
> well to compare a gdb.Value object to a python string? It would be nice
> if the gdb.Value object could figure out that they're not both gdb.Value
> objects so it can do a string comparison itself.

The gdb manual is not clear on how comparisons work on gdb.Value types.
Converting to a python string and comparing in python work well, using
== on string gdb.Values results in this:

gdb.error: evaluation of this expression requires the program to
have a function "malloc"

My guess is gdb attempts to convert both arguments to gdb.Value and do
the comparison via a call on the target? This is very undesirable here.

I get the same error if "name" is a gdb.Value instead of being converted
to a string in invoke().


 \ /
  Last update: 2019-04-23 13:13    [W:0.077 / U:9.428 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site