Better DWARF info for Cmm procedures?

Ömer Sinan Ağacan omeragacan at gmail.com
Sun Jan 6 06:17:44 UTC 2019


Hi,

Currently debugging Cmm is a bit painful because we don't have enough debug
information to map assembly to Cmm lines, so I have do the mapping manually.
However I realized that when building .cmm files we actually generates some
debug information, in form of "ticks":

    //tick src<rts/Apply.cmm:631:9-37>
    _c2e::I64 = I64[R1 + 32];

Here the tick says that this assignment is for this Cmm line in Apply.cmm:

    Words = StgAP_STACK_size(ap);

I was wondering what needs to be done to generate DWARF information from those
so that gdb can show Cmm line we're executing, and gdb commands like `next`,
`break` etc. work.

I also realize that we don't consistently generate these ticks for all Cmm
lines, for example, in the same Cmm dump there isn't a tick before this line:

    (_c2j::I64) = call MO_Cmpxchg W64(R1, stg_AP_STACK_info,
stg_WHITEHOLE_info);

It's actually for Apply.cmm:646.

So there are two problems:

- Generate ticks for _all_ Cmm lines
- Generate DWARF information from those so that gdb can show current Cmm line,
  and commands like `next` and `break` work.

Anyone know how hard would this be to implement? I'm wondering if we could turn
this into a SoC project. It's a very well defined task, and given that we have
some DWARF support already, perhaps it's not too hard for a SoC.

Ömer


More information about the ghc-devs mailing list