Hadrian build with DWARF information doesn't contain as much debug information as I would expect
Matthew Pickering
matthewtpickering at gmail.com
Sun May 3 07:55:58 UTC 2020
Thanks Adam for the tip about dynamic linking, as always.
He was right that the debug information was in the relevant .so files
and that when I statically linked GHC the information was included (as
with cabal). The issue was my program which read the dwarf information
did not work properly for dynamically linked executables (and still
doesn't, I wonder how gdb knows which shared objects to load and what
addresses to use).
Cheers,
Matt
On Sun, May 3, 2020 at 8:20 AM Adam Sandberg Eriksson
<adam at sandbergericsson.se> wrote:
>
> I don't know how you read the DWARF info but maybe it's missing info from dynamic libraries? If your GHC is dynamically linked the library DWARF info might be available in their respective .so's.
>
> Cheers,
> Adam Sandberg Eriksson
>
> On Sat, 2 May 2020, at 23:08, Matthew Pickering wrote:
> > I followed the instructions on the wiki to enable debug symbols in my
> > build of GHC.
> > (https://gitlab.haskell.org/ghc/ghc/-/wikis/building/hadrian#enabling-dwarf-debug-symbols)
> >
> > So I added these flags to may hadrian.settings file
> >
> > stage1.*.ghc.hs.opts += -g3
> > stage1.*.cabal.configure.opts += --disable-library-stripping
> > --disable-executable-stripping
> > stage1.ghc-bin.ghc.link.opts += -eventlog
> >
> > The resulting executable has debug information in it for the
> > executable component but not for any of the libraries in including the
> > compiler library.
> >
> > ("../sysdeps/x86_64/start.S",Just 4414944,Just 4414987,139633489318136)
> > ("init.c",Nothing,Nothing,139633489318136)
> > ("../sysdeps/x86_64/crti.S",Nothing,Nothing,139633489318136)
> > ("ghc/Main.hs",Just 4415312,Just 4615455,139633489318136)
> > ("ghc/GHCi/Leak.hs",Just 4615480,Just 4623414,139633489318136)
> > ("ghc/GHCi/UI.hs",Just 4623440,Just 5461990,139633489318136)
> > ("ghc/GHCi/UI/Info.hs",Just 5461992,Just 5571230,139633489318136)
> > ("ghc/GHCi/UI/Monad.hs",Just 5571232,Just 5679695,139633489318136)
> > ("ghc/GHCi/UI/Tags.hs",Just 5679696,Just 5704775,139633489318136)
> > ("ghc/GHCi/Util.hs",Just 24,Just 173,139633489318136)
> > ("../sysdeps/x86_64/crtn.S",Nothing,Nothing,139633489318136)
> >
> > I tried building a project with cabal and the resulting executable had
> > debug information for every file in the dependencies as well as the
> > main project.
> >
> > So how do I convince hadrian to include the correct information? Is it
> > a bug in hadrian?
> >
> > I checked the command line when building the library and `-g3` is passed.
> >
> > Cheers,
> >
> > Matt
> > _______________________________________________
> > ghc-devs mailing list
> > ghc-devs at haskell.org
> > http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
> >
More information about the ghc-devs
mailing list