GDB (xrefs)
|
#include "defs.h"
#include "value.h"
#include <ctype.h>
#include "ui-out.h"
#include "top.h"
#include "ui.h"
#include "breakpoint.h"
#include "tracepoint.h"
#include "cli/cli-cmds.h"
#include "cli/cli-decode.h"
#include "cli/cli-script.h"
#include "cli/cli-style.h"
#include "gdbcmd.h"
#include "extension.h"
#include "interps.h"
#include "compile/compile.h"
#include "gdbsupport/gdb_string_view.h"
#include "python/python.h"
#include "guile/guile.h"
#include <vector>
Go to the source code of this file.
Classes | |
class | user_args |
struct | scoped_user_args_level |
class | scoped_restore_hook_in |
Macros | |
#define | END_MESSAGE "End with a line saying just \"end\"." |
#define | HOOK_STRING "hook-" |
#define | HOOK_LEN 5 |
#define | HOOK_POST_STRING "hookpost-" |
#define | HOOK_POST_LEN 9 |
Functions | |
static enum command_control_type | recurse_read_control_structure (read_next_line_ftype read_next_line_func, struct command_line *current_cmd, gdb::function_view< void(const char *)> validator) |
static void | do_define_command (const char *comname, int from_tty, const counted_command_line *commands) |
static void | do_document_command (const char *comname, int from_tty, const counted_command_line *commands) |
static const char * | read_next_line (std::string &buffer) |
static int | multi_line_command_p (enum command_control_type type) |
static command_line_up | build_command_line (enum command_control_type type, const char *args) |
counted_command_line | get_command_line (enum command_control_type type, const char *arg) |
void | print_command_lines (struct ui_out *uiout, struct command_line *cmd, unsigned int depth) |
void | execute_cmd_pre_hook (struct cmd_list_element *c) |
void | execute_cmd_post_hook (struct cmd_list_element *c) |
void | execute_control_commands (struct command_line *cmdlines, int from_tty) |
std::string | execute_control_commands_to_string (struct command_line *commands, int from_tty) |
void | execute_user_command (struct cmd_list_element *c, const char *args) |
void | reset_command_nest_depth (void) |
void | print_command_trace (const char *fmt,...) |
static enum command_control_type | execute_control_command_1 (struct command_line *cmd, int from_tty) |
enum command_control_type | execute_control_command (struct command_line *cmd, int from_tty) |
enum command_control_type | execute_control_command_untraced (struct command_line *cmd) |
static void | while_command (const char *arg, int from_tty) |
static void | if_command (const char *arg, int from_tty) |
static const char * | locate_arg (const char *p) |
std::string | insert_user_defined_cmd_args (const char *line) |
static const char * | line_first_arg (const char *p) |
static enum misc_command_type | process_next_line (const char *p, command_line_up *command, int parse_commands, gdb::function_view< void(const char *)> validator) |
counted_command_line | read_command_lines (const char *prompt_arg, int from_tty, int parse_commands, gdb::function_view< void(const char *)> validator) |
counted_command_line | read_command_lines_1 (read_next_line_ftype read_next_line_func, int parse_commands, gdb::function_view< void(const char *)> validator) |
void | free_command_lines (struct command_line **lptr) |
static struct cmd_list_element ** | validate_comname (const char **comname) |
static void | user_defined_command (const char *ignore, int from_tty) |
static void | define_command (const char *comname, int from_tty) |
static void | document_command (const char *comname, int from_tty) |
static void | define_prefix_command (const char *comname, int from_tty) |
void | script_from_file (FILE *stream, const char *file) |
void | show_user_1 (struct cmd_list_element *c, const char *prefix, const char *name, struct ui_file *stream) |
void | _initialize_cli_script () |
Variables | |
static int | control_level |
static int | command_nest_depth = 1 |
static int | suppress_next_print_command_trace = 0 |
static cmd_list_element * | while_cmd_element = nullptr |
static cmd_list_element * | if_cmd_element = nullptr |
static cmd_list_element * | define_cmd_element = nullptr |
static cmd_list_element * | document_cmd_element = nullptr |
static std::vector< std::unique_ptr< user_args > > | user_args_stack |
#define END_MESSAGE "End with a line saying just \"end\"." |
Definition at line 1175 of file cli-script.c.
Referenced by read_command_lines().
#define HOOK_LEN 5 |
#define HOOK_POST_LEN 9 |
#define HOOK_POST_STRING "hookpost-" |
#define HOOK_STRING "hook-" |
void _initialize_cli_script | ( | ) |
Definition at line 1692 of file cli-script.c.
Referenced by initialize_all_files().
|
static |
Definition at line 160 of file cli-script.c.
References define_control, document_control, if_control, and while_control.
Referenced by get_command_line(), and process_next_line().
|
static |
Definition at line 1502 of file cli-script.c.
References do_define_command().
|
static |
Definition at line 1585 of file cli-script.c.
References add_cmd(), cmd_list_element::allow_unknown, class_user, cmd_list_element::is_prefix(), lookup_cmd_exact(), cmd_list_element::subcommands, cmd_list_element::theclass, cmd_list_element::user_commands, user_defined_command(), and validate_comname().
|
static |
Definition at line 1371 of file cli-script.c.
References add_cmd(), cmd_list_element::allow_unknown, class_alias, class_user, cmd_list_element::doc, HOOK_LEN, cmd_list_element::hook_post, HOOK_POST_LEN, HOOK_POST_STRING, cmd_list_element::hook_pre, HOOK_STRING, cmd_list_element::hookee_post, cmd_list_element::hookee_pre, cmd_list_element::is_prefix(), lookup_cmd_exact(), cmd_list_element::name, nullptr, query(), read_command_lines(), cmd_list_element::subcommands, cmd_list_element::theclass, cmd_list_element::user_commands, user_defined_command(), and validate_comname().
Referenced by define_command(), and execute_control_command_1().
|
static |
Definition at line 1512 of file cli-script.c.
References alias, class_alias, class_user, cmd_list_element::doc, cmd_list_element::doc_allocated, command_line::line, lookup_cmd_composition(), command_line::next, read_command_lines(), cmd_list_element::theclass, validate_comname(), xfree(), and xmalloc().
Referenced by document_command(), and execute_control_command_1().
|
static |
Definition at line 1577 of file cli-script.c.
References do_document_command().
void execute_cmd_post_hook | ( | struct cmd_list_element * | c | ) |
Definition at line 390 of file cli-script.c.
References execute_user_command(), cmd_list_element::hook_in, and cmd_list_element::hook_post.
Referenced by execute_command().
void execute_cmd_pre_hook | ( | struct cmd_list_element * | c | ) |
Definition at line 379 of file cli-script.c.
References execute_user_command(), cmd_list_element::hook_in, and cmd_list_element::hook_pre.
Referenced by execute_command(), and normal_stop().
enum command_control_type execute_control_command | ( | struct command_line * | cmd, |
int | from_tty ) |
Definition at line 698 of file cli-script.c.
References current_ui, current_uiout, execute_control_command_1(), INTERP_CONSOLE, interp_lookup(), and interp::interp_ui_out().
Referenced by bpstat_do_actions_1(), execute_control_command_untraced(), and execute_control_commands().
|
static |
Definition at line 513 of file cli-script.c.
References command_line::body_list_0, command_line::body_list_1, break_control, command_nest_depth, commands_control, commands_from_control_command(), command_line::compile, compile_control, continue_control, command_line::control_type, command_line::control_u, define_control, do_define_command(), do_document_command(), document_control, eval_compile_command(), eval_ext_lang_from_control_command(), execute_command(), execute_control_command_1(), guile_control, if_control, insert_user_defined_cmd_args(), invalid_control, command_line::line, command_line::next, parse_expression(), print_command_trace(), python_control, QUIT, command_line::scope, command_line::scope_data, simple_control, value_true(), and while_control.
Referenced by execute_control_command(), and execute_control_command_1().
enum command_control_type execute_control_command_untraced | ( | struct command_line * | cmd | ) |
Definition at line 716 of file cli-script.c.
References execute_control_command(), and suppress_next_print_command_trace.
Referenced by compile_code_command(), compile_print_command(), guile_command(), if_command(), python_interactive_command(), and while_command().
void execute_control_commands | ( | struct command_line * | cmdlines, |
int | from_tty ) |
Definition at line 403 of file cli-script.c.
References ui::async, break_control, command_nest_depth, current_ui, execute_control_command(), command_line::next, and simple_control.
Referenced by dprintf_breakpoint::after_condition_true(), execute_control_commands_to_string(), and execute_user_command().
std::string execute_control_commands_to_string | ( | struct command_line * | commands, |
int | from_tty ) |
Definition at line 425 of file cli-script.c.
References execute_control_commands(), and execute_fn_to_string().
void execute_user_command | ( | struct cmd_list_element * | c, |
const char * | args ) |
Definition at line 439 of file cli-script.c.
References current_ui, execute_control_commands(), ui::instream, max_user_call_depth, user_args_stack, and cmd_list_element::user_commands.
Referenced by execute_cmd_post_hook(), execute_cmd_pre_hook(), and execute_command().
void free_command_lines | ( | struct command_line ** | lptr | ) |
Definition at line 1293 of file cli-script.c.
Referenced by command_lines_deleter::operator()().
counted_command_line get_command_line | ( | enum command_control_type | type, |
const char * | arg ) |
Definition at line 182 of file cli-script.c.
References build_command_line(), invalid_control, read_next_line(), and recurse_read_control_structure().
Referenced by compile_code_command(), compile_print_command(), guile_command(), if_command(), python_interactive_command(), and while_command().
|
static |
Definition at line 744 of file cli-script.c.
References ui::async, control_level, current_ui, execute_control_command_untraced(), get_command_line(), and if_control.
std::string insert_user_defined_cmd_args | ( | const char * | line | ) |
Definition at line 839 of file cli-script.c.
References command_line::line, and user_args_stack.
Referenced by eval_command(), and execute_control_command_1().
|
static |
Definition at line 928 of file cli-script.c.
References find_command_name_length().
Referenced by process_next_line().
|
static |
Definition at line 824 of file cli-script.c.
Referenced by user_args::insert_args().
|
static |
Definition at line 137 of file cli-script.c.
References commands_control, compile_control, define_control, document_control, guile_control, if_control, python_control, while_control, and while_stepping_control.
Referenced by read_command_lines_1(), and recurse_read_control_structure().
void print_command_lines | ( | struct ui_out * | uiout, |
struct command_line * | cmd, | ||
unsigned int | depth ) |
Definition at line 202 of file cli-script.c.
References command_line::body_list_0, command_line::body_list_1, break_control, commands_control, compile_control, continue_control, command_line::control_type, ui_out::field_fmt(), ui_out::field_string(), guile_control, if_control, command_line::line, command_line::next, print_command_lines(), python_control, simple_control, ui_out::spaces(), ui_out::text(), while_control, and while_stepping_control.
Referenced by bppy_get_commands(), gdbscm_breakpoint_commands(), print_command_lines(), print_one_breakpoint_location(), save_breakpoints(), and show_user_1().
void print_command_trace | ( | const char * | fmt, |
... ) |
Definition at line 486 of file cli-script.c.
References command_nest_depth, gdb_printf(), gdb_puts(), gdb_vprintf(), source_verbose, suppress_next_print_command_trace, and trace_commands.
Referenced by execute_command(), and execute_control_command_1().
|
static |
Definition at line 944 of file cli-script.c.
References break_control, build_command_line(), cmdlist, commands_cmd_element, commands_control, compile_cmd_element, compile_control, COMPILE_I_INVALID_SCOPE, continue_control, define_cmd_element, define_control, document_cmd_element, document_control, else_command, end_command, guile_cmd_element, guile_control, if_cmd_element, if_control, line_first_arg(), lookup_cmd_1(), nop_command, ok_command, python_cmd_element, python_control, simple_control, while_cmd_element, while_control, while_stepping_cmd_element, and while_stepping_control.
Referenced by read_command_lines_1(), and recurse_read_control_structure().
counted_command_line read_command_lines | ( | const char * | prompt_arg, |
int | from_tty, | ||
int | parse_commands, | ||
gdb::function_view< void(const char *)> | validator ) |
Definition at line 1178 of file cli-script.c.
References current_interp_named_p(), current_ui, deprecated_readline_begin_hook, deprecated_readline_end_hook, END_MESSAGE, ui::input_interactive_p(), INTERP_CONSOLE, printf_unfiltered(), read_command_lines_1(), and read_next_line().
Referenced by actions_command(), commands_command_1(), do_define_command(), and do_document_command().
counted_command_line read_command_lines_1 | ( | read_next_line_ftype | read_next_line_func, |
int | parse_commands, | ||
gdb::function_view< void(const char *)> | validator ) |
Definition at line 1220 of file cli-script.c.
References control_level, dont_repeat(), end_command, invalid_control, multi_line_command_p(), command_line::next, nop_command, ok_command, process_next_line(), recurse_read_control_structure(), and simple_control.
Referenced by bppy_set_commands(), create_tracepoint_from_upload(), mi_cmd_break_commands(), and read_command_lines().
|
static |
Definition at line 898 of file cli-script.c.
References command_line_input(), control_level, current_ui, deprecated_readline_hook, ui::instream, and ui::stdin_stream.
Referenced by get_command_line(), and read_command_lines().
|
static |
Definition at line 1068 of file cli-script.c.
References command_line::body_list_0, command_line::body_list_1, compile_control, control_level, command_line::control_type, dont_repeat(), else_command, end_command, guile_control, if_control, invalid_control, multi_line_command_p(), command_line::next, nop_command, process_next_line(), python_control, recurse_read_control_structure(), and simple_control.
Referenced by get_command_line(), read_command_lines_1(), and recurse_read_control_structure().
void reset_command_nest_depth | ( | void | ) |
Definition at line 468 of file cli-script.c.
References command_nest_depth, and suppress_next_print_command_trace.
Referenced by display_gdb_prompt().
void script_from_file | ( | FILE * | stream, |
const char * | file ) |
Definition at line 1627 of file cli-script.c.
References ui::async, current_ui, read_command_file(), source_file_name, and source_line_number.
Referenced by source_gdb_objfile_script(), source_gdb_script(), and source_script_from_stream().
void show_user_1 | ( | struct cmd_list_element * | c, |
const char * | prefix, | ||
const char * | name, | ||
struct ui_file * | stream ) |
Definition at line 1660 of file cli-script.c.
References class_user, cli_user_command_p(), current_uiout, fprintf_styled(), gdb_printf(), gdb_puts(), gdb_stdout, cmd_list_element::is_prefix(), name, cmd_list_element::name, cmd_list_element::next, prefix, cmd_list_element::prefixname(), print_command_lines(), show_user_1(), cli_style_option::style(), cmd_list_element::subcommands, cmd_list_element::theclass, title_style, and cmd_list_element::user_commands.
Referenced by show_user(), and show_user_1().
|
static |
Definition at line 1360 of file cli-script.c.
Referenced by define_prefix_command(), and do_define_command().
|
static |
Definition at line 1314 of file cli-script.c.
References cmdlist, error_no_arg(), cmd_list_element::is_prefix(), lookup_cmd(), prefix, cmd_list_element::subcommands, and valid_cmd_char_p().
Referenced by define_prefix_command(), do_define_command(), and do_document_command().
|
static |
Definition at line 727 of file cli-script.c.
References ui::async, control_level, current_ui, execute_control_command_untraced(), get_command_line(), and while_control.
|
static |
Definition at line 64 of file cli-script.c.
Referenced by execute_control_command_1(), execute_control_commands(), print_command_trace(), and reset_command_nest_depth().
|
static |
Definition at line 61 of file cli-script.c.
Referenced by if_command(), read_command_lines_1(), read_next_line(), recurse_read_control_structure(), and while_command().
|
static |
Definition at line 76 of file cli-script.c.
Referenced by process_next_line().
|
static |
Definition at line 79 of file cli-script.c.
Referenced by process_next_line().
|
static |
Definition at line 73 of file cli-script.c.
Referenced by process_next_line().
|
static |
Definition at line 67 of file cli-script.c.
Referenced by execute_control_command_untraced(), print_command_trace(), and reset_command_nest_depth().
|
static |
Definition at line 112 of file cli-script.c.
Referenced by execute_user_command(), insert_user_defined_cmd_args(), scoped_user_args_level::scoped_user_args_level(), and scoped_user_args_level::~scoped_user_args_level().
|
static |
Definition at line 70 of file cli-script.c.
Referenced by process_next_line().