<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 --- - LLDB-Server Assertion raised when single stepping on MIPS"
   href="https://llvm.org/bugs/show_bug.cgi?id=25194">25194</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>LLDB-Server Assertion raised when single stepping on MIPS
          </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>aidan@codeplay.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>When using LLDB-Server on the Android Mips32 emulator and assertion is raised
when performing a single step.  The sample program attached can be used to
reproduce this problem.

The sample program was compiled using the mips toolchain from the Android NDK,
specificaly: gcc version 4.9 20140827 (prerelease) (GCC).
The binary was compiled at -O0 with debug info.

The test case is as follows:

<main.cpp>
#include <stdio.h>
#include <unistd.h>

static volatile bool e = true;

int main() {

    printf("hello world!\n");

    while (e) {
        usleep(1);
    }

    printf( "exiting...\n" );
    return 0;
}
</main.cpp>

If I place a breakpoint on line 11 (usleep) and then inside of usleep for 10
instructions or so, the following occurs.

1|root@generic_mips:/data # ./lldb-server-3.8.0-s g *:1234 -- test             
using the default platform: host
Launched 'test' as process 963...
lldb-server-local_buildListening to port 1234 for a connection from *...
Connection established.
/home/aidan/rs/llvm/tools/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp:1640:
lldb_private::Error
lldb_private::process_linux::NativeProcessLinux::SetupSoftwareSingleStepping(lldb_private::process_linux::NativeThreadLinux&):
assertion "pc_it != baton.m_register_values.end() && "Emulation was successfull
but PC wasn't updated"" failed
Aborted 

>From the perspective of lldb server I see this:

(lldb) s
Process 963 stopped
* thread #1: tid = 963, 0x77d35748, name = 'test', stop reason = instruction
step into
    frame #0: 0x77d35748
->  0x77d35748: addiu  $sp, $sp, -40
    0x77d3574c: addiu  $7, $6, 16960
    0x77d35750: mfhi   $5
    0x77d35754: sw     $ra, 36($sp)
(lldb) s
Process 963 exited with status = -1 (0xffffffff) lost connection

I have seen the same assersion fire up when single stepping in a more
complicated scenario.

My version of LLDB was build from the upstream git mirror from commit:
adb9afc13ea113e2daeed6c739ecc2d52e2fd7d7

I have attached the source code for the sample, and a copy of my compiled
binary.</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>