unflutter/dart/Reader.h

42 lines
841 B
C++

//
// Created by selim on 27.11.22.
//
#ifndef UNFLUTTER_READER_H
#define UNFLUTTER_READER_H
#include "elfio/elfio.hpp"
#include "Snapshot.h"
#include <filesystem>
namespace fs = std::filesystem;
namespace Dart {
enum class DartSnapshot {
VM_INSTRUCTIONS,
VM_DATA,
ISOLATE_INSTRUCTIONS,
ISOLATE_DATA,
BUILD_ID
};
class Reader {
private:
ELFIO::elfio _elfio;
std::unique_ptr<std::byte[]> _file;
private:
static std::string getSnapshotName(DartSnapshot snapshot) ;
public:
explicit Reader(const fs::path& path);
void dumpInfo() const;
[[nodiscard]] const std::byte* getSnapshotPtr(DartSnapshot snapshot) const;
[[nodiscard]] Snapshot getSnapshot(DartSnapshot snapshot) const;
};
}
#endif //UNFLUTTER_READER_H