debugger: Fix gdb adapter and logger (#28280)

There were two bugs that caused the gdb adapter not to work properly,
one on our end and one their end.

The bug on our end was sending `stopOnEntry: null` in our launch request
when stop on entry had no value. I fixed that bug across all dap
adapters

The other bug had to do with python's "great" type system and how we
serialized our unit structs to json; mainly,
`ConfigurationDoneArguments` and `ThreadsArguments`. Gdb seems to follow
a pattern for handling requests where they pass `**args` to a function,
this errors out when the equivalent json is `"arguments": null`.

```py
@capability("supportsConfigurationDoneRequest")
@request("configurationDone", on_dap_thread=True)
def config_done(**args): ### BUG!!
    ...
```

Release Notes:

- N/A
This commit is contained in:
Anthony Eid 2025-04-07 18:02:13 -04:00 committed by GitHub
parent 56ed5dcc89
commit 862d0c07ca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 120 additions and 64 deletions

View file

@ -185,7 +185,7 @@ impl DebugPanel {
) -> Vec<Entity<DebugSession>> {
self.sessions
.iter()
.filter(|item| item.read(cx).session_id(cx) == Some(*client_id))
.filter(|item| item.read(cx).session_id(cx) == *client_id)
.map(|item| item.clone())
.collect()
}
@ -200,7 +200,7 @@ impl DebugPanel {
.find(|item| {
let item = item.read(cx);
item.session_id(cx) == Some(client_id)
item.session_id(cx) == client_id
})
.cloned()
}
@ -227,7 +227,7 @@ impl DebugPanel {
if self
.sessions
.iter()
.any(|item| item.read(cx).session_id(cx) == Some(*session_id))
.any(|item| item.read(cx).session_id(cx) == *session_id)
{
// We already have an item for this session.
return;

View file

@ -75,9 +75,9 @@ impl DebugSession {
})
}
pub(crate) fn session_id(&self, cx: &App) -> Option<SessionId> {
pub(crate) fn session_id(&self, cx: &App) -> SessionId {
match &self.mode {
DebugSessionState::Running(entity) => Some(entity.read(cx).session_id()),
DebugSessionState::Running(entity) => entity.read(cx).session_id(),
}
}

View file

@ -270,7 +270,7 @@ async fn test_we_can_only_have_one_panel_per_debug_session(
.clone()
});
assert_eq!(client.id(), active_session.read(cx).session_id(cx).unwrap());
assert_eq!(client.id(), active_session.read(cx).session_id(cx));
assert_eq!(
ThreadId(1),
running_state.read(cx).selected_thread_id().unwrap()
@ -307,7 +307,7 @@ async fn test_we_can_only_have_one_panel_per_debug_session(
.clone()
});
assert_eq!(client.id(), active_session.read(cx).session_id(cx).unwrap());
assert_eq!(client.id(), active_session.read(cx).session_id(cx));
assert_eq!(
ThreadId(1),
running_state.read(cx).selected_thread_id().unwrap()