2002-12-07 Andrew Cagney <ac131313@redhat.com>

* f-valprint.c (info_common_command): Use get_frame_pc.
	* std-regs.c (value_of_builtin_frame_pc_reg): Ditto.
	* ax-gdb.c (agent_command): Ditto.
	* rs6000-tdep.c (rs6000_init_extra_frame_info): Ditto.
	(rs6000_pop_frame): Ditto.
	(rs6000_frameless_function_invocation): Ditto.
	(rs6000_frame_saved_pc, frame_get_saved_regs): Ditto.
	(frame_initial_stack_address, rs6000_frame_chain): Ditto.
	* macroscope.c (default_macro_scope): Ditto.
	* stack.c (print_frame_info_base): Ditto.
	(print_frame, frame_info, print_frame_label_vars): Ditto.
	(return_command, func_command, get_frame_language): Ditto.
	* infcmd.c (finish_command): Ditto.
	* dummy-frame.c (cached_find_dummy_frame): Ditto.
	* breakpoint.c (deprecated_frame_in_dummy): Ditto.
	(break_at_finish_at_depth_command_1): Ditto.
	(break_at_finish_command_1): Ditto.
	(until_break_command, get_catch_sals): Ditto.
	* blockframe.c (func_frame_chain_valid): Ditto.
	(frameless_look_for_prologue): Ditto.
	(frame_address_in_block, generic_func_frame_chain_valid): Ditto.
This commit is contained in:
Andrew Cagney 2002-12-09 03:30:44 +00:00
parent 408400e7f6
commit bdd78e628a
12 changed files with 95 additions and 65 deletions

View File

@ -1,3 +1,27 @@
2002-12-07 Andrew Cagney <ac131313@redhat.com>
* f-valprint.c (info_common_command): Use get_frame_pc.
* std-regs.c (value_of_builtin_frame_pc_reg): Ditto.
* ax-gdb.c (agent_command): Ditto.
* rs6000-tdep.c (rs6000_init_extra_frame_info): Ditto.
(rs6000_pop_frame): Ditto.
(rs6000_frameless_function_invocation): Ditto.
(rs6000_frame_saved_pc, frame_get_saved_regs): Ditto.
(frame_initial_stack_address, rs6000_frame_chain): Ditto.
* macroscope.c (default_macro_scope): Ditto.
* stack.c (print_frame_info_base): Ditto.
(print_frame, frame_info, print_frame_label_vars): Ditto.
(return_command, func_command, get_frame_language): Ditto.
* infcmd.c (finish_command): Ditto.
* dummy-frame.c (cached_find_dummy_frame): Ditto.
* breakpoint.c (deprecated_frame_in_dummy): Ditto.
(break_at_finish_at_depth_command_1): Ditto.
(break_at_finish_command_1): Ditto.
(until_break_command, get_catch_sals): Ditto.
* blockframe.c (func_frame_chain_valid): Ditto.
(frameless_look_for_prologue): Ditto.
(frame_address_in_block, generic_func_frame_chain_valid): Ditto.
2002-12-08 Andrew Cagney <ac131313@redhat.com>
* config/rs6000/tm-rs6000.h (init_frame_pc_noop): Add declaration.

View File

@ -1836,7 +1836,7 @@ agent_command (char *exp, int from_tty)
expr = parse_expression (exp);
old_chain = make_cleanup (free_current_contents, &expr);
agent = gen_trace_for_expr (fi->pc, expr);
agent = gen_trace_for_expr (get_frame_pc (fi), expr);
make_cleanup_free_agent_expr (agent);
ax_print (gdb_stdout, agent);

View File

