1999-10-06 07:13:56 +08:00
|
|
|
/* Handling of inferior events for the event loop for GDB, the GNU debugger.
|
2012-01-04 16:17:56 +08:00
|
|
|
Copyright (C) 1999, 2007-2012 Free Software Foundation, Inc.
|
1999-10-06 07:13:56 +08:00
|
|
|
Written by Elena Zannoni <ezannoni@cygnus.com> of Cygnus Solutions.
|
|
|
|
|
|
|
|
This file is part of GDB.
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
2007-08-24 02:08:50 +08:00
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
1999-10-06 07:13:56 +08:00
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
2011-01-09 11:08:57 +08:00
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
1999-10-06 07:13:56 +08:00
|
|
|
|
|
|
|
#include "defs.h"
|
2011-01-09 11:08:57 +08:00
|
|
|
#include "inferior.h" /* For fetch_inferior_event. */
|
|
|
|
#include "target.h" /* For enum inferior_event_type. */
|
1999-10-06 07:13:56 +08:00
|
|
|
#include "event-loop.h"
|
|
|
|
#include "event-top.h"
|
|
|
|
#include "inf-loop.h"
|
2008-03-14 23:14:49 +08:00
|
|
|
#include "remote.h"
|
2005-01-12 Andrew Cagney <cagney@gnu.org>
* exceptions.h (enum return_reason, RETURN_MASK)
(RETURN_MASK_QUIT, RETURN_MASK_ERROR, RETURN_MASK_ALL)
(return_mask, throw_exception, catch_exceptions_ftype)
(catch_exceptions_with_msg, catch_errors_ftype, catch_errors)
(catch_command_errors_ftype, catch_command_errors): Move to
exceptions.h.
* exceptions.c, exceptions.h: New files.
* top.c: Do not include <setjmp.h>.
(SIGJMP_BUF, SIGSETJMP, SIGLONGJMP, catch_return)
(throw_exception, catcher, catch_exceptions)
(catch_exceptions_with_msg, struct catch_errors_args)
(do_catch_errors, catch_errors, struct captured_command_args)
(do_captured_command, catch_command_errors): Move to exceptions.c.
* wrapper.c, wince.c, win32-nat.c, utils.c: Include "exceptions.h".
* tui/tui-interp.c, top.c, thread.c, symmisc.c: Ditto.
* symfile-mem.c, stack.c, solib.c, rs6000-nat.c: Ditto.
* remote-sds.c, remote-mips.c, remote-fileio.c: Ditto.
* remote-e7000.c, objc-lang.c, ocd.c: Ditto.
* remote.c, nto-procfs.c, monitor.c, mi/mi-main.c: Ditto.
* main.c, m32r-rom.c, infrun.c, inf-loop.c: Ditto.
* hppa-hpux-tdep.c, frame.c, event-top.c, event-loop.c: Ditto.
* corelow.c, corefile.c, cli/cli-interp.c, breakpoint.c: Ditto.
* ada-valprint.c, ada-lang.c: Ditto.
* Makefile.in (HFILES_NO_SRCDIR, COMMON_OBS): Add exceptions.h and
exceptions.o. Update all dependencies.
2005-01-13 02:31:35 +08:00
|
|
|
#include "exceptions.h"
|
2008-03-15 02:57:44 +08:00
|
|
|
#include "language.h"
|
2008-07-10 06:16:15 +08:00
|
|
|
#include "gdbthread.h"
|
2011-05-27 Pedro Alves <pedro@codesourcery.com>
* defs.h (struct continuation, continuation_ftype)
(continuation_free_arg_ftype, add_continuation)
(do_all_continuations, do_all_continuations_thread)
(discard_all_continuations, discard_all_continuations_thread)
(add_intermediate_continuation, do_all_intermediate_continuations)
(do_all_intermediate_continuations_thread)
(discard_all_intermediate_continuations)
(discard_all_intermediate_continuations_thread)
(add_inferior_continuation, do_all_inferior_continuations)
(discard_all_inferior_continuations): Move to ...
* continuations.h: ... this new file.
* breakpoint.c, continuations.c, event-top.c, inf-loop.c,
infcmd.c, inferior.c, infrun.c, interps.c: Include
continuations.h.
2011-05-28 02:28:18 +08:00
|
|
|
#include "continuations.h"
|
2011-09-03 00:56:30 +08:00
|
|
|
#include "interps.h"
|
2011-12-17 04:29:28 +08:00
|
|
|
#include "top.h"
|
1999-10-06 07:13:56 +08:00
|
|
|
|
|
|
|
static int fetch_inferior_event_wrapper (gdb_client_data client_data);
|
|
|
|
|
2011-01-09 11:08:57 +08:00
|
|
|
/* General function to handle events in the inferior. So far it just
|
1999-10-06 07:13:56 +08:00
|
|
|
takes care of detecting errors reported by select() or poll(),
|
|
|
|
otherwise it assumes that all is OK, and goes on reading data from
|
2011-01-09 11:08:57 +08:00
|
|
|
the fd. This however may not always be what we want to do. */
|
1999-10-06 07:13:56 +08:00
|
|
|
void
|
|
|
|
inferior_event_handler (enum inferior_event_type event_type,
|
|
|
|
gdb_client_data client_data)
|
|
|
|
{
|
2011-08-27 05:45:24 +08:00
|
|
|
struct cleanup *cleanup_if_error = make_bpstat_clear_actions_cleanup ();
|
2010-05-15 05:25:51 +08:00
|
|
|
|
1999-10-06 07:13:56 +08:00
|
|
|
switch (event_type)
|
|
|
|
{
|
|
|
|
case INF_REG_EVENT:
|
|
|
|
/* Use catch errors for now, until the inner layers of
|
|
|
|
fetch_inferior_event (i.e. readchar) can return meaningful
|
|
|
|
error status. If an error occurs while getting an event from
|
2011-05-31 02:04:32 +08:00
|
|
|
the target, just cancel the current command. */
|
1999-10-06 07:13:56 +08:00
|
|
|
if (!catch_errors (fetch_inferior_event_wrapper,
|
|
|
|
client_data, "", RETURN_MASK_ALL))
|
|
|
|
{
|
2011-08-27 05:45:24 +08:00
|
|
|
bpstat_clear_actions ();
|
2011-05-31 02:04:32 +08:00
|
|
|
do_all_intermediate_continuations (1);
|
|
|
|
do_all_continuations (1);
|
2008-03-15 03:55:51 +08:00
|
|
|
async_enable_stdin ();
|
1999-10-06 07:13:56 +08:00
|
|
|
display_gdb_prompt (0);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case INF_EXEC_COMPLETE:
|
Non-stop inferior control.
* infrun.c (resume): In non-stop mode, always resume just one
thread.
(proceed): Don't call prepare_to_proceed in non-stop mode.
(fetch_inferior_event): In non-stop mode, switch context before
handling the event.
(error_is_running, ensure_not_running): New.
(handle_inferior_event): In non-stop mode: Mark only the event
thread as stopped. Require that the target module manages adding
threads to the thread list. Assert that there isn't a
deferred_step_ptid set. Don't switch to infwait_thread_hop_state.
(normal_stop): Only mark not-running if inferior hasn't exited.
In non-stop mode, only mark the event thread.
* thread.c:Include "cli/cli-decode.h".
(print_thread_info): Don't read from a running thread.
Output "(running)" if thread is running.
(switch_to_thread): Don't read stop_pc if thread is executing.
(do_restore_current_thread_cleanup): Don't write to a running
thread.
(thread_apply_all_command): Don't read from a running thread. In
non-stop mode, do a full context-switch instead of just switching
threads.
(thread_apply_command): In non-stop mode, do a full context-switch
instead of just switching threads.
(do_captured_thread_select): Likewise. Inform user if selected
thread is running.
(_initialize_thread): Mark "info threads" and "thread" and
async_ok.
* inf-loop.c (inferior_event_handler): In non-stop mode, don't
unregister the target from the event loop.
* infcmd.c (continue_command, step_1, jump_command)
(signal_command): Ensure the selected thread isn't running.
(interrupt_target_command): In non-stop mode, interrupt only the
selected thread.
* inferior.h (error_is_running, ensure_not_running): Declare.
* target.h (struct target_ops): Add ptid argument to the to_stop
member.
(target_stop): Add ptid_t argument.
* target.c (update_current_target): Add ptid argument to to_stop's
type.
(debug_to_stop): Add ptid_t argument.
(debug_to_rcmd): Set to_stop_ptid.
* remote.c (remote_stop): Add ptid_t argument.
(async_remote_interrupt): Add inferior_ptid to target_stop.
* inf-ptrace.c (inf_ptrace_stop): Add ptid argument.
* Makefile.in (thread.o): Depend on $(cli_decode_h).
2008-07-10 06:42:43 +08:00
|
|
|
if (!non_stop)
|
|
|
|
{
|
2011-01-09 11:08:57 +08:00
|
|
|
/* Unregister the inferior from the event loop. This is done
|
Non-stop inferior control.
* infrun.c (resume): In non-stop mode, always resume just one
thread.
(proceed): Don't call prepare_to_proceed in non-stop mode.
(fetch_inferior_event): In non-stop mode, switch context before
handling the event.
(error_is_running, ensure_not_running): New.
(handle_inferior_event): In non-stop mode: Mark only the event
thread as stopped. Require that the target module manages adding
threads to the thread list. Assert that there isn't a
deferred_step_ptid set. Don't switch to infwait_thread_hop_state.
(normal_stop): Only mark not-running if inferior hasn't exited.
In non-stop mode, only mark the event thread.
* thread.c:Include "cli/cli-decode.h".
(print_thread_info): Don't read from a running thread.
Output "(running)" if thread is running.
(switch_to_thread): Don't read stop_pc if thread is executing.
(do_restore_current_thread_cleanup): Don't write to a running
thread.
(thread_apply_all_command): Don't read from a running thread. In
non-stop mode, do a full context-switch instead of just switching
threads.
(thread_apply_command): In non-stop mode, do a full context-switch
instead of just switching threads.
(do_captured_thread_select): Likewise. Inform user if selected
thread is running.
(_initialize_thread): Mark "info threads" and "thread" and
async_ok.
* inf-loop.c (inferior_event_handler): In non-stop mode, don't
unregister the target from the event loop.
* infcmd.c (continue_command, step_1, jump_command)
(signal_command): Ensure the selected thread isn't running.
(interrupt_target_command): In non-stop mode, interrupt only the
selected thread.
* inferior.h (error_is_running, ensure_not_running): Declare.
* target.h (struct target_ops): Add ptid argument to the to_stop
member.
(target_stop): Add ptid_t argument.
* target.c (update_current_target): Add ptid argument to to_stop's
type.
(debug_to_stop): Add ptid_t argument.
(debug_to_rcmd): Set to_stop_ptid.
* remote.c (remote_stop): Add ptid_t argument.
(async_remote_interrupt): Add inferior_ptid to target_stop.
* inf-ptrace.c (inf_ptrace_stop): Add ptid argument.
* Makefile.in (thread.o): Depend on $(cli_decode_h).
2008-07-10 06:42:43 +08:00
|
|
|
so that when the inferior is not running we don't get
|
|
|
|
distracted by spurious inferior output. */
|
|
|
|
if (target_has_execution)
|
|
|
|
target_async (NULL, 0);
|
|
|
|
}
|
2008-03-15 02:57:44 +08:00
|
|
|
|
2008-11-06 04:23:07 +08:00
|
|
|
/* Do all continuations associated with the whole inferior (not
|
|
|
|
a particular thread). */
|
|
|
|
if (!ptid_equal (inferior_ptid, null_ptid))
|
2011-05-31 02:04:32 +08:00
|
|
|
do_all_inferior_continuations (0);
|
2008-11-06 04:23:07 +08:00
|
|
|
|
2008-04-17 19:49:56 +08:00
|
|
|
/* If we were doing a multi-step (eg: step n, next n), but it
|
|
|
|
got interrupted by a breakpoint, still do the pending
|
|
|
|
continuations. The continuation itself is responsible for
|
2008-05-07 02:49:19 +08:00
|
|
|
distinguishing the cases. The continuations are allowed to
|
|
|
|
touch the inferior memory, e.g. to remove breakpoints, so run
|
|
|
|
them before running breakpoint commands, which may resume the
|
|
|
|
target. */
|
Remove global continuations in favour of a per-thread
continuations.
* gdbthread.h (struct thread_info): Add comments around
continuations and intermediate_continuations.
(save_infrun_state, load_infrun_state): Delete continuations and
intermediate_continuations arguments.
* infrun.c (fetch_inferior_event): Only call normal_stop if
stop_soon is NO_STOP_QUIETLY.
(context_switch): Don't context-switch the continuations.
* thread.c (clear_thread_inferior_resources): Discard all
continuations of the thread we're clearing.
(save_infrun_state, load_infrun_state): Delete continuations and
intermediate_continuations arguments, and the code referencing
them.
* utils.c: Include "gdbthread.h".
(cmd_continuation, intermediate_continuation): Delete.
(add_continuation): Add thread_info* argument. Install the
continuation on it.
(restore_thread_cleanup): New.
(do_all_continuations_ptid, do_all_continuations_thread_callback):
New.
(do_all_continuations): Reimplement.
(discard_all_continuations_thread_callback,
discard_all_continuations_thread): New.
(discard_all_continuations): Reimplement.
(add_intermediate_continuation): Add thread_info* argument.
Install the continuation on it.
(do_all_intermediate_continuations_thread_callback)
(do_all_intermediate_continuations_thread): New.
(do_all_intermediate_continuations): Reimplement.
(discard_all_intermediate_continuations_thread_callback): New.
(discard_all_intermediate_continuations_thread): New.
(discard_all_intermediate_continuations): Reimplement.
* breakpoint.c (until_break_command): Install the continuation on
the current thread.
* defs.h (cmd_continuation, intermediate_continuation): Delete.
(struct thread_info): Forward declare.
(add_continuation, add_intermediate_continuation): Add
thread_info* argument.
(do_all_continuations_thread, discard_all_continuations_thread)
(do_all_intermediate_continuations_thread)
(discard_all_intermediate_continuations_thread): Declare.
* inf-loop.c (inferior_event_handler): In non-stop only run
continuations on the thread that stopped. In all-stop, run
continuations on all threads.
* infcmd.c (step_once, finish_command): Adjust.
2008-09-09 05:57:42 +08:00
|
|
|
if (non_stop
|
|
|
|
&& target_has_execution
|
|
|
|
&& !ptid_equal (inferior_ptid, null_ptid))
|
2011-05-31 02:04:32 +08:00
|
|
|
do_all_intermediate_continuations_thread (inferior_thread (), 0);
|
Remove global continuations in favour of a per-thread
continuations.
* gdbthread.h (struct thread_info): Add comments around
continuations and intermediate_continuations.
(save_infrun_state, load_infrun_state): Delete continuations and
intermediate_continuations arguments.
* infrun.c (fetch_inferior_event): Only call normal_stop if
stop_soon is NO_STOP_QUIETLY.
(context_switch): Don't context-switch the continuations.
* thread.c (clear_thread_inferior_resources): Discard all
continuations of the thread we're clearing.
(save_infrun_state, load_infrun_state): Delete continuations and
intermediate_continuations arguments, and the code referencing
them.
* utils.c: Include "gdbthread.h".
(cmd_continuation, intermediate_continuation): Delete.
(add_continuation): Add thread_info* argument. Install the
continuation on it.
(restore_thread_cleanup): New.
(do_all_continuations_ptid, do_all_continuations_thread_callback):
New.
(do_all_continuations): Reimplement.
(discard_all_continuations_thread_callback,
discard_all_continuations_thread): New.
(discard_all_continuations): Reimplement.
(add_intermediate_continuation): Add thread_info* argument.
Install the continuation on it.
(do_all_intermediate_continuations_thread_callback)
(do_all_intermediate_continuations_thread): New.
(do_all_intermediate_continuations): Reimplement.
(discard_all_intermediate_continuations_thread_callback): New.
(discard_all_intermediate_continuations_thread): New.
(discard_all_intermediate_continuations): Reimplement.
* breakpoint.c (until_break_command): Install the continuation on
the current thread.
* defs.h (cmd_continuation, intermediate_continuation): Delete.
(struct thread_info): Forward declare.
(add_continuation, add_intermediate_continuation): Add
thread_info* argument.
(do_all_continuations_thread, discard_all_continuations_thread)
(do_all_intermediate_continuations_thread)
(discard_all_intermediate_continuations_thread): Declare.
* inf-loop.c (inferior_event_handler): In non-stop only run
continuations on the thread that stopped. In all-stop, run
continuations on all threads.
* infcmd.c (step_once, finish_command): Adjust.
2008-09-09 05:57:42 +08:00
|
|
|
else
|
2011-05-31 02:04:32 +08:00
|
|
|
do_all_intermediate_continuations (0);
|
2008-04-17 19:49:56 +08:00
|
|
|
|
2008-05-07 02:49:19 +08:00
|
|
|
/* Always finish the previous command before running any
|
|
|
|
breakpoint commands. Any stop cancels the previous command.
|
|
|
|
E.g. a "finish" or "step-n" command interrupted by an
|
|
|
|
unrelated breakpoint is canceled. */
|
Remove global continuations in favour of a per-thread
continuations.
* gdbthread.h (struct thread_info): Add comments around
continuations and intermediate_continuations.
(save_infrun_state, load_infrun_state): Delete continuations and
intermediate_continuations arguments.
* infrun.c (fetch_inferior_event): Only call normal_stop if
stop_soon is NO_STOP_QUIETLY.
(context_switch): Don't context-switch the continuations.
* thread.c (clear_thread_inferior_resources): Discard all
continuations of the thread we're clearing.
(save_infrun_state, load_infrun_state): Delete continuations and
intermediate_continuations arguments, and the code referencing
them.
* utils.c: Include "gdbthread.h".
(cmd_continuation, intermediate_continuation): Delete.
(add_continuation): Add thread_info* argument. Install the
continuation on it.
(restore_thread_cleanup): New.
(do_all_continuations_ptid, do_all_continuations_thread_callback):
New.
(do_all_continuations): Reimplement.
(discard_all_continuations_thread_callback,
discard_all_continuations_thread): New.
(discard_all_continuations): Reimplement.
(add_intermediate_continuation): Add thread_info* argument.
Install the continuation on it.
(do_all_intermediate_continuations_thread_callback)
(do_all_intermediate_continuations_thread): New.
(do_all_intermediate_continuations): Reimplement.
(discard_all_intermediate_continuations_thread_callback): New.
(discard_all_intermediate_continuations_thread): New.
(discard_all_intermediate_continuations): Reimplement.
* breakpoint.c (until_break_command): Install the continuation on
the current thread.
* defs.h (cmd_continuation, intermediate_continuation): Delete.
(struct thread_info): Forward declare.
(add_continuation, add_intermediate_continuation): Add
thread_info* argument.
(do_all_continuations_thread, discard_all_continuations_thread)
(do_all_intermediate_continuations_thread)
(discard_all_intermediate_continuations_thread): Declare.
* inf-loop.c (inferior_event_handler): In non-stop only run
continuations on the thread that stopped. In all-stop, run
continuations on all threads.
* infcmd.c (step_once, finish_command): Adjust.
2008-09-09 05:57:42 +08:00
|
|
|
if (non_stop
|
|
|
|
&& target_has_execution
|
|
|
|
&& !ptid_equal (inferior_ptid, null_ptid))
|
2011-05-31 02:04:32 +08:00
|
|
|
do_all_continuations_thread (inferior_thread (), 0);
|
Remove global continuations in favour of a per-thread
continuations.
* gdbthread.h (struct thread_info): Add comments around
continuations and intermediate_continuations.
(save_infrun_state, load_infrun_state): Delete continuations and
intermediate_continuations arguments.
* infrun.c (fetch_inferior_event): Only call normal_stop if
stop_soon is NO_STOP_QUIETLY.
(context_switch): Don't context-switch the continuations.
* thread.c (clear_thread_inferior_resources): Discard all
continuations of the thread we're clearing.
(save_infrun_state, load_infrun_state): Delete continuations and
intermediate_continuations arguments, and the code referencing
them.
* utils.c: Include "gdbthread.h".
(cmd_continuation, intermediate_continuation): Delete.
(add_continuation): Add thread_info* argument. Install the
continuation on it.
(restore_thread_cleanup): New.
(do_all_continuations_ptid, do_all_continuations_thread_callback):
New.
(do_all_continuations): Reimplement.
(discard_all_continuations_thread_callback,
discard_all_continuations_thread): New.
(discard_all_continuations): Reimplement.
(add_intermediate_continuation): Add thread_info* argument.
Install the continuation on it.
(do_all_intermediate_continuations_thread_callback)
(do_all_intermediate_continuations_thread): New.
(do_all_intermediate_continuations): Reimplement.
(discard_all_intermediate_continuations_thread_callback): New.
(discard_all_intermediate_continuations_thread): New.
(discard_all_intermediate_continuations): Reimplement.
* breakpoint.c (until_break_command): Install the continuation on
the current thread.
* defs.h (cmd_continuation, intermediate_continuation): Delete.
(struct thread_info): Forward declare.
(add_continuation, add_intermediate_continuation): Add
thread_info* argument.
(do_all_continuations_thread, discard_all_continuations_thread)
(do_all_intermediate_continuations_thread)
(discard_all_intermediate_continuations_thread): Declare.
* inf-loop.c (inferior_event_handler): In non-stop only run
continuations on the thread that stopped. In all-stop, run
continuations on all threads.
* infcmd.c (step_once, finish_command): Adjust.
2008-09-09 05:57:42 +08:00
|
|
|
else
|
2011-05-31 02:04:32 +08:00
|
|
|
do_all_continuations (0);
|
2008-03-15 02:57:44 +08:00
|
|
|
|
2011-09-03 00:56:30 +08:00
|
|
|
/* When running a command list (from a user command, say), these
|
|
|
|
are only run when the command list is all done. */
|
|
|
|
if (interpreter_async)
|
2008-03-15 02:57:44 +08:00
|
|
|
{
|
2011-09-03 00:56:30 +08:00
|
|
|
volatile struct gdb_exception e;
|
|
|
|
|
2011-12-17 04:29:28 +08:00
|
|
|
check_frame_language_change ();
|
2011-09-03 00:56:30 +08:00
|
|
|
|
|
|
|
/* Don't propagate breakpoint commands errors. Either we're
|
|
|
|
stopping or some command resumes the inferior. The user will
|
|
|
|
be informed. */
|
|
|
|
TRY_CATCH (e, RETURN_MASK_ALL)
|
|
|
|
{
|
|
|
|
bpstat_do_actions ();
|
|
|
|
}
|
|
|
|
exception_print (gdb_stderr, e);
|
2008-03-15 02:57:44 +08:00
|
|
|
}
|
1999-10-06 07:13:56 +08:00
|
|
|
break;
|
|
|
|
|
1999-12-07 11:56:43 +08:00
|
|
|
case INF_EXEC_CONTINUE:
|
|
|
|
/* Is there anything left to do for the command issued to
|
2011-01-09 11:08:57 +08:00
|
|
|
complete? */
|
Remove global continuations in favour of a per-thread
continuations.
* gdbthread.h (struct thread_info): Add comments around
continuations and intermediate_continuations.
(save_infrun_state, load_infrun_state): Delete continuations and
intermediate_continuations arguments.
* infrun.c (fetch_inferior_event): Only call normal_stop if
stop_soon is NO_STOP_QUIETLY.
(context_switch): Don't context-switch the continuations.
* thread.c (clear_thread_inferior_resources): Discard all
continuations of the thread we're clearing.
(save_infrun_state, load_infrun_state): Delete continuations and
intermediate_continuations arguments, and the code referencing
them.
* utils.c: Include "gdbthread.h".
(cmd_continuation, intermediate_continuation): Delete.
(add_continuation): Add thread_info* argument. Install the
continuation on it.
(restore_thread_cleanup): New.
(do_all_continuations_ptid, do_all_continuations_thread_callback):
New.
(do_all_continuations): Reimplement.
(discard_all_continuations_thread_callback,
discard_all_continuations_thread): New.
(discard_all_continuations): Reimplement.
(add_intermediate_continuation): Add thread_info* argument.
Install the continuation on it.
(do_all_intermediate_continuations_thread_callback)
(do_all_intermediate_continuations_thread): New.
(do_all_intermediate_continuations): Reimplement.
(discard_all_intermediate_continuations_thread_callback): New.
(discard_all_intermediate_continuations_thread): New.
(discard_all_intermediate_continuations): Reimplement.
* breakpoint.c (until_break_command): Install the continuation on
the current thread.
* defs.h (cmd_continuation, intermediate_continuation): Delete.
(struct thread_info): Forward declare.
(add_continuation, add_intermediate_continuation): Add
thread_info* argument.
(do_all_continuations_thread, discard_all_continuations_thread)
(do_all_intermediate_continuations_thread)
(discard_all_intermediate_continuations_thread): Declare.
* inf-loop.c (inferior_event_handler): In non-stop only run
continuations on the thread that stopped. In all-stop, run
continuations on all threads.
* infcmd.c (step_once, finish_command): Adjust.
2008-09-09 05:57:42 +08:00
|
|
|
|
|
|
|
if (non_stop)
|
2011-05-31 02:04:32 +08:00
|
|
|
do_all_intermediate_continuations_thread (inferior_thread (), 0);
|
Remove global continuations in favour of a per-thread
continuations.
* gdbthread.h (struct thread_info): Add comments around
continuations and intermediate_continuations.
(save_infrun_state, load_infrun_state): Delete continuations and
intermediate_continuations arguments.
* infrun.c (fetch_inferior_event): Only call normal_stop if
stop_soon is NO_STOP_QUIETLY.
(context_switch): Don't context-switch the continuations.
* thread.c (clear_thread_inferior_resources): Discard all
continuations of the thread we're clearing.
(save_infrun_state, load_infrun_state): Delete continuations and
intermediate_continuations arguments, and the code referencing
them.
* utils.c: Include "gdbthread.h".
(cmd_continuation, intermediate_continuation): Delete.
(add_continuation): Add thread_info* argument. Install the
continuation on it.
(restore_thread_cleanup): New.
(do_all_continuations_ptid, do_all_continuations_thread_callback):
New.
(do_all_continuations): Reimplement.
(discard_all_continuations_thread_callback,
discard_all_continuations_thread): New.
(discard_all_continuations): Reimplement.
(add_intermediate_continuation): Add thread_info* argument.
Install the continuation on it.
(do_all_intermediate_continuations_thread_callback)
(do_all_intermediate_continuations_thread): New.
(do_all_intermediate_continuations): Reimplement.
(discard_all_intermediate_continuations_thread_callback): New.
(discard_all_intermediate_continuations_thread): New.
(discard_all_intermediate_continuations): Reimplement.
* breakpoint.c (until_break_command): Install the continuation on
the current thread.
* defs.h (cmd_continuation, intermediate_continuation): Delete.
(struct thread_info): Forward declare.
(add_continuation, add_intermediate_continuation): Add
thread_info* argument.
(do_all_continuations_thread, discard_all_continuations_thread)
(do_all_intermediate_continuations_thread)
(discard_all_intermediate_continuations_thread): Declare.
* inf-loop.c (inferior_event_handler): In non-stop only run
continuations on the thread that stopped. In all-stop, run
continuations on all threads.
* infcmd.c (step_once, finish_command): Adjust.
2008-09-09 05:57:42 +08:00
|
|
|
else
|
2011-05-31 02:04:32 +08:00
|
|
|
do_all_intermediate_continuations (0);
|
1999-12-07 11:56:43 +08:00
|
|
|
break;
|
|
|
|
|
1999-10-06 07:13:56 +08:00
|
|
|
case INF_TIMER:
|
|
|
|
default:
|
2005-02-11 Andrew Cagney <cagney@gnu.org>
Mark up some of printf_filtered and printf_unfiltered.
* ada-lang.c, annotate.c, arch-utils.c, breakpoint.c: Update.
* corelow.c, cp-namespace.c, cp-support.c, dcache.c: Update.
* demangle.c, dsrec.c, dwarf2read.c, dwarfread.c: Update.
* event-loop.c, event-top.c, exec.c, f-valprint.c: Update.
* gdbtypes.c, inf-loop.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcmd.c, inflow.c, infrun.c, inftarg.c, language.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, maint.c: Update.
* mdebugread.c, memattr.c, monitor.c, objc-lang.c: Update.
* ocd.c, osabi.c, printcmd.c, procfs.c, regcache.c: Update.
* remote.c, solib-som.c, solib.c, somsolib.c, source.c: Update.
* stack.c, symfile.c, symmisc.c, target.c, thread.c: Update.
* top.c, utils.c, valprint.c, value.c, cli/cli-cmds.c: Update.
* cli/cli-dump.c, cli/cli-logging.c, tui/tui-hooks.c: Update.
* tui/tui-regs.c, tui/tui-win.c: Update.
2005-02-12 08:39:24 +08:00
|
|
|
printf_unfiltered (_("Event type not recognized.\n"));
|
1999-10-06 07:13:56 +08:00
|
|
|
break;
|
|
|
|
}
|
2011-08-27 05:45:24 +08:00
|
|
|
|
|
|
|
discard_cleanups (cleanup_if_error);
|
1999-10-06 07:13:56 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
fetch_inferior_event_wrapper (gdb_client_data client_data)
|
|
|
|
{
|
|
|
|
fetch_inferior_event (client_data);
|
|
|
|
return 1;
|
|
|
|
}
|