* [PATCH 6/7] constify some blockvector APIs
2014-06-11 18:53 [PATCH 0/7] more constification Tom Tromey
2014-06-11 18:53 ` [PATCH 4/7] remove unneeded cast in symtab.c Tom Tromey
@ 2014-06-11 18:53 ` Tom Tromey
2014-06-11 18:53 ` [PATCH 2/7] constify probe.c function Tom Tromey
` (7 subsequent siblings)
9 siblings, 0 replies; 17+ messages in thread
From: Tom Tromey @ 2014-06-11 18:53 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
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-11 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.
---
gdb/ChangeLog | 32 ++++++++++++++++++++++++++++++++
gdb/ada-lang.c | 2 +-
gdb/block.c | 12 ++++++------
gdb/block.h | 12 ++++++------
gdb/breakpoint.c | 2 +-
gdb/buildsym.c | 2 +-
gdb/dwarf2read.c | 2 +-
gdb/inline-frame.c | 2 +-
gdb/jit.c | 15 ++++++++-------
gdb/jv-lang.c | 2 +-
gdb/mdebugread.c | 26 +++++++++++++++-----------
gdb/objfiles.c | 2 +-
gdb/psymtab.c | 4 ++--
gdb/python/py-symtab.c | 4 ++--
gdb/spu-tdep.c | 2 +-
gdb/symmisc.c | 2 +-
gdb/symtab.c | 16 ++++++++--------
gdb/symtab.h | 2 +-
18 files changed, 89 insertions(+), 52 deletions(-)
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 6afa528..fd2aec9 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -12818,7 +12818,7 @@ ada_add_global_exceptions (regex_t *preg, VEC(ada_exc_info) **exceptions)
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++)
diff --git a/gdb/block.c b/gdb/block.c
index e388d69..a4b9ef5 100644
--- a/gdb/block.c
+++ b/gdb/block.c
@@ -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);
diff --git a/gdb/block.h b/gdb/block.h
index 2c3012a..0e5d0be 100644
--- a/gdb/block.h
+++ b/gdb/block.h
@@ -145,15 +145,15 @@ 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,
+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);
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 9a45ae5..2fedbff 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -10099,7 +10099,7 @@ resolve_sal_pc (struct symtab_and_line *sal)
if (sal->section == 0 && sal->symtab != NULL)
{
- struct blockvector *bv;
+ const struct blockvector *bv;
const struct block *b;
struct symbol *sym;
diff --git a/gdb/buildsym.c b/gdb/buildsym.c
index b367d18..c49ed68 100644
--- a/gdb/buildsym.c
+++ b/gdb/buildsym.c
@@ -1390,7 +1390,7 @@ set_missing_symtab (struct pending *pending_list, struct symtab *symtab)
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)
{
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index f078cb4..6ead9b4 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -3616,7 +3616,7 @@ dw2_lookup_symbol (struct objfile *objfile, int block_index,
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);
diff --git a/gdb/inline-frame.c b/gdb/inline-frame.c
index 9027617..50f492a 100644
--- a/gdb/inline-frame.c
+++ b/gdb/inline-frame.c
@@ -276,7 +276,7 @@ const struct frame_unwind inline_frame_unwind = {
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);
diff --git a/gdb/jit.c b/gdb/jit.c
index db6c1b0..a1983c9 100644
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -639,6 +639,7 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
struct block *block_iter;
int actual_nblocks, i, blockvector_size;
CORE_ADDR begin, end;
+ struct blockvector *bv;
actual_nblocks = FIRST_LOCAL_BLOCK + stab->nblocks;
@@ -662,16 +663,16 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
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
@@ -706,7 +707,7 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
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))
@@ -732,7 +733,7 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
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);
@@ -755,7 +756,7 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
{
/* 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);
}
}
diff --git a/gdb/jv-lang.c b/gdb/jv-lang.c
index 243a45a..3e5f096 100644
--- a/gdb/jv-lang.c
+++ b/gdb/jv-lang.c
@@ -175,7 +175,7 @@ add_class_symtab_symbol (struct symbol *sym)
{
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);
}
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index 2303010..2e9608b 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -756,7 +756,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
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
@@ -1131,7 +1131,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
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;
@@ -4608,7 +4608,9 @@ add_symbol (struct symbol *s, struct symtab *symtab, struct block *b)
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)
@@ -4677,7 +4679,9 @@ compare_blocks (const void *arg1, const void *arg2)
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)
{
@@ -4729,17 +4733,17 @@ static struct symtab *
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);
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index 81bbf24..9f8db75 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -746,7 +746,7 @@ objfile_relocate1 (struct objfile *objfile,
ALL_OBJFILE_SYMTABS (objfile, s)
{
struct linetable *l;
- struct blockvector *bv;
+ const struct blockvector *bv;
int i;
/* First the line table. */
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index 2787f4c..ba6a58a 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -517,7 +517,7 @@ lookup_symbol_aux_psymtabs (struct objfile *objfile,
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);
@@ -2003,7 +2003,7 @@ maintenance_check_psymtabs (char *ignore, int from_tty)
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;
diff --git a/gdb/python/py-symtab.c b/gdb/python/py-symtab.c
index d4c2dad..8f4208d 100644
--- a/gdb/python/py-symtab.c
+++ b/gdb/python/py-symtab.c
@@ -161,7 +161,7 @@ stpy_global_block (PyObject *self, PyObject *args)
{
struct symtab *symtab = NULL;
struct block *block = NULL;
- struct blockvector *blockvector;
+ const struct blockvector *blockvector;
STPY_REQUIRE_VALID (self, symtab);
@@ -177,7 +177,7 @@ stpy_static_block (PyObject *self, PyObject *args)
{
struct symtab *symtab = NULL;
struct block *block = NULL;
- struct blockvector *blockvector;
+ const struct blockvector *blockvector;
STPY_REQUIRE_VALID (self, symtab);
diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c
index 4fc3ca5..8a7884c 100644
--- a/gdb/spu-tdep.c
+++ b/gdb/spu-tdep.c
@@ -1985,7 +1985,7 @@ spu_catch_start (struct objfile *objfile)
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;
diff --git a/gdb/symmisc.c b/gdb/symmisc.c
index 7ea97bd..de2e166 100644
--- a/gdb/symmisc.c
+++ b/gdb/symmisc.c
@@ -291,7 +291,7 @@ dump_symtab_1 (struct objfile *objfile, struct symtab *symtab,
struct dict_iterator iter;
int len;
struct linetable *l;
- struct blockvector *bv;
+ const struct blockvector *bv;
struct symbol *sym;
struct block *b;
int depth;
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 3c9e0dd..655c6e8 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -1615,7 +1615,7 @@ lookup_global_symbol_from_objfile (const struct objfile *main_objfile,
{
const struct objfile *objfile;
struct symbol *sym;
- struct blockvector *bv;
+ const struct blockvector *bv;
const struct block *block;
struct symtab *s;
@@ -1655,7 +1655,7 @@ lookup_symbol_aux_objfile (struct objfile *objfile, int block_index,
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;
@@ -1758,7 +1758,7 @@ lookup_symbol_aux_quick (struct objfile *objfile, int kind,
const char *name, const domain_enum domain)
{
struct symtab *symtab;
- struct blockvector *bv;
+ const struct blockvector *bv;
const struct block *block;
struct symbol *sym;
@@ -1946,7 +1946,7 @@ basic_lookup_transparent_type_quick (struct objfile *objfile, int kind,
const char *name)
{
struct symtab *symtab;
- struct blockvector *bv;
+ const struct blockvector *bv;
struct block *block;
struct symbol *sym;
@@ -1979,7 +1979,7 @@ basic_lookup_transparent_type (const char *name)
{
struct symbol *sym;
struct symtab *s = NULL;
- struct blockvector *bv;
+ const struct blockvector *bv;
struct objfile *objfile;
struct block *block;
struct type *t;
@@ -2136,7 +2136,7 @@ struct symtab *
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;
@@ -2279,7 +2279,7 @@ find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent)
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;
@@ -3516,7 +3516,7 @@ search_symbols (char *regexp, enum search_domain kind,
struct symbol_search **matches)
{
struct symtab *s;
- struct blockvector *bv;
+ const struct blockvector *bv;
struct block *b;
int i = 0;
struct block_iterator iter;
diff --git a/gdb/symtab.h b/gdb/symtab.h
index 94b9c60..5ccc7ec 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -882,7 +882,7 @@ struct symtab
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. */
--
1.9.3
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 1/7] constify struct block in some places
2014-06-11 18:53 [PATCH 0/7] more constification Tom Tromey
` (3 preceding siblings ...)
2014-06-11 18:53 ` [PATCH 3/7] fix up parse_cli_boolean_value after rebase Tom Tromey
@ 2014-06-11 18:53 ` Tom Tromey
2014-06-11 19:46 ` [PATCH 5/7] constify complete_line Tom Tromey
` (4 subsequent siblings)
9 siblings, 0 replies; 17+ messages in thread
From: Tom Tromey @ 2014-06-11 18:53 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
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 <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.
---
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;
--
1.9.3
^ permalink raw reply [flat|nested] 17+ messages in thread