-
Notifications
You must be signed in to change notification settings - Fork 11.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[LLDB] Reapply SBSaveCore Add Memory List #107937
Changes from all commits
2bdc8c0
db07089
11a0289
2b174ca
f172f08
36e814d
a381ddc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
//===-- CoreFileMemoryRanges.h ----------------------------------*- 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/Utility/RangeMap.h" | ||
#include "lldb/Utility/Status.h" | ||
|
||
#include "llvm/ADT/AddressRanges.h" | ||
|
||
#ifndef LLDB_TARGET_COREFILEMEMORYRANGES_H | ||
#define LLDB_TARGET_COREFILEMEMORYRANGES_H | ||
|
||
namespace lldb_private { | ||
|
||
struct CoreFileMemoryRange { | ||
llvm::AddressRange range; /// The address range to save into the core file. | ||
uint32_t lldb_permissions; /// A bit set of lldb::Permissions bits. | ||
|
||
bool operator==(const CoreFileMemoryRange &rhs) const { | ||
return range == rhs.range && lldb_permissions == rhs.lldb_permissions; | ||
} | ||
|
||
bool operator!=(const CoreFileMemoryRange &rhs) const { | ||
return !(*this == rhs); | ||
} | ||
|
||
bool operator<(const CoreFileMemoryRange &rhs) const { | ||
if (range < rhs.range) | ||
return true; | ||
if (range == rhs.range) | ||
return lldb_permissions < rhs.lldb_permissions; | ||
return false; | ||
} | ||
}; | ||
|
||
class CoreFileMemoryRanges | ||
: public lldb_private::RangeDataVector<lldb::addr_t, lldb::addr_t, | ||
CoreFileMemoryRange> { | ||
public: | ||
/// Finalize and merge all overlapping ranges in this collection. Ranges | ||
/// will be seperated based on permissions. | ||
Status FinalizeCoreFileSaveRanges(); | ||
}; | ||
} // namespace lldb_private | ||
|
||
#endif // LLDB_TARGET_COREFILEMEMORYRANGES_H |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -450,6 +450,12 @@ class RangeDataVector { | |
|
||
void Append(const Entry &entry) { m_entries.emplace_back(entry); } | ||
|
||
/// Append a range with data to the vector | ||
/// \param B The base of the memory range | ||
/// \param S The size of the memory range | ||
/// \param T The data associated with the memory range | ||
void Append(B &&b, S &&s, T &&t) { m_entries.emplace_back(Entry(b, s, t)); } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit to self, add code comments about Base Size And Data There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why not just name then base, size, data? Then the reader doesn't have to read the function contract. Also, would be curious what the guideline says about single letter naming for variables. |
||
|
||
bool Erase(uint32_t start, uint32_t end) { | ||
if (start >= end || end > m_entries.size()) | ||
return false; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you might need to explicitly inherit the ctors: