Skip to content

Commit a4d5b8c

Browse files
authoredMar 10, 2024··
Update for Win10+ (#589)
Essentially reverts b891125 but only for Win10+
1 parent 140076d commit a4d5b8c

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
 

‎src/symbolize/dbghelp.rs

+17
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,22 @@ impl Symbol<'_> {
7272
#[repr(C, align(8))]
7373
struct Aligned8<T>(T);
7474

75+
#[cfg(not(target_vendor = "win7"))]
76+
pub unsafe fn resolve(what: ResolveWhat<'_>, cb: &mut dyn FnMut(&super::Symbol)) {
77+
// Ensure this process's symbols are initialized
78+
let dbghelp = match dbghelp::init() {
79+
Ok(dbghelp) => dbghelp,
80+
Err(()) => return, // oh well...
81+
};
82+
match what {
83+
ResolveWhat::Address(_) => resolve_with_inline(&dbghelp, what.address_or_ip(), None, cb),
84+
ResolveWhat::Frame(frame) => {
85+
resolve_with_inline(&dbghelp, frame.ip(), frame.inner.inline_context(), cb)
86+
}
87+
}
88+
}
89+
90+
#[cfg(target_vendor = "win7")]
7591
pub unsafe fn resolve(what: ResolveWhat<'_>, cb: &mut dyn FnMut(&super::Symbol)) {
7692
// Ensure this process's symbols are initialized
7793
let dbghelp = match dbghelp::init() {
@@ -100,6 +116,7 @@ pub unsafe fn resolve(what: ResolveWhat<'_>, cb: &mut dyn FnMut(&super::Symbol))
100116
///
101117
/// This should work all the way down to Windows XP. The inline context is
102118
/// ignored, since this concept was only introduced in dbghelp 6.2+.
119+
#[cfg(target_vendor = "win7")]
103120
unsafe fn resolve_legacy(
104121
dbghelp: &dbghelp::Init,
105122
addr: *mut c_void,

0 commit comments

Comments
 (0)
Please sign in to comment.