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