]> sourceware.org Git - systemtap.git/blame - session.h
Provide dwarf module names as defaults in @cast()s
[systemtap.git] / session.h
CommitLineData
177a8ead 1// -*- C++ -*-
6643650d 2// Copyright (C) 2005-2008 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;
888af770 33struct uprobe_derived_probe_group;
935447c8 34struct utrace_derived_probe_group;
a96d1db0 35struct itrace_derived_probe_group;
935447c8 36struct task_finder_derived_probe_group;
b20febf3
FCE
37struct timer_derived_probe_group;
38struct profile_derived_probe_group;
39struct mark_derived_probe_group;
40struct hrtimer_derived_probe_group;
41struct perfmon_derived_probe_group;
604eef3b 42struct procfs_derived_probe_group;
177a8ead
FCE
43struct embeddedcode;
44struct translator_output;
45struct unparser;
46struct semantic_error;
405b71b8 47struct module_cache;
177a8ead
FCE
48
49
50// XXX: a generalized form of this descriptor could be associated with
51// a vardecl instead of out here at the systemtap_session level.
52struct statistic_decl
53{
54 statistic_decl()
dff50e09 55 : type(none),
177a8ead 56 linear_low(0), linear_high(0), linear_step(0)
dff50e09 57 {}
177a8ead 58 enum { none, linear, logarithmic } type;
177a8ead
FCE
59 int64_t linear_low;
60 int64_t linear_high;
61 int64_t linear_step;
07c17d67
GH
62 bool operator==(statistic_decl const & other)
63 {
dff50e09 64 return type == other.type
07c17d67
GH
65 && linear_low == other.linear_low
66 && linear_high == other.linear_high
67 && linear_step == other.linear_step;
68 }
177a8ead
FCE
69};
70
71
72struct systemtap_session
73{
74 systemtap_session ();
b20febf3 75 // NB: new POD members likely need to be explicitly cleared in the ctor.
888af770 76 // See elaborate.cxx.
177a8ead
FCE
77
78 // command line args
79 std::vector<std::string> include_path;
80 std::vector<std::string> macros;
81 std::vector<std::string> args;
82 std::string kernel_release;
197a4d62 83 std::string kernel_base_release;
7471ea1f 84 std::string kernel_build_tree;
44ce8ed5 85 std::string architecture;
177a8ead 86 std::string runtime_path;
1b78aef5 87 std::string data_path;
177a8ead 88 std::string module_name;
de0db58a 89 std::string stapconf_name;
177a8ead
FCE
90 std::string output_file;
91 std::string cmd;
92 int target_pid;
93 int last_pass;
e0b4e89d 94 unsigned perpass_verbose[5];
b0ee93c4 95 unsigned verbose;
a9e8f7e0 96 bool timing;
177a8ead
FCE
97 bool keep_tmpdir;
98 bool guru_mode;
16442b90 99 bool listing_mode;
177a8ead 100 bool bulk_mode;
cbfbbf69 101 bool unoptimized;
f272aacc 102 bool merge;
a9e8f7e0 103 bool suppress_warnings;
177a8ead 104 int buffer_size;
47dd066d 105 unsigned perfmon;
84048984 106 bool symtab; /* true: emit symbol table at translation time; false: let staprun do it. */
44f75386 107 bool prologue_searching;
c3a3c0c9 108 bool tapset_compile_coverage;
6274464e 109 bool need_uprobes;
2fa2a091 110 bool load_only; // flight recorder mode
177a8ead 111
1b78aef5
DS
112 // Cache data
113 bool use_cache;
114 std::string cache_path;
115 std::string hash_path;
5c54d49e 116 std::string stapconf_path;
1b78aef5 117
5f0a03a6
JK
118 // dwarfless operation
119 bool consult_symtab;
120 std::string kernel_symtab_path;
121 bool ignore_vmlinux;
122 bool ignore_dwarf;
123
177a8ead
FCE
124 // temporary directory for module builds etc.
125 // hazardous - it is "rm -rf"'d at exit
126 std::string tmpdir;
127 std::string translated_source; // C source code
128
129 match_node* pattern_root;
130 void register_library_aliases();
131
132 // parse trees for the various script files
133 stapfile* user_file;
134 std::vector<stapfile*> library_files;
135
136 // resolved globals/functions/probes for the run as a whole
137 std::vector<stapfile*> files;
138 std::vector<vardecl*> globals;
f76427a2 139 std::map<std::string,functiondecl*> functions;
b20febf3 140 std::vector<derived_probe*> probes; // see also *_probes groups below
177a8ead
FCE
141 std::vector<embeddedcode*> embeds;
142 std::map<std::string, statistic_decl> stat_decls;
c3a3c0c9
WC
143 // track things that are removed
144 std::vector<vardecl*> unused_globals;
145 std::vector<derived_probe*> unused_probes; // see also *_probes groups below
146 std::vector<functiondecl*> unused_functions;
177a8ead
FCE
147 // XXX: vector<*> instead please?
148
b20febf3
FCE
149 // Every probe in these groups must also appear in the
150 // session.probes vector.
151 be_derived_probe_group* be_derived_probes;
152 dwarf_derived_probe_group* dwarf_derived_probes;
888af770 153 uprobe_derived_probe_group* uprobe_derived_probes;
935447c8 154 utrace_derived_probe_group* utrace_derived_probes;
a96d1db0 155 itrace_derived_probe_group* itrace_derived_probes;
935447c8 156 task_finder_derived_probe_group* task_finder_derived_probes;
b20febf3
FCE
157 timer_derived_probe_group* timer_derived_probes;
158 profile_derived_probe_group* profile_derived_probes;
159 mark_derived_probe_group* mark_derived_probes;
160 hrtimer_derived_probe_group* hrtimer_derived_probes;
161 perfmon_derived_probe_group* perfmon_derived_probes;
604eef3b 162 procfs_derived_probe_group* procfs_derived_probes;
177a8ead
FCE
163
164 // unparser data
165 translator_output* op;
166 unparser* up;
167
84048984
FCE
168 // some symbol addresses
169 // XXX: these belong elsewhere; perhaps the dwflpp instance
170 Dwarf_Addr sym_kprobes_text_start;
171 Dwarf_Addr sym_kprobes_text_end;
172 Dwarf_Addr sym_stext;
1d3a40b6 173
a8368458 174 // List of libdwfl module names to extract symbol/unwind data for.
1a0dbc5a 175 std::set<std::string> unwindsym_modules;
cbf5ebe1 176 struct module_cache* module_cache;
a8368458 177
7e41d3dc 178 std::set<std::string> seen_errors;
ab54fa85 179 std::set<std::string> seen_warnings;
7e41d3dc 180 unsigned num_errors () { return seen_errors.size(); }
cfd621bc 181
177a8ead 182 // void print_error (const parse_error& e);
cfd621bc
FCE
183 const token* last_token;
184 void print_token (std::ostream& o, const token* tok);
177a8ead 185 void print_error (const semantic_error& e);
1b1b4ceb 186 void print_error_source (std::ostream&, std::string&, const token* tok);
cfd621bc 187 void print_warning (const std::string& w, const token* tok = 0);
b20febf3
FCE
188
189 // reNB: new POD members likely need to be explicitly cleared in the ctor.
177a8ead
FCE
190};
191
192
49abf162
FCE
193// global counter of SIGINT/SIGTERM's received
194extern int pending_interrupts;
195
177a8ead 196#endif // SESSION_H
73267b89
JS
197
198/* vim: set sw=2 ts=8 cino=>4,n-2,{2,^-2,t0,(0,u0,w1,M1 : */
This page took 0.078102 seconds and 5 git commands to generate.