aboutsummaryrefslogtreecommitdiff
path: root/gdb/block.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2013-03-12 09:51:37 -0600
committerTom Tromey <tromey@redhat.com>2014-06-18 08:16:52 -0600
commit3977b71f1dfd04b6ac2c14e1405ce251c31a38aa (patch)
treec71f73d0a33b83bbc4ae2a8bcf3fb17a9c6f0c15 /gdb/block.c
parent5d376983ca914e1cf36f4968cc87957f9033ebcd (diff)
downloadgdb-3977b71f1dfd04b6ac2c14e1405ce251c31a38aa.zip
gdb-3977b71f1dfd04b6ac2c14e1405ce251c31a38aa.tar.gz
gdb-3977b71f1dfd04b6ac2c14e1405ce251c31a38aa.tar.bz2
constify struct block in some places
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-18 Tom Tromey <tromey@redhat.com> * 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) <block>: 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) <bval>: Now const. * mi/mi-cmd-stack.c (list_args_or_locals): Update. * mdebugread.c (mylookup_symbol, parse_procedure): Update. * m2-exp.y (%union) <bval>: 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) <bval>: 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) <block>: Now const. (%union): Likewise. (block_lookup): Constify.
Diffstat (limited to 'gdb/block.c')
-rw-r--r--gdb/block.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/gdb/block.c b/gdb/block.c
index 2eb07588..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));