+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.
+
2014-06-18 Tom Tromey <tromey@redhat.com>
* completer.c (complete_line): Make "line_buffer" const.
ALL_PRIMARY_SYMTABS (objfile, s)
{
- struct blockvector *bv = BLOCKVECTOR (s);
+ const struct blockvector *bv = BLOCKVECTOR (s);
int i;
for (i = GLOBAL_BLOCK; i <= STATIC_BLOCK; i++)
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;
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 */
/* 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;
}
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),
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);
extern int contained_in (const struct block *, const struct block *);
-extern struct blockvector *blockvector_for_pc (CORE_ADDR,
+extern const struct blockvector *blockvector_for_pc (CORE_ADDR,
const struct block **);
-extern struct blockvector *blockvector_for_pc_sect (CORE_ADDR,
- struct obj_section *,
- const struct block **,
- struct symtab *);
+extern const struct blockvector *blockvector_for_pc_sect (CORE_ADDR,
+ struct obj_section *,
+ const struct block **,
+ struct symtab *);
-extern int blockvector_contains_pc (struct blockvector *bv, CORE_ADDR pc);
+extern int blockvector_contains_pc (const struct blockvector *bv, CORE_ADDR pc);
extern struct call_site *call_site_for_pc (struct gdbarch *gdbarch,
CORE_ADDR pc);
if (sal->section == 0 && sal->symtab != NULL)
{
- struct blockvector *bv;
+ const struct blockvector *bv;
const struct block *b;
struct symbol *sym;
void
augment_type_symtab (struct objfile *objfile, struct symtab *primary_symtab)
{
- struct blockvector *blockvector = primary_symtab->blockvector;
+ const struct blockvector *blockvector = primary_symtab->blockvector;
if (context_stack_depth > 0)
{
information (but NAME might contain it). */
if (stab->primary)
{
- struct blockvector *bv = BLOCKVECTOR (stab);
+ const struct blockvector *bv = BLOCKVECTOR (stab);
struct block *block = BLOCKVECTOR_BLOCK (bv, block_index);
sym = lookup_block_symbol (block, name, domain);
static int
block_starting_point_at (CORE_ADDR pc, const struct block *block)
{
- struct blockvector *bv;
+ const struct blockvector *bv;
struct block *new_block;
bv = blockvector_for_pc (pc, NULL);
struct block *block_iter;
int actual_nblocks, i, blockvector_size;
CORE_ADDR begin, end;
+ struct blockvector *bv;
actual_nblocks = FIRST_LOCAL_BLOCK + stab->nblocks;
blockvector_size = (sizeof (struct blockvector)
+ (actual_nblocks - 1) * sizeof (struct block *));
- symtab->blockvector = obstack_alloc (&objfile->objfile_obstack,
- blockvector_size);
+ bv = obstack_alloc (&objfile->objfile_obstack, blockvector_size);
+ symtab->blockvector = bv;
/* (begin, end) will contain the PC range this entire blockvector
spans. */
set_symtab_primary (symtab, 1);
- BLOCKVECTOR_MAP (symtab->blockvector) = NULL;
+ BLOCKVECTOR_MAP (bv) = NULL;
begin = stab->blocks->begin;
end = stab->blocks->end;
- BLOCKVECTOR_NBLOCKS (symtab->blockvector) = actual_nblocks;
+ BLOCKVECTOR_NBLOCKS (bv) = actual_nblocks;
/* First run over all the gdb_block objects, creating a real block
object for each. Simultaneously, keep setting the real_block
BLOCK_FUNCTION (new_block) = block_name;
- BLOCKVECTOR_BLOCK (symtab->blockvector, i) = new_block;
+ BLOCKVECTOR_BLOCK (bv, i) = new_block;
if (begin > BLOCK_START (new_block))
begin = BLOCK_START (new_block);
if (end < BLOCK_END (new_block))
BLOCK_START (new_block) = (CORE_ADDR) begin;
BLOCK_END (new_block) = (CORE_ADDR) end;
- BLOCKVECTOR_BLOCK (symtab->blockvector, i) = new_block;
+ BLOCKVECTOR_BLOCK (bv, i) = new_block;
if (i == GLOBAL_BLOCK)
set_block_symtab (new_block, symtab);
{
/* And if not, we set a default parent block. */
BLOCK_SUPERBLOCK (gdb_block_iter->real_block) =
- BLOCKVECTOR_BLOCK (symtab->blockvector, STATIC_BLOCK);
+ BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
}
}
{
struct symtab *symtab
= get_java_class_symtab (get_objfile_arch (SYMBOL_SYMTAB (sym)->objfile));
- struct blockvector *bv = BLOCKVECTOR (symtab);
+ const struct blockvector *bv = BLOCKVECTOR (symtab);
dict_add_symbol (BLOCK_DICT (BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK)), sym);
}
b = top_stack->cur_block;
if (sh->st == stProc)
{
- struct blockvector *bv = BLOCKVECTOR (top_stack->cur_st);
+ const struct blockvector *bv = BLOCKVECTOR (top_stack->cur_st);
/* The next test should normally be true, but provides a
hook for nested functions (which we don't want to make
top_stack->blocktype == stStaticProc))
{
/* Finished with procedure */
- struct blockvector *bv = BLOCKVECTOR (top_stack->cur_st);
+ const struct blockvector *bv = BLOCKVECTOR (top_stack->cur_st);
struct mdebug_extra_func_info *e;
struct block *b = top_stack->cur_block;
struct type *ftype = top_stack->cur_type;
static void
add_block (struct block *b, struct symtab *s)
{
- struct blockvector *bv = BLOCKVECTOR (s);
+ /* Cast away "const", but that's ok because we're building the
+ symtab and blockvector here. */
+ struct blockvector *bv = (struct blockvector *) BLOCKVECTOR (s);
bv = (struct blockvector *) xrealloc ((void *) bv,
(sizeof (struct blockvector)
static void
sort_blocks (struct symtab *s)
{
- struct blockvector *bv = BLOCKVECTOR (s);
+ /* We have to cast away const here, but this is ok because we're
+ constructing the blockvector in this code. */
+ struct blockvector *bv = (struct blockvector *) BLOCKVECTOR (s);
if (BLOCKVECTOR_NBLOCKS (bv) <= FIRST_LOCAL_BLOCK)
{
new_symtab (const char *name, int maxlines, struct objfile *objfile)
{
struct symtab *s = allocate_symtab (name, objfile);
+ struct blockvector *bv;
LINETABLE (s) = new_linetable (maxlines);
/* All symtabs must have at least two blocks. */
- BLOCKVECTOR (s) = new_bvect (2);
- BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), GLOBAL_BLOCK)
- = new_block (NON_FUNCTION_BLOCK);
- BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), STATIC_BLOCK)
- = new_block (NON_FUNCTION_BLOCK);
- BLOCK_SUPERBLOCK (BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), STATIC_BLOCK)) =
- BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), GLOBAL_BLOCK);
+ bv = new_bvect (2);
+ BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK) = new_block (NON_FUNCTION_BLOCK);
+ BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK) = new_block (NON_FUNCTION_BLOCK);
+ BLOCK_SUPERBLOCK (BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK)) =
+ BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
+ BLOCKVECTOR (s) = bv;
s->debugformat = "ECOFF";
return (s);
ALL_OBJFILE_SYMTABS (objfile, s)
{
struct linetable *l;
- struct blockvector *bv;
+ const struct blockvector *bv;
int i;
/* First the line table. */
information (but NAME might contain it). */
if (stab->primary)
{
- struct blockvector *bv = BLOCKVECTOR (stab);
+ const struct blockvector *bv = BLOCKVECTOR (stab);
struct block *block = BLOCKVECTOR_BLOCK (bv, block_index);
sym = lookup_block_symbol (block, name, domain);
struct partial_symbol **psym;
struct symtab *s = NULL;
struct partial_symtab *ps;
- struct blockvector *bv;
+ const struct blockvector *bv;
struct objfile *objfile;
struct block *b;
int length;
{
struct symtab *symtab = NULL;
struct block *block = NULL;
- struct blockvector *blockvector;
+ const struct blockvector *blockvector;
STPY_REQUIRE_VALID (self, symtab);
{
struct symtab *symtab = NULL;
struct block *block = NULL;
- struct blockvector *blockvector;
+ const struct blockvector *blockvector;
STPY_REQUIRE_VALID (self, symtab);
minsym.minsym));
if (symtab != NULL)
{
- struct blockvector *bv = BLOCKVECTOR (symtab);
+ const struct blockvector *bv = BLOCKVECTOR (symtab);
struct block *block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
struct symbol *sym;
struct symtab_and_line sal;
struct dict_iterator iter;
int len;
struct linetable *l;
- struct blockvector *bv;
+ const struct blockvector *bv;
struct symbol *sym;
struct block *b;
int depth;
{
const struct objfile *objfile;
struct symbol *sym;
- struct blockvector *bv;
+ const struct blockvector *bv;
const struct block *block;
struct symtab *s;
const char *name, const domain_enum domain)
{
struct symbol *sym = NULL;
- struct blockvector *bv;
+ const struct blockvector *bv;
const struct block *block;
struct symtab *s;
const char *name, const domain_enum domain)
{
struct symtab *symtab;
- struct blockvector *bv;
+ const struct blockvector *bv;
const struct block *block;
struct symbol *sym;
const char *name)
{
struct symtab *symtab;
- struct blockvector *bv;
+ const struct blockvector *bv;
struct block *block;
struct symbol *sym;
{
struct symbol *sym;
struct symtab *s = NULL;
- struct blockvector *bv;
+ const struct blockvector *bv;
struct objfile *objfile;
struct block *block;
struct type *t;
find_pc_sect_symtab (CORE_ADDR pc, struct obj_section *section)
{
struct block *b;
- struct blockvector *bv;
+ const struct blockvector *bv;
struct symtab *s = NULL;
struct symtab *best_s = NULL;
struct objfile *objfile;
int i;
struct linetable_entry *item;
struct symtab_and_line val;
- struct blockvector *bv;
+ const struct blockvector *bv;
struct bound_minimal_symbol msymbol;
struct objfile *objfile;
struct symbol_search **matches)
{
struct symtab *s;
- struct blockvector *bv;
+ const struct blockvector *bv;
struct block *b;
int i = 0;
struct block_iterator iter;
between different symtabs (and normally is for all the symtabs
in a given compilation unit). */
- struct blockvector *blockvector;
+ const struct blockvector *blockvector;
/* Table mapping core addresses to line numbers for this file.
Can be NULL if none. Never shared between different symtabs. */