File: stapdyn.h

package info (click to toggle)
systemtap 2.6-0.2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 21,220 kB
  • ctags: 10,944
  • sloc: cpp: 53,239; ansic: 50,615; exp: 33,694; sh: 9,906; xml: 7,665; perl: 2,089; python: 1,534; tcl: 1,236; makefile: 797; java: 148; lisp: 104; awk: 94; asm: 91; sed: 16
file content (109 lines) | stat: -rw-r--r-- 3,451 bytes parent folder | download | duplicates (4)
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
/* stapdyn interface header
 * Copyright (C) 2012-2013 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 _STAPDYN_H_
#define _STAPDYN_H_

#ifdef __cplusplus
extern "C" {
#endif

#include <stdint.h>
#include <asm/ptrace.h>


/* These are declarations of all interfaces that stapdyn may call in the
 * module, either directly or via dyninst in the mutatee.  To maintain
 * compatibility as much as possible, function signatures should not be
 * changed between releases, only deprecated/renamed as necessary.
 *
 * NB: These are organized by the systemtap release in which each was first
 * added, so we can keep some idea of the ABI progression.
 */


/* With -fvisibility=hidden, we have to expose these manually.
 * Using "protected" keeps internal references always internal.  */
#pragma GCC visibility push(protected)


/**** STAP 2.0 : ****/

extern int stp_dyninst_session_init(void);
extern void stp_dyninst_session_exit(void);

extern uint64_t stp_dyninst_target_count(void);
extern const char* stp_dyninst_target_path(uint64_t index);

extern uint64_t stp_dyninst_probe_count(void);
extern uint64_t stp_dyninst_probe_target(uint64_t index);
extern uint64_t stp_dyninst_probe_offset(uint64_t index);
extern uint64_t stp_dyninst_probe_semaphore(uint64_t index);

extern int enter_dyninst_uprobe(uint64_t index, struct pt_regs *regs);

/* This is somewhat of a hack until we can figure out how to build a pt_regs
 * struct directly with stapdyn.  The varargs are all unsigned long, giving
 * first the original PC, then DWARF-ordered registers.  */
extern int enter_dyninst_uprobe_regs(uint64_t index, unsigned long nregs, ...);


/**** STAP 2.1 : ****/

/* uprobes-like flags */
#define STAPDYN_PROBE_FLAG_RETURN	0x1

/* utrace-like flags */
#define STAPDYN_PROBE_FLAG_PROC_BEGIN	0x100
#define STAPDYN_PROBE_FLAG_PROC_END	0x200
#define STAPDYN_PROBE_FLAG_THREAD_BEGIN	0x400
#define STAPDYN_PROBE_FLAG_THREAD_END	0x800

extern uint64_t stp_dyninst_probe_flags(uint64_t index);

extern int enter_dyninst_utrace_probe(uint64_t index, struct pt_regs *regs);

extern const char* stp_dyninst_shm_init(void);
extern int stp_dyninst_shm_connect(const char* name);


/**** STAP 2.2 : ****/

/* The following function is dynamically generated by systemtap, and
 * used by stapdyn to modify global variables at module startup only
 * (that is, *before* running stp_dyninst_session_init()). If the
 * name starts with '@', the name is assumed to be an internal value. */
extern int stp_global_setter(const char *name, const char *value);


/**** STAP 2.3 : ****/

/* Just returns an exit code, for indicating errors in the script.
 * This should be called after stp_dyninst_session_exit (which really
 * should have returned int itself, but now it's a legacy API).  */
int stp_dyninst_exit_status(void);


/**** STAP 2.x : ****/


/* STAPDYN_PROBE_ALL_FLAGS was first added for 2.1, but is placed here so
 * it can continue to be updated with new flags too.  */
#define STAPDYN_PROBE_ALL_FLAGS (uint64_t)(STAPDYN_PROBE_FLAG_RETURN	\
    | STAPDYN_PROBE_FLAG_PROC_BEGIN | STAPDYN_PROBE_FLAG_PROC_END	\
    | STAPDYN_PROBE_FLAG_THREAD_BEGIN | STAPDYN_PROBE_FLAG_THREAD_END)


#pragma GCC visibility pop

#ifdef __cplusplus
}
#endif

#endif /* _STAPDYN_H_ */