Hadrian: debug rts not built with -g3 -O0 (as in make)
The debug rts needs to be built with -O0 -g3.
See https://gitlab.haskell.org/ghc/ghc/blob/master/rts/ghc.mk#L157
In hadrian this logic is implemented in rtsPackageArgs. However, -O2 is always used to build the RTS (apparently because of https://github.com/snowleopard/hadrian/issues/90) but Make managed to build it fine with -O0. It also builds fine for me locally with -O0.
In general rtsPackageFlags could be cleaned up a bit as there is a lot of duplicate flags passed which are also generated in the compileC function. It took me a while to work out which exact flags I had to change to get the changes at the end of the command line.