GDB (xrefs)
|
#include "defs.h"
#include "value.h"
#include "language.h"
#include <ctype.h>
#include "ui-out.h"
#include "top.h"
#include "breakpoint.h"
#include "cli/cli-cmds.h"
#include "cli/cli-decode.h"
#include "cli/cli-script.h"
#include "extension.h"
#include "interps.h"
#include "compile/compile.h"
Go to the source code of this file.
Classes | |
struct | user_args |
struct | source_cleanup_lines_args |
Macros | |
#define | MAXUSERARGS 10 |
#define | END_MESSAGE "End with a line saying just \"end\"." |
#define | MAX_TMPBUF 128 |
#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 (char *(*read_next_line_func)(void), struct command_line *current_cmd, void(*validator)(char *, void *), void *closure) |
static char * | insert_args (char *line) |
static struct cleanup * | setup_user_args (char *p) |
static char * | read_next_line (void) |
static int | multi_line_command_p (enum command_control_type type) |
static struct command_line * | build_command_line (enum command_control_type type, char *args) |
struct command_line * | get_command_line (enum command_control_type type, char *arg) |
void | print_command_lines (struct ui_out *uiout, struct command_line *cmd, unsigned int depth) |
static void | clear_hook_in_cleanup (void *data) |
void | execute_cmd_pre_hook (struct cmd_list_element *c) |
void | execute_cmd_post_hook (struct cmd_list_element *c) |
static void | do_restore_user_call_depth (void *call_depth) |
void | execute_user_command (struct cmd_list_element *c, char *args) |
void | reset_command_nest_depth (void) |
void | print_command_trace (const char *cmd) |
enum command_control_type | execute_control_command (struct command_line *cmd) |
enum command_control_type | execute_control_command_untraced (struct command_line *cmd) |
static void | while_command (char *arg, int from_tty) |
static void | if_command (char *arg, int from_tty) |
static void | arg_cleanup (void *ignore) |
static char * | locate_arg (char *p) |
static void | realloc_body_list (struct command_line *command, int new_length) |
static enum misc_command_type | process_next_line (char *p, struct command_line **command, int parse_commands, void(*validator)(char *, void *), void *closure) |
static void | restore_interp (void *arg) |
struct command_line * | read_command_lines (char *prompt_arg, int from_tty, int parse_commands, void(*validator)(char *, void *), void *closure) |
struct command_line * | read_command_lines_1 (char *(*read_next_line_func)(void), int parse_commands, void(*validator)(char *, void *), void *closure) |
void | free_command_lines (struct command_line **lptr) |
static void | do_free_command_lines_cleanup (void *arg) |
struct cleanup * | make_cleanup_free_command_lines (struct command_line **arg) |
struct command_line * | copy_command_lines (struct command_line *cmds) |
static struct cmd_list_element ** | validate_comname (char **comname) |
static void | user_defined_command (char *ignore, int from_tty) |
static void | define_command (char *comname, int from_tty) |
static void | document_command (char *comname, int from_tty) |
static void | source_cleanup_lines (void *args) |
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 (void) |
Variables | |
static int | control_level |
static int | command_nest_depth = 1 |
static int | suppress_next_print_command_trace = 0 |
struct user_args * | user_args |
initialize_file_ftype | _initialize_cli_script |
#define END_MESSAGE "End with a line saying just \"end\"." |
Definition at line 1256 of file cli-script.c.
Referenced by read_command_lines().
#define HOOK_LEN 5 |
Referenced by define_command().
#define HOOK_POST_LEN 9 |
Referenced by define_command().
#define HOOK_POST_STRING "hookpost-" |
Referenced by define_command().
#define HOOK_STRING "hook-" |
Referenced by define_command().
#define MAX_TMPBUF 128 |
Referenced by define_command().
#define MAXUSERARGS 10 |
Definition at line 60 of file cli-script.c.
Referenced by setup_user_args().
void _initialize_cli_script | ( | void | ) |
Definition at line 1757 of file cli-script.c.
References _, add_com(), class_support, define_command(), document_command(), if_command(), and while_command().
|
static |
Definition at line 702 of file cli-script.c.
References _, user_args::command, internal_error(), user_args::next, user_args, and xfree().
Referenced by setup_user_args().
|
static |
Definition at line 104 of file cli-script.c.
References _, command_line::body_count, command_line::body_list, command_line::control_type, error(), gdb_assert, if_control, command_line::line, command_line::next, type, while_control, and xmalloc().
Referenced by get_command_line(), and process_next_line().
|
static |
Definition at line 311 of file cli-script.c.
References cmd_list_element::hook_in.
Referenced by execute_cmd_post_hook(), and execute_cmd_pre_hook().
struct command_line* copy_command_lines | ( | struct command_line * | cmds | ) |
Definition at line 1411 of file cli-script.c.
References command_line::body_count, command_line::body_list, command_line::control_type, copy_command_lines(), command_line::line, command_line::next, and xmalloc().
Referenced by copy_command_lines(), and do_map_commands_command().
|
static |
Definition at line 1501 of file cli-script.c.
References _, add_cmd(), class_alias, class_user, cmd_list_element::doc, error(), free_command_lines(), 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, internal_error(), lookup_cmd(), MAX_TMPBUF, cmd_list_element::name, query(), read_command_lines(), cmd_list_element::theclass, cmd_list_element::user_commands, user_defined_command(), validate_comname(), warning(), and xsnprintf().
Referenced by _initialize_cli_script().
|
static |
Definition at line 1399 of file cli-script.c.
References free_command_lines().
Referenced by make_cleanup_free_command_lines().
|
static |
Definition at line 345 of file cli-script.c.
References in_user_command.
Referenced by execute_user_command().
|
static |
Definition at line 1619 of file cli-script.c.
References _, class_user, cmd_list_element::doc, error(), free_command_lines(), len, command_line::line, lookup_cmd(), command_line::next, read_command_lines(), cmd_list_element::theclass, validate_comname(), xfree(), xmalloc(), and xsnprintf().
Referenced by _initialize_cli_script().
void execute_cmd_post_hook | ( | struct cmd_list_element * | c | ) |
Definition at line 331 of file cli-script.c.
References clear_hook_in_cleanup(), do_cleanups(), execute_user_command(), cmd_list_element::hook_in, cmd_list_element::hook_post, and make_cleanup().
Referenced by execute_command().
void execute_cmd_pre_hook | ( | struct cmd_list_element * | c | ) |
Definition at line 319 of file cli-script.c.
References clear_hook_in_cleanup(), do_cleanups(), execute_user_command(), cmd_list_element::hook_in, cmd_list_element::hook_pre, and make_cleanup().
Referenced by execute_command(), and hook_stop_stub().
enum command_control_type execute_control_command | ( | struct command_line * | cmd | ) |
Definition at line 444 of file cli-script.c.
References _, command_line::body_count, command_line::body_list, break_control, commands_control, commands_from_control_command(), command_line::compile, compile_control, continue_control, command_line::control_type, command_line::control_u, do_cleanups(), eval_compile_command(), eval_ext_lang_from_control_command(), evaluate_expression(), execute_command(), execute_control_command(), free_current_contents(), guile_control, if_control, insert_args(), invalid_control, len, command_line::line, make_cleanup(), command_line::next, null_cleanup(), parse_expression(), print_command_trace(), python_control, QUIT, simple_control, value_free_to_mark(), value_mark(), value_true(), warning(), while_control, and xsnprintf().
Referenced by bpstat_do_actions_1(), execute_control_command(), execute_control_command_untraced(), and execute_user_command().
enum command_control_type execute_control_command_untraced | ( | struct command_line * | cmd | ) |
Definition at line 645 of file cli-script.c.
References execute_control_command().
Referenced by compile_code_command(), compile_print_command(), guile_command(), if_command(), python_command(), and while_command().
void execute_user_command | ( | struct cmd_list_element * | c, |
char * | args | ||
) |
Definition at line 356 of file cli-script.c.
References _, break_control, do_cleanups(), do_restore_instream_cleanup(), do_restore_user_call_depth(), error(), execute_control_command(), in_user_command, instream, interpreter_async, make_cleanup(), make_cleanup_restore_integer(), max_user_call_depth, command_line::next, setup_user_args(), simple_control, cmd_list_element::user_commands, and warning().
Referenced by execute_cmd_post_hook(), execute_cmd_pre_hook(), and execute_command().
void free_command_lines | ( | struct command_line ** | lptr | ) |
Definition at line 1375 of file cli-script.c.
References command_line::body_count, command_line::body_list, free_command_lines(), command_line::line, command_line::next, and xfree().
Referenced by decref_counted_command_line(), define_command(), do_free_command_lines_cleanup(), document_command(), free_command_lines(), if_command(), and while_command().
struct command_line* get_command_line | ( | enum command_control_type | type, |
char * | arg | ||
) |
Definition at line 130 of file cli-script.c.
References _, build_command_line(), discard_cleanups(), do_cleanups(), invalid_control, make_cleanup_free_command_lines(), read_next_line(), recurse_read_control_structure(), and warning().
Referenced by compile_code_command(), compile_print_command(), guile_command(), if_command(), python_command(), and while_command().
|
static |
Definition at line 680 of file cli-script.c.
References do_cleanups(), execute_control_command_untraced(), free_command_lines(), get_command_line(), if_control, interpreter_async, and make_cleanup_restore_integer().
Referenced by _initialize_cli_script().
|
static |
Definition at line 817 of file cli-script.c.
References _, user_args::a, user_args::arg, user_args::count, error(), gdb_assert, user_args::len, len, line, locate_arg(), and xmalloc().
Referenced by execute_control_command().
|
static |
struct cleanup* make_cleanup_free_command_lines | ( | struct command_line ** | arg | ) |
Definition at line 1405 of file cli-script.c.
References do_free_command_lines_cleanup(), and make_cleanup().
Referenced by compile_code_command(), compile_print_command(), get_command_line(), guile_command(), python_command(), and read_command_lines_1().
|
static |
Definition at line 83 of file cli-script.c.
References commands_control, compile_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 156 of file cli-script.c.
References command_line::body_count, command_line::body_list, break_control, commands_control, compile_control, continue_control, command_line::control_type, guile_control, if_control, command_line::line, command_line::next, print_command_lines(), python_control, simple_control, ui_out_field_fmt(), ui_out_field_string(), 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 * | cmd | ) |
Definition at line 424 of file cli-script.c.
References command_nest_depth, printf_filtered(), source_verbose, and trace_commands.
Referenced by execute_command(), and execute_control_command().
|
static |
Definition at line 969 of file cli-script.c.
References break_control, build_command_line(), CATCH, commands_control, compile_control, COMPILE_I_INVALID_SCOPE, continue_control, else_command, END_CATCH, end_command, guile_control, if_control, nop_command, ok_command, python_control, RETURN_MASK_ALL, savestring(), simple_control, startswith(), throw_exception(), TRY, while_control, while_stepping_control, xfree(), and xmalloc().
Referenced by read_command_lines_1(), and recurse_read_control_structure().
struct command_line* read_command_lines | ( | char * | prompt_arg, |
int | from_tty, | ||
int | parse_commands, | ||
void(*)(char *, void *) | validator, | ||
void * | closure | ||
) |
Definition at line 1259 of file cli-script.c.
References current_interp_named_p(), deprecated_readline_begin_hook, deprecated_readline_end_hook, do_cleanups(), END_MESSAGE, gdb_flush(), gdb_stdout, input_from_terminal_p(), INTERP_CONSOLE, interp_set_temp(), make_cleanup(), printf_unfiltered(), read_command_lines_1(), read_next_line(), and restore_interp().
Referenced by define_command(), do_map_commands_command(), document_command(), and trace_actions_command().
struct command_line* read_command_lines_1 | ( | char *(*)(void) | read_next_line_func, |
int | parse_commands, | ||
void(*)(char *, void *) | validator, | ||
void * | closure | ||
) |
Definition at line 1306 of file cli-script.c.
References command_line::control_type, discard_cleanups(), do_cleanups(), dont_repeat(), end_command, invalid_control, make_cleanup(), make_cleanup_free_command_lines(), multi_line_command_p(), cleanup::next, command_line::next, nop_command, null_cleanup(), ok_command, process_next_line(), recurse_read_control_structure(), and simple_control.
Referenced by create_tracepoint_from_upload(), mi_cmd_break_commands(), and read_command_lines().
|
static |
Definition at line 937 of file cli-script.c.
References _, command_line_input(), control_level, deprecated_readline_hook, error(), and instream.
Referenced by get_command_line(), and read_command_lines().
|
static |
Definition at line 910 of file cli-script.c.
References command_line::body_count, command_line::body_list, xfree(), and xmalloc().
Referenced by recurse_read_control_structure().
|
static |
Definition at line 1137 of file cli-script.c.
References _, command_line::body_count, command_line::body_list, compile_control, command_line::control_type, dont_repeat(), else_command, end_command, error(), guile_control, if_control, invalid_control, multi_line_command_p(), command_line::next, nop_command, process_next_line(), python_control, realloc_body_list(), and simple_control.
Referenced by get_command_line(), and read_command_lines_1().
void reset_command_nest_depth | ( | void | ) |
Definition at line 407 of file cli-script.c.
Referenced by display_gdb_prompt().
|
static |
Definition at line 1242 of file cli-script.c.
References interp_name(), and interp_set_temp().
Referenced by read_command_lines().
void script_from_file | ( | FILE * | stream, |
const char * | file | ||
) |
Definition at line 1686 of file cli-script.c.
References _, CATCH, do_cleanups(), END_CATCH, internal_error(), interpreter_async, make_cleanup(), make_cleanup_restore_integer(), source_cleanup_lines_args::old_file, source_cleanup_lines_args::old_line, read_command_file(), RETURN_MASK_ERROR, source_cleanup_lines(), source_file_name, source_line_number, throw_error(), and TRY.
Referenced by source_gdb_objfile_script(), source_gdb_script(), and source_script_from_stream().
|
static |
Definition at line 719 of file cli-script.c.
References _, user_args::a, user_args::arg, arg_cleanup(), user_args::command, user_args::count, error(), user_args::len, make_cleanup(), MAXUSERARGS, user_args::next, user_args, and xmalloc().
Referenced by execute_user_command().
void show_user_1 | ( | struct cmd_list_element * | c, |
const char * | prefix, | ||
const char * | name, | ||
struct ui_file * | stream | ||
) |
Definition at line 1728 of file cli-script.c.
References class_user, current_uiout, fprintf_filtered(), fputs_filtered(), gdb_stdout, cmd_list_element::name, cmd_list_element::next, cmd_list_element::prefixlist, cmd_list_element::prefixname, print_command_lines(), show_user_1(), cmd_list_element::theclass, and cmd_list_element::user_commands.
Referenced by show_user(), and show_user_1().
|
static |
Definition at line 1674 of file cli-script.c.
References source_cleanup_lines_args::old_file, source_cleanup_lines_args::old_line, source_file_name, and source_line_number.
Referenced by script_from_file().
|
static |
Definition at line 1496 of file cli-script.c.
Referenced by define_command().
|
static |
Definition at line 1447 of file cli-script.c.
References _, cmdlist, error(), error_no_arg(), lookup_cmd(), and cmd_list_element::prefixlist.
Referenced by define_command(), and document_command().
|
static |
Definition at line 656 of file cli-script.c.
References do_cleanups(), execute_control_command_untraced(), free_command_lines(), get_command_line(), interpreter_async, make_cleanup_restore_integer(), and while_control.
Referenced by _initialize_cli_script().
initialize_file_ftype _initialize_cli_script |
Definition at line 1754 of file cli-script.c.
Referenced by initialize_all_files().
|
static |
Definition at line 54 of file cli-script.c.
Referenced by print_command_trace().
|
static |
Definition at line 51 of file cli-script.c.
Referenced by read_next_line().
|
static |
Definition at line 57 of file cli-script.c.
Referenced by arg_cleanup(), and setup_user_args().