<p dir="ltr">This is excellent news. I assume your refer to the Python script i posted in [1]. That was a port of our production code to illustrate issues with high frequency process suspends/resumes in conjunction with tracing steps/breakpoints. </p>
<p dir="ltr">If reading from the inferiors memory while the process is running works, then that issues will vanish.</p>
<p dir="ltr">We are targeting Mac OS X and iOS, both of which use debugserver and hence GDBProcess afaik. Does GDBProcess support reading memory while the process is running?</p>
<p dir="ltr">Thanks,<br>
Mario</p>
<p dir="ltr">[1] <a href="http://lists.cs.uiuc.edu/pipermail/lldb-dev/2014-December/006138.html">http://lists.cs.uiuc.edu/pipermail/lldb-dev/2014-December/006138.html</a></p>
<div class="gmail_quote">On Jan 6, 2015 11:08 PM, "Greg Clayton" <<a href="mailto:gclayton@apple.com">gclayton@apple.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">It is fine to not require that a process be stopped in order to read memory. Are you still doing your python based approach? We are currently enforcing that a process must be stopped in order to read memory in SBProcess::ReadMemory() where we acquire the run lock and make sure the process stays stopped. This can be changed, but we will probably need to add code the lldb_private::Process that asks the current process if it can handle reading memory while running.<br>
<br>
So the code would need to go from this:<br>
<br>
if (process_sp)<br>
{<br>
Process::StopLocker stop_locker;<br>
if (stop_locker.TryLock(&process_sp->GetRunLock()))<br>
{<br>
Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());<br>
bytes_read = process_sp->ReadMemory (addr, dst, dst_len, sb_error.ref());<br>
}<br>
else<br>
{<br>
if (log)<br>
log->Printf ("SBProcess(%p)::ReadMemory() => error: process is running",<br>
static_cast<void*>(process_sp.get()));<br>
sb_error.SetErrorString("process is running");<br>
}<br>
}<br>
<br>
<br>
to something like:<br>
<br>
<br>
if (process_sp)<br>
{<br>
Process::StopLocker stop_locker;<br>
if (process_sp->CanReadMemoryWhileRunning() || stop_locker.TryLock(&process_sp->GetRunLock()))<br>
{<br>
Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());<br>
bytes_read = process_sp->ReadMemory (addr, dst, dst_len, sb_error.ref());<br>
}<br>
else<br>
{<br>
if (log)<br>
log->Printf ("SBProcess(%p)::ReadMemory() => error: process is running",<br>
static_cast<void*>(process_sp.get()));<br>
sb_error.SetErrorString("process is running");<br>
}<br>
}<br>
<br>
The lldb_private::Process::CanReadMemoryWhileRunning() would need to be a virtual function that is added to lldb_private::Process which defaults to return false. Then any process plug-ins that do allow this can override this function and return true.<br>
<br>
Greg<br>
<br>
<br>
> On Dec 21, 2014, at 6:28 AM, Mario Zechner <<a href="mailto:badlogicgames@gmail.com">badlogicgames@gmail.com</a>> wrote:<br>
><br>
> Hi,<br>
><br>
> i know this has been asked before [1], but i just wanted to explore whether it's a waste of time to patch this into our LLDB fork. I talked about our architecture in [2]. It boils down to having to suspend/resume the inferior to quickly read a tiny bit of memory. This causes us quite a bit of problems as outlined in the other thread.<br>
><br>
> Our memory reads would be just that: fetch a block of memory from a known, non-stack address. We can resolve atomicity issues on our end. Do you think this would be feasible?<br>
><br>
> Thanks,<br>
> Mario<br>
><br>
><br>
> [1] <a href="http://lists.cs.uiuc.edu/pipermail/lldb-dev/2014-June/004139.html" target="_blank">http://lists.cs.uiuc.edu/pipermail/lldb-dev/2014-June/004139.html</a><br>
> [2] <a href="http://lists.cs.uiuc.edu/pipermail/lldb-dev/2014-December/006138.html" target="_blank">http://lists.cs.uiuc.edu/pipermail/lldb-dev/2014-December/006138.html</a><br>
> _______________________________________________<br>
> lldb-dev mailing list<br>
> <a href="mailto:lldb-dev@cs.uiuc.edu">lldb-dev@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev</a><br>
<br>
</blockquote></div>