This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Fix assertion when ScriptedProcess have no pid after launch
ClosedPublic

Authored by mib on Apr 12 2023, 11:46 AM.

Details

Summary

This patch should fix an assertion that causes some test failures:
https://ci.swift.org/view/LLDB/job/llvm-org-lldb-release-debuginfo/3587/console

This was caused by the changes introduces in 88f409194d5a where we
replaced DidLaunch by DidResume in the ScriptedProcess class.

However, by the time we resume the process, the pid should be already
set. To address this, this patch brings back DidLaunch which will
initialize the ScriptedProcess pid with a placeholder value. That value
will be updated in DidResume to the final pid.

Note, this 2 stage PID initialization is necessary sometimes, when the
scripted process gets stopped at entry (launch) and gets assigned an
object that contains the PID value. In this case, we need to update the
PID when we resume the process after we've stopped at entry.

This also replaces the default scripted process id to an arbitrary
number (42) since the current value (0) is considered invalid.

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>

Diff Detail

Event Timeline

mib created this revision.Apr 12 2023, 11:46 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 12 2023, 11:46 AM
mib requested review of this revision.Apr 12 2023, 11:46 AM
mib edited the summary of this revision. (Show Details)Apr 12 2023, 11:46 AM
mib updated this revision to Diff 512927.Apr 12 2023, 11:49 AM
mib edited the summary of this revision. (Show Details)
bulbazord accepted this revision.Apr 12 2023, 3:52 PM
This revision is now accepted and ready to land.Apr 12 2023, 3:52 PM