GDB (xrefs)
Loading...
Searching...
No Matches
Classes | Macros | Functions | Variables
cli-script.c File Reference
#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_elementwhile_cmd_element = nullptr
 
static cmd_list_elementif_cmd_element = nullptr
 
static cmd_list_elementdefine_cmd_element = nullptr
 
static cmd_list_elementdocument_cmd_element = nullptr
 
static std::vector< std::unique_ptr< user_args > > user_args_stack
 

Macro Definition Documentation

◆ END_MESSAGE

#define END_MESSAGE   "End with a line saying just \"end\"."

Definition at line 1175 of file cli-script.c.

Referenced by read_command_lines().

◆ HOOK_LEN

#define HOOK_LEN   5

◆ HOOK_POST_LEN

#define HOOK_POST_LEN   9

◆ HOOK_POST_STRING

#define HOOK_POST_STRING   "hookpost-"

◆ HOOK_STRING

#define HOOK_STRING   "hook-"

Function Documentation

◆ _initialize_cli_script()

void _initialize_cli_script ( )

Definition at line 1692 of file cli-script.c.

Referenced by initialize_all_files().

◆ build_command_line()

static command_line_up build_command_line ( enum command_control_type type,
const char * args )
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().

◆ define_command()

static void define_command ( const char * comname,
int from_tty )
static

Definition at line 1502 of file cli-script.c.

References do_define_command().

◆ define_prefix_command()

static void define_prefix_command ( const char * comname,
int from_tty )
static

◆ do_define_command()

static void do_define_command ( const char * comname,
int from_tty,
const counted_command_line * commands )
static

◆ do_document_command()

static void do_document_command ( const char * comname,
int from_tty,
const counted_command_line * commands )
static

◆ document_command()

static void document_command ( const char * comname,
int from_tty )
static

Definition at line 1577 of file cli-script.c.

References do_document_command().

◆ execute_cmd_post_hook()

void execute_cmd_post_hook ( struct cmd_list_element * c)

◆ execute_cmd_pre_hook()

void execute_cmd_pre_hook ( struct cmd_list_element * c)

◆ execute_control_command()

enum command_control_type execute_control_command ( struct command_line * cmd,
int from_tty )

◆ execute_control_command_1()

static enum command_control_type execute_control_command_1 ( struct command_line * cmd,
int from_tty )
static

◆ execute_control_command_untraced()

enum command_control_type execute_control_command_untraced ( struct command_line * cmd)

◆ execute_control_commands()

void execute_control_commands ( struct command_line * cmdlines,
int from_tty )

◆ execute_control_commands_to_string()

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().

◆ execute_user_command()

void execute_user_command ( struct cmd_list_element * c,
const char * args )

◆ free_command_lines()

void free_command_lines ( struct command_line ** lptr)

Definition at line 1293 of file cli-script.c.

Referenced by command_lines_deleter::operator()().

◆ get_command_line()

counted_command_line get_command_line ( enum command_control_type type,
const char * arg )

◆ if_command()

static void if_command ( const char * arg,
int from_tty )
static

◆ insert_user_defined_cmd_args()

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().

◆ line_first_arg()

static const char * line_first_arg ( const char * p)
static

Definition at line 928 of file cli-script.c.

References find_command_name_length().

Referenced by process_next_line().

◆ locate_arg()

static const char * locate_arg ( const char * p)
static

Definition at line 824 of file cli-script.c.

Referenced by user_args::insert_args().

◆ multi_line_command_p()

static int multi_line_command_p ( enum command_control_type type)
static

◆ print_command_lines()

void print_command_lines ( struct ui_out * uiout,
struct command_line * cmd,
unsigned int depth )

◆ print_command_trace()

void print_command_trace ( const char * fmt,
... )

◆ process_next_line()

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 )
static

◆ read_command_lines()

counted_command_line read_command_lines ( const char * prompt_arg,
int from_tty,
int parse_commands,
gdb::function_view< void(const char *)> validator )

◆ read_command_lines_1()

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 )

◆ read_next_line()

static const char * read_next_line ( std::string & buffer)
static

◆ recurse_read_control_structure()

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

◆ reset_command_nest_depth()

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().

◆ script_from_file()

void script_from_file ( FILE * stream,
const char * file )

◆ show_user_1()

void show_user_1 ( struct cmd_list_element * c,
const char * prefix,
const char * name,
struct ui_file * stream )

◆ user_defined_command()

static void user_defined_command ( const char * ignore,
int from_tty )
static

Definition at line 1360 of file cli-script.c.

Referenced by define_prefix_command(), and do_define_command().

◆ validate_comname()

static struct cmd_list_element ** validate_comname ( const char ** comname)
static

◆ while_command()

static void while_command ( const char * arg,
int from_tty )
static

Variable Documentation

◆ command_nest_depth

int command_nest_depth = 1
static

◆ control_level

int control_level
static

◆ define_cmd_element

cmd_list_element* define_cmd_element = nullptr
static

Definition at line 76 of file cli-script.c.

Referenced by process_next_line().

◆ document_cmd_element

cmd_list_element* document_cmd_element = nullptr
static

Definition at line 79 of file cli-script.c.

Referenced by process_next_line().

◆ if_cmd_element

cmd_list_element* if_cmd_element = nullptr
static

Definition at line 73 of file cli-script.c.

Referenced by process_next_line().

◆ suppress_next_print_command_trace

int suppress_next_print_command_trace = 0
static

◆ user_args_stack

std::vector<std::unique_ptr<user_args> > user_args_stack
static

◆ while_cmd_element

cmd_list_element* while_cmd_element = nullptr
static

Definition at line 70 of file cli-script.c.

Referenced by process_next_line().