Skip to content

Commit 67f3b24

Browse files
committed
ref: Temporarily bump to findshlibs branch
1 parent 0ab88fc commit 67f3b24

File tree

2 files changed

+6
-31
lines changed

2 files changed

+6
-31
lines changed

sentry-debug-images/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ edition = "2018"
1515
[dependencies]
1616
sentry-core = { version = "0.18.0", path = "../sentry-core" }
1717
lazy_static = "1.4.0"
18-
findshlibs = "0.7.0"
18+
findshlibs = { git = "https://github.com/jan-auer/findshlibs", branch = "fix/load_addr" }

sentry-debug-images/src/unix.rs

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use sentry_core::protocol::debugid::DebugId;
44
use sentry_core::protocol::{DebugImage, SymbolicDebugImage};
55
use sentry_core::types::Uuid;
66

7-
use findshlibs::{Segment, SharedLibrary, SharedLibraryId, TargetSharedLibrary, TARGET_SUPPORTED};
7+
use findshlibs::{SharedLibrary, SharedLibraryId, TargetSharedLibrary, TARGET_SUPPORTED};
88

99
const UUID_SIZE: usize = 16;
1010

@@ -33,18 +33,6 @@ fn debug_id_from_build_id(build_id: &[u8]) -> Option<DebugId> {
3333
Uuid::from_slice(&data).map(DebugId::from_uuid).ok()
3434
}
3535

36-
/// Filters for PT_LOAD segments.
37-
#[cfg(target_os = "linux")]
38-
fn filter_seg(lib: &findshlibs::linux::Segment) -> bool {
39-
lib.is_load()
40-
}
41-
42-
/// Filters for __TEXT segments.
43-
#[cfg(target_os = "macos")]
44-
fn filter_seg(lib: &findshlibs::macos::Segment) -> bool {
45-
lib.is_code()
46-
}
47-
4836
pub fn debug_images() -> Vec<DebugImage> {
4937
let mut images = vec![];
5038
if !TARGET_SUPPORTED {
@@ -62,21 +50,8 @@ pub fn debug_images() -> Vec<DebugImage> {
6250
None => return,
6351
};
6452

65-
let mut lowest_addr = !0;
66-
let mut lowest_vmaddr = !0;
67-
let mut highest_addr = 0;
68-
69-
for seg in shlib.segments().filter(filter_seg) {
70-
let avma = seg.actual_virtual_memory_address(shlib).0 as u64;
71-
lowest_addr = lowest_addr.min(avma);
72-
highest_addr = highest_addr.max(avma);
73-
74-
let svma = seg.stated_virtual_memory_address().0 as u64;
75-
lowest_vmaddr = lowest_vmaddr.min(svma);
76-
}
77-
7853
let mut name = shlib.name().to_string_lossy().to_string();
79-
if name == "" {
54+
if name.is_empty() {
8055
name = env::current_exe()
8156
.map(|x| x.display().to_string())
8257
.unwrap_or_else(|_| "<main>".to_string());
@@ -86,9 +61,9 @@ pub fn debug_images() -> Vec<DebugImage> {
8661
SymbolicDebugImage {
8762
name,
8863
arch: None,
89-
image_addr: lowest_addr.into(),
90-
image_size: highest_addr - lowest_addr,
91-
image_vmaddr: lowest_vmaddr.into(),
64+
image_addr: shlib.actual_load_addr().0.into(),
65+
image_size: shlib.len() as u64,
66+
image_vmaddr: shlib.stated_load_addr().0.into(),
9267
id: debug_id,
9368
}
9469
.into(),

0 commit comments

Comments
 (0)