GDB (xrefs)

cli-script.h
Go to the documentation of this file.
1 /* Header file for GDB CLI command implementation library.
2 Copyright (C) 2000-2018 Free Software Foundation, Inc.
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
6 the Free Software Foundation; either version 3 of the License, or
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
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
16
17 #if !defined (CLI_SCRIPT_H)
18 #define CLI_SCRIPT_H 1
19
20 struct ui_file;
21 struct cmd_list_element;
22
23 /* * Control types for commands. */
24
25 enum misc_command_type
26 {
27 ok_command,
28 end_command,
29 else_command,
30 nop_command
31 };
32
33 enum command_control_type
34 {
35 simple_control,
36 break_control,
37 continue_control,
38 while_control,
39 if_control,
40 commands_control,
41 python_control,
42 compile_control,
43 guile_control,
44 while_stepping_control,
45 invalid_control
46 };
47
48 /* * Structure for saved commands lines (for breakpoints, defined
49 commands, etc). */
50
51 struct command_line
52 {
53 struct command_line *next;
54 char *line;
55 enum command_control_type control_type;
56 union
57 {
58 struct
59 {
60 enum compile_i_scope_types scope;
61 void *scope_data;
62 }
63 compile;
64 }
65 control_u;
66 /* * The number of elements in body_list. */
67 int body_count;
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;
72 };
73
74 extern void free_command_lines (struct command_line **);
75
76 /* A deleter for command_line that calls free_command_lines. */
77
78 struct command_lines_deleter
79 {
80 void operator() (command_line *cmd_lines) const
81 {
82 free_command_lines (&cmd_lines);
83 }
84 };
85
86 /* A unique pointer to a command_line. */
87
88 typedef std::unique_ptr<command_line, command_lines_deleter> command_line_up;
89
90 extern command_line_up read_command_lines (char *, int, int,
91 void (*)(char *, void *),
92 void *);
93 extern command_line_up read_command_lines_1 (char * (*) (void), int,
94 void (*)(char *, void *),
95 void *);
96
97
98 /* Exported to cli/cli-cmds.c */
99
100 extern void script_from_file (FILE *stream, const char *file);
101
102 extern void show_user_1 (struct cmd_list_element *c,
103 const char *prefix,
104 const char *name,
105 struct ui_file *stream);
106
107 /* Exported to gdb/breakpoint.c */
108
109 extern enum command_control_type
110 execute_control_command (struct command_line *cmd);
111
112 extern enum command_control_type
113 execute_control_command_untraced (struct command_line *cmd);
114
115 extern command_line_up get_command_line (enum command_control_type,
116 const char *);
117
118 extern void print_command_lines (struct ui_out *,
119 struct command_line *, unsigned int);
120
121 extern command_line_up copy_command_lines (struct command_line *cmds);
122
123 /* Exported to gdb/infrun.c */
124
125 extern void execute_user_command (struct cmd_list_element *c, const char *args);
126
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
130 variables. */
131 extern std::string insert_user_defined_cmd_args (const char *line);
132
133 /* Exported to top.c */
134
135 extern void print_command_trace (const char *cmd);
136
137 /* Exported to event-top.c */
138
139 extern void reset_command_nest_depth (void);
140
141 #endif /* !defined (CLI_SCRIPT_H) */
string
const char * string
Definition: signals.c:50
command_line::body_count
int body_count
Definition: cli-script.h:67
print_command_lines
void print_command_lines(struct ui_out *, struct command_line *, unsigned int)
Definition: cli-script.c:189
command_line
Definition: cli-script.h:51
while_control
Definition: cli-script.h:38
read_command_lines
command_line_up read_command_lines(char *, int, int, void(*)(char *, void *), void *)
Definition: cli-script.c:1198
get_command_line
command_line_up get_command_line(enum command_control_type, const char *)
Definition: cli-script.c:170
guile_control
Definition: cli-script.h:43
cmd_list_element
Definition: cli-decode.h:46
print_command_trace
void print_command_trace(const char *cmd)
Definition: cli-script.c:447
copy_command_lines
command_line_up copy_command_lines(struct command_line *cmds)
Definition: cli-script.c:1333
compile_i_scope_types
compile_i_scope_types
Definition: defs.h:61
ui_file
Definition: ui-file.h:26
show_user_1
void show_user_1(struct cmd_list_element *c, const char *prefix, const char *name, struct ui_file *stream)
Definition: cli-script.c:1610
command_line::compile
struct command_line::@21::@22 compile
execute_control_command_untraced
enum command_control_type execute_control_command_untraced(struct command_line *cmd)
Definition: cli-script.c:665
if_control
Definition: cli-script.h:39
end_command
Definition: cli-script.h:28
command_line::line
char * line
Definition: cli-script.h:54
name
const char *const name
Definition: aarch64-tdep.c:76
else_command
Definition: cli-script.h:29
python_control
Definition: cli-script.h:41
continue_control
Definition: cli-script.h:37
invalid_control
Definition: cli-script.h:45
command_line::scope
enum compile_i_scope_types scope
Definition: cli-script.h:60
command_lines_deleter::operator()
void operator()(command_line *cmd_lines) const
Definition: cli-script.h:80
break_control
Definition: cli-script.h:36
command_control_type
command_control_type
Definition: cli-script.h:33
free_command_lines
void free_command_lines(struct command_line **)
Definition: cli-script.c:1309
commands_control
Definition: cli-script.h:40
command_lines_deleter
Definition: cli-script.h:78
execute_control_command
enum command_control_type execute_control_command(struct command_line *cmd)
Definition: cli-script.c:650
command_line::scope_data
void * scope_data
Definition: cli-script.h:61
while_stepping_control
Definition: cli-script.h:44
reset_command_nest_depth
void reset_command_nest_depth(void)
Definition: cli-script.c:430
read_command_lines_1
command_line_up read_command_lines_1(char *(*)(void), int, void(*)(char *, void *), void *)
misc_command_type
misc_command_type
Definition: cli-script.h:25
nop_command
Definition: cli-script.h:30
ui_out
Definition: ui-out.h:77
command_line::next
struct command_line * next
Definition: cli-script.h:53
command_line::control_type
enum command_control_type control_type
Definition: cli-script.h:55
execute_user_command
void execute_user_command(struct cmd_list_element *c, const char *args)
Definition: cli-script.c:388
simple_control
Definition: cli-script.h:35
compile_control
Definition: cli-script.h:42
script_from_file
void script_from_file(FILE *stream, const char *file)
Definition: cli-script.c:1578
command_line_up
std::unique_ptr< command_line, command_lines_deleter > command_line_up
Definition: cli-script.h:88
insert_user_defined_cmd_args
std::string insert_user_defined_cmd_args(const char *line)
Definition: cli-script.c:788
command_line::body_list
struct command_line ** body_list
Definition: cli-script.h:71
command_line::control_u
union command_line::@21 control_u
ok_command
Definition: cli-script.h:27