https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99215
--- Comment #3 from Iain Sandoe <iains at gcc dot gnu.org> --- (In reply to Nils Gladitz from comment #2) > (In reply to Iain Sandoe from comment #1) > > Can you identify specific key blockers to progress? > > (I think the paper cited contained a number of desiderata, but it would be > > good to start from the most important requirements). > As you and the paper have stated setting breakpoints so far seems to work > fine for me. great (there could still be room for improvement, so if you see something that doesn't work, worth filing a PR). > What stands out most for me is being unable to inspect parameters (which for > the debugger don't seem to exist) and local variables (their names seem to > be known but their values all show as "<optimized out>"). > > On second look this seems to be only half true as I seem to be able to > inspect both local variables and parameters via the debugger visible > "frame_ptr" variable. That is correct, both parameters and local variables are moved into the coroutine frame, but there is nothing telling the debugger that this happened... (there are also a bunch of artificial vars created in the frame to carry state that must persist across suspension points). The only debugger support I think is for MSVC - and they mentioned that it was useful to know the suspension point index - one of the artificial values, (but I don't think that there's any agreed way to represent that - certainly, nothing formal in DWARF). > Not straightforward and names seem to be mangled but that might suffice to > get started to some degree; won't work with gdb frontends though (which I > have been using). > > I have no idea of how any of this is actually implemented but I am hoping > this is just a matter of emitting debug information that tells gdb to look > for members and parameters in the corresponding frame_ptr locations? ... the essence of the idea [on the mentioned long TODO] is to change the way in which frame vars are referenced; instead of changing the uses to point to the frame version, change the vars to have a DECL_VALUE_EXPR pointing to the frame version. This is a totally theoretical sketch (no experiments done yet). Stated in one sentence, that doesn't sound too tricky .. but maintaining the state of the coroutine *is* quite tricky (and lambdas already use the DECL_VALUE_EXPRs).