[Lldb-commits] [lldb] [lldb] Remove Function::GetAddressRange usage from the gui (PR #130991)
via lldb-commits
lldb-commits at lists.llvm.org
Wed Mar 12 09:54:56 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lldb
Author: Pavel Labath (labath)
<details>
<summary>Changes</summary>
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/130991.diff
1 Files Affected:
- (modified) lldb/source/Core/IOHandlerCursesGUI.cpp (+4-22)
``````````diff
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;
``````````
</details>
https://github.com/llvm/llvm-project/pull/130991
More information about the lldb-commits
mailing list