1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 * vim: set ts=8 sts=4 et sw=4 tw=99:
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef jscrashformat_h
8 #define jscrashformat_h
13 static const int crash_cookie_len
= 16;
14 static const char crash_cookie
[crash_cookie_len
] = "*J*S*CRASHDATA*";
16 /* These values are used for CrashHeader::id. */
18 JS_CRASH_STACK_GC
= 0x400,
19 JS_CRASH_STACK_ERROR
= 0x401,
24 * All the data here will be stored directly in the minidump, so we use
25 * platform-independent types. We also ensure that the size of every field is a
26 * multiple of 8 bytes, to guarantee that they won't be padded.
31 char cookie
[crash_cookie_len
];
33 /* id of the crash data, chosen from the enum above. */
36 explicit CrashHeader(uint64_t id
) : id(id
) { memcpy(cookie
, crash_cookie
, crash_cookie_len
); }
44 static const int crash_buffer_size
= 32 * 1024;
48 explicit CrashStack(uint64_t id
) : header(id
) {}
51 uint64_t snaptime
; /* Unix time when the stack was snapshotted. */
52 CrashRegisters regs
; /* Register contents for the snapshot. */
53 uint64_t stack_base
; /* Base address of stack at the time of snapshot. */
54 uint64_t stack_len
; /* Extent of the stack. */
55 char stack
[crash_buffer_size
]; /* Contents of the stack. */
60 explicit CrashRing(uint64_t id
) : header(id
), offset(0) { memset(buffer
, 0, sizeof(buffer
)); }
63 uint64_t offset
; /* Next byte to be written in the buffer. */
64 char buffer
[crash_buffer_size
];
67 /* These are the tag values for each entry in the CrashRing. */
69 JS_CRASH_TAG_GC
= 0x200
72 } /* namespace crash */
75 #endif /* jscrashformat_h */