Fix debugger attach
This commit was SVN r23921.
Этот коммит содержится в:
родитель
148ed00dd1
Коммит
2c1a658232
@ -23,6 +23,15 @@
|
||||
|
||||
BEGIN_C_DECLS
|
||||
|
||||
typedef struct {
|
||||
int output;
|
||||
bool dump_proctable;
|
||||
char *test_daemon;
|
||||
bool test_attach;
|
||||
} orte_debugger_base_t;
|
||||
|
||||
ORTE_DECLSPEC extern orte_debugger_base_t orte_debugger_base;
|
||||
|
||||
/*
|
||||
* function definitions
|
||||
*/
|
||||
@ -35,7 +44,6 @@ ORTE_DECLSPEC void orte_debugger_base_run_debugger(char *basename, opal_cmd_line
|
||||
ORTE_DECLSPEC void orte_debugger_base_init_after_spawn(orte_job_t *jdata);
|
||||
ORTE_DECLSPEC void orte_debugger_base_dump(void);
|
||||
|
||||
ORTE_DECLSPEC extern int orte_debugger_base_output;
|
||||
ORTE_DECLSPEC extern opal_list_t orte_debugger_base_components_available;
|
||||
|
||||
/* +++ begin MPICH/TotalView std debugger interface definitions */
|
||||
|
@ -24,7 +24,7 @@ int orte_debugger_base_close(void)
|
||||
}
|
||||
|
||||
/* Close all remaining available components */
|
||||
mca_base_components_close(orte_debugger_base_output,
|
||||
mca_base_components_close(orte_debugger_base.output,
|
||||
&orte_debugger_base_components_available, NULL);
|
||||
#endif
|
||||
|
||||
|
@ -92,14 +92,17 @@ void orte_debugger_base_init_after_spawn(orte_job_t *jdata)
|
||||
|
||||
if (MPIR_proctable) {
|
||||
/* already initialized */
|
||||
opal_output_verbose(5, orte_debugger_base.output,
|
||||
"%s: debugger already initialized",
|
||||
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME));
|
||||
return;
|
||||
}
|
||||
|
||||
/* fill in the proc table for the application processes */
|
||||
|
||||
if (orte_debug_flag) {
|
||||
opal_output(0, "Info: Setting up debugger process table for applications\n");
|
||||
}
|
||||
opal_output_verbose(5, orte_debugger_base.output,
|
||||
"%s: Setting up debugger process table for applications",
|
||||
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME));
|
||||
|
||||
MPIR_debug_state = 1;
|
||||
|
||||
@ -110,11 +113,11 @@ void orte_debugger_base_init_after_spawn(orte_job_t *jdata)
|
||||
MPIR_proctable = (struct MPIR_PROCDESC *) malloc(sizeof(struct MPIR_PROCDESC) *
|
||||
MPIR_proctable_size);
|
||||
if (MPIR_proctable == NULL) {
|
||||
opal_output(0, "Error: Out of memory\n");
|
||||
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
|
||||
return;
|
||||
}
|
||||
|
||||
if (orte_output_debugger_proctable) {
|
||||
if (orte_debugger_base.dump_proctable) {
|
||||
opal_output(orte_clean_output, "MPIR Proctable for job %s", ORTE_JOBID_PRINT(jdata->jobid));
|
||||
}
|
||||
|
||||
@ -140,14 +143,14 @@ void orte_debugger_base_init_after_spawn(orte_job_t *jdata)
|
||||
opal_os_path( false, appctx->cwd, appctx->app, NULL );
|
||||
}
|
||||
MPIR_proctable[i].pid = proc->pid;
|
||||
if (orte_output_debugger_proctable) {
|
||||
if (orte_debugger_base.dump_proctable) {
|
||||
opal_output(orte_clean_output, "%s: Host %s Exe %s Pid %d",
|
||||
ORTE_VPID_PRINT(i), MPIR_proctable[i].host_name,
|
||||
MPIR_proctable[i].executable_name, MPIR_proctable[i].pid);
|
||||
}
|
||||
}
|
||||
|
||||
if (orte_debug_flag) {
|
||||
if (0 < opal_output_get_verbosity(orte_debugger_base.output)) {
|
||||
orte_debugger_base_dump();
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@
|
||||
/*
|
||||
* Global variables
|
||||
*/
|
||||
int orte_debugger_base_output = -1;
|
||||
orte_debugger_base_t orte_debugger_base;
|
||||
opal_list_t orte_debugger_base_components_available;
|
||||
|
||||
orte_debugger_base_module_t orte_debugger;
|
||||
@ -66,14 +66,32 @@ int orte_debugger_base_open(void)
|
||||
*/
|
||||
int orte_debugger_base_open(void)
|
||||
{
|
||||
int value;
|
||||
|
||||
/* Debugging / verbose output. Always have stream open, with
|
||||
verbose set by the mca open system... */
|
||||
orte_debugger_base_output = opal_output_open(NULL);
|
||||
orte_debugger_base.output = opal_output_open(NULL);
|
||||
|
||||
mca_base_param_reg_int_name("orte",
|
||||
"output_debugger_proctable",
|
||||
"Whether or not to output the debugger proctable after launch (default: false)",
|
||||
true, false, 0, &value);
|
||||
orte_debugger_base.dump_proctable = OPAL_INT_TO_BOOL(value);
|
||||
|
||||
mca_base_param_reg_string_name("orte", "debugger_test_daemon",
|
||||
"Name of the executable to be used to simulate a debugger colaunch (relative or absolute path)",
|
||||
false, false, NULL, &orte_debugger_base.test_daemon);
|
||||
|
||||
mca_base_param_reg_int_name("orte",
|
||||
"debugger_test_attach",
|
||||
"Test debugger colaunch after debugger attachment",
|
||||
false, false, 0, &value);
|
||||
orte_debugger_base.test_attach = OPAL_INT_TO_BOOL(value);
|
||||
|
||||
/* Open up all available components */
|
||||
|
||||
if (ORTE_SUCCESS !=
|
||||
mca_base_components_open("debugger", orte_debugger_base_output,
|
||||
mca_base_components_open("debugger", orte_debugger_base.output,
|
||||
mca_debugger_base_static_components,
|
||||
&orte_debugger_base_components_available,
|
||||
true)) {
|
||||
|
@ -31,7 +31,7 @@ int orte_debugger_base_select(void)
|
||||
/*
|
||||
* Select the best component
|
||||
*/
|
||||
if( OPAL_SUCCESS != mca_base_select("debugger", orte_debugger_base_output,
|
||||
if( OPAL_SUCCESS != mca_base_select("debugger", orte_debugger_base.output,
|
||||
&orte_debugger_base_components_available,
|
||||
(mca_base_module_t **) &best_module,
|
||||
(mca_base_component_t **) &best_component) ) {
|
||||
|
@ -178,9 +178,7 @@ void init_before_spawn(orte_job_t *jdata)
|
||||
return;
|
||||
}
|
||||
|
||||
if (orte_debug_flag) {
|
||||
opal_output(0, "Info: Spawned by a debugger");
|
||||
}
|
||||
opal_output_verbose(1, orte_debugger_base.output, "Info: Spawned by a debugger");
|
||||
|
||||
/* tell the procs they are being debugged */
|
||||
env_name = mca_base_param_environ_variable("orte",
|
||||
|
@ -108,7 +108,7 @@ void init_before_spawn(orte_job_t *jdata)
|
||||
/* if we were given a test debugger, then we still want to
|
||||
* colaunch it
|
||||
*/
|
||||
if (NULL != orte_debugger_test_daemon) {
|
||||
if (NULL != orte_debugger_base.test_daemon) {
|
||||
goto launchit;
|
||||
}
|
||||
/* if we were given an auto-detect rate, then we want to setup
|
||||
@ -153,7 +153,7 @@ void init_before_spawn(orte_job_t *jdata)
|
||||
free(env_name);
|
||||
|
||||
/* check if we need to co-spawn the debugger daemons */
|
||||
if ('\0' != MPIR_executable_path[0] || NULL != orte_debugger_test_daemon) {
|
||||
if ('\0' != MPIR_executable_path[0] || NULL != orte_debugger_base.test_daemon) {
|
||||
/* can only have one debugger */
|
||||
if (NULL != orte_debugger_daemon) {
|
||||
opal_output(0, "-------------------------------------------\n"
|
||||
@ -179,8 +179,8 @@ void init_before_spawn(orte_job_t *jdata)
|
||||
opal_pointer_array_set_item(orte_job_data, ljob, orte_debugger_daemon);
|
||||
/* create an app_context for the debugger daemon */
|
||||
app = OBJ_NEW(orte_app_context_t);
|
||||
if (NULL != orte_debugger_test_daemon) {
|
||||
app->app = strdup(orte_debugger_test_daemon);
|
||||
if (NULL != orte_debugger_base.test_daemon) {
|
||||
app->app = strdup(orte_debugger_base.test_daemon);
|
||||
} else {
|
||||
app->app = strdup((char*)MPIR_executable_path);
|
||||
}
|
||||
@ -201,15 +201,14 @@ static void attach_debugger(int fd, short event, void *arg)
|
||||
struct timeval now;
|
||||
opal_event_t *check;
|
||||
|
||||
if (!MPIR_being_debugged && !orte_debugger_test_attach) {
|
||||
if (!MPIR_being_debugged && !orte_debugger_base.test_attach) {
|
||||
/* false alarm */
|
||||
goto RELEASE;
|
||||
}
|
||||
|
||||
if (orte_debug_flag) {
|
||||
opal_output(0, "%s Attaching debugger %s", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
||||
(NULL == orte_debugger_test_daemon) ? MPIR_executable_path : orte_debugger_test_daemon);
|
||||
}
|
||||
opal_output_verbose(1, orte_debugger_base.output,
|
||||
"%s Attaching debugger %s", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
||||
(NULL == orte_debugger_base.test_daemon) ? MPIR_executable_path : orte_debugger_base.test_daemon);
|
||||
|
||||
/* read the file descriptor to clear that event, if necessary */
|
||||
if (orte_debugger_mpirx_check_rate <= 0) {
|
||||
@ -225,7 +224,7 @@ static void attach_debugger(int fd, short event, void *arg)
|
||||
* data is already available, so we only need to
|
||||
* check to see if we should spawn any daemons
|
||||
*/
|
||||
if ('\0' != MPIR_executable_path[0] || NULL != orte_debugger_test_daemon) {
|
||||
if ('\0' != MPIR_executable_path[0] || NULL != orte_debugger_base.test_daemon) {
|
||||
/* can only have one debugger */
|
||||
if (NULL != orte_debugger_daemon) {
|
||||
opal_output(0, "-------------------------------------------\n"
|
||||
@ -253,8 +252,8 @@ static void attach_debugger(int fd, short event, void *arg)
|
||||
opal_pointer_array_set_item(orte_job_data, ljob, jdata);
|
||||
/* create an app_context for the debugger daemon */
|
||||
app = OBJ_NEW(orte_app_context_t);
|
||||
if (NULL != orte_debugger_test_daemon) {
|
||||
app->app = strdup(orte_debugger_test_daemon);
|
||||
if (NULL != orte_debugger_base.test_daemon) {
|
||||
app->app = strdup(orte_debugger_base.test_daemon);
|
||||
} else {
|
||||
app->app = strdup((char*)MPIR_executable_path);
|
||||
}
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include "orte/types.h"
|
||||
#include "orte/util/proc_info.h"
|
||||
#include "orte/util/error_strings.h"
|
||||
#include "orte/mca/debugger/base/base.h"
|
||||
#include "orte/mca/errmgr/errmgr.h"
|
||||
#include "orte/mca/rml/rml.h"
|
||||
#include "orte/mca/rml/rml_types.h"
|
||||
@ -277,7 +278,7 @@ static void process_msg(int fd, short event, void *data)
|
||||
job = jdata->jobid;
|
||||
|
||||
/* output debugger proctable, if requested */
|
||||
if (orte_output_debugger_proctable) {
|
||||
if (orte_debugger_base.dump_proctable) {
|
||||
char *output;
|
||||
opal_dss.print(&output, NULL, jdata->map, ORTE_JOB_MAP);
|
||||
if (orte_xml_output) {
|
||||
|
@ -85,11 +85,8 @@ bool orte_allocation_required;
|
||||
char *orte_launch_agent = NULL;
|
||||
char **orted_cmd_line=NULL;
|
||||
|
||||
/* debugger flags */
|
||||
/* debugger job */
|
||||
orte_job_t *orte_debugger_daemon=NULL;
|
||||
bool orte_output_debugger_proctable=false;
|
||||
char *orte_debugger_test_daemon=NULL;
|
||||
bool orte_debugger_test_attach=false;
|
||||
|
||||
/* exit flags */
|
||||
int orte_exit_status = 0;
|
||||
|
@ -612,11 +612,8 @@ ORTE_DECLSPEC extern bool orte_allocation_required;
|
||||
ORTE_DECLSPEC extern char *orte_launch_agent;
|
||||
ORTE_DECLSPEC extern char **orted_cmd_line;
|
||||
|
||||
/* debugger flags */
|
||||
/* debugger job */
|
||||
ORTE_DECLSPEC extern orte_job_t *orte_debugger_daemon;
|
||||
ORTE_DECLSPEC extern bool orte_output_debugger_proctable;
|
||||
ORTE_DECLSPEC extern char *orte_debugger_test_daemon;
|
||||
ORTE_DECLSPEC extern bool orte_debugger_test_attach;
|
||||
|
||||
/* exit flags */
|
||||
ORTE_DECLSPEC extern bool orte_abnormal_term_ordered;
|
||||
|
@ -152,22 +152,6 @@ int orte_register_params(void)
|
||||
true, false, 0, &value);
|
||||
orte_in_parallel_debugger = OPAL_INT_TO_BOOL(value);
|
||||
|
||||
mca_base_param_reg_int_name("orte",
|
||||
"output_debugger_proctable",
|
||||
"Whether or not to output the debugger proctable after launch (default: false)",
|
||||
true, false, 0, &value);
|
||||
orte_output_debugger_proctable = OPAL_INT_TO_BOOL(value);
|
||||
|
||||
mca_base_param_reg_string_name("orte", "debugger_test_daemon",
|
||||
"Name of the executable to be used to simulate a debugger colaunch (relative or absolute path)",
|
||||
false, false, NULL, &orte_debugger_test_daemon);
|
||||
|
||||
mca_base_param_reg_int_name("orte",
|
||||
"debugger_test_attach",
|
||||
"Test debugger colaunch after debugger attachment",
|
||||
false, false, 0, &value);
|
||||
orte_debugger_test_attach = OPAL_INT_TO_BOOL(value);
|
||||
|
||||
mca_base_param_reg_int_name("orte", "do_not_launch",
|
||||
"Perform all necessary operations to prepare to launch the application, but do not actually launch it",
|
||||
false, false, (int)false, &value);
|
||||
|
@ -528,8 +528,12 @@ int orterun(int argc, char *argv[])
|
||||
* prior to orte_init when a debugger wants to launch
|
||||
* us
|
||||
*/
|
||||
MPIR_proctable = NULL;
|
||||
MPIR_proctable_size = 0;
|
||||
if (NULL == MPIR_proctable) {
|
||||
rc = ORTE_SUCCESS;
|
||||
}
|
||||
if (0 == MPIR_proctable_size) {
|
||||
rc = ORTE_SUCCESS;
|
||||
}
|
||||
if (0 == MPIR_being_debugged) {
|
||||
rc = ORTE_SUCCESS;
|
||||
}
|
||||
@ -542,15 +546,21 @@ int orterun(int argc, char *argv[])
|
||||
if (1 == MPIR_partial_attach_ok) {
|
||||
rc = ORTE_SUCCESS;
|
||||
}
|
||||
memset((char*)MPIR_executable_path, 0, MPIR_MAX_PATH_LENGTH);
|
||||
memset((char*)MPIR_server_arguments, 0, MPIR_MAX_ARG_LENGTH);
|
||||
if (NULL == MPIR_executable_path) {
|
||||
rc = ORTE_SUCCESS;
|
||||
}
|
||||
if (NULL == MPIR_server_arguments) {
|
||||
rc = ORTE_SUCCESS;
|
||||
}
|
||||
if (0 == MPIR_forward_output) {
|
||||
rc = ORTE_SUCCESS;
|
||||
}
|
||||
if (0 == MPIR_forward_comm) {
|
||||
rc = ORTE_SUCCESS;
|
||||
}
|
||||
memset((char*)MPIR_attach_fifo, 0, MPIR_MAX_PATH_LENGTH);
|
||||
if (NULL == MPIR_attach_fifo) {
|
||||
rc = ORTE_SUCCESS;
|
||||
}
|
||||
foo = MPIR_Breakpoint;
|
||||
|
||||
/* Check for some "global" command line params */
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user