@ -60,8 +60,8 @@ int
func_frame_chain_valid (CORE_ADDR chain, struct frame_info *thisframe)
{
return ((chain) != 0
&& !inside_main_func ((thisframe)->pc)
&& !inside_entry_func ((thisframe)->pc));
&& !inside_main_func (get_frame_pc (thisframe))
&& !inside_entry_func (get_frame_pc (thisframe)));
}
/* A very simple method of determining a valid frame */
@ -173,7 +173,7 @@ frameless_look_for_prologue (struct frame_info *frame)
{
CORE_ADDR func_start, after_prologue;
func_start = get_pc_function_start (frame->pc);
func_start = get_pc_function_start (get_frame_pc (frame));
if (func_start)
{
func_start += FUNCTION_START_OFFSET;
@ -181,7 +181,7 @@ frameless_look_for_prologue (struct frame_info *frame)
prologue, not how long it is. */
return PROLOGUE_FRAMELESS_P (func_start);
}
else if (frame->pc == 0)
else if (get_frame_pc (frame) == 0)
/* A frame with a zero PC is usually created by dereferencing a
NULL function pointer, normally causing an immediate core dump
of the inferior. Mark function as frameless, as the inferior
@ -202,7 +202,7 @@ frameless_look_for_prologue (struct frame_info *frame)
CORE_ADDR
frame_address_in_block (struct frame_info *frame)
{
CORE_ADDR pc = frame->pc;
CORE_ADDR pc = get_frame_pc (frame);
/* If we are not in the innermost frame, and we are not interrupted
by a signal, frame->pc points to the instruction following the
@ -710,13 +710,13 @@ int
generic_func_frame_chain_valid (CORE_ADDR fp, struct frame_info *fi)
{
if (DEPRECATED_USE_GENERIC_DUMMY_FRAMES
&& DEPRECATED_PC_IN_CALL_DUMMY ((fi)->pc, 0, 0))
&& DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (fi), 0, 0))
return 1; /* don't prune CALL_DUMMY frames */
else /* fall back to default algorithm (see frame.h) */
return (fp != 0
&& (INNER_THAN (get_frame_base (fi), fp)
|| get_frame_base (fi) == fp)
&& !inside_main_func ((fi)->pc)
&& !inside_entry_func ((fi)->pc));
&& !inside_main_func (get_frame_pc (fi))
&& !inside_entry_func (get_frame_pc (fi)));
}

View File

