[RFC 0/5] New proc_service functionality for Infinity

Gary Benson gbenson@redhat.com
Thu Jun 8 09:15:00 GMT 2017


Hi all,

Infinity is a platform-independent system for executables and shared
libraries to expose functionality to debug, monitoring, and analysis
tooling.  Executable and shared library files contain platform-
independent debugging functions that tools like GDB can load and
execute.

I've written a prototype libthread_db that uses Infinity functions.
Implementation-specific details such as structure offsets and other
constants are held with the implementation (specifically, in
libpthread.so and ld.so) which means that one libthread_db.so can
support any correctly-annotated system, regardless of architecture
or operating system, and without recompilation.  You can, for example,
debug a core file from an aarch64 system running Debian on your
x86_64 laptop that's running Fedora.  You can try this out right now,
there's instructions at:

  https://infinitynotes.org/wiki/Third_Eye

This series adds proc_service functionality that the Infinity
libthread_db.so needs.  The series isn't polished, but I'm mailing
it now to get feedback on the two new proc_service functions I'm
proposing in patch 4.  Specifically I'd like feedback on the API,
I'd like to know it's going to be acceptable and make any required
changes now.

The things Infinity needs that the existing proc_service API doesn't
provide are:

 1) The ability to get the contents of a registers in a cross-platform
    environment.  proc_service has ps_lgetregs, but it's not suitable.
    proc_service has no way to determine the inferior's architecture,
    so there's no way to determine the size of the register set you're
    going to get, and no way to determine where in that register set
    the register values you want are.  I've handled this by adding
    ps_get_register, which returns the contents of a single register,
    referenced by its DWARF register number.

 2) The ability to fetch .note.infinity sections from the inferior's
    executable and shared libraries.  With proc_service as it stands,
    you can sort of find the binaries in some cases, but you can't
    find them in all cases GDB supports: if they're in a sysroot, for
    example.  The only way I could think of to reliably solve this in
    all cases GDB supports is to have GDB extract the sections itself
    and supply them to the library via a callback.  It's further
    complicated by the fact that .note.infinity sections contain
    addresses that require relocation.  I've handled this with the
    ps_foreach_infinity_note function.  I'm not 100% happy with how
    complex this part of the API is, but I can't see a simpler way :/

Thanks,
Gary

--
https://infinitynotes.org/



More information about the Gdb-patches mailing list