[Lldb-commits] [lldb] [lldb] Handle an empty SBMemoryRegionInfo from scripted process (PR #115963)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Wed Nov 13 01:28:27 PST 2024


================
@@ -288,8 +288,15 @@ Status ScriptedProcess::DoGetMemoryRegionInfo(lldb::addr_t load_addr,
                                               MemoryRegionInfo &region) {
   Status error;
   if (auto region_or_err =
-          GetInterface().GetMemoryRegionContainingAddress(load_addr, error))
+          GetInterface().GetMemoryRegionContainingAddress(load_addr, error)) {
     region = *region_or_err;
+    if (region.GetRange().GetRangeBase() == 0 &&
+        (region.GetRange().GetByteSize() == 0 ||
+         region.GetRange().GetByteSize() == LLDB_INVALID_ADDRESS)) {
----------------
labath wrote:

A single region that covers the entire address space is fairly boring, but it is the kind of thing I might return as an "I don't know" value (perhaps I'm in some embedded environment where every address really is readable?). What's the problem with that kind of result?

That said, I think this check could be made more robust. `(0, 0)` is the likeliest response, but doesn't this mean that we would still loop if the plugin returns `(0,1)` instead? It sounds to me that if we check that:
- the returned region is of non-zero size
- the returned region actually includes the address being queried (I guess this kinda subsumes the previous item)
then we can guarantee forward progress no matter what the plugin returns (?)

https://github.com/llvm/llvm-project/pull/115963


More information about the lldb-commits mailing list