1 /* Top level stuff for GDB, the GNU debugger.
3 Copyright (C) 1986-2024 Free Software Foundation, Inc.
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
23 #include "gdbsupport/event-loop.h"
24 #include "gdbsupport/next-iterator.h"
29 extern int inhibit_gdbinit
;
30 extern auto_boolean interactive_mode
;
32 /* Print the GDB version banner to STREAM. If INTERACTIVE is false,
33 then information referring to commands (e.g., "show configuration")
34 is omitted; this mode is used for the --version command line
35 option. If INTERACTIVE is true, then interactive commands are
37 extern void print_gdb_version (struct ui_file
*stream
, bool interactive
);
39 extern void print_gdb_configuration (struct ui_file
*);
41 extern void read_command_file (FILE *);
42 extern void init_history (void);
43 extern void command_loop (void);
44 extern int quit_confirm (void);
45 extern void quit_force (int *, int) ATTRIBUTE_NORETURN
;
46 extern void quit_command (const char *, int);
47 extern void quit_cover (void);
48 extern void execute_command (const char *, int);
50 /* If the interpreter is in sync mode (we're running a user command's
51 list, running command hooks or similars), and we just ran a
52 synchronous command that started the target, wait for that command
53 to end. WAS_SYNC indicates whether sync_execution was set before
54 the command was run. */
56 extern void maybe_wait_sync_command_done (int was_sync
);
58 /* Wait for a synchronous execution command to end. */
59 extern void wait_sync_command_done (void);
61 extern void check_frame_language_change (void);
63 /* Prepare for execution of a command.
64 Call this before every command, CLI or MI.
65 Returns a cleanup to be run after the command is completed. */
66 extern scoped_value_mark
prepare_execute_command (void);
68 /* This function returns a pointer to the string that is used
69 by gdb for its command prompt. */
70 extern const std::string
&get_prompt ();
72 /* This function returns a pointer to the string that is used
73 by gdb for its command prompt. */
74 extern void set_prompt (const char *s
);
76 /* Return 1 if UI's current input handler is a secondary prompt, 0
79 extern int gdb_in_secondary_prompt_p (struct ui
*ui
);
81 /* Perform _initialize initialization. */
82 extern void gdb_init ();
84 /* For use by event-top.c. */
85 /* Variables from top.c. */
86 extern int source_line_number
;
87 extern std::string source_file_name
;
88 extern bool history_expansion_p
;
89 extern bool server_command
;
90 extern char *lim_at_start
;
92 extern void gdb_add_history (const char *);
94 extern void show_commands (const char *args
, int from_tty
);
96 extern void set_verbose (const char *, int, struct cmd_list_element
*);
98 extern const char *handle_line_of_input (std::string
&cmd_line_buffer
,
99 const char *rl
, int repeat
,
100 const char *annotation_suffix
);
102 /* Call at startup to see if the user has requested that gdb start up
105 extern bool check_quiet_mode ();
107 /* Unbuffer STREAM. This is a wrapper around setbuf(STREAM, nullptr)
108 which applies some special rules for MS-Windows hosts. */
110 extern void unbuffer_stream (FILE *stream
);