File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -167,6 +167,8 @@ static uint64_t ConvertAddress(uint64_t addr)
167167static __attribute__ ((noinline)) std::vector<uint64_t> GetStackFrames(size_t skip, size_t max_frames, const CONTEXT* pContext = nullptr )
168168{
169169#ifdef ENABLE_STACKTRACES
170+ volatile size_t skip_frames = skip;
171+
170172 // We can't use libbacktrace for stack unwinding on Windows as it returns invalid addresses (like 0x1 or 0xffffffff)
171173 // dbghelp is not thread safe
172174 static StdMutex m;
@@ -205,7 +207,7 @@ static __attribute__((noinline)) std::vector<uint64_t> GetStackFrames(size_t ski
205207 stackframe.AddrStack .Offset = context.Rsp ;
206208 stackframe.AddrStack .Mode = AddrModeFlat;
207209 if (!pContext) {
208- skip++ ; // skip this method
210+ skip_frames = skip_frames + 1 ; // skip this method
209211 }
210212#else
211213#error unsupported architecture
@@ -223,7 +225,7 @@ static __attribute__((noinline)) std::vector<uint64_t> GetStackFrames(size_t ski
223225 if (!result) {
224226 break ;
225227 }
226- if (i >= skip ) {
228+ if (i >= skip_frames ) {
227229 uint64_t pc = ConvertAddress (stackframe.AddrPC .Offset );
228230 if (pc == 0 ) {
229231 pc = stackframe.AddrPC .Offset ;
You can’t perform that action at this time.
0 commit comments