2005-09-01 00:35:15 +04:00
|
|
|
/*
|
2005-11-05 22:57:48 +03:00
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
2006-08-28 08:09:43 +04:00
|
|
|
* Copyright (c) 2004-2006 The University of Tennessee and The University
|
2005-11-05 22:57:48 +03:00
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
2005-09-01 00:35:15 +04:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* MPI portion of debugger support: TotalView
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "ompi_config.h"
|
|
|
|
|
2005-12-11 01:36:40 +03:00
|
|
|
#ifdef HAVE_UNISTD_H
|
2005-09-01 00:35:15 +04:00
|
|
|
#include <unistd.h>
|
2005-12-11 01:36:40 +03:00
|
|
|
#endif /* HAVE_UNISTD_H */
|
2005-09-01 00:35:15 +04:00
|
|
|
|
|
|
|
#include "opal/mca/base/base.h"
|
|
|
|
#include "debuggers.h"
|
|
|
|
|
2005-12-31 15:18:15 +03:00
|
|
|
OMPI_DECLSPEC int MPIR_being_debugged = 0;
|
|
|
|
OMPI_DECLSPEC volatile int MPIR_debug_gate = 0;
|
|
|
|
OMPI_DECLSPEC volatile int MPIR_debug_state = 0;
|
2005-09-01 00:35:15 +04:00
|
|
|
struct MPIR_PROCDESC {
|
|
|
|
char *host_name; /* something that can be passed to inet_addr */
|
|
|
|
char *executable_name; /* name of binary */
|
|
|
|
int pid; /* process pid */
|
|
|
|
};
|
2005-12-31 15:18:15 +03:00
|
|
|
OMPI_DECLSPEC struct MPIR_PROCDESC *MPIR_proctable = NULL;
|
2005-09-01 00:35:15 +04:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Wait for a TotalView-like debugger if asked.
|
|
|
|
*/
|
2005-12-31 15:18:15 +03:00
|
|
|
OMPI_DECLSPEC void ompi_wait_for_totalview(void)
|
2005-09-01 00:35:15 +04:00
|
|
|
{
|
|
|
|
int wait_for_totalview;
|
|
|
|
|
|
|
|
/* Do we need to wait for a TotalView-like debugger? */
|
|
|
|
mca_base_param_reg_int_name("orte",
|
|
|
|
"mpi_wait_for_totalview",
|
|
|
|
"Whether the MPI application "
|
|
|
|
"should wait for a debugger or not",
|
|
|
|
false, false, (int) false,
|
|
|
|
&wait_for_totalview);
|
|
|
|
if (wait_for_totalview) {
|
|
|
|
while (MPIR_debug_gate == 0) {
|
2005-12-11 01:10:39 +03:00
|
|
|
#if defined(__WINDOWS__)
|
2006-08-28 08:09:43 +04:00
|
|
|
Sleep(100); /* milliseconds */
|
2005-09-01 00:35:15 +04:00
|
|
|
#else
|
|
|
|
usleep(100000); /* microseconds */
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|