Skip to content

Commit 5b0df7a

Browse files
Merge pull request #54 from ZacWalk/master
Windows ARM64 support
2 parents 5332051 + e3c85f0 commit 5b0df7a

8 files changed

Lines changed: 647 additions & 5 deletions

Main/StackWalker/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
/Debug_*
66
/Release_*
77
/x64
8+
/arm64
89
/Itanium
910
/ipch
1011
/.vs

Main/StackWalker/StackWalker.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,6 +1190,14 @@ BOOL StackWalker::ShowCallstack(HANDLE hThread,
11901190
s.AddrBStore.Mode = AddrModeFlat;
11911191
s.AddrStack.Offset = c.IntSp;
11921192
s.AddrStack.Mode = AddrModeFlat;
1193+
#elif _M_ARM64
1194+
imageType = IMAGE_FILE_MACHINE_ARM64;
1195+
s.AddrPC.Offset = c.Pc;
1196+
s.AddrPC.Mode = AddrModeFlat;
1197+
s.AddrFrame.Offset = c.Fp;
1198+
s.AddrFrame.Mode = AddrModeFlat;
1199+
s.AddrStack.Offset = c.Sp;
1200+
s.AddrStack.Mode = AddrModeFlat;
11931201
#else
11941202
#error "Platform not supported!"
11951203
#endif
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
Microsoft Visual Studio Solution File, Format Version 12.00
2+
# Visual Studio Version 17
3+
VisualStudioVersion = 17.3.32620.295
4+
MinimumVisualStudioVersion = 10.0.40219.1
5+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "StackWalker_VC2022", "StackWalker_VC2022.vcxproj", "{89B2BD42-B130-4811-9043-71A8EBC40DE5}"
6+
EndProject
7+
Global
8+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
9+
Debug_VC2017|ARM64 = Debug_VC2017|ARM64
10+
Debug_VC2017|Win32 = Debug_VC2017|Win32
11+
Debug_VC2017|x64 = Debug_VC2017|x64
12+
Debug_VC2017-UNICODE|ARM64 = Debug_VC2017-UNICODE|ARM64
13+
Debug_VC2017-UNICODE|Win32 = Debug_VC2017-UNICODE|Win32
14+
Debug_VC2017-UNICODE|x64 = Debug_VC2017-UNICODE|x64
15+
Release_VC2017|ARM64 = Release_VC2017|ARM64
16+
Release_VC2017|Win32 = Release_VC2017|Win32
17+
Release_VC2017|x64 = Release_VC2017|x64
18+
Release_VC2017-UNICODE|ARM64 = Release_VC2017-UNICODE|ARM64
19+
Release_VC2017-UNICODE|Win32 = Release_VC2017-UNICODE|Win32
20+
Release_VC2017-UNICODE|x64 = Release_VC2017-UNICODE|x64
21+
EndGlobalSection
22+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
23+
{89B2BD42-B130-4811-9043-71A8EBC40DE5}.Debug_VC2017|ARM64.ActiveCfg = Debug_VC2017|ARM64
24+
{89B2BD42-B130-4811-9043-71A8EBC40DE5}.Debug_VC2017|ARM64.Build.0 = Debug_VC2017|ARM64
25+
{89B2BD42-B130-4811-9043-71A8EBC40DE5}.Debug_VC2017|Win32.ActiveCfg = Debug_VC2017|Win32
26+
{89B2BD42-B130-4811-9043-71A8EBC40DE5}.Debug_VC2017|Win32.Build.0 = Debug_VC2017|Win32
27+
{89B2BD42-B130-4811-9043-71A8EBC40DE5}.Debug_VC2017|x64.ActiveCfg = Debug_VC2017|x64
28+
{89B2BD42-B130-4811-9043-71A8EBC40DE5}.Debug_VC2017|x64.Build.0 = Debug_VC2017|x64
29+
{89B2BD42-B130-4811-9043-71A8EBC40DE5}.Debug_VC2017-UNICODE|ARM64.ActiveCfg = Debug_VC2017-UNICODE|ARM64
30+
{89B2BD42-B130-4811-9043-71A8EBC40DE5}.Debug_VC2017-UNICODE|ARM64.Build.0 = Debug_VC2017-UNICODE|ARM64
31+
{89B2BD42-B130-4811-9043-71A8EBC40DE5}.Debug_VC2017-UNICODE|Win32.ActiveCfg = Debug_VC2017-UNICODE|Win32
32+
{89B2BD42-B130-4811-9043-71A8EBC40DE5}.Debug_VC2017-UNICODE|Win32.Build.0 = Debug_VC2017-UNICODE|Win32
33+
{89B2BD42-B130-4811-9043-71A8EBC40DE5}.Debug_VC2017-UNICODE|x64.ActiveCfg = Debug_VC2017-UNICODE|x64
34+
{89B2BD42-B130-4811-9043-71A8EBC40DE5}.Debug_VC2017-UNICODE|x64.Build.0 = Debug_VC2017-UNICODE|x64
35+
{89B2BD42-B130-4811-9043-71A8EBC40DE5}.Release_VC2017|ARM64.ActiveCfg = Release_VC2017|ARM64
36+
{89B2BD42-B130-4811-9043-71A8EBC40DE5}.Release_VC2017|ARM64.Build.0 = Release_VC2017|ARM64
37+
{89B2BD42-B130-4811-9043-71A8EBC40DE5}.Release_VC2017|Win32.ActiveCfg = Release_VC2017|Win32
38+
{89B2BD42-B130-4811-9043-71A8EBC40DE5}.Release_VC2017|Win32.Build.0 = Release_VC2017|Win32
39+
{89B2BD42-B130-4811-9043-71A8EBC40DE5}.Release_VC2017|x64.ActiveCfg = Release_VC2017|x64
40+
{89B2BD42-B130-4811-9043-71A8EBC40DE5}.Release_VC2017|x64.Build.0 = Release_VC2017|x64
41+
{89B2BD42-B130-4811-9043-71A8EBC40DE5}.Release_VC2017-UNICODE|ARM64.ActiveCfg = Release_VC2017-UNICODE|ARM64
42+
{89B2BD42-B130-4811-9043-71A8EBC40DE5}.Release_VC2017-UNICODE|ARM64.Build.0 = Release_VC2017-UNICODE|ARM64
43+
{89B2BD42-B130-4811-9043-71A8EBC40DE5}.Release_VC2017-UNICODE|Win32.ActiveCfg = Release_VC2017-UNICODE|Win32
44+
{89B2BD42-B130-4811-9043-71A8EBC40DE5}.Release_VC2017-UNICODE|Win32.Build.0 = Release_VC2017-UNICODE|Win32
45+
{89B2BD42-B130-4811-9043-71A8EBC40DE5}.Release_VC2017-UNICODE|x64.ActiveCfg = Release_VC2017-UNICODE|x64
46+
{89B2BD42-B130-4811-9043-71A8EBC40DE5}.Release_VC2017-UNICODE|x64.Build.0 = Release_VC2017-UNICODE|x64
47+
EndGlobalSection
48+
GlobalSection(SolutionProperties) = preSolution
49+
HideSolutionNode = FALSE
50+
EndGlobalSection
51+
GlobalSection(ExtensibilityGlobals) = postSolution
52+
SolutionGuid = {214F4088-66CE-43FA-80E8-33674E8CE048}
53+
EndGlobalSection
54+
EndGlobal

Main/StackWalker/StackWalker_VC2022.vcxproj

Lines changed: 517 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup>
4+
<Filter Include="Source Files">
5+
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
6+
<Extensions>cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
7+
</Filter>
8+
<Filter Include="Header Files">
9+
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
10+
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
11+
</Filter>
12+
<Filter Include="Resource Files">
13+
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
14+
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx</Extensions>
15+
</Filter>
16+
</ItemGroup>
17+
<ItemGroup>
18+
<ClCompile Include="main.cpp">
19+
<Filter>Source Files</Filter>
20+
</ClCompile>
21+
<ClCompile Include="StackWalker.cpp">
22+
<Filter>Source Files</Filter>
23+
</ClCompile>
24+
</ItemGroup>
25+
<ItemGroup>
26+
<ClInclude Include="StackWalker.h">
27+
<Filter>Header Files</Filter>
28+
</ClInclude>
29+
</ItemGroup>
30+
</Project>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
""
2+
{
3+
"FILE_VERSION" = "9237"
4+
"ENLISTMENT_CHOICE" = "NEVER"
5+
"PROJECT_FILE_RELATIVE_PATH" = ""
6+
"NUMBER_OF_EXCLUDED_FILES" = "0"
7+
"ORIGINAL_PROJECT_FILE_PATH" = ""
8+
"NUMBER_OF_NESTED_PROJECTS" = "0"
9+
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROJECT"
10+
}

Main/StackWalker/main.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ void GlobalFunctionPointerTest()
8585
// http://blog.kalmbach-software.de/2008/04/02/unhandled-exceptions-in-vc8-and-above-for-x86-and-x64/
8686
// Even better: http://blog.kalmbach-software.de/2013/05/23/improvedpreventsetunhandledexceptionfilter/
8787

88-
#if defined(_M_X64) || defined(_M_IX86)
88+
#if defined(_M_X64) || defined(_M_IX86) || defined(_M_ARM64)
8989
static BOOL PreventSetUnhandledExceptionFilter()
9090
{
9191
HMODULE hKernel32 = LoadLibrary(_T("kernel32.dll"));
@@ -104,6 +104,11 @@ static BOOL PreventSetUnhandledExceptionFilter()
104104
// 33 C0 xor eax,eax
105105
// C3 ret
106106
unsigned char szExecute[] = {0x33, 0xC0, 0xC3};
107+
#elif _M_ARM64
108+
unsigned char szExecute[] = {
109+
0x00, 0x00, 0x80, 0x52, // mov w0, #0
110+
0xC0, 0x03, 0x5F, 0xD6 // ret
111+
};
107112
#else
108113
#error "The following code only works for x86 and x64!"
109114
#endif
@@ -123,7 +128,7 @@ static BOOL PreventSetUnhandledExceptionFilter()
123128
return bRet;
124129
}
125130
#else
126-
#pragma message("This code works only for x86 and x64!")
131+
#pragma message("This code works only for x86, x64 and arm64!")
127132
#endif
128133

129134
static TCHAR s_szExceptionLogFileName[_MAX_PATH] = _T("\\exceptions.log"); // default
@@ -174,7 +179,7 @@ static void InitUnhandledExceptionFilter()
174179
{
175180
// set global exception handler (for handling all unhandled exceptions)
176181
SetUnhandledExceptionFilter(CrashHandlerExceptionFilter);
177-
#if defined _M_X64 || defined _M_IX86
182+
#if defined _M_X64 || defined _M_IX86 || defined _M_ARM64
178183
PreventSetUnhandledExceptionFilter();
179184
#endif
180185
s_bUnhandledExeptionFilterSet = TRUE;

appveyor.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,31 @@ environment:
1212
CONFIGURATION: "Release_VC9-UNICODE"
1313
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
1414
CMAKE_GENERATOR: "Visual Studio 12 2013"
15-
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
15+
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
1616
CMAKE_GENERATOR: "Visual Studio 12 2013 Win64"
17+
TARGET_CONFIG: "--config RelWithDebInfo"
1718
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
1819
CMAKE_GENERATOR: "Visual Studio 14 2015"
20+
TARGET_CONFIG: "--config RelWithDebInfo"
1921
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
2022
CMAKE_GENERATOR: "Visual Studio 14 2015 Win64"
23+
TARGET_CONFIG: "--config RelWithDebInfo"
2124
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
2225
CMAKE_GENERATOR: "Visual Studio 15 2017"
26+
TARGET_CONFIG: "--config RelWithDebInfo"
2327
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
2428
CMAKE_GENERATOR: "Visual Studio 15 2017 Win64"
29+
TARGET_CONFIG: "--config RelWithDebInfo"
30+
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022
31+
CMAKE_GENERATOR: "Visual Studio 17 2022"
32+
TARGET_ARCH: "-A Win32"
33+
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022
34+
CMAKE_GENERATOR: "Visual Studio 17 2022"
35+
TARGET_ARCH: "-A x64"
36+
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022
37+
CMAKE_GENERATOR: "Visual Studio 17 2022"
38+
TARGET_ARCH: "-A ARM64"
39+
2540

2641
before_build:
2742
- if [%BUILDER%]==[msbuild] echo MSVC2008
@@ -55,6 +70,8 @@ build_script:
5570
- if [%BUILDER%]==[msbuild] msbuild %SLN_NAME% %MS_BLD_ARGS% /logger:"%AVLOGGER%"
5671
- if not [%BUILDER%]==[msbuild] cmake --version
5772
- if not [%BUILDER%]==[msbuild] cmake -E make_directory "build-dir"
58-
- if not [%BUILDER%]==[msbuild] cmake -E chdir "build-dir" cmake -G "%CMAKE_GENERATOR%" --config RelWithDebInfo -DCMAKE_INSTALL_PREFIX="%APPVEYOR_BUILD_FOLDER%/root" ..
73+
- if not [%BUILDER%]==[msbuild] cmake -E chdir "build-dir" cmake -G "%CMAKE_GENERATOR%" %TARGET_ARCH% %TARGET_CONFIG% -DCMAKE_INSTALL_PREFIX="%APPVEYOR_BUILD_FOLDER%/root" ..
5974
- if not [%BUILDER%]==[msbuild] cmake --build "build-dir" --config RelWithDebInfo
6075
- if not [%BUILDER%]==[msbuild] cmake --build "build-dir" --target install --config RelWithDebInfo
76+
77+

0 commit comments

Comments
 (0)