New Focused and Excluded memory regions
This commit is contained in:
@@ -191,6 +191,7 @@ add_executable(Bloom
|
||||
|
||||
# Target memory inspection pane
|
||||
src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/TargetMemoryInspectionPane.cpp
|
||||
src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/MemoryRegion.cpp
|
||||
src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/HexViewerWidget.cpp
|
||||
src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/ByteItemContainerGraphicsView.cpp
|
||||
src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/ByteItemGraphicsScene.cpp
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include "MemoryRegion.hpp"
|
||||
|
||||
namespace Bloom
|
||||
{
|
||||
class ExcludedMemoryRegion: public MemoryRegion
|
||||
{
|
||||
public:
|
||||
explicit ExcludedMemoryRegion(
|
||||
const QString& name,
|
||||
const Targets::TargetMemoryDescriptor& memoryDescriptor,
|
||||
const Targets::TargetMemoryAddressRange& addressRange
|
||||
): MemoryRegion(name, MemoryRegionType::EXCLUDED, memoryDescriptor, addressRange) {};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include "MemoryRegion.hpp"
|
||||
|
||||
namespace Bloom
|
||||
{
|
||||
enum class MemoryRegionDataType: std::uint8_t
|
||||
{
|
||||
UNKNOWN,
|
||||
INTEGER,
|
||||
ASCII_STRING,
|
||||
};
|
||||
|
||||
class FocusedMemoryRegion: public MemoryRegion
|
||||
{
|
||||
public:
|
||||
MemoryRegionDataType dataType = MemoryRegionDataType::UNKNOWN;
|
||||
|
||||
explicit FocusedMemoryRegion(
|
||||
const QString& name,
|
||||
const Targets::TargetMemoryDescriptor& memoryDescriptor,
|
||||
const Targets::TargetMemoryAddressRange& addressRange
|
||||
): MemoryRegion(name, MemoryRegionType::FOCUSED, memoryDescriptor, addressRange) {};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
#include "MemoryRegion.hpp"
|
||||
|
||||
using namespace Bloom;
|
||||
|
||||
using Bloom::Targets::TargetMemoryAddressRange;
|
||||
|
||||
TargetMemoryAddressRange MemoryRegion::getAbsoluteAddressRange() const {
|
||||
if (this->addressRangeType == MemoryRegionAddressType::ABSOLUTE) {
|
||||
return this->addressRange;
|
||||
}
|
||||
|
||||
return TargetMemoryAddressRange(
|
||||
this->addressRange.startAddress + this->memoryDescriptor.addressRange.startAddress,
|
||||
this->addressRange.endAddress + this->memoryDescriptor.addressRange.startAddress
|
||||
);
|
||||
}
|
||||
|
||||
TargetMemoryAddressRange MemoryRegion::getRelativeAddressRange() const {
|
||||
if (this->addressRangeType == MemoryRegionAddressType::RELATIVE) {
|
||||
return this->addressRange;
|
||||
}
|
||||
|
||||
return TargetMemoryAddressRange(
|
||||
this->addressRange.startAddress - this->memoryDescriptor.addressRange.startAddress,
|
||||
this->addressRange.endAddress - this->memoryDescriptor.addressRange.startAddress
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <atomic>
|
||||
#include <QString>
|
||||
#include <utility>
|
||||
|
||||
#include "src/Targets/TargetMemory.hpp"
|
||||
#include "src/Helpers/DateTime.hpp"
|
||||
|
||||
namespace Bloom
|
||||
{
|
||||
enum class MemoryRegionType: std::uint8_t
|
||||
{
|
||||
FOCUSED,
|
||||
EXCLUDED,
|
||||
};
|
||||
|
||||
enum class MemoryRegionAddressType: std::uint8_t
|
||||
{
|
||||
ABSOLUTE,
|
||||
RELATIVE,
|
||||
};
|
||||
|
||||
class MemoryRegion
|
||||
{
|
||||
public:
|
||||
std::size_t id = MemoryRegion::lastId++;
|
||||
QString name;
|
||||
QDateTime createdDate = DateTime::currentDateTime();
|
||||
MemoryRegionType type;
|
||||
const Targets::TargetMemoryDescriptor& memoryDescriptor;
|
||||
Targets::TargetMemoryAddressRange addressRange;
|
||||
MemoryRegionAddressType addressRangeType = MemoryRegionAddressType::ABSOLUTE;
|
||||
|
||||
MemoryRegion(
|
||||
QString name,
|
||||
MemoryRegionType type,
|
||||
const Targets::TargetMemoryDescriptor& memoryDescriptor,
|
||||
const Targets::TargetMemoryAddressRange& addressRange
|
||||
): name(std::move(name)), type(type), memoryDescriptor(memoryDescriptor), addressRange(addressRange) {};
|
||||
|
||||
bool operator == (const MemoryRegion& other) const {
|
||||
return this->id == other.id;
|
||||
}
|
||||
|
||||
bool operator != (const MemoryRegion& other) const {
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
[[nodiscard]] bool intersectsWith(const MemoryRegion& other) const {
|
||||
return this->getAbsoluteAddressRange().intersectsWith(other.getAbsoluteAddressRange());
|
||||
}
|
||||
|
||||
[[nodiscard]] Targets::TargetMemoryAddressRange getAbsoluteAddressRange() const;
|
||||
[[nodiscard]] Targets::TargetMemoryAddressRange getRelativeAddressRange() const;
|
||||
|
||||
private:
|
||||
static inline std::atomic<std::size_t> lastId = 0;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user