diff options
-rw-r--r-- | gdb/ChangeLog | 36 | ||||
-rw-r--r-- | gdb/ada-exp.y | 16 | ||||
-rw-r--r-- | gdb/ada-lang.c | 14 | ||||
-rw-r--r-- | gdb/ada-lang.h | 4 | ||||
-rw-r--r-- | gdb/breakpoint.c | 2 | ||||
-rw-r--r-- | gdb/breakpoint.h | 4 | ||||
-rw-r--r-- | gdb/c-exp.y | 4 | ||||
-rw-r--r-- | gdb/expprint.c | 2 | ||||
-rw-r--r-- | gdb/expression.h | 8 | ||||
-rw-r--r-- | gdb/gdbtypes.c | 8 | ||||
-rw-r--r-- | gdb/gdbtypes.h | 2 | ||||
-rw-r--r-- | gdb/go-exp.y | 6 | ||||
-rw-r--r-- | gdb/objc-lang.c | 2 | ||||
-rw-r--r-- | gdb/objc-lang.h | 2 | ||||
-rw-r--r-- | gdb/parse.c | 13 | ||||
-rw-r--r-- | gdb/parser-defs.h | 8 | ||||
-rw-r--r-- | gdb/printcmd.c | 2 | ||||
-rw-r--r-- | gdb/symtab.c | 1 | ||||
-rw-r--r-- | gdb/symtab.h | 6 | ||||
-rw-r--r-- | gdb/valops.c | 2 | ||||
-rw-r--r-- | gdb/value.h | 3 | ||||
-rw-r--r-- | gdb/varobj.c | 2 |
22 files changed, 93 insertions, 54 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 72423fb..5e2a263 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,39 @@ +2012-12-03 Tom Tromey <tromey@redhat.com> + + * ada-exp.y (write_object_renaming, write_var_or_type) + (write_ambiguous_var, write_var_from_sym): Make blocks const. + * ada-lang.c (replace_operator_with_call) + (find_old_style_renaming_symbol): Make blocks const. + * ada-lang.h (ada_find_renaming_symbol): Update. + (struct ada_symbol_info) <block>: Now const. + * breakpoint.c (watch_command_1): Update. + * breakpoint.h (struct watchpoint) <exp_valid_block, + cond_exp_valid_block>: Now const. + * c-exp.y (classify_inner_name, classify_name): Make block + argument const. + * expprint.c (print_subexp_standard) <OP_VAR_VALUE>: Make 'b' + const. + * expression.h (innermost_block, parse_exp_1): Update. + (union exp_element) <block>: Now const. + * gdbtypes.c (lookup_template_type, lookup_enum, lookup_union) + (lookup_struct): Make block argument const. + * gdbtypes.h (lookup_template_type): Update. + * go-exp.y (classify_name, classify_packaged_name) + (package_name_p): Make block argument const. + * objc-lang.c (lookup_struct_typedef): Make block argument const. + * objc-lang.h (lookup_struct_typedef): Update. + * parse.c (parse_exp_in_context, parse_exp_1) + (write_exp_elt_block): Make block arguments const. + (expression_context_block, innermost_block): Now const. + * parser-defs.h (write_exp_elt_block): Update. + (expression_context_block, innermost_block, block_found): Now + const. + * printcmd.c (struct display) <block>: Now const. + * symtab.h (lookup_struct, lookup_union, lookup_enum): Update. + * valops.c (address_of_variable): Make block argument const. + * value.h (value_of_variable): Update. + * varobj.c (struct varobj_root) <valid_block>: Now const. + 2012-11-30 Yao Qi <yao@codesourcery.com> * breakpoint.c (print_one_breakpoint_location): Indent code. diff --git a/gdb/ada-exp.y b/gdb/ada-exp.y index 1a80b0b..57c7d86 100644 --- a/gdb/ada-exp.y +++ b/gdb/ada-exp.y @@ -130,10 +130,10 @@ static struct stoken string_to_operator (struct stoken); static void write_int (LONGEST, struct type *); -static void write_object_renaming (struct block *, const char *, int, +static void write_object_renaming (const struct block *, const char *, int, const char *, int); -static struct type* write_var_or_type (struct block *, struct stoken); +static struct type* write_var_or_type (const struct block *, struct stoken); static void write_name_assoc (struct stoken); @@ -143,7 +143,7 @@ static struct block *block_lookup (struct block *, char *); static LONGEST convert_char_literal (struct type *, LONGEST); -static void write_ambiguous_var (struct block *, char *, int); +static void write_ambiguous_var (const struct block *, char *, int); static struct type *type_int (void); @@ -818,8 +818,8 @@ string_to_operator (struct stoken string) /* Emit expression to access an instance of SYM, in block BLOCK (if * non-NULL), and with :: qualification ORIG_LEFT_CONTEXT. */ static void -write_var_from_sym (struct block *orig_left_context, - struct block *block, +write_var_from_sym (const struct block *orig_left_context, + const struct block *block, struct symbol *sym) { if (orig_left_context == NULL && symbol_read_needs_frame (sym)) @@ -867,7 +867,7 @@ write_exp_op_with_string (enum exp_opcode opcode, struct stoken token) * new encoding entirely (FIXME pnh 7/20/2007). */ static void -write_object_renaming (struct block *orig_left_context, +write_object_renaming (const struct block *orig_left_context, const char *renamed_entity, int renamed_entity_len, const char *renaming_expr, int max_depth) { @@ -1161,7 +1161,7 @@ write_selectors (char *sels) a temporary symbol that is valid until the next call to ada_parse. */ static void -write_ambiguous_var (struct block *block, char *name, int len) +write_ambiguous_var (const struct block *block, char *name, int len) { struct symbol *sym = obstack_alloc (&temp_parse_space, sizeof (struct symbol)); @@ -1253,7 +1253,7 @@ get_symbol_field_type (struct symbol *sym, char *encoded_field_name) identifier). */ static struct type* -write_var_or_type (struct block *block, struct stoken name0) +write_var_or_type (const struct block *block, struct stoken name0) { int depth; char *encoded_name; diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index deefcfb..b03b2a2 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -128,7 +128,7 @@ static struct value *resolve_subexp (struct expression **, int *, int, struct type *); static void replace_operator_with_call (struct expression **, int, int, int, - struct symbol *, struct block *); + struct symbol *, const struct block *); static int possible_user_operator_p (enum exp_opcode, struct value **); @@ -150,7 +150,7 @@ static enum ada_renaming_category parse_old_style_renaming (struct type *, const char **); static struct symbol *find_old_style_renaming_symbol (const char *, - struct block *); + const struct block *); static struct type *ada_lookup_struct_elt_type (struct type *, char *, int, int, int *); @@ -3719,7 +3719,7 @@ get_selections (int *choices, int n_choices, int max_results, static void replace_operator_with_call (struct expression **expp, int pc, int nargs, int oplen, struct symbol *sym, - struct block *block) + const struct block *block) { /* A new expression, with 6 more elements (3 for funcall, 4 for function symbol, -oplen for operator being replaced). */ @@ -4232,7 +4232,7 @@ lookup_cached_symbol (const char *name, domain_enum namespace, static void cache_symbol (const char *name, domain_enum namespace, struct symbol *sym, - struct block *block) + const struct block *block) { } @@ -4805,7 +4805,7 @@ remove_irrelevant_renamings (struct ada_symbol_info *syms, for (i = 0; i < nsyms; i += 1) { struct symbol *sym = syms[i].sym; - struct block *block = syms[i].block; + const struct block *block = syms[i].block; const char *name; const char *suffix; @@ -7195,7 +7195,7 @@ ada_find_any_type (const char *name) Return symbol if found, and NULL otherwise. */ struct symbol * -ada_find_renaming_symbol (struct symbol *name_sym, struct block *block) +ada_find_renaming_symbol (struct symbol *name_sym, const struct block *block) { const char *name = SYMBOL_LINKAGE_NAME (name_sym); struct symbol *sym; @@ -7217,7 +7217,7 @@ ada_find_renaming_symbol (struct symbol *name_sym, struct block *block) } static struct symbol * -find_old_style_renaming_symbol (const char *name, struct block *block) +find_old_style_renaming_symbol (const char *name, const struct block *block) { const struct symbol *function_sym = block_linkage_function (block); char *rename; diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h index f6154fd..ab6997d 100644 --- a/gdb/ada-lang.h +++ b/gdb/ada-lang.h @@ -90,7 +90,7 @@ struct ada_symbol_info struct symbol *sym; /* The block where the symbol was found. */ - struct block *block; + const struct block *block; }; /* Denotes a type of renaming symbol (see ada_parse_renaming). */ @@ -342,7 +342,7 @@ extern struct type *ada_find_parallel_type (struct type *, extern LONGEST get_int_var_value (char *, int *); extern struct symbol *ada_find_renaming_symbol (struct symbol *name_sym, - struct block *block); + const struct block *block); extern int ada_prefer_type (struct type *, struct type *); diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 59b7bf3..01a472c 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -10750,7 +10750,7 @@ watch_command_1 (char *arg, int accessflag, int from_tty, volatile struct gdb_exception e; struct breakpoint *b, *scope_breakpoint = NULL; struct expression *exp; - struct block *exp_valid_block = NULL, *cond_exp_valid_block = NULL; + const struct block *exp_valid_block = NULL, *cond_exp_valid_block = NULL; struct value *val, *mark, *result; struct frame_info *frame; char *exp_start = NULL; diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index 8b1bcb7..546e855 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -756,12 +756,12 @@ struct watchpoint struct expression *exp; /* The largest block within which it is valid, or NULL if it is valid anywhere (e.g. consists just of global symbols). */ - struct block *exp_valid_block; + const struct block *exp_valid_block; /* The conditional expression if any. */ struct expression *cond_exp; /* The largest block within which it is valid, or NULL if it is valid anywhere (e.g. consists just of global symbols). */ - struct block *cond_exp_valid_block; + const struct block *cond_exp_valid_block; /* Value of the watchpoint the last time we checked it, or NULL when we do not know the value yet or the value was not readable. VAL is never lazy. */ diff --git a/gdb/c-exp.y b/gdb/c-exp.y index 11eaadb..05d12be 100644 --- a/gdb/c-exp.y +++ b/gdb/c-exp.y @@ -2699,7 +2699,7 @@ static struct obstack name_obstack; in which lookups start; this can be NULL to mean the global scope. */ static int -classify_name (struct block *block) +classify_name (const struct block *block) { struct symbol *sym; char *copy; @@ -2791,7 +2791,7 @@ classify_name (struct block *block) in `yylval' is the first component of a name, false otherwise. */ static int -classify_inner_name (struct block *block, int first_name) +classify_inner_name (const struct block *block, int first_name) { struct type *type, *new_type; char *copy; diff --git a/gdb/expprint.c b/gdb/expprint.c index ddd3a77..b68fbee 100644 --- a/gdb/expprint.c +++ b/gdb/expprint.c @@ -122,7 +122,7 @@ print_subexp_standard (struct expression *exp, int *pos, case OP_VAR_VALUE: { - struct block *b; + const struct block *b; (*pos) += 3; b = exp->elts[pc + 1].block; diff --git a/gdb/expression.h b/gdb/expression.h index 004a60e..3b70ef3 100644 --- a/gdb/expression.h +++ b/gdb/expression.h @@ -73,7 +73,7 @@ union exp_element char string; struct type *type; struct internalvar *internalvar; - struct block *block; + const struct block *block; struct objfile *objfile; }; @@ -100,8 +100,8 @@ extern struct expression *parse_expression (char *); extern struct type *parse_field_expression (char *, char **); -extern struct expression *parse_exp_1 (char **, CORE_ADDR pc, struct block *, - int); +extern struct expression *parse_exp_1 (char **, CORE_ADDR pc, + const struct block *, int); /* For use by parsers; set if we want to parse an expression and attempt to complete a field name. */ @@ -110,7 +110,7 @@ extern int in_parse_field; /* The innermost context required by the stack and register variables we've encountered so far. To use this, set it to NULL, then call parse_<whatever>, then look at it. */ -extern struct block *innermost_block; +extern const struct block *innermost_block; /* From eval.c */ diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index d322004..ceb52a5 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -1234,7 +1234,7 @@ lookup_signed_typename (const struct language_defn *language, visible in lexical block BLOCK. */ struct type * -lookup_struct (const char *name, struct block *block) +lookup_struct (const char *name, const struct block *block) { struct symbol *sym; @@ -1256,7 +1256,7 @@ lookup_struct (const char *name, struct block *block) visible in lexical block BLOCK. */ struct type * -lookup_union (const char *name, struct block *block) +lookup_union (const char *name, const struct block *block) { struct symbol *sym; struct type *t; @@ -1280,7 +1280,7 @@ lookup_union (const char *name, struct block *block) visible in lexical block BLOCK. */ struct type * -lookup_enum (const char *name, struct block *block) +lookup_enum (const char *name, const struct block *block) { struct symbol *sym; @@ -1302,7 +1302,7 @@ lookup_enum (const char *name, struct block *block) struct type * lookup_template_type (char *name, struct type *type, - struct block *block) + const struct block *block) { struct symbol *sym; char *nam = (char *) diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index b23df9a..fb113d2 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -1543,7 +1543,7 @@ extern struct type *lookup_typename (const struct language_defn *, const struct block *, int); extern struct type *lookup_template_type (char *, struct type *, - struct block *); + const struct block *); extern int get_vptr_fieldno (struct type *, struct type **); diff --git a/gdb/go-exp.y b/gdb/go-exp.y index c3171c3..18669fc 100644 --- a/gdb/go-exp.y +++ b/gdb/go-exp.y @@ -1362,7 +1362,7 @@ build_packaged_name (const char *package, int package_len, to mean the global scope. */ static int -package_name_p (const char *name, struct block *block) +package_name_p (const char *name, const struct block *block) { struct symbol *sym; int is_a_field_of_this; @@ -1402,7 +1402,7 @@ classify_unsafe_function (struct stoken function_name) The result is one of NAME, NAME_OR_INT, or TYPENAME. */ static int -classify_packaged_name (struct block *block) +classify_packaged_name (const struct block *block) { char *copy; struct symbol *sym; @@ -1430,7 +1430,7 @@ classify_packaged_name (struct block *block) The result is one of NAME, NAME_OR_INT, or TYPENAME. */ static int -classify_name (struct block *block) +classify_name (const struct block *block) { struct type *type; struct symbol *sym; diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c index e42a03c..2dbaffd 100644 --- a/gdb/objc-lang.c +++ b/gdb/objc-lang.c @@ -82,7 +82,7 @@ static const struct objfile_data *objc_objfile_data; suitably defined. */ struct symbol * -lookup_struct_typedef (char *name, struct block *block, int noerr) +lookup_struct_typedef (char *name, const struct block *block, int noerr) { struct symbol *sym; diff --git a/gdb/objc-lang.h b/gdb/objc-lang.h index 1feeca4..47fbae9 100644 --- a/gdb/objc-lang.h +++ b/gdb/objc-lang.h @@ -46,7 +46,7 @@ extern void start_msglist (void); extern void add_msglist (struct stoken *str, int addcolon); extern int end_msglist (void); -struct symbol *lookup_struct_typedef (char *name, struct block *block, +struct symbol *lookup_struct_typedef (char *name, const struct block *block, int noerr); #endif diff --git a/gdb/parse.c b/gdb/parse.c index afe1c18..0392c6a 100644 --- a/gdb/parse.c +++ b/gdb/parse.c @@ -71,9 +71,9 @@ const struct exp_descriptor exp_descriptor_standard = struct expression *expout; int expout_size; int expout_ptr; -struct block *expression_context_block; +const struct block *expression_context_block; CORE_ADDR expression_context_pc; -struct block *innermost_block; +const struct block *innermost_block; int arglist_len; static struct type_stack type_stack; char *lexptr; @@ -116,7 +116,7 @@ static int prefixify_subexp (struct expression *, struct expression *, int, int); static struct expression *parse_exp_in_context (char **, CORE_ADDR, - struct block *, int, + const struct block *, int, int, int *); void _initialize_parse (void); @@ -248,7 +248,7 @@ write_exp_elt_sym (struct symbol *expelt) } void -write_exp_elt_block (struct block *b) +write_exp_elt_block (const struct block *b) { union exp_element tmp; @@ -1097,7 +1097,8 @@ prefixify_subexp (struct expression *inexpr, If COMMA is nonzero, stop if a comma is reached. */ struct expression * -parse_exp_1 (char **stringptr, CORE_ADDR pc, struct block *block, int comma) +parse_exp_1 (char **stringptr, CORE_ADDR pc, const struct block *block, + int comma) { return parse_exp_in_context (stringptr, pc, block, comma, 0, NULL); } @@ -1110,7 +1111,7 @@ parse_exp_1 (char **stringptr, CORE_ADDR pc, struct block *block, int comma) is left untouched. */ static struct expression * -parse_exp_in_context (char **stringptr, CORE_ADDR pc, struct block *block, +parse_exp_in_context (char **stringptr, CORE_ADDR pc, const struct block *block, int comma, int void_context_p, int *out_subexp) { volatile struct gdb_exception except; diff --git a/gdb/parser-defs.h b/gdb/parser-defs.h index c889d56..6dd5329 100644 --- a/gdb/parser-defs.h +++ b/gdb/parser-defs.h @@ -41,7 +41,7 @@ extern int expout_ptr; /* If this is nonzero, this block is used as the lexical context for symbol names. */ -extern struct block *expression_context_block; +extern const struct block *expression_context_block; /* If expression_context_block is non-zero, then this is the PC within the block that we want to evaluate expressions at. When debugging @@ -51,12 +51,12 @@ extern CORE_ADDR expression_context_pc; /* The innermost context required by the stack and register variables we've encountered so far. */ -extern struct block *innermost_block; +extern const struct block *innermost_block; /* The block in which the most recently discovered symbol was found. FIXME: Should be declared along with lookup_symbol in symtab.h; is not related specifically to parsing. */ -extern struct block *block_found; +extern const struct block *block_found; /* Number of arguments seen so far in innermost function call. */ extern int arglist_len; @@ -191,7 +191,7 @@ void write_exp_string_vector (int type, struct stoken_vector *vec); extern void write_exp_bitstring (struct stoken); -extern void write_exp_elt_block (struct block *); +extern void write_exp_elt_block (const struct block *); extern void write_exp_elt_objfile (struct objfile *objfile); diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 7a669f1..143bd0e 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -145,7 +145,7 @@ struct display struct program_space *pspace; /* Innermost block required by this expression when evaluated. */ - struct block *block; + const struct block *block; /* Status of this display (enabled or disabled). */ int enabled_p; diff --git a/gdb/symtab.c b/gdb/symtab.c index c4bd13d..dee47a9 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -62,6 +62,7 @@ #include "macroscope.h" #include "psymtab.h" +#include "parser-defs.h" /* Prototypes for local functions */ diff --git a/gdb/symtab.h b/gdb/symtab.h index 0d24cb5..d1cbef5 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -980,11 +980,11 @@ extern struct symbol *lookup_block_symbol (const struct block *, const char *, /* lookup a [struct, union, enum] by name, within a specified block. */ -extern struct type *lookup_struct (const char *, struct block *); +extern struct type *lookup_struct (const char *, const struct block *); -extern struct type *lookup_union (const char *, struct block *); +extern struct type *lookup_union (const char *, const struct block *); -extern struct type *lookup_enum (const char *, struct block *); +extern struct type *lookup_enum (const char *, const struct block *); /* from blockframe.c: */ diff --git a/gdb/valops.c b/gdb/valops.c index 502fb0d..1dd2579 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -1516,7 +1516,7 @@ value_of_variable (struct symbol *var, const struct block *b) } struct value * -address_of_variable (struct symbol *var, struct block *b) +address_of_variable (struct symbol *var, const struct block *b) { struct type *type = SYMBOL_TYPE (var); struct value *val; diff --git a/gdb/value.h b/gdb/value.h index 3685935..7a23715 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -557,7 +557,8 @@ extern CORE_ADDR address_from_register (struct type *type, int regnum, extern struct value *value_of_variable (struct symbol *var, const struct block *b); -extern struct value *address_of_variable (struct symbol *var, struct block *b); +extern struct value *address_of_variable (struct symbol *var, + const struct block *b); extern struct value *value_of_register (int regnum, struct frame_info *frame); diff --git a/gdb/varobj.c b/gdb/varobj.c index 6699699..130f438 100644 --- a/gdb/varobj.c +++ b/gdb/varobj.c @@ -84,7 +84,7 @@ struct varobj_root struct expression *exp; /* Block for which this expression is valid. */ - struct block *valid_block; + const struct block *valid_block; /* The frame for this expression. This field is set iff valid_block is not NULL. */ |