]>
Commit | Line | Data |
---|---|---|
177a8ead | 1 | // -*- C++ -*- |
44f75386 | 2 | // Copyright (C) 2005-2007 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 |
19 | extern "C" { |
20 | #include <elfutils/libdw.h> | |
21 | } | |
22 | ||
177a8ead FCE |
23 | |
24 | // forward decls for all referenced systemtap types | |
25 | struct match_node; | |
26 | struct stapfile; | |
27 | struct vardecl; | |
28 | struct functiondecl; | |
b20febf3 FCE |
29 | struct derived_probe; |
30 | struct be_derived_probe_group; | |
31 | struct dwarf_derived_probe_group; | |
888af770 | 32 | struct uprobe_derived_probe_group; |
b20febf3 FCE |
33 | struct timer_derived_probe_group; |
34 | struct profile_derived_probe_group; | |
35 | struct mark_derived_probe_group; | |
36 | struct hrtimer_derived_probe_group; | |
37 | struct perfmon_derived_probe_group; | |
177a8ead FCE |
38 | struct embeddedcode; |
39 | struct translator_output; | |
40 | struct unparser; | |
41 | struct semantic_error; | |
42 | ||
43 | ||
44 | // XXX: a generalized form of this descriptor could be associated with | |
45 | // a vardecl instead of out here at the systemtap_session level. | |
46 | struct statistic_decl | |
47 | { | |
48 | statistic_decl() | |
49 | : type(none), | |
50 | logarithmic_buckets(0), | |
51 | linear_low(0), linear_high(0), linear_step(0) | |
52 | {} | |
53 | enum { none, linear, logarithmic } type; | |
54 | int64_t logarithmic_buckets; | |
55 | int64_t linear_low; | |
56 | int64_t linear_high; | |
57 | int64_t linear_step; | |
07c17d67 GH |
58 | bool operator==(statistic_decl const & other) |
59 | { | |
60 | return type == other.type | |
61 | && logarithmic_buckets == other.logarithmic_buckets | |
62 | && linear_low == other.linear_low | |
63 | && linear_high == other.linear_high | |
64 | && linear_step == other.linear_step; | |
65 | } | |
177a8ead FCE |
66 | }; |
67 | ||
68 | ||
69 | struct systemtap_session | |
70 | { | |
71 | systemtap_session (); | |
b20febf3 | 72 | // NB: new POD members likely need to be explicitly cleared in the ctor. |
888af770 | 73 | // See elaborate.cxx. |
177a8ead FCE |
74 | |
75 | // command line args | |
76 | std::vector<std::string> include_path; | |
77 | std::vector<std::string> macros; | |
78 | std::vector<std::string> args; | |
79 | std::string kernel_release; | |
197a4d62 | 80 | std::string kernel_base_release; |
44ce8ed5 | 81 | std::string architecture; |
177a8ead | 82 | std::string runtime_path; |
1b78aef5 | 83 | std::string data_path; |
177a8ead FCE |
84 | std::string module_name; |
85 | std::string output_file; | |
86 | std::string cmd; | |
87 | int target_pid; | |
88 | int last_pass; | |
b0ee93c4 | 89 | unsigned verbose; |
4b17d6af | 90 | unsigned timing; |
177a8ead FCE |
91 | bool keep_tmpdir; |
92 | bool guru_mode; | |
93 | bool bulk_mode; | |
cbfbbf69 | 94 | bool unoptimized; |
f272aacc | 95 | bool merge; |
177a8ead | 96 | int buffer_size; |
47dd066d | 97 | unsigned perfmon; |
84048984 | 98 | bool symtab; /* true: emit symbol table at translation time; false: let staprun do it. */ |
44f75386 | 99 | bool prologue_searching; |
c3a3c0c9 | 100 | bool tapset_compile_coverage; |
177a8ead | 101 | |
1b78aef5 DS |
102 | // Cache data |
103 | bool use_cache; | |
104 | std::string cache_path; | |
105 | std::string hash_path; | |
106 | ||
177a8ead FCE |
107 | // temporary directory for module builds etc. |
108 | // hazardous - it is "rm -rf"'d at exit | |
109 | std::string tmpdir; | |
110 | std::string translated_source; // C source code | |
111 | ||
112 | match_node* pattern_root; | |
113 | void register_library_aliases(); | |
114 | ||
115 | // parse trees for the various script files | |
116 | stapfile* user_file; | |
117 | std::vector<stapfile*> library_files; | |
118 | ||
119 | // resolved globals/functions/probes for the run as a whole | |
120 | std::vector<stapfile*> files; | |
121 | std::vector<vardecl*> globals; | |
122 | std::vector<functiondecl*> functions; | |
b20febf3 | 123 | std::vector<derived_probe*> probes; // see also *_probes groups below |
177a8ead FCE |
124 | std::vector<embeddedcode*> embeds; |
125 | std::map<std::string, statistic_decl> stat_decls; | |
c3a3c0c9 WC |
126 | // track things that are removed |
127 | std::vector<vardecl*> unused_globals; | |
128 | std::vector<derived_probe*> unused_probes; // see also *_probes groups below | |
129 | std::vector<functiondecl*> unused_functions; | |
177a8ead FCE |
130 | // XXX: vector<*> instead please? |
131 | ||
b20febf3 FCE |
132 | // Every probe in these groups must also appear in the |
133 | // session.probes vector. | |
134 | be_derived_probe_group* be_derived_probes; | |
135 | dwarf_derived_probe_group* dwarf_derived_probes; | |
888af770 | 136 | uprobe_derived_probe_group* uprobe_derived_probes; |
b20febf3 FCE |
137 | timer_derived_probe_group* timer_derived_probes; |
138 | profile_derived_probe_group* profile_derived_probes; | |
139 | mark_derived_probe_group* mark_derived_probes; | |
140 | hrtimer_derived_probe_group* hrtimer_derived_probes; | |
141 | perfmon_derived_probe_group* perfmon_derived_probes; | |
177a8ead FCE |
142 | |
143 | // unparser data | |
144 | translator_output* op; | |
145 | unparser* up; | |
146 | ||
84048984 FCE |
147 | // some symbol addresses |
148 | // XXX: these belong elsewhere; perhaps the dwflpp instance | |
149 | Dwarf_Addr sym_kprobes_text_start; | |
150 | Dwarf_Addr sym_kprobes_text_end; | |
151 | Dwarf_Addr sym_stext; | |
1d3a40b6 | 152 | |
7e41d3dc FCE |
153 | std::set<std::string> seen_errors; |
154 | unsigned num_errors () { return seen_errors.size(); } | |
177a8ead FCE |
155 | // void print_error (const parse_error& e); |
156 | void print_error (const semantic_error& e); | |
b20febf3 FCE |
157 | |
158 | // reNB: new POD members likely need to be explicitly cleared in the ctor. | |
177a8ead FCE |
159 | }; |
160 | ||
161 | ||
162 | #endif // SESSION_H |