Replace with equivalent methods.
Change-Id: I31ec00f5bf85335c8b23d306ca0fe0b84d489101
/* If we found a non-function match, assume that's the one. We
only check this when finding a function boundary, so that we
can accumulate all results from intervening blocks first. */
- if (BLOCK_FUNCTION (block) != nullptr && is_nonfunction (result))
+ if (block->function () != nullptr && is_nonfunction (result))
return;
block = BLOCK_SUPERBLOCK (block);
}
}
}
- if (BLOCK_FUNCTION (block) != NULL)
+ if (block->function () != NULL)
break;
block = BLOCK_SUPERBLOCK (block);
}
{
const struct global_block *global_block;
- if (BLOCK_FUNCTION (block) != NULL)
- return BLOCK_FUNCTION (block)->objfile ();
+ if (block->function () != nullptr)
+ return block->function ()->objfile ();
global_block = (struct global_block *) block_global_block (block);
return global_block->compunit_symtab->objfile ();
struct gdbarch *
block_gdbarch (const struct block *block)
{
- if (BLOCK_FUNCTION (block) != NULL)
- return BLOCK_FUNCTION (block)->arch ();
+ if (block->function () != nullptr)
+ return block->function ()->arch ();
return block_objfile (block)->arch ();
}
return true;
/* If A is a function block, then A cannot be contained in B,
except if A was inlined. */
- if (!allow_nested && BLOCK_FUNCTION (a) != NULL && !block_inlined_p (a))
+ if (!allow_nested && a->function () != NULL && !block_inlined_p (a))
return false;
a = BLOCK_SUPERBLOCK (a);
}
struct symbol *
block_linkage_function (const struct block *bl)
{
- while ((BLOCK_FUNCTION (bl) == NULL || block_inlined_p (bl))
+ while ((bl->function () == NULL || block_inlined_p (bl))
&& BLOCK_SUPERBLOCK (bl) != NULL)
bl = BLOCK_SUPERBLOCK (bl);
- return BLOCK_FUNCTION (bl);
+ return bl->function ();
}
/* Return the symbol for the function which contains a specified
struct symbol *
block_containing_function (const struct block *bl)
{
- while (BLOCK_FUNCTION (bl) == NULL && BLOCK_SUPERBLOCK (bl) != NULL)
+ while (bl->function () == NULL && BLOCK_SUPERBLOCK (bl) != NULL)
bl = BLOCK_SUPERBLOCK (bl);
- return BLOCK_FUNCTION (bl);
+ return bl->function ();
}
/* Return one if BL represents an inlined function. */
int
block_inlined_p (const struct block *bl)
{
- return BLOCK_FUNCTION (bl) != NULL && BLOCK_FUNCTION (bl)->is_inlined ();
+ return bl->function () != NULL && bl->function ()->is_inlined ();
}
/* A helper function that checks whether PC is in the blockvector BL.
/* Only objfile-owned blocks that materialize top function scopes can have
static links. */
- if (objfile == NULL || BLOCK_FUNCTION (block) == NULL)
+ if (objfile == NULL || block->function () == NULL)
return NULL;
return (struct dynamic_prop *) objfile_lookup_static_link (objfile, block);
lookup_name_info lookup_name (name, match_type);
- if (!BLOCK_FUNCTION (block))
+ if (!block->function ())
{
struct symbol *other = NULL;
void set_end (CORE_ADDR end)
{ m_end = end; }
+ /* Return this block's function symbol. */
+ symbol *function () const
+ { return m_function; }
+
+ /* Set this block's function symbol. */
+ void set_function (symbol *function)
+ { m_function = function; }
+
/* Addresses in the executable code that are in this block. */
CORE_ADDR m_start;
/* The symbol that names this block, if the block is the body of a
function (real or inlined); otherwise, zero. */
- struct symbol *function;
+ struct symbol *m_function;
/* The `struct block' for the containing block, or 0 if none.
struct compunit_symtab *compunit_symtab;
};
-#define BLOCK_FUNCTION(bl) (bl)->function
#define BLOCK_SUPERBLOCK(bl) (bl)->superblock
#define BLOCK_MULTIDICT(bl) (bl)->multidict
#define BLOCK_NAMESPACE(bl) (bl)->namespace_info
if (bl == NULL)
return NULL;
- while (BLOCK_FUNCTION (bl) == NULL && BLOCK_SUPERBLOCK (bl) != NULL)
+ while (bl->function () == NULL && BLOCK_SUPERBLOCK (bl) != NULL)
bl = BLOCK_SUPERBLOCK (bl);
- return BLOCK_FUNCTION (bl);
+ return bl->function ();
}
\f
struct type *ftype = symbol->type ();
struct mdict_iterator miter;
symbol->set_value_block (block);
- BLOCK_FUNCTION (block) = symbol;
+ block->set_function (symbol);
if (ftype->num_fields () <= 0)
{
}
}
else
- {
- BLOCK_FUNCTION (block) = NULL;
- }
+ block->set_function (nullptr);
if (static_link != NULL)
objfile_register_static_link (m_objfile, block, static_link);
Skip blocks which correspond to a function; they're not
physically nested inside this other blocks, only
lexically nested. */
- if (BLOCK_FUNCTION (pblock->block) == NULL
+ if (pblock->block->function () == NULL
&& (pblock->block->start () < block->start ()
|| pblock->block->end () > block->end ()))
{
/* Inlined functions may have symbols not in the global or
static symbol lists. */
- if (BLOCK_FUNCTION (block) != NULL)
- if (BLOCK_FUNCTION (block)->symtab () == NULL)
- BLOCK_FUNCTION (block)->set_symtab (symtab);
+ if (block->function () != nullptr
+ && block->function ()->symtab () == nullptr)
+ block->function ()->set_symtab (symtab);
/* Note that we only want to fix up symbols from the local
blocks, not blocks coming from included symtabs. That is why
/* If we just finished the outermost block of a function, we're
done. */
- if (BLOCK_FUNCTION (block) != NULL)
+ if (block->function () != NULL)
break;
block = BLOCK_SUPERBLOCK (block);
}
const struct block *function_block;
block = BLOCKVECTOR_BLOCK (bv, block_loop);
- if (BLOCK_FUNCTION (block) != NULL)
+ if (block->function () != NULL)
continue;
gdb_val_sym = block_lookup_symbol (block,
COMPILE_I_EXPR_VAL,
&& function_block != BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK))
{
function_block = BLOCK_SUPERBLOCK (function_block);
- function = BLOCK_FUNCTION (function_block);
+ function = function_block->function ();
if (function != NULL)
break;
}
const struct block *block,
const domain_enum domain)
{
- struct symbol *function = BLOCK_FUNCTION (block);
+ struct symbol *function = block->function ();
struct block_symbol result;
if (symbol_lookup_debug)
info_common_command_for_block (block, comname, &values_printed);
/* After handling the function's top-level block, stop. Don't
continue to its superblock, the block of per-file symbols. */
- if (BLOCK_FUNCTION (block))
+ if (block->function ())
break;
block = BLOCK_SUPERBLOCK (block);
}
/* Assuming we have a block for this frame: if we are at the function
level, the immediate upper lexical block is in an outer function:
follow the static link. */
- else if (BLOCK_FUNCTION (frame_block))
+ else if (frame_block->function ())
{
const struct dynamic_prop *static_link
= block_static_link (frame_block);
frame = block_innermost_frame (var_block);
if (frame == NULL)
{
- if (BLOCK_FUNCTION (var_block)
+ if (var_block->function ()
&& !block_inlined_p (var_block)
- && BLOCK_FUNCTION (var_block)->print_name ())
+ && var_block->function ()->print_name ())
error (_("No frame is currently executing in block %s."),
- BLOCK_FUNCTION (var_block)->print_name ());
+ var_block->function ()->print_name ());
else
error (_("No frame is currently executing in specified"
" block"));
{
while (block != NULL)
{
- struct symbol *function = BLOCK_FUNCTION (block);
+ struct symbol *function = block->function ();
if (function != NULL)
{
else if (BLOCK_SUPERBLOCK (BLOCK_SUPERBLOCK (b)) == NULL)
gdbscm_printf (port, " static");
- if (BLOCK_FUNCTION (b) != NULL)
- gdbscm_printf (port, " %s", BLOCK_FUNCTION (b)->print_name ());
+ if (b->function () != NULL)
+ gdbscm_printf (port, " %s", b->function ()->print_name ());
gdbscm_printf (port, " %s-%s",
hex_string (b->start ()), hex_string (b->end ()));
const struct block *block = b_smob->block;
struct symbol *sym;
- sym = BLOCK_FUNCTION (block);
+ sym = block->function ();
if (sym != NULL)
return syscm_scm_from_symbol (sym);
}
for (fn_block = block;
- fn_block != NULL && BLOCK_FUNCTION (fn_block) == NULL;
+ fn_block != NULL && fn_block->function () == NULL;
fn_block = BLOCK_SUPERBLOCK (fn_block))
continue;
- if (block == NULL || fn_block == NULL || BLOCK_FUNCTION (fn_block) == NULL)
+ if (block == NULL || fn_block == NULL || fn_block->function () == NULL)
{
scm_misc_error (FUNC_NAME, _("cannot find block for frame"),
scm_list_1 (self));
if (block != NULL)
{
return bkscm_scm_from_block
- (block, BLOCK_FUNCTION (fn_block)->objfile ());
+ (block, fn_block->function ()->objfile ());
}
return SCM_BOOL_F;
{
if (block_inlined_p (cur_block))
depth++;
- else if (BLOCK_FUNCTION (cur_block) != NULL)
+ else if (cur_block->function () != NULL)
break;
cur_block = BLOCK_SUPERBLOCK (cur_block);
break;
skip_count++;
- skipped_syms.push_back (BLOCK_FUNCTION (cur_block));
+ skipped_syms.push_back (cur_block->function ());
}
else
break;
}
- else if (BLOCK_FUNCTION (cur_block) != NULL)
+ else if (cur_block->function () != NULL)
break;
cur_block = BLOCK_SUPERBLOCK (cur_block);
block_name->m_name = obstack_strdup (&objfile->objfile_obstack,
gdb_block_iter.name.get ());
- BLOCK_FUNCTION (new_block) = block_name;
+ new_block->set_function (block_name);
BLOCKVECTOR_BLOCK (bv, block_idx) = new_block;
if (begin > new_block->start ())
block = get_current_search_block ();
for (;
- block && !BLOCK_FUNCTION (block);
+ block && !block->function ();
block = BLOCK_SUPERBLOCK (block))
;
if (!block)
return {};
- fn_sym = BLOCK_FUNCTION (block);
+ fn_sym = block->function ();
find_label_symbols_in_block (block, name, fn_sym, completion_mode,
&result, label_funcs_ret);
/* Create and enter a new lexical context. */
b = new_block (FUNCTION_BLOCK, s->language ());
s->set_value_block (b);
- BLOCK_FUNCTION (b) = s;
+ b->set_function (s);
b->set_start (sh->value);
b->set_end (sh->value);
BLOCK_SUPERBLOCK (b) = top_stack->cur_block;
}
}
- if (BLOCK_FUNCTION (block))
+ if (block->function ())
break;
else
block = BLOCK_SUPERBLOCK (block);
BLPY_REQUIRE_VALID (self, block);
- sym = BLOCK_FUNCTION (block);
+ sym = block->function ();
if (sym)
return symbol_to_symbol_object (sym);
}
for (fn_block = block;
- fn_block != NULL && BLOCK_FUNCTION (fn_block) == NULL;
+ fn_block != NULL && fn_block->function () == NULL;
fn_block = BLOCK_SUPERBLOCK (fn_block))
;
- if (block == NULL || fn_block == NULL || BLOCK_FUNCTION (fn_block) == NULL)
+ if (block == NULL || fn_block == NULL || fn_block->function () == NULL)
{
PyErr_SetString (PyExc_RuntimeError,
_("Cannot locate block for frame."));
if (block)
{
return block_to_block_object
- (block, BLOCK_FUNCTION (fn_block)->objfile ());
+ (block, fn_block->function ()->objfile ());
}
Py_RETURN_NONE;
/* After handling the function's top-level block, stop. Don't
continue to its superblock, the block of per-file
symbols. */
- if (BLOCK_FUNCTION (block))
+ if (block->function ())
break;
block = BLOCK_SUPERBLOCK (block);
}
gdb_puts (paddress (gdbarch, b->start ()), outfile);
gdb_printf (outfile, "..");
gdb_puts (paddress (gdbarch, b->end ()), outfile);
- if (BLOCK_FUNCTION (b))
+ if (b->function ())
{
gdb_printf (outfile, ", function %s",
- BLOCK_FUNCTION (b)->linkage_name ());
- if (BLOCK_FUNCTION (b)->demangled_name () != NULL)
+ b->function ()->linkage_name ());
+ if (b->function ()->demangled_name () != NULL)
{
gdb_printf (outfile, ", %s",
- BLOCK_FUNCTION (b)->demangled_name ());
+ b->function ()->demangled_name ());
}
}
gdb_printf (outfile, "\n");
}
return (struct block_symbol) {sym, block};
}
- if (BLOCK_FUNCTION (block))
+ if (block->function ())
break;
block = BLOCK_SUPERBLOCK (block);
}
return blocksym;
}
- if (BLOCK_FUNCTION (block) != NULL && block_inlined_p (block))
+ if (block->function () != NULL && block_inlined_p (block))
break;
block = BLOCK_SUPERBLOCK (block);
}
function_block = NULL;
while (b != NULL)
{
- if (BLOCK_FUNCTION (b) != NULL && block_inlined_p (b))
+ if (b->function () != NULL && block_inlined_p (b))
function_block = b;
- else if (BLOCK_FUNCTION (b) != NULL)
+ else if (b->function () != NULL)
break;
b = BLOCK_SUPERBLOCK (b);
}
if (function_block != NULL
- && BLOCK_FUNCTION (function_block)->line () != 0)
+ && function_block->function ()->line () != 0)
{
- sal->line = BLOCK_FUNCTION (function_block)->line ();
- sal->symtab = BLOCK_FUNCTION (function_block)->symtab ();
+ sal->line = function_block->function ()->line ();
+ sal->symtab = function_block->function ()->symtab ();
}
}
{
if (block_inlined_p (bl))
break;
- if (BLOCK_FUNCTION (bl))
+ if (bl->function ())
{
bl = NULL;
break;
/* Stop when we encounter an enclosing function. Do not stop for
non-inlined functions - the locals of the enclosing function
are in scope for a nested function. */
- if (BLOCK_FUNCTION (b) != NULL && block_inlined_p (b))
+ if (b->function () != NULL && block_inlined_p (b))
break;
b = BLOCK_SUPERBLOCK (b);
}
gdb_printf (", length %s.\n", pulongest (TYPE_LENGTH (t)));
}
}
- if (BLOCK_FUNCTION (block))
+ if (block->function ())
break;
else
block = BLOCK_SUPERBLOCK (block);