Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:42:53

0001 //===-- CoreFileMemoryRanges.h ----------------------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #include "lldb/Utility/RangeMap.h"
0010 #include "lldb/Utility/Status.h"
0011 #include "lldb/Utility/StreamString.h"
0012 
0013 #include "llvm/ADT/AddressRanges.h"
0014 
0015 #ifndef LLDB_TARGET_COREFILEMEMORYRANGES_H
0016 #define LLDB_TARGET_COREFILEMEMORYRANGES_H
0017 
0018 namespace lldb_private {
0019 
0020 struct CoreFileMemoryRange {
0021   llvm::AddressRange range;  /// The address range to save into the core file.
0022   uint32_t lldb_permissions; /// A bit set of lldb::Permissions bits.
0023 
0024   bool operator==(const CoreFileMemoryRange &rhs) const {
0025     return range == rhs.range && lldb_permissions == rhs.lldb_permissions;
0026   }
0027 
0028   bool operator!=(const CoreFileMemoryRange &rhs) const {
0029     return !(*this == rhs);
0030   }
0031 
0032   bool operator<(const CoreFileMemoryRange &rhs) const {
0033     if (range < rhs.range)
0034       return true;
0035     if (range == rhs.range)
0036       return lldb_permissions < rhs.lldb_permissions;
0037     return false;
0038   }
0039 
0040   std::string Dump() const {
0041     lldb_private::StreamString stream;
0042     stream << "[";
0043     stream.PutHex64(range.start());
0044     stream << '-';
0045     stream.PutHex64(range.end());
0046     stream << ")";
0047     return stream.GetString().str();
0048   }
0049 };
0050 
0051 class CoreFileMemoryRanges
0052     : public lldb_private::RangeDataVector<lldb::addr_t, lldb::addr_t,
0053                                            CoreFileMemoryRange> {
0054 public:
0055   /// Finalize and merge all overlapping ranges in this collection. Ranges
0056   /// will be seperated based on permissions.
0057   Status FinalizeCoreFileSaveRanges();
0058 };
0059 } // namespace lldb_private
0060 
0061 #endif // LLDB_TARGET_COREFILEMEMORYRANGES_H