[v2,1/6] gdb: use schedlock_applies in user_visible_resume_ptid.
Checks
Context |
Check |
Description |
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 |
success
|
Build passed
|
linaro-tcwg-bot/tcwg_gdb_build--master-arm |
success
|
Build passed
|
linaro-tcwg-bot/tcwg_gdb_check--master-arm |
success
|
Test passed
|
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 |
success
|
Test passed
|
Commit Message
This is a refactoring. The logic in user_visible_resume_ptid is very
similar to schedlock_applies, but uses `step` parameter instead of
`tp->control.stepping_command`.
Refactor schedlock_applies logic into the following two overloaded methods:
bool schedlock_applies (thread_info *tp)
and
bool schedlock_applies (bool step)
such that they share the logic.
Update the call-sites accordingly, where we have only the thread, use
the former, and where we have the bool step, use the latter.
---
gdb/infrun.c | 29 +++++++++++++++--------------
1 file changed, 15 insertions(+), 14 deletions(-)
@@ -107,7 +107,8 @@ static bool start_step_over (void);
static bool step_over_info_valid_p (void);
-static bool schedlock_applies (struct thread_info *tp);
+static bool schedlock_applies (thread_info *tp);
+static bool schedlock_applies (bool step);
/* Asynchronous signal handler registered as event loop source for
when we have pending events ready to be passed to the core. */
@@ -2392,20 +2393,12 @@ user_visible_resume_ptid (int step)
individually. */
resume_ptid = inferior_ptid;
}
- else if ((scheduler_mode == schedlock_on)
- || (scheduler_mode == schedlock_step && step))
+ else if (schedlock_applies (step))
{
/* User-settable 'scheduler' mode requires solo thread
resume. */
resume_ptid = inferior_ptid;
}
- else if ((scheduler_mode == schedlock_replay)
- && target_record_will_replay (minus_one_ptid, execution_direction))
- {
- /* User-settable 'scheduler' mode requires solo thread resume in replay
- mode. */
- resume_ptid = inferior_ptid;
- }
else if (inferior_ptid != null_ptid
&& inferior_thread ()->control.in_cond_eval)
{
@@ -3195,15 +3188,23 @@ thread_still_needs_step_over (struct thread_info *tp)
return what;
}
+/* Returns true if scheduler locking applies to TP. */
+
+static bool
+schedlock_applies (thread_info *tp)
+{
+ bool step = (tp != nullptr) && tp->control.stepping_command;
+ return schedlock_applies (step);
+}
+
/* Returns true if scheduler locking applies. STEP indicates whether
- we're about to do a step/next-like command to a thread. */
+ we're about to do a step/next-like command. */
static bool
-schedlock_applies (struct thread_info *tp)
+schedlock_applies (bool step)
{
return (scheduler_mode == schedlock_on
- || (scheduler_mode == schedlock_step
- && tp->control.stepping_command)
+ || (scheduler_mode == schedlock_step && step)
|| (scheduler_mode == schedlock_replay
&& target_record_will_replay (minus_one_ptid,
execution_direction)));