From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jonathan Larmour To: gdb-patches@sources.redhat.com Subject: generic_prepare_to_proceed vs. Ctrl-C Date: Tue, 22 May 2001 15:24:00 -0000 Message-id: <3B0AE715.17823A37@redhat.com> X-SW-Source: 2001-05/msg00419.html David S's recently added generic_prepare_to_proceed() only takes account of stopping at a breakpoint and switching threads. It does not deal with stopping due to a Ctrl-C and switching threads. The below patch fixes this. Okay to check in? 2001-05-22 Jonathan Larmour * arch-utils.c (generic_prepare_to_proceed): Allow for having stopped due to a Ctrl-C as well as breakpoints. Jifl Index: arch-utils.c =================================================================== RCS file: /cvs/src/src/gdb/arch-utils.c,v retrieving revision 1.27 diff -u -5 -p -r1.27 arch-utils.c --- arch-utils.c 2001/05/10 18:36:26 1.27 +++ arch-utils.c 2001/05/22 22:19:29 @@ -256,26 +256,26 @@ generic_prepare_to_proceed (int select_i struct target_waitstatus wait_status; /* Get the last target status returned by target_wait(). */ get_last_target_status (&wait_ptid, &wait_status); - /* Make sure we were stopped at a breakpoint. */ + /* Make sure we were stopped either at a breakpoint, or because + of a Ctrl-C. */ if (wait_status.kind != TARGET_WAITKIND_STOPPED - || wait_status.value.sig != TARGET_SIGNAL_TRAP) + || (wait_status.value.sig != TARGET_SIGNAL_TRAP && + wait_status.value.sig != TARGET_SIGNAL_INT)) { return 0; } if (!ptid_equal (wait_ptid, minus_one_ptid) && !ptid_equal (inferior_ptid, wait_ptid)) { /* Switched over from WAIT_PID. */ CORE_ADDR wait_pc = read_pc_pid (wait_ptid); - /* Avoid switching where it wouldn't do any good, i.e. if both - threads are at the same breakpoint. */ - if (wait_pc != read_pc () && breakpoint_here_p (wait_pc)) + if (wait_pc != read_pc ()) { if (select_it) { /* User hasn't deleted the breakpoint. Switch back to WAIT_PID and return non-zero. */ @@ -286,12 +286,15 @@ generic_prepare_to_proceed (int select_i flush_cached_frames (); registers_changed (); stop_pc = wait_pc; select_frame (get_current_frame (), 0); } - - return 1; + /* Step over the breakpoint if there is one here. */ + if (breakpoint_here_p (wait_pc)) + { + return 1; + } } } return 0; } -- Red Hat, Rustat House, Clifton Road, Cambridge, UK. Tel: +44 (1223) 271062 Maybe this world is another planet's Hell -Aldous Huxley || Opinions==mine