On Tue, Mar 19, 2019 at 9:38 PM Justin Paston-Cooper <paston.coo...@gmail.com> wrote: > > Hello, > > In my message https://sourceware.org/ml/gdb/2019-03/msg00042.html to > the gdb mailing list, I asked whether it would be possible to > implement a command which breaks at all exit points of the current > stack frame. This would be very useful for evaluating a function's > final state before it returns its result, independent of where in its > definition it returns from. > > Tom Tromey suggested in that thread that this would be quite easy on > gdb's side if gcc indicates exit locations in the DWARF data, for
Did he indicate _how_ to represent this in DWARF? I suppose the breakpoint should happen before the local frame is teared down. > instance in the C case, it would indicate the locations of return > statements. On a related note, he mentions that the "finish" command > does not work for inlined functions because the compiler does not emit > the required information. While "finish" wants a location at the caller side, after the inlined frame is teared down. So they are somewhat distinct. Can you open two enhancement requests in buzilla? Thanks, Richard. > It would be nice if this new break on exit command worked both for > inlined functions, and also the case of breaking after tail-recursions > exit. With a single stone, the "finish" bird above is also killed. > Would it be feasible to implement such a feature in gcc? If I'm not > the first person to ask for this, are there any architectural or > practical reasons as to why it might not be possible to implement? As > it stands, I don't have the level of familiarity with gcc to come to > you with a patch, but with guidance I would certainly be interested in > working on the C/C++ case if that would be useful. > > Thanks, > > Justin