/*** Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved. File: BlackBox.hpp Date: 2021-6-10 Author: Reece ***/ #pragma once namespace Aurora::Telemetry { enum class ENewBlackBoxEntry { eSpecsMetadata, eMessage, eStackWarning, eWinCxxException, eAccessViolation, eAssertion, ePanic, eLog, eScreenshot, eMinidump, eAnnounceMap, eAnnounceThreadName, eAnnounceApplication, eAnnounceSymbols }; struct NewBlockboxEntryMessage { AuUInt address; AuUInt32 category; AuString message; AuUInt32 threadId; }; struct NewBlockBoxEntryStackReport { Debug::StackTrace backtrace; }; struct NewBlackboxEntryUpdateMapEntry { AuUInt base; AuUInt size; char perms[6]; AuString module; }; struct NewBlackboxEntryUpdateMap { Aurora::Process::Segments map; }; enum class ENewBlackBoxAccessViolation { eUnknown, eNXViolation, eWriteViolation, eMissingPage }; struct NewBlockBoxEntryMemoryViolation { AuUInt address; AuUInt code; ENewBlackBoxAccessViolation type; NewBlockBoxEntryStackReport stack; }; struct NewBlockBoxEntryWin32CxxException { NewBlockBoxEntryStackReport stack; AuString str; }; struct NewBlockboxEntryBasicMessage { Console::ConsoleMessage message; }; enum class ENewBlackBoxResourceType { eLocal, eResource }; struct NewBlackBoxResource { ENewBlackBoxResourceType type; AuString path; int resourceId; }; struct NewBlackBoxEntryScreenshot { NewBlackBoxResource resource; }; enum class MinidumpType { eMSVC, eBreakpadMSVC, eBrokenElfRamDump, eMagicalMinidump, eExternalEcosystemTransaction }; struct NewBlackBoxEntryMinidump { MinidumpType type; bool includesRx; Aurora::Build::EPlatform platform; NewBlackBoxResource resource; }; struct NewBlockboxEntryReportSpecs { Aurora::Build::EPlatform platform; Aurora::Build::ECompiler compiler; Aurora::Build::EABI abi; Aurora::HWInfo::CpuInfo cpuInfo; Aurora::HWInfo::RamStat sysMem; Aurora::HWInfo::RamStat procMem; }; struct NewBlackBoxEntryReportApplication { AuUInt16 applicationServiceNumber; AuString applicationExecutableName; AuString applicationPath; AuString locality; }; struct NewBlackBoxEntryMapThread { AuUInt64 id; AuUInt64 name; }; struct NewBlockboxEntry { ENewBlackBoxEntry type; NewBlackBoxEntryReportApplication process; NewBlockboxEntryReportSpecs specs; NewBlockboxEntryMessage message; NewBlockboxEntryMessage assertion; NewBlockBoxEntryStackReport stack; NewBlockBoxEntryWin32CxxException wincxx; NewBlockboxEntryBasicMessage log; NewBlockboxEntryBasicMessage panic; NewBlockBoxEntryMemoryViolation violation; NewBlackBoxEntryMinidump minidump; NewBlackboxEntryUpdateMap map; }; using StreamWriter = std::function; using StreamReader = std::function; AUKN_SYM AuList ReadBlackboxStream(const StreamReader &reader); AUKN_SYM void WriteBlackboxStream(const AuList &, StreamWriter writer); }