From 33c9f2b2b2cf5587139e36c0e05de13e72cf77fa Mon Sep 17 00:00:00 2001 From: Omri Steiner Date: Mon, 5 May 2025 11:01:26 +0200 Subject: [PATCH] aya: uprobe: use PathBuf for ResolveSymbolError::DebuglinkAccessError Makes no sense to use a string, as it's a path. This breaks the public API. --- aya/src/programs/uprobe.rs | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/aya/src/programs/uprobe.rs b/aya/src/programs/uprobe.rs index e733e3f4..ac438136 100644 --- a/aya/src/programs/uprobe.rs +++ b/aya/src/programs/uprobe.rs @@ -621,7 +621,7 @@ enum ResolveSymbolError { SectionFileRangeNone(String, Result), #[error("failed to access debuglink file `{0}`: `{1}`")] - DebuglinkAccessError(String, io::Error), + DebuglinkAccessError(PathBuf, io::Error), #[error("symbol `{0}` not found, mismatched build IDs in main and debug files")] BuildIdMismatch(String), @@ -695,15 +695,8 @@ fn resolve_symbol(path: &Path, symbol: &str) -> Result } else { // Only search in the debug object if the symbol was not found in the main object let debug_path = find_debug_path_in_object(&obj, path, symbol)?; - let debug_data = MMap::map_copy_read_only(&debug_path).map_err(|e| { - ResolveSymbolError::DebuglinkAccessError( - debug_path - .to_str() - .unwrap_or("Debuglink path missing") - .to_string(), - e, - ) - })?; + let debug_data = MMap::map_copy_read_only(&debug_path) + .map_err(|e| ResolveSymbolError::DebuglinkAccessError(debug_path, e))?; let debug_obj = object::read::File::parse(debug_data.as_ref())?; verify_build_ids(&obj, &debug_obj, symbol)?;