[lldb-dev] Infinity full-system preview

Gary Benson via lldb-dev lldb-dev at lists.llvm.org
Mon Jun 13 04:43:01 PDT 2016


Hi all,

I've been working on a platform-independent system for executables and
shared libraries to expose functionality to debug, monitoring, and
analysis tooling.  It's called Infinity.  I'm writing it to solve some
problems GDB has, but these are likely problems LLDB has too so I'd
like to make what I write suitable for you to use too.

The initial use case is to allow GDB to debug multithreaded inferiors
without libthread_db, a requirement which causes problems with
debugging inferiors in containers and makes it difficult to debug core
files from one platform with a debugger on another (e.g. debugging an
aarch64 core on your x86_64 workstation).  If Infinity proves
acceptable to the glibc community then it's likely this stuff will be
added to glibc to allow debuggers to support dlmopen too, and I'm
hoping the OpenMP community will get on board too (they are currently
proposing another libthread_db-style interface).

Rather than requiring a plugin library that the debugger loads, in
Infinity debug functions are shipped as DWARF bytecode in the actual
library they are for, so, e.g., the notes implementing what
libthread_db.so currently implements live in libpthread.so.  The idea
is that the debugger keeps a track of the notes it finds in the
executables and libraries it loads, and when complete sets arrive it
enables that particular subsystem.  So, when the notes needed to
support multithreaded inferiors appear then thread debugging switches
on.  This works regardless of whether the notes came from a library
(libpthread.so) or from the main executable (-static -pthread).

What exists so far?

 * Enough notes for GDB to attach to a process (or load a core file)
   and do "info threads".
 * An LGPLv2.1 client library to process and execute those notes.

The final plan is for GDB to directly call the client library
functions, but to allow people to see how this all works I've put
together a shim libthread_db.so that loads notes from the inferior
and uses the client library to execute them.  If you'd like to try
this out there are instructions here:

  https://infinitynotes.org/wiki/First_Flight

The code in the libthread_db shim is something like what would need
adding to LLDB, minus the ELF parsing which LLDB presumably already
handles.  For gdbserver there will be some remote protocol changes;
gdbserver does not parse ELF, so GDB will have to extract the notes
and pass them over the wire somehow.  I don't know if lldbserver
handles ELF parsing or not, but if it doesn't I'd like to collaborate
to make sure that the gdbserver remote protocol changes are suitable
for lldbserver too so we're talking the same language.

Infinity's mailing list is infinity at sourceware.org, so please
subscribe if you're interested (by sending an empty message to
infinity-subsribe@).

Thanks,
Gary

-- 
https://infinitynotes.org/


More information about the lldb-dev mailing list