diff options
| author | Josh Ferrell <josh@vector35.com> | 2025-08-21 12:20:21 -0400 |
|---|---|---|
| committer | Josh Ferrell <josh@vector35.com> | 2025-08-21 12:20:45 -0400 |
| commit | eb09898c0ea423328d929dec4d1730030f99abe4 (patch) | |
| tree | ef188a4d24a171142e65441b2a46bb3b1a92a835 /plugins/pdb-ng/src | |
| parent | 55b35dfbcf181797ef91c9b8d5a22638a1dfb0c6 (diff) | |
Add support for automatically loading PDB/DWARF info from sibling files in projects
Diffstat (limited to 'plugins/pdb-ng/src')
| -rw-r--r-- | plugins/pdb-ng/src/lib.rs | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/plugins/pdb-ng/src/lib.rs b/plugins/pdb-ng/src/lib.rs index cad1ada0..9a0e0724 100644 --- a/plugins/pdb-ng/src/lib.rs +++ b/plugins/pdb-ng/src/lib.rs @@ -614,11 +614,7 @@ impl CustomDebugInfoParser for PDBParser { potential_path.pop(); potential_path.push(&info.file_name); if potential_path.exists() { - match fs::read( - potential_path - .to_str() - .expect("Potential path is a real string"), - ) { + match fs::read(potential_path) { Ok(conts) => match self .load_from_file(&conts, debug_info, view, &progress, true, false) { @@ -631,6 +627,35 @@ impl CustomDebugInfoParser for PDBParser { } } + // Try in the same folder in the project + if let Some(project_file) = view.file().project_file() { + let project_file_folder_id = project_file.folder().map(|x| x.id()); + for file in project_file.project().files().iter() { + let file_folder_id = file.folder().map(|x| x.id()); + if file.name() == info.file_name && file_folder_id == project_file_folder_id { + if !file.exists_on_disk() { + // If the file doesn't exist, don't consider it + // TODO: if we're connected to a remote project, offer to download the file + continue; + } + + if let Some(path_on_disk) = file.path_on_disk() { + match fs::read(path_on_disk) { + Ok(conts) => match self.load_from_file( + &conts, debug_info, view, &progress, true, false, + ) { + Ok(_) => return true, + Err(e) if e.to_string() == "Cancelled" => return false, + Err(e) => debug!("Skipping, {}", e.to_string()), + }, + Err(e) if e.to_string() == "Cancelled" => return false, + Err(e) => debug!("Could not read pdb: {}", e.to_string()), + } + } + } + } + } + // Check the local symbol store if let Ok(local_store_path) = active_local_cache(Some(view)) { match search_sym_store(view, local_store_path.clone(), &info) { |
