Index: lldb/include/lldb/Core/Debugger.h =================================================================== --- lldb/include/lldb/Core/Debugger.h +++ lldb/include/lldb/Core/Debugger.h @@ -345,6 +345,10 @@ llvm::StringRef GetStopShowColumnAnsiSuffix() const; + llvm::StringRef GetShowProgressAnsiPrefix() const; + + llvm::StringRef GetShowProgressAnsiSuffix() const; + uint32_t GetStopSourceLineCount(bool before) const; StopDisassemblyType GetStopDisassemblyDisplay() const; Index: lldb/source/Core/CoreProperties.td =================================================================== --- lldb/source/Core/CoreProperties.td +++ lldb/source/Core/CoreProperties.td @@ -135,6 +135,14 @@ Global, DefaultTrue, Desc<"Whether to show progress or not.">; + def ShowProgressAnsiPrefix: Property<"show-progress-ansi-prefix", "String">, + Global, + DefaultStringValue<"${ansi.faint}">, + Desc<"When displaying progress in a color-enabled (i.e. ANSI) terminal, use the ANSI terminal code specified in this format immediately before the progress message.">; + def ShowProgressAnsiSuffix: Property<"show-progress-ansi-suffix", "String">, + Global, + DefaultStringValue<"${ansi.normal}">, + Desc<"When displaying progress in a color-enabled (i.e. ANSI) terminal, use the ANSI terminal code specified in this format immediately after the progress message.">; def UseSourceCache: Property<"use-source-cache", "Boolean">, Global, DefaultTrue, Index: lldb/source/Core/Debugger.cpp =================================================================== --- lldb/source/Core/Debugger.cpp +++ lldb/source/Core/Debugger.cpp @@ -436,6 +436,16 @@ return m_collection_sp->GetPropertyAtIndexAsString(nullptr, idx, ""); } +llvm::StringRef Debugger::GetShowProgressAnsiPrefix() const { + const uint32_t idx = ePropertyShowProgressAnsiPrefix; + return m_collection_sp->GetPropertyAtIndexAsString(nullptr, idx, ""); +} + +llvm::StringRef Debugger::GetShowProgressAnsiSuffix() const { + const uint32_t idx = ePropertyShowProgressAnsiSuffix; + return m_collection_sp->GetPropertyAtIndexAsString(nullptr, idx, ""); +} + uint32_t Debugger::GetStopSourceLineCount(bool before) const { const uint32_t idx = before ? ePropertyStopLineCountBefore : ePropertyStopLineCountAfter; @@ -1769,6 +1779,12 @@ return; } + const bool use_color = GetUseColor(); + llvm::StringRef ansi_prefix = GetShowProgressAnsiPrefix(); + if (!ansi_prefix.empty()) + output.Printf( + "%s", ansi::FormatAnsiTerminalCodes(ansi_prefix, use_color).c_str()); + // Print over previous line, if any. output.Printf("\r"); @@ -1781,6 +1797,11 @@ output.Printf("%s...", message.c_str()); } + llvm::StringRef ansi_suffix = GetShowProgressAnsiSuffix(); + if (!ansi_suffix.empty()) + output.Printf( + "%s", ansi::FormatAnsiTerminalCodes(ansi_suffix, use_color).c_str()); + // Clear until the end of the line. output.Printf("\x1B[K");