]> sourceware.org Git - systemtap.git/blame - session.h
Fixed PR 11480 by updating rpc.stp and its tests.
[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
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;
70e6d6c9 93 std::set<std::string> kernel_exports;
44ce8ed5 94 std::string architecture;
177a8ead 95 std::string runtime_path;
1b78aef5 96 std::string data_path;
98f552c2 97 std::string cert_db_path;
177a8ead 98 std::string module_name;
de0db58a 99 std::string stapconf_name;
177a8ead 100 std::string output_file;
701c41be 101 std::string size_option;
177a8ead 102 std::string cmd;
db135493 103 std::string compatible; // use (strverscmp(s.compatible.c_str(), "N.M") >= 0)
177a8ead
FCE
104 int target_pid;
105 int last_pass;
e0b4e89d 106 unsigned perpass_verbose[5];
b0ee93c4 107 unsigned verbose;
a9e8f7e0 108 bool timing;
177a8ead
FCE
109 bool keep_tmpdir;
110 bool guru_mode;
16442b90 111 bool listing_mode;
8c39844b 112 bool listing_mode_vars;
177a8ead 113 bool bulk_mode;
cbfbbf69 114 bool unoptimized;
a9e8f7e0 115 bool suppress_warnings;
57a56e00 116 bool panic_warnings;
177a8ead 117 int buffer_size;
84048984 118 bool symtab; /* true: emit symbol table at translation time; false: let staprun do it. */
44f75386 119 bool prologue_searching;
c3a3c0c9 120 bool tapset_compile_coverage;
6274464e 121 bool need_uprobes;
2fa2a091 122 bool load_only; // flight recorder mode
2f54c4fe 123 bool unprivileged;
c72dd3c7 124 bool omit_werror;
177a8ead 125
28f569c2
FCE
126 // NB: It is very important for all of the above (and below) fields
127 // to be cleared in the systemtap_session ctor (elaborate.cxx)
128 // and/or main.cxx(main).
129
1b78aef5 130 // Cache data
d105f664
JS
131 bool use_cache; // control all caching
132 bool use_script_cache; // control caching of pass-3/4 output
133 bool poison_cache; // consider the cache to be write-only
134 std::string cache_path; // usually ~/.systemtap/cache
135 std::string hash_path; // path to the cached script module
136 std::string stapconf_path; // path to the cached stapconf
137 hash *base_hash; // hash common to all caching
1b78aef5 138
5f0a03a6
JK
139 // dwarfless operation
140 bool consult_symtab;
141 std::string kernel_symtab_path;
142 bool ignore_vmlinux;
143 bool ignore_dwarf;
144
3bd0d4df
RA
145 // Skip bad $ vars
146 bool skip_badvars;
147
28f569c2
FCE
148 // NB: It is very important for all of the above (and below) fields
149 // to be cleared in the systemtap_session ctor (elaborate.cxx)
150 // and/or main.cxx(main).
151
177a8ead
FCE
152 // temporary directory for module builds etc.
153 // hazardous - it is "rm -rf"'d at exit
154 std::string tmpdir;
155 std::string translated_source; // C source code
156
157 match_node* pattern_root;
158 void register_library_aliases();
159
160 // parse trees for the various script files
161 stapfile* user_file;
162 std::vector<stapfile*> library_files;
163
f80d9004
JS
164 // filters to run over all code before symbol resolution
165 // e.g. @cast expansion
166 std::vector<update_visitor*> code_filters;
167
177a8ead
FCE
168 // resolved globals/functions/probes for the run as a whole
169 std::vector<stapfile*> files;
170 std::vector<vardecl*> globals;
f76427a2 171 std::map<std::string,functiondecl*> functions;
b20febf3 172 std::vector<derived_probe*> probes; // see also *_probes groups below
177a8ead
FCE
173 std::vector<embeddedcode*> embeds;
174 std::map<std::string, statistic_decl> stat_decls;
c3a3c0c9
WC
175 // track things that are removed
176 std::vector<vardecl*> unused_globals;
177 std::vector<derived_probe*> unused_probes; // see also *_probes groups below
178 std::vector<functiondecl*> unused_functions;
177a8ead
FCE
179 // XXX: vector<*> instead please?
180
b20febf3
FCE
181 // Every probe in these groups must also appear in the
182 // session.probes vector.
183 be_derived_probe_group* be_derived_probes;
184 dwarf_derived_probe_group* dwarf_derived_probes;
e6fe60e7 185 kprobe_derived_probe_group* kprobe_derived_probes;
dd225250 186 hwbkpt_derived_probe_group* hwbkpt_derived_probes;
83ea76b1 187 perf_derived_probe_group* perf_derived_probes;
888af770 188 uprobe_derived_probe_group* uprobe_derived_probes;
935447c8 189 utrace_derived_probe_group* utrace_derived_probes;
a96d1db0 190 itrace_derived_probe_group* itrace_derived_probes;
935447c8 191 task_finder_derived_probe_group* task_finder_derived_probes;
b20febf3
FCE
192 timer_derived_probe_group* timer_derived_probes;
193 profile_derived_probe_group* profile_derived_probes;
194 mark_derived_probe_group* mark_derived_probes;
0a6f5a3f 195 tracepoint_derived_probe_group* tracepoint_derived_probes;
b20febf3 196 hrtimer_derived_probe_group* hrtimer_derived_probes;
604eef3b 197 procfs_derived_probe_group* procfs_derived_probes;
28f569c2 198
f9355a6c 199 // NB: It is very important for all of the above (and below) fields
28f569c2
FCE
200 // to be cleared in the systemtap_session ctor (elaborate.cxx)
201 // and/or main.cxx(main).
177a8ead
FCE
202
203 // unparser data
204 translator_output* op;
205 unparser* up;
206
84048984
FCE
207 // some symbol addresses
208 // XXX: these belong elsewhere; perhaps the dwflpp instance
209 Dwarf_Addr sym_kprobes_text_start;
210 Dwarf_Addr sym_kprobes_text_end;
211 Dwarf_Addr sym_stext;
1d3a40b6 212
a8368458 213 // List of libdwfl module names to extract symbol/unwind data for.
1a0dbc5a 214 std::set<std::string> unwindsym_modules;
cbf5ebe1 215 struct module_cache* module_cache;
a8368458 216
28f569c2
FCE
217 // NB: It is very important for all of the above (and below) fields
218 // to be cleared in the systemtap_session ctor (elaborate.cxx)
219 // and/or main.cxx(main).
220
7e41d3dc 221 std::set<std::string> seen_errors;
ab54fa85 222 std::set<std::string> seen_warnings;
57a56e00 223 unsigned num_errors () { return seen_errors.size() + (panic_warnings ? seen_warnings.size() : 0); }
cfd621bc 224
2ed04863
WC
225 std::set<std::string> rpms_to_install;
226
177a8ead 227 // void print_error (const parse_error& e);
cfd621bc
FCE
228 const token* last_token;
229 void print_token (std::ostream& o, const token* tok);
177a8ead 230 void print_error (const semantic_error& e);
1b1b4ceb 231 void print_error_source (std::ostream&, std::string&, const token* tok);
cfd621bc 232 void print_warning (const std::string& w, const token* tok = 0);
b20febf3 233
28f569c2
FCE
234 // NB: It is very important for all of the above (and below) fields
235 // to be cleared in the systemtap_session ctor (elaborate.cxx)
236 // and/or main.cxx(main).
177a8ead
FCE
237};
238
239
49abf162
FCE
240// global counter of SIGINT/SIGTERM's received
241extern int pending_interrupts;
242
177a8ead 243#endif // SESSION_H
73267b89
JS
244
245/* vim: set sw=2 ts=8 cino=>4,n-2,{2,^-2,t0,(0,u0,w1,M1 : */
This page took 0.103512 seconds and 5 git commands to generate.