Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Ales Novak <alnovak@suse.cz>
To: Kieran Bingham <kieran.bingham@linaro.org>
Cc: Phil Muldoon <pmuldoon@redhat.com>,
	gdb@sourceware.org,     Yao Qi <yao.qi@linaro.org>,
	Peter Griffin <peter.griffin@linaro.org>,
	    Jan Kiszka <jan.kiszka@siemens.com>,
	Lee Jones <lee.jones@linaro.org>,
	    Jeff Mahoney <jeffm@suse.com>,
	ptesarik@suse.com
Subject: Re: [RFC] Target Layer Python Interface
Date: Thu, 04 Feb 2016 22:16:00 -0000	[thread overview]
Message-ID: <alpine.LSU.2.03.1602042255390.5343@suse.cz> (raw)
In-Reply-To: <56AFA1B8.6060402@linaro.org>

Hello,

On 2016-2-1 19:19, Kieran Bingham wrote:
> [...]
> The API, I would expect to match that of the Target API operations. I
> would expect a one-to-one mapping of (required) operation names to
> perform functions.
>
> For instance, to support thread listings, I would expect something along
> the lines of:
>
> .to_update_thread_list
> .to_pid_to_str
> .to_extra_thread_info
> .to_thread_alive
> .to_fetch_registers
> ...

FTR I've slightly tweaked your gdb.Target to process "to_xfer_partial", 
the respective commit is:

https://github.com/alesax/gdb-kdump/commit/efba160691273ef3c1547112554584088b5dba75

(and the respective branch is "gdb-target")

Then the target code which is accessing virtual (!) memory of the kernel 
dump on the disk (using libkdumpfile library) is as small as:

===
from gdb import Target
from _kdumpfile import kdumpfile

class MyTarget(Target):
     def __init__(self, fil):
         self.kdump = kdumpfile(fil)
         self.kdump.symbol_func = \
             lambda nam: long(gdb.lookup_minimal_symbol(nam).value())
         self.kdump.vtop_init()
         super(MyTarget, self).__init__()
     def to_xfer_partial(self, obj, annex, readbuf, writebuf, offset, ln):
         if obj == self.TARGET_OBJECT_MEMORY:
             r = self.kdump.read (self.kdump.KDUMP_KVADDR, offset, ln)
             readbuf[:] = r
         return ln

MyTarget(file("/tmp/vmcore"))
===

which is really nice, I'd say. Now it would be interesting


> And having seen Jeff's work today, we could utilise Jeff's py-regcache
> object quite effectively
>
> [...]
>
> Yes, I suspect some of the functionality to implement will be very
> repeatable throughout each of the operation call implementations.
>
>
> However, the more I look into it - the more I see each function is
> likely to need very specific bindings, as it is not simple passing from
> c function to c function.

Yes, the mentioned to_xfer_partial being a good example (of not simple 
passing).

> Perhaps we can factor out commonality as we go - and try to keep as DRY
> as possible, but I suspect it will be an iterative implementation process.
>
>
>> I can't comment without more details though. My initial reaction
>> though is yeah, this sounds useful and exciting.
>
> Perfect :)

Yes, this definitely is worth pursuing.

-- 
Ales Novak
SUSE L3 Team


  reply	other threads:[~2016-02-04 22:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-29 12:33 Kieran Bingham
2016-01-31 15:21 ` Phil Muldoon
2016-02-01 18:19   ` Kieran Bingham
2016-02-04 22:16     ` Ales Novak [this message]
2016-02-05 16:36       ` Kieran Bingham
2016-02-05 16:38         ` Jeff Mahoney
2016-02-05 16:47           ` Kieran Bingham
2016-02-05 17:06             ` Kieran Bingham

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=alpine.LSU.2.03.1602042255390.5343@suse.cz \
    --to=alnovak@suse.cz \
    --cc=gdb@sourceware.org \
    --cc=jan.kiszka@siemens.com \
    --cc=jeffm@suse.com \
    --cc=kieran.bingham@linaro.org \
    --cc=lee.jones@linaro.org \
    --cc=peter.griffin@linaro.org \
    --cc=pmuldoon@redhat.com \
    --cc=ptesarik@suse.com \
    --cc=yao.qi@linaro.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox