The current setup to debug GHC+HDB can work but is fragile, i.e. weird errors and segfaults are not uncommon.
Turns out we have to be quite mindful of the global symbols exposed by the RTS, because those will be shared by every ghc library loaded in the same process.
Known issues:
The current setup to debug GHC+HDB can work but is fragile, i.e. weird errors and segfaults are not uncommon.
Turns out we have to be quite mindful of the global symbols exposed by the RTS, because those will be shared by every
ghclibrary loaded in the same process.Known issues:
initUniqSupplywill reset the Unique counter for both the debugger and the debuggee: no longer called when starting a session but it's called frommain, should not be called by the debuggee because it'd run while arunGhcsession is active.FastStringTablerepresentation must match. UNPACK pragmas are noops with -O0 afaict, so we have to make sure to set the right optimization level, otherwise the debuggee ghc will expect indirections and find inlined data and vice versa for the debugger.hostIsDynamic(sp?) are also globals, and HDB code does check them. Here the globals might just be doing the right thing, but we should check.ghcandhdbare built the samewaysince they'll be sharing an RTS. (Not exactly true because of the external interpreter, but we generally have just onehdbexecutable that we run both as host and interpreter.)rts/include/rts/Globals.h,compiler/GHC/Utils/GlobalVars.hs, andrts/include/Rts.hfor more that might be relevant.