summaryrefslogtreecommitdiff
path: root/rust/examples
diff options
context:
space:
mode:
authorJosh Ferrell <josh@vector35.com>2024-11-05 17:12:11 -0500
committerJosh Ferrell <josh@vector35.com>2024-11-05 17:13:19 -0500
commitbf8ecfead9fcbe669c5e5c0a531037701c53d52d (patch)
treeef49d72dec74647418b3ad5149bdddbc30e76606 /rust/examples
parentaec66022d5b940bf6f489947f72ac52e0fc7cac4 (diff)
Fix .dSYM sibling file load logic and update .dSYM docs
Diffstat (limited to 'rust/examples')
-rw-r--r--rust/examples/dwarf/dwarf_import/src/helpers.rs13
1 files changed, 9 insertions, 4 deletions
diff --git a/rust/examples/dwarf/dwarf_import/src/helpers.rs b/rust/examples/dwarf/dwarf_import/src/helpers.rs
index 691c5751..6aba99d4 100644
--- a/rust/examples/dwarf/dwarf_import/src/helpers.rs
+++ b/rust/examples/dwarf/dwarf_import/src/helpers.rs
@@ -12,7 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-use std::path::PathBuf;
+use std::ffi::OsStr;
+use std::path::{Path, PathBuf};
use std::{
collections::HashMap,
ops::Deref,
@@ -553,15 +554,19 @@ pub(crate) fn find_sibling_debug_file(view: &BinaryView) -> Option<String> {
return None;
}
- let filename = view.file().filename().to_string();
+ let full_file_path = view.file().filename().to_string();
- let debug_file = PathBuf::from(format!("{}.debug", filename));
- let dsym_folder = PathBuf::from(format!("{}.dSYM/", filename));
+ let debug_file = PathBuf::from(format!("{}.debug", full_file_path));
+ let dsym_folder = PathBuf::from(format!("{}.dSYM", full_file_path));
if debug_file.exists() && debug_file.is_file() {
return Some(debug_file.to_string_lossy().to_string());
}
if dsym_folder.exists() && dsym_folder.is_dir() {
+ let filename = Path::new(&full_file_path)
+ .file_name()
+ .unwrap_or(OsStr::new(""));
+
let dsym_file = dsym_folder
.join("Contents/Resources/DWARF/")
.join(filename); // TODO: should this just pull any file out? Can there be multiple files?