^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: LGPL-2.1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Copyright (C) 2009, 2010 Red Hat Inc, Steven Rostedt <srostedt@redhat.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #ifndef _PARSE_EVENTS_INT_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #define _PARSE_EVENTS_INT_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) struct tep_cmdline;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) struct cmdline_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) struct func_map;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) struct func_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) struct event_handler;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) struct func_resolver;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) struct tep_plugins_dir;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #define __hidden __attribute__((visibility ("hidden")))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) struct tep_handle {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) int ref_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) int header_page_ts_offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) int header_page_ts_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) int header_page_size_offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) int header_page_size_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) int header_page_data_offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) int header_page_data_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) int header_page_overwrite;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) enum tep_endian file_bigendian;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) enum tep_endian host_bigendian;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) int old_format;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) int cpus;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) int long_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) int page_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) struct tep_cmdline *cmdlines;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) struct cmdline_list *cmdlist;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) int cmdline_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) struct func_map *func_map;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) struct func_resolver *func_resolver;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) struct func_list *funclist;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) unsigned int func_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) struct printk_map *printk_map;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) struct printk_list *printklist;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) unsigned int printk_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) struct tep_event **events;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) int nr_events;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) struct tep_event **sort_events;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) enum tep_event_sort_type last_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) int type_offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) int type_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) int pid_offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) int pid_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) int pc_offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) int pc_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) int flags_offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) int flags_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) int ld_offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) int ld_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) int test_filters;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) int flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) struct tep_format_field *bprint_ip_field;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) struct tep_format_field *bprint_fmt_field;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) struct tep_format_field *bprint_buf_field;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) struct event_handler *handlers;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) struct tep_function_handler *func_handlers;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) /* cache */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) struct tep_event *last_event;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) struct tep_plugins_dir *plugins_dir;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) enum tep_print_parse_type {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) PRINT_FMT_STRING,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) PRINT_FMT_ARG_DIGIT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) PRINT_FMT_ARG_POINTER,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) PRINT_FMT_ARG_STRING,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) struct tep_print_parse {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) struct tep_print_parse *next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) char *format;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) int ls;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) enum tep_print_parse_type type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) struct tep_print_arg *arg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) struct tep_print_arg *len_as_arg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) void free_tep_event(struct tep_event *event);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) void free_tep_format_field(struct tep_format_field *field);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) void free_tep_plugin_paths(struct tep_handle *tep);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) unsigned short data2host2(struct tep_handle *tep, unsigned short data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) unsigned int data2host4(struct tep_handle *tep, unsigned int data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) unsigned long long data2host8(struct tep_handle *tep, unsigned long long data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) /* access to the internal parser */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) int peek_char(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) void init_input_buf(const char *buf, unsigned long long size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) unsigned long long get_input_buf_ptr(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) const char *get_input_buf(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) enum tep_event_type read_token(char **tok);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) void free_token(char *tok);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) #endif /* _PARSE_EVENTS_INT_H */