Hi,

A couple of weeks ago I posted a patch to GDB adding support to the 
Linux backend for user space threads such as qemu's coroutines:

https://sourceware.org/pipermail/gdb-patches/2024-September/212028.html

Within the patch is an example of how to maintain data structures within 
userspace for GDB's custom libthread_db.so backend to parse, and indeed 
the creation of a custom libthread_db.so.

In our codebase here, we measure approx a 3 nanosecond overhead added to 
context switching using setjmp/longjmp. If one uses a faster 
implementation such as Boost.Context, 5 nanoseconds is added. This is 
probably low enough it can be left turned on even in release binaries.

With a suitable GDB, a suitable custom libthread_db.so and an inferior 
emitting the right data structures, qemu coroutines would appear in 
GDB's `info threads`. You can switch into their currently suspended 
state, examine their backtraces and current local variables etc.

I'll stay subscribed here for a few weeks in case anybody has any 
questions, but I figured you guys might find this support as useful as 
we have so I ought to let you know of its existence.

Regards,
Niall Douglas


Reply via email to