Bumping manifests a=b2g-bump
[gecko.git] / js / src / jscrashformat.h
blobc2f7d083d11022e598f12d18c23eaf3439bf6779
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
10 namespace js {
11 namespace crash {
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. */
17 enum {
18 JS_CRASH_STACK_GC = 0x400,
19 JS_CRASH_STACK_ERROR = 0x401,
20 JS_CRASH_RING = 0x800
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.
29 struct CrashHeader
31 char cookie[crash_cookie_len];
33 /* id of the crash data, chosen from the enum above. */
34 uint64_t id;
36 explicit CrashHeader(uint64_t id) : id(id) { memcpy(cookie, crash_cookie, crash_cookie_len); }
39 struct CrashRegisters
41 uint64_t ip, sp, bp;
44 static const int crash_buffer_size = 32 * 1024;
46 struct CrashStack
48 explicit CrashStack(uint64_t id) : header(id) {}
50 CrashHeader header;
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. */
58 struct CrashRing
60 explicit CrashRing(uint64_t id) : header(id), offset(0) { memset(buffer, 0, sizeof(buffer)); }
62 CrashHeader header;
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. */
68 enum {
69 JS_CRASH_TAG_GC = 0x200
72 } /* namespace crash */
73 } /* namespace js */
75 #endif /* jscrashformat_h */