|
| 1 | +//===-- CoreFileMemoryRanges.h ----------------------------------*- C++ -*-===// |
| 2 | +// |
| 3 | +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | +// See https://llvm.org/LICENSE.txt for license information. |
| 5 | +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | +// |
| 7 | +//===----------------------------------------------------------------------===// |
| 8 | + |
| 9 | +#include "lldb/Utility/RangeMap.h" |
| 10 | +#include "lldb/Utility/Status.h" |
| 11 | + |
| 12 | +#include "llvm/ADT/AddressRanges.h" |
| 13 | + |
| 14 | +#ifndef LLDB_TARGET_COREFILEMEMORYRANGES_H |
| 15 | +#define LLDB_TARGET_COREFILEMEMORYRANGES_H |
| 16 | + |
| 17 | +namespace lldb_private { |
| 18 | + |
| 19 | +struct CoreFileMemoryRange { |
| 20 | + llvm::AddressRange range; /// The address range to save into the core file. |
| 21 | + uint32_t lldb_permissions; /// A bit set of lldb::Permissions bits. |
| 22 | + |
| 23 | + bool operator==(const CoreFileMemoryRange &rhs) const { |
| 24 | + return range == rhs.range && lldb_permissions == rhs.lldb_permissions; |
| 25 | + } |
| 26 | + |
| 27 | + bool operator!=(const CoreFileMemoryRange &rhs) const { |
| 28 | + return !(*this == rhs); |
| 29 | + } |
| 30 | + |
| 31 | + bool operator<(const CoreFileMemoryRange &rhs) const { |
| 32 | + if (range < rhs.range) |
| 33 | + return true; |
| 34 | + if (range == rhs.range) |
| 35 | + return lldb_permissions < rhs.lldb_permissions; |
| 36 | + return false; |
| 37 | + } |
| 38 | +}; |
| 39 | + |
| 40 | +class CoreFileMemoryRanges |
| 41 | + : public lldb_private::RangeDataVector<lldb::addr_t, lldb::addr_t, |
| 42 | + CoreFileMemoryRange> { |
| 43 | +public: |
| 44 | + /// Finalize and merge all overlapping ranges in this collection. Ranges |
| 45 | + /// will be seperated based on permissions. |
| 46 | + Status FinalizeCoreFileSaveRanges(); |
| 47 | +}; |
| 48 | +} // namespace lldb_private |
| 49 | + |
| 50 | +#endif // LLDB_TARGET_COREFILEMEMORYRANGES_H |
0 commit comments