def interrupt_inferior(self): """Sends a ^C to the inferior process.""" fredutil.fred_assert(self.personality_name() == 'gdb', "Unimplemented") n_pid = fredmanager.get_real_inferior_pid() if n_pid != -1: os.kill(n_pid, signal.SIGINT)
def setup_from_resume(self): """Set up data structures from a resume.""" global GS_FRED_MASTER_BRANCH_NAME fredutil.fred_assert(False, "Resume not yet implemented with branches.") self.branch = Branch(GS_FRED_MASTER_BRANCH_NAME) for i in range(0, dmtcpmanager.get_num_checkpoints()): self.branch.add_checkpoint(Checkpoint(i)) self.branch.set_current_checkpoint(self.branch.get_last_checkpoint()) self.update_state()
def stop_inferior(self): """Sends SIGSTOP to inferior process.""" n_pid = fredmanager.get_real_inferior_pid() fredutil.fred_assert(n_pid != -1) os.kill(n_pid, signal.SIGSTOP) # XXX: Figure out a way to avoid using fredio. import fredio fredio.wait_for_prompt() del fredio self.disable_sigstop()
def stop_inferior(self): """Sends SIGSTOP to inferior process.""" fredutil.fred_assert(self.personality_name() == 'gdb', "Unimplemented") n_pid = fredmanager.get_real_inferior_pid() fredutil.fred_assert(n_pid != -1) os.kill(n_pid, signal.SIGSTOP) # XXX: Figure out a way to avoid using fredio. import fredio fredio.wait_for_prompt() del fredio self.disable_sigstop()
def execute_fred_command(self, cmd, b_update=True): """Execute the given FredCommand.""" if cmd.b_ignore: fredutil.fred_debug("Skipping ignore command '%s'" % \ (cmd.s_native + " " + cmd.s_args)) return # Special handling for "log-breakpoint X" and "log-continue" cmds. if cmd.is_log_breakpoint(): self.set_log_breakpoint(int(cmd.s_args)) elif cmd.is_log_continue(): self.do_log_continue() else: fredutil.fred_assert(cmd.s_native != "") self._p.execute_command(cmd.s_native + " " + cmd.s_args + "\n", cmd.b_wait_for_prompt) if b_update: self.update_state()
def execute_fred_command(self, cmd, b_update=True): """Execute the given FredCommand.""" if cmd.b_ignore: fredutil.fred_debug("Skipping ignore command '%s'" % \ (cmd.s_native + " " + cmd.s_args)) return # Special handling for "log-breakpoint X" and "log-continue" cmds. if cmd.is_log_breakpoint(): self.set_log_breakpoint(int(cmd.s_args)) elif cmd.is_log_continue(): self.do_log_continue() else: fredutil.fred_assert(cmd.s_native != "") self._p.execute_command(cmd.s_native + " " + cmd.s_args + "\n", b_prompt=cmd.b_wait_for_prompt) if b_update: self.update_state()
def _execute_fred_command(s_cmd, s_arg=None): """Execute the given fred_command command and return its output.""" global g_child_subprocess fredutil.fred_assert(s_cmd in ["status", "info", "break", "continue"]) l_cmd = ["%s/fred_command" % GS_FREDHIJACK_PATH] fredutil.fred_assert(get_pid() != -1) s_path = "%s/fred-shm.%d" % (os.environ["DMTCP_TMPDIR"], get_pid()) l_cmd.append("--%s" % s_cmd) if s_arg != None: l_cmd.append(s_arg) l_cmd.append(s_path) fredutil.fred_debug("Executing fred_command: %s" % l_cmd) if s_cmd == "break": fredutil.fred_assert(g_child_subprocess == None) g_child_subprocess = fredutil.execute_background_shell_command(l_cmd) s_output = "" else: s_output = fredutil.execute_shell_command(l_cmd) return s_output
def _execute_fred_command(s_cmd, s_arg=None): """Execute the given fred_command command and return its output.""" global g_child_subprocess fredutil.fred_assert(s_cmd in ["status", "info", "break", "continue"]) l_cmd = ["%s/fred_command" % GS_FREDHIJACK_PATH] fredutil.fred_assert(get_virtual_inferior_pid() != -1) s_path = "%s/fred-shm.%d" % (os.environ["DMTCP_TMPDIR"], get_virtual_inferior_pid()) l_cmd.append("--%s" % s_cmd) if s_arg != None: l_cmd.append(s_arg) l_cmd.append(s_path) fredutil.fred_debug("Executing fred_command: %s" % l_cmd) if s_cmd == "break": fredutil.fred_assert(g_child_subprocess == None) g_child_subprocess = fredutil.execute_background_shell_command(l_cmd) s_output = "" else: s_output = fredutil.execute_shell_command(l_cmd) return s_output
def count(self): """Return integer representation of 'count' argument.""" fredutil.fred_assert(self.b_count_cmd, "Tried to get count of non-count cmd.") return fredutil.to_int(self.s_args, 1)
def wait_on_fred_breakpoint(): """Blocking wait until a FReD internal breakpoint is hit.""" global g_child_subprocess fredutil.fred_assert(g_child_subprocess != None) g_child_subprocess.communicate() g_child_subprocess = None
def within_user_code(self): """Return True if the current position is within user code.""" fredutil.fred_assert(self.personality_name() == "gdb") return self._p.within_user_code()
def set_scheduler_locking(self, n_on): fredutil.fred_assert(self.personality_name() == "gdb") fredutil.fred_debug("Turning scheduler locking to %s" % str(n_on)) self._p.set_scheduler_locking(n_on)
def set_count(self, n): """Set s_args flag to the given count.""" fredutil.fred_assert(self.b_count_cmd, "Tried to set count of non-count cmd.") self.s_args = str(n)
def program_is_runnable(self): """Return True if inferior is in a "runnable" state.""" if self.personality_name() == "gdb": return self._p.current_position() != None else: fredutil.fred_assert(False, "Unimplemented")
def set_count(self, n): """Set s_args flag to the given count.""" fredutil.fred_assert(self.b_count_cmd or n == 1, "Tried to set count of non-count cmd.") self.s_args = str(n)
def stop_inferior(self): """Sends SIGSTOP to inferior process.""" n_pid = fredutil.get_inferior_pid(self.get_debugger_pid()) fredutil.fred_assert(n_pid != -1) os.kill(n_pid, signal.SIGSTOP) fredio.wait_for_prompt()
def create_master_branch(s_name): """Create the master branch.""" fredutil.fred_assert(not branch_exists(s_name)) # Copy current tmpdir to correct path. relocate_dmtcp_tmpdir(s_name) load_dmtcp_tmpdir(s_name)