AuroraRuntime/Include/Aurora/Telemetry/BlackBox.hpp
Reece 510928e62e [*] Linux should not raise int3 unless the binary is a debug one
TODO: investigate registering an int3 signal handler to prevent crashing under internal builds
[*] Amend MemoryViews
[*] Begin shifting towards MemoryView based binary APIs
[*] Fix public RSA key leak
[+] Some clean up and possible bug fixes
2021-09-15 00:56:26 +01:00

166 lines
3.7 KiB
C++

/***
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<void(AuUInt8 stream, const AuUInt8 *buffer, AuUInt32 length)>;
using StreamReader = std::function<void(AuUInt8 stream, AuUInt8 *buffer, AuUInt32 &length)>;
AUKN_SYM AuList<NewBlockboxEntry> ReadBlackboxStream(const StreamReader &reader);
AUKN_SYM void WriteBlackboxStream(const AuList<NewBlockboxEntry> &, StreamWriter writer);
}