bgamari / ghc-debug

Moved to Haskell.org GitLab.
https://gitlab.haskell.org/ghc/ghc-debug
62 stars 10 forks source link

Work out how to use DWARF information #11

Open mpickering opened 5 years ago

mpickering commented 5 years ago

I have tried to read DWARF information from the binary using dwarfadt so we can map an address to a line number.

I need to work out how list * in gdb works. Does it use the .debug_line section?

My first attempt was to try to find the subprogram recursively (which worked) but then it lacked location information.

mpickering commented 5 years ago

I added support for parsing .debug_line to dwarf and now we get line numbers as well.

The remaining issues are about how to upstream the changes to dwarf as I also had to remove some unnecessary dependencies (text-show and lens)

mpickering commented 5 years ago
mpickering commented 5 years ago

I added a small patch this evening which prints out the portion of the source file the dwarf information points to, like how list * works in gdb.

mpickering commented 5 years ago

The lookup logic is wrong somewhere. The info table pointer looks correct but I get a different result to list *.

mpickering commented 5 years ago

Looking at the debug_line dump all the addresses look quite wrong so not sure what's happening here.

mpickering commented 5 years ago

I fixed the upstream libraries, and the changes are merged in but need to wait for a new release so we can remove the submodules.