Re: GDB process (on Linux) cooperating with the debugged process (some particular pthread on it)

Andrew Burgess via Gdb <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <[email protected]>
Basile Starynkevitch <[email protected]> writes:

> On Thu, 2025-05-15 at 12:04 +0100, Andrew Burgess via Gdb wrote:
>> Basile Starynkevitch <[email protected]> writes:
>> 
>> > Hello all,
>> > 
>> > Is it possible for the debugged process (for me the RefPerSys inference
>> > engine,
>> > GPL licensed, see below) which has several threads to send GDB commands or
>> > interact with the debugger process.
>> 
>> I'm not aware of any existing, general technique for having the debuggee
>> send commands to the debugger.  There is some limited support for JIT
>> like processes to allow the process to give GDB debug information for
>> the dynamically generated code, but nothing beyond that.
>
> Thanks. Do you mind explaining how that works? or in what GDB source files does
> that happen?

Start by reading:

 https://sourceware.org/gdb/current/onlinedocs/gdb.html/JIT-Interface.html#JIT-Interface

Though the documentation isn't great, I think it could be improved with
some examples maybe.  But you can find some example code in the
testsuite, look in gdb/testsuite/gdb.base/ and read through any of the
files starting with 'jit-'.

In GDB source the entry point for jit handling is in jit.c, but if your
interest is being a user then hopefully the docs should be enough.

Thanks,
Andrew
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.