constify some blockvector APIs

Generally, the blockvector ought to be readonly.  So, this patch makes
the blockvector const in the symtab, and also changes various
blockvector APIs to be const.

This patch has a couple of spots that cast away const.  I consider
these to be ok because they occur in mdebugread and are used while
constructing the blockvector.  I have added comments at these spots.

2014-06-18  Tom Tromey  <tromey@redhat.com>

	* symtab.h (struct symtab) <blockvector>: Now const.
	* ada-lang.c (ada_add_global_exceptions): Update.
	* buildsym.c (augment_type_symtab): Update.
	* dwarf2read.c (dw2_lookup_symbol): Update.
	* jit.c (finalize_symtab): Update.
	* jv-lang.c (add_class_symtab_symbol): Update.
	* mdebugread.c (parse_symbol, add_block, sort_blocks, new_symtab):
	Update.
	* objfiles.c (objfile_relocate1): Update.
	* psymtab.c (lookup_symbol_aux_psymtabs)
	(maintenance_check_psymtabs): Update.
	* python/py-symtab.c (stpy_global_block, stpy_static_block):
	Update.
	* spu-tdep.c (spu_catch_start): Update.
	* symmisc.c (dump_symtab_1): Update.
	* symtab.c (lookup_global_symbol_from_objfile)
	(lookup_symbol_aux_objfile, lookup_symbol_aux_quick)
	(basic_lookup_transparent_type_quick)
	(basic_lookup_transparent_type, find_pc_sect_symtab)
	(find_pc_sect_line, search_symbols): Update.
	* block.c (find_block_in_blockvector): Make "bl" const.
	(blockvector_for_pc_sect, blockvector_for_pc): Make return type
	const.
	(blockvector_contains_pc): Make "bv" const.
	(block_for_pc_sect): Update.
	* block.h (blockvector_for_pc, blockvector_for_pc_sect)
	(blockvector_contains_pc): Update.
	* breakpoint.c (resolve_sal_pc): Update.
	* inline-frame.c (block_starting_point_at): Update.
This commit is contained in:
Tom Tromey
2014-06-10 13:11:19 -06:00
parent 1834676b5f
commit 346d1dfebd
18 changed files with 89 additions and 52 deletions

View File

@ -107,7 +107,7 @@ block_inlined_p (const struct block *bl)
It returns the containing block if there is one, or else NULL. */
static struct block *
find_block_in_blockvector (struct blockvector *bl, CORE_ADDR pc)
find_block_in_blockvector (const struct blockvector *bl, CORE_ADDR pc)
{
struct block *b;
int bot, top, half;
@ -155,11 +155,11 @@ find_block_in_blockvector (struct blockvector *bl, CORE_ADDR pc)
is none. PBLOCK is a pointer to the block. If PBLOCK is NULL, we
don't pass this information back to the caller. */
struct blockvector *
const struct blockvector *
blockvector_for_pc_sect (CORE_ADDR pc, struct obj_section *section,
const struct block **pblock, struct symtab *symtab)
{
struct blockvector *bl;
const struct blockvector *bl;
struct block *b;
if (symtab == 0) /* if no symtab specified by caller */
@ -185,7 +185,7 @@ blockvector_for_pc_sect (CORE_ADDR pc, struct obj_section *section,
/* Return true if the blockvector BV contains PC, false otherwise. */
int
blockvector_contains_pc (struct blockvector *bv, CORE_ADDR pc)
blockvector_contains_pc (const struct blockvector *bv, CORE_ADDR pc)
{
return find_block_in_blockvector (bv, pc) != NULL;
}
@ -227,7 +227,7 @@ call_site_for_pc (struct gdbarch *gdbarch, CORE_ADDR pc)
containing the specified pc value, or 0 if there is none.
Backward compatibility, no section. */
struct blockvector *
const struct blockvector *
blockvector_for_pc (CORE_ADDR pc, const struct block **pblock)
{
return blockvector_for_pc_sect (pc, find_pc_mapped_section (pc),
@ -240,7 +240,7 @@ blockvector_for_pc (CORE_ADDR pc, const struct block **pblock)
const struct block *
block_for_pc_sect (CORE_ADDR pc, struct obj_section *section)
{
struct blockvector *bl;
const struct blockvector *bl;
const struct block *b;
bl = blockvector_for_pc_sect (pc, section, &b, NULL);