2 // Copyright (C) 2005-2009 Red Hat Inc.
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
20 #include <elfutils/libdw.h>
24 // forward decls for all referenced systemtap types
31 struct be_derived_probe_group
;
32 struct dwarf_derived_probe_group
;
33 struct kprobe_derived_probe_group
;
34 struct uprobe_derived_probe_group
;
35 struct utrace_derived_probe_group
;
36 struct itrace_derived_probe_group
;
37 struct task_finder_derived_probe_group
;
38 struct timer_derived_probe_group
;
39 struct profile_derived_probe_group
;
40 struct mark_derived_probe_group
;
41 struct tracepoint_derived_probe_group
;
42 struct hrtimer_derived_probe_group
;
43 struct perfmon_derived_probe_group
;
44 struct procfs_derived_probe_group
;
46 struct translator_output
;
48 struct semantic_error
;
50 struct update_visitor
;
53 // XXX: a generalized form of this descriptor could be associated with
54 // a vardecl instead of out here at the systemtap_session level.
59 linear_low(0), linear_high(0), linear_step(0)
61 enum { none
, linear
, logarithmic
} type
;
65 bool operator==(statistic_decl
const & other
)
67 return type
== other
.type
68 && linear_low
== other
.linear_low
69 && linear_high
== other
.linear_high
70 && linear_step
== other
.linear_step
;
75 struct systemtap_session
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).
83 std::vector
<std::string
> include_path
;
84 std::vector
<std::string
> macros
;
85 std::vector
<std::string
> args
;
86 std::string kernel_release
;
87 std::string kernel_base_release
;
88 std::string kernel_build_tree
;
89 std::string architecture
;
90 std::string runtime_path
;
91 std::string data_path
;
92 std::string cert_db_path
;
93 std::string module_name
;
94 std::string stapconf_name
;
95 std::string output_file
;
96 std::string size_option
;
100 unsigned perpass_verbose
[5];
109 bool suppress_warnings
;
112 bool symtab
; /* true: emit symbol table at translation time; false: let staprun do it. */
113 bool prologue_searching
;
114 bool tapset_compile_coverage
;
116 bool load_only
; // flight recorder mode
119 // NB: It is very important for all of the above (and below) fields
120 // to be cleared in the systemtap_session ctor (elaborate.cxx)
121 // and/or main.cxx(main).
125 std::string cache_path
;
126 std::string hash_path
;
127 std::string stapconf_path
;
128 std::string tracequery_path
;
130 // dwarfless operation
132 std::string kernel_symtab_path
;
139 // NB: It is very important for all of the above (and below) fields
140 // to be cleared in the systemtap_session ctor (elaborate.cxx)
141 // and/or main.cxx(main).
143 // temporary directory for module builds etc.
144 // hazardous - it is "rm -rf"'d at exit
146 std::string translated_source
; // C source code
148 match_node
* pattern_root
;
149 void register_library_aliases();
151 // parse trees for the various script files
153 std::vector
<stapfile
*> library_files
;
155 // filters to run over all code before symbol resolution
156 // e.g. @cast expansion
157 std::vector
<update_visitor
*> code_filters
;
159 // resolved globals/functions/probes for the run as a whole
160 std::vector
<stapfile
*> files
;
161 std::vector
<vardecl
*> globals
;
162 std::map
<std::string
,functiondecl
*> functions
;
163 std::vector
<derived_probe
*> probes
; // see also *_probes groups below
164 std::vector
<embeddedcode
*> embeds
;
165 std::map
<std::string
, statistic_decl
> stat_decls
;
166 // track things that are removed
167 std::vector
<vardecl
*> unused_globals
;
168 std::vector
<derived_probe
*> unused_probes
; // see also *_probes groups below
169 std::vector
<functiondecl
*> unused_functions
;
170 // XXX: vector<*> instead please?
172 // Every probe in these groups must also appear in the
173 // session.probes vector.
174 be_derived_probe_group
* be_derived_probes
;
175 dwarf_derived_probe_group
* dwarf_derived_probes
;
176 kprobe_derived_probe_group
* kprobe_derived_probes
;
177 uprobe_derived_probe_group
* uprobe_derived_probes
;
178 utrace_derived_probe_group
* utrace_derived_probes
;
179 itrace_derived_probe_group
* itrace_derived_probes
;
180 task_finder_derived_probe_group
* task_finder_derived_probes
;
181 timer_derived_probe_group
* timer_derived_probes
;
182 profile_derived_probe_group
* profile_derived_probes
;
183 mark_derived_probe_group
* mark_derived_probes
;
184 tracepoint_derived_probe_group
* tracepoint_derived_probes
;
185 hrtimer_derived_probe_group
* hrtimer_derived_probes
;
186 perfmon_derived_probe_group
* perfmon_derived_probes
;
187 procfs_derived_probe_group
* procfs_derived_probes
;
189 // NB: It is very important for all of the above (and below) fields
190 // to be cleared in the systemtap_session ctor (elaborate.cxx)
191 // and/or main.cxx(main).
194 translator_output
* op
;
197 // some symbol addresses
198 // XXX: these belong elsewhere; perhaps the dwflpp instance
199 Dwarf_Addr sym_kprobes_text_start
;
200 Dwarf_Addr sym_kprobes_text_end
;
201 Dwarf_Addr sym_stext
;
203 // List of libdwfl module names to extract symbol/unwind data for.
204 std::set
<std::string
> unwindsym_modules
;
205 struct module_cache
* module_cache
;
207 // NB: It is very important for all of the above (and below) fields
208 // to be cleared in the systemtap_session ctor (elaborate.cxx)
209 // and/or main.cxx(main).
211 std::set
<std::string
> seen_errors
;
212 std::set
<std::string
> seen_warnings
;
213 unsigned num_errors () { return seen_errors
.size(); }
215 // void print_error (const parse_error& e);
216 const token
* last_token
;
217 void print_token (std::ostream
& o
, const token
* tok
);
218 void print_error (const semantic_error
& e
);
219 void print_error_source (std::ostream
&, std::string
&, const token
* tok
);
220 void print_warning (const std::string
& w
, const token
* tok
= 0);
222 // NB: It is very important for all of the above (and below) fields
223 // to be cleared in the systemtap_session ctor (elaborate.cxx)
224 // and/or main.cxx(main).
228 // global counter of SIGINT/SIGTERM's received
229 extern int pending_interrupts
;
233 /* vim: set sw=2 ts=8 cino=>4,n-2,{2,^-2,t0,(0,u0,w1,M1 : */