| 1 | // Licensed to the .NET Foundation under one or more agreements. |
| 2 | // The .NET Foundation licenses this file to you under the MIT license. |
| 3 | // See the LICENSE file in the project root for more information. |
| 4 | |
| 5 | // |
| 6 | |
| 7 | #ifndef __unwinder_h__ |
| 8 | #define __unwinder_h__ |
| 9 | |
| 10 | |
| 11 | //--------------------------------------------------------------------------------------- |
| 12 | // |
| 13 | // OOPStackUnwinder is the abstract base class for unwinding stack frames. Each of the two 64-bit platforms |
| 14 | // has its own derived class. Although the name of this class and its derived classes have changed, they |
| 15 | // are actually borrowed from dbghelp.dll. (StackWalk64() is built on top of these classes.) We have ripped |
| 16 | // out everything we don't need such as symbol lookup and various state, and keep just enough code to support |
| 17 | // VirtualUnwind(). The managed debugging infrastructure can't call RtlVirtualUnwind() because it doesn't |
| 18 | // work from out-of-processr |
| 19 | // |
| 20 | // Notes: |
| 21 | // To see what we have changed in the borrowed source, you can diff the original version and our version. |
| 22 | // For example, on X64, you can diff clr\src\Debug\daccess\amd64\dbs_stack_x64.cpp (the original) and |
| 23 | // clr\src\Debug\daccess\amd64\unwinder_amd64.cpp. |
| 24 | // |
| 25 | |
| 26 | class OOPStackUnwinder |
| 27 | { |
| 28 | protected: |
| 29 | |
| 30 | // Given a control PC, return the base of the module it is in. For jitted managed code, this is the |
| 31 | // start of the code heap. |
| 32 | static HRESULT GetModuleBase( DWORD64 address, |
| 33 | __out PDWORD64 pdwBase); |
| 34 | |
| 35 | // Given a control PC, return the function entry of the functoin it is in. |
| 36 | static HRESULT GetFunctionEntry( DWORD64 address, |
| 37 | __out_ecount(cbBuffer) PVOID pBuffer, |
| 38 | DWORD cbBuffer); |
| 39 | }; |
| 40 | |
| 41 | #endif // __unwinder_h__ |
| 42 | |