summaryrefslogtreecommitdiffstats
path: root/js/src/jit/Jitdump.h
blob: a1d61bd69e60776f024eb05ab91c3dd35f0a6740 (plain)
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 * vim: set ts=8 sts=2 et sw=2 tw=80:
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#ifndef jit_JitDump_h
#define jit_JitDump_h

/*
   This file provides the necessary data structures to meet the JitDump
   specification as of
   https://github.com/torvalds/linux/blob/f2906aa863381afb0015a9eb7fefad885d4e5a56/tools/perf/Documentation/jitdump-specification.txt
*/

namespace js {
namespace jit {

// JitDump record types
enum {
  JIT_CODE_LOAD = 0,
  JIT_CODE_MOVE,
  JIT_CODE_DEBUG_INFO,
  JIT_CODE_CLOSE,
  JIT_CODE_UNWINDING_INFO
};

// File header
struct JitDumpHeader {
  uint32_t magic;
  uint32_t version;
  uint32_t total_size;
  uint32_t elf_mach;
  uint32_t pad1;
  uint32_t pid;
  uint64_t timestamp;
  uint64_t flags;
};

// Header for each record
struct JitDumpRecordHeader {
  uint32_t id;
  uint32_t total_size;
  uint64_t timestamp;
};

// Load record
struct JitDumpLoadRecord {
  JitDumpRecordHeader header;

  // Payload
  uint32_t pid;
  uint32_t tid;
  uint64_t vma;
  uint64_t code_addr;
  uint64_t code_size;
  uint64_t code_index;
};

// Debug record
struct JitDumpDebugRecord {
  JitDumpRecordHeader header;

  // Debug header
  uint64_t code_addr;
  uint64_t nr_entry;
};

struct JitDumpDebugEntry {
  uint64_t code_addr;
  uint32_t line;
  uint32_t discrim;
};

}  // namespace jit
}  // namespace js

#endif /* jit_JitDump_h */