[Lldb-commits] [lldb] [lldb] Refactor string manipulation in Debugger.cpp (#91209) (PR #92565)

via lldb-commits lldb-commits at lists.llvm.org
Fri May 17 20:09:36 PDT 2024


https://github.com/aabhinavg updated https://github.com/llvm/llvm-project/pull/92565

>From 13fefb6846b6641900843c37746b03140063a955 Mon Sep 17 00:00:00 2001
From: aabhinavg <tiwariabhinavak at gmail.com>
Date: Fri, 17 May 2024 21:17:51 +0530
Subject: [PATCH 1/2] removed unwanted file

---
 lldb/source/Core/Debugger.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index 9951fbcd3e7c3..70303173925e3 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -2067,7 +2067,7 @@ void Debugger::HandleProgressEvent(const lldb::EventSP &event_sp) {
   const uint32_t term_width = GetTerminalWidth();
   const uint32_t ellipsis = 3;
   if (message.size() + ellipsis >= term_width)
-    message = message.substr(0, term_width - ellipsis);
+    message.resize(message.size() - ellipsis);
 
   const bool use_color = GetUseColor();
   llvm::StringRef ansi_prefix = GetShowProgressAnsiPrefix();

>From 3ed69bf19942a6e9470fda66efd54b25cbac176e Mon Sep 17 00:00:00 2001
From: aabhinavg <tiwariabhinavak at gmail.com>
Date: Sat, 18 May 2024 08:39:21 +0530
Subject: [PATCH 2/2] updated the patch

---
 lldb/source/Core/Debugger.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index 70303173925e3..d08aa1dc476f6 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -2067,7 +2067,7 @@ void Debugger::HandleProgressEvent(const lldb::EventSP &event_sp) {
   const uint32_t term_width = GetTerminalWidth();
   const uint32_t ellipsis = 3;
   if (message.size() + ellipsis >= term_width)
-    message.resize(message.size() - ellipsis);
+    message.resize(term_width - ellipsis);
 
   const bool use_color = GetUseColor();
   llvm::StringRef ansi_prefix = GetShowProgressAnsiPrefix();



More information about the lldb-commits mailing list