creport: Try to take screenshot of application crashes on 9.x+

This commit is contained in:
Michael Scire
2020-04-22 14:50:16 -07:00
parent 93e0c9194d
commit 6ac1ff6f24
9 changed files with 201 additions and 23 deletions

View File

@@ -22,28 +22,35 @@ namespace ams::creport {
class CrashReport {
private:
static constexpr size_t DyingMessageSizeMax = os::MemoryPageSize;
static constexpr size_t MemoryHeapSize = 512_KB;
static_assert(MemoryHeapSize >= DyingMessageSizeMax + sizeof(ModuleList) + sizeof(ThreadList) + os::MemoryPageSize);
private:
Handle debug_handle = INVALID_HANDLE;
bool has_extra_info = true;
Result result = ResultIncompleteReport();
/* Meta, used for building module/thread list. */
std::map<u64, u64> thread_tls_map;
/* Attach process info. */
svc::DebugInfoAttachProcess process_info = {};
u64 dying_message_address = 0;
u64 dying_message_size = 0;
u8 dying_message[DyingMessageSizeMax] = {};
u8 *dying_message = nullptr;
/* Exception info. */
svc::DebugInfoException exception_info = {};
u64 module_base_address = 0;
u64 crashed_thread_id = 0;
ThreadInfo crashed_thread;
/* Lists. */
ModuleList module_list;
ThreadList thread_list;
ModuleList *module_list = nullptr;
ThreadList *thread_list = nullptr;
/* Meta, used for building module/thread list. */
std::map<u64, u64> thread_tls_map;
/* Memory heap. */
lmem::HeapHandle heap_handle;
u8 heap_storage[MemoryHeapSize];
public:
Result GetResult() const {
return this->result;
@@ -80,6 +87,8 @@ namespace ams::creport {
}
}
void Initialize();
void BuildReport(os::ProcessId process_id, bool has_extra_info);
void GetFatalContext(::FatalCpuContext *out) const;
void SaveReport();