diff options
author | Pedro Alves <palves@redhat.com> | 2015-03-24 17:50:31 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2015-03-24 17:50:31 +0000 |
commit | 856e7dd6986d26b251d91b7fcd10c08fb57dc73b (patch) | |
tree | 3d37e0c30c36f0bf4212180739d83732adf86f12 /gdb/doc | |
parent | 885eeb5b8ea021cc79ffebe8ec40122229c572f0 (diff) | |
download | gdb-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/doc')
-rw-r--r-- | gdb/doc/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/doc/gdb.texinfo | 5 |
2 files changed, 7 insertions, 3 deletions
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index b41c5cb..30d5a5b 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,8 @@ +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. + 2015-03-23 Yurij Grechishhev <yurij.grechishhev@gmail.com> * gdb.texinfo (Remote configuration): Document "set/show diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 7117e42..c03ecb0 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -5846,9 +5846,8 @@ current thread may run when the inferior is resumed. The @code{step} mode optimizes for single-stepping; it prevents other threads from preempting the current thread while you are stepping, so that the focus of debugging does not change unexpectedly. -Other threads only rarely (or never) get a chance to run -when you step. They are more likely to run when you @samp{next} over a -function call, and they are completely free to run when you use commands +Other threads never get a chance to run when you step, and they are +completely free to run when you use commands like @samp{continue}, @samp{until}, or @samp{finish}. However, unless another thread hits a breakpoint during its timeslice, @value{GDBN} does not change the current thread away from the thread that you are debugging. |