@@ -1084,12 +1084,10 @@ enum class resume_state
1084
1084
RESUMED ,
1085
1085
};
1086
1086
1087
- /* Information about a thread's pending vCont-resume. Used when a thread is in
1088
- the remote_resume_state::RESUMED_PENDING_VCONT state. remote_target::resume
1089
- stores this information which is then picked up by
1090
- remote_target::commit_resume to know which is the proper action for this
1091
- thread to include in the vCont packet. */
1092
- struct resumed_pending_vcont_info
1087
+ /* Information about a thread's resume state. Used when a thread is
1088
+ in the resume_state::RESUMED_PENDING_VCONT or resume_state::RESUMED
1089
+ states. */
1090
+ struct resume_info
1093
1091
{
1094
1092
/* True if the last resume call for this thread was a step request, false
1095
1093
if a continue request. */
@@ -1133,45 +1131,54 @@ struct remote_thread_info : public private_thread_info
1133
1131
void set_resumed_pending_vcont (bool step , gdb_signal sig )
1134
1132
{
1135
1133
m_resume_state = resume_state ::RESUMED_PENDING_VCONT ;
1136
- m_resumed_pending_vcont_info .step = step ;
1137
- m_resumed_pending_vcont_info .sig = sig ;
1138
- }
1139
-
1140
- /* Get the information this thread's pending vCont-resumption.
1141
-
1142
- Must only be called if the thread is in the RESUMED_PENDING_VCONT resume
1143
- state. */
1144
- const struct resumed_pending_vcont_info & resumed_pending_vcont_info () const
1145
- {
1146
- gdb_assert (m_resume_state == resume_state ::RESUMED_PENDING_VCONT );
1147
-
1148
- return m_resumed_pending_vcont_info ;
1134
+ m_resume_info .step = step ;
1135
+ m_resume_info .sig = sig ;
1149
1136
}
1150
1137
1151
1138
/* Put the thread in the VCONT_RESUMED state. */
1152
- void set_resumed ()
1139
+ void set_resumed (bool step , gdb_signal sig )
1153
1140
{
1154
1141
m_resume_state = resume_state ::RESUMED ;
1142
+ m_resume_info .step = step ;
1143
+ m_resume_info .sig = sig ;
1155
1144
}
1156
1145
1157
- private :
1158
- /* Resume state for this thread. This is used to implement vCont action
1159
- coalescing (only when the target operates in non-stop mode).
1146
+ /* Get the information this thread's pending vCont-resumption.
1160
1147
1161
- remote_target::resume moves the thread to the RESUMED_PENDING_VCONT state,
1162
- which notes that this thread must be considered in the next commit_resume
1163
- call.
1148
+ Must only be called if the thread is in the RESUMED_PENDING_VCONT
1149
+ or RESUMED states. */
1150
+ const struct resume_info & resume_info () const
1151
+ {
1152
+ gdb_assert (m_resume_state == resume_state ::RESUMED_PENDING_VCONT
1153
+ || m_resume_state == resume_state ::RESUMED );
1164
1154
1165
- remote_target::commit_resume sends a vCont packet with actions for the
1166
- threads in the RESUMED_PENDING_VCONT state and moves them to the
1167
- VCONT_RESUMED state.
1155
+ return m_resume_info ;
1156
+ }
1168
1157
1169
- When reporting a stop to the core for a thread, that thread is moved back
1170
- to the NOT_RESUMED state. */
1158
+ private :
1159
+ /* Resume state for this thread. This is used to implement vCont
1160
+ action coalescing (only when the target operates in non-stop
1161
+ mode), and also generally be able to retrieve the last resume
1162
+ action on a given thread.
1163
+
1164
+ In non-stop mode, remote_target::resume moves the thread to the
1165
+ RESUMED_PENDING_VCONT state, which notes that this thread must be
1166
+ considered in the next commit_resume call. In all-stop,
1167
+ remote_target::resume resumes the thread immediately and moves it
1168
+ to the RESUMED state.
1169
+
1170
+ In non-stop mode, remote_target::commit_resume sends a vCont
1171
+ packet with actions for the threads in the RESUMED_PENDING_VCONT
1172
+ state and moves them to the VCONT_RESUMED state.
1173
+ remote_target::commit_resume is a no-op in all-stop mode.
1174
+
1175
+ When reporting a stop to the core for a thread, that thread is
1176
+ moved back to the NOT_RESUMED state. */
1171
1177
enum resume_state m_resume_state = resume_state ::NOT_RESUMED ;
1172
1178
1173
- /* Extra info used if the thread is in the RESUMED_PENDING_VCONT state. */
1174
- struct resumed_pending_vcont_info m_resumed_pending_vcont_info ;
1179
+ /* Extra info used if the thread is in the RESUMED_PENDING_VCONT or
1180
+ RESUMED state. */
1181
+ struct resume_info m_resume_info ;
1175
1182
};
1176
1183
1177
1184
remote_state ::remote_state ()
@@ -2548,7 +2555,7 @@ remote_target::remote_add_thread (ptid_t ptid, bool running, bool executing)
2548
2555
2549
2556
/* We start by assuming threads are resumed. That state then gets updated
2550
2557
when we process a matching stop reply. */
2551
- get_remote_thread_info (thread )-> set_resumed ();
2558
+ get_remote_thread_info (thread )-> set_resumed (false, GDB_SIGNAL_0 );
2552
2559
2553
2560
set_executing (this , ptid , executing );
2554
2561
set_running (this , ptid , running );
@@ -4835,7 +4842,7 @@ remote_target::start_remote (int from_tty, int extended_p)
4835
4842
non-threaded target as single-threaded; add a main
4836
4843
thread. */
4837
4844
thread_info * tp = add_current_inferior_and_thread (wait_status );
4838
- get_remote_thread_info (tp )-> set_resumed ();
4845
+ get_remote_thread_info (tp )-> set_resumed (false, GDB_SIGNAL_0 );
4839
4846
}
4840
4847
else
4841
4848
{
@@ -6426,6 +6433,13 @@ remote_target::resume (ptid_t ptid, int step, enum gdb_signal siggnal)
6426
6433
{
6427
6434
struct remote_state * rs = get_remote_state ();
6428
6435
6436
+ remote_thread_info * remote_thr ;
6437
+
6438
+ if (minus_one_ptid == ptid || ptid .is_pid ())
6439
+ remote_thr = get_remote_thread_info (this , inferior_ptid );
6440
+ else
6441
+ remote_thr = get_remote_thread_info (this , ptid );
6442
+
6429
6443
/* When connected in non-stop mode, the core resumes threads
6430
6444
individually. Resuming remote threads directly in target_resume
6431
6445
would thus result in sending one packet per thread. Instead, to
@@ -6435,13 +6449,6 @@ remote_target::resume (ptid_t ptid, int step, enum gdb_signal siggnal)
6435
6449
able to do vCont action coalescing. */
6436
6450
if (target_is_non_stop_p () && ::execution_direction != EXEC_REVERSE )
6437
6451
{
6438
- remote_thread_info * remote_thr ;
6439
-
6440
- if (minus_one_ptid == ptid || ptid .is_pid ())
6441
- remote_thr = get_remote_thread_info (this , inferior_ptid );
6442
- else
6443
- remote_thr = get_remote_thread_info (this , ptid );
6444
-
6445
6452
/* We don't expect the core to ask to resume an already resumed (from
6446
6453
its point of view) thread. */
6447
6454
gdb_assert (remote_thr -> get_resume_state () == resume_state ::NOT_RESUMED );
@@ -6467,7 +6474,8 @@ remote_target::resume (ptid_t ptid, int step, enum gdb_signal siggnal)
6467
6474
6468
6475
/* Update resumed state tracked by the remote target. */
6469
6476
for (thread_info * tp : all_non_exited_threads (this , ptid ))
6470
- get_remote_thread_info (tp )-> set_resumed ();
6477
+ get_remote_thread_info (tp )-> set_resumed (false, GDB_SIGNAL_0 );
6478
+ remote_thr -> set_resumed (step , siggnal );
6471
6479
6472
6480
/* We are about to start executing the inferior, let's register it
6473
6481
with the event loop. NOTE: this is the one place where all the
@@ -6777,16 +6785,15 @@ remote_target::commit_resumed ()
6777
6785
for (const auto & stop_reply : rs -> stop_reply_queue )
6778
6786
gdb_assert (stop_reply -> ptid != tp -> ptid );
6779
6787
6780
- const resumed_pending_vcont_info & info
6781
- = remote_thr -> resumed_pending_vcont_info ();
6788
+ const resume_info & info = remote_thr -> resume_info ();
6782
6789
6783
6790
/* Check if we need to send a specific action for this thread. If not,
6784
6791
it will be included in a wildcard resume instead. */
6785
6792
if (info .step || info .sig != GDB_SIGNAL_0
6786
6793
|| !get_remote_inferior (tp -> inf )-> may_wildcard_vcont )
6787
6794
vcont_builder .push_action (tp -> ptid , info .step , info .sig );
6788
6795
6789
- remote_thr -> set_resumed ();
6796
+ remote_thr -> set_resumed (info . step , info . sig );
6790
6797
}
6791
6798
6792
6799
/* Now check whether we can send any process-wide wildcard. This is
@@ -6874,8 +6881,7 @@ remote_target::remote_stop_ns (ptid_t ptid)
6874
6881
if (remote_thr -> get_resume_state ()
6875
6882
== resume_state ::RESUMED_PENDING_VCONT )
6876
6883
{
6877
- const resumed_pending_vcont_info & info
6878
- = remote_thr -> resumed_pending_vcont_info ();
6884
+ const resume_info & info = remote_thr -> resume_info ();
6879
6885
if (info .sig != GDB_SIGNAL_0 )
6880
6886
{
6881
6887
/* This signal must be forwarded to the inferior. We
@@ -6904,8 +6910,7 @@ remote_target::remote_stop_ns (ptid_t ptid)
6904
6910
/* Check that the thread wasn't resumed with a signal.
6905
6911
Generating a phony stop would result in losing the
6906
6912
signal. */
6907
- const resumed_pending_vcont_info & info
6908
- = remote_thr -> resumed_pending_vcont_info ();
6913
+ const resume_info & info = remote_thr -> resume_info ();
6909
6914
gdb_assert (info .sig == GDB_SIGNAL_0 );
6910
6915
6911
6916
stop_reply * sr = new stop_reply ();
@@ -6926,7 +6931,7 @@ remote_target::remote_stop_ns (ptid_t ptid)
6926
6931
queue, we'll end up reporting a stop event to the core
6927
6932
for that thread while it is running on the remote
6928
6933
target... that would be bad. */
6929
- remote_thr -> set_resumed ();
6934
+ remote_thr -> set_resumed (false, GDB_SIGNAL_0 );
6930
6935
}
6931
6936
}
6932
6937
0 commit comments