// Maps remote file path to local file path.
// The bulk of this work is done by LLDB itself (via target.source-map), in addition to which:
// - if `filespec` contains a relative path, we convert it to an absolute one using relative_path_base
//   (which is normally initialized to ${workspaceFolder}) as a base.
// - we check whether the local file actually exists, and suppress it (if `suppress_missing_files` is true),
//   to prevent VSCode from prompting to create them.
Maps remote file path to local file path.
The bulk of this work is done by LLDB itself (via target.source-map), in addition to which:
if `filespec` contains a relative path, we convert it to an absolute one using relative_path_base
(which is normally initialized to ${workspaceFolder}) as a base.
we check whether the local file actually exists, and suppress it (if `suppress_missing_files` is true),
to prevent VSCode from prompting to create them.
Maps remote file path to local file path . The bulk of this work is done by LLDB itself ( via target . source - map ) in addition to which : if ` filespec ` contains a relative path we convert it to an absolute one using relative_path_base ( which is normally initialized to $ { workspaceFolder } ) as a base . we check whether the local file actually exists and suppress it ( if ` suppress_missing_files ` is true ) to prevent VSCode from prompting to create them .
fn map_filespec_to_local(&self, filespec: &SBFileSpec) -> Option<Rc<PathBuf>> {
        if !filespec.is_valid() {
            return None;
        } else {
            let source_path = filespec.path();
            let mut source_map_cache = self.source_map_cache.borrow_mut();
            match source_map_cache.get(&source_path) {
                Some(mapped_path) => mapped_path.clone(),
                None => {
                    let mut path = filespec.path();
                    // Make sure the path is absolute.
                    if path.is_relative() {
                        path = self.relative_path_base.join(path);
                    }
                    // Check if the file exists.
                    let mapped_path = if self.suppress_missing_files && !path.is_file() {
                        None
                    } else {
                        Some(Rc::new(path))
                    };
                    // Cache the result, so we don't have to probe file system again for the same path.
                    source_map_cache.insert(source_path, mapped_path.clone());
                    mapped_path
                }
            }
        }
    }
fn map_filespec_to_local ( & self , filespec : & SBFileSpec ) -> Option < Rc < PathBuf > > { if ! filespec . is_valid ( ) { return None ; } else { let source_path = filespec . path ( ) ; let mut source_map_cache = self . source_map_cache . borrow_mut ( ) ; match source_map_cache . get ( & source_path ) { Some ( mapped_path ) => mapped_path . clone ( ) , None => { let mut path = filespec . path ( ) ; // Make sure the path is absolute. if path . is_relative ( ) { path = self . relative_path_base . join ( path ) ; } // Check if the file exists. let mapped_path = if self . suppress_missing_files && ! path . is_file ( ) { None } else { Some ( Rc :: new ( path ) ) } ; // Cache the result, so we don't have to probe file system again for the same path. source_map_cache . insert ( source_path , mapped_path . clone ( ) ) ; mapped_path } } } }
Maps remote file path to local file path.
Maps remote file path to local file path .
&self
filespec
&SBFileSpec