Replace with equivalent methods.
Change-Id: I334a319909a50b5cc5570a45c38c70e10dc00630
if (block->function () != nullptr && is_nonfunction (result))
return;
- block = BLOCK_SUPERBLOCK (block);
+ block = block->superblock ();
}
}
}
if (block->function () != NULL)
break;
- block = BLOCK_SUPERBLOCK (block);
+ block = block->superblock ();
}
}
/* Search upwards from currently selected frame (so that we can
complete on local vars. */
- for (b = get_selected_block (0); b != NULL; b = BLOCK_SUPERBLOCK (b))
+ for (b = get_selected_block (0); b != NULL; b = b->superblock ())
{
- if (!BLOCK_SUPERBLOCK (b))
+ if (!b->superblock ())
surrounding_static_block = b; /* For elmin of dups */
ALL_BLOCK_SYMBOLS (b, iter, sym)
except if A was inlined. */
if (!allow_nested && a->function () != NULL && !block_inlined_p (a))
return false;
- a = BLOCK_SUPERBLOCK (a);
+ a = a->superblock ();
}
while (a != NULL);
block_linkage_function (const struct block *bl)
{
while ((bl->function () == NULL || block_inlined_p (bl))
- && BLOCK_SUPERBLOCK (bl) != NULL)
- bl = BLOCK_SUPERBLOCK (bl);
+ && bl->superblock () != NULL)
+ bl = bl->superblock ();
return bl->function ();
}
struct symbol *
block_containing_function (const struct block *bl)
{
- while (bl->function () == NULL && BLOCK_SUPERBLOCK (bl) != NULL)
- bl = BLOCK_SUPERBLOCK (bl);
+ while (bl->function () == NULL && bl->superblock () != NULL)
+ bl = bl->superblock ();
return bl->function ();
}
const char *
block_scope (const struct block *block)
{
- for (; block != NULL; block = BLOCK_SUPERBLOCK (block))
+ for (; block != NULL; block = block->superblock ())
{
if (BLOCK_NAMESPACE (block) != NULL
&& BLOCK_NAMESPACE (block)->scope != NULL)
const struct block *
block_static_block (const struct block *block)
{
- if (block == NULL || BLOCK_SUPERBLOCK (block) == NULL)
+ if (block == NULL || block->superblock () == NULL)
return NULL;
- while (BLOCK_SUPERBLOCK (BLOCK_SUPERBLOCK (block)) != NULL)
- block = BLOCK_SUPERBLOCK (block);
+ while (block->superblock ()->superblock () != NULL)
+ block = block->superblock ();
return block;
}
if (block == NULL)
return NULL;
- while (BLOCK_SUPERBLOCK (block) != NULL)
- block = BLOCK_SUPERBLOCK (block);
+ while (block->superblock () != NULL)
+ block = block->superblock ();
return block;
}
{
struct global_block *gb;
- gdb_assert (BLOCK_SUPERBLOCK (block) == NULL);
+ gdb_assert (block->superblock () == NULL);
gb = (struct global_block *) block;
gdb_assert (gb->compunit_symtab == NULL);
gb->compunit_symtab = cu;
{
struct global_block *gb;
- gdb_assert (BLOCK_SUPERBLOCK (block) == NULL);
+ gdb_assert (block->superblock () == NULL);
gb = (struct global_block *) block;
gdb_assert (gb->compunit_symtab != NULL);
return gb->compunit_symtab;
iter->idx = -1;
- if (BLOCK_SUPERBLOCK (block) == NULL)
+ if (block->superblock () == NULL)
{
which = GLOBAL_BLOCK;
cu = get_block_compunit_symtab (block);
}
- else if (BLOCK_SUPERBLOCK (BLOCK_SUPERBLOCK (block)) == NULL)
+ else if (block->superblock ()->superblock () == NULL)
{
which = STATIC_BLOCK;
- cu = get_block_compunit_symtab (BLOCK_SUPERBLOCK (block));
+ cu = get_block_compunit_symtab (block->superblock ());
}
else
{
lookup_name_info lookup_name (name, symbol_name_match_type::FULL);
/* Verify BLOCK is STATIC_BLOCK or GLOBAL_BLOCK. */
- gdb_assert (BLOCK_SUPERBLOCK (block) == NULL
- || BLOCK_SUPERBLOCK (BLOCK_SUPERBLOCK (block)) == NULL);
+ gdb_assert (block->superblock () == NULL
+ || block->superblock ()->superblock () == NULL);
other = NULL;
for (sym
lookup_name_info lookup_name (name, symbol_name_match_type::FULL);
/* Verify BLOCK is STATIC_BLOCK or GLOBAL_BLOCK. */
- gdb_assert (BLOCK_SUPERBLOCK (block) == NULL
- || BLOCK_SUPERBLOCK (BLOCK_SUPERBLOCK (block)) == NULL);
+ gdb_assert (block->superblock () == NULL
+ || block->superblock ()->superblock () == NULL);
ALL_BLOCK_SYMBOLS_WITH_NAME (block, lookup_name, iter, sym)
{
void set_function (symbol *function)
{ m_function = function; }
+ /* Return this block's superblock. */
+ const block *superblock () const
+ { return m_superblock; }
+
+ /* Set this block's superblock. */
+ void set_superblock (const block *superblock)
+ { m_superblock = superblock; }
+
/* Addresses in the executable code that are in this block. */
CORE_ADDR m_start;
case of C) is the STATIC_BLOCK. The superblock of the
STATIC_BLOCK is the GLOBAL_BLOCK. */
- const struct block *superblock;
+ const struct block *m_superblock;
/* This is used to store the symbols in the block. */
struct compunit_symtab *compunit_symtab;
};
-#define BLOCK_SUPERBLOCK(bl) (bl)->superblock
#define BLOCK_MULTIDICT(bl) (bl)->multidict
#define BLOCK_NAMESPACE(bl) (bl)->namespace_info
if (block_inlined_p (bl))
inline_count--;
- bl = BLOCK_SUPERBLOCK (bl);
+ bl = bl->superblock ();
gdb_assert (bl != NULL);
}
if (bl == NULL)
return NULL;
- while (bl->function () == NULL && BLOCK_SUPERBLOCK (bl) != NULL)
- bl = BLOCK_SUPERBLOCK (bl);
+ while (bl->function () == NULL && bl->superblock () != NULL)
+ bl = bl->superblock ();
return bl->function ();
}
pblock && pblock != old_blocks;
pblock = pblock->next)
{
- if (BLOCK_SUPERBLOCK (pblock->block) == NULL)
+ if (pblock->block->superblock () == NULL)
{
/* Check to be sure the blocks are nested as we receive
them. If the compiler/assembler/linker work, this just
if (pblock->block->end () > block->end ())
pblock->block->set_end (block->end ());
}
- BLOCK_SUPERBLOCK (pblock->block) = block;
+ pblock->block->set_superblock (block);
}
opblock = pblock;
}
done. */
if (block->function () != NULL)
break;
- block = BLOCK_SUPERBLOCK (block);
+ block = block->superblock ();
}
return registers_used;
while (function_block != BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK)
&& function_block != BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK))
{
- function_block = BLOCK_SUPERBLOCK (function_block);
+ function_block = function_block->superblock ();
function = function_block->function ();
if (function != NULL)
break;
}
if (function != NULL
- && (BLOCK_SUPERBLOCK (function_block)
+ && (function_block->superblock ()
== BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK))
&& symbol_matches_search_name (function, func_matcher))
break;
struct type *context;
std::string name_copy (function->natural_name ());
const struct language_defn *lang = language_def (language_cplus);
- const struct block *parent = BLOCK_SUPERBLOCK (block);
+ const struct block *parent = block->superblock ();
struct symbol *sym;
while (1)
if (sym.symbol)
return sym;
- block = BLOCK_SUPERBLOCK (block);
+ block = block->superblock ();
}
return {};
for (block = get_selected_block (0);
block != NULL;
- block = BLOCK_SUPERBLOCK (block))
+ block = block->superblock ())
for (current = block_using (block);
current != NULL;
current = current->next)
/* Search upwards from currently selected frame (so that we can
complete on local vars. */
- for (b = get_selected_block (0); b != NULL; b = BLOCK_SUPERBLOCK (b))
+ for (b = get_selected_block (0); b != NULL; b = b->superblock ())
add_symbol_overload_list_block (func_name, b, overload_list);
surrounding_static_block = block_static_block (get_selected_block (0));
if (sym.symbol != NULL)
return sym;
- block = BLOCK_SUPERBLOCK (block);
+ block = block->superblock ();
}
return {};
continue to its superblock, the block of per-file symbols. */
if (block->function ())
break;
- block = BLOCK_SUPERBLOCK (block);
+ block = block->superblock ();
}
if (!values_printed)
else
/* We must be in some function nested lexical block. Just get the
outer block: both must share the same frame. */
- frame_block = BLOCK_SUPERBLOCK (frame_block);
+ frame_block = frame_block->superblock ();
}
/* Old compilers may not provide a static link, or they may provide an
return NULL;
}
- block = BLOCK_SUPERBLOCK (block);
+ block = block->superblock ();
}
return NULL;
gdbscm_printf (port, "#<%s", block_smob_name);
- if (BLOCK_SUPERBLOCK (b) == NULL)
+ if (b->superblock () == NULL)
gdbscm_printf (port, " global");
- else if (BLOCK_SUPERBLOCK (BLOCK_SUPERBLOCK (b)) == NULL)
+ else if (b->superblock ()->superblock () == NULL)
gdbscm_printf (port, " static");
if (b->function () != NULL)
const struct block *block = b_smob->block;
const struct block *super_block;
- super_block = BLOCK_SUPERBLOCK (block);
+ super_block = block->superblock ();
if (super_block)
return bkscm_scm_from_block (super_block, b_smob->objfile);
const struct block *block = b_smob->block;
const struct block *static_block;
- if (BLOCK_SUPERBLOCK (block) == NULL)
+ if (block->superblock () == NULL)
return SCM_BOOL_F;
static_block = block_static_block (block);
= bkscm_get_valid_block_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
const struct block *block = b_smob->block;
- return scm_from_bool (BLOCK_SUPERBLOCK (block) == NULL);
+ return scm_from_bool (block->superblock () == NULL);
}
/* (block-static? <gdb:block>) -> boolean
= bkscm_get_valid_block_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
const struct block *block = b_smob->block;
- if (BLOCK_SUPERBLOCK (block) != NULL
- && BLOCK_SUPERBLOCK (BLOCK_SUPERBLOCK (block)) == NULL)
+ if (block->superblock () != NULL
+ && block->superblock ()->superblock () == NULL)
return SCM_BOOL_T;
return SCM_BOOL_F;
}
for (fn_block = block;
fn_block != NULL && fn_block->function () == NULL;
- fn_block = BLOCK_SUPERBLOCK (fn_block))
+ fn_block = fn_block->superblock ())
continue;
if (block == NULL || fn_block == NULL || fn_block->function () == NULL)
location. */
depth = 0;
cur_block = frame_block;
- while (BLOCK_SUPERBLOCK (cur_block))
+ while (cur_block->superblock ())
{
if (block_inlined_p (cur_block))
depth++;
else if (cur_block->function () != NULL)
break;
- cur_block = BLOCK_SUPERBLOCK (cur_block);
+ cur_block = cur_block->superblock ();
}
/* Check how many inlined functions already have frames. */
if (frame_block != NULL)
{
cur_block = frame_block;
- while (BLOCK_SUPERBLOCK (cur_block))
+ while (cur_block->superblock ())
{
if (block_inlined_p (cur_block))
{
else if (cur_block->function () != NULL)
break;
- cur_block = BLOCK_SUPERBLOCK (cur_block);
+ cur_block = cur_block->superblock ();
}
}
: allocate_block (&objfile->objfile_obstack));
BLOCK_MULTIDICT (new_block)
= mdict_create_linear (&objfile->objfile_obstack, NULL);
- BLOCK_SUPERBLOCK (new_block) = block_iter;
+ new_block->set_superblock (block_iter);
block_iter = new_block;
new_block->set_start (begin);
{
/* If the plugin specifically mentioned a parent block, we
use that. */
- BLOCK_SUPERBLOCK (gdb_block_iter.real_block) =
- gdb_block_iter.parent->real_block;
+ gdb_block_iter.real_block->set_superblock
+ (gdb_block_iter.parent->real_block);
+
}
else
{
/* And if not, we set a default parent block. */
- BLOCK_SUPERBLOCK (gdb_block_iter.real_block) =
- BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
+ gdb_block_iter.real_block->set_superblock
+ (BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK));
}
}
}
for (block = BLOCKVECTOR_BLOCK (symtab->compunit ()->blockvector (),
STATIC_BLOCK);
block != NULL;
- block = BLOCK_SUPERBLOCK (block))
+ block = block->superblock ())
current_language->iterate_over_symbols (block, name, domain, callback);
}
for (;
block && !block->function ();
- block = BLOCK_SUPERBLOCK (block))
+ block = block->superblock ())
;
if (!block)
b->set_function (s);
b->set_start (sh->value);
b->set_end (sh->value);
- BLOCK_SUPERBLOCK (b) = top_stack->cur_block;
+ b->set_superblock (top_stack->cur_block);
add_block (b, top_stack->cur_st);
/* Not if we only have partial info. */
top_stack->blocktype = stBlock;
b = new_block (NON_FUNCTION_BLOCK, psymtab_language);
b->set_start (sh->value + top_stack->procadr);
- BLOCK_SUPERBLOCK (b) = top_stack->cur_block;
+ b->set_superblock (top_stack->cur_block);
top_stack->cur_block = b;
add_block (b, top_stack->cur_st);
break;
{
struct block *b_bad = BLOCKVECTOR_BLOCK (bv, i);
- if (BLOCK_SUPERBLOCK (b_bad) == cblock
+ if (b_bad->superblock () == cblock
&& b_bad->start () == top_stack->procadr
&& b_bad->end () == top_stack->procadr)
{
return sym;
}
- block = BLOCK_SUPERBLOCK (block);
+ block = block->superblock ();
if (block)
return mylookup_symbol (name, block, domain, theclass);
return 0;
bv = new_bvect (2);
BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK) = new_block (NON_FUNCTION_BLOCK, lang);
BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK) = new_block (NON_FUNCTION_BLOCK, lang);
- BLOCK_SUPERBLOCK (BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK)) =
- BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
+ BLOCKVECTOR_BLOCK(bv, STATIC_BLOCK)->set_superblock
+ (BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK));
cust->set_blockvector (bv);
cust->set_debugformat ("ECOFF");
if (block->function ())
break;
else
- block = BLOCK_SUPERBLOCK (block);
+ block = block->superblock ();
}
}
BLPY_REQUIRE_VALID (self, block);
- super_block = BLOCK_SUPERBLOCK (block);
+ super_block = block->superblock ();
if (super_block)
return block_to_block_object (super_block, self_obj->objfile);
BLPY_REQUIRE_VALID (self, block);
- if (BLOCK_SUPERBLOCK (block) == NULL)
+ if (block->superblock () == NULL)
Py_RETURN_NONE;
static_block = block_static_block (block);
BLPY_REQUIRE_VALID (self, block);
- if (BLOCK_SUPERBLOCK (block))
+ if (block->superblock ())
Py_RETURN_FALSE;
Py_RETURN_TRUE;
BLPY_REQUIRE_VALID (self, block);
- if (BLOCK_SUPERBLOCK (block) != NULL
- && BLOCK_SUPERBLOCK (BLOCK_SUPERBLOCK (block)) == NULL)
+ if (block->superblock () != NULL
+ && block->superblock ()->superblock () == NULL)
Py_RETURN_TRUE;
Py_RETURN_FALSE;
for (fn_block = block;
fn_block != NULL && fn_block->function () == NULL;
- fn_block = BLOCK_SUPERBLOCK (fn_block))
+ fn_block = fn_block->superblock ())
;
if (block == NULL || fn_block == NULL || fn_block->function () == NULL)
symbols. */
if (block->function ())
break;
- block = BLOCK_SUPERBLOCK (block);
+ block = block->superblock ();
}
}
gdb_printf (outfile, "%*sblock #%03d, object at %s",
depth, "", i,
host_address_to_string (b));
- if (BLOCK_SUPERBLOCK (b))
+ if (b->superblock ())
gdb_printf (outfile, " under %s",
- host_address_to_string (BLOCK_SUPERBLOCK (b)));
+ host_address_to_string (b->superblock ()));
/* drow/2002-07-10: We could save the total symbols count
even if we're using a hashtable, but nothing else but this message
wants it. */
{
int i = 0;
- while ((block = BLOCK_SUPERBLOCK (block)) != NULL)
+ while ((block = block->superblock ()) != NULL)
{
i++;
}
}
if (block->function ())
break;
- block = BLOCK_SUPERBLOCK (block);
+ block = block->superblock ();
}
if (symbol_lookup_debug > 1)
if (block->function () != NULL && block_inlined_p (block))
break;
- block = BLOCK_SUPERBLOCK (block);
+ block = block->superblock ();
}
/* We've reached the end of the function without finding a result. */
function_block = b;
else if (b->function () != NULL)
break;
- b = BLOCK_SUPERBLOCK (b);
+ b = b->superblock ();
}
if (function_block != NULL
&& function_block->function ()->line () != 0)
bl = NULL;
break;
}
- bl = BLOCK_SUPERBLOCK (bl);
+ bl = bl->superblock ();
}
if (bl != NULL)
break;
are in scope for a nested function. */
if (b->function () != NULL && block_inlined_p (b))
break;
- b = BLOCK_SUPERBLOCK (b);
+ b = b->superblock ();
}
/* Add fields from the file's types; symbols will be added below. */
if (block->function ())
break;
else
- block = BLOCK_SUPERBLOCK (block);
+ block = block->superblock ();
}
if (count <= 0)
gdb_printf ("Scope for %s contains no locals or arguments.\n",