Debugger: Add stop on entry support to debug adapter configs (#27942)
This PR adds passing in `stop_on_entry` to debug configs in debug.json instead of going through initialization args. This has two benefits: 1. It's more streamlined to a user since every internal adapter supports `stop_on_entry` for launch requests and Go's adapter supports it for attach requests too. 2. It will allow @osiewicz `NewSesssionModal` PR to use this field for the stop on entry checkbox. Release Notes: - N/A
This commit is contained in:
parent
e1a8a31fa4
commit
0ba8432b0b
14 changed files with 25 additions and 2 deletions
|
@ -79,7 +79,7 @@ impl DebugAdapter for GdbDebugAdapter {
|
||||||
json!({"pid": attach_config.process_id})
|
json!({"pid": attach_config.process_id})
|
||||||
}
|
}
|
||||||
dap::DebugRequestType::Launch(launch_config) => {
|
dap::DebugRequestType::Launch(launch_config) => {
|
||||||
json!({"program": launch_config.program, "cwd": launch_config.cwd})
|
json!({"program": launch_config.program, "cwd": launch_config.cwd, "stopOnEntry": config.stop_on_entry})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,12 +86,14 @@ impl DebugAdapter for GoDebugAdapter {
|
||||||
match &config.request {
|
match &config.request {
|
||||||
dap::DebugRequestType::Attach(attach_config) => {
|
dap::DebugRequestType::Attach(attach_config) => {
|
||||||
json!({
|
json!({
|
||||||
"processId": attach_config.process_id
|
"processId": attach_config.process_id,
|
||||||
|
"stopOnEntry": config.stop_on_entry,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
dap::DebugRequestType::Launch(launch_config) => json!({
|
dap::DebugRequestType::Launch(launch_config) => json!({
|
||||||
"program": launch_config.program,
|
"program": launch_config.program,
|
||||||
"cwd": launch_config.cwd,
|
"cwd": launch_config.cwd,
|
||||||
|
"stopOnEntry": config.stop_on_entry,
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,6 +131,7 @@ impl DebugAdapter for JsDebugAdapter {
|
||||||
match &config.request {
|
match &config.request {
|
||||||
DebugRequestType::Attach(attach) => {
|
DebugRequestType::Attach(attach) => {
|
||||||
map.insert("processId".into(), attach.process_id.into());
|
map.insert("processId".into(), attach.process_id.into());
|
||||||
|
map.insert("stopOnEntry".into(), config.stop_on_entry.into());
|
||||||
}
|
}
|
||||||
DebugRequestType::Launch(launch) => {
|
DebugRequestType::Launch(launch) => {
|
||||||
map.insert("program".into(), launch.program.clone().into());
|
map.insert("program".into(), launch.program.clone().into());
|
||||||
|
|
|
@ -78,6 +78,7 @@ impl DebugAdapter for LldbDebugAdapter {
|
||||||
match &config.request {
|
match &config.request {
|
||||||
DebugRequestType::Attach(attach) => {
|
DebugRequestType::Attach(attach) => {
|
||||||
map.insert("pid".into(), attach.process_id.into());
|
map.insert("pid".into(), attach.process_id.into());
|
||||||
|
map.insert("stopOnEntry".into(), config.stop_on_entry.into());
|
||||||
}
|
}
|
||||||
DebugRequestType::Launch(launch) => {
|
DebugRequestType::Launch(launch) => {
|
||||||
map.insert("program".into(), launch.program.clone().into());
|
map.insert("program".into(), launch.program.clone().into());
|
||||||
|
|
|
@ -118,6 +118,7 @@ impl DebugAdapter for PhpDebugAdapter {
|
||||||
json!({
|
json!({
|
||||||
"program": launch_config.program,
|
"program": launch_config.program,
|
||||||
"cwd": launch_config.cwd,
|
"cwd": launch_config.cwd,
|
||||||
|
"stopOnEntry": config.stop_on_entry,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,6 +133,7 @@ impl DebugAdapter for PythonDebugAdapter {
|
||||||
"subProcess": true,
|
"subProcess": true,
|
||||||
"cwd": launch_config.cwd,
|
"cwd": launch_config.cwd,
|
||||||
"redirectOutput": true,
|
"redirectOutput": true,
|
||||||
|
"StopOnEntry": config.stop_on_entry,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
dap::DebugRequestType::Attach(attach_config) => {
|
dap::DebugRequestType::Attach(attach_config) => {
|
||||||
|
|
|
@ -161,6 +161,7 @@ impl Render for InertState {
|
||||||
initialize_args: None,
|
initialize_args: None,
|
||||||
args: Default::default(),
|
args: Default::default(),
|
||||||
locator: None,
|
locator: None,
|
||||||
|
stop_on_entry: None,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -324,6 +325,7 @@ impl InertState {
|
||||||
args: Default::default(),
|
args: Default::default(),
|
||||||
locator: None,
|
locator: None,
|
||||||
tcp_connection: Some(TCPHost::default()),
|
tcp_connection: Some(TCPHost::default()),
|
||||||
|
stop_on_entry: None,
|
||||||
};
|
};
|
||||||
|
|
||||||
let _ = self.workspace.update(cx, |workspace, cx| {
|
let _ = self.workspace.update(cx, |workspace, cx| {
|
||||||
|
|
|
@ -90,6 +90,7 @@ async fn test_show_attach_modal_and_select_process(
|
||||||
initialize_args: None,
|
initialize_args: None,
|
||||||
tcp_connection: Some(TCPHost::default()),
|
tcp_connection: Some(TCPHost::default()),
|
||||||
locator: None,
|
locator: None,
|
||||||
|
stop_on_entry: None,
|
||||||
args: Default::default(),
|
args: Default::default(),
|
||||||
},
|
},
|
||||||
vec![
|
vec![
|
||||||
|
|
|
@ -637,6 +637,7 @@ impl ContextProvider for RustContextProvider {
|
||||||
locator: Some("cargo".into()),
|
locator: Some("cargo".into()),
|
||||||
tcp_connection: None,
|
tcp_connection: None,
|
||||||
initialize_args: None,
|
initialize_args: None,
|
||||||
|
stop_on_entry: None,
|
||||||
}),
|
}),
|
||||||
command: "cargo".into(),
|
command: "cargo".into(),
|
||||||
args: vec![
|
args: vec![
|
||||||
|
@ -737,6 +738,7 @@ impl ContextProvider for RustContextProvider {
|
||||||
initialize_args: None,
|
initialize_args: None,
|
||||||
locator: Some("cargo".into()),
|
locator: Some("cargo".into()),
|
||||||
tcp_connection: None,
|
tcp_connection: None,
|
||||||
|
stop_on_entry: None,
|
||||||
}),
|
}),
|
||||||
args: debug_task_args,
|
args: debug_task_args,
|
||||||
tags: vec!["rust-main".to_owned()],
|
tags: vec!["rust-main".to_owned()],
|
||||||
|
|
|
@ -472,6 +472,7 @@ impl DapStore {
|
||||||
tcp_connection: config.tcp_connection.clone(),
|
tcp_connection: config.tcp_connection.clone(),
|
||||||
locator: None,
|
locator: None,
|
||||||
args: Default::default(),
|
args: Default::default(),
|
||||||
|
stop_on_entry: config.stop_on_entry,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(any(test, feature = "test-support"))]
|
#[cfg(any(test, feature = "test-support"))]
|
||||||
|
|
|
@ -1490,6 +1490,7 @@ impl Project {
|
||||||
tcp_connection: None,
|
tcp_connection: None,
|
||||||
locator: None,
|
locator: None,
|
||||||
args: Default::default(),
|
args: Default::default(),
|
||||||
|
stop_on_entry: None,
|
||||||
};
|
};
|
||||||
let caps = caps.unwrap_or(Capabilities {
|
let caps = caps.unwrap_or(Capabilities {
|
||||||
supports_step_back: Some(false),
|
supports_step_back: Some(false),
|
||||||
|
|
|
@ -106,6 +106,8 @@ pub struct DebugAdapterConfig {
|
||||||
pub locator: Option<String>,
|
pub locator: Option<String>,
|
||||||
/// Args to pass to a debug adapter (only used in locator right now)
|
/// Args to pass to a debug adapter (only used in locator right now)
|
||||||
pub args: Vec<String>,
|
pub args: Vec<String>,
|
||||||
|
/// Whether to tell the debug adapter to stop on entry
|
||||||
|
pub stop_on_entry: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<DebugTaskDefinition> for DebugAdapterConfig {
|
impl From<DebugTaskDefinition> for DebugAdapterConfig {
|
||||||
|
@ -118,6 +120,7 @@ impl From<DebugTaskDefinition> for DebugAdapterConfig {
|
||||||
tcp_connection: def.tcp_connection,
|
tcp_connection: def.tcp_connection,
|
||||||
locator: def.locator,
|
locator: def.locator,
|
||||||
args: def.args,
|
args: def.args,
|
||||||
|
stop_on_entry: def.stop_on_entry,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -138,6 +141,7 @@ impl TryFrom<DebugAdapterConfig> for DebugTaskDefinition {
|
||||||
tcp_connection: def.tcp_connection,
|
tcp_connection: def.tcp_connection,
|
||||||
locator: def.locator,
|
locator: def.locator,
|
||||||
args: def.args,
|
args: def.args,
|
||||||
|
stop_on_entry: def.stop_on_entry,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -166,6 +170,7 @@ impl DebugTaskDefinition {
|
||||||
initialize_args: self.initialize_args,
|
initialize_args: self.initialize_args,
|
||||||
locator: self.locator,
|
locator: self.locator,
|
||||||
tcp_connection: self.tcp_connection,
|
tcp_connection: self.tcp_connection,
|
||||||
|
stop_on_entry: self.stop_on_entry,
|
||||||
});
|
});
|
||||||
|
|
||||||
let label = self.label.clone();
|
let label = self.label.clone();
|
||||||
|
@ -215,6 +220,8 @@ pub struct DebugTaskDefinition {
|
||||||
/// Args to pass to a debug adapter (only used in locator right now)
|
/// Args to pass to a debug adapter (only used in locator right now)
|
||||||
#[serde(skip)]
|
#[serde(skip)]
|
||||||
pub args: Vec<String>,
|
pub args: Vec<String>,
|
||||||
|
/// Whether to tell the debug adapter to stop on entry
|
||||||
|
pub stop_on_entry: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A group of Debug Tasks defined in a JSON file.
|
/// A group of Debug Tasks defined in a JSON file.
|
||||||
|
|
|
@ -144,6 +144,7 @@ impl ResolvedTask {
|
||||||
tcp_connection: debug_args.tcp_connection,
|
tcp_connection: debug_args.tcp_connection,
|
||||||
args,
|
args,
|
||||||
locator: debug_args.locator.clone(),
|
locator: debug_args.locator.clone(),
|
||||||
|
stop_on_entry: debug_args.stop_on_entry,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
_ => None,
|
_ => None,
|
||||||
|
|
|
@ -97,6 +97,8 @@ pub struct DebugArgs {
|
||||||
pub initialize_args: Option<serde_json::value::Value>,
|
pub initialize_args: Option<serde_json::value::Value>,
|
||||||
/// the locator to use
|
/// the locator to use
|
||||||
pub locator: Option<String>,
|
pub locator: Option<String>,
|
||||||
|
/// Whether to tell the debug adapter to stop on entry
|
||||||
|
pub stop_on_entry: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Represents the type of task that is being ran
|
/// Represents the type of task that is being ran
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue