Skip to content

Commit

Permalink
Fix LLDB not updating the target status on time when debugging an ELF…
Browse files Browse the repository at this point in the history
… without dynamic loader
  • Loading branch information
xusheng6 committed Apr 11, 2023
1 parent 82eab25 commit ac0108e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion core/adapters/lldbadapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -999,7 +999,10 @@ DebugStopReason LldbAdapter::StopReason()
{
StateType state = m_process.GetState();
if (state == lldb::eStateExited)
{
LogWarn("target exited");
return DebugStopReason::ProcessExited;
}

if (state == lldb::eStateStopped)
{
Expand Down Expand Up @@ -1387,7 +1390,12 @@ void LldbAdapter::EventListener()
FixActiveThread();
DebuggerEvent dbgevt;
dbgevt.type = AdapterStoppedEventType;
dbgevt.data.targetStoppedData.reason = StopReason();
// LLDB sometimes fails to update the process status when it is already sending eStateStopped event.
// When we restart the process, the target will appear to have exited
auto reason = StopReason();
if (reason == ProcessExited)
reason = UnknownReason;
dbgevt.data.targetStoppedData.reason = reason;
PostDebuggerEvent(dbgevt);
break;
}
Expand Down

0 comments on commit ac0108e

Please sign in to comment.