| 1 |
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
| 2 |
* vim: set ts=8 sts=2 et sw=2 tw=80: |
| 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/. */ |
| 6 |
|
| 7 |
#ifndef jit_JitDump_h |
| 8 |
#define jit_JitDump_h |
| 9 |
|
| 10 |
/* |
| 11 |
This file provides the necessary data structures to meet the JitDump |
| 12 |
specification as of |
| 13 |
https://github.com/torvalds/linux/blob/f2906aa863381afb0015a9eb7fefad885d4e5a56/tools/perf/Documentation/jitdump-specification.txt |
| 14 |
*/ |
| 15 |
|
| 16 |
namespace js { |
| 17 |
namespace jit { |
| 18 |
|
| 19 |
// JitDump record types |
| 20 |
enum { |
| 21 |
JIT_CODE_LOAD = 0, |
| 22 |
JIT_CODE_MOVE, |
| 23 |
JIT_CODE_DEBUG_INFO, |
| 24 |
JIT_CODE_CLOSE, |
| 25 |
JIT_CODE_UNWINDING_INFO |
| 26 |
}; |
| 27 |
|
| 28 |
// File header |
| 29 |
struct JitDumpHeader { |
| 30 |
uint32_t magic; |
| 31 |
uint32_t version; |
| 32 |
uint32_t total_size; |
| 33 |
uint32_t elf_mach; |
| 34 |
uint32_t pad1; |
| 35 |
uint32_t pid; |
| 36 |
uint64_t timestamp; |
| 37 |
uint64_t flags; |
| 38 |
}; |
| 39 |
|
| 40 |
// Header for each record |
| 41 |
struct JitDumpRecordHeader { |
| 42 |
uint32_t id; |
| 43 |
uint32_t total_size; |
| 44 |
uint64_t timestamp; |
| 45 |
}; |
| 46 |
|
| 47 |
// Load record |
| 48 |
struct JitDumpLoadRecord { |
| 49 |
JitDumpRecordHeader header; |
| 50 |
|
| 51 |
// Payload |
| 52 |
uint32_t pid; |
| 53 |
uint32_t tid; |
| 54 |
uint64_t vma; |
| 55 |
uint64_t code_addr; |
| 56 |
uint64_t code_size; |
| 57 |
uint64_t code_index; |
| 58 |
}; |
| 59 |
|
| 60 |
// Debug record |
| 61 |
struct JitDumpDebugRecord { |
| 62 |
JitDumpRecordHeader header; |
| 63 |
|
| 64 |
// Debug header |
| 65 |
uint64_t code_addr; |
| 66 |
uint64_t nr_entry; |
| 67 |
}; |
| 68 |
|
| 69 |
struct JitDumpDebugEntry { |
| 70 |
uint64_t code_addr; |
| 71 |
uint32_t line; |
| 72 |
uint32_t discrim; |
| 73 |
}; |
| 74 |
|
| 75 |
} // namespace jit |
| 76 |
} // namespace js |
| 77 |
|
| 78 |
#endif /* jit_JitDump_h */ |