File: tapsets.h

package info (click to toggle)
systemtap 5.1-5
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 47,964 kB
  • sloc: cpp: 80,838; ansic: 54,757; xml: 49,725; exp: 43,665; sh: 11,527; python: 5,003; perl: 2,252; tcl: 1,312; makefile: 1,006; javascript: 149; lisp: 105; awk: 101; asm: 91; java: 70; sed: 16
file content (185 lines) | stat: -rw-r--r-- 6,824 bytes parent folder | download | duplicates (2)
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
// -*- C++ -*-
// Copyright (C) 2005-2019 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 TAPSETS_H
#define TAPSETS_H

#include "config.h"
#include "staptree.h"
#include "elaborate.h"
#include "stringtable.h"
#include "dwflpp.h"

void check_process_probe_kernel_support(systemtap_session& s);

void register_standard_tapsets(systemtap_session& sess);
std::vector<derived_probe_group*> all_session_groups(systemtap_session& s);
std::string common_probe_init (derived_probe* p);
void common_probe_entryfn_prologue (systemtap_session& s, std::string statestr,
                                    std::string statestr2,
				    std::string probe, std::string probe_type,
				    bool overload_processing = true,
				    void (*declaration_callback)(systemtap_session& s, void* data) = NULL,
				    void (*pre_context_callback)(systemtap_session& s, void* data) = NULL,
				    void* callback_data = NULL);
void common_probe_entryfn_epilogue (systemtap_session& s,
				    bool overload_processing,
				    bool schedule_work_safe);

struct be_derived_probe_group;
bool sort_for_bpf(systemtap_session& s,
		  be_derived_probe_group *,
		  std::vector<derived_probe *> &begin_v,
		  std::vector<derived_probe *> &end_v,
                  std::vector<derived_probe *> &error_v);

struct generic_kprobe_derived_probe_group;
struct uprobe_derived_probe_group;
struct perf_derived_probe_group;
struct hrtimer_derived_probe_group;
struct timer_derived_probe_group;
struct tracepoint_derived_probe_group;

struct hwbkpt_derived_probe_group;
struct utrace_derived_probe_group;
struct itrace_derived_probe_group;
struct netfilter_derived_probe_group;
struct profile_derived_probe_group;
struct mark_derived_probe_group;
struct python_derived_probe_group;

typedef std::vector<std::pair<derived_probe *, std::string> >
  sort_for_bpf_probe_arg_vector;

bool sort_for_bpf(systemtap_session& s,
		  generic_kprobe_derived_probe_group *ge,
		  sort_for_bpf_probe_arg_vector &v);
bool sort_for_bpf(systemtap_session& s,
                  procfs_derived_probe_group *pr,
                  sort_for_bpf_probe_arg_vector &v);
bool sort_for_bpf(systemtap_session& s,
		  hrtimer_derived_probe_group *hr,
                  timer_derived_probe_group *t,
                  sort_for_bpf_probe_arg_vector &v);
bool sort_for_bpf(systemtap_session& s,
		  perf_derived_probe_group *pg,
                  sort_for_bpf_probe_arg_vector &v);
bool sort_for_bpf(systemtap_session& s,
		  tracepoint_derived_probe_group *t,
                  sort_for_bpf_probe_arg_vector &v);
bool sort_for_bpf(systemtap_session& s,
		  uprobe_derived_probe_group *u,
                  sort_for_bpf_probe_arg_vector &v);

// PR26234: Warn that a derived probe group is not supported on BPF.
// Will print "<kind> will be ignored":
void warn_for_bpf(systemtap_session& s,
                  hwbkpt_derived_probe_group *dpg,
                  const std::string& kind);
void warn_for_bpf(systemtap_session& s,
                  utrace_derived_probe_group *dpg,
                  const std::string& kind);
void warn_for_bpf(systemtap_session& s,
                  itrace_derived_probe_group *dpg,
                  const std::string& kind);
void warn_for_bpf(systemtap_session& s,
                  netfilter_derived_probe_group *dpg,
                  const std::string& kind);
void warn_for_bpf(systemtap_session& s,
                  profile_derived_probe_group *dpg,
                  const std::string& kind);
void warn_for_bpf(systemtap_session& s,
                  mark_derived_probe_group *dpg,
                  const std::string& kind);
void warn_for_bpf(systemtap_session& s,
                  python_derived_probe_group *dpg,
                  const std::string& kind);

void register_tapset_been(systemtap_session& sess);
void register_tapset_itrace(systemtap_session& sess);
void register_tapset_mark(systemtap_session& sess);
void register_tapset_procfs(systemtap_session& sess);
void register_tapset_timers(systemtap_session& sess);
void register_tapset_netfilter(systemtap_session& sess);
void register_tapset_perf(systemtap_session& sess);
void register_tapset_utrace(systemtap_session& sess);
void register_tapset_java(systemtap_session& sess);
void register_tapset_python(systemtap_session& sess);
void register_tapset_debuginfod(systemtap_session& sess);


std::string path_remove_sysroot(const systemtap_session& sess,
				const std::string& path);

// ------------------------------------------------------------------------
// Generic derived_probe_group: contains an ordinary vector of the
// given type.  It provides only the enrollment function.

template <class DP> struct generic_dpg: public derived_probe_group
{
protected:
  std::vector <DP*> probes;
public:
  generic_dpg () {}
  void enroll (DP* probe) { probes.push_back (probe); }
};


// ------------------------------------------------------------------------
// An update visitor that allows replacing assignments with a function call

struct var_expanding_visitor: public update_visitor
{
  var_expanding_visitor (systemtap_session& s);
  void visit_assignment (assignment* e);
  void visit_pre_crement (pre_crement* e);
  void visit_post_crement (post_crement* e);
  void visit_delete_statement (delete_statement* s);
  void visit_defined_op (defined_op* e);

  // PR25841: update through functions
  void visit_functioncall (functioncall* e);
  
protected:
  std::set<functiondecl*> early_resolution_in_progress;
  
  systemtap_session& sess;
  static unsigned tick;
  std::stack<defined_op*> defined_ops;
  std::set<std::string> valid_ops;
  interned_string* op;

  void provide_lvalue_call(functioncall* fcall);

private:
  std::stack<functioncall**> target_symbol_setter_functioncalls;
  bool rewrite_lvalue(const token *tok, interned_string& eop,
                      expression*& lvalue, expression*& rvalue);
};

// ------------------------------------------------------------------------

struct exp_type_dwarf : public exp_type_details
{
  // NB: We don't own this dwflpp, so don't use it after build_no_more!
  // A shared_ptr might help, but expressions are currently so leaky
  // that we'd probably never clear all references... :/
  dwflpp* dw;
  Dwarf_Die die;
  bool userspace_p;
  bool is_pointer;
  exp_type_dwarf(dwflpp* dw, Dwarf_Die* die, bool userspace_p, bool addressof);
  uintptr_t id () const { return reinterpret_cast<uintptr_t>(die.addr); }
  bool expandable() const { return true; }
  functioncall *expand(autocast_op* e, bool lvalue);
  void print (std::ostream& o) const;
};

#endif // TAPSETS_H

/* vim: set sw=2 ts=8 cino=>4,n-2,{2,^-2,t0,(0,u0,w1,M1 : */