1 /* Header file for GDB CLI command implementation library.
2 Copyright (C) 2000-2017 Free Software Foundation, Inc.
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
17 #if !defined (CLI_SCRIPT_H)
18 #define CLI_SCRIPT_H 1
21 struct cmd_list_element;
23 /* * Control types for commands. */
25 enum misc_command_type
33 enum command_control_type
44 while_stepping_control,
48 /* * Structure for saved commands lines (for breakpoints, defined
53 struct command_line *next;
55 enum command_control_type control_type;
60 enum compile_i_scope_types scope;
66 /* * The number of elements in body_list. */
68 /* * For composite commands, the nested lists of commands. For
69 example, for "if" command this will contain the then branch and
70 the else branch, if that is available. */
71 struct command_line **body_list;
74 extern void free_command_lines (struct command_line **);
76 /* A deleter for command_line that calls free_command_lines. */
78 struct command_lines_deleter
80 void operator() (command_line *cmd_lines) const
82 free_command_lines (&cmd_lines);
86 /* A unique pointer to a command_line. */
88 typedef std::unique_ptr<command_line, command_lines_deleter> command_line_up;
90 extern command_line_up read_command_lines (char *, int, int,
91 void (*)(char *, void *),
93 extern command_line_up read_command_lines_1 (char * (*) (void), int,
94 void (*)(char *, void *),
98 /* Exported to cli/cli-cmds.c */
100 extern void script_from_file (FILE *stream, const char *file);
102 extern void show_user_1 (struct cmd_list_element *c,
105 struct ui_file *stream);
107 /* Exported to gdb/breakpoint.c */
109 extern enum command_control_type
110 execute_control_command (struct command_line *cmd);
112 extern enum command_control_type
113 execute_control_command_untraced (struct command_line *cmd);
115 extern command_line_up get_command_line (enum command_control_type,
118 extern void print_command_lines (struct ui_out *,
119 struct command_line *, unsigned int);
121 extern command_line_up copy_command_lines (struct command_line *cmds);
123 /* Exported to gdb/infrun.c */
125 extern void execute_user_command (struct cmd_list_element *c, const char *args);
127 /* If we're in a user-defined command, replace any $argc/$argN
128 reference found in LINE with the arguments that were passed to the
129 command. Otherwise, treat $argc/$argN as normal convenience
131 extern std::string insert_user_defined_cmd_args (const char *line);
133 /* Exported to top.c */
135 extern void print_command_trace (const char *cmd);
137 /* Exported to event-top.c */
139 extern void reset_command_nest_depth (void);
141 #endif /* !defined (CLI_SCRIPT_H) */