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 source == target {
42 continue; }
44 if let Ok(stripped) = path.strip_prefix(source) {
45 tracing::debug!(
46 "Remapping {} from {} to {}",
47 path.display(),
48 source.display(),
49 target.display()
50 );
51 path = target.join(stripped);
52 }
53 }
54 path
55 }
56
57 fn get_source_map(&self) -> &[(PathBuf, PathBuf)];
59}