OpenMPI 0.1.1

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

- File List
- Globals

memchecker.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2004-2007 High Performance Computing Center Stuttgart,
3 * University of Stuttgart. All rights reserved.
4 * Copyright (c) 2004-2008 The Trustees of Indiana University.
5 * All rights reserved.
6 *
7 * $COPYRIGHT$
8 *
9 * Additional copyrights may follow
10 *
11 * $HEADER$
12 */
13
14 /**
15 * @file
16 *
17 * memchecker (memory checker) framework component interface.
18 *
19 * Intent
20 *
21 * This is a very thin framework to abstract memory checking tools,
22 * such as valgrind and possibly Sun rtc (memory checking available
23 * possibly only under Solaris/Sparc).
24 *
25 * Currently, only functionality for hiding and unhiding of memory
26 * is added; further functions provided by the memory checker/api
27 * checker could be added, however, this comes (at least for valgrind)
28 * with considerable overhead.
29 * One possible option would be to have error_print_callbacks, that
30 * output different error messages, depending on the memory location
31 * being hit by certain error.
32 */
33
34 #ifndef OPAL_MCA_MEMCHECKER_MEMCHECKER_H
35 #define OPAL_MCA_MEMCHECKER_MEMCHECKER_H
36
37 #include "opal_config.h"
38
39 #include "opal/mca/mca.h"
40 #include "opal/mca/base/base.h"
41
42 /**
43 * Module initialization function. Should return OPAL_SUCCESS.
44 */
45 typedef int (*opal_memchecker_base_module_init_1_0_0_fn_t)(void);
46
47 /**
48 * Module function to query, whether we're under the memory
49 * checking program, like valgrind
50 */
51 typedef int (*opal_memchecker_base_module_runindebugger_fn_t)(void);
52
53 /**
54 * Module function to check, whether memory region is addressable
55 */
56 typedef int (*opal_memchecker_base_module_isaddressable_fn_t)(void * p, size_t len);
57
58 /**
59 * Module function to check, whether memory region is defined
60 */
61 typedef int (*opal_memchecker_base_module_isdefined_fn_t)(void * p, size_t len);
62
63 /**
64 * Module function to set memory region to not accessible
65 */
66 typedef int (*opal_memchecker_base_module_mem_noaccess_fn_t)(void * p, size_t len);
67
68 /**
69 * Module function to set memory region to undefined
70 */
71 typedef int (*opal_memchecker_base_module_mem_undefined_fn_t)(void * p, size_t len);
72
73 /**
74 * Module function to set memory region to defined
75 */
76 typedef int (*opal_memchecker_base_module_mem_defined_fn_t)(void * p, size_t len);
77
78 /**
79 * Module function to set memory region to defined, but only if addressable
80 */
81 typedef int (*opal_memchecker_base_module_mem_defined_if_addressable_fn_t)(void * p, size_t len);
82
83 /**
84 * Module function name a specific memory region
85 */
86 typedef int (*opal_memchecker_base_module_create_block_fn_t)(void * p, size_t len, char * description);
87
88 /**
89 * Module function to discard a named memory region
90 */
91 typedef int (*opal_memchecker_base_module_discard_block_fn_t)(void * p); /* Here, we need to do some mapping for valgrind */
92
93 /**
94 * Module function to check for any leaks
95 */
96 typedef int (*opal_memchecker_base_module_leakcheck_fn_t)(void);
97
98 /**
99 * Module function to get vbits
100 */
101 typedef int (*opal_memchecker_base_module_get_vbits_fn_t)(void * p, char * vbits, size_t len);
102
103 /**
104 * Module function to set vbits
105 */
106 typedef int (*opal_memchecker_base_module_set_vbits_fn_t)(void * p, char * vbits, size_t len);
107
108
109
110 /**
111 * Structure for memchecker components.
112 */
113 struct opal_memchecker_base_component_2_0_0_t {
114 /** MCA base component */
115 mca_base_component_t base_version;
116 /** MCA base data */
117 mca_base_component_data_t base_data;
118 };
119
120 /**
121 * Convenience typedef
122 */
123 typedef struct opal_memchecker_base_component_2_0_0_t opal_memchecker_base_component_2_0_0_t;
124 typedef struct opal_memchecker_base_component_2_0_0_t opal_memchecker_base_component_t;
125
126 /**
127 * Structure for memchecker modules
128 */
129 struct opal_memchecker_base_module_1_0_0_t {
130 /** Module initialization function */
131 opal_memchecker_base_module_init_1_0_0_fn_t init;
132
133 /** Module function to check, whether we are executed by memory debugger */
134 opal_memchecker_base_module_runindebugger_fn_t runindebugger;
135
136 /** Module function to check, whether memory region is addressable */
137 opal_memchecker_base_module_isaddressable_fn_t isaddressable;
138
139 /** Module function to check, whether memory region is defined */
140 opal_memchecker_base_module_isdefined_fn_t isdefined;
141
142 /** Module function to set memory region to not accessible */
143 opal_memchecker_base_module_mem_noaccess_fn_t mem_noaccess;
144
145 /** Module function to set memory region to undefined */
146 opal_memchecker_base_module_mem_undefined_fn_t mem_undefined;
147
148 /** Module function to set memory region to defined */
149 opal_memchecker_base_module_mem_defined_fn_t mem_defined;
150
151 /** Module function to set memory region to defined, but only if addressable */
152 opal_memchecker_base_module_mem_defined_if_addressable_fn_t mem_defined_if_addressable;
153
154 /** Module function name a specific memory region */
155 opal_memchecker_base_module_create_block_fn_t create_block;
156
157 /** Module function to discard a named memory region */
158 opal_memchecker_base_module_discard_block_fn_t discard_block;
159
160 /** Module function to check for any leaks */
161 opal_memchecker_base_module_leakcheck_fn_t leakcheck;
162
163 /** Module function to get vbits */
164 opal_memchecker_base_module_get_vbits_fn_t get_vbits;
165
166 /** Module function to set vbits */
167 opal_memchecker_base_module_set_vbits_fn_t set_vbits;
168 };
169
170 /**
171 * Convenience typedef
172 */
173 typedef struct opal_memchecker_base_module_1_0_0_t opal_memchecker_base_module_1_0_0_t;
174 typedef struct opal_memchecker_base_module_1_0_0_t opal_memchecker_base_module_t;
175
176
177 /**
178 * Macro for use in components that are of type memchecker
179 */
180 #define OPAL_MEMCHECKER_BASE_VERSION_2_0_0 \
181 MCA_BASE_VERSION_2_0_0, \
182 "memchecker", 2, 0, 0
183
184 #endif /* OPAL_MCA_MEMCHECKER_MEMCHECKER_H */
opal_memchecker_base_module_mem_defined_if_addressable_fn_t
int(* opal_memchecker_base_module_mem_defined_if_addressable_fn_t)(void *p, size_t len)
Module function to set memory region to defined, but only if addressable.
Definition: memchecker.h:81
opal_memchecker_base_module_discard_block_fn_t
int(* opal_memchecker_base_module_discard_block_fn_t)(void *p)
Module function to discard a named memory region.
Definition: memchecker.h:91
opal_memchecker_base_module_set_vbits_fn_t
int(* opal_memchecker_base_module_set_vbits_fn_t)(void *p, char *vbits, size_t len)
Module function to set vbits.
Definition: memchecker.h:106
mca_base_component_2_0_0_t
Common type for all MCA components.
Definition: mca.h:250
opal_memchecker_base_module_isaddressable_fn_t
int(* opal_memchecker_base_module_isaddressable_fn_t)(void *p, size_t len)
Module function to check, whether memory region is addressable.
Definition: memchecker.h:56
opal_memchecker_base_module_leakcheck_fn_t
int(* opal_memchecker_base_module_leakcheck_fn_t)(void)
Module function to check for any leaks.
Definition: memchecker.h:96
opal_memchecker_base_module_1_0_0_t::mem_noaccess
opal_memchecker_base_module_mem_noaccess_fn_t mem_noaccess
Module function to set memory region to not accessible.
Definition: memchecker.h:143
opal_memchecker_base_component_2_0_0_t::base_version
mca_base_component_t base_version
MCA base component.
Definition: memchecker.h:115
opal_memchecker_base_module_mem_undefined_fn_t
int(* opal_memchecker_base_module_mem_undefined_fn_t)(void *p, size_t len)
Module function to set memory region to undefined.
Definition: memchecker.h:71
opal_memchecker_base_module_mem_noaccess_fn_t
int(* opal_memchecker_base_module_mem_noaccess_fn_t)(void *p, size_t len)
Module function to set memory region to not accessible.
Definition: memchecker.h:66
opal_memchecker_base_module_1_0_0_t::mem_defined
opal_memchecker_base_module_mem_defined_fn_t mem_defined
Module function to set memory region to defined.
Definition: memchecker.h:149
opal_memchecker_base_module_1_0_0_t::leakcheck
opal_memchecker_base_module_leakcheck_fn_t leakcheck
Module function to check for any leaks.
Definition: memchecker.h:161
opal_memchecker_base_module_create_block_fn_t
int(* opal_memchecker_base_module_create_block_fn_t)(void *p, size_t len, char *description)
Module function name a specific memory region.
Definition: memchecker.h:86
opal_memchecker_base_module_1_0_0_t::set_vbits
opal_memchecker_base_module_set_vbits_fn_t set_vbits
Module function to set vbits.
Definition: memchecker.h:167
mca.h
Top-level interface for all MCA components.
opal_memchecker_base_module_get_vbits_fn_t
int(* opal_memchecker_base_module_get_vbits_fn_t)(void *p, char *vbits, size_t len)
Module function to get vbits.
Definition: memchecker.h:101
opal_memchecker_base_module_1_0_0_t::create_block
opal_memchecker_base_module_create_block_fn_t create_block
Module function name a specific memory region.
Definition: memchecker.h:155
opal_memchecker_base_module_1_0_0_t::runindebugger
opal_memchecker_base_module_runindebugger_fn_t runindebugger
Module function to check, whether we are executed by memory debugger.
Definition: memchecker.h:134
opal_memchecker_base_module_init_1_0_0_fn_t
int(* opal_memchecker_base_module_init_1_0_0_fn_t)(void)
Module initialization function.
Definition: memchecker.h:45
opal_memchecker_base_module_isdefined_fn_t
int(* opal_memchecker_base_module_isdefined_fn_t)(void *p, size_t len)
Module function to check, whether memory region is defined.
Definition: memchecker.h:61
opal_memchecker_base_module_1_0_0_t::get_vbits
opal_memchecker_base_module_get_vbits_fn_t get_vbits
Module function to get vbits.
Definition: memchecker.h:164
opal_memchecker_base_component_2_0_0_t::base_data
mca_base_component_data_t base_data
MCA base data.
Definition: memchecker.h:117
opal_memchecker_base_module_runindebugger_fn_t
int(* opal_memchecker_base_module_runindebugger_fn_t)(void)
Module function to query, whether we're under the memory checking program, like valgrind.
Definition: memchecker.h:51
opal_memchecker_base_module_1_0_0_t::mem_defined_if_addressable
opal_memchecker_base_module_mem_defined_if_addressable_fn_t mem_defined_if_addressable
Module function to set memory region to defined, but only if addressable.
Definition: memchecker.h:152
opal_memchecker_base_module_1_0_0_t::isaddressable
opal_memchecker_base_module_isaddressable_fn_t isaddressable
Module function to check, whether memory region is addressable.
Definition: memchecker.h:137
opal_memchecker_base_module_1_0_0_t::discard_block
opal_memchecker_base_module_discard_block_fn_t discard_block
Module function to discard a named memory region.
Definition: memchecker.h:158
opal_memchecker_base_module_1_0_0_t::mem_undefined
opal_memchecker_base_module_mem_undefined_fn_t mem_undefined
Module function to set memory region to undefined.
Definition: memchecker.h:146
mca_base_component_data_2_0_0_t
Meta data for MCA v2.0.0 components.
Definition: mca.h:309
opal_memchecker_base_component_2_0_0_t
Structure for memchecker components.
Definition: memchecker.h:113
opal_memchecker_base_module_1_0_0_t::isdefined
opal_memchecker_base_module_isdefined_fn_t isdefined
Module function to check, whether memory region is defined.
Definition: memchecker.h:140
opal_memchecker_base_module_1_0_0_t::init
opal_memchecker_base_module_init_1_0_0_fn_t init
Module initialization function.
Definition: memchecker.h:131
opal_memchecker_base_module_mem_defined_fn_t
int(* opal_memchecker_base_module_mem_defined_fn_t)(void *p, size_t len)
Module function to set memory region to defined.
Definition: memchecker.h:76
opal_memchecker_base_module_1_0_0_t
Structure for memchecker modules.
Definition: memchecker.h:129