Factor out foreground/background execution command preparation.
All execution commands currently have this pattern:
/* If we must run in the background, but the target can't do it,
error out. */
if (async_exec && !target_can_async_p ())
error (_("Asynchronous execution not supported on this target."));
/* If we are not asked to run in the bg, then prepare to run in the
foreground, synchronously. */
if (!async_exec && target_can_async_p ())
{
/* Simulate synchronous execution. */
async_disable_stdin ();
}
This patch factors that into a shared function.
attach_command installs a cleanup to re-enable stdin, but that's not
necessary, as per the comment in prepare_execution_command. In any
case, if someday it turns out necessary, we have a single place to
install it now.
Tested on x86_64 Fedora 17, sync and async modes.
gdb/
2014-03-12 Pedro Alves <palves@redhat.com>
* infcmd.c (prepare_execution_command): New function, factored out
from several execution commands.
(run_command_1, continue_command, step_1, jump_command)
(signal_command, until_command, advance_command, finish_command)
(attach_command): Use prepare_execution_command.