GDB (xrefs)
Classes | Macros | Functions | Variables
cli-script.c File Reference
#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"
#include <vector>

Go to the source code of this file.

Classes

struct  string_view
 
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 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 * read_next_line (void)
 
static int multi_line_command_p (enum command_control_type type)
 
static struct command_linebuild_command_line (enum command_control_type type, const char *args)
 
command_line_up 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_user_command (struct cmd_list_element *c, const char *args)
 
void reset_command_nest_depth (void)
 
void print_command_trace (const char *cmd)
 
static enum command_control_type execute_control_command_1 (struct command_line *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 (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 void realloc_body_list (struct command_line *command, int new_length)
 
static bool command_name_equals (struct cmd_list_element *cmd, const char *name)
 
static const char * line_first_arg (const char *p)
 
static enum misc_command_type process_next_line (char *p, struct command_line **command, int parse_commands, void(*validator)(char *, void *), void *closure)
 
command_line_up read_command_lines (char *prompt_arg, int from_tty, int parse_commands, void(*validator)(char *, void *), void *closure)
 
command_line_up 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)
 
command_line_up copy_command_lines (struct command_line *cmds)
 
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)
 
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
 
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 1195 of file cli-script.c.

Referenced by read_command_lines().

◆ HOOK_LEN

#define HOOK_LEN   5

Referenced by define_command().

◆ HOOK_POST_LEN

#define HOOK_POST_LEN   9

Referenced by define_command().

◆ HOOK_POST_STRING

#define HOOK_POST_STRING   "hookpost-"

Referenced by define_command().

◆ HOOK_STRING

#define HOOK_STRING   "hook-"

Referenced by define_command().

◆ MAX_TMPBUF

#define MAX_TMPBUF   128

Referenced by define_command().

Function Documentation

◆ _initialize_cli_script()

void _initialize_cli_script ( void  )

◆ build_command_line()

static struct command_line* build_command_line ( enum command_control_type  type,
const char *  args 
)
static

◆ command_name_equals()

static bool command_name_equals ( struct cmd_list_element cmd,
const char *  name 
)
static

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

References CMD_LIST_AMBIGUOUS, cmd_list_element::name, and name.

Referenced by process_next_line().

◆ copy_command_lines()

command_line_up copy_command_lines ( struct command_line cmds)

◆ define_command()

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

◆ document_command()

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

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

◆ execute_control_command_1()

static enum command_control_type execute_control_command_1 ( struct command_line cmd)
static

◆ execute_control_command_untraced()

enum command_control_type execute_control_command_untraced ( struct command_line cmd)

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

◆ get_command_line()

command_line_up 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 788 of file cli-script.c.

References 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 912 of file cli-script.c.

References find_command_name_length(), and skip_spaces().

Referenced by process_next_line().

◆ locate_arg()

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

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

References startswith().

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 *  cmd)

◆ process_next_line()

static enum misc_command_type process_next_line ( char *  p,
struct command_line **  command,
int  parse_commands,
void(*)(char *, void *)  validator,
void *  closure 
)
static

◆ read_command_lines()

command_line_up read_command_lines ( char *  prompt_arg,
int  from_tty,
int  parse_commands,
void(*)(char *, void *)  validator,
void *  closure 
)

◆ read_command_lines_1()

command_line_up read_command_lines_1 ( char *(*)(void)  read_next_line_func,
int  parse_commands,
void(*)(char *, void *)  validator,
void *  closure 
)

◆ read_next_line()

static char * read_next_line ( void  )
static

◆ realloc_body_list()

static void realloc_body_list ( struct command_line command,
int  new_length 
)
static

◆ recurse_read_control_structure()

static enum command_control_type recurse_read_control_structure ( char *(*)(void)  read_next_line_func,
struct command_line current_cmd,
void(*)(char *, void *)  validator,
void *  closure 
)
static

◆ reset_command_nest_depth()

void reset_command_nest_depth ( void  )

Definition at line 430 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 1415 of file cli-script.c.

Referenced by 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

◆ 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