<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 --- - SBThread::StepOut erases stack frames and doesn't set return value"
   href="https://llvm.org/bugs/show_bug.cgi?id=25111">25111</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>SBThread::StepOut erases stack frames and doesn't set return value
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>unspecified
          </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>normal
          </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>berykubik@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>Created <span class=""><a href="attachment.cgi?id=15035" name="attach_15035" title="C++ source with a simple function that returns a value">attachment 15035</a> <a href="attachment.cgi?id=15035&action=edit" title="C++ source with a simple function that returns a value">[details]</a></span>
C++ source with a simple function that returns a value

SBThread::StepOut doesn't seem to work for me on lldb 3.8 compiled from trunk.
When I use it, the thread loses it's stack frames (len(thread.frames) == 0) and
the return_value attribute doesn't get set. What is curious though, that when I
print the thread, it's description contains both the stack frame and the return
value (in text form). I've attached a simple C++ program that demonstrates
this. I've compiled it with -g, -O0 and even -fno-inline-small-functions, so
the function should not be inlined.

import lldb
import os
import time

debugger = lldb.SBDebugger.Create()
target = debugger.CreateTarget("./test")
target.BreakpointCreateByLocation("test.cpp", 3)
process = target.LaunchSimple([], [], os.getcwd())

time.sleep(2) # wait for BP to be hit

thread = process.GetSelectedThread()
thread.StepOut()

time.sleep(2) # wait for step out to complete

value = thread.GetStopReturnValue() # No value</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>