GDB (xrefs)
Classes | Defines | Typedefs | Enumerations | Functions | Variables
/home/stan/gdb/src/gdb/linespec.c File Reference
#include "defs.h"
#include "symtab.h"
#include "frame.h"
#include "command.h"
#include "symfile.h"
#include "objfiles.h"
#include "source.h"
#include "demangle.h"
#include "value.h"
#include "completer.h"
#include "cp-abi.h"
#include "cp-support.h"
#include "parser-defs.h"
#include "block.h"
#include "objc-lang.h"
#include "linespec.h"
#include "exceptions.h"
#include "language.h"
#include "interps.h"
#include "mi/mi-cmds.h"
#include "target.h"
#include "arch-utils.h"
#include <ctype.h>
#include "cli/cli-utils.h"
#include "filenames.h"
#include "ada-lang.h"
#include "stack.h"

Go to the source code of this file.

Classes

struct  address_entry
struct  line_offset
struct  linespec
struct  linespec_canonical_name
struct  linespec_state
struct  collect_info
struct  ls_token
struct  ls_parser
struct  symbol_and_data_callback
struct  symbol_matcher_data
struct  decode_line_2_item
struct  decode_compound_collector
struct  symtab_collector
struct  collect_minsyms

Defines

#define LS_TOKEN_STOKEN(TOK)   (TOK).data.string
#define LS_TOKEN_KEYWORD(TOK)   (TOK).data.keyword
#define PARSER_STREAM(P)   (*(P)->lexer.stream)
#define PARSER_STATE(PPTR)   (&(PPTR)->state)
#define PARSER_RESULT(PPTR)   (&(PPTR)->result)

Typedefs

typedef struct symbolsymbolp
typedef struct typetypep
typedef struct bound_minimal_symbol bound_minimal_symbol_d
typedef struct linespeclinespec_p
typedef enum ls_token_type linespec_token_type
typedef struct ls_token linespec_token
typedef struct ls_parser linespec_parser

Enumerations

enum  offset_relative_sign { LINE_OFFSET_NONE, LINE_OFFSET_PLUS, LINE_OFFSET_MINUS, LINE_OFFSET_UNKNOWN }
enum  ls_token_type {
  LSTOKEN_KEYWORD = 0, LSTOKEN_COLON, LSTOKEN_STRING, LSTOKEN_NUMBER,
  LSTOKEN_COMMA, LSTOKEN_EOI, LSTOKEN_CONSUMED
}

Functions

 DEF_VEC_P (symbolp)
 DEF_VEC_P (typep)
 DEF_VEC_O (bound_minimal_symbol_d)
