blob: a60611d453a18b4f532a4940d4606e3fb335b61d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
|
// -*- C++ -*-
// Copyright (C) 2005 Red Hat Inc.
//
// This file is part of systemtap, and is free software. You can
// redistribute it and/or modify it under the terms of the GNU General
// Public License (GPL); either version 2, or (at your option) any
// later version.
#ifndef SESSION_H
#define SESSION_H
#include "elaborate.h"
#include <string>
#include <vector>
#include <iostream>
#include <sstream>
#include <map>
extern "C" {
#include <elfutils/libdw.h>
}
// forward decls for all referenced systemtap types
struct match_node;
struct stapfile;
struct vardecl;
struct functiondecl;
struct derived_probe_group_container;
struct embeddedcode;
struct translator_output;
struct unparser;
struct semantic_error;
// XXX: a generalized form of this descriptor could be associated with
// a vardecl instead of out here at the systemtap_session level.
struct statistic_decl
{
statistic_decl()
: type(none),
logarithmic_buckets(0),
linear_low(0), linear_high(0), linear_step(0)
{}
enum { none, linear, logarithmic } type;
int64_t logarithmic_buckets;
int64_t linear_low;
int64_t linear_high;
int64_t linear_step;
bool operator==(statistic_decl const & other)
{
return type == other.type
&& logarithmic_buckets == other.logarithmic_buckets
&& linear_low == other.linear_low
&& linear_high == other.linear_high
&& linear_step == other.linear_step;
}
};
struct systemtap_session
{
systemtap_session ();
// command line args
std::vector<std::string> include_path;
std::vector<std::string> macros;
std::vector<std::string> args;
std::string kernel_release;
std::string kernel_base_release;
std::string architecture;
std::string runtime_path;
std::string data_path;
std::string module_name;
std::string output_file;
std::string cmd;
int target_pid;
int last_pass;
unsigned verbose;
unsigned timing;
bool keep_tmpdir;
bool guru_mode;
bool bulk_mode;
bool unoptimized;
bool merge;
int buffer_size;
unsigned perfmon;
// Cache data
bool use_cache;
std::string cache_path;
std::string hash_path;
// temporary directory for module builds etc.
// hazardous - it is "rm -rf"'d at exit
std::string tmpdir;
std::string translated_source; // C source code
match_node* pattern_root;
void register_library_aliases();
// parse trees for the various script files
stapfile* user_file;
std::vector<stapfile*> library_files;
// resolved globals/functions/probes for the run as a whole
std::vector<stapfile*> files;
std::vector<vardecl*> globals;
std::vector<functiondecl*> functions;
derived_probe_group_container probes;
std::vector<embeddedcode*> embeds;
std::map<std::string, statistic_decl> stat_decls;
// XXX: vector<*> instead please?
// module-referencing file handles
std::map<std::string,int> module_fds;
// unparser data
translator_output* op;
unparser* up;
// kprobes_text data
bool kprobes_text_initialized;
Dwarf_Addr kprobes_text_start;
Dwarf_Addr kprobes_text_end;
unsigned num_errors;
// void print_error (const parse_error& e);
void print_error (const semantic_error& e);
};
#endif // SESSION_H
|