Skip to content

Commit f178ce3

Browse files
committed
Simplify actual_start_index in Backtrace
Try matching on the exact values and otherwise let extra frames sneak through if they're otherwise not present
1 parent 7ef89a9 commit f178ce3

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

src/capture.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ pub struct BacktraceFrame {
5252
enum Frame {
5353
Raw(::Frame),
5454
#[allow(dead_code)]
55-
Deserialized { ip: usize, symbol_address: usize },
55+
Deserialized {
56+
ip: usize,
57+
symbol_address: usize,
58+
},
5659
}
5760

5861
impl Frame {
@@ -155,23 +158,15 @@ impl Backtrace {
155158
}
156159

157160
fn create(ip: usize) -> Backtrace {
158-
let ip_lo = ip;
159-
let ip_hi = ip + 128;
160-
161161
let mut frames = Vec::new();
162162
let mut actual_start_index = None;
163163
trace(|frame| {
164-
let ip = frame.ip() as usize;
165164
frames.push(BacktraceFrame {
166165
frame: Frame::Raw(frame.clone()),
167166
symbols: None,
168167
});
169168

170-
if cfg!(not(all(target_os = "windows", target_arch = "x86")))
171-
&& ip >= ip_lo
172-
&& ip <= ip_hi
173-
&& actual_start_index.is_none()
174-
{
169+
if frame.symbol_address() as usize == ip && actual_start_index.is_none() {
175170
actual_start_index = Some(frames.len());
176171
}
177172
true

0 commit comments

Comments
 (0)