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 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. 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