[Lldb-commits] [lldb] [lldb] correct inconsistent order of messages on process launch (PR #73173)

via lldb-commits lldb-commits at lists.llvm.org
Wed Nov 22 13:34:01 PST 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: José Lira Junior (junior-jl)

<details>
<summary>Changes</summary>

## Overview

This pull request addresses the issue [#<!-- -->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`.

## Impact

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 are anticipated as the tests are designed to expect the "Process stopped" message before the "Process launched" message, which is the behavior this PR aims to correct.

---
Full diff: https://github.com/llvm/llvm-project/pull/73173.diff


1 Files Affected:

- (modified) lldb/source/Commands/CommandObjectProcess.cpp (+2-2) 


``````````diff
diff --git a/lldb/source/Commands/CommandObjectProcess.cpp b/lldb/source/Commands/CommandObjectProcess.cpp
index c7ce1b1258c196c..f601316a6f673ec 100644
--- a/lldb/source/Commands/CommandObjectProcess.cpp
+++ b/lldb/source/Commands/CommandObjectProcess.cpp
@@ -265,8 +265,6 @@ class CommandObjectProcessLaunch : public CommandObjectProcessLaunchOrAttach {
         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 +280,8 @@ class CommandObjectProcessLaunch : public CommandObjectProcessLaunchOrAttach {
               exe_module_sp->GetFileSpec().GetPath().c_str(), archname);
         }
         result.SetStatus(eReturnStatusSuccessFinishResult);
+        if (!data.empty())
+          result.AppendMessage(data);
         result.SetDidChangeProcessState(true);
       } else {
         result.AppendError(

``````````

</details>


https://github.com/llvm/llvm-project/pull/73173


More information about the lldb-commits mailing list