* breakpoint.h (bpstat_do_actions): Remove bpstat* argument.
* breakpoint.c (bpstat_do_actions): Rename to ...
(bpstat_do_actions_1): ... this. Make static. Change return type
to int. Return true if a breakpoint proceeded.
(bpstat_do_actions): New, as wrapper around bpstat_do_actions_1.
(delete_breakpoint): Don't reference the global stop_bpstat; it's
gone.
* gdbthread.h (struct thread_info): Add stop_bpstat.
(save_infrun_state, load_infrun_state): Remove stop_bpstat
argument.
* thread.c (load_infrun_state, save_infrun_state): Remove
stop_bpstat argument, and the code referencing it.
* infcall.c: Include "gdbthread.h".
(call_function_by_hand): Adjust.
* exceptions.c: Include "gdbthread.h".
(throw_exception): Adjust.
* infcmd.c (stop_bpstat): Delete.
(continue_command): In all-stop, set the ignore count on the
thread that reported the stop. In non-stop, set it on the current
thread.
(finish_command_continuation): Adjust.
(program_info): Adjust.
* infrun.c (clear_proceed_status): Adjust.
(context_switch): Don't context-switch stop_bpstat.
(handle_inferior_event): Adjust.
(normal_stop): Adjust.
(save_inferior_status, restore_inferior_status): Adjust.
* inf-loop.c (inferior_event_handler): Remove parameter to
bpstat_do_actions call.
* top.c (command_loop): Remove parameter to bpstat_do_actions
call. Call it unconditionally.
* event-top.c (command_handler): Ditto.
* python/python.c (execute_gdb_command): Ditto.
* breakpoint.c (until_break_command_continuation): Add
the 'error' parameter. Directly delete the breakoint as
opposed to running cleanups.
(until_break_command): Install continuation only
after starting the target. Don't use exec cleanups,
use ordinary cleanups. Discard cleanups is successfully
started the target in async mode.
(make_cleanup_delete_breakpoint): Remove.
* breakpoint.h (make_cleanup_delete_breakpoint): Remove
declaration.
* defs.h (do_exec_cleanups, make_exec_cleanup): Remove
declarations.
(struct continations): Add the 'error' parameter to the
continuation_hook field.
(add_continuation, do_all_continuations)
(add_intermediate_continuation)
(do_all_intermediate_continuations): Add the 'error' parameter.
* exceptions.c (throw_exception): Don't call do_exec_cleanups.
* inf-loop.c (inferior_event_handler): Instead of calling
discard_all_continuations, use do_all_continuations with 1 as
'error' parameter. Pass 0 as 'error' parameter in existing uses
of discard_all_continuations.
* infcmd.c (step_1): Do not use exec cleanup. For async case, discard
cleanups.
(step_once): Install continuation only after resuming the target.
(step_1_continuation): Disable longjmp breakpoint on error.
(finish_command_continuation): Add the error parameter. Delete
the finish breakpoint directly, do not use cleanups.
(finish_command): Do not use exec_cleanups. Always setup
continuation. For sync case, immediately run them.
(attach_command_continuation): Add the error parameter.
* infrun.c (fetch_inferior_event): Do not use exec cleanups to
remove step_resume_breakpoint -- adjust delete it directly.
* interps.c (interp_set): Adjust call to do_all_continations.
* mi/mi-interp.c (mi_interpreter_exec_continuation): Do not
do exec cleanups.
* mi/mi-main.c (mi_cmd_target_select): Do not do exec
cleanups.
(mi_cmd_execute): Do not use exec_cleanup.
(mi_execute_async_cli_command): Simplify the string concatenation
logic. Do no use exec cleanup.
(mi_exec_async_cli_cmd_continuation): New parameter error.
Free last_async_command.
* top.c (command_line_handler_continuation): New parameter error.
* utils.c (exec_cleanup_chain, make_exec_cleanup)
(do_exec_cleanups): Remove.
(add_continuation, do_all_continations)
(add_intermediate_continuation)
(do_all_intermediate_continuations): New parameter error.
* 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.
* cli/cli-script.c: Include "exceptions.h".
(struct wrapped_read_command_file_args): Define.
(wrapped_read_command_file): New function.
(script_from_file): Replace direct call to read_command_file by
one wrapped by an exception handler.
* exceptions.c (throw_it): Free the old message after creating the
new.
* Makefile.in: Update dependencies.
Index: testsuite/ChangeLog
2005-01-16 Andrew Cagney <cagney@gnu.org>
* gdb.base/source.exp: Delete KFAIL gdb/1846, simplify.
* exceptions.c (struct catcher): Delete saved_error_pre_print and
saved_quit_pre_print.
(catcher_init): Delete parameter errstring, do not override the
pre_print strings.
(catcher_pop): Do not restore the pre_print strings.
(catch_exception, catch_exceptions_with_msg, catch_errors)
(catch_command_errors): Update catch_init calls.
* exceptions.c (print_and_throw): Delete, replaced by throw_it.
(throw_reason): Leave the exception's message field blank.
(throw_it): New function, create the exception and throw it.
(throw_verror, throw_vfatal, throw_error): Call throw_it.
(print_any_exception): New function.
(catch_errors, catch_exceptions_with_msg): Call
print_any_exception.
(throw_exception): Move code calling annotate_error and
annotate_quit from here ...
(print_exception): ... to here.
* exceptions.c (exception_fprintf, exception_print): Move printing
of \n from here ...
(print_exception): ... to here.
(print_flush): New function.
(exception_print, exception_fprintf): Replace duplicated flush and
wrap code with call to print_flush.
(print_and_throw): Simplify, by using xstrvprintf, print_flush,
and print_exception.
(do_write): Delete.
* exceptions.h (exception_fprintf): Declare.
(exception_print): Drop pre_print parameter.
* mi/mi-main.c (mi_execute_command): Update exception_print call.
* cli/cli-interp.c (safe_execute_command): Update exception_print
call.
* remote.c (remote_open_1): Instead of passing an error prefix to
catch_exceptions, use catch_exceptions and exception_fprintf.
(remote_start_remote): Change return type to void.
* breakpoint.c (insert_bp_location): Instead of passing an error
prefix to catch_exceptions, use catch_exceptions and
exception_fprintf.
(insert_catchpoint): Change return type to void.
(break_command_1): Update exception_print call.
* exceptions.c (exception_fprintf): New function.
(print_exception): New function.
(exception_print): Use print_exception.
* mi/mi-main.c (mi_execute_command): Print the exception.
* cli/cli-interp.c (safe_execute_command): Print the exception.
* exceptions.h (exception_print): Declare.
* exceptions.c (struct catcher): Add field print_message.
(catcher_init): Add parameter print_message, store in the catcher
struct.
(print_and_throw): Only print the message when print_message.
(catch_exceptions_with_msg, catch_errors): Pass print_message=1 to
catcher_init.
(catch_exception): Pass print_message=0 to catcher_init.