How does the dynamic loader (libdl) hook in to gdb?

dufault at hda.com dufault at hda.com
Wed Jan 22 23:06:18 UTC 2020



> On Jan 21, 2020, at 15:59 , dufault at hda.com wrote:
> 
> - I've modified "libdl" to generate a report of the sections that GDB expects to receive in response the that query.  It's almost what is present to support the special RTEMS target stub, but you've collapsed the number of sections reported.  The stub needs to report sections such as (something like) ".rdonly-rela" in addition to ".rdonly" (sorry, not looking at the code).  This was straight-forward.

The actual output of my XML library reporter that is sent to GDB (after loading only the SLAC gdb stub) is:

<library-list>
  <library name="rtems_gdb_stub">
    <section address="0x12c1888"> <!-- .text         --> </section>
    <section address="0x12cd590"> <!-- .rodata       --> </section>
    <section address="0x12cfd54"> <!-- .rodata.str1.4 --> </section>
    <section address="0x12d0418"> <!-- .data         --> </section>
    <section address="0x12d050c"> <!-- .ctors        --> </section>
    <section address="0x12d0510"> <!-- .dtors        --> </section>
    <section address="0x12d0528"> <!-- .bss          --> </section>
  </library>
</library-list>

The "rela" sections I mentioned are actually the ones that are dropped, not added, and sections such as ".rodata.str1.4" are being collapsed into ".rodata" but need to be reported.  It's the same with ".ctors" and ".dtors", they need to be reported separately.

I'm still having some problems and I'll follow up when it's working.  I want to avoid patching GDB except for patches to make GDB support doing this without adding target specific code.  Target specific code *can't* be required for this since I can cut-and-paste "add-symbol-file" auto-generated output from the SLAC/RTEMS gdb-stub into generic GDB and then everything works.

Peter
-----------------
Peter Dufault
HD Associates, Inc.      Software and System Engineering

This email is delivered through the public internet using protocols subject to interception and tampering.



More information about the devel mailing list