GDB (xrefs)
Classes | Functions | Variables
/tmp/gdb-7.10/gdb/parse.c File Reference
#include "defs.h"
#include <ctype.h>
#include "arch-utils.h"
#include "symtab.h"
#include "gdbtypes.h"
#include "frame.h"
#include "expression.h"
#include "value.h"
#include "command.h"
#include "language.h"
#include "f-lang.h"
#include "parser-defs.h"
#include "gdbcmd.h"
#include "symfile.h"
#include "inferior.h"
#include "doublest.h"
#include "block.h"
#include "source.h"
#include "objfiles.h"
#include "user-regs.h"

Go to the source code of this file.

Classes

struct  funcall
 

Functions

static void show_expressiondebug (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
 
static void show_parserdebug (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
 
static void free_funcalls (void *ignore)
 
static int prefixify_subexp (struct expression *, struct expression *, int, int)
 
static struct expressionparse_exp_in_context (const char **, CORE_ADDR, const struct block *, int, int, int *)
 
static struct expressionparse_exp_in_context_1 (const char **, CORE_ADDR, const struct block *, int, int, int *)
 
void _initialize_parse (void)
 
void start_arglist (void)
 
int end_arglist (void)
 
void initialize_expout (struct parser_state *ps, size_t initial_size, const struct language_defn *lang, struct gdbarch *gdbarch)
 
void reallocate_expout (struct parser_state *ps)
 
static void write_exp_elt (struct parser_state *ps, const union exp_element *expelt)
 
void write_exp_elt_opcode (struct parser_state *ps, enum exp_opcode expelt)
 
void write_exp_elt_sym (struct parser_state *ps, struct symbol *expelt)
 
void write_exp_elt_block (struct parser_state *ps, const struct block *b)
 
void write_exp_elt_objfile (struct parser_state *ps, struct objfile *objfile)
 
void write_exp_elt_longcst (struct parser_state *ps, LONGEST expelt)
 
void write_exp_elt_dblcst (struct parser_state *ps, DOUBLEST expelt)
 
void write_exp_elt_decfloatcst (struct parser_state *ps, gdb_byte expelt[16])
 
void write_exp_elt_type (struct parser_state *ps, struct type *expelt)
 
void write_exp_elt_intern (struct parser_state *ps, struct internalvar *expelt)
 
void write_exp_string (struct parser_state *ps, struct stoken str)
 
void write_exp_string_vector (struct parser_state *ps, int type, struct stoken_vector *vec)
 
void write_exp_bitstring (struct parser_state *ps, struct stoken str)
 
void write_exp_msymbol (struct parser_state *ps, struct bound_minimal_symbol bound_msym)
 
void mark_struct_expression (struct parser_state *ps)
 
void mark_completion_tag (enum type_code tag, const char *ptr, int length)
 
void write_dollar_variable (struct parser_state *ps, struct stoken str)
 
const char * find_template_name_end (const char *p)
 
char * copy_name (struct stoken token)
 
int prefixify_expression (struct expression *expr)
 
int length_of_subexp (struct expression *expr, int endpos)
 
void operator_length (const struct expression *expr, int endpos, int *oplenp, int *argsp)
 
void operator_length_standard (const struct expression *expr, int endpos, int *oplenp, int *argsp)
 
struct expressionparse_exp_1 (const char **stringptr, CORE_ADDR pc, const struct block *block, int comma)
 
struct expressionparse_expression (const char *string)
 
struct expressionparse_expression_with_language (const char *string, enum language lang)
 
struct typeparse_expression_for_completion (const char *string, char **name, enum type_code *code)
 
void null_post_parser (struct expression **exp, int void_context_p)
 
int parse_float (const char *p, int len, DOUBLEST *d, const char **suffix)
 
int parse_c_float (struct gdbarch *gdbarch, const char *p, int len, DOUBLEST *d, struct type **t)
 
static void type_stack_reserve (struct type_stack *stack, int howmuch)
 
static void check_type_stack_depth (void)
 
static void insert_into_type_stack (int slot, union type_stack_elt element)
 
void insert_type (enum type_pieces tp)
 
void push_type (enum type_pieces tp)
 
void push_type_int (int n)
 
void insert_type_address_space (struct parser_state *pstate, char *string)
 
enum type_pieces pop_type (void)
 
int pop_type_int (void)
 
static VEC (type_ptr)
 
static struct type_stackpop_type_stack (void)
 
struct type_stackappend_type_stack (struct type_stack *to, struct type_stack *from)
 
void push_type_stack (struct type_stack *stack)
 
struct type_stackget_type_stack (void)
 
void type_stack_cleanup (void *arg)
 
void push_typelist (VEC(type_ptr)*list)
 
struct typefollow_types (struct type *follow_type)
 
void parser_fprintf (FILE *x, const char *y,...)
 
int operator_check_standard (struct expression *exp, int pos, int(*objfile_func)(struct objfile *objfile, void *data), void *data)
 
static int exp_iterate (struct expression *exp, int(*objfile_func)(struct objfile *objfile, void *data), void *data)
 
static int exp_uses_objfile_iter (struct objfile *exp_objfile, void *objfile_voidp)
 
int exp_uses_objfile (struct expression *exp, struct objfile *objfile)
 
void increase_expout_size (struct parser_state *ps, size_t lenelt)
 

Variables

const struct exp_descriptor exp_descriptor_standard
 
const struct blockexpression_context_block
 
CORE_ADDR expression_context_pc
 
const struct blockinnermost_block
 
int arglist_len
 
static struct type_stack type_stack
 
const char * lexptr
 
const char * prev_lexptr
 
int paren_depth
 
int comma_terminates
 
int parse_completion
 
static int expout_last_struct = -1
 
static enum type_code expout_tag_completion_type = TYPE_CODE_UNDEF
 
static char * expout_completion_name
 
static unsigned int expressiondebug = 0
 
int parser_debug
 
static struct funcallfuncall_chain
 

Function Documentation

void _initialize_parse ( void  )
struct type_stack* append_type_stack ( struct type_stack to,
struct type_stack from 
)

Definition at line 1579 of file parse.c.

References type_stack::depth, type_stack::elements, to, and type_stack_reserve().

Referenced by yyparse().

static void check_type_stack_depth ( void  )
static
char* copy_name ( struct stoken  token)
int end_arglist ( void  )

Definition at line 156 of file parse.c.

References arglist_len, funcall::arglist_len, funcall_chain, funcall::next, and xfree().

Referenced by yyparse().

static int exp_iterate ( struct expression exp,
int(*)(struct objfile *objfile, void *data)  objfile_func,
void *  data 
)
static
int exp_uses_objfile ( struct expression exp,
struct objfile objfile 
)
static int exp_uses_objfile_iter ( struct objfile exp_objfile,
void *  objfile_voidp 
)
static

Definition at line 1897 of file parse.c.

References objfile::separate_debug_objfile_backlink.

Referenced by exp_uses_objfile().

const char* find_template_name_end ( const char *  p)

Definition at line 712 of file parse.c.

Referenced by lex_one_token().

struct type* follow_types ( struct type follow_type)
static void free_funcalls ( void *  ignore)
static

Definition at line 171 of file parse.c.

References funcall::next, and xfree().

Referenced by parse_exp_in_context_1().

struct type_stack* get_type_stack ( void  )

Definition at line 1605 of file parse.c.

References type_stack::depth, type_stack::elements, type_stack::size, and type_stack.

Referenced by yyparse().

void increase_expout_size ( struct parser_state ps,
size_t  lenelt 
)
void initialize_expout ( struct parser_state ps,
size_t  initial_size,
const struct language_defn lang,
struct gdbarch gdbarch 
)
static void insert_into_type_stack ( int  slot,
union type_stack_elt  element 
)
static
void insert_type ( enum type_pieces  tp)
void insert_type_address_space ( struct parser_state pstate,
char *  string 
)
int length_of_subexp ( struct expression expr,
int  endpos 
)

Definition at line 829 of file parse.c.

References length_of_subexp(), and operator_length().

Referenced by copy_exp(), length_of_subexp(), prefixify_subexp(), and yyparse().

void mark_completion_tag ( enum type_code  tag,
const char *  ptr,
int  length 
)
void mark_struct_expression ( struct parser_state ps)
void null_post_parser ( struct expression **  exp,
int  void_context_p 
)

Definition at line 1358 of file parse.c.

int operator_check_standard ( struct expression exp,
int  pos,
int(*)(struct objfile *objfile, void *data)  objfile_func,
void *  data 
)
void operator_length ( const struct expression expr,
int  endpos,
int oplenp,
int argsp 
)
void operator_length_standard ( const struct expression expr,
int  endpos,
int oplenp,
int argsp 
)
int parse_c_float ( struct gdbarch gdbarch,
const char *  p,
int  len,
DOUBLEST d,
struct type **  t 
)
struct expression* parse_exp_1 ( const char **  stringptr,
CORE_ADDR  pc,
const struct block block,
int  comma 
)
static struct expression * parse_exp_in_context ( const char **  stringptr,
CORE_ADDR  pc,
const struct block block,
int  comma,
int  void_context_p,
int out_subexp 
)
static

Definition at line 1116 of file parse.c.

References parse_exp_in_context_1().

Referenced by parse_exp_1(), and parse_expression_for_completion().

static struct expression * parse_exp_in_context_1 ( const char **  stringptr,
CORE_ADDR  pc,
const struct block block,
int  comma,
int  void_context_p,
int out_subexp 
)
static
struct expression* parse_expression ( const char *  string)
struct type* parse_expression_for_completion ( const char *  string,
char **  name,
enum type_code code 
)
struct expression* parse_expression_with_language ( const char *  string,
enum language  lang 
)
int parse_float ( const char *  p,
int  len,
DOUBLEST d,
const char **  suffix 
)

Definition at line 1370 of file parse.c.

References DOUBLEST_SCAN_FORMAT, len, xfree(), and xmalloc().

Referenced by parse_c_float(), and parse_number().

void parser_fprintf ( FILE *  x,
const char *  y,
  ... 
)

Definition at line 1764 of file parse.c.

References fprintf_unfiltered(), gdb_stderr, and vfprintf_unfiltered().

enum type_pieces pop_type ( void  )

Definition at line 1541 of file parse.c.

References type_stack::depth, type_stack::elements, type_stack_elt::piece, and tp_end.

Referenced by follow_types(), and yyparse().

int pop_type_int ( void  )

Definition at line 1549 of file parse.c.

References type_stack::depth, type_stack::elements, and type_stack_elt::int_val.

Referenced by follow_types(), and yyparse().

static struct type_stack* pop_type_stack ( void  )
static

Definition at line 1569 of file parse.c.

References type_stack::depth, type_stack::elements, gdb_assert, and type_stack_elt::stack_val.

Referenced by follow_types().

int prefixify_expression ( struct expression expr)
static int prefixify_subexp ( struct expression inexpr,
struct expression outexpr,
int  inend,
int  outbeg 
)
static
void push_type ( enum type_pieces  tp)
void push_type_int ( int  n)

Definition at line 1505 of file parse.c.

References check_type_stack_depth(), type_stack::depth, type_stack::elements, and type_stack_elt::int_val.

Referenced by yyparse().

void push_type_stack ( struct type_stack stack)
void push_typelist ( VEC(type_ptr)*  list)
void reallocate_expout ( struct parser_state ps)
static void show_expressiondebug ( struct ui_file file,
int  from_tty,
struct cmd_list_element c,
const char *  value 
)
static

Definition at line 94 of file parse.c.

References _, and fprintf_filtered().

Referenced by _initialize_parse().

static void show_parserdebug ( struct ui_file file,
int  from_tty,
struct cmd_list_element c,
const char *  value 
)
static

Definition at line 105 of file parse.c.

References _, and fprintf_filtered().

Referenced by _initialize_parse().

void start_arglist ( void  )

Definition at line 141 of file parse.c.

References arglist_len, funcall::arglist_len, funcall_chain, funcall::next, and xmalloc().

Referenced by yyparse().

void type_stack_cleanup ( void *  arg)

Definition at line 1620 of file parse.c.

References type_stack::elements, and xfree().

Referenced by yyparse().

static void type_stack_reserve ( struct type_stack stack,
int  howmuch 
)
static
static VEC ( type_ptr  )
static

Definition at line 1559 of file parse.c.

References type_stack::depth, type_stack::elements, and gdb_assert.

Referenced by follow_types().

void write_dollar_variable ( struct parser_state ps,
struct stoken  str 
)
void write_exp_bitstring ( struct parser_state ps,
struct stoken  str 
)
static void write_exp_elt ( struct parser_state ps,
const union exp_element expelt 
)
static
void write_exp_elt_block ( struct parser_state ps,
const struct block b 
)
void write_exp_elt_dblcst ( struct parser_state ps,
DOUBLEST  expelt 
)

Definition at line 286 of file parse.c.

References exp_element::doubleconst, and write_exp_elt().

Referenced by yyparse().

void write_exp_elt_decfloatcst ( struct parser_state ps,
gdb_byte  expelt[16] 
)

Definition at line 296 of file parse.c.

References exp_element::decfloatconst, and write_exp_elt().

Referenced by yyparse().

void write_exp_elt_intern ( struct parser_state ps,
struct internalvar expelt 
)

Definition at line 318 of file parse.c.

References exp_element::internalvar, and write_exp_elt().

Referenced by write_dollar_variable().

void write_exp_elt_longcst ( struct parser_state ps,
LONGEST  expelt 
)
void write_exp_elt_objfile ( struct parser_state ps,
struct objfile objfile 
)

Definition at line 266 of file parse.c.

References exp_element::objfile, and write_exp_elt().

Referenced by write_exp_msymbol().

void write_exp_elt_opcode ( struct parser_state ps,
enum exp_opcode  expelt 
)
void write_exp_elt_sym ( struct parser_state ps,
struct symbol expelt 
)
void write_exp_elt_type ( struct parser_state ps,
struct type expelt 
)
void write_exp_msymbol ( struct parser_state ps,
struct bound_minimal_symbol  bound_msym 
)
void write_exp_string ( struct parser_state ps,
struct stoken  str 
)
void write_exp_string_vector ( struct parser_state ps,
int  type,
struct stoken_vector vec 
)

Variable Documentation

int arglist_len

Definition at line 70 of file parse.c.

Referenced by end_arglist(), start_arglist(), and yyparse().

int comma_terminates

Definition at line 75 of file parse.c.

Referenced by lex_one_token(), parse_exp_in_context_1(), and yylex().

const struct exp_descriptor exp_descriptor_standard
Initial value:
=
{
}
int dump_subexp_body_standard(struct expression *exp, struct ui_file *stream, int elt)
Definition: expprint.c:762
char * op_name_standard(enum exp_opcode opcode)
Definition: expprint.c:662
void print_subexp_standard(struct expression *exp, int *pos, struct ui_file *stream, enum precedence prec)
Definition: expprint.c:58
int operator_check_standard(struct expression *exp, int pos, int(*objfile_func)(struct objfile *objfile, void *data), void *data)
Definition: parse.c:1782
struct value * evaluate_subexp_standard(struct type *expect_type, struct expression *exp, int *pos, enum noside noside)
Definition: eval.c:699
void operator_length_standard(const struct expression *expr, int endpos, int *oplenp, int *argsp)
Definition: parse.c:859

Definition at line 56 of file parse.c.

char* expout_completion_name
static
int expout_last_struct = -1
static
enum type_code expout_tag_completion_type = TYPE_CODE_UNDEF
static
const struct block* expression_context_block
CORE_ADDR expression_context_pc

Definition at line 68 of file parse.c.

Referenced by c_parse(), and parse_exp_in_context_1().

unsigned int expressiondebug = 0
static

Definition at line 92 of file parse.c.

Referenced by _initialize_parse(), and parse_exp_in_context_1().

struct funcall* funcall_chain
static

Definition at line 135 of file parse.c.

Referenced by end_arglist(), and start_arglist().

const struct block* innermost_block
const char* lexptr

Definition at line 72 of file parse.c.

Referenced by parse_exp_in_context_1().

int paren_depth

Definition at line 74 of file parse.c.

Referenced by lex_one_token(), parse_exp_in_context_1(), and yylex().

int parse_completion
int parser_debug

Definition at line 102 of file parse.c.

Referenced by _initialize_parse(), c_parse(), d_parse(), and go_parse().

const char* prev_lexptr

Definition at line 73 of file parse.c.

Referenced by parse_exp_in_context_1().

struct type_stack type_stack
static

Definition at line 71 of file parse.c.

Referenced by follow_types(), and get_type_stack().