summaryrefslogtreecommitdiff
path: root/plugins/dwarf
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2026-02-11 17:56:26 -0800
committerMason Reed <35282038+emesare@users.noreply.github.com>2026-02-23 00:09:44 -0800
commitc1dbea197a6ba7e3d008e01c8169f5c3702151ea (patch)
treec4dc5e203e7c04bd7ba1b105bd065073f05774a5 /plugins/dwarf
parentd61826e8fbe3580c762f7f317f69201bce3710ad (diff)
[Rust] Refactor `FileMetadata` file information
- Rename and retype `FileMetadata::filename` and make the assignment required to happen at time of construction. - Add `FileMetadata::display_name` which is only to be used for presentation purposes. - Add `FileMetadata::virtual_path` for containers. - Rename `FileMetadata::modified` to `FileMetadata::is_modified` to be more consistent across codebase. - Add some missing documentation. - Add `BinaryView::from_metadata` with accompanying documentation.
Diffstat (limited to 'plugins/dwarf')
-rw-r--r--plugins/dwarf/dwarf_import/src/helpers.rs22
1 files changed, 9 insertions, 13 deletions
diff --git a/plugins/dwarf/dwarf_import/src/helpers.rs b/plugins/dwarf/dwarf_import/src/helpers.rs
index c7855b25..541fdc42 100644
--- a/plugins/dwarf/dwarf_import/src/helpers.rs
+++ b/plugins/dwarf/dwarf_import/src/helpers.rs
@@ -12,8 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-use std::ffi::OsStr;
-use std::path::{Path, PathBuf};
+use std::path::PathBuf;
use std::{str::FromStr, sync::mpsc};
use crate::{DebugInfoBuilderContext, ReaderType};
@@ -590,10 +589,8 @@ pub(crate) fn find_sibling_debug_file(view: &BinaryView) -> Option<String> {
return None;
}
- let full_file_path = view.file().filename().to_string();
-
- let debug_file = PathBuf::from(format!("{}.debug", full_file_path));
- let dsym_folder = PathBuf::from(format!("{}.dSYM", full_file_path));
+ let debug_file = view.file().file_path().with_extension("debug");
+ let dsym_folder = view.file().file_path().with_extension("dSYM");
// Find sibling debug file
if debug_file.exists() && debug_file.is_file() {
@@ -624,13 +621,12 @@ pub(crate) fn find_sibling_debug_file(view: &BinaryView) -> Option<String> {
// Look for dSYM
// TODO: look for dSYM in project
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?
- if dsym_file.exists() {
- return Some(dsym_file.to_string_lossy().to_string());
+ if let Some(filename) = view.file().file_path().file_name() {
+ // TODO: should this just pull any file out? Can there be multiple files?
+ let dsym_file = dsym_folder.join("Contents/Resources/DWARF/").join(filename);
+ if dsym_file.exists() {
+ return Some(dsym_file.to_string_lossy().to_string());
+ }
}
}