[lldb-dev] Infinity full-system preview

2016-06-13 Thread Gary Benson via lldb-dev
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 infin...@sourceware.org, so please
subscribe if you're interested (by sending an empty message to
infinity-subsribe@).

Thanks,
Gary

-- 
https://infinitynotes.org/
___
lldb-dev mailing list
lldb-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev


[lldb-dev] Infinity

2015-10-20 Thread Gary Benson via lldb-dev
Hi all,

I've been working on a platform-independent system for executables and
shared libraries to export information to debuggers and other software
development tools.  It's called Infinity.  The initial use case was to
allow GDB to debug multithreaded inferiors without requiring
libthread_db, but if that all works 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.  So, I'm sending this email so
it doesn't come as a complete surprise.

The idea is basically that, rather than requiring a plugin library
that the debugger loads, in Infinity inspection functions are shipped
as DWARF bytecode in ELF notes in the actual library they are for, so,
e.g., the notes implementing what libthread_db.so currently implements
will 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.

I just mailed an RFC to the glibc list with notes implementing
map_lwp2thr function to get some feedback.  The series starts here:

  https://sourceware.org/ml/libc-alpha/2015-10/msg00690.html

This series is to build the notes, not to execute them--it's nothing
to do with debuggers--so it should be ok to look without fear of
having seen LGPL code you can't then implement.  IANAL though :)

I'm currently documenting the system on the GDB wiki, starting here:

  https://sourceware.org/gdb/wiki/Infinity

That won't be its final home, it's just somewhere convenient for now.
The documentation is by no means complete but I'll be filling it in
over the next few days, and most of the important concepts have at
least placeholder pages so if you subscribe to those you'll get emails
as I write.

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

Cheers,
Gary

-- 
http://gbenson.net/
___
lldb-dev mailing list
lldb-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev