Skip to content

Commit 67d684a

Browse files
committed
Symbolize with an offset PC on MSVC
For whatever reason this looks to produce more consistent backtraces, but it's unclear why... For now let's document that we don't know why it works but otherwise leave it in due to the more accurate debuginfo-related backtraces it produces.
1 parent 6e1d6c4 commit 67d684a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/symbolize/dbghelp.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,11 @@ unsafe fn resolve_with_inline(
113113
|info| {
114114
dbghelp.SymFromInlineContextW()(
115115
GetCurrentProcess(),
116-
frame.AddrPC.Offset,
116+
// FIXME: why is `-1` used here and below? It seems to produce
117+
// more accurate backtraces on Windows (aka passes tests in
118+
// rust-lang/rust), but it's unclear why it's required in the
119+
// first place.
120+
frame.AddrPC.Offset - 1,
117121
frame.InlineFrameContext,
118122
&mut 0,
119123
info,
@@ -122,7 +126,7 @@ unsafe fn resolve_with_inline(
122126
|line| {
123127
dbghelp.SymGetLineFromInlineContextW()(
124128
GetCurrentProcess(),
125-
frame.AddrPC.Offset,
129+
frame.AddrPC.Offset - 1,
126130
frame.InlineFrameContext,
127131
0,
128132
&mut 0,

0 commit comments

Comments
 (0)