Replace with equivalent methods.
Change-Id: I10a6c8a2a86462d9d4a6a6409a3f07a6bea66310
CORE_ADDR startaddr;
find_pc_partial_function (pc, &sh_name, &startaddr, NULL);
- if (startaddr > BLOCK_START (b))
+ if (startaddr > b->start ())
/* This is the "pathological" case referred to in a comment in
print_frame_info. It might be better to move this check into
symbol reading. */
{
half = (top - bot + 1) >> 1;
b = BLOCKVECTOR_BLOCK (bl, bot + half);
- if (BLOCK_START (b) <= pc)
+ if (b->start () <= pc)
bot += half;
else
top = bot + half;
while (bot >= STATIC_BLOCK)
{
b = BLOCKVECTOR_BLOCK (bl, bot);
- if (!(BLOCK_START (b) <= pc))
+ if (!(b->start () <= pc))
return NULL;
- if (BLOCK_END (b) > pc)
+ if (b->end () > pc)
return b;
bot--;
}
struct block
{
+ /* Return this block's start address. */
+ CORE_ADDR start () const
+ { return m_start; }
+
+ /* Set this block's start address. */
+ void set_start (CORE_ADDR start)
+ { m_start = start; }
+
+ /* Return this block's end address. */
+ CORE_ADDR end () const
+ { return m_end; }
+
+ /* Set this block's end address. */
+ void set_end (CORE_ADDR end)
+ { m_end = end; }
/* Addresses in the executable code that are in this block. */
- CORE_ADDR startaddr;
- CORE_ADDR endaddr;
+ CORE_ADDR m_start;
+ CORE_ADDR m_end;
/* The symbol that names this block, if the block is the body of a
function (real or inlined); otherwise, zero. */
struct compunit_symtab *compunit_symtab;
};
-#define BLOCK_START(bl) (bl)->startaddr
-#define BLOCK_END(bl) (bl)->endaddr
#define BLOCK_FUNCTION(bl) (bl)->function
#define BLOCK_SUPERBLOCK(bl) (bl)->superblock
#define BLOCK_MULTIDICT(bl) (bl)->multidict
too). BLOCK_ENTRY_PC can then be redefined to be less DWARF-centric. */
#define BLOCK_ENTRY_PC(bl) (BLOCK_CONTIGUOUS_P (bl) \
- ? BLOCK_START (bl) \
+ ? bl->start () \
: BLOCK_RANGE_START (bl,0))
struct blockvector
if (BLOCK_CONTIGUOUS_P (b))
{
- cache_pc_function_low = BLOCK_START (b);
- cache_pc_function_high = BLOCK_END (b);
+ cache_pc_function_low = b->start ();
+ cache_pc_function_high = b->end ();
}
else
{
}
}
- BLOCK_START (block) = start;
- BLOCK_END (block) = end;
+ block->set_start (start);
+ block->set_end (end);
/* Put the block in as the value of the symbol that names it. */
/* Check to be sure that the blocks have an end address that is
greater than starting address. */
- if (BLOCK_END (block) < BLOCK_START (block))
+ if (block->end () < block->start ())
{
if (symbol)
{
{
complaint (_("block end address %s less than block "
"start address %s (patched it)"),
- paddress (gdbarch, BLOCK_END (block)),
- paddress (gdbarch, BLOCK_START (block)));
+ paddress (gdbarch, block->end ()),
+ paddress (gdbarch, block->start ()));
}
/* Better than nothing. */
- BLOCK_END (block) = BLOCK_START (block);
+ block->set_end (block->start ());
}
/* Install this block as the superblock of all blocks made since the
physically nested inside this other blocks, only
lexically nested. */
if (BLOCK_FUNCTION (pblock->block) == NULL
- && (BLOCK_START (pblock->block) < BLOCK_START (block)
- || BLOCK_END (pblock->block) > BLOCK_END (block)))
+ && (pblock->block->start () < block->start ()
+ || pblock->block->end () > block->end ()))
{
if (symbol)
{
{
complaint (_("inner block (%s-%s) not "
"inside outer block (%s-%s)"),
- paddress (gdbarch, BLOCK_START (pblock->block)),
- paddress (gdbarch, BLOCK_END (pblock->block)),
- paddress (gdbarch, BLOCK_START (block)),
- paddress (gdbarch, BLOCK_END (block)));
+ paddress (gdbarch, pblock->block->start ()),
+ paddress (gdbarch, pblock->block->end ()),
+ paddress (gdbarch, block->start ()),
+ paddress (gdbarch, block->end ()));
}
- if (BLOCK_START (pblock->block) < BLOCK_START (block))
- BLOCK_START (pblock->block) = BLOCK_START (block);
- if (BLOCK_END (pblock->block) > BLOCK_END (block))
- BLOCK_END (pblock->block) = BLOCK_END (block);
+
+ if (pblock->block->start () < block->start ())
+ pblock->block->set_start (block->start ());
+
+ if (pblock->block->end () > block->end ())
+ pblock->block->set_end (block->end ());
}
BLOCK_SUPERBLOCK (pblock->block) = block;
}
become interesting. Note that even if this block doesn't have
any "interesting" ranges, some later block might, so we still
need to record this block in the addrmap. */
- if (start != BLOCK_START (block)
- || end_inclusive + 1 != BLOCK_END (block))
+ if (start != block->start ()
+ || end_inclusive + 1 != block->end ())
m_pending_addrmap_interesting = true;
if (m_pending_addrmap == nullptr)
{
for (i = 1; i < BLOCKVECTOR_NBLOCKS (blockvector); i++)
{
- if (BLOCK_START (BLOCKVECTOR_BLOCK (blockvector, i - 1))
- > BLOCK_START (BLOCKVECTOR_BLOCK (blockvector, i)))
+ if (BLOCKVECTOR_BLOCK(blockvector, i - 1)->start ()
+ > BLOCKVECTOR_BLOCK(blockvector, i)->start ())
{
CORE_ADDR start
- = BLOCK_START (BLOCKVECTOR_BLOCK (blockvector, i));
+ = BLOCKVECTOR_BLOCK(blockvector, i)->start ();
complaint (_("block at %s out of order"),
hex_string ((LONGEST) start));
std::stable_sort (barray.begin (), barray.end (),
[] (const block *a, const block *b)
{
- return BLOCK_START (a) > BLOCK_START (b);
+ return a->start () > b->start ();
});
int i = 0;
gdb_assert (static_block != NULL);
gdb_assert (m_subfiles != NULL);
- end_addr = BLOCK_END (static_block);
+ end_addr = static_block->end ();
/* Create the GLOBAL_BLOCK and build the blockvector. */
finish_block_internal (NULL, get_global_symbols (), NULL, NULL,
case LOC_BLOCK:
{
kind = GCC_CP_SYMBOL_FUNCTION;
- addr = BLOCK_START (sym.symbol->value_block ());
+ addr = sym.symbol->value_block()->start ();
if (is_global && sym.symbol->type ()->is_gnu_ifunc ())
addr = gnu_ifunc_resolve_addr (target_gdbarch (), addr);
}
gdb_printf (gdb_stdlog,
"gcc_symbol_address \"%s\": full symbol\n",
identifier);
- result = BLOCK_START (sym->value_block ());
+ result = sym->value_block ()->start ();
if (sym->type ()->is_gnu_ifunc ())
result = gnu_ifunc_resolve_addr (target_gdbarch (), result);
found = 1;
const char *filename = sym.symbol->symtab ()->filename;
unsigned int line = sym.symbol->line ();
- CORE_ADDR address = BLOCK_START (sym.symbol->value_block ());
+ CORE_ADDR address = sym.symbol->value_block()->start ();
const char *kind;
if (TYPE_FN_FIELD_STATIC_P (methods, j))
/* Get the (function) symbol matching prologue_start. */
bl = block_for_pc (prologue_start);
if (bl != NULL)
- func_size = bl->endaddr - bl->startaddr;
+ func_size = bl->end () - bl->start ();
else
{
struct bound_minimal_symbol msymbol
const struct block *block = bs.symbol->value_block ();
gdb_assert (block != nullptr);
- sym_addr = BLOCK_START (block);
+ sym_addr = block->start ();
}
else
sym_addr = msymbol.value_address ();
gdbscm_printf (port, " %s", BLOCK_FUNCTION (b)->print_name ());
gdbscm_printf (port, " %s-%s",
- hex_string (BLOCK_START (b)), hex_string (BLOCK_END (b)));
+ hex_string (b->start ()), hex_string (b->end ()));
scm_puts (">", port);
= bkscm_get_valid_block_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
const struct block *block = b_smob->block;
- return gdbscm_scm_from_ulongest (BLOCK_START (block));
+ return gdbscm_scm_from_ulongest (block->start ());
}
/* (block-end <gdb:block>) -> address */
= bkscm_get_valid_block_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
const struct block *block = b_smob->block;
- return gdbscm_scm_from_ulongest (BLOCK_END (block));
+ return gdbscm_scm_from_ulongest (block->end ());
}
/* (block-function <gdb:block>) -> <gdb:symbol> */
if (sym->aclass () == LOC_BLOCK)
{
const block *block = sym->value_block ();
- if (BLOCK_END (block) < tp->control.step_range_end)
- tp->control.step_range_end = BLOCK_END (block);
+ if (block->end () < tp->control.step_range_end)
+ tp->control.step_range_end = block->end ();
}
}
BLOCK_MULTIDICT (new_block)
= mdict_create_linear (&objfile->objfile_obstack, NULL);
/* The address range. */
- BLOCK_START (new_block) = (CORE_ADDR) gdb_block_iter.begin;
- BLOCK_END (new_block) = (CORE_ADDR) gdb_block_iter.end;
+ new_block->set_start (gdb_block_iter.begin);
+ new_block->set_end (gdb_block_iter.end);
/* The name. */
block_name->set_domain (VAR_DOMAIN);
BLOCK_FUNCTION (new_block) = block_name;
BLOCKVECTOR_BLOCK (bv, block_idx) = new_block;
- if (begin > BLOCK_START (new_block))
- begin = BLOCK_START (new_block);
- if (end < BLOCK_END (new_block))
- end = BLOCK_END (new_block);
+ if (begin > new_block->start ())
+ begin = new_block->start ();
+ if (end < new_block->end ())
+ end = new_block->end ();
gdb_block_iter.real_block = new_block;
BLOCK_SUPERBLOCK (new_block) = block_iter;
block_iter = new_block;
- BLOCK_START (new_block) = (CORE_ADDR) begin;
- BLOCK_END (new_block) = (CORE_ADDR) end;
+ new_block->set_start (begin);
+ new_block->set_end (end);
BLOCKVECTOR_BLOCK (bv, i) = new_block;
b = new_block (FUNCTION_BLOCK, s->language ());
s->set_value_block (b);
BLOCK_FUNCTION (b) = s;
- BLOCK_START (b) = BLOCK_END (b) = sh->value;
+ b->set_start (sh->value);
+ b->set_end (sh->value);
BLOCK_SUPERBLOCK (b) = top_stack->cur_block;
add_block (b, top_stack->cur_st);
top_stack->blocktype = stBlock;
b = new_block (NON_FUNCTION_BLOCK, psymtab_language);
- BLOCK_START (b) = sh->value + top_stack->procadr;
+ b->set_start (sh->value + top_stack->procadr);
BLOCK_SUPERBLOCK (b) = top_stack->cur_block;
top_stack->cur_block = b;
add_block (b, top_stack->cur_st);
struct type *ftype = top_stack->cur_type;
int i;
- BLOCK_END (top_stack->cur_block) += sh->value; /* size */
+ top_stack->cur_block->set_end
+ (top_stack->cur_block->end () + sh->value); /* size */
/* Make up special symbol to contain procedure specific info. */
s = new_symbol (MDEBUG_EFI_SYMBOL_NAME);
struct block *b_bad = BLOCKVECTOR_BLOCK (bv, i);
if (BLOCK_SUPERBLOCK (b_bad) == cblock
- && BLOCK_START (b_bad) == top_stack->procadr
- && BLOCK_END (b_bad) == top_stack->procadr)
+ && b_bad->start () == top_stack->procadr
+ && b_bad->end () == top_stack->procadr)
{
- BLOCK_START (b_bad) = BLOCK_START (cblock);
- BLOCK_END (b_bad) = BLOCK_END (cblock);
+ b_bad->set_start (cblock->start ());
+ b_bad->set_end (cblock->end ());
}
}
/* End of (code) block. The value of the symbol is the
displacement from the procedure`s start address of the
end of this block. */
- BLOCK_END (top_stack->cur_block) = sh->value + top_stack->procadr;
+ top_stack->cur_block->set_end (sh->value + top_stack->procadr);
}
else if (sh->sc == scText && top_stack->blocktype == stNil)
{
e->pdr.adr is sometimes offset by a bogus value.
To work around these problems, we replace e->pdr.adr with
the start address of the function. */
- e->pdr.adr = BLOCK_START (b);
+ e->pdr.adr = b->start ();
}
/* It would be reasonable that functions that have been compiled
top_stack->cur_st = cust->primary_filetab ();
top_stack->cur_block
= BLOCKVECTOR_BLOCK (cust->blockvector (), STATIC_BLOCK);
- BLOCK_START (top_stack->cur_block) = pst->text_low (objfile);
- BLOCK_END (top_stack->cur_block) = 0;
+ top_stack->cur_block->set_start (pst->text_low (objfile));
+ top_stack->cur_block->set_end (0);
top_stack->blocktype = stFile;
top_stack->cur_type = 0;
top_stack->procadr = 0;
static bool
block_is_less_than (const struct block *b1, const struct block *b2)
{
- CORE_ADDR start1 = BLOCK_START (b1);
- CORE_ADDR start2 = BLOCK_START (b2);
+ CORE_ADDR start1 = b1->start ();
+ CORE_ADDR start2 = b2->start ();
if (start1 != start2)
return start1 < start2;
- return (BLOCK_END (b2)) < (BLOCK_END (b1));
+ return (b2->end ()) < (b1->end ());
}
/* Sort the blocks of a symtab S.
if (BLOCKVECTOR_NBLOCKS (bv) <= FIRST_LOCAL_BLOCK)
{
/* Cosmetic */
- if (BLOCK_END (BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK)) == 0)
- BLOCK_START (BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK)) = 0;
- if (BLOCK_END (BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK)) == 0)
- BLOCK_START (BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK)) = 0;
+ if (BLOCKVECTOR_BLOCK(bv, GLOBAL_BLOCK)->end () == 0)
+ BLOCKVECTOR_BLOCK(bv, GLOBAL_BLOCK)->set_start (0);
+ if (BLOCKVECTOR_BLOCK(bv, STATIC_BLOCK)->end () == 0)
+ BLOCKVECTOR_BLOCK(bv, STATIC_BLOCK)->set_start (0);
return;
}
/*
int i, j = BLOCKVECTOR_NBLOCKS (bv);
for (i = FIRST_LOCAL_BLOCK; i < j; i++)
- if (high < BLOCK_END (BLOCKVECTOR_BLOCK (bv, i)))
- high = BLOCK_END (BLOCKVECTOR_BLOCK (bv, i));
- BLOCK_END (BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK)) = high;
+ if (high < BLOCKVECTOR_BLOCK(bv, i)->end ())
+ high = BLOCKVECTOR_BLOCK(bv, i)->end ();
+ BLOCKVECTOR_BLOCK(bv, GLOBAL_BLOCK)->set_end (high);
}
- BLOCK_START (BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK)) =
- BLOCK_START (BLOCKVECTOR_BLOCK (bv, FIRST_LOCAL_BLOCK));
+ BLOCKVECTOR_BLOCK(bv, GLOBAL_BLOCK)->set_start
+ (BLOCKVECTOR_BLOCK(bv, FIRST_LOCAL_BLOCK)->start ());
- BLOCK_START (BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK)) =
- BLOCK_START (BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK));
- BLOCK_END (BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK)) =
- BLOCK_END (BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK));
+ BLOCKVECTOR_BLOCK(bv, STATIC_BLOCK)->set_start
+ (BLOCKVECTOR_BLOCK(bv, GLOBAL_BLOCK)->start ());
+
+ BLOCKVECTOR_BLOCK(bv, STATIC_BLOCK)->set_end
+ (BLOCKVECTOR_BLOCK(bv, GLOBAL_BLOCK)->end ());
}
\f
CORE_ADDR compact_block_start;
struct bound_minimal_symbol msym;
- compact_block_start = BLOCK_START (block) | 1;
+ compact_block_start = block->start () | 1;
msym = lookup_minimal_symbol_by_pc (compact_block_start);
if (msym.minsym && !msymbol_is_mips (msym.minsym))
{
- BLOCK_START (block) = compact_block_start;
+ block->set_start (compact_block_start);
}
}
}
struct mdict_iterator miter;
b = BLOCKVECTOR_BLOCK (bv, i);
- BLOCK_START (b) += delta[block_line_section];
- BLOCK_END (b) += delta[block_line_section];
+ b->set_start (b->start () + delta[block_line_section]);
+ b->set_end (b->end () + delta[block_line_section]);
if (BLOCK_RANGES (b) != nullptr)
for (int j = 0; j < BLOCK_NRANGES (b); j++)
}
}
if (ps->raw_text_high () != 0
- && (ps->text_low (objfile) < BLOCK_START (b)
- || ps->text_high (objfile) > BLOCK_END (b)))
+ && (ps->text_low (objfile) < b->start ()
+ || ps->text_high (objfile) > b->end ()))
{
gdb_printf ("Psymtab ");
gdb_puts (ps->filename);
gdb_printf (" - ");
gdb_puts (paddress (gdbarch, ps->text_high (objfile)));
gdb_printf (" but symtab covers only ");
- gdb_puts (paddress (gdbarch, BLOCK_START (b)));
+ gdb_puts (paddress (gdbarch, b->start ()));
gdb_printf (" - ");
- gdb_puts (paddress (gdbarch, BLOCK_END (b)));
+ gdb_puts (paddress (gdbarch, b->end ()));
gdb_printf ("\n");
}
}
BLPY_REQUIRE_VALID (self, block);
- return gdb_py_object_from_ulongest (BLOCK_START (block)).release ();
+ return gdb_py_object_from_ulongest (block->start ()).release ();
}
static PyObject *
BLPY_REQUIRE_VALID (self, block);
- return gdb_py_object_from_ulongest (BLOCK_END (block)).release ();
+ return gdb_py_object_from_ulongest (block->end ()).release ();
}
static PyObject *
wants it. */
gdb_printf (outfile, ", %d syms/buckets in ",
mdict_size (BLOCK_MULTIDICT (b)));
- gdb_puts (paddress (gdbarch, BLOCK_START (b)), outfile);
+ gdb_puts (paddress (gdbarch, b->start ()), outfile);
gdb_printf (outfile, "..");
- gdb_puts (paddress (gdbarch, BLOCK_END (b)), outfile);
+ gdb_puts (paddress (gdbarch, b->end ()), outfile);
if (BLOCK_FUNCTION (b))
{
gdb_printf (outfile, ", function %s",
gdb_printf
(outfile, "block object %s, %s..%s",
host_address_to_string (symbol->value_block ()),
- paddress (gdbarch, BLOCK_START (symbol->value_block ())),
- paddress (gdbarch, BLOCK_END (symbol->value_block ())));
+ paddress (gdbarch, symbol->value_block()->start ()),
+ paddress (gdbarch, symbol->value_block()->end ()));
if (section)
gdb_printf (outfile, " section %s",
bfd_section_name (section->the_bfd_section));
const struct blockvector *bv = cust->blockvector ();
const struct block *global_block
= BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
- CORE_ADDR start = BLOCK_START (global_block);
- CORE_ADDR end = BLOCK_END (global_block);
+ CORE_ADDR start = global_block->start ();
+ CORE_ADDR end = global_block->end ();
bool in_range_p = start <= pc && pc < end;
if (!in_range_p)
continue;
else if (alt)
val.end = alt->pc;
else
- val.end = BLOCK_END (BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK));
+ val.end = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK)->end ();
}
val.section = section;
return val;
line is still part of the same function. */
if (skip && start_sal.pc != pc
&& (sym ? (BLOCK_ENTRY_PC (sym->value_block ()) <= start_sal.end
- && start_sal.end < BLOCK_END (sym->value_block ()))
+ && start_sal.end < sym->value_block()->end ())
: (lookup_minimal_symbol_by_pc_section (start_sal.end, section).minsym
== lookup_minimal_symbol_by_pc_section (pc, section).minsym)))
{
{
CORE_ADDR pc = get_frame_pc (fi);
- if (pc < BLOCK_START (var->root->valid_block) ||
- pc >= BLOCK_END (var->root->valid_block))
+ if (pc < var->root->valid_block->start () ||
+ pc >= var->root->valid_block->end ())
scope = false;
else
select_frame (fi);