Sanitised loaded memory regions
This commit is contained in:
@@ -194,27 +194,50 @@ void TargetMemoryInspectionPane::postDeactivate() {
|
|||||||
|
|
||||||
void TargetMemoryInspectionPane::sanitiseSettings() {
|
void TargetMemoryInspectionPane::sanitiseSettings() {
|
||||||
// Remove any invalid memory regions. It's very unlikely that there will be any, but not impossible.
|
// Remove any invalid memory regions. It's very unlikely that there will be any, but not impossible.
|
||||||
this->settings.focusedMemoryRegions.erase(
|
auto processedFocusedMemoryRegions = std::vector<FocusedMemoryRegion>();
|
||||||
std::remove_if(
|
auto processedExcludedMemoryRegions = std::vector<ExcludedMemoryRegion>();
|
||||||
this->settings.focusedMemoryRegions.begin(),
|
|
||||||
this->settings.focusedMemoryRegions.end(),
|
|
||||||
[this] (const FocusedMemoryRegion& region) {
|
|
||||||
return !this->targetMemoryDescriptor.addressRange.contains(region.addressRange);
|
|
||||||
}
|
|
||||||
),
|
|
||||||
this->settings.focusedMemoryRegions.end()
|
|
||||||
);
|
|
||||||
|
|
||||||
this->settings.excludedMemoryRegions.erase(
|
const auto regionIntersects = [
|
||||||
std::remove_if(
|
&processedFocusedMemoryRegions,
|
||||||
this->settings.excludedMemoryRegions.begin(),
|
&processedExcludedMemoryRegions
|
||||||
this->settings.excludedMemoryRegions.end(),
|
] (const MemoryRegion& region) {
|
||||||
[this] (const ExcludedMemoryRegion& region) {
|
for (const auto& processedFocusedRegion : processedFocusedMemoryRegions) {
|
||||||
return !this->targetMemoryDescriptor.addressRange.contains(region.addressRange);
|
if (processedFocusedRegion.intersectsWith(region)) {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
),
|
}
|
||||||
this->settings.excludedMemoryRegions.end()
|
|
||||||
);
|
for (const auto& processedExcludedRegion : processedExcludedMemoryRegions) {
|
||||||
|
if (processedExcludedRegion.intersectsWith(region)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
for (const auto& focusedRegion : this->settings.focusedMemoryRegions) {
|
||||||
|
if (!this->targetMemoryDescriptor.addressRange.contains(focusedRegion.addressRange)
|
||||||
|
|| regionIntersects(focusedRegion)
|
||||||
|
) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
processedFocusedMemoryRegions.emplace_back(focusedRegion);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const auto& excludedRegion : this->settings.excludedMemoryRegions) {
|
||||||
|
if (!this->targetMemoryDescriptor.addressRange.contains(excludedRegion.addressRange)
|
||||||
|
|| regionIntersects(excludedRegion)
|
||||||
|
) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
processedExcludedMemoryRegions.emplace_back(excludedRegion);
|
||||||
|
}
|
||||||
|
|
||||||
|
this->settings.focusedMemoryRegions = std::move(processedFocusedMemoryRegions);
|
||||||
|
this->settings.excludedMemoryRegions = std::move(processedExcludedMemoryRegions);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TargetMemoryInspectionPane::onTargetStateChanged(Targets::TargetState newState) {
|
void TargetMemoryInspectionPane::onTargetStateChanged(Targets::TargetState newState) {
|
||||||
|
|||||||
Reference in New Issue
Block a user