Example #1
0
    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)
Example #2
0
 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()
Example #3
0
 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()
Example #4
0
    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()
Example #5
0
 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()
Example #6
0
 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()
Example #7
0
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
Example #8
0
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
Example #9
0
 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)
Example #10
0
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
Example #11
0
 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()
Example #12
0
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
Example #13
0
 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()
Example #14
0
 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)
Example #15
0
 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)
Example #16
0
 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")
Example #17
0
 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)
Example #18
0
 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)
Example #19
0
 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)
Example #20
0
 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()
Example #21
0
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)
Example #22
0
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)
Example #23
0
 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")