Use BLOCK_ENTRY_PC in place of most uses of BLOCK_START

This change/patch substitues BLOCK_ENTRY_PC for BLOCK_START in
places where BLOCK_START is used to obtain the address at which
execution should enter the block.  Since blocks can now contain
non-contiguous ranges, the BLOCK_START - which is still be the
very lowest address in the block - might not be the same as
BLOCK_ENTRY_PC.

There is a change to infrun.c which is less obvious and less mechanical.
I'm posting it as a separate patch.

gdb/ChangeLog:

	* ax-gdb.c (gen_var_ref): Use BLOCK_ENTRY_PC in place of
	BLOCK_START.
	* blockframe.c (get_pc_function_start): Likewise.
	* compile/compile-c-symbols.c (convert_one_symbol): Likewise.
	(gcc_symbol_address): Likewise.
	* compile/compile-object-run.c (compile_object_run): Likewise.
	* compile/compile.c (get_expr_block_and_pc): Likewise.
	* dwarf2loc.c (dwarf2_find_location_expression): Likewise.
	(func_addr_to_tail_call_list): Likewise.
	* findvar.c (default_read_var_value): Likewise.
	* inline-frame.c (inline_frame_this_id): Likewise.
	(skip-inline_frames): Likewise.
	* infcmd.c (until_next_command): Likewise.
	* linespec.c (convert_linespec_to_sals): Likewise.
	* parse.c (parse_exp_in_context_1): Likewise.
	* printcmd.c (build_address_symbolic): likewise.
	(info_address_command): Likewise.
	symtab.c (find_function_start_sal): Likewise.
	(skip_prologue_sal): Likewise.
	(find_function_alias_target): Likewise.
	(find_gnu_ifunc): Likewise.
	* stack.c (find_frame_funname): Likewise.
	* symtab.c (fixup_symbol_section): Likewise.
	(find_function_start_sal): Likewise.
	(skip_prologue_sal): Likewsie.
	(find_function_alias_target): Likewise.
	(find_gnu_ifunc): Likewise.
	* tracepoint.c (info_scope_command): Likewise.
	* value.c (value_fn_field): Likewise.
This commit is contained in:
Kevin Buettner 2018-08-23 16:00:49 -07:00
parent e94802301b
commit 2b1ffcfd6f
17 changed files with 61 additions and 31 deletions

View File

@ -19,6 +19,36 @@
(disassemble_current_function): Likewise.
(disassemble_command): Likewise.
* ax-gdb.c (gen_var_ref): Use BLOCK_ENTRY_PC in place of
BLOCK_START.
* blockframe.c (get_pc_function_start): Likewise.
* compile/compile-c-symbols.c (convert_one_symbol): Likewise.
(gcc_symbol_address): Likewise.
* compile/compile-object-run.c (compile_object_run): Likewise.
* compile/compile.c (get_expr_block_and_pc): Likewise.
* dwarf2loc.c (dwarf2_find_location_expression): Likewise.
(func_addr_to_tail_call_list): Likewise.
* findvar.c (default_read_var_value): Likewise.
* inline-frame.c (inline_frame_this_id): Likewise.
(skip-inline_frames): Likewise.
* infcmd.c (until_next_command): Likewise.
* linespec.c (convert_linespec_to_sals): Likewise.
* parse.c (parse_exp_in_context_1): Likewise.
* printcmd.c (build_address_symbolic): likewise.
(info_address_command): Likewise.
symtab.c (find_function_start_sal): Likewise.
(skip_prologue_sal): Likewise.
(find_function_alias_target): Likewise.
(find_gnu_ifunc): Likewise.
* stack.c (find_frame_funname): Likewise.
* symtab.c (fixup_symbol_section): Likewise.
(find_function_start_sal): Likewise.
(skip_prologue_sal): Likewsie.
(find_function_alias_target): Likewise.
(find_gnu_ifunc): Likewise.
* tracepoint.c (info_scope_command): Likewise.
* value.c (value_fn_field): Likewise.
2018-08-23 Xavier Roirand <roirand@adacore.com>
* machoread.c (macho_symfile_read_all_oso): Remove uneeded

View File

@ -679,7 +679,7 @@ gen_var_ref (struct agent_expr *ax, struct axs_value *value, struct symbol *var)
break;
case LOC_BLOCK:
ax_const_l (ax, BLOCK_START (SYMBOL_BLOCK_VALUE (var)));
ax_const_l (ax, BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (var)));
value->kind = axs_rvalue;
break;

View File

@ -96,7 +96,7 @@ get_pc_function_start (CORE_ADDR pc)
if (symbol)
{
bl = SYMBOL_BLOCK_VALUE (symbol);
return BLOCK_START (bl);
return BLOCK_ENTRY_PC (bl);
}
}
@ -382,7 +382,7 @@ find_function_type (CORE_ADDR pc)
{
struct symbol *sym = find_pc_function (pc);
if (sym != NULL && BLOCK_START (SYMBOL_BLOCK_VALUE (sym)) == pc)
if (sym != NULL && BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (sym)) == pc)
return SYMBOL_TYPE (sym);
return NULL;

