================
@@ -278,19 +268,16 @@ bool Block::GetRangeContainingLoadAddress(lldb::addr_t
load_addr,
uint32_t Block::GetRangeIndexContainingAddress(const Address &addr) {
Function *function = CalculateSymbolContextFunction();
- if (function) {
- const AddressRange &func_range = function->GetAddressRange();
- if (addr.GetSection() == func_range.GetBaseAddress().GetSection()) {
- const addr_t addr_offset = addr.GetOffset();
- const addr_t func_offset = func_range.GetBaseAddress().GetOffset();
- if (addr_offset >= func_offset &&
- addr_offset < func_offset + func_range.GetByteSize()) {
- addr_t offset = addr_offset - func_offset;
- return m_ranges.FindEntryIndexThatContains(offset);
- }
- }
- }
- return UINT32_MAX;
+ if (!function)
+ return UINT32_MAX;
+
+ const Address &func_addr = function->GetAddress();
+ if (addr.GetModule() != func_addr.GetModule())
+ return UINT32_MAX;
+
+ const addr_t file_addr = addr.GetFileAddress();
+ const addr_t func_file_addr = func_addr.GetFileAddress();
+ return m_ranges.FindEntryIndexThatContains(file_addr - func_file_addr);
----------------
DavidSpickett wrote:
Here we expect that func_file_addr is lower or equal to file_addr, meaning that
`addr.GetFileAddress()` returns some point exactly at the start or some way
into a function?
https://github.com/llvm/llvm-project/pull/124931
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits