From 6c2c7994f1412e8aa504800c7164de875c350fc1 Mon Sep 17 00:00:00 2001 From: Jan Vorlicek Date: Tue, 3 Feb 2015 16:02:18 -0800 Subject: [PATCH] Move the windows unwinder code out of the debug folder. It is a preparation for using the DAC unwinder code as an unwinder for the jitted code on Linux, because the jitter generates windows style unwind info. The unwinder is build as a static library and linked to mscordac. [tfs-changeset: 1409640] --- src/CMakeLists.txt | 1 + src/debug/daccess/CMakeLists.txt | 2 - src/debug/daccess/daccess.targets | 6 -- src/dirs.proj | 1 + src/dlls/mscordac/CMakeLists.txt | 1 + src/dlls/mscordac/mscordac.targets | 3 + src/unwinder/.gitmirror | 1 + src/unwinder/CMakeLists.txt | 22 +++++++ src/unwinder/amd64/.gitmirror | 1 + .../amd64/dbs_stack_x64.cpp | 0 .../amd64/unwinder_amd64.cpp | 0 .../amd64/unwinder_amd64.h | 0 src/unwinder/arm/.gitmirror | 1 + .../daccess => unwinder}/arm/unwinder_arm.cpp | 0 .../daccess => unwinder}/arm/unwinder_arm.h | 0 src/unwinder/arm64/.gitmirror | 1 + .../arm64/unwinder_arm64.cpp | 0 .../arm64/unwinder_arm64.h | 0 src/unwinder/dac/.gitmirror | 1 + src/unwinder/dac/CMakeLists.txt | 10 ++++ src/unwinder/dac/dirs.proj | 18 ++++++ src/unwinder/dac/hostlocal/.gitmirror | 1 + .../dac/hostlocal/unwinder_dac.nativeproj | 13 ++++ src/unwinder/dac/hostwinamd64/.gitmirror | 1 + src/unwinder/dac/hostwinamd64/CMakeLists.txt | 5 ++ .../dac/hostwinamd64/unwinder_dac.nativeproj | 15 +++++ src/unwinder/dac/hostwinx86/.gitmirror | 1 + .../dac/hostwinx86/unwinder_dac.nativeproj | 15 +++++ src/unwinder/dirs.proj | 19 ++++++ src/unwinder/stdafx.cpp | 13 ++++ src/unwinder/stdafx.h | 19 ++++++ src/{debug/daccess => unwinder}/unwinder.cpp | 0 src/{debug/daccess => unwinder}/unwinder.h | 0 src/unwinder/unwinder.targets | 60 +++++++++++++++++++ 34 files changed, 223 insertions(+), 8 deletions(-) create mode 100644 src/unwinder/.gitmirror create mode 100644 src/unwinder/CMakeLists.txt create mode 100644 src/unwinder/amd64/.gitmirror rename src/{debug/daccess => unwinder}/amd64/dbs_stack_x64.cpp (100%) rename src/{debug/daccess => unwinder}/amd64/unwinder_amd64.cpp (100%) rename src/{debug/daccess => unwinder}/amd64/unwinder_amd64.h (100%) create mode 100644 src/unwinder/arm/.gitmirror rename src/{debug/daccess => unwinder}/arm/unwinder_arm.cpp (100%) rename src/{debug/daccess => unwinder}/arm/unwinder_arm.h (100%) create mode 100644 src/unwinder/arm64/.gitmirror rename src/{debug/daccess => unwinder}/arm64/unwinder_arm64.cpp (100%) rename src/{debug/daccess => unwinder}/arm64/unwinder_arm64.h (100%) create mode 100644 src/unwinder/dac/.gitmirror create mode 100644 src/unwinder/dac/CMakeLists.txt create mode 100644 src/unwinder/dac/dirs.proj create mode 100644 src/unwinder/dac/hostlocal/.gitmirror create mode 100644 src/unwinder/dac/hostlocal/unwinder_dac.nativeproj create mode 100644 src/unwinder/dac/hostwinamd64/.gitmirror create mode 100644 src/unwinder/dac/hostwinamd64/CMakeLists.txt create mode 100644 src/unwinder/dac/hostwinamd64/unwinder_dac.nativeproj create mode 100644 src/unwinder/dac/hostwinx86/.gitmirror create mode 100644 src/unwinder/dac/hostwinx86/unwinder_dac.nativeproj create mode 100644 src/unwinder/dirs.proj create mode 100644 src/unwinder/stdafx.cpp create mode 100644 src/unwinder/stdafx.h rename src/{debug/daccess => unwinder}/unwinder.cpp (100%) rename src/{debug/daccess => unwinder}/unwinder.h (100%) create mode 100644 src/unwinder/unwinder.targets diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 30b8a199a963..35914f2f1063 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -30,6 +30,7 @@ add_subdirectory(strongname) add_subdirectory(binder) add_subdirectory(classlibnative) add_subdirectory(dlls) +add_subdirectory(unwinder) if(WIN32) add_subdirectory(ipcman) diff --git a/src/debug/daccess/CMakeLists.txt b/src/debug/daccess/CMakeLists.txt index 92dce0ef0eeb..5c012ce13f51 100644 --- a/src/debug/daccess/CMakeLists.txt +++ b/src/debug/daccess/CMakeLists.txt @@ -38,9 +38,7 @@ if(IS_64BIT_BUILD EQUAL 1) set(DACCESS_SOURCES ${DACCESS_SOURCES} - unwinder.cpp amd64/primitives.cpp - amd64/unwinder_amd64.cpp ) else(IS_64BIT_BUILD EQUAL 1) set(DACCESS_SOURCES diff --git a/src/debug/daccess/daccess.targets b/src/debug/daccess/daccess.targets index 7aacdc302c16..a7d9e41554de 100644 --- a/src/debug/daccess/daccess.targets +++ b/src/debug/daccess/daccess.targets @@ -58,15 +58,9 @@ - - - - - - diff --git a/src/dirs.proj b/src/dirs.proj index d5df279b42bf..3599b7912bf2 100644 --- a/src/dirs.proj +++ b/src/dirs.proj @@ -40,6 +40,7 @@ + diff --git a/src/dlls/mscordac/CMakeLists.txt b/src/dlls/mscordac/CMakeLists.txt index 057288c74741..527cf341b5aa 100644 --- a/src/dlls/mscordac/CMakeLists.txt +++ b/src/dlls/mscordac/CMakeLists.txt @@ -37,6 +37,7 @@ set(COREDAC_LIBRARIES mdruntimerw_dac strongname_dac utilcode_dac + unwinder_dac ) if(WIN32) diff --git a/src/dlls/mscordac/mscordac.targets b/src/dlls/mscordac/mscordac.targets index 8c41f106f740..3e0474f9a89b 100644 --- a/src/dlls/mscordac/mscordac.targets +++ b/src/dlls/mscordac/mscordac.targets @@ -77,6 +77,9 @@ $(ClrSrcDirectory)StrongName\api\dac\$(XPlatHostLibBuildDir)\strongname_dac.nativeproj + + $(ClrSrcDirectory)unwinder\dac\$(XPlatHostLibBuildDir)\unwinder_dac.nativeproj + $(ClrSrcDirectory)debug\dbgutil\$(XPlatHostLibBuildDir)\dbgutil.nativeproj diff --git a/src/unwinder/.gitmirror b/src/unwinder/.gitmirror new file mode 100644 index 000000000000..f507630f949d --- /dev/null +++ b/src/unwinder/.gitmirror @@ -0,0 +1 @@ +Only contents of this folder, excluding subfolders, will be mirrored by the Git-TFS Mirror. \ No newline at end of file diff --git a/src/unwinder/CMakeLists.txt b/src/unwinder/CMakeLists.txt new file mode 100644 index 000000000000..0ed0160b8aaa --- /dev/null +++ b/src/unwinder/CMakeLists.txt @@ -0,0 +1,22 @@ +include_directories(BEFORE ${VM_DIR}) +include_directories(BEFORE ${VM_DIR}/${ARCH_SOURCES_DIR}) +include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}) +include_directories(BEFORE ${CLR_DIR}/src/unwinder) +include_directories(${CLR_DIR}/src/debug/ee) +include_directories(${CLR_DIR}/src/gc) +include_directories(${CLR_DIR}/src/gcdump) +include_directories(${CLR_DIR}/src/debug/daccess) + +if(IS_64BIT_BUILD EQUAL 1) + include_directories(amd64) + + set(UNWINDER_SOURCES + unwinder.cpp + amd64/unwinder_amd64.cpp + ) + + convert_to_absolute_path(UNWINDER_SOURCES ${UNWINDER_SOURCES}) + + add_subdirectory(dac) +endif(IS_64BIT_BUILD EQUAL 1) + diff --git a/src/unwinder/amd64/.gitmirror b/src/unwinder/amd64/.gitmirror new file mode 100644 index 000000000000..f507630f949d --- /dev/null +++ b/src/unwinder/amd64/.gitmirror @@ -0,0 +1 @@ +Only contents of this folder, excluding subfolders, will be mirrored by the Git-TFS Mirror. \ No newline at end of file diff --git a/src/debug/daccess/amd64/dbs_stack_x64.cpp b/src/unwinder/amd64/dbs_stack_x64.cpp similarity index 100% rename from src/debug/daccess/amd64/dbs_stack_x64.cpp rename to src/unwinder/amd64/dbs_stack_x64.cpp diff --git a/src/debug/daccess/amd64/unwinder_amd64.cpp b/src/unwinder/amd64/unwinder_amd64.cpp similarity index 100% rename from src/debug/daccess/amd64/unwinder_amd64.cpp rename to src/unwinder/amd64/unwinder_amd64.cpp diff --git a/src/debug/daccess/amd64/unwinder_amd64.h b/src/unwinder/amd64/unwinder_amd64.h similarity index 100% rename from src/debug/daccess/amd64/unwinder_amd64.h rename to src/unwinder/amd64/unwinder_amd64.h diff --git a/src/unwinder/arm/.gitmirror b/src/unwinder/arm/.gitmirror new file mode 100644 index 000000000000..f507630f949d --- /dev/null +++ b/src/unwinder/arm/.gitmirror @@ -0,0 +1 @@ +Only contents of this folder, excluding subfolders, will be mirrored by the Git-TFS Mirror. \ No newline at end of file diff --git a/src/debug/daccess/arm/unwinder_arm.cpp b/src/unwinder/arm/unwinder_arm.cpp similarity index 100% rename from src/debug/daccess/arm/unwinder_arm.cpp rename to src/unwinder/arm/unwinder_arm.cpp diff --git a/src/debug/daccess/arm/unwinder_arm.h b/src/unwinder/arm/unwinder_arm.h similarity index 100% rename from src/debug/daccess/arm/unwinder_arm.h rename to src/unwinder/arm/unwinder_arm.h diff --git a/src/unwinder/arm64/.gitmirror b/src/unwinder/arm64/.gitmirror new file mode 100644 index 000000000000..f507630f949d --- /dev/null +++ b/src/unwinder/arm64/.gitmirror @@ -0,0 +1 @@ +Only contents of this folder, excluding subfolders, will be mirrored by the Git-TFS Mirror. \ No newline at end of file diff --git a/src/debug/daccess/arm64/unwinder_arm64.cpp b/src/unwinder/arm64/unwinder_arm64.cpp similarity index 100% rename from src/debug/daccess/arm64/unwinder_arm64.cpp rename to src/unwinder/arm64/unwinder_arm64.cpp diff --git a/src/debug/daccess/arm64/unwinder_arm64.h b/src/unwinder/arm64/unwinder_arm64.h similarity index 100% rename from src/debug/daccess/arm64/unwinder_arm64.h rename to src/unwinder/arm64/unwinder_arm64.h diff --git a/src/unwinder/dac/.gitmirror b/src/unwinder/dac/.gitmirror new file mode 100644 index 000000000000..f507630f949d --- /dev/null +++ b/src/unwinder/dac/.gitmirror @@ -0,0 +1 @@ +Only contents of this folder, excluding subfolders, will be mirrored by the Git-TFS Mirror. \ No newline at end of file diff --git a/src/unwinder/dac/CMakeLists.txt b/src/unwinder/dac/CMakeLists.txt new file mode 100644 index 000000000000..e82046197cc1 --- /dev/null +++ b/src/unwinder/dac/CMakeLists.txt @@ -0,0 +1,10 @@ +include(${CLR_DIR}/dac.cmake) + +add_definitions(-DFEATURE_NO_HOST) +add_definitions(-D_TARGET_AMD64_=1) +add_definitions(-DDBG_TARGET_64BIT=1) +add_definitions(-DDBG_TARGET_AMD64=1) +add_definitions(-DDBG_TARGET_WIN64=1) +add_definitions(-D_WIN64=1) + +add_library(unwinder_dac ${UNWINDER_SOURCES}) diff --git a/src/unwinder/dac/dirs.proj b/src/unwinder/dac/dirs.proj new file mode 100644 index 000000000000..77738732edc6 --- /dev/null +++ b/src/unwinder/dac/dirs.proj @@ -0,0 +1,18 @@ + + + + + + true + false + true + true + + + + + + + + + diff --git a/src/unwinder/dac/hostlocal/.gitmirror b/src/unwinder/dac/hostlocal/.gitmirror new file mode 100644 index 000000000000..f507630f949d --- /dev/null +++ b/src/unwinder/dac/hostlocal/.gitmirror @@ -0,0 +1 @@ +Only contents of this folder, excluding subfolders, will be mirrored by the Git-TFS Mirror. \ No newline at end of file diff --git a/src/unwinder/dac/hostlocal/unwinder_dac.nativeproj b/src/unwinder/dac/hostlocal/unwinder_dac.nativeproj new file mode 100644 index 000000000000..3b562e07f9cf --- /dev/null +++ b/src/unwinder/dac/hostlocal/unwinder_dac.nativeproj @@ -0,0 +1,13 @@ + + + + + true + true + unwinder_dac + + + + + + diff --git a/src/unwinder/dac/hostwinamd64/.gitmirror b/src/unwinder/dac/hostwinamd64/.gitmirror new file mode 100644 index 000000000000..f507630f949d --- /dev/null +++ b/src/unwinder/dac/hostwinamd64/.gitmirror @@ -0,0 +1 @@ +Only contents of this folder, excluding subfolders, will be mirrored by the Git-TFS Mirror. \ No newline at end of file diff --git a/src/unwinder/dac/hostwinamd64/CMakeLists.txt b/src/unwinder/dac/hostwinamd64/CMakeLists.txt new file mode 100644 index 000000000000..66a595f03333 --- /dev/null +++ b/src/unwinder/dac/hostwinamd64/CMakeLists.txt @@ -0,0 +1,5 @@ +remove_definitions(-DPROFILING_SUPPORTED) +add_definitions(-DPROFILING_SUPPORTED_DATA) +add_definitions(-DDACCESS_COMPILE) + +add_library(unwinder_dac_amd64 ${UNWINDER_SOURCES}) diff --git a/src/unwinder/dac/hostwinamd64/unwinder_dac.nativeproj b/src/unwinder/dac/hostwinamd64/unwinder_dac.nativeproj new file mode 100644 index 000000000000..e0dff469a4c7 --- /dev/null +++ b/src/unwinder/dac/hostwinamd64/unwinder_dac.nativeproj @@ -0,0 +1,15 @@ + + + + + + + + true + unwinder_dac_amd64 + + + + + + diff --git a/src/unwinder/dac/hostwinx86/.gitmirror b/src/unwinder/dac/hostwinx86/.gitmirror new file mode 100644 index 000000000000..f507630f949d --- /dev/null +++ b/src/unwinder/dac/hostwinx86/.gitmirror @@ -0,0 +1 @@ +Only contents of this folder, excluding subfolders, will be mirrored by the Git-TFS Mirror. \ No newline at end of file diff --git a/src/unwinder/dac/hostwinx86/unwinder_dac.nativeproj b/src/unwinder/dac/hostwinx86/unwinder_dac.nativeproj new file mode 100644 index 000000000000..a3538c338387 --- /dev/null +++ b/src/unwinder/dac/hostwinx86/unwinder_dac.nativeproj @@ -0,0 +1,15 @@ + + + + + + + + true + unwinder_dac_x86 + + + + + + diff --git a/src/unwinder/dirs.proj b/src/unwinder/dirs.proj new file mode 100644 index 000000000000..8b511971e365 --- /dev/null +++ b/src/unwinder/dirs.proj @@ -0,0 +1,19 @@ + + + + + + true + false + true + true + + + + + + + + + + diff --git a/src/unwinder/stdafx.cpp b/src/unwinder/stdafx.cpp new file mode 100644 index 000000000000..184cc8de1120 --- /dev/null +++ b/src/unwinder/stdafx.cpp @@ -0,0 +1,13 @@ +// +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// +//***************************************************************************** +// File: stdafx.cpp +// + +// +// Host for precompiled headers. +// +//***************************************************************************** +#include "stdafx.h" // Precompiled header key. diff --git a/src/unwinder/stdafx.h b/src/unwinder/stdafx.h new file mode 100644 index 000000000000..840877ea5bf7 --- /dev/null +++ b/src/unwinder/stdafx.h @@ -0,0 +1,19 @@ +// +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// +//***************************************************************************** +// File: stdafx.h +// + +// Prevent the inclusion of Random.h from disabling rand(). rand() is used by some other headers we include +// and there's no reason why DAC should be forbidden from using it. +#define DO_NOT_DISABLE_RAND + +#define USE_COM_CONTEXT_DEF + +#include +#include +#include +#include +#include diff --git a/src/debug/daccess/unwinder.cpp b/src/unwinder/unwinder.cpp similarity index 100% rename from src/debug/daccess/unwinder.cpp rename to src/unwinder/unwinder.cpp diff --git a/src/debug/daccess/unwinder.h b/src/unwinder/unwinder.h similarity index 100% rename from src/debug/daccess/unwinder.h rename to src/unwinder/unwinder.h diff --git a/src/unwinder/unwinder.targets b/src/unwinder/unwinder.targets new file mode 100644 index 000000000000..18cd2bfa7ce0 --- /dev/null +++ b/src/unwinder/unwinder.targets @@ -0,0 +1,60 @@ + + + + + + + + + true + + + $(UserIncludes); + $(ClrSrcDirectory)\unwinder; + $(ClrSrcDirectory)\debug\daccess; + $(ClrSrcDirectory)\vm; + $(ClrSrcDirectory)\vm\$(TargetCpu); + $(ClrSrcDirectory)\debug\inc; + $(ClrSrcDirectory)\debug\inc\$(TargetCpu); + $(ClrSrcDirectory)\debug\inc\dump; + $(ClrSrcDirectory)\debug\ee; + $(ClrSrcDirectory)\inc; + $(VCToolsIncPath); + + + $(CDefines);UNICODE;_UNICODE;$(USER_SPECIFIC_C_DEFINES);FEATURE_NO_HOST + + unwinder_dac + $(ClrLibDest) + LIBRARY + stdafx.h + true + $(ClrSrcDirectory)\unwinder\stdafx.cpp + + $(ClrSrcDirectory)\unwinder + $(ClrSrcDirectory)\unwinder\amd64 + $(ClrSrcDirectory)\unwinder\arm + $(ClrSrcDirectory)\unwinder\arm64 + + + + + + + + + + + + + + + + + + + + + + +