Bug ID 28910
Summary Add frame-finish breakpoints
Component All Bugs
It would be helpful for LLDB's Python API to provide a notification when a particular frame of interest is no longer on the call stack. The motivating use-case is a script which performs per-function-activation analysis, and needs to perform book-keeping when the function of interest is both activated and completed. These features in particular would be great: (a) Users have a reliable mechanism to correlate the activation and completion of each frame. (b) Sometimes a frame is completed not because it executed a "return" statement, but because of a C++ exception or a call to "longjmp". In these cases, it would be very helpful if the notification still occurred. Ideally the notification would occur before another call was made, on that same thread, to the function of interest. But it would still be useful if the notifications were deferred until the overall thread completed execution. (c) Performance is better than what one would get by having a script single-step through the inferior's execution, examining the state of the call stack after each step. RELATED WORK: (1) In a discussion on llvm-dev: [http://lists.llvm.org/pipermail/lldb-dev/2016-August/010865.html](http://lists.llvm.org/pipermail/lldb-dev/2016-August/010865.html) , Jim Ingham provided a Python class which approximates the desired behavior. Casual testing on be a novice LLDB user (me) seems to show that his approach works for normal return paths, but does not detect frame-completions arising from "longjump" calls, as described above. The effect of C++ exceptions were not tested. (2) The lldb command "thread step-out" seems to behave similarly to (1) in the presence / absence of "longjmp" calls. (3) GDB provides a "finish" command, which attempts to resume execution (approximately) until the currently selected stack frame is complete. That gdb command seems equivalent to creating a 'gdb.FinishBreakpoint' object in gdb's Python API. Testing seems to show that 'gdb.FinishBreakpoint' objects do eventually get triggered even when a "longjmp" occurred, but perhaps not until the next time that thread's execution is paused.