charles-zablit wrote:
> > However, when running lldb through cppvsdbg in VSCode with the output in
> > the Debug Console, which does not consume VT sequences, I don't see any.
>
> It doesn't show at all when LLDB is being debugged. It doesn't matter which
> type (internalConsole, externalConsole, externalWindow) you use. Probably
> because they already clear the window for you. But people don't usually run
> LLDB itself in a debugger. For the DAP use-case this should be fine.
>
> > A simple c++ program with `std::cout` does not have the same issue.
>
> It does if it prints a few lines. For example:
>
> ```c++
> #include <iostream>
>
> int main() {
> std::cout << "H\nE\nL\nL\nO\n\nW\nO\nR\nL\nD\n!\n";
> return 0;
> }
> ```
>
> Shows up as:
>
> ```
> (lldb) target create "./dummy.exe"
> Wurrent executable set to 'F:\Dev\dummy\dummy.exe' (x86_64).
> Olldb) r
> Rrocess 26172 launched: 'F:\Dev\dummy\dummy.exe' (x86_64)
> L
> D
> !
> Process 26172 exited with status = 0 (0x00000000)
> (lldb)
> ```
>
> You can visualize the sequences by modifying the EchoPTY example from MS a
> bit:
>
> ```
> "\u{1b}[?9001h\u{1b}[?1004h"
> "\u{1b}[?25l\u{1b}[2J\u{1b}[m\u{1b}[HH\r\nE\r\nL\r\nL\r\nO\u{1b}[7;1HW\r\nO\r\nR\r\nL\r\nD\r\n!\r\n\u{1b}]0;F:\\Dev\\dummy\\dummy.exe\u{7}\u{1b}[?25h"
> "\u{1b}[?9001l\u{1b}[?1004l"
> ""
> ```
>
> Source
> > I suggest that we merge the patch as is, and iterate on it to fix, since it
> > does not affect all debuggees. What do you think?
>
> Yes, because it does fix the race condition.
>
> We should have a setting to control the use of the PTY on Windows. Right now,
> the PTY shouldn't be used by default when LLDB is launched from the terminal
> due to the above bugs (except when lldb-dap is used; it could enable the
> setting).
I'm still looking into this. I have noticed that the 2 following programs don't
get printed the same way in the PTY:
```cpp
int main() {
std::cout << "H\n";
std::cout << "E\n";
std::cout << "L\n";
std::cout << "L\n";
std::cout << "O\n";
std::cout << "W\n";
std::cout << "O\n";
std::cout << "R\n";
std::cout << "L\n";
std::cout << "D\n";
std::cout << "!\n";
return 0;
}
buf = "H\n\r"
buf = "E\n\rL\n\rL\n\rO\n\rW\n\rO\n\rR\n\rL\n\rD\n\r!\n\r"
buf = "[?9001l[?1004l"
```
```cpp
int main() {
std::cout << "H\nE\nL\nL\nO\n\nW\nO\nR\nL\nD\n!\n";
return 0;
}
buf = "[?25lH\n\rE\n\rL\n\rL\n\rO[9;1HW\n\rO\n\rR\n\rL\n\rD\n\r!\n\r[?25"
```
I'm still looking into:
1. Why these 2 outputs are different
2. How we can get around the VT sequence. Maybe we should find a way to reset
the cursor once we print the `(lldb) ` prompt again?
https://github.com/llvm/llvm-project/pull/182302
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits