How to Log Stack Frames with Windows x64

前端 未结 12 1005
-上瘾入骨i
-上瘾入骨i 2020-12-07 14:48

I am using Stackdumps with Win32, to write all return adresses into my logfile. I match these with a mapfile later on (see my article [Post Mortem Debugging][1]).

<

12条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-07 15:42

    The trick is to stop calling StackWalk64 when it returns 0 in stk.AddrReturn.Offset. This means there are no more frames on the stack. If stk.AddrReturn.Offset is non-zero, you can use that value as the return address.

    If you continue calling StackWalk64 after this, my guess is that it will try to interpret whatever is in the memory locations as being a stack and will return unpredictable data.

提交回复
热议问题