Adding some more parsing
This commit is contained in:
parent
24917a40ab
commit
4420fee251
@ -7,7 +7,7 @@
|
||||
|
||||
namespace Dart {
|
||||
|
||||
enum class ClassId {
|
||||
enum class ClassId: uint64_t {
|
||||
Illegal = 0,
|
||||
NativePointer = 1,
|
||||
FreeListElement = 2,
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
//
|
||||
|
||||
#include "Snapshot.h"
|
||||
#include "ClassId.h"
|
||||
#include <stdexcept>
|
||||
#include <ranges>
|
||||
#include <sstream>
|
||||
@ -42,6 +43,18 @@ namespace Dart {
|
||||
_fieldTableLength = Leb128Int(data);
|
||||
data += _fieldTableLength.size();
|
||||
|
||||
_instructionsTableLength = Leb128Int(data);
|
||||
data += _instructionsTableLength.size();
|
||||
|
||||
uint64_t cidAndCanonical = *(uint64_t*)data;
|
||||
uint64_t cid = (cidAndCanonical >> 1) & 0xFFFFFFFF;
|
||||
bool canonical = cidAndCanonical & 1;
|
||||
|
||||
// If non-predefined (instance) cid
|
||||
if (cid >= (uint64_t)ClassId::NumPredefined || cid == (uint64_t)ClassId::Instance) {
|
||||
|
||||
}
|
||||
|
||||
auto nextInt = Leb128Int(data);
|
||||
auto val = nextInt.value();
|
||||
auto size = nextInt.size();
|
||||
@ -56,7 +69,7 @@ namespace Dart {
|
||||
case Kind::FULL: return "Full";
|
||||
case Kind::FULL_JIT: return "Full JIT";
|
||||
case Kind::FULL_AOT: return "Full AOT";
|
||||
case Kind::MESSAGE: return "Message";
|
||||
case Kind::FULL_CORE: return "Full core";
|
||||
case Kind::NONE: return "None";
|
||||
case Kind::INVALID: return "Invalid";
|
||||
}
|
||||
@ -109,4 +122,8 @@ namespace Dart {
|
||||
return _fieldTableLength.value();
|
||||
}
|
||||
|
||||
uint64_t Snapshot::instructionsTableLength() const {
|
||||
return _instructionsTableLength.value();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -17,7 +17,7 @@ namespace Dart {
|
||||
class Snapshot {
|
||||
public:
|
||||
enum class Kind: uint64_t {
|
||||
FULL, FULL_JIT, FULL_AOT, MESSAGE, NONE, INVALID
|
||||
FULL, FULL_CORE, FULL_JIT, FULL_AOT, NONE, INVALID
|
||||
};
|
||||
|
||||
static const uint32_t MAGIC = 0xDCDCF5F5;
|
||||
@ -32,6 +32,7 @@ namespace Dart {
|
||||
Leb128Int _allObjectsCount;
|
||||
Leb128Int _clustersCount;
|
||||
Leb128Int _fieldTableLength;
|
||||
Leb128Int _instructionsTableLength;
|
||||
|
||||
private:
|
||||
static std::vector<std::string> split(const std::string &str);
|
||||
@ -46,6 +47,7 @@ namespace Dart {
|
||||
[[nodiscard]] uint64_t allObjectsCount() const;
|
||||
[[nodiscard]] uint64_t clustersCount() const;
|
||||
[[nodiscard]] uint64_t fieldTableLength() const;
|
||||
[[nodiscard]] uint64_t instructionsTableLength() const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
1
main.cpp
1
main.cpp
@ -13,6 +13,7 @@ int main(int argc, char** argv) {
|
||||
std::cout << "All objects: " << snapshot.allObjectsCount() << std::endl;
|
||||
std::cout << "Clusters: " << snapshot.clustersCount() << std::endl;
|
||||
std::cout << "Field table length: " << snapshot.fieldTableLength() << std::endl;
|
||||
std::cout << "Instructions table length: " << snapshot.instructionsTableLength() << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user