]>
Commit | Line | Data |
---|---|---|
177a8ead | 1 | // -*- C++ -*- |
6643650d | 2 | // Copyright (C) 2005-2008 Red Hat Inc. |
177a8ead FCE |
3 | // |
4 | // This file is part of systemtap, and is free software. You can | |
5 | // redistribute it and/or modify it under the terms of the GNU General | |
6 | // Public License (GPL); either version 2, or (at your option) any | |
7 | // later version. | |
8 | ||
9 | #ifndef SESSION_H | |
10 | #define SESSION_H | |
11 | ||
12 | #include <string> | |
13 | #include <vector> | |
14 | #include <iostream> | |
15 | #include <sstream> | |
16 | #include <map> | |
7e41d3dc | 17 | #include <set> |
177a8ead | 18 | |
1d3a40b6 DS |
19 | extern "C" { |
20 | #include <elfutils/libdw.h> | |
21 | } | |
22 | ||
177a8ead FCE |
23 | |
24 | // forward decls for all referenced systemtap types | |
25 | struct match_node; | |
26 | struct stapfile; | |
27 | struct vardecl; | |
cfd621bc | 28 | struct token; |
177a8ead | 29 | struct functiondecl; |
b20febf3 FCE |
30 | struct derived_probe; |
31 | struct be_derived_probe_group; | |
32 | struct dwarf_derived_probe_group; | |
888af770 | 33 | struct uprobe_derived_probe_group; |
935447c8 DS |
34 | struct utrace_derived_probe_group; |
35 | struct task_finder_derived_probe_group; | |
b20febf3 FCE |
36 | struct timer_derived_probe_group; |
37 | struct profile_derived_probe_group; | |
38 | struct mark_derived_probe_group; | |
39 | struct hrtimer_derived_probe_group; | |
40 | struct perfmon_derived_probe_group; | |
604eef3b | 41 | struct procfs_derived_probe_group; |
177a8ead FCE |
42 | struct embeddedcode; |
43 | struct translator_output; | |
44 | struct unparser; | |
45 | struct semantic_error; | |
405b71b8 | 46 | struct module_cache; |
177a8ead FCE |
47 | |
48 | ||
49 | // XXX: a generalized form of this descriptor could be associated with | |
50 | // a vardecl instead of out here at the systemtap_session level. | |
51 | struct statistic_decl | |
52 | { | |
53 | statistic_decl() | |
54 | : type(none), | |
177a8ead FCE |
55 | linear_low(0), linear_high(0), linear_step(0) |
56 | {} | |
57 | enum { none, linear, logarithmic } type; | |
177a8ead FCE |
58 | int64_t linear_low; |
59 | int64_t linear_high; | |
60 | int64_t linear_step; | |
07c17d67 GH |
61 | bool operator==(statistic_decl const & other) |
62 | { | |
63 | return type == other.type | |
07c17d67 GH |
64 | && linear_low == other.linear_low |
65 | && linear_high == other.linear_high | |
66 | && linear_step == other.linear_step; | |
67 | } | |
177a8ead FCE |
68 | }; |
69 | ||
70 | ||
71 | struct systemtap_session | |
72 | { | |
73 | systemtap_session (); | |
b20febf3 | 74 | // NB: new POD members likely need to be explicitly cleared in the ctor. |
888af770 | 75 | // See elaborate.cxx. |
177a8ead FCE |
76 | |
77 | // command line args | |
78 | std::vector<std::string> include_path; | |
79 | std::vector<std::string> macros; | |
80 | std::vector<std::string> args; | |
81 | std::string kernel_release; | |
197a4d62 | 82 | std::string kernel_base_release; |
44ce8ed5 | 83 | std::string architecture; |
177a8ead | 84 | std::string runtime_path; |
1b78aef5 | 85 | std::string data_path; |
177a8ead FCE |
86 | std::string module_name; |
87 | std::string output_file; | |
88 | std::string cmd; | |
89 | int target_pid; | |
90 | int last_pass; | |
b0ee93c4 | 91 | unsigned verbose; |
a9e8f7e0 | 92 | bool timing; |
177a8ead FCE |
93 | bool keep_tmpdir; |
94 | bool guru_mode; | |
16442b90 | 95 | bool listing_mode; |
177a8ead | 96 | bool bulk_mode; |
cbfbbf69 | 97 | bool unoptimized; |
f272aacc | 98 | bool merge; |
a9e8f7e0 | 99 | bool suppress_warnings; |
177a8ead | 100 | int buffer_size; |
47dd066d | 101 | unsigned perfmon; |
84048984 | 102 | bool symtab; /* true: emit symbol table at translation time; false: let staprun do it. */ |
44f75386 | 103 | bool prologue_searching; |
c3a3c0c9 | 104 | bool tapset_compile_coverage; |
6274464e | 105 | bool need_uprobes; |
177a8ead | 106 | |
1b78aef5 DS |
107 | // Cache data |
108 | bool use_cache; | |
109 | std::string cache_path; | |
110 | std::string hash_path; | |
111 | ||
5f0a03a6 JK |
112 | // dwarfless operation |
113 | bool consult_symtab; | |
114 | std::string kernel_symtab_path; | |
115 | bool ignore_vmlinux; | |
116 | bool ignore_dwarf; | |
117 | ||
177a8ead FCE |
118 | // temporary directory for module builds etc. |
119 | // hazardous - it is "rm -rf"'d at exit | |
120 | std::string tmpdir; | |
121 | std::string translated_source; // C source code | |
122 | ||
123 | match_node* pattern_root; | |
124 | void register_library_aliases(); | |
125 | ||
126 | // parse trees for the various script files | |
127 | stapfile* user_file; | |
128 | std::vector<stapfile*> library_files; | |
129 | ||
130 | // resolved globals/functions/probes for the run as a whole | |
131 | std::vector<stapfile*> files; | |
132 | std::vector<vardecl*> globals; | |
133 | std::vector<functiondecl*> functions; | |
b20febf3 | 134 | std::vector<derived_probe*> probes; // see also *_probes groups below |
177a8ead FCE |
135 | std::vector<embeddedcode*> embeds; |
136 | std::map<std::string, statistic_decl> stat_decls; | |
c3a3c0c9 WC |
137 | // track things that are removed |
138 | std::vector<vardecl*> unused_globals; | |
139 | std::vector<derived_probe*> unused_probes; // see also *_probes groups below | |
140 | std::vector<functiondecl*> unused_functions; | |
177a8ead FCE |
141 | // XXX: vector<*> instead please? |
142 | ||
b20febf3 FCE |
143 | // Every probe in these groups must also appear in the |
144 | // session.probes vector. | |
145 | be_derived_probe_group* be_derived_probes; | |
146 | dwarf_derived_probe_group* dwarf_derived_probes; | |
888af770 | 147 | uprobe_derived_probe_group* uprobe_derived_probes; |
935447c8 DS |
148 | utrace_derived_probe_group* utrace_derived_probes; |
149 | task_finder_derived_probe_group* task_finder_derived_probes; | |
b20febf3 FCE |
150 | timer_derived_probe_group* timer_derived_probes; |
151 | profile_derived_probe_group* profile_derived_probes; | |
152 | mark_derived_probe_group* mark_derived_probes; | |
153 | hrtimer_derived_probe_group* hrtimer_derived_probes; | |
154 | perfmon_derived_probe_group* perfmon_derived_probes; | |
604eef3b | 155 | procfs_derived_probe_group* procfs_derived_probes; |
177a8ead FCE |
156 | |
157 | // unparser data | |
158 | translator_output* op; | |
159 | unparser* up; | |
160 | ||
84048984 FCE |
161 | // some symbol addresses |
162 | // XXX: these belong elsewhere; perhaps the dwflpp instance | |
163 | Dwarf_Addr sym_kprobes_text_start; | |
164 | Dwarf_Addr sym_kprobes_text_end; | |
165 | Dwarf_Addr sym_stext; | |
1d3a40b6 | 166 | |
a8368458 | 167 | // List of libdwfl module names to extract symbol/unwind data for. |
405b71b8 | 168 | struct module_cache* module_cache; |
1a0dbc5a | 169 | std::set<std::string> unwindsym_modules; |
a8368458 | 170 | |
7e41d3dc | 171 | std::set<std::string> seen_errors; |
ab54fa85 | 172 | std::set<std::string> seen_warnings; |
7e41d3dc | 173 | unsigned num_errors () { return seen_errors.size(); } |
cfd621bc | 174 | |
177a8ead | 175 | // void print_error (const parse_error& e); |
cfd621bc FCE |
176 | const token* last_token; |
177 | void print_token (std::ostream& o, const token* tok); | |
177a8ead | 178 | void print_error (const semantic_error& e); |
cfd621bc | 179 | void print_warning (const std::string& w, const token* tok = 0); |
b20febf3 FCE |
180 | |
181 | // reNB: new POD members likely need to be explicitly cleared in the ctor. | |
177a8ead FCE |
182 | }; |
183 | ||
184 | ||
49abf162 FCE |
185 | // global counter of SIGINT/SIGTERM's received |
186 | extern int pending_interrupts; | |
187 | ||
177a8ead | 188 | #endif // SESSION_H |