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