static void iterate_over_file_blocks (struct symtab *symtab, const char *name, domain_enum domain, symbol_found_callback_ftype *callback, void *data)
static void initialize_defaults (struct symtab **default_symtab, int *default_line)
static CORE_ADDR linespec_expression_to_pc (const char **exp_ptr)
static struct symtabs_and_lines decode_objc (struct linespec_state *self, linespec_p ls, const char **argptr)
static VEC (static VEC()*collect_symtabs_from_filename(const char *file) symtab_ptr)
static const char * linespec_lexer_lex_keyword (const char *p)
static int is_ada_operator (const char *string)
static const char * skip_quote_char (const char *string, char quote_char)
static char * copy_token_string (linespec_token token)
static int is_closing_quote_enclosed (const char *p)
static const char * find_parameter_list_end (const char *input)
static linespec_token linespec_lexer_lex_string (linespec_parser *parser)
static linespec_token linespec_lexer_lex_one (linespec_parser *parser)
static linespec_token linespec_lexer_consume_token (linespec_parser *parser)
static linespec_token linespec_lexer_peek_token (linespec_parser *parser)
static void add_sal_to_sals_basic (struct symtabs_and_lines *sals, struct symtab_and_line *sal)
static void add_sal_to_sals (struct linespec_state *self, struct symtabs_and_lines *sals, struct symtab_and_line *sal, const char *symname, int literal_canonical)
static hashval_t hash_address_entry (const void *p)
static int eq_address_entry (const void *a, const void *b)
static int maybe_add_address (htab_t set, struct program_space *pspace, CORE_ADDR addr)
static int iterate_inline_only (struct symbol *sym, void *d)
static int iterate_name_matcher (const char *name, void *d)
static void iterate_over_all_matching_symtabs (struct linespec_state *state, const char *name, const domain_enum domain, symbol_found_callback_ftype *callback, void *data, struct program_space *search_pspace, int include_inline)
static struct blockget_current_search_block (void)
static void find_methods (struct type *t, const char *name, VEC(const_char_ptr)**result_names, VEC(typep)**superclasses)
static const char * find_toplevel_char (const char *s, char c)
static const char * find_toplevel_string (const char *haystack, const char *needle)
static char * canonical_to_fullform (const struct linespec_canonical_name *canonical)
static void filter_results (struct linespec_state *self, struct symtabs_and_lines *result, VEC(const_char_ptr)*filters)
static void convert_results_to_lsals (struct linespec_state *self, struct symtabs_and_lines *result)
static int decode_line_2_compare_items (const void *ap, const void *bp)
static void decode_line_2 (struct linespec_state *self, struct symtabs_and_lines *result, const char *select_mode)
static void ATTRIBUTE_NORETURN symbol_not_found_error (const char *symbol, const char *filename)
static void ATTRIBUTE_NORETURN unexpected_linespec_error (linespec_parser *parser)
static struct line_offset linespec_parse_line_offset (const char *string)
static void linespec_parse_basic (linespec_parser *parser)
static void canonicalize_linespec (struct linespec_state *state, linespec_p ls)
static struct symtabs_and_lines create_sals_line_offset (struct linespec_state *self, linespec_p ls)
static struct symtabs_and_lines convert_linespec_to_sals (struct linespec_state *state, linespec_p ls)
static struct symtabs_and_lines parse_linespec (linespec_parser *parser, const char **argptr)
static void linespec_state_constructor (struct linespec_state *self, int flags, const struct language_defn *language, struct symtab *default_symtab, int default_line, struct linespec_result *canonical)
static void linespec_parser_new (linespec_parser *parser, int flags, const struct language_defn *language, struct symtab *default_symtab, int default_line, struct linespec_result *canonical)
static void linespec_state_destructor (struct linespec_state *self)
static void linespec_parser_delete (void *arg)
void decode_line_full (char **argptr, int flags, struct symtab *default_symtab, int default_line, struct linespec_result *canonical, const char *select_mode, const char *filter)
struct symtabs_and_lines decode_line_1 (char **argptr, int flags, struct symtab *default_symtab, int default_line)
struct symtabs_and_lines decode_line_with_current_source (char *string, int flags)
struct symtabs_and_lines decode_line_with_last_displayed (char *string, int flags)
static int collect_one_symbol (struct symbol *sym, void *d)
static VEC (symbolp)
static int compare_symbols (const void *a, const void *b)
static int compare_msymbols (const void *a, const void *b)
static void add_all_symbol_names_from_pspace (struct collect_info *info, struct program_space *pspace, VEC(const_char_ptr)*names)
static void find_superclass_methods (VEC(typep)*superclasses, const char *name, VEC(const_char_ptr)**result_names)
static void find_method (struct linespec_state *self, VEC(symtab_ptr)*file_symtabs, const char *class_name, const char *method_name, VEC(symbolp)*sym_classes, VEC(symbolp)**symbols, VEC(bound_minimal_symbol_d)**minsyms)
static int add_symtabs_to_list (struct symtab *symtab, void *d)
static VEC (symtab_ptr)
static void find_function_symbols (struct linespec_state *state, VEC(symtab_ptr)*file_symtabs, const char *name, VEC(symbolp)**symbols, VEC(bound_minimal_symbol_d)**minsyms)
static void find_linespec_symbols (struct linespec_state *state, VEC(symtab_ptr)*file_symtabs, const char *name, VEC(symbolp)**symbols, VEC(bound_minimal_symbol_d)**minsyms)
static void decode_digits_list_mode (struct linespec_state *self, linespec_p ls, struct symtabs_and_lines *values, struct symtab_and_line val)
static void decode_digits_ordinary (struct linespec_state *self, linespec_p ls, int line, struct symtabs_and_lines *sals, struct linetable_entry **best_entry)
static struct line_offset linespec_parse_variable (struct linespec_state *self, const char *variable)
static int collect_symbols (struct symbol *sym, void *data)
static void minsym_found (struct linespec_state *self, struct objfile *objfile, struct minimal_symbol *msymbol, struct symtabs_and_lines *result)
static int classify_mtype (enum minimal_symbol_type t)
static int compare_msyms (const void *a, const void *b)
static void add_minsym (struct minimal_symbol *minsym, void *d)
static void search_minsyms_for_name (struct collect_info *info, const char *name, struct program_space *search_pspace)
static void add_matching_symbols_to_info (const char *name, struct collect_info *info, struct program_space *pspace)
static int symbol_to_sal (struct symtab_and_line *result, int funfirstline, struct symbol *sym)
void init_linespec_result (struct linespec_result *lr)
void destroy_linespec_result (struct linespec_result *ls)
static void cleanup_linespec_result (void *a)
struct cleanupmake_cleanup_destroy_linespec_result (struct linespec_result *ls)

