Exemplo n.º 1
0
def dispatch_command(s_command, b_wait=False):
    """Given a user command, dispatches and executes it in the right way.
    If b_wait is True, wait for the debugger prompt after each command."""
    fredutil.fred_timer_start(s_command)
    # TODO: Currently we do not log fred commands. Do we need to?
    if is_fred_command(s_command):
        handle_fred_command(s_command)
    else:
        fredio.send_command(s_command)
        g_debugger.log_command(s_command)
        if b_wait:
            fredio.wait_for_prompt()
    fredutil.fred_timer_stop(s_command)
Exemplo n.º 2
0
def fred_setup_as_module(l_cmd, s_dmtcp_port, b_debug):
    """Perform setup for FReD when being used as a module, return g_debugger.
    For example, fredtest.py uses FReD as a module."""
    global g_debugger
    cleanup_fred_files()
    setup_environment_variables(s_dmtcp_port, b_debug)
    setup_debugger(l_cmd[0])
    setup_fredio(l_cmd, True)
    # Since modules won't use the main_io_loop, we perform the debugger setup
    # requiring a debugger prompt here.
    fredio.wait_for_prompt()
    interactive_debugger_setup()
    return g_debugger
Exemplo n.º 3
0
def dispatch_command(s_command, b_wait=False):
    """Given a user command, dispatches and executes it in the right way.
    If b_wait is True, wait for the debugger prompt after each command."""
    fredutil.fred_timer_start(s_command)
    # TODO: Currently we do not log fred commands. Do we need to?
    if is_fred_command(s_command):
        handle_fred_command(s_command)
    else:
        fredio.send_command(s_command)
        g_debugger.log_command(s_command)
        if b_wait:
           fredio.wait_for_prompt()
    fredutil.fred_timer_stop(s_command)
Exemplo n.º 4
0
def fred_setup_as_module(l_cmd, s_dmtcp_port, b_debug, b_show_child_output):
    """Perform setup for FReD when being used as a module, return g_debugger.
    For example, fredtest.py uses FReD as a module."""
    global g_debugger, gb_show_child_output
    cleanup_fred_files()
    setup_environment_variables(s_dmtcp_port, b_debug)
    setup_debugger(l_cmd[0])
    gb_show_child_output = b_show_child_output
    setup_fredio(l_cmd, True)
    # Since modules won't use the main_io_loop, we perform the debugger setup
    # requiring a debugger prompt here.
    g_debugger.set_real_debugger_pid(fredio.get_child_pid())
    fredio.wait_for_prompt()
    interactive_debugger_setup()
    return g_debugger
Exemplo n.º 5
0
def dispatch_command(s_command, b_wait=False):
    """Given a user command, dispatches and executes it in the right way.
    If b_wait is True, wait for the debugger prompt after each command."""
    fredutil.fred_timer_start(s_command)
    # TODO: Currently we do not log fred commands. Do we need to?
    if is_fred_command(s_command):
        handle_fred_command(s_command)
    else:
        # XXX: Figure out a more elegant way to do this. We can't set the
        # inferior pid until we know the inferior is alive, so we keep trying
        # to update it with every command issued until it succeeds.
        if fredmanager.get_pid() == -1:
            n_inf_pid = fredutil.get_inferior_pid(fredio.get_child_pid())
            fredmanager.set_pid(n_inf_pid)

        fredio.send_command(s_command)
        g_debugger.log_command(s_command)
        if b_wait:
            fredio.wait_for_prompt()
    fredutil.fred_timer_stop(s_command)
Exemplo n.º 6
0
def main_io_loop(b_skip_prompt=False):
    """Main I/O loop to get and handle user commands."""
    global g_source_script
    if not b_skip_prompt:
        # This is true typically on resume. gdb doesn't print the prompt when
        # resuming from a checkpoint, so we don't wait for it here.
        fredio.wait_for_prompt()
    interactive_debugger_setup()
    s_last_command = ""
    while True:
        try:
            # Get one user command (blocking):
            s_command = fredio.get_command()
            # Special case: user entered '\n' => execute last command again.
            if s_command == "":
                s_command = s_last_command
            dispatch_command(s_command)
            s_last_command = s_command
        except KeyboardInterrupt:
            g_debugger.interrupt_inferior()
            fredio.wait_for_prompt()
Exemplo n.º 7
0
def main_io_loop(b_skip_prompt=False):
    """Main I/O loop to get and handle user commands."""
    global g_source_script, g_debugger
    if not b_skip_prompt:
        # This is true typically on resume. gdb doesn't print the prompt when
        # resuming from a checkpoint, so we don't wait for it here.
        fredio.wait_for_prompt()
    interactive_debugger_setup()
    s_last_command = ""
    while True:
        try:
            # Get one user command (blocking):
            s_command = fredio.get_command()
            # Special case: user entered '\n' => execute last command again.
            if s_command == '':
                s_command = s_last_command
            dispatch_command(s_command)
            s_last_command = s_command
        except KeyboardInterrupt:
            if g_debugger.personality_name() not in ("Pdb", "perl"):
                g_debugger.interrupt_inferior()
            fredio.wait_for_prompt()