GDB (xrefs)
Classes | Defines | Functions | Variables
/home/stan/gdb/src/gdb/cli/cli-script.c File Reference
#include "defs.h"
#include "value.h"
#include "language.h"
#include <ctype.h>
#include "ui-out.h"
#include "gdb_string.h"
#include "exceptions.h"
#include "top.h"
#include "breakpoint.h"
#include "cli/cli-cmds.h"
#include "cli/cli-decode.h"
#include "cli/cli-script.h"
#include "gdb_assert.h"
#include "python/python.h"
#include "interps.h"

Go to the source code of this file.

Classes

struct  user_args
struct  source_cleanup_lines_args

Defines

#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 cleanupsetup_user_args (char *p)
static char * read_next_line (void)
static struct command_linebuild_command_line (enum command_control_type type, char *args)
struct command_lineget_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_lineread_command_lines (char *prompt_arg, int from_tty, int parse_commands, void(*validator)(char *, void *), void *closure)
struct command_lineread_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 cleanupmake_cleanup_free_command_lines (struct command_line **arg)
struct command_linecopy_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_argsuser_args
initialize_file_ftype _initialize_cli_script

Define Documentation

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

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

Referenced by setup_user_args().


Function Documentation

void _initialize_cli_script ( void  )
static void arg_cleanup ( void *  ignore) [static]

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

References _, user_args::command, internal_error(), user_args::next, user_args, and xfree().

Referenced by setup_user_args().

static struct command_line* build_command_line ( enum command_control_type  type,
char *  args 
) [static, read]
static void clear_hook_in_cleanup ( void *  data) [static]

Definition at line 266 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) [read]
static void define_command ( char *  comname,
int  from_tty 
) [static]
static void do_free_command_lines_cleanup ( void *  arg) [static]

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

References free_command_lines().

Referenced by make_cleanup_free_command_lines().

static void do_restore_user_call_depth ( void *  call_depth) [static]

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

References in_user_command.

Referenced by execute_user_command().

static void document_command ( char *  comname,
int  from_tty 
) [static]
void execute_cmd_pre_hook ( struct cmd_list_element c)

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

References execute_control_command().

Referenced by if_command(), python_interactive_command(), and while_command().

void execute_user_command ( struct cmd_list_element c,
char *  args 
)
void free_command_lines ( struct command_line **  lptr)
struct command_line* get_command_line ( enum command_control_type  type,
char *  arg 
) [read]
static void if_command ( char *  arg,
int  from_tty 
) [static]
static char * insert_args ( char *  line) [static]
static char* locate_arg ( char *  p) [static]

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

References strchr().

Referenced by insert_args().

struct cleanup* make_cleanup_free_command_lines ( struct command_line **  arg) [read]
void print_command_lines ( struct ui_out uiout,
struct command_line cmd,
unsigned int  depth 
)
void print_command_trace ( const char *  cmd)
static enum misc_command_type process_next_line ( char *  p,
struct command_line **  command,
int  parse_commands,
void(*)(char *, void *)  validator,
void *  closure 
) [static]
struct command_line* read_command_lines ( char *  prompt_arg,
int  from_tty,
int  parse_commands,
void(*)(char *, void *)  validator,
void *  closure 
) [read]
struct command_line* read_command_lines_1 ( char *(*)(void)  read_next_line_func,
int  parse_commands,
void(*)(char *, void *)  validator,
void *  closure 
) [read]
static char * read_next_line ( void  ) [static]
static void realloc_body_list ( struct command_line command,
int  new_length 
) [static]
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]
void reset_command_nest_depth ( void  )

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

Referenced by display_gdb_prompt().

static void restore_interp ( void *  arg) [static]

Definition at line 1181 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 
)
static struct cleanup * setup_user_args ( char *  p) [static, read]
void show_user_1 ( struct cmd_list_element c,
const char *  prefix,
const char *  name,
struct ui_file stream 
)
static void source_cleanup_lines ( void *  args) [static]
static void user_defined_command ( char *  ignore,
int  from_tty 
) [static]

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

Referenced by define_command().

static struct cmd_list_element** validate_comname ( char **  comname) [static, read]

Definition at line 1390 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 void while_command ( char *  arg,
int  from_tty 
) [static]

Variable Documentation

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

Referenced by initialize_all_files().

int command_nest_depth = 1 [static]

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

Referenced by print_command_trace().

int control_level [static]

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

Referenced by read_next_line().

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

struct user_args * user_args

Referenced by arg_cleanup(), and setup_user_args().

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines