https://github.com/labath created 
https://github.com/llvm/llvm-project/pull/130991

m_disassembly_range was used only to prune the list of breakpoints to those 
that are in the current function. This isn't really necessary, as the list is 
only used to highlight instructions with breakpoints on them, and an unpruned 
list works just as well for that.

The shouldn't make things slower, since we still needed through iterate through 
all breakpoints to create the list, and I doubt anyone will notice the memory 
used to store the extra breakpoints.

>From 151c42bcd05cc9e0e327f64cba8137889cfc4fef Mon Sep 17 00:00:00 2001
From: Pavel Labath <pa...@labath.sk>
Date: Wed, 12 Mar 2025 17:45:53 +0100
Subject: [PATCH] [lldb] Remove Function::GetAddressRange usage from the gui

m_disassembly_range was used only to prune the list of breakpoints to
those that are in the current function. This isn't really necessary, as
the list is only used to highlight instructions with breakpoints on
them, and an unpruned list works just as well for that.

The shouldn't make things slower, since we still needed through iterate
through all breakpoints to create the list, and I doubt anyone will
notice the memory used to store the extra breakpoints.
---
 lldb/source/Core/IOHandlerCursesGUI.cpp | 26 ++++---------------------
 1 file changed, 4 insertions(+), 22 deletions(-)

diff --git a/lldb/source/Core/IOHandlerCursesGUI.cpp 
b/lldb/source/Core/IOHandlerCursesGUI.cpp
index ee6e847cdb688..7f0e0fc3b7293 100644
--- a/lldb/source/Core/IOHandlerCursesGUI.cpp
+++ b/lldb/source/Core/IOHandlerCursesGUI.cpp
@@ -6781,8 +6781,7 @@ class StatusBarWindowDelegate : public WindowDelegate {
 class SourceFileWindowDelegate : public WindowDelegate {
 public:
   SourceFileWindowDelegate(Debugger &debugger)
-      : WindowDelegate(), m_debugger(debugger), m_sc(), m_file_sp(),
-        m_disassembly_sp(), m_disassembly_range(), m_title() {}
+      : WindowDelegate(), m_debugger(debugger) {}
 
   ~SourceFileWindowDelegate() override = default;
 
@@ -6939,12 +6938,8 @@ class SourceFileWindowDelegate : public WindowDelegate {
               m_disassembly_scope = m_sc.function;
               m_disassembly_sp = m_sc.function->GetInstructions(
                   exe_ctx, nullptr, !prefer_file_cache);
-              if (m_disassembly_sp) {
+              if (m_disassembly_sp)
                 set_selected_line_to_pc = true;
-                m_disassembly_range = m_sc.function->GetAddressRange();
-              } else {
-                m_disassembly_range.Clear();
-              }
             } else {
               set_selected_line_to_pc = context_changed;
             }
@@ -6953,14 +6948,8 @@ class SourceFileWindowDelegate : public WindowDelegate {
               m_disassembly_scope = m_sc.symbol;
               m_disassembly_sp = m_sc.symbol->GetInstructions(
                   exe_ctx, nullptr, prefer_file_cache);
-              if (m_disassembly_sp) {
+              if (m_disassembly_sp)
                 set_selected_line_to_pc = true;
-                m_disassembly_range.GetBaseAddress() =
-                    m_sc.symbol->GetAddress();
-                m_disassembly_range.SetByteSize(m_sc.symbol->GetByteSize());
-              } else {
-                m_disassembly_range.Clear();
-              }
             } else {
               set_selected_line_to_pc = context_changed;
             }
@@ -7114,13 +7103,7 @@ class SourceFileWindowDelegate : public WindowDelegate {
                  ++bp_loc_idx) {
               BreakpointLocationSP bp_loc_sp =
                   bp_sp->GetLocationAtIndex(bp_loc_idx);
-              LineEntry bp_loc_line_entry;
-              const lldb::addr_t file_addr =
-                  bp_loc_sp->GetAddress().GetFileAddress();
-              if (file_addr != LLDB_INVALID_ADDRESS) {
-                if (m_disassembly_range.ContainsFileAddress(file_addr))
-                  bp_file_addrs.insert(file_addr);
-              }
+              bp_file_addrs.insert(bp_loc_sp->GetAddress().GetFileAddress());
             }
           }
         }
@@ -7552,7 +7535,6 @@ class SourceFileWindowDelegate : public WindowDelegate {
   SourceManager::FileSP m_file_sp;
   SymbolContextScope *m_disassembly_scope = nullptr;
   lldb::DisassemblerSP m_disassembly_sp;
-  AddressRange m_disassembly_range;
   StreamString m_title;
   lldb::user_id_t m_tid = LLDB_INVALID_THREAD_ID;
   int m_line_width = 4;

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to