================
@@ -283,39 +283,42 @@ uint32_t Block::GetRangeIndexContainingAddress(const
Address &addr) {
return m_ranges.FindEntryIndexThatContains(file_addr - func_file_addr);
}
+static AddressRange ToAddressRange(const Address &func_addr,
+ const Block::Range &range) {
+ assert(func_addr.GetModule());
+ return AddressRange(func_addr.GetFileAddress() + range.base, range.size,
----------------
DavidSpickett wrote:
So a block range is `[offset, offset + size)`, where offset is relative to the
parent function's entry point.
You want to make AddressRange which is a proper virtual address (minus the
generally applied load offset). So you make it `[function entry point + offset,
function entry point + offset + size)` by adding the function entry point to
the base of the range.
If any of that is a correct interpretation, consider adding a comment to
explain that in the code:
```
// The block's base address is a relative offset to its parent function's entry
point. We want to produce a virtual address
// so we need to add the value of that entry point here.
```
https://github.com/llvm/llvm-project/pull/137955
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits