1pub mod address;
8pub mod die;
9pub mod error;
10pub mod expressions;
11pub mod file;
12pub mod function;
13pub mod modules;
14pub mod parser;
15pub mod symbols;
16pub mod types;
17pub mod visitor;
18
19#[cfg(test)]
21pub mod test_utils;
22
23use std::path::{Path, PathBuf};
25
26pub use die::Die;
28pub use error::Error;
29pub use file::{Binary, DebugFile, SourceFile};
30pub use gimli;
31pub use symbols::{SymbolName, TypeName};
32pub use types::{find_type_by_name, get_die_typename};
33
34#[salsa::db]
36pub trait DwarfDb: salsa::Database {
37 fn remap_path(&self, path: &Path) -> PathBuf {
39 let mut path = path.to_path_buf();
40 for (source, target) in self.get_source_map() {
41 if let Ok(stripped) = path.strip_prefix(source) {
42 tracing::debug!(
43 "Remapping {} from {} to {}",
44 path.display(),
45 source.display(),
46 target.display()
47 );
48 path = target.join(stripped);
49 }
50 }
51 path
52 }
53
54 fn get_source_map(&self) -> &[(PathBuf, PathBuf)];
56}