Re: Python API for supplying thread information?

Phil Muldoon
2017-03-22T15:32:04Z

On 22/03/17 09:43, Freddie Chopin wrote:
> Hello!
>
> The idea I'm asking about is related to the Pretty Printing API in
> Python, which allows one to extend behaviour of GDB completely on
> "client side" - there's absolutely no need to modify any component of
> the toolchain to print your own types in any way you like.
>
> It would be really great if something like this existed for _supplying_
> thread information to GDB. I'm not talking about the Python API to
> _query_ GDB about threads.
> ( https://sourceware.org/gdb/onlinedocs/gdb/Threads-In-Python.html ).

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. 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.

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.

My advice would be to undertake a study to estimate the work needed.

Cheers

Phil