Skip to content

Commit 4e5290f

Browse files
committed
fix: fix test and log errors from handle_message/read method in DAP loop
1 parent ffaee67 commit 4e5290f

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

src/db-backend/src/dap.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,7 @@ pub fn read_dap_message_from_reader<R: std::io::BufRead>(reader: &mut R) -> DapR
379379
error!("Read Line: {:?}", e);
380380
serde_json::Error::custom(e.to_string())
381381
})?;
382+
info!("line read");
382383
if !header.to_ascii_lowercase().starts_with("content-length:") {
383384
// println!("no content-length!");
384385
return Err(serde_json::Error::custom("Missing Content-Length header").into());

src/db-backend/src/dap_server.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -446,10 +446,21 @@ fn handle_client<R: std::io::BufRead, T: DapTransport>(
446446

447447
let mut ctx = Ctx::default();
448448

449-
while let Ok(msg) = dap::read_dap_message_from_reader(reader) {
450-
let _ = handle_message(&msg, transport, &mut ctx);
449+
loop {
450+
match dap::read_dap_message_from_reader(reader) {
451+
Ok(msg) => {
452+
let res = handle_message(&msg, transport, &mut ctx);
453+
if let Err(e) = res {
454+
error!("handle_message error: {e:?}");
455+
}
456+
},
457+
Err(e) => {
458+
error!("error from read_dap_message_from_reader: {e:?}");
459+
break;
460+
}
461+
}
451462
}
452463

453-
error!("maybe error from reader");
464+
454465
Ok(())
455466
}

src/db-backend/src/handler.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1654,7 +1654,7 @@ mod tests {
16541654

16551655
// Assert: Check that the Handler instance is correctly initialized
16561656
assert_eq!(handler.step_id, StepId(0));
1657-
assert!(!handler.breakpoint_list.is_empty());
1657+
assert!(!handler.breakpoints.is_empty());
16581658
}
16591659

16601660
// Test single tracepoint

0 commit comments

Comments
 (0)