From patchwork Wed Jun 11 18:53:11 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 1448 Received: (qmail 12557 invoked by alias); 11 Jun 2014 18:53:27 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 12305 invoked by uid 89); 11 Jun 2014 18:53:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL, BAYES_00, KAM_STOCKGEN, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=no version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 11 Jun 2014 18:53:22 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s5BIrKD3004371 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 11 Jun 2014 14:53:20 -0400 Received: from barimba.redhat.com (ovpn-113-103.phx2.redhat.com [10.3.113.103]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s5BIrJRF005158; Wed, 11 Jun 2014 14:53:19 -0400 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 1/7] constify struct block in some places Date: Wed, 11 Jun 2014 12:53:11 -0600 Message-Id: <1402512797-6082-2-git-send-email-tromey@redhat.com> In-Reply-To: <1402512797-6082-1-git-send-email-tromey@redhat.com> References: <1402512797-6082-1-git-send-email-tromey@redhat.com> This makes some spots in gdb, particularly general_symbol_info, use a "const struct block", then fixes the fallout. The justification is that, ordinarily, blocks ought to be readonly. Note though that we can't add "const" in the blockvector due to block relocation. This can be done once blocks are made independent of the program space. 2014-06-11 Tom Tromey * varobj.c (varobj_create): Update. * valops.c (value_of_this): Update. * tracepoint.c (add_local_symbols, scope_info): Update. * symtab.h (struct general_symbol_info) : Now const. * symtab.c (skip_prologue_sal) (default_make_symbol_completion_list_break_on) (skip_prologue_using_sal): Update. * stack.h (iterate_over_block_locals) (iterate_over_block_local_vars): Update. * stack.c (print_frame_args): Update. (iterate_over_block_locals, iterate_over_block_local_vars): Make parameter const. (get_selected_block): Make return type const. * python/py-frame.c (frapy_block): Update. * python/py-block.c (gdbpy_block_for_pc): Update. * p-exp.y (%union) : Now const. * mi/mi-cmd-stack.c (list_args_or_locals): Update. * mdebugread.c (mylookup_symbol, parse_procedure): Update. * m2-exp.y (%union) : Now const. * linespec.c (get_current_search_block): Make return type const. (create_sals_line_offset, find_label_symbols): Update. * inline-frame.c (inline_frame_sniffer, skip_inline_frames): Update. (block_starting_point_at): Make "block" const. * infrun.c (insert_exception_resume_breakpoint): Make "b" const. (check_exception_resume): Update. * guile/scm-frame.c (gdbscm_frame_block): Update. * guile/scm-block.c (gdbscm_lookup_block): Update. * frame.h (get_frame_block): Update. (get_selected_block): Make return type const. * frame.c (frame_id_inner): Update. * f-valprint.c (info_common_command_for_block) (info_common_command): Update. * dwarf2loc.c (dwarf2_find_location_expression) (dwarf_expr_frame_base, dwarf2_compile_expr_to_ax) (locexpr_describe_location_piece): Update. * c-exp.y (%union) : Now const. * breakpoint.c (resolve_sal_pc): Update. * blockframe.c (get_frame_block):Make return type const. (get_pc_function_start, get_frame_function, find_pc_sect_function) (block_innermost_frame): Update. * block.h (blockvector_for_pc, blockvector_for_pc_sect) (block_for_pc, block_for_pc_sect): Update. * block.c (blockvector_for_pc_sect, blockvector_for_pc): Make 'pblock' const. (block_for_pc_sect, block_for_pc): Make return type const. * ax-gdb.c (gen_expr): Update. * alpha-mdebug-tdep.c (find_proc_desc): Update. * ada-lang.c (ada_read_renaming_var_value): Make 'block' const. (ada_make_symbol_completion_list, ada_add_exceptions_from_frame) (ada_read_var_value): Update. * ada-exp.y (struct name_info) : Now const. (%union): Likewise. (block_lookup): Constify. --- gdb/ChangeLog | 57 +++++++++++++++++++++++++++++++++++++++++++++++++ gdb/ada-exp.y | 10 ++++----- gdb/ada-lang.c | 8 +++---- gdb/alpha-mdebug-tdep.c | 2 +- gdb/ax-gdb.c | 2 +- gdb/block.c | 10 ++++----- gdb/block.h | 9 ++++---- gdb/blockframe.c | 12 +++++------ gdb/breakpoint.c | 2 +- gdb/c-exp.y | 2 +- gdb/dwarf2loc.c | 8 +++---- gdb/f-valprint.c | 4 ++-- gdb/frame.c | 2 +- gdb/frame.h | 6 +++--- gdb/guile/scm-block.c | 2 +- gdb/guile/scm-frame.c | 2 +- gdb/infrun.c | 4 ++-- gdb/inline-frame.c | 6 +++--- gdb/linespec.c | 10 ++++----- gdb/m2-exp.y | 2 +- gdb/mdebugread.c | 8 +++---- gdb/mi/mi-cmd-stack.c | 2 +- gdb/p-exp.y | 2 +- gdb/python/py-block.c | 2 +- gdb/python/py-frame.c | 2 +- gdb/stack.c | 12 +++++------ gdb/stack.h | 4 ++-- gdb/symtab.c | 6 +++--- gdb/symtab.h | 2 +- gdb/tracepoint.c | 4 ++-- gdb/valops.c | 2 +- gdb/varobj.c | 2 +- 32 files changed, 133 insertions(+), 75 deletions(-) diff --git a/gdb/ada-exp.y b/gdb/ada-exp.y index 9815f23..96188ac 100644 --- a/gdb/ada-exp.y +++ b/gdb/ada-exp.y @@ -110,7 +110,7 @@ struct name_info { struct symbol *sym; struct minimal_symbol *msym; - struct block *block; + const struct block *block; struct stoken stoken; }; @@ -145,7 +145,7 @@ static void write_name_assoc (struct parser_state *, struct stoken); static void write_exp_op_with_string (struct parser_state *, enum exp_opcode, struct stoken); -static struct block *block_lookup (struct block *, const char *); +static const struct block *block_lookup (const struct block *, const char *); static LONGEST convert_char_literal (struct type *, LONGEST); @@ -185,7 +185,7 @@ static struct type *type_system_address (struct parser_state *); } typed_val_float; struct type *tval; struct stoken sval; - struct block *bval; + const struct block *bval; struct internalvar *ivar; } @@ -1010,8 +1010,8 @@ write_object_renaming (struct parser_state *par_state, error (_("Internal error in encoding of renaming declaration")); } -static struct block* -block_lookup (struct block *context, const char *raw_name) +static const struct block* +block_lookup (const struct block *context, const char *raw_name) { const char *name; struct ada_symbol_info *syms; diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index d7c7e24..6afa528 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -4167,7 +4167,7 @@ parse_old_style_renaming (struct type *type, static struct value * ada_read_renaming_var_value (struct symbol *renaming_sym, - struct block *block) + const struct block *block) { const char *sym_name; struct expression *expr; @@ -6132,7 +6132,7 @@ ada_make_symbol_completion_list (const char *text0, const char *word, struct symtab *s; struct minimal_symbol *msymbol; struct objfile *objfile; - struct block *b, *surrounding_static_block = 0; + const struct block *b, *surrounding_static_block = 0; int i; struct block_iterator iter; struct cleanup *old_chain = make_cleanup (null_cleanup, NULL); @@ -12757,7 +12757,7 @@ static void ada_add_exceptions_from_frame (regex_t *preg, struct frame_info *frame, VEC(ada_exc_info) **exceptions) { - struct block *block = get_frame_block (frame, 0); + const struct block *block = get_frame_block (frame, 0); while (block != 0) { @@ -13443,7 +13443,7 @@ ada_get_symbol_name_cmp (const char *lookup_name) static struct value * ada_read_var_value (struct symbol *var, struct frame_info *frame) { - struct block *frame_block = NULL; + const struct block *frame_block = NULL; struct symbol *renaming_sym = NULL; /* The only case where default_read_var_value is not sufficient diff --git a/gdb/alpha-mdebug-tdep.c b/gdb/alpha-mdebug-tdep.c index 02688b2..8c29425 100644 --- a/gdb/alpha-mdebug-tdep.c +++ b/gdb/alpha-mdebug-tdep.c @@ -93,7 +93,7 @@ static struct mdebug_extra_func_info * find_proc_desc (CORE_ADDR pc) { - struct block *b = block_for_pc (pc); + const struct block *b = block_for_pc (pc); struct mdebug_extra_func_info *proc_desc = NULL; struct symbol *sym = NULL; const char *sh_name = NULL; diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c index b77716d..f359317 100644 --- a/gdb/ax-gdb.c +++ b/gdb/ax-gdb.c @@ -2188,7 +2188,7 @@ gen_expr (struct expression *exp, union exp_element **pc, case OP_THIS: { struct symbol *sym, *func; - struct block *b; + const struct block *b; const struct language_defn *lang; b = block_for_pc (ax->scope); diff --git a/gdb/block.c b/gdb/block.c index 2eb0758..e388d69 100644 --- a/gdb/block.c +++ b/gdb/block.c @@ -157,7 +157,7 @@ find_block_in_blockvector (struct blockvector *bl, CORE_ADDR pc) struct blockvector * blockvector_for_pc_sect (CORE_ADDR pc, struct obj_section *section, - struct block **pblock, struct symtab *symtab) + const struct block **pblock, struct symtab *symtab) { struct blockvector *bl; struct block *b; @@ -228,7 +228,7 @@ call_site_for_pc (struct gdbarch *gdbarch, CORE_ADDR pc) Backward compatibility, no section. */ struct blockvector * -blockvector_for_pc (CORE_ADDR pc, struct block **pblock) +blockvector_for_pc (CORE_ADDR pc, const struct block **pblock) { return blockvector_for_pc_sect (pc, find_pc_mapped_section (pc), pblock, NULL); @@ -237,11 +237,11 @@ blockvector_for_pc (CORE_ADDR pc, struct block **pblock) /* Return the innermost lexical block containing the specified pc value in the specified section, or 0 if there is none. */ -struct block * +const struct block * block_for_pc_sect (CORE_ADDR pc, struct obj_section *section) { struct blockvector *bl; - struct block *b; + const struct block *b; bl = blockvector_for_pc_sect (pc, section, &b, NULL); if (bl) @@ -252,7 +252,7 @@ block_for_pc_sect (CORE_ADDR pc, struct obj_section *section) /* Return the innermost lexical block containing the specified pc value, or 0 if there is none. Backward compatibility, no section. */ -struct block * +const struct block * block_for_pc (CORE_ADDR pc) { return block_for_pc_sect (pc, find_pc_mapped_section (pc)); diff --git a/gdb/block.h b/gdb/block.h index ca143a9..2c3012a 100644 --- a/gdb/block.h +++ b/gdb/block.h @@ -145,11 +145,12 @@ extern int block_inlined_p (const struct block *block); extern int contained_in (const struct block *, const struct block *); -extern struct blockvector *blockvector_for_pc (CORE_ADDR, struct block **); +extern struct blockvector *blockvector_for_pc (CORE_ADDR, + const struct block **); extern struct blockvector *blockvector_for_pc_sect (CORE_ADDR, struct obj_section *, - struct block **, + const struct block **, struct symtab *); extern int blockvector_contains_pc (struct blockvector *bv, CORE_ADDR pc); @@ -157,9 +158,9 @@ extern int blockvector_contains_pc (struct blockvector *bv, CORE_ADDR pc); extern struct call_site *call_site_for_pc (struct gdbarch *gdbarch, CORE_ADDR pc); -extern struct block *block_for_pc (CORE_ADDR); +extern const struct block *block_for_pc (CORE_ADDR); -extern struct block *block_for_pc_sect (CORE_ADDR, struct obj_section *); +extern const struct block *block_for_pc_sect (CORE_ADDR, struct obj_section *); extern const char *block_scope (const struct block *block); diff --git a/gdb/blockframe.c b/gdb/blockframe.c index 0a9381e..856b9ef 100644 --- a/gdb/blockframe.c +++ b/gdb/blockframe.c @@ -52,11 +52,11 @@ --- hopefully pointing us at the call instruction, or its delay slot instruction. */ -struct block * +const struct block * get_frame_block (struct frame_info *frame, CORE_ADDR *addr_in_block) { CORE_ADDR pc; - struct block *bl; + const struct block *bl; int inline_count; if (!get_frame_address_in_block_if_available (frame, &pc)) @@ -86,7 +86,7 @@ get_frame_block (struct frame_info *frame, CORE_ADDR *addr_in_block) CORE_ADDR get_pc_function_start (CORE_ADDR pc) { - struct block *bl; + const struct block *bl; struct bound_minimal_symbol msymbol; bl = block_for_pc (pc); @@ -118,7 +118,7 @@ get_pc_function_start (CORE_ADDR pc) struct symbol * get_frame_function (struct frame_info *frame) { - struct block *bl = get_frame_block (frame, 0); + const struct block *bl = get_frame_block (frame, 0); if (bl == NULL) return NULL; @@ -136,7 +136,7 @@ get_frame_function (struct frame_info *frame) struct symbol * find_pc_sect_function (CORE_ADDR pc, struct obj_section *section) { - struct block *b = block_for_pc_sect (pc, section); + const struct block *b = block_for_pc_sect (pc, section); if (b == 0) return 0; @@ -338,7 +338,7 @@ block_innermost_frame (const struct block *block) frame = get_current_frame (); while (frame != NULL) { - struct block *frame_block = get_frame_block (frame, NULL); + const struct block *frame_block = get_frame_block (frame, NULL); if (frame_block != NULL && contained_in (frame_block, block)) return frame; diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 23c8895..9a45ae5 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -10100,7 +10100,7 @@ resolve_sal_pc (struct symtab_and_line *sal) if (sal->section == 0 && sal->symtab != NULL) { struct blockvector *bv; - struct block *b; + const struct block *b; struct symbol *sym; bv = blockvector_for_pc_sect (sal->pc, 0, &b, sal->symtab); diff --git a/gdb/c-exp.y b/gdb/c-exp.y index 0191067..0708db3 100644 --- a/gdb/c-exp.y +++ b/gdb/c-exp.y @@ -158,7 +158,7 @@ static int type_aggregate_p (struct type *); struct ttype tsym; struct symtoken ssym; int voidval; - struct block *bval; + const struct block *bval; enum exp_opcode opcode; struct stoken_vector svec; diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c index 5517442..fcab9b9 100644 --- a/gdb/dwarf2loc.c +++ b/gdb/dwarf2loc.c @@ -277,7 +277,7 @@ dwarf2_find_location_expression (struct dwarf2_loclist_baton *baton, /* This is entry PC record present only at entry point of a function. Verify it is really the function entry point. */ - struct block *pc_block = block_for_pc (pc); + const struct block *pc_block = block_for_pc (pc); struct symbol *pc_func = NULL; if (pc_block) @@ -353,7 +353,7 @@ dwarf_expr_frame_base (void *baton, const gdb_byte **start, size_t * length) this_base method. */ struct symbol *framefunc; struct dwarf_expr_baton *debaton = (struct dwarf_expr_baton *) baton; - struct block *bl = get_frame_block (debaton->frame, NULL); + const struct block *bl = get_frame_block (debaton->frame, NULL); if (bl == NULL) error (_("frame address is not available.")); @@ -3087,7 +3087,7 @@ dwarf2_compile_expr_to_ax (struct agent_expr *expr, struct axs_value *loc, { const gdb_byte *datastart; size_t datalen; - struct block *b; + const struct block *b; struct symbol *framefunc; b = block_for_pc (expr->scope); @@ -3542,7 +3542,7 @@ locexpr_describe_location_piece (struct symbol *symbol, struct ui_file *stream, } else if (data[0] == DW_OP_fbreg) { - struct block *b; + const struct block *b; struct symbol *framefunc; int frame_reg = 0; int64_t frame_offset; diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c index d8c767f..0040bbd 100644 --- a/gdb/f-valprint.c +++ b/gdb/f-valprint.c @@ -411,7 +411,7 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset, } static void -info_common_command_for_block (struct block *block, const char *comname, +info_common_command_for_block (const struct block *block, const char *comname, int *any_printed) { struct block_iterator iter; @@ -472,7 +472,7 @@ static void info_common_command (char *comname, int from_tty) { struct frame_info *fi; - struct block *block; + const struct block *block; int values_printed = 0; /* We have been told to display the contents of F77 COMMON diff --git a/gdb/frame.c b/gdb/frame.c index 8dea9c4..baeb630 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -699,7 +699,7 @@ frame_id_inner (struct gdbarch *gdbarch, struct frame_id l, struct frame_id r) && l.special_addr == r.special_addr) { /* Same function, different inlined functions. */ - struct block *lb, *rb; + const struct block *lb, *rb; gdb_assert (l.code_addr_p && r.code_addr_p); diff --git a/gdb/frame.h b/gdb/frame.h index 59564f9..4cc4858 100644 --- a/gdb/frame.h +++ b/gdb/frame.h @@ -665,8 +665,8 @@ extern void *frame_obstack_zalloc (unsigned long size); /* Create a regcache, and copy the frame's registers into it. */ struct regcache *frame_save_as_regcache (struct frame_info *this_frame); -extern struct block *get_frame_block (struct frame_info *, - CORE_ADDR *addr_in_block); +extern const struct block *get_frame_block (struct frame_info *, + CORE_ADDR *addr_in_block); /* Return the `struct block' that belongs to the selected thread's selected frame. If the inferior has no state, return NULL. @@ -694,7 +694,7 @@ extern struct block *get_frame_block (struct frame_info *, it occurs in the CLI code and makes it possible for commands to work, even when the inferior has no state. */ -extern struct block *get_selected_block (CORE_ADDR *addr_in_block); +extern const struct block *get_selected_block (CORE_ADDR *addr_in_block); extern struct symbol *get_frame_function (struct frame_info *); diff --git a/gdb/guile/scm-block.c b/gdb/guile/scm-block.c index 2290008..67864f8 100644 --- a/gdb/guile/scm-block.c +++ b/gdb/guile/scm-block.c @@ -674,7 +674,7 @@ static SCM gdbscm_lookup_block (SCM pc_scm) { CORE_ADDR pc; - struct block *block = NULL; + const struct block *block = NULL; struct obj_section *section = NULL; struct symtab *symtab = NULL; volatile struct gdb_exception except; diff --git a/gdb/guile/scm-frame.c b/gdb/guile/scm-frame.c index 9c0b00d..32abf6d3 100644 --- a/gdb/guile/scm-frame.c +++ b/gdb/guile/scm-frame.c @@ -576,7 +576,7 @@ static SCM gdbscm_frame_block (SCM self) { frame_smob *f_smob; - struct block *block = NULL, *fn_block; + const struct block *block = NULL, *fn_block; struct frame_info *frame = NULL; volatile struct gdb_exception except; diff --git a/gdb/infrun.c b/gdb/infrun.c index 47604c7..c752d0b 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -5611,7 +5611,7 @@ insert_longjmp_resume_breakpoint (struct gdbarch *gdbarch, CORE_ADDR pc) static void insert_exception_resume_breakpoint (struct thread_info *tp, - struct block *b, + const struct block *b, struct frame_info *frame, struct symbol *sym) { @@ -5708,7 +5708,7 @@ check_exception_resume (struct execution_control_state *ecs, TRY_CATCH (e, RETURN_MASK_ERROR) { - struct block *b; + const struct block *b; struct block_iterator iter; struct symbol *sym; int argno = 0; diff --git a/gdb/inline-frame.c b/gdb/inline-frame.c index eb82143..9027617 100644 --- a/gdb/inline-frame.c +++ b/gdb/inline-frame.c @@ -209,7 +209,7 @@ inline_frame_sniffer (const struct frame_unwind *self, void **this_cache) { CORE_ADDR this_pc; - struct block *frame_block, *cur_block; + const struct block *frame_block, *cur_block; int depth; struct frame_info *next_frame; struct inline_state *state = find_inline_frame_state (inferior_ptid); @@ -274,7 +274,7 @@ const struct frame_unwind inline_frame_unwind = { before it). */ static int -block_starting_point_at (CORE_ADDR pc, struct block *block) +block_starting_point_at (CORE_ADDR pc, const struct block *block) { struct blockvector *bv; struct block *new_block; @@ -304,7 +304,7 @@ void skip_inline_frames (ptid_t ptid) { CORE_ADDR this_pc; - struct block *frame_block, *cur_block; + const struct block *frame_block, *cur_block; struct symbol *last_sym = NULL; int skip_count = 0; struct inline_state *state; diff --git a/gdb/linespec.c b/gdb/linespec.c index cb76b9c..8a2c8e3 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -1058,10 +1058,10 @@ iterate_over_all_matching_symtabs (struct linespec_state *state, /* Returns the block to be used for symbol searches from the current location. */ -static struct block * +static const struct block * get_current_search_block (void) { - struct block *block; + const struct block *block; enum language save_language; /* get_selected_block can change the current language when there is @@ -1897,7 +1897,7 @@ create_sals_line_offset (struct linespec_state *self, { struct linetable_entry *best_entry = NULL; int *filter; - struct block **blocks; + const struct block **blocks; struct cleanup *cleanup; struct symtabs_and_lines intermediate_results; int i, j; @@ -1925,7 +1925,7 @@ create_sals_line_offset (struct linespec_state *self, filter = XNEWVEC (int, intermediate_results.nelts); make_cleanup (xfree, filter); - blocks = XNEWVEC (struct block *, intermediate_results.nelts); + blocks = XNEWVEC (const struct block *, intermediate_results.nelts); make_cleanup (xfree, blocks); for (i = 0; i < intermediate_results.nelts; ++i) @@ -3214,7 +3214,7 @@ find_label_symbols (struct linespec_state *self, VEC (symbolp) **label_funcs_ret, const char *name) { int ix; - struct block *block; + const struct block *block; struct symbol *sym; struct symbol *fn_sym; VEC (symbolp) *result = NULL; diff --git a/gdb/m2-exp.y b/gdb/m2-exp.y index 917a028..e98abe2 100644 --- a/gdb/m2-exp.y +++ b/gdb/m2-exp.y @@ -143,7 +143,7 @@ static int number_sign = 1; struct type *tval; struct stoken sval; int voidval; - struct block *bval; + const struct block *bval; enum exp_opcode opcode; struct internalvar *ivar; diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index c03ac67..2303010 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -248,8 +248,8 @@ static struct blockvector *new_bvect (int); static struct type *parse_type (int, union aux_ext *, unsigned int, int *, int, char *); -static struct symbol *mylookup_symbol (char *, struct block *, domain_enum, - enum address_class); +static struct symbol *mylookup_symbol (char *, const struct block *, + domain_enum, enum address_class); static void sort_blocks (struct symtab *); @@ -1928,7 +1928,7 @@ parse_procedure (PDR *pr, struct symtab *search_symtab, struct partial_symtab *pst) { struct symbol *s, *i; - struct block *b; + const struct block *b; char *sh_name; /* Simple rule to find files linked "-x". */ @@ -4570,7 +4570,7 @@ cross_ref (int fd, union aux_ext *ax, struct type **tpp, keeping the symtab sorted. */ static struct symbol * -mylookup_symbol (char *name, struct block *block, +mylookup_symbol (char *name, const struct block *block, domain_enum domain, enum address_class class) { struct block_iterator iter; diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c index 7bc8114..ac30fca 100644 --- a/gdb/mi/mi-cmd-stack.c +++ b/gdb/mi/mi-cmd-stack.c @@ -559,7 +559,7 @@ static void list_args_or_locals (enum what_to_list what, enum print_values values, struct frame_info *fi, int skip_unavailable) { - struct block *block; + const struct block *block; struct symbol *sym; struct block_iterator iter; struct cleanup *cleanup_list; diff --git a/gdb/p-exp.y b/gdb/p-exp.y index 4e8f96c..5bb1864 100644 --- a/gdb/p-exp.y +++ b/gdb/p-exp.y @@ -154,7 +154,7 @@ static char *uptok (const char *, int); struct ttype tsym; struct symtoken ssym; int voidval; - struct block *bval; + const struct block *bval; enum exp_opcode opcode; struct internalvar *ivar; diff --git a/gdb/python/py-block.c b/gdb/python/py-block.c index e5e136b..3fa4530 100644 --- a/gdb/python/py-block.c +++ b/gdb/python/py-block.c @@ -371,7 +371,7 @@ PyObject * gdbpy_block_for_pc (PyObject *self, PyObject *args) { gdb_py_ulongest pc; - struct block *block = NULL; + const struct block *block = NULL; struct obj_section *section = NULL; struct symtab *symtab = NULL; volatile struct gdb_exception except; diff --git a/gdb/python/py-frame.c b/gdb/python/py-frame.c index 77077d3..120e147 100644 --- a/gdb/python/py-frame.c +++ b/gdb/python/py-frame.c @@ -242,7 +242,7 @@ static PyObject * frapy_block (PyObject *self, PyObject *args) { struct frame_info *frame; - struct block *block = NULL, *fn_block; + const struct block *block = NULL, *fn_block; volatile struct gdb_exception except; TRY_CATCH (except, RETURN_MASK_ALL) diff --git a/gdb/stack.c b/gdb/stack.c index 4f16238..0d6d8e7 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -538,7 +538,7 @@ print_frame_args (struct symbol *func, struct frame_info *frame, if (func) { - struct block *b = SYMBOL_BLOCK_VALUE (func); + const struct block *b = SYMBOL_BLOCK_VALUE (func); struct block_iterator iter; struct symbol *sym; @@ -1928,7 +1928,7 @@ backtrace_full_command (char *arg, int from_tty) CB_DATA. */ static void -iterate_over_block_locals (struct block *b, +iterate_over_block_locals (const struct block *b, iterate_over_block_arg_local_vars_cb cb, void *cb_data) { @@ -2011,7 +2011,7 @@ print_block_frame_labels (struct gdbarch *gdbarch, struct block *b, superblocks, stopping when the top-level block is reached. */ void -iterate_over_block_local_vars (struct block *block, +iterate_over_block_local_vars (const struct block *block, iterate_over_block_arg_local_vars_cb cb, void *cb_data) { @@ -2073,7 +2073,7 @@ print_frame_local_vars (struct frame_info *frame, int num_tabs, struct ui_file *stream) { struct print_variable_and_value_data cb_data; - struct block *block; + const struct block *block; CORE_ADDR pc; if (!get_frame_pc_if_available (frame, &pc)) @@ -2118,7 +2118,7 @@ locals_info (char *args, int from_tty) Returns 1 if any argument was walked; 0 otherwise. */ void -iterate_over_block_arg_vars (struct block *b, +iterate_over_block_arg_vars (const struct block *b, iterate_over_block_arg_local_vars_cb cb, void *cb_data) { @@ -2221,7 +2221,7 @@ select_and_print_frame (struct frame_info *frame) code address within the block returned. We use this to decide which macros are in scope. */ -struct block * +const struct block * get_selected_block (CORE_ADDR *addr_in_block) { if (!has_stack_frames ()) diff --git a/gdb/stack.h b/gdb/stack.h index 804ffa8..94d1f36 100644 --- a/gdb/stack.h +++ b/gdb/stack.h @@ -29,11 +29,11 @@ typedef void (*iterate_over_block_arg_local_vars_cb) (const char *print_name, struct symbol *sym, void *cb_data); -void iterate_over_block_arg_vars (struct block *block, +void iterate_over_block_arg_vars (const struct block *block, iterate_over_block_arg_local_vars_cb cb, void *cb_data); -void iterate_over_block_local_vars (struct block *block, +void iterate_over_block_local_vars (const struct block *block, iterate_over_block_arg_local_vars_cb cb, void *cb_data); diff --git a/gdb/symtab.c b/gdb/symtab.c index 66d1624..2453f2d 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -2877,7 +2877,7 @@ skip_prologue_sal (struct symtab_and_line *sal) const char *name; struct objfile *objfile; struct gdbarch *gdbarch; - struct block *b, *function_block; + const struct block *b, *function_block; int force_skip, skip; /* Do not change the SAL if PC was specified explicitly. */ @@ -4313,7 +4313,7 @@ default_make_symbol_completion_list_break_on (const char *text, struct symtab *s; struct minimal_symbol *msymbol; struct objfile *objfile; - struct block *b; + const struct block *b; const struct block *surrounding_static_block, *surrounding_global_block; struct block_iterator iter; /* The symbol we are completing on. Points in same buffer as text. */ @@ -4923,7 +4923,7 @@ skip_prologue_using_sal (struct gdbarch *gdbarch, CORE_ADDR func_addr) struct symtab_and_line prologue_sal; CORE_ADDR start_pc; CORE_ADDR end_pc; - struct block *bl; + const struct block *bl; /* Get an initial range for the function. */ find_pc_partial_function (func_addr, NULL, &start_pc, &end_pc); diff --git a/gdb/symtab.h b/gdb/symtab.h index fbe5868..94b9c60 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -114,7 +114,7 @@ struct general_symbol_info { LONGEST ivalue; - struct block *block; + const struct block *block; const gdb_byte *bytes; diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index c522193..cdd395f 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -1155,7 +1155,7 @@ add_local_symbols (struct collection_list *collect, long frame_regno, long frame_offset, int type, int trace_string) { - struct block *block; + const struct block *block; struct add_local_symbols_data cb_data; cb_data.collect = collect; @@ -2705,7 +2705,7 @@ scope_info (char *args, int from_tty) struct symtabs_and_lines sals; struct symbol *sym; struct bound_minimal_symbol msym; - struct block *block; + const struct block *block; const char *symname; char *save_args = args; struct block_iterator iter; diff --git a/gdb/valops.c b/gdb/valops.c index e0c8873..4164d63 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -3712,7 +3712,7 @@ struct value * value_of_this (const struct language_defn *lang) { struct symbol *sym; - struct block *b; + const struct block *b; struct frame_info *frame; if (!lang->la_name_of_this) diff --git a/gdb/varobj.c b/gdb/varobj.c index 8016368..927d482 100644 --- a/gdb/varobj.c +++ b/gdb/varobj.c @@ -303,7 +303,7 @@ varobj_create (char *objname, { struct frame_info *fi; struct frame_id old_id = null_frame_id; - struct block *block; + const struct block *block; const char *p; struct value *value = NULL; volatile struct gdb_exception except;