@ -1707,10 +1707,10 @@ deprecated_frame_in_dummy (struct frame_info *frame)
&& b->frame == get_frame_base (frame)
/* We need to check the PC as well as the frame on the sparc,
for signals.exp in the testsuite. */
&& (frame->pc
&& (get_frame_pc (frame)
>= (b->address
- SIZEOF_CALL_DUMMY_WORDS / sizeof (LONGEST) * REGISTER_SIZE))
&& frame->pc <= b->address)
- SIZEOF_CALL_DUMMY_WORDS / sizeof (LONGEST) * REGISTER_SIZE))
&& get_frame_pc (frame) <= b->address)
return 1;
}
return 0;
@ -4968,7 +4968,7 @@ break_at_finish_at_depth_command_1 (char *arg, int flag, int from_tty)
{
if (deprecated_selected_frame)
{
selected_pc = deprecated_selected_frame->pc;
selected_pc = get_frame_pc (deprecated_selected_frame);
if (arg)
if_arg = 1;
}
@ -4997,7 +4997,7 @@ break_at_finish_at_depth_command_1 (char *arg, int flag, int from_tty)
frame = parse_frame_specification (level_arg);
if (frame)
selected_pc = frame->pc;
selected_pc = get_frame_pc (frame);
else
selected_pc = 0;
}
@ -5047,7 +5047,8 @@ break_at_finish_command_1 (char *arg, int flag, int from_tty)
if (deprecated_selected_frame)
{
addr_string = (char *) xmalloc (15);
sprintf (addr_string, "*0x%s", paddr_nz (deprecated_selected_frame->pc));
sprintf (addr_string, "*0x%s",
paddr_nz (get_frame_pc (deprecated_selected_frame)));
if (arg)
if_arg = 1;
}
@ -5647,8 +5648,8 @@ until_break_command (char *arg, int from_tty)
if (prev_frame)
{
sal = find_pc_line (prev_frame->pc, 0);
sal.pc = prev_frame->pc;
sal = find_pc_line (get_frame_pc (prev_frame), 0);
sal.pc = get_frame_pc (prev_frame);
breakpoint = set_momentary_breakpoint (sal, prev_frame, bp_until);
if (!event_loop_p || !target_can_async_p ())
make_cleanup_delete_breakpoint (breakpoint);
@ -5776,7 +5777,7 @@ get_catch_sals (int this_level_only)
if (deprecated_selected_frame == NULL)
error ("No selected frame.");
block = get_frame_block (deprecated_selected_frame, 0);
pc = deprecated_selected_frame->pc;
pc = get_frame_pc (deprecated_selected_frame);
sals.nelts = 0;
sals.sals = NULL;

View File

@ -106,7 +106,7 @@ struct dummy_frame *
cached_find_dummy_frame (struct frame_info *frame, void **cache)
{
if ((*cache) == NULL)
(*cache) = find_dummy_frame (frame->pc, get_frame_base (frame));
(*cache) = find_dummy_frame (get_frame_pc (frame), get_frame_base (frame));
return (*cache);
}

View File

@ -595,7 +595,7 @@ info_common_command (char *comname, int from_tty)
/* The following is generally ripped off from stack.c's routine
print_frame_info() */
func = find_pc_function (fi->pc);
func = find_pc_function (get_frame_pc (fi));
if (func)
{
/* In certain pathological cases, the symtabs give the wrong
@ -612,7 +612,7 @@ info_common_command (char *comname, int from_tty)
be any minimal symbols in the middle of a function.
FIXME: (Not necessarily true. What about text labels) */
struct minimal_symbol *msymbol = lookup_minimal_symbol_by_pc (fi->pc);
struct minimal_symbol *msymbol = lookup_minimal_symbol_by_pc (get_frame_pc (fi));
if (msymbol != NULL
&& (SYMBOL_VALUE_ADDRESS (msymbol)
@ -624,7 +624,7 @@ info_common_command (char *comname, int from_tty)
else
{
register struct minimal_symbol *msymbol =
lookup_minimal_symbol_by_pc (fi->pc);
lookup_minimal_symbol_by_pc (get_frame_pc (fi));
if (msymbol != NULL)
funname = SYMBOL_NAME (msymbol);

View File

@ -1281,8 +1281,8 @@ finish_command (char *arg, int from_tty)
clear_proceed_status ();
sal = find_pc_line (frame->pc, 0);
sal.pc = frame->pc;
sal = find_pc_line (get_frame_pc (frame), 0);
sal.pc = get_frame_pc (frame);
breakpoint = set_momentary_breakpoint (sal, frame, bp_finish);
@ -1293,7 +1293,7 @@ finish_command (char *arg, int from_tty)
/* Find the function we will return from. */
function = find_pc_function (deprecated_selected_frame->pc);
function = find_pc_function (get_frame_pc (deprecated_selected_frame));
/* Print info on the selected frame, including level number
but not source. */

View File

@ -88,7 +88,7 @@ default_macro_scope (void)
/* If there's a selected frame, use its PC. */
if (deprecated_selected_frame)
sal = find_pc_line (deprecated_selected_frame->pc, 0);
sal = find_pc_line (get_frame_pc (deprecated_selected_frame), 0);
/* If the target has any registers at all, then use its PC. Why we
would have registers but no stack, I'm not sure. */

View File

@ -169,8 +169,8 @@ rs6000_init_extra_frame_info (int fromleaf, struct frame_info *fi)
fi->extra_info = (struct frame_extra_info *)
frame_obstack_alloc (sizeof (struct frame_extra_info));
fi->extra_info->initial_sp = 0;
if (get_next_frame (fi) != (CORE_ADDR) 0
&& fi->pc < TEXT_SEGMENT_BASE)
if (get_next_frame (fi) != NULL
&& get_frame_pc (fi) < TEXT_SEGMENT_BASE)
/* We're in get_prev_frame */
/* and this is a special signal frame. */
/* (fi->pc will be some low address in the kernel, */
@ -958,7 +958,7 @@ rs6000_pop_frame (void)
pc = read_pc ();
sp = get_frame_base (frame);
if (DEPRECATED_PC_IN_CALL_DUMMY (frame->pc,
if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (frame),
get_frame_base (frame),
get_frame_base (frame)))
{
@ -974,8 +974,8 @@ rs6000_pop_frame (void)
still in the link register, otherwise walk the frames and retrieve the
saved %pc value in the previous frame. */
addr = get_pc_function_start (frame->pc);
(void) skip_prologue (addr, frame->pc, &fdata);
addr = get_pc_function_start (get_frame_pc (frame));
(void) skip_prologue (addr, get_frame_pc (frame), &fdata);
wordsize = gdbarch_tdep (current_gdbarch)->wordsize;
if (fdata.frameless)
@ -1483,7 +1483,7 @@ rs6000_frameless_function_invocation (struct frame_info *fi)
&& !(get_frame_type (get_next_frame (fi)) == SIGTRAMP_FRAME))
return 0;
func_start = get_pc_function_start (fi->pc);
func_start = get_pc_function_start (get_frame_pc (fi));
/* If we failed to find the start of the function, it is a mistake
to inspect the instructions. */
@ -1494,13 +1494,13 @@ rs6000_frameless_function_invocation (struct frame_info *fi)
function pointer, normally causing an immediate core dump of the
inferior. Mark function as frameless, as the inferior has no chance
of setting up a stack frame. */
if (fi->pc == 0)
if (get_frame_pc (fi) == 0)
return 1;
else
return 0;
}
(void) skip_prologue (func_start, fi->pc, &fdata);
(void) skip_prologue (func_start, get_frame_pc (fi), &fdata);
return fdata.frameless;
}
@ -1518,20 +1518,20 @@ rs6000_frame_saved_pc (struct frame_info *fi)
return read_memory_addr (get_frame_base (fi) + SIG_FRAME_PC_OFFSET,
wordsize);
if (DEPRECATED_PC_IN_CALL_DUMMY (fi->pc,
if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (fi),
get_frame_base (fi),
get_frame_base (fi)))
return deprecated_read_register_dummy (fi->pc,
return deprecated_read_register_dummy (get_frame_pc (fi),
get_frame_base (fi), PC_REGNUM);
func_start = get_pc_function_start (fi->pc);
func_start = get_pc_function_start (get_frame_pc (fi));
/* If we failed to find the start of the function, it is a mistake
to inspect the instructions. */
if (!func_start)
return 0;
(void) skip_prologue (func_start, fi->pc, &fdata);
(void) skip_prologue (func_start, get_frame_pc (fi), &fdata);
if (fdata.lr_offset == 0 && get_next_frame (fi) != NULL)
{
@ -1539,7 +1539,7 @@ rs6000_frame_saved_pc (struct frame_info *fi)
return read_memory_addr ((get_frame_base (get_next_frame (fi))
+ SIG_FRAME_LR_OFFSET),
wordsize);
else if (DEPRECATED_PC_IN_CALL_DUMMY (get_next_frame (fi)->pc, 0, 0))
else if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (get_next_frame (fi)), 0, 0))
/* The link register wasn't saved by this frame and the next
(inner, newer) frame is a dummy. Get the link register
value by unwinding it from that [dummy] frame. */
@ -1578,7 +1578,8 @@ frame_get_saved_regs (struct frame_info *fi, struct rs6000_framedata *fdatap)
if (fdatap == NULL)
{
fdatap = &work_fdata;
(void) skip_prologue (get_pc_function_start (fi->pc), fi->pc, fdatap);
(void) skip_prologue (get_pc_function_start (get_frame_pc (fi)),
get_frame_pc (fi), fdatap);
}
frame_saved_regs_zalloc (fi);
@ -1701,7 +1702,8 @@ frame_initial_stack_address (struct frame_info *fi)
/* Find out if this function is using an alloca register. */
(void) skip_prologue (get_pc_function_start (fi->pc), fi->pc, &fdata);
(void) skip_prologue (get_pc_function_start (get_frame_pc (fi)),
get_frame_pc (fi), &fdata);
/* If saved registers of this frame are not known yet, read and
cache them. */
@ -1752,15 +1754,15 @@ rs6000_frame_chain (struct frame_info *thisframe)
CORE_ADDR fp, fpp, lr;
int wordsize = gdbarch_tdep (current_gdbarch)->wordsize;
if (DEPRECATED_PC_IN_CALL_DUMMY (thisframe->pc,
if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (thisframe),
get_frame_base (thisframe),
get_frame_base (thisframe)))
/* A dummy frame always correctly chains back to the previous
frame. */
return read_memory_addr (get_frame_base (thisframe), wordsize);
if (inside_entry_file (thisframe->pc) ||
thisframe->pc == entry_point_address ())
if (inside_entry_file (get_frame_pc (thisframe))
|| get_frame_pc (thisframe) == entry_point_address ())
return 0;
if ((get_frame_type (thisframe) == SIGTRAMP_FRAME))

View File

@ -314,7 +314,7 @@ print_frame_info_base (struct frame_info *fi, int level, int source, int args)
if (get_frame_type (fi) == DUMMY_FRAME)
{
annotate_frame_begin (level == -1 ? 0 : level, fi->pc);
annotate_frame_begin (level == -1 ? 0 : level, get_frame_pc (fi));
/* Do this regardless of SOURCE because we don't have any source
to list for this frame. */
@ -330,7 +330,7 @@ print_frame_info_base (struct frame_info *fi, int level, int source, int args)
}
if ((get_frame_type (fi) == SIGTRAMP_FRAME))
{
annotate_frame_begin (level == -1 ? 0 : level, fi->pc);
annotate_frame_begin (level == -1 ? 0 : level, get_frame_pc (fi));
/* Do this regardless of SOURCE because we don't have any source
to list for this frame. */
@ -369,11 +369,11 @@ print_frame_info_base (struct frame_info *fi, int level, int source, int args)
{
struct symtab_and_line cursal;
int done = 0;
int mid_statement = (source == SRC_LINE) && (fi->pc != sal.pc);
int mid_statement = (source == SRC_LINE) && (get_frame_pc (fi) != sal.pc);
if (annotation_level)
done = identify_source_line (sal.symtab, sal.line, mid_statement,
fi->pc);
get_frame_pc (fi));
if (!done)
{
if (print_frame_info_listing_hook)
@ -390,7 +390,7 @@ print_frame_info_base (struct frame_info *fi, int level, int source, int args)
ability to decide for themselves if it is desired. */
if (addressprint && mid_statement)
{
ui_out_field_core_addr (uiout, "addr", fi->pc);
ui_out_field_core_addr (uiout, "addr", get_frame_pc (fi));
ui_out_text (uiout, "\t");
}
@ -405,7 +405,7 @@ print_frame_info_base (struct frame_info *fi, int level, int source, int args)
}
if (source != 0)
set_default_breakpoint (1, fi->pc, sal.symtab, sal.line);
set_default_breakpoint (1, get_frame_pc (fi), sal.symtab, sal.line);
annotate_frame_end ();
@ -504,7 +504,7 @@ print_frame (struct frame_info *fi,
}
}
annotate_frame_begin (level == -1 ? 0 : level, fi->pc);
annotate_frame_begin (level == -1 ? 0 : level, get_frame_pc (fi));
list_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "frame");
@ -514,10 +514,12 @@ print_frame (struct frame_info *fi,
ui_out_field_fmt_int (uiout, 2, ui_left, "level", level);
}
if (addressprint)
if (fi->pc != sal.pc || !sal.symtab || source == LOC_AND_ADDRESS)
if (get_frame_pc (fi) != sal.pc
|| !sal.symtab
|| source == LOC_AND_ADDRESS)
{
annotate_frame_address ();
ui_out_field_core_addr (uiout, "addr", fi->pc);
ui_out_field_core_addr (uiout, "addr", get_frame_pc (fi));
annotate_frame_address_end ();
ui_out_text (uiout, " in ");
}
@ -562,7 +564,7 @@ print_frame (struct frame_info *fi,
#ifdef PC_SOLIB
if (!funname || (!sal.symtab || !sal.symtab->filename))
{
char *lib = PC_SOLIB (fi->pc);
char *lib = PC_SOLIB (get_frame_pc (fi));
if (lib)
{
annotate_frame_where ();
@ -752,7 +754,7 @@ frame_info (char *addr_exp, int from_tty)
func = get_frame_function (fi);
/* FIXME: cagney/2002-11-28: Why bother? Won't sal.symtab contain
the same value. */
s = find_pc_symtab (fi->pc);
s = find_pc_symtab (get_frame_pc (fi));
if (func)
{
/* I'd like to use SYMBOL_SOURCE_NAME() here, to display
@ -784,7 +786,7 @@ frame_info (char *addr_exp, int from_tty)
}
else
{
register struct minimal_symbol *msymbol = lookup_minimal_symbol_by_pc (fi->pc);
register struct minimal_symbol *msymbol = lookup_minimal_symbol_by_pc (get_frame_pc (fi));
if (msymbol != NULL)
{
funname = SYMBOL_NAME (msymbol);
@ -807,7 +809,7 @@ frame_info (char *addr_exp, int from_tty)
printf_filtered (":\n");
}
printf_filtered (" %s = ", REGISTER_NAME (PC_REGNUM));
print_address_numeric (fi->pc, 1, gdb_stdout);
print_address_numeric (get_frame_pc (fi), 1, gdb_stdout);
wrap_here (" ");
if (funname)
@ -1301,7 +1303,7 @@ print_frame_label_vars (register struct frame_info *fi, int this_level_only,
register int values_printed = 0;
int index, have_default = 0;
char *blocks_printed;
CORE_ADDR pc = fi->pc;
CORE_ADDR pc = get_frame_pc (fi);
if (block == 0)
{
@ -1708,7 +1710,7 @@ return_command (char *retval_exp, int from_tty)
error ("No selected frame.");
thisfun = get_frame_function (deprecated_selected_frame);
selected_frame_addr = get_frame_base (deprecated_selected_frame);
selected_frame_pc = deprecated_selected_frame->pc;
selected_frame_pc = get_frame_pc (deprecated_selected_frame);
/* Compute the return value (if any -- possibly getting errors here). */
@ -1753,7 +1755,7 @@ return_command (char *retval_exp, int from_tty)
selected frame shares its fp with another frame. */
while (selected_frame_addr != get_frame_base (frame = get_current_frame ())
|| selected_frame_pc != frame->pc)
|| selected_frame_pc != get_frame_pc (frame))
POP_FRAME;
/* Then pop that frame. */
@ -1822,8 +1824,8 @@ func_command (char *arg, int from_tty)
do
{
for (i = 0; (i < sals.nelts && !found); i++)
found = (fp->pc >= func_bounds[i].low &&
fp->pc < func_bounds[i].high);
found = (get_frame_pc (fp) >= func_bounds[i].low &&
get_frame_pc (fp) < func_bounds[i].high);
if (!found)
{
level = 1;
@ -1851,7 +1853,7 @@ get_frame_language (void)
if (deprecated_selected_frame)
{
s = find_pc_symtab (deprecated_selected_frame->pc);
s = find_pc_symtab (get_frame_pc (deprecated_selected_frame));
if (s)
flang = s->language;
else

View File

@ -103,7 +103,8 @@ value_of_builtin_frame_pc_reg (struct frame_info *frame)
if (frame == NULL)
memset (buf, TYPE_LENGTH (VALUE_TYPE (val)), 0);
else
ADDRESS_TO_POINTER (builtin_type_void_data_ptr, buf, frame->pc);
ADDRESS_TO_POINTER (builtin_type_void_data_ptr, buf,
get_frame_pc (frame));
return val;
}
}

View File

@ -2105,7 +2105,7 @@ trace_find_line_command (char *args, int from_tty)
{
if (args == 0 || *args == 0)
{
sal = find_pc_line ((get_current_frame ())->pc, 0);
sal = find_pc_line (get_frame_pc (get_current_frame ()), 0);
sals.nelts = 1;
sals.sals = (struct symtab_and_line *)
xmalloc (sizeof (struct symtab_and_line));