Variables

static const char *const linespec_keywords [] = { "if", "thread", "task" }

Define Documentation

#define LS_TOKEN_KEYWORD (   TOK)    (TOK).data.keyword

Definition at line 271 of file linespec.c.

Referenced by copy_token_string(), and linespec_lexer_lex_one().

#define LS_TOKEN_STOKEN (   TOK)    (TOK).data.string
#define PARSER_RESULT (   PPTR)    (&(PPTR)->result)
#define PARSER_STATE (   PPTR)    (&(PPTR)->state)
#define PARSER_STREAM (   P)    (*(P)->lexer.stream)

Typedef Documentation

Definition at line 64 of file linespec.c.

typedef struct linespec* linespec_p

Definition at line 148 of file linespec.c.

typedef struct ls_parser linespec_parser

Definition at line 307 of file linespec.c.

typedef struct ls_token linespec_token

Definition at line 268 of file linespec.c.

Definition at line 245 of file linespec.c.

typedef struct symbol* symbolp

Definition at line 48 of file linespec.c.

typedef struct type* typep

Definition at line 51 of file linespec.c.


Enumeration Type Documentation

Enumerator:
LSTOKEN_KEYWORD 
LSTOKEN_COLON 
LSTOKEN_STRING 
LSTOKEN_NUMBER 
LSTOKEN_COMMA 
LSTOKEN_EOI 
LSTOKEN_CONSUMED 

Definition at line 222 of file linespec.c.

Enumerator:
LINE_OFFSET_NONE 
LINE_OFFSET_PLUS 
LINE_OFFSET_MINUS 
LINE_OFFSET_UNKNOWN 

Definition at line 69 of file linespec.c.


Function Documentation

static void add_all_symbol_names_from_pspace ( struct collect_info info,
struct program_space pspace,
VEC(const_char_ptr)*  names 
) [static]

Definition at line 2826 of file linespec.c.

References add_matching_symbols_to_info(), and VEC_iterate.

Referenced by decode_objc(), find_function_symbols(), and find_method().

static void add_matching_symbols_to_info ( const char *  name,
struct collect_info info,
struct program_space pspace 
) [static]
static void add_minsym ( struct minimal_symbol minsym,
void *  d 
) [static]
static void add_sal_to_sals ( struct linespec_state self,
struct symtabs_and_lines sals,
struct symtab_and_line sal,
const char *  symname,
int  literal_canonical 
) [static]
static void add_sal_to_sals_basic ( struct symtabs_and_lines sals,
struct symtab_and_line sal 
) [static]
static int add_symtabs_to_list ( struct symtab symtab,
void *  d 
) [static]

Definition at line 2977 of file linespec.c.

References VEC_safe_push.

Referenced by VEC().

static char* canonical_to_fullform ( const struct linespec_canonical_name canonical) [static]
static void canonicalize_linespec ( struct linespec_state state,
linespec_p  ls 
) [static]
static int classify_mtype ( enum minimal_symbol_type  t) [static]

Definition at line 3459 of file linespec.c.

References mst_file_bss, mst_file_data, mst_file_text, and mst_solib_trampoline.

Referenced by compare_msyms(), and search_minsyms_for_name().

static void cleanup_linespec_result ( void *  a) [static]

Definition at line 3703 of file linespec.c.

References destroy_linespec_result().

Referenced by make_cleanup_destroy_linespec_result().

static int collect_one_symbol ( struct symbol sym,
void *  d 
) [static]
static int collect_symbols ( struct symbol sym,
void *  data 
) [static]
static int compare_msymbols ( const void *  a,
const void *  b 
) [static]
static int compare_msyms ( const void *  a,
const void *  b 
) [static]

Definition at line 3482 of file linespec.c.

References classify_mtype(), bound_minimal_symbol::minsym, and MSYMBOL_TYPE.

Referenced by search_minsyms_for_name().

static int compare_symbols ( const void *  a,
const void *  b 
) [static]

