[Lldb-commits] [lldb] [llvm] [Obj2Yaml] Add support for minidump generation with 64b memory ranges. (PR #101272)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Wed Aug 7 01:13:46 PDT 2024


================
@@ -494,6 +528,32 @@ Stream::create(const Directory &StreamDesc, const object::MinidumpFile &File) {
     }
     return std::make_unique<MemoryListStream>(std::move(Ranges));
   }
+  case StreamKind::Memory64List: {
+    // Error, unlike expected is true in failure state
+    Error Err = Error::success();
+    // Explicit check on Err so that if we return due to getmemory64list
+    // getting an error, it's not destructed when unchecked.
+    if (Err)
+      return Err;
+    auto ExpectedList = File.getMemory64List(Err);
+    if (!ExpectedList)
+      return ExpectedList.takeError();
+    std::vector<Memory64ListStream::entry_type> Ranges;
+    for (auto It = ExpectedList->begin(); It != ExpectedList->end(); ++It) {
----------------
labath wrote:

It should be possible to use a range based for to implement this loop, and the fact that you needed to check the error inside the loop makes me suspect there is something wrong with the loop termination condition. Maybe you need to explicitly set the iterator to the "end" state so that this condition fires?
```
  friend bool operator==(const fallible_iterator &LHS,
                         const fallible_iterator &RHS) {
    // If both iterators are in the end state they compare
    // equal, regardless of whether either is valid.
    if (LHS.isEnd() && RHS.isEnd())
      return true;
```

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


More information about the lldb-commits mailing list