]> sourceware.org Git - systemtap.git/blame - session.h
Restore legacy domain (localhost) in server cert for stap-client.
[systemtap.git] / session.h
CommitLineData
177a8ead 1// -*- C++ -*-
70e6d6c9 2// Copyright (C) 2005-2010 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
aa4d21c0 12#include <list>
177a8ead
FCE
13#include <string>
14#include <vector>
15#include <iostream>
16#include <sstream>
17#include <map>
7e41d3dc 18#include <set>
177a8ead 19
1d3a40b6 20extern "C" {
2dce8c42 21#include <signal.h>
1d3a40b6
DS
22#include <elfutils/libdw.h>
23}
24
177a8ead
FCE
25
26// forward decls for all referenced systemtap types
9b3c54b2 27struct hash;
177a8ead
FCE
28struct match_node;
29struct stapfile;
30struct vardecl;
cfd621bc 31struct token;
177a8ead 32struct functiondecl;
b20febf3
FCE
33struct derived_probe;
34struct be_derived_probe_group;
35struct dwarf_derived_probe_group;
e6fe60e7 36struct kprobe_derived_probe_group;
dd225250 37struct hwbkpt_derived_probe_group;
83ea76b1 38struct perf_derived_probe_group;
888af770 39struct uprobe_derived_probe_group;
935447c8 40struct utrace_derived_probe_group;
a96d1db0 41struct itrace_derived_probe_group;
935447c8 42struct task_finder_derived_probe_group;
b20febf3
FCE
43struct timer_derived_probe_group;
44struct profile_derived_probe_group;
45struct mark_derived_probe_group;
0a6f5a3f 46struct tracepoint_derived_probe_group;
b20febf3 47struct hrtimer_derived_probe_group;
604eef3b 48struct procfs_derived_probe_group;
177a8ead
FCE
49struct embeddedcode;
50struct translator_output;
51struct unparser;
52struct semantic_error;
405b71b8 53struct module_cache;
f80d9004 54struct update_visitor;
177a8ead 55
177a8ead
FCE
56// XXX: a generalized form of this descriptor could be associated with
57// a vardecl instead of out here at the systemtap_session level.
58struct statistic_decl
59{
60 statistic_decl()
dff50e09 61 : type(none),
177a8ead 62 linear_low(0), linear_high(0), linear_step(0)
dff50e09 63 {}
177a8ead 64 enum { none, linear, logarithmic } type;
177a8ead
FCE
65 int64_t linear_low;
66 int64_t linear_high;
67 int64_t linear_step;
07c17d67
GH
68 bool operator==(statistic_decl const & other)
69 {
dff50e09 70 return type == other.type
07c17d67
GH
71 && linear_low == other.linear_low
72 && linear_high == other.linear_high
73 && linear_step == other.linear_step;
74 }
177a8ead
FCE
75};
76
177a8ead
FCE
77struct systemtap_session
78{
79 systemtap_session ();
b0e5fa85 80 ~systemtap_session ();
aa4d21c0 81
28f569c2 82 // NB: It is very important for all of the above (and below) fields
85007c04 83 // to be cleared in the systemtap_session ctor (session.cxx).
e2012a7a 84 void setup_kernel_release (const char* kstr);
aa4d21c0
DB
85 int parse_kernel_config ();
86 int parse_kernel_exports ();
bb153adb 87 void insert_loaded_modules ();
e2012a7a
DB
88
89 // command line parsing
90 int parse_cmdline (int argc, char * const argv []);
91 void version ();
92 void usage (int exitcode);
93 void check_options (int argc, char * const argv []);
94 static const char* morehelp;
177a8ead 95
aa4d21c0 96 // NB: It is very important for all of the above (and below) fields
85007c04 97 // to be cleared in the systemtap_session ctor (session.cxx).
aa4d21c0 98
177a8ead 99 // command line args
e2012a7a
DB
100 std::string script_file; // FILE
101 std::string cmdline_script; // -e PROGRAM
102 bool have_script;
177a8ead 103 std::vector<std::string> include_path;
2fad97fd 104 int include_arg_start;
177a8ead
FCE
105 std::vector<std::string> macros;
106 std::vector<std::string> args;
1392896d 107 std::vector<std::string> kbuildflags;
bb25d08f 108 std::vector<std::string> globalopts; // -G var=val
e2012a7a 109 std::string release;
177a8ead 110 std::string kernel_release;
197a4d62 111 std::string kernel_base_release;
7471ea1f 112 std::string kernel_build_tree;
d4393459 113 std::string kernel_source_tree;
561079c8 114 std::map<std::string,std::string> kernel_config;
70e6d6c9 115 std::set<std::string> kernel_exports;
e2012a7a 116 std::string machine;
44ce8ed5 117 std::string architecture;
177a8ead 118 std::string runtime_path;
2fad97fd 119 bool runtime_specified;
1b78aef5 120 std::string data_path;
177a8ead 121 std::string module_name;
de0db58a 122 std::string stapconf_name;
177a8ead 123 std::string output_file;
701c41be 124 std::string size_option;
177a8ead 125 std::string cmd;
db135493 126 std::string compatible; // use (strverscmp(s.compatible.c_str(), "N.M") >= 0)
177a8ead
FCE
127 int target_pid;
128 int last_pass;
e0b4e89d 129 unsigned perpass_verbose[5];
b0ee93c4 130 unsigned verbose;
a9e8f7e0 131 bool timing;
e2012a7a 132 bool save_module;
177a8ead
FCE
133 bool keep_tmpdir;
134 bool guru_mode;
16442b90 135 bool listing_mode;
8c39844b 136 bool listing_mode_vars;
177a8ead 137 bool bulk_mode;
cbfbbf69 138 bool unoptimized;
a9e8f7e0 139 bool suppress_warnings;
57a56e00 140 bool panic_warnings;
177a8ead 141 int buffer_size;
44f75386 142 bool prologue_searching;
c3a3c0c9 143 bool tapset_compile_coverage;
6274464e 144 bool need_uprobes;
2fa2a091 145 bool load_only; // flight recorder mode
2dce8c42
DB
146 bool omit_werror;
147 bool unprivileged;
148
149 // NB: It is very important for all of the above (and below) fields
85007c04 150 // to be cleared in the systemtap_session ctor (session.cxx).
2dce8c42
DB
151
152 // Client/server
b0e5fa85
DB
153#if HAVE_NSS
154 bool NSPR_Initialized;
b0e5fa85 155#endif
3d9dfde6 156 void NSPR_init ();
e2012a7a
DB
157 bool client_options;
158 std::string client_options_disallowed;
2dce8c42
DB
159 std::vector<std::string> server_status_strings;
160 std::vector<std::string> specified_servers;
c77af0d0 161 std::string server_trust_spec;
2fad97fd 162 std::vector<std::string> server_args;
920be590 163 std::string winning_server;
2dce8c42 164
28f569c2 165 // NB: It is very important for all of the above (and below) fields
85007c04 166 // to be cleared in the systemtap_session ctor (session.cxx).
28f569c2 167
1b78aef5 168 // Cache data
d105f664
JS
169 bool use_cache; // control all caching
170 bool use_script_cache; // control caching of pass-3/4 output
171 bool poison_cache; // consider the cache to be write-only
172 std::string cache_path; // usually ~/.systemtap/cache
173 std::string hash_path; // path to the cached script module
174 std::string stapconf_path; // path to the cached stapconf
175 hash *base_hash; // hash common to all caching
1b78aef5 176
5f0a03a6
JK
177 // dwarfless operation
178 bool consult_symtab;
179 std::string kernel_symtab_path;
180 bool ignore_vmlinux;
181 bool ignore_dwarf;
182
3bd0d4df
RA
183 // Skip bad $ vars
184 bool skip_badvars;
185
28f569c2 186 // NB: It is very important for all of the above (and below) fields
85007c04 187 // to be cleared in the systemtap_session ctor (session.cxx).
28f569c2 188
177a8ead
FCE
189 // temporary directory for module builds etc.
190 // hazardous - it is "rm -rf"'d at exit
191 std::string tmpdir;
192 std::string translated_source; // C source code
193
194 match_node* pattern_root;
195 void register_library_aliases();
196
197 // parse trees for the various script files
198 stapfile* user_file;
199 std::vector<stapfile*> library_files;
200
f80d9004
JS
201 // filters to run over all code before symbol resolution
202 // e.g. @cast expansion
203 std::vector<update_visitor*> code_filters;
204
177a8ead
FCE
205 // resolved globals/functions/probes for the run as a whole
206 std::vector<stapfile*> files;
207 std::vector<vardecl*> globals;
f76427a2 208 std::map<std::string,functiondecl*> functions;
b20febf3 209 std::vector<derived_probe*> probes; // see also *_probes groups below
177a8ead
FCE
210 std::vector<embeddedcode*> embeds;
211 std::map<std::string, statistic_decl> stat_decls;
c3a3c0c9
WC
212 // track things that are removed
213 std::vector<vardecl*> unused_globals;
214 std::vector<derived_probe*> unused_probes; // see also *_probes groups below
215 std::vector<functiondecl*> unused_functions;
177a8ead
FCE
216 // XXX: vector<*> instead please?
217
b20febf3
FCE
218 // Every probe in these groups must also appear in the
219 // session.probes vector.
220 be_derived_probe_group* be_derived_probes;
221 dwarf_derived_probe_group* dwarf_derived_probes;
e6fe60e7 222 kprobe_derived_probe_group* kprobe_derived_probes;
dd225250 223 hwbkpt_derived_probe_group* hwbkpt_derived_probes;
83ea76b1 224 perf_derived_probe_group* perf_derived_probes;
888af770 225 uprobe_derived_probe_group* uprobe_derived_probes;
935447c8 226 utrace_derived_probe_group* utrace_derived_probes;
a96d1db0 227 itrace_derived_probe_group* itrace_derived_probes;
935447c8 228 task_finder_derived_probe_group* task_finder_derived_probes;
b20febf3
FCE
229 timer_derived_probe_group* timer_derived_probes;
230 profile_derived_probe_group* profile_derived_probes;
231 mark_derived_probe_group* mark_derived_probes;
0a6f5a3f 232 tracepoint_derived_probe_group* tracepoint_derived_probes;
b20febf3 233 hrtimer_derived_probe_group* hrtimer_derived_probes;
604eef3b 234 procfs_derived_probe_group* procfs_derived_probes;
28f569c2 235
f9355a6c 236 // NB: It is very important for all of the above (and below) fields
85007c04 237 // to be cleared in the systemtap_session ctor (session.cxx).
177a8ead
FCE
238
239 // unparser data
240 translator_output* op;
241 unparser* up;
242
84048984
FCE
243 // some symbol addresses
244 // XXX: these belong elsewhere; perhaps the dwflpp instance
245 Dwarf_Addr sym_kprobes_text_start;
246 Dwarf_Addr sym_kprobes_text_end;
247 Dwarf_Addr sym_stext;
1d3a40b6 248
a8368458 249 // List of libdwfl module names to extract symbol/unwind data for.
1a0dbc5a 250 std::set<std::string> unwindsym_modules;
ef06c938 251 bool unwindsym_ldd;
cbf5ebe1 252 struct module_cache* module_cache;
a8368458 253
28f569c2 254 // NB: It is very important for all of the above (and below) fields
85007c04 255 // to be cleared in the systemtap_session ctor (session.cxx).
28f569c2 256
7e41d3dc 257 std::set<std::string> seen_errors;
ab54fa85 258 std::set<std::string> seen_warnings;
57a56e00 259 unsigned num_errors () { return seen_errors.size() + (panic_warnings ? seen_warnings.size() : 0); }
cfd621bc 260
2ed04863
WC
261 std::set<std::string> rpms_to_install;
262
177a8ead 263 // void print_error (const parse_error& e);
cfd621bc
FCE
264 const token* last_token;
265 void print_token (std::ostream& o, const token* tok);
177a8ead 266 void print_error (const semantic_error& e);
1b1b4ceb 267 void print_error_source (std::ostream&, std::string&, const token* tok);
cfd621bc 268 void print_warning (const std::string& w, const token* tok = 0);
aa4d21c0 269 void printscript(std::ostream& o);
b20febf3 270
28f569c2 271 // NB: It is very important for all of the above (and below) fields
85007c04
DB
272 // to be cleared in the systemtap_session ctor (session.cxx).
273};
274
177a8ead 275
49abf162 276// global counter of SIGINT/SIGTERM's received
85007c04
DB
277extern int pending_interrupts;
278
279int passes_0_4 ();
49abf162 280
177a8ead 281#endif // SESSION_H
73267b89
JS
282
283/* vim: set sw=2 ts=8 cino=>4,n-2,{2,^-2,t0,(0,u0,w1,M1 : */
This page took 0.124206 seconds and 5 git commands to generate.