#include "binary_annotator.h"
#include <algorithm>
#include <cstdint>
#include <iostream>
#include <limits>
#include <string>
#include <vector>
#include "flatbuffers/base.h"
#include "flatbuffers/reflection.h"
#include "flatbuffers/util.h"
#include "flatbuffers/verifier.h"
namespace flatbuffers {
namespace {
static bool BinaryRegionSort(const BinaryRegion &a, const BinaryRegion &b) { … }
static void SetError(BinaryRegionComment &comment, BinaryRegionStatus status,
std::string message = "") { … }
static BinaryRegion MakeBinaryRegion(
const uint64_t offset = 0, const uint64_t length = 0,
const BinaryRegionType type = BinaryRegionType::Unknown,
const uint64_t array_length = 0, const uint64_t points_to_offset = 0,
BinaryRegionComment comment = { … }
static BinarySection MakeBinarySection(const std::string &name,
const BinarySectionType type,
std::vector<BinaryRegion> regions) { … }
static BinarySection MakeSingleRegionBinarySection(const std::string &name,
const BinarySectionType type,
const BinaryRegion ®ion) { … }
static bool IsNonZeroRegion(const uint64_t offset, const uint64_t length,
const uint8_t *const binary) { … }
static bool IsPrintableRegion(const uint64_t offset, const uint64_t length,
const uint8_t *const binary) { … }
static BinarySection GenerateMissingSection(const uint64_t offset,
const uint64_t length,
const uint8_t *const binary) { … }
}
std::map<uint64_t, BinarySection> BinaryAnnotator::Annotate() { … }
uint64_t BinaryAnnotator::BuildHeader(const uint64_t header_offset) { … }
BinaryAnnotator::VTable *BinaryAnnotator::GetOrBuildVTable(
const uint64_t vtable_offset, const reflection::Object *const table,
const uint64_t offset_of_referring_table) { … }
void BinaryAnnotator::BuildTable(const uint64_t table_offset,
const BinarySectionType type,
const reflection::Object *const table) { … }
uint64_t BinaryAnnotator::BuildStruct(const uint64_t struct_offset,
std::vector<BinaryRegion> ®ions,
const std::string referring_field_name,
const reflection::Object *const object) { … }
void BinaryAnnotator::BuildString(const uint64_t string_offset,
const reflection::Object *const table,
const reflection::Field *const field) { … }
void BinaryAnnotator::BuildVector(
const uint64_t vector_offset, const reflection::Object *const table,
const reflection::Field *const field, const uint64_t parent_table_offset,
const std::map<uint16_t, VTable::Entry> vtable_fields) { … }
std::string BinaryAnnotator::BuildUnion(const uint64_t union_offset,
const uint8_t realized_type,
const reflection::Field *const field) { … }
void BinaryAnnotator::FixMissingRegions() { … }
void BinaryAnnotator::FixMissingSections() { … }
bool BinaryAnnotator::ContainsSection(const uint64_t offset) { … }
const reflection::Object *BinaryAnnotator::RootTable() const { … }
}