/*** 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, eAccessViolation, eAssertion, ePanic, eLog, eScreenshot, eMinidump, eAnnounceMap, eAnnounceThreadName, eAnnounceApplication, eAnnounceSymbols }; struct NewBlockboxEntryMessage { AuUInt address; AuUInt32 category; AuString message; AuUInt32 threadId; }; struct NewBlockBoxEntryStackReport { AuString str; Debug::StackTrace backtrace; AuUInt32 fenceId; }; struct NewBlackboxEntryUpdateMapEntry { AuUInt base; AuUInt size; char perms[6]; AuString module; }; struct NewBlackboxEntryUpdateMap { Aurora::Process::Sections map; }; enum class ENewBlackBoxAccessViolation { eUnknown, eNXViolation, eWriteViolation, eMissingPage }; struct NewBlockBoxEntryMemoryViolation { AuUInt address; AuUInt code; ENewBlackBoxAccessViolation type; NewBlockBoxEntryStackReport stack; }; 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 ramMem; Aurora::HWInfo::RamStat procCommitMem; Aurora::HWInfo::RamStat procLowerMem; }; 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; NewBlockboxEntryBasicMessage log; NewBlockboxEntryBasicMessage panic; NewBlockBoxEntryMemoryViolation violation; NewBlackBoxEntryMinidump minidump; NewBlackboxEntryUpdateMap map; }; // TODO: port to lui using StreamWriter = AuFunction; using StreamReader = AuFunction; AUKN_SYM AuList ReadBlackboxStream(const StreamReader &reader); AUKN_SYM void WriteBlackboxStream(const AuList &, StreamWriter writer); }