[lldb-dev] Synchronous execution with process plugin
Zachary Turner
zturner at google.com
Fri Mar 20 15:57:33 PDT 2015
I ran into an issue earlier where I tried to make a .lldbinit file with
some lines like this:
file a.out
run
When this happens the process runs, the breakpoint gets hit and I see the
source listing, it returns to the lldb prompt, but then I can't type
anything. It appears LLDB is deadlocked inside of Target::Launch() at the
following location:
if (!synchronous_execution)
m_process_sp->RestoreProcessEvents ();
error = m_process_sp->PrivateResume();
if (error.Success())
{
// there is a race condition where this thread will
return up the call stack to the main command
// handler and show an (lldb) prompt before
HandlePrivateEvent (from PrivateStateThread) has
// a chance to call PushProcessIOHandler()
m_process_sp->SyncIOHandler(2000);
if (synchronous_execution)
{
state = m_process_sp->WaitForProcessToStop (NULL, NULL, true,
hijack_listener_sp.get(), stream);
const bool must_be_alive = false; // eStateExited
is ok, so this must be false
if (!StateIsStoppedState(state, must_be_alive))
{
error.SetErrorStringWithFormat("process isn't
stopped: %s", StateAsCString(state));
}
}
}
Normally when I'm using LLDB and entering the commands myself, this
synchronous_execution value is not set, and everything works as expected.
How is this supposed to work? What does my plugin need to do differently
in order to handle this case? The process has already stopped once and
resumed, so I'm not sure why it would need to stop again? I see that it's
not restoring process events in the case of synchronous execution, so maybe
it should have never resumed in the first place?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20150320/c40d9bf7/attachment.html>
More information about the lldb-dev
mailing list