def fred_setup(): """Perform any setup needed by FReD before entering an I/O loop.""" global g_debugger, gs_resume_dir_path, GS_FRED_TMPDIR, gb_show_child_output # Parse command line args and set up environment. l_cmd = parse_program_args() # Set up the FReD global debugger setup_debugger(l_cmd[0]) # Set up I/O handling # (only spawn if we are not resuming:) b_resume = gs_resume_dir_path != None if not b_resume: cleanup_fred_files() setup_fredio(l_cmd, True) g_debugger.create_master_branch() else: setup_fredio(l_cmd, False) dmtcpmanager.resume(GS_FRED_TMPDIR, gs_resume_dir_path) g_debugger.setup_from_resume() # XXX: Right now this is a hack to get the virtualized pid of the # inferior. We should make this more robust. Ideally we could have # support from DMTCP (via dmtcp_command) to tell us the inferior # virtualized pid. fredutil.fred_assert(g_debugger.personality_name() == "gdb") n_inf_pid = int(g_debugger.evaluate_expression("getpid()")) fredmanager.set_virtual_inferior_pid(n_inf_pid) g_debugger.set_real_debugger_pid(fredio.get_child_pid())
def fred_setup(): """Perform any setup needed by FReD before entering an I/O loop.""" global g_debugger, gs_resume_dir_path, GS_FRED_TMPDIR # Parse command line args and set up environment. l_cmd = parse_program_args() # Set up the FReD global debugger setup_debugger(l_cmd[0]) # Set up I/O handling # (only spawn if we are not resuming:) b_resume = gs_resume_dir_path != None if not b_resume: cleanup_fred_files() setup_fredio(l_cmd, True) g_debugger.create_master_branch() else: setup_fredio(l_cmd, False) dmtcpmanager.resume(GS_FRED_TMPDIR, gs_resume_dir_path) g_debugger.setup_from_resume() # XXX: Right now this is a hack to get the virtualized pid of the # inferior. We should make this more robust. Ideally we could have # support from DMTCP (via dmtcp_command) to tell us the inferior # virtualized pid. fredutil.fred_assert(g_debugger.personality_name() == "gdb") n_inf_pid = int(g_debugger.evaluate_expression("getpid()")) fredmanager.set_pid(n_inf_pid) g_debugger.set_debugger_pid(fredio.get_child_pid())
def cleanup_fred_files(): """Remove FReD temporary directory and recreate a clean tree.""" global GS_FRED_TMPDIR # Create a new DMTCP tmpdir if it doesn't exist: if not os.path.exists(GS_FRED_TMPDIR): os.makedirs(GS_DMTCP_TMPDIR, 0755) return fredutil.fred_info("Removing previous temporary directory '%s'" % GS_FRED_TMPDIR) fredutil.fred_assert(GS_FRED_TMPDIR.find("/tmp") != -1) shutil.rmtree(GS_FRED_TMPDIR, ignore_errors=True) os.makedirs(GS_DMTCP_TMPDIR, 0755)
def cleanup_fred_files(): """Remove FReD temporary directory and recreate a clean tree.""" global GS_FRED_TMPDIR # Create a new DMTCP tmpdir if it doesn't exist: if not os.path.exists(GS_FRED_TMPDIR): os.makedirs(GS_DMTCP_TMPDIR, 0755) return fredutil.fred_info("Removing previous temporary directory '%s'" % \ GS_FRED_TMPDIR) fredutil.fred_assert(GS_FRED_TMPDIR.find("/tmp") != -1) shutil.rmtree(GS_FRED_TMPDIR, ignore_errors=True) os.makedirs(GS_DMTCP_TMPDIR, 0755)