-
Notifications
You must be signed in to change notification settings - Fork 4.6k
/
crashreportwriter.h
47 lines (41 loc) · 1.41 KB
/
crashreportwriter.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
#pragma once
#define JSON_INDENT_VALUE 1
class CrashReportWriter
{
private:
int m_fd;
int m_indent;
bool m_comma;
CrashInfo& m_crashInfo;
// no public copy constructor
CrashReportWriter(const CrashReportWriter&) = delete;
void operator=(const CrashReportWriter&) = delete;
public:
CrashReportWriter(CrashInfo& crashInfo);
virtual ~CrashReportWriter();
void WriteCrashReport(const std::string& dumpFileName);
private:
void WriteCrashReport();
#ifdef __APPLE__
void WriteSysctl(const char* sysctlname, const char* valueName);
#endif
void WriteStackFrame(const StackFrame& frame);
void Write(const std::string& text);
void Write(const char* buffer);
void Indent(std::string& text);
void WriteSeparator(std::string& text);
void OpenValue(const char* key, char marker);
void CloseValue(char marker);
bool OpenWriter(const char* fileName);
void CloseWriter();
void WriteValue(const char* key, const char* value);
void WriteValueBool(const char* key, bool value);
void WriteValue32(const char* key, uint32_t value);
void WriteValue64(const char* key, uint64_t value);
void OpenObject(const char* key = nullptr);
void CloseObject();
void OpenArray(const char* key);
void CloseArray();
};