Restore the auto-poll method for detecting debugger attachment, but only in the mpirx debugger module and only if the corresponding rate mca param is set.
Guess we missed it before, but add the debugger framework to the orte-info and ompi_info tools This commit was SVN r23667.
Этот коммит содержится в:
родитель
97fb426325
Коммит
2e223abe33
@ -95,6 +95,8 @@
|
||||
#include "orte/util/show_help.h"
|
||||
#include "orte/util/proc_info.h"
|
||||
#if !ORTE_DISABLE_FULL_SUPPORT
|
||||
#include "orte/mca/debugger/debugger.h"
|
||||
#include "orte/mca/debugger/base/base.h"
|
||||
#include "orte/mca/iof/iof.h"
|
||||
#include "orte/mca/iof/base/base.h"
|
||||
#include "orte/mca/oob/oob.h"
|
||||
@ -399,6 +401,14 @@ void ompi_info_open_components(void)
|
||||
opal_pointer_array_add(&component_map, map);
|
||||
|
||||
#if !ORTE_DISABLE_FULL_SUPPORT
|
||||
if (ORTE_SUCCESS != orte_debugger_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
map = OBJ_NEW(ompi_info_component_map_t);
|
||||
map->type = strdup("debugger");
|
||||
map->components = &orte_debugger_base_components_available;
|
||||
opal_pointer_array_add(&component_map, map);
|
||||
|
||||
if (ORTE_SUCCESS != mca_oob_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
|
@ -223,6 +223,7 @@ int main(int argc, char *argv[])
|
||||
#endif
|
||||
|
||||
#if !ORTE_DISABLE_FULL_SUPPORT
|
||||
opal_pointer_array_add(&mca_types, "debugger");
|
||||
opal_pointer_array_add(&mca_types, "iof");
|
||||
opal_pointer_array_add(&mca_types, "oob");
|
||||
opal_pointer_array_add(&mca_types, "odls");
|
||||
|
@ -92,7 +92,7 @@ void finalize(void)
|
||||
|
||||
/**
|
||||
* Initialization of data structures for running under a debugger
|
||||
* using the MPICH/TotalView parallel debugger interface. Before the
|
||||
* using an extended MPICH/TotalView parallel debugger interface. Before the
|
||||
* spawn we need to check if we are being run under a TotalView-like
|
||||
* debugger; if so then inform applications via an MCA parameter.
|
||||
*/
|
||||
@ -111,24 +111,31 @@ void init_before_spawn(orte_job_t *jdata)
|
||||
if (NULL != orte_debugger_test_daemon) {
|
||||
goto launchit;
|
||||
}
|
||||
/* create the attachment FIFO and put it into MPIR, setup readevent */
|
||||
memset(&attach,0,sizeof(attach));
|
||||
/* create a FIFO name in the session dir */
|
||||
attach_fifo = opal_os_path(false, orte_process_info.job_session_dir, "debugger_attach_fifo", NULL);
|
||||
if ((mkfifo(attach_fifo, FILE_MODE) < 0) && errno != EEXIST) {
|
||||
opal_output(0, "CANNOT CREATE FIFO");
|
||||
/* if we were given an auto-detect rate, then we want to setup
|
||||
* an event so we periodically do the check
|
||||
*/
|
||||
if (0 < orte_debugger_mpirx_check_rate) {
|
||||
ORTE_TIMER_EVENT(orte_debugger_mpirx_check_rate, 0, attach_debugger);
|
||||
} else {
|
||||
/* create the attachment FIFO and put it into MPIR, setup readevent */
|
||||
memset(&attach,0,sizeof(attach));
|
||||
/* create a FIFO name in the session dir */
|
||||
attach_fifo = opal_os_path(false, orte_process_info.job_session_dir, "debugger_attach_fifo", NULL);
|
||||
if ((mkfifo(attach_fifo, FILE_MODE) < 0) && errno != EEXIST) {
|
||||
opal_output(0, "CANNOT CREATE FIFO");
|
||||
free(attach_fifo);
|
||||
return;
|
||||
}
|
||||
strncpy(MPIR_attach_fifo, attach_fifo, MPIR_MAX_PATH_LENGTH);
|
||||
attach_fd = open(attach_fifo, O_RDONLY, 0);
|
||||
free(attach_fifo);
|
||||
return;
|
||||
opal_event_set(&attach, attach_fd, OPAL_EV_READ|OPAL_EV_PERSIST, attach_debugger, NULL);
|
||||
opal_event_add(&attach, 0);
|
||||
}
|
||||
strncpy(MPIR_attach_fifo, attach_fifo, MPIR_MAX_PATH_LENGTH);
|
||||
attach_fd = open(attach_fifo, O_RDONLY, 0);
|
||||
free(attach_fifo);
|
||||
opal_event_set(&attach, attach_fd, OPAL_EV_READ|OPAL_EV_PERSIST, attach_debugger, NULL);
|
||||
opal_event_add(&attach, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
launchit:
|
||||
launchit:
|
||||
if (orte_debug_flag) {
|
||||
opal_output(0, "Info: Spawned by a debugger");
|
||||
}
|
||||
@ -150,8 +157,8 @@ launchit:
|
||||
/* can only have one debugger */
|
||||
if (NULL != orte_debugger_daemon) {
|
||||
opal_output(0, "-------------------------------------------\n"
|
||||
"Only one debugger can be used on a job.\n"
|
||||
"-------------------------------------------\n");
|
||||
"Only one debugger can be used on a job.\n"
|
||||
"-------------------------------------------\n");
|
||||
ORTE_UPDATE_EXIT_STATUS(ORTE_ERROR_DEFAULT_EXIT_CODE);
|
||||
return;
|
||||
}
|
||||
@ -191,12 +198,12 @@ static void attach_debugger(int fd, short event, void *arg)
|
||||
int rc;
|
||||
int32_t ljob;
|
||||
orte_job_t *jdata;
|
||||
|
||||
opal_output(0, "ATTACHING DEBUGGER");
|
||||
struct timeval now;
|
||||
opal_event_t *check;
|
||||
|
||||
if (!MPIR_being_debugged && !orte_debugger_test_attach) {
|
||||
/* false alarm */
|
||||
return;
|
||||
goto RELEASE;
|
||||
}
|
||||
|
||||
if (orte_debug_flag) {
|
||||
@ -262,12 +269,18 @@ static void attach_debugger(int fd, short event, void *arg)
|
||||
}
|
||||
|
||||
RELEASE:
|
||||
/* reset the read event */
|
||||
opal_event_add(&attach, 0);
|
||||
/* reset the read or timer event */
|
||||
if (0 < orte_debugger_mpirx_check_rate) {
|
||||
check = (opal_event_t*)arg;
|
||||
now.tv_sec = orte_debugger_mpirx_check_rate;
|
||||
now.tv_usec = 0;
|
||||
opal_evtimer_add(check, &now);
|
||||
} else {
|
||||
opal_event_add(&attach, 0);
|
||||
}
|
||||
|
||||
/* notify the debugger that all is ready */
|
||||
MPIR_Breakpoint();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
BEGIN_C_DECLS
|
||||
|
||||
ORTE_MODULE_DECLSPEC extern orte_debugger_base_component_t mca_debugger_mpirx_component;
|
||||
extern int orte_debugger_mpirx_check_rate;
|
||||
extern orte_debugger_base_module_t orte_debugger_mpirx_module;
|
||||
|
||||
END_C_DECLS
|
||||
|
@ -13,10 +13,11 @@
|
||||
|
||||
#include "mpirx.h"
|
||||
|
||||
int orte_debugger_mpirx_check_rate=0;
|
||||
|
||||
static int component_open(void);
|
||||
static int component_query(mca_base_module_t **module, int *priority);
|
||||
|
||||
|
||||
/*
|
||||
* Struct of function pointers that need to be initialized
|
||||
*/
|
||||
@ -29,7 +30,7 @@ orte_debugger_base_component_t mca_debugger_mpirx_component = {
|
||||
ORTE_MINOR_VERSION, /* MCA module minor version */
|
||||
ORTE_RELEASE_VERSION, /* MCA module release version */
|
||||
|
||||
NULL,
|
||||
component_open,
|
||||
NULL,
|
||||
component_query /* module query */
|
||||
},
|
||||
@ -39,6 +40,16 @@ orte_debugger_base_component_t mca_debugger_mpirx_component = {
|
||||
}
|
||||
};
|
||||
|
||||
static int component_open(void)
|
||||
{
|
||||
mca_base_component_t *c = &mca_debugger_mpirx_component.base_version;
|
||||
|
||||
mca_base_param_reg_int(c, "check_rate",
|
||||
"Set rate (in secs) for auto-detect of debugger attachment (0 => do not check)",
|
||||
false, false, 0, &orte_debugger_mpirx_check_rate);
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
||||
static int component_query(mca_base_module_t **module, int *priority)
|
||||
{
|
||||
*priority = 10;
|
||||
|
@ -67,6 +67,8 @@
|
||||
#include "orte/util/show_help.h"
|
||||
#include "orte/util/proc_info.h"
|
||||
#if !ORTE_DISABLE_FULL_SUPPORT
|
||||
#include "orte/mca/debugger/debugger.h"
|
||||
#include "orte/mca/debugger/base/base.h"
|
||||
#include "orte/mca/iof/iof.h"
|
||||
#include "orte/mca/iof/base/base.h"
|
||||
#include "orte/mca/oob/oob.h"
|
||||
@ -352,6 +354,14 @@ void orte_info_open_components(void)
|
||||
opal_pointer_array_add(&component_map, map);
|
||||
|
||||
#if !ORTE_DISABLE_FULL_SUPPORT
|
||||
if (ORTE_SUCCESS != orte_debugger_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
map = OBJ_NEW(orte_info_component_map_t);
|
||||
map->type = strdup("debugger");
|
||||
map->components = &orte_debugger_base_components_available;
|
||||
opal_pointer_array_add(&component_map, map);
|
||||
|
||||
if (ORTE_SUCCESS != mca_oob_base_open()) {
|
||||
goto error;
|
||||
}
|
||||
|
@ -198,6 +198,7 @@ int main(int argc, char *argv[])
|
||||
#endif
|
||||
|
||||
#if !ORTE_DISABLE_FULL_SUPPORT
|
||||
opal_pointer_array_add(&mca_types, "debugger");
|
||||
opal_pointer_array_add(&mca_types, "iof");
|
||||
opal_pointer_array_add(&mca_types, "oob");
|
||||
opal_pointer_array_add(&mca_types, "odls");
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user