diff options
author | Ingo Molnar <mingo@kernel.org> | 2012-04-13 03:50:21 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2012-04-13 03:50:21 -0400 |
commit | 659c36fcda403013a01b85da07cf2d9711e6d6c7 (patch) | |
tree | ece2e7d0e2c19ea5a3d0ec172ad0b81a8a19021d /tools | |
parent | 9521d830b6341d1887dcfc2aebde23fbfa5f1473 (diff) | |
parent | 5a7ed29c7572d00a75e8c4529e30c5ac2ef82271 (diff) |
Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
Fixes and improvements for perf/core:
. Overhaul the tools/ makefiles, gluing them to the top level Makefile, from
Borislav Petkov.
. Move the UI files from tools/perf/util/ui/ to tools/perf/ui/. Also move
the GTK+ browser to tools/perf/ui/gtk/, from Namhyung Kim.
. Only fallback to sw cycles counter on ENOENT for the hw cycles, from
Robert Richter
. Trivial fixes from Robert Richter
. Handle the autogenerated bison/flex files better, from Namhyung and Jiri Olsa.
. Navigate jump instructions in the annotate browser, just press enter or ->,
still needs support for a jump navigation history, i.e. to go back.
. Search string in the annotate browser: same keys as vim:
/ forward
n next backward/forward
? backward
. Clarify number of events/samples in the report header, from Ashay Rane
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools')
74 files changed, 1608 insertions, 8858 deletions
diff --git a/tools/Makefile b/tools/Makefile new file mode 100644 index 000000000000..3ae43947a171 --- /dev/null +++ b/tools/Makefile | |||
@@ -0,0 +1,77 @@ | |||
1 | include scripts/Makefile.include | ||
2 | |||
3 | help: | ||
4 | @echo 'Possible targets:' | ||
5 | @echo '' | ||
6 | @echo ' cpupower - a tool for all things x86 CPU power' | ||
7 | @echo ' firewire - the userspace part of nosy, an IEEE-1394 traffic sniffer' | ||
8 | @echo ' lguest - a minimal 32-bit x86 hypervisor' | ||
9 | @echo ' perf - Linux performance measurement and analysis tool' | ||
10 | @echo ' selftests - various kernel selftests' | ||
11 | @echo ' turbostat - Intel CPU idle stats and freq reporting tool' | ||
12 | @echo ' usb - USB testing tools' | ||
13 | @echo ' virtio - vhost test module' | ||
14 | @echo ' vm - misc vm tools' | ||
15 | @echo ' x86_energy_perf_policy - Intel energy policy tool' | ||
16 | @echo '' | ||
17 | @echo 'You can do:' | ||
18 | @echo ' $$ make -C tools/<tool>_install' | ||
19 | @echo '' | ||
20 | @echo ' from the kernel command line to build and install one of' | ||
21 | @echo ' the tools above' | ||
22 | @echo '' | ||
23 | @echo ' $$ make tools/install' | ||
24 | @echo '' | ||
25 | @echo ' installs all tools.' | ||
26 | @echo '' | ||
27 | @echo 'Cleaning targets:' | ||
28 | @echo '' | ||
29 | @echo ' all of the above with the "_clean" string appended cleans' | ||
30 | @echo ' the respective build directory.' | ||
31 | @echo ' clean: a summary clean target to clean _all_ folders' | ||
32 | |||
33 | cpupower: FORCE | ||
34 | $(QUIET_SUBDIR0)power/$@/ $(QUIET_SUBDIR1) | ||
35 | |||
36 | firewire lguest perf usb virtio vm: FORCE | ||
37 | $(QUIET_SUBDIR0)$@/ $(QUIET_SUBDIR1) | ||
38 | |||
39 | selftests: FORCE | ||
40 | $(QUIET_SUBDIR0)testing/$@/ $(QUIET_SUBDIR1) | ||
41 | |||
42 | turbostat x86_energy_perf_policy: FORCE | ||
43 | $(QUIET_SUBDIR0)power/x86/$@/ $(QUIET_SUBDIR1) | ||
44 | |||
45 | cpupower_install: | ||
46 | $(QUIET_SUBDIR0)power/$(@:_install=)/ $(QUIET_SUBDIR1) install | ||
47 | |||
48 | firewire_install lguest_install perf_install usb_install virtio_install vm_install: | ||
49 | $(QUIET_SUBDIR0)$(@:_install=)/ $(QUIET_SUBDIR1) install | ||
50 | |||
51 | selftests_install: | ||
52 | $(QUIET_SUBDIR0)testing/$(@:_clean=)/ $(QUIET_SUBDIR1) install | ||
53 | |||
54 | turbostat_install x86_energy_perf_policy_install: | ||
55 | $(QUIET_SUBDIR0)power/x86/$(@:_install=)/ $(QUIET_SUBDIR1) install | ||
56 | |||
57 | install: cpupower_install firewire_install lguest_install perf_install \ | ||
58 | selftests_install turbostat_install usb_install virtio_install \ | ||
59 | vm_install x86_energy_perf_policy_install | ||
60 | |||
61 | cpupower_clean: | ||
62 | $(QUIET_SUBDIR0)power/cpupower/ $(QUIET_SUBDIR1) clean | ||
63 | |||
64 | firewire_clean lguest_clean perf_clean usb_clean virtio_clean vm_clean: | ||
65 | $(QUIET_SUBDIR0)$(@:_clean=)/ $(QUIET_SUBDIR1) clean | ||
66 | |||
67 | selftests_clean: | ||
68 | $(QUIET_SUBDIR0)testing/$(@:_clean=)/ $(QUIET_SUBDIR1) clean | ||
69 | |||
70 | turbostat_clean x86_energy_perf_policy_clean: | ||
71 | $(QUIET_SUBDIR0)power/x86/$(@:_clean=)/ $(QUIET_SUBDIR1) clean | ||
72 | |||
73 | clean: cpupower_clean firewire_clean lguest_clean perf_clean selftests_clean \ | ||
74 | turbostat_clean usb_clean virtio_clean vm_clean \ | ||
75 | x86_energy_perf_policy_clean | ||
76 | |||
77 | .PHONY: FORCE | ||
diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c index 11224eddcdc2..146fd6147e84 100644 --- a/tools/hv/hv_kvp_daemon.c +++ b/tools/hv/hv_kvp_daemon.c | |||
@@ -34,21 +34,13 @@ | |||
34 | #include <errno.h> | 34 | #include <errno.h> |
35 | #include <arpa/inet.h> | 35 | #include <arpa/inet.h> |
36 | #include <linux/connector.h> | 36 | #include <linux/connector.h> |
37 | #include <linux/hyperv.h> | ||
37 | #include <linux/netlink.h> | 38 | #include <linux/netlink.h> |
38 | #include <ifaddrs.h> | 39 | #include <ifaddrs.h> |
39 | #include <netdb.h> | 40 | #include <netdb.h> |
40 | #include <syslog.h> | 41 | #include <syslog.h> |
41 | 42 | #include <sys/stat.h> | |
42 | /* | 43 | #include <fcntl.h> |
43 | * KYS: TODO. Need to register these in the kernel. | ||
44 | * | ||
45 | * The following definitions are shared with the in-kernel component; do not | ||
46 | * change any of this without making the corresponding changes in | ||
47 | * the KVP kernel component. | ||
48 | */ | ||
49 | #define CN_KVP_IDX 0x9 /* MSFT KVP functionality */ | ||
50 | #define CN_KVP_VAL 0x1 /* This supports queries from the kernel */ | ||
51 | #define CN_KVP_USER_VAL 0x2 /* This supports queries from the user */ | ||
52 | 44 | ||
53 | /* | 45 | /* |
54 | * KVP protocol: The user mode component first registers with the | 46 | * KVP protocol: The user mode component first registers with the |
@@ -60,25 +52,8 @@ | |||
60 | * We use this infrastructure for also supporting queries from user mode | 52 | * We use this infrastructure for also supporting queries from user mode |
61 | * application for state that may be maintained in the KVP kernel component. | 53 | * application for state that may be maintained in the KVP kernel component. |
62 | * | 54 | * |
63 | * XXXKYS: Have a shared header file between the user and kernel (TODO) | ||
64 | */ | 55 | */ |
65 | 56 | ||
66 | enum kvp_op { | ||
67 | KVP_REGISTER = 0, /* Register the user mode component*/ | ||
68 | KVP_KERNEL_GET, /*Kernel is requesting the value for the specified key*/ | ||
69 | KVP_KERNEL_SET, /*Kernel is providing the value for the specified key*/ | ||
70 | KVP_USER_GET, /*User is requesting the value for the specified key*/ | ||
71 | KVP_USER_SET /*User is providing the value for the specified key*/ | ||
72 | }; | ||
73 | |||
74 | #define HV_KVP_EXCHANGE_MAX_KEY_SIZE 512 | ||
75 | #define HV_KVP_EXCHANGE_MAX_VALUE_SIZE 2048 | ||
76 | |||
77 | struct hv_ku_msg { | ||
78 | __u32 kvp_index; | ||
79 | __u8 kvp_key[HV_KVP_EXCHANGE_MAX_KEY_SIZE]; /* Key name */ | ||
80 | __u8 kvp_value[HV_KVP_EXCHANGE_MAX_VALUE_SIZE]; /* Key value */ | ||
81 | }; | ||
82 | 57 | ||
83 | enum key_index { | 58 | enum key_index { |
84 | FullyQualifiedDomainName = 0, | 59 | FullyQualifiedDomainName = 0, |
@@ -93,10 +68,6 @@ enum key_index { | |||
93 | ProcessorArchitecture | 68 | ProcessorArchitecture |
94 | }; | 69 | }; |
95 | 70 | ||
96 | /* | ||
97 | * End of shared definitions. | ||
98 | */ | ||
99 | |||
100 | static char kvp_send_buffer[4096]; | 71 | static char kvp_send_buffer[4096]; |
101 | static char kvp_recv_buffer[4096]; | 72 | static char kvp_recv_buffer[4096]; |
102 | static struct sockaddr_nl addr; | 73 | static struct sockaddr_nl addr; |
@@ -109,6 +80,345 @@ static char *os_build; | |||
109 | static char *lic_version; | 80 | static char *lic_version; |
110 | static struct utsname uts_buf; | 81 | static struct utsname uts_buf; |
111 | 82 | ||
83 | |||
84 | #define MAX_FILE_NAME 100 | ||
85 | #define ENTRIES_PER_BLOCK 50 | ||
86 | |||
87 | struct kvp_record { | ||
88 | __u8 key[HV_KVP_EXCHANGE_MAX_KEY_SIZE]; | ||
89 | __u8 value[HV_KVP_EXCHANGE_MAX_VALUE_SIZE]; | ||
90 | }; | ||
91 | |||
92 | struct kvp_file_state { | ||
93 | int fd; | ||
94 | int num_blocks; | ||
95 | struct kvp_record *records; | ||
96 | int num_records; | ||
97 | __u8 fname[MAX_FILE_NAME]; | ||
98 | }; | ||
99 | |||
100 | static struct kvp_file_state kvp_file_info[KVP_POOL_COUNT]; | ||
101 | |||
102 | static void kvp_acquire_lock(int pool) | ||
103 | { | ||
104 | struct flock fl = {F_WRLCK, SEEK_SET, 0, 0, 0}; | ||
105 | fl.l_pid = getpid(); | ||
106 | |||
107 | if (fcntl(kvp_file_info[pool].fd, F_SETLKW, &fl) == -1) { | ||
108 | syslog(LOG_ERR, "Failed to acquire the lock pool: %d", pool); | ||
109 | exit(-1); | ||
110 | } | ||
111 | } | ||
112 | |||
113 | static void kvp_release_lock(int pool) | ||
114 | { | ||
115 | struct flock fl = {F_UNLCK, SEEK_SET, 0, 0, 0}; | ||
116 | fl.l_pid = getpid(); | ||
117 | |||
118 | if (fcntl(kvp_file_info[pool].fd, F_SETLK, &fl) == -1) { | ||
119 | perror("fcntl"); | ||
120 | syslog(LOG_ERR, "Failed to release the lock pool: %d", pool); | ||
121 | exit(-1); | ||
122 | } | ||
123 | } | ||
124 | |||
125 | static void kvp_update_file(int pool) | ||
126 | { | ||
127 | FILE *filep; | ||
128 | size_t bytes_written; | ||
129 | |||
130 | /* | ||
131 | * We are going to write our in-memory registry out to | ||
132 | * disk; acquire the lock first. | ||
133 | */ | ||
134 | kvp_acquire_lock(pool); | ||
135 | |||
136 | filep = fopen(kvp_file_info[pool].fname, "w"); | ||
137 | if (!filep) { | ||
138 | kvp_release_lock(pool); | ||
139 | syslog(LOG_ERR, "Failed to open file, pool: %d", pool); | ||
140 | exit(-1); | ||
141 | } | ||
142 | |||
143 | bytes_written = fwrite(kvp_file_info[pool].records, | ||
144 | sizeof(struct kvp_record), | ||
145 | kvp_file_info[pool].num_records, filep); | ||
146 | |||
147 | fflush(filep); | ||
148 | kvp_release_lock(pool); | ||
149 | } | ||
150 | |||
151 | static void kvp_update_mem_state(int pool) | ||
152 | { | ||
153 | FILE *filep; | ||
154 | size_t records_read = 0; | ||
155 | struct kvp_record *record = kvp_file_info[pool].records; | ||
156 | struct kvp_record *readp; | ||
157 | int num_blocks = kvp_file_info[pool].num_blocks; | ||
158 | int alloc_unit = sizeof(struct kvp_record) * ENTRIES_PER_BLOCK; | ||
159 | |||
160 | kvp_acquire_lock(pool); | ||
161 | |||
162 | filep = fopen(kvp_file_info[pool].fname, "r"); | ||
163 | if (!filep) { | ||
164 | kvp_release_lock(pool); | ||
165 | syslog(LOG_ERR, "Failed to open file, pool: %d", pool); | ||
166 | exit(-1); | ||
167 | } | ||
168 | while (!feof(filep)) { | ||
169 | readp = &record[records_read]; | ||
170 | records_read += fread(readp, sizeof(struct kvp_record), | ||
171 | ENTRIES_PER_BLOCK * num_blocks, | ||
172 | filep); | ||
173 | |||
174 | if (!feof(filep)) { | ||
175 | /* | ||
176 | * We have more data to read. | ||
177 | */ | ||
178 | num_blocks++; | ||
179 | record = realloc(record, alloc_unit * num_blocks); | ||
180 | |||
181 | if (record == NULL) { | ||
182 | syslog(LOG_ERR, "malloc failed"); | ||
183 | exit(-1); | ||
184 | } | ||
185 | continue; | ||
186 | } | ||
187 | break; | ||
188 | } | ||
189 | |||
190 | kvp_file_info[pool].num_blocks = num_blocks; | ||
191 | kvp_file_info[pool].records = record; | ||
192 | kvp_file_info[pool].num_records = records_read; | ||
193 | |||
194 | kvp_release_lock(pool); | ||
195 | } | ||
196 | static int kvp_file_init(void) | ||
197 | { | ||
198 | int ret, fd; | ||
199 | FILE *filep; | ||
200 | size_t records_read; | ||
201 | __u8 *fname; | ||
202 | struct kvp_record *record; | ||
203 | struct kvp_record *readp; | ||
204 | int num_blocks; | ||
205 | int i; | ||
206 | int alloc_unit = sizeof(struct kvp_record) * ENTRIES_PER_BLOCK; | ||
207 | |||
208 | if (access("/var/opt/hyperv", F_OK)) { | ||
209 | if (mkdir("/var/opt/hyperv", S_IRUSR | S_IWUSR | S_IROTH)) { | ||
210 | syslog(LOG_ERR, " Failed to create /var/opt/hyperv"); | ||
211 | exit(-1); | ||
212 | } | ||
213 | } | ||
214 | |||
215 | for (i = 0; i < KVP_POOL_COUNT; i++) { | ||
216 | fname = kvp_file_info[i].fname; | ||
217 | records_read = 0; | ||
218 | num_blocks = 1; | ||
219 | sprintf(fname, "/var/opt/hyperv/.kvp_pool_%d", i); | ||
220 | fd = open(fname, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR | S_IROTH); | ||
221 | |||
222 | if (fd == -1) | ||
223 | return 1; | ||
224 | |||
225 | |||
226 | filep = fopen(fname, "r"); | ||
227 | if (!filep) | ||
228 | return 1; | ||
229 | |||
230 | record = malloc(alloc_unit * num_blocks); | ||
231 | if (record == NULL) { | ||
232 | fclose(filep); | ||
233 | return 1; | ||
234 | } | ||
235 | while (!feof(filep)) { | ||
236 | readp = &record[records_read]; | ||
237 | records_read += fread(readp, sizeof(struct kvp_record), | ||
238 | ENTRIES_PER_BLOCK, | ||
239 | filep); | ||
240 | |||
241 | if (!feof(filep)) { | ||
242 | /* | ||
243 | * We have more data to read. | ||
244 | */ | ||
245 | num_blocks++; | ||
246 | record = realloc(record, alloc_unit * | ||
247 | num_blocks); | ||
248 | if (record == NULL) { | ||
249 | fclose(filep); | ||
250 | return 1; | ||
251 | } | ||
252 | continue; | ||
253 | } | ||
254 | break; | ||
255 | } | ||
256 | kvp_file_info[i].fd = fd; | ||
257 | kvp_file_info[i].num_blocks = num_blocks; | ||
258 | kvp_file_info[i].records = record; | ||
259 | kvp_file_info[i].num_records = records_read; | ||
260 | fclose(filep); | ||
261 | |||
262 | } | ||
263 | |||
264 | return 0; | ||
265 | } | ||
266 | |||
267 | static int kvp_key_delete(int pool, __u8 *key, int key_size) | ||
268 | { | ||
269 | int i; | ||
270 | int j, k; | ||
271 | int num_records; | ||
272 | struct kvp_record *record; | ||
273 | |||
274 | /* | ||
275 | * First update the in-memory state. | ||
276 | */ | ||
277 | kvp_update_mem_state(pool); | ||
278 | |||
279 | num_records = kvp_file_info[pool].num_records; | ||
280 | record = kvp_file_info[pool].records; | ||
281 | |||
282 | for (i = 0; i < num_records; i++) { | ||
283 | if (memcmp(key, record[i].key, key_size)) | ||
284 | continue; | ||
285 | /* | ||
286 | * Found a match; just move the remaining | ||
287 | * entries up. | ||
288 | */ | ||
289 | if (i == num_records) { | ||
290 | kvp_file_info[pool].num_records--; | ||
291 | kvp_update_file(pool); | ||
292 | return 0; | ||
293 | } | ||
294 | |||
295 | j = i; | ||
296 | k = j + 1; | ||
297 | for (; k < num_records; k++) { | ||
298 | strcpy(record[j].key, record[k].key); | ||
299 | strcpy(record[j].value, record[k].value); | ||
300 | j++; | ||
301 | } | ||
302 | |||
303 | kvp_file_info[pool].num_records--; | ||
304 | kvp_update_file(pool); | ||
305 | return 0; | ||
306 | } | ||
307 | return 1; | ||
308 | } | ||
309 | |||
310 | static int kvp_key_add_or_modify(int pool, __u8 *key, int key_size, __u8 *value, | ||
311 | int value_size) | ||
312 | { | ||
313 | int i; | ||
314 | int j, k; | ||
315 | int num_records; | ||
316 | struct kvp_record *record; | ||
317 | int num_blocks; | ||
318 | |||
319 | if ((key_size > HV_KVP_EXCHANGE_MAX_KEY_SIZE) || | ||
320 | (value_size > HV_KVP_EXCHANGE_MAX_VALUE_SIZE)) | ||
321 | return 1; | ||
322 | |||
323 | /* | ||
324 | * First update the in-memory state. | ||
325 | */ | ||
326 | kvp_update_mem_state(pool); | ||
327 | |||
328 | num_records = kvp_file_info[pool].num_records; | ||
329 | record = kvp_file_info[pool].records; | ||
330 | num_blocks = kvp_file_info[pool].num_blocks; | ||
331 | |||
332 | for (i = 0; i < num_records; i++) { | ||
333 | if (memcmp(key, record[i].key, key_size)) | ||
334 | continue; | ||
335 | /* | ||
336 | * Found a match; just update the value - | ||
337 | * this is the modify case. | ||
338 | */ | ||
339 | memcpy(record[i].value, value, value_size); | ||
340 | kvp_update_file(pool); | ||
341 | return 0; | ||
342 | } | ||
343 | |||
344 | /* | ||
345 | * Need to add a new entry; | ||
346 | */ | ||
347 | if (num_records == (ENTRIES_PER_BLOCK * num_blocks)) { | ||
348 | /* Need to allocate a larger array for reg entries. */ | ||
349 | record = realloc(record, sizeof(struct kvp_record) * | ||
350 | ENTRIES_PER_BLOCK * (num_blocks + 1)); | ||
351 | |||
352 | if (record == NULL) | ||
353 | return 1; | ||
354 | kvp_file_info[pool].num_blocks++; | ||
355 | |||
356 | } | ||
357 | memcpy(record[i].value, value, value_size); | ||
358 | memcpy(record[i].key, key, key_size); | ||
359 | kvp_file_info[pool].records = record; | ||
360 | kvp_file_info[pool].num_records++; | ||
361 | kvp_update_file(pool); | ||
362 | return 0; | ||
363 | } | ||
364 | |||
365 | static int kvp_get_value(int pool, __u8 *key, int key_size, __u8 *value, | ||
366 | int value_size) | ||
367 | { | ||
368 | int i; | ||
369 | int num_records; | ||
370 | struct kvp_record *record; | ||
371 | |||
372 | if ((key_size > HV_KVP_EXCHANGE_MAX_KEY_SIZE) || | ||
373 | (value_size > HV_KVP_EXCHANGE_MAX_VALUE_SIZE)) | ||
374 | return 1; | ||
375 | |||
376 | /* | ||
377 | * First update the in-memory state. | ||
378 | */ | ||
379 | kvp_update_mem_state(pool); | ||
380 | |||
381 | num_records = kvp_file_info[pool].num_records; | ||
382 | record = kvp_file_info[pool].records; | ||
383 | |||
384 | for (i = 0; i < num_records; i++) { | ||
385 | if (memcmp(key, record[i].key, key_size)) | ||
386 | continue; | ||
387 | /* | ||
388 | * Found a match; just copy the value out. | ||
389 | */ | ||
390 | memcpy(value, record[i].value, value_size); | ||
391 | return 0; | ||
392 | } | ||
393 | |||
394 | return 1; | ||
395 | } | ||
396 | |||
397 | static void kvp_pool_enumerate(int pool, int index, __u8 *key, int key_size, | ||
398 | __u8 *value, int value_size) | ||
399 | { | ||
400 | struct kvp_record *record; | ||
401 | |||
402 | /* | ||
403 | * First update our in-memory database. | ||
404 | */ | ||
405 | kvp_update_mem_state(pool); | ||
406 | record = kvp_file_info[pool].records; | ||
407 | |||
408 | if (index >= kvp_file_info[pool].num_records) { | ||
409 | /* | ||
410 | * This is an invalid index; terminate enumeration; | ||
411 | * - a NULL value will do the trick. | ||
412 | */ | ||
413 | strcpy(value, ""); | ||
414 | return; | ||
415 | } | ||
416 | |||
417 | memcpy(key, record[index].key, key_size); | ||
418 | memcpy(value, record[index].value, value_size); | ||
419 | } | ||
420 | |||
421 | |||
112 | void kvp_get_os_info(void) | 422 | void kvp_get_os_info(void) |
113 | { | 423 | { |
114 | FILE *file; | 424 | FILE *file; |
@@ -332,7 +642,7 @@ int main(void) | |||
332 | struct pollfd pfd; | 642 | struct pollfd pfd; |
333 | struct nlmsghdr *incoming_msg; | 643 | struct nlmsghdr *incoming_msg; |
334 | struct cn_msg *incoming_cn_msg; | 644 | struct cn_msg *incoming_cn_msg; |
335 | struct hv_ku_msg *hv_msg; | 645 | struct hv_kvp_msg *hv_msg; |
336 | char *p; | 646 | char *p; |
337 | char *key_value; | 647 | char *key_value; |
338 | char *key_name; | 648 | char *key_name; |
@@ -345,6 +655,11 @@ int main(void) | |||
345 | */ | 655 | */ |
346 | kvp_get_os_info(); | 656 | kvp_get_os_info(); |
347 | 657 | ||
658 | if (kvp_file_init()) { | ||
659 | syslog(LOG_ERR, "Failed to initialize the pools"); | ||
660 | exit(-1); | ||
661 | } | ||
662 | |||
348 | fd = socket(AF_NETLINK, SOCK_DGRAM, NETLINK_CONNECTOR); | 663 | fd = socket(AF_NETLINK, SOCK_DGRAM, NETLINK_CONNECTOR); |
349 | if (fd < 0) { | 664 | if (fd < 0) { |
350 | syslog(LOG_ERR, "netlink socket creation failed; error:%d", fd); | 665 | syslog(LOG_ERR, "netlink socket creation failed; error:%d", fd); |
@@ -370,9 +685,11 @@ int main(void) | |||
370 | message = (struct cn_msg *)kvp_send_buffer; | 685 | message = (struct cn_msg *)kvp_send_buffer; |
371 | message->id.idx = CN_KVP_IDX; | 686 | message->id.idx = CN_KVP_IDX; |
372 | message->id.val = CN_KVP_VAL; | 687 | message->id.val = CN_KVP_VAL; |
373 | message->seq = KVP_REGISTER; | 688 | |
689 | hv_msg = (struct hv_kvp_msg *)message->data; | ||
690 | hv_msg->kvp_hdr.operation = KVP_OP_REGISTER; | ||
374 | message->ack = 0; | 691 | message->ack = 0; |
375 | message->len = 0; | 692 | message->len = sizeof(struct hv_kvp_msg); |
376 | 693 | ||
377 | len = netlink_send(fd, message); | 694 | len = netlink_send(fd, message); |
378 | if (len < 0) { | 695 | if (len < 0) { |
@@ -398,14 +715,15 @@ int main(void) | |||
398 | 715 | ||
399 | incoming_msg = (struct nlmsghdr *)kvp_recv_buffer; | 716 | incoming_msg = (struct nlmsghdr *)kvp_recv_buffer; |
400 | incoming_cn_msg = (struct cn_msg *)NLMSG_DATA(incoming_msg); | 717 | incoming_cn_msg = (struct cn_msg *)NLMSG_DATA(incoming_msg); |
718 | hv_msg = (struct hv_kvp_msg *)incoming_cn_msg->data; | ||
401 | 719 | ||
402 | switch (incoming_cn_msg->seq) { | 720 | switch (hv_msg->kvp_hdr.operation) { |
403 | case KVP_REGISTER: | 721 | case KVP_OP_REGISTER: |
404 | /* | 722 | /* |
405 | * Driver is registering with us; stash away the version | 723 | * Driver is registering with us; stash away the version |
406 | * information. | 724 | * information. |
407 | */ | 725 | */ |
408 | p = (char *)incoming_cn_msg->data; | 726 | p = (char *)hv_msg->body.kvp_register.version; |
409 | lic_version = malloc(strlen(p) + 1); | 727 | lic_version = malloc(strlen(p) + 1); |
410 | if (lic_version) { | 728 | if (lic_version) { |
411 | strcpy(lic_version, p); | 729 | strcpy(lic_version, p); |
@@ -416,17 +734,65 @@ int main(void) | |||
416 | } | 734 | } |
417 | continue; | 735 | continue; |
418 | 736 | ||
419 | case KVP_KERNEL_GET: | 737 | /* |
738 | * The current protocol with the kernel component uses a | ||
739 | * NULL key name to pass an error condition. | ||
740 | * For the SET, GET and DELETE operations, | ||
741 | * use the existing protocol to pass back error. | ||
742 | */ | ||
743 | |||
744 | case KVP_OP_SET: | ||
745 | if (kvp_key_add_or_modify(hv_msg->kvp_hdr.pool, | ||
746 | hv_msg->body.kvp_set.data.key, | ||
747 | hv_msg->body.kvp_set.data.key_size, | ||
748 | hv_msg->body.kvp_set.data.value, | ||
749 | hv_msg->body.kvp_set.data.value_size)) | ||
750 | strcpy(hv_msg->body.kvp_set.data.key, ""); | ||
751 | break; | ||
752 | |||
753 | case KVP_OP_GET: | ||
754 | if (kvp_get_value(hv_msg->kvp_hdr.pool, | ||
755 | hv_msg->body.kvp_set.data.key, | ||
756 | hv_msg->body.kvp_set.data.key_size, | ||
757 | hv_msg->body.kvp_set.data.value, | ||
758 | hv_msg->body.kvp_set.data.value_size)) | ||
759 | strcpy(hv_msg->body.kvp_set.data.key, ""); | ||
760 | break; | ||
761 | |||
762 | case KVP_OP_DELETE: | ||
763 | if (kvp_key_delete(hv_msg->kvp_hdr.pool, | ||
764 | hv_msg->body.kvp_delete.key, | ||
765 | hv_msg->body.kvp_delete.key_size)) | ||
766 | strcpy(hv_msg->body.kvp_delete.key, ""); | ||
420 | break; | 767 | break; |
768 | |||
421 | default: | 769 | default: |
422 | continue; | 770 | break; |
771 | } | ||
772 | |||
773 | if (hv_msg->kvp_hdr.operation != KVP_OP_ENUMERATE) | ||
774 | goto kvp_done; | ||
775 | |||
776 | /* | ||
777 | * If the pool is KVP_POOL_AUTO, dynamically generate | ||
778 | * both the key and the value; if not read from the | ||
779 | * appropriate pool. | ||
780 | */ | ||
781 | if (hv_msg->kvp_hdr.pool != KVP_POOL_AUTO) { | ||
782 | kvp_pool_enumerate(hv_msg->kvp_hdr.pool, | ||
783 | hv_msg->body.kvp_enum_data.index, | ||
784 | hv_msg->body.kvp_enum_data.data.key, | ||
785 | HV_KVP_EXCHANGE_MAX_KEY_SIZE, | ||
786 | hv_msg->body.kvp_enum_data.data.value, | ||
787 | HV_KVP_EXCHANGE_MAX_VALUE_SIZE); | ||
788 | goto kvp_done; | ||
423 | } | 789 | } |
424 | 790 | ||
425 | hv_msg = (struct hv_ku_msg *)incoming_cn_msg->data; | 791 | hv_msg = (struct hv_kvp_msg *)incoming_cn_msg->data; |
426 | key_name = (char *)hv_msg->kvp_key; | 792 | key_name = (char *)hv_msg->body.kvp_enum_data.data.key; |
427 | key_value = (char *)hv_msg->kvp_value; | 793 | key_value = (char *)hv_msg->body.kvp_enum_data.data.value; |
428 | 794 | ||
429 | switch (hv_msg->kvp_index) { | 795 | switch (hv_msg->body.kvp_enum_data.index) { |
430 | case FullyQualifiedDomainName: | 796 | case FullyQualifiedDomainName: |
431 | kvp_get_domain_name(key_value, | 797 | kvp_get_domain_name(key_value, |
432 | HV_KVP_EXCHANGE_MAX_VALUE_SIZE); | 798 | HV_KVP_EXCHANGE_MAX_VALUE_SIZE); |
@@ -483,12 +849,12 @@ int main(void) | |||
483 | * already in the receive buffer. Update the cn_msg header to | 849 | * already in the receive buffer. Update the cn_msg header to |
484 | * reflect the key value that has been added to the message | 850 | * reflect the key value that has been added to the message |
485 | */ | 851 | */ |
852 | kvp_done: | ||
486 | 853 | ||
487 | incoming_cn_msg->id.idx = CN_KVP_IDX; | 854 | incoming_cn_msg->id.idx = CN_KVP_IDX; |
488 | incoming_cn_msg->id.val = CN_KVP_VAL; | 855 | incoming_cn_msg->id.val = CN_KVP_VAL; |
489 | incoming_cn_msg->seq = KVP_USER_SET; | ||
490 | incoming_cn_msg->ack = 0; | 856 | incoming_cn_msg->ack = 0; |
491 | incoming_cn_msg->len = sizeof(struct hv_ku_msg); | 857 | incoming_cn_msg->len = sizeof(struct hv_kvp_msg); |
492 | 858 | ||
493 | len = netlink_send(fd, incoming_cn_msg); | 859 | len = netlink_send(fd, incoming_cn_msg); |
494 | if (len < 0) { | 860 | if (len < 0) { |
diff --git a/tools/include/tools/be_byteshift.h b/tools/include/tools/be_byteshift.h new file mode 100644 index 000000000000..f4912e2668ba --- /dev/null +++ b/tools/include/tools/be_byteshift.h | |||
@@ -0,0 +1,70 @@ | |||
1 | #ifndef _TOOLS_BE_BYTESHIFT_H | ||
2 | #define _TOOLS_BE_BYTESHIFT_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | static inline __u16 __get_unaligned_be16(const __u8 *p) | ||
7 | { | ||
8 | return p[0] << 8 | p[1]; | ||
9 | } | ||
10 | |||
11 | static inline __u32 __get_unaligned_be32(const __u8 *p) | ||
12 | { | ||
13 | return p[0] << 24 | p[1] << 16 | p[2] << 8 | p[3]; | ||
14 | } | ||
15 | |||
16 | static inline __u64 __get_unaligned_be64(const __u8 *p) | ||
17 | { | ||
18 | return (__u64)__get_unaligned_be32(p) << 32 | | ||
19 | __get_unaligned_be32(p + 4); | ||
20 | } | ||
21 | |||
22 | static inline void __put_unaligned_be16(__u16 val, __u8 *p) | ||
23 | { | ||
24 | *p++ = val >> 8; | ||
25 | *p++ = val; | ||
26 | } | ||
27 | |||
28 | static inline void __put_unaligned_be32(__u32 val, __u8 *p) | ||
29 | { | ||
30 | __put_unaligned_be16(val >> 16, p); | ||
31 | __put_unaligned_be16(val, p + 2); | ||
32 | } | ||
33 | |||
34 | static inline void __put_unaligned_be64(__u64 val, __u8 *p) | ||
35 | { | ||
36 | __put_unaligned_be32(val >> 32, p); | ||
37 | __put_unaligned_be32(val, p + 4); | ||
38 | } | ||
39 | |||
40 | static inline __u16 get_unaligned_be16(const void *p) | ||
41 | { | ||
42 | return __get_unaligned_be16((const __u8 *)p); | ||
43 | } | ||
44 | |||
45 | static inline __u32 get_unaligned_be32(const void *p) | ||
46 | { | ||
47 | return __get_unaligned_be32((const __u8 *)p); | ||
48 | } | ||
49 | |||
50 | static inline __u64 get_unaligned_be64(const void *p) | ||
51 | { | ||
52 | return __get_unaligned_be64((const __u8 *)p); | ||
53 | } | ||
54 | |||
55 | static inline void put_unaligned_be16(__u16 val, void *p) | ||
56 | { | ||
57 | __put_unaligned_be16(val, p); | ||
58 | } | ||
59 | |||
60 | static inline void put_unaligned_be32(__u32 val, void *p) | ||
61 | { | ||
62 | __put_unaligned_be32(val, p); | ||
63 | } | ||
64 | |||
65 | static inline void put_unaligned_be64(__u64 val, void *p) | ||
66 | { | ||
67 | __put_unaligned_be64(val, p); | ||
68 | } | ||
69 | |||
70 | #endif /* _TOOLS_BE_BYTESHIFT_H */ | ||
diff --git a/tools/include/tools/le_byteshift.h b/tools/include/tools/le_byteshift.h new file mode 100644 index 000000000000..c99d45a68bda --- /dev/null +++ b/tools/include/tools/le_byteshift.h | |||
@@ -0,0 +1,70 @@ | |||
1 | #ifndef _TOOLS_LE_BYTESHIFT_H | ||
2 | #define _TOOLS_LE_BYTESHIFT_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | static inline __u16 __get_unaligned_le16(const __u8 *p) | ||
7 | { | ||
8 | return p[0] | p[1] << 8; | ||
9 | } | ||
10 | |||
11 | static inline __u32 __get_unaligned_le32(const __u8 *p) | ||
12 | { | ||
13 | return p[0] | p[1] << 8 | p[2] << 16 | p[3] << 24; | ||
14 | } | ||
15 | |||
16 | static inline __u64 __get_unaligned_le64(const __u8 *p) | ||
17 | { | ||
18 | return (__u64)__get_unaligned_le32(p + 4) << 32 | | ||
19 | __get_unaligned_le32(p); | ||
20 | } | ||
21 | |||
22 | static inline void __put_unaligned_le16(__u16 val, __u8 *p) | ||
23 | { | ||
24 | *p++ = val; | ||
25 | *p++ = val >> 8; | ||
26 | } | ||
27 | |||
28 | static inline void __put_unaligned_le32(__u32 val, __u8 *p) | ||
29 | { | ||
30 | __put_unaligned_le16(val >> 16, p + 2); | ||
31 | __put_unaligned_le16(val, p); | ||
32 | } | ||
33 | |||
34 | static inline void __put_unaligned_le64(__u64 val, __u8 *p) | ||
35 | { | ||
36 | __put_unaligned_le32(val >> 32, p + 4); | ||
37 | __put_unaligned_le32(val, p); | ||
38 | } | ||
39 | |||
40 | static inline __u16 get_unaligned_le16(const void *p) | ||
41 | { | ||
42 | return __get_unaligned_le16((const __u8 *)p); | ||
43 | } | ||
44 | |||
45 | static inline __u32 get_unaligned_le32(const void *p) | ||
46 | { | ||
47 | return __get_unaligned_le32((const __u8 *)p); | ||
48 | } | ||
49 | |||
50 | static inline __u64 get_unaligned_le64(const void *p) | ||
51 | { | ||
52 | return __get_unaligned_le64((const __u8 *)p); | ||
53 | } | ||
54 | |||
55 | static inline void put_unaligned_le16(__u16 val, void *p) | ||
56 | { | ||
57 | __put_unaligned_le16(val, p); | ||
58 | } | ||
59 | |||
60 | static inline void put_unaligned_le32(__u32 val, void *p) | ||
61 | { | ||
62 | __put_unaligned_le32(val, p); | ||
63 | } | ||
64 | |||
65 | static inline void put_unaligned_le64(__u64 val, void *p) | ||
66 | { | ||
67 | __put_unaligned_le64(val, p); | ||
68 | } | ||
69 | |||
70 | #endif /* _TOOLS_LE_BYTESHIFT_H */ | ||
diff --git a/tools/perf/.gitignore b/tools/perf/.gitignore index 416684be0ad3..26b823b61aa1 100644 --- a/tools/perf/.gitignore +++ b/tools/perf/.gitignore | |||
@@ -19,3 +19,5 @@ TAGS | |||
19 | cscope* | 19 | cscope* |
20 | config.mak | 20 | config.mak |
21 | config.mak.autogen | 21 | config.mak.autogen |
22 | *-bison.* | ||
23 | *-flex.* | ||
diff --git a/tools/perf/Documentation/perfconfig.example b/tools/perf/Documentation/perfconfig.example index d1448668f4d4..42c6fd2ae85d 100644 --- a/tools/perf/Documentation/perfconfig.example +++ b/tools/perf/Documentation/perfconfig.example | |||
@@ -6,6 +6,7 @@ | |||
6 | normal = black, lightgray | 6 | normal = black, lightgray |
7 | selected = lightgray, magenta | 7 | selected = lightgray, magenta |
8 | code = blue, lightgray | 8 | code = blue, lightgray |
9 | addr = magenta, lightgray | ||
9 | 10 | ||
10 | [tui] | 11 | [tui] |
11 | 12 | ||
diff --git a/tools/perf/Makefile b/tools/perf/Makefile index cc27148635cd..e98e14c88532 100644 --- a/tools/perf/Makefile +++ b/tools/perf/Makefile | |||
@@ -1,18 +1,10 @@ | |||
1 | ifeq ("$(origin O)", "command line") | 1 | include ../scripts/Makefile.include |
2 | OUTPUT := $(O)/ | ||
3 | endif | ||
4 | 2 | ||
5 | # The default target of this Makefile is... | 3 | # The default target of this Makefile is... |
6 | all: | 4 | all: |
7 | 5 | ||
8 | include config/utilities.mak | 6 | include config/utilities.mak |
9 | 7 | ||
10 | ifneq ($(OUTPUT),) | ||
11 | # check that the output directory actually exists | ||
12 | OUTDIR := $(shell cd $(OUTPUT) && /bin/pwd) | ||
13 | $(if $(OUTDIR),, $(error output directory "$(OUTPUT)" does not exist)) | ||
14 | endif | ||
15 | |||
16 | # Define V to have a more verbose compile. | 8 | # Define V to have a more verbose compile. |
17 | # | 9 | # |
18 | # Define O to save output files in a separate directory. | 10 | # Define O to save output files in a separate directory. |
@@ -61,8 +53,6 @@ ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \ | |||
61 | 53 | ||
62 | CC = $(CROSS_COMPILE)gcc | 54 | CC = $(CROSS_COMPILE)gcc |
63 | AR = $(CROSS_COMPILE)ar | 55 | AR = $(CROSS_COMPILE)ar |
64 | FLEX = $(CROSS_COMPILE)flex | ||
65 | BISON= $(CROSS_COMPILE)bison | ||
66 | 56 | ||
67 | # Additional ARCH settings for x86 | 57 | # Additional ARCH settings for x86 |
68 | ifeq ($(ARCH),i386) | 58 | ifeq ($(ARCH),i386) |
@@ -86,31 +76,6 @@ ifneq ($(WERROR),0) | |||
86 | CFLAGS_WERROR := -Werror | 76 | CFLAGS_WERROR := -Werror |
87 | endif | 77 | endif |
88 | 78 | ||
89 | # | ||
90 | # Include saner warnings here, which can catch bugs: | ||
91 | # | ||
92 | |||
93 | EXTRA_WARNINGS := -Wformat | ||
94 | EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wformat-security | ||
95 | EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wformat-y2k | ||
96 | EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wshadow | ||
97 | EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Winit-self | ||
98 | EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wpacked | ||
99 | EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wredundant-decls | ||
100 | EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wstrict-aliasing=3 | ||
101 | EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wswitch-default | ||
102 | EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wswitch-enum | ||
103 | EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wno-system-headers | ||
104 | EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wundef | ||
105 | EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wwrite-strings | ||
106 | EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wbad-function-cast | ||
107 | EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wmissing-declarations | ||
108 | EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wmissing-prototypes | ||
109 | EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wnested-externs | ||
110 | EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wold-style-definition | ||
111 | EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wstrict-prototypes | ||
112 | EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wdeclaration-after-statement | ||
113 | |||
114 | ifeq ("$(origin DEBUG)", "command line") | 79 | ifeq ("$(origin DEBUG)", "command line") |
115 | PERF_DEBUG = $(DEBUG) | 80 | PERF_DEBUG = $(DEBUG) |
116 | endif | 81 | endif |
@@ -184,7 +149,7 @@ endif | |||
184 | 149 | ||
185 | ### --- END CONFIGURATION SECTION --- | 150 | ### --- END CONFIGURATION SECTION --- |
186 | 151 | ||
187 | BASIC_CFLAGS = -Iutil/include -Iarch/$(ARCH)/include -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE | 152 | BASIC_CFLAGS = -Iutil/include -Iarch/$(ARCH)/include -I$(OUTPUT)/util -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE |
188 | BASIC_LDFLAGS = | 153 | BASIC_LDFLAGS = |
189 | 154 | ||
190 | # Guard against environment variables | 155 | # Guard against environment variables |
@@ -236,6 +201,24 @@ endif | |||
236 | 201 | ||
237 | export PERL_PATH | 202 | export PERL_PATH |
238 | 203 | ||
204 | FLEX = $(CROSS_COMPILE)flex | ||
205 | BISON= $(CROSS_COMPILE)bison | ||
206 | |||
207 | $(OUTPUT)util/parse-events-flex.c: util/parse-events.l | ||
208 | $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/parse-events-flex.h -t util/parse-events.l > $(OUTPUT)util/parse-events-flex.c | ||
209 | |||
210 | $(OUTPUT)util/parse-events-bison.c: util/parse-events.y | ||
211 | $(QUIET_BISON)$(BISON) -v util/parse-events.y -d -o $(OUTPUT)util/parse-events-bison.c | ||
212 | |||
213 | $(OUTPUT)util/pmu-flex.c: util/pmu.l | ||
214 | $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/pmu-flex.h -t util/pmu.l > $(OUTPUT)util/pmu-flex.c | ||
215 | |||
216 | $(OUTPUT)util/pmu-bison.c: util/pmu.y | ||
217 | $(QUIET_BISON)$(BISON) -v util/pmu.y -d -o $(OUTPUT)util/pmu-bison.c | ||
218 | |||
219 | $(OUTPUT)util/parse-events.o: $(OUTPUT)util/parse-events-flex.c $(OUTPUT)util/parse-events-bison.c | ||
220 | $(OUTPUT)util/pmu.o: $(OUTPUT)util/pmu-flex.c $(OUTPUT)util/pmu-bison.c | ||
221 | |||
239 | LIB_FILE=$(OUTPUT)libperf.a | 222 | LIB_FILE=$(OUTPUT)libperf.a |
240 | 223 | ||
241 | LIB_H += ../../include/linux/perf_event.h | 224 | LIB_H += ../../include/linux/perf_event.h |
@@ -251,7 +234,7 @@ LIB_H += util/include/linux/const.h | |||
251 | LIB_H += util/include/linux/ctype.h | 234 | LIB_H += util/include/linux/ctype.h |
252 | LIB_H += util/include/linux/kernel.h | 235 | LIB_H += util/include/linux/kernel.h |
253 | LIB_H += util/include/linux/list.h | 236 | LIB_H += util/include/linux/list.h |
254 | LIB_H += util/include/linux/module.h | 237 | LIB_H += util/include/linux/export.h |
255 | LIB_H += util/include/linux/poison.h | 238 | LIB_H += util/include/linux/poison.h |
256 | LIB_H += util/include/linux/prefetch.h | 239 | LIB_H += util/include/linux/prefetch.h |
257 | LIB_H += util/include/linux/rbtree.h | 240 | LIB_H += util/include/linux/rbtree.h |
@@ -268,6 +251,8 @@ LIB_H += util/include/asm/uaccess.h | |||
268 | LIB_H += util/include/dwarf-regs.h | 251 | LIB_H += util/include/dwarf-regs.h |
269 | LIB_H += util/include/asm/dwarf2.h | 252 | LIB_H += util/include/asm/dwarf2.h |
270 | LIB_H += util/include/asm/cpufeature.h | 253 | LIB_H += util/include/asm/cpufeature.h |
254 | LIB_H += util/include/asm/unistd_32.h | ||
255 | LIB_H += util/include/asm/unistd_64.h | ||
271 | LIB_H += perf.h | 256 | LIB_H += perf.h |
272 | LIB_H += util/annotate.h | 257 | LIB_H += util/annotate.h |
273 | LIB_H += util/cache.h | 258 | LIB_H += util/cache.h |
@@ -488,27 +473,27 @@ else | |||
488 | # Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h | 473 | # Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h |
489 | BASIC_CFLAGS += -I/usr/include/slang | 474 | BASIC_CFLAGS += -I/usr/include/slang |
490 | EXTLIBS += -lnewt -lslang | 475 | EXTLIBS += -lnewt -lslang |
491 | LIB_OBJS += $(OUTPUT)util/ui/setup.o | 476 | LIB_OBJS += $(OUTPUT)ui/setup.o |
492 | LIB_OBJS += $(OUTPUT)util/ui/browser.o | 477 | LIB_OBJS += $(OUTPUT)ui/browser.o |
493 | LIB_OBJS += $(OUTPUT)util/ui/browsers/annotate.o | 478 | LIB_OBJS += $(OUTPUT)ui/browsers/annotate.o |
494 | LIB_OBJS += $(OUTPUT)util/ui/browsers/hists.o | 479 | LIB_OBJS += $(OUTPUT)ui/browsers/hists.o |
495 | LIB_OBJS += $(OUTPUT)util/ui/browsers/map.o | 480 | LIB_OBJS += $(OUTPUT)ui/browsers/map.o |
496 | LIB_OBJS += $(OUTPUT)util/ui/helpline.o | 481 | LIB_OBJS += $(OUTPUT)ui/helpline.o |
497 | LIB_OBJS += $(OUTPUT)util/ui/progress.o | 482 | LIB_OBJS += $(OUTPUT)ui/progress.o |
498 | LIB_OBJS += $(OUTPUT)util/ui/util.o | 483 | LIB_OBJS += $(OUTPUT)ui/util.o |
499 | LIB_H += util/ui/browser.h | 484 | LIB_H += ui/browser.h |
500 | LIB_H += util/ui/browsers/map.h | 485 | LIB_H += ui/browsers/map.h |
501 | LIB_H += util/ui/helpline.h | 486 | LIB_H += ui/helpline.h |
502 | LIB_H += util/ui/keysyms.h | 487 | LIB_H += ui/keysyms.h |
503 | LIB_H += util/ui/libslang.h | 488 | LIB_H += ui/libslang.h |
504 | LIB_H += util/ui/progress.h | 489 | LIB_H += ui/progress.h |
505 | LIB_H += util/ui/util.h | 490 | LIB_H += ui/util.h |
506 | LIB_H += util/ui/ui.h | 491 | LIB_H += ui/ui.h |
507 | endif | 492 | endif |
508 | endif | 493 | endif |
509 | 494 | ||
510 | ifdef NO_GTK2 | 495 | ifdef NO_GTK2 |
511 | BASIC_CFLAGS += -DNO_GTK2 | 496 | BASIC_CFLAGS += -DNO_GTK2_SUPPORT |
512 | else | 497 | else |
513 | FLAGS_GTK2=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(shell pkg-config --libs --cflags gtk+-2.0) | 498 | FLAGS_GTK2=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(shell pkg-config --libs --cflags gtk+-2.0) |
514 | ifneq ($(call try-cc,$(SOURCE_GTK2),$(FLAGS_GTK2)),y) | 499 | ifneq ($(call try-cc,$(SOURCE_GTK2),$(FLAGS_GTK2)),y) |
@@ -517,7 +502,7 @@ else | |||
517 | else | 502 | else |
518 | BASIC_CFLAGS += $(shell pkg-config --cflags gtk+-2.0) | 503 | BASIC_CFLAGS += $(shell pkg-config --cflags gtk+-2.0) |
519 | EXTLIBS += $(shell pkg-config --libs gtk+-2.0) | 504 | EXTLIBS += $(shell pkg-config --libs gtk+-2.0) |
520 | LIB_OBJS += $(OUTPUT)util/gtk/browser.o | 505 | LIB_OBJS += $(OUTPUT)ui/gtk/browser.o |
521 | endif | 506 | endif |
522 | endif | 507 | endif |
523 | 508 | ||
@@ -660,18 +645,6 @@ else | |||
660 | endif | 645 | endif |
661 | endif | 646 | endif |
662 | 647 | ||
663 | ifneq ($(findstring $(MAKEFLAGS),s),s) | ||
664 | ifndef V | ||
665 | QUIET_CC = @echo ' ' CC $@; | ||
666 | QUIET_AR = @echo ' ' AR $@; | ||
667 | QUIET_LINK = @echo ' ' LINK $@; | ||
668 | QUIET_MKDIR = @echo ' ' MKDIR $@; | ||
669 | QUIET_GEN = @echo ' ' GEN $@; | ||
670 | QUIET_FLEX = @echo ' ' FLEX $@; | ||
671 | QUIET_BISON = @echo ' ' BISON $@; | ||
672 | endif | ||
673 | endif | ||
674 | |||
675 | ifdef ASCIIDOC8 | 648 | ifdef ASCIIDOC8 |
676 | export ASCIIDOC8 | 649 | export ASCIIDOC8 |
677 | endif | 650 | endif |
@@ -752,6 +725,15 @@ $(OUTPUT)perf.o perf.spec \ | |||
752 | .SUFFIXES: | 725 | .SUFFIXES: |
753 | .SUFFIXES: .o .c .S .s | 726 | .SUFFIXES: .o .c .S .s |
754 | 727 | ||
728 | # These two need to be here so that when O= is not used they take precedence | ||
729 | # over the general rule for .o | ||
730 | |||
731 | $(OUTPUT)util/%-flex.o: $(OUTPUT)util/%-flex.c $(OUTPUT)PERF-CFLAGS | ||
732 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -Iutil/ -Wno-redundant-decls -Wno-switch-default -Wno-unused-function $< | ||
733 | |||
734 | $(OUTPUT)util/%-bison.o: $(OUTPUT)util/%-bison.c $(OUTPUT)PERF-CFLAGS | ||
735 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0 -Iutil/ -Wno-redundant-decls -Wno-switch-default -Wno-unused-function $< | ||
736 | |||
755 | $(OUTPUT)%.o: %.c $(OUTPUT)PERF-CFLAGS | 737 | $(OUTPUT)%.o: %.c $(OUTPUT)PERF-CFLAGS |
756 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $< | 738 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $< |
757 | $(OUTPUT)%.i: %.c $(OUTPUT)PERF-CFLAGS | 739 | $(OUTPUT)%.i: %.c $(OUTPUT)PERF-CFLAGS |
@@ -773,27 +755,21 @@ $(OUTPUT)util/exec_cmd.o: util/exec_cmd.c $(OUTPUT)PERF-CFLAGS | |||
773 | $(OUTPUT)util/config.o: util/config.c $(OUTPUT)PERF-CFLAGS | 755 | $(OUTPUT)util/config.o: util/config.c $(OUTPUT)PERF-CFLAGS |
774 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $< | 756 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $< |
775 | 757 | ||
776 | $(OUTPUT)util/ui/browser.o: util/ui/browser.c $(OUTPUT)PERF-CFLAGS | 758 | $(OUTPUT)ui/browser.o: ui/browser.c $(OUTPUT)PERF-CFLAGS |
777 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DENABLE_SLFUTURE_CONST $< | 759 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DENABLE_SLFUTURE_CONST $< |
778 | 760 | ||
779 | $(OUTPUT)util/ui/browsers/annotate.o: util/ui/browsers/annotate.c $(OUTPUT)PERF-CFLAGS | 761 | $(OUTPUT)ui/browsers/annotate.o: ui/browsers/annotate.c $(OUTPUT)PERF-CFLAGS |
780 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DENABLE_SLFUTURE_CONST $< | 762 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DENABLE_SLFUTURE_CONST $< |
781 | 763 | ||
782 | $(OUTPUT)util/ui/browsers/hists.o: util/ui/browsers/hists.c $(OUTPUT)PERF-CFLAGS | 764 | $(OUTPUT)ui/browsers/hists.o: ui/browsers/hists.c $(OUTPUT)PERF-CFLAGS |
783 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DENABLE_SLFUTURE_CONST $< | 765 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DENABLE_SLFUTURE_CONST $< |
784 | 766 | ||
785 | $(OUTPUT)util/ui/browsers/map.o: util/ui/browsers/map.c $(OUTPUT)PERF-CFLAGS | 767 | $(OUTPUT)ui/browsers/map.o: ui/browsers/map.c $(OUTPUT)PERF-CFLAGS |
786 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DENABLE_SLFUTURE_CONST $< | 768 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DENABLE_SLFUTURE_CONST $< |
787 | 769 | ||
788 | $(OUTPUT)util/rbtree.o: ../../lib/rbtree.c $(OUTPUT)PERF-CFLAGS | 770 | $(OUTPUT)util/rbtree.o: ../../lib/rbtree.c $(OUTPUT)PERF-CFLAGS |
789 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $< | 771 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $< |
790 | 772 | ||
791 | $(OUTPUT)util/parse-events-flex.o: util/parse-events-flex.c $(OUTPUT)PERF-CFLAGS | ||
792 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -Wno-redundant-decls -Wno-switch-default -Wno-unused-function $< | ||
793 | |||
794 | $(OUTPUT)util/pmu-flex.o: util/pmu-flex.c $(OUTPUT)PERF-CFLAGS | ||
795 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -Wno-redundant-decls -Wno-switch-default -Wno-unused-function $< | ||
796 | |||
797 | $(OUTPUT)util/scripting-engines/trace-event-perl.o: util/scripting-engines/trace-event-perl.c $(OUTPUT)PERF-CFLAGS | 773 | $(OUTPUT)util/scripting-engines/trace-event-perl.o: util/scripting-engines/trace-event-perl.c $(OUTPUT)PERF-CFLAGS |
798 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow $< | 774 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow $< |
799 | 775 | ||
@@ -830,8 +806,6 @@ help: | |||
830 | @echo ' html - make html documentation' | 806 | @echo ' html - make html documentation' |
831 | @echo ' info - make GNU info documentation (access with info <foo>)' | 807 | @echo ' info - make GNU info documentation (access with info <foo>)' |
832 | @echo ' pdf - make pdf documentation' | 808 | @echo ' pdf - make pdf documentation' |
833 | @echo ' event-parser - make event parser code' | ||
834 | @echo ' pmu-parser - make pmu format parser code' | ||
835 | @echo ' TAGS - use etags to make tag information for source browsing' | 809 | @echo ' TAGS - use etags to make tag information for source browsing' |
836 | @echo ' tags - use ctags to make tag information for source browsing' | 810 | @echo ' tags - use ctags to make tag information for source browsing' |
837 | @echo ' cscope - use cscope to make interactive browsing database' | 811 | @echo ' cscope - use cscope to make interactive browsing database' |
@@ -881,14 +855,6 @@ cscope: | |||
881 | $(RM) cscope* | 855 | $(RM) cscope* |
882 | $(FIND) . -name '*.[hcS]' -print | xargs cscope -b | 856 | $(FIND) . -name '*.[hcS]' -print | xargs cscope -b |
883 | 857 | ||
884 | event-parser: | ||
885 | $(QUIET_BISON)$(BISON) -v util/parse-events.y -d -o util/parse-events-bison.c | ||
886 | $(QUIET_FLEX)$(FLEX) --header-file=util/parse-events-flex.h -t util/parse-events.l > util/parse-events-flex.c | ||
887 | |||
888 | pmu-parser: | ||
889 | $(QUIET_BISON)$(BISON) -v util/pmu.y -d -o util/pmu-bison.c | ||
890 | $(QUIET_FLEX)$(FLEX) --header-file=util/pmu-flex.h -t util/pmu.l > util/pmu-flex.c | ||
891 | |||
892 | ### Detect prefix changes | 858 | ### Detect prefix changes |
893 | TRACK_CFLAGS = $(subst ','\'',$(ALL_CFLAGS)):\ | 859 | TRACK_CFLAGS = $(subst ','\'',$(ALL_CFLAGS)):\ |
894 | $(bindir_SQ):$(perfexecdir_SQ):$(template_dir_SQ):$(prefix_SQ) | 860 | $(bindir_SQ):$(perfexecdir_SQ):$(template_dir_SQ):$(prefix_SQ) |
@@ -976,6 +942,7 @@ clean: | |||
976 | $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* | 942 | $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* |
977 | $(MAKE) -C Documentation/ clean | 943 | $(MAKE) -C Documentation/ clean |
978 | $(RM) $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)PERF-CFLAGS | 944 | $(RM) $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)PERF-CFLAGS |
945 | $(RM) $(OUTPUT)util/*-{bison,flex}* | ||
979 | $(python-clean) | 946 | $(python-clean) |
980 | 947 | ||
981 | .PHONY: all install clean strip | 948 | .PHONY: all install clean strip |
diff --git a/tools/perf/arch/powerpc/util/header.c b/tools/perf/arch/powerpc/util/header.c index eba80c292945..2f7073d107fd 100644 --- a/tools/perf/arch/powerpc/util/header.c +++ b/tools/perf/arch/powerpc/util/header.c | |||
@@ -25,7 +25,7 @@ get_cpuid(char *buffer, size_t sz) | |||
25 | 25 | ||
26 | pvr = mfspr(SPRN_PVR); | 26 | pvr = mfspr(SPRN_PVR); |
27 | 27 | ||
28 | nb = snprintf(buffer, sz, "%lu,%lu$", PVR_VER(pvr), PVR_REV(pvr)); | 28 | nb = scnprintf(buffer, sz, "%lu,%lu$", PVR_VER(pvr), PVR_REV(pvr)); |
29 | 29 | ||
30 | /* look for end marker to ensure the entire data fit */ | 30 | /* look for end marker to ensure the entire data fit */ |
31 | if (strchr(buffer, '$')) { | 31 | if (strchr(buffer, '$')) { |
diff --git a/tools/perf/arch/x86/util/header.c b/tools/perf/arch/x86/util/header.c index f94006068d2b..146d12a1cec0 100644 --- a/tools/perf/arch/x86/util/header.c +++ b/tools/perf/arch/x86/util/header.c | |||
@@ -48,7 +48,7 @@ get_cpuid(char *buffer, size_t sz) | |||
48 | if (family >= 0x6) | 48 | if (family >= 0x6) |
49 | model += ((a >> 16) & 0xf) << 4; | 49 | model += ((a >> 16) & 0xf) << 4; |
50 | } | 50 | } |
51 | nb = snprintf(buffer, sz, "%s,%u,%u,%u$", vendor, family, model, step); | 51 | nb = scnprintf(buffer, sz, "%s,%u,%u,%u$", vendor, family, model, step); |
52 | 52 | ||
53 | /* look for end marker to ensure the entire data fit */ | 53 | /* look for end marker to ensure the entire data fit */ |
54 | if (strchr(buffer, '$')) { | 54 | if (strchr(buffer, '$')) { |
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c index 4f19513d7dda..d29d350fb2b7 100644 --- a/tools/perf/builtin-diff.c +++ b/tools/perf/builtin-diff.c | |||
@@ -24,6 +24,11 @@ static char diff__default_sort_order[] = "dso,symbol"; | |||
24 | static bool force; | 24 | static bool force; |
25 | static bool show_displacement; | 25 | static bool show_displacement; |
26 | 26 | ||
27 | struct perf_diff { | ||
28 | struct perf_tool tool; | ||
29 | struct perf_session *session; | ||
30 | }; | ||
31 | |||
27 | static int hists__add_entry(struct hists *self, | 32 | static int hists__add_entry(struct hists *self, |
28 | struct addr_location *al, u64 period) | 33 | struct addr_location *al, u64 period) |
29 | { | 34 | { |
@@ -32,12 +37,14 @@ static int hists__add_entry(struct hists *self, | |||
32 | return -ENOMEM; | 37 | return -ENOMEM; |
33 | } | 38 | } |
34 | 39 | ||
35 | static int diff__process_sample_event(struct perf_tool *tool __used, | 40 | static int diff__process_sample_event(struct perf_tool *tool, |
36 | union perf_event *event, | 41 | union perf_event *event, |
37 | struct perf_sample *sample, | 42 | struct perf_sample *sample, |
38 | struct perf_evsel *evsel __used, | 43 | struct perf_evsel *evsel __used, |
39 | struct machine *machine) | 44 | struct machine *machine) |
40 | { | 45 | { |
46 | struct perf_diff *_diff = container_of(tool, struct perf_diff, tool); | ||
47 | struct perf_session *session = _diff->session; | ||
41 | struct addr_location al; | 48 | struct addr_location al; |
42 | 49 | ||
43 | if (perf_event__preprocess_sample(event, machine, &al, sample, NULL) < 0) { | 50 | if (perf_event__preprocess_sample(event, machine, &al, sample, NULL) < 0) { |
@@ -49,24 +56,26 @@ static int diff__process_sample_event(struct perf_tool *tool __used, | |||
49 | if (al.filtered || al.sym == NULL) | 56 | if (al.filtered || al.sym == NULL) |
50 | return 0; | 57 | return 0; |
51 | 58 | ||
52 | if (hists__add_entry(&evsel->hists, &al, sample->period)) { | 59 | if (hists__add_entry(&session->hists, &al, sample->period)) { |
53 | pr_warning("problem incrementing symbol period, skipping event\n"); | 60 | pr_warning("problem incrementing symbol period, skipping event\n"); |
54 | return -1; | 61 | return -1; |
55 | } | 62 | } |
56 | 63 | ||
57 | evsel->hists.stats.total_period += sample->period; | 64 | session->hists.stats.total_period += sample->period; |
58 | return 0; | 65 | return 0; |
59 | } | 66 | } |
60 | 67 | ||
61 | static struct perf_tool perf_diff = { | 68 | static struct perf_diff diff = { |
62 | .sample = diff__process_sample_event, | 69 | .tool = { |
63 | .mmap = perf_event__process_mmap, | 70 | .sample = diff__process_sample_event, |
64 | .comm = perf_event__process_comm, | 71 | .mmap = perf_event__process_mmap, |
65 | .exit = perf_event__process_task, | 72 | .comm = perf_event__process_comm, |
66 | .fork = perf_event__process_task, | 73 | .exit = perf_event__process_task, |
67 | .lost = perf_event__process_lost, | 74 | .fork = perf_event__process_task, |
68 | .ordered_samples = true, | 75 | .lost = perf_event__process_lost, |
69 | .ordering_requires_timestamps = true, | 76 | .ordered_samples = true, |
77 | .ordering_requires_timestamps = true, | ||
78 | }, | ||
70 | }; | 79 | }; |
71 | 80 | ||
72 | static void perf_session__insert_hist_entry_by_name(struct rb_root *root, | 81 | static void perf_session__insert_hist_entry_by_name(struct rb_root *root, |
@@ -107,12 +116,6 @@ static void hists__resort_entries(struct hists *self) | |||
107 | self->entries = tmp; | 116 | self->entries = tmp; |
108 | } | 117 | } |
109 | 118 | ||
110 | static void hists__set_positions(struct hists *self) | ||
111 | { | ||
112 | hists__output_resort(self); | ||
113 | hists__resort_entries(self); | ||
114 | } | ||
115 | |||
116 | static struct hist_entry *hists__find_entry(struct hists *self, | 119 | static struct hist_entry *hists__find_entry(struct hists *self, |
117 | struct hist_entry *he) | 120 | struct hist_entry *he) |
118 | { | 121 | { |
@@ -146,30 +149,37 @@ static void hists__match(struct hists *older, struct hists *newer) | |||
146 | static int __cmd_diff(void) | 149 | static int __cmd_diff(void) |
147 | { | 150 | { |
148 | int ret, i; | 151 | int ret, i; |
152 | #define older (session[0]) | ||
153 | #define newer (session[1]) | ||
149 | struct perf_session *session[2]; | 154 | struct perf_session *session[2]; |
150 | 155 | ||
151 | session[0] = perf_session__new(input_old, O_RDONLY, force, false, &perf_diff); | 156 | older = perf_session__new(input_old, O_RDONLY, force, false, |
152 | session[1] = perf_session__new(input_new, O_RDONLY, force, false, &perf_diff); | 157 | &diff.tool); |
158 | newer = perf_session__new(input_new, O_RDONLY, force, false, | ||
159 | &diff.tool); | ||
153 | if (session[0] == NULL || session[1] == NULL) | 160 | if (session[0] == NULL || session[1] == NULL) |
154 | return -ENOMEM; | 161 | return -ENOMEM; |
155 | 162 | ||
156 | for (i = 0; i < 2; ++i) { | 163 | for (i = 0; i < 2; ++i) { |
157 | ret = perf_session__process_events(session[i], &perf_diff); | 164 | diff.session = session[i]; |
165 | ret = perf_session__process_events(session[i], &diff.tool); | ||
158 | if (ret) | 166 | if (ret) |
159 | goto out_delete; | 167 | goto out_delete; |
168 | hists__output_resort(&session[i]->hists); | ||
160 | } | 169 | } |
161 | 170 | ||
162 | hists__output_resort(&session[1]->hists); | ||
163 | if (show_displacement) | 171 | if (show_displacement) |
164 | hists__set_positions(&session[0]->hists); | 172 | hists__resort_entries(&older->hists); |
165 | 173 | ||
166 | hists__match(&session[0]->hists, &session[1]->hists); | 174 | hists__match(&older->hists, &newer->hists); |
167 | hists__fprintf(&session[1]->hists, &session[0]->hists, | 175 | hists__fprintf(&newer->hists, &older->hists, |
168 | show_displacement, true, 0, 0, stdout); | 176 | show_displacement, true, 0, 0, stdout); |
169 | out_delete: | 177 | out_delete: |
170 | for (i = 0; i < 2; ++i) | 178 | for (i = 0; i < 2; ++i) |
171 | perf_session__delete(session[i]); | 179 | perf_session__delete(session[i]); |
172 | return ret; | 180 | return ret; |
181 | #undef older | ||
182 | #undef newer | ||
173 | } | 183 | } |
174 | 184 | ||
175 | static const char * const diff_usage[] = { | 185 | static const char * const diff_usage[] = { |
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index be4e1eee782e..10b1f1f25ed7 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -245,7 +245,7 @@ try_again: | |||
245 | * based cpu-clock-tick sw counter, which | 245 | * based cpu-clock-tick sw counter, which |
246 | * is always available even if no PMU support: | 246 | * is always available even if no PMU support: |
247 | */ | 247 | */ |
248 | if (attr->type == PERF_TYPE_HARDWARE | 248 | if (err == ENOENT && attr->type == PERF_TYPE_HARDWARE |
249 | && attr->config == PERF_COUNT_HW_CPU_CYCLES) { | 249 | && attr->config == PERF_COUNT_HW_CPU_CYCLES) { |
250 | 250 | ||
251 | if (verbose) | 251 | if (verbose) |
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 2e317438980b..cec2b8cee80c 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
@@ -296,12 +296,15 @@ static size_t hists__fprintf_nr_sample_events(struct hists *self, | |||
296 | { | 296 | { |
297 | size_t ret; | 297 | size_t ret; |
298 | char unit; | 298 | char unit; |
299 | unsigned long nr_events = self->stats.nr_events[PERF_RECORD_SAMPLE]; | 299 | unsigned long nr_samples = self->stats.nr_events[PERF_RECORD_SAMPLE]; |
300 | u64 nr_events = self->stats.total_period; | ||
300 | 301 | ||
301 | nr_events = convert_unit(nr_events, &unit); | 302 | nr_samples = convert_unit(nr_samples, &unit); |
302 | ret = fprintf(fp, "# Events: %lu%c", nr_events, unit); | 303 | ret = fprintf(fp, "# Samples: %lu%c", nr_samples, unit); |
303 | if (evname != NULL) | 304 | if (evname != NULL) |
304 | ret += fprintf(fp, " %s", evname); | 305 | ret += fprintf(fp, " of event '%s'", evname); |
306 | |||
307 | ret += fprintf(fp, "\n# Event count (approx.): %lu", nr_events); | ||
305 | return ret + fprintf(fp, "\n#\n"); | 308 | return ret + fprintf(fp, "\n#\n"); |
306 | } | 309 | } |
307 | 310 | ||
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c index fb8b5f83b4a0..1cad3af4bf4c 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include "util/debug.h" | 17 | #include "util/debug.h" |
18 | 18 | ||
19 | #include <sys/prctl.h> | 19 | #include <sys/prctl.h> |
20 | #include <sys/resource.h> | ||
20 | 21 | ||
21 | #include <semaphore.h> | 22 | #include <semaphore.h> |
22 | #include <pthread.h> | 23 | #include <pthread.h> |
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index c941bb640f49..dde9e17c018b 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c | |||
@@ -173,7 +173,7 @@ static struct perf_event_attr very_very_detailed_attrs[] = { | |||
173 | 173 | ||
174 | 174 | ||
175 | 175 | ||
176 | struct perf_evlist *evsel_list; | 176 | static struct perf_evlist *evsel_list; |
177 | 177 | ||
178 | static bool system_wide = false; | 178 | static bool system_wide = false; |
179 | static int run_idx = 0; | 179 | static int run_idx = 0; |
@@ -265,18 +265,18 @@ static double stddev_stats(struct stats *stats) | |||
265 | return sqrt(variance_mean); | 265 | return sqrt(variance_mean); |
266 | } | 266 | } |
267 | 267 | ||
268 | struct stats runtime_nsecs_stats[MAX_NR_CPUS]; | 268 | static struct stats runtime_nsecs_stats[MAX_NR_CPUS]; |
269 | struct stats runtime_cycles_stats[MAX_NR_CPUS]; | 269 | static struct stats runtime_cycles_stats[MAX_NR_CPUS]; |
270 | struct stats runtime_stalled_cycles_front_stats[MAX_NR_CPUS]; | 270 | static struct stats runtime_stalled_cycles_front_stats[MAX_NR_CPUS]; |
271 | struct stats runtime_stalled_cycles_back_stats[MAX_NR_CPUS]; | 271 | static struct stats runtime_stalled_cycles_back_stats[MAX_NR_CPUS]; |
272 | struct stats runtime_branches_stats[MAX_NR_CPUS]; | 272 | static struct stats runtime_branches_stats[MAX_NR_CPUS]; |
273 | struct stats runtime_cacherefs_stats[MAX_NR_CPUS]; | 273 | static struct stats runtime_cacherefs_stats[MAX_NR_CPUS]; |
274 | struct stats runtime_l1_dcache_stats[MAX_NR_CPUS]; | 274 | static struct stats runtime_l1_dcache_stats[MAX_NR_CPUS]; |
275 | struct stats runtime_l1_icache_stats[MAX_NR_CPUS]; | 275 | static struct stats runtime_l1_icache_stats[MAX_NR_CPUS]; |
276 | struct stats runtime_ll_cache_stats[MAX_NR_CPUS]; | 276 | static struct stats runtime_ll_cache_stats[MAX_NR_CPUS]; |
277 | struct stats runtime_itlb_cache_stats[MAX_NR_CPUS]; | 277 | static struct stats runtime_itlb_cache_stats[MAX_NR_CPUS]; |
278 | struct stats runtime_dtlb_cache_stats[MAX_NR_CPUS]; | 278 | static struct stats runtime_dtlb_cache_stats[MAX_NR_CPUS]; |
279 | struct stats walltime_nsecs_stats; | 279 | static struct stats walltime_nsecs_stats; |
280 | 280 | ||
281 | static int create_perf_stat_counter(struct perf_evsel *evsel, | 281 | static int create_perf_stat_counter(struct perf_evsel *evsel, |
282 | struct perf_evsel *first) | 282 | struct perf_evsel *first) |
diff --git a/tools/perf/builtin-test.c b/tools/perf/builtin-test.c index 86874238a350..1c5b9801ac61 100644 --- a/tools/perf/builtin-test.c +++ b/tools/perf/builtin-test.c | |||
@@ -877,6 +877,58 @@ static int test__checkevent_genhw_modifier(struct perf_evlist *evlist) | |||
877 | return test__checkevent_genhw(evlist); | 877 | return test__checkevent_genhw(evlist); |
878 | } | 878 | } |
879 | 879 | ||
880 | static int test__checkevent_breakpoint_modifier(struct perf_evlist *evlist) | ||
881 | { | ||
882 | struct perf_evsel *evsel = list_entry(evlist->entries.next, | ||
883 | struct perf_evsel, node); | ||
884 | |||
885 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user); | ||
886 | TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel); | ||
887 | TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv); | ||
888 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); | ||
889 | |||
890 | return test__checkevent_breakpoint(evlist); | ||
891 | } | ||
892 | |||
893 | static int test__checkevent_breakpoint_x_modifier(struct perf_evlist *evlist) | ||
894 | { | ||
895 | struct perf_evsel *evsel = list_entry(evlist->entries.next, | ||
896 | struct perf_evsel, node); | ||
897 | |||
898 | TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user); | ||
899 | TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel); | ||
900 | TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv); | ||
901 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); | ||
902 | |||
903 | return test__checkevent_breakpoint_x(evlist); | ||
904 | } | ||
905 | |||
906 | static int test__checkevent_breakpoint_r_modifier(struct perf_evlist *evlist) | ||
907 | { | ||
908 | struct perf_evsel *evsel = list_entry(evlist->entries.next, | ||
909 | struct perf_evsel, node); | ||
910 | |||
911 | TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user); | ||
912 | TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel); | ||
913 | TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv); | ||
914 | TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip); | ||
915 | |||
916 | return test__checkevent_breakpoint_r(evlist); | ||
917 | } | ||
918 | |||
919 | static int test__checkevent_breakpoint_w_modifier(struct perf_evlist *evlist) | ||
920 | { | ||
921 | struct perf_evsel *evsel = list_entry(evlist->entries.next, | ||
922 | struct perf_evsel, node); | ||
923 | |||
924 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user); | ||
925 | TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel); | ||
926 | TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv); | ||
927 | TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip); | ||
928 | |||
929 | return test__checkevent_breakpoint_w(evlist); | ||
930 | } | ||
931 | |||
880 | static int test__checkevent_pmu(struct perf_evlist *evlist) | 932 | static int test__checkevent_pmu(struct perf_evlist *evlist) |
881 | { | 933 | { |
882 | 934 | ||
@@ -893,6 +945,47 @@ static int test__checkevent_pmu(struct perf_evlist *evlist) | |||
893 | return 0; | 945 | return 0; |
894 | } | 946 | } |
895 | 947 | ||
948 | static int test__checkevent_list(struct perf_evlist *evlist) | ||
949 | { | ||
950 | struct perf_evsel *evsel; | ||
951 | |||
952 | TEST_ASSERT_VAL("wrong number of entries", 3 == evlist->nr_entries); | ||
953 | |||
954 | /* r1 */ | ||
955 | evsel = list_entry(evlist->entries.next, struct perf_evsel, node); | ||
956 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->attr.type); | ||
957 | TEST_ASSERT_VAL("wrong config", 1 == evsel->attr.config); | ||
958 | TEST_ASSERT_VAL("wrong config1", 0 == evsel->attr.config1); | ||
959 | TEST_ASSERT_VAL("wrong config2", 0 == evsel->attr.config2); | ||
960 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user); | ||
961 | TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel); | ||
962 | TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv); | ||
963 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); | ||
964 | |||
965 | /* syscalls:sys_enter_open:k */ | ||
966 | evsel = list_entry(evsel->node.next, struct perf_evsel, node); | ||
967 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_TRACEPOINT == evsel->attr.type); | ||
968 | TEST_ASSERT_VAL("wrong sample_type", | ||
969 | (PERF_SAMPLE_RAW | PERF_SAMPLE_TIME | PERF_SAMPLE_CPU) == | ||
970 | evsel->attr.sample_type); | ||
971 | TEST_ASSERT_VAL("wrong sample_period", 1 == evsel->attr.sample_period); | ||
972 | TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user); | ||
973 | TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel); | ||
974 | TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv); | ||
975 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); | ||
976 | |||
977 | /* 1:1:hp */ | ||
978 | evsel = list_entry(evsel->node.next, struct perf_evsel, node); | ||
979 | TEST_ASSERT_VAL("wrong type", 1 == evsel->attr.type); | ||
980 | TEST_ASSERT_VAL("wrong config", 1 == evsel->attr.config); | ||
981 | TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user); | ||
982 | TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel); | ||
983 | TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv); | ||
984 | TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip); | ||
985 | |||
986 | return 0; | ||
987 | } | ||
988 | |||
896 | static struct test__event_st { | 989 | static struct test__event_st { |
897 | const char *name; | 990 | const char *name; |
898 | __u32 type; | 991 | __u32 type; |
@@ -975,9 +1068,29 @@ static struct test__event_st { | |||
975 | .check = test__checkevent_genhw_modifier, | 1068 | .check = test__checkevent_genhw_modifier, |
976 | }, | 1069 | }, |
977 | { | 1070 | { |
1071 | .name = "mem:0:u", | ||
1072 | .check = test__checkevent_breakpoint_modifier, | ||
1073 | }, | ||
1074 | { | ||
1075 | .name = "mem:0:x:k", | ||
1076 | .check = test__checkevent_breakpoint_x_modifier, | ||
1077 | }, | ||
1078 | { | ||
1079 | .name = "mem:0:r:hp", | ||
1080 | .check = test__checkevent_breakpoint_r_modifier, | ||
1081 | }, | ||
1082 | { | ||
1083 | .name = "mem:0:w:up", | ||
1084 | .check = test__checkevent_breakpoint_w_modifier, | ||
1085 | }, | ||
1086 | { | ||
978 | .name = "cpu/config=10,config1,config2=3,period=1000/u", | 1087 | .name = "cpu/config=10,config1,config2=3,period=1000/u", |
979 | .check = test__checkevent_pmu, | 1088 | .check = test__checkevent_pmu, |
980 | }, | 1089 | }, |
1090 | { | ||
1091 | .name = "r1,syscalls:sys_enter_open:k,1:1:hp", | ||
1092 | .check = test__checkevent_list, | ||
1093 | }, | ||
981 | }; | 1094 | }; |
982 | 1095 | ||
983 | #define TEST__EVENTS_CNT (sizeof(test__events) / sizeof(struct test__event_st)) | 1096 | #define TEST__EVENTS_CNT (sizeof(test__events) / sizeof(struct test__event_st)) |
@@ -1003,10 +1116,9 @@ static int test__parse_events(void) | |||
1003 | } | 1116 | } |
1004 | 1117 | ||
1005 | ret = e->check(evlist); | 1118 | ret = e->check(evlist); |
1119 | perf_evlist__delete(evlist); | ||
1006 | if (ret) | 1120 | if (ret) |
1007 | break; | 1121 | break; |
1008 | |||
1009 | perf_evlist__delete(evlist); | ||
1010 | } | 1122 | } |
1011 | 1123 | ||
1012 | return ret; | 1124 | return ret; |
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index e3c63aef8efc..8ef59f8262bb 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
@@ -42,6 +42,7 @@ | |||
42 | #include "util/debug.h" | 42 | #include "util/debug.h" |
43 | 43 | ||
44 | #include <assert.h> | 44 | #include <assert.h> |
45 | #include <elf.h> | ||
45 | #include <fcntl.h> | 46 | #include <fcntl.h> |
46 | 47 | ||
47 | #include <stdio.h> | 48 | #include <stdio.h> |
@@ -59,6 +60,7 @@ | |||
59 | #include <sys/prctl.h> | 60 | #include <sys/prctl.h> |
60 | #include <sys/wait.h> | 61 | #include <sys/wait.h> |
61 | #include <sys/uio.h> | 62 | #include <sys/uio.h> |
63 | #include <sys/utsname.h> | ||
62 | #include <sys/mman.h> | 64 | #include <sys/mman.h> |
63 | 65 | ||
64 | #include <linux/unistd.h> | 66 | #include <linux/unistd.h> |
@@ -162,12 +164,40 @@ static void __zero_source_counters(struct hist_entry *he) | |||
162 | symbol__annotate_zero_histograms(sym); | 164 | symbol__annotate_zero_histograms(sym); |
163 | } | 165 | } |
164 | 166 | ||
167 | static void ui__warn_map_erange(struct map *map, struct symbol *sym, u64 ip) | ||
168 | { | ||
169 | struct utsname uts; | ||
170 | int err = uname(&uts); | ||
171 | |||
172 | ui__warning("Out of bounds address found:\n\n" | ||
173 | "Addr: %" PRIx64 "\n" | ||
174 | "DSO: %s %c\n" | ||
175 | "Map: %" PRIx64 "-%" PRIx64 "\n" | ||
176 | "Symbol: %" PRIx64 "-%" PRIx64 " %c %s\n" | ||
177 | "Arch: %s\n" | ||
178 | "Kernel: %s\n" | ||
179 | "Tools: %s\n\n" | ||
180 | "Not all samples will be on the annotation output.\n\n" | ||
181 | "Please report to linux-kernel@vger.kernel.org\n", | ||
182 | ip, map->dso->long_name, dso__symtab_origin(map->dso), | ||
183 | map->start, map->end, sym->start, sym->end, | ||
184 | sym->binding == STB_GLOBAL ? 'g' : | ||
185 | sym->binding == STB_LOCAL ? 'l' : 'w', sym->name, | ||
186 | err ? "[unknown]" : uts.machine, | ||
187 | err ? "[unknown]" : uts.release, perf_version_string); | ||
188 | if (use_browser <= 0) | ||
189 | sleep(5); | ||
190 | |||
191 | map->erange_warned = true; | ||
192 | } | ||
193 | |||
165 | static void perf_top__record_precise_ip(struct perf_top *top, | 194 | static void perf_top__record_precise_ip(struct perf_top *top, |
166 | struct hist_entry *he, | 195 | struct hist_entry *he, |
167 | int counter, u64 ip) | 196 | int counter, u64 ip) |
168 | { | 197 | { |
169 | struct annotation *notes; | 198 | struct annotation *notes; |
170 | struct symbol *sym; | 199 | struct symbol *sym; |
200 | int err; | ||
171 | 201 | ||
172 | if (he == NULL || he->ms.sym == NULL || | 202 | if (he == NULL || he->ms.sym == NULL || |
173 | ((top->sym_filter_entry == NULL || | 203 | ((top->sym_filter_entry == NULL || |
@@ -189,9 +219,12 @@ static void perf_top__record_precise_ip(struct perf_top *top, | |||
189 | } | 219 | } |
190 | 220 | ||
191 | ip = he->ms.map->map_ip(he->ms.map, ip); | 221 | ip = he->ms.map->map_ip(he->ms.map, ip); |
192 | symbol__inc_addr_samples(sym, he->ms.map, counter, ip); | 222 | err = symbol__inc_addr_samples(sym, he->ms.map, counter, ip); |
193 | 223 | ||
194 | pthread_mutex_unlock(¬es->lock); | 224 | pthread_mutex_unlock(¬es->lock); |
225 | |||
226 | if (err == -ERANGE && !he->ms.map->erange_warned) | ||
227 | ui__warn_map_erange(he->ms.map, sym, ip); | ||
195 | } | 228 | } |
196 | 229 | ||
197 | static void perf_top__show_details(struct perf_top *top) | 230 | static void perf_top__show_details(struct perf_top *top) |
@@ -615,6 +648,7 @@ process_hotkey: | |||
615 | 648 | ||
616 | /* Tag samples to be skipped. */ | 649 | /* Tag samples to be skipped. */ |
617 | static const char *skip_symbols[] = { | 650 | static const char *skip_symbols[] = { |
651 | "intel_idle", | ||
618 | "default_idle", | 652 | "default_idle", |
619 | "native_safe_halt", | 653 | "native_safe_halt", |
620 | "cpu_idle", | 654 | "cpu_idle", |
diff --git a/tools/perf/perf.h b/tools/perf/perf.h index eec392e48067..89e3355ab173 100644 --- a/tools/perf/perf.h +++ b/tools/perf/perf.h | |||
@@ -10,6 +10,9 @@ void get_term_dimensions(struct winsize *ws); | |||
10 | #define rmb() asm volatile("lock; addl $0,0(%%esp)" ::: "memory") | 10 | #define rmb() asm volatile("lock; addl $0,0(%%esp)" ::: "memory") |
11 | #define cpu_relax() asm volatile("rep; nop" ::: "memory"); | 11 | #define cpu_relax() asm volatile("rep; nop" ::: "memory"); |
12 | #define CPUINFO_PROC "model name" | 12 | #define CPUINFO_PROC "model name" |
13 | #ifndef __NR_perf_event_open | ||
14 | # define __NR_perf_event_open 336 | ||
15 | #endif | ||
13 | #endif | 16 | #endif |
14 | 17 | ||
15 | #if defined(__x86_64__) | 18 | #if defined(__x86_64__) |
@@ -17,6 +20,9 @@ void get_term_dimensions(struct winsize *ws); | |||
17 | #define rmb() asm volatile("lfence" ::: "memory") | 20 | #define rmb() asm volatile("lfence" ::: "memory") |
18 | #define cpu_relax() asm volatile("rep; nop" ::: "memory"); | 21 | #define cpu_relax() asm volatile("rep; nop" ::: "memory"); |
19 | #define CPUINFO_PROC "model name" | 22 | #define CPUINFO_PROC "model name" |
23 | #ifndef __NR_perf_event_open | ||
24 | # define __NR_perf_event_open 298 | ||
25 | #endif | ||
20 | #endif | 26 | #endif |
21 | 27 | ||
22 | #ifdef __powerpc__ | 28 | #ifdef __powerpc__ |
diff --git a/tools/perf/util/ui/browser.c b/tools/perf/ui/browser.c index 556829124b02..a1b140cf75ac 100644 --- a/tools/perf/util/ui/browser.c +++ b/tools/perf/ui/browser.c | |||
@@ -27,9 +27,12 @@ static int ui_browser__percent_color(struct ui_browser *browser, | |||
27 | return HE_COLORSET_NORMAL; | 27 | return HE_COLORSET_NORMAL; |
28 | } | 28 | } |
29 | 29 | ||
30 | void ui_browser__set_color(struct ui_browser *self __used, int color) | 30 | int ui_browser__set_color(struct ui_browser *browser, int color) |
31 | { | 31 | { |
32 | int ret = browser->current_color; | ||
33 | browser->current_color = color; | ||
32 | SLsmg_set_color(color); | 34 | SLsmg_set_color(color); |
35 | return ret; | ||
33 | } | 36 | } |
34 | 37 | ||
35 | void ui_browser__set_percent_color(struct ui_browser *self, | 38 | void ui_browser__set_percent_color(struct ui_browser *self, |
@@ -503,6 +506,12 @@ static struct ui_browser__colorset { | |||
503 | .bg = "default", | 506 | .bg = "default", |
504 | }, | 507 | }, |
505 | { | 508 | { |
509 | .colorset = HE_COLORSET_ADDR, | ||
510 | .name = "addr", | ||
511 | .fg = "magenta", | ||
512 | .bg = "default", | ||
513 | }, | ||
514 | { | ||
506 | .name = NULL, | 515 | .name = NULL, |
507 | } | 516 | } |
508 | }; | 517 | }; |
diff --git a/tools/perf/util/ui/browser.h b/tools/perf/ui/browser.h index 6ee82f60feaf..2550277db9f9 100644 --- a/tools/perf/util/ui/browser.h +++ b/tools/perf/ui/browser.h | |||
@@ -10,11 +10,13 @@ | |||
10 | #define HE_COLORSET_NORMAL 52 | 10 | #define HE_COLORSET_NORMAL 52 |
11 | #define HE_COLORSET_SELECTED 53 | 11 | #define HE_COLORSET_SELECTED 53 |
12 | #define HE_COLORSET_CODE 54 | 12 | #define HE_COLORSET_CODE 54 |
13 | #define HE_COLORSET_ADDR 55 | ||
13 | 14 | ||
14 | struct ui_browser { | 15 | struct ui_browser { |
15 | u64 index, top_idx; | 16 | u64 index, top_idx; |
16 | void *top, *entries; | 17 | void *top, *entries; |
17 | u16 y, x, width, height; | 18 | u16 y, x, width, height; |
19 | int current_color; | ||
18 | void *priv; | 20 | void *priv; |
19 | const char *title; | 21 | const char *title; |
20 | char *helpline; | 22 | char *helpline; |
@@ -27,7 +29,7 @@ struct ui_browser { | |||
27 | bool use_navkeypressed; | 29 | bool use_navkeypressed; |
28 | }; | 30 | }; |
29 | 31 | ||
30 | void ui_browser__set_color(struct ui_browser *self, int color); | 32 | int ui_browser__set_color(struct ui_browser *browser, int color); |
31 | void ui_browser__set_percent_color(struct ui_browser *self, | 33 | void ui_browser__set_percent_color(struct ui_browser *self, |
32 | double percent, bool current); | 34 | double percent, bool current); |
33 | bool ui_browser__is_current_entry(struct ui_browser *self, unsigned row); | 35 | bool ui_browser__is_current_entry(struct ui_browser *self, unsigned row); |
diff --git a/tools/perf/util/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c index 57a4c6ef3fd2..4db5186472b5 100644 --- a/tools/perf/util/ui/browsers/annotate.c +++ b/tools/perf/ui/browsers/annotate.c | |||
@@ -1,13 +1,13 @@ | |||
1 | #include "../../util.h" | 1 | #include "../../util/util.h" |
2 | #include "../browser.h" | 2 | #include "../browser.h" |
3 | #include "../helpline.h" | 3 | #include "../helpline.h" |
4 | #include "../libslang.h" | 4 | #include "../libslang.h" |
5 | #include "../ui.h" | 5 | #include "../ui.h" |
6 | #include "../util.h" | 6 | #include "../util.h" |
7 | #include "../../annotate.h" | 7 | #include "../../util/annotate.h" |
8 | #include "../../hist.h" | 8 | #include "../../util/hist.h" |
9 | #include "../../sort.h" | 9 | #include "../../util/sort.h" |
10 | #include "../../symbol.h" | 10 | #include "../../util/symbol.h" |
11 | #include <pthread.h> | 11 | #include <pthread.h> |
12 | #include <newt.h> | 12 | #include <newt.h> |
13 | 13 | ||
@@ -16,9 +16,13 @@ struct annotate_browser { | |||
16 | struct rb_root entries; | 16 | struct rb_root entries; |
17 | struct rb_node *curr_hot; | 17 | struct rb_node *curr_hot; |
18 | struct objdump_line *selection; | 18 | struct objdump_line *selection; |
19 | u64 start; | ||
19 | int nr_asm_entries; | 20 | int nr_asm_entries; |
20 | int nr_entries; | 21 | int nr_entries; |
21 | bool hide_src_code; | 22 | bool hide_src_code; |
23 | bool use_offset; | ||
24 | bool searching_backwards; | ||
25 | char search_bf[128]; | ||
22 | }; | 26 | }; |
23 | 27 | ||
24 | struct objdump_line_rb_node { | 28 | struct objdump_line_rb_node { |
@@ -51,6 +55,9 @@ static void annotate_browser__write(struct ui_browser *self, void *entry, int ro | |||
51 | struct annotate_browser *ab = container_of(self, struct annotate_browser, b); | 55 | struct annotate_browser *ab = container_of(self, struct annotate_browser, b); |
52 | struct objdump_line *ol = list_entry(entry, struct objdump_line, node); | 56 | struct objdump_line *ol = list_entry(entry, struct objdump_line, node); |
53 | bool current_entry = ui_browser__is_current_entry(self, row); | 57 | bool current_entry = ui_browser__is_current_entry(self, row); |
58 | bool change_color = (!ab->hide_src_code && | ||
59 | (!current_entry || (self->use_navkeypressed && | ||
60 | !self->navkeypressed))); | ||
54 | int width = self->width; | 61 | int width = self->width; |
55 | 62 | ||
56 | if (ol->offset != -1) { | 63 | if (ol->offset != -1) { |
@@ -69,15 +76,29 @@ static void annotate_browser__write(struct ui_browser *self, void *entry, int ro | |||
69 | if (!self->navkeypressed) | 76 | if (!self->navkeypressed) |
70 | width += 1; | 77 | width += 1; |
71 | 78 | ||
72 | if (!ab->hide_src_code && ol->offset != -1) | 79 | if (ol->offset != -1 && change_color) |
73 | if (!current_entry || (self->use_navkeypressed && | 80 | ui_browser__set_color(self, HE_COLORSET_CODE); |
74 | !self->navkeypressed)) | ||
75 | ui_browser__set_color(self, HE_COLORSET_CODE); | ||
76 | 81 | ||
77 | if (!*ol->line) | 82 | if (!*ol->line) |
78 | slsmg_write_nstring(" ", width - 18); | 83 | slsmg_write_nstring(" ", width - 18); |
79 | else | 84 | else if (ol->offset == -1) |
80 | slsmg_write_nstring(ol->line, width - 18); | 85 | slsmg_write_nstring(ol->line, width - 18); |
86 | else { | ||
87 | char bf[64]; | ||
88 | u64 addr = ol->offset; | ||
89 | int printed, color = -1; | ||
90 | |||
91 | if (!ab->use_offset) | ||
92 | addr += ab->start; | ||
93 | |||
94 | printed = scnprintf(bf, sizeof(bf), " %" PRIx64 ":", addr); | ||
95 | if (change_color) | ||
96 | color = ui_browser__set_color(self, HE_COLORSET_ADDR); | ||
97 | slsmg_write_nstring(bf, printed); | ||
98 | if (change_color) | ||
99 | ui_browser__set_color(self, color); | ||
100 | slsmg_write_nstring(ol->line, width - 18 - printed); | ||
101 | } | ||
81 | 102 | ||
82 | if (current_entry) | 103 | if (current_entry) |
83 | ab->selection = ol; | 104 | ab->selection = ol; |
@@ -138,27 +159,38 @@ static void objdump__insert_line(struct rb_root *self, | |||
138 | } | 159 | } |
139 | 160 | ||
140 | static void annotate_browser__set_top(struct annotate_browser *self, | 161 | static void annotate_browser__set_top(struct annotate_browser *self, |
141 | struct rb_node *nd) | 162 | struct objdump_line *pos, u32 idx) |
142 | { | 163 | { |
143 | struct objdump_line_rb_node *rbpos; | ||
144 | struct objdump_line *pos; | ||
145 | unsigned back; | 164 | unsigned back; |
146 | 165 | ||
147 | ui_browser__refresh_dimensions(&self->b); | 166 | ui_browser__refresh_dimensions(&self->b); |
148 | back = self->b.height / 2; | 167 | back = self->b.height / 2; |
149 | rbpos = rb_entry(nd, struct objdump_line_rb_node, rb_node); | 168 | self->b.top_idx = self->b.index = idx; |
150 | pos = ((struct objdump_line *)rbpos) - 1; | ||
151 | self->b.top_idx = self->b.index = rbpos->idx; | ||
152 | 169 | ||
153 | while (self->b.top_idx != 0 && back != 0) { | 170 | while (self->b.top_idx != 0 && back != 0) { |
154 | pos = list_entry(pos->node.prev, struct objdump_line, node); | 171 | pos = list_entry(pos->node.prev, struct objdump_line, node); |
155 | 172 | ||
173 | if (objdump_line__filter(&self->b, &pos->node)) | ||
174 | continue; | ||
175 | |||
156 | --self->b.top_idx; | 176 | --self->b.top_idx; |
157 | --back; | 177 | --back; |
158 | } | 178 | } |
159 | 179 | ||
160 | self->b.top = pos; | 180 | self->b.top = pos; |
161 | self->curr_hot = nd; | 181 | self->b.navkeypressed = true; |
182 | } | ||
183 | |||
184 | static void annotate_browser__set_rb_top(struct annotate_browser *browser, | ||
185 | struct rb_node *nd) | ||
186 | { | ||
187 | struct objdump_line_rb_node *rbpos; | ||
188 | struct objdump_line *pos; | ||
189 | |||
190 | rbpos = rb_entry(nd, struct objdump_line_rb_node, rb_node); | ||
191 | pos = ((struct objdump_line *)rbpos) - 1; | ||
192 | annotate_browser__set_top(browser, pos, rbpos->idx); | ||
193 | browser->curr_hot = nd; | ||
162 | } | 194 | } |
163 | 195 | ||
164 | static void annotate_browser__calc_percent(struct annotate_browser *browser, | 196 | static void annotate_browser__calc_percent(struct annotate_browser *browser, |
@@ -226,6 +258,231 @@ static bool annotate_browser__toggle_source(struct annotate_browser *browser) | |||
226 | return true; | 258 | return true; |
227 | } | 259 | } |
228 | 260 | ||
261 | static bool annotate_browser__callq(struct annotate_browser *browser, | ||
262 | int evidx, void (*timer)(void *arg), | ||
263 | void *arg, int delay_secs) | ||
264 | { | ||
265 | struct map_symbol *ms = browser->b.priv; | ||
266 | struct symbol *sym = ms->sym; | ||
267 | struct annotation *notes; | ||
268 | struct symbol *target; | ||
269 | char *s = strstr(browser->selection->line, "callq "); | ||
270 | u64 ip; | ||
271 | |||
272 | if (s == NULL) | ||
273 | return false; | ||
274 | |||
275 | s = strchr(s, ' '); | ||
276 | if (s++ == NULL) { | ||
277 | ui_helpline__puts("Invallid callq instruction."); | ||
278 | return true; | ||
279 | } | ||
280 | |||
281 | ip = strtoull(s, NULL, 16); | ||
282 | ip = ms->map->map_ip(ms->map, ip); | ||
283 | target = map__find_symbol(ms->map, ip, NULL); | ||
284 | if (target == NULL) { | ||
285 | ui_helpline__puts("The called function was not found."); | ||
286 | return true; | ||
287 | } | ||
288 | |||
289 | notes = symbol__annotation(target); | ||
290 | pthread_mutex_lock(¬es->lock); | ||
291 | |||
292 | if (notes->src == NULL && symbol__alloc_hist(target) < 0) { | ||
293 | pthread_mutex_unlock(¬es->lock); | ||
294 | ui__warning("Not enough memory for annotating '%s' symbol!\n", | ||
295 | target->name); | ||
296 | return true; | ||
297 | } | ||
298 | |||
299 | pthread_mutex_unlock(¬es->lock); | ||
300 | symbol__tui_annotate(target, ms->map, evidx, timer, arg, delay_secs); | ||
301 | ui_browser__show_title(&browser->b, sym->name); | ||
302 | return true; | ||
303 | } | ||
304 | |||
305 | static struct objdump_line * | ||
306 | annotate_browser__find_offset(struct annotate_browser *browser, | ||
307 | s64 offset, s64 *idx) | ||
308 | { | ||
309 | struct map_symbol *ms = browser->b.priv; | ||
310 | struct symbol *sym = ms->sym; | ||
311 | struct annotation *notes = symbol__annotation(sym); | ||
312 | struct objdump_line *pos; | ||
313 | |||
314 | *idx = 0; | ||
315 | list_for_each_entry(pos, ¬es->src->source, node) { | ||
316 | if (pos->offset == offset) | ||
317 | return pos; | ||
318 | if (!objdump_line__filter(&browser->b, &pos->node)) | ||
319 | ++*idx; | ||
320 | } | ||
321 | |||
322 | return NULL; | ||
323 | } | ||
324 | |||
325 | static bool annotate_browser__jump(struct annotate_browser *browser) | ||
326 | { | ||
327 | const char *jumps[] = { "je ", "jne ", "ja ", "jmpq ", "js ", "jmp ", NULL }; | ||
328 | struct objdump_line *line; | ||
329 | s64 idx, offset; | ||
330 | char *s = NULL; | ||
331 | int i = 0; | ||
332 | |||
333 | while (jumps[i]) { | ||
334 | s = strstr(browser->selection->line, jumps[i++]); | ||
335 | if (s) | ||
336 | break; | ||
337 | } | ||
338 | |||
339 | if (s == NULL) | ||
340 | return false; | ||
341 | |||
342 | s = strchr(s, '+'); | ||
343 | if (s++ == NULL) { | ||
344 | ui_helpline__puts("Invallid jump instruction."); | ||
345 | return true; | ||
346 | } | ||
347 | |||
348 | offset = strtoll(s, NULL, 16); | ||
349 | line = annotate_browser__find_offset(browser, offset, &idx); | ||
350 | if (line == NULL) { | ||
351 | ui_helpline__puts("Invallid jump offset"); | ||
352 | return true; | ||
353 | } | ||
354 | |||
355 | annotate_browser__set_top(browser, line, idx); | ||
356 | |||
357 | return true; | ||
358 | } | ||
359 | |||
360 | static struct objdump_line * | ||
361 | annotate_browser__find_string(struct annotate_browser *browser, | ||
362 | char *s, s64 *idx) | ||
363 | { | ||
364 | struct map_symbol *ms = browser->b.priv; | ||
365 | struct symbol *sym = ms->sym; | ||
366 | struct annotation *notes = symbol__annotation(sym); | ||
367 | struct objdump_line *pos = browser->selection; | ||
368 | |||
369 | *idx = browser->b.index; | ||
370 | list_for_each_entry_continue(pos, ¬es->src->source, node) { | ||
371 | if (objdump_line__filter(&browser->b, &pos->node)) | ||
372 | continue; | ||
373 | |||
374 | ++*idx; | ||
375 | |||
376 | if (pos->line && strstr(pos->line, s) != NULL) | ||
377 | return pos; | ||
378 | } | ||
379 | |||
380 | return NULL; | ||
381 | } | ||
382 | |||
383 | static bool __annotate_browser__search(struct annotate_browser *browser) | ||
384 | { | ||
385 | struct objdump_line *line; | ||
386 | s64 idx; | ||
387 | |||
388 | line = annotate_browser__find_string(browser, browser->search_bf, &idx); | ||
389 | if (line == NULL) { | ||
390 | ui_helpline__puts("String not found!"); | ||
391 | return false; | ||
392 | } | ||
393 | |||
394 | annotate_browser__set_top(browser, line, idx); | ||
395 | browser->searching_backwards = false; | ||
396 | return true; | ||
397 | } | ||
398 | |||
399 | static struct objdump_line * | ||
400 | annotate_browser__find_string_reverse(struct annotate_browser *browser, | ||
401 | char *s, s64 *idx) | ||
402 | { | ||
403 | struct map_symbol *ms = browser->b.priv; | ||
404 | struct symbol *sym = ms->sym; | ||
405 | struct annotation *notes = symbol__annotation(sym); | ||
406 | struct objdump_line *pos = browser->selection; | ||
407 | |||
408 | *idx = browser->b.index; | ||
409 | list_for_each_entry_continue_reverse(pos, ¬es->src->source, node) { | ||
410 | if (objdump_line__filter(&browser->b, &pos->node)) | ||
411 | continue; | ||
412 | |||
413 | --*idx; | ||
414 | |||
415 | if (pos->line && strstr(pos->line, s) != NULL) | ||
416 | return pos; | ||
417 | } | ||
418 | |||
419 | return NULL; | ||
420 | } | ||
421 | |||
422 | static bool __annotate_browser__search_reverse(struct annotate_browser *browser) | ||
423 | { | ||
424 | struct objdump_line *line; | ||
425 | s64 idx; | ||
426 | |||
427 | line = annotate_browser__find_string_reverse(browser, browser->search_bf, &idx); | ||
428 | if (line == NULL) { | ||
429 | ui_helpline__puts("String not found!"); | ||
430 | return false; | ||
431 | } | ||
432 | |||
433 | annotate_browser__set_top(browser, line, idx); | ||
434 | browser->searching_backwards = true; | ||
435 | return true; | ||
436 | } | ||
437 | |||
438 | static bool annotate_browser__search_window(struct annotate_browser *browser, | ||
439 | int delay_secs) | ||
440 | { | ||
441 | if (ui_browser__input_window("Search", "String: ", browser->search_bf, | ||
442 | "ENTER: OK, ESC: Cancel", | ||
443 | delay_secs * 2) != K_ENTER || | ||
444 | !*browser->search_bf) | ||
445 | return false; | ||
446 | |||
447 | return true; | ||
448 | } | ||
449 | |||
450 | static bool annotate_browser__search(struct annotate_browser *browser, int delay_secs) | ||
451 | { | ||
452 | if (annotate_browser__search_window(browser, delay_secs)) | ||
453 | return __annotate_browser__search(browser); | ||
454 | |||
455 | return false; | ||
456 | } | ||
457 | |||
458 | static bool annotate_browser__continue_search(struct annotate_browser *browser, | ||
459 | int delay_secs) | ||
460 | { | ||
461 | if (!*browser->search_bf) | ||
462 | return annotate_browser__search(browser, delay_secs); | ||
463 | |||
464 | return __annotate_browser__search(browser); | ||
465 | } | ||
466 | |||
467 | static bool annotate_browser__search_reverse(struct annotate_browser *browser, | ||
468 | int delay_secs) | ||
469 | { | ||
470 | if (annotate_browser__search_window(browser, delay_secs)) | ||
471 | return __annotate_browser__search_reverse(browser); | ||
472 | |||
473 | return false; | ||
474 | } | ||
475 | |||
476 | static | ||
477 | bool annotate_browser__continue_search_reverse(struct annotate_browser *browser, | ||
478 | int delay_secs) | ||
479 | { | ||
480 | if (!*browser->search_bf) | ||
481 | return annotate_browser__search_reverse(browser, delay_secs); | ||
482 | |||
483 | return __annotate_browser__search_reverse(browser); | ||
484 | } | ||
485 | |||
229 | static int annotate_browser__run(struct annotate_browser *self, int evidx, | 486 | static int annotate_browser__run(struct annotate_browser *self, int evidx, |
230 | void(*timer)(void *arg), | 487 | void(*timer)(void *arg), |
231 | void *arg, int delay_secs) | 488 | void *arg, int delay_secs) |
@@ -235,6 +492,7 @@ static int annotate_browser__run(struct annotate_browser *self, int evidx, | |||
235 | struct symbol *sym = ms->sym; | 492 | struct symbol *sym = ms->sym; |
236 | const char *help = "<-/ESC: Exit, TAB/shift+TAB: Cycle hot lines, " | 493 | const char *help = "<-/ESC: Exit, TAB/shift+TAB: Cycle hot lines, " |
237 | "H: Go to hottest line, ->/ENTER: Line action, " | 494 | "H: Go to hottest line, ->/ENTER: Line action, " |
495 | "O: Toggle offset view, " | ||
238 | "S: Toggle source code view"; | 496 | "S: Toggle source code view"; |
239 | int key; | 497 | int key; |
240 | 498 | ||
@@ -243,8 +501,10 @@ static int annotate_browser__run(struct annotate_browser *self, int evidx, | |||
243 | 501 | ||
244 | annotate_browser__calc_percent(self, evidx); | 502 | annotate_browser__calc_percent(self, evidx); |
245 | 503 | ||
246 | if (self->curr_hot) | 504 | if (self->curr_hot) { |
247 | annotate_browser__set_top(self, self->curr_hot); | 505 | annotate_browser__set_rb_top(self, self->curr_hot); |
506 | self->b.navkeypressed = false; | ||
507 | } | ||
248 | 508 | ||
249 | nd = self->curr_hot; | 509 | nd = self->curr_hot; |
250 | 510 | ||
@@ -295,56 +555,35 @@ static int annotate_browser__run(struct annotate_browser *self, int evidx, | |||
295 | if (annotate_browser__toggle_source(self)) | 555 | if (annotate_browser__toggle_source(self)) |
296 | ui_helpline__puts(help); | 556 | ui_helpline__puts(help); |
297 | continue; | 557 | continue; |
558 | case 'O': | ||
559 | case 'o': | ||
560 | self->use_offset = !self->use_offset; | ||
561 | continue; | ||
562 | case '/': | ||
563 | if (annotate_browser__search(self, delay_secs)) { | ||
564 | show_help: | ||
565 | ui_helpline__puts(help); | ||
566 | } | ||
567 | continue; | ||
568 | case 'n': | ||
569 | if (self->searching_backwards ? | ||
570 | annotate_browser__continue_search_reverse(self, delay_secs) : | ||
571 | annotate_browser__continue_search(self, delay_secs)) | ||
572 | goto show_help; | ||
573 | continue; | ||
574 | case '?': | ||
575 | if (annotate_browser__search_reverse(self, delay_secs)) | ||
576 | goto show_help; | ||
577 | continue; | ||
298 | case K_ENTER: | 578 | case K_ENTER: |
299 | case K_RIGHT: | 579 | case K_RIGHT: |
300 | if (self->selection == NULL) { | 580 | if (self->selection == NULL) |
301 | ui_helpline__puts("Huh? No selection. Report to linux-kernel@vger.kernel.org"); | 581 | ui_helpline__puts("Huh? No selection. Report to linux-kernel@vger.kernel.org"); |
302 | continue; | 582 | else if (self->selection->offset == -1) |
303 | } | ||
304 | |||
305 | if (self->selection->offset == -1) { | ||
306 | ui_helpline__puts("Actions are only available for assembly lines."); | 583 | ui_helpline__puts("Actions are only available for assembly lines."); |
307 | continue; | 584 | else if (!(annotate_browser__jump(self) || |
308 | } else { | 585 | annotate_browser__callq(self, evidx, timer, arg, delay_secs))) |
309 | char *s = strstr(self->selection->line, "callq "); | 586 | ui_helpline__puts("Actions are only available for the 'callq' and jump instructions."); |
310 | struct annotation *notes; | ||
311 | struct symbol *target; | ||
312 | u64 ip; | ||
313 | |||
314 | if (s == NULL) { | ||
315 | ui_helpline__puts("Actions are only available for the 'callq' instruction."); | ||
316 | continue; | ||
317 | } | ||
318 | |||
319 | s = strchr(s, ' '); | ||
320 | if (s++ == NULL) { | ||
321 | ui_helpline__puts("Invallid callq instruction."); | ||
322 | continue; | ||
323 | } | ||
324 | |||
325 | ip = strtoull(s, NULL, 16); | ||
326 | ip = ms->map->map_ip(ms->map, ip); | ||
327 | target = map__find_symbol(ms->map, ip, NULL); | ||
328 | if (target == NULL) { | ||
329 | ui_helpline__puts("The called function was not found."); | ||
330 | continue; | ||
331 | } | ||
332 | |||
333 | notes = symbol__annotation(target); | ||
334 | pthread_mutex_lock(¬es->lock); | ||
335 | |||
336 | if (notes->src == NULL && symbol__alloc_hist(target) < 0) { | ||
337 | pthread_mutex_unlock(¬es->lock); | ||
338 | ui__warning("Not enough memory for annotating '%s' symbol!\n", | ||
339 | target->name); | ||
340 | continue; | ||
341 | } | ||
342 | |||
343 | pthread_mutex_unlock(¬es->lock); | ||
344 | symbol__tui_annotate(target, ms->map, evidx, | ||
345 | timer, arg, delay_secs); | ||
346 | ui_browser__show_title(&self->b, sym->name); | ||
347 | } | ||
348 | continue; | 587 | continue; |
349 | case K_LEFT: | 588 | case K_LEFT: |
350 | case K_ESC: | 589 | case K_ESC: |
@@ -356,7 +595,7 @@ static int annotate_browser__run(struct annotate_browser *self, int evidx, | |||
356 | } | 595 | } |
357 | 596 | ||
358 | if (nd != NULL) | 597 | if (nd != NULL) |
359 | annotate_browser__set_top(self, nd); | 598 | annotate_browser__set_rb_top(self, nd); |
360 | } | 599 | } |
361 | out: | 600 | out: |
362 | ui_browser__hide(&self->b); | 601 | ui_browser__hide(&self->b); |
@@ -406,6 +645,7 @@ int symbol__tui_annotate(struct symbol *sym, struct map *map, int evidx, | |||
406 | ui_helpline__push("Press <- or ESC to exit"); | 645 | ui_helpline__push("Press <- or ESC to exit"); |
407 | 646 | ||
408 | notes = symbol__annotation(sym); | 647 | notes = symbol__annotation(sym); |
648 | browser.start = map__rip_2objdump(map, sym->start); | ||
409 | 649 | ||
410 | list_for_each_entry(pos, ¬es->src->source, node) { | 650 | list_for_each_entry(pos, ¬es->src->source, node) { |
411 | struct objdump_line_rb_node *rbpos; | 651 | struct objdump_line_rb_node *rbpos; |
diff --git a/tools/perf/util/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c index c4173c9733bb..466827e91b87 100644 --- a/tools/perf/util/ui/browsers/hists.c +++ b/tools/perf/ui/browsers/hists.c | |||
@@ -5,12 +5,12 @@ | |||
5 | #include <newt.h> | 5 | #include <newt.h> |
6 | #include <linux/rbtree.h> | 6 | #include <linux/rbtree.h> |
7 | 7 | ||
8 | #include "../../evsel.h" | 8 | #include "../../util/evsel.h" |
9 | #include "../../evlist.h" | 9 | #include "../../util/evlist.h" |
10 | #include "../../hist.h" | 10 | #include "../../util/hist.h" |
11 | #include "../../pstack.h" | 11 | #include "../../util/pstack.h" |
12 | #include "../../sort.h" | 12 | #include "../../util/sort.h" |
13 | #include "../../util.h" | 13 | #include "../../util/util.h" |
14 | 14 | ||
15 | #include "../browser.h" | 15 | #include "../browser.h" |
16 | #include "../helpline.h" | 16 | #include "../helpline.h" |
@@ -125,6 +125,9 @@ static int callchain__count_rows(struct rb_root *chain) | |||
125 | 125 | ||
126 | static bool map_symbol__toggle_fold(struct map_symbol *self) | 126 | static bool map_symbol__toggle_fold(struct map_symbol *self) |
127 | { | 127 | { |
128 | if (!self) | ||
129 | return false; | ||
130 | |||
128 | if (!self->has_children) | 131 | if (!self->has_children) |
129 | return false; | 132 | return false; |
130 | 133 | ||
@@ -837,21 +840,25 @@ static int hists__browser_title(struct hists *self, char *bf, size_t size, | |||
837 | int printed; | 840 | int printed; |
838 | const struct dso *dso = self->dso_filter; | 841 | const struct dso *dso = self->dso_filter; |
839 | const struct thread *thread = self->thread_filter; | 842 | const struct thread *thread = self->thread_filter; |
840 | unsigned long nr_events = self->stats.nr_events[PERF_RECORD_SAMPLE]; | 843 | unsigned long nr_samples = self->stats.nr_events[PERF_RECORD_SAMPLE]; |
844 | u64 nr_events = self->stats.total_period; | ||
845 | |||
846 | nr_samples = convert_unit(nr_samples, &unit); | ||
847 | printed = scnprintf(bf, size, | ||
848 | "Samples: %lu%c of event '%s', Event count (approx.): %lu", | ||
849 | nr_samples, unit, ev_name, nr_events); | ||
841 | 850 | ||
842 | nr_events = convert_unit(nr_events, &unit); | ||
843 | printed = snprintf(bf, size, "Events: %lu%c %s", nr_events, unit, ev_name); | ||
844 | 851 | ||
845 | if (self->uid_filter_str) | 852 | if (self->uid_filter_str) |
846 | printed += snprintf(bf + printed, size - printed, | 853 | printed += snprintf(bf + printed, size - printed, |
847 | ", UID: %s", self->uid_filter_str); | 854 | ", UID: %s", self->uid_filter_str); |
848 | if (thread) | 855 | if (thread) |
849 | printed += snprintf(bf + printed, size - printed, | 856 | printed += scnprintf(bf + printed, size - printed, |
850 | ", Thread: %s(%d)", | 857 | ", Thread: %s(%d)", |
851 | (thread->comm_set ? thread->comm : ""), | 858 | (thread->comm_set ? thread->comm : ""), |
852 | thread->pid); | 859 | thread->pid); |
853 | if (dso) | 860 | if (dso) |
854 | printed += snprintf(bf + printed, size - printed, | 861 | printed += scnprintf(bf + printed, size - printed, |
855 | ", DSO: %s", dso->short_name); | 862 | ", DSO: %s", dso->short_name); |
856 | return printed; | 863 | return printed; |
857 | } | 864 | } |
@@ -1174,7 +1181,7 @@ static void perf_evsel_menu__write(struct ui_browser *browser, | |||
1174 | HE_COLORSET_NORMAL); | 1181 | HE_COLORSET_NORMAL); |
1175 | 1182 | ||
1176 | nr_events = convert_unit(nr_events, &unit); | 1183 | nr_events = convert_unit(nr_events, &unit); |
1177 | printed = snprintf(bf, sizeof(bf), "%lu%c%s%s", nr_events, | 1184 | printed = scnprintf(bf, sizeof(bf), "%lu%c%s%s", nr_events, |
1178 | unit, unit == ' ' ? "" : " ", ev_name); | 1185 | unit, unit == ' ' ? "" : " ", ev_name); |
1179 | slsmg_printf("%s", bf); | 1186 | slsmg_printf("%s", bf); |
1180 | 1187 | ||
@@ -1184,8 +1191,8 @@ static void perf_evsel_menu__write(struct ui_browser *browser, | |||
1184 | if (!current_entry) | 1191 | if (!current_entry) |
1185 | ui_browser__set_color(browser, HE_COLORSET_TOP); | 1192 | ui_browser__set_color(browser, HE_COLORSET_TOP); |
1186 | nr_events = convert_unit(nr_events, &unit); | 1193 | nr_events = convert_unit(nr_events, &unit); |
1187 | snprintf(bf, sizeof(bf), ": %ld%c%schunks LOST!", nr_events, | 1194 | printed += scnprintf(bf, sizeof(bf), ": %ld%c%schunks LOST!", |
1188 | unit, unit == ' ' ? "" : " "); | 1195 | nr_events, unit, unit == ' ' ? "" : " "); |
1189 | warn = bf; | 1196 | warn = bf; |
1190 | } | 1197 | } |
1191 | 1198 | ||
diff --git a/tools/perf/util/ui/browsers/map.c b/tools/perf/ui/browsers/map.c index eca6575abfd0..98851d55a53e 100644 --- a/tools/perf/util/ui/browsers/map.c +++ b/tools/perf/ui/browsers/map.c | |||
@@ -5,9 +5,9 @@ | |||
5 | #include <sys/ttydefaults.h> | 5 | #include <sys/ttydefaults.h> |
6 | #include <string.h> | 6 | #include <string.h> |
7 | #include <linux/bitops.h> | 7 | #include <linux/bitops.h> |
8 | #include "../../util.h" | 8 | #include "../../util/util.h" |
9 | #include "../../debug.h" | 9 | #include "../../util/debug.h" |
10 | #include "../../symbol.h" | 10 | #include "../../util/symbol.h" |
11 | #include "../browser.h" | 11 | #include "../browser.h" |
12 | #include "../helpline.h" | 12 | #include "../helpline.h" |
13 | #include "map.h" | 13 | #include "map.h" |
diff --git a/tools/perf/util/ui/browsers/map.h b/tools/perf/ui/browsers/map.h index df8581a43e17..df8581a43e17 100644 --- a/tools/perf/util/ui/browsers/map.h +++ b/tools/perf/ui/browsers/map.h | |||
diff --git a/tools/perf/util/gtk/browser.c b/tools/perf/ui/gtk/browser.c index 258352a2356c..258352a2356c 100644 --- a/tools/perf/util/gtk/browser.c +++ b/tools/perf/ui/gtk/browser.c | |||
diff --git a/tools/perf/util/gtk/gtk.h b/tools/perf/ui/gtk/gtk.h index 75177ee04032..75177ee04032 100644 --- a/tools/perf/util/gtk/gtk.h +++ b/tools/perf/ui/gtk/gtk.h | |||
diff --git a/tools/perf/util/ui/helpline.c b/tools/perf/ui/helpline.c index 4f48f5901b30..2f950c2641c8 100644 --- a/tools/perf/util/ui/helpline.c +++ b/tools/perf/ui/helpline.c | |||
@@ -64,7 +64,7 @@ int ui_helpline__show_help(const char *format, va_list ap) | |||
64 | static int backlog; | 64 | static int backlog; |
65 | 65 | ||
66 | pthread_mutex_lock(&ui__lock); | 66 | pthread_mutex_lock(&ui__lock); |
67 | ret = vsnprintf(ui_helpline__last_msg + backlog, | 67 | ret = vscnprintf(ui_helpline__last_msg + backlog, |
68 | sizeof(ui_helpline__last_msg) - backlog, format, ap); | 68 | sizeof(ui_helpline__last_msg) - backlog, format, ap); |
69 | backlog += ret; | 69 | backlog += ret; |
70 | 70 | ||
diff --git a/tools/perf/util/ui/helpline.h b/tools/perf/ui/helpline.h index 7bab6b34e35e..7bab6b34e35e 100644 --- a/tools/perf/util/ui/helpline.h +++ b/tools/perf/ui/helpline.h | |||
diff --git a/tools/perf/util/ui/keysyms.h b/tools/perf/ui/keysyms.h index 809eca5707fa..809eca5707fa 100644 --- a/tools/perf/util/ui/keysyms.h +++ b/tools/perf/ui/keysyms.h | |||
diff --git a/tools/perf/util/ui/libslang.h b/tools/perf/ui/libslang.h index 4d54b6450f5b..4d54b6450f5b 100644 --- a/tools/perf/util/ui/libslang.h +++ b/tools/perf/ui/libslang.h | |||
diff --git a/tools/perf/util/ui/progress.c b/tools/perf/ui/progress.c index 13aa64e50e11..13aa64e50e11 100644 --- a/tools/perf/util/ui/progress.c +++ b/tools/perf/ui/progress.c | |||
diff --git a/tools/perf/util/ui/progress.h b/tools/perf/ui/progress.h index d9c205b59aa1..d9c205b59aa1 100644 --- a/tools/perf/util/ui/progress.h +++ b/tools/perf/ui/progress.h | |||
diff --git a/tools/perf/util/ui/setup.c b/tools/perf/ui/setup.c index 85a69faa09aa..85a69faa09aa 100644 --- a/tools/perf/util/ui/setup.c +++ b/tools/perf/ui/setup.c | |||
diff --git a/tools/perf/util/ui/ui.h b/tools/perf/ui/ui.h index 7b67045479f6..7b67045479f6 100644 --- a/tools/perf/util/ui/ui.h +++ b/tools/perf/ui/ui.h | |||
diff --git a/tools/perf/util/ui/util.c b/tools/perf/ui/util.c index ad4374a16bb0..ad4374a16bb0 100644 --- a/tools/perf/util/ui/util.c +++ b/tools/perf/ui/util.c | |||
diff --git a/tools/perf/util/ui/util.h b/tools/perf/ui/util.h index 2d1738bd71c8..2d1738bd71c8 100644 --- a/tools/perf/util/ui/util.h +++ b/tools/perf/ui/util.h | |||
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index e5a462f1d07c..1e7fd52bd29d 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c | |||
@@ -28,8 +28,8 @@ int symbol__annotate_init(struct map *map __used, struct symbol *sym) | |||
28 | int symbol__alloc_hist(struct symbol *sym) | 28 | int symbol__alloc_hist(struct symbol *sym) |
29 | { | 29 | { |
30 | struct annotation *notes = symbol__annotation(sym); | 30 | struct annotation *notes = symbol__annotation(sym); |
31 | size_t sizeof_sym_hist = (sizeof(struct sym_hist) + | 31 | const size_t size = sym->end - sym->start + 1; |
32 | (sym->end - sym->start) * sizeof(u64)); | 32 | size_t sizeof_sym_hist = (sizeof(struct sym_hist) + size * sizeof(u64)); |
33 | 33 | ||
34 | notes->src = zalloc(sizeof(*notes->src) + symbol_conf.nr_events * sizeof_sym_hist); | 34 | notes->src = zalloc(sizeof(*notes->src) + symbol_conf.nr_events * sizeof_sym_hist); |
35 | if (notes->src == NULL) | 35 | if (notes->src == NULL) |
@@ -64,8 +64,8 @@ int symbol__inc_addr_samples(struct symbol *sym, struct map *map, | |||
64 | 64 | ||
65 | pr_debug3("%s: addr=%#" PRIx64 "\n", __func__, map->unmap_ip(map, addr)); | 65 | pr_debug3("%s: addr=%#" PRIx64 "\n", __func__, map->unmap_ip(map, addr)); |
66 | 66 | ||
67 | if (addr >= sym->end) | 67 | if (addr < sym->start || addr > sym->end) |
68 | return 0; | 68 | return -ERANGE; |
69 | 69 | ||
70 | offset = addr - sym->start; | 70 | offset = addr - sym->start; |
71 | h = annotation__histogram(notes, evidx); | 71 | h = annotation__histogram(notes, evidx); |
@@ -84,10 +84,15 @@ static struct objdump_line *objdump_line__new(s64 offset, char *line, size_t pri | |||
84 | 84 | ||
85 | if (self != NULL) { | 85 | if (self != NULL) { |
86 | self->offset = offset; | 86 | self->offset = offset; |
87 | self->line = line; | 87 | self->line = strdup(line); |
88 | if (self->line == NULL) | ||
89 | goto out_delete; | ||
88 | } | 90 | } |
89 | 91 | ||
90 | return self; | 92 | return self; |
93 | out_delete: | ||
94 | free(self); | ||
95 | return NULL; | ||
91 | } | 96 | } |
92 | 97 | ||
93 | void objdump_line__free(struct objdump_line *self) | 98 | void objdump_line__free(struct objdump_line *self) |
@@ -112,7 +117,7 @@ struct objdump_line *objdump__get_next_ip_line(struct list_head *head, | |||
112 | } | 117 | } |
113 | 118 | ||
114 | static int objdump_line__print(struct objdump_line *oline, struct symbol *sym, | 119 | static int objdump_line__print(struct objdump_line *oline, struct symbol *sym, |
115 | int evidx, u64 len, int min_pcnt, | 120 | u64 start, int evidx, u64 len, int min_pcnt, |
116 | int printed, int max_lines, | 121 | int printed, int max_lines, |
117 | struct objdump_line *queue) | 122 | struct objdump_line *queue) |
118 | { | 123 | { |
@@ -128,6 +133,7 @@ static int objdump_line__print(struct objdump_line *oline, struct symbol *sym, | |||
128 | struct source_line *src_line = notes->src->lines; | 133 | struct source_line *src_line = notes->src->lines; |
129 | struct sym_hist *h = annotation__histogram(notes, evidx); | 134 | struct sym_hist *h = annotation__histogram(notes, evidx); |
130 | s64 offset = oline->offset; | 135 | s64 offset = oline->offset; |
136 | const u64 addr = start + offset; | ||
131 | struct objdump_line *next; | 137 | struct objdump_line *next; |
132 | 138 | ||
133 | next = objdump__get_next_ip_line(¬es->src->source, oline); | 139 | next = objdump__get_next_ip_line(¬es->src->source, oline); |
@@ -157,7 +163,7 @@ static int objdump_line__print(struct objdump_line *oline, struct symbol *sym, | |||
157 | list_for_each_entry_from(queue, ¬es->src->source, node) { | 163 | list_for_each_entry_from(queue, ¬es->src->source, node) { |
158 | if (queue == oline) | 164 | if (queue == oline) |
159 | break; | 165 | break; |
160 | objdump_line__print(queue, sym, evidx, len, | 166 | objdump_line__print(queue, sym, start, evidx, len, |
161 | 0, 0, 1, NULL); | 167 | 0, 0, 1, NULL); |
162 | } | 168 | } |
163 | } | 169 | } |
@@ -180,6 +186,7 @@ static int objdump_line__print(struct objdump_line *oline, struct symbol *sym, | |||
180 | 186 | ||
181 | color_fprintf(stdout, color, " %7.2f", percent); | 187 | color_fprintf(stdout, color, " %7.2f", percent); |
182 | printf(" : "); | 188 | printf(" : "); |
189 | color_fprintf(stdout, PERF_COLOR_MAGENTA, " %" PRIx64 ":", addr); | ||
183 | color_fprintf(stdout, PERF_COLOR_BLUE, "%s\n", oline->line); | 190 | color_fprintf(stdout, PERF_COLOR_BLUE, "%s\n", oline->line); |
184 | } else if (max_lines && printed >= max_lines) | 191 | } else if (max_lines && printed >= max_lines) |
185 | return 1; | 192 | return 1; |
@@ -201,7 +208,7 @@ static int symbol__parse_objdump_line(struct symbol *sym, struct map *map, | |||
201 | { | 208 | { |
202 | struct annotation *notes = symbol__annotation(sym); | 209 | struct annotation *notes = symbol__annotation(sym); |
203 | struct objdump_line *objdump_line; | 210 | struct objdump_line *objdump_line; |
204 | char *line = NULL, *tmp, *tmp2, *c; | 211 | char *line = NULL, *parsed_line, *tmp, *tmp2, *c; |
205 | size_t line_len; | 212 | size_t line_len; |
206 | s64 line_ip, offset = -1; | 213 | s64 line_ip, offset = -1; |
207 | 214 | ||
@@ -219,6 +226,7 @@ static int symbol__parse_objdump_line(struct symbol *sym, struct map *map, | |||
219 | *c = 0; | 226 | *c = 0; |
220 | 227 | ||
221 | line_ip = -1; | 228 | line_ip = -1; |
229 | parsed_line = line; | ||
222 | 230 | ||
223 | /* | 231 | /* |
224 | * Strip leading spaces: | 232 | * Strip leading spaces: |
@@ -246,13 +254,16 @@ static int symbol__parse_objdump_line(struct symbol *sym, struct map *map, | |||
246 | offset = line_ip - start; | 254 | offset = line_ip - start; |
247 | if (offset < 0 || (u64)line_ip > end) | 255 | if (offset < 0 || (u64)line_ip > end) |
248 | offset = -1; | 256 | offset = -1; |
257 | else | ||
258 | parsed_line = tmp2 + 1; | ||
249 | } | 259 | } |
250 | 260 | ||
251 | objdump_line = objdump_line__new(offset, line, privsize); | 261 | objdump_line = objdump_line__new(offset, parsed_line, privsize); |
252 | if (objdump_line == NULL) { | 262 | free(line); |
253 | free(line); | 263 | |
264 | if (objdump_line == NULL) | ||
254 | return -1; | 265 | return -1; |
255 | } | 266 | |
256 | objdump__add_line(¬es->src->source, objdump_line); | 267 | objdump__add_line(¬es->src->source, objdump_line); |
257 | 268 | ||
258 | return 0; | 269 | return 0; |
@@ -408,7 +419,7 @@ static int symbol__get_source_line(struct symbol *sym, struct map *map, | |||
408 | if (!notes->src->lines) | 419 | if (!notes->src->lines) |
409 | return -1; | 420 | return -1; |
410 | 421 | ||
411 | start = map->unmap_ip(map, sym->start); | 422 | start = map__rip_2objdump(map, sym->start); |
412 | 423 | ||
413 | for (i = 0; i < len; i++) { | 424 | for (i = 0; i < len; i++) { |
414 | char *path = NULL; | 425 | char *path = NULL; |
@@ -493,6 +504,7 @@ int symbol__annotate_printf(struct symbol *sym, struct map *map, int evidx, | |||
493 | const char *filename = dso->long_name, *d_filename; | 504 | const char *filename = dso->long_name, *d_filename; |
494 | struct annotation *notes = symbol__annotation(sym); | 505 | struct annotation *notes = symbol__annotation(sym); |
495 | struct objdump_line *pos, *queue = NULL; | 506 | struct objdump_line *pos, *queue = NULL; |
507 | u64 start = map__rip_2objdump(map, sym->start); | ||
496 | int printed = 2, queue_len = 0; | 508 | int printed = 2, queue_len = 0; |
497 | int more = 0; | 509 | int more = 0; |
498 | u64 len; | 510 | u64 len; |
@@ -516,8 +528,9 @@ int symbol__annotate_printf(struct symbol *sym, struct map *map, int evidx, | |||
516 | queue_len = 0; | 528 | queue_len = 0; |
517 | } | 529 | } |
518 | 530 | ||
519 | switch (objdump_line__print(pos, sym, evidx, len, min_pcnt, | 531 | switch (objdump_line__print(pos, sym, start, evidx, len, |
520 | printed, max_lines, queue)) { | 532 | min_pcnt, printed, max_lines, |
533 | queue)) { | ||
521 | case 0: | 534 | case 0: |
522 | ++printed; | 535 | ++printed; |
523 | if (context) { | 536 | if (context) { |
@@ -561,16 +574,12 @@ void symbol__annotate_decay_histogram(struct symbol *sym, int evidx) | |||
561 | { | 574 | { |
562 | struct annotation *notes = symbol__annotation(sym); | 575 | struct annotation *notes = symbol__annotation(sym); |
563 | struct sym_hist *h = annotation__histogram(notes, evidx); | 576 | struct sym_hist *h = annotation__histogram(notes, evidx); |
564 | struct objdump_line *pos; | 577 | int len = sym->end - sym->start, offset; |
565 | int len = sym->end - sym->start; | ||
566 | 578 | ||
567 | h->sum = 0; | 579 | h->sum = 0; |
568 | 580 | for (offset = 0; offset < len; ++offset) { | |
569 | list_for_each_entry(pos, ¬es->src->source, node) { | 581 | h->addr[offset] = h->addr[offset] * 7 / 8; |
570 | if (pos->offset != -1 && pos->offset < len) { | 582 | h->sum += h->addr[offset]; |
571 | h->addr[pos->offset] = h->addr[pos->offset] * 7 / 8; | ||
572 | h->sum += h->addr[pos->offset]; | ||
573 | } | ||
574 | } | 583 | } |
575 | } | 584 | } |
576 | 585 | ||
diff --git a/tools/perf/util/color.c b/tools/perf/util/color.c index 521c38a79190..11e46da17bbb 100644 --- a/tools/perf/util/color.c +++ b/tools/perf/util/color.c | |||
@@ -1,3 +1,4 @@ | |||
1 | #include <linux/kernel.h> | ||
1 | #include "cache.h" | 2 | #include "cache.h" |
2 | #include "color.h" | 3 | #include "color.h" |
3 | 4 | ||
@@ -182,12 +183,12 @@ static int __color_vsnprintf(char *bf, size_t size, const char *color, | |||
182 | } | 183 | } |
183 | 184 | ||
184 | if (perf_use_color_default && *color) | 185 | if (perf_use_color_default && *color) |
185 | r += snprintf(bf, size, "%s", color); | 186 | r += scnprintf(bf, size, "%s", color); |
186 | r += vsnprintf(bf + r, size - r, fmt, args); | 187 | r += vscnprintf(bf + r, size - r, fmt, args); |
187 | if (perf_use_color_default && *color) | 188 | if (perf_use_color_default && *color) |
188 | r += snprintf(bf + r, size - r, "%s", PERF_COLOR_RESET); | 189 | r += scnprintf(bf + r, size - r, "%s", PERF_COLOR_RESET); |
189 | if (trail) | 190 | if (trail) |
190 | r += snprintf(bf + r, size - r, "%s", trail); | 191 | r += scnprintf(bf + r, size - r, "%s", trail); |
191 | return r; | 192 | return r; |
192 | } | 193 | } |
193 | 194 | ||
diff --git a/tools/perf/util/debug.h b/tools/perf/util/debug.h index f2ce88d04f54..6bebe7f0a20c 100644 --- a/tools/perf/util/debug.h +++ b/tools/perf/util/debug.h | |||
@@ -26,7 +26,7 @@ static inline void ui_progress__update(u64 curr __used, u64 total __used, | |||
26 | #else | 26 | #else |
27 | extern char ui_helpline__last_msg[]; | 27 | extern char ui_helpline__last_msg[]; |
28 | int ui_helpline__show_help(const char *format, va_list ap); | 28 | int ui_helpline__show_help(const char *format, va_list ap); |
29 | #include "ui/progress.h" | 29 | #include "../ui/progress.h" |
30 | int ui__error(const char *format, ...) __attribute__((format(printf, 1, 2))); | 30 | int ui__error(const char *format, ...) __attribute__((format(printf, 1, 2))); |
31 | #endif | 31 | #endif |
32 | 32 | ||
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index 0221700075c5..8c13dbcb84b9 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c | |||
@@ -34,7 +34,7 @@ int __perf_evsel__sample_size(u64 sample_type) | |||
34 | return size; | 34 | return size; |
35 | } | 35 | } |
36 | 36 | ||
37 | static void hists__init(struct hists *hists) | 37 | void hists__init(struct hists *hists) |
38 | { | 38 | { |
39 | memset(hists, 0, sizeof(*hists)); | 39 | memset(hists, 0, sizeof(*hists)); |
40 | hists->entries_in_array[0] = hists->entries_in_array[1] = RB_ROOT; | 40 | hists->entries_in_array[0] = hists->entries_in_array[1] = RB_ROOT; |
@@ -580,6 +580,8 @@ int perf_event__parse_sample(const union perf_event *event, u64 type, | |||
580 | return -EFAULT; | 580 | return -EFAULT; |
581 | 581 | ||
582 | data->raw_data = (void *) pdata; | 582 | data->raw_data = (void *) pdata; |
583 | |||
584 | array = (void *)array + data->raw_size + sizeof(u32); | ||
583 | } | 585 | } |
584 | 586 | ||
585 | if (type & PERF_SAMPLE_BRANCH_STACK) { | 587 | if (type & PERF_SAMPLE_BRANCH_STACK) { |
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h index 3158ca3d69a1..3d6b3e4cb66b 100644 --- a/tools/perf/util/evsel.h +++ b/tools/perf/util/evsel.h | |||
@@ -170,4 +170,6 @@ static inline int perf_evsel__sample_size(struct perf_evsel *evsel) | |||
170 | return __perf_evsel__sample_size(evsel->attr.sample_type); | 170 | return __perf_evsel__sample_size(evsel->attr.sample_type); |
171 | } | 171 | } |
172 | 172 | ||
173 | void hists__init(struct hists *hists); | ||
174 | |||
173 | #endif /* __PERF_EVSEL_H */ | 175 | #endif /* __PERF_EVSEL_H */ |
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index 0d9b6da86a39..4c7c2d73251f 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c | |||
@@ -291,7 +291,7 @@ int build_id_cache__add_s(const char *sbuild_id, const char *debugdir, | |||
291 | if (realname == NULL || filename == NULL || linkname == NULL) | 291 | if (realname == NULL || filename == NULL || linkname == NULL) |
292 | goto out_free; | 292 | goto out_free; |
293 | 293 | ||
294 | len = snprintf(filename, size, "%s%s%s", | 294 | len = scnprintf(filename, size, "%s%s%s", |
295 | debugdir, is_kallsyms ? "/" : "", realname); | 295 | debugdir, is_kallsyms ? "/" : "", realname); |
296 | if (mkdir_p(filename, 0755)) | 296 | if (mkdir_p(filename, 0755)) |
297 | goto out_free; | 297 | goto out_free; |
@@ -306,7 +306,7 @@ int build_id_cache__add_s(const char *sbuild_id, const char *debugdir, | |||
306 | goto out_free; | 306 | goto out_free; |
307 | } | 307 | } |
308 | 308 | ||
309 | len = snprintf(linkname, size, "%s/.build-id/%.2s", | 309 | len = scnprintf(linkname, size, "%s/.build-id/%.2s", |
310 | debugdir, sbuild_id); | 310 | debugdir, sbuild_id); |
311 | 311 | ||
312 | if (access(linkname, X_OK) && mkdir_p(linkname, 0755)) | 312 | if (access(linkname, X_OK) && mkdir_p(linkname, 0755)) |
@@ -1177,7 +1177,7 @@ static void print_event_desc(struct perf_header *ph, int fd, FILE *fp) | |||
1177 | goto error; | 1177 | goto error; |
1178 | 1178 | ||
1179 | msz = sizeof(attr); | 1179 | msz = sizeof(attr); |
1180 | if (sz < (ssize_t)msz) | 1180 | if (sz < msz) |
1181 | msz = sz; | 1181 | msz = sz; |
1182 | 1182 | ||
1183 | for (i = 0 ; i < nre; i++) { | 1183 | for (i = 0 ; i < nre; i++) { |
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index 2c624ad371a7..9f6d630d5316 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c | |||
@@ -256,6 +256,18 @@ static struct hist_entry *add_hist_entry(struct hists *hists, | |||
256 | if (!cmp) { | 256 | if (!cmp) { |
257 | he->period += period; | 257 | he->period += period; |
258 | ++he->nr_events; | 258 | ++he->nr_events; |
259 | |||
260 | /* If the map of an existing hist_entry has | ||
261 | * become out-of-date due to an exec() or | ||
262 | * similar, update it. Otherwise we will | ||
263 | * mis-adjust symbol addresses when computing | ||
264 | * the history counter to increment. | ||
265 | */ | ||
266 | if (he->ms.map != entry->ms.map) { | ||
267 | he->ms.map = entry->ms.map; | ||
268 | if (he->ms.map) | ||
269 | he->ms.map->referenced = true; | ||
270 | } | ||
259 | goto out; | 271 | goto out; |
260 | } | 272 | } |
261 | 273 | ||
@@ -607,7 +619,7 @@ static void init_rem_hits(void) | |||
607 | rem_hits.ms.sym = rem_sq_bracket; | 619 | rem_hits.ms.sym = rem_sq_bracket; |
608 | } | 620 | } |
609 | 621 | ||
610 | static size_t __callchain__fprintf_graph(FILE *fp, struct callchain_node *self, | 622 | static size_t __callchain__fprintf_graph(FILE *fp, struct rb_root *root, |
611 | u64 total_samples, int depth, | 623 | u64 total_samples, int depth, |
612 | int depth_mask, int left_margin) | 624 | int depth_mask, int left_margin) |
613 | { | 625 | { |
@@ -615,21 +627,16 @@ static size_t __callchain__fprintf_graph(FILE *fp, struct callchain_node *self, | |||
615 | struct callchain_node *child; | 627 | struct callchain_node *child; |
616 | struct callchain_list *chain; | 628 | struct callchain_list *chain; |
617 | int new_depth_mask = depth_mask; | 629 | int new_depth_mask = depth_mask; |
618 | u64 new_total; | ||
619 | u64 remaining; | 630 | u64 remaining; |
620 | size_t ret = 0; | 631 | size_t ret = 0; |
621 | int i; | 632 | int i; |
622 | uint entries_printed = 0; | 633 | uint entries_printed = 0; |
623 | 634 | ||
624 | if (callchain_param.mode == CHAIN_GRAPH_REL) | 635 | remaining = total_samples; |
625 | new_total = self->children_hit; | ||
626 | else | ||
627 | new_total = total_samples; | ||
628 | |||
629 | remaining = new_total; | ||
630 | 636 | ||
631 | node = rb_first(&self->rb_root); | 637 | node = rb_first(root); |
632 | while (node) { | 638 | while (node) { |
639 | u64 new_total; | ||
633 | u64 cumul; | 640 | u64 cumul; |
634 | 641 | ||
635 | child = rb_entry(node, struct callchain_node, rb_node); | 642 | child = rb_entry(node, struct callchain_node, rb_node); |
@@ -657,11 +664,17 @@ static size_t __callchain__fprintf_graph(FILE *fp, struct callchain_node *self, | |||
657 | list_for_each_entry(chain, &child->val, list) { | 664 | list_for_each_entry(chain, &child->val, list) { |
658 | ret += ipchain__fprintf_graph(fp, chain, depth, | 665 | ret += ipchain__fprintf_graph(fp, chain, depth, |
659 | new_depth_mask, i++, | 666 | new_depth_mask, i++, |
660 | new_total, | 667 | total_samples, |
661 | cumul, | 668 | cumul, |
662 | left_margin); | 669 | left_margin); |
663 | } | 670 | } |
664 | ret += __callchain__fprintf_graph(fp, child, new_total, | 671 | |
672 | if (callchain_param.mode == CHAIN_GRAPH_REL) | ||
673 | new_total = child->children_hit; | ||
674 | else | ||
675 | new_total = total_samples; | ||
676 | |||
677 | ret += __callchain__fprintf_graph(fp, &child->rb_root, new_total, | ||
665 | depth + 1, | 678 | depth + 1, |
666 | new_depth_mask | (1 << depth), | 679 | new_depth_mask | (1 << depth), |
667 | left_margin); | 680 | left_margin); |
@@ -671,61 +684,75 @@ static size_t __callchain__fprintf_graph(FILE *fp, struct callchain_node *self, | |||
671 | } | 684 | } |
672 | 685 | ||
673 | if (callchain_param.mode == CHAIN_GRAPH_REL && | 686 | if (callchain_param.mode == CHAIN_GRAPH_REL && |
674 | remaining && remaining != new_total) { | 687 | remaining && remaining != total_samples) { |
675 | 688 | ||
676 | if (!rem_sq_bracket) | 689 | if (!rem_sq_bracket) |
677 | return ret; | 690 | return ret; |
678 | 691 | ||
679 | new_depth_mask &= ~(1 << (depth - 1)); | 692 | new_depth_mask &= ~(1 << (depth - 1)); |
680 | |||
681 | ret += ipchain__fprintf_graph(fp, &rem_hits, depth, | 693 | ret += ipchain__fprintf_graph(fp, &rem_hits, depth, |
682 | new_depth_mask, 0, new_total, | 694 | new_depth_mask, 0, total_samples, |
683 | remaining, left_margin); | 695 | remaining, left_margin); |
684 | } | 696 | } |
685 | 697 | ||
686 | return ret; | 698 | return ret; |
687 | } | 699 | } |
688 | 700 | ||
689 | static size_t callchain__fprintf_graph(FILE *fp, struct callchain_node *self, | 701 | static size_t callchain__fprintf_graph(FILE *fp, struct rb_root *root, |
690 | u64 total_samples, int left_margin) | 702 | u64 total_samples, int left_margin) |
691 | { | 703 | { |
704 | struct callchain_node *cnode; | ||
692 | struct callchain_list *chain; | 705 | struct callchain_list *chain; |
706 | u32 entries_printed = 0; | ||
693 | bool printed = false; | 707 | bool printed = false; |
708 | struct rb_node *node; | ||
694 | int i = 0; | 709 | int i = 0; |
695 | int ret = 0; | 710 | int ret; |
696 | u32 entries_printed = 0; | ||
697 | |||
698 | list_for_each_entry(chain, &self->val, list) { | ||
699 | if (!i++ && sort__first_dimension == SORT_SYM) | ||
700 | continue; | ||
701 | |||
702 | if (!printed) { | ||
703 | ret += callchain__fprintf_left_margin(fp, left_margin); | ||
704 | ret += fprintf(fp, "|\n"); | ||
705 | ret += callchain__fprintf_left_margin(fp, left_margin); | ||
706 | ret += fprintf(fp, "---"); | ||
707 | |||
708 | left_margin += 3; | ||
709 | printed = true; | ||
710 | } else | ||
711 | ret += callchain__fprintf_left_margin(fp, left_margin); | ||
712 | 711 | ||
713 | if (chain->ms.sym) | 712 | /* |
714 | ret += fprintf(fp, " %s\n", chain->ms.sym->name); | 713 | * If have one single callchain root, don't bother printing |
715 | else | 714 | * its percentage (100 % in fractal mode and the same percentage |
716 | ret += fprintf(fp, " %p\n", (void *)(long)chain->ip); | 715 | * than the hist in graph mode). This also avoid one level of column. |
716 | */ | ||
717 | node = rb_first(root); | ||
718 | if (node && !rb_next(node)) { | ||
719 | cnode = rb_entry(node, struct callchain_node, rb_node); | ||
720 | list_for_each_entry(chain, &cnode->val, list) { | ||
721 | /* | ||
722 | * If we sort by symbol, the first entry is the same than | ||
723 | * the symbol. No need to print it otherwise it appears as | ||
724 | * displayed twice. | ||
725 | */ | ||
726 | if (!i++ && sort__first_dimension == SORT_SYM) | ||
727 | continue; | ||
728 | if (!printed) { | ||
729 | ret += callchain__fprintf_left_margin(fp, left_margin); | ||
730 | ret += fprintf(fp, "|\n"); | ||
731 | ret += callchain__fprintf_left_margin(fp, left_margin); | ||
732 | ret += fprintf(fp, "---"); | ||
733 | left_margin += 3; | ||
734 | printed = true; | ||
735 | } else | ||
736 | ret += callchain__fprintf_left_margin(fp, left_margin); | ||
737 | |||
738 | if (chain->ms.sym) | ||
739 | ret += fprintf(fp, " %s\n", chain->ms.sym->name); | ||
740 | else | ||
741 | ret += fprintf(fp, " %p\n", (void *)(long)chain->ip); | ||
717 | 742 | ||
718 | if (++entries_printed == callchain_param.print_limit) | 743 | if (++entries_printed == callchain_param.print_limit) |
719 | break; | 744 | break; |
745 | } | ||
746 | root = &cnode->rb_root; | ||
720 | } | 747 | } |
721 | 748 | ||
722 | ret += __callchain__fprintf_graph(fp, self, total_samples, 1, 1, left_margin); | 749 | return __callchain__fprintf_graph(fp, root, total_samples, |
723 | 750 | 1, 1, left_margin); | |
724 | return ret; | ||
725 | } | 751 | } |
726 | 752 | ||
727 | static size_t callchain__fprintf_flat(FILE *fp, struct callchain_node *self, | 753 | static size_t __callchain__fprintf_flat(FILE *fp, |
728 | u64 total_samples) | 754 | struct callchain_node *self, |
755 | u64 total_samples) | ||
729 | { | 756 | { |
730 | struct callchain_list *chain; | 757 | struct callchain_list *chain; |
731 | size_t ret = 0; | 758 | size_t ret = 0; |
@@ -733,7 +760,7 @@ static size_t callchain__fprintf_flat(FILE *fp, struct callchain_node *self, | |||
733 | if (!self) | 760 | if (!self) |
734 | return 0; | 761 | return 0; |
735 | 762 | ||
736 | ret += callchain__fprintf_flat(fp, self->parent, total_samples); | 763 | ret += __callchain__fprintf_flat(fp, self->parent, total_samples); |
737 | 764 | ||
738 | 765 | ||
739 | list_for_each_entry(chain, &self->val, list) { | 766 | list_for_each_entry(chain, &self->val, list) { |
@@ -749,44 +776,58 @@ static size_t callchain__fprintf_flat(FILE *fp, struct callchain_node *self, | |||
749 | return ret; | 776 | return ret; |
750 | } | 777 | } |
751 | 778 | ||
752 | static size_t hist_entry_callchain__fprintf(struct hist_entry *he, | 779 | static size_t callchain__fprintf_flat(FILE *fp, struct rb_root *self, |
753 | u64 total_samples, int left_margin, | 780 | u64 total_samples) |
754 | FILE *fp) | ||
755 | { | 781 | { |
756 | struct rb_node *rb_node; | ||
757 | struct callchain_node *chain; | ||
758 | size_t ret = 0; | 782 | size_t ret = 0; |
759 | u32 entries_printed = 0; | 783 | u32 entries_printed = 0; |
784 | struct rb_node *rb_node; | ||
785 | struct callchain_node *chain; | ||
760 | 786 | ||
761 | rb_node = rb_first(&he->sorted_chain); | 787 | rb_node = rb_first(self); |
762 | while (rb_node) { | 788 | while (rb_node) { |
763 | double percent; | 789 | double percent; |
764 | 790 | ||
765 | chain = rb_entry(rb_node, struct callchain_node, rb_node); | 791 | chain = rb_entry(rb_node, struct callchain_node, rb_node); |
766 | percent = chain->hit * 100.0 / total_samples; | 792 | percent = chain->hit * 100.0 / total_samples; |
767 | switch (callchain_param.mode) { | 793 | |
768 | case CHAIN_FLAT: | 794 | ret = percent_color_fprintf(fp, " %6.2f%%\n", percent); |
769 | ret += percent_color_fprintf(fp, " %6.2f%%\n", | 795 | ret += __callchain__fprintf_flat(fp, chain, total_samples); |
770 | percent); | ||
771 | ret += callchain__fprintf_flat(fp, chain, total_samples); | ||
772 | break; | ||
773 | case CHAIN_GRAPH_ABS: /* Falldown */ | ||
774 | case CHAIN_GRAPH_REL: | ||
775 | ret += callchain__fprintf_graph(fp, chain, total_samples, | ||
776 | left_margin); | ||
777 | case CHAIN_NONE: | ||
778 | default: | ||
779 | break; | ||
780 | } | ||
781 | ret += fprintf(fp, "\n"); | 796 | ret += fprintf(fp, "\n"); |
782 | if (++entries_printed == callchain_param.print_limit) | 797 | if (++entries_printed == callchain_param.print_limit) |
783 | break; | 798 | break; |
799 | |||
784 | rb_node = rb_next(rb_node); | 800 | rb_node = rb_next(rb_node); |
785 | } | 801 | } |
786 | 802 | ||
787 | return ret; | 803 | return ret; |
788 | } | 804 | } |
789 | 805 | ||
806 | static size_t hist_entry_callchain__fprintf(struct hist_entry *he, | ||
807 | u64 total_samples, int left_margin, | ||
808 | FILE *fp) | ||
809 | { | ||
810 | switch (callchain_param.mode) { | ||
811 | case CHAIN_GRAPH_REL: | ||
812 | return callchain__fprintf_graph(fp, &he->sorted_chain, he->period, | ||
813 | left_margin); | ||
814 | break; | ||
815 | case CHAIN_GRAPH_ABS: | ||
816 | return callchain__fprintf_graph(fp, &he->sorted_chain, total_samples, | ||
817 | left_margin); | ||
818 | break; | ||
819 | case CHAIN_FLAT: | ||
820 | return callchain__fprintf_flat(fp, &he->sorted_chain, total_samples); | ||
821 | break; | ||
822 | case CHAIN_NONE: | ||
823 | break; | ||
824 | default: | ||
825 | pr_err("Bad callchain mode\n"); | ||
826 | } | ||
827 | |||
828 | return 0; | ||
829 | } | ||
830 | |||
790 | void hists__output_recalc_col_len(struct hists *hists, int max_rows) | 831 | void hists__output_recalc_col_len(struct hists *hists, int max_rows) |
791 | { | 832 | { |
792 | struct rb_node *next = rb_first(&hists->entries); | 833 | struct rb_node *next = rb_first(&hists->entries); |
@@ -840,7 +881,7 @@ static int hist_entry__pcnt_snprintf(struct hist_entry *he, char *s, | |||
840 | sep ? "%.2f" : " %6.2f%%", | 881 | sep ? "%.2f" : " %6.2f%%", |
841 | (period * 100.0) / total); | 882 | (period * 100.0) / total); |
842 | else | 883 | else |
843 | ret = snprintf(s, size, sep ? "%.2f" : " %6.2f%%", | 884 | ret = scnprintf(s, size, sep ? "%.2f" : " %6.2f%%", |
844 | (period * 100.0) / total); | 885 | (period * 100.0) / total); |
845 | if (symbol_conf.show_cpu_utilization) { | 886 | if (symbol_conf.show_cpu_utilization) { |
846 | ret += percent_color_snprintf(s + ret, size - ret, | 887 | ret += percent_color_snprintf(s + ret, size - ret, |
@@ -863,20 +904,20 @@ static int hist_entry__pcnt_snprintf(struct hist_entry *he, char *s, | |||
863 | } | 904 | } |
864 | } | 905 | } |
865 | } else | 906 | } else |
866 | ret = snprintf(s, size, sep ? "%" PRIu64 : "%12" PRIu64 " ", period); | 907 | ret = scnprintf(s, size, sep ? "%" PRIu64 : "%12" PRIu64 " ", period); |
867 | 908 | ||
868 | if (symbol_conf.show_nr_samples) { | 909 | if (symbol_conf.show_nr_samples) { |
869 | if (sep) | 910 | if (sep) |
870 | ret += snprintf(s + ret, size - ret, "%c%" PRIu64, *sep, nr_events); | 911 | ret += scnprintf(s + ret, size - ret, "%c%" PRIu64, *sep, nr_events); |
871 | else | 912 | else |
872 | ret += snprintf(s + ret, size - ret, "%11" PRIu64, nr_events); | 913 | ret += scnprintf(s + ret, size - ret, "%11" PRIu64, nr_events); |
873 | } | 914 | } |
874 | 915 | ||
875 | if (symbol_conf.show_total_period) { | 916 | if (symbol_conf.show_total_period) { |
876 | if (sep) | 917 | if (sep) |
877 | ret += snprintf(s + ret, size - ret, "%c%" PRIu64, *sep, period); | 918 | ret += scnprintf(s + ret, size - ret, "%c%" PRIu64, *sep, period); |
878 | else | 919 | else |
879 | ret += snprintf(s + ret, size - ret, " %12" PRIu64, period); | 920 | ret += scnprintf(s + ret, size - ret, " %12" PRIu64, period); |
880 | } | 921 | } |
881 | 922 | ||
882 | if (pair_hists) { | 923 | if (pair_hists) { |
@@ -891,25 +932,25 @@ static int hist_entry__pcnt_snprintf(struct hist_entry *he, char *s, | |||
891 | diff = new_percent - old_percent; | 932 | diff = new_percent - old_percent; |
892 | 933 | ||
893 | if (fabs(diff) >= 0.01) | 934 | if (fabs(diff) >= 0.01) |
894 | snprintf(bf, sizeof(bf), "%+4.2F%%", diff); | 935 | scnprintf(bf, sizeof(bf), "%+4.2F%%", diff); |
895 | else | 936 | else |
896 | snprintf(bf, sizeof(bf), " "); | 937 | scnprintf(bf, sizeof(bf), " "); |
897 | 938 | ||
898 | if (sep) | 939 | if (sep) |
899 | ret += snprintf(s + ret, size - ret, "%c%s", *sep, bf); | 940 | ret += scnprintf(s + ret, size - ret, "%c%s", *sep, bf); |
900 | else | 941 | else |
901 | ret += snprintf(s + ret, size - ret, "%11.11s", bf); | 942 | ret += scnprintf(s + ret, size - ret, "%11.11s", bf); |
902 | 943 | ||
903 | if (show_displacement) { | 944 | if (show_displacement) { |
904 | if (displacement) | 945 | if (displacement) |
905 | snprintf(bf, sizeof(bf), "%+4ld", displacement); | 946 | scnprintf(bf, sizeof(bf), "%+4ld", displacement); |
906 | else | 947 | else |
907 | snprintf(bf, sizeof(bf), " "); | 948 | scnprintf(bf, sizeof(bf), " "); |
908 | 949 | ||
909 | if (sep) | 950 | if (sep) |
910 | ret += snprintf(s + ret, size - ret, "%c%s", *sep, bf); | 951 | ret += scnprintf(s + ret, size - ret, "%c%s", *sep, bf); |
911 | else | 952 | else |
912 | ret += snprintf(s + ret, size - ret, "%6.6s", bf); | 953 | ret += scnprintf(s + ret, size - ret, "%6.6s", bf); |
913 | } | 954 | } |
914 | } | 955 | } |
915 | 956 | ||
@@ -927,7 +968,7 @@ int hist_entry__snprintf(struct hist_entry *he, char *s, size_t size, | |||
927 | if (se->elide) | 968 | if (se->elide) |
928 | continue; | 969 | continue; |
929 | 970 | ||
930 | ret += snprintf(s + ret, size - ret, "%s", sep ?: " "); | 971 | ret += scnprintf(s + ret, size - ret, "%s", sep ?: " "); |
931 | ret += se->se_snprintf(he, s + ret, size - ret, | 972 | ret += se->se_snprintf(he, s + ret, size - ret, |
932 | hists__col_len(hists, se->se_width_idx)); | 973 | hists__col_len(hists, se->se_width_idx)); |
933 | } | 974 | } |
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h index 2cae9df40e04..cfc64e293f90 100644 --- a/tools/perf/util/hist.h +++ b/tools/perf/util/hist.h | |||
@@ -138,7 +138,7 @@ static inline int hist_entry__tui_annotate(struct hist_entry *self __used, | |||
138 | #define K_LEFT -1 | 138 | #define K_LEFT -1 |
139 | #define K_RIGHT -2 | 139 | #define K_RIGHT -2 |
140 | #else | 140 | #else |
141 | #include "ui/keysyms.h" | 141 | #include "../ui/keysyms.h" |
142 | int hist_entry__tui_annotate(struct hist_entry *he, int evidx, | 142 | int hist_entry__tui_annotate(struct hist_entry *he, int evidx, |
143 | void(*timer)(void *arg), void *arg, int delay_secs); | 143 | void(*timer)(void *arg), void *arg, int delay_secs); |
144 | 144 | ||
diff --git a/tools/perf/util/include/asm/unistd_32.h b/tools/perf/util/include/asm/unistd_32.h new file mode 100644 index 000000000000..8b137891791f --- /dev/null +++ b/tools/perf/util/include/asm/unistd_32.h | |||
@@ -0,0 +1 @@ | |||
diff --git a/tools/perf/util/include/asm/unistd_64.h b/tools/perf/util/include/asm/unistd_64.h new file mode 100644 index 000000000000..8b137891791f --- /dev/null +++ b/tools/perf/util/include/asm/unistd_64.h | |||
@@ -0,0 +1 @@ | |||
diff --git a/tools/perf/util/include/linux/bitops.h b/tools/perf/util/include/linux/bitops.h index 62cdee78db7b..f1584833bd22 100644 --- a/tools/perf/util/include/linux/bitops.h +++ b/tools/perf/util/include/linux/bitops.h | |||
@@ -15,7 +15,7 @@ | |||
15 | (bit) = find_next_bit((addr), (size), (bit) + 1)) | 15 | (bit) = find_next_bit((addr), (size), (bit) + 1)) |
16 | 16 | ||
17 | /* same as for_each_set_bit() but use bit as value to start with */ | 17 | /* same as for_each_set_bit() but use bit as value to start with */ |
18 | #define for_each_set_bit_cont(bit, addr, size) \ | 18 | #define for_each_set_bit_from(bit, addr, size) \ |
19 | for ((bit) = find_next_bit((addr), (size), (bit)); \ | 19 | for ((bit) = find_next_bit((addr), (size), (bit)); \ |
20 | (bit) < (size); \ | 20 | (bit) < (size); \ |
21 | (bit) = find_next_bit((addr), (size), (bit) + 1)) | 21 | (bit) = find_next_bit((addr), (size), (bit) + 1)) |
diff --git a/tools/perf/util/include/linux/module.h b/tools/perf/util/include/linux/export.h index b43e2dc21e04..b43e2dc21e04 100644 --- a/tools/perf/util/include/linux/module.h +++ b/tools/perf/util/include/linux/export.h | |||
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c index dea6d1c1a954..35ae56864e4f 100644 --- a/tools/perf/util/map.c +++ b/tools/perf/util/map.c | |||
@@ -38,6 +38,7 @@ void map__init(struct map *self, enum map_type type, | |||
38 | RB_CLEAR_NODE(&self->rb_node); | 38 | RB_CLEAR_NODE(&self->rb_node); |
39 | self->groups = NULL; | 39 | self->groups = NULL; |
40 | self->referenced = false; | 40 | self->referenced = false; |
41 | self->erange_warned = false; | ||
41 | } | 42 | } |
42 | 43 | ||
43 | struct map *map__new(struct list_head *dsos__list, u64 start, u64 len, | 44 | struct map *map__new(struct list_head *dsos__list, u64 start, u64 len, |
diff --git a/tools/perf/util/map.h b/tools/perf/util/map.h index b100c20b7f94..81371bad4ef0 100644 --- a/tools/perf/util/map.h +++ b/tools/perf/util/map.h | |||
@@ -33,6 +33,7 @@ struct map { | |||
33 | u64 end; | 33 | u64 end; |
34 | u8 /* enum map_type */ type; | 34 | u8 /* enum map_type */ type; |
35 | bool referenced; | 35 | bool referenced; |
36 | bool erange_warned; | ||
36 | u32 priv; | 37 | u32 priv; |
37 | u64 pgoff; | 38 | u64 pgoff; |
38 | 39 | ||
diff --git a/tools/perf/util/parse-events-bison.c b/tools/perf/util/parse-events-bison.c deleted file mode 100644 index 4a0fd6d5cebf..000000000000 --- a/tools/perf/util/parse-events-bison.c +++ /dev/null | |||
@@ -1,1852 +0,0 @@ | |||
1 | /* A Bison parser, made by GNU Bison 2.4.3. */ | ||
2 | |||
3 | /* Skeleton implementation for Bison's Yacc-like parsers in C | ||
4 | |||
5 | Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006, | ||
6 | 2009, 2010 Free Software Foundation, Inc. | ||
7 | |||
8 | This program is free software: you can redistribute it and/or modify | ||
9 | it under the terms of the GNU General Public License as published by | ||
10 | the Free Software Foundation, either version 3 of the License, or | ||
11 | (at your option) any later version. | ||
12 | |||
13 | This program is distributed in the hope that it will be useful, | ||
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | GNU General Public License for more details. | ||
17 | |||
18 | You should have received a copy of the GNU General Public License | ||
19 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | ||
20 | |||
21 | /* As a special exception, you may create a larger work that contains | ||
22 | part or all of the Bison parser skeleton and distribute that work | ||
23 | under terms of your choice, so long as that work isn't itself a | ||
24 | parser generator using the skeleton or a modified version thereof | ||
25 | as a parser skeleton. Alternatively, if you modify or redistribute | ||
26 | the parser skeleton itself, you may (at your option) remove this | ||
27 | special exception, which will cause the skeleton and the resulting | ||
28 | Bison output files to be licensed under the GNU General Public | ||
29 | License without this special exception. | ||
30 | |||
31 | This special exception was added by the Free Software Foundation in | ||
32 | version 2.2 of Bison. */ | ||
33 | |||
34 | /* C LALR(1) parser skeleton written by Richard Stallman, by | ||
35 | simplifying the original so-called "semantic" parser. */ | ||
36 | |||
37 | /* All symbols defined below should begin with yy or YY, to avoid | ||
38 | infringing on user name space. This should be done even for local | ||
39 | variables, as they might otherwise be expanded by user macros. | ||
40 | There are some unavoidable exceptions within include files to | ||
41 | define necessary library symbols; they are noted "INFRINGES ON | ||
42 | USER NAME SPACE" below. */ | ||
43 | |||
44 | /* Identify Bison output. */ | ||
45 | #define YYBISON 1 | ||
46 | |||
47 | /* Bison version. */ | ||
48 | #define YYBISON_VERSION "2.4.3" | ||
49 | |||
50 | /* Skeleton name. */ | ||
51 | #define YYSKELETON_NAME "yacc.c" | ||
52 | |||
53 | /* Pure parsers. */ | ||
54 | #define YYPURE 0 | ||
55 | |||
56 | /* Push parsers. */ | ||
57 | #define YYPUSH 0 | ||
58 | |||
59 | /* Pull parsers. */ | ||
60 | #define YYPULL 1 | ||
61 | |||
62 | /* Using locations. */ | ||
63 | #define YYLSP_NEEDED 0 | ||
64 | |||
65 | /* Substitute the variable and function names. */ | ||
66 | #define yyparse parse_events_parse | ||
67 | #define yylex parse_events_lex | ||
68 | #define yyerror parse_events_error | ||
69 | #define yylval parse_events_lval | ||
70 | #define yychar parse_events_char | ||
71 | #define yydebug parse_events_debug | ||
72 | #define yynerrs parse_events_nerrs | ||
73 | |||
74 | |||
75 | /* Copy the first part of user declarations. */ | ||
76 | |||
77 | /* Line 189 of yacc.c */ | ||
78 | #line 6 "util/parse-events.y" | ||
79 | |||
80 | |||
81 | #define YYDEBUG 1 | ||
82 | |||
83 | #include <linux/compiler.h> | ||
84 | #include <linux/list.h> | ||
85 | #include "types.h" | ||
86 | #include "util.h" | ||
87 | #include "parse-events.h" | ||
88 | |||
89 | extern int parse_events_lex (void); | ||
90 | |||
91 | #define ABORT_ON(val) \ | ||
92 | do { \ | ||
93 | if (val) \ | ||
94 | YYABORT; \ | ||
95 | } while (0) | ||
96 | |||
97 | |||
98 | |||
99 | /* Line 189 of yacc.c */ | ||
100 | #line 101 "util/parse-events-bison.c" | ||
101 | |||
102 | /* Enabling traces. */ | ||
103 | #ifndef YYDEBUG | ||
104 | # define YYDEBUG 0 | ||
105 | #endif | ||
106 | |||
107 | /* Enabling verbose error messages. */ | ||
108 | #ifdef YYERROR_VERBOSE | ||
109 | # undef YYERROR_VERBOSE | ||
110 | # define YYERROR_VERBOSE 1 | ||
111 | #else | ||
112 | # define YYERROR_VERBOSE 0 | ||
113 | #endif | ||
114 | |||
115 | /* Enabling the token table. */ | ||
116 | #ifndef YYTOKEN_TABLE | ||
117 | # define YYTOKEN_TABLE 0 | ||
118 | #endif | ||
119 | |||
120 | |||
121 | /* Tokens. */ | ||
122 | #ifndef YYTOKENTYPE | ||
123 | # define YYTOKENTYPE | ||
124 | /* Put the tokens into the symbol table, so that GDB and other debuggers | ||
125 | know about them. */ | ||
126 | enum yytokentype { | ||
127 | PE_VALUE = 258, | ||
128 | PE_VALUE_SYM = 259, | ||
129 | PE_RAW = 260, | ||
130 | PE_TERM = 261, | ||
131 | PE_NAME = 262, | ||
132 | PE_MODIFIER_EVENT = 263, | ||
133 | PE_MODIFIER_BP = 264, | ||
134 | PE_NAME_CACHE_TYPE = 265, | ||
135 | PE_NAME_CACHE_OP_RESULT = 266, | ||
136 | PE_PREFIX_MEM = 267, | ||
137 | PE_PREFIX_RAW = 268, | ||
138 | PE_ERROR = 269 | ||
139 | }; | ||
140 | #endif | ||
141 | |||
142 | |||
143 | |||
144 | #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED | ||
145 | typedef union YYSTYPE | ||
146 | { | ||
147 | |||
148 | /* Line 214 of yacc.c */ | ||
149 | #line 45 "util/parse-events.y" | ||
150 | |||
151 | char *str; | ||
152 | unsigned long num; | ||
153 | struct list_head *head; | ||
154 | struct parse_events__term *term; | ||
155 | |||
156 | |||
157 | |||
158 | /* Line 214 of yacc.c */ | ||
159 | #line 160 "util/parse-events-bison.c" | ||
160 | } YYSTYPE; | ||
161 | # define YYSTYPE_IS_TRIVIAL 1 | ||
162 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ | ||
163 | # define YYSTYPE_IS_DECLARED 1 | ||
164 | #endif | ||
165 | |||
166 | |||
167 | /* Copy the second part of user declarations. */ | ||
168 | |||
169 | |||
170 | /* Line 264 of yacc.c */ | ||
171 | #line 172 "util/parse-events-bison.c" | ||
172 | |||
173 | #ifdef short | ||
174 | # undef short | ||
175 | #endif | ||
176 | |||
177 | #ifdef YYTYPE_UINT8 | ||
178 | typedef YYTYPE_UINT8 yytype_uint8; | ||
179 | #else | ||
180 | typedef unsigned char yytype_uint8; | ||
181 | #endif | ||
182 | |||
183 | #ifdef YYTYPE_INT8 | ||
184 | typedef YYTYPE_INT8 yytype_int8; | ||
185 | #elif (defined __STDC__ || defined __C99__FUNC__ \ | ||
186 | || defined __cplusplus || defined _MSC_VER) | ||
187 | typedef signed char yytype_int8; | ||
188 | #else | ||
189 | typedef short int yytype_int8; | ||
190 | #endif | ||
191 | |||
192 | #ifdef YYTYPE_UINT16 | ||
193 | typedef YYTYPE_UINT16 yytype_uint16; | ||
194 | #else | ||
195 | typedef unsigned short int yytype_uint16; | ||
196 | #endif | ||
197 | |||
198 | #ifdef YYTYPE_INT16 | ||
199 | typedef YYTYPE_INT16 yytype_int16; | ||
200 | #else | ||
201 | typedef short int yytype_int16; | ||
202 | #endif | ||
203 | |||
204 | #ifndef YYSIZE_T | ||
205 | # ifdef __SIZE_TYPE__ | ||
206 | # define YYSIZE_T __SIZE_TYPE__ | ||
207 | # elif defined size_t | ||
208 | # define YYSIZE_T size_t | ||
209 | # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ | ||
210 | || defined __cplusplus || defined _MSC_VER) | ||
211 | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ | ||
212 | # define YYSIZE_T size_t | ||
213 | # else | ||
214 | # define YYSIZE_T unsigned int | ||
215 | # endif | ||
216 | #endif | ||
217 | |||
218 | #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) | ||
219 | |||
220 | #ifndef YY_ | ||
221 | # if defined YYENABLE_NLS && YYENABLE_NLS | ||
222 | # if ENABLE_NLS | ||
223 | # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ | ||
224 | # define YY_(msgid) dgettext ("bison-runtime", msgid) | ||
225 | # endif | ||
226 | # endif | ||
227 | # ifndef YY_ | ||
228 | # define YY_(msgid) msgid | ||
229 | # endif | ||
230 | #endif | ||
231 | |||
232 | /* Suppress unused-variable warnings by "using" E. */ | ||
233 | #if ! defined lint || defined __GNUC__ | ||
234 | # define YYUSE(e) ((void) (e)) | ||
235 | #else | ||
236 | # define YYUSE(e) /* empty */ | ||
237 | #endif | ||
238 | |||
239 | /* Identity function, used to suppress warnings about constant conditions. */ | ||
240 | #ifndef lint | ||
241 | # define YYID(n) (n) | ||
242 | #else | ||
243 | #if (defined __STDC__ || defined __C99__FUNC__ \ | ||
244 | || defined __cplusplus || defined _MSC_VER) | ||
245 | static int | ||
246 | YYID (int yyi) | ||
247 | #else | ||
248 | static int | ||
249 | YYID (yyi) | ||
250 | int yyi; | ||
251 | #endif | ||
252 | { | ||
253 | return yyi; | ||
254 | } | ||
255 | #endif | ||
256 | |||
257 | #if ! defined yyoverflow || YYERROR_VERBOSE | ||
258 | |||
259 | /* The parser invokes alloca or malloc; define the necessary symbols. */ | ||
260 | |||
261 | # ifdef YYSTACK_USE_ALLOCA | ||
262 | # if YYSTACK_USE_ALLOCA | ||
263 | # ifdef __GNUC__ | ||
264 | # define YYSTACK_ALLOC __builtin_alloca | ||
265 | # elif defined __BUILTIN_VA_ARG_INCR | ||
266 | # include <alloca.h> /* INFRINGES ON USER NAME SPACE */ | ||
267 | # elif defined _AIX | ||
268 | # define YYSTACK_ALLOC __alloca | ||
269 | # elif defined _MSC_VER | ||
270 | # include <malloc.h> /* INFRINGES ON USER NAME SPACE */ | ||
271 | # define alloca _alloca | ||
272 | # else | ||
273 | # define YYSTACK_ALLOC alloca | ||
274 | # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ | ||
275 | || defined __cplusplus || defined _MSC_VER) | ||
276 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ | ||
277 | # ifndef _STDLIB_H | ||
278 | # define _STDLIB_H 1 | ||
279 | # endif | ||
280 | # endif | ||
281 | # endif | ||
282 | # endif | ||
283 | # endif | ||
284 | |||
285 | # ifdef YYSTACK_ALLOC | ||
286 | /* Pacify GCC's `empty if-body' warning. */ | ||
287 | # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) | ||
288 | # ifndef YYSTACK_ALLOC_MAXIMUM | ||
289 | /* The OS might guarantee only one guard page at the bottom of the stack, | ||
290 | and a page size can be as small as 4096 bytes. So we cannot safely | ||
291 | invoke alloca (N) if N exceeds 4096. Use a slightly smaller number | ||
292 | to allow for a few compiler-allocated temporary stack slots. */ | ||
293 | # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ | ||
294 | # endif | ||
295 | # else | ||
296 | # define YYSTACK_ALLOC YYMALLOC | ||
297 | # define YYSTACK_FREE YYFREE | ||
298 | # ifndef YYSTACK_ALLOC_MAXIMUM | ||
299 | # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM | ||
300 | # endif | ||
301 | # if (defined __cplusplus && ! defined _STDLIB_H \ | ||
302 | && ! ((defined YYMALLOC || defined malloc) \ | ||
303 | && (defined YYFREE || defined free))) | ||
304 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ | ||
305 | # ifndef _STDLIB_H | ||
306 | # define _STDLIB_H 1 | ||
307 | # endif | ||
308 | # endif | ||
309 | # ifndef YYMALLOC | ||
310 | # define YYMALLOC malloc | ||
311 | # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ | ||
312 | || defined __cplusplus || defined _MSC_VER) | ||
313 | void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ | ||
314 | # endif | ||
315 | # endif | ||
316 | # ifndef YYFREE | ||
317 | # define YYFREE free | ||
318 | # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ | ||
319 | || defined __cplusplus || defined _MSC_VER) | ||
320 | void free (void *); /* INFRINGES ON USER NAME SPACE */ | ||
321 | # endif | ||
322 | # endif | ||
323 | # endif | ||
324 | #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ | ||
325 | |||
326 | |||
327 | #if (! defined yyoverflow \ | ||
328 | && (! defined __cplusplus \ | ||
329 | || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) | ||
330 | |||
331 | /* A type that is properly aligned for any stack member. */ | ||
332 | union yyalloc | ||
333 | { | ||
334 | yytype_int16 yyss_alloc; | ||
335 | YYSTYPE yyvs_alloc; | ||
336 | }; | ||
337 | |||
338 | /* The size of the maximum gap between one aligned stack and the next. */ | ||
339 | # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) | ||
340 | |||
341 | /* The size of an array large to enough to hold all stacks, each with | ||
342 | N elements. */ | ||
343 | # define YYSTACK_BYTES(N) \ | ||
344 | ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ | ||
345 | + YYSTACK_GAP_MAXIMUM) | ||
346 | |||
347 | /* Copy COUNT objects from FROM to TO. The source and destination do | ||
348 | not overlap. */ | ||
349 | # ifndef YYCOPY | ||
350 | # if defined __GNUC__ && 1 < __GNUC__ | ||
351 | # define YYCOPY(To, From, Count) \ | ||
352 | __builtin_memcpy (To, From, (Count) * sizeof (*(From))) | ||
353 | # else | ||
354 | # define YYCOPY(To, From, Count) \ | ||
355 | do \ | ||
356 | { \ | ||
357 | YYSIZE_T yyi; \ | ||
358 | for (yyi = 0; yyi < (Count); yyi++) \ | ||
359 | (To)[yyi] = (From)[yyi]; \ | ||
360 | } \ | ||
361 | while (YYID (0)) | ||
362 | # endif | ||
363 | # endif | ||
364 | |||
365 | /* Relocate STACK from its old location to the new one. The | ||
366 | local variables YYSIZE and YYSTACKSIZE give the old and new number of | ||
367 | elements in the stack, and YYPTR gives the new location of the | ||
368 | stack. Advance YYPTR to a properly aligned location for the next | ||
369 | stack. */ | ||
370 | # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ | ||
371 | do \ | ||
372 | { \ | ||
373 | YYSIZE_T yynewbytes; \ | ||
374 | YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ | ||
375 | Stack = &yyptr->Stack_alloc; \ | ||
376 | yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ | ||
377 | yyptr += yynewbytes / sizeof (*yyptr); \ | ||
378 | } \ | ||
379 | while (YYID (0)) | ||
380 | |||
381 | #endif | ||
382 | |||
383 | /* YYFINAL -- State number of the termination state. */ | ||
384 | #define YYFINAL 25 | ||
385 | /* YYLAST -- Last index in YYTABLE. */ | ||
386 | #define YYLAST 43 | ||
387 | |||
388 | /* YYNTOKENS -- Number of terminals. */ | ||
389 | #define YYNTOKENS 20 | ||
390 | /* YYNNTS -- Number of nonterminals. */ | ||
391 | #define YYNNTS 15 | ||
392 | /* YYNRULES -- Number of rules. */ | ||
393 | #define YYNRULES 35 | ||
394 | /* YYNRULES -- Number of states. */ | ||
395 | #define YYNSTATES 57 | ||
396 | |||
397 | /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ | ||
398 | #define YYUNDEFTOK 2 | ||
399 | #define YYMAXUTOK 269 | ||
400 | |||
401 | #define YYTRANSLATE(YYX) \ | ||
402 | ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) | ||
403 | |||
404 | /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ | ||
405 | static const yytype_uint8 yytranslate[] = | ||
406 | { | ||
407 | 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
408 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
409 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
410 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
411 | 2, 2, 2, 2, 15, 17, 2, 16, 2, 2, | ||
412 | 2, 2, 2, 2, 2, 2, 2, 2, 18, 2, | ||
413 | 2, 19, 2, 2, 2, 2, 2, 2, 2, 2, | ||
414 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
415 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
416 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
417 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
418 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
419 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
420 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
421 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
422 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
423 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
424 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
425 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
426 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
427 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
428 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
429 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
430 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
431 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
432 | 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, | ||
433 | 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 | ||
434 | }; | ||
435 | |||
436 | #if YYDEBUG | ||
437 | /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in | ||
438 | YYRHS. */ | ||
439 | static const yytype_uint8 yyprhs[] = | ||
440 | { | ||
441 | 0, 0, 3, 7, 9, 12, 14, 16, 18, 21, | ||
442 | 23, 26, 29, 32, 37, 42, 45, 51, 55, 57, | ||
443 | 63, 67, 71, 75, 77, 81, 83, 87, 91, 93, | ||
444 | 97, 99, 101, 102, 104, 106 | ||
445 | }; | ||
446 | |||
447 | /* YYRHS -- A `-1'-separated list of the rules' RHS. */ | ||
448 | static const yytype_int8 yyrhs[] = | ||
449 | { | ||
450 | 21, 0, -1, 21, 15, 22, -1, 22, -1, 23, | ||
451 | 8, -1, 23, -1, 24, -1, 25, -1, 26, 33, | ||
452 | -1, 27, -1, 28, 33, -1, 29, 33, -1, 30, | ||
453 | 33, -1, 7, 16, 31, 16, -1, 4, 16, 31, | ||
454 | 16, -1, 4, 34, -1, 10, 17, 11, 17, 11, | ||
455 | -1, 10, 17, 11, -1, 10, -1, 12, 3, 18, | ||
456 | 9, 33, -1, 12, 3, 33, -1, 7, 18, 7, | ||
457 | -1, 3, 18, 3, -1, 5, -1, 31, 15, 32, | ||
458 | -1, 32, -1, 7, 19, 7, -1, 7, 19, 3, | ||
459 | -1, 7, -1, 6, 19, 3, -1, 6, -1, 18, | ||
460 | -1, -1, 16, -1, 18, -1, -1 | ||
461 | }; | ||
462 | |||
463 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ | ||
464 | static const yytype_uint8 yyrline[] = | ||
465 | { | ||
466 | 0, 54, 54, 54, 57, 62, 64, 65, 66, 67, | ||
467 | 68, 69, 70, 73, 80, 89, 98, 103, 108, 114, | ||
468 | 119, 125, 131, 137, 143, 153, 165, 174, 183, 192, | ||
469 | 200, 208, 208, 210, 210, 210 | ||
470 | }; | ||
471 | #endif | ||
472 | |||
473 | #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE | ||
474 | /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. | ||
475 | First, the terminals, then, starting at YYNTOKENS, nonterminals. */ | ||
476 | static const char *const yytname[] = | ||
477 | { | ||
478 | "$end", "error", "$undefined", "PE_VALUE", "PE_VALUE_SYM", "PE_RAW", | ||
479 | "PE_TERM", "PE_NAME", "PE_MODIFIER_EVENT", "PE_MODIFIER_BP", | ||
480 | "PE_NAME_CACHE_TYPE", "PE_NAME_CACHE_OP_RESULT", "PE_PREFIX_MEM", | ||
481 | "PE_PREFIX_RAW", "PE_ERROR", "','", "'/'", "'-'", "':'", "'='", | ||
482 | "$accept", "events", "event", "event_def", "event_pmu", | ||
483 | "event_legacy_symbol", "event_legacy_cache", "event_legacy_mem", | ||
484 | "event_legacy_tracepoint", "event_legacy_numeric", "event_legacy_raw", | ||
485 | "event_config", "event_term", "sep_dc", "sep_slash_dc", 0 | ||
486 | }; | ||
487 | #endif | ||
488 | |||
489 | # ifdef YYPRINT | ||
490 | /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to | ||
491 | token YYLEX-NUM. */ | ||
492 | static const yytype_uint16 yytoknum[] = | ||
493 | { | ||
494 | 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, | ||
495 | 265, 266, 267, 268, 269, 44, 47, 45, 58, 61 | ||
496 | }; | ||
497 | # endif | ||
498 | |||
499 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ | ||
500 | static const yytype_uint8 yyr1[] = | ||
501 | { | ||
502 | 0, 20, 21, 21, 22, 22, 23, 23, 23, 23, | ||
503 | 23, 23, 23, 24, 25, 25, 26, 26, 26, 27, | ||
504 | 27, 28, 29, 30, 31, 31, 32, 32, 32, 32, | ||
505 | 32, 33, 33, 34, 34, 34 | ||
506 | }; | ||
507 | |||
508 | /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ | ||
509 | static const yytype_uint8 yyr2[] = | ||
510 | { | ||
511 | 0, 2, 3, 1, 2, 1, 1, 1, 2, 1, | ||
512 | 2, 2, 2, 4, 4, 2, 5, 3, 1, 5, | ||
513 | 3, 3, 3, 1, 3, 1, 3, 3, 1, 3, | ||
514 | 1, 1, 0, 1, 1, 0 | ||
515 | }; | ||
516 | |||
517 | /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state | ||
518 | STATE-NUM when YYTABLE doesn't specify something else to do. Zero | ||
519 | means the default is an error. */ | ||
520 | static const yytype_uint8 yydefact[] = | ||
521 | { | ||
522 | 0, 0, 35, 23, 0, 18, 0, 0, 3, 5, | ||
523 | 6, 7, 32, 9, 32, 32, 32, 0, 33, 34, | ||
524 | 15, 0, 0, 0, 32, 1, 0, 4, 31, 8, | ||
525 | 10, 11, 12, 22, 30, 28, 0, 25, 0, 21, | ||
526 | 17, 31, 20, 2, 0, 0, 0, 14, 13, 0, | ||
527 | 32, 29, 27, 26, 24, 16, 19 | ||
528 | }; | ||
529 | |||
530 | /* YYDEFGOTO[NTERM-NUM]. */ | ||
531 | static const yytype_int8 yydefgoto[] = | ||
532 | { | ||
533 | -1, 7, 8, 9, 10, 11, 12, 13, 14, 15, | ||
534 | 16, 36, 37, 29, 20 | ||
535 | }; | ||
536 | |||
537 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing | ||
538 | STATE-NUM. */ | ||
539 | #define YYPACT_NINF -15 | ||
540 | static const yytype_int8 yypact[] = | ||
541 | { | ||
542 | 1, -4, -9, -15, -1, 10, 22, 3, -15, 18, | ||
543 | -15, -15, 11, -15, 11, 11, 11, 25, 13, -15, | ||
544 | -15, 13, 23, 20, 14, -15, 1, -15, -15, -15, | ||
545 | -15, -15, -15, -15, 15, 16, 6, -15, 8, -15, | ||
546 | 21, 24, -15, -15, 34, 9, 13, -15, -15, 28, | ||
547 | 11, -15, -15, -15, -15, -15, -15 | ||
548 | }; | ||
549 | |||
550 | /* YYPGOTO[NTERM-NUM]. */ | ||
551 | static const yytype_int8 yypgoto[] = | ||
552 | { | ||
553 | -15, -15, 17, -15, -15, -15, -15, -15, -15, -15, | ||
554 | -15, 19, -5, -14, -15 | ||
555 | }; | ||
556 | |||
557 | /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If | ||
558 | positive, shift that token. If negative, reduce the rule which | ||
559 | number is the opposite. If zero, do what YYDEFACT says. | ||
560 | If YYTABLE_NINF, syntax error. */ | ||
561 | #define YYTABLE_NINF -1 | ||
562 | static const yytype_uint8 yytable[] = | ||
563 | { | ||
564 | 30, 31, 32, 25, 1, 2, 3, 18, 4, 19, | ||
565 | 42, 5, 52, 6, 17, 21, 53, 22, 26, 34, | ||
566 | 35, 46, 47, 46, 48, 24, 27, 23, 33, 28, | ||
567 | 39, 40, 41, 50, 44, 45, 56, 51, 49, 55, | ||
568 | 38, 54, 0, 43 | ||
569 | }; | ||
570 | |||
571 | static const yytype_int8 yycheck[] = | ||
572 | { | ||
573 | 14, 15, 16, 0, 3, 4, 5, 16, 7, 18, | ||
574 | 24, 10, 3, 12, 18, 16, 7, 18, 15, 6, | ||
575 | 7, 15, 16, 15, 16, 3, 8, 17, 3, 18, | ||
576 | 7, 11, 18, 9, 19, 19, 50, 3, 17, 11, | ||
577 | 21, 46, -1, 26 | ||
578 | }; | ||
579 | |||
580 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing | ||
581 | symbol of state STATE-NUM. */ | ||
582 | static const yytype_uint8 yystos[] = | ||
583 | { | ||
584 | 0, 3, 4, 5, 7, 10, 12, 21, 22, 23, | ||
585 | 24, 25, 26, 27, 28, 29, 30, 18, 16, 18, | ||
586 | 34, 16, 18, 17, 3, 0, 15, 8, 18, 33, | ||
587 | 33, 33, 33, 3, 6, 7, 31, 32, 31, 7, | ||
588 | 11, 18, 33, 22, 19, 19, 15, 16, 16, 17, | ||
589 | 9, 3, 3, 7, 32, 11, 33 | ||
590 | }; | ||
591 | |||
592 | #define yyerrok (yyerrstatus = 0) | ||
593 | #define yyclearin (yychar = YYEMPTY) | ||
594 | #define YYEMPTY (-2) | ||
595 | #define YYEOF 0 | ||
596 | |||
597 | #define YYACCEPT goto yyacceptlab | ||
598 | #define YYABORT goto yyabortlab | ||
599 | #define YYERROR goto yyerrorlab | ||
600 | |||
601 | |||
602 | /* Like YYERROR except do call yyerror. This remains here temporarily | ||
603 | to ease the transition to the new meaning of YYERROR, for GCC. | ||
604 | Once GCC version 2 has supplanted version 1, this can go. However, | ||
605 | YYFAIL appears to be in use. Nevertheless, it is formally deprecated | ||
606 | in Bison 2.4.2's NEWS entry, where a plan to phase it out is | ||
607 | discussed. */ | ||
608 | |||
609 | #define YYFAIL goto yyerrlab | ||
610 | #if defined YYFAIL | ||
611 | /* This is here to suppress warnings from the GCC cpp's | ||
612 | -Wunused-macros. Normally we don't worry about that warning, but | ||
613 | some users do, and we want to make it easy for users to remove | ||
614 | YYFAIL uses, which will produce warnings from Bison 2.5. */ | ||
615 | #endif | ||
616 | |||
617 | #define YYRECOVERING() (!!yyerrstatus) | ||
618 | |||
619 | #define YYBACKUP(Token, Value) \ | ||
620 | do \ | ||
621 | if (yychar == YYEMPTY && yylen == 1) \ | ||
622 | { \ | ||
623 | yychar = (Token); \ | ||
624 | yylval = (Value); \ | ||
625 | yytoken = YYTRANSLATE (yychar); \ | ||
626 | YYPOPSTACK (1); \ | ||
627 | goto yybackup; \ | ||
628 | } \ | ||
629 | else \ | ||
630 | { \ | ||
631 | yyerror (list, idx, YY_("syntax error: cannot back up")); \ | ||
632 | YYERROR; \ | ||
633 | } \ | ||
634 | while (YYID (0)) | ||
635 | |||
636 | |||
637 | #define YYTERROR 1 | ||
638 | #define YYERRCODE 256 | ||
639 | |||
640 | |||
641 | /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. | ||
642 | If N is 0, then set CURRENT to the empty location which ends | ||
643 | the previous symbol: RHS[0] (always defined). */ | ||
644 | |||
645 | #define YYRHSLOC(Rhs, K) ((Rhs)[K]) | ||
646 | #ifndef YYLLOC_DEFAULT | ||
647 | # define YYLLOC_DEFAULT(Current, Rhs, N) \ | ||
648 | do \ | ||
649 | if (YYID (N)) \ | ||
650 | { \ | ||
651 | (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ | ||
652 | (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ | ||
653 | (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ | ||
654 | (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ | ||
655 | } \ | ||
656 | else \ | ||
657 | { \ | ||
658 | (Current).first_line = (Current).last_line = \ | ||
659 | YYRHSLOC (Rhs, 0).last_line; \ | ||
660 | (Current).first_column = (Current).last_column = \ | ||
661 | YYRHSLOC (Rhs, 0).last_column; \ | ||
662 | } \ | ||
663 | while (YYID (0)) | ||
664 | #endif | ||
665 | |||
666 | |||
667 | /* YY_LOCATION_PRINT -- Print the location on the stream. | ||
668 | This macro was not mandated originally: define only if we know | ||
669 | we won't break user code: when these are the locations we know. */ | ||
670 | |||
671 | #ifndef YY_LOCATION_PRINT | ||
672 | # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL | ||
673 | # define YY_LOCATION_PRINT(File, Loc) \ | ||
674 | fprintf (File, "%d.%d-%d.%d", \ | ||
675 | (Loc).first_line, (Loc).first_column, \ | ||
676 | (Loc).last_line, (Loc).last_column) | ||
677 | # else | ||
678 | # define YY_LOCATION_PRINT(File, Loc) ((void) 0) | ||
679 | # endif | ||
680 | #endif | ||
681 | |||
682 | |||
683 | /* YYLEX -- calling `yylex' with the right arguments. */ | ||
684 | |||
685 | #ifdef YYLEX_PARAM | ||
686 | # define YYLEX yylex (YYLEX_PARAM) | ||
687 | #else | ||
688 | # define YYLEX yylex () | ||
689 | #endif | ||
690 | |||
691 | /* Enable debugging if requested. */ | ||
692 | #if YYDEBUG | ||
693 | |||
694 | # ifndef YYFPRINTF | ||
695 | # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ | ||
696 | # define YYFPRINTF fprintf | ||
697 | # endif | ||
698 | |||
699 | # define YYDPRINTF(Args) \ | ||
700 | do { \ | ||
701 | if (yydebug) \ | ||
702 | YYFPRINTF Args; \ | ||
703 | } while (YYID (0)) | ||
704 | |||
705 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ | ||
706 | do { \ | ||
707 | if (yydebug) \ | ||
708 | { \ | ||
709 | YYFPRINTF (stderr, "%s ", Title); \ | ||
710 | yy_symbol_print (stderr, \ | ||
711 | Type, Value, list, idx); \ | ||
712 | YYFPRINTF (stderr, "\n"); \ | ||
713 | } \ | ||
714 | } while (YYID (0)) | ||
715 | |||
716 | |||
717 | /*--------------------------------. | ||
718 | | Print this symbol on YYOUTPUT. | | ||
719 | `--------------------------------*/ | ||
720 | |||
721 | /*ARGSUSED*/ | ||
722 | #if (defined __STDC__ || defined __C99__FUNC__ \ | ||
723 | || defined __cplusplus || defined _MSC_VER) | ||
724 | static void | ||
725 | yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, struct list_head *list, int *idx) | ||
726 | #else | ||
727 | static void | ||
728 | yy_symbol_value_print (yyoutput, yytype, yyvaluep, list, idx) | ||
729 | FILE *yyoutput; | ||
730 | int yytype; | ||
731 | YYSTYPE const * const yyvaluep; | ||
732 | struct list_head *list; | ||
733 | int *idx; | ||
734 | #endif | ||
735 | { | ||
736 | if (!yyvaluep) | ||
737 | return; | ||
738 | YYUSE (list); | ||
739 | YYUSE (idx); | ||
740 | # ifdef YYPRINT | ||
741 | if (yytype < YYNTOKENS) | ||
742 | YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); | ||
743 | # else | ||
744 | YYUSE (yyoutput); | ||
745 | # endif | ||
746 | switch (yytype) | ||
747 | { | ||
748 | default: | ||
749 | break; | ||
750 | } | ||
751 | } | ||
752 | |||
753 | |||
754 | /*--------------------------------. | ||
755 | | Print this symbol on YYOUTPUT. | | ||
756 | `--------------------------------*/ | ||
757 | |||
758 | #if (defined __STDC__ || defined __C99__FUNC__ \ | ||
759 | || defined __cplusplus || defined _MSC_VER) | ||
760 | static void | ||
761 | yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, struct list_head *list, int *idx) | ||
762 | #else | ||
763 | static void | ||
764 | yy_symbol_print (yyoutput, yytype, yyvaluep, list, idx) | ||
765 | FILE *yyoutput; | ||
766 | int yytype; | ||
767 | YYSTYPE const * const yyvaluep; | ||
768 | struct list_head *list; | ||
769 | int *idx; | ||
770 | #endif | ||
771 | { | ||
772 | if (yytype < YYNTOKENS) | ||
773 | YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); | ||
774 | else | ||
775 | YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); | ||
776 | |||
777 | yy_symbol_value_print (yyoutput, yytype, yyvaluep, list, idx); | ||
778 | YYFPRINTF (yyoutput, ")"); | ||
779 | } | ||
780 | |||
781 | /*------------------------------------------------------------------. | ||
782 | | yy_stack_print -- Print the state stack from its BOTTOM up to its | | ||
783 | | TOP (included). | | ||
784 | `------------------------------------------------------------------*/ | ||
785 | |||
786 | #if (defined __STDC__ || defined __C99__FUNC__ \ | ||
787 | || defined __cplusplus || defined _MSC_VER) | ||
788 | static void | ||
789 | yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) | ||
790 | #else | ||
791 | static void | ||
792 | yy_stack_print (yybottom, yytop) | ||
793 | yytype_int16 *yybottom; | ||
794 | yytype_int16 *yytop; | ||
795 | #endif | ||
796 | { | ||
797 | YYFPRINTF (stderr, "Stack now"); | ||
798 | for (; yybottom <= yytop; yybottom++) | ||
799 | { | ||
800 | int yybot = *yybottom; | ||
801 | YYFPRINTF (stderr, " %d", yybot); | ||
802 | } | ||
803 | YYFPRINTF (stderr, "\n"); | ||
804 | } | ||
805 | |||
806 | # define YY_STACK_PRINT(Bottom, Top) \ | ||
807 | do { \ | ||
808 | if (yydebug) \ | ||
809 | yy_stack_print ((Bottom), (Top)); \ | ||
810 | } while (YYID (0)) | ||
811 | |||
812 | |||
813 | /*------------------------------------------------. | ||
814 | | Report that the YYRULE is going to be reduced. | | ||
815 | `------------------------------------------------*/ | ||
816 | |||
817 | #if (defined __STDC__ || defined __C99__FUNC__ \ | ||
818 | || defined __cplusplus || defined _MSC_VER) | ||
819 | static void | ||
820 | yy_reduce_print (YYSTYPE *yyvsp, int yyrule, struct list_head *list, int *idx) | ||
821 | #else | ||
822 | static void | ||
823 | yy_reduce_print (yyvsp, yyrule, list, idx) | ||
824 | YYSTYPE *yyvsp; | ||
825 | int yyrule; | ||
826 | struct list_head *list; | ||
827 | int *idx; | ||
828 | #endif | ||
829 | { | ||
830 | int yynrhs = yyr2[yyrule]; | ||
831 | int yyi; | ||
832 | unsigned long int yylno = yyrline[yyrule]; | ||
833 | YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", | ||
834 | yyrule - 1, yylno); | ||
835 | /* The symbols being reduced. */ | ||
836 | for (yyi = 0; yyi < yynrhs; yyi++) | ||
837 | { | ||
838 | YYFPRINTF (stderr, " $%d = ", yyi + 1); | ||
839 | yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], | ||
840 | &(yyvsp[(yyi + 1) - (yynrhs)]) | ||
841 | , list, idx); | ||
842 | YYFPRINTF (stderr, "\n"); | ||
843 | } | ||
844 | } | ||
845 | |||
846 | # define YY_REDUCE_PRINT(Rule) \ | ||
847 | do { \ | ||
848 | if (yydebug) \ | ||
849 | yy_reduce_print (yyvsp, Rule, list, idx); \ | ||
850 | } while (YYID (0)) | ||
851 | |||
852 | /* Nonzero means print parse trace. It is left uninitialized so that | ||
853 | multiple parsers can coexist. */ | ||
854 | int yydebug; | ||
855 | #else /* !YYDEBUG */ | ||
856 | # define YYDPRINTF(Args) | ||
857 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) | ||
858 | # define YY_STACK_PRINT(Bottom, Top) | ||
859 | # define YY_REDUCE_PRINT(Rule) | ||
860 | #endif /* !YYDEBUG */ | ||
861 | |||
862 | |||
863 | /* YYINITDEPTH -- initial size of the parser's stacks. */ | ||
864 | #ifndef YYINITDEPTH | ||
865 | # define YYINITDEPTH 200 | ||
866 | #endif | ||
867 | |||
868 | /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only | ||
869 | if the built-in stack extension method is used). | ||
870 | |||
871 | Do not make this value too large; the results are undefined if | ||
872 | YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) | ||
873 | evaluated with infinite-precision integer arithmetic. */ | ||
874 | |||
875 | #ifndef YYMAXDEPTH | ||
876 | # define YYMAXDEPTH 10000 | ||
877 | #endif | ||
878 | |||
879 | |||
880 | |||
881 | #if YYERROR_VERBOSE | ||
882 | |||
883 | # ifndef yystrlen | ||
884 | # if defined __GLIBC__ && defined _STRING_H | ||
885 | # define yystrlen strlen | ||
886 | # else | ||
887 | /* Return the length of YYSTR. */ | ||
888 | #if (defined __STDC__ || defined __C99__FUNC__ \ | ||
889 | || defined __cplusplus || defined _MSC_VER) | ||
890 | static YYSIZE_T | ||
891 | yystrlen (const char *yystr) | ||
892 | #else | ||
893 | static YYSIZE_T | ||
894 | yystrlen (yystr) | ||
895 | const char *yystr; | ||
896 | #endif | ||
897 | { | ||
898 | YYSIZE_T yylen; | ||
899 | for (yylen = 0; yystr[yylen]; yylen++) | ||
900 | continue; | ||
901 | return yylen; | ||
902 | } | ||
903 | # endif | ||
904 | # endif | ||
905 | |||
906 | # ifndef yystpcpy | ||
907 | # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE | ||
908 | # define yystpcpy stpcpy | ||
909 | # else | ||
910 | /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in | ||
911 | YYDEST. */ | ||
912 | #if (defined __STDC__ || defined __C99__FUNC__ \ | ||
913 | || defined __cplusplus || defined _MSC_VER) | ||
914 | static char * | ||
915 | yystpcpy (char *yydest, const char *yysrc) | ||
916 | #else | ||
917 | static char * | ||
918 | yystpcpy (yydest, yysrc) | ||
919 | char *yydest; | ||
920 | const char *yysrc; | ||
921 | #endif | ||
922 | { | ||
923 | char *yyd = yydest; | ||
924 | const char *yys = yysrc; | ||
925 | |||
926 | while ((*yyd++ = *yys++) != '\0') | ||
927 | continue; | ||
928 | |||
929 | return yyd - 1; | ||
930 | } | ||
931 | # endif | ||
932 | # endif | ||
933 | |||
934 | # ifndef yytnamerr | ||
935 | /* Copy to YYRES the contents of YYSTR after stripping away unnecessary | ||
936 | quotes and backslashes, so that it's suitable for yyerror. The | ||
937 | heuristic is that double-quoting is unnecessary unless the string | ||
938 | contains an apostrophe, a comma, or backslash (other than | ||
939 | backslash-backslash). YYSTR is taken from yytname. If YYRES is | ||
940 | null, do not copy; instead, return the length of what the result | ||
941 | would have been. */ | ||
942 | static YYSIZE_T | ||
943 | yytnamerr (char *yyres, const char *yystr) | ||
944 | { | ||
945 | if (*yystr == '"') | ||
946 | { | ||
947 | YYSIZE_T yyn = 0; | ||
948 | char const *yyp = yystr; | ||
949 | |||
950 | for (;;) | ||
951 | switch (*++yyp) | ||
952 | { | ||
953 | case '\'': | ||
954 | case ',': | ||
955 | goto do_not_strip_quotes; | ||
956 | |||
957 | case '\\': | ||
958 | if (*++yyp != '\\') | ||
959 | goto do_not_strip_quotes; | ||
960 | /* Fall through. */ | ||
961 | default: | ||
962 | if (yyres) | ||
963 | yyres[yyn] = *yyp; | ||
964 | yyn++; | ||
965 | break; | ||
966 | |||
967 | case '"': | ||
968 | if (yyres) | ||
969 | yyres[yyn] = '\0'; | ||
970 | return yyn; | ||
971 | } | ||
972 | do_not_strip_quotes: ; | ||
973 | } | ||
974 | |||
975 | if (! yyres) | ||
976 | return yystrlen (yystr); | ||
977 | |||
978 | return yystpcpy (yyres, yystr) - yyres; | ||
979 | } | ||
980 | # endif | ||
981 | |||
982 | /* Copy into YYRESULT an error message about the unexpected token | ||
983 | YYCHAR while in state YYSTATE. Return the number of bytes copied, | ||
984 | including the terminating null byte. If YYRESULT is null, do not | ||
985 | copy anything; just return the number of bytes that would be | ||
986 | copied. As a special case, return 0 if an ordinary "syntax error" | ||
987 | message will do. Return YYSIZE_MAXIMUM if overflow occurs during | ||
988 | size calculation. */ | ||
989 | static YYSIZE_T | ||
990 | yysyntax_error (char *yyresult, int yystate, int yychar) | ||
991 | { | ||
992 | int yyn = yypact[yystate]; | ||
993 | |||
994 | if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) | ||
995 | return 0; | ||
996 | else | ||
997 | { | ||
998 | int yytype = YYTRANSLATE (yychar); | ||
999 | YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); | ||
1000 | YYSIZE_T yysize = yysize0; | ||
1001 | YYSIZE_T yysize1; | ||
1002 | int yysize_overflow = 0; | ||
1003 | enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; | ||
1004 | char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; | ||
1005 | int yyx; | ||
1006 | |||
1007 | # if 0 | ||
1008 | /* This is so xgettext sees the translatable formats that are | ||
1009 | constructed on the fly. */ | ||
1010 | YY_("syntax error, unexpected %s"); | ||
1011 | YY_("syntax error, unexpected %s, expecting %s"); | ||
1012 | YY_("syntax error, unexpected %s, expecting %s or %s"); | ||
1013 | YY_("syntax error, unexpected %s, expecting %s or %s or %s"); | ||
1014 | YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); | ||
1015 | # endif | ||
1016 | char *yyfmt; | ||
1017 | char const *yyf; | ||
1018 | static char const yyunexpected[] = "syntax error, unexpected %s"; | ||
1019 | static char const yyexpecting[] = ", expecting %s"; | ||
1020 | static char const yyor[] = " or %s"; | ||
1021 | char yyformat[sizeof yyunexpected | ||
1022 | + sizeof yyexpecting - 1 | ||
1023 | + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) | ||
1024 | * (sizeof yyor - 1))]; | ||
1025 | char const *yyprefix = yyexpecting; | ||
1026 | |||
1027 | /* Start YYX at -YYN if negative to avoid negative indexes in | ||
1028 | YYCHECK. */ | ||
1029 | int yyxbegin = yyn < 0 ? -yyn : 0; | ||
1030 | |||
1031 | /* Stay within bounds of both yycheck and yytname. */ | ||
1032 | int yychecklim = YYLAST - yyn + 1; | ||
1033 | int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; | ||
1034 | int yycount = 1; | ||
1035 | |||
1036 | yyarg[0] = yytname[yytype]; | ||
1037 | yyfmt = yystpcpy (yyformat, yyunexpected); | ||
1038 | |||
1039 | for (yyx = yyxbegin; yyx < yyxend; ++yyx) | ||
1040 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) | ||
1041 | { | ||
1042 | if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) | ||
1043 | { | ||
1044 | yycount = 1; | ||
1045 | yysize = yysize0; | ||
1046 | yyformat[sizeof yyunexpected - 1] = '\0'; | ||
1047 | break; | ||
1048 | } | ||
1049 | yyarg[yycount++] = yytname[yyx]; | ||
1050 | yysize1 = yysize + yytnamerr (0, yytname[yyx]); | ||
1051 | yysize_overflow |= (yysize1 < yysize); | ||
1052 | yysize = yysize1; | ||
1053 | yyfmt = yystpcpy (yyfmt, yyprefix); | ||
1054 | yyprefix = yyor; | ||
1055 | } | ||
1056 | |||
1057 | yyf = YY_(yyformat); | ||
1058 | yysize1 = yysize + yystrlen (yyf); | ||
1059 | yysize_overflow |= (yysize1 < yysize); | ||
1060 | yysize = yysize1; | ||
1061 | |||
1062 | if (yysize_overflow) | ||
1063 | return YYSIZE_MAXIMUM; | ||
1064 | |||
1065 | if (yyresult) | ||
1066 | { | ||
1067 | /* Avoid sprintf, as that infringes on the user's name space. | ||
1068 | Don't have undefined behavior even if the translation | ||
1069 | produced a string with the wrong number of "%s"s. */ | ||
1070 | char *yyp = yyresult; | ||
1071 | int yyi = 0; | ||
1072 | while ((*yyp = *yyf) != '\0') | ||
1073 | { | ||
1074 | if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) | ||
1075 | { | ||
1076 | yyp += yytnamerr (yyp, yyarg[yyi++]); | ||
1077 | yyf += 2; | ||
1078 | } | ||
1079 | else | ||
1080 | { | ||
1081 | yyp++; | ||
1082 | yyf++; | ||
1083 | } | ||
1084 | } | ||
1085 | } | ||
1086 | return yysize; | ||
1087 | } | ||
1088 | } | ||
1089 | #endif /* YYERROR_VERBOSE */ | ||
1090 | |||
1091 | |||
1092 | /*-----------------------------------------------. | ||
1093 | | Release the memory associated to this symbol. | | ||
1094 | `-----------------------------------------------*/ | ||
1095 | |||
1096 | /*ARGSUSED*/ | ||
1097 | #if (defined __STDC__ || defined __C99__FUNC__ \ | ||
1098 | || defined __cplusplus || defined _MSC_VER) | ||
1099 | static void | ||
1100 | yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, struct list_head *list, int *idx) | ||
1101 | #else | ||
1102 | static void | ||
1103 | yydestruct (yymsg, yytype, yyvaluep, list, idx) | ||
1104 | const char *yymsg; | ||
1105 | int yytype; | ||
1106 | YYSTYPE *yyvaluep; | ||
1107 | struct list_head *list; | ||
1108 | int *idx; | ||
1109 | #endif | ||
1110 | { | ||
1111 | YYUSE (yyvaluep); | ||
1112 | YYUSE (list); | ||
1113 | YYUSE (idx); | ||
1114 | |||
1115 | if (!yymsg) | ||
1116 | yymsg = "Deleting"; | ||
1117 | YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); | ||
1118 | |||
1119 | switch (yytype) | ||
1120 | { | ||
1121 | |||
1122 | default: | ||
1123 | break; | ||
1124 | } | ||
1125 | } | ||
1126 | |||
1127 | /* Prevent warnings from -Wmissing-prototypes. */ | ||
1128 | #ifdef YYPARSE_PARAM | ||
1129 | #if defined __STDC__ || defined __cplusplus | ||
1130 | int yyparse (void *YYPARSE_PARAM); | ||
1131 | #else | ||
1132 | int yyparse (); | ||
1133 | #endif | ||
1134 | #else /* ! YYPARSE_PARAM */ | ||
1135 | #if defined __STDC__ || defined __cplusplus | ||
1136 | int yyparse (struct list_head *list, int *idx); | ||
1137 | #else | ||
1138 | int yyparse (); | ||
1139 | #endif | ||
1140 | #endif /* ! YYPARSE_PARAM */ | ||
1141 | |||
1142 | |||
1143 | /* The lookahead symbol. */ | ||
1144 | int yychar; | ||
1145 | |||
1146 | /* The semantic value of the lookahead symbol. */ | ||
1147 | YYSTYPE yylval; | ||
1148 | |||
1149 | /* Number of syntax errors so far. */ | ||
1150 | int yynerrs; | ||
1151 | |||
1152 | |||
1153 | |||
1154 | /*-------------------------. | ||
1155 | | yyparse or yypush_parse. | | ||
1156 | `-------------------------*/ | ||
1157 | |||
1158 | #ifdef YYPARSE_PARAM | ||
1159 | #if (defined __STDC__ || defined __C99__FUNC__ \ | ||
1160 | || defined __cplusplus || defined _MSC_VER) | ||
1161 | int | ||
1162 | yyparse (void *YYPARSE_PARAM) | ||
1163 | #else | ||
1164 | int | ||
1165 | yyparse (YYPARSE_PARAM) | ||
1166 | void *YYPARSE_PARAM; | ||
1167 | #endif | ||
1168 | #else /* ! YYPARSE_PARAM */ | ||
1169 | #if (defined __STDC__ || defined __C99__FUNC__ \ | ||
1170 | || defined __cplusplus || defined _MSC_VER) | ||
1171 | int | ||
1172 | yyparse (struct list_head *list, int *idx) | ||
1173 | #else | ||
1174 | int | ||
1175 | yyparse (list, idx) | ||
1176 | struct list_head *list; | ||
1177 | int *idx; | ||
1178 | #endif | ||
1179 | #endif | ||
1180 | { | ||
1181 | |||
1182 | |||
1183 | int yystate; | ||
1184 | /* Number of tokens to shift before error messages enabled. */ | ||
1185 | int yyerrstatus; | ||
1186 | |||
1187 | /* The stacks and their tools: | ||
1188 | `yyss': related to states. | ||
1189 | `yyvs': related to semantic values. | ||
1190 | |||
1191 | Refer to the stacks thru separate pointers, to allow yyoverflow | ||
1192 | to reallocate them elsewhere. */ | ||
1193 | |||
1194 | /* The state stack. */ | ||
1195 | yytype_int16 yyssa[YYINITDEPTH]; | ||
1196 | yytype_int16 *yyss; | ||
1197 | yytype_int16 *yyssp; | ||
1198 | |||
1199 | /* The semantic value stack. */ | ||
1200 | YYSTYPE yyvsa[YYINITDEPTH]; | ||
1201 | YYSTYPE *yyvs; | ||
1202 | YYSTYPE *yyvsp; | ||
1203 | |||
1204 | YYSIZE_T yystacksize; | ||
1205 | |||
1206 | int yyn; | ||
1207 | int yyresult; | ||
1208 | /* Lookahead token as an internal (translated) token number. */ | ||
1209 | int yytoken; | ||
1210 | /* The variables used to return semantic value and location from the | ||
1211 | action routines. */ | ||
1212 | YYSTYPE yyval; | ||
1213 | |||
1214 | #if YYERROR_VERBOSE | ||
1215 | /* Buffer for error messages, and its allocated size. */ | ||
1216 | char yymsgbuf[128]; | ||
1217 | char *yymsg = yymsgbuf; | ||
1218 | YYSIZE_T yymsg_alloc = sizeof yymsgbuf; | ||
1219 | #endif | ||
1220 | |||
1221 | #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) | ||
1222 | |||
1223 | /* The number of symbols on the RHS of the reduced rule. | ||
1224 | Keep to zero when no symbol should be popped. */ | ||
1225 | int yylen = 0; | ||
1226 | |||
1227 | yytoken = 0; | ||
1228 | yyss = yyssa; | ||
1229 | yyvs = yyvsa; | ||
1230 | yystacksize = YYINITDEPTH; | ||
1231 | |||
1232 | YYDPRINTF ((stderr, "Starting parse\n")); | ||
1233 | |||
1234 | yystate = 0; | ||
1235 | yyerrstatus = 0; | ||
1236 | yynerrs = 0; | ||
1237 | yychar = YYEMPTY; /* Cause a token to be read. */ | ||
1238 | |||
1239 | /* Initialize stack pointers. | ||
1240 | Waste one element of value and location stack | ||
1241 | so that they stay on the same level as the state stack. | ||
1242 | The wasted elements are never initialized. */ | ||
1243 | yyssp = yyss; | ||
1244 | yyvsp = yyvs; | ||
1245 | |||
1246 | goto yysetstate; | ||
1247 | |||
1248 | /*------------------------------------------------------------. | ||
1249 | | yynewstate -- Push a new state, which is found in yystate. | | ||
1250 | `------------------------------------------------------------*/ | ||
1251 | yynewstate: | ||
1252 | /* In all cases, when you get here, the value and location stacks | ||
1253 | have just been pushed. So pushing a state here evens the stacks. */ | ||
1254 | yyssp++; | ||
1255 | |||
1256 | yysetstate: | ||
1257 | *yyssp = yystate; | ||
1258 | |||
1259 | if (yyss + yystacksize - 1 <= yyssp) | ||
1260 | { | ||
1261 | /* Get the current used size of the three stacks, in elements. */ | ||
1262 | YYSIZE_T yysize = yyssp - yyss + 1; | ||
1263 | |||
1264 | #ifdef yyoverflow | ||
1265 | { | ||
1266 | /* Give user a chance to reallocate the stack. Use copies of | ||
1267 | these so that the &'s don't force the real ones into | ||
1268 | memory. */ | ||
1269 | YYSTYPE *yyvs1 = yyvs; | ||
1270 | yytype_int16 *yyss1 = yyss; | ||
1271 | |||
1272 | /* Each stack pointer address is followed by the size of the | ||
1273 | data in use in that stack, in bytes. This used to be a | ||
1274 | conditional around just the two extra args, but that might | ||
1275 | be undefined if yyoverflow is a macro. */ | ||
1276 | yyoverflow (YY_("memory exhausted"), | ||
1277 | &yyss1, yysize * sizeof (*yyssp), | ||
1278 | &yyvs1, yysize * sizeof (*yyvsp), | ||
1279 | &yystacksize); | ||
1280 | |||
1281 | yyss = yyss1; | ||
1282 | yyvs = yyvs1; | ||
1283 | } | ||
1284 | #else /* no yyoverflow */ | ||
1285 | # ifndef YYSTACK_RELOCATE | ||
1286 | goto yyexhaustedlab; | ||
1287 | # else | ||
1288 | /* Extend the stack our own way. */ | ||
1289 | if (YYMAXDEPTH <= yystacksize) | ||
1290 | goto yyexhaustedlab; | ||
1291 | yystacksize *= 2; | ||
1292 | if (YYMAXDEPTH < yystacksize) | ||
1293 | yystacksize = YYMAXDEPTH; | ||
1294 | |||
1295 | { | ||
1296 | yytype_int16 *yyss1 = yyss; | ||
1297 | union yyalloc *yyptr = | ||
1298 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); | ||
1299 | if (! yyptr) | ||
1300 | goto yyexhaustedlab; | ||
1301 | YYSTACK_RELOCATE (yyss_alloc, yyss); | ||
1302 | YYSTACK_RELOCATE (yyvs_alloc, yyvs); | ||
1303 | # undef YYSTACK_RELOCATE | ||
1304 | if (yyss1 != yyssa) | ||
1305 | YYSTACK_FREE (yyss1); | ||
1306 | } | ||
1307 | # endif | ||
1308 | #endif /* no yyoverflow */ | ||
1309 | |||
1310 | yyssp = yyss + yysize - 1; | ||
1311 | yyvsp = yyvs + yysize - 1; | ||
1312 | |||
1313 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", | ||
1314 | (unsigned long int) yystacksize)); | ||
1315 | |||
1316 | if (yyss + yystacksize - 1 <= yyssp) | ||
1317 | YYABORT; | ||
1318 | } | ||
1319 | |||
1320 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); | ||
1321 | |||
1322 | if (yystate == YYFINAL) | ||
1323 | YYACCEPT; | ||
1324 | |||
1325 | goto yybackup; | ||
1326 | |||
1327 | /*-----------. | ||
1328 | | yybackup. | | ||
1329 | `-----------*/ | ||
1330 | yybackup: | ||
1331 | |||
1332 | /* Do appropriate processing given the current state. Read a | ||
1333 | lookahead token if we need one and don't already have one. */ | ||
1334 | |||
1335 | /* First try to decide what to do without reference to lookahead token. */ | ||
1336 | yyn = yypact[yystate]; | ||
1337 | if (yyn == YYPACT_NINF) | ||
1338 | goto yydefault; | ||
1339 | |||
1340 | /* Not known => get a lookahead token if don't already have one. */ | ||
1341 | |||
1342 | /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ | ||
1343 | if (yychar == YYEMPTY) | ||
1344 | { | ||
1345 | YYDPRINTF ((stderr, "Reading a token: ")); | ||
1346 | yychar = YYLEX; | ||
1347 | } | ||
1348 | |||
1349 | if (yychar <= YYEOF) | ||
1350 | { | ||
1351 | yychar = yytoken = YYEOF; | ||
1352 | YYDPRINTF ((stderr, "Now at end of input.\n")); | ||
1353 | } | ||
1354 | else | ||
1355 | { | ||
1356 | yytoken = YYTRANSLATE (yychar); | ||
1357 | YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); | ||
1358 | } | ||
1359 | |||
1360 | /* If the proper action on seeing token YYTOKEN is to reduce or to | ||
1361 | detect an error, take that action. */ | ||
1362 | yyn += yytoken; | ||
1363 | if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) | ||
1364 | goto yydefault; | ||
1365 | yyn = yytable[yyn]; | ||
1366 | if (yyn <= 0) | ||
1367 | { | ||
1368 | if (yyn == 0 || yyn == YYTABLE_NINF) | ||
1369 | goto yyerrlab; | ||
1370 | yyn = -yyn; | ||
1371 | goto yyreduce; | ||
1372 | } | ||
1373 | |||
1374 | /* Count tokens shifted since error; after three, turn off error | ||
1375 | status. */ | ||
1376 | if (yyerrstatus) | ||
1377 | yyerrstatus--; | ||
1378 | |||
1379 | /* Shift the lookahead token. */ | ||
1380 | YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); | ||
1381 | |||
1382 | /* Discard the shifted token. */ | ||
1383 | yychar = YYEMPTY; | ||
1384 | |||
1385 | yystate = yyn; | ||
1386 | *++yyvsp = yylval; | ||
1387 | |||
1388 | goto yynewstate; | ||
1389 | |||
1390 | |||
1391 | /*-----------------------------------------------------------. | ||
1392 | | yydefault -- do the default action for the current state. | | ||
1393 | `-----------------------------------------------------------*/ | ||
1394 | yydefault: | ||
1395 | yyn = yydefact[yystate]; | ||
1396 | if (yyn == 0) | ||
1397 | goto yyerrlab; | ||
1398 | goto yyreduce; | ||
1399 | |||
1400 | |||
1401 | /*-----------------------------. | ||
1402 | | yyreduce -- Do a reduction. | | ||
1403 | `-----------------------------*/ | ||
1404 | yyreduce: | ||
1405 | /* yyn is the number of a rule to reduce with. */ | ||
1406 | yylen = yyr2[yyn]; | ||
1407 | |||
1408 | /* If YYLEN is nonzero, implement the default value of the action: | ||
1409 | `$$ = $1'. | ||
1410 | |||
1411 | Otherwise, the following line sets YYVAL to garbage. | ||
1412 | This behavior is undocumented and Bison | ||
1413 | users should not rely upon it. Assigning to YYVAL | ||
1414 | unconditionally makes the parser a bit smaller, and it avoids a | ||
1415 | GCC warning that YYVAL may be used uninitialized. */ | ||
1416 | yyval = yyvsp[1-yylen]; | ||
1417 | |||
1418 | |||
1419 | YY_REDUCE_PRINT (yyn); | ||
1420 | switch (yyn) | ||
1421 | { | ||
1422 | case 4: | ||
1423 | |||
1424 | /* Line 1464 of yacc.c */ | ||
1425 | #line 58 "util/parse-events.y" | ||
1426 | { | ||
1427 | ABORT_ON(parse_events_modifier(list, (yyvsp[(2) - (2)].str))); | ||
1428 | ;} | ||
1429 | break; | ||
1430 | |||
1431 | case 13: | ||
1432 | |||
1433 | /* Line 1464 of yacc.c */ | ||
1434 | #line 74 "util/parse-events.y" | ||
1435 | { | ||
1436 | ABORT_ON(parse_events_add_pmu(list, idx, (yyvsp[(1) - (4)].str), (yyvsp[(3) - (4)].head))); | ||
1437 | parse_events__free_terms((yyvsp[(3) - (4)].head)); | ||
1438 | ;} | ||
1439 | break; | ||
1440 | |||
1441 | case 14: | ||
1442 | |||
1443 | /* Line 1464 of yacc.c */ | ||
1444 | #line 81 "util/parse-events.y" | ||
1445 | { | ||
1446 | int type = (yyvsp[(1) - (4)].num) >> 16; | ||
1447 | int config = (yyvsp[(1) - (4)].num) & 255; | ||
1448 | |||
1449 | ABORT_ON(parse_events_add_numeric(list, idx, type, config, (yyvsp[(3) - (4)].head))); | ||
1450 | parse_events__free_terms((yyvsp[(3) - (4)].head)); | ||
1451 | ;} | ||
1452 | break; | ||
1453 | |||
1454 | case 15: | ||
1455 | |||
1456 | /* Line 1464 of yacc.c */ | ||
1457 | #line 90 "util/parse-events.y" | ||
1458 | { | ||
1459 | int type = (yyvsp[(1) - (2)].num) >> 16; | ||
1460 | int config = (yyvsp[(1) - (2)].num) & 255; | ||
1461 | |||
1462 | ABORT_ON(parse_events_add_numeric(list, idx, type, config, NULL)); | ||
1463 | ;} | ||
1464 | break; | ||
1465 | |||
1466 | case 16: | ||
1467 | |||
1468 | /* Line 1464 of yacc.c */ | ||
1469 | #line 99 "util/parse-events.y" | ||
1470 | { | ||
1471 | ABORT_ON(parse_events_add_cache(list, idx, (yyvsp[(1) - (5)].str), (yyvsp[(3) - (5)].str), (yyvsp[(5) - (5)].str))); | ||
1472 | ;} | ||
1473 | break; | ||
1474 | |||
1475 | case 17: | ||
1476 | |||
1477 | /* Line 1464 of yacc.c */ | ||
1478 | #line 104 "util/parse-events.y" | ||
1479 | { | ||
1480 | ABORT_ON(parse_events_add_cache(list, idx, (yyvsp[(1) - (3)].str), (yyvsp[(3) - (3)].str), NULL)); | ||
1481 | ;} | ||
1482 | break; | ||
1483 | |||
1484 | case 18: | ||
1485 | |||
1486 | /* Line 1464 of yacc.c */ | ||
1487 | #line 109 "util/parse-events.y" | ||
1488 | { | ||
1489 | ABORT_ON(parse_events_add_cache(list, idx, (yyvsp[(1) - (1)].str), NULL, NULL)); | ||
1490 | ;} | ||
1491 | break; | ||
1492 | |||
1493 | case 19: | ||
1494 | |||
1495 | /* Line 1464 of yacc.c */ | ||
1496 | #line 115 "util/parse-events.y" | ||
1497 | { | ||
1498 | ABORT_ON(parse_events_add_breakpoint(list, idx, (void *) (yyvsp[(2) - (5)].num), (yyvsp[(4) - (5)].str))); | ||
1499 | ;} | ||
1500 | break; | ||
1501 | |||
1502 | case 20: | ||
1503 | |||
1504 | /* Line 1464 of yacc.c */ | ||
1505 | #line 120 "util/parse-events.y" | ||
1506 | { | ||
1507 | ABORT_ON(parse_events_add_breakpoint(list, idx, (void *) (yyvsp[(2) - (3)].num), NULL)); | ||
1508 | ;} | ||
1509 | break; | ||
1510 | |||
1511 | case 21: | ||
1512 | |||
1513 | /* Line 1464 of yacc.c */ | ||
1514 | #line 126 "util/parse-events.y" | ||
1515 | { | ||
1516 | ABORT_ON(parse_events_add_tracepoint(list, idx, (yyvsp[(1) - (3)].str), (yyvsp[(3) - (3)].str))); | ||
1517 | ;} | ||
1518 | break; | ||
1519 | |||
1520 | case 22: | ||
1521 | |||
1522 | /* Line 1464 of yacc.c */ | ||
1523 | #line 132 "util/parse-events.y" | ||
1524 | { | ||
1525 | ABORT_ON(parse_events_add_numeric(list, idx, (yyvsp[(1) - (3)].num), (yyvsp[(3) - (3)].num), NULL)); | ||
1526 | ;} | ||
1527 | break; | ||
1528 | |||
1529 | case 23: | ||
1530 | |||
1531 | /* Line 1464 of yacc.c */ | ||
1532 | #line 138 "util/parse-events.y" | ||
1533 | { | ||
1534 | ABORT_ON(parse_events_add_numeric(list, idx, PERF_TYPE_RAW, (yyvsp[(1) - (1)].num), NULL)); | ||
1535 | ;} | ||
1536 | break; | ||
1537 | |||
1538 | case 24: | ||
1539 | |||
1540 | /* Line 1464 of yacc.c */ | ||
1541 | #line 144 "util/parse-events.y" | ||
1542 | { | ||
1543 | struct list_head *head = (yyvsp[(1) - (3)].head); | ||
1544 | struct parse_events__term *term = (yyvsp[(3) - (3)].term); | ||
1545 | |||
1546 | ABORT_ON(!head); | ||
1547 | list_add_tail(&term->list, head); | ||
1548 | (yyval.head) = (yyvsp[(1) - (3)].head); | ||
1549 | ;} | ||
1550 | break; | ||
1551 | |||
1552 | case 25: | ||
1553 | |||
1554 | /* Line 1464 of yacc.c */ | ||
1555 | #line 154 "util/parse-events.y" | ||
1556 | { | ||
1557 | struct list_head *head = malloc(sizeof(*head)); | ||
1558 | struct parse_events__term *term = (yyvsp[(1) - (1)].term); | ||
1559 | |||
1560 | ABORT_ON(!head); | ||
1561 | INIT_LIST_HEAD(head); | ||
1562 | list_add_tail(&term->list, head); | ||
1563 | (yyval.head) = head; | ||
1564 | ;} | ||
1565 | break; | ||
1566 | |||
1567 | case 26: | ||
1568 | |||
1569 | /* Line 1464 of yacc.c */ | ||
1570 | #line 166 "util/parse-events.y" | ||
1571 | { | ||
1572 | struct parse_events__term *term; | ||
1573 | |||
1574 | ABORT_ON(parse_events__new_term(&term, PARSE_EVENTS__TERM_TYPE_STR, | ||
1575 | (yyvsp[(1) - (3)].str), (yyvsp[(3) - (3)].str), 0)); | ||
1576 | (yyval.term) = term; | ||
1577 | ;} | ||
1578 | break; | ||
1579 | |||
1580 | case 27: | ||
1581 | |||
1582 | /* Line 1464 of yacc.c */ | ||
1583 | #line 175 "util/parse-events.y" | ||
1584 | { | ||
1585 | struct parse_events__term *term; | ||
1586 | |||
1587 | ABORT_ON(parse_events__new_term(&term, PARSE_EVENTS__TERM_TYPE_NUM, | ||
1588 | (yyvsp[(1) - (3)].str), NULL, (yyvsp[(3) - (3)].num))); | ||
1589 | (yyval.term) = term; | ||
1590 | ;} | ||
1591 | break; | ||
1592 | |||
1593 | case 28: | ||
1594 | |||
1595 | /* Line 1464 of yacc.c */ | ||
1596 | #line 184 "util/parse-events.y" | ||
1597 | { | ||
1598 | struct parse_events__term *term; | ||
1599 | |||
1600 | ABORT_ON(parse_events__new_term(&term, PARSE_EVENTS__TERM_TYPE_NUM, | ||
1601 | (yyvsp[(1) - (1)].str), NULL, 1)); | ||
1602 | (yyval.term) = term; | ||
1603 | ;} | ||
1604 | break; | ||
1605 | |||
1606 | case 29: | ||
1607 | |||
1608 | /* Line 1464 of yacc.c */ | ||
1609 | #line 193 "util/parse-events.y" | ||
1610 | { | ||
1611 | struct parse_events__term *term; | ||
1612 | |||
1613 | ABORT_ON(parse_events__new_term(&term, (yyvsp[(1) - (3)].num), NULL, NULL, (yyvsp[(3) - (3)].num))); | ||
1614 | (yyval.term) = term; | ||
1615 | ;} | ||
1616 | break; | ||
1617 | |||
1618 | case 30: | ||
1619 | |||
1620 | /* Line 1464 of yacc.c */ | ||
1621 | #line 201 "util/parse-events.y" | ||
1622 | { | ||
1623 | struct parse_events__term *term; | ||
1624 | |||
1625 | ABORT_ON(parse_events__new_term(&term, (yyvsp[(1) - (1)].num), NULL, NULL, 1)); | ||
1626 | (yyval.term) = term; | ||
1627 | ;} | ||
1628 | break; | ||
1629 | |||
1630 | |||
1631 | |||
1632 | /* Line 1464 of yacc.c */ | ||
1633 | #line 1634 "util/parse-events-bison.c" | ||
1634 | default: break; | ||
1635 | } | ||
1636 | YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); | ||
1637 | |||
1638 | YYPOPSTACK (yylen); | ||
1639 | yylen = 0; | ||
1640 | YY_STACK_PRINT (yyss, yyssp); | ||
1641 | |||
1642 | *++yyvsp = yyval; | ||
1643 | |||
1644 | /* Now `shift' the result of the reduction. Determine what state | ||
1645 | that goes to, based on the state we popped back to and the rule | ||
1646 | number reduced by. */ | ||
1647 | |||
1648 | yyn = yyr1[yyn]; | ||
1649 | |||
1650 | yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; | ||
1651 | if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) | ||
1652 | yystate = yytable[yystate]; | ||
1653 | else | ||
1654 | yystate = yydefgoto[yyn - YYNTOKENS]; | ||
1655 | |||
1656 | goto yynewstate; | ||
1657 | |||
1658 | |||
1659 | /*------------------------------------. | ||
1660 | | yyerrlab -- here on detecting error | | ||
1661 | `------------------------------------*/ | ||
1662 | yyerrlab: | ||
1663 | /* If not already recovering from an error, report this error. */ | ||
1664 | if (!yyerrstatus) | ||
1665 | { | ||
1666 | ++yynerrs; | ||
1667 | #if ! YYERROR_VERBOSE | ||
1668 | yyerror (list, idx, YY_("syntax error")); | ||
1669 | #else | ||
1670 | { | ||
1671 | YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); | ||
1672 | if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) | ||
1673 | { | ||
1674 | YYSIZE_T yyalloc = 2 * yysize; | ||
1675 | if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) | ||
1676 | yyalloc = YYSTACK_ALLOC_MAXIMUM; | ||
1677 | if (yymsg != yymsgbuf) | ||
1678 | YYSTACK_FREE (yymsg); | ||
1679 | yymsg = (char *) YYSTACK_ALLOC (yyalloc); | ||
1680 | if (yymsg) | ||
1681 | yymsg_alloc = yyalloc; | ||
1682 | else | ||
1683 | { | ||
1684 | yymsg = yymsgbuf; | ||
1685 | yymsg_alloc = sizeof yymsgbuf; | ||
1686 | } | ||
1687 | } | ||
1688 | |||
1689 | if (0 < yysize && yysize <= yymsg_alloc) | ||
1690 | { | ||
1691 | (void) yysyntax_error (yymsg, yystate, yychar); | ||
1692 | yyerror (list, idx, yymsg); | ||
1693 | } | ||
1694 | else | ||
1695 | { | ||
1696 | yyerror (list, idx, YY_("syntax error")); | ||
1697 | if (yysize != 0) | ||
1698 | goto yyexhaustedlab; | ||
1699 | } | ||
1700 | } | ||
1701 | #endif | ||
1702 | } | ||
1703 | |||
1704 | |||
1705 | |||
1706 | if (yyerrstatus == 3) | ||
1707 | { | ||
1708 | /* If just tried and failed to reuse lookahead token after an | ||
1709 | error, discard it. */ | ||
1710 | |||
1711 | if (yychar <= YYEOF) | ||
1712 | { | ||
1713 | /* Return failure if at end of input. */ | ||
1714 | if (yychar == YYEOF) | ||
1715 | YYABORT; | ||
1716 | } | ||
1717 | else | ||
1718 | { | ||
1719 | yydestruct ("Error: discarding", | ||
1720 | yytoken, &yylval, list, idx); | ||
1721 | yychar = YYEMPTY; | ||
1722 | } | ||
1723 | } | ||
1724 | |||
1725 | /* Else will try to reuse lookahead token after shifting the error | ||
1726 | token. */ | ||
1727 | goto yyerrlab1; | ||
1728 | |||
1729 | |||
1730 | /*---------------------------------------------------. | ||
1731 | | yyerrorlab -- error raised explicitly by YYERROR. | | ||
1732 | `---------------------------------------------------*/ | ||
1733 | yyerrorlab: | ||
1734 | |||
1735 | /* Pacify compilers like GCC when the user code never invokes | ||
1736 | YYERROR and the label yyerrorlab therefore never appears in user | ||
1737 | code. */ | ||
1738 | if (/*CONSTCOND*/ 0) | ||
1739 | goto yyerrorlab; | ||
1740 | |||
1741 | /* Do not reclaim the symbols of the rule which action triggered | ||
1742 | this YYERROR. */ | ||
1743 | YYPOPSTACK (yylen); | ||
1744 | yylen = 0; | ||
1745 | YY_STACK_PRINT (yyss, yyssp); | ||
1746 | yystate = *yyssp; | ||
1747 | goto yyerrlab1; | ||
1748 | |||
1749 | |||
1750 | /*-------------------------------------------------------------. | ||
1751 | | yyerrlab1 -- common code for both syntax error and YYERROR. | | ||
1752 | `-------------------------------------------------------------*/ | ||
1753 | yyerrlab1: | ||
1754 | yyerrstatus = 3; /* Each real token shifted decrements this. */ | ||
1755 | |||
1756 | for (;;) | ||
1757 | { | ||
1758 | yyn = yypact[yystate]; | ||
1759 | if (yyn != YYPACT_NINF) | ||
1760 | { | ||
1761 | yyn += YYTERROR; | ||
1762 | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) | ||
1763 | { | ||
1764 | yyn = yytable[yyn]; | ||
1765 | if (0 < yyn) | ||
1766 | break; | ||
1767 | } | ||
1768 | } | ||
1769 | |||
1770 | /* Pop the current state because it cannot handle the error token. */ | ||
1771 | if (yyssp == yyss) | ||
1772 | YYABORT; | ||
1773 | |||
1774 | |||
1775 | yydestruct ("Error: popping", | ||
1776 | yystos[yystate], yyvsp, list, idx); | ||
1777 | YYPOPSTACK (1); | ||
1778 | yystate = *yyssp; | ||
1779 | YY_STACK_PRINT (yyss, yyssp); | ||
1780 | } | ||
1781 | |||
1782 | *++yyvsp = yylval; | ||
1783 | |||
1784 | |||
1785 | /* Shift the error token. */ | ||
1786 | YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); | ||
1787 | |||
1788 | yystate = yyn; | ||
1789 | goto yynewstate; | ||
1790 | |||
1791 | |||
1792 | /*-------------------------------------. | ||
1793 | | yyacceptlab -- YYACCEPT comes here. | | ||
1794 | `-------------------------------------*/ | ||
1795 | yyacceptlab: | ||
1796 | yyresult = 0; | ||
1797 | goto yyreturn; | ||
1798 | |||
1799 | /*-----------------------------------. | ||
1800 | | yyabortlab -- YYABORT comes here. | | ||
1801 | `-----------------------------------*/ | ||
1802 | yyabortlab: | ||
1803 | yyresult = 1; | ||
1804 | goto yyreturn; | ||
1805 | |||
1806 | #if !defined(yyoverflow) || YYERROR_VERBOSE | ||
1807 | /*-------------------------------------------------. | ||
1808 | | yyexhaustedlab -- memory exhaustion comes here. | | ||
1809 | `-------------------------------------------------*/ | ||
1810 | yyexhaustedlab: | ||
1811 | yyerror (list, idx, YY_("memory exhausted")); | ||
1812 | yyresult = 2; | ||
1813 | /* Fall through. */ | ||
1814 | #endif | ||
1815 | |||
1816 | yyreturn: | ||
1817 | if (yychar != YYEMPTY) | ||
1818 | yydestruct ("Cleanup: discarding lookahead", | ||
1819 | yytoken, &yylval, list, idx); | ||
1820 | /* Do not reclaim the symbols of the rule which action triggered | ||
1821 | this YYABORT or YYACCEPT. */ | ||
1822 | YYPOPSTACK (yylen); | ||
1823 | YY_STACK_PRINT (yyss, yyssp); | ||
1824 | while (yyssp != yyss) | ||
1825 | { | ||
1826 | yydestruct ("Cleanup: popping", | ||
1827 | yystos[*yyssp], yyvsp, list, idx); | ||
1828 | YYPOPSTACK (1); | ||
1829 | } | ||
1830 | #ifndef yyoverflow | ||
1831 | if (yyss != yyssa) | ||
1832 | YYSTACK_FREE (yyss); | ||
1833 | #endif | ||
1834 | #if YYERROR_VERBOSE | ||
1835 | if (yymsg != yymsgbuf) | ||
1836 | YYSTACK_FREE (yymsg); | ||
1837 | #endif | ||
1838 | /* Make sure YYID is used. */ | ||
1839 | return YYID (yyresult); | ||
1840 | } | ||
1841 | |||
1842 | |||
1843 | |||
1844 | /* Line 1684 of yacc.c */ | ||
1845 | #line 212 "util/parse-events.y" | ||
1846 | |||
1847 | |||
1848 | void parse_events_error(struct list_head *list __used, int *idx __used, | ||
1849 | char const *msg __used) | ||
1850 | { | ||
1851 | } | ||
1852 | |||
diff --git a/tools/perf/util/parse-events-bison.h b/tools/perf/util/parse-events-bison.h deleted file mode 100644 index c58b76584f92..000000000000 --- a/tools/perf/util/parse-events-bison.h +++ /dev/null | |||
@@ -1,82 +0,0 @@ | |||
1 | /* A Bison parser, made by GNU Bison 2.4.3. */ | ||
2 | |||
3 | /* Skeleton interface for Bison's Yacc-like parsers in C | ||
4 | |||
5 | Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006, | ||
6 | 2009, 2010 Free Software Foundation, Inc. | ||
7 | |||
8 | This program is free software: you can redistribute it and/or modify | ||
9 | it under the terms of the GNU General Public License as published by | ||
10 | the Free Software Foundation, either version 3 of the License, or | ||
11 | (at your option) any later version. | ||
12 | |||
13 | This program is distributed in the hope that it will be useful, | ||
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | GNU General Public License for more details. | ||
17 | |||
18 | You should have received a copy of the GNU General Public License | ||
19 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | ||
20 | |||
21 | /* As a special exception, you may create a larger work that contains | ||
22 | part or all of the Bison parser skeleton and distribute that work | ||
23 | under terms of your choice, so long as that work isn't itself a | ||
24 | parser generator using the skeleton or a modified version thereof | ||
25 | as a parser skeleton. Alternatively, if you modify or redistribute | ||
26 | the parser skeleton itself, you may (at your option) remove this | ||
27 | special exception, which will cause the skeleton and the resulting | ||
28 | Bison output files to be licensed under the GNU General Public | ||
29 | License without this special exception. | ||
30 | |||
31 | This special exception was added by the Free Software Foundation in | ||
32 | version 2.2 of Bison. */ | ||
33 | |||
34 | |||
35 | /* Tokens. */ | ||
36 | #ifndef YYTOKENTYPE | ||
37 | # define YYTOKENTYPE | ||
38 | /* Put the tokens into the symbol table, so that GDB and other debuggers | ||
39 | know about them. */ | ||
40 | enum yytokentype { | ||
41 | PE_VALUE = 258, | ||
42 | PE_VALUE_SYM = 259, | ||
43 | PE_RAW = 260, | ||
44 | PE_TERM = 261, | ||
45 | PE_NAME = 262, | ||
46 | PE_MODIFIER_EVENT = 263, | ||
47 | PE_MODIFIER_BP = 264, | ||
48 | PE_NAME_CACHE_TYPE = 265, | ||
49 | PE_NAME_CACHE_OP_RESULT = 266, | ||
50 | PE_PREFIX_MEM = 267, | ||
51 | PE_PREFIX_RAW = 268, | ||
52 | PE_ERROR = 269 | ||
53 | }; | ||
54 | #endif | ||
55 | |||
56 | |||
57 | |||
58 | #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED | ||
59 | typedef union YYSTYPE | ||
60 | { | ||
61 | |||
62 | /* Line 1685 of yacc.c */ | ||
63 | #line 45 "util/parse-events.y" | ||
64 | |||
65 | char *str; | ||
66 | unsigned long num; | ||
67 | struct list_head *head; | ||
68 | struct parse_events__term *term; | ||
69 | |||
70 | |||
71 | |||
72 | /* Line 1685 of yacc.c */ | ||
73 | #line 74 "util/parse-events-bison.h" | ||
74 | } YYSTYPE; | ||
75 | # define YYSTYPE_IS_TRIVIAL 1 | ||
76 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ | ||
77 | # define YYSTYPE_IS_DECLARED 1 | ||
78 | #endif | ||
79 | |||
80 | extern YYSTYPE parse_events_lval; | ||
81 | |||
82 | |||
diff --git a/tools/perf/util/parse-events-flex.c b/tools/perf/util/parse-events-flex.c deleted file mode 100644 index 34cfc85c4f79..000000000000 --- a/tools/perf/util/parse-events-flex.c +++ /dev/null | |||
@@ -1,2272 +0,0 @@ | |||
1 | |||
2 | #line 3 "<stdout>" | ||
3 | |||
4 | #define YY_INT_ALIGNED short int | ||
5 | |||
6 | /* A lexical scanner generated by flex */ | ||
7 | |||
8 | #define yy_create_buffer parse_events__create_buffer | ||
9 | #define yy_delete_buffer parse_events__delete_buffer | ||
10 | #define yy_flex_debug parse_events__flex_debug | ||
11 | #define yy_init_buffer parse_events__init_buffer | ||
12 | #define yy_flush_buffer parse_events__flush_buffer | ||
13 | #define yy_load_buffer_state parse_events__load_buffer_state | ||
14 | #define yy_switch_to_buffer parse_events__switch_to_buffer | ||
15 | #define yyin parse_events_in | ||
16 | #define yyleng parse_events_leng | ||
17 | #define yylex parse_events_lex | ||
18 | #define yylineno parse_events_lineno | ||
19 | #define yyout parse_events_out | ||
20 | #define yyrestart parse_events_restart | ||
21 | #define yytext parse_events_text | ||
22 | #define yywrap parse_events_wrap | ||
23 | #define yyalloc parse_events_alloc | ||
24 | #define yyrealloc parse_events_realloc | ||
25 | #define yyfree parse_events_free | ||
26 | |||
27 | #define FLEX_SCANNER | ||
28 | #define YY_FLEX_MAJOR_VERSION 2 | ||
29 | #define YY_FLEX_MINOR_VERSION 5 | ||
30 | #define YY_FLEX_SUBMINOR_VERSION 35 | ||
31 | #if YY_FLEX_SUBMINOR_VERSION > 0 | ||
32 | #define FLEX_BETA | ||
33 | #endif | ||
34 | |||
35 | /* First, we deal with platform-specific or compiler-specific issues. */ | ||
36 | |||
37 | /* begin standard C headers. */ | ||
38 | #include <stdio.h> | ||
39 | #include <string.h> | ||
40 | #include <errno.h> | ||
41 | #include <stdlib.h> | ||
42 | |||
43 | /* end standard C headers. */ | ||
44 | |||
45 | /* flex integer type definitions */ | ||
46 | |||
47 | #ifndef FLEXINT_H | ||
48 | #define FLEXINT_H | ||
49 | |||
50 | /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ | ||
51 | |||
52 | #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L | ||
53 | |||
54 | /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, | ||
55 | * if you want the limit (max/min) macros for int types. | ||
56 | */ | ||
57 | #ifndef __STDC_LIMIT_MACROS | ||
58 | #define __STDC_LIMIT_MACROS 1 | ||
59 | #endif | ||
60 | |||
61 | #include <inttypes.h> | ||
62 | typedef int8_t flex_int8_t; | ||
63 | typedef uint8_t flex_uint8_t; | ||
64 | typedef int16_t flex_int16_t; | ||
65 | typedef uint16_t flex_uint16_t; | ||
66 | typedef int32_t flex_int32_t; | ||
67 | typedef uint32_t flex_uint32_t; | ||
68 | #else | ||
69 | typedef signed char flex_int8_t; | ||
70 | typedef short int flex_int16_t; | ||
71 | typedef int flex_int32_t; | ||
72 | typedef unsigned char flex_uint8_t; | ||
73 | typedef unsigned short int flex_uint16_t; | ||
74 | typedef unsigned int flex_uint32_t; | ||
75 | #endif /* ! C99 */ | ||
76 | |||
77 | /* Limits of integral types. */ | ||
78 | #ifndef INT8_MIN | ||
79 | #define INT8_MIN (-128) | ||
80 | #endif | ||
81 | #ifndef INT16_MIN | ||
82 | #define INT16_MIN (-32767-1) | ||
83 | #endif | ||
84 | #ifndef INT32_MIN | ||
85 | #define INT32_MIN (-2147483647-1) | ||
86 | #endif | ||
87 | #ifndef INT8_MAX | ||
88 | #define INT8_MAX (127) | ||
89 | #endif | ||
90 | #ifndef INT16_MAX | ||
91 | #define INT16_MAX (32767) | ||
92 | #endif | ||
93 | #ifndef INT32_MAX | ||
94 | #define INT32_MAX (2147483647) | ||
95 | #endif | ||
96 | #ifndef UINT8_MAX | ||
97 | #define UINT8_MAX (255U) | ||
98 | #endif | ||
99 | #ifndef UINT16_MAX | ||
100 | #define UINT16_MAX (65535U) | ||
101 | #endif | ||
102 | #ifndef UINT32_MAX | ||
103 | #define UINT32_MAX (4294967295U) | ||
104 | #endif | ||
105 | |||
106 | #endif /* ! FLEXINT_H */ | ||
107 | |||
108 | #ifdef __cplusplus | ||
109 | |||
110 | /* The "const" storage-class-modifier is valid. */ | ||
111 | #define YY_USE_CONST | ||
112 | |||
113 | #else /* ! __cplusplus */ | ||
114 | |||
115 | /* C99 requires __STDC__ to be defined as 1. */ | ||
116 | #if defined (__STDC__) | ||
117 | |||
118 | #define YY_USE_CONST | ||
119 | |||
120 | #endif /* defined (__STDC__) */ | ||
121 | #endif /* ! __cplusplus */ | ||
122 | |||
123 | #ifdef YY_USE_CONST | ||
124 | #define yyconst const | ||
125 | #else | ||
126 | #define yyconst | ||
127 | #endif | ||
128 | |||
129 | /* Returned upon end-of-file. */ | ||
130 | #define YY_NULL 0 | ||
131 | |||
132 | /* Promotes a possibly negative, possibly signed char to an unsigned | ||
133 | * integer for use as an array index. If the signed char is negative, | ||
134 | * we want to instead treat it as an 8-bit unsigned char, hence the | ||
135 | * double cast. | ||
136 | */ | ||
137 | #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) | ||
138 | |||
139 | /* Enter a start condition. This macro really ought to take a parameter, | ||
140 | * but we do it the disgusting crufty way forced on us by the ()-less | ||
141 | * definition of BEGIN. | ||
142 | */ | ||
143 | #define BEGIN (yy_start) = 1 + 2 * | ||
144 | |||
145 | /* Translate the current start state into a value that can be later handed | ||
146 | * to BEGIN to return to the state. The YYSTATE alias is for lex | ||
147 | * compatibility. | ||
148 | */ | ||
149 | #define YY_START (((yy_start) - 1) / 2) | ||
150 | #define YYSTATE YY_START | ||
151 | |||
152 | /* Action number for EOF rule of a given start state. */ | ||
153 | #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) | ||
154 | |||
155 | /* Special action meaning "start processing a new file". */ | ||
156 | #define YY_NEW_FILE parse_events_restart(parse_events_in ) | ||
157 | |||
158 | #define YY_END_OF_BUFFER_CHAR 0 | ||
159 | |||
160 | /* Size of default input buffer. */ | ||
161 | #ifndef YY_BUF_SIZE | ||
162 | #define YY_BUF_SIZE 16384 | ||
163 | #endif | ||
164 | |||
165 | /* The state buf must be large enough to hold one state per character in the main buffer. | ||
166 | */ | ||
167 | #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) | ||
168 | |||
169 | #ifndef YY_TYPEDEF_YY_BUFFER_STATE | ||
170 | #define YY_TYPEDEF_YY_BUFFER_STATE | ||
171 | typedef struct yy_buffer_state *YY_BUFFER_STATE; | ||
172 | #endif | ||
173 | |||
174 | extern int parse_events_leng; | ||
175 | |||
176 | extern FILE *parse_events_in, *parse_events_out; | ||
177 | |||
178 | #define EOB_ACT_CONTINUE_SCAN 0 | ||
179 | #define EOB_ACT_END_OF_FILE 1 | ||
180 | #define EOB_ACT_LAST_MATCH 2 | ||
181 | |||
182 | #define YY_LESS_LINENO(n) | ||
183 | |||
184 | /* Return all but the first "n" matched characters back to the input stream. */ | ||
185 | #define yyless(n) \ | ||
186 | do \ | ||
187 | { \ | ||
188 | /* Undo effects of setting up parse_events_text. */ \ | ||
189 | int yyless_macro_arg = (n); \ | ||
190 | YY_LESS_LINENO(yyless_macro_arg);\ | ||
191 | *yy_cp = (yy_hold_char); \ | ||
192 | YY_RESTORE_YY_MORE_OFFSET \ | ||
193 | (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ | ||
194 | YY_DO_BEFORE_ACTION; /* set up parse_events_text again */ \ | ||
195 | } \ | ||
196 | while ( 0 ) | ||
197 | |||
198 | #define unput(c) yyunput( c, (yytext_ptr) ) | ||
199 | |||
200 | #ifndef YY_TYPEDEF_YY_SIZE_T | ||
201 | #define YY_TYPEDEF_YY_SIZE_T | ||
202 | typedef size_t yy_size_t; | ||
203 | #endif | ||
204 | |||
205 | #ifndef YY_STRUCT_YY_BUFFER_STATE | ||
206 | #define YY_STRUCT_YY_BUFFER_STATE | ||
207 | struct yy_buffer_state | ||
208 | { | ||
209 | FILE *yy_input_file; | ||
210 | |||
211 | char *yy_ch_buf; /* input buffer */ | ||
212 | char *yy_buf_pos; /* current position in input buffer */ | ||
213 | |||
214 | /* Size of input buffer in bytes, not including room for EOB | ||
215 | * characters. | ||
216 | */ | ||
217 | yy_size_t yy_buf_size; | ||
218 | |||
219 | /* Number of characters read into yy_ch_buf, not including EOB | ||
220 | * characters. | ||
221 | */ | ||
222 | int yy_n_chars; | ||
223 | |||
224 | /* Whether we "own" the buffer - i.e., we know we created it, | ||
225 | * and can realloc() it to grow it, and should free() it to | ||
226 | * delete it. | ||
227 | */ | ||
228 | int yy_is_our_buffer; | ||
229 | |||
230 | /* Whether this is an "interactive" input source; if so, and | ||
231 | * if we're using stdio for input, then we want to use getc() | ||
232 | * instead of fread(), to make sure we stop fetching input after | ||
233 | * each newline. | ||
234 | */ | ||
235 | int yy_is_interactive; | ||
236 | |||
237 | /* Whether we're considered to be at the beginning of a line. | ||
238 | * If so, '^' rules will be active on the next match, otherwise | ||
239 | * not. | ||
240 | */ | ||
241 | int yy_at_bol; | ||
242 | |||
243 | int yy_bs_lineno; /**< The line count. */ | ||
244 | int yy_bs_column; /**< The column count. */ | ||
245 | |||
246 | /* Whether to try to fill the input buffer when we reach the | ||
247 | * end of it. | ||
248 | */ | ||
249 | int yy_fill_buffer; | ||
250 | |||
251 | int yy_buffer_status; | ||
252 | |||
253 | #define YY_BUFFER_NEW 0 | ||
254 | #define YY_BUFFER_NORMAL 1 | ||
255 | /* When an EOF's been seen but there's still some text to process | ||
256 | * then we mark the buffer as YY_EOF_PENDING, to indicate that we | ||
257 | * shouldn't try reading from the input source any more. We might | ||
258 | * still have a bunch of tokens to match, though, because of | ||
259 | * possible backing-up. | ||
260 | * | ||
261 | * When we actually see the EOF, we change the status to "new" | ||
262 | * (via parse_events_restart()), so that the user can continue scanning by | ||
263 | * just pointing parse_events_in at a new input file. | ||
264 | */ | ||
265 | #define YY_BUFFER_EOF_PENDING 2 | ||
266 | |||
267 | }; | ||
268 | #endif /* !YY_STRUCT_YY_BUFFER_STATE */ | ||
269 | |||
270 | /* Stack of input buffers. */ | ||
271 | static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ | ||
272 | static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ | ||
273 | static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ | ||
274 | |||
275 | /* We provide macros for accessing buffer states in case in the | ||
276 | * future we want to put the buffer states in a more general | ||
277 | * "scanner state". | ||
278 | * | ||
279 | * Returns the top of the stack, or NULL. | ||
280 | */ | ||
281 | #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ | ||
282 | ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ | ||
283 | : NULL) | ||
284 | |||
285 | /* Same as previous macro, but useful when we know that the buffer stack is not | ||
286 | * NULL or when we need an lvalue. For internal use only. | ||
287 | */ | ||
288 | #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] | ||
289 | |||
290 | /* yy_hold_char holds the character lost when parse_events_text is formed. */ | ||
291 | static char yy_hold_char; | ||
292 | static int yy_n_chars; /* number of characters read into yy_ch_buf */ | ||
293 | int parse_events_leng; | ||
294 | |||
295 | /* Points to current character in buffer. */ | ||
296 | static char *yy_c_buf_p = (char *) 0; | ||
297 | static int yy_init = 0; /* whether we need to initialize */ | ||
298 | static int yy_start = 0; /* start state number */ | ||
299 | |||
300 | /* Flag which is used to allow parse_events_wrap()'s to do buffer switches | ||
301 | * instead of setting up a fresh parse_events_in. A bit of a hack ... | ||
302 | */ | ||
303 | static int yy_did_buffer_switch_on_eof; | ||
304 | |||
305 | void parse_events_restart (FILE *input_file ); | ||
306 | void parse_events__switch_to_buffer (YY_BUFFER_STATE new_buffer ); | ||
307 | YY_BUFFER_STATE parse_events__create_buffer (FILE *file,int size ); | ||
308 | void parse_events__delete_buffer (YY_BUFFER_STATE b ); | ||
309 | void parse_events__flush_buffer (YY_BUFFER_STATE b ); | ||
310 | void parse_events_push_buffer_state (YY_BUFFER_STATE new_buffer ); | ||
311 | void parse_events_pop_buffer_state (void ); | ||
312 | |||
313 | static void parse_events_ensure_buffer_stack (void ); | ||
314 | static void parse_events__load_buffer_state (void ); | ||
315 | static void parse_events__init_buffer (YY_BUFFER_STATE b,FILE *file ); | ||
316 | |||
317 | #define YY_FLUSH_BUFFER parse_events__flush_buffer(YY_CURRENT_BUFFER ) | ||
318 | |||
319 | YY_BUFFER_STATE parse_events__scan_buffer (char *base,yy_size_t size ); | ||
320 | YY_BUFFER_STATE parse_events__scan_string (yyconst char *yy_str ); | ||
321 | YY_BUFFER_STATE parse_events__scan_bytes (yyconst char *bytes,int len ); | ||
322 | |||
323 | void *parse_events_alloc (yy_size_t ); | ||
324 | void *parse_events_realloc (void *,yy_size_t ); | ||
325 | void parse_events_free (void * ); | ||
326 | |||
327 | #define yy_new_buffer parse_events__create_buffer | ||
328 | |||
329 | #define yy_set_interactive(is_interactive) \ | ||
330 | { \ | ||
331 | if ( ! YY_CURRENT_BUFFER ){ \ | ||
332 | parse_events_ensure_buffer_stack (); \ | ||
333 | YY_CURRENT_BUFFER_LVALUE = \ | ||
334 | parse_events__create_buffer(parse_events_in,YY_BUF_SIZE ); \ | ||
335 | } \ | ||
336 | YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ | ||
337 | } | ||
338 | |||
339 | #define yy_set_bol(at_bol) \ | ||
340 | { \ | ||
341 | if ( ! YY_CURRENT_BUFFER ){\ | ||
342 | parse_events_ensure_buffer_stack (); \ | ||
343 | YY_CURRENT_BUFFER_LVALUE = \ | ||
344 | parse_events__create_buffer(parse_events_in,YY_BUF_SIZE ); \ | ||
345 | } \ | ||
346 | YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ | ||
347 | } | ||
348 | |||
349 | #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) | ||
350 | |||
351 | /* Begin user sect3 */ | ||
352 | |||
353 | typedef unsigned char YY_CHAR; | ||
354 | |||
355 | FILE *parse_events_in = (FILE *) 0, *parse_events_out = (FILE *) 0; | ||
356 | |||
357 | typedef int yy_state_type; | ||
358 | |||
359 | extern int parse_events_lineno; | ||
360 | |||
361 | int parse_events_lineno = 1; | ||
362 | |||
363 | extern char *parse_events_text; | ||
364 | #define yytext_ptr parse_events_text | ||
365 | |||
366 | static yy_state_type yy_get_previous_state (void ); | ||
367 | static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); | ||
368 | static int yy_get_next_buffer (void ); | ||
369 | static void yy_fatal_error (yyconst char msg[] ); | ||
370 | |||
371 | /* Done after the current pattern has been matched and before the | ||
372 | * corresponding action - sets up parse_events_text. | ||
373 | */ | ||
374 | #define YY_DO_BEFORE_ACTION \ | ||
375 | (yytext_ptr) = yy_bp; \ | ||
376 | parse_events_leng = (size_t) (yy_cp - yy_bp); \ | ||
377 | (yy_hold_char) = *yy_cp; \ | ||
378 | *yy_cp = '\0'; \ | ||
379 | (yy_c_buf_p) = yy_cp; | ||
380 | |||
381 | #define YY_NUM_RULES 49 | ||
382 | #define YY_END_OF_BUFFER 50 | ||
383 | /* This struct is not used in this scanner, | ||
384 | but its presence is necessary. */ | ||
385 | struct yy_trans_info | ||
386 | { | ||
387 | flex_int32_t yy_verify; | ||
388 | flex_int32_t yy_nxt; | ||
389 | }; | ||
390 | static yyconst flex_int16_t yy_accept[440] = | ||
391 | { 0, | ||
392 | 0, 0, 50, 49, 43, 46, 45, 44, 39, 39, | ||
393 | 47, 48, 43, 43, 43, 43, 43, 43, 43, 43, | ||
394 | 43, 43, 41, 43, 43, 43, 43, 43, 41, 42, | ||
395 | 43, 43, 42, 42, 43, 39, 0, 43, 43, 43, | ||
396 | 21, 43, 43, 43, 43, 43, 43, 43, 43, 43, | ||
397 | 43, 43, 15, 43, 0, 43, 43, 43, 41, 0, | ||
398 | 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, | ||
399 | 43, 43, 43, 38, 38, 43, 43, 43, 43, 40, | ||
400 | 43, 43, 0, 43, 43, 43, 24, 43, 43, 43, | ||
401 | 43, 43, 43, 0, 43, 43, 43, 41, 0, 43, | ||
402 | |||
403 | 43, 43, 0, 19, 20, 43, 43, 43, 43, 43, | ||
404 | 43, 43, 30, 43, 43, 43, 38, 38, 43, 43, | ||
405 | 43, 43, 43, 43, 43, 0, 0, 43, 43, 43, | ||
406 | 43, 0, 43, 43, 43, 0, 43, 0, 22, 43, | ||
407 | 43, 41, 0, 23, 43, 43, 19, 20, 26, 43, | ||
408 | 37, 43, 43, 31, 25, 43, 43, 43, 26, 43, | ||
409 | 43, 43, 43, 43, 0, 43, 0, 0, 0, 0, | ||
410 | 43, 43, 43, 43, 0, 43, 43, 43, 0, 0, | ||
411 | 43, 22, 43, 43, 41, 23, 0, 43, 26, 43, | ||
412 | 43, 43, 43, 0, 43, 43, 43, 43, 27, 0, | ||
413 | |||
414 | 27, 0, 43, 0, 0, 0, 0, 43, 43, 24, | ||
415 | 0, 0, 32, 43, 0, 0, 0, 1, 43, 12, | ||
416 | 0, 43, 0, 43, 0, 31, 0, 35, 43, 43, | ||
417 | 43, 0, 0, 43, 0, 0, 0, 43, 43, 0, | ||
418 | 43, 43, 0, 0, 0, 33, 34, 43, 0, 0, | ||
419 | 0, 43, 0, 43, 0, 43, 0, 0, 43, 43, | ||
420 | 43, 0, 43, 0, 0, 0, 43, 43, 0, 0, | ||
421 | 43, 7, 0, 0, 0, 0, 0, 0, 0, 43, | ||
422 | 0, 43, 0, 43, 0, 0, 28, 43, 0, 0, | ||
423 | 43, 0, 43, 0, 0, 43, 0, 0, 0, 0, | ||
424 | |||
425 | 10, 0, 0, 43, 0, 43, 0, 43, 0, 0, | ||
426 | 43, 43, 0, 0, 43, 0, 0, 0, 0, 43, | ||
427 | 9, 0, 0, 0, 1, 0, 0, 0, 43, 0, | ||
428 | 16, 0, 0, 28, 43, 0, 11, 43, 0, 0, | ||
429 | 0, 0, 36, 0, 0, 0, 0, 0, 0, 43, | ||
430 | 0, 0, 12, 43, 0, 0, 0, 0, 0, 0, | ||
431 | 6, 0, 0, 0, 0, 0, 4, 14, 13, 0, | ||
432 | 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, | ||
433 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
434 | 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
435 | |||
436 | 0, 0, 0, 0, 0, 0, 0, 17, 0, 5, | ||
437 | 15, 18, 0, 0, 29, 0, 0, 0, 0, 0, | ||
438 | 0, 0, 0, 0, 0, 0, 0, 7, 3, 0, | ||
439 | 0, 0, 2, 0, 0, 0, 0, 0, 0 | ||
440 | } ; | ||
441 | |||
442 | static yyconst flex_int32_t yy_ec[256] = | ||
443 | { 0, | ||
444 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
445 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
446 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
447 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
448 | 1, 2, 1, 3, 4, 1, 5, 6, 7, 8, | ||
449 | 9, 9, 9, 9, 9, 9, 9, 10, 1, 1, | ||
450 | 11, 1, 2, 1, 12, 13, 14, 15, 12, 12, | ||
451 | 2, 2, 16, 2, 2, 17, 2, 2, 2, 2, | ||
452 | 2, 18, 2, 19, 2, 2, 2, 2, 2, 2, | ||
453 | 1, 1, 1, 1, 20, 1, 21, 22, 23, 24, | ||
454 | |||
455 | 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, | ||
456 | 35, 36, 2, 37, 38, 39, 40, 41, 42, 43, | ||
457 | 44, 2, 1, 1, 1, 1, 1, 1, 1, 1, | ||
458 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
459 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
460 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
461 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
462 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
463 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
464 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
465 | |||
466 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
467 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
468 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
469 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
470 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
471 | 1, 1, 1, 1, 1 | ||
472 | } ; | ||
473 | |||
474 | static yyconst flex_int32_t yy_meta[45] = | ||
475 | { 0, | ||
476 | 1, 2, 1, 1, 1, 3, 3, 3, 3, 1, | ||
477 | 1, 3, 3, 3, 3, 2, 2, 2, 2, 2, | ||
478 | 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, | ||
479 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
480 | 2, 2, 2, 2 | ||
481 | } ; | ||
482 | |||
483 | static yyconst flex_int16_t yy_base[442] = | ||
484 | { 0, | ||
485 | 0, 0, 510, 511, 0, 511, 511, 511, 39, 43, | ||
486 | 511, 511, 488, 474, 46, 482, 32, 20, 37, 57, | ||
487 | 473, 484, 34, 64, 59, 64, 469, 467, 78, 113, | ||
488 | 41, 481, 464, 0, 0, 104, 0, 461, 461, 494, | ||
489 | 0, 483, 470, 472, 465, 44, 472, 470, 453, 467, | ||
490 | 455, 448, 0, 464, 447, 468, 444, 443, 64, 443, | ||
491 | 464, 448, 441, 67, 457, 447, 443, 52, 451, 436, | ||
492 | 446, 435, 446, 445, 76, 444, 95, 430, 438, 0, | ||
493 | 445, 426, 100, 439, 438, 435, 0, 427, 456, 431, | ||
494 | 105, 454, 425, 424, 442, 422, 421, 112, 420, 438, | ||
495 | |||
496 | 425, 410, 117, 0, 0, 424, 412, 436, 408, 409, | ||
497 | 405, 417, 0, 416, 411, 413, 83, 107, 415, 405, | ||
498 | 399, 404, 395, 429, 395, 126, 119, 394, 392, 395, | ||
499 | 405, 404, 401, 396, 399, 100, 398, 400, 0, 400, | ||
500 | 381, 123, 397, 0, 414, 380, 511, 511, 378, 378, | ||
501 | 511, 393, 376, 387, 0, 407, 375, 384, 383, 367, | ||
502 | 374, 380, 400, 378, 383, 361, 361, 378, 377, 359, | ||
503 | 371, 357, 361, 365, 348, 387, 363, 346, 73, 359, | ||
504 | 349, 511, 347, 347, 0, 511, 361, 343, 0, 378, | ||
505 | 342, 376, 341, 352, 353, 337, 343, 349, 335, 349, | ||
506 | |||
507 | 0, 354, 347, 348, 345, 344, 327, 331, 339, 146, | ||
508 | 340, 123, 150, 323, 326, 337, 332, 0, 329, 0, | ||
509 | 313, 333, 329, 325, 327, 0, 331, 0, 328, 329, | ||
510 | 325, 316, 334, 307, 317, 316, 306, 319, 307, 132, | ||
511 | 301, 301, 306, 308, 311, 0, 0, 331, 311, 301, | ||
512 | 295, 296, 307, 290, 307, 292, 305, 285, 296, 284, | ||
513 | 318, 286, 291, 294, 293, 277, 291, 276, 280, 284, | ||
514 | 268, 0, 286, 272, 283, 270, 276, 281, 284, 270, | ||
515 | 271, 273, 261, 266, 259, 266, 272, 267, 272, 271, | ||
516 | 258, 269, 287, 252, 251, 252, 249, 248, 260, 242, | ||
517 | |||
518 | 511, 245, 243, 277, 255, 244, 246, 239, 244, 236, | ||
519 | 236, 232, 228, 240, 236, 230, 242, 228, 228, 240, | ||
520 | 511, 239, 226, 233, 511, 232, 234, 221, 224, 218, | ||
521 | 0, 217, 217, 0, 229, 230, 511, 248, 222, 229, | ||
522 | 212, 223, 0, 209, 221, 206, 209, 222, 238, 203, | ||
523 | 202, 201, 511, 234, 205, 217, 200, 194, 193, 194, | ||
524 | 511, 197, 207, 195, 188, 142, 0, 511, 511, 130, | ||
525 | 202, 209, 191, 192, 200, 511, 199, 193, 182, 187, | ||
526 | 197, 180, 181, 190, 176, 200, 173, 172, 185, 184, | ||
527 | 511, 169, 184, 171, 184, 183, 199, 164, 172, 162, | ||
528 | |||
529 | 161, 160, 166, 162, 171, 170, 147, 511, 158, 511, | ||
530 | 511, 511, 167, 152, 511, 169, 152, 154, 153, 161, | ||
531 | 162, 149, 145, 158, 147, 149, 145, 511, 511, 154, | ||
532 | 152, 137, 511, 138, 145, 131, 53, 54, 511, 172, | ||
533 | 66 | ||
534 | } ; | ||
535 | |||
536 | static yyconst flex_int16_t yy_def[442] = | ||
537 | { 0, | ||
538 | 439, 1, 439, 439, 440, 439, 439, 439, 439, 439, | ||
539 | 439, 439, 440, 440, 440, 440, 440, 440, 440, 440, | ||
540 | 440, 440, 440, 440, 440, 440, 440, 440, 440, 440, | ||
541 | 440, 440, 440, 440, 440, 439, 441, 440, 440, 440, | ||
542 | 440, 440, 440, 440, 440, 440, 440, 440, 440, 440, | ||
543 | 440, 440, 440, 440, 439, 440, 440, 440, 440, 439, | ||
544 | 440, 440, 440, 440, 440, 440, 440, 440, 440, 440, | ||
545 | 440, 440, 440, 30, 30, 440, 440, 440, 440, 441, | ||
546 | 440, 440, 439, 440, 440, 440, 440, 440, 440, 440, | ||
547 | 440, 440, 440, 439, 440, 440, 440, 440, 439, 440, | ||
548 | |||
549 | 440, 440, 439, 440, 440, 440, 440, 440, 440, 440, | ||
550 | 440, 440, 440, 440, 440, 440, 30, 30, 440, 440, | ||
551 | 440, 440, 440, 440, 440, 439, 439, 440, 440, 440, | ||
552 | 440, 439, 440, 440, 440, 439, 440, 439, 440, 440, | ||
553 | 440, 440, 439, 440, 440, 440, 439, 439, 440, 440, | ||
554 | 439, 440, 440, 440, 440, 440, 440, 440, 30, 440, | ||
555 | 440, 440, 440, 440, 439, 440, 439, 439, 439, 439, | ||
556 | 440, 440, 440, 440, 439, 440, 440, 440, 439, 439, | ||
557 | 440, 439, 440, 440, 440, 439, 439, 440, 440, 440, | ||
558 | 440, 440, 440, 439, 440, 440, 440, 440, 440, 439, | ||
559 | |||
560 | 440, 439, 440, 439, 439, 439, 439, 440, 440, 440, | ||
561 | 439, 439, 440, 440, 439, 439, 439, 440, 440, 440, | ||
562 | 439, 440, 439, 440, 439, 440, 439, 440, 440, 440, | ||
563 | 440, 439, 439, 440, 439, 439, 439, 440, 440, 439, | ||
564 | 440, 440, 439, 439, 439, 440, 440, 440, 439, 439, | ||
565 | 439, 440, 439, 440, 439, 440, 439, 439, 440, 440, | ||
566 | 440, 439, 440, 439, 439, 439, 440, 440, 439, 439, | ||
567 | 440, 440, 439, 439, 439, 439, 439, 439, 439, 440, | ||
568 | 439, 440, 439, 440, 439, 439, 440, 440, 439, 439, | ||
569 | 440, 439, 440, 439, 439, 440, 439, 439, 439, 439, | ||
570 | |||
571 | 439, 439, 439, 440, 439, 440, 439, 440, 439, 439, | ||
572 | 440, 440, 439, 439, 440, 439, 439, 439, 439, 440, | ||
573 | 439, 439, 439, 439, 439, 439, 439, 439, 440, 439, | ||
574 | 440, 439, 439, 440, 440, 439, 439, 440, 439, 439, | ||
575 | 439, 439, 440, 439, 439, 439, 439, 439, 439, 440, | ||
576 | 439, 439, 439, 440, 439, 439, 439, 439, 439, 439, | ||
577 | 439, 439, 439, 439, 439, 439, 440, 439, 439, 439, | ||
578 | 439, 439, 439, 439, 439, 439, 439, 439, 439, 439, | ||
579 | 439, 439, 439, 439, 439, 439, 439, 439, 439, 439, | ||
580 | 439, 439, 439, 439, 439, 439, 439, 439, 439, 439, | ||
581 | |||
582 | 439, 439, 439, 439, 439, 439, 439, 439, 439, 439, | ||
583 | 439, 439, 439, 439, 439, 439, 439, 439, 439, 439, | ||
584 | 439, 439, 439, 439, 439, 439, 439, 439, 439, 439, | ||
585 | 439, 439, 439, 439, 439, 439, 439, 439, 0, 439, | ||
586 | 439 | ||
587 | } ; | ||
588 | |||
589 | static yyconst flex_int16_t yy_nxt[556] = | ||
590 | { 0, | ||
591 | 4, 5, 6, 7, 8, 9, 10, 10, 10, 11, | ||
592 | 12, 5, 5, 5, 13, 14, 15, 16, 5, 5, | ||
593 | 17, 18, 19, 20, 21, 22, 5, 23, 24, 5, | ||
594 | 23, 25, 26, 27, 28, 29, 30, 31, 32, 23, | ||
595 | 5, 33, 34, 5, 36, 36, 36, 36, 36, 36, | ||
596 | 36, 36, 40, 41, 44, 46, 47, 50, 48, 49, | ||
597 | 55, 59, 42, 45, 59, 64, 87, 60, 80, 59, | ||
598 | 103, 51, 52, 59, 53, 56, 76, 433, 109, 77, | ||
599 | 54, 37, 61, 87, 66, 110, 438, 62, 67, 111, | ||
600 | 104, 98, 68, 65, 98, 105, 117, 63, 71, 98, | ||
601 | |||
602 | 74, 118, 72, 98, 215, 59, 159, 74, 59, 36, | ||
603 | 36, 36, 36, 59, 73, 120, 216, 59, 74, 74, | ||
604 | 74, 74, 179, 126, 74, 74, 74, 74, 127, 121, | ||
605 | 134, 74, 180, 74, 74, 74, 74, 75, 74, 142, | ||
606 | 147, 169, 142, 135, 113, 148, 167, 142, 168, 240, | ||
607 | 185, 142, 170, 185, 429, 244, 246, 247, 185, 245, | ||
608 | 269, 383, 185, 381, 270, 241, 384, 382, 416, 437, | ||
609 | 242, 436, 417, 35, 35, 435, 434, 433, 432, 431, | ||
610 | 430, 429, 428, 427, 426, 425, 424, 423, 422, 421, | ||
611 | 420, 419, 418, 415, 415, 414, 413, 412, 411, 410, | ||
612 | |||
613 | 409, 408, 407, 406, 405, 404, 403, 402, 401, 400, | ||
614 | 399, 398, 186, 397, 396, 395, 394, 393, 392, 391, | ||
615 | 390, 389, 388, 387, 148, 386, 385, 380, 379, 378, | ||
616 | 377, 376, 375, 374, 373, 372, 371, 370, 369, 368, | ||
617 | 367, 366, 365, 364, 363, 362, 361, 360, 359, 358, | ||
618 | 357, 356, 355, 354, 353, 352, 351, 350, 349, 348, | ||
619 | 347, 346, 345, 344, 343, 342, 341, 340, 339, 338, | ||
620 | 337, 336, 335, 334, 333, 332, 331, 330, 329, 328, | ||
621 | 327, 326, 325, 324, 323, 322, 321, 320, 319, 318, | ||
622 | 317, 316, 315, 314, 313, 312, 311, 310, 309, 308, | ||
623 | |||
624 | 307, 306, 305, 304, 303, 302, 301, 300, 299, 298, | ||
625 | 297, 296, 295, 294, 293, 113, 292, 148, 147, 291, | ||
626 | 290, 289, 288, 287, 286, 285, 284, 283, 282, 281, | ||
627 | 280, 279, 278, 277, 276, 275, 274, 273, 272, 271, | ||
628 | 268, 267, 266, 265, 264, 263, 182, 262, 261, 260, | ||
629 | 259, 258, 257, 256, 255, 254, 253, 252, 251, 250, | ||
630 | 249, 248, 243, 239, 238, 237, 236, 235, 147, 234, | ||
631 | 233, 232, 201, 231, 230, 229, 228, 227, 226, 225, | ||
632 | 224, 223, 222, 221, 220, 219, 218, 217, 214, 213, | ||
633 | 212, 211, 210, 209, 113, 208, 207, 206, 205, 204, | ||
634 | |||
635 | 203, 202, 201, 200, 199, 198, 197, 74, 196, 195, | ||
636 | 194, 193, 192, 191, 190, 189, 188, 187, 186, 184, | ||
637 | 183, 182, 181, 178, 177, 176, 175, 174, 173, 172, | ||
638 | 171, 166, 165, 164, 163, 162, 161, 160, 158, 157, | ||
639 | 156, 155, 154, 153, 152, 151, 150, 149, 146, 145, | ||
640 | 144, 143, 141, 140, 139, 138, 137, 136, 133, 132, | ||
641 | 131, 130, 129, 128, 125, 124, 123, 122, 119, 74, | ||
642 | 116, 115, 114, 113, 112, 108, 107, 106, 102, 101, | ||
643 | 100, 99, 97, 96, 95, 94, 93, 92, 91, 90, | ||
644 | 89, 87, 88, 86, 85, 84, 41, 83, 82, 81, | ||
645 | |||
646 | 79, 78, 70, 69, 58, 57, 43, 39, 38, 439, | ||
647 | 3, 439, 439, 439, 439, 439, 439, 439, 439, 439, | ||
648 | 439, 439, 439, 439, 439, 439, 439, 439, 439, 439, | ||
649 | 439, 439, 439, 439, 439, 439, 439, 439, 439, 439, | ||
650 | 439, 439, 439, 439, 439, 439, 439, 439, 439, 439, | ||
651 | 439, 439, 439, 439, 439 | ||
652 | } ; | ||
653 | |||
654 | static yyconst flex_int16_t yy_chk[556] = | ||
655 | { 0, | ||
656 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
657 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
658 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
659 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
660 | 1, 1, 1, 1, 9, 9, 9, 9, 10, 10, | ||
661 | 10, 10, 15, 15, 17, 18, 18, 19, 18, 18, | ||
662 | 20, 23, 15, 17, 23, 25, 46, 24, 441, 23, | ||
663 | 64, 19, 19, 23, 19, 20, 31, 438, 68, 31, | ||
664 | 19, 9, 24, 46, 26, 68, 437, 24, 26, 68, | ||
665 | 64, 59, 26, 25, 59, 64, 75, 24, 29, 59, | ||
666 | |||
667 | 75, 75, 29, 59, 179, 29, 117, 117, 29, 36, | ||
668 | 36, 36, 36, 29, 29, 77, 179, 29, 30, 30, | ||
669 | 30, 30, 136, 83, 30, 30, 30, 30, 83, 77, | ||
670 | 91, 118, 136, 30, 30, 30, 30, 30, 30, 98, | ||
671 | 103, 127, 98, 91, 118, 103, 126, 98, 126, 210, | ||
672 | 142, 98, 127, 142, 436, 212, 213, 213, 142, 212, | ||
673 | 240, 370, 142, 366, 240, 210, 370, 366, 407, 435, | ||
674 | 210, 434, 407, 440, 440, 432, 431, 430, 427, 426, | ||
675 | 425, 424, 423, 422, 421, 420, 419, 418, 417, 416, | ||
676 | 414, 413, 409, 406, 405, 404, 403, 402, 401, 400, | ||
677 | |||
678 | 399, 398, 397, 396, 395, 394, 393, 392, 390, 389, | ||
679 | 388, 387, 386, 385, 384, 383, 382, 381, 380, 379, | ||
680 | 378, 377, 375, 374, 373, 372, 371, 365, 364, 363, | ||
681 | 362, 360, 359, 358, 357, 356, 355, 354, 352, 351, | ||
682 | 350, 349, 348, 347, 346, 345, 344, 342, 341, 340, | ||
683 | 339, 338, 336, 335, 333, 332, 330, 329, 328, 327, | ||
684 | 326, 324, 323, 322, 320, 319, 318, 317, 316, 315, | ||
685 | 314, 313, 312, 311, 310, 309, 308, 307, 306, 305, | ||
686 | 304, 303, 302, 300, 299, 298, 297, 296, 295, 294, | ||
687 | 293, 292, 291, 290, 289, 288, 287, 286, 285, 284, | ||
688 | |||
689 | 283, 282, 281, 280, 279, 278, 277, 276, 275, 274, | ||
690 | 273, 271, 270, 269, 268, 267, 266, 265, 264, 263, | ||
691 | 262, 261, 260, 259, 258, 257, 256, 255, 254, 253, | ||
692 | 252, 251, 250, 249, 248, 245, 244, 243, 242, 241, | ||
693 | 239, 238, 237, 236, 235, 234, 233, 232, 231, 230, | ||
694 | 229, 227, 225, 224, 223, 222, 221, 219, 217, 216, | ||
695 | 215, 214, 211, 209, 208, 207, 206, 205, 204, 203, | ||
696 | 202, 200, 199, 198, 197, 196, 195, 194, 193, 192, | ||
697 | 191, 190, 188, 187, 184, 183, 181, 180, 178, 177, | ||
698 | 176, 175, 174, 173, 172, 171, 170, 169, 168, 167, | ||
699 | |||
700 | 166, 165, 164, 163, 162, 161, 160, 159, 158, 157, | ||
701 | 156, 154, 153, 152, 150, 149, 146, 145, 143, 141, | ||
702 | 140, 138, 137, 135, 134, 133, 132, 131, 130, 129, | ||
703 | 128, 125, 124, 123, 122, 121, 120, 119, 116, 115, | ||
704 | 114, 112, 111, 110, 109, 108, 107, 106, 102, 101, | ||
705 | 100, 99, 97, 96, 95, 94, 93, 92, 90, 89, | ||
706 | 88, 86, 85, 84, 82, 81, 79, 78, 76, 74, | ||
707 | 73, 72, 71, 70, 69, 67, 66, 65, 63, 62, | ||
708 | 61, 60, 58, 57, 56, 55, 54, 52, 51, 50, | ||
709 | 49, 48, 47, 45, 44, 43, 42, 40, 39, 38, | ||
710 | |||
711 | 33, 32, 28, 27, 22, 21, 16, 14, 13, 3, | ||
712 | 439, 439, 439, 439, 439, 439, 439, 439, 439, 439, | ||
713 | 439, 439, 439, 439, 439, 439, 439, 439, 439, 439, | ||
714 | 439, 439, 439, 439, 439, 439, 439, 439, 439, 439, | ||
715 | 439, 439, 439, 439, 439, 439, 439, 439, 439, 439, | ||
716 | 439, 439, 439, 439, 439 | ||
717 | } ; | ||
718 | |||
719 | static yy_state_type yy_last_accepting_state; | ||
720 | static char *yy_last_accepting_cpos; | ||
721 | |||
722 | extern int parse_events__flex_debug; | ||
723 | int parse_events__flex_debug = 0; | ||
724 | |||
725 | /* The intent behind this definition is that it'll catch | ||
726 | * any uses of REJECT which flex missed. | ||
727 | */ | ||
728 | #define REJECT reject_used_but_not_detected | ||
729 | #define yymore() yymore_used_but_not_detected | ||
730 | #define YY_MORE_ADJ 0 | ||
731 | #define YY_RESTORE_YY_MORE_OFFSET | ||
732 | char *parse_events_text; | ||
733 | #line 1 "util/parse-events.l" | ||
734 | #line 5 "util/parse-events.l" | ||
735 | #include <errno.h> | ||
736 | #include "../perf.h" | ||
737 | #include "parse-events-bison.h" | ||
738 | #include "parse-events.h" | ||
739 | |||
740 | static int __value(char *str, int base, int token) | ||
741 | { | ||
742 | long num; | ||
743 | |||
744 | errno = 0; | ||
745 | num = strtoul(str, NULL, base); | ||
746 | if (errno) | ||
747 | return PE_ERROR; | ||
748 | |||
749 | parse_events_lval.num = num; | ||
750 | return token; | ||
751 | } | ||
752 | |||
753 | static int value(int base) | ||
754 | { | ||
755 | return __value(parse_events_text, base, PE_VALUE); | ||
756 | } | ||
757 | |||
758 | static int raw(void) | ||
759 | { | ||
760 | return __value(parse_events_text + 1, 16, PE_RAW); | ||
761 | } | ||
762 | |||
763 | static int str(int token) | ||
764 | { | ||
765 | parse_events_lval.str = strdup(parse_events_text); | ||
766 | return token; | ||
767 | } | ||
768 | |||
769 | static int sym(int type, int config) | ||
770 | { | ||
771 | parse_events_lval.num = (type << 16) + config; | ||
772 | return PE_VALUE_SYM; | ||
773 | } | ||
774 | |||
775 | static int term(int type) | ||
776 | { | ||
777 | parse_events_lval.num = type; | ||
778 | return PE_TERM; | ||
779 | } | ||
780 | |||
781 | #line 782 "<stdout>" | ||
782 | |||
783 | #define INITIAL 0 | ||
784 | |||
785 | #ifndef YY_NO_UNISTD_H | ||
786 | /* Special case for "unistd.h", since it is non-ANSI. We include it way | ||
787 | * down here because we want the user's section 1 to have been scanned first. | ||
788 | * The user has a chance to override it with an option. | ||
789 | */ | ||
790 | #include <unistd.h> | ||
791 | #endif | ||
792 | |||
793 | #ifndef YY_EXTRA_TYPE | ||
794 | #define YY_EXTRA_TYPE void * | ||
795 | #endif | ||
796 | |||
797 | static int yy_init_globals (void ); | ||
798 | |||
799 | /* Accessor methods to globals. | ||
800 | These are made visible to non-reentrant scanners for convenience. */ | ||
801 | |||
802 | int parse_events_lex_destroy (void ); | ||
803 | |||
804 | int parse_events_get_debug (void ); | ||
805 | |||
806 | void parse_events_set_debug (int debug_flag ); | ||
807 | |||
808 | YY_EXTRA_TYPE parse_events_get_extra (void ); | ||
809 | |||
810 | void parse_events_set_extra (YY_EXTRA_TYPE user_defined ); | ||
811 | |||
812 | FILE *parse_events_get_in (void ); | ||
813 | |||
814 | void parse_events_set_in (FILE * in_str ); | ||
815 | |||
816 | FILE *parse_events_get_out (void ); | ||
817 | |||
818 | void parse_events_set_out (FILE * out_str ); | ||
819 | |||
820 | int parse_events_get_leng (void ); | ||
821 | |||
822 | char *parse_events_get_text (void ); | ||
823 | |||
824 | int parse_events_get_lineno (void ); | ||
825 | |||
826 | void parse_events_set_lineno (int line_number ); | ||
827 | |||
828 | /* Macros after this point can all be overridden by user definitions in | ||
829 | * section 1. | ||
830 | */ | ||
831 | |||
832 | #ifndef YY_SKIP_YYWRAP | ||
833 | #ifdef __cplusplus | ||
834 | extern "C" int parse_events_wrap (void ); | ||
835 | #else | ||
836 | extern int parse_events_wrap (void ); | ||
837 | #endif | ||
838 | #endif | ||
839 | |||
840 | static void yyunput (int c,char *buf_ptr ); | ||
841 | |||
842 | #ifndef yytext_ptr | ||
843 | static void yy_flex_strncpy (char *,yyconst char *,int ); | ||
844 | #endif | ||
845 | |||
846 | #ifdef YY_NEED_STRLEN | ||
847 | static int yy_flex_strlen (yyconst char * ); | ||
848 | #endif | ||
849 | |||
850 | #ifndef YY_NO_INPUT | ||
851 | |||
852 | #ifdef __cplusplus | ||
853 | static int yyinput (void ); | ||
854 | #else | ||
855 | static int input (void ); | ||
856 | #endif | ||
857 | |||
858 | #endif | ||
859 | |||
860 | /* Amount of stuff to slurp up with each read. */ | ||
861 | #ifndef YY_READ_BUF_SIZE | ||
862 | #define YY_READ_BUF_SIZE 8192 | ||
863 | #endif | ||
864 | |||
865 | /* Copy whatever the last rule matched to the standard output. */ | ||
866 | #ifndef ECHO | ||
867 | /* This used to be an fputs(), but since the string might contain NUL's, | ||
868 | * we now use fwrite(). | ||
869 | */ | ||
870 | #define ECHO do { if (fwrite( parse_events_text, parse_events_leng, 1, parse_events_out )) {} } while (0) | ||
871 | #endif | ||
872 | |||
873 | /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, | ||
874 | * is returned in "result". | ||
875 | */ | ||
876 | #ifndef YY_INPUT | ||
877 | #define YY_INPUT(buf,result,max_size) \ | ||
878 | if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ | ||
879 | { \ | ||
880 | int c = '*'; \ | ||
881 | unsigned n; \ | ||
882 | for ( n = 0; n < max_size && \ | ||
883 | (c = getc( parse_events_in )) != EOF && c != '\n'; ++n ) \ | ||
884 | buf[n] = (char) c; \ | ||
885 | if ( c == '\n' ) \ | ||
886 | buf[n++] = (char) c; \ | ||
887 | if ( c == EOF && ferror( parse_events_in ) ) \ | ||
888 | YY_FATAL_ERROR( "input in flex scanner failed" ); \ | ||
889 | result = n; \ | ||
890 | } \ | ||
891 | else \ | ||
892 | { \ | ||
893 | errno=0; \ | ||
894 | while ( (result = fread(buf, 1, max_size, parse_events_in))==0 && ferror(parse_events_in)) \ | ||
895 | { \ | ||
896 | if( errno != EINTR) \ | ||
897 | { \ | ||
898 | YY_FATAL_ERROR( "input in flex scanner failed" ); \ | ||
899 | break; \ | ||
900 | } \ | ||
901 | errno=0; \ | ||
902 | clearerr(parse_events_in); \ | ||
903 | } \ | ||
904 | }\ | ||
905 | \ | ||
906 | |||
907 | #endif | ||
908 | |||
909 | /* No semi-colon after return; correct usage is to write "yyterminate();" - | ||
910 | * we don't want an extra ';' after the "return" because that will cause | ||
911 | * some compilers to complain about unreachable statements. | ||
912 | */ | ||
913 | #ifndef yyterminate | ||
914 | #define yyterminate() return YY_NULL | ||
915 | #endif | ||
916 | |||
917 | /* Number of entries by which start-condition stack grows. */ | ||
918 | #ifndef YY_START_STACK_INCR | ||
919 | #define YY_START_STACK_INCR 25 | ||
920 | #endif | ||
921 | |||
922 | /* Report a fatal error. */ | ||
923 | #ifndef YY_FATAL_ERROR | ||
924 | #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) | ||
925 | #endif | ||
926 | |||
927 | /* end tables serialization structures and prototypes */ | ||
928 | |||
929 | /* Default declaration of generated scanner - a define so the user can | ||
930 | * easily add parameters. | ||
931 | */ | ||
932 | #ifndef YY_DECL | ||
933 | #define YY_DECL_IS_OURS 1 | ||
934 | |||
935 | extern int parse_events_lex (void); | ||
936 | |||
937 | #define YY_DECL int parse_events_lex (void) | ||
938 | #endif /* !YY_DECL */ | ||
939 | |||
940 | /* Code executed at the beginning of each rule, after parse_events_text and parse_events_leng | ||
941 | * have been set up. | ||
942 | */ | ||
943 | #ifndef YY_USER_ACTION | ||
944 | #define YY_USER_ACTION | ||
945 | #endif | ||
946 | |||
947 | /* Code executed at the end of each rule. */ | ||
948 | #ifndef YY_BREAK | ||
949 | #define YY_BREAK break; | ||
950 | #endif | ||
951 | |||
952 | #define YY_RULE_SETUP \ | ||
953 | YY_USER_ACTION | ||
954 | |||
955 | /** The main scanner function which does all the work. | ||
956 | */ | ||
957 | YY_DECL | ||
958 | { | ||
959 | register yy_state_type yy_current_state; | ||
960 | register char *yy_cp, *yy_bp; | ||
961 | register int yy_act; | ||
962 | |||
963 | #line 60 "util/parse-events.l" | ||
964 | |||
965 | #line 966 "<stdout>" | ||
966 | |||
967 | if ( !(yy_init) ) | ||
968 | { | ||
969 | (yy_init) = 1; | ||
970 | |||
971 | #ifdef YY_USER_INIT | ||
972 | YY_USER_INIT; | ||
973 | #endif | ||
974 | |||
975 | if ( ! (yy_start) ) | ||
976 | (yy_start) = 1; /* first start state */ | ||
977 | |||
978 | if ( ! parse_events_in ) | ||
979 | parse_events_in = stdin; | ||
980 | |||
981 | if ( ! parse_events_out ) | ||
982 | parse_events_out = stdout; | ||
983 | |||
984 | if ( ! YY_CURRENT_BUFFER ) { | ||
985 | parse_events_ensure_buffer_stack (); | ||
986 | YY_CURRENT_BUFFER_LVALUE = | ||
987 | parse_events__create_buffer(parse_events_in,YY_BUF_SIZE ); | ||
988 | } | ||
989 | |||
990 | parse_events__load_buffer_state( ); | ||
991 | } | ||
992 | |||
993 | while ( 1 ) /* loops until end-of-file is reached */ | ||
994 | { | ||
995 | yy_cp = (yy_c_buf_p); | ||
996 | |||
997 | /* Support of parse_events_text. */ | ||
998 | *yy_cp = (yy_hold_char); | ||
999 | |||
1000 | /* yy_bp points to the position in yy_ch_buf of the start of | ||
1001 | * the current run. | ||
1002 | */ | ||
1003 | yy_bp = yy_cp; | ||
1004 | |||
1005 | yy_current_state = (yy_start); | ||
1006 | yy_match: | ||
1007 | do | ||
1008 | { | ||
1009 | register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; | ||
1010 | if ( yy_accept[yy_current_state] ) | ||
1011 | { | ||
1012 | (yy_last_accepting_state) = yy_current_state; | ||
1013 | (yy_last_accepting_cpos) = yy_cp; | ||
1014 | } | ||
1015 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) | ||
1016 | { | ||
1017 | yy_current_state = (int) yy_def[yy_current_state]; | ||
1018 | if ( yy_current_state >= 440 ) | ||
1019 | yy_c = yy_meta[(unsigned int) yy_c]; | ||
1020 | } | ||
1021 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; | ||
1022 | ++yy_cp; | ||
1023 | } | ||
1024 | while ( yy_base[yy_current_state] != 511 ); | ||
1025 | |||
1026 | yy_find_action: | ||
1027 | yy_act = yy_accept[yy_current_state]; | ||
1028 | if ( yy_act == 0 ) | ||
1029 | { /* have to back up */ | ||
1030 | yy_cp = (yy_last_accepting_cpos); | ||
1031 | yy_current_state = (yy_last_accepting_state); | ||
1032 | yy_act = yy_accept[yy_current_state]; | ||
1033 | } | ||
1034 | |||
1035 | YY_DO_BEFORE_ACTION; | ||
1036 | |||
1037 | do_action: /* This label is used only to access EOF actions. */ | ||
1038 | |||
1039 | switch ( yy_act ) | ||
1040 | { /* beginning of action switch */ | ||
1041 | case 0: /* must back up */ | ||
1042 | /* undo the effects of YY_DO_BEFORE_ACTION */ | ||
1043 | *yy_cp = (yy_hold_char); | ||
1044 | yy_cp = (yy_last_accepting_cpos); | ||
1045 | yy_current_state = (yy_last_accepting_state); | ||
1046 | goto yy_find_action; | ||
1047 | |||
1048 | case 1: | ||
1049 | YY_RULE_SETUP | ||
1050 | #line 61 "util/parse-events.l" | ||
1051 | { return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_CPU_CYCLES); } | ||
1052 | YY_BREAK | ||
1053 | case 2: | ||
1054 | YY_RULE_SETUP | ||
1055 | #line 62 "util/parse-events.l" | ||
1056 | { return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_STALLED_CYCLES_FRONTEND); } | ||
1057 | YY_BREAK | ||
1058 | case 3: | ||
1059 | YY_RULE_SETUP | ||
1060 | #line 63 "util/parse-events.l" | ||
1061 | { return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_STALLED_CYCLES_BACKEND); } | ||
1062 | YY_BREAK | ||
1063 | case 4: | ||
1064 | YY_RULE_SETUP | ||
1065 | #line 64 "util/parse-events.l" | ||
1066 | { return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_INSTRUCTIONS); } | ||
1067 | YY_BREAK | ||
1068 | case 5: | ||
1069 | YY_RULE_SETUP | ||
1070 | #line 65 "util/parse-events.l" | ||
1071 | { return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_CACHE_REFERENCES); } | ||
1072 | YY_BREAK | ||
1073 | case 6: | ||
1074 | YY_RULE_SETUP | ||
1075 | #line 66 "util/parse-events.l" | ||
1076 | { return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_CACHE_MISSES); } | ||
1077 | YY_BREAK | ||
1078 | case 7: | ||
1079 | YY_RULE_SETUP | ||
1080 | #line 67 "util/parse-events.l" | ||
1081 | { return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_BRANCH_INSTRUCTIONS); } | ||
1082 | YY_BREAK | ||
1083 | case 8: | ||
1084 | YY_RULE_SETUP | ||
1085 | #line 68 "util/parse-events.l" | ||
1086 | { return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_BRANCH_MISSES); } | ||
1087 | YY_BREAK | ||
1088 | case 9: | ||
1089 | YY_RULE_SETUP | ||
1090 | #line 69 "util/parse-events.l" | ||
1091 | { return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_BUS_CYCLES); } | ||
1092 | YY_BREAK | ||
1093 | case 10: | ||
1094 | YY_RULE_SETUP | ||
1095 | #line 70 "util/parse-events.l" | ||
1096 | { return sym(PERF_TYPE_SOFTWARE, PERF_COUNT_SW_CPU_CLOCK); } | ||
1097 | YY_BREAK | ||
1098 | case 11: | ||
1099 | YY_RULE_SETUP | ||
1100 | #line 71 "util/parse-events.l" | ||
1101 | { return sym(PERF_TYPE_SOFTWARE, PERF_COUNT_SW_TASK_CLOCK); } | ||
1102 | YY_BREAK | ||
1103 | case 12: | ||
1104 | YY_RULE_SETUP | ||
1105 | #line 72 "util/parse-events.l" | ||
1106 | { return sym(PERF_TYPE_SOFTWARE, PERF_COUNT_SW_PAGE_FAULTS); } | ||
1107 | YY_BREAK | ||
1108 | case 13: | ||
1109 | YY_RULE_SETUP | ||
1110 | #line 73 "util/parse-events.l" | ||
1111 | { return sym(PERF_TYPE_SOFTWARE, PERF_COUNT_SW_PAGE_FAULTS_MIN); } | ||
1112 | YY_BREAK | ||
1113 | case 14: | ||
1114 | YY_RULE_SETUP | ||
1115 | #line 74 "util/parse-events.l" | ||
1116 | { return sym(PERF_TYPE_SOFTWARE, PERF_COUNT_SW_PAGE_FAULTS_MAJ); } | ||
1117 | YY_BREAK | ||
1118 | case 15: | ||
1119 | YY_RULE_SETUP | ||
1120 | #line 75 "util/parse-events.l" | ||
1121 | { return sym(PERF_TYPE_SOFTWARE, PERF_COUNT_SW_CONTEXT_SWITCHES); } | ||
1122 | YY_BREAK | ||
1123 | case 16: | ||
1124 | YY_RULE_SETUP | ||
1125 | #line 76 "util/parse-events.l" | ||
1126 | { return sym(PERF_TYPE_SOFTWARE, PERF_COUNT_SW_CPU_MIGRATIONS); } | ||
1127 | YY_BREAK | ||
1128 | case 17: | ||
1129 | YY_RULE_SETUP | ||
1130 | #line 77 "util/parse-events.l" | ||
1131 | { return sym(PERF_TYPE_SOFTWARE, PERF_COUNT_SW_ALIGNMENT_FAULTS); } | ||
1132 | YY_BREAK | ||
1133 | case 18: | ||
1134 | YY_RULE_SETUP | ||
1135 | #line 78 "util/parse-events.l" | ||
1136 | { return sym(PERF_TYPE_SOFTWARE, PERF_COUNT_SW_EMULATION_FAULTS); } | ||
1137 | YY_BREAK | ||
1138 | case 19: | ||
1139 | #line 81 "util/parse-events.l" | ||
1140 | case 20: | ||
1141 | #line 82 "util/parse-events.l" | ||
1142 | case 21: | ||
1143 | #line 83 "util/parse-events.l" | ||
1144 | case 22: | ||
1145 | #line 84 "util/parse-events.l" | ||
1146 | case 23: | ||
1147 | #line 85 "util/parse-events.l" | ||
1148 | case 24: | ||
1149 | #line 86 "util/parse-events.l" | ||
1150 | case 25: | ||
1151 | YY_RULE_SETUP | ||
1152 | #line 86 "util/parse-events.l" | ||
1153 | { return str(PE_NAME_CACHE_TYPE); } | ||
1154 | YY_BREAK | ||
1155 | case 26: | ||
1156 | #line 89 "util/parse-events.l" | ||
1157 | case 27: | ||
1158 | #line 90 "util/parse-events.l" | ||
1159 | case 28: | ||
1160 | #line 91 "util/parse-events.l" | ||
1161 | case 29: | ||
1162 | #line 92 "util/parse-events.l" | ||
1163 | case 30: | ||
1164 | #line 93 "util/parse-events.l" | ||
1165 | case 31: | ||
1166 | YY_RULE_SETUP | ||
1167 | #line 93 "util/parse-events.l" | ||
1168 | { return str(PE_NAME_CACHE_OP_RESULT); } | ||
1169 | YY_BREAK | ||
1170 | /* | ||
1171 | * These are event config hardcoded term names to be specified | ||
1172 | * within xxx/.../ syntax. So far we dont clash with other names, | ||
1173 | * so we can put them here directly. In case the we have a conflict | ||
1174 | * in future, this needs to go into '//' condition block. | ||
1175 | */ | ||
1176 | case 32: | ||
1177 | YY_RULE_SETUP | ||
1178 | #line 101 "util/parse-events.l" | ||
1179 | { return term(PARSE_EVENTS__TERM_TYPE_CONFIG); } | ||
1180 | YY_BREAK | ||
1181 | case 33: | ||
1182 | YY_RULE_SETUP | ||
1183 | #line 102 "util/parse-events.l" | ||
1184 | { return term(PARSE_EVENTS__TERM_TYPE_CONFIG1); } | ||
1185 | YY_BREAK | ||
1186 | case 34: | ||
1187 | YY_RULE_SETUP | ||
1188 | #line 103 "util/parse-events.l" | ||
1189 | { return term(PARSE_EVENTS__TERM_TYPE_CONFIG2); } | ||
1190 | YY_BREAK | ||
1191 | case 35: | ||
1192 | YY_RULE_SETUP | ||
1193 | #line 104 "util/parse-events.l" | ||
1194 | { return term(PARSE_EVENTS__TERM_TYPE_SAMPLE_PERIOD); } | ||
1195 | YY_BREAK | ||
1196 | case 36: | ||
1197 | YY_RULE_SETUP | ||
1198 | #line 105 "util/parse-events.l" | ||
1199 | { return term(PARSE_EVENTS__TERM_TYPE_BRANCH_SAMPLE_TYPE); } | ||
1200 | YY_BREAK | ||
1201 | case 37: | ||
1202 | YY_RULE_SETUP | ||
1203 | #line 107 "util/parse-events.l" | ||
1204 | { return PE_PREFIX_MEM; } | ||
1205 | YY_BREAK | ||
1206 | case 38: | ||
1207 | YY_RULE_SETUP | ||
1208 | #line 108 "util/parse-events.l" | ||
1209 | { return raw(); } | ||
1210 | YY_BREAK | ||
1211 | case 39: | ||
1212 | YY_RULE_SETUP | ||
1213 | #line 109 "util/parse-events.l" | ||
1214 | { return value(10); } | ||
1215 | YY_BREAK | ||
1216 | case 40: | ||
1217 | YY_RULE_SETUP | ||
1218 | #line 110 "util/parse-events.l" | ||
1219 | { return value(16); } | ||
1220 | YY_BREAK | ||
1221 | case 41: | ||
1222 | YY_RULE_SETUP | ||
1223 | #line 112 "util/parse-events.l" | ||
1224 | { return str(PE_MODIFIER_EVENT); } | ||
1225 | YY_BREAK | ||
1226 | case 42: | ||
1227 | YY_RULE_SETUP | ||
1228 | #line 113 "util/parse-events.l" | ||
1229 | { return str(PE_MODIFIER_BP); } | ||
1230 | YY_BREAK | ||
1231 | case 43: | ||
1232 | YY_RULE_SETUP | ||
1233 | #line 114 "util/parse-events.l" | ||
1234 | { return str(PE_NAME); } | ||
1235 | YY_BREAK | ||
1236 | case 44: | ||
1237 | YY_RULE_SETUP | ||
1238 | #line 115 "util/parse-events.l" | ||
1239 | { return '/'; } | ||
1240 | YY_BREAK | ||
1241 | case 45: | ||
1242 | YY_RULE_SETUP | ||
1243 | #line 116 "util/parse-events.l" | ||
1244 | { return '-'; } | ||
1245 | YY_BREAK | ||
1246 | case 46: | ||
1247 | YY_RULE_SETUP | ||
1248 | #line 117 "util/parse-events.l" | ||
1249 | { return ','; } | ||
1250 | YY_BREAK | ||
1251 | case 47: | ||
1252 | YY_RULE_SETUP | ||
1253 | #line 118 "util/parse-events.l" | ||
1254 | { return ':'; } | ||
1255 | YY_BREAK | ||
1256 | case 48: | ||
1257 | YY_RULE_SETUP | ||
1258 | #line 119 "util/parse-events.l" | ||
1259 | { return '='; } | ||
1260 | YY_BREAK | ||
1261 | case 49: | ||
1262 | YY_RULE_SETUP | ||
1263 | #line 121 "util/parse-events.l" | ||
1264 | ECHO; | ||
1265 | YY_BREAK | ||
1266 | #line 1267 "<stdout>" | ||
1267 | case YY_STATE_EOF(INITIAL): | ||
1268 | yyterminate(); | ||
1269 | |||
1270 | case YY_END_OF_BUFFER: | ||
1271 | { | ||
1272 | /* Amount of text matched not including the EOB char. */ | ||
1273 | int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; | ||
1274 | |||
1275 | /* Undo the effects of YY_DO_BEFORE_ACTION. */ | ||
1276 | *yy_cp = (yy_hold_char); | ||
1277 | YY_RESTORE_YY_MORE_OFFSET | ||
1278 | |||
1279 | if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) | ||
1280 | { | ||
1281 | /* We're scanning a new file or input source. It's | ||
1282 | * possible that this happened because the user | ||
1283 | * just pointed parse_events_in at a new source and called | ||
1284 | * parse_events_lex(). If so, then we have to assure | ||
1285 | * consistency between YY_CURRENT_BUFFER and our | ||
1286 | * globals. Here is the right place to do so, because | ||
1287 | * this is the first action (other than possibly a | ||
1288 | * back-up) that will match for the new input source. | ||
1289 | */ | ||
1290 | (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; | ||
1291 | YY_CURRENT_BUFFER_LVALUE->yy_input_file = parse_events_in; | ||
1292 | YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; | ||
1293 | } | ||
1294 | |||
1295 | /* Note that here we test for yy_c_buf_p "<=" to the position | ||
1296 | * of the first EOB in the buffer, since yy_c_buf_p will | ||
1297 | * already have been incremented past the NUL character | ||
1298 | * (since all states make transitions on EOB to the | ||
1299 | * end-of-buffer state). Contrast this with the test | ||
1300 | * in input(). | ||
1301 | */ | ||
1302 | if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) | ||
1303 | { /* This was really a NUL. */ | ||
1304 | yy_state_type yy_next_state; | ||
1305 | |||
1306 | (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; | ||
1307 | |||
1308 | yy_current_state = yy_get_previous_state( ); | ||
1309 | |||
1310 | /* Okay, we're now positioned to make the NUL | ||
1311 | * transition. We couldn't have | ||
1312 | * yy_get_previous_state() go ahead and do it | ||
1313 | * for us because it doesn't know how to deal | ||
1314 | * with the possibility of jamming (and we don't | ||
1315 | * want to build jamming into it because then it | ||
1316 | * will run more slowly). | ||
1317 | */ | ||
1318 | |||
1319 | yy_next_state = yy_try_NUL_trans( yy_current_state ); | ||
1320 | |||
1321 | yy_bp = (yytext_ptr) + YY_MORE_ADJ; | ||
1322 | |||
1323 | if ( yy_next_state ) | ||
1324 | { | ||
1325 | /* Consume the NUL. */ | ||
1326 | yy_cp = ++(yy_c_buf_p); | ||
1327 | yy_current_state = yy_next_state; | ||
1328 | goto yy_match; | ||
1329 | } | ||
1330 | |||
1331 | else | ||
1332 | { | ||
1333 | yy_cp = (yy_c_buf_p); | ||
1334 | goto yy_find_action; | ||
1335 | } | ||
1336 | } | ||
1337 | |||
1338 | else switch ( yy_get_next_buffer( ) ) | ||
1339 | { | ||
1340 | case EOB_ACT_END_OF_FILE: | ||
1341 | { | ||
1342 | (yy_did_buffer_switch_on_eof) = 0; | ||
1343 | |||
1344 | if ( parse_events_wrap( ) ) | ||
1345 | { | ||
1346 | /* Note: because we've taken care in | ||
1347 | * yy_get_next_buffer() to have set up | ||
1348 | * parse_events_text, we can now set up | ||
1349 | * yy_c_buf_p so that if some total | ||
1350 | * hoser (like flex itself) wants to | ||
1351 | * call the scanner after we return the | ||
1352 | * YY_NULL, it'll still work - another | ||
1353 | * YY_NULL will get returned. | ||
1354 | */ | ||
1355 | (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; | ||
1356 | |||
1357 | yy_act = YY_STATE_EOF(YY_START); | ||
1358 | goto do_action; | ||
1359 | } | ||
1360 | |||
1361 | else | ||
1362 | { | ||
1363 | if ( ! (yy_did_buffer_switch_on_eof) ) | ||
1364 | YY_NEW_FILE; | ||
1365 | } | ||
1366 | break; | ||
1367 | } | ||
1368 | |||
1369 | case EOB_ACT_CONTINUE_SCAN: | ||
1370 | (yy_c_buf_p) = | ||
1371 | (yytext_ptr) + yy_amount_of_matched_text; | ||
1372 | |||
1373 | yy_current_state = yy_get_previous_state( ); | ||
1374 | |||
1375 | yy_cp = (yy_c_buf_p); | ||
1376 | yy_bp = (yytext_ptr) + YY_MORE_ADJ; | ||
1377 | goto yy_match; | ||
1378 | |||
1379 | case EOB_ACT_LAST_MATCH: | ||
1380 | (yy_c_buf_p) = | ||
1381 | &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; | ||
1382 | |||
1383 | yy_current_state = yy_get_previous_state( ); | ||
1384 | |||
1385 | yy_cp = (yy_c_buf_p); | ||
1386 | yy_bp = (yytext_ptr) + YY_MORE_ADJ; | ||
1387 | goto yy_find_action; | ||
1388 | } | ||
1389 | break; | ||
1390 | } | ||
1391 | |||
1392 | default: | ||
1393 | YY_FATAL_ERROR( | ||
1394 | "fatal flex scanner internal error--no action found" ); | ||
1395 | } /* end of action switch */ | ||
1396 | } /* end of scanning one token */ | ||
1397 | } /* end of parse_events_lex */ | ||
1398 | |||
1399 | /* yy_get_next_buffer - try to read in a new buffer | ||
1400 | * | ||
1401 | * Returns a code representing an action: | ||
1402 | * EOB_ACT_LAST_MATCH - | ||
1403 | * EOB_ACT_CONTINUE_SCAN - continue scanning from current position | ||
1404 | * EOB_ACT_END_OF_FILE - end of file | ||
1405 | */ | ||
1406 | static int yy_get_next_buffer (void) | ||
1407 | { | ||
1408 | register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; | ||
1409 | register char *source = (yytext_ptr); | ||
1410 | register int number_to_move, i; | ||
1411 | int ret_val; | ||
1412 | |||
1413 | if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) | ||
1414 | YY_FATAL_ERROR( | ||
1415 | "fatal flex scanner internal error--end of buffer missed" ); | ||
1416 | |||
1417 | if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) | ||
1418 | { /* Don't try to fill the buffer, so this is an EOF. */ | ||
1419 | if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) | ||
1420 | { | ||
1421 | /* We matched a single character, the EOB, so | ||
1422 | * treat this as a final EOF. | ||
1423 | */ | ||
1424 | return EOB_ACT_END_OF_FILE; | ||
1425 | } | ||
1426 | |||
1427 | else | ||
1428 | { | ||
1429 | /* We matched some text prior to the EOB, first | ||
1430 | * process it. | ||
1431 | */ | ||
1432 | return EOB_ACT_LAST_MATCH; | ||
1433 | } | ||
1434 | } | ||
1435 | |||
1436 | /* Try to read more data. */ | ||
1437 | |||
1438 | /* First move last chars to start of buffer. */ | ||
1439 | number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; | ||
1440 | |||
1441 | for ( i = 0; i < number_to_move; ++i ) | ||
1442 | *(dest++) = *(source++); | ||
1443 | |||
1444 | if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) | ||
1445 | /* don't do the read, it's not guaranteed to return an EOF, | ||
1446 | * just force an EOF | ||
1447 | */ | ||
1448 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; | ||
1449 | |||
1450 | else | ||
1451 | { | ||
1452 | int num_to_read = | ||
1453 | YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; | ||
1454 | |||
1455 | while ( num_to_read <= 0 ) | ||
1456 | { /* Not enough room in the buffer - grow it. */ | ||
1457 | |||
1458 | /* just a shorter name for the current buffer */ | ||
1459 | YY_BUFFER_STATE b = YY_CURRENT_BUFFER; | ||
1460 | |||
1461 | int yy_c_buf_p_offset = | ||
1462 | (int) ((yy_c_buf_p) - b->yy_ch_buf); | ||
1463 | |||
1464 | if ( b->yy_is_our_buffer ) | ||
1465 | { | ||
1466 | int new_size = b->yy_buf_size * 2; | ||
1467 | |||
1468 | if ( new_size <= 0 ) | ||
1469 | b->yy_buf_size += b->yy_buf_size / 8; | ||
1470 | else | ||
1471 | b->yy_buf_size *= 2; | ||
1472 | |||
1473 | b->yy_ch_buf = (char *) | ||
1474 | /* Include room in for 2 EOB chars. */ | ||
1475 | parse_events_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); | ||
1476 | } | ||
1477 | else | ||
1478 | /* Can't grow it, we don't own it. */ | ||
1479 | b->yy_ch_buf = 0; | ||
1480 | |||
1481 | if ( ! b->yy_ch_buf ) | ||
1482 | YY_FATAL_ERROR( | ||
1483 | "fatal error - scanner input buffer overflow" ); | ||
1484 | |||
1485 | (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; | ||
1486 | |||
1487 | num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - | ||
1488 | number_to_move - 1; | ||
1489 | |||
1490 | } | ||
1491 | |||
1492 | if ( num_to_read > YY_READ_BUF_SIZE ) | ||
1493 | num_to_read = YY_READ_BUF_SIZE; | ||
1494 | |||
1495 | /* Read in more data. */ | ||
1496 | YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), | ||
1497 | (yy_n_chars), (size_t) num_to_read ); | ||
1498 | |||
1499 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); | ||
1500 | } | ||
1501 | |||
1502 | if ( (yy_n_chars) == 0 ) | ||
1503 | { | ||
1504 | if ( number_to_move == YY_MORE_ADJ ) | ||
1505 | { | ||
1506 | ret_val = EOB_ACT_END_OF_FILE; | ||
1507 | parse_events_restart(parse_events_in ); | ||
1508 | } | ||
1509 | |||
1510 | else | ||
1511 | { | ||
1512 | ret_val = EOB_ACT_LAST_MATCH; | ||
1513 | YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = | ||
1514 | YY_BUFFER_EOF_PENDING; | ||
1515 | } | ||
1516 | } | ||
1517 | |||
1518 | else | ||
1519 | ret_val = EOB_ACT_CONTINUE_SCAN; | ||
1520 | |||
1521 | if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { | ||
1522 | /* Extend the array by 50%, plus the number we really need. */ | ||
1523 | yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); | ||
1524 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) parse_events_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); | ||
1525 | if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) | ||
1526 | YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); | ||
1527 | } | ||
1528 | |||
1529 | (yy_n_chars) += number_to_move; | ||
1530 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; | ||
1531 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; | ||
1532 | |||
1533 | (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; | ||
1534 | |||
1535 | return ret_val; | ||
1536 | } | ||
1537 | |||
1538 | /* yy_get_previous_state - get the state just before the EOB char was reached */ | ||
1539 | |||
1540 | static yy_state_type yy_get_previous_state (void) | ||
1541 | { | ||
1542 | register yy_state_type yy_current_state; | ||
1543 | register char *yy_cp; | ||
1544 | |||
1545 | yy_current_state = (yy_start); | ||
1546 | |||
1547 | for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) | ||
1548 | { | ||
1549 | register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); | ||
1550 | if ( yy_accept[yy_current_state] ) | ||
1551 | { | ||
1552 | (yy_last_accepting_state) = yy_current_state; | ||
1553 | (yy_last_accepting_cpos) = yy_cp; | ||
1554 | } | ||
1555 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) | ||
1556 | { | ||
1557 | yy_current_state = (int) yy_def[yy_current_state]; | ||
1558 | if ( yy_current_state >= 440 ) | ||
1559 | yy_c = yy_meta[(unsigned int) yy_c]; | ||
1560 | } | ||
1561 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; | ||
1562 | } | ||
1563 | |||
1564 | return yy_current_state; | ||
1565 | } | ||
1566 | |||
1567 | /* yy_try_NUL_trans - try to make a transition on the NUL character | ||
1568 | * | ||
1569 | * synopsis | ||
1570 | * next_state = yy_try_NUL_trans( current_state ); | ||
1571 | */ | ||
1572 | static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) | ||
1573 | { | ||
1574 | register int yy_is_jam; | ||
1575 | register char *yy_cp = (yy_c_buf_p); | ||
1576 | |||
1577 | register YY_CHAR yy_c = 1; | ||
1578 | if ( yy_accept[yy_current_state] ) | ||
1579 | { | ||
1580 | (yy_last_accepting_state) = yy_current_state; | ||
1581 | (yy_last_accepting_cpos) = yy_cp; | ||
1582 | } | ||
1583 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) | ||
1584 | { | ||
1585 | yy_current_state = (int) yy_def[yy_current_state]; | ||
1586 | if ( yy_current_state >= 440 ) | ||
1587 | yy_c = yy_meta[(unsigned int) yy_c]; | ||
1588 | } | ||
1589 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; | ||
1590 | yy_is_jam = (yy_current_state == 439); | ||
1591 | |||
1592 | return yy_is_jam ? 0 : yy_current_state; | ||
1593 | } | ||
1594 | |||
1595 | static void yyunput (int c, register char * yy_bp ) | ||
1596 | { | ||
1597 | register char *yy_cp; | ||
1598 | |||
1599 | yy_cp = (yy_c_buf_p); | ||
1600 | |||
1601 | /* undo effects of setting up parse_events_text */ | ||
1602 | *yy_cp = (yy_hold_char); | ||
1603 | |||
1604 | if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) | ||
1605 | { /* need to shift things up to make room */ | ||
1606 | /* +2 for EOB chars. */ | ||
1607 | register int number_to_move = (yy_n_chars) + 2; | ||
1608 | register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ | ||
1609 | YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; | ||
1610 | register char *source = | ||
1611 | &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; | ||
1612 | |||
1613 | while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) | ||
1614 | *--dest = *--source; | ||
1615 | |||
1616 | yy_cp += (int) (dest - source); | ||
1617 | yy_bp += (int) (dest - source); | ||
1618 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = | ||
1619 | (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; | ||
1620 | |||
1621 | if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) | ||
1622 | YY_FATAL_ERROR( "flex scanner push-back overflow" ); | ||
1623 | } | ||
1624 | |||
1625 | *--yy_cp = (char) c; | ||
1626 | |||
1627 | (yytext_ptr) = yy_bp; | ||
1628 | (yy_hold_char) = *yy_cp; | ||
1629 | (yy_c_buf_p) = yy_cp; | ||
1630 | } | ||
1631 | |||
1632 | #ifndef YY_NO_INPUT | ||
1633 | #ifdef __cplusplus | ||
1634 | static int yyinput (void) | ||
1635 | #else | ||
1636 | static int input (void) | ||
1637 | #endif | ||
1638 | |||
1639 | { | ||
1640 | int c; | ||
1641 | |||
1642 | *(yy_c_buf_p) = (yy_hold_char); | ||
1643 | |||
1644 | if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) | ||
1645 | { | ||
1646 | /* yy_c_buf_p now points to the character we want to return. | ||
1647 | * If this occurs *before* the EOB characters, then it's a | ||
1648 | * valid NUL; if not, then we've hit the end of the buffer. | ||
1649 | */ | ||
1650 | if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) | ||
1651 | /* This was really a NUL. */ | ||
1652 | *(yy_c_buf_p) = '\0'; | ||
1653 | |||
1654 | else | ||
1655 | { /* need more input */ | ||
1656 | int offset = (yy_c_buf_p) - (yytext_ptr); | ||
1657 | ++(yy_c_buf_p); | ||
1658 | |||
1659 | switch ( yy_get_next_buffer( ) ) | ||
1660 | { | ||
1661 | case EOB_ACT_LAST_MATCH: | ||
1662 | /* This happens because yy_g_n_b() | ||
1663 | * sees that we've accumulated a | ||
1664 | * token and flags that we need to | ||
1665 | * try matching the token before | ||
1666 | * proceeding. But for input(), | ||
1667 | * there's no matching to consider. | ||
1668 | * So convert the EOB_ACT_LAST_MATCH | ||
1669 | * to EOB_ACT_END_OF_FILE. | ||
1670 | */ | ||
1671 | |||
1672 | /* Reset buffer status. */ | ||
1673 | parse_events_restart(parse_events_in ); | ||
1674 | |||
1675 | /*FALLTHROUGH*/ | ||
1676 | |||
1677 | case EOB_ACT_END_OF_FILE: | ||
1678 | { | ||
1679 | if ( parse_events_wrap( ) ) | ||
1680 | return EOF; | ||
1681 | |||
1682 | if ( ! (yy_did_buffer_switch_on_eof) ) | ||
1683 | YY_NEW_FILE; | ||
1684 | #ifdef __cplusplus | ||
1685 | return yyinput(); | ||
1686 | #else | ||
1687 | return input(); | ||
1688 | #endif | ||
1689 | } | ||
1690 | |||
1691 | case EOB_ACT_CONTINUE_SCAN: | ||
1692 | (yy_c_buf_p) = (yytext_ptr) + offset; | ||
1693 | break; | ||
1694 | } | ||
1695 | } | ||
1696 | } | ||
1697 | |||
1698 | c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ | ||
1699 | *(yy_c_buf_p) = '\0'; /* preserve parse_events_text */ | ||
1700 | (yy_hold_char) = *++(yy_c_buf_p); | ||
1701 | |||
1702 | return c; | ||
1703 | } | ||
1704 | #endif /* ifndef YY_NO_INPUT */ | ||
1705 | |||
1706 | /** Immediately switch to a different input stream. | ||
1707 | * @param input_file A readable stream. | ||
1708 | * | ||
1709 | * @note This function does not reset the start condition to @c INITIAL . | ||
1710 | */ | ||
1711 | void parse_events_restart (FILE * input_file ) | ||
1712 | { | ||
1713 | |||
1714 | if ( ! YY_CURRENT_BUFFER ){ | ||
1715 | parse_events_ensure_buffer_stack (); | ||
1716 | YY_CURRENT_BUFFER_LVALUE = | ||
1717 | parse_events__create_buffer(parse_events_in,YY_BUF_SIZE ); | ||
1718 | } | ||
1719 | |||
1720 | parse_events__init_buffer(YY_CURRENT_BUFFER,input_file ); | ||
1721 | parse_events__load_buffer_state( ); | ||
1722 | } | ||
1723 | |||
1724 | /** Switch to a different input buffer. | ||
1725 | * @param new_buffer The new input buffer. | ||
1726 | * | ||
1727 | */ | ||
1728 | void parse_events__switch_to_buffer (YY_BUFFER_STATE new_buffer ) | ||
1729 | { | ||
1730 | |||
1731 | /* TODO. We should be able to replace this entire function body | ||
1732 | * with | ||
1733 | * parse_events_pop_buffer_state(); | ||
1734 | * parse_events_push_buffer_state(new_buffer); | ||
1735 | */ | ||
1736 | parse_events_ensure_buffer_stack (); | ||
1737 | if ( YY_CURRENT_BUFFER == new_buffer ) | ||
1738 | return; | ||
1739 | |||
1740 | if ( YY_CURRENT_BUFFER ) | ||
1741 | { | ||
1742 | /* Flush out information for old buffer. */ | ||
1743 | *(yy_c_buf_p) = (yy_hold_char); | ||
1744 | YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); | ||
1745 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); | ||
1746 | } | ||
1747 | |||
1748 | YY_CURRENT_BUFFER_LVALUE = new_buffer; | ||
1749 | parse_events__load_buffer_state( ); | ||
1750 | |||
1751 | /* We don't actually know whether we did this switch during | ||
1752 | * EOF (parse_events_wrap()) processing, but the only time this flag | ||
1753 | * is looked at is after parse_events_wrap() is called, so it's safe | ||
1754 | * to go ahead and always set it. | ||
1755 | */ | ||
1756 | (yy_did_buffer_switch_on_eof) = 1; | ||
1757 | } | ||
1758 | |||
1759 | static void parse_events__load_buffer_state (void) | ||
1760 | { | ||
1761 | (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; | ||
1762 | (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; | ||
1763 | parse_events_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file; | ||
1764 | (yy_hold_char) = *(yy_c_buf_p); | ||
1765 | } | ||
1766 | |||
1767 | /** Allocate and initialize an input buffer state. | ||
1768 | * @param file A readable stream. | ||
1769 | * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. | ||
1770 | * | ||
1771 | * @return the allocated buffer state. | ||
1772 | */ | ||
1773 | YY_BUFFER_STATE parse_events__create_buffer (FILE * file, int size ) | ||
1774 | { | ||
1775 | YY_BUFFER_STATE b; | ||
1776 | |||
1777 | b = (YY_BUFFER_STATE) parse_events_alloc(sizeof( struct yy_buffer_state ) ); | ||
1778 | if ( ! b ) | ||
1779 | YY_FATAL_ERROR( "out of dynamic memory in parse_events__create_buffer()" ); | ||
1780 | |||
1781 | b->yy_buf_size = size; | ||
1782 | |||
1783 | /* yy_ch_buf has to be 2 characters longer than the size given because | ||
1784 | * we need to put in 2 end-of-buffer characters. | ||
1785 | */ | ||
1786 | b->yy_ch_buf = (char *) parse_events_alloc(b->yy_buf_size + 2 ); | ||
1787 | if ( ! b->yy_ch_buf ) | ||
1788 | YY_FATAL_ERROR( "out of dynamic memory in parse_events__create_buffer()" ); | ||
1789 | |||
1790 | b->yy_is_our_buffer = 1; | ||
1791 | |||
1792 | parse_events__init_buffer(b,file ); | ||
1793 | |||
1794 | return b; | ||
1795 | } | ||
1796 | |||
1797 | /** Destroy the buffer. | ||
1798 | * @param b a buffer created with parse_events__create_buffer() | ||
1799 | * | ||
1800 | */ | ||
1801 | void parse_events__delete_buffer (YY_BUFFER_STATE b ) | ||
1802 | { | ||
1803 | |||
1804 | if ( ! b ) | ||
1805 | return; | ||
1806 | |||
1807 | if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ | ||
1808 | YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; | ||
1809 | |||
1810 | if ( b->yy_is_our_buffer ) | ||
1811 | parse_events_free((void *) b->yy_ch_buf ); | ||
1812 | |||
1813 | parse_events_free((void *) b ); | ||
1814 | } | ||
1815 | |||
1816 | #ifndef __cplusplus | ||
1817 | extern int isatty (int ); | ||
1818 | #endif /* __cplusplus */ | ||
1819 | |||
1820 | /* Initializes or reinitializes a buffer. | ||
1821 | * This function is sometimes called more than once on the same buffer, | ||
1822 | * such as during a parse_events_restart() or at EOF. | ||
1823 | */ | ||
1824 | static void parse_events__init_buffer (YY_BUFFER_STATE b, FILE * file ) | ||
1825 | |||
1826 | { | ||
1827 | int oerrno = errno; | ||
1828 | |||
1829 | parse_events__flush_buffer(b ); | ||
1830 | |||
1831 | b->yy_input_file = file; | ||
1832 | b->yy_fill_buffer = 1; | ||
1833 | |||
1834 | /* If b is the current buffer, then parse_events__init_buffer was _probably_ | ||
1835 | * called from parse_events_restart() or through yy_get_next_buffer. | ||
1836 | * In that case, we don't want to reset the lineno or column. | ||
1837 | */ | ||
1838 | if (b != YY_CURRENT_BUFFER){ | ||
1839 | b->yy_bs_lineno = 1; | ||
1840 | b->yy_bs_column = 0; | ||
1841 | } | ||
1842 | |||
1843 | b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; | ||
1844 | |||
1845 | errno = oerrno; | ||
1846 | } | ||
1847 | |||
1848 | /** Discard all buffered characters. On the next scan, YY_INPUT will be called. | ||
1849 | * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. | ||
1850 | * | ||
1851 | */ | ||
1852 | void parse_events__flush_buffer (YY_BUFFER_STATE b ) | ||
1853 | { | ||
1854 | if ( ! b ) | ||
1855 | return; | ||
1856 | |||
1857 | b->yy_n_chars = 0; | ||
1858 | |||
1859 | /* We always need two end-of-buffer characters. The first causes | ||
1860 | * a transition to the end-of-buffer state. The second causes | ||
1861 | * a jam in that state. | ||
1862 | */ | ||
1863 | b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; | ||
1864 | b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; | ||
1865 | |||
1866 | b->yy_buf_pos = &b->yy_ch_buf[0]; | ||
1867 | |||
1868 | b->yy_at_bol = 1; | ||
1869 | b->yy_buffer_status = YY_BUFFER_NEW; | ||
1870 | |||
1871 | if ( b == YY_CURRENT_BUFFER ) | ||
1872 | parse_events__load_buffer_state( ); | ||
1873 | } | ||
1874 | |||
1875 | /** Pushes the new state onto the stack. The new state becomes | ||
1876 | * the current state. This function will allocate the stack | ||
1877 | * if necessary. | ||
1878 | * @param new_buffer The new state. | ||
1879 | * | ||
1880 | */ | ||
1881 | void parse_events_push_buffer_state (YY_BUFFER_STATE new_buffer ) | ||
1882 | { | ||
1883 | if (new_buffer == NULL) | ||
1884 | return; | ||
1885 | |||
1886 | parse_events_ensure_buffer_stack(); | ||
1887 | |||
1888 | /* This block is copied from parse_events__switch_to_buffer. */ | ||
1889 | if ( YY_CURRENT_BUFFER ) | ||
1890 | { | ||
1891 | /* Flush out information for old buffer. */ | ||
1892 | *(yy_c_buf_p) = (yy_hold_char); | ||
1893 | YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); | ||
1894 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); | ||
1895 | } | ||
1896 | |||
1897 | /* Only push if top exists. Otherwise, replace top. */ | ||
1898 | if (YY_CURRENT_BUFFER) | ||
1899 | (yy_buffer_stack_top)++; | ||
1900 | YY_CURRENT_BUFFER_LVALUE = new_buffer; | ||
1901 | |||
1902 | /* copied from parse_events__switch_to_buffer. */ | ||
1903 | parse_events__load_buffer_state( ); | ||
1904 | (yy_did_buffer_switch_on_eof) = 1; | ||
1905 | } | ||
1906 | |||
1907 | /** Removes and deletes the top of the stack, if present. | ||
1908 | * The next element becomes the new top. | ||
1909 | * | ||
1910 | */ | ||
1911 | void parse_events_pop_buffer_state (void) | ||
1912 | { | ||
1913 | if (!YY_CURRENT_BUFFER) | ||
1914 | return; | ||
1915 | |||
1916 | parse_events__delete_buffer(YY_CURRENT_BUFFER ); | ||
1917 | YY_CURRENT_BUFFER_LVALUE = NULL; | ||
1918 | if ((yy_buffer_stack_top) > 0) | ||
1919 | --(yy_buffer_stack_top); | ||
1920 | |||
1921 | if (YY_CURRENT_BUFFER) { | ||
1922 | parse_events__load_buffer_state( ); | ||
1923 | (yy_did_buffer_switch_on_eof) = 1; | ||
1924 | } | ||
1925 | } | ||
1926 | |||
1927 | /* Allocates the stack if it does not exist. | ||
1928 | * Guarantees space for at least one push. | ||
1929 | */ | ||
1930 | static void parse_events_ensure_buffer_stack (void) | ||
1931 | { | ||
1932 | int num_to_alloc; | ||
1933 | |||
1934 | if (!(yy_buffer_stack)) { | ||
1935 | |||
1936 | /* First allocation is just for 2 elements, since we don't know if this | ||
1937 | * scanner will even need a stack. We use 2 instead of 1 to avoid an | ||
1938 | * immediate realloc on the next call. | ||
1939 | */ | ||
1940 | num_to_alloc = 1; | ||
1941 | (yy_buffer_stack) = (struct yy_buffer_state**)parse_events_alloc | ||
1942 | (num_to_alloc * sizeof(struct yy_buffer_state*) | ||
1943 | ); | ||
1944 | if ( ! (yy_buffer_stack) ) | ||
1945 | YY_FATAL_ERROR( "out of dynamic memory in parse_events_ensure_buffer_stack()" ); | ||
1946 | |||
1947 | memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); | ||
1948 | |||
1949 | (yy_buffer_stack_max) = num_to_alloc; | ||
1950 | (yy_buffer_stack_top) = 0; | ||
1951 | return; | ||
1952 | } | ||
1953 | |||
1954 | if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ | ||
1955 | |||
1956 | /* Increase the buffer to prepare for a possible push. */ | ||
1957 | int grow_size = 8 /* arbitrary grow size */; | ||
1958 | |||
1959 | num_to_alloc = (yy_buffer_stack_max) + grow_size; | ||
1960 | (yy_buffer_stack) = (struct yy_buffer_state**)parse_events_realloc | ||
1961 | ((yy_buffer_stack), | ||
1962 | num_to_alloc * sizeof(struct yy_buffer_state*) | ||
1963 | ); | ||
1964 | if ( ! (yy_buffer_stack) ) | ||
1965 | YY_FATAL_ERROR( "out of dynamic memory in parse_events_ensure_buffer_stack()" ); | ||
1966 | |||
1967 | /* zero only the new slots.*/ | ||
1968 | memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); | ||
1969 | (yy_buffer_stack_max) = num_to_alloc; | ||
1970 | } | ||
1971 | } | ||
1972 | |||
1973 | /** Setup the input buffer state to scan directly from a user-specified character buffer. | ||
1974 | * @param base the character buffer | ||
1975 | * @param size the size in bytes of the character buffer | ||
1976 | * | ||
1977 | * @return the newly allocated buffer state object. | ||
1978 | */ | ||
1979 | YY_BUFFER_STATE parse_events__scan_buffer (char * base, yy_size_t size ) | ||
1980 | { | ||
1981 | YY_BUFFER_STATE b; | ||
1982 | |||
1983 | if ( size < 2 || | ||
1984 | base[size-2] != YY_END_OF_BUFFER_CHAR || | ||
1985 | base[size-1] != YY_END_OF_BUFFER_CHAR ) | ||
1986 | /* They forgot to leave room for the EOB's. */ | ||
1987 | return 0; | ||
1988 | |||
1989 | b = (YY_BUFFER_STATE) parse_events_alloc(sizeof( struct yy_buffer_state ) ); | ||
1990 | if ( ! b ) | ||
1991 | YY_FATAL_ERROR( "out of dynamic memory in parse_events__scan_buffer()" ); | ||
1992 | |||
1993 | b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ | ||
1994 | b->yy_buf_pos = b->yy_ch_buf = base; | ||
1995 | b->yy_is_our_buffer = 0; | ||
1996 | b->yy_input_file = 0; | ||
1997 | b->yy_n_chars = b->yy_buf_size; | ||
1998 | b->yy_is_interactive = 0; | ||
1999 | b->yy_at_bol = 1; | ||
2000 | b->yy_fill_buffer = 0; | ||
2001 | b->yy_buffer_status = YY_BUFFER_NEW; | ||
2002 | |||
2003 | parse_events__switch_to_buffer(b ); | ||
2004 | |||
2005 | return b; | ||
2006 | } | ||
2007 | |||
2008 | /** Setup the input buffer state to scan a string. The next call to parse_events_lex() will | ||
2009 | * scan from a @e copy of @a str. | ||
2010 | * @param yystr a NUL-terminated string to scan | ||
2011 | * | ||
2012 | * @return the newly allocated buffer state object. | ||
2013 | * @note If you want to scan bytes that may contain NUL values, then use | ||
2014 | * parse_events__scan_bytes() instead. | ||
2015 | */ | ||
2016 | YY_BUFFER_STATE parse_events__scan_string (yyconst char * yystr ) | ||
2017 | { | ||
2018 | |||
2019 | return parse_events__scan_bytes(yystr,strlen(yystr) ); | ||
2020 | } | ||
2021 | |||
2022 | /** Setup the input buffer state to scan the given bytes. The next call to parse_events_lex() will | ||
2023 | * scan from a @e copy of @a bytes. | ||
2024 | * @param bytes the byte buffer to scan | ||
2025 | * @param len the number of bytes in the buffer pointed to by @a bytes. | ||
2026 | * | ||
2027 | * @return the newly allocated buffer state object. | ||
2028 | */ | ||
2029 | YY_BUFFER_STATE parse_events__scan_bytes (yyconst char * yybytes, int _yybytes_len ) | ||
2030 | { | ||
2031 | YY_BUFFER_STATE b; | ||
2032 | char *buf; | ||
2033 | yy_size_t n; | ||
2034 | int i; | ||
2035 | |||
2036 | /* Get memory for full buffer, including space for trailing EOB's. */ | ||
2037 | n = _yybytes_len + 2; | ||
2038 | buf = (char *) parse_events_alloc(n ); | ||
2039 | if ( ! buf ) | ||
2040 | YY_FATAL_ERROR( "out of dynamic memory in parse_events__scan_bytes()" ); | ||
2041 | |||
2042 | for ( i = 0; i < _yybytes_len; ++i ) | ||
2043 | buf[i] = yybytes[i]; | ||
2044 | |||
2045 | buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; | ||
2046 | |||
2047 | b = parse_events__scan_buffer(buf,n ); | ||
2048 | if ( ! b ) | ||
2049 | YY_FATAL_ERROR( "bad buffer in parse_events__scan_bytes()" ); | ||
2050 | |||
2051 | /* It's okay to grow etc. this buffer, and we should throw it | ||
2052 | * away when we're done. | ||
2053 | */ | ||
2054 | b->yy_is_our_buffer = 1; | ||
2055 | |||
2056 | return b; | ||
2057 | } | ||
2058 | |||
2059 | #ifndef YY_EXIT_FAILURE | ||
2060 | #define YY_EXIT_FAILURE 2 | ||
2061 | #endif | ||
2062 | |||
2063 | static void yy_fatal_error (yyconst char* msg ) | ||
2064 | { | ||
2065 | (void) fprintf( stderr, "%s\n", msg ); | ||
2066 | exit( YY_EXIT_FAILURE ); | ||
2067 | } | ||
2068 | |||
2069 | /* Redefine yyless() so it works in section 3 code. */ | ||
2070 | |||
2071 | #undef yyless | ||
2072 | #define yyless(n) \ | ||
2073 | do \ | ||
2074 | { \ | ||
2075 | /* Undo effects of setting up parse_events_text. */ \ | ||
2076 | int yyless_macro_arg = (n); \ | ||
2077 | YY_LESS_LINENO(yyless_macro_arg);\ | ||
2078 | parse_events_text[parse_events_leng] = (yy_hold_char); \ | ||
2079 | (yy_c_buf_p) = parse_events_text + yyless_macro_arg; \ | ||
2080 | (yy_hold_char) = *(yy_c_buf_p); \ | ||
2081 | *(yy_c_buf_p) = '\0'; \ | ||
2082 | parse_events_leng = yyless_macro_arg; \ | ||
2083 | } \ | ||
2084 | while ( 0 ) | ||
2085 | |||
2086 | /* Accessor methods (get/set functions) to struct members. */ | ||
2087 | |||
2088 | /** Get the current line number. | ||
2089 | * | ||
2090 | */ | ||
2091 | int parse_events_get_lineno (void) | ||
2092 | { | ||
2093 | |||
2094 | return parse_events_lineno; | ||
2095 | } | ||
2096 | |||
2097 | /** Get the input stream. | ||
2098 | * | ||
2099 | */ | ||
2100 | FILE *parse_events_get_in (void) | ||
2101 | { | ||
2102 | return parse_events_in; | ||
2103 | } | ||
2104 | |||
2105 | /** Get the output stream. | ||
2106 | * | ||
2107 | */ | ||
2108 | FILE *parse_events_get_out (void) | ||
2109 | { | ||
2110 | return parse_events_out; | ||
2111 | } | ||
2112 | |||
2113 | /** Get the length of the current token. | ||
2114 | * | ||
2115 | */ | ||
2116 | int parse_events_get_leng (void) | ||
2117 | { | ||
2118 | return parse_events_leng; | ||
2119 | } | ||
2120 | |||
2121 | /** Get the current token. | ||
2122 | * | ||
2123 | */ | ||
2124 | |||
2125 | char *parse_events_get_text (void) | ||
2126 | { | ||
2127 | return parse_events_text; | ||
2128 | } | ||
2129 | |||
2130 | /** Set the current line number. | ||
2131 | * @param line_number | ||
2132 | * | ||
2133 | */ | ||
2134 | void parse_events_set_lineno (int line_number ) | ||
2135 | { | ||
2136 | |||
2137 | parse_events_lineno = line_number; | ||
2138 | } | ||
2139 | |||
2140 | /** Set the input stream. This does not discard the current | ||
2141 | * input buffer. | ||
2142 | * @param in_str A readable stream. | ||
2143 | * | ||
2144 | * @see parse_events__switch_to_buffer | ||
2145 | */ | ||
2146 | void parse_events_set_in (FILE * in_str ) | ||
2147 | { | ||
2148 | parse_events_in = in_str ; | ||
2149 | } | ||
2150 | |||
2151 | void parse_events_set_out (FILE * out_str ) | ||
2152 | { | ||
2153 | parse_events_out = out_str ; | ||
2154 | } | ||
2155 | |||
2156 | int parse_events_get_debug (void) | ||
2157 | { | ||
2158 | return parse_events__flex_debug; | ||
2159 | } | ||
2160 | |||
2161 | void parse_events_set_debug (int bdebug ) | ||
2162 | { | ||
2163 | parse_events__flex_debug = bdebug ; | ||
2164 | } | ||
2165 | |||
2166 | static int yy_init_globals (void) | ||
2167 | { | ||
2168 | /* Initialization is the same as for the non-reentrant scanner. | ||
2169 | * This function is called from parse_events_lex_destroy(), so don't allocate here. | ||
2170 | */ | ||
2171 | |||
2172 | (yy_buffer_stack) = 0; | ||
2173 | (yy_buffer_stack_top) = 0; | ||
2174 | (yy_buffer_stack_max) = 0; | ||
2175 | (yy_c_buf_p) = (char *) 0; | ||
2176 | (yy_init) = 0; | ||
2177 | (yy_start) = 0; | ||
2178 | |||
2179 | /* Defined in main.c */ | ||
2180 | #ifdef YY_STDINIT | ||
2181 | parse_events_in = stdin; | ||
2182 | parse_events_out = stdout; | ||
2183 | #else | ||
2184 | parse_events_in = (FILE *) 0; | ||
2185 | parse_events_out = (FILE *) 0; | ||
2186 | #endif | ||
2187 | |||
2188 | /* For future reference: Set errno on error, since we are called by | ||
2189 | * parse_events_lex_init() | ||
2190 | */ | ||
2191 | return 0; | ||
2192 | } | ||
2193 | |||
2194 | /* parse_events_lex_destroy is for both reentrant and non-reentrant scanners. */ | ||
2195 | int parse_events_lex_destroy (void) | ||
2196 | { | ||
2197 | |||
2198 | /* Pop the buffer stack, destroying each element. */ | ||
2199 | while(YY_CURRENT_BUFFER){ | ||
2200 | parse_events__delete_buffer(YY_CURRENT_BUFFER ); | ||
2201 | YY_CURRENT_BUFFER_LVALUE = NULL; | ||
2202 | parse_events_pop_buffer_state(); | ||
2203 | } | ||
2204 | |||
2205 | /* Destroy the stack itself. */ | ||
2206 | parse_events_free((yy_buffer_stack) ); | ||
2207 | (yy_buffer_stack) = NULL; | ||
2208 | |||
2209 | /* Reset the globals. This is important in a non-reentrant scanner so the next time | ||
2210 | * parse_events_lex() is called, initialization will occur. */ | ||
2211 | yy_init_globals( ); | ||
2212 | |||
2213 | return 0; | ||
2214 | } | ||
2215 | |||
2216 | /* | ||
2217 | * Internal utility routines. | ||
2218 | */ | ||
2219 | |||
2220 | #ifndef yytext_ptr | ||
2221 | static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) | ||
2222 | { | ||
2223 | register int i; | ||
2224 | for ( i = 0; i < n; ++i ) | ||
2225 | s1[i] = s2[i]; | ||
2226 | } | ||
2227 | #endif | ||
2228 | |||
2229 | #ifdef YY_NEED_STRLEN | ||
2230 | static int yy_flex_strlen (yyconst char * s ) | ||
2231 | { | ||
2232 | register int n; | ||
2233 | for ( n = 0; s[n]; ++n ) | ||
2234 | ; | ||
2235 | |||
2236 | return n; | ||
2237 | } | ||
2238 | #endif | ||
2239 | |||
2240 | void *parse_events_alloc (yy_size_t size ) | ||
2241 | { | ||
2242 | return (void *) malloc( size ); | ||
2243 | } | ||
2244 | |||
2245 | void *parse_events_realloc (void * ptr, yy_size_t size ) | ||
2246 | { | ||
2247 | /* The cast to (char *) in the following accommodates both | ||
2248 | * implementations that use char* generic pointers, and those | ||
2249 | * that use void* generic pointers. It works with the latter | ||
2250 | * because both ANSI C and C++ allow castless assignment from | ||
2251 | * any pointer type to void*, and deal with argument conversions | ||
2252 | * as though doing an assignment. | ||
2253 | */ | ||
2254 | return (void *) realloc( (char *) ptr, size ); | ||
2255 | } | ||
2256 | |||
2257 | void parse_events_free (void * ptr ) | ||
2258 | { | ||
2259 | free( (char *) ptr ); /* see parse_events_realloc() for (char *) cast */ | ||
2260 | } | ||
2261 | |||
2262 | #define YYTABLES_NAME "yytables" | ||
2263 | |||
2264 | #line 121 "util/parse-events.l" | ||
2265 | |||
2266 | |||
2267 | |||
2268 | int parse_events_wrap(void) | ||
2269 | { | ||
2270 | return 1; | ||
2271 | } | ||
2272 | |||
diff --git a/tools/perf/util/parse-events-flex.h b/tools/perf/util/parse-events-flex.h deleted file mode 100644 index ceb9b20d732c..000000000000 --- a/tools/perf/util/parse-events-flex.h +++ /dev/null | |||
@@ -1,316 +0,0 @@ | |||
1 | #ifndef parse_events_HEADER_H | ||
2 | #define parse_events_HEADER_H 1 | ||
3 | #define parse_events_IN_HEADER 1 | ||
4 | |||
5 | #line 6 "util/parse-events-flex.h" | ||
6 | |||
7 | #define YY_INT_ALIGNED short int | ||
8 | |||
9 | /* A lexical scanner generated by flex */ | ||
10 | |||
11 | #define FLEX_SCANNER | ||
12 | #define YY_FLEX_MAJOR_VERSION 2 | ||
13 | #define YY_FLEX_MINOR_VERSION 5 | ||
14 | #define YY_FLEX_SUBMINOR_VERSION 35 | ||
15 | #if YY_FLEX_SUBMINOR_VERSION > 0 | ||
16 | #define FLEX_BETA | ||
17 | #endif | ||
18 | |||
19 | /* First, we deal with platform-specific or compiler-specific issues. */ | ||
20 | |||
21 | /* begin standard C headers. */ | ||
22 | #include <stdio.h> | ||
23 | #include <string.h> | ||
24 | #include <errno.h> | ||
25 | #include <stdlib.h> | ||
26 | |||
27 | /* end standard C headers. */ | ||
28 | |||
29 | /* flex integer type definitions */ | ||
30 | |||
31 | #ifndef FLEXINT_H | ||
32 | #define FLEXINT_H | ||
33 | |||
34 | /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ | ||
35 | |||
36 | #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L | ||
37 | |||
38 | /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, | ||
39 | * if you want the limit (max/min) macros for int types. | ||
40 | */ | ||
41 | #ifndef __STDC_LIMIT_MACROS | ||
42 | #define __STDC_LIMIT_MACROS 1 | ||
43 | #endif | ||
44 | |||
45 | #include <inttypes.h> | ||
46 | typedef int8_t flex_int8_t; | ||
47 | typedef uint8_t flex_uint8_t; | ||
48 | typedef int16_t flex_int16_t; | ||
49 | typedef uint16_t flex_uint16_t; | ||
50 | typedef int32_t flex_int32_t; | ||
51 | typedef uint32_t flex_uint32_t; | ||
52 | #else | ||
53 | typedef signed char flex_int8_t; | ||
54 | typedef short int flex_int16_t; | ||
55 | typedef int flex_int32_t; | ||
56 | typedef unsigned char flex_uint8_t; | ||
57 | typedef unsigned short int flex_uint16_t; | ||
58 | typedef unsigned int flex_uint32_t; | ||
59 | #endif /* ! C99 */ | ||
60 | |||
61 | /* Limits of integral types. */ | ||
62 | #ifndef INT8_MIN | ||
63 | #define INT8_MIN (-128) | ||
64 | #endif | ||
65 | #ifndef INT16_MIN | ||
66 | #define INT16_MIN (-32767-1) | ||
67 | #endif | ||
68 | #ifndef INT32_MIN | ||
69 | #define INT32_MIN (-2147483647-1) | ||
70 | #endif | ||
71 | #ifndef INT8_MAX | ||
72 | #define INT8_MAX (127) | ||
73 | #endif | ||
74 | #ifndef INT16_MAX | ||
75 | #define INT16_MAX (32767) | ||
76 | #endif | ||
77 | #ifndef INT32_MAX | ||
78 | #define INT32_MAX (2147483647) | ||
79 | #endif | ||
80 | #ifndef UINT8_MAX | ||
81 | #define UINT8_MAX (255U) | ||
82 | #endif | ||
83 | #ifndef UINT16_MAX | ||
84 | #define UINT16_MAX (65535U) | ||
85 | #endif | ||
86 | #ifndef UINT32_MAX | ||
87 | #define UINT32_MAX (4294967295U) | ||
88 | #endif | ||
89 | |||
90 | #endif /* ! FLEXINT_H */ | ||
91 | |||
92 | #ifdef __cplusplus | ||
93 | |||
94 | /* The "const" storage-class-modifier is valid. */ | ||
95 | #define YY_USE_CONST | ||
96 | |||
97 | #else /* ! __cplusplus */ | ||
98 | |||
99 | /* C99 requires __STDC__ to be defined as 1. */ | ||
100 | #if defined (__STDC__) | ||
101 | |||
102 | #define YY_USE_CONST | ||
103 | |||
104 | #endif /* defined (__STDC__) */ | ||
105 | #endif /* ! __cplusplus */ | ||
106 | |||
107 | #ifdef YY_USE_CONST | ||
108 | #define yyconst const | ||
109 | #else | ||
110 | #define yyconst | ||
111 | #endif | ||
112 | |||
113 | /* Size of default input buffer. */ | ||
114 | #ifndef YY_BUF_SIZE | ||
115 | #define YY_BUF_SIZE 16384 | ||
116 | #endif | ||
117 | |||
118 | #ifndef YY_TYPEDEF_YY_BUFFER_STATE | ||
119 | #define YY_TYPEDEF_YY_BUFFER_STATE | ||
120 | typedef struct yy_buffer_state *YY_BUFFER_STATE; | ||
121 | #endif | ||
122 | |||
123 | extern int parse_events_leng; | ||
124 | |||
125 | extern FILE *parse_events_in, *parse_events_out; | ||
126 | |||
127 | #ifndef YY_TYPEDEF_YY_SIZE_T | ||
128 | #define YY_TYPEDEF_YY_SIZE_T | ||
129 | typedef size_t yy_size_t; | ||
130 | #endif | ||
131 | |||
132 | #ifndef YY_STRUCT_YY_BUFFER_STATE | ||
133 | #define YY_STRUCT_YY_BUFFER_STATE | ||
134 | struct yy_buffer_state | ||
135 | { | ||
136 | FILE *yy_input_file; | ||
137 | |||
138 | char *yy_ch_buf; /* input buffer */ | ||
139 | char *yy_buf_pos; /* current position in input buffer */ | ||
140 | |||
141 | /* Size of input buffer in bytes, not including room for EOB | ||
142 | * characters. | ||
143 | */ | ||
144 | yy_size_t yy_buf_size; | ||
145 | |||
146 | /* Number of characters read into yy_ch_buf, not including EOB | ||
147 | * characters. | ||
148 | */ | ||
149 | int yy_n_chars; | ||
150 | |||
151 | /* Whether we "own" the buffer - i.e., we know we created it, | ||
152 | * and can realloc() it to grow it, and should free() it to | ||
153 | * delete it. | ||
154 | */ | ||
155 | int yy_is_our_buffer; | ||
156 | |||
157 | /* Whether this is an "interactive" input source; if so, and | ||
158 | * if we're using stdio for input, then we want to use getc() | ||
159 | * instead of fread(), to make sure we stop fetching input after | ||
160 | * each newline. | ||
161 | */ | ||
162 | int yy_is_interactive; | ||
163 | |||
164 | /* Whether we're considered to be at the beginning of a line. | ||
165 | * If so, '^' rules will be active on the next match, otherwise | ||
166 | * not. | ||
167 | */ | ||
168 | int yy_at_bol; | ||
169 | |||
170 | int yy_bs_lineno; /**< The line count. */ | ||
171 | int yy_bs_column; /**< The column count. */ | ||
172 | |||
173 | /* Whether to try to fill the input buffer when we reach the | ||
174 | * end of it. | ||
175 | */ | ||
176 | int yy_fill_buffer; | ||
177 | |||
178 | int yy_buffer_status; | ||
179 | |||
180 | }; | ||
181 | #endif /* !YY_STRUCT_YY_BUFFER_STATE */ | ||
182 | |||
183 | void parse_events_restart (FILE *input_file ); | ||
184 | void parse_events__switch_to_buffer (YY_BUFFER_STATE new_buffer ); | ||
185 | YY_BUFFER_STATE parse_events__create_buffer (FILE *file,int size ); | ||
186 | void parse_events__delete_buffer (YY_BUFFER_STATE b ); | ||
187 | void parse_events__flush_buffer (YY_BUFFER_STATE b ); | ||
188 | void parse_events_push_buffer_state (YY_BUFFER_STATE new_buffer ); | ||
189 | void parse_events_pop_buffer_state (void ); | ||
190 | |||
191 | YY_BUFFER_STATE parse_events__scan_buffer (char *base,yy_size_t size ); | ||
192 | YY_BUFFER_STATE parse_events__scan_string (yyconst char *yy_str ); | ||
193 | YY_BUFFER_STATE parse_events__scan_bytes (yyconst char *bytes,int len ); | ||
194 | |||
195 | void *parse_events_alloc (yy_size_t ); | ||
196 | void *parse_events_realloc (void *,yy_size_t ); | ||
197 | void parse_events_free (void * ); | ||
198 | |||
199 | /* Begin user sect3 */ | ||
200 | |||
201 | extern int parse_events_lineno; | ||
202 | |||
203 | extern char *parse_events_text; | ||
204 | #define yytext_ptr parse_events_text | ||
205 | |||
206 | #ifdef YY_HEADER_EXPORT_START_CONDITIONS | ||
207 | #define INITIAL 0 | ||
208 | |||
209 | #endif | ||
210 | |||
211 | #ifndef YY_NO_UNISTD_H | ||
212 | /* Special case for "unistd.h", since it is non-ANSI. We include it way | ||
213 | * down here because we want the user's section 1 to have been scanned first. | ||
214 | * The user has a chance to override it with an option. | ||
215 | */ | ||
216 | #include <unistd.h> | ||
217 | #endif | ||
218 | |||
219 | #ifndef YY_EXTRA_TYPE | ||
220 | #define YY_EXTRA_TYPE void * | ||
221 | #endif | ||
222 | |||
223 | /* Accessor methods to globals. | ||
224 | These are made visible to non-reentrant scanners for convenience. */ | ||
225 | |||
226 | int parse_events_lex_destroy (void ); | ||
227 | |||
228 | int parse_events_get_debug (void ); | ||
229 | |||
230 | void parse_events_set_debug (int debug_flag ); | ||
231 | |||
232 | YY_EXTRA_TYPE parse_events_get_extra (void ); | ||
233 | |||
234 | void parse_events_set_extra (YY_EXTRA_TYPE user_defined ); | ||
235 | |||
236 | FILE *parse_events_get_in (void ); | ||
237 | |||
238 | void parse_events_set_in (FILE * in_str ); | ||
239 | |||
240 | FILE *parse_events_get_out (void ); | ||
241 | |||
242 | void parse_events_set_out (FILE * out_str ); | ||
243 | |||
244 | int parse_events_get_leng (void ); | ||
245 | |||
246 | char *parse_events_get_text (void ); | ||
247 | |||
248 | int parse_events_get_lineno (void ); | ||
249 | |||
250 | void parse_events_set_lineno (int line_number ); | ||
251 | |||
252 | /* Macros after this point can all be overridden by user definitions in | ||
253 | * section 1. | ||
254 | */ | ||
255 | |||
256 | #ifndef YY_SKIP_YYWRAP | ||
257 | #ifdef __cplusplus | ||
258 | extern "C" int parse_events_wrap (void ); | ||
259 | #else | ||
260 | extern int parse_events_wrap (void ); | ||
261 | #endif | ||
262 | #endif | ||
263 | |||
264 | #ifndef yytext_ptr | ||
265 | static void yy_flex_strncpy (char *,yyconst char *,int ); | ||
266 | #endif | ||
267 | |||
268 | #ifdef YY_NEED_STRLEN | ||
269 | static int yy_flex_strlen (yyconst char * ); | ||
270 | #endif | ||
271 | |||
272 | #ifndef YY_NO_INPUT | ||
273 | |||
274 | #endif | ||
275 | |||
276 | /* Amount of stuff to slurp up with each read. */ | ||
277 | #ifndef YY_READ_BUF_SIZE | ||
278 | #define YY_READ_BUF_SIZE 8192 | ||
279 | #endif | ||
280 | |||
281 | /* Number of entries by which start-condition stack grows. */ | ||
282 | #ifndef YY_START_STACK_INCR | ||
283 | #define YY_START_STACK_INCR 25 | ||
284 | #endif | ||
285 | |||
286 | /* Default declaration of generated scanner - a define so the user can | ||
287 | * easily add parameters. | ||
288 | */ | ||
289 | #ifndef YY_DECL | ||
290 | #define YY_DECL_IS_OURS 1 | ||
291 | |||
292 | extern int parse_events_lex (void); | ||
293 | |||
294 | #define YY_DECL int parse_events_lex (void) | ||
295 | #endif /* !YY_DECL */ | ||
296 | |||
297 | /* yy_get_previous_state - get the state just before the EOB char was reached */ | ||
298 | |||
299 | #undef YY_NEW_FILE | ||
300 | #undef YY_FLUSH_BUFFER | ||
301 | #undef yy_set_bol | ||
302 | #undef yy_new_buffer | ||
303 | #undef yy_set_interactive | ||
304 | #undef YY_DO_BEFORE_ACTION | ||
305 | |||
306 | #ifdef YY_DECL_IS_OURS | ||
307 | #undef YY_DECL_IS_OURS | ||
308 | #undef YY_DECL | ||
309 | #endif | ||
310 | |||
311 | #line 121 "util/parse-events.l" | ||
312 | |||
313 | |||
314 | #line 315 "util/parse-events-flex.h" | ||
315 | #undef parse_events_IN_HEADER | ||
316 | #endif /* parse_events_HEADER_H */ | ||
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index bec1cc6a1f38..5b3a0ef4e232 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c | |||
@@ -23,7 +23,8 @@ struct event_symbol { | |||
23 | const char *alias; | 23 | const char *alias; |
24 | }; | 24 | }; |
25 | 25 | ||
26 | int parse_events_parse(struct list_head *list, int *idx); | 26 | int parse_events_parse(struct list_head *list, struct list_head *list_tmp, |
27 | int *idx); | ||
27 | 28 | ||
28 | #define CHW(x) .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_##x | 29 | #define CHW(x) .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_##x |
29 | #define CSW(x) .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_SW_##x | 30 | #define CSW(x) .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_SW_##x |
@@ -165,7 +166,7 @@ struct tracepoint_path *tracepoint_id_to_path(u64 config) | |||
165 | struct tracepoint_path *path = NULL; | 166 | struct tracepoint_path *path = NULL; |
166 | DIR *sys_dir, *evt_dir; | 167 | DIR *sys_dir, *evt_dir; |
167 | struct dirent *sys_next, *evt_next, sys_dirent, evt_dirent; | 168 | struct dirent *sys_next, *evt_next, sys_dirent, evt_dirent; |
168 | char id_buf[4]; | 169 | char id_buf[24]; |
169 | int fd; | 170 | int fd; |
170 | u64 id; | 171 | u64 id; |
171 | char evt_path[MAXPATHLEN]; | 172 | char evt_path[MAXPATHLEN]; |
@@ -569,7 +570,7 @@ int parse_events_add_breakpoint(struct list_head *list, int *idx, | |||
569 | char name[MAX_NAME_LEN]; | 570 | char name[MAX_NAME_LEN]; |
570 | 571 | ||
571 | memset(&attr, 0, sizeof(attr)); | 572 | memset(&attr, 0, sizeof(attr)); |
572 | attr.bp_addr = (u64) ptr; | 573 | attr.bp_addr = (unsigned long) ptr; |
573 | 574 | ||
574 | if (parse_breakpoint_type(type, &attr)) | 575 | if (parse_breakpoint_type(type, &attr)) |
575 | return -EINVAL; | 576 | return -EINVAL; |
@@ -671,6 +672,18 @@ int parse_events_add_pmu(struct list_head *list, int *idx, | |||
671 | return add_event(list, idx, &attr, (char *) "pmu"); | 672 | return add_event(list, idx, &attr, (char *) "pmu"); |
672 | } | 673 | } |
673 | 674 | ||
675 | void parse_events_update_lists(struct list_head *list_event, | ||
676 | struct list_head *list_all) | ||
677 | { | ||
678 | /* | ||
679 | * Called for single event definition. Update the | ||
680 | * 'all event' list, and reinit the 'signle event' | ||
681 | * list, for next event definition. | ||
682 | */ | ||
683 | list_splice_tail(list_event, list_all); | ||
684 | INIT_LIST_HEAD(list_event); | ||
685 | } | ||
686 | |||
674 | int parse_events_modifier(struct list_head *list, char *str) | 687 | int parse_events_modifier(struct list_head *list, char *str) |
675 | { | 688 | { |
676 | struct perf_evsel *evsel; | 689 | struct perf_evsel *evsel; |
@@ -736,14 +749,14 @@ int parse_events_modifier(struct list_head *list, char *str) | |||
736 | 749 | ||
737 | int parse_events(struct perf_evlist *evlist, const char *str, int unset __used) | 750 | int parse_events(struct perf_evlist *evlist, const char *str, int unset __used) |
738 | { | 751 | { |
739 | struct perf_evsel *evsel, *h; | ||
740 | LIST_HEAD(list); | 752 | LIST_HEAD(list); |
753 | LIST_HEAD(list_tmp); | ||
741 | YY_BUFFER_STATE buffer; | 754 | YY_BUFFER_STATE buffer; |
742 | int ret, idx = evlist->nr_entries; | 755 | int ret, idx = evlist->nr_entries; |
743 | 756 | ||
744 | buffer = parse_events__scan_string(str); | 757 | buffer = parse_events__scan_string(str); |
745 | 758 | ||
746 | ret = parse_events_parse(&list, &idx); | 759 | ret = parse_events_parse(&list, &list_tmp, &idx); |
747 | 760 | ||
748 | parse_events__flush_buffer(buffer); | 761 | parse_events__flush_buffer(buffer); |
749 | parse_events__delete_buffer(buffer); | 762 | parse_events__delete_buffer(buffer); |
@@ -754,9 +767,11 @@ int parse_events(struct perf_evlist *evlist, const char *str, int unset __used) | |||
754 | return 0; | 767 | return 0; |
755 | } | 768 | } |
756 | 769 | ||
757 | list_for_each_entry_safe(evsel, h, &list, node) | 770 | /* |
758 | perf_evsel__delete(evsel); | 771 | * There are 2 users - builtin-record and builtin-test objects. |
759 | 772 | * Both call perf_evlist__delete in case of error, so we dont | |
773 | * need to bother. | ||
774 | */ | ||
760 | fprintf(stderr, "invalid or unsupported event: '%s'\n", str); | 775 | fprintf(stderr, "invalid or unsupported event: '%s'\n", str); |
761 | fprintf(stderr, "Run 'perf list' for a list of valid events\n"); | 776 | fprintf(stderr, "Run 'perf list' for a list of valid events\n"); |
762 | return ret; | 777 | return ret; |
diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h index 6d7c74b77c24..ca069f893381 100644 --- a/tools/perf/util/parse-events.h +++ b/tools/perf/util/parse-events.h | |||
@@ -76,8 +76,11 @@ int parse_events_add_breakpoint(struct list_head *list, int *idx, | |||
76 | void *ptr, char *type); | 76 | void *ptr, char *type); |
77 | int parse_events_add_pmu(struct list_head *list, int *idx, | 77 | int parse_events_add_pmu(struct list_head *list, int *idx, |
78 | char *pmu , struct list_head *head_config); | 78 | char *pmu , struct list_head *head_config); |
79 | void parse_events_error(struct list_head *list, int *idx, | 79 | void parse_events_update_lists(struct list_head *list_event, |
80 | char const *msg); | 80 | struct list_head *list_all); |
81 | void parse_events_error(struct list_head *list_all, | ||
82 | struct list_head *list_event, | ||
83 | int *idx, char const *msg); | ||
81 | 84 | ||
82 | void print_events(const char *event_glob); | 85 | void print_events(const char *event_glob); |
83 | void print_events_type(u8 type); | 86 | void print_events_type(u8 type); |
diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l index ab9eca120feb..05d766e3ecb5 100644 --- a/tools/perf/util/parse-events.l +++ b/tools/perf/util/parse-events.l | |||
@@ -67,6 +67,7 @@ cache-misses { return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_CACHE_MISSES); } | |||
67 | branch-instructions|branches { return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_BRANCH_INSTRUCTIONS); } | 67 | branch-instructions|branches { return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_BRANCH_INSTRUCTIONS); } |
68 | branch-misses { return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_BRANCH_MISSES); } | 68 | branch-misses { return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_BRANCH_MISSES); } |
69 | bus-cycles { return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_BUS_CYCLES); } | 69 | bus-cycles { return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_BUS_CYCLES); } |
70 | ref-cycles { return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_REF_CPU_CYCLES); } | ||
70 | cpu-clock { return sym(PERF_TYPE_SOFTWARE, PERF_COUNT_SW_CPU_CLOCK); } | 71 | cpu-clock { return sym(PERF_TYPE_SOFTWARE, PERF_COUNT_SW_CPU_CLOCK); } |
71 | task-clock { return sym(PERF_TYPE_SOFTWARE, PERF_COUNT_SW_TASK_CLOCK); } | 72 | task-clock { return sym(PERF_TYPE_SOFTWARE, PERF_COUNT_SW_TASK_CLOCK); } |
72 | page-faults|faults { return sym(PERF_TYPE_SOFTWARE, PERF_COUNT_SW_PAGE_FAULTS); } | 73 | page-faults|faults { return sym(PERF_TYPE_SOFTWARE, PERF_COUNT_SW_PAGE_FAULTS); } |
diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y index 3a530193f5a8..d9637da7333c 100644 --- a/tools/perf/util/parse-events.y +++ b/tools/perf/util/parse-events.y | |||
@@ -1,6 +1,7 @@ | |||
1 | 1 | ||
2 | %name-prefix "parse_events_" | 2 | %name-prefix "parse_events_" |
3 | %parse-param {struct list_head *list} | 3 | %parse-param {struct list_head *list_all} |
4 | %parse-param {struct list_head *list_event} | ||
4 | %parse-param {int *idx} | 5 | %parse-param {int *idx} |
5 | 6 | ||
6 | %{ | 7 | %{ |
@@ -56,10 +57,19 @@ events ',' event | event | |||
56 | event: | 57 | event: |
57 | event_def PE_MODIFIER_EVENT | 58 | event_def PE_MODIFIER_EVENT |
58 | { | 59 | { |
59 | ABORT_ON(parse_events_modifier(list, $2)); | 60 | /* |
61 | * Apply modifier on all events added by single event definition | ||
62 | * (there could be more events added for multiple tracepoint | ||
63 | * definitions via '*?'. | ||
64 | */ | ||
65 | ABORT_ON(parse_events_modifier(list_event, $2)); | ||
66 | parse_events_update_lists(list_event, list_all); | ||
60 | } | 67 | } |
61 | | | 68 | | |
62 | event_def | 69 | event_def |
70 | { | ||
71 | parse_events_update_lists(list_event, list_all); | ||
72 | } | ||
63 | 73 | ||
64 | event_def: event_pmu | | 74 | event_def: event_pmu | |
65 | event_legacy_symbol | | 75 | event_legacy_symbol | |
@@ -72,7 +82,7 @@ event_def: event_pmu | | |||
72 | event_pmu: | 82 | event_pmu: |
73 | PE_NAME '/' event_config '/' | 83 | PE_NAME '/' event_config '/' |
74 | { | 84 | { |
75 | ABORT_ON(parse_events_add_pmu(list, idx, $1, $3)); | 85 | ABORT_ON(parse_events_add_pmu(list_event, idx, $1, $3)); |
76 | parse_events__free_terms($3); | 86 | parse_events__free_terms($3); |
77 | } | 87 | } |
78 | 88 | ||
@@ -82,7 +92,7 @@ PE_VALUE_SYM '/' event_config '/' | |||
82 | int type = $1 >> 16; | 92 | int type = $1 >> 16; |
83 | int config = $1 & 255; | 93 | int config = $1 & 255; |
84 | 94 | ||
85 | ABORT_ON(parse_events_add_numeric(list, idx, type, config, $3)); | 95 | ABORT_ON(parse_events_add_numeric(list_event, idx, type, config, $3)); |
86 | parse_events__free_terms($3); | 96 | parse_events__free_terms($3); |
87 | } | 97 | } |
88 | | | 98 | | |
@@ -91,52 +101,52 @@ PE_VALUE_SYM sep_slash_dc | |||
91 | int type = $1 >> 16; | 101 | int type = $1 >> 16; |
92 | int config = $1 & 255; | 102 | int config = $1 & 255; |
93 | 103 | ||
94 | ABORT_ON(parse_events_add_numeric(list, idx, type, config, NULL)); | 104 | ABORT_ON(parse_events_add_numeric(list_event, idx, type, config, NULL)); |
95 | } | 105 | } |
96 | 106 | ||
97 | event_legacy_cache: | 107 | event_legacy_cache: |
98 | PE_NAME_CACHE_TYPE '-' PE_NAME_CACHE_OP_RESULT '-' PE_NAME_CACHE_OP_RESULT | 108 | PE_NAME_CACHE_TYPE '-' PE_NAME_CACHE_OP_RESULT '-' PE_NAME_CACHE_OP_RESULT |
99 | { | 109 | { |
100 | ABORT_ON(parse_events_add_cache(list, idx, $1, $3, $5)); | 110 | ABORT_ON(parse_events_add_cache(list_event, idx, $1, $3, $5)); |
101 | } | 111 | } |
102 | | | 112 | | |
103 | PE_NAME_CACHE_TYPE '-' PE_NAME_CACHE_OP_RESULT | 113 | PE_NAME_CACHE_TYPE '-' PE_NAME_CACHE_OP_RESULT |
104 | { | 114 | { |
105 | ABORT_ON(parse_events_add_cache(list, idx, $1, $3, NULL)); | 115 | ABORT_ON(parse_events_add_cache(list_event, idx, $1, $3, NULL)); |
106 | } | 116 | } |
107 | | | 117 | | |
108 | PE_NAME_CACHE_TYPE | 118 | PE_NAME_CACHE_TYPE |
109 | { | 119 | { |
110 | ABORT_ON(parse_events_add_cache(list, idx, $1, NULL, NULL)); | 120 | ABORT_ON(parse_events_add_cache(list_event, idx, $1, NULL, NULL)); |
111 | } | 121 | } |
112 | 122 | ||
113 | event_legacy_mem: | 123 | event_legacy_mem: |
114 | PE_PREFIX_MEM PE_VALUE ':' PE_MODIFIER_BP sep_dc | 124 | PE_PREFIX_MEM PE_VALUE ':' PE_MODIFIER_BP sep_dc |
115 | { | 125 | { |
116 | ABORT_ON(parse_events_add_breakpoint(list, idx, (void *) $2, $4)); | 126 | ABORT_ON(parse_events_add_breakpoint(list_event, idx, (void *) $2, $4)); |
117 | } | 127 | } |
118 | | | 128 | | |
119 | PE_PREFIX_MEM PE_VALUE sep_dc | 129 | PE_PREFIX_MEM PE_VALUE sep_dc |
120 | { | 130 | { |
121 | ABORT_ON(parse_events_add_breakpoint(list, idx, (void *) $2, NULL)); | 131 | ABORT_ON(parse_events_add_breakpoint(list_event, idx, (void *) $2, NULL)); |
122 | } | 132 | } |
123 | 133 | ||
124 | event_legacy_tracepoint: | 134 | event_legacy_tracepoint: |
125 | PE_NAME ':' PE_NAME | 135 | PE_NAME ':' PE_NAME |
126 | { | 136 | { |
127 | ABORT_ON(parse_events_add_tracepoint(list, idx, $1, $3)); | 137 | ABORT_ON(parse_events_add_tracepoint(list_event, idx, $1, $3)); |
128 | } | 138 | } |
129 | 139 | ||
130 | event_legacy_numeric: | 140 | event_legacy_numeric: |
131 | PE_VALUE ':' PE_VALUE | 141 | PE_VALUE ':' PE_VALUE |
132 | { | 142 | { |
133 | ABORT_ON(parse_events_add_numeric(list, idx, $1, $3, NULL)); | 143 | ABORT_ON(parse_events_add_numeric(list_event, idx, $1, $3, NULL)); |
134 | } | 144 | } |
135 | 145 | ||
136 | event_legacy_raw: | 146 | event_legacy_raw: |
137 | PE_RAW | 147 | PE_RAW |
138 | { | 148 | { |
139 | ABORT_ON(parse_events_add_numeric(list, idx, PERF_TYPE_RAW, $1, NULL)); | 149 | ABORT_ON(parse_events_add_numeric(list_event, idx, PERF_TYPE_RAW, $1, NULL)); |
140 | } | 150 | } |
141 | 151 | ||
142 | event_config: | 152 | event_config: |
@@ -211,7 +221,9 @@ sep_slash_dc: '/' | ':' | | |||
211 | 221 | ||
212 | %% | 222 | %% |
213 | 223 | ||
214 | void parse_events_error(struct list_head *list __used, int *idx __used, | 224 | void parse_events_error(struct list_head *list_all __used, |
225 | struct list_head *list_event __used, | ||
226 | int *idx __used, | ||
215 | char const *msg __used) | 227 | char const *msg __used) |
216 | { | 228 | { |
217 | } | 229 | } |
diff --git a/tools/perf/util/pmu-bison.c b/tools/perf/util/pmu-bison.c deleted file mode 100644 index 343521ec589f..000000000000 --- a/tools/perf/util/pmu-bison.c +++ /dev/null | |||
@@ -1,1663 +0,0 @@ | |||
1 | /* A Bison parser, made by GNU Bison 2.4.3. */ | ||
2 | |||
3 | /* Skeleton implementation for Bison's Yacc-like parsers in C | ||
4 | |||
5 | Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006, | ||
6 | 2009, 2010 Free Software Foundation, Inc. | ||
7 | |||
8 | This program is free software: you can redistribute it and/or modify | ||
9 | it under the terms of the GNU General Public License as published by | ||
10 | the Free Software Foundation, either version 3 of the License, or | ||
11 | (at your option) any later version. | ||
12 | |||
13 | This program is distributed in the hope that it will be useful, | ||
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | GNU General Public License for more details. | ||
17 | |||
18 | You should have received a copy of the GNU General Public License | ||
19 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | ||
20 | |||
21 | /* As a special exception, you may create a larger work that contains | ||
22 | part or all of the Bison parser skeleton and distribute that work | ||
23 | under terms of your choice, so long as that work isn't itself a | ||
24 | parser generator using the skeleton or a modified version thereof | ||
25 | as a parser skeleton. Alternatively, if you modify or redistribute | ||
26 | the parser skeleton itself, you may (at your option) remove this | ||
27 | special exception, which will cause the skeleton and the resulting | ||
28 | Bison output files to be licensed under the GNU General Public | ||
29 | License without this special exception. | ||
30 | |||
31 | This special exception was added by the Free Software Foundation in | ||
32 | version 2.2 of Bison. */ | ||
33 | |||
34 | /* C LALR(1) parser skeleton written by Richard Stallman, by | ||
35 | simplifying the original so-called "semantic" parser. */ | ||
36 | |||
37 | /* All symbols defined below should begin with yy or YY, to avoid | ||
38 | infringing on user name space. This should be done even for local | ||
39 | variables, as they might otherwise be expanded by user macros. | ||
40 | There are some unavoidable exceptions within include files to | ||
41 | define necessary library symbols; they are noted "INFRINGES ON | ||
42 | USER NAME SPACE" below. */ | ||
43 | |||
44 | /* Identify Bison output. */ | ||
45 | #define YYBISON 1 | ||
46 | |||
47 | /* Bison version. */ | ||
48 | #define YYBISON_VERSION "2.4.3" | ||
49 | |||
50 | /* Skeleton name. */ | ||
51 | #define YYSKELETON_NAME "yacc.c" | ||
52 | |||
53 | /* Pure parsers. */ | ||
54 | #define YYPURE 0 | ||
55 | |||
56 | /* Push parsers. */ | ||
57 | #define YYPUSH 0 | ||
58 | |||
59 | /* Pull parsers. */ | ||
60 | #define YYPULL 1 | ||
61 | |||
62 | /* Using locations. */ | ||
63 | #define YYLSP_NEEDED 0 | ||
64 | |||
65 | /* Substitute the variable and function names. */ | ||
66 | #define yyparse perf_pmu_parse | ||
67 | #define yylex perf_pmu_lex | ||
68 | #define yyerror perf_pmu_error | ||
69 | #define yylval perf_pmu_lval | ||
70 | #define yychar perf_pmu_char | ||
71 | #define yydebug perf_pmu_debug | ||
72 | #define yynerrs perf_pmu_nerrs | ||
73 | |||
74 | |||
75 | /* Copy the first part of user declarations. */ | ||
76 | |||
77 | /* Line 189 of yacc.c */ | ||
78 | #line 6 "util/pmu.y" | ||
79 | |||
80 | |||
81 | #include <linux/compiler.h> | ||
82 | #include <linux/list.h> | ||
83 | #include <linux/bitmap.h> | ||
84 | #include <string.h> | ||
85 | #include "pmu.h" | ||
86 | |||
87 | extern int perf_pmu_lex (void); | ||
88 | |||
89 | #define ABORT_ON(val) \ | ||
90 | do { \ | ||
91 | if (val) \ | ||
92 | YYABORT; \ | ||
93 | } while (0) | ||
94 | |||
95 | |||
96 | |||
97 | /* Line 189 of yacc.c */ | ||
98 | #line 99 "util/pmu-bison.c" | ||
99 | |||
100 | /* Enabling traces. */ | ||
101 | #ifndef YYDEBUG | ||
102 | # define YYDEBUG 0 | ||
103 | #endif | ||
104 | |||
105 | /* Enabling verbose error messages. */ | ||
106 | #ifdef YYERROR_VERBOSE | ||
107 | # undef YYERROR_VERBOSE | ||
108 | # define YYERROR_VERBOSE 1 | ||
109 | #else | ||
110 | # define YYERROR_VERBOSE 0 | ||
111 | #endif | ||
112 | |||
113 | /* Enabling the token table. */ | ||
114 | #ifndef YYTOKEN_TABLE | ||
115 | # define YYTOKEN_TABLE 0 | ||
116 | #endif | ||
117 | |||
118 | |||
119 | /* Tokens. */ | ||
120 | #ifndef YYTOKENTYPE | ||
121 | # define YYTOKENTYPE | ||
122 | /* Put the tokens into the symbol table, so that GDB and other debuggers | ||
123 | know about them. */ | ||
124 | enum yytokentype { | ||
125 | PP_CONFIG = 258, | ||
126 | PP_CONFIG1 = 259, | ||
127 | PP_CONFIG2 = 260, | ||
128 | PP_VALUE = 261, | ||
129 | PP_ERROR = 262 | ||
130 | }; | ||
131 | #endif | ||
132 | |||
133 | |||
134 | |||
135 | #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED | ||
136 | typedef union YYSTYPE | ||
137 | { | ||
138 | |||
139 | /* Line 214 of yacc.c */ | ||
140 | #line 31 "util/pmu.y" | ||
141 | |||
142 | unsigned long num; | ||
143 | DECLARE_BITMAP(bits, PERF_PMU_FORMAT_BITS); | ||
144 | |||
145 | |||
146 | |||
147 | /* Line 214 of yacc.c */ | ||
148 | #line 149 "util/pmu-bison.c" | ||
149 | } YYSTYPE; | ||
150 | # define YYSTYPE_IS_TRIVIAL 1 | ||
151 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ | ||
152 | # define YYSTYPE_IS_DECLARED 1 | ||
153 | #endif | ||
154 | |||
155 | |||
156 | /* Copy the second part of user declarations. */ | ||
157 | |||
158 | |||
159 | /* Line 264 of yacc.c */ | ||
160 | #line 161 "util/pmu-bison.c" | ||
161 | |||
162 | #ifdef short | ||
163 | # undef short | ||
164 | #endif | ||
165 | |||
166 | #ifdef YYTYPE_UINT8 | ||
167 | typedef YYTYPE_UINT8 yytype_uint8; | ||
168 | #else | ||
169 | typedef unsigned char yytype_uint8; | ||
170 | #endif | ||
171 | |||
172 | #ifdef YYTYPE_INT8 | ||
173 | typedef YYTYPE_INT8 yytype_int8; | ||
174 | #elif (defined __STDC__ || defined __C99__FUNC__ \ | ||
175 | || defined __cplusplus || defined _MSC_VER) | ||
176 | typedef signed char yytype_int8; | ||
177 | #else | ||
178 | typedef short int yytype_int8; | ||
179 | #endif | ||
180 | |||
181 | #ifdef YYTYPE_UINT16 | ||
182 | typedef YYTYPE_UINT16 yytype_uint16; | ||
183 | #else | ||
184 | typedef unsigned short int yytype_uint16; | ||
185 | #endif | ||
186 | |||
187 | #ifdef YYTYPE_INT16 | ||
188 | typedef YYTYPE_INT16 yytype_int16; | ||
189 | #else | ||
190 | typedef short int yytype_int16; | ||
191 | #endif | ||
192 | |||
193 | #ifndef YYSIZE_T | ||
194 | # ifdef __SIZE_TYPE__ | ||
195 | # define YYSIZE_T __SIZE_TYPE__ | ||
196 | # elif defined size_t | ||
197 | # define YYSIZE_T size_t | ||
198 | # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ | ||
199 | || defined __cplusplus || defined _MSC_VER) | ||
200 | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ | ||
201 | # define YYSIZE_T size_t | ||
202 | # else | ||
203 | # define YYSIZE_T unsigned int | ||
204 | # endif | ||
205 | #endif | ||
206 | |||
207 | #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) | ||
208 | |||
209 | #ifndef YY_ | ||
210 | # if defined YYENABLE_NLS && YYENABLE_NLS | ||
211 | # if ENABLE_NLS | ||
212 | # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ | ||
213 | # define YY_(msgid) dgettext ("bison-runtime", msgid) | ||
214 | # endif | ||
215 | # endif | ||
216 | # ifndef YY_ | ||
217 | # define YY_(msgid) msgid | ||
218 | # endif | ||
219 | #endif | ||
220 | |||
221 | /* Suppress unused-variable warnings by "using" E. */ | ||
222 | #if ! defined lint || defined __GNUC__ | ||
223 | # define YYUSE(e) ((void) (e)) | ||
224 | #else | ||
225 | # define YYUSE(e) /* empty */ | ||
226 | #endif | ||
227 | |||
228 | /* Identity function, used to suppress warnings about constant conditions. */ | ||
229 | #ifndef lint | ||
230 | # define YYID(n) (n) | ||
231 | #else | ||
232 | #if (defined __STDC__ || defined __C99__FUNC__ \ | ||
233 | || defined __cplusplus || defined _MSC_VER) | ||
234 | static int | ||
235 | YYID (int yyi) | ||
236 | #else | ||
237 | static int | ||
238 | YYID (yyi) | ||
239 | int yyi; | ||
240 | #endif | ||
241 | { | ||
242 | return yyi; | ||
243 | } | ||
244 | #endif | ||
245 | |||
246 | #if ! defined yyoverflow || YYERROR_VERBOSE | ||
247 | |||
248 | /* The parser invokes alloca or malloc; define the necessary symbols. */ | ||
249 | |||
250 | # ifdef YYSTACK_USE_ALLOCA | ||
251 | # if YYSTACK_USE_ALLOCA | ||
252 | # ifdef __GNUC__ | ||
253 | # define YYSTACK_ALLOC __builtin_alloca | ||
254 | # elif defined __BUILTIN_VA_ARG_INCR | ||
255 | # include <alloca.h> /* INFRINGES ON USER NAME SPACE */ | ||
256 | # elif defined _AIX | ||
257 | # define YYSTACK_ALLOC __alloca | ||
258 | # elif defined _MSC_VER | ||
259 | # include <malloc.h> /* INFRINGES ON USER NAME SPACE */ | ||
260 | # define alloca _alloca | ||
261 | # else | ||
262 | # define YYSTACK_ALLOC alloca | ||
263 | # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ | ||
264 | || defined __cplusplus || defined _MSC_VER) | ||
265 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ | ||
266 | # ifndef _STDLIB_H | ||
267 | # define _STDLIB_H 1 | ||
268 | # endif | ||
269 | # endif | ||
270 | # endif | ||
271 | # endif | ||
272 | # endif | ||
273 | |||
274 | # ifdef YYSTACK_ALLOC | ||
275 | /* Pacify GCC's `empty if-body' warning. */ | ||
276 | # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) | ||
277 | # ifndef YYSTACK_ALLOC_MAXIMUM | ||
278 | /* The OS might guarantee only one guard page at the bottom of the stack, | ||
279 | and a page size can be as small as 4096 bytes. So we cannot safely | ||
280 | invoke alloca (N) if N exceeds 4096. Use a slightly smaller number | ||
281 | to allow for a few compiler-allocated temporary stack slots. */ | ||
282 | # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ | ||
283 | # endif | ||
284 | # else | ||
285 | # define YYSTACK_ALLOC YYMALLOC | ||
286 | # define YYSTACK_FREE YYFREE | ||
287 | # ifndef YYSTACK_ALLOC_MAXIMUM | ||
288 | # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM | ||
289 | # endif | ||
290 | # if (defined __cplusplus && ! defined _STDLIB_H \ | ||
291 | && ! ((defined YYMALLOC || defined malloc) \ | ||
292 | && (defined YYFREE || defined free))) | ||
293 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ | ||
294 | # ifndef _STDLIB_H | ||
295 | # define _STDLIB_H 1 | ||
296 | # endif | ||
297 | # endif | ||
298 | # ifndef YYMALLOC | ||
299 | # define YYMALLOC malloc | ||
300 | # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ | ||
301 | || defined __cplusplus || defined _MSC_VER) | ||
302 | void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ | ||
303 | # endif | ||
304 | # endif | ||
305 | # ifndef YYFREE | ||
306 | # define YYFREE free | ||
307 | # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ | ||
308 | || defined __cplusplus || defined _MSC_VER) | ||
309 | void free (void *); /* INFRINGES ON USER NAME SPACE */ | ||
310 | # endif | ||
311 | # endif | ||
312 | # endif | ||
313 | #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ | ||
314 | |||
315 | |||
316 | #if (! defined yyoverflow \ | ||
317 | && (! defined __cplusplus \ | ||
318 | || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) | ||
319 | |||
320 | /* A type that is properly aligned for any stack member. */ | ||
321 | union yyalloc | ||
322 | { | ||
323 | yytype_int16 yyss_alloc; | ||
324 | YYSTYPE yyvs_alloc; | ||
325 | }; | ||
326 | |||
327 | /* The size of the maximum gap between one aligned stack and the next. */ | ||
328 | # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) | ||
329 | |||
330 | /* The size of an array large to enough to hold all stacks, each with | ||
331 | N elements. */ | ||
332 | # define YYSTACK_BYTES(N) \ | ||
333 | ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ | ||
334 | + YYSTACK_GAP_MAXIMUM) | ||
335 | |||
336 | /* Copy COUNT objects from FROM to TO. The source and destination do | ||
337 | not overlap. */ | ||
338 | # ifndef YYCOPY | ||
339 | # if defined __GNUC__ && 1 < __GNUC__ | ||
340 | # define YYCOPY(To, From, Count) \ | ||
341 | __builtin_memcpy (To, From, (Count) * sizeof (*(From))) | ||
342 | # else | ||
343 | # define YYCOPY(To, From, Count) \ | ||
344 | do \ | ||
345 | { \ | ||
346 | YYSIZE_T yyi; \ | ||
347 | for (yyi = 0; yyi < (Count); yyi++) \ | ||
348 | (To)[yyi] = (From)[yyi]; \ | ||
349 | } \ | ||
350 | while (YYID (0)) | ||
351 | # endif | ||
352 | # endif | ||
353 | |||
354 | /* Relocate STACK from its old location to the new one. The | ||
355 | local variables YYSIZE and YYSTACKSIZE give the old and new number of | ||
356 | elements in the stack, and YYPTR gives the new location of the | ||
357 | stack. Advance YYPTR to a properly aligned location for the next | ||
358 | stack. */ | ||
359 | # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ | ||
360 | do \ | ||
361 | { \ | ||
362 | YYSIZE_T yynewbytes; \ | ||
363 | YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ | ||
364 | Stack = &yyptr->Stack_alloc; \ | ||
365 | yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ | ||
366 | yyptr += yynewbytes / sizeof (*yyptr); \ | ||
367 | } \ | ||
368 | while (YYID (0)) | ||
369 | |||
370 | #endif | ||
371 | |||
372 | /* YYFINAL -- State number of the termination state. */ | ||
373 | #define YYFINAL 9 | ||
374 | /* YYLAST -- Last index in YYTABLE. */ | ||
375 | #define YYLAST 17 | ||
376 | |||
377 | /* YYNTOKENS -- Number of terminals. */ | ||
378 | #define YYNTOKENS 11 | ||
379 | /* YYNNTS -- Number of nonterminals. */ | ||
380 | #define YYNNTS 5 | ||
381 | /* YYNRULES -- Number of rules. */ | ||
382 | #define YYNRULES 10 | ||
383 | /* YYNRULES -- Number of states. */ | ||
384 | #define YYNSTATES 20 | ||
385 | |||
386 | /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ | ||
387 | #define YYUNDEFTOK 2 | ||
388 | #define YYMAXUTOK 262 | ||
389 | |||
390 | #define YYTRANSLATE(YYX) \ | ||
391 | ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) | ||
392 | |||
393 | /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ | ||
394 | static const yytype_uint8 yytranslate[] = | ||
395 | { | ||
396 | 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
397 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
398 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
399 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
400 | 2, 2, 2, 2, 9, 10, 2, 2, 2, 2, | ||
401 | 2, 2, 2, 2, 2, 2, 2, 2, 8, 2, | ||
402 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
403 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
404 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
405 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
406 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
407 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
408 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
409 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
410 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
411 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
412 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
413 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
414 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
415 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
416 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
417 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
418 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
419 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
420 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
421 | 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, | ||
422 | 5, 6, 7 | ||
423 | }; | ||
424 | |||
425 | #if YYDEBUG | ||
426 | /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in | ||
427 | YYRHS. */ | ||
428 | static const yytype_uint8 yyprhs[] = | ||
429 | { | ||
430 | 0, 0, 3, 6, 8, 12, 16, 20, 24, 26, | ||
431 | 30 | ||
432 | }; | ||
433 | |||
434 | /* YYRHS -- A `-1'-separated list of the rules' RHS. */ | ||
435 | static const yytype_int8 yyrhs[] = | ||
436 | { | ||
437 | 12, 0, -1, 12, 13, -1, 13, -1, 3, 8, | ||
438 | 14, -1, 4, 8, 14, -1, 5, 8, 14, -1, | ||
439 | 14, 9, 15, -1, 15, -1, 6, 10, 6, -1, | ||
440 | 6, -1 | ||
441 | }; | ||
442 | |||
443 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ | ||
444 | static const yytype_uint8 yyrline[] = | ||
445 | { | ||
446 | 0, 39, 39, 41, 44, 51, 58, 66, 71, 77, | ||
447 | 82 | ||
448 | }; | ||
449 | #endif | ||
450 | |||
451 | #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE | ||
452 | /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. | ||
453 | First, the terminals, then, starting at YYNTOKENS, nonterminals. */ | ||
454 | static const char *const yytname[] = | ||
455 | { | ||
456 | "$end", "error", "$undefined", "PP_CONFIG", "PP_CONFIG1", "PP_CONFIG2", | ||
457 | "PP_VALUE", "PP_ERROR", "':'", "','", "'-'", "$accept", "format", | ||
458 | "format_term", "bits", "bit_term", 0 | ||
459 | }; | ||
460 | #endif | ||
461 | |||
462 | # ifdef YYPRINT | ||
463 | /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to | ||
464 | token YYLEX-NUM. */ | ||
465 | static const yytype_uint16 yytoknum[] = | ||
466 | { | ||
467 | 0, 256, 257, 258, 259, 260, 261, 262, 58, 44, | ||
468 | 45 | ||
469 | }; | ||
470 | # endif | ||
471 | |||
472 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ | ||
473 | static const yytype_uint8 yyr1[] = | ||
474 | { | ||
475 | 0, 11, 12, 12, 13, 13, 13, 14, 14, 15, | ||
476 | 15 | ||
477 | }; | ||
478 | |||
479 | /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ | ||
480 | static const yytype_uint8 yyr2[] = | ||
481 | { | ||
482 | 0, 2, 2, 1, 3, 3, 3, 3, 1, 3, | ||
483 | 1 | ||
484 | }; | ||
485 | |||
486 | /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state | ||
487 | STATE-NUM when YYTABLE doesn't specify something else to do. Zero | ||
488 | means the default is an error. */ | ||
489 | static const yytype_uint8 yydefact[] = | ||
490 | { | ||
491 | 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, | ||
492 | 2, 10, 4, 8, 5, 6, 0, 0, 9, 7 | ||
493 | }; | ||
494 | |||
495 | /* YYDEFGOTO[NTERM-NUM]. */ | ||
496 | static const yytype_int8 yydefgoto[] = | ||
497 | { | ||
498 | -1, 4, 5, 12, 13 | ||
499 | }; | ||
500 | |||
501 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing | ||
502 | STATE-NUM. */ | ||
503 | #define YYPACT_NINF -7 | ||
504 | static const yytype_int8 yypact[] = | ||
505 | { | ||
506 | 3, 1, 2, 4, 0, -7, 5, 5, 5, -7, | ||
507 | -7, 6, 8, -7, 8, 8, 7, 5, -7, -7 | ||
508 | }; | ||
509 | |||
510 | /* YYPGOTO[NTERM-NUM]. */ | ||
511 | static const yytype_int8 yypgoto[] = | ||
512 | { | ||
513 | -7, -7, 10, -6, -2 | ||
514 | }; | ||
515 | |||
516 | /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If | ||
517 | positive, shift that token. If negative, reduce the rule which | ||
518 | number is the opposite. If zero, do what YYDEFACT says. | ||
519 | If YYTABLE_NINF, syntax error. */ | ||
520 | #define YYTABLE_NINF -1 | ||
521 | static const yytype_uint8 yytable[] = | ||
522 | { | ||
523 | 9, 14, 15, 1, 2, 3, 1, 2, 3, 6, | ||
524 | 7, 11, 8, 18, 10, 19, 16, 17 | ||
525 | }; | ||
526 | |||
527 | static const yytype_uint8 yycheck[] = | ||
528 | { | ||
529 | 0, 7, 8, 3, 4, 5, 3, 4, 5, 8, | ||
530 | 8, 6, 8, 6, 4, 17, 10, 9 | ||
531 | }; | ||
532 | |||
533 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing | ||
534 | symbol of state STATE-NUM. */ | ||
535 | static const yytype_uint8 yystos[] = | ||
536 | { | ||
537 | 0, 3, 4, 5, 12, 13, 8, 8, 8, 0, | ||
538 | 13, 6, 14, 15, 14, 14, 10, 9, 6, 15 | ||
539 | }; | ||
540 | |||
541 | #define yyerrok (yyerrstatus = 0) | ||
542 | #define yyclearin (yychar = YYEMPTY) | ||
543 | #define YYEMPTY (-2) | ||
544 | #define YYEOF 0 | ||
545 | |||
546 | #define YYACCEPT goto yyacceptlab | ||
547 | #define YYABORT goto yyabortlab | ||
548 | #define YYERROR goto yyerrorlab | ||
549 | |||
550 | |||
551 | /* Like YYERROR except do call yyerror. This remains here temporarily | ||
552 | to ease the transition to the new meaning of YYERROR, for GCC. | ||
553 | Once GCC version 2 has supplanted version 1, this can go. However, | ||
554 | YYFAIL appears to be in use. Nevertheless, it is formally deprecated | ||
555 | in Bison 2.4.2's NEWS entry, where a plan to phase it out is | ||
556 | discussed. */ | ||
557 | |||
558 | #define YYFAIL goto yyerrlab | ||
559 | #if defined YYFAIL | ||
560 | /* This is here to suppress warnings from the GCC cpp's | ||
561 | -Wunused-macros. Normally we don't worry about that warning, but | ||
562 | some users do, and we want to make it easy for users to remove | ||
563 | YYFAIL uses, which will produce warnings from Bison 2.5. */ | ||
564 | #endif | ||
565 | |||
566 | #define YYRECOVERING() (!!yyerrstatus) | ||
567 | |||
568 | #define YYBACKUP(Token, Value) \ | ||
569 | do \ | ||
570 | if (yychar == YYEMPTY && yylen == 1) \ | ||
571 | { \ | ||
572 | yychar = (Token); \ | ||
573 | yylval = (Value); \ | ||
574 | yytoken = YYTRANSLATE (yychar); \ | ||
575 | YYPOPSTACK (1); \ | ||
576 | goto yybackup; \ | ||
577 | } \ | ||
578 | else \ | ||
579 | { \ | ||
580 | yyerror (format, name, YY_("syntax error: cannot back up")); \ | ||
581 | YYERROR; \ | ||
582 | } \ | ||
583 | while (YYID (0)) | ||
584 | |||
585 | |||
586 | #define YYTERROR 1 | ||
587 | #define YYERRCODE 256 | ||
588 | |||
589 | |||
590 | /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. | ||
591 | If N is 0, then set CURRENT to the empty location which ends | ||
592 | the previous symbol: RHS[0] (always defined). */ | ||
593 | |||
594 | #define YYRHSLOC(Rhs, K) ((Rhs)[K]) | ||
595 | #ifndef YYLLOC_DEFAULT | ||
596 | # define YYLLOC_DEFAULT(Current, Rhs, N) \ | ||
597 | do \ | ||
598 | if (YYID (N)) \ | ||
599 | { \ | ||
600 | (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ | ||
601 | (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ | ||
602 | (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ | ||
603 | (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ | ||
604 | } \ | ||
605 | else \ | ||
606 | { \ | ||
607 | (Current).first_line = (Current).last_line = \ | ||
608 | YYRHSLOC (Rhs, 0).last_line; \ | ||
609 | (Current).first_column = (Current).last_column = \ | ||
610 | YYRHSLOC (Rhs, 0).last_column; \ | ||
611 | } \ | ||
612 | while (YYID (0)) | ||
613 | #endif | ||
614 | |||
615 | |||
616 | /* YY_LOCATION_PRINT -- Print the location on the stream. | ||
617 | This macro was not mandated originally: define only if we know | ||
618 | we won't break user code: when these are the locations we know. */ | ||
619 | |||
620 | #ifndef YY_LOCATION_PRINT | ||
621 | # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL | ||
622 | # define YY_LOCATION_PRINT(File, Loc) \ | ||
623 | fprintf (File, "%d.%d-%d.%d", \ | ||
624 | (Loc).first_line, (Loc).first_column, \ | ||
625 | (Loc).last_line, (Loc).last_column) | ||
626 | # else | ||
627 | # define YY_LOCATION_PRINT(File, Loc) ((void) 0) | ||
628 | # endif | ||
629 | #endif | ||
630 | |||
631 | |||
632 | /* YYLEX -- calling `yylex' with the right arguments. */ | ||
633 | |||
634 | #ifdef YYLEX_PARAM | ||
635 | # define YYLEX yylex (YYLEX_PARAM) | ||
636 | #else | ||
637 | # define YYLEX yylex () | ||
638 | #endif | ||
639 | |||
640 | /* Enable debugging if requested. */ | ||
641 | #if YYDEBUG | ||
642 | |||
643 | # ifndef YYFPRINTF | ||
644 | # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ | ||
645 | # define YYFPRINTF fprintf | ||
646 | # endif | ||
647 | |||
648 | # define YYDPRINTF(Args) \ | ||
649 | do { \ | ||
650 | if (yydebug) \ | ||
651 | YYFPRINTF Args; \ | ||
652 | } while (YYID (0)) | ||
653 | |||
654 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ | ||
655 | do { \ | ||
656 | if (yydebug) \ | ||
657 | { \ | ||
658 | YYFPRINTF (stderr, "%s ", Title); \ | ||
659 | yy_symbol_print (stderr, \ | ||
660 | Type, Value, format, name); \ | ||
661 | YYFPRINTF (stderr, "\n"); \ | ||
662 | } \ | ||
663 | } while (YYID (0)) | ||
664 | |||
665 | |||
666 | /*--------------------------------. | ||
667 | | Print this symbol on YYOUTPUT. | | ||
668 | `--------------------------------*/ | ||
669 | |||
670 | /*ARGSUSED*/ | ||
671 | #if (defined __STDC__ || defined __C99__FUNC__ \ | ||
672 | || defined __cplusplus || defined _MSC_VER) | ||
673 | static void | ||
674 | yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, struct list_head *format, char *name) | ||
675 | #else | ||
676 | static void | ||
677 | yy_symbol_value_print (yyoutput, yytype, yyvaluep, format, name) | ||
678 | FILE *yyoutput; | ||
679 | int yytype; | ||
680 | YYSTYPE const * const yyvaluep; | ||
681 | struct list_head *format; | ||
682 | char *name; | ||
683 | #endif | ||
684 | { | ||
685 | if (!yyvaluep) | ||
686 | return; | ||
687 | YYUSE (format); | ||
688 | YYUSE (name); | ||
689 | # ifdef YYPRINT | ||
690 | if (yytype < YYNTOKENS) | ||
691 | YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); | ||
692 | # else | ||
693 | YYUSE (yyoutput); | ||
694 | # endif | ||
695 | switch (yytype) | ||
696 | { | ||
697 | default: | ||
698 | break; | ||
699 | } | ||
700 | } | ||
701 | |||
702 | |||
703 | /*--------------------------------. | ||
704 | | Print this symbol on YYOUTPUT. | | ||
705 | `--------------------------------*/ | ||
706 | |||
707 | #if (defined __STDC__ || defined __C99__FUNC__ \ | ||
708 | || defined __cplusplus || defined _MSC_VER) | ||
709 | static void | ||
710 | yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, struct list_head *format, char *name) | ||
711 | #else | ||
712 | static void | ||
713 | yy_symbol_print (yyoutput, yytype, yyvaluep, format, name) | ||
714 | FILE *yyoutput; | ||
715 | int yytype; | ||
716 | YYSTYPE const * const yyvaluep; | ||
717 | struct list_head *format; | ||
718 | char *name; | ||
719 | #endif | ||
720 | { | ||
721 | if (yytype < YYNTOKENS) | ||
722 | YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); | ||
723 | else | ||
724 | YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); | ||
725 | |||
726 | yy_symbol_value_print (yyoutput, yytype, yyvaluep, format, name); | ||
727 | YYFPRINTF (yyoutput, ")"); | ||
728 | } | ||
729 | |||
730 | /*------------------------------------------------------------------. | ||
731 | | yy_stack_print -- Print the state stack from its BOTTOM up to its | | ||
732 | | TOP (included). | | ||
733 | `------------------------------------------------------------------*/ | ||
734 | |||
735 | #if (defined __STDC__ || defined __C99__FUNC__ \ | ||
736 | || defined __cplusplus || defined _MSC_VER) | ||
737 | static void | ||
738 | yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) | ||
739 | #else | ||
740 | static void | ||
741 | yy_stack_print (yybottom, yytop) | ||
742 | yytype_int16 *yybottom; | ||
743 | yytype_int16 *yytop; | ||
744 | #endif | ||
745 | { | ||
746 | YYFPRINTF (stderr, "Stack now"); | ||
747 | for (; yybottom <= yytop; yybottom++) | ||
748 | { | ||
749 | int yybot = *yybottom; | ||
750 | YYFPRINTF (stderr, " %d", yybot); | ||
751 | } | ||
752 | YYFPRINTF (stderr, "\n"); | ||
753 | } | ||
754 | |||
755 | # define YY_STACK_PRINT(Bottom, Top) \ | ||
756 | do { \ | ||
757 | if (yydebug) \ | ||
758 | yy_stack_print ((Bottom), (Top)); \ | ||
759 | } while (YYID (0)) | ||
760 | |||
761 | |||
762 | /*------------------------------------------------. | ||
763 | | Report that the YYRULE is going to be reduced. | | ||
764 | `------------------------------------------------*/ | ||
765 | |||
766 | #if (defined __STDC__ || defined __C99__FUNC__ \ | ||
767 | || defined __cplusplus || defined _MSC_VER) | ||
768 | static void | ||
769 | yy_reduce_print (YYSTYPE *yyvsp, int yyrule, struct list_head *format, char *name) | ||
770 | #else | ||
771 | static void | ||
772 | yy_reduce_print (yyvsp, yyrule, format, name) | ||
773 | YYSTYPE *yyvsp; | ||
774 | int yyrule; | ||
775 | struct list_head *format; | ||
776 | char *name; | ||
777 | #endif | ||
778 | { | ||
779 | int yynrhs = yyr2[yyrule]; | ||
780 | int yyi; | ||
781 | unsigned long int yylno = yyrline[yyrule]; | ||
782 | YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", | ||
783 | yyrule - 1, yylno); | ||
784 | /* The symbols being reduced. */ | ||
785 | for (yyi = 0; yyi < yynrhs; yyi++) | ||
786 | { | ||
787 | YYFPRINTF (stderr, " $%d = ", yyi + 1); | ||
788 | yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], | ||
789 | &(yyvsp[(yyi + 1) - (yynrhs)]) | ||
790 | , format, name); | ||
791 | YYFPRINTF (stderr, "\n"); | ||
792 | } | ||
793 | } | ||
794 | |||
795 | # define YY_REDUCE_PRINT(Rule) \ | ||
796 | do { \ | ||
797 | if (yydebug) \ | ||
798 | yy_reduce_print (yyvsp, Rule, format, name); \ | ||
799 | } while (YYID (0)) | ||
800 | |||
801 | /* Nonzero means print parse trace. It is left uninitialized so that | ||
802 | multiple parsers can coexist. */ | ||
803 | int yydebug; | ||
804 | #else /* !YYDEBUG */ | ||
805 | # define YYDPRINTF(Args) | ||
806 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) | ||
807 | # define YY_STACK_PRINT(Bottom, Top) | ||
808 | # define YY_REDUCE_PRINT(Rule) | ||
809 | #endif /* !YYDEBUG */ | ||
810 | |||
811 | |||
812 | /* YYINITDEPTH -- initial size of the parser's stacks. */ | ||
813 | #ifndef YYINITDEPTH | ||
814 | # define YYINITDEPTH 200 | ||
815 | #endif | ||
816 | |||
817 | /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only | ||
818 | if the built-in stack extension method is used). | ||
819 | |||
820 | Do not make this value too large; the results are undefined if | ||
821 | YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) | ||
822 | evaluated with infinite-precision integer arithmetic. */ | ||
823 | |||
824 | #ifndef YYMAXDEPTH | ||
825 | # define YYMAXDEPTH 10000 | ||
826 | #endif | ||
827 | |||
828 | |||
829 | |||
830 | #if YYERROR_VERBOSE | ||
831 | |||
832 | # ifndef yystrlen | ||
833 | # if defined __GLIBC__ && defined _STRING_H | ||
834 | # define yystrlen strlen | ||
835 | # else | ||
836 | /* Return the length of YYSTR. */ | ||
837 | #if (defined __STDC__ || defined __C99__FUNC__ \ | ||
838 | || defined __cplusplus || defined _MSC_VER) | ||
839 | static YYSIZE_T | ||
840 | yystrlen (const char *yystr) | ||
841 | #else | ||
842 | static YYSIZE_T | ||
843 | yystrlen (yystr) | ||
844 | const char *yystr; | ||
845 | #endif | ||
846 | { | ||
847 | YYSIZE_T yylen; | ||
848 | for (yylen = 0; yystr[yylen]; yylen++) | ||
849 | continue; | ||
850 | return yylen; | ||
851 | } | ||
852 | # endif | ||
853 | # endif | ||
854 | |||
855 | # ifndef yystpcpy | ||
856 | # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE | ||
857 | # define yystpcpy stpcpy | ||
858 | # else | ||
859 | /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in | ||
860 | YYDEST. */ | ||
861 | #if (defined __STDC__ || defined __C99__FUNC__ \ | ||
862 | || defined __cplusplus || defined _MSC_VER) | ||
863 | static char * | ||
864 | yystpcpy (char *yydest, const char *yysrc) | ||
865 | #else | ||
866 | static char * | ||
867 | yystpcpy (yydest, yysrc) | ||
868 | char *yydest; | ||
869 | const char *yysrc; | ||
870 | #endif | ||
871 | { | ||
872 | char *yyd = yydest; | ||
873 | const char *yys = yysrc; | ||
874 | |||
875 | while ((*yyd++ = *yys++) != '\0') | ||
876 | continue; | ||
877 | |||
878 | return yyd - 1; | ||
879 | } | ||
880 | # endif | ||
881 | # endif | ||
882 | |||
883 | # ifndef yytnamerr | ||
884 | /* Copy to YYRES the contents of YYSTR after stripping away unnecessary | ||
885 | quotes and backslashes, so that it's suitable for yyerror. The | ||
886 | heuristic is that double-quoting is unnecessary unless the string | ||
887 | contains an apostrophe, a comma, or backslash (other than | ||
888 | backslash-backslash). YYSTR is taken from yytname. If YYRES is | ||
889 | null, do not copy; instead, return the length of what the result | ||
890 | would have been. */ | ||
891 | static YYSIZE_T | ||
892 | yytnamerr (char *yyres, const char *yystr) | ||
893 | { | ||
894 | if (*yystr == '"') | ||
895 | { | ||
896 | YYSIZE_T yyn = 0; | ||
897 | char const *yyp = yystr; | ||
898 | |||
899 | for (;;) | ||
900 | switch (*++yyp) | ||
901 | { | ||
902 | case '\'': | ||
903 | case ',': | ||
904 | goto do_not_strip_quotes; | ||
905 | |||
906 | case '\\': | ||
907 | if (*++yyp != '\\') | ||
908 | goto do_not_strip_quotes; | ||
909 | /* Fall through. */ | ||
910 | default: | ||
911 | if (yyres) | ||
912 | yyres[yyn] = *yyp; | ||
913 | yyn++; | ||
914 | break; | ||
915 | |||
916 | case '"': | ||
917 | if (yyres) | ||
918 | yyres[yyn] = '\0'; | ||
919 | return yyn; | ||
920 | } | ||
921 | do_not_strip_quotes: ; | ||
922 | } | ||
923 | |||
924 | if (! yyres) | ||
925 | return yystrlen (yystr); | ||
926 | |||
927 | return yystpcpy (yyres, yystr) - yyres; | ||
928 | } | ||
929 | # endif | ||
930 | |||
931 | /* Copy into YYRESULT an error message about the unexpected token | ||
932 | YYCHAR while in state YYSTATE. Return the number of bytes copied, | ||
933 | including the terminating null byte. If YYRESULT is null, do not | ||
934 | copy anything; just return the number of bytes that would be | ||
935 | copied. As a special case, return 0 if an ordinary "syntax error" | ||
936 | message will do. Return YYSIZE_MAXIMUM if overflow occurs during | ||
937 | size calculation. */ | ||
938 | static YYSIZE_T | ||
939 | yysyntax_error (char *yyresult, int yystate, int yychar) | ||
940 | { | ||
941 | int yyn = yypact[yystate]; | ||
942 | |||
943 | if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) | ||
944 | return 0; | ||
945 | else | ||
946 | { | ||
947 | int yytype = YYTRANSLATE (yychar); | ||
948 | YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); | ||
949 | YYSIZE_T yysize = yysize0; | ||
950 | YYSIZE_T yysize1; | ||
951 | int yysize_overflow = 0; | ||
952 | enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; | ||
953 | char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; | ||
954 | int yyx; | ||
955 | |||
956 | # if 0 | ||
957 | /* This is so xgettext sees the translatable formats that are | ||
958 | constructed on the fly. */ | ||
959 | YY_("syntax error, unexpected %s"); | ||
960 | YY_("syntax error, unexpected %s, expecting %s"); | ||
961 | YY_("syntax error, unexpected %s, expecting %s or %s"); | ||
962 | YY_("syntax error, unexpected %s, expecting %s or %s or %s"); | ||
963 | YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); | ||
964 | # endif | ||
965 | char *yyfmt; | ||
966 | char const *yyf; | ||
967 | static char const yyunexpected[] = "syntax error, unexpected %s"; | ||
968 | static char const yyexpecting[] = ", expecting %s"; | ||
969 | static char const yyor[] = " or %s"; | ||
970 | char yyformat[sizeof yyunexpected | ||
971 | + sizeof yyexpecting - 1 | ||
972 | + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) | ||
973 | * (sizeof yyor - 1))]; | ||
974 | char const *yyprefix = yyexpecting; | ||
975 | |||
976 | /* Start YYX at -YYN if negative to avoid negative indexes in | ||
977 | YYCHECK. */ | ||
978 | int yyxbegin = yyn < 0 ? -yyn : 0; | ||
979 | |||
980 | /* Stay within bounds of both yycheck and yytname. */ | ||
981 | int yychecklim = YYLAST - yyn + 1; | ||
982 | int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; | ||
983 | int yycount = 1; | ||
984 | |||
985 | yyarg[0] = yytname[yytype]; | ||
986 | yyfmt = yystpcpy (yyformat, yyunexpected); | ||
987 | |||
988 | for (yyx = yyxbegin; yyx < yyxend; ++yyx) | ||
989 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) | ||
990 | { | ||
991 | if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) | ||
992 | { | ||
993 | yycount = 1; | ||
994 | yysize = yysize0; | ||
995 | yyformat[sizeof yyunexpected - 1] = '\0'; | ||
996 | break; | ||
997 | } | ||
998 | yyarg[yycount++] = yytname[yyx]; | ||
999 | yysize1 = yysize + yytnamerr (0, yytname[yyx]); | ||
1000 | yysize_overflow |= (yysize1 < yysize); | ||
1001 | yysize = yysize1; | ||
1002 | yyfmt = yystpcpy (yyfmt, yyprefix); | ||
1003 | yyprefix = yyor; | ||
1004 | } | ||
1005 | |||
1006 | yyf = YY_(yyformat); | ||
1007 | yysize1 = yysize + yystrlen (yyf); | ||
1008 | yysize_overflow |= (yysize1 < yysize); | ||
1009 | yysize = yysize1; | ||
1010 | |||
1011 | if (yysize_overflow) | ||
1012 | return YYSIZE_MAXIMUM; | ||
1013 | |||
1014 | if (yyresult) | ||
1015 | { | ||
1016 | /* Avoid sprintf, as that infringes on the user's name space. | ||
1017 | Don't have undefined behavior even if the translation | ||
1018 | produced a string with the wrong number of "%s"s. */ | ||
1019 | char *yyp = yyresult; | ||
1020 | int yyi = 0; | ||
1021 | while ((*yyp = *yyf) != '\0') | ||
1022 | { | ||
1023 | if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) | ||
1024 | { | ||
1025 | yyp += yytnamerr (yyp, yyarg[yyi++]); | ||
1026 | yyf += 2; | ||
1027 | } | ||
1028 | else | ||
1029 | { | ||
1030 | yyp++; | ||
1031 | yyf++; | ||
1032 | } | ||
1033 | } | ||
1034 | } | ||
1035 | return yysize; | ||
1036 | } | ||
1037 | } | ||
1038 | #endif /* YYERROR_VERBOSE */ | ||
1039 | |||
1040 | |||
1041 | /*-----------------------------------------------. | ||
1042 | | Release the memory associated to this symbol. | | ||
1043 | `-----------------------------------------------*/ | ||
1044 | |||
1045 | /*ARGSUSED*/ | ||
1046 | #if (defined __STDC__ || defined __C99__FUNC__ \ | ||
1047 | || defined __cplusplus || defined _MSC_VER) | ||
1048 | static void | ||
1049 | yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, struct list_head *format, char *name) | ||
1050 | #else | ||
1051 | static void | ||
1052 | yydestruct (yymsg, yytype, yyvaluep, format, name) | ||
1053 | const char *yymsg; | ||
1054 | int yytype; | ||
1055 | YYSTYPE *yyvaluep; | ||
1056 | struct list_head *format; | ||
1057 | char *name; | ||
1058 | #endif | ||
1059 | { | ||
1060 | YYUSE (yyvaluep); | ||
1061 | YYUSE (format); | ||
1062 | YYUSE (name); | ||
1063 | |||
1064 | if (!yymsg) | ||
1065 | yymsg = "Deleting"; | ||
1066 | YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); | ||
1067 | |||
1068 | switch (yytype) | ||
1069 | { | ||
1070 | |||
1071 | default: | ||
1072 | break; | ||
1073 | } | ||
1074 | } | ||
1075 | |||
1076 | /* Prevent warnings from -Wmissing-prototypes. */ | ||
1077 | #ifdef YYPARSE_PARAM | ||
1078 | #if defined __STDC__ || defined __cplusplus | ||
1079 | int yyparse (void *YYPARSE_PARAM); | ||
1080 | #else | ||
1081 | int yyparse (); | ||
1082 | #endif | ||
1083 | #else /* ! YYPARSE_PARAM */ | ||
1084 | #if defined __STDC__ || defined __cplusplus | ||
1085 | int yyparse (struct list_head *format, char *name); | ||
1086 | #else | ||
1087 | int yyparse (); | ||
1088 | #endif | ||
1089 | #endif /* ! YYPARSE_PARAM */ | ||
1090 | |||
1091 | |||
1092 | /* The lookahead symbol. */ | ||
1093 | int yychar; | ||
1094 | |||
1095 | /* The semantic value of the lookahead symbol. */ | ||
1096 | YYSTYPE yylval; | ||
1097 | |||
1098 | /* Number of syntax errors so far. */ | ||
1099 | int yynerrs; | ||
1100 | |||
1101 | |||
1102 | |||
1103 | /*-------------------------. | ||
1104 | | yyparse or yypush_parse. | | ||
1105 | `-------------------------*/ | ||
1106 | |||
1107 | #ifdef YYPARSE_PARAM | ||
1108 | #if (defined __STDC__ || defined __C99__FUNC__ \ | ||
1109 | || defined __cplusplus || defined _MSC_VER) | ||
1110 | int | ||
1111 | yyparse (void *YYPARSE_PARAM) | ||
1112 | #else | ||
1113 | int | ||
1114 | yyparse (YYPARSE_PARAM) | ||
1115 | void *YYPARSE_PARAM; | ||
1116 | #endif | ||
1117 | #else /* ! YYPARSE_PARAM */ | ||
1118 | #if (defined __STDC__ || defined __C99__FUNC__ \ | ||
1119 | || defined __cplusplus || defined _MSC_VER) | ||
1120 | int | ||
1121 | yyparse (struct list_head *format, char *name) | ||
1122 | #else | ||
1123 | int | ||
1124 | yyparse (format, name) | ||
1125 | struct list_head *format; | ||
1126 | char *name; | ||
1127 | #endif | ||
1128 | #endif | ||
1129 | { | ||
1130 | |||
1131 | |||
1132 | int yystate; | ||
1133 | /* Number of tokens to shift before error messages enabled. */ | ||
1134 | int yyerrstatus; | ||
1135 | |||
1136 | /* The stacks and their tools: | ||
1137 | `yyss': related to states. | ||
1138 | `yyvs': related to semantic values. | ||
1139 | |||
1140 | Refer to the stacks thru separate pointers, to allow yyoverflow | ||
1141 | to reallocate them elsewhere. */ | ||
1142 | |||
1143 | /* The state stack. */ | ||
1144 | yytype_int16 yyssa[YYINITDEPTH]; | ||
1145 | yytype_int16 *yyss; | ||
1146 | yytype_int16 *yyssp; | ||
1147 | |||
1148 | /* The semantic value stack. */ | ||
1149 | YYSTYPE yyvsa[YYINITDEPTH]; | ||
1150 | YYSTYPE *yyvs; | ||
1151 | YYSTYPE *yyvsp; | ||
1152 | |||
1153 | YYSIZE_T yystacksize; | ||
1154 | |||
1155 | int yyn; | ||
1156 | int yyresult; | ||
1157 | /* Lookahead token as an internal (translated) token number. */ | ||
1158 | int yytoken; | ||
1159 | /* The variables used to return semantic value and location from the | ||
1160 | action routines. */ | ||
1161 | YYSTYPE yyval; | ||
1162 | |||
1163 | #if YYERROR_VERBOSE | ||
1164 | /* Buffer for error messages, and its allocated size. */ | ||
1165 | char yymsgbuf[128]; | ||
1166 | char *yymsg = yymsgbuf; | ||
1167 | YYSIZE_T yymsg_alloc = sizeof yymsgbuf; | ||
1168 | #endif | ||
1169 | |||
1170 | #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) | ||
1171 | |||
1172 | /* The number of symbols on the RHS of the reduced rule. | ||
1173 | Keep to zero when no symbol should be popped. */ | ||
1174 | int yylen = 0; | ||
1175 | |||
1176 | yytoken = 0; | ||
1177 | yyss = yyssa; | ||
1178 | yyvs = yyvsa; | ||
1179 | yystacksize = YYINITDEPTH; | ||
1180 | |||
1181 | YYDPRINTF ((stderr, "Starting parse\n")); | ||
1182 | |||
1183 | yystate = 0; | ||
1184 | yyerrstatus = 0; | ||
1185 | yynerrs = 0; | ||
1186 | yychar = YYEMPTY; /* Cause a token to be read. */ | ||
1187 | |||
1188 | /* Initialize stack pointers. | ||
1189 | Waste one element of value and location stack | ||
1190 | so that they stay on the same level as the state stack. | ||
1191 | The wasted elements are never initialized. */ | ||
1192 | yyssp = yyss; | ||
1193 | yyvsp = yyvs; | ||
1194 | |||
1195 | goto yysetstate; | ||
1196 | |||
1197 | /*------------------------------------------------------------. | ||
1198 | | yynewstate -- Push a new state, which is found in yystate. | | ||
1199 | `------------------------------------------------------------*/ | ||
1200 | yynewstate: | ||
1201 | /* In all cases, when you get here, the value and location stacks | ||
1202 | have just been pushed. So pushing a state here evens the stacks. */ | ||
1203 | yyssp++; | ||
1204 | |||
1205 | yysetstate: | ||
1206 | *yyssp = yystate; | ||
1207 | |||
1208 | if (yyss + yystacksize - 1 <= yyssp) | ||
1209 | { | ||
1210 | /* Get the current used size of the three stacks, in elements. */ | ||
1211 | YYSIZE_T yysize = yyssp - yyss + 1; | ||
1212 | |||
1213 | #ifdef yyoverflow | ||
1214 | { | ||
1215 | /* Give user a chance to reallocate the stack. Use copies of | ||
1216 | these so that the &'s don't force the real ones into | ||
1217 | memory. */ | ||
1218 | YYSTYPE *yyvs1 = yyvs; | ||
1219 | yytype_int16 *yyss1 = yyss; | ||
1220 | |||
1221 | /* Each stack pointer address is followed by the size of the | ||
1222 | data in use in that stack, in bytes. This used to be a | ||
1223 | conditional around just the two extra args, but that might | ||
1224 | be undefined if yyoverflow is a macro. */ | ||
1225 | yyoverflow (YY_("memory exhausted"), | ||
1226 | &yyss1, yysize * sizeof (*yyssp), | ||
1227 | &yyvs1, yysize * sizeof (*yyvsp), | ||
1228 | &yystacksize); | ||
1229 | |||
1230 | yyss = yyss1; | ||
1231 | yyvs = yyvs1; | ||
1232 | } | ||
1233 | #else /* no yyoverflow */ | ||
1234 | # ifndef YYSTACK_RELOCATE | ||
1235 | goto yyexhaustedlab; | ||
1236 | # else | ||
1237 | /* Extend the stack our own way. */ | ||
1238 | if (YYMAXDEPTH <= yystacksize) | ||
1239 | goto yyexhaustedlab; | ||
1240 | yystacksize *= 2; | ||
1241 | if (YYMAXDEPTH < yystacksize) | ||
1242 | yystacksize = YYMAXDEPTH; | ||
1243 | |||
1244 | { | ||
1245 | yytype_int16 *yyss1 = yyss; | ||
1246 | union yyalloc *yyptr = | ||
1247 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); | ||
1248 | if (! yyptr) | ||
1249 | goto yyexhaustedlab; | ||
1250 | YYSTACK_RELOCATE (yyss_alloc, yyss); | ||
1251 | YYSTACK_RELOCATE (yyvs_alloc, yyvs); | ||
1252 | # undef YYSTACK_RELOCATE | ||
1253 | if (yyss1 != yyssa) | ||
1254 | YYSTACK_FREE (yyss1); | ||
1255 | } | ||
1256 | # endif | ||
1257 | #endif /* no yyoverflow */ | ||
1258 | |||
1259 | yyssp = yyss + yysize - 1; | ||
1260 | yyvsp = yyvs + yysize - 1; | ||
1261 | |||
1262 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", | ||
1263 | (unsigned long int) yystacksize)); | ||
1264 | |||
1265 | if (yyss + yystacksize - 1 <= yyssp) | ||
1266 | YYABORT; | ||
1267 | } | ||
1268 | |||
1269 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); | ||
1270 | |||
1271 | if (yystate == YYFINAL) | ||
1272 | YYACCEPT; | ||
1273 | |||
1274 | goto yybackup; | ||
1275 | |||
1276 | /*-----------. | ||
1277 | | yybackup. | | ||
1278 | `-----------*/ | ||
1279 | yybackup: | ||
1280 | |||
1281 | /* Do appropriate processing given the current state. Read a | ||
1282 | lookahead token if we need one and don't already have one. */ | ||
1283 | |||
1284 | /* First try to decide what to do without reference to lookahead token. */ | ||
1285 | yyn = yypact[yystate]; | ||
1286 | if (yyn == YYPACT_NINF) | ||
1287 | goto yydefault; | ||
1288 | |||
1289 | /* Not known => get a lookahead token if don't already have one. */ | ||
1290 | |||
1291 | /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ | ||
1292 | if (yychar == YYEMPTY) | ||
1293 | { | ||
1294 | YYDPRINTF ((stderr, "Reading a token: ")); | ||
1295 | yychar = YYLEX; | ||
1296 | } | ||
1297 | |||
1298 | if (yychar <= YYEOF) | ||
1299 | { | ||
1300 | yychar = yytoken = YYEOF; | ||
1301 | YYDPRINTF ((stderr, "Now at end of input.\n")); | ||
1302 | } | ||
1303 | else | ||
1304 | { | ||
1305 | yytoken = YYTRANSLATE (yychar); | ||
1306 | YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); | ||
1307 | } | ||
1308 | |||
1309 | /* If the proper action on seeing token YYTOKEN is to reduce or to | ||
1310 | detect an error, take that action. */ | ||
1311 | yyn += yytoken; | ||
1312 | if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) | ||
1313 | goto yydefault; | ||
1314 | yyn = yytable[yyn]; | ||
1315 | if (yyn <= 0) | ||
1316 | { | ||
1317 | if (yyn == 0 || yyn == YYTABLE_NINF) | ||
1318 | goto yyerrlab; | ||
1319 | yyn = -yyn; | ||
1320 | goto yyreduce; | ||
1321 | } | ||
1322 | |||
1323 | /* Count tokens shifted since error; after three, turn off error | ||
1324 | status. */ | ||
1325 | if (yyerrstatus) | ||
1326 | yyerrstatus--; | ||
1327 | |||
1328 | /* Shift the lookahead token. */ | ||
1329 | YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); | ||
1330 | |||
1331 | /* Discard the shifted token. */ | ||
1332 | yychar = YYEMPTY; | ||
1333 | |||
1334 | yystate = yyn; | ||
1335 | *++yyvsp = yylval; | ||
1336 | |||
1337 | goto yynewstate; | ||
1338 | |||
1339 | |||
1340 | /*-----------------------------------------------------------. | ||
1341 | | yydefault -- do the default action for the current state. | | ||
1342 | `-----------------------------------------------------------*/ | ||
1343 | yydefault: | ||
1344 | yyn = yydefact[yystate]; | ||
1345 | if (yyn == 0) | ||
1346 | goto yyerrlab; | ||
1347 | goto yyreduce; | ||
1348 | |||
1349 | |||
1350 | /*-----------------------------. | ||
1351 | | yyreduce -- Do a reduction. | | ||
1352 | `-----------------------------*/ | ||
1353 | yyreduce: | ||
1354 | /* yyn is the number of a rule to reduce with. */ | ||
1355 | yylen = yyr2[yyn]; | ||
1356 | |||
1357 | /* If YYLEN is nonzero, implement the default value of the action: | ||
1358 | `$$ = $1'. | ||
1359 | |||
1360 | Otherwise, the following line sets YYVAL to garbage. | ||
1361 | This behavior is undocumented and Bison | ||
1362 | users should not rely upon it. Assigning to YYVAL | ||
1363 | unconditionally makes the parser a bit smaller, and it avoids a | ||
1364 | GCC warning that YYVAL may be used uninitialized. */ | ||
1365 | yyval = yyvsp[1-yylen]; | ||
1366 | |||
1367 | |||
1368 | YY_REDUCE_PRINT (yyn); | ||
1369 | switch (yyn) | ||
1370 | { | ||
1371 | case 4: | ||
1372 | |||
1373 | /* Line 1464 of yacc.c */ | ||
1374 | #line 45 "util/pmu.y" | ||
1375 | { | ||
1376 | ABORT_ON(perf_pmu__new_format(format, name, | ||
1377 | PERF_PMU_FORMAT_VALUE_CONFIG, | ||
1378 | (yyvsp[(3) - (3)].bits))); | ||
1379 | ;} | ||
1380 | break; | ||
1381 | |||
1382 | case 5: | ||
1383 | |||
1384 | /* Line 1464 of yacc.c */ | ||
1385 | #line 52 "util/pmu.y" | ||
1386 | { | ||
1387 | ABORT_ON(perf_pmu__new_format(format, name, | ||
1388 | PERF_PMU_FORMAT_VALUE_CONFIG1, | ||
1389 | (yyvsp[(3) - (3)].bits))); | ||
1390 | ;} | ||
1391 | break; | ||
1392 | |||
1393 | case 6: | ||
1394 | |||
1395 | /* Line 1464 of yacc.c */ | ||
1396 | #line 59 "util/pmu.y" | ||
1397 | { | ||
1398 | ABORT_ON(perf_pmu__new_format(format, name, | ||
1399 | PERF_PMU_FORMAT_VALUE_CONFIG2, | ||
1400 | (yyvsp[(3) - (3)].bits))); | ||
1401 | ;} | ||
1402 | break; | ||
1403 | |||
1404 | case 7: | ||
1405 | |||
1406 | /* Line 1464 of yacc.c */ | ||
1407 | #line 67 "util/pmu.y" | ||
1408 | { | ||
1409 | bitmap_or((yyval.bits), (yyvsp[(1) - (3)].bits), (yyvsp[(3) - (3)].bits), 64); | ||
1410 | ;} | ||
1411 | break; | ||
1412 | |||
1413 | case 8: | ||
1414 | |||
1415 | /* Line 1464 of yacc.c */ | ||
1416 | #line 72 "util/pmu.y" | ||
1417 | { | ||
1418 | memcpy((yyval.bits), (yyvsp[(1) - (1)].bits), sizeof((yyvsp[(1) - (1)].bits))); | ||
1419 | ;} | ||
1420 | break; | ||
1421 | |||
1422 | case 9: | ||
1423 | |||
1424 | /* Line 1464 of yacc.c */ | ||
1425 | #line 78 "util/pmu.y" | ||
1426 | { | ||
1427 | perf_pmu__set_format((yyval.bits), (yyvsp[(1) - (3)].num), (yyvsp[(3) - (3)].num)); | ||
1428 | ;} | ||
1429 | break; | ||
1430 | |||
1431 | case 10: | ||
1432 | |||
1433 | /* Line 1464 of yacc.c */ | ||
1434 | #line 83 "util/pmu.y" | ||
1435 | { | ||
1436 | perf_pmu__set_format((yyval.bits), (yyvsp[(1) - (1)].num), 0); | ||
1437 | ;} | ||
1438 | break; | ||
1439 | |||
1440 | |||
1441 | |||
1442 | /* Line 1464 of yacc.c */ | ||
1443 | #line 1444 "util/pmu-bison.c" | ||
1444 | default: break; | ||
1445 | } | ||
1446 | YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); | ||
1447 | |||
1448 | YYPOPSTACK (yylen); | ||
1449 | yylen = 0; | ||
1450 | YY_STACK_PRINT (yyss, yyssp); | ||
1451 | |||
1452 | *++yyvsp = yyval; | ||
1453 | |||
1454 | /* Now `shift' the result of the reduction. Determine what state | ||
1455 | that goes to, based on the state we popped back to and the rule | ||
1456 | number reduced by. */ | ||
1457 | |||
1458 | yyn = yyr1[yyn]; | ||
1459 | |||
1460 | yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; | ||
1461 | if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) | ||
1462 | yystate = yytable[yystate]; | ||
1463 | else | ||
1464 | yystate = yydefgoto[yyn - YYNTOKENS]; | ||
1465 | |||
1466 | goto yynewstate; | ||
1467 | |||
1468 | |||
1469 | /*------------------------------------. | ||
1470 | | yyerrlab -- here on detecting error | | ||
1471 | `------------------------------------*/ | ||
1472 | yyerrlab: | ||
1473 | /* If not already recovering from an error, report this error. */ | ||
1474 | if (!yyerrstatus) | ||
1475 | { | ||
1476 | ++yynerrs; | ||
1477 | #if ! YYERROR_VERBOSE | ||
1478 | yyerror (format, name, YY_("syntax error")); | ||
1479 | #else | ||
1480 | { | ||
1481 | YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); | ||
1482 | if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) | ||
1483 | { | ||
1484 | YYSIZE_T yyalloc = 2 * yysize; | ||
1485 | if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) | ||
1486 | yyalloc = YYSTACK_ALLOC_MAXIMUM; | ||
1487 | if (yymsg != yymsgbuf) | ||
1488 | YYSTACK_FREE (yymsg); | ||
1489 | yymsg = (char *) YYSTACK_ALLOC (yyalloc); | ||
1490 | if (yymsg) | ||
1491 | yymsg_alloc = yyalloc; | ||
1492 | else | ||
1493 | { | ||
1494 | yymsg = yymsgbuf; | ||
1495 | yymsg_alloc = sizeof yymsgbuf; | ||
1496 | } | ||
1497 | } | ||
1498 | |||
1499 | if (0 < yysize && yysize <= yymsg_alloc) | ||
1500 | { | ||
1501 | (void) yysyntax_error (yymsg, yystate, yychar); | ||
1502 | yyerror (format, name, yymsg); | ||
1503 | } | ||
1504 | else | ||
1505 | { | ||
1506 | yyerror (format, name, YY_("syntax error")); | ||
1507 | if (yysize != 0) | ||
1508 | goto yyexhaustedlab; | ||
1509 | } | ||
1510 | } | ||
1511 | #endif | ||
1512 | } | ||
1513 | |||
1514 | |||
1515 | |||
1516 | if (yyerrstatus == 3) | ||
1517 | { | ||
1518 | /* If just tried and failed to reuse lookahead token after an | ||
1519 | error, discard it. */ | ||
1520 | |||
1521 | if (yychar <= YYEOF) | ||
1522 | { | ||
1523 | /* Return failure if at end of input. */ | ||
1524 | if (yychar == YYEOF) | ||
1525 | YYABORT; | ||
1526 | } | ||
1527 | else | ||
1528 | { | ||
1529 | yydestruct ("Error: discarding", | ||
1530 | yytoken, &yylval, format, name); | ||
1531 | yychar = YYEMPTY; | ||
1532 | } | ||
1533 | } | ||
1534 | |||
1535 | /* Else will try to reuse lookahead token after shifting the error | ||
1536 | token. */ | ||
1537 | goto yyerrlab1; | ||
1538 | |||
1539 | |||
1540 | /*---------------------------------------------------. | ||
1541 | | yyerrorlab -- error raised explicitly by YYERROR. | | ||
1542 | `---------------------------------------------------*/ | ||
1543 | yyerrorlab: | ||
1544 | |||
1545 | /* Pacify compilers like GCC when the user code never invokes | ||
1546 | YYERROR and the label yyerrorlab therefore never appears in user | ||
1547 | code. */ | ||
1548 | if (/*CONSTCOND*/ 0) | ||
1549 | goto yyerrorlab; | ||
1550 | |||
1551 | /* Do not reclaim the symbols of the rule which action triggered | ||
1552 | this YYERROR. */ | ||
1553 | YYPOPSTACK (yylen); | ||
1554 | yylen = 0; | ||
1555 | YY_STACK_PRINT (yyss, yyssp); | ||
1556 | yystate = *yyssp; | ||
1557 | goto yyerrlab1; | ||
1558 | |||
1559 | |||
1560 | /*-------------------------------------------------------------. | ||
1561 | | yyerrlab1 -- common code for both syntax error and YYERROR. | | ||
1562 | `-------------------------------------------------------------*/ | ||
1563 | yyerrlab1: | ||
1564 | yyerrstatus = 3; /* Each real token shifted decrements this. */ | ||
1565 | |||
1566 | for (;;) | ||
1567 | { | ||
1568 | yyn = yypact[yystate]; | ||
1569 | if (yyn != YYPACT_NINF) | ||
1570 | { | ||
1571 | yyn += YYTERROR; | ||
1572 | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) | ||
1573 | { | ||
1574 | yyn = yytable[yyn]; | ||
1575 | if (0 < yyn) | ||
1576 | break; | ||
1577 | } | ||
1578 | } | ||
1579 | |||
1580 | /* Pop the current state because it cannot handle the error token. */ | ||
1581 | if (yyssp == yyss) | ||
1582 | YYABORT; | ||
1583 | |||
1584 | |||
1585 | yydestruct ("Error: popping", | ||
1586 | yystos[yystate], yyvsp, format, name); | ||
1587 | YYPOPSTACK (1); | ||
1588 | yystate = *yyssp; | ||
1589 | YY_STACK_PRINT (yyss, yyssp); | ||
1590 | } | ||
1591 | |||
1592 | *++yyvsp = yylval; | ||
1593 | |||
1594 | |||
1595 | /* Shift the error token. */ | ||
1596 | YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); | ||
1597 | |||
1598 | yystate = yyn; | ||
1599 | goto yynewstate; | ||
1600 | |||
1601 | |||
1602 | /*-------------------------------------. | ||
1603 | | yyacceptlab -- YYACCEPT comes here. | | ||
1604 | `-------------------------------------*/ | ||
1605 | yyacceptlab: | ||
1606 | yyresult = 0; | ||
1607 | goto yyreturn; | ||
1608 | |||
1609 | /*-----------------------------------. | ||
1610 | | yyabortlab -- YYABORT comes here. | | ||
1611 | `-----------------------------------*/ | ||
1612 | yyabortlab: | ||
1613 | yyresult = 1; | ||
1614 | goto yyreturn; | ||
1615 | |||
1616 | #if !defined(yyoverflow) || YYERROR_VERBOSE | ||
1617 | /*-------------------------------------------------. | ||
1618 | | yyexhaustedlab -- memory exhaustion comes here. | | ||
1619 | `-------------------------------------------------*/ | ||
1620 | yyexhaustedlab: | ||
1621 | yyerror (format, name, YY_("memory exhausted")); | ||
1622 | yyresult = 2; | ||
1623 | /* Fall through. */ | ||
1624 | #endif | ||
1625 | |||
1626 | yyreturn: | ||
1627 | if (yychar != YYEMPTY) | ||
1628 | yydestruct ("Cleanup: discarding lookahead", | ||
1629 | yytoken, &yylval, format, name); | ||
1630 | /* Do not reclaim the symbols of the rule which action triggered | ||
1631 | this YYABORT or YYACCEPT. */ | ||
1632 | YYPOPSTACK (yylen); | ||
1633 | YY_STACK_PRINT (yyss, yyssp); | ||
1634 | while (yyssp != yyss) | ||
1635 | { | ||
1636 | yydestruct ("Cleanup: popping", | ||
1637 | yystos[*yyssp], yyvsp, format, name); | ||
1638 | YYPOPSTACK (1); | ||
1639 | } | ||
1640 | #ifndef yyoverflow | ||
1641 | if (yyss != yyssa) | ||
1642 | YYSTACK_FREE (yyss); | ||
1643 | #endif | ||
1644 | #if YYERROR_VERBOSE | ||
1645 | if (yymsg != yymsgbuf) | ||
1646 | YYSTACK_FREE (yymsg); | ||
1647 | #endif | ||
1648 | /* Make sure YYID is used. */ | ||
1649 | return YYID (yyresult); | ||
1650 | } | ||
1651 | |||
1652 | |||
1653 | |||
1654 | /* Line 1684 of yacc.c */ | ||
1655 | #line 87 "util/pmu.y" | ||
1656 | |||
1657 | |||
1658 | void perf_pmu_error(struct list_head *list __used, | ||
1659 | char *name __used, | ||
1660 | char const *msg __used) | ||
1661 | { | ||
1662 | } | ||
1663 | |||
diff --git a/tools/perf/util/pmu-bison.h b/tools/perf/util/pmu-bison.h deleted file mode 100644 index 54f4a0d7829b..000000000000 --- a/tools/perf/util/pmu-bison.h +++ /dev/null | |||
@@ -1,73 +0,0 @@ | |||
1 | /* A Bison parser, made by GNU Bison 2.4.3. */ | ||
2 | |||
3 | /* Skeleton interface for Bison's Yacc-like parsers in C | ||
4 | |||
5 | Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006, | ||
6 | 2009, 2010 Free Software Foundation, Inc. | ||
7 | |||
8 | This program is free software: you can redistribute it and/or modify | ||
9 | it under the terms of the GNU General Public License as published by | ||
10 | the Free Software Foundation, either version 3 of the License, or | ||
11 | (at your option) any later version. | ||
12 | |||
13 | This program is distributed in the hope that it will be useful, | ||
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | GNU General Public License for more details. | ||
17 | |||
18 | You should have received a copy of the GNU General Public License | ||
19 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | ||
20 | |||
21 | /* As a special exception, you may create a larger work that contains | ||
22 | part or all of the Bison parser skeleton and distribute that work | ||
23 | under terms of your choice, so long as that work isn't itself a | ||
24 | parser generator using the skeleton or a modified version thereof | ||
25 | as a parser skeleton. Alternatively, if you modify or redistribute | ||
26 | the parser skeleton itself, you may (at your option) remove this | ||
27 | special exception, which will cause the skeleton and the resulting | ||
28 | Bison output files to be licensed under the GNU General Public | ||
29 | License without this special exception. | ||
30 | |||
31 | This special exception was added by the Free Software Foundation in | ||
32 | version 2.2 of Bison. */ | ||
33 | |||
34 | |||
35 | /* Tokens. */ | ||
36 | #ifndef YYTOKENTYPE | ||
37 | # define YYTOKENTYPE | ||
38 | /* Put the tokens into the symbol table, so that GDB and other debuggers | ||
39 | know about them. */ | ||
40 | enum yytokentype { | ||
41 | PP_CONFIG = 258, | ||
42 | PP_CONFIG1 = 259, | ||
43 | PP_CONFIG2 = 260, | ||
44 | PP_VALUE = 261, | ||
45 | PP_ERROR = 262 | ||
46 | }; | ||
47 | #endif | ||
48 | |||
49 | |||
50 | |||
51 | #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED | ||
52 | typedef union YYSTYPE | ||
53 | { | ||
54 | |||
55 | /* Line 1685 of yacc.c */ | ||
56 | #line 31 "util/pmu.y" | ||
57 | |||
58 | unsigned long num; | ||
59 | DECLARE_BITMAP(bits, PERF_PMU_FORMAT_BITS); | ||
60 | |||
61 | |||
62 | |||
63 | /* Line 1685 of yacc.c */ | ||
64 | #line 65 "util/pmu-bison.h" | ||
65 | } YYSTYPE; | ||
66 | # define YYSTYPE_IS_TRIVIAL 1 | ||
67 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ | ||
68 | # define YYSTYPE_IS_DECLARED 1 | ||
69 | #endif | ||
70 | |||
71 | extern YYSTYPE perf_pmu_lval; | ||
72 | |||
73 | |||
diff --git a/tools/perf/util/pmu-flex.c b/tools/perf/util/pmu-flex.c deleted file mode 100644 index 5a8c15966d5c..000000000000 --- a/tools/perf/util/pmu-flex.c +++ /dev/null | |||
@@ -1,1821 +0,0 @@ | |||
1 | |||
2 | #line 3 "<stdout>" | ||
3 | |||
4 | #define YY_INT_ALIGNED short int | ||
5 | |||
6 | /* A lexical scanner generated by flex */ | ||
7 | |||
8 | #define yy_create_buffer perf_pmu__create_buffer | ||
9 | #define yy_delete_buffer perf_pmu__delete_buffer | ||
10 | #define yy_flex_debug perf_pmu__flex_debug | ||
11 | #define yy_init_buffer perf_pmu__init_buffer | ||
12 | #define yy_flush_buffer perf_pmu__flush_buffer | ||
13 | #define yy_load_buffer_state perf_pmu__load_buffer_state | ||
14 | #define yy_switch_to_buffer perf_pmu__switch_to_buffer | ||
15 | #define yyin perf_pmu_in | ||
16 | #define yyleng perf_pmu_leng | ||
17 | #define yylex perf_pmu_lex | ||
18 | #define yylineno perf_pmu_lineno | ||
19 | #define yyout perf_pmu_out | ||
20 | #define yyrestart perf_pmu_restart | ||
21 | #define yytext perf_pmu_text | ||
22 | #define yywrap perf_pmu_wrap | ||
23 | #define yyalloc perf_pmu_alloc | ||
24 | #define yyrealloc perf_pmu_realloc | ||
25 | #define yyfree perf_pmu_free | ||
26 | |||
27 | #define FLEX_SCANNER | ||
28 | #define YY_FLEX_MAJOR_VERSION 2 | ||
29 | #define YY_FLEX_MINOR_VERSION 5 | ||
30 | #define YY_FLEX_SUBMINOR_VERSION 35 | ||
31 | #if YY_FLEX_SUBMINOR_VERSION > 0 | ||
32 | #define FLEX_BETA | ||
33 | #endif | ||
34 | |||
35 | /* First, we deal with platform-specific or compiler-specific issues. */ | ||
36 | |||
37 | /* begin standard C headers. */ | ||
38 | #include <stdio.h> | ||
39 | #include <string.h> | ||
40 | #include <errno.h> | ||
41 | #include <stdlib.h> | ||
42 | |||
43 | /* end standard C headers. */ | ||
44 | |||
45 | /* flex integer type definitions */ | ||
46 | |||
47 | #ifndef FLEXINT_H | ||
48 | #define FLEXINT_H | ||
49 | |||
50 | /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ | ||
51 | |||
52 | #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L | ||
53 | |||
54 | /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, | ||
55 | * if you want the limit (max/min) macros for int types. | ||
56 | */ | ||
57 | #ifndef __STDC_LIMIT_MACROS | ||
58 | #define __STDC_LIMIT_MACROS 1 | ||
59 | #endif | ||
60 | |||
61 | #include <inttypes.h> | ||
62 | typedef int8_t flex_int8_t; | ||
63 | typedef uint8_t flex_uint8_t; | ||
64 | typedef int16_t flex_int16_t; | ||
65 | typedef uint16_t flex_uint16_t; | ||
66 | typedef int32_t flex_int32_t; | ||
67 | typedef uint32_t flex_uint32_t; | ||
68 | #else | ||
69 | typedef signed char flex_int8_t; | ||
70 | typedef short int flex_int16_t; | ||
71 | typedef int flex_int32_t; | ||
72 | typedef unsigned char flex_uint8_t; | ||
73 | typedef unsigned short int flex_uint16_t; | ||
74 | typedef unsigned int flex_uint32_t; | ||
75 | #endif /* ! C99 */ | ||
76 | |||
77 | /* Limits of integral types. */ | ||
78 | #ifndef INT8_MIN | ||
79 | #define INT8_MIN (-128) | ||
80 | #endif | ||
81 | #ifndef INT16_MIN | ||
82 | #define INT16_MIN (-32767-1) | ||
83 | #endif | ||
84 | #ifndef INT32_MIN | ||
85 | #define INT32_MIN (-2147483647-1) | ||
86 | #endif | ||
87 | #ifndef INT8_MAX | ||
88 | #define INT8_MAX (127) | ||
89 | #endif | ||
90 | #ifndef INT16_MAX | ||
91 | #define INT16_MAX (32767) | ||
92 | #endif | ||
93 | #ifndef INT32_MAX | ||
94 | #define INT32_MAX (2147483647) | ||
95 | #endif | ||
96 | #ifndef UINT8_MAX | ||
97 | #define UINT8_MAX (255U) | ||
98 | #endif | ||
99 | #ifndef UINT16_MAX | ||
100 | #define UINT16_MAX (65535U) | ||
101 | #endif | ||
102 | #ifndef UINT32_MAX | ||
103 | #define UINT32_MAX (4294967295U) | ||
104 | #endif | ||
105 | |||
106 | #endif /* ! FLEXINT_H */ | ||
107 | |||
108 | #ifdef __cplusplus | ||
109 | |||
110 | /* The "const" storage-class-modifier is valid. */ | ||
111 | #define YY_USE_CONST | ||
112 | |||
113 | #else /* ! __cplusplus */ | ||
114 | |||
115 | /* C99 requires __STDC__ to be defined as 1. */ | ||
116 | #if defined (__STDC__) | ||
117 | |||
118 | #define YY_USE_CONST | ||
119 | |||
120 | #endif /* defined (__STDC__) */ | ||
121 | #endif /* ! __cplusplus */ | ||
122 | |||
123 | #ifdef YY_USE_CONST | ||
124 | #define yyconst const | ||
125 | #else | ||
126 | #define yyconst | ||
127 | #endif | ||
128 | |||
129 | /* Returned upon end-of-file. */ | ||
130 | #define YY_NULL 0 | ||
131 | |||
132 | /* Promotes a possibly negative, possibly signed char to an unsigned | ||
133 | * integer for use as an array index. If the signed char is negative, | ||
134 | * we want to instead treat it as an 8-bit unsigned char, hence the | ||
135 | * double cast. | ||
136 | */ | ||
137 | #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) | ||
138 | |||
139 | /* Enter a start condition. This macro really ought to take a parameter, | ||
140 | * but we do it the disgusting crufty way forced on us by the ()-less | ||
141 | * definition of BEGIN. | ||
142 | */ | ||
143 | #define BEGIN (yy_start) = 1 + 2 * | ||
144 | |||
145 | /* Translate the current start state into a value that can be later handed | ||
146 | * to BEGIN to return to the state. The YYSTATE alias is for lex | ||
147 | * compatibility. | ||
148 | */ | ||
149 | #define YY_START (((yy_start) - 1) / 2) | ||
150 | #define YYSTATE YY_START | ||
151 | |||
152 | /* Action number for EOF rule of a given start state. */ | ||
153 | #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) | ||
154 | |||
155 | /* Special action meaning "start processing a new file". */ | ||
156 | #define YY_NEW_FILE perf_pmu_restart(perf_pmu_in ) | ||
157 | |||
158 | #define YY_END_OF_BUFFER_CHAR 0 | ||
159 | |||
160 | /* Size of default input buffer. */ | ||
161 | #ifndef YY_BUF_SIZE | ||
162 | #define YY_BUF_SIZE 16384 | ||
163 | #endif | ||
164 | |||
165 | /* The state buf must be large enough to hold one state per character in the main buffer. | ||
166 | */ | ||
167 | #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) | ||
168 | |||
169 | #ifndef YY_TYPEDEF_YY_BUFFER_STATE | ||
170 | #define YY_TYPEDEF_YY_BUFFER_STATE | ||
171 | typedef struct yy_buffer_state *YY_BUFFER_STATE; | ||
172 | #endif | ||
173 | |||
174 | extern int perf_pmu_leng; | ||
175 | |||
176 | extern FILE *perf_pmu_in, *perf_pmu_out; | ||
177 | |||
178 | #define EOB_ACT_CONTINUE_SCAN 0 | ||
179 | #define EOB_ACT_END_OF_FILE 1 | ||
180 | #define EOB_ACT_LAST_MATCH 2 | ||
181 | |||
182 | #define YY_LESS_LINENO(n) | ||
183 | |||
184 | /* Return all but the first "n" matched characters back to the input stream. */ | ||
185 | #define yyless(n) \ | ||
186 | do \ | ||
187 | { \ | ||
188 | /* Undo effects of setting up perf_pmu_text. */ \ | ||
189 | int yyless_macro_arg = (n); \ | ||
190 | YY_LESS_LINENO(yyless_macro_arg);\ | ||
191 | *yy_cp = (yy_hold_char); \ | ||
192 | YY_RESTORE_YY_MORE_OFFSET \ | ||
193 | (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ | ||
194 | YY_DO_BEFORE_ACTION; /* set up perf_pmu_text again */ \ | ||
195 | } \ | ||
196 | while ( 0 ) | ||
197 | |||
198 | #define unput(c) yyunput( c, (yytext_ptr) ) | ||
199 | |||
200 | #ifndef YY_TYPEDEF_YY_SIZE_T | ||
201 | #define YY_TYPEDEF_YY_SIZE_T | ||
202 | typedef size_t yy_size_t; | ||
203 | #endif | ||
204 | |||
205 | #ifndef YY_STRUCT_YY_BUFFER_STATE | ||
206 | #define YY_STRUCT_YY_BUFFER_STATE | ||
207 | struct yy_buffer_state | ||
208 | { | ||
209 | FILE *yy_input_file; | ||
210 | |||
211 | char *yy_ch_buf; /* input buffer */ | ||
212 | char *yy_buf_pos; /* current position in input buffer */ | ||
213 | |||
214 | /* Size of input buffer in bytes, not including room for EOB | ||
215 | * characters. | ||
216 | */ | ||
217 | yy_size_t yy_buf_size; | ||
218 | |||
219 | /* Number of characters read into yy_ch_buf, not including EOB | ||
220 | * characters. | ||
221 | */ | ||
222 | int yy_n_chars; | ||
223 | |||
224 | /* Whether we "own" the buffer - i.e., we know we created it, | ||
225 | * and can realloc() it to grow it, and should free() it to | ||
226 | * delete it. | ||
227 | */ | ||
228 | int yy_is_our_buffer; | ||
229 | |||
230 | /* Whether this is an "interactive" input source; if so, and | ||
231 | * if we're using stdio for input, then we want to use getc() | ||
232 | * instead of fread(), to make sure we stop fetching input after | ||
233 | * each newline. | ||
234 | */ | ||
235 | int yy_is_interactive; | ||
236 | |||
237 | /* Whether we're considered to be at the beginning of a line. | ||
238 | * If so, '^' rules will be active on the next match, otherwise | ||
239 | * not. | ||
240 | */ | ||
241 | int yy_at_bol; | ||
242 | |||
243 | int yy_bs_lineno; /**< The line count. */ | ||
244 | int yy_bs_column; /**< The column count. */ | ||
245 | |||
246 | /* Whether to try to fill the input buffer when we reach the | ||
247 | * end of it. | ||
248 | */ | ||
249 | int yy_fill_buffer; | ||
250 | |||
251 | int yy_buffer_status; | ||
252 | |||
253 | #define YY_BUFFER_NEW 0 | ||
254 | #define YY_BUFFER_NORMAL 1 | ||
255 | /* When an EOF's been seen but there's still some text to process | ||
256 | * then we mark the buffer as YY_EOF_PENDING, to indicate that we | ||
257 | * shouldn't try reading from the input source any more. We might | ||
258 | * still have a bunch of tokens to match, though, because of | ||
259 | * possible backing-up. | ||
260 | * | ||
261 | * When we actually see the EOF, we change the status to "new" | ||
262 | * (via perf_pmu_restart()), so that the user can continue scanning by | ||
263 | * just pointing perf_pmu_in at a new input file. | ||
264 | */ | ||
265 | #define YY_BUFFER_EOF_PENDING 2 | ||
266 | |||
267 | }; | ||
268 | #endif /* !YY_STRUCT_YY_BUFFER_STATE */ | ||
269 | |||
270 | /* Stack of input buffers. */ | ||
271 | static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ | ||
272 | static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ | ||
273 | static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ | ||
274 | |||
275 | /* We provide macros for accessing buffer states in case in the | ||
276 | * future we want to put the buffer states in a more general | ||
277 | * "scanner state". | ||
278 | * | ||
279 | * Returns the top of the stack, or NULL. | ||
280 | */ | ||
281 | #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ | ||
282 | ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ | ||
283 | : NULL) | ||
284 | |||
285 | /* Same as previous macro, but useful when we know that the buffer stack is not | ||
286 | * NULL or when we need an lvalue. For internal use only. | ||
287 | */ | ||
288 | #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] | ||
289 | |||
290 | /* yy_hold_char holds the character lost when perf_pmu_text is formed. */ | ||
291 | static char yy_hold_char; | ||
292 | static int yy_n_chars; /* number of characters read into yy_ch_buf */ | ||
293 | int perf_pmu_leng; | ||
294 | |||
295 | /* Points to current character in buffer. */ | ||
296 | static char *yy_c_buf_p = (char *) 0; | ||
297 | static int yy_init = 0; /* whether we need to initialize */ | ||
298 | static int yy_start = 0; /* start state number */ | ||
299 | |||
300 | /* Flag which is used to allow perf_pmu_wrap()'s to do buffer switches | ||
301 | * instead of setting up a fresh perf_pmu_in. A bit of a hack ... | ||
302 | */ | ||
303 | static int yy_did_buffer_switch_on_eof; | ||
304 | |||
305 | void perf_pmu_restart (FILE *input_file ); | ||
306 | void perf_pmu__switch_to_buffer (YY_BUFFER_STATE new_buffer ); | ||
307 | YY_BUFFER_STATE perf_pmu__create_buffer (FILE *file,int size ); | ||
308 | void perf_pmu__delete_buffer (YY_BUFFER_STATE b ); | ||
309 | void perf_pmu__flush_buffer (YY_BUFFER_STATE b ); | ||
310 | void perf_pmu_push_buffer_state (YY_BUFFER_STATE new_buffer ); | ||
311 | void perf_pmu_pop_buffer_state (void ); | ||
312 | |||
313 | static void perf_pmu_ensure_buffer_stack (void ); | ||
314 | static void perf_pmu__load_buffer_state (void ); | ||
315 | static void perf_pmu__init_buffer (YY_BUFFER_STATE b,FILE *file ); | ||
316 | |||
317 | #define YY_FLUSH_BUFFER perf_pmu__flush_buffer(YY_CURRENT_BUFFER ) | ||
318 | |||
319 | YY_BUFFER_STATE perf_pmu__scan_buffer (char *base,yy_size_t size ); | ||
320 | YY_BUFFER_STATE perf_pmu__scan_string (yyconst char *yy_str ); | ||
321 | YY_BUFFER_STATE perf_pmu__scan_bytes (yyconst char *bytes,int len ); | ||
322 | |||
323 | void *perf_pmu_alloc (yy_size_t ); | ||
324 | void *perf_pmu_realloc (void *,yy_size_t ); | ||
325 | void perf_pmu_free (void * ); | ||
326 | |||
327 | #define yy_new_buffer perf_pmu__create_buffer | ||
328 | |||
329 | #define yy_set_interactive(is_interactive) \ | ||
330 | { \ | ||
331 | if ( ! YY_CURRENT_BUFFER ){ \ | ||
332 | perf_pmu_ensure_buffer_stack (); \ | ||
333 | YY_CURRENT_BUFFER_LVALUE = \ | ||
334 | perf_pmu__create_buffer(perf_pmu_in,YY_BUF_SIZE ); \ | ||
335 | } \ | ||
336 | YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ | ||
337 | } | ||
338 | |||
339 | #define yy_set_bol(at_bol) \ | ||
340 | { \ | ||
341 | if ( ! YY_CURRENT_BUFFER ){\ | ||
342 | perf_pmu_ensure_buffer_stack (); \ | ||
343 | YY_CURRENT_BUFFER_LVALUE = \ | ||
344 | perf_pmu__create_buffer(perf_pmu_in,YY_BUF_SIZE ); \ | ||
345 | } \ | ||
346 | YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ | ||
347 | } | ||
348 | |||
349 | #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) | ||
350 | |||
351 | /* Begin user sect3 */ | ||
352 | |||
353 | typedef unsigned char YY_CHAR; | ||
354 | |||
355 | FILE *perf_pmu_in = (FILE *) 0, *perf_pmu_out = (FILE *) 0; | ||
356 | |||
357 | typedef int yy_state_type; | ||
358 | |||
359 | extern int perf_pmu_lineno; | ||
360 | |||
361 | int perf_pmu_lineno = 1; | ||
362 | |||
363 | extern char *perf_pmu_text; | ||
364 | #define yytext_ptr perf_pmu_text | ||
365 | |||
366 | static yy_state_type yy_get_previous_state (void ); | ||
367 | static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); | ||
368 | static int yy_get_next_buffer (void ); | ||
369 | static void yy_fatal_error (yyconst char msg[] ); | ||
370 | |||
371 | /* Done after the current pattern has been matched and before the | ||
372 | * corresponding action - sets up perf_pmu_text. | ||
373 | */ | ||
374 | #define YY_DO_BEFORE_ACTION \ | ||
375 | (yytext_ptr) = yy_bp; \ | ||
376 | perf_pmu_leng = (size_t) (yy_cp - yy_bp); \ | ||
377 | (yy_hold_char) = *yy_cp; \ | ||
378 | *yy_cp = '\0'; \ | ||
379 | (yy_c_buf_p) = yy_cp; | ||
380 | |||
381 | #define YY_NUM_RULES 10 | ||
382 | #define YY_END_OF_BUFFER 11 | ||
383 | /* This struct is not used in this scanner, | ||
384 | but its presence is necessary. */ | ||
385 | struct yy_trans_info | ||
386 | { | ||
387 | flex_int32_t yy_verify; | ||
388 | flex_int32_t yy_nxt; | ||
389 | }; | ||
390 | static yyconst flex_int16_t yy_accept[20] = | ||
391 | { 0, | ||
392 | 0, 0, 11, 8, 9, 7, 5, 1, 6, 8, | ||
393 | 1, 0, 0, 0, 0, 2, 3, 4, 0 | ||
394 | } ; | ||
395 | |||
396 | static yyconst flex_int32_t yy_ec[256] = | ||
397 | { 0, | ||
398 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, | ||
399 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
400 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
401 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
402 | 1, 1, 1, 3, 4, 1, 1, 5, 6, 7, | ||
403 | 5, 5, 5, 5, 5, 5, 5, 8, 1, 1, | ||
404 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
405 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
406 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
407 | 1, 1, 1, 1, 1, 1, 1, 1, 9, 1, | ||
408 | |||
409 | 1, 10, 11, 1, 12, 1, 1, 1, 1, 13, | ||
410 | 14, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
411 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
412 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
413 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
414 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
415 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
416 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
417 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
418 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
419 | |||
420 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
421 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
422 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
423 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
424 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
425 | 1, 1, 1, 1, 1 | ||
426 | } ; | ||
427 | |||
428 | static yyconst flex_int32_t yy_meta[15] = | ||
429 | { 0, | ||
430 | 1, 1, 1, 1, 2, 2, 2, 1, 1, 1, | ||
431 | 1, 1, 1, 1 | ||
432 | } ; | ||
433 | |||
434 | static yyconst flex_int16_t yy_base[21] = | ||
435 | { 0, | ||
436 | 0, 0, 23, 24, 24, 24, 24, 0, 24, 8, | ||
437 | 0, 8, 10, 7, 7, 9, 24, 24, 24, 15 | ||
438 | } ; | ||
439 | |||
440 | static yyconst flex_int16_t yy_def[21] = | ||
441 | { 0, | ||
442 | 19, 1, 19, 19, 19, 19, 19, 20, 19, 19, | ||
443 | 20, 19, 19, 19, 19, 19, 19, 19, 0, 19 | ||
444 | } ; | ||
445 | |||
446 | static yyconst flex_int16_t yy_nxt[39] = | ||
447 | { 0, | ||
448 | 4, 5, 6, 7, 8, 8, 8, 9, 10, 4, | ||
449 | 4, 4, 4, 4, 17, 18, 11, 16, 15, 14, | ||
450 | 13, 12, 19, 3, 19, 19, 19, 19, 19, 19, | ||
451 | 19, 19, 19, 19, 19, 19, 19, 19 | ||
452 | } ; | ||
453 | |||
454 | static yyconst flex_int16_t yy_chk[39] = | ||
455 | { 0, | ||
456 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
457 | 1, 1, 1, 1, 16, 16, 20, 15, 14, 13, | ||
458 | 12, 10, 3, 19, 19, 19, 19, 19, 19, 19, | ||
459 | 19, 19, 19, 19, 19, 19, 19, 19 | ||
460 | } ; | ||
461 | |||
462 | static yy_state_type yy_last_accepting_state; | ||
463 | static char *yy_last_accepting_cpos; | ||
464 | |||
465 | extern int perf_pmu__flex_debug; | ||
466 | int perf_pmu__flex_debug = 0; | ||
467 | |||
468 | /* The intent behind this definition is that it'll catch | ||
469 | * any uses of REJECT which flex missed. | ||
470 | */ | ||
471 | #define REJECT reject_used_but_not_detected | ||
472 | #define yymore() yymore_used_but_not_detected | ||
473 | #define YY_MORE_ADJ 0 | ||
474 | #define YY_RESTORE_YY_MORE_OFFSET | ||
475 | char *perf_pmu_text; | ||
476 | #line 1 "util/pmu.l" | ||
477 | #line 4 "util/pmu.l" | ||
478 | #include <stdlib.h> | ||
479 | #include <linux/bitops.h> | ||
480 | #include "pmu.h" | ||
481 | #include "pmu-bison.h" | ||
482 | |||
483 | static int value(int base) | ||
484 | { | ||
485 | long num; | ||
486 | |||
487 | errno = 0; | ||
488 | num = strtoul(perf_pmu_text, NULL, base); | ||
489 | if (errno) | ||
490 | return PP_ERROR; | ||
491 | |||
492 | perf_pmu_lval.num = num; | ||
493 | return PP_VALUE; | ||
494 | } | ||
495 | |||
496 | #line 497 "<stdout>" | ||
497 | |||
498 | #define INITIAL 0 | ||
499 | |||
500 | #ifndef YY_NO_UNISTD_H | ||
501 | /* Special case for "unistd.h", since it is non-ANSI. We include it way | ||
502 | * down here because we want the user's section 1 to have been scanned first. | ||
503 | * The user has a chance to override it with an option. | ||
504 | */ | ||
505 | #include <unistd.h> | ||
506 | #endif | ||
507 | |||
508 | #ifndef YY_EXTRA_TYPE | ||
509 | #define YY_EXTRA_TYPE void * | ||
510 | #endif | ||
511 | |||
512 | static int yy_init_globals (void ); | ||
513 | |||
514 | /* Accessor methods to globals. | ||
515 | These are made visible to non-reentrant scanners for convenience. */ | ||
516 | |||
517 | int perf_pmu_lex_destroy (void ); | ||
518 | |||
519 | int perf_pmu_get_debug (void ); | ||
520 | |||
521 | void perf_pmu_set_debug (int debug_flag ); | ||
522 | |||
523 | YY_EXTRA_TYPE perf_pmu_get_extra (void ); | ||
524 | |||
525 | void perf_pmu_set_extra (YY_EXTRA_TYPE user_defined ); | ||
526 | |||
527 | FILE *perf_pmu_get_in (void ); | ||
528 | |||
529 | void perf_pmu_set_in (FILE * in_str ); | ||
530 | |||
531 | FILE *perf_pmu_get_out (void ); | ||
532 | |||
533 | void perf_pmu_set_out (FILE * out_str ); | ||
534 | |||
535 | int perf_pmu_get_leng (void ); | ||
536 | |||
537 | char *perf_pmu_get_text (void ); | ||
538 | |||
539 | int perf_pmu_get_lineno (void ); | ||
540 | |||
541 | void perf_pmu_set_lineno (int line_number ); | ||
542 | |||
543 | /* Macros after this point can all be overridden by user definitions in | ||
544 | * section 1. | ||
545 | */ | ||
546 | |||
547 | #ifndef YY_SKIP_YYWRAP | ||
548 | #ifdef __cplusplus | ||
549 | extern "C" int perf_pmu_wrap (void ); | ||
550 | #else | ||
551 | extern int perf_pmu_wrap (void ); | ||
552 | #endif | ||
553 | #endif | ||
554 | |||
555 | static void yyunput (int c,char *buf_ptr ); | ||
556 | |||
557 | #ifndef yytext_ptr | ||
558 | static void yy_flex_strncpy (char *,yyconst char *,int ); | ||
559 | #endif | ||
560 | |||
561 | #ifdef YY_NEED_STRLEN | ||
562 | static int yy_flex_strlen (yyconst char * ); | ||
563 | #endif | ||
564 | |||
565 | #ifndef YY_NO_INPUT | ||
566 | |||
567 | #ifdef __cplusplus | ||
568 | static int yyinput (void ); | ||
569 | #else | ||
570 | static int input (void ); | ||
571 | #endif | ||
572 | |||
573 | #endif | ||
574 | |||
575 | /* Amount of stuff to slurp up with each read. */ | ||
576 | #ifndef YY_READ_BUF_SIZE | ||
577 | #define YY_READ_BUF_SIZE 8192 | ||
578 | #endif | ||
579 | |||
580 | /* Copy whatever the last rule matched to the standard output. */ | ||
581 | #ifndef ECHO | ||
582 | /* This used to be an fputs(), but since the string might contain NUL's, | ||
583 | * we now use fwrite(). | ||
584 | */ | ||
585 | #define ECHO do { if (fwrite( perf_pmu_text, perf_pmu_leng, 1, perf_pmu_out )) {} } while (0) | ||
586 | #endif | ||
587 | |||
588 | /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, | ||
589 | * is returned in "result". | ||
590 | */ | ||
591 | #ifndef YY_INPUT | ||
592 | #define YY_INPUT(buf,result,max_size) \ | ||
593 | if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ | ||
594 | { \ | ||
595 | int c = '*'; \ | ||
596 | unsigned n; \ | ||
597 | for ( n = 0; n < max_size && \ | ||
598 | (c = getc( perf_pmu_in )) != EOF && c != '\n'; ++n ) \ | ||
599 | buf[n] = (char) c; \ | ||
600 | if ( c == '\n' ) \ | ||
601 | buf[n++] = (char) c; \ | ||
602 | if ( c == EOF && ferror( perf_pmu_in ) ) \ | ||
603 | YY_FATAL_ERROR( "input in flex scanner failed" ); \ | ||
604 | result = n; \ | ||
605 | } \ | ||
606 | else \ | ||
607 | { \ | ||
608 | errno=0; \ | ||
609 | while ( (result = fread(buf, 1, max_size, perf_pmu_in))==0 && ferror(perf_pmu_in)) \ | ||
610 | { \ | ||
611 | if( errno != EINTR) \ | ||
612 | { \ | ||
613 | YY_FATAL_ERROR( "input in flex scanner failed" ); \ | ||
614 | break; \ | ||
615 | } \ | ||
616 | errno=0; \ | ||
617 | clearerr(perf_pmu_in); \ | ||
618 | } \ | ||
619 | }\ | ||
620 | \ | ||
621 | |||
622 | #endif | ||
623 | |||
624 | /* No semi-colon after return; correct usage is to write "yyterminate();" - | ||
625 | * we don't want an extra ';' after the "return" because that will cause | ||
626 | * some compilers to complain about unreachable statements. | ||
627 | */ | ||
628 | #ifndef yyterminate | ||
629 | #define yyterminate() return YY_NULL | ||
630 | #endif | ||
631 | |||
632 | /* Number of entries by which start-condition stack grows. */ | ||
633 | #ifndef YY_START_STACK_INCR | ||
634 | #define YY_START_STACK_INCR 25 | ||
635 | #endif | ||
636 | |||
637 | /* Report a fatal error. */ | ||
638 | #ifndef YY_FATAL_ERROR | ||
639 | #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) | ||
640 | #endif | ||
641 | |||
642 | /* end tables serialization structures and prototypes */ | ||
643 | |||
644 | /* Default declaration of generated scanner - a define so the user can | ||
645 | * easily add parameters. | ||
646 | */ | ||
647 | #ifndef YY_DECL | ||
648 | #define YY_DECL_IS_OURS 1 | ||
649 | |||
650 | extern int perf_pmu_lex (void); | ||
651 | |||
652 | #define YY_DECL int perf_pmu_lex (void) | ||
653 | #endif /* !YY_DECL */ | ||
654 | |||
655 | /* Code executed at the beginning of each rule, after perf_pmu_text and perf_pmu_leng | ||
656 | * have been set up. | ||
657 | */ | ||
658 | #ifndef YY_USER_ACTION | ||
659 | #define YY_USER_ACTION | ||
660 | #endif | ||
661 | |||
662 | /* Code executed at the end of each rule. */ | ||
663 | #ifndef YY_BREAK | ||
664 | #define YY_BREAK break; | ||
665 | #endif | ||
666 | |||
667 | #define YY_RULE_SETUP \ | ||
668 | YY_USER_ACTION | ||
669 | |||
670 | /** The main scanner function which does all the work. | ||
671 | */ | ||
672 | YY_DECL | ||
673 | { | ||
674 | register yy_state_type yy_current_state; | ||
675 | register char *yy_cp, *yy_bp; | ||
676 | register int yy_act; | ||
677 | |||
678 | #line 26 "util/pmu.l" | ||
679 | |||
680 | |||
681 | #line 682 "<stdout>" | ||
682 | |||
683 | if ( !(yy_init) ) | ||
684 | { | ||
685 | (yy_init) = 1; | ||
686 | |||
687 | #ifdef YY_USER_INIT | ||
688 | YY_USER_INIT; | ||
689 | #endif | ||
690 | |||
691 | if ( ! (yy_start) ) | ||
692 | (yy_start) = 1; /* first start state */ | ||
693 | |||
694 | if ( ! perf_pmu_in ) | ||
695 | perf_pmu_in = stdin; | ||
696 | |||
697 | if ( ! perf_pmu_out ) | ||
698 | perf_pmu_out = stdout; | ||
699 | |||
700 | if ( ! YY_CURRENT_BUFFER ) { | ||
701 | perf_pmu_ensure_buffer_stack (); | ||
702 | YY_CURRENT_BUFFER_LVALUE = | ||
703 | perf_pmu__create_buffer(perf_pmu_in,YY_BUF_SIZE ); | ||
704 | } | ||
705 | |||
706 | perf_pmu__load_buffer_state( ); | ||
707 | } | ||
708 | |||
709 | while ( 1 ) /* loops until end-of-file is reached */ | ||
710 | { | ||
711 | yy_cp = (yy_c_buf_p); | ||
712 | |||
713 | /* Support of perf_pmu_text. */ | ||
714 | *yy_cp = (yy_hold_char); | ||
715 | |||
716 | /* yy_bp points to the position in yy_ch_buf of the start of | ||
717 | * the current run. | ||
718 | */ | ||
719 | yy_bp = yy_cp; | ||
720 | |||
721 | yy_current_state = (yy_start); | ||
722 | yy_match: | ||
723 | do | ||
724 | { | ||
725 | register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; | ||
726 | if ( yy_accept[yy_current_state] ) | ||
727 | { | ||
728 | (yy_last_accepting_state) = yy_current_state; | ||
729 | (yy_last_accepting_cpos) = yy_cp; | ||
730 | } | ||
731 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) | ||
732 | { | ||
733 | yy_current_state = (int) yy_def[yy_current_state]; | ||
734 | if ( yy_current_state >= 20 ) | ||
735 | yy_c = yy_meta[(unsigned int) yy_c]; | ||
736 | } | ||
737 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; | ||
738 | ++yy_cp; | ||
739 | } | ||
740 | while ( yy_base[yy_current_state] != 24 ); | ||
741 | |||
742 | yy_find_action: | ||
743 | yy_act = yy_accept[yy_current_state]; | ||
744 | if ( yy_act == 0 ) | ||
745 | { /* have to back up */ | ||
746 | yy_cp = (yy_last_accepting_cpos); | ||
747 | yy_current_state = (yy_last_accepting_state); | ||
748 | yy_act = yy_accept[yy_current_state]; | ||
749 | } | ||
750 | |||
751 | YY_DO_BEFORE_ACTION; | ||
752 | |||
753 | do_action: /* This label is used only to access EOF actions. */ | ||
754 | |||
755 | switch ( yy_act ) | ||
756 | { /* beginning of action switch */ | ||
757 | case 0: /* must back up */ | ||
758 | /* undo the effects of YY_DO_BEFORE_ACTION */ | ||
759 | *yy_cp = (yy_hold_char); | ||
760 | yy_cp = (yy_last_accepting_cpos); | ||
761 | yy_current_state = (yy_last_accepting_state); | ||
762 | goto yy_find_action; | ||
763 | |||
764 | case 1: | ||
765 | YY_RULE_SETUP | ||
766 | #line 28 "util/pmu.l" | ||
767 | { return value(10); } | ||
768 | YY_BREAK | ||
769 | case 2: | ||
770 | YY_RULE_SETUP | ||
771 | #line 29 "util/pmu.l" | ||
772 | { return PP_CONFIG; } | ||
773 | YY_BREAK | ||
774 | case 3: | ||
775 | YY_RULE_SETUP | ||
776 | #line 30 "util/pmu.l" | ||
777 | { return PP_CONFIG1; } | ||
778 | YY_BREAK | ||
779 | case 4: | ||
780 | YY_RULE_SETUP | ||
781 | #line 31 "util/pmu.l" | ||
782 | { return PP_CONFIG2; } | ||
783 | YY_BREAK | ||
784 | case 5: | ||
785 | YY_RULE_SETUP | ||
786 | #line 32 "util/pmu.l" | ||
787 | { return '-'; } | ||
788 | YY_BREAK | ||
789 | case 6: | ||
790 | YY_RULE_SETUP | ||
791 | #line 33 "util/pmu.l" | ||
792 | { return ':'; } | ||
793 | YY_BREAK | ||
794 | case 7: | ||
795 | YY_RULE_SETUP | ||
796 | #line 34 "util/pmu.l" | ||
797 | { return ','; } | ||
798 | YY_BREAK | ||
799 | case 8: | ||
800 | YY_RULE_SETUP | ||
801 | #line 35 "util/pmu.l" | ||
802 | { ; } | ||
803 | YY_BREAK | ||
804 | case 9: | ||
805 | /* rule 9 can match eol */ | ||
806 | YY_RULE_SETUP | ||
807 | #line 36 "util/pmu.l" | ||
808 | { ; } | ||
809 | YY_BREAK | ||
810 | case 10: | ||
811 | YY_RULE_SETUP | ||
812 | #line 38 "util/pmu.l" | ||
813 | ECHO; | ||
814 | YY_BREAK | ||
815 | #line 816 "<stdout>" | ||
816 | case YY_STATE_EOF(INITIAL): | ||
817 | yyterminate(); | ||
818 | |||
819 | case YY_END_OF_BUFFER: | ||
820 | { | ||
821 | /* Amount of text matched not including the EOB char. */ | ||
822 | int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; | ||
823 | |||
824 | /* Undo the effects of YY_DO_BEFORE_ACTION. */ | ||
825 | *yy_cp = (yy_hold_char); | ||
826 | YY_RESTORE_YY_MORE_OFFSET | ||
827 | |||
828 | if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) | ||
829 | { | ||
830 | /* We're scanning a new file or input source. It's | ||
831 | * possible that this happened because the user | ||
832 | * just pointed perf_pmu_in at a new source and called | ||
833 | * perf_pmu_lex(). If so, then we have to assure | ||
834 | * consistency between YY_CURRENT_BUFFER and our | ||
835 | * globals. Here is the right place to do so, because | ||
836 | * this is the first action (other than possibly a | ||
837 | * back-up) that will match for the new input source. | ||
838 | */ | ||
839 | (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; | ||
840 | YY_CURRENT_BUFFER_LVALUE->yy_input_file = perf_pmu_in; | ||
841 | YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; | ||
842 | } | ||
843 | |||
844 | /* Note that here we test for yy_c_buf_p "<=" to the position | ||
845 | * of the first EOB in the buffer, since yy_c_buf_p will | ||
846 | * already have been incremented past the NUL character | ||
847 | * (since all states make transitions on EOB to the | ||
848 | * end-of-buffer state). Contrast this with the test | ||
849 | * in input(). | ||
850 | */ | ||
851 | if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) | ||
852 | { /* This was really a NUL. */ | ||
853 | yy_state_type yy_next_state; | ||
854 | |||
855 | (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; | ||
856 | |||
857 | yy_current_state = yy_get_previous_state( ); | ||
858 | |||
859 | /* Okay, we're now positioned to make the NUL | ||
860 | * transition. We couldn't have | ||
861 | * yy_get_previous_state() go ahead and do it | ||
862 | * for us because it doesn't know how to deal | ||
863 | * with the possibility of jamming (and we don't | ||
864 | * want to build jamming into it because then it | ||
865 | * will run more slowly). | ||
866 | */ | ||
867 | |||
868 | yy_next_state = yy_try_NUL_trans( yy_current_state ); | ||
869 | |||
870 | yy_bp = (yytext_ptr) + YY_MORE_ADJ; | ||
871 | |||
872 | if ( yy_next_state ) | ||
873 | { | ||
874 | /* Consume the NUL. */ | ||
875 | yy_cp = ++(yy_c_buf_p); | ||
876 | yy_current_state = yy_next_state; | ||
877 | goto yy_match; | ||
878 | } | ||
879 | |||
880 | else | ||
881 | { | ||
882 | yy_cp = (yy_c_buf_p); | ||
883 | goto yy_find_action; | ||
884 | } | ||
885 | } | ||
886 | |||
887 | else switch ( yy_get_next_buffer( ) ) | ||
888 | { | ||
889 | case EOB_ACT_END_OF_FILE: | ||
890 | { | ||
891 | (yy_did_buffer_switch_on_eof) = 0; | ||
892 | |||
893 | if ( perf_pmu_wrap( ) ) | ||
894 | { | ||
895 | /* Note: because we've taken care in | ||
896 | * yy_get_next_buffer() to have set up | ||
897 | * perf_pmu_text, we can now set up | ||
898 | * yy_c_buf_p so that if some total | ||
899 | * hoser (like flex itself) wants to | ||
900 | * call the scanner after we return the | ||
901 | * YY_NULL, it'll still work - another | ||
902 | * YY_NULL will get returned. | ||
903 | */ | ||
904 | (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; | ||
905 | |||
906 | yy_act = YY_STATE_EOF(YY_START); | ||
907 | goto do_action; | ||
908 | } | ||
909 | |||
910 | else | ||
911 | { | ||
912 | if ( ! (yy_did_buffer_switch_on_eof) ) | ||
913 | YY_NEW_FILE; | ||
914 | } | ||
915 | break; | ||
916 | } | ||
917 | |||
918 | case EOB_ACT_CONTINUE_SCAN: | ||
919 | (yy_c_buf_p) = | ||
920 | (yytext_ptr) + yy_amount_of_matched_text; | ||
921 | |||
922 | yy_current_state = yy_get_previous_state( ); | ||
923 | |||
924 | yy_cp = (yy_c_buf_p); | ||
925 | yy_bp = (yytext_ptr) + YY_MORE_ADJ; | ||
926 | goto yy_match; | ||
927 | |||
928 | case EOB_ACT_LAST_MATCH: | ||
929 | (yy_c_buf_p) = | ||
930 | &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; | ||
931 | |||
932 | yy_current_state = yy_get_previous_state( ); | ||
933 | |||
934 | yy_cp = (yy_c_buf_p); | ||
935 | yy_bp = (yytext_ptr) + YY_MORE_ADJ; | ||
936 | goto yy_find_action; | ||
937 | } | ||
938 | break; | ||
939 | } | ||
940 | |||
941 | default: | ||
942 | YY_FATAL_ERROR( | ||
943 | "fatal flex scanner internal error--no action found" ); | ||
944 | } /* end of action switch */ | ||
945 | } /* end of scanning one token */ | ||
946 | } /* end of perf_pmu_lex */ | ||
947 | |||
948 | /* yy_get_next_buffer - try to read in a new buffer | ||
949 | * | ||
950 | * Returns a code representing an action: | ||
951 | * EOB_ACT_LAST_MATCH - | ||
952 | * EOB_ACT_CONTINUE_SCAN - continue scanning from current position | ||
953 | * EOB_ACT_END_OF_FILE - end of file | ||
954 | */ | ||
955 | static int yy_get_next_buffer (void) | ||
956 | { | ||
957 | register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; | ||
958 | register char *source = (yytext_ptr); | ||
959 | register int number_to_move, i; | ||
960 | int ret_val; | ||
961 | |||
962 | if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) | ||
963 | YY_FATAL_ERROR( | ||
964 | "fatal flex scanner internal error--end of buffer missed" ); | ||
965 | |||
966 | if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) | ||
967 | { /* Don't try to fill the buffer, so this is an EOF. */ | ||
968 | if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) | ||
969 | { | ||
970 | /* We matched a single character, the EOB, so | ||
971 | * treat this as a final EOF. | ||
972 | */ | ||
973 | return EOB_ACT_END_OF_FILE; | ||
974 | } | ||
975 | |||
976 | else | ||
977 | { | ||
978 | /* We matched some text prior to the EOB, first | ||
979 | * process it. | ||
980 | */ | ||
981 | return EOB_ACT_LAST_MATCH; | ||
982 | } | ||
983 | } | ||
984 | |||
985 | /* Try to read more data. */ | ||
986 | |||
987 | /* First move last chars to start of buffer. */ | ||
988 | number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; | ||
989 | |||
990 | for ( i = 0; i < number_to_move; ++i ) | ||
991 | *(dest++) = *(source++); | ||
992 | |||
993 | if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) | ||
994 | /* don't do the read, it's not guaranteed to return an EOF, | ||
995 | * just force an EOF | ||
996 | */ | ||
997 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; | ||
998 | |||
999 | else | ||
1000 | { | ||
1001 | int num_to_read = | ||
1002 | YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; | ||
1003 | |||
1004 | while ( num_to_read <= 0 ) | ||
1005 | { /* Not enough room in the buffer - grow it. */ | ||
1006 | |||
1007 | /* just a shorter name for the current buffer */ | ||
1008 | YY_BUFFER_STATE b = YY_CURRENT_BUFFER; | ||
1009 | |||
1010 | int yy_c_buf_p_offset = | ||
1011 | (int) ((yy_c_buf_p) - b->yy_ch_buf); | ||
1012 | |||
1013 | if ( b->yy_is_our_buffer ) | ||
1014 | { | ||
1015 | int new_size = b->yy_buf_size * 2; | ||
1016 | |||
1017 | if ( new_size <= 0 ) | ||
1018 | b->yy_buf_size += b->yy_buf_size / 8; | ||
1019 | else | ||
1020 | b->yy_buf_size *= 2; | ||
1021 | |||
1022 | b->yy_ch_buf = (char *) | ||
1023 | /* Include room in for 2 EOB chars. */ | ||
1024 | perf_pmu_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); | ||
1025 | } | ||
1026 | else | ||
1027 | /* Can't grow it, we don't own it. */ | ||
1028 | b->yy_ch_buf = 0; | ||
1029 | |||
1030 | if ( ! b->yy_ch_buf ) | ||
1031 | YY_FATAL_ERROR( | ||
1032 | "fatal error - scanner input buffer overflow" ); | ||
1033 | |||
1034 | (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; | ||
1035 | |||
1036 | num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - | ||
1037 | number_to_move - 1; | ||
1038 | |||
1039 | } | ||
1040 | |||
1041 | if ( num_to_read > YY_READ_BUF_SIZE ) | ||
1042 | num_to_read = YY_READ_BUF_SIZE; | ||
1043 | |||
1044 | /* Read in more data. */ | ||
1045 | YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), | ||
1046 | (yy_n_chars), (size_t) num_to_read ); | ||
1047 | |||
1048 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); | ||
1049 | } | ||
1050 | |||
1051 | if ( (yy_n_chars) == 0 ) | ||
1052 | { | ||
1053 | if ( number_to_move == YY_MORE_ADJ ) | ||
1054 | { | ||
1055 | ret_val = EOB_ACT_END_OF_FILE; | ||
1056 | perf_pmu_restart(perf_pmu_in ); | ||
1057 | } | ||
1058 | |||
1059 | else | ||
1060 | { | ||
1061 | ret_val = EOB_ACT_LAST_MATCH; | ||
1062 | YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = | ||
1063 | YY_BUFFER_EOF_PENDING; | ||
1064 | } | ||
1065 | } | ||
1066 | |||
1067 | else | ||
1068 | ret_val = EOB_ACT_CONTINUE_SCAN; | ||
1069 | |||
1070 | if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { | ||
1071 | /* Extend the array by 50%, plus the number we really need. */ | ||
1072 | yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); | ||
1073 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) perf_pmu_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); | ||
1074 | if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) | ||
1075 | YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); | ||
1076 | } | ||
1077 | |||
1078 | (yy_n_chars) += number_to_move; | ||
1079 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; | ||
1080 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; | ||
1081 | |||
1082 | (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; | ||
1083 | |||
1084 | return ret_val; | ||
1085 | } | ||
1086 | |||
1087 | /* yy_get_previous_state - get the state just before the EOB char was reached */ | ||
1088 | |||
1089 | static yy_state_type yy_get_previous_state (void) | ||
1090 | { | ||
1091 | register yy_state_type yy_current_state; | ||
1092 | register char *yy_cp; | ||
1093 | |||
1094 | yy_current_state = (yy_start); | ||
1095 | |||
1096 | for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) | ||
1097 | { | ||
1098 | register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); | ||
1099 | if ( yy_accept[yy_current_state] ) | ||
1100 | { | ||
1101 | (yy_last_accepting_state) = yy_current_state; | ||
1102 | (yy_last_accepting_cpos) = yy_cp; | ||
1103 | } | ||
1104 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) | ||
1105 | { | ||
1106 | yy_current_state = (int) yy_def[yy_current_state]; | ||
1107 | if ( yy_current_state >= 20 ) | ||
1108 | yy_c = yy_meta[(unsigned int) yy_c]; | ||
1109 | } | ||
1110 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; | ||
1111 | } | ||
1112 | |||
1113 | return yy_current_state; | ||
1114 | } | ||
1115 | |||
1116 | /* yy_try_NUL_trans - try to make a transition on the NUL character | ||
1117 | * | ||
1118 | * synopsis | ||
1119 | * next_state = yy_try_NUL_trans( current_state ); | ||
1120 | */ | ||
1121 | static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) | ||
1122 | { | ||
1123 | register int yy_is_jam; | ||
1124 | register char *yy_cp = (yy_c_buf_p); | ||
1125 | |||
1126 | register YY_CHAR yy_c = 1; | ||
1127 | if ( yy_accept[yy_current_state] ) | ||
1128 | { | ||
1129 | (yy_last_accepting_state) = yy_current_state; | ||
1130 | (yy_last_accepting_cpos) = yy_cp; | ||
1131 | } | ||
1132 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) | ||
1133 | { | ||
1134 | yy_current_state = (int) yy_def[yy_current_state]; | ||
1135 | if ( yy_current_state >= 20 ) | ||
1136 | yy_c = yy_meta[(unsigned int) yy_c]; | ||
1137 | } | ||
1138 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; | ||
1139 | yy_is_jam = (yy_current_state == 19); | ||
1140 | |||
1141 | return yy_is_jam ? 0 : yy_current_state; | ||
1142 | } | ||
1143 | |||
1144 | static void yyunput (int c, register char * yy_bp ) | ||
1145 | { | ||
1146 | register char *yy_cp; | ||
1147 | |||
1148 | yy_cp = (yy_c_buf_p); | ||
1149 | |||
1150 | /* undo effects of setting up perf_pmu_text */ | ||
1151 | *yy_cp = (yy_hold_char); | ||
1152 | |||
1153 | if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) | ||
1154 | { /* need to shift things up to make room */ | ||
1155 | /* +2 for EOB chars. */ | ||
1156 | register int number_to_move = (yy_n_chars) + 2; | ||
1157 | register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ | ||
1158 | YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; | ||
1159 | register char *source = | ||
1160 | &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; | ||
1161 | |||
1162 | while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) | ||
1163 | *--dest = *--source; | ||
1164 | |||
1165 | yy_cp += (int) (dest - source); | ||
1166 | yy_bp += (int) (dest - source); | ||
1167 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = | ||
1168 | (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; | ||
1169 | |||
1170 | if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) | ||
1171 | YY_FATAL_ERROR( "flex scanner push-back overflow" ); | ||
1172 | } | ||
1173 | |||
1174 | *--yy_cp = (char) c; | ||
1175 | |||
1176 | (yytext_ptr) = yy_bp; | ||
1177 | (yy_hold_char) = *yy_cp; | ||
1178 | (yy_c_buf_p) = yy_cp; | ||
1179 | } | ||
1180 | |||
1181 | #ifndef YY_NO_INPUT | ||
1182 | #ifdef __cplusplus | ||
1183 | static int yyinput (void) | ||
1184 | #else | ||
1185 | static int input (void) | ||
1186 | #endif | ||
1187 | |||
1188 | { | ||
1189 | int c; | ||
1190 | |||
1191 | *(yy_c_buf_p) = (yy_hold_char); | ||
1192 | |||
1193 | if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) | ||
1194 | { | ||
1195 | /* yy_c_buf_p now points to the character we want to return. | ||
1196 | * If this occurs *before* the EOB characters, then it's a | ||
1197 | * valid NUL; if not, then we've hit the end of the buffer. | ||
1198 | */ | ||
1199 | if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) | ||
1200 | /* This was really a NUL. */ | ||
1201 | *(yy_c_buf_p) = '\0'; | ||
1202 | |||
1203 | else | ||
1204 | { /* need more input */ | ||
1205 | int offset = (yy_c_buf_p) - (yytext_ptr); | ||
1206 | ++(yy_c_buf_p); | ||
1207 | |||
1208 | switch ( yy_get_next_buffer( ) ) | ||
1209 | { | ||
1210 | case EOB_ACT_LAST_MATCH: | ||
1211 | /* This happens because yy_g_n_b() | ||
1212 | * sees that we've accumulated a | ||
1213 | * token and flags that we need to | ||
1214 | * try matching the token before | ||
1215 | * proceeding. But for input(), | ||
1216 | * there's no matching to consider. | ||
1217 | * So convert the EOB_ACT_LAST_MATCH | ||
1218 | * to EOB_ACT_END_OF_FILE. | ||
1219 | */ | ||
1220 | |||
1221 | /* Reset buffer status. */ | ||
1222 | perf_pmu_restart(perf_pmu_in ); | ||
1223 | |||
1224 | /*FALLTHROUGH*/ | ||
1225 | |||
1226 | case EOB_ACT_END_OF_FILE: | ||
1227 | { | ||
1228 | if ( perf_pmu_wrap( ) ) | ||
1229 | return EOF; | ||
1230 | |||
1231 | if ( ! (yy_did_buffer_switch_on_eof) ) | ||
1232 | YY_NEW_FILE; | ||
1233 | #ifdef __cplusplus | ||
1234 | return yyinput(); | ||
1235 | #else | ||
1236 | return input(); | ||
1237 | #endif | ||
1238 | } | ||
1239 | |||
1240 | case EOB_ACT_CONTINUE_SCAN: | ||
1241 | (yy_c_buf_p) = (yytext_ptr) + offset; | ||
1242 | break; | ||
1243 | } | ||
1244 | } | ||
1245 | } | ||
1246 | |||
1247 | c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ | ||
1248 | *(yy_c_buf_p) = '\0'; /* preserve perf_pmu_text */ | ||
1249 | (yy_hold_char) = *++(yy_c_buf_p); | ||
1250 | |||
1251 | return c; | ||
1252 | } | ||
1253 | #endif /* ifndef YY_NO_INPUT */ | ||
1254 | |||
1255 | /** Immediately switch to a different input stream. | ||
1256 | * @param input_file A readable stream. | ||
1257 | * | ||
1258 | * @note This function does not reset the start condition to @c INITIAL . | ||
1259 | */ | ||
1260 | void perf_pmu_restart (FILE * input_file ) | ||
1261 | { | ||
1262 | |||
1263 | if ( ! YY_CURRENT_BUFFER ){ | ||
1264 | perf_pmu_ensure_buffer_stack (); | ||
1265 | YY_CURRENT_BUFFER_LVALUE = | ||
1266 | perf_pmu__create_buffer(perf_pmu_in,YY_BUF_SIZE ); | ||
1267 | } | ||
1268 | |||
1269 | perf_pmu__init_buffer(YY_CURRENT_BUFFER,input_file ); | ||
1270 | perf_pmu__load_buffer_state( ); | ||
1271 | } | ||
1272 | |||
1273 | /** Switch to a different input buffer. | ||
1274 | * @param new_buffer The new input buffer. | ||
1275 | * | ||
1276 | */ | ||
1277 | void perf_pmu__switch_to_buffer (YY_BUFFER_STATE new_buffer ) | ||
1278 | { | ||
1279 | |||
1280 | /* TODO. We should be able to replace this entire function body | ||
1281 | * with | ||
1282 | * perf_pmu_pop_buffer_state(); | ||
1283 | * perf_pmu_push_buffer_state(new_buffer); | ||
1284 | */ | ||
1285 | perf_pmu_ensure_buffer_stack (); | ||
1286 | if ( YY_CURRENT_BUFFER == new_buffer ) | ||
1287 | return; | ||
1288 | |||
1289 | if ( YY_CURRENT_BUFFER ) | ||
1290 | { | ||
1291 | /* Flush out information for old buffer. */ | ||
1292 | *(yy_c_buf_p) = (yy_hold_char); | ||
1293 | YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); | ||
1294 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); | ||
1295 | } | ||
1296 | |||
1297 | YY_CURRENT_BUFFER_LVALUE = new_buffer; | ||
1298 | perf_pmu__load_buffer_state( ); | ||
1299 | |||
1300 | /* We don't actually know whether we did this switch during | ||
1301 | * EOF (perf_pmu_wrap()) processing, but the only time this flag | ||
1302 | * is looked at is after perf_pmu_wrap() is called, so it's safe | ||
1303 | * to go ahead and always set it. | ||
1304 | */ | ||
1305 | (yy_did_buffer_switch_on_eof) = 1; | ||
1306 | } | ||
1307 | |||
1308 | static void perf_pmu__load_buffer_state (void) | ||
1309 | { | ||
1310 | (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; | ||
1311 | (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; | ||
1312 | perf_pmu_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file; | ||
1313 | (yy_hold_char) = *(yy_c_buf_p); | ||
1314 | } | ||
1315 | |||
1316 | /** Allocate and initialize an input buffer state. | ||
1317 | * @param file A readable stream. | ||
1318 | * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. | ||
1319 | * | ||
1320 | * @return the allocated buffer state. | ||
1321 | */ | ||
1322 | YY_BUFFER_STATE perf_pmu__create_buffer (FILE * file, int size ) | ||
1323 | { | ||
1324 | YY_BUFFER_STATE b; | ||
1325 | |||
1326 | b = (YY_BUFFER_STATE) perf_pmu_alloc(sizeof( struct yy_buffer_state ) ); | ||
1327 | if ( ! b ) | ||
1328 | YY_FATAL_ERROR( "out of dynamic memory in perf_pmu__create_buffer()" ); | ||
1329 | |||
1330 | b->yy_buf_size = size; | ||
1331 | |||
1332 | /* yy_ch_buf has to be 2 characters longer than the size given because | ||
1333 | * we need to put in 2 end-of-buffer characters. | ||
1334 | */ | ||
1335 | b->yy_ch_buf = (char *) perf_pmu_alloc(b->yy_buf_size + 2 ); | ||
1336 | if ( ! b->yy_ch_buf ) | ||
1337 | YY_FATAL_ERROR( "out of dynamic memory in perf_pmu__create_buffer()" ); | ||
1338 | |||
1339 | b->yy_is_our_buffer = 1; | ||
1340 | |||
1341 | perf_pmu__init_buffer(b,file ); | ||
1342 | |||
1343 | return b; | ||
1344 | } | ||
1345 | |||
1346 | /** Destroy the buffer. | ||
1347 | * @param b a buffer created with perf_pmu__create_buffer() | ||
1348 | * | ||
1349 | */ | ||
1350 | void perf_pmu__delete_buffer (YY_BUFFER_STATE b ) | ||
1351 | { | ||
1352 | |||
1353 | if ( ! b ) | ||
1354 | return; | ||
1355 | |||
1356 | if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ | ||
1357 | YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; | ||
1358 | |||
1359 | if ( b->yy_is_our_buffer ) | ||
1360 | perf_pmu_free((void *) b->yy_ch_buf ); | ||
1361 | |||
1362 | perf_pmu_free((void *) b ); | ||
1363 | } | ||
1364 | |||
1365 | #ifndef __cplusplus | ||
1366 | extern int isatty (int ); | ||
1367 | #endif /* __cplusplus */ | ||
1368 | |||
1369 | /* Initializes or reinitializes a buffer. | ||
1370 | * This function is sometimes called more than once on the same buffer, | ||
1371 | * such as during a perf_pmu_restart() or at EOF. | ||
1372 | */ | ||
1373 | static void perf_pmu__init_buffer (YY_BUFFER_STATE b, FILE * file ) | ||
1374 | |||
1375 | { | ||
1376 | int oerrno = errno; | ||
1377 | |||
1378 | perf_pmu__flush_buffer(b ); | ||
1379 | |||
1380 | b->yy_input_file = file; | ||
1381 | b->yy_fill_buffer = 1; | ||
1382 | |||
1383 | /* If b is the current buffer, then perf_pmu__init_buffer was _probably_ | ||
1384 | * called from perf_pmu_restart() or through yy_get_next_buffer. | ||
1385 | * In that case, we don't want to reset the lineno or column. | ||
1386 | */ | ||
1387 | if (b != YY_CURRENT_BUFFER){ | ||
1388 | b->yy_bs_lineno = 1; | ||
1389 | b->yy_bs_column = 0; | ||
1390 | } | ||
1391 | |||
1392 | b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; | ||
1393 | |||
1394 | errno = oerrno; | ||
1395 | } | ||
1396 | |||
1397 | /** Discard all buffered characters. On the next scan, YY_INPUT will be called. | ||
1398 | * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. | ||
1399 | * | ||
1400 | */ | ||
1401 | void perf_pmu__flush_buffer (YY_BUFFER_STATE b ) | ||
1402 | { | ||
1403 | if ( ! b ) | ||
1404 | return; | ||
1405 | |||
1406 | b->yy_n_chars = 0; | ||
1407 | |||
1408 | /* We always need two end-of-buffer characters. The first causes | ||
1409 | * a transition to the end-of-buffer state. The second causes | ||
1410 | * a jam in that state. | ||
1411 | */ | ||
1412 | b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; | ||
1413 | b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; | ||
1414 | |||
1415 | b->yy_buf_pos = &b->yy_ch_buf[0]; | ||
1416 | |||
1417 | b->yy_at_bol = 1; | ||
1418 | b->yy_buffer_status = YY_BUFFER_NEW; | ||
1419 | |||
1420 | if ( b == YY_CURRENT_BUFFER ) | ||
1421 | perf_pmu__load_buffer_state( ); | ||
1422 | } | ||
1423 | |||
1424 | /** Pushes the new state onto the stack. The new state becomes | ||
1425 | * the current state. This function will allocate the stack | ||
1426 | * if necessary. | ||
1427 | * @param new_buffer The new state. | ||
1428 | * | ||
1429 | */ | ||
1430 | void perf_pmu_push_buffer_state (YY_BUFFER_STATE new_buffer ) | ||
1431 | { | ||
1432 | if (new_buffer == NULL) | ||
1433 | return; | ||
1434 | |||
1435 | perf_pmu_ensure_buffer_stack(); | ||
1436 | |||
1437 | /* This block is copied from perf_pmu__switch_to_buffer. */ | ||
1438 | if ( YY_CURRENT_BUFFER ) | ||
1439 | { | ||
1440 | /* Flush out information for old buffer. */ | ||
1441 | *(yy_c_buf_p) = (yy_hold_char); | ||
1442 | YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); | ||
1443 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); | ||
1444 | } | ||
1445 | |||
1446 | /* Only push if top exists. Otherwise, replace top. */ | ||
1447 | if (YY_CURRENT_BUFFER) | ||
1448 | (yy_buffer_stack_top)++; | ||
1449 | YY_CURRENT_BUFFER_LVALUE = new_buffer; | ||
1450 | |||
1451 | /* copied from perf_pmu__switch_to_buffer. */ | ||
1452 | perf_pmu__load_buffer_state( ); | ||
1453 | (yy_did_buffer_switch_on_eof) = 1; | ||
1454 | } | ||
1455 | |||
1456 | /** Removes and deletes the top of the stack, if present. | ||
1457 | * The next element becomes the new top. | ||
1458 | * | ||
1459 | */ | ||
1460 | void perf_pmu_pop_buffer_state (void) | ||
1461 | { | ||
1462 | if (!YY_CURRENT_BUFFER) | ||
1463 | return; | ||
1464 | |||
1465 | perf_pmu__delete_buffer(YY_CURRENT_BUFFER ); | ||
1466 | YY_CURRENT_BUFFER_LVALUE = NULL; | ||
1467 | if ((yy_buffer_stack_top) > 0) | ||
1468 | --(yy_buffer_stack_top); | ||
1469 | |||
1470 | if (YY_CURRENT_BUFFER) { | ||
1471 | perf_pmu__load_buffer_state( ); | ||
1472 | (yy_did_buffer_switch_on_eof) = 1; | ||
1473 | } | ||
1474 | } | ||
1475 | |||
1476 | /* Allocates the stack if it does not exist. | ||
1477 | * Guarantees space for at least one push. | ||
1478 | */ | ||
1479 | static void perf_pmu_ensure_buffer_stack (void) | ||
1480 | { | ||
1481 | int num_to_alloc; | ||
1482 | |||
1483 | if (!(yy_buffer_stack)) { | ||
1484 | |||
1485 | /* First allocation is just for 2 elements, since we don't know if this | ||
1486 | * scanner will even need a stack. We use 2 instead of 1 to avoid an | ||
1487 | * immediate realloc on the next call. | ||
1488 | */ | ||
1489 | num_to_alloc = 1; | ||
1490 | (yy_buffer_stack) = (struct yy_buffer_state**)perf_pmu_alloc | ||
1491 | (num_to_alloc * sizeof(struct yy_buffer_state*) | ||
1492 | ); | ||
1493 | if ( ! (yy_buffer_stack) ) | ||
1494 | YY_FATAL_ERROR( "out of dynamic memory in perf_pmu_ensure_buffer_stack()" ); | ||
1495 | |||
1496 | memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); | ||
1497 | |||
1498 | (yy_buffer_stack_max) = num_to_alloc; | ||
1499 | (yy_buffer_stack_top) = 0; | ||
1500 | return; | ||
1501 | } | ||
1502 | |||
1503 | if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ | ||
1504 | |||
1505 | /* Increase the buffer to prepare for a possible push. */ | ||
1506 | int grow_size = 8 /* arbitrary grow size */; | ||
1507 | |||
1508 | num_to_alloc = (yy_buffer_stack_max) + grow_size; | ||
1509 | (yy_buffer_stack) = (struct yy_buffer_state**)perf_pmu_realloc | ||
1510 | ((yy_buffer_stack), | ||
1511 | num_to_alloc * sizeof(struct yy_buffer_state*) | ||
1512 | ); | ||
1513 | if ( ! (yy_buffer_stack) ) | ||
1514 | YY_FATAL_ERROR( "out of dynamic memory in perf_pmu_ensure_buffer_stack()" ); | ||
1515 | |||
1516 | /* zero only the new slots.*/ | ||
1517 | memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); | ||
1518 | (yy_buffer_stack_max) = num_to_alloc; | ||
1519 | } | ||
1520 | } | ||
1521 | |||
1522 | /** Setup the input buffer state to scan directly from a user-specified character buffer. | ||
1523 | * @param base the character buffer | ||
1524 | * @param size the size in bytes of the character buffer | ||
1525 | * | ||
1526 | * @return the newly allocated buffer state object. | ||
1527 | */ | ||
1528 | YY_BUFFER_STATE perf_pmu__scan_buffer (char * base, yy_size_t size ) | ||
1529 | { | ||
1530 | YY_BUFFER_STATE b; | ||
1531 | |||
1532 | if ( size < 2 || | ||
1533 | base[size-2] != YY_END_OF_BUFFER_CHAR || | ||
1534 | base[size-1] != YY_END_OF_BUFFER_CHAR ) | ||
1535 | /* They forgot to leave room for the EOB's. */ | ||
1536 | return 0; | ||
1537 | |||
1538 | b = (YY_BUFFER_STATE) perf_pmu_alloc(sizeof( struct yy_buffer_state ) ); | ||
1539 | if ( ! b ) | ||
1540 | YY_FATAL_ERROR( "out of dynamic memory in perf_pmu__scan_buffer()" ); | ||
1541 | |||
1542 | b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ | ||
1543 | b->yy_buf_pos = b->yy_ch_buf = base; | ||
1544 | b->yy_is_our_buffer = 0; | ||
1545 | b->yy_input_file = 0; | ||
1546 | b->yy_n_chars = b->yy_buf_size; | ||
1547 | b->yy_is_interactive = 0; | ||
1548 | b->yy_at_bol = 1; | ||
1549 | b->yy_fill_buffer = 0; | ||
1550 | b->yy_buffer_status = YY_BUFFER_NEW; | ||
1551 | |||
1552 | perf_pmu__switch_to_buffer(b ); | ||
1553 | |||
1554 | return b; | ||
1555 | } | ||
1556 | |||
1557 | /** Setup the input buffer state to scan a string. The next call to perf_pmu_lex() will | ||
1558 | * scan from a @e copy of @a str. | ||
1559 | * @param yystr a NUL-terminated string to scan | ||
1560 | * | ||
1561 | * @return the newly allocated buffer state object. | ||
1562 | * @note If you want to scan bytes that may contain NUL values, then use | ||
1563 | * perf_pmu__scan_bytes() instead. | ||
1564 | */ | ||
1565 | YY_BUFFER_STATE perf_pmu__scan_string (yyconst char * yystr ) | ||
1566 | { | ||
1567 | |||
1568 | return perf_pmu__scan_bytes(yystr,strlen(yystr) ); | ||
1569 | } | ||
1570 | |||
1571 | /** Setup the input buffer state to scan the given bytes. The next call to perf_pmu_lex() will | ||
1572 | * scan from a @e copy of @a bytes. | ||
1573 | * @param bytes the byte buffer to scan | ||
1574 | * @param len the number of bytes in the buffer pointed to by @a bytes. | ||
1575 | * | ||
1576 | * @return the newly allocated buffer state object. | ||
1577 | */ | ||
1578 | YY_BUFFER_STATE perf_pmu__scan_bytes (yyconst char * yybytes, int _yybytes_len ) | ||
1579 | { | ||
1580 | YY_BUFFER_STATE b; | ||
1581 | char *buf; | ||
1582 | yy_size_t n; | ||
1583 | int i; | ||
1584 | |||
1585 | /* Get memory for full buffer, including space for trailing EOB's. */ | ||
1586 | n = _yybytes_len + 2; | ||
1587 | buf = (char *) perf_pmu_alloc(n ); | ||
1588 | if ( ! buf ) | ||
1589 | YY_FATAL_ERROR( "out of dynamic memory in perf_pmu__scan_bytes()" ); | ||
1590 | |||
1591 | for ( i = 0; i < _yybytes_len; ++i ) | ||
1592 | buf[i] = yybytes[i]; | ||
1593 | |||
1594 | buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; | ||
1595 | |||
1596 | b = perf_pmu__scan_buffer(buf,n ); | ||
1597 | if ( ! b ) | ||
1598 | YY_FATAL_ERROR( "bad buffer in perf_pmu__scan_bytes()" ); | ||
1599 | |||
1600 | /* It's okay to grow etc. this buffer, and we should throw it | ||
1601 | * away when we're done. | ||
1602 | */ | ||
1603 | b->yy_is_our_buffer = 1; | ||
1604 | |||
1605 | return b; | ||
1606 | } | ||
1607 | |||
1608 | #ifndef YY_EXIT_FAILURE | ||
1609 | #define YY_EXIT_FAILURE 2 | ||
1610 | #endif | ||
1611 | |||
1612 | static void yy_fatal_error (yyconst char* msg ) | ||
1613 | { | ||
1614 | (void) fprintf( stderr, "%s\n", msg ); | ||
1615 | exit( YY_EXIT_FAILURE ); | ||
1616 | } | ||
1617 | |||
1618 | /* Redefine yyless() so it works in section 3 code. */ | ||
1619 | |||
1620 | #undef yyless | ||
1621 | #define yyless(n) \ | ||
1622 | do \ | ||
1623 | { \ | ||
1624 | /* Undo effects of setting up perf_pmu_text. */ \ | ||
1625 | int yyless_macro_arg = (n); \ | ||
1626 | YY_LESS_LINENO(yyless_macro_arg);\ | ||
1627 | perf_pmu_text[perf_pmu_leng] = (yy_hold_char); \ | ||
1628 | (yy_c_buf_p) = perf_pmu_text + yyless_macro_arg; \ | ||
1629 | (yy_hold_char) = *(yy_c_buf_p); \ | ||
1630 | *(yy_c_buf_p) = '\0'; \ | ||
1631 | perf_pmu_leng = yyless_macro_arg; \ | ||
1632 | } \ | ||
1633 | while ( 0 ) | ||
1634 | |||
1635 | /* Accessor methods (get/set functions) to struct members. */ | ||
1636 | |||
1637 | /** Get the current line number. | ||
1638 | * | ||
1639 | */ | ||
1640 | int perf_pmu_get_lineno (void) | ||
1641 | { | ||
1642 | |||
1643 | return perf_pmu_lineno; | ||
1644 | } | ||
1645 | |||
1646 | /** Get the input stream. | ||
1647 | * | ||
1648 | */ | ||
1649 | FILE *perf_pmu_get_in (void) | ||
1650 | { | ||
1651 | return perf_pmu_in; | ||
1652 | } | ||
1653 | |||
1654 | /** Get the output stream. | ||
1655 | * | ||
1656 | */ | ||
1657 | FILE *perf_pmu_get_out (void) | ||
1658 | { | ||
1659 | return perf_pmu_out; | ||
1660 | } | ||
1661 | |||
1662 | /** Get the length of the current token. | ||
1663 | * | ||
1664 | */ | ||
1665 | int perf_pmu_get_leng (void) | ||
1666 | { | ||
1667 | return perf_pmu_leng; | ||
1668 | } | ||
1669 | |||
1670 | /** Get the current token. | ||
1671 | * | ||
1672 | */ | ||
1673 | |||
1674 | char *perf_pmu_get_text (void) | ||
1675 | { | ||
1676 | return perf_pmu_text; | ||
1677 | } | ||
1678 | |||
1679 | /** Set the current line number. | ||
1680 | * @param line_number | ||
1681 | * | ||
1682 | */ | ||
1683 | void perf_pmu_set_lineno (int line_number ) | ||
1684 | { | ||
1685 | |||
1686 | perf_pmu_lineno = line_number; | ||
1687 | } | ||
1688 | |||
1689 | /** Set the input stream. This does not discard the current | ||
1690 | * input buffer. | ||
1691 | * @param in_str A readable stream. | ||
1692 | * | ||
1693 | * @see perf_pmu__switch_to_buffer | ||
1694 | */ | ||
1695 | void perf_pmu_set_in (FILE * in_str ) | ||
1696 | { | ||
1697 | perf_pmu_in = in_str ; | ||
1698 | } | ||
1699 | |||
1700 | void perf_pmu_set_out (FILE * out_str ) | ||
1701 | { | ||
1702 | perf_pmu_out = out_str ; | ||
1703 | } | ||
1704 | |||
1705 | int perf_pmu_get_debug (void) | ||
1706 | { | ||
1707 | return perf_pmu__flex_debug; | ||
1708 | } | ||
1709 | |||
1710 | void perf_pmu_set_debug (int bdebug ) | ||
1711 | { | ||
1712 | perf_pmu__flex_debug = bdebug ; | ||
1713 | } | ||
1714 | |||
1715 | static int yy_init_globals (void) | ||
1716 | { | ||
1717 | /* Initialization is the same as for the non-reentrant scanner. | ||
1718 | * This function is called from perf_pmu_lex_destroy(), so don't allocate here. | ||
1719 | */ | ||
1720 | |||
1721 | (yy_buffer_stack) = 0; | ||
1722 | (yy_buffer_stack_top) = 0; | ||
1723 | (yy_buffer_stack_max) = 0; | ||
1724 | (yy_c_buf_p) = (char *) 0; | ||
1725 | (yy_init) = 0; | ||
1726 | (yy_start) = 0; | ||
1727 | |||
1728 | /* Defined in main.c */ | ||
1729 | #ifdef YY_STDINIT | ||
1730 | perf_pmu_in = stdin; | ||
1731 | perf_pmu_out = stdout; | ||
1732 | #else | ||
1733 | perf_pmu_in = (FILE *) 0; | ||
1734 | perf_pmu_out = (FILE *) 0; | ||
1735 | #endif | ||
1736 | |||
1737 | /* For future reference: Set errno on error, since we are called by | ||
1738 | * perf_pmu_lex_init() | ||
1739 | */ | ||
1740 | return 0; | ||
1741 | } | ||
1742 | |||
1743 | /* perf_pmu_lex_destroy is for both reentrant and non-reentrant scanners. */ | ||
1744 | int perf_pmu_lex_destroy (void) | ||
1745 | { | ||
1746 | |||
1747 | /* Pop the buffer stack, destroying each element. */ | ||
1748 | while(YY_CURRENT_BUFFER){ | ||
1749 | perf_pmu__delete_buffer(YY_CURRENT_BUFFER ); | ||
1750 | YY_CURRENT_BUFFER_LVALUE = NULL; | ||
1751 | perf_pmu_pop_buffer_state(); | ||
1752 | } | ||
1753 | |||
1754 | /* Destroy the stack itself. */ | ||
1755 | perf_pmu_free((yy_buffer_stack) ); | ||
1756 | (yy_buffer_stack) = NULL; | ||
1757 | |||
1758 | /* Reset the globals. This is important in a non-reentrant scanner so the next time | ||
1759 | * perf_pmu_lex() is called, initialization will occur. */ | ||
1760 | yy_init_globals( ); | ||
1761 | |||
1762 | return 0; | ||
1763 | } | ||
1764 | |||
1765 | /* | ||
1766 | * Internal utility routines. | ||
1767 | */ | ||
1768 | |||
1769 | #ifndef yytext_ptr | ||
1770 | static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) | ||
1771 | { | ||
1772 | register int i; | ||
1773 | for ( i = 0; i < n; ++i ) | ||
1774 | s1[i] = s2[i]; | ||
1775 | } | ||
1776 | #endif | ||
1777 | |||
1778 | #ifdef YY_NEED_STRLEN | ||
1779 | static int yy_flex_strlen (yyconst char * s ) | ||
1780 | { | ||
1781 | register int n; | ||
1782 | for ( n = 0; s[n]; ++n ) | ||
1783 | ; | ||
1784 | |||
1785 | return n; | ||
1786 | } | ||
1787 | #endif | ||
1788 | |||
1789 | void *perf_pmu_alloc (yy_size_t size ) | ||
1790 | { | ||
1791 | return (void *) malloc( size ); | ||
1792 | } | ||
1793 | |||
1794 | void *perf_pmu_realloc (void * ptr, yy_size_t size ) | ||
1795 | { | ||
1796 | /* The cast to (char *) in the following accommodates both | ||
1797 | * implementations that use char* generic pointers, and those | ||
1798 | * that use void* generic pointers. It works with the latter | ||
1799 | * because both ANSI C and C++ allow castless assignment from | ||
1800 | * any pointer type to void*, and deal with argument conversions | ||
1801 | * as though doing an assignment. | ||
1802 | */ | ||
1803 | return (void *) realloc( (char *) ptr, size ); | ||
1804 | } | ||
1805 | |||
1806 | void perf_pmu_free (void * ptr ) | ||
1807 | { | ||
1808 | free( (char *) ptr ); /* see perf_pmu_realloc() for (char *) cast */ | ||
1809 | } | ||
1810 | |||
1811 | #define YYTABLES_NAME "yytables" | ||
1812 | |||
1813 | #line 38 "util/pmu.l" | ||
1814 | |||
1815 | |||
1816 | |||
1817 | int perf_pmu_wrap(void) | ||
1818 | { | ||
1819 | return 1; | ||
1820 | } | ||
1821 | |||
diff --git a/tools/perf/util/pmu-flex.h b/tools/perf/util/pmu-flex.h deleted file mode 100644 index 0a29c8a0da4e..000000000000 --- a/tools/perf/util/pmu-flex.h +++ /dev/null | |||
@@ -1,316 +0,0 @@ | |||
1 | #ifndef perf_pmu_HEADER_H | ||
2 | #define perf_pmu_HEADER_H 1 | ||
3 | #define perf_pmu_IN_HEADER 1 | ||
4 | |||
5 | #line 6 "util/pmu-flex.h" | ||
6 | |||
7 | #define YY_INT_ALIGNED short int | ||
8 | |||
9 | /* A lexical scanner generated by flex */ | ||
10 | |||
11 | #define FLEX_SCANNER | ||
12 | #define YY_FLEX_MAJOR_VERSION 2 | ||
13 | #define YY_FLEX_MINOR_VERSION 5 | ||
14 | #define YY_FLEX_SUBMINOR_VERSION 35 | ||
15 | #if YY_FLEX_SUBMINOR_VERSION > 0 | ||
16 | #define FLEX_BETA | ||
17 | #endif | ||
18 | |||
19 | /* First, we deal with platform-specific or compiler-specific issues. */ | ||
20 | |||
21 | /* begin standard C headers. */ | ||
22 | #include <stdio.h> | ||
23 | #include <string.h> | ||
24 | #include <errno.h> | ||
25 | #include <stdlib.h> | ||
26 | |||
27 | /* end standard C headers. */ | ||
28 | |||
29 | /* flex integer type definitions */ | ||
30 | |||
31 | #ifndef FLEXINT_H | ||
32 | #define FLEXINT_H | ||
33 | |||
34 | /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ | ||
35 | |||
36 | #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L | ||
37 | |||
38 | /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, | ||
39 | * if you want the limit (max/min) macros for int types. | ||
40 | */ | ||
41 | #ifndef __STDC_LIMIT_MACROS | ||
42 | #define __STDC_LIMIT_MACROS 1 | ||
43 | #endif | ||
44 | |||
45 | #include <inttypes.h> | ||
46 | typedef int8_t flex_int8_t; | ||
47 | typedef uint8_t flex_uint8_t; | ||
48 | typedef int16_t flex_int16_t; | ||
49 | typedef uint16_t flex_uint16_t; | ||
50 | typedef int32_t flex_int32_t; | ||
51 | typedef uint32_t flex_uint32_t; | ||
52 | #else | ||
53 | typedef signed char flex_int8_t; | ||
54 | typedef short int flex_int16_t; | ||
55 | typedef int flex_int32_t; | ||
56 | typedef unsigned char flex_uint8_t; | ||
57 | typedef unsigned short int flex_uint16_t; | ||
58 | typedef unsigned int flex_uint32_t; | ||
59 | #endif /* ! C99 */ | ||
60 | |||
61 | /* Limits of integral types. */ | ||
62 | #ifndef INT8_MIN | ||
63 | #define INT8_MIN (-128) | ||
64 | #endif | ||
65 | #ifndef INT16_MIN | ||
66 | #define INT16_MIN (-32767-1) | ||
67 | #endif | ||
68 | #ifndef INT32_MIN | ||
69 | #define INT32_MIN (-2147483647-1) | ||
70 | #endif | ||
71 | #ifndef INT8_MAX | ||
72 | #define INT8_MAX (127) | ||
73 | #endif | ||
74 | #ifndef INT16_MAX | ||
75 | #define INT16_MAX (32767) | ||
76 | #endif | ||
77 | #ifndef INT32_MAX | ||
78 | #define INT32_MAX (2147483647) | ||
79 | #endif | ||
80 | #ifndef UINT8_MAX | ||
81 | #define UINT8_MAX (255U) | ||
82 | #endif | ||
83 | #ifndef UINT16_MAX | ||
84 | #define UINT16_MAX (65535U) | ||
85 | #endif | ||
86 | #ifndef UINT32_MAX | ||
87 | #define UINT32_MAX (4294967295U) | ||
88 | #endif | ||
89 | |||
90 | #endif /* ! FLEXINT_H */ | ||
91 | |||
92 | #ifdef __cplusplus | ||
93 | |||
94 | /* The "const" storage-class-modifier is valid. */ | ||
95 | #define YY_USE_CONST | ||
96 | |||
97 | #else /* ! __cplusplus */ | ||
98 | |||
99 | /* C99 requires __STDC__ to be defined as 1. */ | ||
100 | #if defined (__STDC__) | ||
101 | |||
102 | #define YY_USE_CONST | ||
103 | |||
104 | #endif /* defined (__STDC__) */ | ||
105 | #endif /* ! __cplusplus */ | ||
106 | |||
107 | #ifdef YY_USE_CONST | ||
108 | #define yyconst const | ||
109 | #else | ||
110 | #define yyconst | ||
111 | #endif | ||
112 | |||
113 | /* Size of default input buffer. */ | ||
114 | #ifndef YY_BUF_SIZE | ||
115 | #define YY_BUF_SIZE 16384 | ||
116 | #endif | ||
117 | |||
118 | #ifndef YY_TYPEDEF_YY_BUFFER_STATE | ||
119 | #define YY_TYPEDEF_YY_BUFFER_STATE | ||
120 | typedef struct yy_buffer_state *YY_BUFFER_STATE; | ||
121 | #endif | ||
122 | |||
123 | extern int perf_pmu_leng; | ||
124 | |||
125 | extern FILE *perf_pmu_in, *perf_pmu_out; | ||
126 | |||
127 | #ifndef YY_TYPEDEF_YY_SIZE_T | ||
128 | #define YY_TYPEDEF_YY_SIZE_T | ||
129 | typedef size_t yy_size_t; | ||
130 | #endif | ||
131 | |||
132 | #ifndef YY_STRUCT_YY_BUFFER_STATE | ||
133 | #define YY_STRUCT_YY_BUFFER_STATE | ||
134 | struct yy_buffer_state | ||
135 | { | ||
136 | FILE *yy_input_file; | ||
137 | |||
138 | char *yy_ch_buf; /* input buffer */ | ||
139 | char *yy_buf_pos; /* current position in input buffer */ | ||
140 | |||
141 | /* Size of input buffer in bytes, not including room for EOB | ||
142 | * characters. | ||
143 | */ | ||
144 | yy_size_t yy_buf_size; | ||
145 | |||
146 | /* Number of characters read into yy_ch_buf, not including EOB | ||
147 | * characters. | ||
148 | */ | ||
149 | int yy_n_chars; | ||
150 | |||
151 | /* Whether we "own" the buffer - i.e., we know we created it, | ||
152 | * and can realloc() it to grow it, and should free() it to | ||
153 | * delete it. | ||
154 | */ | ||
155 | int yy_is_our_buffer; | ||
156 | |||
157 | /* Whether this is an "interactive" input source; if so, and | ||
158 | * if we're using stdio for input, then we want to use getc() | ||
159 | * instead of fread(), to make sure we stop fetching input after | ||
160 | * each newline. | ||
161 | */ | ||
162 | int yy_is_interactive; | ||
163 | |||
164 | /* Whether we're considered to be at the beginning of a line. | ||
165 | * If so, '^' rules will be active on the next match, otherwise | ||
166 | * not. | ||
167 | */ | ||
168 | int yy_at_bol; | ||
169 | |||
170 | int yy_bs_lineno; /**< The line count. */ | ||
171 | int yy_bs_column; /**< The column count. */ | ||
172 | |||
173 | /* Whether to try to fill the input buffer when we reach the | ||
174 | * end of it. | ||
175 | */ | ||
176 | int yy_fill_buffer; | ||
177 | |||
178 | int yy_buffer_status; | ||
179 | |||
180 | }; | ||
181 | #endif /* !YY_STRUCT_YY_BUFFER_STATE */ | ||
182 | |||
183 | void perf_pmu_restart (FILE *input_file ); | ||
184 | void perf_pmu__switch_to_buffer (YY_BUFFER_STATE new_buffer ); | ||
185 | YY_BUFFER_STATE perf_pmu__create_buffer (FILE *file,int size ); | ||
186 | void perf_pmu__delete_buffer (YY_BUFFER_STATE b ); | ||
187 | void perf_pmu__flush_buffer (YY_BUFFER_STATE b ); | ||
188 | void perf_pmu_push_buffer_state (YY_BUFFER_STATE new_buffer ); | ||
189 | void perf_pmu_pop_buffer_state (void ); | ||
190 | |||
191 | YY_BUFFER_STATE perf_pmu__scan_buffer (char *base,yy_size_t size ); | ||
192 | YY_BUFFER_STATE perf_pmu__scan_string (yyconst char *yy_str ); | ||
193 | YY_BUFFER_STATE perf_pmu__scan_bytes (yyconst char *bytes,int len ); | ||
194 | |||
195 | void *perf_pmu_alloc (yy_size_t ); | ||
196 | void *perf_pmu_realloc (void *,yy_size_t ); | ||
197 | void perf_pmu_free (void * ); | ||
198 | |||
199 | /* Begin user sect3 */ | ||
200 | |||
201 | extern int perf_pmu_lineno; | ||
202 | |||
203 | extern char *perf_pmu_text; | ||
204 | #define yytext_ptr perf_pmu_text | ||
205 | |||
206 | #ifdef YY_HEADER_EXPORT_START_CONDITIONS | ||
207 | #define INITIAL 0 | ||
208 | |||
209 | #endif | ||
210 | |||
211 | #ifndef YY_NO_UNISTD_H | ||
212 | /* Special case for "unistd.h", since it is non-ANSI. We include it way | ||
213 | * down here because we want the user's section 1 to have been scanned first. | ||
214 | * The user has a chance to override it with an option. | ||
215 | */ | ||
216 | #include <unistd.h> | ||
217 | #endif | ||
218 | |||
219 | #ifndef YY_EXTRA_TYPE | ||
220 | #define YY_EXTRA_TYPE void * | ||
221 | #endif | ||
222 | |||
223 | /* Accessor methods to globals. | ||
224 | These are made visible to non-reentrant scanners for convenience. */ | ||
225 | |||
226 | int perf_pmu_lex_destroy (void ); | ||
227 | |||
228 | int perf_pmu_get_debug (void ); | ||
229 | |||
230 | void perf_pmu_set_debug (int debug_flag ); | ||
231 | |||
232 | YY_EXTRA_TYPE perf_pmu_get_extra (void ); | ||
233 | |||
234 | void perf_pmu_set_extra (YY_EXTRA_TYPE user_defined ); | ||
235 | |||
236 | FILE *perf_pmu_get_in (void ); | ||
237 | |||
238 | void perf_pmu_set_in (FILE * in_str ); | ||
239 | |||
240 | FILE *perf_pmu_get_out (void ); | ||
241 | |||
242 | void perf_pmu_set_out (FILE * out_str ); | ||
243 | |||
244 | int perf_pmu_get_leng (void ); | ||
245 | |||
246 | char *perf_pmu_get_text (void ); | ||
247 | |||
248 | int perf_pmu_get_lineno (void ); | ||
249 | |||
250 | void perf_pmu_set_lineno (int line_number ); | ||
251 | |||
252 | /* Macros after this point can all be overridden by user definitions in | ||
253 | * section 1. | ||
254 | */ | ||
255 | |||
256 | #ifndef YY_SKIP_YYWRAP | ||
257 | #ifdef __cplusplus | ||
258 | extern "C" int perf_pmu_wrap (void ); | ||
259 | #else | ||
260 | extern int perf_pmu_wrap (void ); | ||
261 | #endif | ||
262 | #endif | ||
263 | |||
264 | #ifndef yytext_ptr | ||
265 | static void yy_flex_strncpy (char *,yyconst char *,int ); | ||
266 | #endif | ||
267 | |||
268 | #ifdef YY_NEED_STRLEN | ||
269 | static int yy_flex_strlen (yyconst char * ); | ||
270 | #endif | ||
271 | |||
272 | #ifndef YY_NO_INPUT | ||
273 | |||
274 | #endif | ||
275 | |||
276 | /* Amount of stuff to slurp up with each read. */ | ||
277 | #ifndef YY_READ_BUF_SIZE | ||
278 | #define YY_READ_BUF_SIZE 8192 | ||
279 | #endif | ||
280 | |||
281 | /* Number of entries by which start-condition stack grows. */ | ||
282 | #ifndef YY_START_STACK_INCR | ||
283 | #define YY_START_STACK_INCR 25 | ||
284 | #endif | ||
285 | |||
286 | /* Default declaration of generated scanner - a define so the user can | ||
287 | * easily add parameters. | ||
288 | */ | ||
289 | #ifndef YY_DECL | ||
290 | #define YY_DECL_IS_OURS 1 | ||
291 | |||
292 | extern int perf_pmu_lex (void); | ||
293 | |||
294 | #define YY_DECL int perf_pmu_lex (void) | ||
295 | #endif /* !YY_DECL */ | ||
296 | |||
297 | /* yy_get_previous_state - get the state just before the EOB char was reached */ | ||
298 | |||
299 | #undef YY_NEW_FILE | ||
300 | #undef YY_FLUSH_BUFFER | ||
301 | #undef yy_set_bol | ||
302 | #undef yy_new_buffer | ||
303 | #undef yy_set_interactive | ||
304 | #undef YY_DO_BEFORE_ACTION | ||
305 | |||
306 | #ifdef YY_DECL_IS_OURS | ||
307 | #undef YY_DECL_IS_OURS | ||
308 | #undef YY_DECL | ||
309 | #endif | ||
310 | |||
311 | #line 38 "util/pmu.l" | ||
312 | |||
313 | |||
314 | #line 315 "util/pmu-flex.h" | ||
315 | #undef perf_pmu_IN_HEADER | ||
316 | #endif /* perf_pmu_HEADER_H */ | ||
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c index 2cc162d3b78c..d448984ed789 100644 --- a/tools/perf/util/probe-finder.c +++ b/tools/perf/util/probe-finder.c | |||
@@ -972,10 +972,12 @@ static int probe_point_search_cb(Dwarf_Die *sp_die, void *data) | |||
972 | struct dwarf_callback_param *param = data; | 972 | struct dwarf_callback_param *param = data; |
973 | struct probe_finder *pf = param->data; | 973 | struct probe_finder *pf = param->data; |
974 | struct perf_probe_point *pp = &pf->pev->point; | 974 | struct perf_probe_point *pp = &pf->pev->point; |
975 | Dwarf_Attribute attr; | ||
975 | 976 | ||
976 | /* Check tag and diename */ | 977 | /* Check tag and diename */ |
977 | if (dwarf_tag(sp_die) != DW_TAG_subprogram || | 978 | if (dwarf_tag(sp_die) != DW_TAG_subprogram || |
978 | !die_compare_name(sp_die, pp->function)) | 979 | !die_compare_name(sp_die, pp->function) || |
980 | dwarf_attr(sp_die, DW_AT_declaration, &attr)) | ||
979 | return DWARF_CB_OK; | 981 | return DWARF_CB_OK; |
980 | 982 | ||
981 | /* Check declared file */ | 983 | /* Check declared file */ |
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index 002ebbf59f48..9412e3b05f68 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c | |||
@@ -140,6 +140,7 @@ struct perf_session *perf_session__new(const char *filename, int mode, | |||
140 | INIT_LIST_HEAD(&self->ordered_samples.sample_cache); | 140 | INIT_LIST_HEAD(&self->ordered_samples.sample_cache); |
141 | INIT_LIST_HEAD(&self->ordered_samples.to_free); | 141 | INIT_LIST_HEAD(&self->ordered_samples.to_free); |
142 | machine__init(&self->host_machine, "", HOST_KERNEL_ID); | 142 | machine__init(&self->host_machine, "", HOST_KERNEL_ID); |
143 | hists__init(&self->hists); | ||
143 | 144 | ||
144 | if (mode == O_RDONLY) { | 145 | if (mode == O_RDONLY) { |
145 | if (perf_session__open(self, force) < 0) | 146 | if (perf_session__open(self, force) < 0) |
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c index 88dbcf6f9575..a27237430c5f 100644 --- a/tools/perf/util/sort.c +++ b/tools/perf/util/sort.c | |||
@@ -34,6 +34,9 @@ static int repsep_snprintf(char *bf, size_t size, const char *fmt, ...) | |||
34 | } | 34 | } |
35 | } | 35 | } |
36 | va_end(ap); | 36 | va_end(ap); |
37 | |||
38 | if (n >= (int)size) | ||
39 | return size - 1; | ||
37 | return n; | 40 | return n; |
38 | } | 41 | } |
39 | 42 | ||
diff --git a/tools/perf/util/strbuf.c b/tools/perf/util/strbuf.c index 92e068517c1a..2eeb51baf077 100644 --- a/tools/perf/util/strbuf.c +++ b/tools/perf/util/strbuf.c | |||
@@ -1,4 +1,5 @@ | |||
1 | #include "cache.h" | 1 | #include "cache.h" |
2 | #include <linux/kernel.h> | ||
2 | 3 | ||
3 | int prefixcmp(const char *str, const char *prefix) | 4 | int prefixcmp(const char *str, const char *prefix) |
4 | { | 5 | { |
@@ -89,14 +90,14 @@ void strbuf_addf(struct strbuf *sb, const char *fmt, ...) | |||
89 | if (!strbuf_avail(sb)) | 90 | if (!strbuf_avail(sb)) |
90 | strbuf_grow(sb, 64); | 91 | strbuf_grow(sb, 64); |
91 | va_start(ap, fmt); | 92 | va_start(ap, fmt); |
92 | len = vsnprintf(sb->buf + sb->len, sb->alloc - sb->len, fmt, ap); | 93 | len = vscnprintf(sb->buf + sb->len, sb->alloc - sb->len, fmt, ap); |
93 | va_end(ap); | 94 | va_end(ap); |
94 | if (len < 0) | 95 | if (len < 0) |
95 | die("your vsnprintf is broken"); | 96 | die("your vscnprintf is broken"); |
96 | if (len > strbuf_avail(sb)) { | 97 | if (len > strbuf_avail(sb)) { |
97 | strbuf_grow(sb, len); | 98 | strbuf_grow(sb, len); |
98 | va_start(ap, fmt); | 99 | va_start(ap, fmt); |
99 | len = vsnprintf(sb->buf + sb->len, sb->alloc - sb->len, fmt, ap); | 100 | len = vscnprintf(sb->buf + sb->len, sb->alloc - sb->len, fmt, ap); |
100 | va_end(ap); | 101 | va_end(ap); |
101 | if (len > strbuf_avail(sb)) { | 102 | if (len > strbuf_avail(sb)) { |
102 | die("this should not happen, your snprintf is broken"); | 103 | die("this should not happen, your snprintf is broken"); |
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index 5dd83c3e2c0c..c0a028c3ebaf 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c | |||
@@ -1,6 +1,5 @@ | |||
1 | #include <dirent.h> | 1 | #include <dirent.h> |
2 | #include <errno.h> | 2 | #include <errno.h> |
3 | #include <libgen.h> | ||
4 | #include <stdlib.h> | 3 | #include <stdlib.h> |
5 | #include <stdio.h> | 4 | #include <stdio.h> |
6 | #include <string.h> | 5 | #include <string.h> |
@@ -51,6 +50,8 @@ struct symbol_conf symbol_conf = { | |||
51 | 50 | ||
52 | int dso__name_len(const struct dso *dso) | 51 | int dso__name_len(const struct dso *dso) |
53 | { | 52 | { |
53 | if (!dso) | ||
54 | return strlen("[unknown]"); | ||
54 | if (verbose) | 55 | if (verbose) |
55 | return dso->long_name_len; | 56 | return dso->long_name_len; |
56 | 57 | ||
diff --git a/tools/perf/util/thread_map.h b/tools/perf/util/thread_map.h index 7da80f14418b..f718df8a3c59 100644 --- a/tools/perf/util/thread_map.h +++ b/tools/perf/util/thread_map.h | |||
@@ -6,7 +6,7 @@ | |||
6 | 6 | ||
7 | struct thread_map { | 7 | struct thread_map { |
8 | int nr; | 8 | int nr; |
9 | int map[]; | 9 | pid_t map[]; |
10 | }; | 10 | }; |
11 | 11 | ||
12 | struct thread_map *thread_map__new_by_pid(pid_t pid); | 12 | struct thread_map *thread_map__new_by_pid(pid_t pid); |
diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c index a4088ced1e64..dfd1bd8371a4 100644 --- a/tools/perf/util/trace-event-parse.c +++ b/tools/perf/util/trace-event-parse.c | |||
@@ -722,7 +722,7 @@ static char *event_read_name(void) | |||
722 | static int event_read_id(void) | 722 | static int event_read_id(void) |
723 | { | 723 | { |
724 | char *token; | 724 | char *token; |
725 | int id; | 725 | int id = -1; |
726 | 726 | ||
727 | if (read_expected_item(EVENT_ITEM, "ID") < 0) | 727 | if (read_expected_item(EVENT_ITEM, "ID") < 0) |
728 | return -1; | 728 | return -1; |
@@ -731,15 +731,13 @@ static int event_read_id(void) | |||
731 | return -1; | 731 | return -1; |
732 | 732 | ||
733 | if (read_expect_type(EVENT_ITEM, &token) < 0) | 733 | if (read_expect_type(EVENT_ITEM, &token) < 0) |
734 | goto fail; | 734 | goto free; |
735 | 735 | ||
736 | id = strtoul(token, NULL, 0); | 736 | id = strtoul(token, NULL, 0); |
737 | free_token(token); | ||
738 | return id; | ||
739 | 737 | ||
740 | fail: | 738 | free: |
741 | free_token(token); | 739 | free_token(token); |
742 | return -1; | 740 | return id; |
743 | } | 741 | } |
744 | 742 | ||
745 | static int field_is_string(struct format_field *field) | 743 | static int field_is_string(struct format_field *field) |
diff --git a/tools/scripts/Makefile.include b/tools/scripts/Makefile.include new file mode 100644 index 000000000000..87b55a729a5f --- /dev/null +++ b/tools/scripts/Makefile.include | |||
@@ -0,0 +1,57 @@ | |||
1 | ifeq ("$(origin O)", "command line") | ||
2 | OUTPUT := $(O)/ | ||
3 | endif | ||
4 | |||
5 | ifneq ($(OUTPUT),) | ||
6 | # check that the output directory actually exists | ||
7 | OUTDIR := $(shell cd $(OUTPUT) && /bin/pwd) | ||
8 | $(if $(OUTDIR),, $(error output directory "$(OUTPUT)" does not exist)) | ||
9 | endif | ||
10 | |||
11 | # | ||
12 | # Include saner warnings here, which can catch bugs: | ||
13 | # | ||
14 | EXTRA_WARNINGS := -Wbad-function-cast | ||
15 | EXTRA_WARNINGS += -Wdeclaration-after-statement | ||
16 | EXTRA_WARNINGS += -Wformat-security | ||
17 | EXTRA_WARNINGS += -Wformat-y2k | ||
18 | EXTRA_WARNINGS += -Winit-self | ||
19 | EXTRA_WARNINGS += -Wmissing-declarations | ||
20 | EXTRA_WARNINGS += -Wmissing-prototypes | ||
21 | EXTRA_WARNINGS += -Wnested-externs | ||
22 | EXTRA_WARNINGS += -Wno-system-headers | ||
23 | EXTRA_WARNINGS += -Wold-style-definition | ||
24 | EXTRA_WARNINGS += -Wpacked | ||
25 | EXTRA_WARNINGS += -Wredundant-decls | ||
26 | EXTRA_WARNINGS += -Wshadow | ||
27 | EXTRA_WARNINGS += -Wstrict-aliasing=3 | ||
28 | EXTRA_WARNINGS += -Wstrict-prototypes | ||
29 | EXTRA_WARNINGS += -Wswitch-default | ||
30 | EXTRA_WARNINGS += -Wswitch-enum | ||
31 | EXTRA_WARNINGS += -Wundef | ||
32 | EXTRA_WARNINGS += -Wwrite-strings | ||
33 | EXTRA_WARNINGS += -Wformat | ||
34 | |||
35 | ifneq ($(findstring $(MAKEFLAGS), w),w) | ||
36 | PRINT_DIR = --no-print-directory | ||
37 | else | ||
38 | NO_SUBDIR = : | ||
39 | endif | ||
40 | |||
41 | QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir | ||
42 | QUIET_SUBDIR1 = | ||
43 | |||
44 | ifneq ($(findstring $(MAKEFLAGS),s),s) | ||
45 | ifndef V | ||
46 | QUIET_CC = @echo ' ' CC $@; | ||
47 | QUIET_AR = @echo ' ' AR $@; | ||
48 | QUIET_LINK = @echo ' ' LINK $@; | ||
49 | QUIET_MKDIR = @echo ' ' MKDIR $@; | ||
50 | QUIET_GEN = @echo ' ' GEN $@; | ||
51 | QUIET_SUBDIR0 = +@subdir= | ||
52 | QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \ | ||
53 | $(MAKE) $(PRINT_DIR) -C $$subdir | ||
54 | QUIET_FLEX = @echo ' ' FLEX $@; | ||
55 | QUIET_BISON = @echo ' ' BISON $@; | ||
56 | endif | ||
57 | endif | ||
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl index 9507c4b251a8..95d6a6f7c33a 100755 --- a/tools/testing/ktest/ktest.pl +++ b/tools/testing/ktest/ktest.pl | |||
@@ -46,6 +46,7 @@ my %default = ( | |||
46 | "DIE_ON_FAILURE" => 1, | 46 | "DIE_ON_FAILURE" => 1, |
47 | "SSH_EXEC" => "ssh \$SSH_USER\@\$MACHINE \$SSH_COMMAND", | 47 | "SSH_EXEC" => "ssh \$SSH_USER\@\$MACHINE \$SSH_COMMAND", |
48 | "SCP_TO_TARGET" => "scp \$SRC_FILE \$SSH_USER\@\$MACHINE:\$DST_FILE", | 48 | "SCP_TO_TARGET" => "scp \$SRC_FILE \$SSH_USER\@\$MACHINE:\$DST_FILE", |
49 | "SCP_TO_TARGET_INSTALL" => "\${SCP_TO_TARGET}", | ||
49 | "REBOOT" => "ssh \$SSH_USER\@\$MACHINE reboot", | 50 | "REBOOT" => "ssh \$SSH_USER\@\$MACHINE reboot", |
50 | "STOP_AFTER_SUCCESS" => 10, | 51 | "STOP_AFTER_SUCCESS" => 10, |
51 | "STOP_AFTER_FAILURE" => 60, | 52 | "STOP_AFTER_FAILURE" => 60, |
@@ -86,11 +87,13 @@ my $reboot_on_error; | |||
86 | my $switch_to_good; | 87 | my $switch_to_good; |
87 | my $switch_to_test; | 88 | my $switch_to_test; |
88 | my $poweroff_on_error; | 89 | my $poweroff_on_error; |
90 | my $reboot_on_success; | ||
89 | my $die_on_failure; | 91 | my $die_on_failure; |
90 | my $powercycle_after_reboot; | 92 | my $powercycle_after_reboot; |
91 | my $poweroff_after_halt; | 93 | my $poweroff_after_halt; |
92 | my $ssh_exec; | 94 | my $ssh_exec; |
93 | my $scp_to_target; | 95 | my $scp_to_target; |
96 | my $scp_to_target_install; | ||
94 | my $power_off; | 97 | my $power_off; |
95 | my $grub_menu; | 98 | my $grub_menu; |
96 | my $grub_number; | 99 | my $grub_number; |
@@ -211,6 +214,7 @@ my %option_map = ( | |||
211 | "SWITCH_TO_GOOD" => \$switch_to_good, | 214 | "SWITCH_TO_GOOD" => \$switch_to_good, |
212 | "SWITCH_TO_TEST" => \$switch_to_test, | 215 | "SWITCH_TO_TEST" => \$switch_to_test, |
213 | "POWEROFF_ON_ERROR" => \$poweroff_on_error, | 216 | "POWEROFF_ON_ERROR" => \$poweroff_on_error, |
217 | "REBOOT_ON_SUCCESS" => \$reboot_on_success, | ||
214 | "DIE_ON_FAILURE" => \$die_on_failure, | 218 | "DIE_ON_FAILURE" => \$die_on_failure, |
215 | "POWER_OFF" => \$power_off, | 219 | "POWER_OFF" => \$power_off, |
216 | "POWERCYCLE_AFTER_REBOOT" => \$powercycle_after_reboot, | 220 | "POWERCYCLE_AFTER_REBOOT" => \$powercycle_after_reboot, |
@@ -243,6 +247,7 @@ my %option_map = ( | |||
243 | "BUILD_TARGET" => \$build_target, | 247 | "BUILD_TARGET" => \$build_target, |
244 | "SSH_EXEC" => \$ssh_exec, | 248 | "SSH_EXEC" => \$ssh_exec, |
245 | "SCP_TO_TARGET" => \$scp_to_target, | 249 | "SCP_TO_TARGET" => \$scp_to_target, |
250 | "SCP_TO_TARGET_INSTALL" => \$scp_to_target_install, | ||
246 | "CHECKOUT" => \$checkout, | 251 | "CHECKOUT" => \$checkout, |
247 | "TARGET_IMAGE" => \$target_image, | 252 | "TARGET_IMAGE" => \$target_image, |
248 | "LOCALVERSION" => \$localversion, | 253 | "LOCALVERSION" => \$localversion, |
@@ -1113,7 +1118,6 @@ sub reboot_to_good { | |||
1113 | 1118 | ||
1114 | if (defined($switch_to_good)) { | 1119 | if (defined($switch_to_good)) { |
1115 | run_command $switch_to_good; | 1120 | run_command $switch_to_good; |
1116 | return; | ||
1117 | } | 1121 | } |
1118 | 1122 | ||
1119 | reboot $time; | 1123 | reboot $time; |
@@ -1349,8 +1353,7 @@ sub run_ssh { | |||
1349 | } | 1353 | } |
1350 | 1354 | ||
1351 | sub run_scp { | 1355 | sub run_scp { |
1352 | my ($src, $dst) = @_; | 1356 | my ($src, $dst, $cp_scp) = @_; |
1353 | my $cp_scp = $scp_to_target; | ||
1354 | 1357 | ||
1355 | $cp_scp =~ s/\$SRC_FILE/$src/g; | 1358 | $cp_scp =~ s/\$SRC_FILE/$src/g; |
1356 | $cp_scp =~ s/\$DST_FILE/$dst/g; | 1359 | $cp_scp =~ s/\$DST_FILE/$dst/g; |
@@ -1358,6 +1361,22 @@ sub run_scp { | |||
1358 | return run_command "$cp_scp"; | 1361 | return run_command "$cp_scp"; |
1359 | } | 1362 | } |
1360 | 1363 | ||
1364 | sub run_scp_install { | ||
1365 | my ($src, $dst) = @_; | ||
1366 | |||
1367 | my $cp_scp = $scp_to_target_install; | ||
1368 | |||
1369 | return run_scp($src, $dst, $cp_scp); | ||
1370 | } | ||
1371 | |||
1372 | sub run_scp_mod { | ||
1373 | my ($src, $dst) = @_; | ||
1374 | |||
1375 | my $cp_scp = $scp_to_target; | ||
1376 | |||
1377 | return run_scp($src, $dst, $cp_scp); | ||
1378 | } | ||
1379 | |||
1361 | sub get_grub_index { | 1380 | sub get_grub_index { |
1362 | 1381 | ||
1363 | if ($reboot_type ne "grub") { | 1382 | if ($reboot_type ne "grub") { |
@@ -1460,6 +1479,7 @@ sub get_sha1 { | |||
1460 | sub monitor { | 1479 | sub monitor { |
1461 | my $booted = 0; | 1480 | my $booted = 0; |
1462 | my $bug = 0; | 1481 | my $bug = 0; |
1482 | my $bug_ignored = 0; | ||
1463 | my $skip_call_trace = 0; | 1483 | my $skip_call_trace = 0; |
1464 | my $loops; | 1484 | my $loops; |
1465 | 1485 | ||
@@ -1531,9 +1551,13 @@ sub monitor { | |||
1531 | } | 1551 | } |
1532 | 1552 | ||
1533 | if ($full_line =~ /call trace:/i) { | 1553 | if ($full_line =~ /call trace:/i) { |
1534 | if (!$ignore_errors && !$bug && !$skip_call_trace) { | 1554 | if (!$bug && !$skip_call_trace) { |
1535 | $bug = 1; | 1555 | if ($ignore_errors) { |
1536 | $failure_start = time; | 1556 | $bug_ignored = 1; |
1557 | } else { | ||
1558 | $bug = 1; | ||
1559 | $failure_start = time; | ||
1560 | } | ||
1537 | } | 1561 | } |
1538 | } | 1562 | } |
1539 | 1563 | ||
@@ -1595,6 +1619,10 @@ sub monitor { | |||
1595 | fail "failed - never got a boot prompt." and return 0; | 1619 | fail "failed - never got a boot prompt." and return 0; |
1596 | } | 1620 | } |
1597 | 1621 | ||
1622 | if ($bug_ignored) { | ||
1623 | doprint "WARNING: Call Trace detected but ignored due to IGNORE_ERRORS=1\n"; | ||
1624 | } | ||
1625 | |||
1598 | return 1; | 1626 | return 1; |
1599 | } | 1627 | } |
1600 | 1628 | ||
@@ -1621,7 +1649,7 @@ sub install { | |||
1621 | 1649 | ||
1622 | my $cp_target = eval_kernel_version $target_image; | 1650 | my $cp_target = eval_kernel_version $target_image; |
1623 | 1651 | ||
1624 | run_scp "$outputdir/$build_target", "$cp_target" or | 1652 | run_scp_install "$outputdir/$build_target", "$cp_target" or |
1625 | dodie "failed to copy image"; | 1653 | dodie "failed to copy image"; |
1626 | 1654 | ||
1627 | my $install_mods = 0; | 1655 | my $install_mods = 0; |
@@ -1643,7 +1671,7 @@ sub install { | |||
1643 | return; | 1671 | return; |
1644 | } | 1672 | } |
1645 | 1673 | ||
1646 | run_command "$make INSTALL_MOD_PATH=$tmpdir modules_install" or | 1674 | run_command "$make INSTALL_MOD_STRIP=1 INSTALL_MOD_PATH=$tmpdir modules_install" or |
1647 | dodie "Failed to install modules"; | 1675 | dodie "Failed to install modules"; |
1648 | 1676 | ||
1649 | my $modlib = "/lib/modules/$version"; | 1677 | my $modlib = "/lib/modules/$version"; |
@@ -1656,7 +1684,7 @@ sub install { | |||
1656 | run_command "cd $tmpdir && tar -cjf $modtar lib/modules/$version" or | 1684 | run_command "cd $tmpdir && tar -cjf $modtar lib/modules/$version" or |
1657 | dodie "making tarball"; | 1685 | dodie "making tarball"; |
1658 | 1686 | ||
1659 | run_scp "$tmpdir/$modtar", "/tmp" or | 1687 | run_scp_mod "$tmpdir/$modtar", "/tmp" or |
1660 | dodie "failed to copy modules"; | 1688 | dodie "failed to copy modules"; |
1661 | 1689 | ||
1662 | unlink "$tmpdir/$modtar"; | 1690 | unlink "$tmpdir/$modtar"; |
@@ -2601,7 +2629,7 @@ sub config_bisect { | |||
2601 | # read directly what we want to check | 2629 | # read directly what we want to check |
2602 | my %config_check; | 2630 | my %config_check; |
2603 | open (IN, $output_config) | 2631 | open (IN, $output_config) |
2604 | or dodie "faied to open $output_config"; | 2632 | or dodie "failed to open $output_config"; |
2605 | 2633 | ||
2606 | while (<IN>) { | 2634 | while (<IN>) { |
2607 | if (/^((CONFIG\S*)=.*)/) { | 2635 | if (/^((CONFIG\S*)=.*)/) { |
@@ -3526,8 +3554,10 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) { | |||
3526 | die "failed to checkout $checkout"; | 3554 | die "failed to checkout $checkout"; |
3527 | } | 3555 | } |
3528 | 3556 | ||
3529 | $no_reboot = 0; | 3557 | # A test may opt to not reboot the box |
3530 | 3558 | if ($reboot_on_success) { | |
3559 | $no_reboot = 0; | ||
3560 | } | ||
3531 | 3561 | ||
3532 | if ($test_type eq "bisect") { | 3562 | if ($test_type eq "bisect") { |
3533 | bisect $i; | 3563 | bisect $i; |
@@ -3572,8 +3602,12 @@ if ($opt{"POWEROFF_ON_SUCCESS"}) { | |||
3572 | halt; | 3602 | halt; |
3573 | } elsif ($opt{"REBOOT_ON_SUCCESS"} && !do_not_reboot) { | 3603 | } elsif ($opt{"REBOOT_ON_SUCCESS"} && !do_not_reboot) { |
3574 | reboot_to_good; | 3604 | reboot_to_good; |
3605 | } elsif (defined($switch_to_good)) { | ||
3606 | # still need to get to the good kernel | ||
3607 | run_command $switch_to_good; | ||
3575 | } | 3608 | } |
3576 | 3609 | ||
3610 | |||
3577 | doprint "\n $successes of $opt{NUM_TESTS} tests were successful\n\n"; | 3611 | doprint "\n $successes of $opt{NUM_TESTS} tests were successful\n\n"; |
3578 | 3612 | ||
3579 | exit 0; | 3613 | exit 0; |
diff --git a/tools/testing/ktest/sample.conf b/tools/testing/ktest/sample.conf index 5ea04c6a71bf..b682456afda8 100644 --- a/tools/testing/ktest/sample.conf +++ b/tools/testing/ktest/sample.conf | |||
@@ -710,10 +710,18 @@ | |||
710 | # The variables SSH_USER, MACHINE and SSH_COMMAND are defined | 710 | # The variables SSH_USER, MACHINE and SSH_COMMAND are defined |
711 | #SSH_EXEC = ssh $SSH_USER@$MACHINE $SSH_COMMAND"; | 711 | #SSH_EXEC = ssh $SSH_USER@$MACHINE $SSH_COMMAND"; |
712 | 712 | ||
713 | # The way to copy a file to the target | 713 | # The way to copy a file to the target (install and modules) |
714 | # (default scp $SRC_FILE $SSH_USER@$MACHINE:$DST_FILE) | 714 | # (default scp $SRC_FILE $SSH_USER@$MACHINE:$DST_FILE) |
715 | # The variables SSH_USER, MACHINE, SRC_FILE and DST_FILE are defined. | 715 | # The variables SSH_USER, MACHINE are defined by the config |
716 | #SCP_TO_TARGET = scp $SRC_FILE $SSH_USER@$MACHINE:$DST_FILE | 716 | # SRC_FILE and DST_FILE are ktest internal variables and |
717 | # should only have '$' and not the '${}' notation. | ||
718 | # (default scp $SRC_FILE ${SSH_USER}@${MACHINE}:$DST_FILE) | ||
719 | #SCP_TO_TARGET = echo skip scp for $SRC_FILE $DST_FILE | ||
720 | |||
721 | # If install needs to be different than modules, then this | ||
722 | # option will override the SCP_TO_TARGET for installation. | ||
723 | # (default ${SCP_TO_TARGET} ) | ||
724 | #SCP_TO_TARGET_INSTALL = scp $SRC_FILE tftp@tftpserver:$DST_FILE | ||
717 | 725 | ||
718 | # The nice way to reboot the target | 726 | # The nice way to reboot the target |
719 | # (default ssh $SSH_USER@$MACHINE reboot) | 727 | # (default ssh $SSH_USER@$MACHINE reboot) |
diff --git a/tools/usb/Makefile b/tools/usb/Makefile index 8b704af14349..396d6c44e9d7 100644 --- a/tools/usb/Makefile +++ b/tools/usb/Makefile | |||
@@ -3,7 +3,7 @@ | |||
3 | CC = $(CROSS_COMPILE)gcc | 3 | CC = $(CROSS_COMPILE)gcc |
4 | PTHREAD_LIBS = -lpthread | 4 | PTHREAD_LIBS = -lpthread |
5 | WARNINGS = -Wall -Wextra | 5 | WARNINGS = -Wall -Wextra |
6 | CFLAGS = $(WARNINGS) -g $(PTHREAD_LIBS) | 6 | CFLAGS = $(WARNINGS) -g $(PTHREAD_LIBS) -I../include |
7 | 7 | ||
8 | all: testusb ffs-test | 8 | all: testusb ffs-test |
9 | %: %.c | 9 | %: %.c |
diff --git a/tools/usb/ffs-test.c b/tools/usb/ffs-test.c index b9c798631699..4b107b5e623f 100644 --- a/tools/usb/ffs-test.c +++ b/tools/usb/ffs-test.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * ffs-test.c.c -- user mode filesystem api for usb composite function | 2 | * ffs-test.c.c -- user mode filesystem api for usb composite function |
3 | * | 3 | * |
4 | * Copyright (C) 2010 Samsung Electronics | 4 | * Copyright (C) 2010 Samsung Electronics |
5 | * Author: Michal Nazarewicz <m.nazarewicz@samsung.com> | 5 | * Author: Michal Nazarewicz <mina86@mina86.com> |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License as published by | 8 | * it under the terms of the GNU General Public License as published by |
@@ -36,6 +36,7 @@ | |||
36 | #include <sys/stat.h> | 36 | #include <sys/stat.h> |
37 | #include <sys/types.h> | 37 | #include <sys/types.h> |
38 | #include <unistd.h> | 38 | #include <unistd.h> |
39 | #include <tools/le_byteshift.h> | ||
39 | 40 | ||
40 | #include "../../include/linux/usb/functionfs.h" | 41 | #include "../../include/linux/usb/functionfs.h" |
41 | 42 | ||
@@ -47,34 +48,6 @@ | |||
47 | #define le32_to_cpu(x) le32toh(x) | 48 | #define le32_to_cpu(x) le32toh(x) |
48 | #define le16_to_cpu(x) le16toh(x) | 49 | #define le16_to_cpu(x) le16toh(x) |
49 | 50 | ||
50 | static inline __u16 get_unaligned_le16(const void *_ptr) | ||
51 | { | ||
52 | const __u8 *ptr = _ptr; | ||
53 | return ptr[0] | (ptr[1] << 8); | ||
54 | } | ||
55 | |||
56 | static inline __u32 get_unaligned_le32(const void *_ptr) | ||
57 | { | ||
58 | const __u8 *ptr = _ptr; | ||
59 | return ptr[0] | (ptr[1] << 8) | (ptr[2] << 16) | (ptr[3] << 24); | ||
60 | } | ||
61 | |||
62 | static inline void put_unaligned_le16(__u16 val, void *_ptr) | ||
63 | { | ||
64 | __u8 *ptr = _ptr; | ||
65 | *ptr++ = val; | ||
66 | *ptr++ = val >> 8; | ||
67 | } | ||
68 | |||
69 | static inline void put_unaligned_le32(__u32 val, void *_ptr) | ||
70 | { | ||
71 | __u8 *ptr = _ptr; | ||
72 | *ptr++ = val; | ||
73 | *ptr++ = val >> 8; | ||
74 | *ptr++ = val >> 16; | ||
75 | *ptr++ = val >> 24; | ||
76 | } | ||
77 | |||
78 | 51 | ||
79 | /******************** Messages and Errors ***********************************/ | 52 | /******************** Messages and Errors ***********************************/ |
80 | 53 | ||
diff --git a/tools/usb/testusb.c b/tools/usb/testusb.c index f08e89463842..6e0f56701e44 100644 --- a/tools/usb/testusb.c +++ b/tools/usb/testusb.c | |||
@@ -3,7 +3,7 @@ | |||
3 | /* | 3 | /* |
4 | * Copyright (c) 2002 by David Brownell | 4 | * Copyright (c) 2002 by David Brownell |
5 | * Copyright (c) 2010 by Samsung Electronics | 5 | * Copyright (c) 2010 by Samsung Electronics |
6 | * Author: Michal Nazarewicz <m.nazarewicz@samsung.com> | 6 | * Author: Michal Nazarewicz <mina86@mina86.com> |
7 | * | 7 | * |
8 | * This program is free software; you can redistribute it and/or modify it | 8 | * This program is free software; you can redistribute it and/or modify it |
9 | * under the terms of the GNU General Public License as published by the | 9 | * under the terms of the GNU General Public License as published by the |