[Lldb-commits] [lldb] [LLDB] Reapply SBSaveCore Add Memory List (PR #107937)

Miro Bucko via lldb-commits lldb-commits at lists.llvm.org
Wed Sep 11 11:05:33 PDT 2024


================
@@ -0,0 +1,86 @@
+//===-- CoreFileMemoryRanges.cpp --------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/Target/CoreFileMemoryRanges.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+using Entry = CoreFileMemoryRanges::Entry;
+
+static bool Overlaps(const Entry *region_one, const Entry *region_two) {
+  return !(region_one->GetRangeEnd() < region_two->GetRangeBase() ||
+           region_two->GetRangeEnd() < region_one->GetRangeBase());
+}
+
+static bool IntersectHelper(const Entry *region_one, const Entry *region_two) {
+  return region_one->GetRangeBase() == region_two->GetRangeEnd() ||
+         region_one->GetRangeEnd() == region_two->GetRangeBase();
+}
+
+static bool OnlyIntersects(const Entry *region_one, const Entry *region_two) {
+  return IntersectHelper(region_one, region_two) ||
+         IntersectHelper(region_two, region_one);
----------------
mbucko wrote:

I believe `IntersectHelper(region_one, region_two)` is the same as `IntersectHelper(region_two, region_one)` no?

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


More information about the lldb-commits mailing list