gdb/tui: Link source and assembler scrolling .... again
[deliverable/binutils-gdb.git] / gdb / cli / cli-script.h
CommitLineData
d318976c 1/* Header file for GDB CLI command implementation library.
b811d2c2 2 Copyright (C) 2000-2020 Free Software Foundation, Inc.
d318976c
FN
3
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
a9762ec7 6 the Free Software Foundation; either version 3 of the License, or
d318976c
FN
7 (at your option) any later version.
8
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.
13
14 You should have received a copy of the GNU General Public License
a9762ec7 15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
d318976c 16
1a5c2598
TT
17#ifndef CLI_CLI_SCRIPT_H
18#define CLI_CLI_SCRIPT_H
d318976c 19
0d12e84c
TT
20#include "gdbsupport/function-view.h"
21
da3331ec 22struct ui_file;
da3331ec
AC
23struct cmd_list_element;
24
6b66338c
SM
25/* * Control types for commands. */
26
27enum misc_command_type
28{
29 ok_command,
30 end_command,
31 else_command,
32 nop_command
33};
34
35enum command_control_type
36{
37 simple_control,
38 break_control,
39 continue_control,
40 while_control,
41 if_control,
42 commands_control,
43 python_control,
44 compile_control,
45 guile_control,
46 while_stepping_control,
7a2c85f2 47 define_control,
6b66338c
SM
48 invalid_control
49};
50
12973681
TT
51struct command_line;
52
53extern void free_command_lines (struct command_line **);
54
55/* A deleter for command_line that calls free_command_lines. */
56
57struct command_lines_deleter
58{
59 void operator() (command_line *cmd_lines) const
60 {
61 free_command_lines (&cmd_lines);
62 }
63};
64
65/* A reference-counted struct command_line. */
66typedef std::shared_ptr<command_line> counted_command_line;
67
6b66338c
SM
68/* * Structure for saved commands lines (for breakpoints, defined
69 commands, etc). */
70
71struct command_line
72{
12973681
TT
73 explicit command_line (command_control_type type_, char *line_ = nullptr)
74 : line (line_),
75 control_type (type_)
76 {
77 memset (&control_u, 0, sizeof (control_u));
78 }
79
80 DISABLE_COPY_AND_ASSIGN (command_line);
81
82 struct command_line *next = nullptr;
6b66338c
SM
83 char *line;
84 enum command_control_type control_type;
85 union
86 {
87 struct
88 {
89 enum compile_i_scope_types scope;
90 void *scope_data;
91 }
92 compile;
93 }
94 control_u;
6b66338c
SM
95 /* * For composite commands, the nested lists of commands. For
96 example, for "if" command this will contain the then branch and
97 the else branch, if that is available. */
12973681
TT
98 counted_command_line body_list_0;
99 counted_command_line body_list_1;
6b66338c 100
12973681 101private:
6b66338c 102
12973681 103 friend void free_command_lines (struct command_line **);
6b66338c 104
12973681 105 ~command_line ()
6b66338c 106 {
12973681 107 xfree (line);
6b66338c
SM
108 }
109};
110
60b3cef2
TT
111extern counted_command_line read_command_lines
112 (const char *, int, int, gdb::function_view<void (const char *)>);
113extern counted_command_line read_command_lines_1
114 (gdb::function_view<const char * ()>, int,
115 gdb::function_view<void (const char *)>);
6b66338c
SM
116
117
d318976c
FN
118/* Exported to cli/cli-cmds.c */
119
05159abe 120extern void script_from_file (FILE *stream, const char *file);
d318976c 121
6f937416
PA
122extern void show_user_1 (struct cmd_list_element *c,
123 const char *prefix,
124 const char *name,
125 struct ui_file *stream);
d318976c 126
56bcdbea
TT
127/* Execute the commands in CMDLINES. */
128
129extern void execute_control_commands (struct command_line *cmdlines,
130 int from_tty);
131
132/* Run execute_control_commands for COMMANDS. Capture its output into
133 the returned string, do not display it to the screen. BATCH_FLAG
134 will be temporarily set to true. */
135
136extern std::string execute_control_commands_to_string
137 (struct command_line *commands, int from_tty);
138
d318976c
FN
139/* Exported to gdb/breakpoint.c */
140
141extern enum command_control_type
56bcdbea
TT
142 execute_control_command (struct command_line *cmd,
143 int from_tty = 0);
d318976c 144
d57a3c85
TJB
145extern enum command_control_type
146 execute_control_command_untraced (struct command_line *cmd);
147
12973681
TT
148extern counted_command_line get_command_line (enum command_control_type,
149 const char *);
d57a3c85 150
d318976c
FN
151extern void print_command_lines (struct ui_out *,
152 struct command_line *, unsigned int);
d318976c
FN
153
154/* Exported to gdb/infrun.c */
155
95a6b0a1 156extern void execute_user_command (struct cmd_list_element *c, const char *args);
d318976c 157
01770bbd
PA
158/* If we're in a user-defined command, replace any $argc/$argN
159 reference found in LINE with the arguments that were passed to the
160 command. Otherwise, treat $argc/$argN as normal convenience
161 variables. */
162extern std::string insert_user_defined_cmd_args (const char *line);
163
16026cd7
AS
164/* Exported to top.c */
165
1263a9d5
TT
166extern void print_command_trace (const char *cmd, ...)
167 ATTRIBUTE_PRINTF (1, 2);
16026cd7
AS
168
169/* Exported to event-top.c */
170
171extern void reset_command_nest_depth (void);
172
1a5c2598 173#endif /* CLI_CLI_SCRIPT_H */
This page took 1.22824 seconds and 4 git commands to generate.