aboutsummaryrefslogtreecommitdiff
path: root/gdb/infcmd.c
diff options
context:
space:
mode:
authorVladimir Prus <vladimir@codesourcery.com>2008-03-14 18:57:44 +0000
committerVladimir Prus <vladimir@codesourcery.com>2008-03-14 18:57:44 +0000
commit32c1e744c108afe9bebd41766ab3025279878f85 (patch)
treeb2753a1c815eb9b5c2cca33ec36afe7ebcebf560 /gdb/infcmd.c
parentc04ea773f9e9764a17382e6c1e0cf5a8d24df67a (diff)
downloadgdb-32c1e744c108afe9bebd41766ab3025279878f85.zip
gdb-32c1e744c108afe9bebd41766ab3025279878f85.tar.gz
gdb-32c1e744c108afe9bebd41766ab3025279878f85.tar.bz2
Async mode fixes.
* Makefile.in (infcmd.o, inf-loop.o): Update dependencies. * breakpoint.c (bpstat_do_actions): In async mode, don't jump to top expecting stop_bpstat to be already updated. * event-loop.c (start_event_loop): Call async_enable_stdin on exception. * event-top.c (async_enable_stdin): Do nothing if sync_execution is not set. (command_handler): Do not setup continuation here. (command_line_handler_continuation): Move to... * top.c (command_line_handler_continuation): ... here. (execute_command): In async mode, register continuation. Don't check frame's language in running in async mode. * exceptions.c (throw_exception): Don't do exec_error_cleanups. * inf-loop.c (complete_execution): Inline into... (inferior_event_handler): ... here. Clear target_executing before doing any cleanups. Don't try to show prompt if the target was resumed. * infcmd.c (signal_command): Add support for async mode. (finish_command): Only add continuation if the target was successfully resumed. * remote.c (init_async_opts): Register to_get_thread_local_address handler. * mi/mi-interp.c (mi_cmd_interpreter_exec): Don't mess with sync_execution. * tui/tui-interp.c (tui_command_loop): Call async_enable_stdin on exception.
Diffstat (limited to 'gdb/infcmd.c')
-rw-r--r--gdb/infcmd.c29
1 files changed, 25 insertions, 4 deletions
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 70bf695..3a22c1c 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -48,6 +48,7 @@
#include "observer.h"
#include "target-descriptions.h"
#include "user-regs.h"
+#include "exceptions.h"
/* Functions exported for general use, in inferior.h: */
@@ -1005,10 +1006,28 @@ static void
signal_command (char *signum_exp, int from_tty)
{
enum target_signal oursig;
+ int async_exec = 0;
dont_repeat (); /* Too dangerous. */
ERROR_NO_INFERIOR;
+ /* Find out whether we must run in the background. */
+ if (signum_exp != NULL)
+ async_exec = strip_bg_char (&signum_exp);
+
+ /* 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 ();
+ }
+
if (!signum_exp)
error_no_arg (_("signal number"));
@@ -1321,10 +1340,15 @@ finish_command (char *arg, int from_tty)
print_stack_frame (get_selected_frame (NULL), 1, LOCATION);
}
+ proceed_to_finish = 1; /* We want stop_registers, please... */
+ proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 0);
+
/* If running asynchronously and the target support asynchronous
execution, set things up for the rest of the finish command to be
completed later on, when gdb has detected that the target has
- stopped, in fetch_inferior_event. */
+ stopped, in fetch_inferior_event.
+ Setup it only after proceed, so that if proceed throws, we don't
+ set continuation. */
if (target_can_async_p ())
{
arg1 =
@@ -1342,9 +1366,6 @@ finish_command (char *arg, int from_tty)
add_continuation (finish_command_continuation, arg1);
}
- proceed_to_finish = 1; /* We want stop_registers, please... */
- proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 0);
-
/* Do this only if not running asynchronously or if the target
cannot do async execution. Otherwise, complete this command when
the target actually stops, in fetch_inferior_event. */