Bläddra i källkod

aya: uprobe: use PathBuf for ResolveSymbolError::DebuglinkAccessError

Makes no sense to use a string, as it's a path.
This breaks the public API.
Omri Steiner 2 månader sedan
förälder
incheckning
33c9f2b2b2
1 ändrade filer med 3 tillägg och 10 borttagningar
  1. 3 10
      aya/src/programs/uprobe.rs

+ 3 - 10
aya/src/programs/uprobe.rs

@@ -621,7 +621,7 @@ enum ResolveSymbolError {
     SectionFileRangeNone(String, Result<String, object::Error>),
 
     #[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<u64, ResolveSymbolError>
     } 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)?;