debugger: Remove LLDB adapter, switch Rust tasks to CodeLLDB (#28773)

Closes #ISSUE

Release Notes:

- N/A
This commit is contained in:
Piotr Osiewicz 2025-04-15 17:29:43 +02:00 committed by GitHub
parent aef78dcffd
commit ccf9aef767
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 2 additions and 110 deletions

View File

@ -2,7 +2,6 @@ mod codelldb;
mod gdb;
mod go;
mod javascript;
mod lldb;
mod php;
mod python;
@ -21,7 +20,6 @@ use dap::{
use gdb::GdbDebugAdapter;
use go::GoDebugAdapter;
use javascript::JsDebugAdapter;
use lldb::LldbDebugAdapter;
use php::PhpDebugAdapter;
use python::PythonDebugAdapter;
use serde_json::{Value, json};
@ -32,7 +30,6 @@ pub fn init(registry: Arc<DapRegistry>) {
registry.add_adapter(Arc::from(PythonDebugAdapter));
registry.add_adapter(Arc::from(PhpDebugAdapter));
registry.add_adapter(Arc::from(JsDebugAdapter));
registry.add_adapter(Arc::from(LldbDebugAdapter));
registry.add_adapter(Arc::from(GoDebugAdapter));
registry.add_adapter(Arc::from(GdbDebugAdapter));
}

View File

@ -1,105 +0,0 @@
use std::{ffi::OsStr, path::PathBuf};
use anyhow::Result;
use async_trait::async_trait;
use gpui::AsyncApp;
use task::{DebugRequestType, DebugTaskDefinition};
use crate::*;
#[derive(Default)]
pub(crate) struct LldbDebugAdapter;
impl LldbDebugAdapter {
const ADAPTER_NAME: &'static str = "LLDB";
fn request_args(&self, config: &DebugTaskDefinition) -> dap::StartDebuggingRequestArguments {
let request = config.request.to_dap();
let mut args = json!({
"request": match config.request {
DebugRequestType::Launch(_) => "launch",
DebugRequestType::Attach(_) => "attach",
},
});
let map = args.as_object_mut().unwrap();
match &config.request {
DebugRequestType::Attach(attach) => {
map.insert("pid".into(), attach.process_id.into());
}
DebugRequestType::Launch(launch) => {
map.insert("program".into(), launch.program.clone().into());
if !launch.args.is_empty() {
map.insert("args".into(), launch.args.clone().into());
}
if let Some(stop_on_entry) = config.stop_on_entry {
map.insert("stopOnEntry".into(), stop_on_entry.into());
}
if let Some(cwd) = launch.cwd.as_ref() {
map.insert("cwd".into(), cwd.to_string_lossy().into_owned().into());
}
}
}
dap::StartDebuggingRequestArguments {
request,
configuration: args,
}
}
}
#[async_trait(?Send)]
impl DebugAdapter for LldbDebugAdapter {
fn name(&self) -> DebugAdapterName {
DebugAdapterName(Self::ADAPTER_NAME.into())
}
async fn get_binary(
&self,
delegate: &dyn DapDelegate,
config: &DebugTaskDefinition,
user_installed_path: Option<PathBuf>,
_: &mut AsyncApp,
) -> Result<DebugAdapterBinary> {
let lldb_dap_path = if let Some(user_installed_path) = user_installed_path {
user_installed_path.to_string_lossy().into()
} else {
delegate
.which(OsStr::new("lldb-dap"))
.and_then(|p| p.to_str().map(|s| s.to_string()))
.ok_or(anyhow!("Could not find lldb-dap in path"))?
};
Ok(DebugAdapterBinary {
adapter_name: Self::ADAPTER_NAME.into(),
command: lldb_dap_path,
arguments: None,
envs: None,
cwd: None,
connection: None,
request_args: self.request_args(config),
})
}
async fn install_binary(
&self,
_version: AdapterVersion,
_delegate: &dyn DapDelegate,
) -> Result<()> {
unimplemented!("LLDB debug adapter cannot be installed by Zed (yet)")
}
async fn fetch_latest_adapter_version(&self, _: &dyn DapDelegate) -> Result<AdapterVersion> {
unimplemented!("Fetch latest adapter version not implemented for lldb (yet)")
}
async fn get_installed_binary(
&self,
_: &dyn DapDelegate,
_: &DebugTaskDefinition,
_: Option<PathBuf>,
_: &mut AsyncApp,
) -> Result<DebugAdapterBinary> {
unimplemented!("LLDB debug adapter cannot be installed by Zed (yet)")
}
}

View File

@ -682,7 +682,7 @@ impl ContextProvider for RustContextProvider {
RUST_PACKAGE_TASK_VARIABLE.template_value(),
),
task_type: TaskType::Debug(task::DebugArgs {
adapter: "LLDB".to_owned(),
adapter: "CodeLLDB".to_owned(),
request: task::DebugArgsRequest::Launch,
locator: Some("cargo".into()),
tcp_connection: None,
@ -791,7 +791,7 @@ impl ContextProvider for RustContextProvider {
command: "cargo".into(),
task_type: TaskType::Debug(task::DebugArgs {
request: task::DebugArgsRequest::Launch,
adapter: "LLDB".to_owned(),
adapter: "CodeLLDB".to_owned(),
initialize_args: None,
locator: Some("cargo".into()),
tcp_connection: None,