@@ -127,9 +127,18 @@ pub fn event_loop(reason: KCoreStopReason) -> Result<(), KError> {
127
127
}
128
128
GdbStubStateMachine :: CtrlCInterrupt ( gdb_stm_inner) => {
129
129
trace ! ( "GdbStubStateMachine::CtrlCInterrupt" ) ;
130
- let reason = stop_reason. take ( ) ;
131
- assert_eq ! ( reason, Some ( ThreadStopReason :: Signal ( Signal :: SIGINT ) ) ) ;
132
- match gdb_stm_inner. interrupt_handled ( target, reason) {
130
+ let _reason = stop_reason. take ( ) ;
131
+ // Ideally, this would hole: assert_eq!(reason,
132
+ // Some(ThreadStopReason::Signal(Signal::SIGINT)));
133
+ //
134
+ // But, turns out `reason` can be `StepDone` too if we are
135
+ // single-stepping through things and the ctrl+c packet arrives
136
+ // while we're in this file.
137
+ //
138
+ // So we just consume `reason` and report SIGINT unconditionally.
139
+ match gdb_stm_inner
140
+ . interrupt_handled ( target, Some ( ThreadStopReason :: Signal ( Signal :: SIGINT ) ) )
141
+ {
133
142
Ok ( gdb) => gdb,
134
143
Err ( e) => {
135
144
error ! ( "gdbstub error {:?}" , e) ;
@@ -152,6 +161,8 @@ pub fn event_loop(reason: KCoreStopReason) -> Result<(), KError> {
152
161
let data_to_read = conn. peek ( ) . unwrap ( ) . is_some ( ) ;
153
162
154
163
if data_to_read {
164
+ trace ! ( "GdbStubStateMachine::Running data_to_read" ) ;
165
+
155
166
let byte = gdb_stm_inner. borrow_conn ( ) . read ( ) . unwrap ( ) ;
156
167
match gdb_stm_inner. incoming_data ( target, byte) {
157
168
Ok ( pumped_stm) => pumped_stm,
@@ -165,6 +176,8 @@ pub fn event_loop(reason: KCoreStopReason) -> Result<(), KError> {
165
176
}
166
177
}
167
178
} else if let Some ( reason) = stop_reason. take ( ) {
179
+ trace ! ( "GdbStubStateMachine::Running stop_reason" ) ;
180
+
168
181
match gdb_stm_inner. report_stop ( target, reason) {
169
182
Ok ( gdb_stm_new) => gdb_stm_new,
170
183
Err ( GdbStubError :: TargetError ( e) ) => {
@@ -177,6 +190,8 @@ pub fn event_loop(reason: KCoreStopReason) -> Result<(), KError> {
177
190
}
178
191
}
179
192
} else if target. resume_with . is_some ( ) {
193
+ trace ! ( "GdbStubStateMachine::Running target.resume_with.is_some" ) ;
194
+
180
195
// We don't have a `stop_reason` and we don't have something
181
196
// to read on the line. This probably means we're done and
182
197
// we should run again.
0 commit comments