From aa0cd9c15b5ced11efb415b6e8326b650f67f465 Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Fri, 6 Dec 2002 07:35:55 +0000 Subject: [PATCH] 2002-12-05 Andrew Cagney * 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. --- gdb/ChangeLog | 19 +++++++++++++ gdb/Makefile.in | 4 +-- gdb/gdbthread.h | 9 ++++--- gdb/infcmd.c | 8 +++--- gdb/inferior.h | 5 +++- gdb/infrun.c | 72 ++++++++++++++++++++++++++----------------------- gdb/thread.c | 8 +++--- 7 files changed, 78 insertions(+), 47 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 1b051a120e..4c3ffd1125 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,22 @@ +2002-12-05 Andrew Cagney + + * 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 * dwarf2read.c (dwarf2_add_field): Treat a field that is a diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 7560fbf792..d91b0731b2 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -664,7 +664,7 @@ gdb_wait_h = gdb_wait.h gdbarch_h = gdbarch.h $(dis_asm_h) $(value_h) $(inferior_h) gdbcmd_h = gdbcmd.h $(command_h) $(ui_out_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 gnu_nat_h = gnu-nat.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) i387_tdep_h = i387-tdep.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 kod_h = kod.h language_h = language.h diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h index da89b36eee..e3df58bbcf 100644 --- a/gdb/gdbthread.h +++ b/gdb/gdbthread.h @@ -28,6 +28,9 @@ /* For bpstat */ #include "breakpoint.h" +/* For struct frame_id. */ +#include "frame.h" + struct thread_info { struct thread_info *next; @@ -43,7 +46,7 @@ struct thread_info struct breakpoint *through_sigtramp_breakpoint; CORE_ADDR step_range_start; CORE_ADDR step_range_end; - CORE_ADDR step_frame_address; + struct frame_id step_frame_id; CORE_ADDR step_sp; int current_line; struct symtab *current_symtab; @@ -118,7 +121,7 @@ extern void save_infrun_state (ptid_t ptid, struct breakpoint *through_sigtramp_breakpoint, CORE_ADDR step_range_start, CORE_ADDR step_range_end, - CORE_ADDR step_frame_address, + const struct frame_id *step_frame_id, int handling_longjmp, int another_trap, int stepping_through_solib_after_catch, @@ -139,7 +142,7 @@ extern void load_infrun_state (ptid_t ptid, struct breakpoint **through_sigtramp_breakpoint, CORE_ADDR *step_range_start, CORE_ADDR *step_range_end, - CORE_ADDR *step_frame_address, + struct frame_id *step_frame_id, int *handling_longjmp, int *another_trap, int *stepping_through_solib_affter_catch, diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 2c631bcb5d..aaa2430e81 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -182,7 +182,7 @@ CORE_ADDR step_range_end; /* Exclusive */ 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. */ -CORE_ADDR step_frame_address; +struct frame_id step_frame_id; /* 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 (); if (!frame) /* Avoid coredump here. Why tho? */ error ("No current frame"); - step_frame_address = get_frame_base (frame); + step_frame_id = get_frame_id (frame); step_sp = read_sp (); if (!single_inst) @@ -742,7 +742,7 @@ step_once (int skip_subroutines, int single_inst, int count) frame = get_current_frame (); if (!frame) /* Avoid coredump here. Why tho? */ error ("No current frame"); - step_frame_address = get_frame_base (frame); + step_frame_id = get_frame_id (frame); step_sp = read_sp (); if (!single_inst) @@ -1105,7 +1105,7 @@ until_next_command (int from_tty) } 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_multi = 0; /* Only one call to proceed */ diff --git a/gdb/inferior.h b/gdb/inferior.h index 5d40fa7651..84b45698f3 100644 --- a/gdb/inferior.h +++ b/gdb/inferior.h @@ -32,6 +32,9 @@ struct regcache; /* For enum target_signal. */ #include "target.h" +/* For struct frame_id. */ +#include "frame.h" + /* Structure in which to save the status of the inferior. Create/Save through "save_inferior_status", restore through "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, 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. */ diff --git a/gdb/infrun.c b/gdb/infrun.c index 6998d41f05..76770cc5c1 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -822,7 +822,7 @@ clear_proceed_status (void) trap_expected = 0; step_range_start = 0; step_range_end = 0; - step_frame_address = 0; + step_frame_id = null_frame_id; step_over_calls = STEP_OVER_UNDEBUGGABLE; stop_after_trap = 0; stop_soon_quietly = 0; @@ -1291,7 +1291,7 @@ context_switch (struct execution_control_state *ecs) prev_func_start, prev_func_name, trap_expected, step_resume_breakpoint, 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->stepping_through_solib_after_catch, ecs->stepping_through_solib_catchpoints, @@ -1303,7 +1303,7 @@ context_switch (struct execution_control_state *ecs) &prev_func_start, &prev_func_name, &trap_expected, &step_resume_breakpoint, &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->stepping_through_solib_after_catch, &ecs->stepping_through_solib_catchpoints, @@ -2255,8 +2255,8 @@ process_event_stop_test: #if 0 /* FIXME - Need to implement nested temporary breakpoints */ if (step_over_calls - && (INNER_THAN (get_frame_base (get_current_frame ()), - step_frame_address))) + && (frame_id_inner (get_frame_id (get_current_frame ()), + step_frame_id))) { ecs->another_trap = 1; 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 the point where we took it and one more. */ @@ -2589,8 +2589,7 @@ process_event_stop_test: sr_sal.line = 0; sr_sal.pc = prev_pc; /* We could probably be setting the frame to - step_frame_address; I don't think anyone thought to - try it. */ + step_frame_id; I don't think anyone thought to try it. */ check_for_old_step_resume_breakpoint (); step_resume_breakpoint = set_momentary_breakpoint (sr_sal, NULL, bp_step_resume); @@ -2664,17 +2663,17 @@ process_event_stop_test: /* We're doing a "next". */ 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 calling trampoline. This is misdetected as a subroutine call, but stepping over the signal - trampoline isn't such a bad idea. In order to do - that, we have to ignore the value in - step_frame_address, since that doesn't represent the - frame that'll reach when we return from the signal - trampoline. Otherwise we'll probably continue to the - end of the program. */ - step_frame_address = 0; + trampoline isn't such a bad idea. In order to do that, + we have to ignore the value in step_frame_id, since + that doesn't represent the frame that'll reach when we + return from the signal trampoline. Otherwise we'll + probably continue to the end of the program. */ + step_frame_id = null_frame_id; step_over_function (ecs); keep_going (ecs); @@ -2838,17 +2837,17 @@ process_event_stop_test: } step_range_start = ecs->sal.pc; 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_symtab = ecs->sal.symtab; - /* In the case where we just stepped out of a function into the middle - of a line of the caller, continue stepping, but step_frame_address - must be modified to current frame */ + /* In the case where we just stepped out of a function into the + middle of a line of the caller, continue stepping, but + step_frame_id must be modified to current frame */ { - CORE_ADDR current_frame = get_frame_base (get_current_frame ()); - if (!(INNER_THAN (current_frame, step_frame_address))) - step_frame_address = current_frame; + struct frame_id current_frame = get_frame_id (get_current_frame ()); + if (!(frame_id_inner (current_frame, step_frame_id))) + step_frame_id = current_frame; } keep_going (ecs); @@ -2971,7 +2970,7 @@ step_into_function (struct execution_control_state *ecs) of the call. 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). */ static void @@ -2987,8 +2986,11 @@ step_over_function (struct execution_control_state *ecs) step_resume_breakpoint = set_momentary_breakpoint (sr_sal, get_current_frame (), bp_step_resume); - if (step_frame_address && !IN_SOLIB_DYNSYM_RESOLVE_CODE (sr_sal.pc)) - step_resume_breakpoint->frame = step_frame_address; + if (frame_id_p (step_frame_id) + && !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) insert_breakpoints (); @@ -3352,8 +3354,12 @@ normal_stop (void) switch (bpstat_ret) { 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 - && 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)) source_flag = SRC_LINE; /* finished step, just print source line */ else @@ -3791,7 +3797,7 @@ struct inferior_status int trap_expected; CORE_ADDR step_range_start; CORE_ADDR step_range_end; - CORE_ADDR step_frame_address; + struct frame_id step_frame_id; enum step_over_calls_kind step_over_calls; CORE_ADDR step_resume_break_address; int stop_after_trap; @@ -3838,7 +3844,7 @@ save_inferior_status (int restore_stack_info) inf_status->trap_expected = trap_expected; inf_status->step_range_start = step_range_start; 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->stop_after_trap = stop_after_trap; inf_status->stop_soon_quietly = stop_soon_quietly; @@ -3868,8 +3874,8 @@ restore_selected_frame (void *args) frame = frame_find_by_id (*fid); - /* If inf_status->selected_frame_address is NULL, there was no - previously selected frame. */ + /* If inf_status->selected_frame_id is NULL, there was no previously + selected frame. */ if (frame == NULL) { 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; step_range_start = inf_status->step_range_start; 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; stop_after_trap = inf_status->stop_after_trap; stop_soon_quietly = inf_status->stop_soon_quietly; diff --git a/gdb/thread.c b/gdb/thread.c index 06503e1c60..f2ed52a811 100644 --- a/gdb/thread.c +++ b/gdb/thread.c @@ -296,7 +296,7 @@ load_infrun_state (ptid_t ptid, struct breakpoint **through_sigtramp_breakpoint, CORE_ADDR *step_range_start, CORE_ADDR *step_range_end, - CORE_ADDR *step_frame_address, + struct frame_id *step_frame_id, int *handling_longjmp, int *another_trap, int *stepping_through_solib_after_catch, @@ -322,7 +322,7 @@ load_infrun_state (ptid_t ptid, *through_sigtramp_breakpoint = tp->through_sigtramp_breakpoint; *step_range_start = tp->step_range_start; *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; *another_trap = tp->another_trap; *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, CORE_ADDR step_range_start, CORE_ADDR step_range_end, - CORE_ADDR step_frame_address, + const struct frame_id *step_frame_id, int handling_longjmp, int another_trap, int stepping_through_solib_after_catch, @@ -371,7 +371,7 @@ save_infrun_state (ptid_t ptid, tp->through_sigtramp_breakpoint = through_sigtramp_breakpoint; tp->step_range_start = step_range_start; 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->another_trap = another_trap; tp->stepping_through_solib_after_catch = stepping_through_solib_after_catch; -- 2.34.1