<html>
<head>
<base href="https://bugs.llvm.org/">
</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 - Expression evaluation causes inferior crash on ARM32 remote target"
href="https://bugs.llvm.org/show_bug.cgi?id=45380">45380</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Expression evaluation causes inferior crash on ARM32 remote target
</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>Windows NT
</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>emrekultursay@google.com
</td>
</tr>
<tr>
<th>CC</th>
<td>jdevlieghere@apple.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>When debugging armeabi-v7a Android device, the call to process->CanJIT() at
UserExpression.cpp:190 eventually causes the inferior to crash:
190: if (process == nullptr || !process->CanJIT())
191: execution_policy = eExecutionPolicyNever;
AFAIU, LLDB tries to allocate memory on the inferior by calling mmap().
However, this mmap() execution triggers:
Fatal signal 11 (SIGSEGV), code 2 (SEGV_ACCERR),
fault addr 0xadc42fe6 in tid 25574
(xample.app32bit), pid 25574 (xample.app32bit)
The 0xadc42fe6 address in this error message falls inside the `r--p` section of
the `app_process32` binary, and trying to execute (or write) to that location
would trigger such a crash.
Repro Instructions:
1. Download Android Studio (3.5 through 4.1). (This is probably much easier
than manually setting up remote-android LLDB connections)
2. In Android Studio, create new project and select "Native C++ Activity" from
the wizard.
3. Set a breakpoint at native-lib.cpp:9
4. Modify app/build.gradle, and add the following:
defaultConfig { ndk { abiFilters = ["armeabi-v7a"] } }
so that you build 32-bit ARM only.
5. Hit Debug while targeting an ARM Android device (I tried only with 64-bit
devices).
6. When the breakpoint hits, open the LLDB console and type p hello to trigger
the crash.
How I debugged this issue so far:
// I'm on Windows 10 with Visual Studio
1. Build your own liblldb.dll with symbols
2. Put your DLL and symbols to $INSTALL\Android Studio 4.1 Canary
4\bin\lldb\bin while overwriting the existing liblldb.dll file there.
3. When the breakpoint hits, before you type (p hello) expression, attach to
the existing LLDBFrontend process (which had loaded liblldb.dll library).</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>