[Lldb-commits] [lldb] [lldb] IRMemoryMap zero address mapping fix (PR #99045)
Jason Molenda via lldb-commits
lldb-commits at lists.llvm.org
Fri Jul 19 00:29:47 PDT 2024
jasonmolenda wrote:
I think we should change these checks to look for an explicitly inaccessible memory region, like
```
if (region_info.GetReadable() != MemoryRegionInfo::OptionalBool::eNo &&
region_info.GetWritable() != MemoryRegionInfo::OptionalBool::eNo &&
region_info.GetExecutable() !=
MemoryRegionInfo::OptionalBool::eNo) {
// This region is inaccessible, if it is large enough, use this address.
if (ret + size < region_info.GetRange().GetRangeEnd())
return ret;
else
ret = region_info.GetRange().GetRangeEnd();
// keep searching
```
and I also do think there is value in adding a special case for address 0. Even if we have an inaddressable memory block at address 0 which should be eligible for shadowing with lldb's host memory, using that is a poor choice because people crash at address 0 all the time and we don't want references to that address finding the IRMemoryMap host side memory values.
```
} else if (ret == 0) {
// Don't put our host-side memory block at virtual address 0 even if it
// seems eligible, we don't want to confuse things when a program
// crashes accessing that address, a common way of crashing.
ret = region_info.GetRange().GetRangeEnd();
```
https://github.com/llvm/llvm-project/pull/99045
More information about the lldb-commits
mailing list