52#include "gdbsupport/gdb_optional.h"
76 (
const char **, CORE_ADDR,
77 const struct block *,
int,
79 std::unique_ptr<expr_completion_base> *);
85 innermost_block_tracker_types t)
102 CORE_ADDR *address_p)
108 bool is_tls = (section != NULL
143 if (address_p != NULL)
148 if (address_p != NULL)
202 gdb_assert (tag == TYPE_CODE_UNION
203 || tag == TYPE_CODE_STRUCT
204 || tag == TYPE_CODE_ENUM);
214 std::vector<std::string> data (vec->
len);
215 for (
int i = 0; i < vec->
len; ++i)
227 if (sym.
symbol !=
nullptr)
231 push_new<expr::var_value_operation> (sym);
236 if (msymbol.
minsym != NULL)
237 push_new<expr::var_msym_value_operation> (msymbol);
239 error (_(
"No symbol table is loaded. Use the \"file\" command."));
241 error (_(
"No symbol \"%s\" in current context."),
name);
262 if (str.
length >= 2 && str.
ptr[1] ==
'$')
274 for (; i < str.
length; i++)
275 if (!(str.
ptr[i] >=
'0' && str.
ptr[i] <=
'9'))
279 i = atoi (str.
ptr + 1 + negate);
290 goto handle_register;
298 push_new<expr::internalvar_operation> (isym);
308 push_new<expr::var_value_operation> (sym);
314 push_new<expr::var_msym_value_operation> (msym);
320 push_new<expr::internalvar_operation>
324 push_new<expr::last_operation> (i);
329 push_new<expr::register_operation> (
copy_name (str));
341 int just_seen_right = 0;
342 int just_seen_colon = 0;
343 int just_seen_space = 0;
345 if (!p || (*p !=
'<'))
360 if (just_seen_colon || just_seen_right || just_seen_space)
364 if (just_seen_colon || just_seen_right)
371 if (just_seen_space || (just_seen_colon > 1))
378 if (!((*p >=
'a' && *p <=
'z') ||
379 (*p >=
'A' && *p <=
'Z') ||
380 (*p >=
'0' && *p <=
'9') ||
381 (*p ==
'_') || (*p ==
',') ||
382 (*p ==
'&') || (*p ==
'*') ||
383 (*p ==
'(') || (*p ==
')') ||
384 (*p ==
'[') || (*p ==
']')))
437 int comma,
bool void_context_p,
439 std::unique_ptr<expr_completion_base> *completer)
443 if (*stringptr == 0 || **stringptr == 0)
446 const struct block *expression_context_block =
block;
447 CORE_ADDR expression_context_pc = 0;
450 if (tracker ==
nullptr)
451 tracker = &local_tracker;
454 if (!expression_context_block)
457 expression_context_pc = expression_context_block->
entry_pc ();
459 expression_context_pc = pc;
463 if (!expression_context_block)
468 expression_context_block
471 if (expression_context_block)
472 expression_context_pc = expression_context_block->
entry_pc ();
507 expression_context_pc, comma, *stringptr,
508 completer !=
nullptr, tracker, void_context_p);
517 catch (
const gdb_exception &except)
527 result->op->set_outermost ();
532 if (completer !=
nullptr)
553 error (_(
"Junk after end of expression."));
563 gdb::optional<scoped_restore_current_language> lang_saver;
566 lang_saver.emplace ();
580 std::unique_ptr<expr_completion_base> *completer)
588 catch (
const gdb_exception_error &except)
595 if (*completer ==
nullptr)
610 const struct type *
type, gdb_byte *data)
619fits_in_type (
int n_sign, ULONGEST n,
int type_bits,
bool type_signed_p)
622 if (n == 0 && n_sign == -1)
625 if (n_sign == -1 && !type_signed_p)
629 if (type_bits >
sizeof (ULONGEST) * 8)
632 ULONGEST smax = (ULONGEST)1 << (type_bits - 1);
638 else if (n_sign == 1 && type_signed_p)
643 else if (n_sign == 1 && !type_signed_p)
646 return ((n >> 1) >> (type_bits - 1)) == 0;
649 gdb_assert_not_reached (
"");
688 _(
"Set expression debugging."),
689 _(
"Show expression debugging."),
690 _(
"When non-zero, the internal representation "
691 "of expressions will be printed."),
697 _(
"Set parser debugging."),
698 _(
"Show parser debugging."),
699 _(
"When non-zero, expression parser "
700 "tracing will be enabled."),
struct gdbarch * get_current_arch(void)
bool contained_in(const struct block *a, const struct block *b, bool allow_nested)
struct symbol * block_linkage_function(const struct block *bl)
innermost_block_tracker_types m_types
void update(const struct block *b, innermost_block_tracker_types t)
const struct block * m_innermost_block
void error_no_arg(const char *why)
struct cmd_list_element * showdebuglist
struct cmd_list_element * setdebuglist
set_show_commands add_setshow_boolean_cmd(const char *name, enum command_class theclass, bool *var, const char *set_doc, const char *show_doc, const char *help_doc, cmd_func_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
set_show_commands add_setshow_zuinteger_cmd(const char *name, enum command_class theclass, unsigned int *var, const char *set_doc, const char *show_doc, const char *help_doc, cmd_func_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
std::unique_ptr< expression > expression_up
@ INNERMOST_BLOCK_FOR_REGISTERS
int symbol_read_needs_frame(struct symbol *sym)
const struct block * get_selected_block(CORE_ADDR *addr_in_block)
const struct language_defn * language_def(enum language lang)
const struct language_defn * current_language
enum language set_language(enum language lang)
struct bound_minimal_symbol lookup_bound_minimal_symbol(const char *name)
bool msymbol_is_function(struct objfile *objfile, minimal_symbol *minsym, CORE_ADDR *func_address_p)
int have_partial_symbols(void)
int have_full_symbols(void)
bool parse_float(const char *p, int len, const struct type *type, gdb_byte *data)
bool fits_in_type(int n_sign, ULONGEST n, int type_bits, bool type_signed_p)
expression_up parse_expression_with_language(const char *string, enum language lang)
std::string copy_name(struct stoken token)
static unsigned int expressiondebug
void parser_fprintf(FILE *x, const char *y,...)
expression_up parse_expression(const char *string, innermost_block_tracker *tracker, bool void_context_p)
expression_up parse_expression_for_completion(const char *string, std::unique_ptr< expr_completion_base > *completer)
static expression_up parse_exp_in_context(const char **, CORE_ADDR, const struct block *, int, bool, innermost_block_tracker *, std::unique_ptr< expr_completion_base > *)
expression_up parse_exp_1(const char **stringptr, CORE_ADDR pc, const struct block *block, int comma, innermost_block_tracker *tracker)
static void show_expressiondebug(struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
type * find_minsym_type_and_address(minimal_symbol *msymbol, struct objfile *objfile, CORE_ADDR *address_p)
static void show_parserdebug(struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
const char * find_template_name_end(const char *p)
bool exp_uses_objfile(struct expression *exp, struct objfile *objfile)
std::string copy_name(struct stoken)
void(* func)(remote_target *remote, char *)
struct symtab_and_line get_current_source_symtab_and_line(void)
CORE_ADDR entry_pc() const
struct block * static_block()
CORE_ADDR value_address() const
struct minimal_symbol * minsym
struct blockvector * blockvector()
ATTRIBUTE_UNUSED_RESULT expression_up release()
gdb::unique_xmalloc_ptr< char > m_name
bool complete(struct expression *exp, completion_tracker &tracker) override
struct obj_section * obj_section(const struct objfile *objfile) const
enum language la_language
virtual int parser(struct parser_state *ps) const
CORE_ADDR value_raw_address() const
minimal_symbol_type type() const
struct bfd_section * the_bfd_section
struct type * nodebug_unknown_symbol
struct type * nodebug_tls_symbol
struct type * nodebug_got_plt_symbol
struct type * nodebug_text_gnu_ifunc_symbol
struct type * nodebug_text_symbol
struct type * nodebug_data_symbol
struct objfile * separate_debug_objfile_backlink
const struct block *const expression_context_block
std::unique_ptr< expr_completion_base > m_completion_state
void push_dollar(struct stoken str)
void push_symbol(const char *name, block_symbol sym)
innermost_block_tracker * block_tracker
void mark_completion_tag(enum type_code tag, const char *ptr, int length)
void push_c_string(int, struct stoken_vector *vec)
void mark_struct_expression(expr::structop_base_operation *op)
struct typed_stoken * tokens
struct compunit_symtab * compunit() const
enum overlay_debugging_state overlay_debugging
CORE_ADDR symbol_overlayed_address(CORE_ADDR address, struct obj_section *section)
void collect_symbol_completion_matches_type(completion_tracker &tracker, const char *text, const char *word, enum type_code code)
struct block_symbol lookup_symbol(const char *name, const struct block *block, domain_enum domain, struct field_of_this_result *is_a_field_of_this)
bool target_float_from_string(gdb_byte *addr, const struct type *type, const std::string &string)
CORE_ADDR target_translate_tls_address(struct objfile *objfile, CORE_ADDR offset)
int user_reg_map_name_to_regnum(struct gdbarch *gdbarch, const char *name, int len)
void gdb_vprintf(struct ui_file *stream, const char *format, va_list args)
void gdb_printf(struct ui_file *stream, const char *format,...)
struct internalvar * create_internalvar(const char *name)
struct internalvar * lookup_only_internalvar(const char *name)