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