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());
|
const auto hexData = QByteArray::fromHex(jsonObject.find("hexData")->toString().toUtf8());
|
||||||
this->data = Targets::TargetMemoryBuffer(hexData.begin(), hexData.end());
|
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 {
|
QJsonObject MemorySnapshot::toJson() const {
|
||||||
@@ -92,6 +112,25 @@ namespace Bloom
|
|||||||
return false;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ namespace Bloom::Widgets
|
|||||||
const Targets::TargetMemoryDescriptor& memoryDescriptor,
|
const Targets::TargetMemoryDescriptor& memoryDescriptor,
|
||||||
const std::optional<Targets::TargetMemoryBuffer>& data,
|
const std::optional<Targets::TargetMemoryBuffer>& data,
|
||||||
const bool& staleData,
|
const bool& staleData,
|
||||||
|
const std::vector<FocusedMemoryRegion>& focusedMemoryRegions,
|
||||||
|
const std::vector<ExcludedMemoryRegion>& excludedMemoryRegions,
|
||||||
PaneState& state,
|
PaneState& state,
|
||||||
PanelWidget* parent
|
PanelWidget* parent
|
||||||
)
|
)
|
||||||
@@ -28,6 +30,8 @@ namespace Bloom::Widgets
|
|||||||
, memoryDescriptor(memoryDescriptor)
|
, memoryDescriptor(memoryDescriptor)
|
||||||
, data(data)
|
, data(data)
|
||||||
, staleData(staleData)
|
, staleData(staleData)
|
||||||
|
, focusedMemoryRegions(focusedMemoryRegions)
|
||||||
|
, excludedMemoryRegions(excludedMemoryRegions)
|
||||||
{
|
{
|
||||||
this->setObjectName("snapshot-manager");
|
this->setObjectName("snapshot-manager");
|
||||||
this->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
this->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
||||||
@@ -146,8 +150,8 @@ namespace Bloom::Widgets
|
|||||||
std::move(name),
|
std::move(name),
|
||||||
std::move(description),
|
std::move(description),
|
||||||
this->memoryDescriptor.type,
|
this->memoryDescriptor.type,
|
||||||
{},
|
captureFocusedRegions ? this->focusedMemoryRegions : std::vector<FocusedMemoryRegion>(),
|
||||||
{},
|
this->excludedMemoryRegions,
|
||||||
captureDirectlyFromTarget ? std::nullopt : this->data
|
captureDirectlyFromTarget ? std::nullopt : this->data
|
||||||
),
|
),
|
||||||
&QObject::deleteLater
|
&QObject::deleteLater
|
||||||
|
|||||||
@@ -13,6 +13,8 @@
|
|||||||
|
|
||||||
#include "src/Targets/TargetMemory.hpp"
|
#include "src/Targets/TargetMemory.hpp"
|
||||||
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/MemorySnapshot.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"
|
#include "src/Insight/InsightWorker/Tasks/CaptureMemorySnapshot.hpp"
|
||||||
|
|
||||||
@@ -33,6 +35,8 @@ namespace Bloom::Widgets
|
|||||||
const Targets::TargetMemoryDescriptor& memoryDescriptor,
|
const Targets::TargetMemoryDescriptor& memoryDescriptor,
|
||||||
const std::optional<Targets::TargetMemoryBuffer>& data,
|
const std::optional<Targets::TargetMemoryBuffer>& data,
|
||||||
const bool& staleData,
|
const bool& staleData,
|
||||||
|
const std::vector<FocusedMemoryRegion>& focusedMemoryRegions,
|
||||||
|
const std::vector<ExcludedMemoryRegion>& excludedMemoryRegions,
|
||||||
PaneState& state,
|
PaneState& state,
|
||||||
PanelWidget* parent = nullptr
|
PanelWidget* parent = nullptr
|
||||||
);
|
);
|
||||||
@@ -49,6 +53,9 @@ namespace Bloom::Widgets
|
|||||||
const std::optional<Targets::TargetMemoryBuffer>& data;
|
const std::optional<Targets::TargetMemoryBuffer>& data;
|
||||||
const bool& staleData;
|
const bool& staleData;
|
||||||
|
|
||||||
|
const std::vector<FocusedMemoryRegion>& focusedMemoryRegions;
|
||||||
|
const std::vector<ExcludedMemoryRegion>& excludedMemoryRegions;
|
||||||
|
|
||||||
QHash<QString, MemorySnapshot> snapshotsById;
|
QHash<QString, MemorySnapshot> snapshotsById;
|
||||||
QHash<QString, MemorySnapshotItem*> snapshotItemsById;
|
QHash<QString, MemorySnapshotItem*> snapshotItemsById;
|
||||||
|
|
||||||
|
|||||||
@@ -124,6 +124,8 @@ namespace Bloom::Widgets
|
|||||||
this->targetMemoryDescriptor,
|
this->targetMemoryDescriptor,
|
||||||
this->data,
|
this->data,
|
||||||
this->staleData,
|
this->staleData,
|
||||||
|
this->settings.focusedMemoryRegions,
|
||||||
|
this->settings.excludedMemoryRegions,
|
||||||
this->settings.snapshotManagerState,
|
this->settings.snapshotManagerState,
|
||||||
this->rightPanel
|
this->rightPanel
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user