aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2015-03-24 17:50:31 +0000
committerPedro Alves <palves@redhat.com>2015-03-24 17:50:31 +0000
commit856e7dd6986d26b251d91b7fcd10c08fb57dc73b (patch)
tree3d37e0c30c36f0bf4212180739d83732adf86f12 /gdb/testsuite
parent885eeb5b8ea021cc79ffebe8ec40122229c572f0 (diff)
downloadgdb-856e7dd6986d26b251d91b7fcd10c08fb57dc73b.zip
gdb-856e7dd6986d26b251d91b7fcd10c08fb57dc73b.tar.gz
gdb-856e7dd6986d26b251d91b7fcd10c08fb57dc73b.tar.bz2
Make "set scheduler-locking step" depend on user intention, only
Currently, "set scheduler-locking step" is a bit odd. The manual documents it as being optimized for stepping, so that focus of debugging does not change unexpectedly, but then it says that sometimes other threads may run, and thus focus may indeed change unexpectedly... A user can then be excused to get confused and wonder why does GDB behave like this. I don't think a user should have to know about details of how "next" or whatever other run control command is implemented internally to understand when does the "scheduler-locking step" setting take effect. This patch completes a transition that the code has been moving towards for a while. It makes "set scheduler-locking step" hold threads depending on whether the _command_ the user entered was a stepping command [step/stepi/next/nexti], or not. Before, GDB could end up locking threads even on "continue" if for some reason run control decides a thread needs to be single stepped (e.g., for a software watchpoint). After, if a "continue" happens to need to single-step for some reason, we won't lock threads (unless when stepping over a breakpoint, naturally). And if a stepping command wants to continue a thread for bit, like when skipping a function to a step-resume breakpoint, we'll still lock threads, so focus of debugging doesn't change. In order to make this work, we need to record in the thread structure whether what set it running was a stepping command. (A follow up patch will remove the "step" parameters of 'proceed' and 'resume') FWIW, Fedora GDB, which defaults to "scheduler-locking step" (mainline defaults to "off") carries a different patch that goes in this direction as well. Tested on x86_64 Fedora 20, native and gdbserver. gdb/ChangeLog: 2015-03-24 Pedro Alves <palves@redhat.com> * gdbthread.h (struct thread_control_state) <stepping_command>: New field. * infcmd.c (step_once): Pass step=1 to clear_proceed_status. Set the thread's stepping_command field. * infrun.c (resume): Check the thread's stepping_command flag to determine which threads should be resumed. Rename 'entry_step' local to user_step. (clear_proceed_status_thread): Clear 'stepping_command'. (schedlock_applies): Change parameter type to struct thread_info pointer. Adjust. (find_thread_needs_step_over): Remove 'step' parameter. Adjust. (switch_back_to_stepped_thread): Adjust calls to 'schedlock_applies'. (_initialize_infrun): Adjust "set scheduler-locking step" help. gdb/testsuite/ChangeLog: 2015-03-24 Pedro Alves <palves@redhat.com> * gdb.threads/schedlock.exp (test_step): No longer expect that "set scheduler-locking step" with "next" over a function call runs threads unlocked. gdb/doc/ChangeLog: 2015-03-24 Pedro Alves <palves@redhat.com> * gdb.texinfo (test_step) <set scheduler-locking step>: No longer mention that threads may sometimes run unlocked.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/ChangeLog6
-rw-r--r--gdb/testsuite/gdb.threads/schedlock.exp11
2 files changed, 11 insertions, 6 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 1286542..824d6fc 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2015-03-24 Pedro Alves <palves@redhat.com>
+
+ * gdb.threads/schedlock.exp (test_step): No longer expect that
+ "set scheduler-locking step" with "next" over a function call runs
+ threads unlocked.
+
2015-03-24 Antoine Tremblay <antoine.tremblay@ericsson.com>
* gdb.mi/mi-pending.exp: Fix output of breakpoint test.
diff --git a/gdb/testsuite/gdb.threads/schedlock.exp b/gdb/testsuite/gdb.threads/schedlock.exp
index b47af77..54e847e 100644
--- a/gdb/testsuite/gdb.threads/schedlock.exp
+++ b/gdb/testsuite/gdb.threads/schedlock.exp
@@ -285,8 +285,7 @@ proc test_step { schedlock cmd call_function } {
step_ten_loops $cmd
- # "next" lets other threads run while stepping over functions.
- if { $schedlock == "on" || ($schedlock == "step" && !$call_function) } {
+ if { $schedlock == "on" || $schedlock == "step" } {
set locked 1
} else {
set locked 0
@@ -302,10 +301,10 @@ foreach schedlock {"off" "step" "on"} {
test_step $schedlock "step" 0
}
with_test_prefix "cmd=next" {
- # With "next", and schedlock "step", threads run unlocked
- # when stepping over a function call. This exercises both
- # with and without a function call. Without a function
- # call "next" should behave just like "step".
+ # In GDB <= 7.9, with schedlock "step", "next" would
+ # unlock threads when stepping over a function call. This
+ # exercises "next" with and without a function call. WRT
+ # "schedlock step", "next" should behave just like "step".
foreach call_function {0 1} {
with_test_prefix "call_function=$call_function" {
test_step $schedlock "next" $call_function