root/opal/mca/memchecker/base/base.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 /*
   2  * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart,
   3  *                         University of Stuttgart.  All rights reserved.
   4  * $COPYRIGHT$
   5  *
   6  * Additional copyrights may follow
   7  *
   8  * $HEADER$
   9  *
  10  */
  11 
  12 #ifndef OPAL_MEMCHECKER_BASE_H
  13 #define OPAL_MEMCHECKER_BASE_H
  14 
  15 #include "opal_config.h"
  16 #include "opal/mca/base/mca_base_framework.h"
  17 #include "opal/mca/memchecker/memchecker.h"
  18 
  19 /*
  20  * Global functions for MCA overall memchecker open and close
  21  */
  22 
  23 BEGIN_C_DECLS
  24 
  25 /**
  26  * Select one available component.
  27  *
  28  * @return OPAL_SUCCESS Upon success.
  29  *
  30  * This function invokes the selection process for memchecker
  31  * components
  32  */
  33 OPAL_DECLSPEC int opal_memchecker_base_select(void);
  34 
  35 /**
  36  * Framework structure for memchecker
  37  */
  38 OPAL_DECLSPEC extern mca_base_framework_t opal_memchecker_base_framework;
  39 
  40 /**
  41  * Indication of whether one component was successfully selected
  42  */
  43 OPAL_DECLSPEC extern bool opal_memchecker_base_selected;
  44 
  45 /**
  46  * Global component struct for the selected component
  47  */
  48 OPAL_DECLSPEC extern const opal_memchecker_base_component_2_0_0_t
  49     *opal_memchecker_base_component;
  50 
  51 /**
  52  * Global module struct for the selected module
  53  */
  54 OPAL_DECLSPEC extern const opal_memchecker_base_module_1_0_0_t
  55     *opal_memchecker_base_module;
  56 
  57 /**
  58  * Check if we are running under the memory debugger.
  59  *
  60  * @retval 0   if not running under memory debugger
  61  *         !=0 if running under memory debugger
  62  *
  63  */
  64 OPAL_DECLSPEC int opal_memchecker_base_runindebugger(void);
  65 #if OPAL_WANT_MEMCHECKER == 0
  66 #define opal_memchecker_base_runindebugger() 0
  67 #endif
  68 
  69 
  70 /**
  71  * Check if a memory region is valid to address
  72  *
  73  * @param p Pointer to the memory region
  74  * @param len Length of the memory region
  75  *
  76  * @retval OPAL_SUCCESS upon success.
  77  *
  78  * This function calls the selected memchecker, whether
  79  *  every Byte of this memory region is addressable
  80  */
  81 OPAL_DECLSPEC int opal_memchecker_base_isaddressable(void * p, size_t len);
  82 #if OPAL_WANT_MEMCHECKER == 0
  83 #define opal_memchecker_base_isaddressable(p, len) 0
  84 #endif
  85 
  86 
  87 /**
  88  * Check if a memory region is defined
  89  *
  90  * @param p Pointer to the memory region
  91  * @param len Length of the memory region
  92  *
  93  * @retval OPAL_SUCCESS upon success.
  94  *
  95  * This function calls the selected memchecker, whether
  96  * every Byte of this memory region is correctly initialized.
  97  */
  98 OPAL_DECLSPEC int opal_memchecker_base_isdefined(void * p, size_t len);
  99 #if OPAL_WANT_MEMCHECKER == 0
 100 #define opal_memchecker_base_isdefined(p, len) 0
 101 #endif
 102 
 103 /**
 104  * Set a memory region to not accessible
 105  *
 106  * @param p Pointer to the memory region
 107  * @param len Length of the memory region
 108  *
 109  * @retval OPAL_SUCCESS upon success.
 110  *
 111  * This function calls the selected memchecker, to set
 112  * every Byte of this memory region to not accessible.
 113  */
 114 OPAL_DECLSPEC int opal_memchecker_base_mem_noaccess(void * p, size_t len);
 115 #if OPAL_WANT_MEMCHECKER == 0
 116 #define opal_memchecker_base_mem_noaccess(p, len)
 117 #endif
 118 
 119 /**
 120  * Set a memory region to undefined
 121  *
 122  * @param p Pointer to the memory region
 123  * @param len Length of the memory region
 124  *
 125  * @retval OPAL_SUCCESS upon success.
 126  *
 127  * This function calls the selected memchecker, to set
 128  * every Byte of this memory region to not contain initialized data.
 129  */
 130 OPAL_DECLSPEC int opal_memchecker_base_mem_undefined(void * p, size_t len);
 131 #if OPAL_WANT_MEMCHECKER == 0
 132 #define opal_memchecker_base_mem_undefined(p, len)
 133 #endif
 134 
 135 /**
 136  * Set a memory region to defined
 137  *
 138  * @param p Pointer to the memory region
 139  * @param len Length of the memory region
 140  *
 141  * @retval OPAL_SUCCESS upon success.
 142  *
 143  * This function calls the selected memchecker, to set
 144  * every Byte of this memory region to contain valid, initialized data.
 145  */
 146 OPAL_DECLSPEC int opal_memchecker_base_mem_defined(void * p, size_t len);
 147 #if OPAL_WANT_MEMCHECKER == 0
 148 #define opal_memchecker_base_mem_defined(p, len)
 149 #endif
 150 
 151 /**
 152  * Set a memory region to defined only if the region is addressable
 153  *
 154  * @param p Pointer to the memory region
 155  * @param len Length of the memory region
 156  *
 157  * @retval OPAL_SUCCESS upon success.
 158  *
 159  * This function calls the selected memchecker, to set
 160  * every Byte of this memory region to contain valid, initialized data,
 161  *  but only, if the memory region is addressable.
 162  */
 163 OPAL_DECLSPEC int opal_memchecker_base_mem_defined_if_addressable(void * p, size_t len);
 164 #if OPAL_WANT_MEMCHECKER == 0
 165 #define opal_memchecker_base_mem_defined_if_addressable(p, len)
 166 #endif
 167 
 168 /**
 169  * Create a named memory region
 170  *
 171  * @param p Pointer to the memory region
 172  * @param len Length of the memory region
 173  * @param description Name of the memory region
 174  *
 175  * @retval OPAL_SUCCESS upon success.
 176  *
 177  * This function calls the selected memchecker, to name
 178  * this memory region.
 179  */
 180 OPAL_DECLSPEC int opal_memchecker_base_create_block(void * p, size_t len, char * description);
 181 #if OPAL_WANT_MEMCHECKER == 0
 182 #define opal_memchecker_base_create_block(p, len, description)
 183 #endif
 184 
 185 /**
 186  * Discard a named memory region
 187  *
 188  * @param p Pointer to the memory region
 189  *
 190  * @retval OPAL_SUCCESS upon success.
 191  *
 192  * This function calls the selected memchecker, to discard
 193  * the name information of the memory region.
 194  */
 195 OPAL_DECLSPEC int opal_memchecker_base_discard_block(void * p);
 196 #if OPAL_WANT_MEMCHECKER == 0
 197 #define opal_memchecker_base_discard_block(p)
 198 #endif
 199 
 200 /**
 201  * Perform leak check on lost allocated memory.
 202  *
 203  * @param len Length of the memory region
 204  *
 205  * @retval OPAL_SUCCESS upon success.
 206  *
 207  * This function calls the selected memchecker, to output
 208  * information regarding lost allocated memory.
 209  */
 210 OPAL_DECLSPEC int opal_memchecker_base_leakcheck(void);
 211 #if OPAL_WANT_MEMCHECKER == 0
 212 #define opal_memchecker_base_leakcheck
 213 #endif
 214 
 215 /**
 216  * Get vbits of the memory
 217  *
 218  * @param p Pointer to the memory region
 219  * @param vbits Pointer to the vbit table
 220  * @param len Length of the memory region
 221  *
 222  * @retval OPAL_SUCCESS upon success.
 223  *
 224  * This function calls the selected memchecker, to get
 225  * every vbit of this memory region.
 226  */
 227 OPAL_DECLSPEC int opal_memchecker_base_get_vbits(void * p, char * vbits, size_t len);
 228 #if OPAL_WANT_MEMCHECKER == 0
 229 #define opal_memchecker_base_get_vbits(p, vbits, len)
 230 #endif
 231 
 232 /**
 233  * Set vbits of the memory
 234  *
 235  * @param p Pointer to the memory region
 236  * @param vbits Pointer to the vbit table
 237  * @param len Length of the memory region
 238  *
 239  * @retval OPAL_SUCCESS upon success.
 240  *
 241  * This function calls the selected memchecker, to get
 242  * every vbit of this memory region.
 243  */
 244 OPAL_DECLSPEC int opal_memchecker_base_set_vbits(void * p, char * vbits, size_t len);
 245 #if OPAL_WANT_MEMCHECKER == 0
 246 #define opal_memchecker_base_set_vbits(p, vbits, len)
 247 #endif
 248 
 249 END_C_DECLS
 250 
 251 #endif /* OPAL_MEMCHECKER_BASE_H */

/* [<][>][^][v][top][bottom][index][help] */