Skip to content

Debugging GHC+HDB #350

Description

@Saizan

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:

  • initUniqSupply will reset the Unique counter for both the debugger and the debuggee: no longer called when starting a session but it's called from main, should not be called by the debuggee because it'd run while a runGhc session is active.
  • FastStringTable representation 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.
  • host constants like 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.
  • Make sure all of debugger and debuggee versions of ghc and hdb are built the same way since they'll be sharing an RTS. (Not exactly true because of the external interpreter, but we generally have just one hdb executable that we run both as host and interpreter.)
  • See rts/include/rts/Globals.h, compiler/GHC/Utils/GlobalVars.hs, and rts/include/Rts.h for more that might be relevant.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions