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

* gdbthread.h: Include "frame.h".
	(struct thread_info): Replace step_frame_address with
	step_frame_id.
	* inferior.h: Include "frame.h".
	(step_frame_id): Replace external variable step_frame_address.
	* gdbthread.h (save_infrun_state): Replace step_frame_address
	parameter with step_frame_id parameter.
	(load_infrun_state): Ditto.
	* Makefile.in (gdbthread_h, inferior_h): Add $(frame_h).
	* infcmd.c (step_frame_id, step_1, step_once): Update.
	* thread.c (load_infrun_state, save_infrun_state): Update.
	* infrun.c (clear_proceed_status, save_inferior_status): Update.
	(handle_inferior_event, step_over_function): Update.
	(normal_stop, context_switch, restore_inferior_status): Update.
	(struct inferior_status): Replace step_frame_address with
	step_frame_id.
This commit is contained in:
Andrew Cagney 2002-12-06 07:35:55 +00:00
parent 2f9bd3f641
commit aa0cd9c15b
7 changed files with 78 additions and 47 deletions

View file

@ -1,3 +1,22 @@
2002-12-05 Andrew Cagney <ac131313@redhat.com>
* gdbthread.h: Include "frame.h".
(struct thread_info): Replace step_frame_address with
step_frame_id.
* inferior.h: Include "frame.h".
(step_frame_id): Replace external variable step_frame_address.
* gdbthread.h (save_infrun_state): Replace step_frame_address
parameter with step_frame_id parameter.
(load_infrun_state): Ditto.
* Makefile.in (gdbthread_h, inferior_h): Add $(frame_h).
* infcmd.c (step_frame_id, step_1, step_once): Update.
* thread.c (load_infrun_state, save_infrun_state): Update.
* infrun.c (clear_proceed_status, save_inferior_status): Update.
(handle_inferior_event, step_over_function): Update.
(normal_stop, context_switch, restore_inferior_status): Update.
(struct inferior_status): Replace step_frame_address with
step_frame_id.
2002-12-05 David Carlton <carlton@math.stanford.edu> 2002-12-05 David Carlton <carlton@math.stanford.edu>
* dwarf2read.c (dwarf2_add_field): Treat a field that is a * dwarf2read.c (dwarf2_add_field): Treat a field that is a

View file

@ -664,7 +664,7 @@ gdb_wait_h = gdb_wait.h
gdbarch_h = gdbarch.h $(dis_asm_h) $(value_h) $(inferior_h) gdbarch_h = gdbarch.h $(dis_asm_h) $(value_h) $(inferior_h)
gdbcmd_h = gdbcmd.h $(command_h) $(ui_out_h) gdbcmd_h = gdbcmd.h $(command_h) $(ui_out_h)
gdbcore_h = gdbcore.h $(bfd_h) gdbcore_h = gdbcore.h $(bfd_h)
gdbthread_h = gdbthread.h $(breakpoint_h) gdbthread_h = gdbthread.h $(breakpoint_h) $(frame_h)
gdbtypes_h = gdbtypes.h gdbtypes_h = gdbtypes.h
gnu_nat_h = gnu-nat.h gnu_nat_h = gnu-nat.h
gregset_h = gregset.h gregset_h = gregset.h
@ -672,7 +672,7 @@ i386_linux_tdep_h = i386-linux-tdep.h
i386_tdep_h = i386-tdep.h $(osabi_h) i386_tdep_h = i386-tdep.h $(osabi_h)
i387_tdep_h = i387-tdep.h i387_tdep_h = i387-tdep.h
inf_loop_h = inf-loop.h inf_loop_h = inf-loop.h
inferior_h = inferior.h $(breakpoint_h) $(target_h) inferior_h = inferior.h $(breakpoint_h) $(target_h) $(frame_h)
jv_lang_h = jv-lang.h jv_lang_h = jv-lang.h
kod_h = kod.h kod_h = kod.h
language_h = language.h language_h = language.h

View file

@ -28,6 +28,9 @@
/* For bpstat */ /* For bpstat */
#include "breakpoint.h" #include "breakpoint.h"
/* For struct frame_id. */
#include "frame.h"
struct thread_info struct thread_info
{ {
struct thread_info *next; struct thread_info *next;
@ -43,7 +46,7 @@ struct thread_info
struct breakpoint *through_sigtramp_breakpoint; struct breakpoint *through_sigtramp_breakpoint;
CORE_ADDR step_range_start; CORE_ADDR step_range_start;
CORE_ADDR step_range_end; CORE_ADDR step_range_end;
CORE_ADDR step_frame_address; struct frame_id step_frame_id;
CORE_ADDR step_sp; CORE_ADDR step_sp;
int current_line; int current_line;
struct symtab *current_symtab; struct symtab *current_symtab;
@ -118,7 +121,7 @@ extern void save_infrun_state (ptid_t ptid,
struct breakpoint *through_sigtramp_breakpoint, struct breakpoint *through_sigtramp_breakpoint,
CORE_ADDR step_range_start, CORE_ADDR step_range_start,
CORE_ADDR step_range_end, CORE_ADDR step_range_end,
CORE_ADDR step_frame_address, const struct frame_id *step_frame_id,
int handling_longjmp, int handling_longjmp,
int another_trap, int another_trap,
int stepping_through_solib_after_catch, int stepping_through_solib_after_catch,
@ -139,7 +142,7 @@ extern void load_infrun_state (ptid_t ptid,
struct breakpoint **through_sigtramp_breakpoint, struct breakpoint **through_sigtramp_breakpoint,
CORE_ADDR *step_range_start, CORE_ADDR *step_range_start,
CORE_ADDR *step_range_end, CORE_ADDR *step_range_end,
CORE_ADDR *step_frame_address, struct frame_id *step_frame_id,
int *handling_longjmp, int *handling_longjmp,
int *another_trap, int *another_trap,
int *stepping_through_solib_affter_catch, int *stepping_through_solib_affter_catch,

View file

@ -182,7 +182,7 @@ CORE_ADDR step_range_end; /* Exclusive */
This is how we know when we step into a subroutine call, This is how we know when we step into a subroutine call,
and how to set the frame for the breakpoint used to step out. */ and how to set the frame for the breakpoint used to step out. */
CORE_ADDR step_frame_address; struct frame_id step_frame_id;
/* Our notion of the current stack pointer. */ /* Our notion of the current stack pointer. */
@ -627,7 +627,7 @@ step_1 (int skip_subroutines, int single_inst, char *count_string)
frame = get_current_frame (); frame = get_current_frame ();
if (!frame) /* Avoid coredump here. Why tho? */ if (!frame) /* Avoid coredump here. Why tho? */
error ("No current frame"); error ("No current frame");
step_frame_address = get_frame_base (frame); step_frame_id = get_frame_id (frame);
step_sp = read_sp (); step_sp = read_sp ();
if (!single_inst) if (!single_inst)
@ -742,7 +742,7 @@ step_once (int skip_subroutines, int single_inst, int count)
frame = get_current_frame (); frame = get_current_frame ();
if (!frame) /* Avoid coredump here. Why tho? */ if (!frame) /* Avoid coredump here. Why tho? */
error ("No current frame"); error ("No current frame");
step_frame_address = get_frame_base (frame); step_frame_id = get_frame_id (frame);
step_sp = read_sp (); step_sp = read_sp ();
if (!single_inst) if (!single_inst)
@ -1105,7 +1105,7 @@ until_next_command (int from_tty)
} }
step_over_calls = STEP_OVER_ALL; step_over_calls = STEP_OVER_ALL;
step_frame_address = get_frame_base (frame); step_frame_id = get_frame_id (frame);
step_sp = read_sp (); step_sp = read_sp ();
step_multi = 0; /* Only one call to proceed */ step_multi = 0; /* Only one call to proceed */

View file

@ -32,6 +32,9 @@ struct regcache;
/* For enum target_signal. */ /* For enum target_signal. */
#include "target.h" #include "target.h"
/* For struct frame_id. */
#include "frame.h"
/* Structure in which to save the status of the inferior. Create/Save /* Structure in which to save the status of the inferior. Create/Save
through "save_inferior_status", restore through through "save_inferior_status", restore through
"restore_inferior_status". "restore_inferior_status".
@ -369,7 +372,7 @@ extern CORE_ADDR step_range_end; /* Exclusive */
This is how we know when we step into a subroutine call, This is how we know when we step into a subroutine call,
and how to set the frame for the breakpoint used to step out. */ and how to set the frame for the breakpoint used to step out. */
extern CORE_ADDR step_frame_address; extern struct frame_id step_frame_id;
/* Our notion of the current stack pointer. */ /* Our notion of the current stack pointer. */

View file

@ -822,7 +822,7 @@ clear_proceed_status (void)
trap_expected = 0; trap_expected = 0;
step_range_start = 0; step_range_start = 0;
step_range_end = 0; step_range_end = 0;
step_frame_address = 0; step_frame_id = null_frame_id;
step_over_calls = STEP_OVER_UNDEBUGGABLE; step_over_calls = STEP_OVER_UNDEBUGGABLE;
stop_after_trap = 0; stop_after_trap = 0;
stop_soon_quietly = 0; stop_soon_quietly = 0;
@ -1291,7 +1291,7 @@ context_switch (struct execution_control_state *ecs)
prev_func_start, prev_func_name, prev_func_start, prev_func_name,
trap_expected, step_resume_breakpoint, trap_expected, step_resume_breakpoint,
through_sigtramp_breakpoint, step_range_start, through_sigtramp_breakpoint, step_range_start,
step_range_end, step_frame_address, step_range_end, &step_frame_id,
ecs->handling_longjmp, ecs->another_trap, ecs->handling_longjmp, ecs->another_trap,
ecs->stepping_through_solib_after_catch, ecs->stepping_through_solib_after_catch,
ecs->stepping_through_solib_catchpoints, ecs->stepping_through_solib_catchpoints,
@ -1303,7 +1303,7 @@ context_switch (struct execution_control_state *ecs)
&prev_func_start, &prev_func_name, &prev_func_start, &prev_func_name,
&trap_expected, &step_resume_breakpoint, &trap_expected, &step_resume_breakpoint,
&through_sigtramp_breakpoint, &step_range_start, &through_sigtramp_breakpoint, &step_range_start,
&step_range_end, &step_frame_address, &step_range_end, &step_frame_id,
&ecs->handling_longjmp, &ecs->another_trap, &ecs->handling_longjmp, &ecs->another_trap,
&ecs->stepping_through_solib_after_catch, &ecs->stepping_through_solib_after_catch,
&ecs->stepping_through_solib_catchpoints, &ecs->stepping_through_solib_catchpoints,
@ -2255,8 +2255,8 @@ process_event_stop_test:
#if 0 #if 0
/* FIXME - Need to implement nested temporary breakpoints */ /* FIXME - Need to implement nested temporary breakpoints */
if (step_over_calls if (step_over_calls
&& (INNER_THAN (get_frame_base (get_current_frame ()), && (frame_id_inner (get_frame_id (get_current_frame ()),
step_frame_address))) step_frame_id)))
{ {
ecs->another_trap = 1; ecs->another_trap = 1;
keep_going (ecs); keep_going (ecs);
@ -2567,9 +2567,9 @@ process_event_stop_test:
{ {
CORE_ADDR current_frame = get_frame_base (get_current_frame ()); struct frame_id current_frame = get_frame_id (get_current_frame ());
if (INNER_THAN (current_frame, step_frame_address)) if (frame_id_inner (current_frame, step_frame_id))
{ {
/* We have just taken a signal; go until we are back to /* We have just taken a signal; go until we are back to
the point where we took it and one more. */ the point where we took it and one more. */
@ -2589,8 +2589,7 @@ process_event_stop_test:
sr_sal.line = 0; sr_sal.line = 0;
sr_sal.pc = prev_pc; sr_sal.pc = prev_pc;
/* We could probably be setting the frame to /* We could probably be setting the frame to
step_frame_address; I don't think anyone thought to step_frame_id; I don't think anyone thought to try it. */
try it. */
check_for_old_step_resume_breakpoint (); check_for_old_step_resume_breakpoint ();
step_resume_breakpoint = step_resume_breakpoint =
set_momentary_breakpoint (sr_sal, NULL, bp_step_resume); set_momentary_breakpoint (sr_sal, NULL, bp_step_resume);
@ -2664,17 +2663,17 @@ process_event_stop_test:
/* We're doing a "next". */ /* We're doing a "next". */
if (PC_IN_SIGTRAMP (stop_pc, ecs->stop_func_name) if (PC_IN_SIGTRAMP (stop_pc, ecs->stop_func_name)
&& INNER_THAN (step_frame_address, read_sp ())) && frame_id_inner (step_frame_id,
frame_id_build (read_sp (), 0)))
/* We stepped out of a signal handler, and into its /* We stepped out of a signal handler, and into its
calling trampoline. This is misdetected as a calling trampoline. This is misdetected as a
subroutine call, but stepping over the signal subroutine call, but stepping over the signal
trampoline isn't such a bad idea. In order to do trampoline isn't such a bad idea. In order to do that,
that, we have to ignore the value in we have to ignore the value in step_frame_id, since
step_frame_address, since that doesn't represent the that doesn't represent the frame that'll reach when we
frame that'll reach when we return from the signal return from the signal trampoline. Otherwise we'll
trampoline. Otherwise we'll probably continue to the probably continue to the end of the program. */
end of the program. */ step_frame_id = null_frame_id;
step_frame_address = 0;
step_over_function (ecs); step_over_function (ecs);
keep_going (ecs); keep_going (ecs);
@ -2838,17 +2837,17 @@ process_event_stop_test:
} }
step_range_start = ecs->sal.pc; step_range_start = ecs->sal.pc;
step_range_end = ecs->sal.end; step_range_end = ecs->sal.end;
step_frame_address = get_frame_base (get_current_frame ()); step_frame_id = get_frame_id (get_current_frame ());
ecs->current_line = ecs->sal.line; ecs->current_line = ecs->sal.line;
ecs->current_symtab = ecs->sal.symtab; ecs->current_symtab = ecs->sal.symtab;
/* In the case where we just stepped out of a function into the middle /* In the case where we just stepped out of a function into the
of a line of the caller, continue stepping, but step_frame_address middle of a line of the caller, continue stepping, but
must be modified to current frame */ step_frame_id must be modified to current frame */
{ {
CORE_ADDR current_frame = get_frame_base (get_current_frame ()); struct frame_id current_frame = get_frame_id (get_current_frame ());
if (!(INNER_THAN (current_frame, step_frame_address))) if (!(frame_id_inner (current_frame, step_frame_id)))
step_frame_address = current_frame; step_frame_id = current_frame;
} }
keep_going (ecs); keep_going (ecs);
@ -2971,7 +2970,7 @@ step_into_function (struct execution_control_state *ecs)
of the call. of the call.
To do this, we set the step_resume bp's frame to our current To do this, we set the step_resume bp's frame to our current
caller's frame (step_frame_address, which is set by the "next" or caller's frame (step_frame_id, which is set by the "next" or
"until" command, before execution begins). */ "until" command, before execution begins). */
static void static void
@ -2987,8 +2986,11 @@ step_over_function (struct execution_control_state *ecs)
step_resume_breakpoint = step_resume_breakpoint =
set_momentary_breakpoint (sr_sal, get_current_frame (), bp_step_resume); set_momentary_breakpoint (sr_sal, get_current_frame (), bp_step_resume);
if (step_frame_address && !IN_SOLIB_DYNSYM_RESOLVE_CODE (sr_sal.pc)) if (frame_id_p (step_frame_id)
step_resume_breakpoint->frame = step_frame_address; && !IN_SOLIB_DYNSYM_RESOLVE_CODE (sr_sal.pc))
/* FIXME: cagney/2002-12-01: Someone should modify the breakpoint
code so that it uses a frame ID, instead of a frame address. */
step_resume_breakpoint->frame = step_frame_id.base;
if (breakpoints_inserted) if (breakpoints_inserted)
insert_breakpoints (); insert_breakpoints ();
@ -3352,8 +3354,12 @@ normal_stop (void)
switch (bpstat_ret) switch (bpstat_ret)
{ {
case PRINT_UNKNOWN: case PRINT_UNKNOWN:
/* FIXME: cagney/2002-12-01: Given that a frame ID does
(or should) carry around the function and does (or
should) use that when doing a frame comparison. */
if (stop_step if (stop_step
&& step_frame_address == get_frame_base (get_current_frame ()) && frame_id_eq (step_frame_id,
get_frame_id (get_current_frame ()))
&& step_start_function == find_pc_function (stop_pc)) && step_start_function == find_pc_function (stop_pc))
source_flag = SRC_LINE; /* finished step, just print source line */ source_flag = SRC_LINE; /* finished step, just print source line */
else else
@ -3791,7 +3797,7 @@ struct inferior_status
int trap_expected; int trap_expected;
CORE_ADDR step_range_start; CORE_ADDR step_range_start;
CORE_ADDR step_range_end; CORE_ADDR step_range_end;
CORE_ADDR step_frame_address; struct frame_id step_frame_id;
enum step_over_calls_kind step_over_calls; enum step_over_calls_kind step_over_calls;
CORE_ADDR step_resume_break_address; CORE_ADDR step_resume_break_address;
int stop_after_trap; int stop_after_trap;
@ -3838,7 +3844,7 @@ save_inferior_status (int restore_stack_info)
inf_status->trap_expected = trap_expected; inf_status->trap_expected = trap_expected;
inf_status->step_range_start = step_range_start; inf_status->step_range_start = step_range_start;
inf_status->step_range_end = step_range_end; inf_status->step_range_end = step_range_end;
inf_status->step_frame_address = step_frame_address; inf_status->step_frame_id = step_frame_id;
inf_status->step_over_calls = step_over_calls; inf_status->step_over_calls = step_over_calls;
inf_status->stop_after_trap = stop_after_trap; inf_status->stop_after_trap = stop_after_trap;
inf_status->stop_soon_quietly = stop_soon_quietly; inf_status->stop_soon_quietly = stop_soon_quietly;
@ -3868,8 +3874,8 @@ restore_selected_frame (void *args)
frame = frame_find_by_id (*fid); frame = frame_find_by_id (*fid);
/* If inf_status->selected_frame_address is NULL, there was no /* If inf_status->selected_frame_id is NULL, there was no previously
previously selected frame. */ selected frame. */
if (frame == NULL) if (frame == NULL)
{ {
warning ("Unable to restore previously selected frame.\n"); warning ("Unable to restore previously selected frame.\n");
@ -3892,7 +3898,7 @@ restore_inferior_status (struct inferior_status *inf_status)
trap_expected = inf_status->trap_expected; trap_expected = inf_status->trap_expected;
step_range_start = inf_status->step_range_start; step_range_start = inf_status->step_range_start;
step_range_end = inf_status->step_range_end; step_range_end = inf_status->step_range_end;
step_frame_address = inf_status->step_frame_address; step_frame_id = inf_status->step_frame_id;
step_over_calls = inf_status->step_over_calls; step_over_calls = inf_status->step_over_calls;
stop_after_trap = inf_status->stop_after_trap; stop_after_trap = inf_status->stop_after_trap;
stop_soon_quietly = inf_status->stop_soon_quietly; stop_soon_quietly = inf_status->stop_soon_quietly;

View file

@ -296,7 +296,7 @@ load_infrun_state (ptid_t ptid,
struct breakpoint **through_sigtramp_breakpoint, struct breakpoint **through_sigtramp_breakpoint,
CORE_ADDR *step_range_start, CORE_ADDR *step_range_start,
CORE_ADDR *step_range_end, CORE_ADDR *step_range_end,
CORE_ADDR *step_frame_address, struct frame_id *step_frame_id,
int *handling_longjmp, int *handling_longjmp,
int *another_trap, int *another_trap,
int *stepping_through_solib_after_catch, int *stepping_through_solib_after_catch,
@ -322,7 +322,7 @@ load_infrun_state (ptid_t ptid,
*through_sigtramp_breakpoint = tp->through_sigtramp_breakpoint; *through_sigtramp_breakpoint = tp->through_sigtramp_breakpoint;
*step_range_start = tp->step_range_start; *step_range_start = tp->step_range_start;
*step_range_end = tp->step_range_end; *step_range_end = tp->step_range_end;
*step_frame_address = tp->step_frame_address; *step_frame_id = tp->step_frame_id;
*handling_longjmp = tp->handling_longjmp; *handling_longjmp = tp->handling_longjmp;
*another_trap = tp->another_trap; *another_trap = tp->another_trap;
*stepping_through_solib_after_catch = tp->stepping_through_solib_after_catch; *stepping_through_solib_after_catch = tp->stepping_through_solib_after_catch;
@ -345,7 +345,7 @@ save_infrun_state (ptid_t ptid,
struct breakpoint *through_sigtramp_breakpoint, struct breakpoint *through_sigtramp_breakpoint,
CORE_ADDR step_range_start, CORE_ADDR step_range_start,
CORE_ADDR step_range_end, CORE_ADDR step_range_end,
CORE_ADDR step_frame_address, const struct frame_id *step_frame_id,
int handling_longjmp, int handling_longjmp,
int another_trap, int another_trap,
int stepping_through_solib_after_catch, int stepping_through_solib_after_catch,
@ -371,7 +371,7 @@ save_infrun_state (ptid_t ptid,
tp->through_sigtramp_breakpoint = through_sigtramp_breakpoint; tp->through_sigtramp_breakpoint = through_sigtramp_breakpoint;
tp->step_range_start = step_range_start; tp->step_range_start = step_range_start;
tp->step_range_end = step_range_end; tp->step_range_end = step_range_end;
tp->step_frame_address = step_frame_address; tp->step_frame_id = (*step_frame_id);
tp->handling_longjmp = handling_longjmp; tp->handling_longjmp = handling_longjmp;
tp->another_trap = another_trap; tp->another_trap = another_trap;
tp->stepping_through_solib_after_catch = stepping_through_solib_after_catch; tp->stepping_through_solib_after_catch = stepping_through_solib_after_catch;