This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[commit] Some get_frame_pc() instead of frame->pc.
- From: Andrew Cagney <ac131313 at redhat dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Sun, 08 Dec 2002 22:28:25 -0500
- Subject: [commit] Some get_frame_pc() instead of frame->pc.
Hello,
More frame tightening. This cleans up some of the frame->pc references.
committed,
Andrew
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.
Index: ax-gdb.c
===================================================================
RCS file: /cvs/src/src/gdb/ax-gdb.c,v
retrieving revision 1.14
diff -u -r1.14 ax-gdb.c
--- ax-gdb.c 27 Aug 2002 22:37:06 -0000 1.14
+++ ax-gdb.c 9 Dec 2002 03:22:40 -0000
@@ -1836,7 +1836,7 @@
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);
Index: blockframe.c
===================================================================
RCS file: /cvs/src/src/gdb/blockframe.c,v
retrieving revision 1.58
diff -u -r1.58 blockframe.c
--- blockframe.c 9 Dec 2002 01:40:24 -0000 1.58
+++ blockframe.c 9 Dec 2002 03:22:43 -0000
@@ -60,8 +60,8 @@
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 @@
{
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 @@
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 @@
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 @@
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)));
}
Index: breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.101
diff -u -r1.101 breakpoint.c
--- breakpoint.c 9 Dec 2002 01:40:25 -0000 1.101
+++ breakpoint.c 9 Dec 2002 03:23:00 -0000
@@ -1707,10 +1707,10 @@
&& 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 @@
{
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 @@
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 @@
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 @@
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 @@
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;
Index: dummy-frame.c
===================================================================
RCS file: /cvs/src/src/gdb/dummy-frame.c,v
retrieving revision 1.5
diff -u -r1.5 dummy-frame.c
--- dummy-frame.c 9 Dec 2002 01:40:25 -0000 1.5
+++ dummy-frame.c 9 Dec 2002 03:23:03 -0000
@@ -106,7 +106,7 @@
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);
}
Index: f-valprint.c
===================================================================
RCS file: /cvs/src/src/gdb/f-valprint.c,v
retrieving revision 1.9
diff -u -r1.9 f-valprint.c
--- f-valprint.c 9 Dec 2002 01:40:25 -0000 1.9
+++ f-valprint.c 9 Dec 2002 03:23:06 -0000
@@ -595,7 +595,7 @@
/* 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 @@
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 @@
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);
Index: infcmd.c
===================================================================
RCS file: /cvs/src/src/gdb/infcmd.c,v
retrieving revision 1.66
diff -u -r1.66 infcmd.c
--- infcmd.c 6 Dec 2002 07:35:55 -0000 1.66
+++ infcmd.c 9 Dec 2002 03:23:11 -0000
@@ -1281,8 +1281,8 @@
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 @@
/* 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. */
Index: macroscope.c
===================================================================
RCS file: /cvs/src/src/gdb/macroscope.c,v
retrieving revision 1.6
diff -u -r1.6 macroscope.c
--- macroscope.c 29 Nov 2002 19:15:14 -0000 1.6
+++ macroscope.c 9 Dec 2002 03:23:11 -0000
@@ -88,7 +88,7 @@
/* 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. */
Index: rs6000-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/rs6000-tdep.c,v
retrieving revision 1.98
diff -u -r1.98 rs6000-tdep.c
--- rs6000-tdep.c 9 Dec 2002 01:40:25 -0000 1.98
+++ rs6000-tdep.c 9 Dec 2002 03:23:20 -0000
@@ -169,8 +169,8 @@
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 @@
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 @@
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 @@
&& !(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 @@
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 @@
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 @@
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 @@
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 @@
/* 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 @@
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))
Index: stack.c
===================================================================
RCS file: /cvs/src/src/gdb/stack.c,v
retrieving revision 1.57
diff -u -r1.57 stack.c
--- stack.c 9 Dec 2002 01:40:25 -0000 1.57
+++ stack.c 9 Dec 2002 03:23:25 -0000
@@ -314,7 +314,7 @@
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 @@
}
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 @@
{
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 @@
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 @@
}
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 @@
}
}
- 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 @@
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 @@
#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 @@
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 @@
}
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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
Index: std-regs.c
===================================================================
RCS file: /cvs/src/src/gdb/std-regs.c,v
retrieving revision 1.3
diff -u -r1.3 std-regs.c
--- std-regs.c 9 Dec 2002 01:40:25 -0000 1.3
+++ std-regs.c 9 Dec 2002 03:23:25 -0000
@@ -103,7 +103,8 @@
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;
}
}
Index: tracepoint.c
===================================================================
RCS file: /cvs/src/src/gdb/tracepoint.c,v
retrieving revision 1.44
diff -u -r1.44 tracepoint.c
--- tracepoint.c 29 Nov 2002 19:15:15 -0000 1.44
+++ tracepoint.c 9 Dec 2002 03:23:34 -0000
@@ -2105,7 +2105,7 @@
{
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));