Skip to content

Commit

Permalink
Add the code_file to the SlashSymbols paths (#1483)
Browse files Browse the repository at this point in the history
  • Loading branch information
Swatinem authored Jun 13, 2024
1 parent 788cd60 commit 37faba3
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions crates/symbolicator-sources/src/paths.rs
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,12 @@ fn get_unified_path(filetype: FileType, identifier: &ObjectId) -> Option<String>
Some(format!("{}/{}/{}", id.get(..2)?, id.get(2..)?, suffix))
}

fn get_slashsymbols_path(identifier: &ObjectId) -> Option<String> {
let code_id = identifier.code_id.as_ref()?;
let code_file = identifier.validated_code_file_basename()?;
Some(format!("{code_file}/{code_id}/symbols"))
}

/// Determines the paths for an object file in the given layout.
///
/// The vector is ordered from lower priority to highest priority.
Expand All @@ -439,12 +445,9 @@ pub fn get_directory_paths(
DirectoryLayoutType::Unified => {
get_unified_path(filetype, identifier).into_iter().collect()
}
DirectoryLayoutType::SlashSymbols => identifier
.code_id
.as_ref()
.map(|code_id| format!("{}/symbols", code_id.as_str()))
.into_iter()
.collect(),
DirectoryLayoutType::SlashSymbols => {
get_slashsymbols_path(identifier).into_iter().collect()
}
};

for path in paths.iter_mut() {
Expand Down Expand Up @@ -744,7 +747,10 @@ mod tests {
&ELF_OBJECT_ID,
);
assert_eq!(paths.len(), 1);
assert_eq!(paths[0], "dfb85de42daffd09640c8fe377d572de3e168920/symbols");
assert_eq!(
paths[0],
"libm-2.23.so/dfb85de42daffd09640c8fe377d572de3e168920/symbols"
);
}

#[test]
Expand Down

0 comments on commit 37faba3

Please sign in to comment.