Skip to content

Commit 6634365

Browse files
committed
Fix restart command
We weren't flushing the write data including the Ok response to the disconnect command on write. For some reason this still fails on the *second* restart because CodeLLDB sends a kill command, but that was always the case and is maybe a CodeLLDB bug.
1 parent 7ddd28e commit 6634365

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/main.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,18 @@ async fn main_gdb<A: RiscvArch>(args: Args, elf: Vec<u8>, send_time: Sender<u64>
146146
gdb.incoming_data(&mut machine, byte)?
147147
}
148148

149-
state_machine::GdbStubStateMachine::Disconnected(gdb) => {
149+
state_machine::GdbStubStateMachine::Disconnected(mut gdb) => {
150+
// Flush any data to be sent.
151+
gdb.borrow_conn().flush(&mut socket).await?;
152+
150153
// We're going to restart the whole process on disconnection.
151154
break Ok(gdb.get_reason());
152155
}
153156

154-
state_machine::GdbStubStateMachine::CtrlCInterrupt(gdb) => {
157+
state_machine::GdbStubStateMachine::CtrlCInterrupt(mut gdb) => {
158+
// Flush any data to be sent.
159+
gdb.borrow_conn().flush(&mut socket).await?;
160+
155161
// Stop on Ctrl-C.
156162
let stop_reason = Some(SingleThreadStopReason::Signal(Signal::SIGINT));
157163
gdb.interrupt_handled(&mut machine, stop_reason)?

0 commit comments

Comments
 (0)