binutils-gdb/gdb/top.h

297 lines
9.3 KiB
C
Raw Normal View History

/* Top level stuff for GDB, the GNU debugger.
Copyright (C) 1986-2017 Free Software Foundation, Inc.
1999-07-07 22:19:36 +02:00
This file is part of GDB.
1999-07-07 22:19:36 +02:00
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
the Free Software Foundation; either version 3 of the License, or
1999-07-07 22:19:36 +02:00
(at your option) any later version.
1999-07-07 22:19:36 +02:00
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.
1999-07-07 22:19:36 +02:00
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef TOP_H
#define TOP_H
Introduce "struct ui" This is a step towards supporting multiple consoles/MIs, each on its own stdio streams / terminal. See intro comment in top.h. (I've had trouble picking a name for this object. I've started out with "struct console" originally. But then this is about MI as well, and there's "interpreter-exec console", which is specifically about the CLI... So I changed to "struct terminal", but, then we have a terminal object that works when the input is not a terminal as well ... Then I sort of gave up and renamed it to "struct top_level". But it then gets horribly confusing when we talk about the "top level interpreter that's running on the current top level". In the end, I realized we're already sort of calling this "ui", in struct ui_out, struct ui_file, and a few coments here and there.) gdb/ChangeLog: 2016-06-21 Pedro Alves <palves@redhat.com> * event-top.c: Update readline-related comments. (input_handler, call_readline): Delete globals. (gdb_rl_callback_handler): Call the current UI's input_handler method. (change_line_handler): Adjust to set current UI's properties instead of globals. (current_ui_, current_ui): New globals. (get_command_line_buffer): Rewrite to refer to the current UI. (stdin_event_handler): Adjust to call the call_readline method of the current UI. (gdb_readline_no_editing_callback): Adjust to call the current UI's input_handler method. (gdb_setup_readline): Adjust to set current UI's properties instead of globals. * event-top.h (call_readline, input_handler): Delete declarations. * mi/mi-interp.c (mi_interpreter_resume): Adjust to set current UI's properties instead of globals. * top.c (gdb_readline_wrapper_cleanup): Adjust to set current UI's properties instead of globals. (gdb_readline_wrapper): Adjust to call and set current UI's methods instead of globals. * top.h: Include buffer.h and event-loop.h. (struct ui): New struct. (current_ui): New declaration.
2016-06-21 02:11:44 +02:00
#include "buffer.h"
#include "event-loop.h"
#include "value.h"
Introduce "struct ui" This is a step towards supporting multiple consoles/MIs, each on its own stdio streams / terminal. See intro comment in top.h. (I've had trouble picking a name for this object. I've started out with "struct console" originally. But then this is about MI as well, and there's "interpreter-exec console", which is specifically about the CLI... So I changed to "struct terminal", but, then we have a terminal object that works when the input is not a terminal as well ... Then I sort of gave up and renamed it to "struct top_level". But it then gets horribly confusing when we talk about the "top level interpreter that's running on the current top level". In the end, I realized we're already sort of calling this "ui", in struct ui_out, struct ui_file, and a few coments here and there.) gdb/ChangeLog: 2016-06-21 Pedro Alves <palves@redhat.com> * event-top.c: Update readline-related comments. (input_handler, call_readline): Delete globals. (gdb_rl_callback_handler): Call the current UI's input_handler method. (change_line_handler): Adjust to set current UI's properties instead of globals. (current_ui_, current_ui): New globals. (get_command_line_buffer): Rewrite to refer to the current UI. (stdin_event_handler): Adjust to call the call_readline method of the current UI. (gdb_readline_no_editing_callback): Adjust to call the current UI's input_handler method. (gdb_setup_readline): Adjust to set current UI's properties instead of globals. * event-top.h (call_readline, input_handler): Delete declarations. * mi/mi-interp.c (mi_interpreter_resume): Adjust to set current UI's properties instead of globals. * top.c (gdb_readline_wrapper_cleanup): Adjust to set current UI's properties instead of globals. (gdb_readline_wrapper): Adjust to call and set current UI's methods instead of globals. * top.h: Include buffer.h and event-loop.h. (struct ui): New struct. (current_ui): New declaration.
2016-06-21 02:11:44 +02:00
Make the interpreters be per UI Make each UI have its own interpreter list, top level interpreter, current interpreter, etc. The "interpreter_async" global is not really specific to an struct interp (it crosses interpreter-exec ...), so I moved it to "struct ui" directly, while the other globals were left hidden in interps.c, opaque to the rest of GDB. gdb/ChangeLog: 2016-06-21 Pedro Alves <palves@redhat.com> * breakpoint.c (bpstat_do_actions_1): Access the current UI's async field instead of the interpreter_async global. * cli/cli-script.c (execute_user_command, while_command) (if_command, script_from_file): Likewise. * compile/compile.c: Include top.h instead of interps.h. (compile_file_command, compile_code_command) (compile_print_command): Access the current UI's async field instead of the interpreter_async global. * guile/guile.c: Include top.h instead of interps.h. (guile_repl_command, guile_command, gdbscm_execute_gdb_command): Access the current UI's async field instead of the interpreter_async global. * guile/scm-ports.c: Include top.h instead of interps.h. (ioscm_with_output_to_port_worker): Access the current UI's async field instead of the interpreter_async global. * inf-loop.c (inferior_event_handler): Likewise. * infcall.c (run_inferior_call): Likewise. * infrun.c (reinstall_readline_callback_handler_cleanup) (fetch_inferior_event): Likewise. * interps.c (interpreter_async): Delete. (struct ui_interp_info): New. (get_current_interp_info): New function. (interp_list, current_interpreter, top_level_interpreter_ptr): Delete. (interp_add, interp_set, interp_lookup, interp_ui_out) (current_interp_set_logging, interp_set_temp) (current_interp_named_p): Adjust to per-UI interpreters. (command_interpreter): Delete. (command_interp, current_interp_command_loop, interp_quiet_p) (interp_exec, interpreter_exec_cmd, interpreter_completer) (top_level_interpreter, top_level_interpreter_data): Adjust to per-UI interpreters. * interps.h (interpreter_async): Delete. * main.c (captured_command_loop): Access the current UI's async field instead of the interpreter_async global. * python/python.c (python_interactive_command, python_command) (execute_gdb_command): Likewise. * top.c (maybe_wait_sync_command_done, execute_command_to_string): Access the current UI's async field instead of the interpreter_async global. * top.h (struct tl_interp_info): Forward declare. (struct ui) <interp_info, async>: New fields.
2016-06-21 02:11:45 +02:00
struct tl_interp_info;
Replace the sync_execution global with a new enum prompt_state tristate When sync_execution (a boolean) is true, it means we're running a foreground command -- we hide the prompt stop listening to input, give the inferior the terminal, then go to the event loop waiting for the target to stop. With multiple independent UIs, we need to track whether each UI is synchronously blocked waiting for the target. IOW, if you do "continue" in one console, that console stops accepting commands, but you should still be free to type other commands in the others consoles. Just simply making sync_execution be per-UI alone not sufficient, because of this in fetch_inferior_event: /* If the inferior was in sync execution mode, and now isn't, restore the prompt (a synchronous execution command has finished, and we're ready for input). */ if (current_ui->async && was_sync && !sync_execution) observer_notify_sync_execution_done (); We'd have to record at entry the "was_sync" state for each UI, not just of the current UI. This patch instead replaces the sync_execution flag by a per-UI tristate flag indicating the command line prompt state: enum prompt_state { /* The command line is blocked simulating synchronous execution. This is used to implement the foreground execution commands ('run', 'continue', etc.). We won't display the prompt and accept further commands until the execution is actually over. */ PROMPT_BLOCKED, /* The command finished; display the prompt before returning back to the top level. */ PROMPT_NEEDED, /* We've displayed the prompt already, ready for input. */ PROMPTED, ; I think the end result is _much_ clearer than the current code, and, it addresses the original motivation too. gdb/ChangeLog: 2016-06-21 Pedro Alves <palves@redhat.com> * annotate.c: Include top.h. (async_background_execution_p): Delete. (print_value_flags): Check the UI's prompt state rather then async_background_execution_p. * event-loop.c (start_event_loop): Set the prompt state to PROMPT_NEEDED. * event-top.c (display_gdb_prompt, async_enable_stdin) (async_disable_stdin): Check the current UI's prompt state instead of the sync_execution global. (command_line_handler): Set the prompt state to PROMPT_NEEDED before running a command, and display the prompt if still needed afterwards. * infcall.c (struct call_thread_fsm) <waiting_ui>: New field. (new_call_thread_fsm): New parameter 'waiting_ui'. Store it. (call_thread_fsm_should_stop): Set the prompt state to PROMPT_NEEDED. (run_inferior_call): Adjust to temporarily set the prompt state to PROMPT_BLOCKED instead of using the sync_execution global. (call_function_by_hand_dummy): Pass the current UI to new_call_thread_fsm. * infcmd.c: Include top.h. (continue_1): Check the current UI's prompt state instead of the sync_execution global. (continue_command): Validate global execution state before calling prepare_execution_command. (step_1): Call all_uis_check_sync_execution_done. (attach_post_wait): Don't call async_enable_stdin here. Remove reference to sync_execution. * infrun.c (sync_execution): Delete global. (follow_fork_inferior) (reinstall_readline_callback_handler_cleanup): Check the current UI's prompt state instead of the sync_execution global. (check_curr_ui_sync_execution_done) (all_uis_check_sync_execution_done): New functions. (fetch_inferior_event): Call all_uis_check_sync_execution_done instead of trying to determine whether the global sync execution changed. (handle_no_resumed): Check the prompt state of all UIs. (normal_stop): Emit the no unwait-for even to all PROMPT_BLOCKED UIs. Emit the "Switching to" notification to all UIs. Enable stdin in all UIs. * infrun.h (sync_execution): Delete. (all_uis_check_sync_execution_done): Declare. * main.c (captured_command_loop): Don't call interp_pre_command_loop if the prompt is blocked. (catch_command_errors, catch_command_errors_const): Adjust. (captured_main): Set the initial prompt state to PROMPT_NEEDED. * mi/mi-interp.c (display_mi_prompt): Set the prompt state to PROMPTED. (mi_interpreter_resume): Don't clear sync_execution. Remove hack comment. (mi_execute_command_input_handler): Set the prompt state to PROMPT_NEEDED before executing the command, and only display the prompt if the prompt state is PROMPT_NEEDED afterwards. (mi_on_resume_1): Adjust to check the prompt state. * target.c (target_terminal_inferior): Adjust to check the prompt state. * top.c (wait_sync_command_done, maybe_wait_sync_command_done) (execute_command): Check the current UI's prompt state instead of sync_execution. * top.h (enum prompt_state): New. (struct ui) <prompt_state>: New field. (ALL_UIS): New macro.
2016-06-21 02:11:51 +02:00
/* Prompt state. */
enum prompt_state
{
/* The command line is blocked simulating synchronous execution.
This is used to implement the foreground execution commands
('run', 'continue', etc.). We won't display the prompt and
accept further commands until the execution is actually over. */
PROMPT_BLOCKED,
/* The command finished; display the prompt before returning back to
the top level. */
PROMPT_NEEDED,
/* We've displayed the prompt already, ready for input. */
PROMPTED,
};
Introduce "struct ui" This is a step towards supporting multiple consoles/MIs, each on its own stdio streams / terminal. See intro comment in top.h. (I've had trouble picking a name for this object. I've started out with "struct console" originally. But then this is about MI as well, and there's "interpreter-exec console", which is specifically about the CLI... So I changed to "struct terminal", but, then we have a terminal object that works when the input is not a terminal as well ... Then I sort of gave up and renamed it to "struct top_level". But it then gets horribly confusing when we talk about the "top level interpreter that's running on the current top level". In the end, I realized we're already sort of calling this "ui", in struct ui_out, struct ui_file, and a few coments here and there.) gdb/ChangeLog: 2016-06-21 Pedro Alves <palves@redhat.com> * event-top.c: Update readline-related comments. (input_handler, call_readline): Delete globals. (gdb_rl_callback_handler): Call the current UI's input_handler method. (change_line_handler): Adjust to set current UI's properties instead of globals. (current_ui_, current_ui): New globals. (get_command_line_buffer): Rewrite to refer to the current UI. (stdin_event_handler): Adjust to call the call_readline method of the current UI. (gdb_readline_no_editing_callback): Adjust to call the current UI's input_handler method. (gdb_setup_readline): Adjust to set current UI's properties instead of globals. * event-top.h (call_readline, input_handler): Delete declarations. * mi/mi-interp.c (mi_interpreter_resume): Adjust to set current UI's properties instead of globals. * top.c (gdb_readline_wrapper_cleanup): Adjust to set current UI's properties instead of globals. (gdb_readline_wrapper): Adjust to call and set current UI's methods instead of globals. * top.h: Include buffer.h and event-loop.h. (struct ui): New struct. (current_ui): New declaration.
2016-06-21 02:11:44 +02:00
/* All about a user interface instance. Each user interface has its
own I/O files/streams, readline state, its own top level
interpreter (for the main UI, this is the interpreter specified
with -i on the command line) and secondary interpreters (for
interpreter-exec ...), etc. There's always one UI associated with
stdin/stdout/stderr, but the user can create secondary UIs, for
example, to create a separate MI channel on its own stdio
streams. */
struct ui
{
/* Create a new UI. */
ui (FILE *instream, FILE *outstream, FILE *errstream);
~ui ();
DISABLE_COPY_AND_ASSIGN (ui);
Make the intepreters output to all UIs When we have multiple consoles, MI channels, etc., then we need to broadcast breakpoint hits, etc. to all UIs. In the past, I've adjusted most of the run control to communicate events to the interpreters through observer notifications, so events would be properly sent to console and MI streams, in sync and async modes. This patch does the next logical step -- have each interpreter's observers output interpreter-specific info to _all_ UIs. Note that when we have multiple instances of active cli/tui interpreters, then the cli_interp and tui_interp globals no longer work. This is addressed by this patch. Also, the interpreters currently register some observers when resumed and remove them when suspended. If we have multiple instances of the interpreters, and they can be suspended/resumed at different, independent times, that no longer works. What we instead do is always install the observers, and then have the observers themselves know when to do nothing. An earlier prototype of this series did the looping over struct UIs in common code, and then dispatched events to the interpreters through a matching interp_on_foo method for each observer. That turned out a lot more complicated than the present solution, as we'd end up with having to create a new interp method every time some interpreter wanted to listen to some observer notification, resulting in a lot of duplicated make-work and more coupling than desirable. gdb/ChangeLog: 2016-06-21 Pedro Alves <palves@redhat.com> * cli/cli-interp.c (cli_interp): Delete. (as_cli_interp): New function. (cli_on_normal_stop, cli_on_signal_received) (cli_on_end_stepping_range, cli_on_signal_exited, cli_on_exited) (cli_on_no_history): Send output to all CLI UIs. (cli_on_sync_execution_done, cli_on_command_error): Skip output if the top level interpreter is not a CLI. (cli_interpreter_init): Don't set cli_interp or install observers here. (_initialize_cli_interp): Install observers here. * event-top.c (main_ui_, ui_list): New globals. (current_ui): Point to main_ui_. (restore_ui_cleanup, switch_thru_all_uis_init) (switch_thru_all_uis_cond, switch_thru_all_uis_next): New functions. * mi/mi-interp.c (as_mi_interp): New function. (mi_interpreter_init): Don't install observers here. (mi_on_sync_execution_done): Skip output if the top level interpreter is not a MI. (mi_new_thread, mi_thread_exit, mi_record_changed) (mi_inferior_added, mi_inferior_appeared, mi_inferior_exit) (mi_inferior_removed): Send output to all MI UIs. (find_mi_interpreter, mi_interp_data): Delete. (find_mi_interp): New function. (mi_on_signal_received, mi_on_end_stepping_range) (mi_on_signal_exited, mi_on_exited, mi_on_no_history): Send output to all MI UIs. (mi_on_normal_stop): Rename to ... (mi_on_normal_stop_1): ... this. (mi_on_normal_stop): Reimplement, sending output to all MI UIs. (mi_traceframe_changed, mi_tsv_created, mi_tsv_deleted) (mi_tsv_modified, mi_breakpoint_created, mi_breakpoint_deleted) (mi_breakpoint_modified, mi_output_running_pid): Send output to all MI UIs. (mi_on_resume): Rename to ... (mi_on_resume_1): ... this. Don't handle infcalls here. (mi_on_resume): Reimplement, sending output to all MI UIs. (mi_solib_loaded, mi_solib_unloaded, mi_command_param_changed) (mi_memory_changed): Send output to all MI UIs. (report_initial_inferior): Install observers here. * top.h (struct ui) <next>: New field. (ui_list): Declare. (struct switch_thru_all_uis): New. (switch_thru_all_uis_init, switch_thru_all_uis_cond) (switch_thru_all_uis_next): Declare. (SWITCH_THRU_ALL_UIS): New macro. * tui/tui-interp.c (tui_interp): Delete global. (as_tui_interp): New function. (tui_on_normal_stop, tui_on_signal_received) (tui_on_end_stepping_range, tui_on_signal_exited, tui_on_exited) (tui_on_no_history): Send output to all TUI UIs. (tui_on_sync_execution_done, tui_on_command_error): Skip output if the top level interpreter is not a TUI. (tui_init): Don't set tui_interp or install observers here. (_initialize_tui_interp): Install observers here.
2016-06-21 02:11:45 +02:00
/* Pointer to next in singly-linked list. */
struct ui *next;
/* Convenient handle (UI number). Unique across all UIs. */
int num;
Introduce "struct ui" This is a step towards supporting multiple consoles/MIs, each on its own stdio streams / terminal. See intro comment in top.h. (I've had trouble picking a name for this object. I've started out with "struct console" originally. But then this is about MI as well, and there's "interpreter-exec console", which is specifically about the CLI... So I changed to "struct terminal", but, then we have a terminal object that works when the input is not a terminal as well ... Then I sort of gave up and renamed it to "struct top_level". But it then gets horribly confusing when we talk about the "top level interpreter that's running on the current top level". In the end, I realized we're already sort of calling this "ui", in struct ui_out, struct ui_file, and a few coments here and there.) gdb/ChangeLog: 2016-06-21 Pedro Alves <palves@redhat.com> * event-top.c: Update readline-related comments. (input_handler, call_readline): Delete globals. (gdb_rl_callback_handler): Call the current UI's input_handler method. (change_line_handler): Adjust to set current UI's properties instead of globals. (current_ui_, current_ui): New globals. (get_command_line_buffer): Rewrite to refer to the current UI. (stdin_event_handler): Adjust to call the call_readline method of the current UI. (gdb_readline_no_editing_callback): Adjust to call the current UI's input_handler method. (gdb_setup_readline): Adjust to set current UI's properties instead of globals. * event-top.h (call_readline, input_handler): Delete declarations. * mi/mi-interp.c (mi_interpreter_resume): Adjust to set current UI's properties instead of globals. * top.c (gdb_readline_wrapper_cleanup): Adjust to set current UI's properties instead of globals. (gdb_readline_wrapper): Adjust to call and set current UI's methods instead of globals. * top.h: Include buffer.h and event-loop.h. (struct ui): New struct. (current_ui): New declaration.
2016-06-21 02:11:44 +02:00
/* The UI's command line buffer. This is to used to accumulate
input until we have a whole command line. */
struct buffer line_buffer;
/* The callback used by the event loop whenever an event is detected
on the UI's input file descriptor. This function incrementally
builds a buffer where it accumulates the line read up to the
point of invocation. In the special case in which the character
read is newline, the function invokes the INPUT_HANDLER callback
(see below). */
void (*call_readline) (gdb_client_data);
/* The function to invoke when a complete line of input is ready for
processing. */
void (*input_handler) (char *);
Make command line editing (use of readline) be per UI Due to the way that readline's API works (based on globals), we can only have one instance of readline in a process. So the goal of this patch is to only allow editing in the main UI, and make sure that only one UI calls into readline. Some MI paths touch readline variables currently, which is bad as that is changing variables that matter for the main console UI. This patch fixes those. This actually fixes a nasty bug -- starting gdb in MI mode ("gdb -i=mi"), and then doing "set editing on" crashes GDB, because MI is not prepared to use readline: set editing on &"set editing on\n" =cmd-param-changed,param="editing",value="on" ^done (gdb) p 1 readline: readline_callback_read_char() called with no handler! Aborted (core dumped) The fix for that was to add an interp_proc method to query the interpreter whether it actually supports editing. New test included. gdb/ChangeLog: 2016-06-21 Pedro Alves <palves@redhat.com> PR mi/20034 * cli/cli-interp.c: Include cli-interp.h and event-top.h. (cli_interpreter_resume): Pass 1 to gdb_setup_readline. Set the UI's input_handler here. (cli_interpreter_supports_command_editing): New function. (cli_interp_procs): Install it. * cli/cli-interp.h: New file. * event-top.c (async_command_editing_p): Rename to ... (set_editing_cmd_var): ... this. (change_line_handler): Add parameter 'editing', and use it. Bail early if the interpreter doesn't support editing. Don't touch readline state if editing is off. (gdb_rl_callback_handler_remove, gdb_rl_callback_handler_install) (gdb_rl_callback_handler_reinstall): Assert the current UI is the main UI. (display_gdb_prompt): Don't call gdb_rl_callback_handler_remove if not using readline. Check whether the current UI is using command editing instead of checking the async_command_editing_p global. (set_async_editing_command): Delete. (gdb_setup_readline): Add 'editing' parameter. Only allow editing on the main UI. Don't touch readline state if editing is off. (gdb_disable_readline): Don't touch readline state if editing is off. * event-top.h (gdb_setup_readline): Add 'int' parameter. (set_async_editing_command): Delete declaration. (change_line_handler, command_line_handler): Declare. (async_command_editing_p): Rename to ... (set_editing_cmd_var): ... this. * infrun.c (reinstall_readline_callback_handler_cleanup): Check whether the current UI has editing enabled rather than checking the async_command_editing_p global. * interps.c (interp_supports_command_editing): New function. * interps.h (interp_supports_command_editing_ftype): New typedef. (struct interp_procs) <supports_command_editing_proc>: New field. (interp_supports_command_editing): Declare. * mi/mi-interp.c (mi_interpreter_resume): Pass 0 to gdb_setup_readline. Don't clear the async_command_editing_p global. Update comments. * top.c (gdb_readline_wrapper_line, gdb_readline_wrapper): Check whether the current UI has editing enabled rather than checking the async_command_editing_p global. Don't touch readline state if editing is off. (undo_terminal_modifications_before_exit): Switch to the main UI. Unconditionally call gdb_disable_readline. (set_editing): New function. (show_async_command_editing_p): Rename to ... (show_editing): ... this. Show the state of the current UI. (_initialize_top): Adjust. * top.h (struct ui) <command_editing>: New field. * tui/tui-interp.c: Include cli/cli-interp.h. (tui_resume): Pass 1 to gdb_setup_readline. Set the UI's input_handler. (tui_interp_procs): Install cli_interpreter_supports_command_editing. * tui/tui-io.c (tui_getc): Check whether the current UI has editing enabled rather than checking the async_command_editing_p global. gdb/testsuite/ChangeLog: 2016-06-21 Pedro Alves <palves@redhat.com> PR mi/20034 * gdb.mi/mi-editing.exp: New file.
2016-06-21 02:11:48 +02:00
/* True if this UI is using the readline library for command
editing; false if using GDB's own simple readline emulation, with
no editing support. */
int command_editing;
Make the interpreters be per UI Make each UI have its own interpreter list, top level interpreter, current interpreter, etc. The "interpreter_async" global is not really specific to an struct interp (it crosses interpreter-exec ...), so I moved it to "struct ui" directly, while the other globals were left hidden in interps.c, opaque to the rest of GDB. gdb/ChangeLog: 2016-06-21 Pedro Alves <palves@redhat.com> * breakpoint.c (bpstat_do_actions_1): Access the current UI's async field instead of the interpreter_async global. * cli/cli-script.c (execute_user_command, while_command) (if_command, script_from_file): Likewise. * compile/compile.c: Include top.h instead of interps.h. (compile_file_command, compile_code_command) (compile_print_command): Access the current UI's async field instead of the interpreter_async global. * guile/guile.c: Include top.h instead of interps.h. (guile_repl_command, guile_command, gdbscm_execute_gdb_command): Access the current UI's async field instead of the interpreter_async global. * guile/scm-ports.c: Include top.h instead of interps.h. (ioscm_with_output_to_port_worker): Access the current UI's async field instead of the interpreter_async global. * inf-loop.c (inferior_event_handler): Likewise. * infcall.c (run_inferior_call): Likewise. * infrun.c (reinstall_readline_callback_handler_cleanup) (fetch_inferior_event): Likewise. * interps.c (interpreter_async): Delete. (struct ui_interp_info): New. (get_current_interp_info): New function. (interp_list, current_interpreter, top_level_interpreter_ptr): Delete. (interp_add, interp_set, interp_lookup, interp_ui_out) (current_interp_set_logging, interp_set_temp) (current_interp_named_p): Adjust to per-UI interpreters. (command_interpreter): Delete. (command_interp, current_interp_command_loop, interp_quiet_p) (interp_exec, interpreter_exec_cmd, interpreter_completer) (top_level_interpreter, top_level_interpreter_data): Adjust to per-UI interpreters. * interps.h (interpreter_async): Delete. * main.c (captured_command_loop): Access the current UI's async field instead of the interpreter_async global. * python/python.c (python_interactive_command, python_command) (execute_gdb_command): Likewise. * top.c (maybe_wait_sync_command_done, execute_command_to_string): Access the current UI's async field instead of the interpreter_async global. * top.h (struct tl_interp_info): Forward declare. (struct ui) <interp_info, async>: New fields.
2016-06-21 02:11:45 +02:00
/* Each UI has its own independent set of interpreters. */
struct ui_interp_info *interp_info;
/* True if the UI is in async mode, false if in sync mode. If in
sync mode, a synchronous execution command (e.g, "next") does not
return until the command is finished. If in async mode, then
running a synchronous command returns right after resuming the
target. Waiting for the command's completion is later done on
the top event loop. For the main UI, this starts out disabled,
until all the explicit command line arguments (e.g., `gdb -ex
"start" -ex "next"') are processed. */
int async;
/* The number of nested readline secondary prompts that are
currently active. */
int secondary_prompt_depth;
Make stdin be per UI This commit makes each UI have its own "stdin" stream pointer. This is used to determine whether the "from_tty" argument to execute_command, etc. should be true. Related, this commit makes input_from_terminal_p take an UI parameter, and then avoids the gdb_has_a_terminal in it. gdb_has_a_terminal only returns info on gdb's own main/primary terminal (the real stdin). However, the places that call input_from_terminal_p really want to know is whether the command came from an interactive tty. This patch thus renames input_from_terminal_p to input_interactive_p for clarity, and then makes input_interactive_p check for "set interactive" itself, along with ISATTY, instead of calling gdb_has_a_terminal. Actually, quit_force wants to call input_interactive_p _after_ stdin is closed, we can't call ISATTY that late. So instead we save the result of ISATTY in a field of the UI. gdb/ChangeLog: 2016-06-21 Pedro Alves <palves@redhat.com> * cli/cli-script.c (read_next_line): Adjust to per-UI stdin. (read_command_lines): Use input_interactive_p instead of input_from_terminal_p. * defs.h (struct ui): Forward declare. (input_from_terminal_p): Rename to ... (input_interactive_p): ... this. * event-top.c (stdin_event_handler): Pass 0 as from_tty argument to quit_command. (command_handler): Adjust to per-UI stdin. (handle_line_of_input): Adjust to per-UI stdin and use input_interactive_p instead of ISATTY and input_from_terminal_p. (gdb_readline_no_editing_callback): Adjust to per-UI stdin. (command_line_handler): Always pass true as "from_tty" parameter of handle_line_of_input and execute_command. (async_sigterm_handler): Pass 0 as from_tty argument to quit_command. * inflow.c (interactive_mode, show_interactive_mode): Moved to ... (gdb_has_a_terminal): Don't check interactive_mode here. (_initialize_inflow): Don't install "set interactive-mode" here. * main.c (captured_command_loop): Adjust to per-UI stdin. * mi/mi-interp.c (mi_execute_command_wrapper): Adjust to per-UI stdin. * top.c (new_ui): Save the stdin stream and whether it's a tty. (dont_repeat): Adjust to per-UI stdin. (command_line_input): Adjust to per-UI stdin and to use input_interactive_p. (quit_force): Write history if any UI supports interactive input. (interactive_mode, show_interactive_mode): Move here, from inflow.c. (input_from_terminal_p): Rename to ... (input_interactive_p): ... this, and check the "interactive_mode" global instead of calling gdb_has_a_terminal. (_initialize_top): Install "set interactive-mode" here. * top.h (struct ui) <stdin_stream, input_interactive_p>: New fields. * utils.c (quit): Pass 0 as from_tty argument to quit_force. (defaulted_query): Adjust to per-UI stdin and to use input_interactive_p.
2016-06-21 02:11:54 +02:00
/* The UI's stdin. Set to stdin for the main UI. */
FILE *stdin_stream;
/* stdio stream that command input is being read from. Set to stdin
normally. Set by source_command to the file we are sourcing.
Set to NULL if we are executing a user-defined command or
interacting via a GUI. */
FILE *instream;
/* Standard output stream. */
FILE *outstream;
/* Standard error stream. */
FILE *errstream;
/* The file descriptor for the input stream, so that we can register
it with the event loop. */
int input_fd;
Make stdin be per UI This commit makes each UI have its own "stdin" stream pointer. This is used to determine whether the "from_tty" argument to execute_command, etc. should be true. Related, this commit makes input_from_terminal_p take an UI parameter, and then avoids the gdb_has_a_terminal in it. gdb_has_a_terminal only returns info on gdb's own main/primary terminal (the real stdin). However, the places that call input_from_terminal_p really want to know is whether the command came from an interactive tty. This patch thus renames input_from_terminal_p to input_interactive_p for clarity, and then makes input_interactive_p check for "set interactive" itself, along with ISATTY, instead of calling gdb_has_a_terminal. Actually, quit_force wants to call input_interactive_p _after_ stdin is closed, we can't call ISATTY that late. So instead we save the result of ISATTY in a field of the UI. gdb/ChangeLog: 2016-06-21 Pedro Alves <palves@redhat.com> * cli/cli-script.c (read_next_line): Adjust to per-UI stdin. (read_command_lines): Use input_interactive_p instead of input_from_terminal_p. * defs.h (struct ui): Forward declare. (input_from_terminal_p): Rename to ... (input_interactive_p): ... this. * event-top.c (stdin_event_handler): Pass 0 as from_tty argument to quit_command. (command_handler): Adjust to per-UI stdin. (handle_line_of_input): Adjust to per-UI stdin and use input_interactive_p instead of ISATTY and input_from_terminal_p. (gdb_readline_no_editing_callback): Adjust to per-UI stdin. (command_line_handler): Always pass true as "from_tty" parameter of handle_line_of_input and execute_command. (async_sigterm_handler): Pass 0 as from_tty argument to quit_command. * inflow.c (interactive_mode, show_interactive_mode): Moved to ... (gdb_has_a_terminal): Don't check interactive_mode here. (_initialize_inflow): Don't install "set interactive-mode" here. * main.c (captured_command_loop): Adjust to per-UI stdin. * mi/mi-interp.c (mi_execute_command_wrapper): Adjust to per-UI stdin. * top.c (new_ui): Save the stdin stream and whether it's a tty. (dont_repeat): Adjust to per-UI stdin. (command_line_input): Adjust to per-UI stdin and to use input_interactive_p. (quit_force): Write history if any UI supports interactive input. (interactive_mode, show_interactive_mode): Move here, from inflow.c. (input_from_terminal_p): Rename to ... (input_interactive_p): ... this, and check the "interactive_mode" global instead of calling gdb_has_a_terminal. (_initialize_top): Install "set interactive-mode" here. * top.h (struct ui) <stdin_stream, input_interactive_p>: New fields. * utils.c (quit): Pass 0 as from_tty argument to quit_force. (defaulted_query): Adjust to per-UI stdin and to use input_interactive_p.
2016-06-21 02:11:54 +02:00
/* Whether ISATTY returns true on input_fd. Cached here because
quit_force needs to know this _after_ input_fd might be
closed. */
int input_interactive_p;
Replace the sync_execution global with a new enum prompt_state tristate When sync_execution (a boolean) is true, it means we're running a foreground command -- we hide the prompt stop listening to input, give the inferior the terminal, then go to the event loop waiting for the target to stop. With multiple independent UIs, we need to track whether each UI is synchronously blocked waiting for the target. IOW, if you do "continue" in one console, that console stops accepting commands, but you should still be free to type other commands in the others consoles. Just simply making sync_execution be per-UI alone not sufficient, because of this in fetch_inferior_event: /* If the inferior was in sync execution mode, and now isn't, restore the prompt (a synchronous execution command has finished, and we're ready for input). */ if (current_ui->async && was_sync && !sync_execution) observer_notify_sync_execution_done (); We'd have to record at entry the "was_sync" state for each UI, not just of the current UI. This patch instead replaces the sync_execution flag by a per-UI tristate flag indicating the command line prompt state: enum prompt_state { /* The command line is blocked simulating synchronous execution. This is used to implement the foreground execution commands ('run', 'continue', etc.). We won't display the prompt and accept further commands until the execution is actually over. */ PROMPT_BLOCKED, /* The command finished; display the prompt before returning back to the top level. */ PROMPT_NEEDED, /* We've displayed the prompt already, ready for input. */ PROMPTED, ; I think the end result is _much_ clearer than the current code, and, it addresses the original motivation too. gdb/ChangeLog: 2016-06-21 Pedro Alves <palves@redhat.com> * annotate.c: Include top.h. (async_background_execution_p): Delete. (print_value_flags): Check the UI's prompt state rather then async_background_execution_p. * event-loop.c (start_event_loop): Set the prompt state to PROMPT_NEEDED. * event-top.c (display_gdb_prompt, async_enable_stdin) (async_disable_stdin): Check the current UI's prompt state instead of the sync_execution global. (command_line_handler): Set the prompt state to PROMPT_NEEDED before running a command, and display the prompt if still needed afterwards. * infcall.c (struct call_thread_fsm) <waiting_ui>: New field. (new_call_thread_fsm): New parameter 'waiting_ui'. Store it. (call_thread_fsm_should_stop): Set the prompt state to PROMPT_NEEDED. (run_inferior_call): Adjust to temporarily set the prompt state to PROMPT_BLOCKED instead of using the sync_execution global. (call_function_by_hand_dummy): Pass the current UI to new_call_thread_fsm. * infcmd.c: Include top.h. (continue_1): Check the current UI's prompt state instead of the sync_execution global. (continue_command): Validate global execution state before calling prepare_execution_command. (step_1): Call all_uis_check_sync_execution_done. (attach_post_wait): Don't call async_enable_stdin here. Remove reference to sync_execution. * infrun.c (sync_execution): Delete global. (follow_fork_inferior) (reinstall_readline_callback_handler_cleanup): Check the current UI's prompt state instead of the sync_execution global. (check_curr_ui_sync_execution_done) (all_uis_check_sync_execution_done): New functions. (fetch_inferior_event): Call all_uis_check_sync_execution_done instead of trying to determine whether the global sync execution changed. (handle_no_resumed): Check the prompt state of all UIs. (normal_stop): Emit the no unwait-for even to all PROMPT_BLOCKED UIs. Emit the "Switching to" notification to all UIs. Enable stdin in all UIs. * infrun.h (sync_execution): Delete. (all_uis_check_sync_execution_done): Declare. * main.c (captured_command_loop): Don't call interp_pre_command_loop if the prompt is blocked. (catch_command_errors, catch_command_errors_const): Adjust. (captured_main): Set the initial prompt state to PROMPT_NEEDED. * mi/mi-interp.c (display_mi_prompt): Set the prompt state to PROMPTED. (mi_interpreter_resume): Don't clear sync_execution. Remove hack comment. (mi_execute_command_input_handler): Set the prompt state to PROMPT_NEEDED before executing the command, and only display the prompt if the prompt state is PROMPT_NEEDED afterwards. (mi_on_resume_1): Adjust to check the prompt state. * target.c (target_terminal_inferior): Adjust to check the prompt state. * top.c (wait_sync_command_done, maybe_wait_sync_command_done) (execute_command): Check the current UI's prompt state instead of sync_execution. * top.h (enum prompt_state): New. (struct ui) <prompt_state>: New field. (ALL_UIS): New macro.
2016-06-21 02:11:51 +02:00
/* See enum prompt_state's description. */
enum prompt_state prompt_state;
/* The fields below that start with "m_" are "private". They're
meant to be accessed through wrapper macros that make them look
like globals. */
/* The ui_file streams. */
/* Normal results */
struct ui_file *m_gdb_stdout;
/* Input stream */
struct ui_file *m_gdb_stdin;
/* Serious error notifications */
struct ui_file *m_gdb_stderr;
/* Log/debug/trace messages that should bypass normal stdout/stderr
filtering. For moment, always call this stream using
*_unfiltered. In the very near future that restriction shall be
removed - either call shall be unfiltered. (cagney 1999-06-13). */
struct ui_file *m_gdb_stdlog;
/* The current ui_out. */
struct ui_out *m_current_uiout;
Introduce "struct ui" This is a step towards supporting multiple consoles/MIs, each on its own stdio streams / terminal. See intro comment in top.h. (I've had trouble picking a name for this object. I've started out with "struct console" originally. But then this is about MI as well, and there's "interpreter-exec console", which is specifically about the CLI... So I changed to "struct terminal", but, then we have a terminal object that works when the input is not a terminal as well ... Then I sort of gave up and renamed it to "struct top_level". But it then gets horribly confusing when we talk about the "top level interpreter that's running on the current top level". In the end, I realized we're already sort of calling this "ui", in struct ui_out, struct ui_file, and a few coments here and there.) gdb/ChangeLog: 2016-06-21 Pedro Alves <palves@redhat.com> * event-top.c: Update readline-related comments. (input_handler, call_readline): Delete globals. (gdb_rl_callback_handler): Call the current UI's input_handler method. (change_line_handler): Adjust to set current UI's properties instead of globals. (current_ui_, current_ui): New globals. (get_command_line_buffer): Rewrite to refer to the current UI. (stdin_event_handler): Adjust to call the call_readline method of the current UI. (gdb_readline_no_editing_callback): Adjust to call the current UI's input_handler method. (gdb_setup_readline): Adjust to set current UI's properties instead of globals. * event-top.h (call_readline, input_handler): Delete declarations. * mi/mi-interp.c (mi_interpreter_resume): Adjust to set current UI's properties instead of globals. * top.c (gdb_readline_wrapper_cleanup): Adjust to set current UI's properties instead of globals. (gdb_readline_wrapper): Adjust to call and set current UI's methods instead of globals. * top.h: Include buffer.h and event-loop.h. (struct ui): New struct. (current_ui): New declaration.
2016-06-21 02:11:44 +02:00
};
/* The main UI. This is the UI that is bound to stdin/stdout/stderr.
It always exists and is created automatically when GDB starts
up. */
extern struct ui *main_ui;
Make the intepreters output to all UIs When we have multiple consoles, MI channels, etc., then we need to broadcast breakpoint hits, etc. to all UIs. In the past, I've adjusted most of the run control to communicate events to the interpreters through observer notifications, so events would be properly sent to console and MI streams, in sync and async modes. This patch does the next logical step -- have each interpreter's observers output interpreter-specific info to _all_ UIs. Note that when we have multiple instances of active cli/tui interpreters, then the cli_interp and tui_interp globals no longer work. This is addressed by this patch. Also, the interpreters currently register some observers when resumed and remove them when suspended. If we have multiple instances of the interpreters, and they can be suspended/resumed at different, independent times, that no longer works. What we instead do is always install the observers, and then have the observers themselves know when to do nothing. An earlier prototype of this series did the looping over struct UIs in common code, and then dispatched events to the interpreters through a matching interp_on_foo method for each observer. That turned out a lot more complicated than the present solution, as we'd end up with having to create a new interp method every time some interpreter wanted to listen to some observer notification, resulting in a lot of duplicated make-work and more coupling than desirable. gdb/ChangeLog: 2016-06-21 Pedro Alves <palves@redhat.com> * cli/cli-interp.c (cli_interp): Delete. (as_cli_interp): New function. (cli_on_normal_stop, cli_on_signal_received) (cli_on_end_stepping_range, cli_on_signal_exited, cli_on_exited) (cli_on_no_history): Send output to all CLI UIs. (cli_on_sync_execution_done, cli_on_command_error): Skip output if the top level interpreter is not a CLI. (cli_interpreter_init): Don't set cli_interp or install observers here. (_initialize_cli_interp): Install observers here. * event-top.c (main_ui_, ui_list): New globals. (current_ui): Point to main_ui_. (restore_ui_cleanup, switch_thru_all_uis_init) (switch_thru_all_uis_cond, switch_thru_all_uis_next): New functions. * mi/mi-interp.c (as_mi_interp): New function. (mi_interpreter_init): Don't install observers here. (mi_on_sync_execution_done): Skip output if the top level interpreter is not a MI. (mi_new_thread, mi_thread_exit, mi_record_changed) (mi_inferior_added, mi_inferior_appeared, mi_inferior_exit) (mi_inferior_removed): Send output to all MI UIs. (find_mi_interpreter, mi_interp_data): Delete. (find_mi_interp): New function. (mi_on_signal_received, mi_on_end_stepping_range) (mi_on_signal_exited, mi_on_exited, mi_on_no_history): Send output to all MI UIs. (mi_on_normal_stop): Rename to ... (mi_on_normal_stop_1): ... this. (mi_on_normal_stop): Reimplement, sending output to all MI UIs. (mi_traceframe_changed, mi_tsv_created, mi_tsv_deleted) (mi_tsv_modified, mi_breakpoint_created, mi_breakpoint_deleted) (mi_breakpoint_modified, mi_output_running_pid): Send output to all MI UIs. (mi_on_resume): Rename to ... (mi_on_resume_1): ... this. Don't handle infcalls here. (mi_on_resume): Reimplement, sending output to all MI UIs. (mi_solib_loaded, mi_solib_unloaded, mi_command_param_changed) (mi_memory_changed): Send output to all MI UIs. (report_initial_inferior): Install observers here. * top.h (struct ui) <next>: New field. (ui_list): Declare. (struct switch_thru_all_uis): New. (switch_thru_all_uis_init, switch_thru_all_uis_cond) (switch_thru_all_uis_next): Declare. (SWITCH_THRU_ALL_UIS): New macro. * tui/tui-interp.c (tui_interp): Delete global. (as_tui_interp): New function. (tui_on_normal_stop, tui_on_signal_received) (tui_on_end_stepping_range, tui_on_signal_exited, tui_on_exited) (tui_on_no_history): Send output to all TUI UIs. (tui_on_sync_execution_done, tui_on_command_error): Skip output if the top level interpreter is not a TUI. (tui_init): Don't set tui_interp or install observers here. (_initialize_tui_interp): Install observers here.
2016-06-21 02:11:45 +02:00
/* The current UI. */
Introduce "struct ui" This is a step towards supporting multiple consoles/MIs, each on its own stdio streams / terminal. See intro comment in top.h. (I've had trouble picking a name for this object. I've started out with "struct console" originally. But then this is about MI as well, and there's "interpreter-exec console", which is specifically about the CLI... So I changed to "struct terminal", but, then we have a terminal object that works when the input is not a terminal as well ... Then I sort of gave up and renamed it to "struct top_level". But it then gets horribly confusing when we talk about the "top level interpreter that's running on the current top level". In the end, I realized we're already sort of calling this "ui", in struct ui_out, struct ui_file, and a few coments here and there.) gdb/ChangeLog: 2016-06-21 Pedro Alves <palves@redhat.com> * event-top.c: Update readline-related comments. (input_handler, call_readline): Delete globals. (gdb_rl_callback_handler): Call the current UI's input_handler method. (change_line_handler): Adjust to set current UI's properties instead of globals. (current_ui_, current_ui): New globals. (get_command_line_buffer): Rewrite to refer to the current UI. (stdin_event_handler): Adjust to call the call_readline method of the current UI. (gdb_readline_no_editing_callback): Adjust to call the current UI's input_handler method. (gdb_setup_readline): Adjust to set current UI's properties instead of globals. * event-top.h (call_readline, input_handler): Delete declarations. * mi/mi-interp.c (mi_interpreter_resume): Adjust to set current UI's properties instead of globals. * top.c (gdb_readline_wrapper_cleanup): Adjust to set current UI's properties instead of globals. (gdb_readline_wrapper): Adjust to call and set current UI's methods instead of globals. * top.h: Include buffer.h and event-loop.h. (struct ui): New struct. (current_ui): New declaration.
2016-06-21 02:11:44 +02:00
extern struct ui *current_ui;
Make the intepreters output to all UIs When we have multiple consoles, MI channels, etc., then we need to broadcast breakpoint hits, etc. to all UIs. In the past, I've adjusted most of the run control to communicate events to the interpreters through observer notifications, so events would be properly sent to console and MI streams, in sync and async modes. This patch does the next logical step -- have each interpreter's observers output interpreter-specific info to _all_ UIs. Note that when we have multiple instances of active cli/tui interpreters, then the cli_interp and tui_interp globals no longer work. This is addressed by this patch. Also, the interpreters currently register some observers when resumed and remove them when suspended. If we have multiple instances of the interpreters, and they can be suspended/resumed at different, independent times, that no longer works. What we instead do is always install the observers, and then have the observers themselves know when to do nothing. An earlier prototype of this series did the looping over struct UIs in common code, and then dispatched events to the interpreters through a matching interp_on_foo method for each observer. That turned out a lot more complicated than the present solution, as we'd end up with having to create a new interp method every time some interpreter wanted to listen to some observer notification, resulting in a lot of duplicated make-work and more coupling than desirable. gdb/ChangeLog: 2016-06-21 Pedro Alves <palves@redhat.com> * cli/cli-interp.c (cli_interp): Delete. (as_cli_interp): New function. (cli_on_normal_stop, cli_on_signal_received) (cli_on_end_stepping_range, cli_on_signal_exited, cli_on_exited) (cli_on_no_history): Send output to all CLI UIs. (cli_on_sync_execution_done, cli_on_command_error): Skip output if the top level interpreter is not a CLI. (cli_interpreter_init): Don't set cli_interp or install observers here. (_initialize_cli_interp): Install observers here. * event-top.c (main_ui_, ui_list): New globals. (current_ui): Point to main_ui_. (restore_ui_cleanup, switch_thru_all_uis_init) (switch_thru_all_uis_cond, switch_thru_all_uis_next): New functions. * mi/mi-interp.c (as_mi_interp): New function. (mi_interpreter_init): Don't install observers here. (mi_on_sync_execution_done): Skip output if the top level interpreter is not a MI. (mi_new_thread, mi_thread_exit, mi_record_changed) (mi_inferior_added, mi_inferior_appeared, mi_inferior_exit) (mi_inferior_removed): Send output to all MI UIs. (find_mi_interpreter, mi_interp_data): Delete. (find_mi_interp): New function. (mi_on_signal_received, mi_on_end_stepping_range) (mi_on_signal_exited, mi_on_exited, mi_on_no_history): Send output to all MI UIs. (mi_on_normal_stop): Rename to ... (mi_on_normal_stop_1): ... this. (mi_on_normal_stop): Reimplement, sending output to all MI UIs. (mi_traceframe_changed, mi_tsv_created, mi_tsv_deleted) (mi_tsv_modified, mi_breakpoint_created, mi_breakpoint_deleted) (mi_breakpoint_modified, mi_output_running_pid): Send output to all MI UIs. (mi_on_resume): Rename to ... (mi_on_resume_1): ... this. Don't handle infcalls here. (mi_on_resume): Reimplement, sending output to all MI UIs. (mi_solib_loaded, mi_solib_unloaded, mi_command_param_changed) (mi_memory_changed): Send output to all MI UIs. (report_initial_inferior): Install observers here. * top.h (struct ui) <next>: New field. (ui_list): Declare. (struct switch_thru_all_uis): New. (switch_thru_all_uis_init, switch_thru_all_uis_cond) (switch_thru_all_uis_next): Declare. (SWITCH_THRU_ALL_UIS): New macro. * tui/tui-interp.c (tui_interp): Delete global. (as_tui_interp): New function. (tui_on_normal_stop, tui_on_signal_received) (tui_on_end_stepping_range, tui_on_signal_exited, tui_on_exited) (tui_on_no_history): Send output to all TUI UIs. (tui_on_sync_execution_done, tui_on_command_error): Skip output if the top level interpreter is not a TUI. (tui_init): Don't set tui_interp or install observers here. (_initialize_tui_interp): Install observers here.
2016-06-21 02:11:45 +02:00
/* The list of all UIs. */
extern struct ui *ui_list;
Remove make_cleanup_restore_current_ui This removes make_cleanup_restore_current_ui by converting the last use. The last use was in a few functions used to iterate over all UIs. This patch replaces these functions with a class, and arranges for the class destructor to do the needed cleanup. 2016-10-21 Tom Tromey <tom@tromey.com> * tui/tui-interp.c (tui_on_normal_stop, tui_on_signal_received) (tui_on_end_stepping_range, tui_on_signal_exited, tui_on_exited) (tui_on_no_history, tui_on_user_selected_context_changed): Update. * top.h (switch_thru_all_uis): New class. (SWITCH_THRU_ALL_UIS): Rewrite. (make_cleanup_restore_current_ui, switch_thru_all_uis_init) (switch_thru_all_uis_cond, switch_thru_all_uis_next): Don't declare. * mi/mi-interp.c (mi_new_thread, mi_thread_exit) (mi_record_changed, mi_inferior_added, mi_inferior_appeared) (mi_inferior_exit, mi_inferior_removed, mi_on_signal_received) (mi_on_end_stepping_range, mi_on_signal_exited, mi_on_exited) (mi_on_no_history, mi_on_normal_stop, mi_traceframe_changed) (mi_tsv_created, mi_tsv_deleted, mi_tsv_modified) (mi_breakpoint_created, mi_breakpoint_deleted) (mi_breakpoint_modified, mi_output_running_pid, mi_on_resume) (mi_solib_loaded, mi_solib_unloaded, mi_command_param_changed) (mi_memory_changed, mi_user_selected_context_changed): Update. * infrun.c (all_uis_check_sync_execution_done) (all_uis_on_sync_execution_starting, normal_stop): Update. * event-top.c (restore_ui_cleanup) (make_cleanup_restore_current_ui, switch_thru_all_uis_init) (switch_thru_all_uis_cond, switch_thru_all_uis_next): Remove. * cli/cli-interp.c (cli_on_normal_stop, cli_on_signal_received) (cli_on_end_stepping_range, cli_on_signal_exited, cli_on_exited) (cli_on_no_history, cli_on_user_selected_context_changed): Update. * breakpoint.c (watchpoint_check): Update.
2016-09-25 00:11:14 +02:00
/* State for SWITCH_THRU_ALL_UIS. */
class switch_thru_all_uis
Make the intepreters output to all UIs When we have multiple consoles, MI channels, etc., then we need to broadcast breakpoint hits, etc. to all UIs. In the past, I've adjusted most of the run control to communicate events to the interpreters through observer notifications, so events would be properly sent to console and MI streams, in sync and async modes. This patch does the next logical step -- have each interpreter's observers output interpreter-specific info to _all_ UIs. Note that when we have multiple instances of active cli/tui interpreters, then the cli_interp and tui_interp globals no longer work. This is addressed by this patch. Also, the interpreters currently register some observers when resumed and remove them when suspended. If we have multiple instances of the interpreters, and they can be suspended/resumed at different, independent times, that no longer works. What we instead do is always install the observers, and then have the observers themselves know when to do nothing. An earlier prototype of this series did the looping over struct UIs in common code, and then dispatched events to the interpreters through a matching interp_on_foo method for each observer. That turned out a lot more complicated than the present solution, as we'd end up with having to create a new interp method every time some interpreter wanted to listen to some observer notification, resulting in a lot of duplicated make-work and more coupling than desirable. gdb/ChangeLog: 2016-06-21 Pedro Alves <palves@redhat.com> * cli/cli-interp.c (cli_interp): Delete. (as_cli_interp): New function. (cli_on_normal_stop, cli_on_signal_received) (cli_on_end_stepping_range, cli_on_signal_exited, cli_on_exited) (cli_on_no_history): Send output to all CLI UIs. (cli_on_sync_execution_done, cli_on_command_error): Skip output if the top level interpreter is not a CLI. (cli_interpreter_init): Don't set cli_interp or install observers here. (_initialize_cli_interp): Install observers here. * event-top.c (main_ui_, ui_list): New globals. (current_ui): Point to main_ui_. (restore_ui_cleanup, switch_thru_all_uis_init) (switch_thru_all_uis_cond, switch_thru_all_uis_next): New functions. * mi/mi-interp.c (as_mi_interp): New function. (mi_interpreter_init): Don't install observers here. (mi_on_sync_execution_done): Skip output if the top level interpreter is not a MI. (mi_new_thread, mi_thread_exit, mi_record_changed) (mi_inferior_added, mi_inferior_appeared, mi_inferior_exit) (mi_inferior_removed): Send output to all MI UIs. (find_mi_interpreter, mi_interp_data): Delete. (find_mi_interp): New function. (mi_on_signal_received, mi_on_end_stepping_range) (mi_on_signal_exited, mi_on_exited, mi_on_no_history): Send output to all MI UIs. (mi_on_normal_stop): Rename to ... (mi_on_normal_stop_1): ... this. (mi_on_normal_stop): Reimplement, sending output to all MI UIs. (mi_traceframe_changed, mi_tsv_created, mi_tsv_deleted) (mi_tsv_modified, mi_breakpoint_created, mi_breakpoint_deleted) (mi_breakpoint_modified, mi_output_running_pid): Send output to all MI UIs. (mi_on_resume): Rename to ... (mi_on_resume_1): ... this. Don't handle infcalls here. (mi_on_resume): Reimplement, sending output to all MI UIs. (mi_solib_loaded, mi_solib_unloaded, mi_command_param_changed) (mi_memory_changed): Send output to all MI UIs. (report_initial_inferior): Install observers here. * top.h (struct ui) <next>: New field. (ui_list): Declare. (struct switch_thru_all_uis): New. (switch_thru_all_uis_init, switch_thru_all_uis_cond) (switch_thru_all_uis_next): Declare. (SWITCH_THRU_ALL_UIS): New macro. * tui/tui-interp.c (tui_interp): Delete global. (as_tui_interp): New function. (tui_on_normal_stop, tui_on_signal_received) (tui_on_end_stepping_range, tui_on_signal_exited, tui_on_exited) (tui_on_no_history): Send output to all TUI UIs. (tui_on_sync_execution_done, tui_on_command_error): Skip output if the top level interpreter is not a TUI. (tui_init): Don't set tui_interp or install observers here. (_initialize_tui_interp): Install observers here.
2016-06-21 02:11:45 +02:00
{
Remove make_cleanup_restore_current_ui This removes make_cleanup_restore_current_ui by converting the last use. The last use was in a few functions used to iterate over all UIs. This patch replaces these functions with a class, and arranges for the class destructor to do the needed cleanup. 2016-10-21 Tom Tromey <tom@tromey.com> * tui/tui-interp.c (tui_on_normal_stop, tui_on_signal_received) (tui_on_end_stepping_range, tui_on_signal_exited, tui_on_exited) (tui_on_no_history, tui_on_user_selected_context_changed): Update. * top.h (switch_thru_all_uis): New class. (SWITCH_THRU_ALL_UIS): Rewrite. (make_cleanup_restore_current_ui, switch_thru_all_uis_init) (switch_thru_all_uis_cond, switch_thru_all_uis_next): Don't declare. * mi/mi-interp.c (mi_new_thread, mi_thread_exit) (mi_record_changed, mi_inferior_added, mi_inferior_appeared) (mi_inferior_exit, mi_inferior_removed, mi_on_signal_received) (mi_on_end_stepping_range, mi_on_signal_exited, mi_on_exited) (mi_on_no_history, mi_on_normal_stop, mi_traceframe_changed) (mi_tsv_created, mi_tsv_deleted, mi_tsv_modified) (mi_breakpoint_created, mi_breakpoint_deleted) (mi_breakpoint_modified, mi_output_running_pid, mi_on_resume) (mi_solib_loaded, mi_solib_unloaded, mi_command_param_changed) (mi_memory_changed, mi_user_selected_context_changed): Update. * infrun.c (all_uis_check_sync_execution_done) (all_uis_on_sync_execution_starting, normal_stop): Update. * event-top.c (restore_ui_cleanup) (make_cleanup_restore_current_ui, switch_thru_all_uis_init) (switch_thru_all_uis_cond, switch_thru_all_uis_next): Remove. * cli/cli-interp.c (cli_on_normal_stop, cli_on_signal_received) (cli_on_end_stepping_range, cli_on_signal_exited, cli_on_exited) (cli_on_no_history, cli_on_user_selected_context_changed): Update. * breakpoint.c (watchpoint_check): Update.
2016-09-25 00:11:14 +02:00
public:
switch_thru_all_uis () : m_iter (ui_list), m_save_ui (&current_ui)
{
current_ui = ui_list;
}
/* If done iterating, return true; otherwise return false. */
bool done () const
{
return m_iter == NULL;
}
/* Move to the next UI, setting current_ui if iteration is not yet
complete. */
void next ()
{
m_iter = m_iter->next;
if (m_iter != NULL)
current_ui = m_iter;
}
private:
/* No need for these. They are intentionally not defined
anywhere. */
switch_thru_all_uis &operator= (const switch_thru_all_uis &);
switch_thru_all_uis (const switch_thru_all_uis &);
/* Used to iterate through the UIs. */
struct ui *m_iter;
/* Save and restore current_ui. */
scoped_restore_tmpl<struct ui *> m_save_ui;
Make the intepreters output to all UIs When we have multiple consoles, MI channels, etc., then we need to broadcast breakpoint hits, etc. to all UIs. In the past, I've adjusted most of the run control to communicate events to the interpreters through observer notifications, so events would be properly sent to console and MI streams, in sync and async modes. This patch does the next logical step -- have each interpreter's observers output interpreter-specific info to _all_ UIs. Note that when we have multiple instances of active cli/tui interpreters, then the cli_interp and tui_interp globals no longer work. This is addressed by this patch. Also, the interpreters currently register some observers when resumed and remove them when suspended. If we have multiple instances of the interpreters, and they can be suspended/resumed at different, independent times, that no longer works. What we instead do is always install the observers, and then have the observers themselves know when to do nothing. An earlier prototype of this series did the looping over struct UIs in common code, and then dispatched events to the interpreters through a matching interp_on_foo method for each observer. That turned out a lot more complicated than the present solution, as we'd end up with having to create a new interp method every time some interpreter wanted to listen to some observer notification, resulting in a lot of duplicated make-work and more coupling than desirable. gdb/ChangeLog: 2016-06-21 Pedro Alves <palves@redhat.com> * cli/cli-interp.c (cli_interp): Delete. (as_cli_interp): New function. (cli_on_normal_stop, cli_on_signal_received) (cli_on_end_stepping_range, cli_on_signal_exited, cli_on_exited) (cli_on_no_history): Send output to all CLI UIs. (cli_on_sync_execution_done, cli_on_command_error): Skip output if the top level interpreter is not a CLI. (cli_interpreter_init): Don't set cli_interp or install observers here. (_initialize_cli_interp): Install observers here. * event-top.c (main_ui_, ui_list): New globals. (current_ui): Point to main_ui_. (restore_ui_cleanup, switch_thru_all_uis_init) (switch_thru_all_uis_cond, switch_thru_all_uis_next): New functions. * mi/mi-interp.c (as_mi_interp): New function. (mi_interpreter_init): Don't install observers here. (mi_on_sync_execution_done): Skip output if the top level interpreter is not a MI. (mi_new_thread, mi_thread_exit, mi_record_changed) (mi_inferior_added, mi_inferior_appeared, mi_inferior_exit) (mi_inferior_removed): Send output to all MI UIs. (find_mi_interpreter, mi_interp_data): Delete. (find_mi_interp): New function. (mi_on_signal_received, mi_on_end_stepping_range) (mi_on_signal_exited, mi_on_exited, mi_on_no_history): Send output to all MI UIs. (mi_on_normal_stop): Rename to ... (mi_on_normal_stop_1): ... this. (mi_on_normal_stop): Reimplement, sending output to all MI UIs. (mi_traceframe_changed, mi_tsv_created, mi_tsv_deleted) (mi_tsv_modified, mi_breakpoint_created, mi_breakpoint_deleted) (mi_breakpoint_modified, mi_output_running_pid): Send output to all MI UIs. (mi_on_resume): Rename to ... (mi_on_resume_1): ... this. Don't handle infcalls here. (mi_on_resume): Reimplement, sending output to all MI UIs. (mi_solib_loaded, mi_solib_unloaded, mi_command_param_changed) (mi_memory_changed): Send output to all MI UIs. (report_initial_inferior): Install observers here. * top.h (struct ui) <next>: New field. (ui_list): Declare. (struct switch_thru_all_uis): New. (switch_thru_all_uis_init, switch_thru_all_uis_cond) (switch_thru_all_uis_next): Declare. (SWITCH_THRU_ALL_UIS): New macro. * tui/tui-interp.c (tui_interp): Delete global. (as_tui_interp): New function. (tui_on_normal_stop, tui_on_signal_received) (tui_on_end_stepping_range, tui_on_signal_exited, tui_on_exited) (tui_on_no_history): Send output to all TUI UIs. (tui_on_sync_execution_done, tui_on_command_error): Skip output if the top level interpreter is not a TUI. (tui_init): Don't set tui_interp or install observers here. (_initialize_tui_interp): Install observers here.
2016-06-21 02:11:45 +02:00
};
/* Traverse through all UI, and switch the current UI to the one
being iterated. */
Remove make_cleanup_restore_current_ui This removes make_cleanup_restore_current_ui by converting the last use. The last use was in a few functions used to iterate over all UIs. This patch replaces these functions with a class, and arranges for the class destructor to do the needed cleanup. 2016-10-21 Tom Tromey <tom@tromey.com> * tui/tui-interp.c (tui_on_normal_stop, tui_on_signal_received) (tui_on_end_stepping_range, tui_on_signal_exited, tui_on_exited) (tui_on_no_history, tui_on_user_selected_context_changed): Update. * top.h (switch_thru_all_uis): New class. (SWITCH_THRU_ALL_UIS): Rewrite. (make_cleanup_restore_current_ui, switch_thru_all_uis_init) (switch_thru_all_uis_cond, switch_thru_all_uis_next): Don't declare. * mi/mi-interp.c (mi_new_thread, mi_thread_exit) (mi_record_changed, mi_inferior_added, mi_inferior_appeared) (mi_inferior_exit, mi_inferior_removed, mi_on_signal_received) (mi_on_end_stepping_range, mi_on_signal_exited, mi_on_exited) (mi_on_no_history, mi_on_normal_stop, mi_traceframe_changed) (mi_tsv_created, mi_tsv_deleted, mi_tsv_modified) (mi_breakpoint_created, mi_breakpoint_deleted) (mi_breakpoint_modified, mi_output_running_pid, mi_on_resume) (mi_solib_loaded, mi_solib_unloaded, mi_command_param_changed) (mi_memory_changed, mi_user_selected_context_changed): Update. * infrun.c (all_uis_check_sync_execution_done) (all_uis_on_sync_execution_starting, normal_stop): Update. * event-top.c (restore_ui_cleanup) (make_cleanup_restore_current_ui, switch_thru_all_uis_init) (switch_thru_all_uis_cond, switch_thru_all_uis_next): Remove. * cli/cli-interp.c (cli_on_normal_stop, cli_on_signal_received) (cli_on_end_stepping_range, cli_on_signal_exited, cli_on_exited) (cli_on_no_history, cli_on_user_selected_context_changed): Update. * breakpoint.c (watchpoint_check): Update.
2016-09-25 00:11:14 +02:00
#define SWITCH_THRU_ALL_UIS() \
for (switch_thru_all_uis stau_state; !stau_state.done (); stau_state.next ())
Make the intepreters output to all UIs When we have multiple consoles, MI channels, etc., then we need to broadcast breakpoint hits, etc. to all UIs. In the past, I've adjusted most of the run control to communicate events to the interpreters through observer notifications, so events would be properly sent to console and MI streams, in sync and async modes. This patch does the next logical step -- have each interpreter's observers output interpreter-specific info to _all_ UIs. Note that when we have multiple instances of active cli/tui interpreters, then the cli_interp and tui_interp globals no longer work. This is addressed by this patch. Also, the interpreters currently register some observers when resumed and remove them when suspended. If we have multiple instances of the interpreters, and they can be suspended/resumed at different, independent times, that no longer works. What we instead do is always install the observers, and then have the observers themselves know when to do nothing. An earlier prototype of this series did the looping over struct UIs in common code, and then dispatched events to the interpreters through a matching interp_on_foo method for each observer. That turned out a lot more complicated than the present solution, as we'd end up with having to create a new interp method every time some interpreter wanted to listen to some observer notification, resulting in a lot of duplicated make-work and more coupling than desirable. gdb/ChangeLog: 2016-06-21 Pedro Alves <palves@redhat.com> * cli/cli-interp.c (cli_interp): Delete. (as_cli_interp): New function. (cli_on_normal_stop, cli_on_signal_received) (cli_on_end_stepping_range, cli_on_signal_exited, cli_on_exited) (cli_on_no_history): Send output to all CLI UIs. (cli_on_sync_execution_done, cli_on_command_error): Skip output if the top level interpreter is not a CLI. (cli_interpreter_init): Don't set cli_interp or install observers here. (_initialize_cli_interp): Install observers here. * event-top.c (main_ui_, ui_list): New globals. (current_ui): Point to main_ui_. (restore_ui_cleanup, switch_thru_all_uis_init) (switch_thru_all_uis_cond, switch_thru_all_uis_next): New functions. * mi/mi-interp.c (as_mi_interp): New function. (mi_interpreter_init): Don't install observers here. (mi_on_sync_execution_done): Skip output if the top level interpreter is not a MI. (mi_new_thread, mi_thread_exit, mi_record_changed) (mi_inferior_added, mi_inferior_appeared, mi_inferior_exit) (mi_inferior_removed): Send output to all MI UIs. (find_mi_interpreter, mi_interp_data): Delete. (find_mi_interp): New function. (mi_on_signal_received, mi_on_end_stepping_range) (mi_on_signal_exited, mi_on_exited, mi_on_no_history): Send output to all MI UIs. (mi_on_normal_stop): Rename to ... (mi_on_normal_stop_1): ... this. (mi_on_normal_stop): Reimplement, sending output to all MI UIs. (mi_traceframe_changed, mi_tsv_created, mi_tsv_deleted) (mi_tsv_modified, mi_breakpoint_created, mi_breakpoint_deleted) (mi_breakpoint_modified, mi_output_running_pid): Send output to all MI UIs. (mi_on_resume): Rename to ... (mi_on_resume_1): ... this. Don't handle infcalls here. (mi_on_resume): Reimplement, sending output to all MI UIs. (mi_solib_loaded, mi_solib_unloaded, mi_command_param_changed) (mi_memory_changed): Send output to all MI UIs. (report_initial_inferior): Install observers here. * top.h (struct ui) <next>: New field. (ui_list): Declare. (struct switch_thru_all_uis): New. (switch_thru_all_uis_init, switch_thru_all_uis_cond) (switch_thru_all_uis_next): Declare. (SWITCH_THRU_ALL_UIS): New macro. * tui/tui-interp.c (tui_interp): Delete global. (as_tui_interp): New function. (tui_on_normal_stop, tui_on_signal_received) (tui_on_end_stepping_range, tui_on_signal_exited, tui_on_exited) (tui_on_no_history): Send output to all TUI UIs. (tui_on_sync_execution_done, tui_on_command_error): Skip output if the top level interpreter is not a TUI. (tui_init): Don't set tui_interp or install observers here. (_initialize_tui_interp): Install observers here.
2016-06-21 02:11:45 +02:00
Replace the sync_execution global with a new enum prompt_state tristate When sync_execution (a boolean) is true, it means we're running a foreground command -- we hide the prompt stop listening to input, give the inferior the terminal, then go to the event loop waiting for the target to stop. With multiple independent UIs, we need to track whether each UI is synchronously blocked waiting for the target. IOW, if you do "continue" in one console, that console stops accepting commands, but you should still be free to type other commands in the others consoles. Just simply making sync_execution be per-UI alone not sufficient, because of this in fetch_inferior_event: /* If the inferior was in sync execution mode, and now isn't, restore the prompt (a synchronous execution command has finished, and we're ready for input). */ if (current_ui->async && was_sync && !sync_execution) observer_notify_sync_execution_done (); We'd have to record at entry the "was_sync" state for each UI, not just of the current UI. This patch instead replaces the sync_execution flag by a per-UI tristate flag indicating the command line prompt state: enum prompt_state { /* The command line is blocked simulating synchronous execution. This is used to implement the foreground execution commands ('run', 'continue', etc.). We won't display the prompt and accept further commands until the execution is actually over. */ PROMPT_BLOCKED, /* The command finished; display the prompt before returning back to the top level. */ PROMPT_NEEDED, /* We've displayed the prompt already, ready for input. */ PROMPTED, ; I think the end result is _much_ clearer than the current code, and, it addresses the original motivation too. gdb/ChangeLog: 2016-06-21 Pedro Alves <palves@redhat.com> * annotate.c: Include top.h. (async_background_execution_p): Delete. (print_value_flags): Check the UI's prompt state rather then async_background_execution_p. * event-loop.c (start_event_loop): Set the prompt state to PROMPT_NEEDED. * event-top.c (display_gdb_prompt, async_enable_stdin) (async_disable_stdin): Check the current UI's prompt state instead of the sync_execution global. (command_line_handler): Set the prompt state to PROMPT_NEEDED before running a command, and display the prompt if still needed afterwards. * infcall.c (struct call_thread_fsm) <waiting_ui>: New field. (new_call_thread_fsm): New parameter 'waiting_ui'. Store it. (call_thread_fsm_should_stop): Set the prompt state to PROMPT_NEEDED. (run_inferior_call): Adjust to temporarily set the prompt state to PROMPT_BLOCKED instead of using the sync_execution global. (call_function_by_hand_dummy): Pass the current UI to new_call_thread_fsm. * infcmd.c: Include top.h. (continue_1): Check the current UI's prompt state instead of the sync_execution global. (continue_command): Validate global execution state before calling prepare_execution_command. (step_1): Call all_uis_check_sync_execution_done. (attach_post_wait): Don't call async_enable_stdin here. Remove reference to sync_execution. * infrun.c (sync_execution): Delete global. (follow_fork_inferior) (reinstall_readline_callback_handler_cleanup): Check the current UI's prompt state instead of the sync_execution global. (check_curr_ui_sync_execution_done) (all_uis_check_sync_execution_done): New functions. (fetch_inferior_event): Call all_uis_check_sync_execution_done instead of trying to determine whether the global sync execution changed. (handle_no_resumed): Check the prompt state of all UIs. (normal_stop): Emit the no unwait-for even to all PROMPT_BLOCKED UIs. Emit the "Switching to" notification to all UIs. Enable stdin in all UIs. * infrun.h (sync_execution): Delete. (all_uis_check_sync_execution_done): Declare. * main.c (captured_command_loop): Don't call interp_pre_command_loop if the prompt is blocked. (catch_command_errors, catch_command_errors_const): Adjust. (captured_main): Set the initial prompt state to PROMPT_NEEDED. * mi/mi-interp.c (display_mi_prompt): Set the prompt state to PROMPTED. (mi_interpreter_resume): Don't clear sync_execution. Remove hack comment. (mi_execute_command_input_handler): Set the prompt state to PROMPT_NEEDED before executing the command, and only display the prompt if the prompt state is PROMPT_NEEDED afterwards. (mi_on_resume_1): Adjust to check the prompt state. * target.c (target_terminal_inferior): Adjust to check the prompt state. * top.c (wait_sync_command_done, maybe_wait_sync_command_done) (execute_command): Check the current UI's prompt state instead of sync_execution. * top.h (enum prompt_state): New. (struct ui) <prompt_state>: New field. (ALL_UIS): New macro.
2016-06-21 02:11:51 +02:00
/* Traverse over all UIs. */
#define ALL_UIS(UI) \
for (UI = ui_list; UI; UI = UI->next) \
Fix PR gdb/20418 - Problems with synchronous commands and new-ui When executing commands on a secondary UI running the MI interpreter, some commands that should be synchronous are not. MI incorrectly continues processing input right after the synchronous command is sent, before the target stops. The problem happens when we emit MI async events (=library-loaded, etc.), and we go about restoring the previous terminal state, we end up calling target_terminal_ours, which incorrectly always installs the current UI's input_fd in the event loop... That is, code like this: old_chain = make_cleanup_restore_target_terminal (); target_terminal_ours_for_output (); fprintf_unfiltered (mi->event_channel, "library-loaded"); ... do_cleanups (old_chain); The fix is to move the add_file_handler/delete_file_handler calls out of target_terminal_$foo, making these completely no-ops unless called with the main UI as current UI. gdb/ChangeLog: 2016-08-09 Pedro Alves <palves@redhat.com> PR gdb/20418 * event-top.c (ui_register_input_event_handler) (ui_unregister_input_event_handler): New functions. (async_enable_stdin): Register input in the event loop. (async_disable_stdin): Unregister input from the event loop. (gdb_setup_readline): Register input in the event loop. * infrun.c (check_curr_ui_sync_execution_done): Register input in the event loop. * target.c (target_terminal_inferior): Don't unregister input from the event loop. (target_terminal_ours): Don't register input in the event loop. * target.h (target_terminal_inferior) (target_terminal_ours_for_output, target_terminal_ours): Update comments. * top.h (ui_register_input_event_handler) (ui_unregister_input_event_handler): New declarations. * utils.c (ui_unregister_input_event_handler_cleanup) (prepare_to_handle_input): New functions. (defaulted_query, prompt_for_continue): Use prepare_to_handle_input. gdb/testsuite/ChangeLog: 2016-08-09 Pedro Alves <palves@redhat.com> Simon Marchi <simon.marchi@ericsson.com> PR gdb/20418 * gdb.mi/new-ui-mi-sync.c, gdb.mi/new-ui-mi-sync.exp: New files. * lib/mi-support.exp (mi_expect_interrupt): Remove anchors.
2016-08-09 23:45:40 +02:00
/* Register the UI's input file descriptor in the event loop. */
extern void ui_register_input_event_handler (struct ui *ui);
/* Unregister the UI's input file descriptor from the event loop. */
extern void ui_unregister_input_event_handler (struct ui *ui);
/* From top.c. */
extern char *saved_command_line;
extern int confirm;
extern int inhibit_gdbinit;
extern const char gdbinit[];
2000-02-02 01:21:19 +01:00
extern void print_gdb_version (struct ui_file *);
extern void print_gdb_configuration (struct ui_file *);
2000-05-28 03:12:42 +02:00
extern void read_command_file (FILE *);
extern void init_history (void);
extern void command_loop (void);
extern int quit_confirm (void);
extern void quit_force (int *, int);
2000-05-28 03:12:42 +02:00
extern void quit_command (char *, int);
extern void quit_cover (void);
2000-05-28 03:12:42 +02:00
extern void execute_command (char *, int);
gdb/17347 - Regression: GDB stopped on run with attached process Doing: gdb --pid=PID -ex run Results in GDB getting a SIGTTIN, and thus ending stopped. That's usually indicative of a missing target_terminal_ours call. E.g., from the PR: $ sleep 1h & p=$!; sleep 0.1; gdb -batch sleep $p -ex run [1] 28263 [1] Killed sleep 1h [2]+ Stopped gdb -batch sleep $p -ex run The workaround is doing: gdb -ex "attach $PID" -ex "run" instead of gdb [-p] $PID -ex "run" With the former, gdb waits for the attach command to complete before moving on to the "run" command, because the interpreter is in sync mode at this point, within execute_command. But for the latter, attach_command is called directly from captured_main, and thus misses that waiting. IOW, "run" is running before the attach continuation has run, before the program stops and attach completes. The broken terminal settings are just one symptom of that. Any command that queries or requires input results in the same. The fix is to wait in catch_command_errors (which is specific to main.c nowadays), just like we wait in execute_command. gdb/ChangeLog: 2014-09-11 Pedro Alves <palves@redhat.com> PR gdb/17347 * main.c: Include "infrun.h". (catch_command_errors, catch_command_errors_const): Wait for the foreground command to complete. * top.c (maybe_wait_sync_command_done): New function, factored out from ... (maybe_wait_sync_command_done): ... here. * top.h (maybe_wait_sync_command_done): New declaration. gdb/testsuite/ChangeLog: 2014-09-11 Pedro Alves <palves@redhat.com> PR gdb/17347 * lib/gdb.exp (gdb_spawn_with_cmdline_opts): New procedure. * gdb.base/attach.exp (test_command_line_attach_run): New procedure. (top level): Call it.
2014-09-11 14:04:15 +02:00
/* If the interpreter is in sync mode (we're running a user command's
list, running command hooks or similars), and we just ran a
synchronous command that started the target, wait for that command
to end. WAS_SYNC indicates whether sync_execution was set before
the command was run. */
extern void maybe_wait_sync_command_done (int was_sync);
Merge async and sync code paths some more This patch makes the execution control code use largely the same mechanisms in both sync- and async-capable targets. This means using continuations and use the event loop to react to target events on sync targets as well. The trick is to immediately mark infrun's event loop source after resume instead of calling wait_for_inferior. Then fetch_inferior_event is adjusted to do a blocking wait on sync targets. Tested on x86_64 Fedora 20, native and gdbserver, with and without "maint set target-async off". gdb/ChangeLog: 2015-09-09 Pedro Alves <palves@redhat.com> * breakpoint.c (bpstat_do_actions_1, until_break_command): Don't check whether the target can async. * inf-loop.c (inferior_event_handler): Only call target_async if the target can async. * infcall.c: Include top.h and interps.h. (run_inferior_call): For the interpreter to sync mode while running the infcall. Call wait_sync_command_done instead of wait_for_inferior plus normal_stop. * infcmd.c (prepare_execution_command): Don't check whether the target can async when running in the foreground. (step_1): Delete synchronous case handling. (step_once): Always install a continuation, even in sync mode. (until_next_command, finish_forward): Don't check whether the target can async. (attach_command_post_wait, notice_new_inferior): Always install a continuation, even in sync mode. * infrun.c (mark_infrun_async_event_handler): New function. (proceed): In sync mode, mark infrun's event source instead of waiting for events here. (fetch_inferior_event): If the target can't async, do a blocking wait. (prepare_to_wait): In sync mode, mark infrun's event source. (infrun_async_inferior_event_handler): No longer bail out if the target can't async. * infrun.h (mark_infrun_async_event_handler): New declaration. * linux-nat.c (linux_nat_wait_1): Remove calls to set_sigint_trap/clear_sigint_trap. (linux_nat_terminal_inferior): No longer check whether the target can async. * mi/mi-interp.c (mi_on_sync_execution_done): Update and simplify comment. (mi_execute_command_input_handler): No longer check whether the target is async. Update and simplify comment. * target.c (default_target_wait): New function. * target.h (struct target_ops) <to_wait>: Now defaults to default_target_wait. (default_target_wait): Declare. * top.c (wait_sync_command_done): New function, factored out from ... (maybe_wait_sync_command_done): ... this. * top.h (wait_sync_command_done): Declare. * target-delegates.c: Regenerate.
2015-09-09 19:23:23 +02:00
/* Wait for a synchronous execution command to end. */
extern void wait_sync_command_done (void);
extern void check_frame_language_change (void);
Implement TARGET_OBJECT_STACK_MEMORY. * NEWS: Add note on new "set stack-cache" option. * corefile.c (read_stack): New function. * dcache.c (dcache_struct): New member ptid. (dcache_enable_p): Mark as obsolete. (show_dcache_enabled_p): Flag option as deprecated. (dcache_invalidate): Update ptid. (dcache_invalidate_line): New function. (dcache_read_line): No longer check cacheable attribute, stack accesses get cached despite attribute. (dcache_init): Set ptid. (dcache_xfer_memory): Flush cache if from different ptid than before. Update cache after write. (dcache_update): New function. (dcache_info): Report ptid. (_initialize_dcache): Update text for `remotecache' to indicate it is obsolete. * dcache.h (dcache_update): Declare. * dwarf2loc.c (dwarf2_evaluate_loc_desc): Mark values on stack with set_value_stack. * frame-unwind.c (frame_unwind_got_memory): Ditto. * gdbcore.h (read_stack): Declare. * memattr.c (mem_enable_command): Call target_dcache_invalidate instead of dcache_invalidate. (mem_disable_command, mem_delete_command): Ditto. * target.c (stack_cache_enabled_p_1): New static global. (stack_cache_enabled_p): New static global. (set_stack_cache_enabled_p): New function. (show_stack_cache_enabled_p): New function. (target_dcache): Make static. (target_dcache_invalidate): New function. (target_load, target_resume): Call target_dcache_invalidate instead of dcache_invalidate. (memory_xfer_partial): New arg object, all callers updated. Check for existing inferior before calling dcache routines. When writing non-TARGET_OBJECT_STACK_MEMORY, notify dcache. (target_xfer_partial): Call memory_xfer_partial for TARGET_OBJECT_STACK_MEMORY. (target_read_stack): New function. (initialize_targets): Install new option `stack-cache'. * target.h: Remove #include of dcache.h. (enum target_object): New value TARGET_OBJECT_STACK_MEMORY. (target_dcache): Delete. (target_dcache_invalidate): Declare. (target_read_stack): Declare. * top.c (prepare_execute_command): New function. (execute_command): Call prepare_execute_command instead of free_all_values. * top.h (prepare_execute_command): Declare. * valops.c (get_value_at): New function. (value_at): Guts moved to get_value_at. (value_at_lazy): Similarly. (value_fetch_lazy): Call read_stack for stack values. * value.c (struct value): New member `stack'. (value_stack, set_value_stack): New functions. * value.h (value_stack, set_value_stack): Declare. * mi/mi-main.c (mi_cmd_execute): Call prepare_execute_command instead of free_all_values. doc/ * gdb.texinfo (Caching Data of Remote Targets): Update text. Mark `set/show remotecache' options as obsolete. Document new `set/show stack-cache' option. Update text for `info dcache'.
2009-08-31 22:18:46 +02:00
/* Prepare for execution of a command.
Call this before every command, CLI or MI.
Returns a cleanup to be run after the command is completed. */
extern scoped_value_mark prepare_execute_command (void);
Implement TARGET_OBJECT_STACK_MEMORY. * NEWS: Add note on new "set stack-cache" option. * corefile.c (read_stack): New function. * dcache.c (dcache_struct): New member ptid. (dcache_enable_p): Mark as obsolete. (show_dcache_enabled_p): Flag option as deprecated. (dcache_invalidate): Update ptid. (dcache_invalidate_line): New function. (dcache_read_line): No longer check cacheable attribute, stack accesses get cached despite attribute. (dcache_init): Set ptid. (dcache_xfer_memory): Flush cache if from different ptid than before. Update cache after write. (dcache_update): New function. (dcache_info): Report ptid. (_initialize_dcache): Update text for `remotecache' to indicate it is obsolete. * dcache.h (dcache_update): Declare. * dwarf2loc.c (dwarf2_evaluate_loc_desc): Mark values on stack with set_value_stack. * frame-unwind.c (frame_unwind_got_memory): Ditto. * gdbcore.h (read_stack): Declare. * memattr.c (mem_enable_command): Call target_dcache_invalidate instead of dcache_invalidate. (mem_disable_command, mem_delete_command): Ditto. * target.c (stack_cache_enabled_p_1): New static global. (stack_cache_enabled_p): New static global. (set_stack_cache_enabled_p): New function. (show_stack_cache_enabled_p): New function. (target_dcache): Make static. (target_dcache_invalidate): New function. (target_load, target_resume): Call target_dcache_invalidate instead of dcache_invalidate. (memory_xfer_partial): New arg object, all callers updated. Check for existing inferior before calling dcache routines. When writing non-TARGET_OBJECT_STACK_MEMORY, notify dcache. (target_xfer_partial): Call memory_xfer_partial for TARGET_OBJECT_STACK_MEMORY. (target_read_stack): New function. (initialize_targets): Install new option `stack-cache'. * target.h: Remove #include of dcache.h. (enum target_object): New value TARGET_OBJECT_STACK_MEMORY. (target_dcache): Delete. (target_dcache_invalidate): Declare. (target_read_stack): Declare. * top.c (prepare_execute_command): New function. (execute_command): Call prepare_execute_command instead of free_all_values. * top.h (prepare_execute_command): Declare. * valops.c (get_value_at): New function. (value_at): Guts moved to get_value_at. (value_at_lazy): Similarly. (value_fetch_lazy): Call read_stack for stack values. * value.c (struct value): New member `stack'. (value_stack, set_value_stack): New functions. * value.h (value_stack, set_value_stack): Declare. * mi/mi-main.c (mi_cmd_execute): Call prepare_execute_command instead of free_all_values. doc/ * gdb.texinfo (Caching Data of Remote Targets): Update text. Mark `set/show remotecache' options as obsolete. Document new `set/show stack-cache' option. Update text for `info dcache'.
2009-08-31 22:18:46 +02:00
/* This function returns a pointer to the string that is used
by gdb for its command prompt. */
extern char *get_prompt (void);
/* This function returns a pointer to the string that is used
by gdb for its command prompt. */
extern void set_prompt (const char *s);
/* Return 1 if UI's current input handler is a secondary prompt, 0
otherwise. */
extern int gdb_in_secondary_prompt_p (struct ui *ui);
/* From random places. */
extern int readnow_symbol_files;
1999-05-25 20:09:09 +02:00
/* Perform _initialize initialization. */
2000-05-28 03:12:42 +02:00
extern void gdb_init (char *);
1999-06-14 20:08:47 +02:00
/* For use by event-top.c. */
/* Variables from top.c. */
1999-06-14 20:08:47 +02:00
extern int source_line_number;
extern const char *source_file_name;
1999-06-14 20:08:47 +02:00
extern int history_expansion_p;
extern int server_command;
extern char *lim_at_start;
extern void gdb_add_history (const char *);
2003-06-08 Andrew Cagney <cagney@redhat.com> * acinclude.m4 (gcc_AC_CHECK_DECL, (gcc_AC_CHECK_DECL): Stolen from GCC's acinclude.m4. * configure.in: Check for getopt's delcaration. * aclocal.m4, config.in, configure: Re-generate. * main.c (error_init): Delete declaration. * defs.h (error_init): Declare. * rs6000-tdep.c (rs6000_fetch_pointer_argument): Make static. (rs6000_convert_from_func_ptr_addr): Make static. (_initialize_rs6000_tdep): Add declaration. * cli/cli-cmds.c (dont_repeat): Delete declaration. (show_commands, set_verbose, show_history): Delete declaration. * top.h (set_verbose): Add declaration. (show_history, set_history, show_commands): Add declaration. (do_restore_instream_cleanup): Add declaration. * objc-lang.c (specialcmp): Make static. (print_object_command): Make static. (find_objc_msgsend): Make static. (find_objc_msgcall_submethod_helper): Make static. (find_objc_msgcall_submethod): Make static. (_initialize_objc_language): Add declaration. (find_implementation_from_class): Make static. (find_implementation): Make static. * objc-exp.y (yylex): Delete lookup_struct_typedef declaration. * objc-lang.h (lookup_struct_typedef): Add declaration. * cli/cli-interp.c (_initialize_cli_interp): Add declaration. * cli/cli-script.c (clear_hook_in_cleanup): Make static. (do_restore_user_call_depth): Make static. (do_restore_instream_cleanup): Delete declaration. (dont_repeat): Delete declaration. * cli/cli-decode.c (add_abbrev_cmd): Delete function. * cli/cli-dump.c (_initialize_cli_dump): Add declaration. * reggroups.c (_initialize_reggroup): Add declaration. * cp-support.c (_initialize_cp_support): Add declaration. * cp-abi.c (_initialize_cp_abi): Add declaration. * hpacc-abi.c (_initialize_hpacc_abi): Add declaration. * gnu-v3-abi.c (gnuv3_baseclass_offset): Make static. (_initialize_gnu_v3_abi): Add declaration. * gnu-v2-abi.c (gnuv2_value_rtti_type): Make static. (_initialize_gnu_v2_abi): Add declaration. * frame-base.c (_initialize_frame_base): Add declaration. * doublest.c (floatformat_from_length): Make static. * frame-unwind.c (_initialize_frame_unwind): Add declaration. * frame.c (create_sentinel_frame): Make static. (_initialize_frame): Add declaration. * top.c (do_catch_errors): Make static. (gdb_rl_operate_and_get_next_completion): Make static. * typeprint.c: Include "typeprint.h". * sentinel-frame.c (sentinel_frame_prev_register): Make static. (sentinel_frame_this_id): Make static. * p-valprint.c (_initialize_pascal_valprint): Add declaration. * ui-out.c (make_cleanup_ui_out_begin_end): Delete function. * dwarf2-frame.c (dwarf2_frame_cache): Make static. * p-exp.y (push_current_type, pop_current_type): ISO C declaration. * dwarf2expr.h (dwarf_expr_context): ISO C declaration. * maint.c (maintenance_print_architecture): Make static. * signals/signals.c (_initialize_signals): Add declaration. * std-regs.c (_initialize_frame_reg): Add declaration. * jv-exp.y (push_variable): ISO C definition. (push_qualified_expression_name): Ditto. * memattr.c (_initialize_mem): Add declaration. * remote.c (remote_check_watch_resources): Make static. (remote_stopped_by_watchpoint): Make static. (remote_stopped_data_address): Make static. * d10v-tdep.c (nr_dmap_regs): Make static. (a0_regnum): Make static. (d10v_frame_unwind_cache): Make static. (d10v_frame_p): Make static. * osabi.c (show_osabi): Make static. (_initialize_gdb_osabi): Add extern declaration. * gdbtypes.c (make_qualified_type): Make static. (safe_parse_type): Make static. * macrocmd.c (_initialize_macrocmd): Add extern declaration. * macrotab.c (macro_bcache_free): Make static. * interps.c (interp_set_quiet): Make static. (interpreter_exec_cmd): Make static. * stack.h (select_frame_command): New file. * stack.c: Include "stack.h". (select_frame_command_wrapper): Delete function. (select_frame_command): Make global. * infcall.c: Include "infcall.h". * linespec.c: Include "linespec.h". * symfile.c (sections_overlap): Make static. * cp-support.h (cp_initialize_namespace): ISO C declaration. * charset.c (_initialize_charset): Add missing prototype. * regcache.c (init_legacy_regcache_descr): Make static. (do_regcache_xfree): Make static. (regcache_xfer_part): Make static. (_initialize_regcache): Add missing prototype. * breakpoint.c (parse_breakpoint_sals): Make static. (breakpoint_sals_to_pc): Make static. * interps.h (clear_interpreter_hooks): ISO C declaration. * Makefile.in (stack_h): Define. (stack.o, typeprint.o, mi-main.o): Update dependencies. (mi-cmd-stack.o, infcall.o, linespec.o): Update dependencies. Index: mi/ChangeLog 2003-06-08 Andrew Cagney <cagney@redhat.com> * mi-parse.c (_initialize_mi_parse): Delete function. * mi-main.c: Include "mi-main.h". * mi-interp.c (_initialize_mi_interp): Add declaration. * mi-cmd-stack.c: Include "stack.h". (select_frame_command_wrapper): Delete extern declaration. (mi_cmd_stack_select_frame): Replace select_frame_command_wrapper with select_frame_command.
2003-06-08 20:27:14 +02:00
extern void show_commands (char *args, int from_tty);
Constify add_prefix_cmd This changes add_prefix_cmd to accept a const-taking function as an argument; then fixes up all the callers. In a couple of spots I had to add a non-const overload of a function, because the function is passed to two different command-adding "constructors". These overloads are temporary; once constification is complete they can be removed. This patch also fixes a typo I happened to notice while constifying. Note that this touches a couple of files (gnu-nat.c and go32-nat.c) that I can't build. So, while I made a best-effort there, I am not certain they will still compile. Tested by rebuilding. gdb/ChangeLog 2017-10-11 Tom Tromey <tom@tromey.com> * gdbthread.h (thread_command): Constify. * inferior.h (detach_command): Constify. * top.h (set_history, show_history): Constify. * arm-tdep.c (set_arm_command, show_arm_command): Constify. * serial.c (serial_set_cmd, serial_show_cmd): Constify. * bsd-kvm.c (bsd_kvm_cmd): Constify. * printcmd.c (set_command): Constify. (non_const_set_command): New function. * dcache.c (set_dcache_command, show_dcache_command): Constify. * breakpoint.c (enable_command, disable_command, delete_command) (catch_command, tcatch_command, set_breakpoint_cmd) (show_breakpoint_cmd): Constify. * macrocmd.c (macro_command): Constify. * infcmd.c (unset_command, kill_command, detach_command) (info_proc_cmd): Constify. * i386-tdep.c (set_mpx_cmd, show_mpx_cmd): Constify. * auto-load.c (show_auto_load_cmd, set_auto_load_cmd) (info_auto_load_cmd): Constify. * target-descriptions.c (set_tdesc_cmd, show_tdesc_cmd) (unset_tdesc_cmd): Constify. * ada-lang.c (set_ada_command, show_ada_command) (maint_set_ada_cmd, maint_show_ada_cmd): Constify. * guile/guile.c (set_guile_command, show_guile_command) (info_guile_command): Constify. * tui/tui-win.c (tui_command, set_tui_cmd, show_tui_cmd): Constify. * skip.c (skip_command): Constify. * compile/compile.c (_initialize_compile): Constify. * dwarf2read.c (set_dwarf_cmd, show_dwarf_cmd): Constify. * btrace.c (maint_btrace_cmd, maint_btrace_set_cmd) (maint_btrace_show_cmd, maint_btrace_pt_set_cmd) (maint_btrace_pt_show_cmd): Constify. * remote.c (set_remote_cmd, show_remote_cmd, remote_command): Constify. * python/python.c (user_show_python, user_set_python): Constify. * mips-tdep.c (set_mips_command, show_mips_command) (set_mipsfpu_command): Constify. * record-btrace.c (cmd_record_btrace_start) (cmd_set_record_btrace, cmd_show_record_btrace) (cmd_set_record_btrace_bts, cmd_show_record_btrace_bts) (cmd_set_record_btrace_pt, cmd_show_record_btrace_pt): Constify. * rs6000-tdep.c (set_powerpc_command, show_powerpc_command): Constify. * symfile.c (overlay_command): Constify. * spu-tdep.c (set_spu_command, show_spu_command): Constify. * cli/cli-logging.c (set_logging_command, show_logging_command): Constify. * cli/cli-dump.c (dump_command, append_command) (srec_dump_command, ihex_dump_command, verilog_dump_command) (tekhex_dump_command, binary_dump_command) (binary_append_command): Constify. * cli/cli-decode.c (struct cmd_list_element): Change type of "fun". * cli/cli-cmds.c (info_command, show_command, set_debug) (show_debug): Constify. (show_command): Add non-const overload. * top.c (set_history, show_history): Constify. * sh-tdep.c (set_sh_command, show_sh_command): Constify. * command.h (add_prefix_cmd): Accept a cmd_const_cfunc_ftype. * target.c (target_command): Constify. * sparc64-tdep.c (info_adi_command): Constify. * record-full.c (cmd_record_full_start): Constify. (set_record_full_command): Constify. Fix typo. (show_record_full_command): Constify. * thread.c (thread_command, thread_apply_command): Constify. * memattr.c (dummy_cmd): Constify. * value.c (function_command): Constify. * frame.c (set_backtrace_cmd, show_backtrace_cmd): Constify. * probe.c (info_probes_command): Constify. * ser-tcp.c (set_tcp_cmd, show_tcp_cmd): Constify. * gnu-nat.c (set_task_cmd, show_task_cmd, set_thread_cmd) (show_thread_cmd, set_thread_default_cmd) (show_thread_default_cmd): Constify. (check_empty): Constify. * tracepoint.c (tfind_command): Constify. * cp-support.c (maint_cplus_command): Constify. * windows-tdep.c (info_w32_command): Constify. * record.c (cmd_record_start, set_record_command) (show_record_command, info_record_command, cmd_record_goto): Constify. * ravenscar-thread.c (set_ravenscar_command) (show_ravenscar_command): Constify. * utils.c (set_internal_problem_cmd, show_internal_problem_cmd): Constify. (add_internal_problem_command): Remove casts. * arc-tdep.c (maintenance_print_arc_command): Constify. * valprint.c (set_print, show_print, set_print_raw) (show_print_raw): Constify. * maint.c (maintenance_command, maintenance_info_command) (maintenance_print_command, maintenance_set_cmd) (maintenance_show_cmd, set_per_command_cmd) (show_per_command_cmd, maintenance_check_command): Constify. * language.c (set_check, show_check): Constify. * typeprint.c (show_print_type, set_print_type): Constify. * go32-nat.c (go32_info_dos_command): Constify.
2017-09-26 06:28:30 +02:00
extern void set_history (const char *, int);
2003-06-08 Andrew Cagney <cagney@redhat.com> * acinclude.m4 (gcc_AC_CHECK_DECL, (gcc_AC_CHECK_DECL): Stolen from GCC's acinclude.m4. * configure.in: Check for getopt's delcaration. * aclocal.m4, config.in, configure: Re-generate. * main.c (error_init): Delete declaration. * defs.h (error_init): Declare. * rs6000-tdep.c (rs6000_fetch_pointer_argument): Make static. (rs6000_convert_from_func_ptr_addr): Make static. (_initialize_rs6000_tdep): Add declaration. * cli/cli-cmds.c (dont_repeat): Delete declaration. (show_commands, set_verbose, show_history): Delete declaration. * top.h (set_verbose): Add declaration. (show_history, set_history, show_commands): Add declaration. (do_restore_instream_cleanup): Add declaration. * objc-lang.c (specialcmp): Make static. (print_object_command): Make static. (find_objc_msgsend): Make static. (find_objc_msgcall_submethod_helper): Make static. (find_objc_msgcall_submethod): Make static. (_initialize_objc_language): Add declaration. (find_implementation_from_class): Make static. (find_implementation): Make static. * objc-exp.y (yylex): Delete lookup_struct_typedef declaration. * objc-lang.h (lookup_struct_typedef): Add declaration. * cli/cli-interp.c (_initialize_cli_interp): Add declaration. * cli/cli-script.c (clear_hook_in_cleanup): Make static. (do_restore_user_call_depth): Make static. (do_restore_instream_cleanup): Delete declaration. (dont_repeat): Delete declaration. * cli/cli-decode.c (add_abbrev_cmd): Delete function. * cli/cli-dump.c (_initialize_cli_dump): Add declaration. * reggroups.c (_initialize_reggroup): Add declaration. * cp-support.c (_initialize_cp_support): Add declaration. * cp-abi.c (_initialize_cp_abi): Add declaration. * hpacc-abi.c (_initialize_hpacc_abi): Add declaration. * gnu-v3-abi.c (gnuv3_baseclass_offset): Make static. (_initialize_gnu_v3_abi): Add declaration. * gnu-v2-abi.c (gnuv2_value_rtti_type): Make static. (_initialize_gnu_v2_abi): Add declaration. * frame-base.c (_initialize_frame_base): Add declaration. * doublest.c (floatformat_from_length): Make static. * frame-unwind.c (_initialize_frame_unwind): Add declaration. * frame.c (create_sentinel_frame): Make static. (_initialize_frame): Add declaration. * top.c (do_catch_errors): Make static. (gdb_rl_operate_and_get_next_completion): Make static. * typeprint.c: Include "typeprint.h". * sentinel-frame.c (sentinel_frame_prev_register): Make static. (sentinel_frame_this_id): Make static. * p-valprint.c (_initialize_pascal_valprint): Add declaration. * ui-out.c (make_cleanup_ui_out_begin_end): Delete function. * dwarf2-frame.c (dwarf2_frame_cache): Make static. * p-exp.y (push_current_type, pop_current_type): ISO C declaration. * dwarf2expr.h (dwarf_expr_context): ISO C declaration. * maint.c (maintenance_print_architecture): Make static. * signals/signals.c (_initialize_signals): Add declaration. * std-regs.c (_initialize_frame_reg): Add declaration. * jv-exp.y (push_variable): ISO C definition. (push_qualified_expression_name): Ditto. * memattr.c (_initialize_mem): Add declaration. * remote.c (remote_check_watch_resources): Make static. (remote_stopped_by_watchpoint): Make static. (remote_stopped_data_address): Make static. * d10v-tdep.c (nr_dmap_regs): Make static. (a0_regnum): Make static. (d10v_frame_unwind_cache): Make static. (d10v_frame_p): Make static. * osabi.c (show_osabi): Make static. (_initialize_gdb_osabi): Add extern declaration. * gdbtypes.c (make_qualified_type): Make static. (safe_parse_type): Make static. * macrocmd.c (_initialize_macrocmd): Add extern declaration. * macrotab.c (macro_bcache_free): Make static. * interps.c (interp_set_quiet): Make static. (interpreter_exec_cmd): Make static. * stack.h (select_frame_command): New file. * stack.c: Include "stack.h". (select_frame_command_wrapper): Delete function. (select_frame_command): Make global. * infcall.c: Include "infcall.h". * linespec.c: Include "linespec.h". * symfile.c (sections_overlap): Make static. * cp-support.h (cp_initialize_namespace): ISO C declaration. * charset.c (_initialize_charset): Add missing prototype. * regcache.c (init_legacy_regcache_descr): Make static. (do_regcache_xfree): Make static. (regcache_xfer_part): Make static. (_initialize_regcache): Add missing prototype. * breakpoint.c (parse_breakpoint_sals): Make static. (breakpoint_sals_to_pc): Make static. * interps.h (clear_interpreter_hooks): ISO C declaration. * Makefile.in (stack_h): Define. (stack.o, typeprint.o, mi-main.o): Update dependencies. (mi-cmd-stack.o, infcall.o, linespec.o): Update dependencies. Index: mi/ChangeLog 2003-06-08 Andrew Cagney <cagney@redhat.com> * mi-parse.c (_initialize_mi_parse): Delete function. * mi-main.c: Include "mi-main.h". * mi-interp.c (_initialize_mi_interp): Add declaration. * mi-cmd-stack.c: Include "stack.h". (select_frame_command_wrapper): Delete extern declaration. (mi_cmd_stack_select_frame): Replace select_frame_command_wrapper with select_frame_command.
2003-06-08 20:27:14 +02:00
Constify add_prefix_cmd This changes add_prefix_cmd to accept a const-taking function as an argument; then fixes up all the callers. In a couple of spots I had to add a non-const overload of a function, because the function is passed to two different command-adding "constructors". These overloads are temporary; once constification is complete they can be removed. This patch also fixes a typo I happened to notice while constifying. Note that this touches a couple of files (gnu-nat.c and go32-nat.c) that I can't build. So, while I made a best-effort there, I am not certain they will still compile. Tested by rebuilding. gdb/ChangeLog 2017-10-11 Tom Tromey <tom@tromey.com> * gdbthread.h (thread_command): Constify. * inferior.h (detach_command): Constify. * top.h (set_history, show_history): Constify. * arm-tdep.c (set_arm_command, show_arm_command): Constify. * serial.c (serial_set_cmd, serial_show_cmd): Constify. * bsd-kvm.c (bsd_kvm_cmd): Constify. * printcmd.c (set_command): Constify. (non_const_set_command): New function. * dcache.c (set_dcache_command, show_dcache_command): Constify. * breakpoint.c (enable_command, disable_command, delete_command) (catch_command, tcatch_command, set_breakpoint_cmd) (show_breakpoint_cmd): Constify. * macrocmd.c (macro_command): Constify. * infcmd.c (unset_command, kill_command, detach_command) (info_proc_cmd): Constify. * i386-tdep.c (set_mpx_cmd, show_mpx_cmd): Constify. * auto-load.c (show_auto_load_cmd, set_auto_load_cmd) (info_auto_load_cmd): Constify. * target-descriptions.c (set_tdesc_cmd, show_tdesc_cmd) (unset_tdesc_cmd): Constify. * ada-lang.c (set_ada_command, show_ada_command) (maint_set_ada_cmd, maint_show_ada_cmd): Constify. * guile/guile.c (set_guile_command, show_guile_command) (info_guile_command): Constify. * tui/tui-win.c (tui_command, set_tui_cmd, show_tui_cmd): Constify. * skip.c (skip_command): Constify. * compile/compile.c (_initialize_compile): Constify. * dwarf2read.c (set_dwarf_cmd, show_dwarf_cmd): Constify. * btrace.c (maint_btrace_cmd, maint_btrace_set_cmd) (maint_btrace_show_cmd, maint_btrace_pt_set_cmd) (maint_btrace_pt_show_cmd): Constify. * remote.c (set_remote_cmd, show_remote_cmd, remote_command): Constify. * python/python.c (user_show_python, user_set_python): Constify. * mips-tdep.c (set_mips_command, show_mips_command) (set_mipsfpu_command): Constify. * record-btrace.c (cmd_record_btrace_start) (cmd_set_record_btrace, cmd_show_record_btrace) (cmd_set_record_btrace_bts, cmd_show_record_btrace_bts) (cmd_set_record_btrace_pt, cmd_show_record_btrace_pt): Constify. * rs6000-tdep.c (set_powerpc_command, show_powerpc_command): Constify. * symfile.c (overlay_command): Constify. * spu-tdep.c (set_spu_command, show_spu_command): Constify. * cli/cli-logging.c (set_logging_command, show_logging_command): Constify. * cli/cli-dump.c (dump_command, append_command) (srec_dump_command, ihex_dump_command, verilog_dump_command) (tekhex_dump_command, binary_dump_command) (binary_append_command): Constify. * cli/cli-decode.c (struct cmd_list_element): Change type of "fun". * cli/cli-cmds.c (info_command, show_command, set_debug) (show_debug): Constify. (show_command): Add non-const overload. * top.c (set_history, show_history): Constify. * sh-tdep.c (set_sh_command, show_sh_command): Constify. * command.h (add_prefix_cmd): Accept a cmd_const_cfunc_ftype. * target.c (target_command): Constify. * sparc64-tdep.c (info_adi_command): Constify. * record-full.c (cmd_record_full_start): Constify. (set_record_full_command): Constify. Fix typo. (show_record_full_command): Constify. * thread.c (thread_command, thread_apply_command): Constify. * memattr.c (dummy_cmd): Constify. * value.c (function_command): Constify. * frame.c (set_backtrace_cmd, show_backtrace_cmd): Constify. * probe.c (info_probes_command): Constify. * ser-tcp.c (set_tcp_cmd, show_tcp_cmd): Constify. * gnu-nat.c (set_task_cmd, show_task_cmd, set_thread_cmd) (show_thread_cmd, set_thread_default_cmd) (show_thread_default_cmd): Constify. (check_empty): Constify. * tracepoint.c (tfind_command): Constify. * cp-support.c (maint_cplus_command): Constify. * windows-tdep.c (info_w32_command): Constify. * record.c (cmd_record_start, set_record_command) (show_record_command, info_record_command, cmd_record_goto): Constify. * ravenscar-thread.c (set_ravenscar_command) (show_ravenscar_command): Constify. * utils.c (set_internal_problem_cmd, show_internal_problem_cmd): Constify. (add_internal_problem_command): Remove casts. * arc-tdep.c (maintenance_print_arc_command): Constify. * valprint.c (set_print, show_print, set_print_raw) (show_print_raw): Constify. * maint.c (maintenance_command, maintenance_info_command) (maintenance_print_command, maintenance_set_cmd) (maintenance_show_cmd, set_per_command_cmd) (show_per_command_cmd, maintenance_check_command): Constify. * language.c (set_check, show_check): Constify. * typeprint.c (show_print_type, set_print_type): Constify. * go32-nat.c (go32_info_dos_command): Constify.
2017-09-26 06:28:30 +02:00
extern void show_history (const char *, int);
2003-06-08 Andrew Cagney <cagney@redhat.com> * acinclude.m4 (gcc_AC_CHECK_DECL, (gcc_AC_CHECK_DECL): Stolen from GCC's acinclude.m4. * configure.in: Check for getopt's delcaration. * aclocal.m4, config.in, configure: Re-generate. * main.c (error_init): Delete declaration. * defs.h (error_init): Declare. * rs6000-tdep.c (rs6000_fetch_pointer_argument): Make static. (rs6000_convert_from_func_ptr_addr): Make static. (_initialize_rs6000_tdep): Add declaration. * cli/cli-cmds.c (dont_repeat): Delete declaration. (show_commands, set_verbose, show_history): Delete declaration. * top.h (set_verbose): Add declaration. (show_history, set_history, show_commands): Add declaration. (do_restore_instream_cleanup): Add declaration. * objc-lang.c (specialcmp): Make static. (print_object_command): Make static. (find_objc_msgsend): Make static. (find_objc_msgcall_submethod_helper): Make static. (find_objc_msgcall_submethod): Make static. (_initialize_objc_language): Add declaration. (find_implementation_from_class): Make static. (find_implementation): Make static. * objc-exp.y (yylex): Delete lookup_struct_typedef declaration. * objc-lang.h (lookup_struct_typedef): Add declaration. * cli/cli-interp.c (_initialize_cli_interp): Add declaration. * cli/cli-script.c (clear_hook_in_cleanup): Make static. (do_restore_user_call_depth): Make static. (do_restore_instream_cleanup): Delete declaration. (dont_repeat): Delete declaration. * cli/cli-decode.c (add_abbrev_cmd): Delete function. * cli/cli-dump.c (_initialize_cli_dump): Add declaration. * reggroups.c (_initialize_reggroup): Add declaration. * cp-support.c (_initialize_cp_support): Add declaration. * cp-abi.c (_initialize_cp_abi): Add declaration. * hpacc-abi.c (_initialize_hpacc_abi): Add declaration. * gnu-v3-abi.c (gnuv3_baseclass_offset): Make static. (_initialize_gnu_v3_abi): Add declaration. * gnu-v2-abi.c (gnuv2_value_rtti_type): Make static. (_initialize_gnu_v2_abi): Add declaration. * frame-base.c (_initialize_frame_base): Add declaration. * doublest.c (floatformat_from_length): Make static. * frame-unwind.c (_initialize_frame_unwind): Add declaration. * frame.c (create_sentinel_frame): Make static. (_initialize_frame): Add declaration. * top.c (do_catch_errors): Make static. (gdb_rl_operate_and_get_next_completion): Make static. * typeprint.c: Include "typeprint.h". * sentinel-frame.c (sentinel_frame_prev_register): Make static. (sentinel_frame_this_id): Make static. * p-valprint.c (_initialize_pascal_valprint): Add declaration. * ui-out.c (make_cleanup_ui_out_begin_end): Delete function. * dwarf2-frame.c (dwarf2_frame_cache): Make static. * p-exp.y (push_current_type, pop_current_type): ISO C declaration. * dwarf2expr.h (dwarf_expr_context): ISO C declaration. * maint.c (maintenance_print_architecture): Make static. * signals/signals.c (_initialize_signals): Add declaration. * std-regs.c (_initialize_frame_reg): Add declaration. * jv-exp.y (push_variable): ISO C definition. (push_qualified_expression_name): Ditto. * memattr.c (_initialize_mem): Add declaration. * remote.c (remote_check_watch_resources): Make static. (remote_stopped_by_watchpoint): Make static. (remote_stopped_data_address): Make static. * d10v-tdep.c (nr_dmap_regs): Make static. (a0_regnum): Make static. (d10v_frame_unwind_cache): Make static. (d10v_frame_p): Make static. * osabi.c (show_osabi): Make static. (_initialize_gdb_osabi): Add extern declaration. * gdbtypes.c (make_qualified_type): Make static. (safe_parse_type): Make static. * macrocmd.c (_initialize_macrocmd): Add extern declaration. * macrotab.c (macro_bcache_free): Make static. * interps.c (interp_set_quiet): Make static. (interpreter_exec_cmd): Make static. * stack.h (select_frame_command): New file. * stack.c: Include "stack.h". (select_frame_command_wrapper): Delete function. (select_frame_command): Make global. * infcall.c: Include "infcall.h". * linespec.c: Include "linespec.h". * symfile.c (sections_overlap): Make static. * cp-support.h (cp_initialize_namespace): ISO C declaration. * charset.c (_initialize_charset): Add missing prototype. * regcache.c (init_legacy_regcache_descr): Make static. (do_regcache_xfree): Make static. (regcache_xfer_part): Make static. (_initialize_regcache): Add missing prototype. * breakpoint.c (parse_breakpoint_sals): Make static. (breakpoint_sals_to_pc): Make static. * interps.h (clear_interpreter_hooks): ISO C declaration. * Makefile.in (stack_h): Define. (stack.o, typeprint.o, mi-main.o): Update dependencies. (mi-cmd-stack.o, infcall.o, linespec.o): Update dependencies. Index: mi/ChangeLog 2003-06-08 Andrew Cagney <cagney@redhat.com> * mi-parse.c (_initialize_mi_parse): Delete function. * mi-main.c: Include "mi-main.h". * mi-interp.c (_initialize_mi_interp): Add declaration. * mi-cmd-stack.c: Include "stack.h". (select_frame_command_wrapper): Delete extern declaration. (mi_cmd_stack_select_frame): Replace select_frame_command_wrapper with select_frame_command.
2003-06-08 20:27:14 +02:00
extern void set_verbose (char *, int, struct cmd_list_element *);
extern char *handle_line_of_input (struct buffer *cmd_line_buffer,
char *rl, int repeat,
-Wwrite-strings: The Rest This is the remainder boring constification that all looks more of less borderline obvious IMO. gdb/ChangeLog: 2017-04-05 Pedro Alves <palves@redhat.com> * ada-exp.y (yyerror): Constify. * ada-lang.c (bound_name, get_selections) (ada_variant_discrim_type) (ada_variant_discrim_name, ada_value_struct_elt) (ada_lookup_struct_elt_type, is_unchecked_variant) (ada_which_variant_applies, standard_exc, ada_get_next_arg) (catch_ada_exception_command_split) (catch_ada_assert_command_split, catch_assert_command) (ada_op_name): Constify. * ada-lang.h (ada_yyerror, get_selections) (ada_variant_discrim_name, ada_value_struct_elt): Constify. * arc-tdep.c (arc_print_frame_cache): Constify. * arm-tdep.c (arm_skip_stub): Constify. * ax-gdb.c (gen_binop, gen_struct_ref_recursive, gen_struct_ref) (gen_aggregate_elt_ref): Constify. * bcache.c (print_bcache_statistics): Constify. * bcache.h (print_bcache_statistics): Constify. * break-catch-throw.c (catch_exception_command_1): * breakpoint.c (struct ep_type_description::description): Constify. (add_solib_catchpoint): Constify. (catch_fork_command_1): Add cast. (add_catch_command): Constify. * breakpoint.h (add_catch_command, add_solib_catchpoint): Constify. * bsd-uthread.c (bsd_uthread_state): Constify. * buildsym.c (patch_subfile_names): Constify. * buildsym.h (next_symbol_text_func, patch_subfile_names): Constify. * c-exp.y (yyerror): Constify. (token::oper): Constify. * c-lang.h (c_yyerror, cp_print_class_member): Constify. * c-varobj.c (cplus_describe_child): Constify. * charset.c (find_charset_names): Add cast. (find_charset_names): Constify array and add const_cast. * cli/cli-cmds.c (complete_command, cd_command): Constify. (edit_command): Constify. * cli/cli-decode.c (lookup_cmd): Constify. * cli/cli-dump.c (dump_memory_command, dump_value_command): Constify. (struct dump_context): Constify. (add_dump_command, restore_command): Constify. * cli/cli-script.c (get_command_line): Constify. * cli/cli-script.h (get_command_line): Constify. * cli/cli-utils.c (check_for_argument): Constify. * cli/cli-utils.h (check_for_argument): Constify. * coff-pe-read.c (struct read_pe_section_data): Constify. * command.h (lookup_cmd): Constify. * common/print-utils.c (decimal2str): Constify. * completer.c (gdb_print_filename): Constify. * corefile.c (set_gnutarget): Constify. * cp-name-parser.y (yyerror): Constify. * cp-valprint.c (cp_print_class_member): Constify. * cris-tdep.c (cris_register_name, crisv32_register_name): Constify. * d-exp.y (yyerror): Constify. (struct token::oper): Constify. * d-lang.h (d_yyerror): Constify. * dbxread.c (struct header_file_location::name): Constify. (add_old_header_file, add_new_header_file, last_function_name) (dbx_next_symbol_text, add_bincl_to_list) (find_corresponding_bincl_psymtab, set_namestring) (find_stab_function_addr, read_dbx_symtab, start_psymtab) (dbx_end_psymtab, read_ofile_symtab, process_one_symbol): * defs.h (command_line_input, print_address_symbolic) (deprecated_readline_begin_hook): Constify. * dwarf2read.c (anonymous_struct_prefix, dwarf_bool_name): Constify. * event-top.c (handle_line_of_input): Constify and add cast. * exceptions.c (catch_errors): Constify. * exceptions.h (catch_errors): Constify. * expprint.c (print_subexp_standard, op_string, op_name) (op_name_standard, dump_raw_expression, dump_raw_expression): * expression.h (op_name, op_string, dump_raw_expression): Constify. * f-exp.y (yyerror): Constify. (struct token::oper): Constify. (struct f77_boolean_val::name): Constify. * f-lang.c (f_word_break_characters): Constify. * f-lang.h (f_yyerror): Constify. * fork-child.c (fork_inferior): Add cast. * frv-tdep.c (struct gdbarch_tdep::register_names): Constify. (new_variant): Constify. * gdbarch.sh (pstring_ptr, pstring_list): Constify. * gdbarch.c: Regenerate. * gdbcore.h (set_gnutarget): Constify. * go-exp.y (yyerror): Constify. (token::oper): Constify. * go-lang.h (go_yyerror): Constify. * go32-nat.c (go32_sysinfo): Constify. * guile/scm-breakpoint.c (gdbscm_breakpoint_expression): Constify. * guile/scm-cmd.c (cmdscm_function): Constify. * guile/scm-param.c (pascm_param_value): Constify. * h8300-tdep.c (h8300_register_name, h8300s_register_name) (h8300sx_register_name): Constify. * hppa-tdep.c (hppa32_register_name, hppa64_register_name): Constify. * ia64-tdep.c (ia64_register_names): Constify. * infcmd.c (construct_inferior_arguments): Constify. (path_command, attach_post_wait): Constify. * language.c (show_range_command, show_case_command) (unk_lang_error): Constify. * language.h (language_defn::la_error) (language_defn::la_name_of_this): Constify. * linespec.c (decode_line_2): Constify. * linux-thread-db.c (thread_db_err_str): Constify. * lm32-tdep.c (lm32_register_name): Constify. * m2-exp.y (yyerror): Constify. * m2-lang.h (m2_yyerror): Constify. * m32r-tdep.c (m32r_register_names): Constify and make static. * m68hc11-tdep.c (m68hc11_register_names): Constify. * m88k-tdep.c (m88k_register_name): Constify. * macroexp.c (appendmem): Constify. * mdebugread.c (fdr_name, add_data_symbol, parse_type) (upgrade_type, parse_external, parse_partial_symbols) (mdebug_next_symbol_text, cross_ref, mylookup_symbol, new_psymtab) (new_symbol): Constify. * memattr.c (mem_info_command): Constify. * mep-tdep.c (register_name_from_keyword): Constify. * mi/mi-cmd-env.c (mi_cmd_env_path, _initialize_mi_cmd_env): Constify. * mi/mi-cmd-stack.c (list_args_or_locals): Constify. * mi/mi-cmd-var.c (mi_cmd_var_show_attributes): Constify. * mi/mi-main.c (captured_mi_execute_command): Constify and add cast. (mi_execute_async_cli_command): Constify. * mips-tdep.c (mips_register_name): Constify. * mn10300-tdep.c (register_name, mn10300_generic_register_name) (am33_register_name, am33_2_register_name) * moxie-tdep.c (moxie_register_names): Constify. * nat/linux-osdata.c (osdata_type): Constify fields. * nto-tdep.c (nto_parse_redirection): Constify. * objc-lang.c (lookup_struct_typedef, lookup_objc_class) (lookup_child_selector): Constify. (objc_methcall::name): Constify. * objc-lang.h (lookup_objc_class, lookup_child_selector) (lookup_struct_typedef): Constify. * objfiles.c (pc_in_section): Constify. * objfiles.h (pc_in_section): Constify. * p-exp.y (struct token::oper): Constify. (yyerror): Constify. * p-lang.h (pascal_yyerror): Constify. * parser-defs.h (op_name_standard): Constify. (op_print::string): Constify. (exp_descriptor::op_name): Constify. * printcmd.c (print_address_symbolic): Constify. * psymtab.c (print_partial_symbols): Constify. * python/py-breakpoint.c (stop_func): Constify. (bppy_get_expression): Constify. * python/py-cmd.c (cmdpy_completer::name): Constify. (cmdpy_function): Constify. * python/py-event.c (evpy_add_attribute) (gdbpy_initialize_event_generic): Constify. * python/py-event.h (evpy_add_attribute) (gdbpy_initialize_event_generic): Constify. * python/py-evts.c (add_new_registry): Constify. * python/py-finishbreakpoint.c (outofscope_func): Constify. * python/py-framefilter.c (get_py_iter_from_func): Constify. * python/py-inferior.c (get_buffer): Add cast. * python/py-param.c (parm_constant::name): Constify. * python/py-unwind.c (fprint_frame_id): Constify. * python/python.c (gdbpy_parameter_value): Constify. * remote-fileio.c (remote_fio_func_map): Make 'name' const. * remote.c (memory_packet_config::name): Constify. (show_packet_config_cmd, remote_write_bytes) (remote_buffer_add_string): * reverse.c (exec_reverse_once): Constify. * rs6000-tdep.c (variant::name, variant::description): Constify. * rust-exp.y (rustyyerror): Constify. * rust-lang.c (rust_op_name): Constify. * rust-lang.h (rustyyerror): Constify. * serial.h (serial_ops::name): Constify. * sh-tdep.c (sh_sh_register_name, sh_sh3_register_name) (sh_sh3e_register_name, sh_sh2e_register_name) (sh_sh2a_register_name, sh_sh2a_nofpu_register_name) (sh_sh_dsp_register_name, sh_sh3_dsp_register_name) (sh_sh4_register_name, sh_sh4_nofpu_register_name) (sh_sh4al_dsp_register_name): Constify. * sh64-tdep.c (sh64_register_name): Constify. * solib-darwin.c (lookup_symbol_from_bfd): Constify. * spu-tdep.c (spu_register_name, info_spu_dma_cmdlist): Constify. * stabsread.c (patch_block_stabs, read_type_number) (ref_map::stabs, ref_add, process_reference) (symbol_reference_defined, define_symbol, define_symbol) (error_type, read_type, read_member_functions, read_cpp_abbrev) (read_one_struct_field, read_struct_fields, read_baseclasses) (read_tilde_fields, read_struct_type, read_array_type) (read_enum_type, read_sun_builtin_type, read_sun_floating_type) (read_huge_number, read_range_type, read_args, common_block_start) (find_name_end): Constify. * stabsread.h (common_block_start, define_symbol) (process_one_symbol, symbol_reference_defined, ref_add): * symfile.c (get_section_index, add_symbol_file_command): * symfile.h (get_section_index): Constify. * target-descriptions.c (tdesc_type::name): Constify. (tdesc_free_type): Add cast. * target.c (find_default_run_target): (add_deprecated_target_alias, find_default_run_target) (target_announce_detach): Constify. (do_option): Constify. * target.h (add_deprecated_target_alias): Constify. * thread.c (print_thread_info_1): Constify. * top.c (deprecated_readline_begin_hook, command_line_input): Constify. (init_main): Add casts. * top.h (handle_line_of_input): Constify. * tracefile-tfile.c (tfile_write_uploaded_tsv): Constify. * tracepoint.c (tvariables_info_1, trace_status_mi): Constify. (tfind_command): Rename to ... (tfind_command_1): ... this and constify. (tfind_command): New function. (tfind_end_command, tfind_start_command): Adjust. (encode_source_string): Constify. * tracepoint.h (encode_source_string): Constify. * tui/tui-data.c (tui_partial_win_by_name): Constify. * tui/tui-data.h (tui_partial_win_by_name): Constify. * tui/tui-source.c (tui_set_source_content_nil): Constify. * tui/tui-source.h (tui_set_source_content_nil): Constify. * tui/tui-win.c (parse_scrolling_args): Constify. * tui/tui-windata.c (tui_erase_data_content): Constify. * tui/tui-windata.h (tui_erase_data_content): Constify. * tui/tui-winsource.c (tui_erase_source_content): Constify. * tui/tui.c (tui_enable): Add cast. * utils.c (defaulted_query): Constify. (init_page_info): Add cast. (puts_debug, subset_compare): Constify. * utils.h (subset_compare): Constify. * varobj.c (varobj_format_string): Constify. * varobj.h (varobj_format_string): Constify. * vax-tdep.c (vax_register_name): Constify. * windows-nat.c (windows_detach): Constify. * xcoffread.c (process_linenos, xcoff_next_symbol_text): Constify. * xml-support.c (gdb_xml_end_element): Constify. * xml-tdesc.c (tdesc_start_reg): Constify. * xstormy16-tdep.c (xstormy16_register_name): Constify. * xtensa-tdep.c (xtensa_find_register_by_name): Constify. * xtensa-tdep.h (xtensa_register_t::name): Constify. gdb/gdbserver/ChangeLog: 2017-04-05 Pedro Alves <palves@redhat.com> * gdbreplay.c (sync_error): Constify. * linux-x86-low.c (push_opcode): Constify.
2017-04-05 20:21:37 +02:00
const char *annotation_suffix);
#endif