gdb: remove BLOCK_ENTRY_PC macro
Replace with equivalent method. Change-Id: I0e033095e7358799930775e61028b48246971a7d
This commit is contained in:
parent
086d03c91e
commit
6395b62847
17 changed files with 56 additions and 51 deletions
|
@ -571,7 +571,7 @@ gen_var_ref (struct agent_expr *ax, struct axs_value *value, struct symbol *var)
|
|||
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;
|
||||
|
||||
|
|
41
gdb/block.h
41
gdb/block.h
|
@ -171,6 +171,29 @@ struct block
|
|||
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;
|
||||
|
@ -219,24 +242,6 @@ struct global_block
|
|||
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. */
|
||||
|
|
|
@ -96,7 +96,7 @@ get_pc_function_start (CORE_ADDR pc)
|
|||
if (symbol)
|
||||
{
|
||||
bl = symbol->value_block ();
|
||||
return BLOCK_ENTRY_PC (bl);
|
||||
return bl->entry_pc ();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -254,7 +254,7 @@ find_pc_partial_function_sym (CORE_ADDR 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 ();
|
||||
|
@ -392,7 +392,7 @@ find_function_entry_range_from_pc (CORE_ADDR pc, const char **name,
|
|||
|
||||
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 ())
|
||||
{
|
||||
|
@ -424,7 +424,7 @@ find_function_type (CORE_ADDR pc)
|
|||
{
|
||||
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;
|
||||
|
|
|
@ -93,7 +93,7 @@ convert_one_symbol (compile_c_instance *context,
|
|||
|
||||
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;
|
||||
|
@ -404,7 +404,7 @@ gcc_symbol_address (void *datum, struct gcc_c_context *gcc_context,
|
|||
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;
|
||||
|
|
|
@ -145,7 +145,7 @@ compile_object_run (compile_module_up &&module)
|
|||
|
||||
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)
|
||||
|
|
|
@ -487,10 +487,10 @@ get_expr_block_and_pc (CORE_ADDR *pc)
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -453,7 +453,7 @@ dwarf2_find_location_expression (struct dwarf2_loclist_baton *baton,
|
|||
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;
|
||||
|
@ -753,7 +753,7 @@ func_addr_to_tail_call_list (struct gdbarch *gdbarch, CORE_ADDR addr)
|
|||
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"),
|
||||
|
|
|
@ -704,10 +704,10 @@ language_defn::read_var_value (struct symbol *var,
|
|||
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:
|
||||
|
|
|
@ -1345,7 +1345,7 @@ until_next_command (int from_tty)
|
|||
{
|
||||
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
|
||||
|
|
|
@ -4687,8 +4687,8 @@ fill_in_stop_func (struct gdbarch *gdbarch,
|
|||
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);
|
||||
|
|
|
@ -181,7 +181,7 @@ inline_frame_this_id (struct frame_info *this_frame,
|
|||
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++;
|
||||
}
|
||||
|
||||
|
@ -362,7 +362,7 @@ skip_inline_frames (thread_info *thread, bpstat *stop_chain)
|
|||
{
|
||||
/* 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
|
||||
|
|
|
@ -2224,7 +2224,7 @@ convert_linespec_to_sals (struct linespec_state *state, linespec *ls)
|
|||
&& 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)
|
||||
{
|
||||
|
|
|
@ -454,7 +454,7 @@ parse_exp_in_context (const char **stringptr, CORE_ADDR pc,
|
|||
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;
|
||||
|
||||
|
@ -468,7 +468,7 @@ parse_exp_in_context (const char **stringptr, CORE_ADDR 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)
|
||||
|
|
|
@ -645,7 +645,7 @@ build_address_symbolic (struct gdbarch *gdbarch,
|
|||
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
|
||||
|
@ -1778,7 +1778,7 @@ info_address_command (const char *exp, int from_tty)
|
|||
|
||||
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))
|
||||
|
|
12
gdb/symtab.c
12
gdb/symtab.c
|
@ -1821,7 +1821,7 @@ fixup_symbol_section (struct symbol *sym, struct objfile *objfile)
|
|||
addr = sym->value_address ();
|
||||
break;
|
||||
case LOC_BLOCK:
|
||||
addr = BLOCK_ENTRY_PC (sym->value_block ());
|
||||
addr = sym->value_block ()->entry_pc ();
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -3779,7 +3779,7 @@ find_function_start_sal (symbol *sym, bool funfirstline)
|
|||
{
|
||||
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;
|
||||
|
@ -3908,7 +3908,7 @@ skip_prologue_sal (struct symtab_and_line *sal)
|
|||
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 ();
|
||||
}
|
||||
|
@ -3984,7 +3984,7 @@ skip_prologue_sal (struct symtab_and_line *sal)
|
|||
/* 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)))
|
||||
|
@ -4182,7 +4182,7 @@ find_function_alias_target (bound_minimal_symbol msymbol)
|
|||
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;
|
||||
|
@ -5791,7 +5791,7 @@ find_gnu_ifunc (const symbol *sym)
|
|||
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,
|
||||
|
|
|
@ -2512,7 +2512,7 @@ info_scope_command (const char *args_in, int from_tty)
|
|||
|
||||
if (SYMBOL_COMPUTED_OPS (sym) != NULL)
|
||||
SYMBOL_COMPUTED_OPS (sym)->describe_location (sym,
|
||||
BLOCK_ENTRY_PC (block),
|
||||
block->entry_pc (),
|
||||
gdb_stdout);
|
||||
else
|
||||
{
|
||||
|
@ -2587,7 +2587,7 @@ info_scope_command (const char *args_in, int from_tty)
|
|||
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 (),
|
||||
|
|
|
@ -3184,7 +3184,7 @@ value_fn_field (struct value **arg1p, struct fn_field *f,
|
|||
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
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue