All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leonard Crestez <leonard.crestez@nxp.com>
To: Stephen Boyd <sboyd@kernel.org>
Cc: Jan Kiszka <jan.kiszka@siemens.com>,
	Kieran Bingham <kbingham@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 3/3] scripts/gdb: Add $lx_clk_core_lookup function
Date: Tue, 23 Apr 2019 11:12:49 +0000	[thread overview]
Message-ID: <AM0PR04MB6434A133CB5ABA0286B0F487EE230@AM0PR04MB6434.eurprd04.prod.outlook.com> (raw)
In-Reply-To: 155596430227.15276.13435242792506854365@swboyd.mtv.corp.google.com

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/clk.py b/scripts/gdb/linux/clk.py
>> +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().

--
Regards,
Leonard

  parent reply	other threads:[~2019-04-23 11:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-22  8:26 [PATCH 0/3] scripts/gdb: Initial clk support Leonard Crestez
2019-04-22  8:26 ` [PATCH 1/3] scripts/gdb: Add hlist utilities Leonard Crestez
2019-04-22 20:41   ` Stephen Boyd
2019-04-23  9:20     ` Leonard Crestez
2019-04-22  8:26 ` [PATCH 2/3] scripts/gdb: Initial clk support: lx-clk-summary Leonard Crestez
2019-04-22 20:22   ` Stephen Boyd
2019-04-22  8:26 ` [PATCH 3/3] scripts/gdb: Add $lx_clk_core_lookup function Leonard Crestez
     [not found]   ` <155596430227.15276.13435242792506854365@swboyd.mtv.corp.google.com>
2019-04-23 11:12     ` Leonard Crestez [this message]
2019-04-23 18:16       ` Stephen Boyd
2019-04-22 20:40 ` [PATCH 0/3] scripts/gdb: Initial clk support Stephen Boyd

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AM0PR04MB6434A133CB5ABA0286B0F487EE230@AM0PR04MB6434.eurprd04.prod.outlook.com \
    --to=leonard.crestez@nxp.com \
    --cc=akpm@linux-foundation.org \
    --cc=jan.kiszka@siemens.com \
    --cc=kbingham@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sboyd@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.