Change the RemoteMirror API to have extensible data layout callback (#15291)

* Change the RemoteMirror API to have extensible data layout callback

* Use DLQ_Get prefix on DataLayoutQueryType enum values

* Simplify MemoryReaderImpl and synthesize minimalDataLayoutQueryFunction
This commit is contained in:
Kuba (Brecka) Mracek
2018-03-16 14:54:04 -07:00
committed by GitHub
parent 60a6c02328
commit 84e71b8d7a
8 changed files with 170 additions and 82 deletions

View File

@@ -27,12 +27,22 @@ namespace remote {
/// An implementation of MemoryReader which simply reads from the current
/// address space.
class InProcessMemoryReader final : public MemoryReader {
uint8_t getPointerSize() override {
return sizeof(uintptr_t);
}
bool queryDataLayout(DataLayoutQueryType type, void *inBuffer,
void *outBuffer) override {
switch (type) {
case DLQ_GetPointerSize: {
auto result = static_cast<uint8_t *>(outBuffer);
*result = sizeof(void *);
return true;
}
case DLQ_GetSizeSize: {
auto result = static_cast<uint8_t *>(outBuffer);
*result = sizeof(size_t);
return true;
}
}
uint8_t getSizeSize() override {
return sizeof(size_t);
return false;
}
RemoteAddress getSymbolAddress(const std::string &name) override;