Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/llvm/llvm-project.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lldb
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2022-03-14 20:22:04 +0300
committerJonas Devlieghere <jonas@devlieghere.com>2022-03-14 20:31:22 +0300
commitc231deb791672720cf1935150b99e6deffaf4843 (patch)
tree35ee18993965fabd039c84ed9713e362633a7575 /lldb
parent3568333815b30dc565ce041c64e871bc1d4e8e21 (diff)
[lldb] Use the debugger's asynchronous output stream for progress events.
Use the debugger's asynchronous output stream for printing progress events. This allows the active IOHandler to be in charge of printing them and doing the necessary synchronization. Differential revision: https://reviews.llvm.org/D121502
Diffstat (limited to 'lldb')
-rw-r--r--lldb/source/Core/Debugger.cpp26
1 files changed, 14 insertions, 12 deletions
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index 9764b0bc88c5..44e74e9f292e 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -1750,45 +1750,47 @@ void Debugger::HandleProgressEvent(const lldb::EventSP &event_sp) {
// Determine whether the current output file is an interactive terminal with
// color support. We assume that if we support ANSI escape codes we support
// vt100 escape codes.
- File &output = GetOutputFile();
- if (!output.GetIsInteractive() || !output.GetIsTerminalWithColors())
+ File &file = GetOutputFile();
+ if (!file.GetIsInteractive() || !file.GetIsTerminalWithColors())
return;
+ StreamSP output = GetAsyncOutputStream();
+
// Print over previous line, if any.
- output.Printf("\r");
+ output->Printf("\r");
if (data->GetCompleted()) {
// Clear the current line.
- output.Printf("\x1B[2K");
- output.Flush();
+ output->Printf("\x1B[2K");
+ output->Flush();
return;
}
const bool use_color = GetUseColor();
llvm::StringRef ansi_prefix = GetShowProgressAnsiPrefix();
if (!ansi_prefix.empty())
- output.Printf(
+ output->Printf(
"%s", ansi::FormatAnsiTerminalCodes(ansi_prefix, use_color).c_str());
// Print the progress message.
std::string message = data->GetMessage();
if (data->GetTotal() != UINT64_MAX) {
- output.Printf("[%" PRIu64 "/%" PRIu64 "] %s...", data->GetCompleted(), data->GetTotal(),
- message.c_str());
+ output->Printf("[%" PRIu64 "/%" PRIu64 "] %s...", data->GetCompleted(),
+ data->GetTotal(), message.c_str());
} else {
- output.Printf("%s...", message.c_str());
+ output->Printf("%s...", message.c_str());
}
llvm::StringRef ansi_suffix = GetShowProgressAnsiSuffix();
if (!ansi_suffix.empty())
- output.Printf(
+ output->Printf(
"%s", ansi::FormatAnsiTerminalCodes(ansi_suffix, use_color).c_str());
// Clear until the end of the line.
- output.Printf("\x1B[K\r");
+ output->Printf("\x1B[K\r");
// Flush the output.
- output.Flush();
+ output->Flush();
}
bool Debugger::HasIOHandlerThread() { return m_io_handler_thread.IsJoinable(); }