Next: , Previous: File-I/O Remote Protocol Extension, Up: Remote Protocol


D.12 Library List Format

On some platforms, a dynamic loader (e.g. ld.so) runs in the same process as your application to manage libraries. In this case, gdb can use the loader's symbol table and normal memory operations to maintain a list of shared libraries. On other platforms, the operating system manages loaded libraries. gdb can not retrieve the list of currently loaded libraries through memory operations, so it uses the `qXfer:libraries:read' packet (see qXfer library list read) instead. The remote stub queries the target's operating system and reports which libraries are loaded.

The `qXfer:libraries:read' packet returns an XML document which lists loaded libraries and their offsets. Each library has an associated name and one or more segment base addresses, which report where the library was loaded in memory. The segment bases are start addresses, not relocation offsets; they do not depend on the library's link-time base addresses.

gdb must be linked with the Expat library to support XML library lists. See Expat.

A simple memory map, with one loaded library relocated by a single offset, looks like this:

     <library-list>
       <library name="/lib/libc.so.6">
         <segment address="0x10000000"/>
       </library>
     </library-list>

The format of a library list is described by this DTD:

     <!-- library-list: Root element with versioning -->
     <!ELEMENT library-list  (library)*>
     <!ATTLIST library-list  version CDATA   #FIXED  "1.0">
     <!ELEMENT library       (segment)*>
     <!ATTLIST library       name    CDATA   #REQUIRED>
     <!ELEMENT segment       EMPTY>
     <!ATTLIST segment       address CDATA   #REQUIRED>