]>
sourceware.org Git - systemtap.git/blob - stapdyn/mutatee.h
1 // stapdyn mutatee declarations
2 // Copyright (C) 2012-2014 Red Hat Inc.
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
15 #include <BPatch_object.h>
16 #include <BPatch_process.h>
17 #include <BPatch_snippet.h>
23 // A mutatee is created for each attached process
26 pid_t pid
; // The system's process ID.
27 BPatch_process
* process
; // Dyninst's handle for this process
28 BPatch_object
* stap_dso
; // the injected stap module
30 std::vector
<BPatch_snippet
*> registers
; // PC + DWARF registers
32 std::vector
<BPatchSnippetHandle
*> snippets
; // handles from insertSnippet
34 std::vector
<BPatch_variableExpr
*> semaphores
; // SDT semaphore variables
36 std::vector
<dynprobe_location
> attached_probes
;
37 BPatch_function
* utrace_enter_function
;
39 // process.end probes saved to run after exec
40 std::vector
<dynprobe_location
> exec_proc_end_probes
;
42 // disable implicit constructors by not implementing these
43 mutatee (const mutatee
& other
);
44 mutatee
& operator= (const mutatee
& other
);
46 void update_semaphores(unsigned short delta
, size_t start
=0);
48 void call_utrace_dynprobes(const std::vector
<dynprobe_location
>& probes
,
49 BPatch_thread
* thread
=NULL
);
50 void instrument_utrace_dynprobe(const dynprobe_location
& probe
);
51 void instrument_global_dynprobe_target(const dynprobe_target
& target
);
52 void instrument_global_dynprobes(const std::vector
<dynprobe_target
>& targets
);
55 mutatee(BPatch_process
* process
);
58 pid_t
process_id() { return pid
; }
60 bool operator==(BPatch_process
* other
) { return process
== other
; }
62 // Inject the stap module into the target process
63 bool load_stap_dso(const std::string
& filename
);
65 // Unload the stap module from the target process
66 void unload_stap_dso();
68 // Given a target and the matching object, instrument all of the probes
69 // with calls to the stap_dso's entry function.
70 void instrument_dynprobe_target(BPatch_object
* object
,
71 const dynprobe_target
& target
);
73 // Look for all matches between this object and the targets
74 // we want to probe, then do the instrumentation.
75 void instrument_object_dynprobes(BPatch_object
* object
,
76 const std::vector
<dynprobe_target
>& targets
);
78 // Look for probe matches in all objects.
79 void instrument_dynprobes(const std::vector
<dynprobe_target
>& targets
);
81 // Copy data for forked instrumentation
82 void copy_forked_instrumentation(mutatee
& other
);
84 // Reset instrumentation after an exec
85 void exec_reset_instrumentation();
87 // Remove all BPatch snippets we've instrumented in the target
88 void remove_instrumentation();
90 // Look up a stap function by name and invoke it, optionally with parameters.
91 void call_function(const std::string
& name
);
92 void call_function(const std::string
& name
,
93 const std::vector
<BPatch_snippet
*>& args
);
95 // Send a signal to the process.
98 bool stop_execution();
99 void continue_execution();
100 void terminate_execution() { process
->terminateExecution(); }
102 bool is_stopped() { return process
->isStopped(); }
103 bool is_terminated() { return process
->isTerminated(); }
105 bool check_exit() { return check_dyninst_exit(process
); }
107 void begin_callback(BPatch_thread
*thread
=NULL
);
108 void exit_callback(BPatch_thread
*thread
, bool exec_p
=false);
109 void thread_callback(BPatch_thread
*thread
, bool create_p
);
111 std::vector
<dynprobe_location
> find_attached_probes(uint64_t flag
);
116 /* vim: set sw=2 ts=8 cino=>4,n-2,{2,^-2,t0,(0,u0,w1,M1 : */
This page took 0.039839 seconds and 5 git commands to generate.