]> sourceware.org Git - systemtap.git/blob - session.h
2006-12-19 Frank Ch. Eigler <fche@redhat.com>
[systemtap.git] / session.h
1 // -*- C++ -*-
2 // Copyright (C) 2005, 2006 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 #include <set>
18
19 extern "C" {
20 #include <elfutils/libdw.h>
21 }
22
23
24 // forward decls for all referenced systemtap types
25 struct match_node;
26 struct stapfile;
27 struct vardecl;
28 struct functiondecl;
29 struct derived_probe;
30 struct be_derived_probe_group;
31 struct dwarf_derived_probe_group;
32 struct timer_derived_probe_group;
33 struct profile_derived_probe_group;
34 struct mark_derived_probe_group;
35 struct hrtimer_derived_probe_group;
36 struct perfmon_derived_probe_group;
37 struct embeddedcode;
38 struct translator_output;
39 struct unparser;
40 struct semantic_error;
41
42
43 // XXX: a generalized form of this descriptor could be associated with
44 // a vardecl instead of out here at the systemtap_session level.
45 struct statistic_decl
46 {
47 statistic_decl()
48 : type(none),
49 logarithmic_buckets(0),
50 linear_low(0), linear_high(0), linear_step(0)
51 {}
52 enum { none, linear, logarithmic } type;
53 int64_t logarithmic_buckets;
54 int64_t linear_low;
55 int64_t linear_high;
56 int64_t linear_step;
57 bool operator==(statistic_decl const & other)
58 {
59 return type == other.type
60 && logarithmic_buckets == other.logarithmic_buckets
61 && linear_low == other.linear_low
62 && linear_high == other.linear_high
63 && linear_step == other.linear_step;
64 }
65 };
66
67
68 struct systemtap_session
69 {
70 systemtap_session ();
71 // NB: new POD members likely need to be explicitly cleared in the ctor.
72
73 // command line args
74 std::vector<std::string> include_path;
75 std::vector<std::string> macros;
76 std::vector<std::string> args;
77 std::string kernel_release;
78 std::string kernel_base_release;
79 std::string architecture;
80 std::string runtime_path;
81 std::string data_path;
82 std::string module_name;
83 std::string output_file;
84 std::string cmd;
85 int target_pid;
86 int last_pass;
87 unsigned verbose;
88 unsigned timing;
89 bool keep_tmpdir;
90 bool guru_mode;
91 bool bulk_mode;
92 bool unoptimized;
93 bool merge;
94 int buffer_size;
95 unsigned perfmon;
96 bool symtab;
97
98 // Cache data
99 bool use_cache;
100 std::string cache_path;
101 std::string hash_path;
102
103 // temporary directory for module builds etc.
104 // hazardous - it is "rm -rf"'d at exit
105 std::string tmpdir;
106 std::string translated_source; // C source code
107
108 match_node* pattern_root;
109 void register_library_aliases();
110
111 // parse trees for the various script files
112 stapfile* user_file;
113 std::vector<stapfile*> library_files;
114
115 // resolved globals/functions/probes for the run as a whole
116 std::vector<stapfile*> files;
117 std::vector<vardecl*> globals;
118 std::vector<functiondecl*> functions;
119 std::vector<derived_probe*> probes; // see also *_probes groups below
120 std::vector<embeddedcode*> embeds;
121 std::map<std::string, statistic_decl> stat_decls;
122 // XXX: vector<*> instead please?
123
124 // Every probe in these groups must also appear in the
125 // session.probes vector.
126 be_derived_probe_group* be_derived_probes;
127 dwarf_derived_probe_group* dwarf_derived_probes;
128 timer_derived_probe_group* timer_derived_probes;
129 profile_derived_probe_group* profile_derived_probes;
130 mark_derived_probe_group* mark_derived_probes;
131 hrtimer_derived_probe_group* hrtimer_derived_probes;
132 perfmon_derived_probe_group* perfmon_derived_probes;
133
134 // unparser data
135 translator_output* op;
136 unparser* up;
137
138 // kprobes_text data
139 bool kprobes_text_initialized;
140 Dwarf_Addr kprobes_text_start;
141 Dwarf_Addr kprobes_text_end;
142
143 std::set<std::string> seen_errors;
144 unsigned num_errors () { return seen_errors.size(); }
145 // void print_error (const parse_error& e);
146 void print_error (const semantic_error& e);
147
148 // reNB: new POD members likely need to be explicitly cleared in the ctor.
149 };
150
151
152 #endif // SESSION_H
This page took 0.041845 seconds and 5 git commands to generate.