1 /* -*- Mode: C; c-basic-offset:4 ; -*- */ 2 /* 3 * (C) 2008 by Argonne National Laboratory. 4 * See COPYRIGHT in top-level directory. 5 */ 6 7 #include "hydra.h" 8 #include "debugger.h" 9 10 struct MPIR_PROCDESC *MPIR_proctable = NULL; 11 int MPIR_proctable_size = 0; 12 int MPIR_i_am_starter = 0; 13 int MPIR_partial_attach_ok = 0; 14 15 volatile int MPIR_debug_state = 0; 16 char *MPIR_debug_abort_string = 0; 17 18 volatile int MPIR_being_debugged = 0; 19 20 int (*MPIR_breakpointFn) (void) = MPIR_Breakpoint; 21 MPIR_Breakpoint(void)22int MPIR_Breakpoint(void) 23 { 24 return 0; 25 } 26 HYDT_dbg_setup_procdesc(struct HYD_pg * pg)27HYD_status HYDT_dbg_setup_procdesc(struct HYD_pg * pg) 28 { 29 struct HYD_proxy *proxy; 30 struct HYD_exec *exec; 31 int i, j, np; 32 HYD_status status = HYD_SUCCESS; 33 34 HYDU_FUNC_ENTER(); 35 36 HYDU_MALLOC(MPIR_proctable, struct MPIR_PROCDESC *, 37 pg->pg_process_count * sizeof(struct MPIR_PROCDESC), status); 38 39 for (proxy = pg->proxy_list, i = 0; proxy; proxy = proxy->next) { 40 j = 0; 41 for (exec = proxy->exec_list; exec; exec = exec->next) { 42 for (np = 0; np < exec->proc_count; np++) { 43 MPIR_proctable[i].host_name = HYDU_strdup(proxy->node->hostname); 44 MPIR_proctable[i].pid = proxy->pid[j++]; 45 if (exec->exec[0]) 46 MPIR_proctable[i].executable_name = HYDU_strdup(exec->exec[0]); 47 else 48 MPIR_proctable[i].executable_name = NULL; 49 i++; 50 } 51 } 52 } 53 54 MPIR_proctable_size = pg->pg_process_count; 55 MPIR_debug_state = MPIR_DEBUG_SPAWNED; 56 (*MPIR_breakpointFn) (); 57 58 fn_exit: 59 HYDU_FUNC_EXIT(); 60 return status; 61 62 fn_fail: 63 goto fn_exit; 64 } 65 HYDT_dbg_free_procdesc(void)66void HYDT_dbg_free_procdesc(void) 67 { 68 int i; 69 70 for (i = 0; i < MPIR_proctable_size; i++) { 71 if (MPIR_proctable[i].host_name) 72 HYDU_FREE(MPIR_proctable[i].host_name); 73 if (MPIR_proctable[i].executable_name) 74 HYDU_FREE(MPIR_proctable[i].executable_name); 75 } 76 HYDU_FREE(MPIR_proctable); 77 } 78