OpenMPI 0.1.1

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

vt_dyn.h
1 /**
2 * VampirTrace
3 * http://www.tu-dresden.de/zih/vampirtrace
4 *
5 * Copyright (c) 2005-2012, ZIH, TU Dresden, Federal Republic of Germany
6 *
7 * Copyright (c) 1998-2005, Forschungszentrum Juelich, Juelich Supercomputing
8 * Centre, Federal Republic of Germany
9 *
10 * See the file COPYING in the package base directory for details
11 **/
12
13 #ifndef _VT_DYN_H_
14 #define _VT_DYN_H_
15
16 #include "config.h"
17
18 #include "vt_defs.h"
19 #include "vt_inttypes.h"
20
21 #include "rfg_filter.h"
22
23 #include "BPatch.h"
24 #include "BPatch_addressSpace.h"
25 #include "BPatch_function.h"
26 #include "BPatch_image.h"
27
28 #include <iostream>
29 #include <set>
30 #include <string>
31 #include <vector>
32
33 #define STRBUFSIZE 1024
34
35 //
36 // mutation modes
37 //
38 typedef enum
39 {
40 // either create/attach to a process, instrument, and execute
41 //
42 MODE_CREATE,
43 MODE_ATTACH,
44 // or open, instrument, and rewrite binary
45 MODE_REWRITE
46
47 } MutationT;
48
49 //
50 // structure that contains the mutator parameters
51 // (i.e. command line options)
52 //
53 struct ParamsS
54 {
55 ParamsS()
56 : mode(MODE_CREATE), mutatee_pid(-1), verbose_level(1),
57 detach(true), ignore_no_dbg(false), show_usage(false),
58 show_version(false) {}
59
60 MutationT mode; // mutation mode
61 std::string mutatee; // mutatee executable name
62 int mutatee_pid; // mutatee PID
63 std::vector<std::string> mutatee_args; // mutatee arguments
64 std::vector<std::string> shlibs; // shared libs. to be instrumented
65 std::string filtfile; // pathname of filter file
66 std::string outfile; // file name of binary to rewrite
67 uint32_t verbose_level; // verbose level
68 bool detach; // flag: detach from mutatee?
69 bool ignore_no_dbg; // flag: ignore funcs. without debug?
70 bool show_usage; // flag: show usage text?
71 bool show_version; // flag: show VampirTrace version?
72
73 };
74
75 //
76 // MutatorC class
77 //
78 class MutatorC
79 {
80 public:
81
82 // constructor
83 MutatorC();
84
85 // destructor
86 ~MutatorC();
87
88 // run the mutator
89 bool run();
90
91 private:
92
93 //
94 // structure that contains context information about functions to
95 // be instrumented
96 //
97 struct InstFuncS
98 {
99 InstFuncS( const uint32_t & _index, const std::string & _name,
100 const std::string & _file, const uint32_t & _lno,
101 const BPatch_Vector<BPatch_point*> *& _entry_points,
102 const BPatch_Vector<BPatch_point*> *& _exit_points )
103 : index( _index ), name( _name ), file( _file ), lno( _lno ),
104 entry_points( _entry_points ), exit_points( _exit_points ) {}
105
106 // function index within region id table
107 uint32_t index;
108
109 // function name
110 std::string name;
111
112 // source file name and line number of function definition
113 //
114 std::string file;
115 uint32_t lno;
116
117 // function entry and exit points to be instrumented
118 //
119 const BPatch_Vector<BPatch_point*> * entry_points;
120 const BPatch_Vector<BPatch_point*> * exit_points;
121
122 };
123
124 // create/attach to a process or open binary for rewriting
125 bool initialize();
126
127 // continue execution of mutatee or rewrite binary
128 bool finalize( bool & error );
129
130 // get functions to be instrumented
131 bool getFunctions( std::vector<InstFuncS> & instFuncs );
132
133 // instrument a function entry
134 bool instrumentFunctionEntry( const InstFuncS & instFunc );
135
136 // instrument a function exit
137 bool instrumentFunctionExit( const InstFuncS & instFunc );
138
139 // read input filter file
140 bool readFilter();
141
142 // check whether module is excluded from instrumentation
143 inline bool constraintModule( const std::string & name ) const;
144
145 // check whether function is excluded from instrumentation
146 inline bool constraintFunction( const std::string & name ) const;
147
148 // check whether mutatee uses MPI
149 inline bool isMPI() const;
150
151 // find certain function in mutatee
152 inline bool findFunction( const std::string & name,
153 BPatch_function *& func ) const;
154
155 // entire Dyninst library object
156 BPatch m_bpatch;
157
158 // mutatee's process or binary edit object
159 BPatch_addressSpace * m_appAddrSpace;
160
161 // mutatee's image object
162 BPatch_image * m_appImage;
163
164 // instrumentation functions to be inserted at entry/exit points
165 //
166 BPatch_function * m_vtStartFunc;
167 BPatch_function * m_vtEndFunc;
168
169 // RFG filter object to include/exclude functions from instrumenting
170 RFG_Filter * m_filter;
171
172 };
173
174 #endif // _VT_DYN_H_
ParamsS
Definition: vt_dyn.h:53
MutatorC
Definition: vt_dyn.h:78
RFG_Filter_struct
Definition: rfg_filter.c:24