llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Anutosh Bhat (anutosh491)

<details>
<summary>Changes</summary>

Fixes https://github.com/llvm/llvm-project/issues/153157

The proposed solution has been discussed here 
(https://github.com/llvm/llvm-project/issues/153157#issue-3313379242)

This is what we would be seeing now 

```
base) anutosh491@<!-- -->Anutoshs-MacBook-Air bin % ./lldb 
/Users/anutosh491/work/xeus-cpp/a.out
(lldb) target create "/Users/anutosh491/work/xeus-cpp/a.out"
Current executable set to '/Users/anutosh491/work/xeus-cpp/a.out' (arm64).
(lldb) b main
Breakpoint 1: where = a.out`main, address = 0x0000000100003f90
(lldb) r
Process 71227 launched: '/Users/anutosh491/work/xeus-cpp/a.out' (arm64)
Process 71227 stopped
* thread #<!-- -->1, queue = 'com.apple.main-thread', stop reason = breakpoint 
1.1
    frame #<!-- -->0: 0x0000000100003f90 a.out`main
a.out`main:
-&gt;  0x100003f90 &lt;+0&gt;:  sub    sp, sp, #<!-- -->0x10
    0x100003f94 &lt;+4&gt;:  str    wzr, [sp, #<!-- -->0xc]
    0x100003f98 &lt;+8&gt;:  str    w0, [sp, #<!-- -->0x8]
    0x100003f9c &lt;+12&gt;: str    x1, [sp]
(lldb) expression --repl -l c -- 
  1&gt; 1 + 1
(int) $0 = 2
  2&gt; 2 + 2
(int) $1 = 4
```

```
base) anutosh491@<!-- -->Anutoshs-MacBook-Air bin % ./lldb 
/Users/anutosh491/work/xeus-cpp/a.out
(lldb) target create "/Users/anutosh491/work/xeus-cpp/a.out"
Current executable set to '/Users/anutosh491/work/xeus-cpp/a.out' (arm64).
(lldb) b main
Breakpoint 1: where = a.out`main, address = 0x0000000100003f90
(lldb) r
Process 71355 launched: '/Users/anutosh491/work/xeus-cpp/a.out' (arm64)
Process 71355 stopped
* thread #<!-- -->1, queue = 'com.apple.main-thread', stop reason = breakpoint 
1.1
    frame #<!-- -->0: 0x0000000100003f90 a.out`main
a.out`main:
-&gt;  0x100003f90 &lt;+0&gt;:  sub    sp, sp, #<!-- -->0x10
    0x100003f94 &lt;+4&gt;:  str    wzr, [sp, #<!-- -->0xc]
    0x100003f98 &lt;+8&gt;:  str    w0, [sp, #<!-- -->0x8]
    0x100003f9c &lt;+12&gt;: str    x1, [sp]
(lldb) expression --repl -l c -- 3 + 3
Warning: trailing input is ignored in --repl mode
  1&gt; 1 + 1
(int) $0 = 2
```

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


1 Files Affected:

- (modified) lldb/source/Commands/CommandObjectExpression.cpp (+6) 


``````````diff
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",

``````````

</details>


https://github.com/llvm/llvm-project/pull/153560
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to