Capture memory regions in snapshots
This commit is contained in:
@@ -53,7 +53,27 @@ namespace Bloom
|
||||
const auto hexData = QByteArray::fromHex(jsonObject.find("hexData")->toString().toUtf8());
|
||||
this->data = Targets::TargetMemoryBuffer(hexData.begin(), hexData.end());
|
||||
|
||||
// TODO: Memory regions
|
||||
if (jsonObject.contains("focusedRegions")) {
|
||||
for (const auto& regionValue : jsonObject.find("focusedRegions")->toArray()) {
|
||||
try {
|
||||
this->focusedRegions.emplace_back(regionValue.toObject());
|
||||
|
||||
} catch (Exception exception) {
|
||||
throw Exception("Invalid focused memory region");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (jsonObject.contains("excludedRegions")) {
|
||||
for (const auto& regionValue : jsonObject.find("excludedRegions")->toArray()) {
|
||||
try {
|
||||
this->excludedRegions.emplace_back(regionValue.toObject());
|
||||
|
||||
} catch (Exception exception) {
|
||||
throw Exception("Invalid excluded memory region");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QJsonObject MemorySnapshot::toJson() const {
|
||||
@@ -92,6 +112,25 @@ namespace Bloom
|
||||
return false;
|
||||
}
|
||||
|
||||
const auto& memoryAddressRange = memoryDescriptor.addressRange;
|
||||
for (const auto& focusedRegion : this->focusedRegions) {
|
||||
if (
|
||||
focusedRegion.addressRange.startAddress < memoryAddressRange.startAddress
|
||||
|| focusedRegion.addressRange.endAddress > memoryAddressRange.endAddress
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto& excludedRegion : this->excludedRegions) {
|
||||
if (
|
||||
excludedRegion.addressRange.startAddress < memoryAddressRange.startAddress
|
||||
|| excludedRegion.addressRange.endAddress > memoryAddressRange.endAddress
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,8 @@ namespace Bloom::Widgets
|
||||
const Targets::TargetMemoryDescriptor& memoryDescriptor,
|
||||
const std::optional<Targets::TargetMemoryBuffer>& data,
|
||||
const bool& staleData,
|
||||
const std::vector<FocusedMemoryRegion>& focusedMemoryRegions,
|
||||
const std::vector<ExcludedMemoryRegion>& excludedMemoryRegions,
|
||||
PaneState& state,
|
||||
PanelWidget* parent
|
||||
)
|
||||
@@ -28,6 +30,8 @@ namespace Bloom::Widgets
|
||||
, memoryDescriptor(memoryDescriptor)
|
||||
, data(data)
|
||||
, staleData(staleData)
|
||||
, focusedMemoryRegions(focusedMemoryRegions)
|
||||
, excludedMemoryRegions(excludedMemoryRegions)
|
||||
{
|
||||
this->setObjectName("snapshot-manager");
|
||||
this->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
||||
@@ -146,8 +150,8 @@ namespace Bloom::Widgets
|
||||
std::move(name),
|
||||
std::move(description),
|
||||
this->memoryDescriptor.type,
|
||||
{},
|
||||
{},
|
||||
captureFocusedRegions ? this->focusedMemoryRegions : std::vector<FocusedMemoryRegion>(),
|
||||
this->excludedMemoryRegions,
|
||||
captureDirectlyFromTarget ? std::nullopt : this->data
|
||||
),
|
||||
&QObject::deleteLater
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
|
||||
#include "src/Targets/TargetMemory.hpp"
|
||||
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/MemorySnapshot.hpp"
|
||||
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/FocusedMemoryRegion.hpp"
|
||||
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/ExcludedMemoryRegion.hpp"
|
||||
|
||||
#include "src/Insight/InsightWorker/Tasks/CaptureMemorySnapshot.hpp"
|
||||
|
||||
@@ -33,6 +35,8 @@ namespace Bloom::Widgets
|
||||
const Targets::TargetMemoryDescriptor& memoryDescriptor,
|
||||
const std::optional<Targets::TargetMemoryBuffer>& data,
|
||||
const bool& staleData,
|
||||
const std::vector<FocusedMemoryRegion>& focusedMemoryRegions,
|
||||
const std::vector<ExcludedMemoryRegion>& excludedMemoryRegions,
|
||||
PaneState& state,
|
||||
PanelWidget* parent = nullptr
|
||||
);
|
||||
@@ -49,6 +53,9 @@ namespace Bloom::Widgets
|
||||
const std::optional<Targets::TargetMemoryBuffer>& data;
|
||||
const bool& staleData;
|
||||
|
||||
const std::vector<FocusedMemoryRegion>& focusedMemoryRegions;
|
||||
const std::vector<ExcludedMemoryRegion>& excludedMemoryRegions;
|
||||
|
||||
QHash<QString, MemorySnapshot> snapshotsById;
|
||||
QHash<QString, MemorySnapshotItem*> snapshotItemsById;
|
||||
|
||||
|
||||
@@ -124,6 +124,8 @@ namespace Bloom::Widgets
|
||||
this->targetMemoryDescriptor,
|
||||
this->data,
|
||||
this->staleData,
|
||||
this->settings.focusedMemoryRegions,
|
||||
this->settings.excludedMemoryRegions,
|
||||
this->settings.snapshotManagerState,
|
||||
this->rightPanel
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user