From: Yao Qi <qiyaoltc@gmail.com>
To: Freddie Chopin <freddie_chopin@op.pl>
Cc: Phil Muldoon <pmuldoon@redhat.com>,
gdb@sourceware.org, openocd-devel@lists.sourceforge.net
Subject: Re: Python API for supplying thread information?
Date: Thu, 23 Mar 2017 11:34:00 -0000 [thread overview]
Message-ID: <86mvccuszh.fsf@gmail.com> (raw)
In-Reply-To: <1490199596.1410.3.camel@op.pl> (Freddie Chopin's message of "Wed, 22 Mar 2017 17:19:56 +0100")
Freddie Chopin <freddie_chopin@op.pl> writes:
>> Is it possible? Sure. But without looking at it in any real depth it
>> would be a major undertaking. GDB does not have the concept of
>> "Providers", it assembles state from many different sources: kernel,
>> glibc, libthread_db etc.
>
> Please note that for deeply embedded target these concepts don't apply
> - there's no standard "kernel" (usually there's also no separation
> between application and kernel), glibc is too huge and none of the
> "standard" facilities. From what I've seen
>
The differences between "deeply embedded target" and PC doesn't matter
here. As Phil said, GDB has to assemble state from different sources,
including OpenOCD and others.
>> This state is internally structured and
>> relevant to GDB and is not really structured to receive arbitrary
>> input from an API at the moment. It could, but I think it would
>> require major surgery.
>
> Well, the info OpenOCD provides to GDB is structured quite nice.
> Basically OpenOCD just returns a list of tuples consisting of: thread
> name (string), thread extra info (string, in most implementation it's
> the info about state) and the thread ID (opaque value). Then it also
> informs GDB which of these is currently active. GDB may also request
> the list of thread registers, from what I understand by providing
> "thread ID" and expecting a string with registers as hex.
>
> All of that is done with GDB packets like "qThreadExtraInfo",
> "qfThreadInfo", "qC" and some more.
>
> In this case it would be enough to just get all that data with the
> Python script instead of querying GDB server (OpenOCD).
OpenOCD can provide thread information because it embedded the RTOS
internal knowledge into it, as you mentioned in challenge #2 in your
first mail. IMO, it is a pain. In order to get rid of this pain
completely, python script is needed to *provide* thread information to
GDB by parsing some RTOS's data structures, so that OpenOCD don't need
these C code to get OS-specific thread information at all. Providing
thread info isn't just printing thread name and state in "info
threads". GDB internally needs thread information too.
>
>> Currently the Scripting API is almost entirely focused with providing
>> information and not really designed to take information. You have
>> information providers APIs and data decorators APIs.
>
> I might got something wrong, but wouldn't this be an example of
> "information provider API"?
I agree with Phil. Some python APIs are needed to provide thread
information to GDB, but they are missing in GDB now. Note that we are
working Linux kernel awareness debugging in GDB, in which we get Linux
specific information, for example, kernel threads, via C code. We
thought about doing it in python two years ago, but decide to implement
it C first, and then, add needed python interfaces in GDB and move the
code to python if possible.
--
Yao (齐尧)
next prev parent reply other threads:[~2017-03-23 11:34 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-22 9:43 Freddie Chopin
2017-03-22 11:01 ` [OpenOCD-devel] " Liviu Ionescu
2017-03-22 11:46 ` Freddie Chopin
2017-03-22 17:23 ` Pierre-Marie de Rodat
2017-03-22 17:52 ` Freddie Chopin
2017-03-23 9:23 ` Pierre-Marie de Rodat
2017-03-23 16:50 ` Freddie Chopin
2017-03-23 18:08 ` Liviu Ionescu
2017-03-31 10:55 ` Gary Benson
2017-03-22 15:32 ` Phil Muldoon
2017-03-22 15:37 ` Phil Muldoon
2017-03-22 16:20 ` Freddie Chopin
2017-03-23 11:34 ` Yao Qi [this message]
2017-03-23 14:33 ` [OpenOCD-devel] " Duane Ellis
2017-03-26 14:11 ` Freddie Chopin
2017-03-23 16:41 ` Freddie Chopin
[not found] ` <CADQtY4AdhK73Gva2TYo4VDaTsY3Z33MtrJVLc-OwXwD6R5OqtQ@mail.gmail.com>
2017-03-26 14:02 ` [OpenOCD-devel] " Freddie Chopin
2017-03-22 21:51 ` Gareth McMullin
2017-03-23 16:44 ` Freddie Chopin
[not found] ` <220810f4-9843-d898-6947-e7eeeed3a1ed@daniel-krebs.net>
2017-03-23 16:56 ` [OpenOCD-devel] " Freddie Chopin
[not found] ` <CADQtY4BBxGdOg=DNqZYigA2G8-MVi5bvbbccfh8Vy_KEx-U+ug@mail.gmail.com>
2017-03-26 13:58 ` Freddie Chopin
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=86mvccuszh.fsf@gmail.com \
--to=qiyaoltc@gmail.com \
--cc=freddie_chopin@op.pl \
--cc=gdb@sourceware.org \
--cc=openocd-devel@lists.sourceforge.net \
--cc=pmuldoon@redhat.com \
/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