https://github.com/anutosh491 updated 
https://github.com/llvm/llvm-project/pull/153560

>From 6e7564602e7a5b608a4d1cd788e66425682e82db Mon Sep 17 00:00:00 2001
From: anutosh491 <andersonbhat...@gmail.com>
Date: Thu, 14 Aug 2025 14:25:05 +0530
Subject: [PATCH 1/3] Fix unknown error while starting lldb's C/C++ repl

---
 lldb/source/Commands/CommandObjectExpression.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lldb/source/Commands/CommandObjectExpression.cpp 
b/lldb/source/Commands/CommandObjectExpression.cpp
index c5b91678103d5..57b56ce7eb36e 100644
--- a/lldb/source/Commands/CommandObjectExpression.cpp
+++ b/lldb/source/Commands/CommandObjectExpression.cpp
@@ -640,9 +640,15 @@ void CommandObjectExpression::DoExecute(llvm::StringRef 
command,
             repl_sp->SetValueObjectDisplayOptions(m_varobj_options);
           }
 
+          if (!expr.empty()) {
+            result.GetOutputStream().Printf(
+              "Warning: trailing input is ignored in --repl mode\n");
+          }
+
           IOHandlerSP io_handler_sp(repl_sp->GetIOHandler());
           io_handler_sp->SetIsDone(false);
           debugger.RunIOHandlerAsync(io_handler_sp);
+          return;
         } else {
           repl_error = Status::FromErrorStringWithFormat(
               "Couldn't create a REPL for %s",

>From 22f6e4d36a53d1bbbf0346ea70f11e3042438d60 Mon Sep 17 00:00:00 2001
From: anutosh491 <andersonbhat...@gmail.com>
Date: Thu, 14 Aug 2025 15:19:51 +0530
Subject: [PATCH 2/3] formatting

---
 lldb/source/Commands/CommandObjectExpression.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/source/Commands/CommandObjectExpression.cpp 
b/lldb/source/Commands/CommandObjectExpression.cpp
index 57b56ce7eb36e..65365745ea454 100644
--- a/lldb/source/Commands/CommandObjectExpression.cpp
+++ b/lldb/source/Commands/CommandObjectExpression.cpp
@@ -642,7 +642,7 @@ void CommandObjectExpression::DoExecute(llvm::StringRef 
command,
 
           if (!expr.empty()) {
             result.GetOutputStream().Printf(
-              "Warning: trailing input is ignored in --repl mode\n");
+                "Warning: trailing input is ignored in --repl mode\n");
           }
 
           IOHandlerSP io_handler_sp(repl_sp->GetIOHandler());

>From 0bd1ee6da53f6a997bb7400587844e533c006056 Mon Sep 17 00:00:00 2001
From: anutosh491 <andersonbhat...@gmail.com>
Date: Mon, 18 Aug 2025 12:53:54 +0530
Subject: [PATCH 3/3] Add tests to trigger correct warning

---
 lldb/test/API/repl/clang/TestClangREPL.py | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/lldb/test/API/repl/clang/TestClangREPL.py 
b/lldb/test/API/repl/clang/TestClangREPL.py
index 97d91d1b8f7a5..3152018865b1e 100644
--- a/lldb/test/API/repl/clang/TestClangREPL.py
+++ b/lldb/test/API/repl/clang/TestClangREPL.py
@@ -56,6 +56,16 @@ def test_basic_completion(self):
 
         self.quit()
 
+        # Re-enter the REPL with trailing input to trigger warning.
+        self.child.send("expression --repl -l c -- 3 + 3\n")
+        self.child.expect_exact("Warning: trailing input is ignored in --repl 
mode\n")
+        self.child.expect_exact("1>")
+
+        # Evaluate another expression after warning.
+        self.expect_repl("4 + 4", substrs=["(int) $3 = 8"])
+
+        self.quit()
+
     # PExpect uses many timeouts internally and doesn't play well
     # under ASAN on a loaded machine..
     @skipIfAsan

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to