View File

@ -93,7 +93,7 @@ convert_one_symbol (compile_c_instance *context,
case LOC_BLOCK:
kind = GCC_C_SYMBOL_FUNCTION;
addr = BLOCK_START (SYMBOL_BLOCK_VALUE (sym.symbol));
addr = BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (sym.symbol));
if (is_global && TYPE_GNU_IFUNC (SYMBOL_TYPE (sym.symbol)))
addr = gnu_ifunc_resolve_addr (target_gdbarch (), addr);
break;
@ -405,7 +405,7 @@ gcc_symbol_address (void *datum, struct gcc_c_context *gcc_context,
fprintf_unfiltered (gdb_stdlog,
"gcc_symbol_address \"%s\": full symbol\n",
identifier);
result = BLOCK_START (SYMBOL_BLOCK_VALUE (sym));
result = BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (sym));
if (TYPE_GNU_IFUNC (SYMBOL_TYPE (sym)))
result = gnu_ifunc_resolve_addr (target_gdbarch (), result);
found = 1;

View File

@ -152,7 +152,7 @@ compile_object_run (struct compile_module *module)
gdb_assert (TYPE_CODE (func_type) == TYPE_CODE_FUNC);
func_val = value_from_pointer (lookup_pointer_type (func_type),
BLOCK_START (SYMBOL_BLOCK_VALUE (func_sym)));
BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (func_sym)));
vargs = XALLOCAVEC (struct value *, TYPE_NFIELDS (func_type));
if (TYPE_NFIELDS (func_type) >= 1)

View File

@ -439,10 +439,10 @@ get_expr_block_and_pc (CORE_ADDR *pc)
block = BLOCKVECTOR_BLOCK (SYMTAB_BLOCKVECTOR (cursal.symtab),
STATIC_BLOCK);
if (block != NULL)
*pc = BLOCK_START (block);
*pc = BLOCK_ENTRY_PC (block);
}
else
*pc = BLOCK_START (block);
*pc = BLOCK_ENTRY_PC (block);
return block;
}

View File

@ -367,7 +367,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_START (SYMBOL_BLOCK_VALUE (pc_func)))
if (pc_func && pc == BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (pc_func)))
{
*locexpr_length = length;
return loc_ptr;
@ -871,7 +871,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_START (SYMBOL_BLOCK_VALUE (sym)) != addr)
if (sym == NULL || BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (sym)) != addr)
throw_error (NO_ENTRY_VALUE_ERROR,
_("DW_TAG_call_site resolving failed to find function "
"name for address %s"),

View File

@ -702,10 +702,10 @@ default_read_var_value (struct symbol *var, const struct block *var_block,
case LOC_BLOCK:
if (overlay_debugging)
addr = symbol_overlayed_address
(BLOCK_START (SYMBOL_BLOCK_VALUE (var)),
(BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (var)),
SYMBOL_OBJ_SECTION (symbol_objfile (var), var));
else
addr = BLOCK_START (SYMBOL_BLOCK_VALUE (var));
addr = BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (var));
break;
case LOC_REGISTER:

View File

@ -1552,7 +1552,7 @@ until_next_command (int from_tty)
{
sal = find_pc_line (pc, 0);
tp->control.step_range_start = BLOCK_START (SYMBOL_BLOCK_VALUE (func));
tp->control.step_range_start = BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (func));
tp->control.step_range_end = sal.end;
}
tp->control.may_range_step = 1;

View File

@ -165,7 +165,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_START (SYMBOL_BLOCK_VALUE (func));
(*this_id).code_addr = BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (func));
(*this_id).artificial_depth++;
}
@ -341,8 +341,8 @@ skip_inline_frames (thread_info *thread, bpstat stop_chain)
if (block_inlined_p (cur_block))
{
/* See comments in inline_frame_this_id about this use
of BLOCK_START. */
if (BLOCK_START (cur_block) == this_pc
of BLOCK_ENTRY_PC. */
if (BLOCK_ENTRY_PC (cur_block) == this_pc
|| block_starting_point_at (this_pc, cur_block))
{
/* Do not skip the inlined frame if execution

View File

@ -2283,7 +2283,7 @@ convert_linespec_to_sals (struct linespec_state *state, linespec_p ls)
&& SYMBOL_CLASS (sym) == LOC_BLOCK)
{
const CORE_ADDR addr
= BLOCK_START (SYMBOL_BLOCK_VALUE (sym));
= BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (sym));
bound_minimal_symbol_d *elem;
for (int m = 0;

View File

@ -1146,7 +1146,7 @@ parse_exp_in_context_1 (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_START (expression_context_block);
expression_context_pc = BLOCK_ENTRY_PC (expression_context_block);
else
expression_context_pc = pc;
@ -1160,7 +1160,7 @@ parse_exp_in_context_1 (const char **stringptr, CORE_ADDR pc,
= BLOCKVECTOR_BLOCK (SYMTAB_BLOCKVECTOR (cursal.symtab),
STATIC_BLOCK);
if (expression_context_block)
expression_context_pc = BLOCK_START (expression_context_block);
expression_context_pc = BLOCK_ENTRY_PC (expression_context_block);
}
if (language_mode == language_mode_auto && block != NULL)

View File

@ -609,7 +609,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_START (SYMBOL_BLOCK_VALUE (symbol));
name_location = BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (symbol));
if (do_demangle || asm_demangle)
name_temp = SYMBOL_PRINT_NAME (symbol);
else
@ -1519,7 +1519,7 @@ info_address_command (const char *exp, int from_tty)
case LOC_BLOCK:
printf_filtered (_("a function at address "));
load_addr = BLOCK_START (SYMBOL_BLOCK_VALUE (sym));
load_addr = BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (sym));
fputs_filtered (paddress (gdbarch, load_addr), gdb_stdout);
if (section_is_overlay (section))
{

View File

@ -1079,7 +1079,7 @@ find_frame_funname (struct frame_info *frame, enum language *funlang,
if (msymbol.minsym != NULL
&& (BMSYMBOL_VALUE_ADDRESS (msymbol)
> BLOCK_START (SYMBOL_BLOCK_VALUE (func))))
> BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (func))))
{
/* We also don't know anything about the function besides
its address and name. */

View File

@ -1746,7 +1746,7 @@ fixup_symbol_section (struct symbol *sym, struct objfile *objfile)
addr = SYMBOL_VALUE_ADDRESS (sym);
break;
case LOC_BLOCK:
addr = BLOCK_START (SYMBOL_BLOCK_VALUE (sym));
addr = BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (sym));
break;
default:
@ -3637,7 +3637,7 @@ find_function_start_sal (symbol *sym, bool funfirstline)
{
fixup_symbol_section (sym, NULL);
symtab_and_line sal
= find_function_start_sal_1 (BLOCK_START (SYMBOL_BLOCK_VALUE (sym)),
= find_function_start_sal_1 (BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (sym)),
SYMBOL_OBJ_SECTION (symbol_objfile (sym), sym),
funfirstline);
sal.symbol = sym;
@ -3717,7 +3717,7 @@ skip_prologue_sal (struct symtab_and_line *sal)
fixup_symbol_section (sym, NULL);
objfile = symbol_objfile (sym);
pc = BLOCK_START (SYMBOL_BLOCK_VALUE (sym));
pc = BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (sym));
section = SYMBOL_OBJ_SECTION (objfile, sym);
name = SYMBOL_LINKAGE_NAME (sym);
}
@ -3778,7 +3778,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_START (SYMBOL_BLOCK_VALUE (sym)) <= start_sal.end
&& (sym ? (BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (sym)) <= start_sal.end
&& start_sal.end < BLOCK_END (SYMBOL_BLOCK_VALUE (sym)))
: (lookup_minimal_symbol_by_pc_section (start_sal.end, section).minsym
== lookup_minimal_symbol_by_pc_section (pc, section).minsym)))
@ -3982,7 +3982,7 @@ find_function_alias_target (bound_minimal_symbol msymbol)
symbol *sym = find_pc_function (func_addr);
if (sym != NULL
&& SYMBOL_CLASS (sym) == LOC_BLOCK
&& BLOCK_START (SYMBOL_BLOCK_VALUE (sym)) == func_addr)
&& BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (sym)) == func_addr)
return sym;
return NULL;
@ -4987,7 +4987,7 @@ find_gnu_ifunc (const symbol *sym)
symbol_name_match_type::SEARCH_NAME);
struct objfile *objfile = symbol_objfile (sym);
CORE_ADDR address = BLOCK_START (SYMBOL_BLOCK_VALUE (sym));
CORE_ADDR address = BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (sym));
minimal_symbol *ifunc = NULL;
iterate_over_minimal_symbols (objfile, lookup_name,

View File

@ -2536,7 +2536,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_START (block),
BLOCK_ENTRY_PC (block),
gdb_stdout);
else
{
@ -2613,7 +2613,7 @@ info_scope_command (const char *args_in, int from_tty)
case LOC_BLOCK:
printf_filtered ("a function at address ");
printf_filtered ("%s",
paddress (gdbarch, BLOCK_START (SYMBOL_BLOCK_VALUE (sym))));
paddress (gdbarch, BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (sym))));
break;
case LOC_UNRESOLVED:
msym = lookup_minimal_symbol (SYMBOL_LINKAGE_NAME (sym),

View File

@ -3050,7 +3050,7 @@ value_fn_field (struct value **arg1p, struct fn_field *f,
VALUE_LVAL (v) = lval_memory;
if (sym)
{
set_value_address (v, BLOCK_START (SYMBOL_BLOCK_VALUE (sym)));
set_value_address (v, BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (sym)));
}
else
{