Definition at line 2767 of file linespec.c.

References SYMBOL_SYMTAB, and SYMTAB_PSPACE.

Referenced by convert_linespec_to_sals(), and find_method().

static struct symtabs_and_lines convert_linespec_to_sals ( struct linespec_state state,
linespec_p  ls 
) [static, read]
static void convert_results_to_lsals ( struct linespec_state self,
struct symtabs_and_lines result 
) [static]

Definition at line 1285 of file linespec.c.

References linespec_sals::canonical, linespec_sals::sals, and VEC_safe_push.

Referenced by decode_line_2(), and decode_line_full().

static char* copy_token_string ( linespec_token  token) [static]
static struct symtabs_and_lines create_sals_line_offset ( struct linespec_state self,
linespec_p  ls 
) [static, read]
static void decode_digits_list_mode ( struct linespec_state self,
linespec_p  ls,
struct symtabs_and_lines values,
struct symtab_and_line  val 
) [static]
static void decode_digits_ordinary ( struct linespec_state self,
linespec_p  ls,
int  line,
struct symtabs_and_lines sals,
struct linetable_entry **  best_entry 
) [static]
struct symtabs_and_lines decode_line_1 ( char **  argptr,
int  flags,
struct symtab default_symtab,
int  default_line 
) [read]
static void decode_line_2 ( struct linespec_state self,
struct symtabs_and_lines result,
const char *  select_mode 
) [static]
static int decode_line_2_compare_items ( const void *  ap,
const void *  bp 
) [static]

Definition at line 1320 of file linespec.c.

References decode_line_2_item::displayform, and decode_line_2_item::fullform.

Referenced by decode_line_2().

void decode_line_full ( char **  argptr,
int  flags,
struct symtab default_symtab,
int  default_line,
struct linespec_result canonical,
const char *  select_mode,
const char *  filter 
)
struct symtabs_and_lines decode_line_with_current_source ( char *  string,
int  flags 
) [read]
struct symtabs_and_lines decode_line_with_last_displayed ( char *  string,
int  flags 
) [read]
static struct symtabs_and_lines decode_objc ( struct linespec_state self,
linespec_p  ls,
const char **  argptr 
) [static, read]
static int eq_address_entry ( const void *  a,
const void *  b 
) [static]

Definition at line 909 of file linespec.c.

References address_entry::addr, and address_entry::pspace.

Referenced by linespec_state_constructor().

static void filter_results ( struct linespec_state self,
struct symtabs_and_lines result,
VEC(const_char_ptr)*  filters 
) [static]
static void find_function_symbols ( struct linespec_state state,
VEC(symtab_ptr)*  file_symtabs,
const char *  name,
VEC(symbolp)**  symbols,
VEC(bound_minimal_symbol_d)**  minsyms 
) [static]
static void find_linespec_symbols ( struct linespec_state state,
VEC(symtab_ptr)*  file_symtabs,
const char *  name,
VEC(symbolp)**  symbols,
VEC(bound_minimal_symbol_d)**  minsyms 
) [static]
static void find_method ( struct linespec_state self,
VEC(symtab_ptr)*  file_symtabs,
const char *  class_name,
const char *  method_name,
VEC(symbolp)*  sym_classes,
VEC(symbolp)**  symbols,
VEC(bound_minimal_symbol_d)**  minsyms 
) [static]
static void find_methods ( struct type t,
const char *  name,
VEC(const_char_ptr)**  result_names,
VEC(typep)**  superclasses 
) [static]
static const char* find_parameter_list_end ( const char *  input) [static]

Definition at line 519 of file linespec.c.

References p.

Referenced by linespec_lexer_lex_string().

static void find_superclass_methods ( VEC(typep)*  superclasses,
const char *  name,
VEC(const_char_ptr)**  result_names 
) [static]
static const char* find_toplevel_char ( const char *  s,
char  c 
) [static]

Definition at line 1165 of file linespec.c.

References scan().

Referenced by find_toplevel_string(), and skip_quote_char().

static const char* find_toplevel_string ( const char *  haystack,
const char *  needle 
) [static]

Definition at line 1200 of file linespec.c.

References find_toplevel_char().

Referenced by find_linespec_symbols().

static struct block* get_current_search_block ( void  ) [static, read]
static hashval_t hash_address_entry ( const void *  p) [static]

Definition at line 897 of file linespec.c.

References address_entry::addr, hash(), and address_entry::pspace.

Referenced by linespec_state_constructor().

void init_linespec_result ( struct linespec_result lr)

Definition at line 3678 of file linespec.c.

References memset().

Referenced by agent_command_1(), break_range_command(), create_breakpoint(), and decode_linespec_default().

static void initialize_defaults ( struct symtab **  default_symtab,
int default_line 
) [static]
static int is_ada_operator ( const char *  string) [static]
static int is_closing_quote_enclosed ( const char *  p) [static]
static int iterate_inline_only ( struct symbol sym,
void *  d 
) [static]
static int iterate_name_matcher ( const char *  name,
void *  d 
) [static]
static void iterate_over_all_matching_symtabs ( struct linespec_state state,
const char *  name,
const domain_enum  domain,
symbol_found_callback_ftype callback,
void *  data,
struct program_space search_pspace,
int  include_inline 
) [static]
static void iterate_over_file_blocks ( struct symtab symtab,
const char *  name,
domain_enum  domain,
symbol_found_callback_ftype callback,
void *  data 
) [static]
static CORE_ADDR linespec_expression_to_pc ( const char **  exp_ptr) [static]
static const char* linespec_lexer_lex_keyword ( const char *  p) [static]

Definition at line 426 of file linespec.c.

References len, and linespec_keywords.

Referenced by is_closing_quote_enclosed(), linespec_lexer_lex_one(), and linespec_lexer_lex_string().

static linespec_token linespec_lexer_lex_one ( linespec_parser parser) [static]
static void linespec_parse_basic ( linespec_parser parser) [static]
static struct line_offset linespec_parse_line_offset ( const char *  string) [static, read]
static struct line_offset linespec_parse_variable ( struct linespec_state self,
const char *  variable 
) [static, read]
static void linespec_parser_delete ( void *  arg) [static]

Definition at line 2388 of file linespec.c.

References linespec_state_destructor(), PARSER_RESULT, PARSER_STATE, VEC_free, and xfree().

Referenced by decode_line_1(), and decode_line_full().

static void linespec_parser_new ( linespec_parser parser,
int  flags,
const struct language_defn language,
struct symtab default_symtab,
int  default_line,
struct linespec_result canonical 
) [static]
static void linespec_state_constructor ( struct linespec_state self,
int  flags,
const struct language_defn language,
struct symtab default_symtab,
int  default_line,
struct linespec_result canonical 
) [static]
static void linespec_state_destructor ( struct linespec_state self) [static]

Definition at line 2380 of file linespec.c.

Referenced by linespec_parser_delete().

Definition at line 3711 of file linespec.c.

References cleanup_linespec_result(), and make_cleanup().

Referenced by agent_command_1(), break_range_command(), and create_breakpoint().

static int maybe_add_address ( htab_t  set,
struct program_space pspace,
CORE_ADDR  addr 
) [static]

Definition at line 922 of file linespec.c.

References address_entry::addr, memcpy(), p, and address_entry::pspace.

Referenced by convert_linespec_to_sals(), and minsym_found().

static void minsym_found ( struct linespec_state self,
struct objfile objfile,
struct minimal_symbol msymbol,
struct symtabs_and_lines result 
) [static]
static struct symtabs_and_lines parse_linespec ( linespec_parser parser,
const char **  argptr 
) [static, read]
static void search_minsyms_for_name ( struct collect_info info,
const char *  name,
struct program_space search_pspace 
) [static]
static const char* skip_quote_char ( const char *  string,
char  quote_char 
) [static]

Definition at line 469 of file linespec.c.

References find_toplevel_char(), and p.

Referenced by linespec_lexer_lex_string(), and parse_linespec().

static void ATTRIBUTE_NORETURN symbol_not_found_error ( const char *  symbol,
const char *  filename 
) [static]
static int symbol_to_sal ( struct symtab_and_line result,
int  funfirstline,
struct symbol sym 
) [static]
static void ATTRIBUTE_NORETURN unexpected_linespec_error ( linespec_parser parser) [static]
static VEC ( static VEC () *collect_symtabs_from_filename (const char *file)  symtab_ptr) [static]

Definition at line 325 of file linespec.c.

static VEC ( symbolp  ) [static]
static VEC ( symtab_ptr  ) [static]

Variable Documentation

const char* const linespec_keywords[] = { "if", "thread", "task" } [static]

Definition at line 249 of file linespec.c.

Referenced by linespec_lexer_lex_keyword().

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines