diff options
author | José Lira Junior <josejunior@10xengineers.ai> | 2023-11-24 12:48:16 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-24 15:48:16 +0000 |
commit | bd8f1068cad06b0f0342ac7ef351bf01c2e27322 (patch) | |
tree | d3ea459893c078443693e94b596f373bc73bb210 /lldb/source/Commands/CommandObjectProcess.cpp | |
parent | 18a5ca14d16e6e5142fc5527accdfb10c1a22820 (diff) | |
download | llvm-bd8f1068cad06b0f0342ac7ef351bf01c2e27322.zip llvm-bd8f1068cad06b0f0342ac7ef351bf01c2e27322.tar.gz llvm-bd8f1068cad06b0f0342ac7ef351bf01c2e27322.tar.bz2 |
[lldb] correct inconsistent order of messages on process launch (#73173)
Fixes [#68035](https://github.com/llvm/llvm-project/issues/68035), where
an inconsistency in the order of "Process launched" and "Process
stopped" messages occurs during `process launch`.
The fix involves adjusting the message output sequence in
`CommandObjectProcessLaunch::DoExecute` within
`source/Commands/CommandObjectProcess.cpp`. This ensures "Process
launched" consistently precedes "Process stopped" when executing
commands with the '-o' flag, i.e., non-interactive mode.
Upon implementing this change, two tests failed:
`lldb/test/Shell/Breakpoint/jit-loader_jitlink_elf.test` and
`lldb/test/Shell/Breakpoint/jit-loader_rtdyld_elf.test`. These failures
were expected as they relied on the previous, now-corrected message
order. Updating these tests to align with the new message sequence is
part of this PR's scope.
Diffstat (limited to 'lldb/source/Commands/CommandObjectProcess.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectProcess.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lldb/source/Commands/CommandObjectProcess.cpp b/lldb/source/Commands/CommandObjectProcess.cpp index c7ce1b1..e42d637 100644 --- a/lldb/source/Commands/CommandObjectProcess.cpp +++ b/lldb/source/Commands/CommandObjectProcess.cpp @@ -264,9 +264,6 @@ protected: // PushProcessIOHandler(). process_sp->SyncIOHandler(0, std::chrono::seconds(2)); - llvm::StringRef data = stream.GetString(); - if (!data.empty()) - result.AppendMessage(data); // If we didn't have a local executable, then we wouldn't have had an // executable module before launch. if (!exe_module_sp) @@ -282,6 +279,11 @@ protected: exe_module_sp->GetFileSpec().GetPath().c_str(), archname); } result.SetStatus(eReturnStatusSuccessFinishResult); + // This message will refer to an event that happened after the process + // launched. + llvm::StringRef data = stream.GetString(); + if (!data.empty()) + result.AppendMessage(data); result.SetDidChangeProcessState(true); } else { result.AppendError( |