<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" id="owaParaStyle"></style>
</head>
<body fpstyle="1" ocsi="0">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;"><br>
<div>I am trying to attach to a stopped process on our dsp target using the SBTarget interface but the call hangs. </div>
<div>What I understand is that it is waiting for events on the "lldb.process" broadcaster using the "lldb.Target.Attach.attach.hijack" listener.</div>
<div><br>
</div>
<div>Enabling the logs, I see that the process is attached successfully and that the stop event is generated. It just seems that the event is not seen by the listener.</div>
<div><br>
</div>
<div>
<div>
<div>1442428969.321000000 004B9590 Listener::WaitForEventsInternal (timeout = { 00000000 }) for lldb.Target.Attach.attach.hijack</div>
<div>1442428969.321000000 004BC7F4 Broadcaster("opus.remote")::BroadcastEvent (event_sp = {00A72050 Event: broadcaster = 004BC7F4 (opus.remote), type = 0x00010000, data = <NULL>}, unique =0) hijack = 00000000</div>
<div>1442428969.341000000 0049AC50 Broadcaster("lldb.target")::BroadcastEvent (event_sp = {00A70C78 Event: broadcaster = 0049AC50 (lldb.target), type = 0x00000002 (modules-loaded), data = {}}, unique =0) hijack = 00000000</div>
<div>1442428969.341000000 004BC7F4 Broadcaster("opus.remote")::BroadcastEvent (event_sp = {00A723C8 Event: broadcaster = 004BC7F4 (opus.remote), type = 0x00010000, data = <NULL>}, unique =0) hijack = 00000000</div>
<div>1442428969.450000000 004BC394 Broadcaster("lldb.process.internal_state_broadcaster")::BroadcastEvent (event_sp = {00A723C8 Event: broadcaster = 004BC394 (lldb.process.internal_state_broadcaster), type = 0x00000001, data = { process = 004BC308 (pid = 1),
 state = stopped}}, unique =0) hijack = 00000000</div>
<div>1442428969.452000000 004BC42C Listener('lldb.process.internal_state_listener')::AddEvent (event_sp = {00A723C8})</div>
<div>1442428969.453000000 031CF700 Listener::WaitForEventsInternal (timeout = { 00000000 }) for ProcessOpusRemote::AsyncThread</div>
<div>1442428969.453000000 004BC42C 'lldb.process.internal_state_listener' Listener::FindNextEventInternal(broadcaster=00000000, broadcaster_names=00000000[0], event_type_mask=0x00000000, remove=1) event 00A723C8</div>
<div>1442428969.459000000 0309F8D4 Listener::StartListeningForEvents (broadcaster = 004BC5F4, mask = 0x00000020) acquired_mask = 0x00000020 for Communication::SyncronizeWithReadThread</div>
<div>1442428969.470000000 Process::ShouldBroadcastEvent (00A723C8) => new state: stopped, last broadcast state: stopped - YES</div>
<div>1442428969.471000000 004BC318 Broadcaster("lldb.process")::BroadcastEvent (event_sp = {00A723C8 Event: broadcaster = 004BC318 (lldb.process), type = 0x00000001(state-changed), data = { process = 004BC308 (pid = 1), state = stopped}}, unique =0) hijack
 = 00000000</div>
<div>1442428969.473000000 00402598 Listener('lldb.Debugger')::AddEvent (event_sp = {00A723C8})</div>
<div>1442428969.474000000 004BC42C Listener::WaitForEventsInternal (timeout = { 00000000 }) for lldb.process.internal_state_listener</div>
</div>
</div>
<div><br>
</div>
<div>Here's the code I use to attach.</div>
<div><br>
</div>
<div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>SBDebugger::Initialize();</div>
</div>
<div><br>
</div>
<div><span class="Apple-tab-span" style="font-size: 10pt; white-space: pre;"></span><span style="font-size: 10pt;">SBDebugger debugger = lldb::SBDebugger::Create(false);</span></div>
<div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>debugger.SetAsync(true);</div>
<div><br>
</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>const char* categories [] = { "process", "events", 0 };</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>if (!debugger.EnableLog("lldb", categories))</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>return -1;</div>
<div><br>
</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>pid_t pid = 1;</div>
<div><br>
</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>SBTarget target = debugger.CreateTargetWithFileAndArch(elffile_name, "opus2");</div>
<div><br>
</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>SBError error;</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>SBListener listener("test_listener");</div>
<div><br>
</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>SBProcess process = target.AttachToProcessWithID(listener, pid, error);</div>
<div><br>
</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>if (!process.IsValid())</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>{</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>   ...</div>
<div><br>
</div>
<div><br>
</div>
<div style="font-size: 10pt;">I would be grateful for any insight on the cause of this behavior.</div>
</div>
<div style="font-size: 10pt;"><br>
</div>
<div style="font-size: 10pt;">Thanks,</div>
<div style="font-size: 10pt;">-Philippe</div>
</div>
</body>
</html>