Objects loaded via the RTS linker do not expose symbols to GDB
When the RTS linker is used to load objects and archives, any debugging information produced by -g
is necessarily invisible to GDB. Loading the symbols from the archive manually does not help because only GHC knows the address the objects are ultimately loaded at.
It seems possible to dynamically expose these symbols to GDB using its JIT interface. However, I am not sure how difficult this would be to use in practice, as I don’t currently understand the way the RTS linker works.
On platforms where ghc
is dynamically linked by default (which I believe is everywhere except Windows), this is probably not a big deal, since GHC just uses dlopen
on those platforms. Since -g
is currently only supported on Linux, this doesn’t seem like a particularly big problem. However, when developing GHC, I am often using a statically-linked GHC, and sometimes I even run into cases where I can only trigger a bug with GHC statically linked. (Such a case is what prompted me to open this issue.) So it would be very nice to be able to have debugging symbols in that configuration.