This source file includes following definitions.
- check
- ompi_debugger_setup_dlls
   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 #include "ompi_config.h"
  33 
  34 #ifdef HAVE_UNISTD_H
  35 #include <unistd.h>
  36 #endif  
  37 #ifdef HAVE_DIRENT_H
  38 #include <dirent.h>
  39 #endif
  40 #ifdef HAVE_SYS_TYPES_H
  41 #include <sys/types.h>
  42 #endif
  43 #ifdef HAVE_SYS_STAT_H
  44 #include <sys/stat.h>
  45 #endif
  46 #ifdef HAVE_UNISTD_H
  47 #include <unistd.h>
  48 #endif
  49 
  50 #include "opal/mca/base/base.h"
  51 #include "opal/util/argv.h"
  52 #include "opal/util/printf.h"
  53 #include "opal/mca/installdirs/installdirs.h"
  54 #include "debuggers.h"
  55 #include "ompi/mca/rte/rte.h"
  56 
  57 
  58 
  59 
  60 
  61 
  62 
  63 
  64 
  65 
  66 #include "opal/class/opal_list.h"
  67 #include "opal/class/opal_free_list.h"
  68 #include "ompi/request/request.h"
  69 #include "ompi/mca/pml/base/pml_base_request.h"
  70 #include "ompi/mca/pml/base/pml_base_sendreq.h"
  71 #include "ompi/mca/pml/base/pml_base_recvreq.h"
  72 #include "opal/class/opal_pointer_array.h"
  73 #include "ompi/communicator/communicator.h"
  74 #include "ompi/mca/topo/topo.h"
  75 #include "ompi/group/group.h"
  76 #include "opal/datatype/opal_datatype.h"
  77 #include "ompi/datatype/ompi_datatype.h"
  78 #include "ompi/include/mpi.h"
  79 
  80 #if defined(OMPI_MSGQ_DLL)
  81 
  82 
  83 OMPI_DECLSPEC char MPIR_dll_name[] = OMPI_MSGQ_DLL;
  84 #endif  
  85 OMPI_DECLSPEC char **mpidbg_dll_locations = NULL;
  86 OMPI_DECLSPEC char **mpimsgq_dll_locations = NULL;
  87 
  88 OMPI_DECLSPEC int MPIR_debug_typedefs_sizeof[] = {
  89     sizeof(short),
  90     sizeof(int),
  91     sizeof(long),
  92     sizeof(long long),
  93     sizeof(void*),
  94     sizeof(bool),
  95     sizeof(size_t)
  96 };
  97 
  98 
  99 
 100 
 101 
 102 #define MPIR_DEBUG_SPAWNED   1
 103 #define MPIR_DEBUG_ABORTING  2
 104 
 105 
 106 
 107 
 108 
 109 
 110 
 111 
 112 
 113 OMPI_DECLSPEC opal_list_item_t* opal_list_item_t_type_force_inclusion = NULL;
 114 OMPI_DECLSPEC opal_list_t* opal_list_t_type_force_inclusion = NULL;
 115 OMPI_DECLSPEC opal_free_list_item_t* opal_free_list_item_t_type_force_inclusion = NULL;
 116 OMPI_DECLSPEC opal_free_list_t* opal_free_list_t_type_force_inclusion = NULL;
 117 OMPI_DECLSPEC ompi_request_t* ompi_request_t_type_force_inclusion = NULL;
 118 OMPI_DECLSPEC mca_pml_base_request_t* mca_pml_base_request_t_type_force_inclusion = NULL;
 119 OMPI_DECLSPEC mca_pml_base_send_request_t* mca_pml_base_send_request_t_type_force_inclusion = NULL;
 120 OMPI_DECLSPEC mca_pml_base_recv_request_t* mca_pml_base_recv_request_t_type_force_inclusion = NULL;
 121 OMPI_DECLSPEC opal_pointer_array_t* opal_pointer_array_t_type_force_inclusion = NULL;
 122 OMPI_DECLSPEC ompi_communicator_t* ompi_communicator_t_type_force_inclusion = NULL;
 123 OMPI_DECLSPEC ompi_group_t* ompi_group_t_type_force_inclusion = NULL;
 124 OMPI_DECLSPEC ompi_status_public_t* ompi_status_public_t_type_force_inclusion = NULL;
 125 OMPI_DECLSPEC opal_datatype_t* opal_datatype_t_type_force_inclusion = NULL;
 126 OMPI_DECLSPEC ompi_datatype_t* ompi_datatype_t_type_force_inclusion = NULL;
 127 
 128 OMPI_DECLSPEC volatile int MPIR_debug_gate = 0;
 129 
 130 static char *ompi_debugger_dll_path = NULL;
 131 
 132 
 133 static void check(char *dir, char *file, char **locations)
 134 {
 135     char *str;
 136 
 137     opal_asprintf(&str, "%s/%s.so", dir, file);
 138 
 139 #if defined(HAVE_SYS_STAT_H)
 140     {
 141         struct stat buf;
 142 
 143         
 144         if (0 == stat(str, &buf)) {
 145             opal_argv_append_nosize(&locations, file);
 146         }
 147     }
 148 #else
 149     {
 150         FILE *fp;
 151 
 152         
 153         if (NULL != (fp = fopen(str, "r"))) {
 154             fclose(fp);
 155             opal_argv_append_nosize(&locations, file);
 156         }
 157     }
 158 #endif 
 159 
 160     free(str);
 161 }
 162 
 163 
 164 extern void
 165 ompi_debugger_setup_dlls(void)
 166 {
 167     int i;
 168     char **dirs, **tmp1 = NULL, **tmp2 = NULL;
 169 
 170     ompi_debugger_dll_path = opal_install_dirs.opallibdir;
 171     (void) mca_base_var_register("ompi", "ompi", "debugger", "dll_path",
 172                                  "List of directories where MPI_INIT should search for debugger plugins",
 173                                  MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0,
 174                                  OPAL_INFO_LVL_9,
 175                                  MCA_BASE_VAR_SCOPE_READONLY,
 176                                  &ompi_debugger_dll_path);
 177 
 178     
 179     if (NULL != ompi_debugger_dll_path) {
 180         dirs = opal_argv_split(ompi_debugger_dll_path, ':');
 181         for (i = 0; dirs[i] != NULL; ++i) {
 182             check(dirs[i], OMPI_MPIHANDLES_DLL_PREFIX, tmp1);
 183             check(dirs[i], OMPI_MSGQ_DLL_PREFIX, tmp2);
 184         }
 185         opal_argv_free(dirs);
 186     }
 187 
 188     
 189 
 190 
 191 
 192     mpimsgq_dll_locations = tmp1;
 193     mpidbg_dll_locations = tmp2;
 194 }