mib created this revision. mib added a reviewer: JDevlieghere. mib added a project: LLDB. Herald added a project: All. mib requested review of this revision. Herald added a subscriber: lldb-commits.
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. Signed-off-by: Med Ismail Bennani <medismail.benn...@gmail.com> Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D148153 Files: lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp lldb/source/Plugins/Process/scripted/ScriptedProcess.h Index: lldb/source/Plugins/Process/scripted/ScriptedProcess.h =================================================================== --- lldb/source/Plugins/Process/scripted/ScriptedProcess.h +++ lldb/source/Plugins/Process/scripted/ScriptedProcess.h @@ -47,6 +47,8 @@ Status DoLaunch(Module *exe_module, ProcessLaunchInfo &launch_info) override; + void DidLaunch() override; + void DidResume() override; Status DoResume() override; Index: lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp =================================================================== --- lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp +++ lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp @@ -168,7 +168,10 @@ return {}; } +void ScriptedProcess::DidLaunch() { m_pid = GetInterface().GetProcessID(); } + void ScriptedProcess::DidResume() { + // Update the PID again, in case the user provided a placeholder pid at launch m_pid = GetInterface().GetProcessID(); GetLoadedDynamicLibrariesInfos(); }
Index: lldb/source/Plugins/Process/scripted/ScriptedProcess.h =================================================================== --- lldb/source/Plugins/Process/scripted/ScriptedProcess.h +++ lldb/source/Plugins/Process/scripted/ScriptedProcess.h @@ -47,6 +47,8 @@ Status DoLaunch(Module *exe_module, ProcessLaunchInfo &launch_info) override; + void DidLaunch() override; + void DidResume() override; Status DoResume() override; Index: lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp =================================================================== --- lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp +++ lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp @@ -168,7 +168,10 @@ return {}; } +void ScriptedProcess::DidLaunch() { m_pid = GetInterface().GetProcessID(); } + void ScriptedProcess::DidResume() { + // Update the PID again, in case the user provided a placeholder pid at launch m_pid = GetInterface().GetProcessID(); GetLoadedDynamicLibrariesInfos(); }
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits