<div dir="ltr"><div>On linux, we allocate memory by setting up the inferior registers to appear as if the inferior called mmap(2) upon resume. This is done in InferiorCallMmap. You should check whether this function sets up the context correctly. Things to look at are:</div><div>- did it find the mmap address correctly?</div><div>- are the mmap flags correct</div><div>- is ABI correct (did it put the flags in the right registers)</div><div>- after mmap returns, it should jump to the process entry point (where we have placed a breakpoint). Does this happen?</div><div>- do you correctly restore the original registers afterwards</div><div><br></div><div>Looking at the gdb-remote packet log should give you some insight there. If you can send the relevant parts over, I can give you a rough answer as to how far along did it progress before things broke down.</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 5 December 2017 at 11:54, Alexandre Yukio Yamashita via lldb-dev <span dir="ltr"><<a href="mailto:lldb-dev@lists.llvm.org" target="_blank">lldb-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
<p>Hi,<br>
<br>
I am trying to implement the expression evaluation for PPC64le using JIT.<br>
But the LLDB is failling to allocate memory when it tries to evaluate an expression.<br>
A Thread Plan is being interrupted before LLDB tries to allocate memory.<br>
How could I check why this plan is not finishing?<br>
What functions should I implement to enable JIT?<br>
I am sending the logs of the issue below.<br>
<br>
Thanks.<br>
Alexandre.<br>
</p>
<span class="HOEnZb"><font color="#888888">
</font></span><span class="HOEnZb"><font color="#888888">
</font></span><span class="HOEnZb"><font color="#888888">
</font></span><table cellspacing="2" cellpadding="2" width="100%" border="1">
<tbody>
<tr>
<td valign="top"><font size="-1">lldb 0x10013069c10: tid = 0x976: stop info = breakpoint 1.1 (stop_id = 4)<br>
lldb Process::RunThreadPlan(): execution interrupted: 0x3fff70006ac0 Event: broadcaster = 0x100130167b8 (lldb.process), type = 0x00000001 (state-changed), data = { process = 0x10013016780 (pid = 2422), state = stopped} <1 threads> <0x0976 [ip 0x1000058c]
breakpoint 1.1><br>
lldb Process::RunThreadPlan: ExecutionInterrupted - discarding thread plans up to 0x10013076210.<br>
lldb Discarding thread plans for thread tid = 0x0976, up to 0x10013076210<br>
lldb 0x10013025c10 Broadcaster("lldb.process")::<wbr>RestoreBroadcaster (about to pop listener("lldb.process.<wbr>listener.run-thread-plan")=<wbr>0x10012f85810)<br>
lldb 0x10012f85810 Listener::Clear('lldb.process.<wbr>listener.run-thread-plan')<br>
lldb 0x10012f85810 Listener::~Listener('lldb.<wbr>process.listener.run-thread-<wbr>plan')<br>
lldb ThreadPlanCallFunction(<wbr>0x10013076210): DoTakedown called as no-op for thread 0x0976, m_valid: 1 complete: 1.<br>
<br>
lldb Target::RemoveBreakpointByID (break_id = -3, internal = yes)<br>
<br>
lldb Target::DisableBreakpointByID (break_id = -3, internal = yes)<br>
<br>
lldb GDBRemoteCommunicationClient::<wbr>SendGDBStoppointTypePacket() remove at addr = 0x100003d0<br>
lldb 0x10013017168 Communication::Write (src = 0x10012e7d318, src_len = 17) connection = 0x1001302e610<br>
lldb 0x1001302e610 ConnectionFileDescriptor::<wbr>Write (src = 0x10012e7d318, src_len = 17)<br>
lldb 0x1001302e610 ConnectionFileDescriptor::<wbr>Write(fd = 7, src = 0x10012e7d318, src_len = 17) => 17 (error = (null))<br>
lldb this = 0x0000010013017168, dst = 0x00003FFFED125FC8, dst_len = 8192, timeout = 99999999000000 us, connection = 0x000001001302E610<br>
lldb this = 0x000001001302E610, timeout = 99999999000000 us<br>
lldb 0x1001302e610 ConnectionFileDescriptor::<wbr>Read() fd = 7, dst = 0x3fffed125fc8, dst_len = 8192) => 6, error = (null)<br>
lldb ProcessGDBRemote::<wbr>DoAllocateMemory no direct stub support for memory allocation, and InferiorCallMmap also failed - is stub missing register context save/restore capability?<br>
lldb Process::DoAllocateMemory (byte_size = 0x00001000, permissions = rwx) => 0xffffffffffffffff<br>
lldb AllocatedMemoryCache::<wbr>AllocateMemory (byte_size = 0x00000008, permissions = rwx) => 0xffffffffffffffff<br>
lldb Process::CanJIT pid 2422 allocation test failed, CanJIT () is false: unable to allocate 4096 bytes of memory with permissions rwx<br>
lldb AllocatedMemoryCache::<wbr>DeallocateMemory (addr = 0xffffffffffffffff) => 0</font><span class="HOEnZb"><font color="#888888"><br>
</font></span></td></tr></tbody></table><span class="HOEnZb"><font color="#888888">
<p><br>
</p>
<div class="m_4900499885226493257moz-signature">-- <br>
Alexandre Yukio Yamashita (DSB) <br>
Instituto de Pesquisas Eldorado <br>
<a href="http://www.eldorado.org.br/" title="Eldorado" target="_blank">www.eldorado.org.br</a><br>
<a href="tel:+55%2019%203757-3201" value="+551937573201" target="_blank">+55 19 3757 3201</a> / +55 19 9 8336 5553 <br>
</div>
</font></span></div>
<br>______________________________<wbr>_________________<br>
lldb-dev mailing list<br>
<a href="mailto:lldb-dev@lists.llvm.org">lldb-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/lldb-dev</a><br>
<br></blockquote></div><br></div>