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

José Lira Junior via lldb-commits lldb-commits at lists.llvm.org
Wed Nov 22 13:33:33 PST 2023


https://github.com/junior-jl created https://github.com/llvm/llvm-project/pull/73173

## 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.

>From e451fe7a466f90557c301f0775d65caaa8955a8c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jos=C3=A9=20L=2E=20Junior?= <josejunior at 10xengineers.ai>
Date: Wed, 22 Nov 2023 18:26:14 -0300
Subject: [PATCH] [lldb] correct inconsistent order of messages on process
 launch

---
 lldb/source/Commands/CommandObjectProcess.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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(



More information about the lldb-commits mailing list