<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Add frame-finish breakpoints"
   href="https://llvm.org/bugs/show_bug.cgi?id=28910">28910</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Add frame-finish breakpoints
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>lldb
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.8
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>All Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>lldb-dev@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>christian.convey@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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:
<a href="http://lists.llvm.org/pipermail/lldb-dev/2016-August/010865.html">http://lists.llvm.org/pipermail/lldb-dev/2016-August/010865.html</a> , 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.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>