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

>From 009f13dae8f41a28beb59f2c75692a962886d708 Mon Sep 17 00:00:00 2001
From: anutosh491 <andersonbhat...@gmail.com>
Date: Tue, 19 Aug 2025 19:25:33 +0530
Subject: [PATCH 1/2] Fix failing test in TestClangREPL

---
 lldb/test/API/repl/clang/TestClangREPL.py | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/lldb/test/API/repl/clang/TestClangREPL.py 
b/lldb/test/API/repl/clang/TestClangREPL.py
index 3152018865b1e..ffa598b650937 100644
--- a/lldb/test/API/repl/clang/TestClangREPL.py
+++ b/lldb/test/API/repl/clang/TestClangREPL.py
@@ -30,8 +30,9 @@ def start_repl(self):
         self.expect("b main", substrs=["Breakpoint 1", "address ="])
         self.expect("run", substrs=["stop reason = breakpoint 1"])
 
-        # Start the REPL.
-        self.child.send("expression --repl -l c --\n")
+        # Start the REPL with a harmless trailing input to trigger the warning.
+        self.child.send("expression --repl -l c -- 3 + 3\n")
+        self.child.expect_exact("Warning: trailing input is ignored in --repl 
mode")
         self.child.expect_exact("1>")
 
     # PExpect uses many timeouts internally and doesn't play well
@@ -56,16 +57,6 @@ 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

>From b7003019ca1d02c1261d2e1680788d0cd52fcc63 Mon Sep 17 00:00:00 2001
From: anutosh491 <andersonbhat...@gmail.com>
Date: Tue, 19 Aug 2025 21:16:06 +0530
Subject: [PATCH 2/2] 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 197bffe9c982f..41bc8abf4897f 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",

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

Reply via email to