]> sourceware.org Git - systemtap.git/blob - runtime/common_probe_context.h
Rename CONTEXT regflags to probe_flags. Now simply indicates user mode.
[systemtap.git] / runtime / common_probe_context.h
1 /* Included once by translate.cxx c_unparser::emit_common_header ()
2 Defines all common fields and probe flags for struct context.
3 Available to C-based probe handlers as fields of the CONTEXT ptr. */
4
5 /* Used to indicate whether a probe context is in use.
6 Tested in the code entering the probe setup by common_probe_entry_prologue
7 and cleared by the common_probe_entry_epilogue code. When an early error
8 forces a goto probe_epilogue then needs an explicitly atomic_dec() first.
9 All context busy flags are tested on module unload to prevent unloading
10 while some probe is still running. */
11 atomic_t busy;
12
13 /* The fully-resolved probe point associated with a currently running probe
14 handler, including alias and wild-card expansion effects.
15 aka stap_probe->pp. Setup by common_probe_entryfn_prologue.
16 Used in warning/error messages and accessible by pp() tapset function. */
17 const char *probe_point;
18
19 /* The script-level probe point associated with a currently running probe
20 handler, including wild-card expansion effects as per 'stap -l'.
21 Guarded by STP_NEED_PROBE_NAME as setup in pn() tapset function. */
22 #ifdef STP_NEED_PROBE_NAME
23 const char *probe_name;
24 #endif
25
26 /* The kind of probe this is. One of the _STP_PROBE_HANDLER_ constants.
27 Used to determined what other fields are setup and how. Often the
28 probe context fields depend on how the probe handler is triggered
29 and what information it gets passed. */
30 int probe_type;
31
32 /* Common status of probe. _STP_PROBE_STATE_ flags. */
33 int probe_flags;
34
35 /* Number of "actions" this probe handler is still allowed to do.
36 Setup in common_probe_entryfn_prologue to either MAXACTION or
37 Checked by code generated by c_unparser::record_actions (), which will
38 set last_error in case this goes to zero and then jumps to out.
39 MAXACTION_INTERRUPTIBLE. Note special case in enter_all_profile_probes. */
40 int actionremaining;
41
42 /* The current nesting of a function. Needed to determine which "level" of
43 locals to use. See the recursion_info traversing_visitor for how the
44 maximum is calculated. Locals of a function are stored at
45 c->locals[c->nesting], see c_unparser::emit_function (). */
46 int nesting;
47
48 /* A place to format error messages into if some error occurs, last_error
49 will then be pointed here. */
50 string_t error_buffer;
51
52 /* Only used when stap script uses tokenize.stp tapset. */
53 #ifdef STAP_NEED_CONTEXT_TOKENIZE
54 string_t tok_str;
55 char *tok_start;
56 char *tok_end;
57 #endif
58
59 /* NB: last_error is used as a health flag within a probe.
60 While it's 0, execution continues
61 When it's "something", probe code unwinds, _stp_error's, sets error state */
62 const char *last_error;
63 /* Last statement (token) executed. Often set together with last_error. */
64 const char *last_stmt;
65
66 /* Set when probe handler gets pt_regs handed to it. This can be either
67 the kernel registers or the user space registers. The probe_flags field
68 will indicate which and whether the user registers are complete. */
69 struct pt_regs *regs;
70
71 /* unwaddr is caching unwound address in each probe handler on ia64. */
72 #if defined __ia64__
73 unsigned long *unwaddr;
74 #endif
75
76 /* Individual Probe State (ips).
77 A union since only one can be active at a time. */
78 union {
79
80 /* kretprobe state. */
81 struct {
82 struct kretprobe_instance *pi;
83 /* int64_t count in pi->data, the rest is string_t.
84 See the kretprobe.stp tapset. */
85 int pi_longs;
86 } krp;
87
88 /* State for mark_derived_probes. */
89 struct {
90 va_list *mark_va_list;
91 const char *marker_name;
92 const char *marker_format;
93 } kmark;
94
95 /* State for tracepoint probes. */
96 const char *tracepoint_name;
97
98 /* uretprobe state */
99 struct uretprobe_instance *ri;
100
101 /* State for procfs probes, see tapset-procfs.cxx. */
102 void *procfs_data;
103 } ips;
104
105
106 /* Only used when stap script uses the i386 or x86_64 register.stp tapset. */
107 #ifdef STAP_NEED_REGPARM
108 int regparm;
109 #endif
110
111 /* Only used for overload processing. */
112 #ifdef STP_OVERLOAD
113 cycles_t cycles_base;
114 cycles_t cycles_sum;
115 #endif
116
117 /* Current state of the unwinder (as used in the unwind.c dwarf unwinder). */
118 #if defined(STP_NEED_UNWIND_DATA)
119 struct unwind_context uwcontext;
120 #endif
This page took 0.038363 seconds and 5 git commands to generate.