]>
Commit | Line | Data |
---|---|---|
177a8ead FCE |
1 | // -*- C++ -*- |
2 | // Copyright (C) 2005 Red Hat Inc. | |
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> | |
17 | ||
18 | ||
19 | // forward decls for all referenced systemtap types | |
20 | struct match_node; | |
21 | struct stapfile; | |
22 | struct vardecl; | |
23 | struct functiondecl; | |
24 | struct derived_probe; | |
25 | struct embeddedcode; | |
26 | struct translator_output; | |
27 | struct unparser; | |
28 | struct semantic_error; | |
29 | ||
30 | ||
31 | // XXX: a generalized form of this descriptor could be associated with | |
32 | // a vardecl instead of out here at the systemtap_session level. | |
33 | struct statistic_decl | |
34 | { | |
35 | statistic_decl() | |
36 | : type(none), | |
37 | logarithmic_buckets(0), | |
38 | linear_low(0), linear_high(0), linear_step(0) | |
39 | {} | |
40 | enum { none, linear, logarithmic } type; | |
41 | int64_t logarithmic_buckets; | |
42 | int64_t linear_low; | |
43 | int64_t linear_high; | |
44 | int64_t linear_step; | |
07c17d67 GH |
45 | bool operator==(statistic_decl const & other) |
46 | { | |
47 | return type == other.type | |
48 | && logarithmic_buckets == other.logarithmic_buckets | |
49 | && linear_low == other.linear_low | |
50 | && linear_high == other.linear_high | |
51 | && linear_step == other.linear_step; | |
52 | } | |
177a8ead FCE |
53 | }; |
54 | ||
55 | ||
56 | struct systemtap_session | |
57 | { | |
58 | systemtap_session (); | |
59 | ||
60 | // command line args | |
61 | std::vector<std::string> include_path; | |
62 | std::vector<std::string> macros; | |
63 | std::vector<std::string> args; | |
64 | std::string kernel_release; | |
44ce8ed5 | 65 | std::string architecture; |
177a8ead FCE |
66 | std::string runtime_path; |
67 | std::string module_name; | |
68 | std::string output_file; | |
69 | std::string cmd; | |
70 | int target_pid; | |
71 | int last_pass; | |
177a8ead FCE |
72 | bool verbose; |
73 | bool keep_tmpdir; | |
74 | bool guru_mode; | |
75 | bool bulk_mode; | |
cbfbbf69 | 76 | bool unoptimized; |
177a8ead FCE |
77 | int buffer_size; |
78 | ||
79 | // temporary directory for module builds etc. | |
80 | // hazardous - it is "rm -rf"'d at exit | |
81 | std::string tmpdir; | |
82 | std::string translated_source; // C source code | |
83 | ||
84 | match_node* pattern_root; | |
85 | void register_library_aliases(); | |
86 | ||
87 | // parse trees for the various script files | |
88 | stapfile* user_file; | |
89 | std::vector<stapfile*> library_files; | |
90 | ||
91 | // resolved globals/functions/probes for the run as a whole | |
92 | std::vector<stapfile*> files; | |
93 | std::vector<vardecl*> globals; | |
94 | std::vector<functiondecl*> functions; | |
95 | std::vector<derived_probe*> probes; | |
96 | std::vector<embeddedcode*> embeds; | |
97 | std::map<std::string, statistic_decl> stat_decls; | |
98 | // XXX: vector<*> instead please? | |
99 | ||
100 | // module-referencing file handles | |
101 | std::map<std::string,int> module_fds; | |
102 | ||
103 | // unparser data | |
104 | translator_output* op; | |
105 | unparser* up; | |
106 | ||
107 | unsigned num_errors; | |
108 | // void print_error (const parse_error& e); | |
109 | void print_error (const semantic_error& e); | |
110 | }; | |
111 | ||
112 | ||
113 | #endif // SESSION_H |