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