-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
ReadTargetMemory.hpp
58 lines (46 loc) · 1.73 KB
/
ReadTargetMemory.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#pragma once
#include <cstdint>
#include <set>
#include "Command.hpp"
#include "src/TargetController/Responses/TargetMemoryRead.hpp"
#include "src/Targets/TargetMemory.hpp"
namespace TargetController::Commands
{
class ReadTargetMemory: public Command
{
public:
using SuccessResponseType = Responses::TargetMemoryRead;
static constexpr CommandType type = CommandType::READ_TARGET_MEMORY;
static const inline std::string name = "ReadTargetMemory";
Targets::TargetMemoryType memoryType;
Targets::TargetMemoryAddress startAddress;
Targets::TargetMemorySize bytes;
/**
* Currently, we only cache program memory. This flag has no effect when reading from other memories.
*/
bool bypassCache;
std::set<Targets::TargetMemoryAddressRange> excludedAddressRanges;
ReadTargetMemory(
Targets::TargetMemoryType memoryType,
Targets::TargetMemoryAddress startAddress,
Targets::TargetMemorySize bytes,
bool bypassCache = false,
const std::set<Targets::TargetMemoryAddressRange>& excludedAddressRanges = {}
)
: memoryType(memoryType)
, startAddress(startAddress)
, bytes(bytes)
, bypassCache(bypassCache)
, excludedAddressRanges(excludedAddressRanges)
{};
[[nodiscard]] CommandType getType() const override {
return ReadTargetMemory::type;
}
[[nodiscard]] bool requiresStoppedTargetState() const override {
return true;
}
[[nodiscard]] bool requiresDebugMode() const override {
return this->memoryType == Targets::TargetMemoryType::RAM;
}
};
}