AuroraRuntime/Include/Aurora/Telemetry/BlackBox.hpp

167 lines
3.7 KiB
C++
Raw Normal View History

2021-06-27 21:25:29 +00:00
/***
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;
2021-06-27 21:25:29 +00:00
};
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;
};
2022-01-19 18:18:13 +00:00
// TODO: port to lui
using StreamWriter = AuFunction<void(AuUInt8 stream, const AuUInt8 *buffer, AuUInt32 length)>;
using StreamReader = AuFunction<void(AuUInt8 stream, AuUInt8 *buffer, AuUInt32 &length)>;
2021-06-27 21:25:29 +00:00
AUKN_SYM AuList<NewBlockboxEntry> ReadBlackboxStream(const StreamReader &reader);
AUKN_SYM void WriteBlackboxStream(const AuList<NewBlockboxEntry> &, StreamWriter writer);
}