Linux Perf
jitdump.h
Go to the documentation of this file.
1
/*
2
* jitdump.h: jitted code info encapsulation file format
3
*
4
* Adapted from OProfile GPLv2 support jidump.h:
5
* Copyright 2007 OProfile authors
6
* Jens Wilke
7
* Daniel Hansel
8
* Copyright IBM Corporation 2007
9
*/
10
#ifndef JITDUMP_H
11
#define JITDUMP_H
12
13
#include <sys/time.h>
14
#include <time.h>
15
#include <stdint.h>
16
17
/* JiTD */
18
#define JITHEADER_MAGIC 0x4A695444
19
#define JITHEADER_MAGIC_SW 0x4454694A
20
21
#define PADDING_8ALIGNED(x) ((((x) + 7) & 7) ^ 7)
22
#define ALIGN_8(x) (((x) + 7) & (~7))
23
24
#define JITHEADER_VERSION 1
25
26
enum
jitdump_flags_bits
{
27
JITDUMP_FLAGS_ARCH_TIMESTAMP_BIT
,
28
JITDUMP_FLAGS_MAX_BIT
,
29
};
30
31
#define JITDUMP_FLAGS_ARCH_TIMESTAMP (1ULL << JITDUMP_FLAGS_ARCH_TIMESTAMP_BIT)
32
33
#define JITDUMP_FLAGS_RESERVED (JITDUMP_FLAGS_MAX_BIT < 64 ? \
34
(~((1ULL << JITDUMP_FLAGS_MAX_BIT) - 1)) : 0)
35
36
struct
jitheader
{
37
uint32_t
magic
;
/* characters "jItD" */
38
uint32_t
version
;
/* header version */
39
uint32_t
total_size
;
/* total size of header */
40
uint32_t
elf_mach
;
/* elf mach target */
41
uint32_t
pad1
;
/* reserved */
42
uint32_t
pid
;
/* JIT process id */
43
uint64_t
timestamp
;
/* timestamp */
44
uint64_t
flags
;
/* flags */
45
};
46
47
enum
jit_record_type
{
48
JIT_CODE_LOAD
= 0,
49
JIT_CODE_MOVE
= 1,
50
JIT_CODE_DEBUG_INFO
= 2,
51
JIT_CODE_CLOSE
= 3,
52
JIT_CODE_UNWINDING_INFO
= 4,
53
54
JIT_CODE_MAX
,
55
};
56
57
/* record prefix (mandatory in each record) */
58
struct
jr_prefix
{
59
uint32_t
id
;
60
uint32_t
total_size
;
61
uint64_t
timestamp
;
62
};
63
64
struct
jr_code_load
{
65
struct
jr_prefix
p;
66
67
uint32_t
pid
;
68
uint32_t
tid
;
69
uint64_t
vma
;
70
uint64_t
code_addr
;
71
uint64_t
code_size
;
72
uint64_t
code_index
;
73
};
74
75
struct
jr_code_close
{
76
struct
jr_prefix
p;
77
};
78
79
struct
jr_code_move
{
80
struct
jr_prefix
p;
81
82
uint32_t
pid
;
83
uint32_t
tid
;
84
uint64_t
vma
;
85
uint64_t
old_code_addr
;
86
uint64_t
new_code_addr
;
87
uint64_t
code_size
;
88
uint64_t
code_index
;
89
};
90
91
struct
debug_entry
{
92
uint64_t
addr
;
93
int
lineno
;
/* source line number starting at 1 */
94
int
discrim
;
/* column discriminator, 0 is default */
95
const
char
name
[0];
/* null terminated filename, \xff\0 if same as previous entry */
96
};
97
98
struct
jr_code_debug_info
{
99
struct
jr_prefix
p;
100
101
uint64_t
code_addr
;
102
uint64_t
nr_entry
;
103
struct
debug_entry
entries[0];
104
};
105
106
struct
jr_code_unwinding_info
{
107
struct
jr_prefix
p;
108
109
uint64_t
unwinding_size
;
110
uint64_t
eh_frame_hdr_size
;
111
uint64_t
mapped_size
;
112
const
char
unwinding_data[0];
113
};
114
115
union
jr_entry
{
116
struct
jr_code_debug_info
info;
117
struct
jr_code_close
close;
118
struct
jr_code_load
load;
119
struct
jr_code_move
move;
120
struct
jr_prefix
prefix;
121
struct
jr_code_unwinding_info
unwinding;
122
};
123
124
static
inline
struct
debug_entry
*
125
debug_entry_next
(
struct
debug_entry
*ent)
126
{
127
void
*a = ent + 1;
128
size_t
l = strlen(ent->
name
) + 1;
129
return
a + l;
130
}
131
132
static
inline
char
*
133
debug_entry_file
(
struct
debug_entry
*ent)
134
{
135
void
*a = ent + 1;
136
return
a;
137
}
138
139
#endif
/* !JITDUMP_H */
JITDUMP_FLAGS_MAX_BIT
Definition:
jitdump.h:28
debug_entry::addr
uint64_t addr
Definition:
jitdump.h:92
debug_entry::name
const char name[0]
Definition:
jitdump.h:95
jitheader::timestamp
uint64_t timestamp
Definition:
jitdump.h:43
jr_code_unwinding_info::unwinding_size
uint64_t unwinding_size
Definition:
jitdump.h:109
JIT_CODE_DEBUG_INFO
Definition:
jitdump.h:50
debug_entry_file
static char * debug_entry_file(struct debug_entry *ent)
Definition:
jitdump.h:133
jr_code_unwinding_info::eh_frame_hdr_size
uint64_t eh_frame_hdr_size
Definition:
jitdump.h:110
debug_entry::lineno
int lineno
Definition:
jitdump.h:93
jitheader::pid
uint32_t pid
Definition:
jitdump.h:42
jr_code_move::old_code_addr
uint64_t old_code_addr
Definition:
jitdump.h:85
jr_code_load
Definition:
jitdump.h:64
jr_prefix::total_size
uint32_t total_size
Definition:
jitdump.h:60
jr_code_unwinding_info
Definition:
jitdump.h:106
debug_entry::discrim
int discrim
Definition:
jitdump.h:94
jr_code_move::vma
uint64_t vma
Definition:
jitdump.h:84
jr_prefix::timestamp
uint64_t timestamp
Definition:
jitdump.h:61
debug_entry
Definition:
jitdump.h:91
jr_code_close
Definition:
jitdump.h:75
jr_code_load::code_index
uint64_t code_index
Definition:
jitdump.h:72
jitheader::flags
uint64_t flags
Definition:
jitdump.h:44
jr_code_debug_info
Definition:
jitdump.h:98
jr_code_debug_info::nr_entry
uint64_t nr_entry
Definition:
jitdump.h:102
jr_code_load::pid
uint32_t pid
Definition:
jitdump.h:67
name
const char * name
Definition:
builtin-script.c:1228
jr_code_move::new_code_addr
uint64_t new_code_addr
Definition:
jitdump.h:86
jitheader::elf_mach
uint32_t elf_mach
Definition:
jitdump.h:40
JITDUMP_FLAGS_ARCH_TIMESTAMP_BIT
Definition:
jitdump.h:27
JIT_CODE_UNWINDING_INFO
Definition:
jitdump.h:52
jr_code_unwinding_info::mapped_size
uint64_t mapped_size
Definition:
jitdump.h:111
jr_code_load::code_addr
uint64_t code_addr
Definition:
jitdump.h:70
jr_code_move
Definition:
jitdump.h:79
JIT_CODE_MOVE
Definition:
jitdump.h:49
jitheader
Definition:
jitdump.h:36
jr_code_move::tid
uint32_t tid
Definition:
jitdump.h:83
jr_code_move::pid
uint32_t pid
Definition:
jitdump.h:82
jr_entry
Definition:
jitdump.h:115
JIT_CODE_CLOSE
Definition:
jitdump.h:51
jr_code_load::vma
uint64_t vma
Definition:
jitdump.h:69
jr_prefix::id
uint32_t id
Definition:
jitdump.h:59
jr_code_move::code_size
uint64_t code_size
Definition:
jitdump.h:87
jitheader::magic
uint32_t magic
Definition:
jitdump.h:37
jr_prefix
Definition:
jitdump.h:58
jitheader::version
uint32_t version
Definition:
jitdump.h:38
jitheader::total_size
uint32_t total_size
Definition:
jitdump.h:39
jr_code_debug_info::code_addr
uint64_t code_addr
Definition:
jitdump.h:101
jitdump_flags_bits
jitdump_flags_bits
Definition:
jitdump.h:26
JIT_CODE_LOAD
Definition:
jitdump.h:48
jr_code_move::code_index
uint64_t code_index
Definition:
jitdump.h:88
jitheader::pad1
uint32_t pad1
Definition:
jitdump.h:41
JIT_CODE_MAX
Definition:
jitdump.h:54
jr_code_load::code_size
uint64_t code_size
Definition:
jitdump.h:71
jr_code_load::tid
uint32_t tid
Definition:
jitdump.h:68
debug_entry_next
static struct debug_entry * debug_entry_next(struct debug_entry *ent)
Definition:
jitdump.h:125
jit_record_type
jit_record_type
Definition:
jitdump.h:47
util
jitdump.h
Generated by
1.8.13