Replace with equivalent method.
Change-Id: I0e033095e7358799930775e61028b48246971a7d
break;
case LOC_BLOCK:
- ax_const_l (ax, BLOCK_ENTRY_PC (var->value_block ()));
+ ax_const_l (ax, var->value_block ()->entry_pc ());
value->kind = axs_rvalue;
break;
bool is_contiguous () const
{ return this->ranges ().size () <= 1; }
+ /* Return the "entry PC" of this block.
+
+ The entry PC is the lowest (start) address for the block when all addresses
+ within the block are contiguous. If non-contiguous, then use the start
+ address for the first range in the block.
+
+ At the moment, this almost matches what DWARF specifies as the entry
+ pc. (The missing bit is support for DW_AT_entry_pc which should be
+ preferred over range data and the low_pc.)
+
+ Once support for DW_AT_entry_pc is added, I expect that an entry_pc
+ field will be added to one of these data structures. Once that's done,
+ the entry_pc field can be set from the dwarf reader (and other readers
+ too). ENTRY_PC can then be redefined to be less DWARF-centric. */
+
+ CORE_ADDR entry_pc () const
+ {
+ if (this->is_contiguous ())
+ return this->start ();
+ else
+ return this->ranges ()[0].start ();
+ }
+
/* Addresses in the executable code that are in this block. */
CORE_ADDR m_start;
struct compunit_symtab *compunit_symtab;
};
-/* Define the "entry pc" for a block BL to be the lowest (start) address
- for the block when all addresses within the block are contiguous. If
- non-contiguous, then use the start address for the first range in the
- block.
-
- At the moment, this almost matches what DWARF specifies as the entry
- pc. (The missing bit is support for DW_AT_entry_pc which should be
- preferred over range data and the low_pc.)
-
- Once support for DW_AT_entry_pc is added, I expect that an entry_pc
- field will be added to one of these data structures. Once that's done,
- the entry_pc field can be set from the dwarf reader (and other readers
- too). BLOCK_ENTRY_PC can then be redefined to be less DWARF-centric. */
-
-#define BLOCK_ENTRY_PC(bl) (bl->is_contiguous () \
- ? bl->start () \
- : bl->ranges ()[0].start ())
-
struct blockvector
{
/* Number of blocks in the list. */
if (symbol)
{
bl = symbol->value_block ();
- return BLOCK_ENTRY_PC (bl);
+ return bl->entry_pc ();
}
}
f = find_pc_sect_function (mapped_pc, section);
if (f != NULL
&& (msymbol.minsym == NULL
- || (BLOCK_ENTRY_PC (f->value_block ())
+ || (f->value_block ()->entry_pc ()
>= msymbol.value_address ())))
{
const struct block *b = f->value_block ();
if (status && block != nullptr && !block->is_contiguous ())
{
- CORE_ADDR entry_pc = BLOCK_ENTRY_PC (block);
+ CORE_ADDR entry_pc = block->entry_pc ();
for (const blockrange &range : block->ranges ())
{
{
struct symbol *sym = find_pc_function (pc);
- if (sym != NULL && BLOCK_ENTRY_PC (sym->value_block ()) == pc)
+ if (sym != NULL && sym->value_block ()->entry_pc () == pc)
return sym->type ();
return NULL;
case LOC_BLOCK:
kind = GCC_C_SYMBOL_FUNCTION;
- addr = BLOCK_ENTRY_PC (sym.symbol->value_block ());
+ addr = sym.symbol->value_block ()->entry_pc ();
if (is_global && sym.symbol->type ()->is_gnu_ifunc ())
addr = gnu_ifunc_resolve_addr (target_gdbarch (), addr);
break;
gdb_printf (gdb_stdlog,
"gcc_symbol_address \"%s\": full symbol\n",
identifier);
- result = BLOCK_ENTRY_PC (sym->value_block ());
+ result = sym->value_block ()->entry_pc ();
if (sym->type ()->is_gnu_ifunc ())
result = gnu_ifunc_resolve_addr (target_gdbarch (), result);
found = 1;
gdb_assert (func_type->code () == TYPE_CODE_FUNC);
func_val = value_from_pointer (lookup_pointer_type (func_type),
- BLOCK_ENTRY_PC (func_sym->value_block ()));
+ func_sym->value_block ()->entry_pc ());
vargs = XALLOCAVEC (struct value *, func_type->num_fields ());
if (func_type->num_fields () >= 1)
block = BLOCKVECTOR_BLOCK (cursal.symtab->compunit ()->blockvector (),
STATIC_BLOCK);
if (block != NULL)
- *pc = BLOCK_ENTRY_PC (block);
+ *pc = block->entry_pc ();
}
else
- *pc = BLOCK_ENTRY_PC (block);
+ *pc = block->entry_pc ();
return block;
}
if (pc_block)
pc_func = block_linkage_function (pc_block);
- if (pc_func && pc == BLOCK_ENTRY_PC (pc_func->value_block ()))
+ if (pc_func && pc == pc_func->value_block ()->entry_pc ())
{
*locexpr_length = length;
return loc_ptr;
struct symbol *sym = find_pc_function (addr);
struct type *type;
- if (sym == NULL || BLOCK_ENTRY_PC (sym->value_block ()) != addr)
+ if (sym == NULL || sym->value_block ()->entry_pc () != addr)
throw_error (NO_ENTRY_VALUE_ERROR,
_("DW_TAG_call_site resolving failed to find function "
"name for address %s"),
case LOC_BLOCK:
if (overlay_debugging)
addr = symbol_overlayed_address
- (BLOCK_ENTRY_PC (var->value_block ()),
+ (var->value_block ()->entry_pc (),
var->obj_section (var->objfile ()));
else
- addr = BLOCK_ENTRY_PC (var->value_block ());
+ addr = var->value_block ()->entry_pc ();
break;
case LOC_REGISTER:
{
sal = find_pc_line (pc, 0);
- tp->control.step_range_start = BLOCK_ENTRY_PC (func->value_block ());
+ tp->control.step_range_start = func->value_block ()->entry_pc ();
tp->control.step_range_end = sal.end;
/* By setting the step_range_end based on the current pc, we are
stop_func_start is NOT advanced when in a range of a
non-contiguous block that does not contain the entry pc. */
if (block != nullptr
- && ecs->stop_func_start <= BLOCK_ENTRY_PC (block)
- && BLOCK_ENTRY_PC (block) < ecs->stop_func_end)
+ && ecs->stop_func_start <= block->entry_pc ()
+ && block->entry_pc () < ecs->stop_func_end)
{
ecs->stop_func_start
+= gdbarch_deprecated_function_start_offset (gdbarch);
in the frame ID (and eventually, to set breakpoints). */
func = get_frame_function (this_frame);
gdb_assert (func != NULL);
- (*this_id).code_addr = BLOCK_ENTRY_PC (func->value_block ());
+ (*this_id).code_addr = func->value_block ()->entry_pc ();
(*this_id).artificial_depth++;
}
{
/* See comments in inline_frame_this_id about this use
of BLOCK_ENTRY_PC. */
- if (BLOCK_ENTRY_PC (cur_block) == this_pc
+ if (cur_block->entry_pc () == this_pc
|| block_starting_point_at (this_pc, cur_block))
{
/* Do not skip the inlined frame if execution
&& sym.symbol->aclass () == LOC_BLOCK)
{
const CORE_ADDR addr
- = BLOCK_ENTRY_PC (sym.symbol->value_block ());
+ = sym.symbol->value_block ()->entry_pc ();
for (const auto &elem : ls->minimal_symbols)
{
if (!expression_context_block)
expression_context_block = get_selected_block (&expression_context_pc);
else if (pc == 0)
- expression_context_pc = BLOCK_ENTRY_PC (expression_context_block);
+ expression_context_pc = expression_context_block->entry_pc ();
else
expression_context_pc = pc;
= BLOCKVECTOR_BLOCK (cursal.symtab->compunit ()->blockvector (),
STATIC_BLOCK);
if (expression_context_block)
- expression_context_pc = BLOCK_ENTRY_PC (expression_context_block);
+ expression_context_pc = expression_context_block->entry_pc ();
}
if (language_mode == language_mode_auto && block != NULL)
pointer is <function+3>. This matches the ISA behavior. */
addr = gdbarch_addr_bits_remove (gdbarch, addr);
- name_location = BLOCK_ENTRY_PC (symbol->value_block ());
+ name_location = symbol->value_block ()->entry_pc ();
if (do_demangle || asm_demangle)
name_temp = symbol->print_name ();
else
case LOC_BLOCK:
gdb_printf (_("a function at address "));
- load_addr = BLOCK_ENTRY_PC (sym->value_block ());
+ load_addr = sym->value_block ()->entry_pc ();
fputs_styled (paddress (gdbarch, load_addr), address_style.style (),
gdb_stdout);
if (section_is_overlay (section))
addr = sym->value_address ();
break;
case LOC_BLOCK:
- addr = BLOCK_ENTRY_PC (sym->value_block ());
+ addr = sym->value_block ()->entry_pc ();
break;
default:
{
fixup_symbol_section (sym, NULL);
symtab_and_line sal
- = find_function_start_sal_1 (BLOCK_ENTRY_PC (sym->value_block ()),
+ = find_function_start_sal_1 (sym->value_block ()->entry_pc (),
sym->obj_section (sym->objfile ()),
funfirstline);
sal.symbol = sym;
fixup_symbol_section (sym, NULL);
objfile = sym->objfile ();
- pc = BLOCK_ENTRY_PC (sym->value_block ());
+ pc = sym->value_block ()->entry_pc ();
section = sym->obj_section (objfile);
name = sym->linkage_name ();
}
/* Check if gdbarch_skip_prologue left us in mid-line, and the next
line is still part of the same function. */
if (skip && start_sal.pc != pc
- && (sym ? (BLOCK_ENTRY_PC (sym->value_block ()) <= start_sal.end
+ && (sym ? (sym->value_block ()->entry_pc () <= start_sal.end
&& 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)))
symbol *sym = find_pc_function (func_addr);
if (sym != NULL
&& sym->aclass () == LOC_BLOCK
- && BLOCK_ENTRY_PC (sym->value_block ()) == func_addr)
+ && sym->value_block ()->entry_pc () == func_addr)
return sym;
return NULL;
symbol_name_match_type::SEARCH_NAME);
struct objfile *objfile = sym->objfile ();
- CORE_ADDR address = BLOCK_ENTRY_PC (sym->value_block ());
+ CORE_ADDR address = sym->value_block ()->entry_pc ();
minimal_symbol *ifunc = NULL;
iterate_over_minimal_symbols (objfile, lookup_name,
if (SYMBOL_COMPUTED_OPS (sym) != NULL)
SYMBOL_COMPUTED_OPS (sym)->describe_location (sym,
- BLOCK_ENTRY_PC (block),
+ block->entry_pc (),
gdb_stdout);
else
{
gdb_printf ("a function at address ");
gdb_printf ("%s",
paddress (gdbarch,
- BLOCK_ENTRY_PC (sym->value_block ())));
+ sym->value_block ()->entry_pc ()));
break;
case LOC_UNRESOLVED:
msym = lookup_minimal_symbol (sym->linkage_name (),
VALUE_LVAL (v) = lval_memory;
if (sym)
{
- set_value_address (v, BLOCK_ENTRY_PC (sym->value_block ()));
+ set_value_address (v, sym->value_block ()->entry_pc ());
}
else
{