-
Notifications
You must be signed in to change notification settings - Fork 3
/
etrace.h
150 lines (134 loc) · 3.43 KB
/
etrace.h
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
/*
* Copyright: 2013 Xilinx Inc
* Written by Edgar E. Iglesias <[email protected]>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; version 2.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
enum {
TYPE_EXEC = 1,
TYPE_TB = 2,
TYPE_NOTE = 3,
TYPE_MEM = 4,
TYPE_ARCH = 5,
TYPE_BARRIER = 6,
TYPE_OLD_EVENT_U64 = 7,
TYPE_EVENT_U64 = 8,
TYPE_INFO = 0x4554,
} __attribute__ ((packed)) ;
struct etrace_hdr {
uint16_t type;
union {
uint16_t unit_id;
};
uint32_t len;
} __attribute__ ((packed));
enum etrace_info_flags {
ETRACE_INFO_F_TB_CHAINING = (1 << 0),
};
struct etrace_info_data {
uint64_t attr;
struct {
uint16_t major;
uint16_t minor;
} version;
} __attribute__ ((packed));
struct etrace_arch {
struct {
uint32_t arch_id;
uint8_t arch_bits;
uint8_t big_endian;
} guest, host;
} __attribute__ ((packed));
struct etrace_entry32 {
uint32_t duration;
uint32_t start, end;
} __attribute__ ((packed));
struct etrace_entry64 {
uint32_t duration;
uint64_t start, end;
} __attribute__ ((packed));
struct etrace_exec {
uint64_t start_time;
union {
struct etrace_entry32 t32[0];
struct etrace_entry64 t64[0];
};
} __attribute__ ((packed));
struct etrace_note {
uint64_t time;
uint8_t data8[0];
} __attribute__ ((packed));
enum etrace_mem_attr {
MEM_READ = (0 << 0),
MEM_WRITE = (1 << 0),
};
struct etrace_mem {
uint64_t time;
uint64_t vaddr;
uint64_t paddr;
uint64_t value;
uint32_t attr;
uint8_t size;
uint8_t padd[3];
} __attribute__ ((packed));
struct etrace_tb {
uint64_t vaddr;
uint64_t paddr;
uint64_t host_addr;
uint32_t guest_code_len;
uint32_t host_code_len;
uint8_t data8[0];
} __attribute__ ((packed));
struct etrace_old_event_u64 {
uint64_t time;
uint64_t val;
uint16_t unit_id;
uint16_t dev_name_len;
uint16_t event_name_len;
uint8_t names[0];
} __attribute__ ((packed));
struct etrace_event_u64 {
uint32_t flags;
uint16_t unit_id;
uint16_t __reserved;
uint64_t time;
uint64_t val;
uint64_t prev_val;
uint16_t dev_name_len;
uint16_t event_name_len;
uint8_t names[0];
} __attribute__ ((packed));
struct etrace_pkg {
struct etrace_hdr hdr;
union {
struct etrace_info_data info;
struct etrace_arch arch;
struct etrace_exec ex;
struct etrace_tb tb;
struct etrace_note note;
struct etrace_mem mem;
struct etrace_event_u64 event_u64;
uint8_t u8[0];
uint16_t u16[0];
uint32_t u32[0];
uint64_t u64[0];
};
};
void etrace_show(int fd, FILE *fp_out,
const char *objdump, const char *machine,
const char *guest_objdump, const char *guest_machine,
void **sym_tree, enum cov_format cov_fmt,
enum trace_format trace_in_fmt,
enum trace_format trace_out_fmt);