summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRainer Schuetze <r.sagitario@gmx.de>2015-10-08 07:30:30 (GMT)
committerRainer Schuetze <r.sagitario@gmx.de>2015-10-08 07:30:30 (GMT)
commitea60c263fd7a3d602b01c40654c10946f8a61b9d (patch)
tree7a8df6511a7100a1c6833808a15b543e8e2a2a18 /src
parentad331ec2eb871705a555ced900745a61a0d8db84 (diff)
parent022f160fa2dab744096a2fef6040164a40926dff (diff)
downloadcv2pdb-ea60c263fd7a3d602b01c40654c10946f8a61b9d.zip
cv2pdb-ea60c263fd7a3d602b01c40654c10946f8a61b9d.tar.gz
cv2pdb-ea60c263fd7a3d602b01c40654c10946f8a61b9d.tar.bz2
Merge pull request #11 from l0calh05t/master
x64 fixes for issue #10
Diffstat (limited to 'src')
-rw-r--r--src/cv2pdb.vcxproj88
-rw-r--r--src/cv2pdb.vcxproj.filters5
-rw-r--r--src/cv2pdb_vs12.sln8
-rw-r--r--src/cvt80to64.asm12
-rw-r--r--src/demangle.cpp8
-rw-r--r--src/mspdb.cpp40
6 files changed, 145 insertions, 16 deletions
diff --git a/src/cv2pdb.vcxproj b/src/cv2pdb.vcxproj
index 7f4bf25..b9cca36 100644
--- a/src/cv2pdb.vcxproj
+++ b/src/cv2pdb.vcxproj
@@ -5,10 +5,18 @@
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{5E2BD27D-446A-4C99-9829-135F7C000D90}</ProjectGuid>
@@ -22,20 +30,38 @@
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <PlatformToolset>v120_xp</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v120_xp</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <PlatformToolset>v120_xp</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
+ <Import Project="$(VCTargetsPath)\BuildCustomizations\masm.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>12.0.21005.1</_ProjectFileVersion>
@@ -45,11 +71,21 @@
<IntDir>..\bin\$(Configuration)\$(ProjectName)\</IntDir>
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>..\bin\$(Configuration)_$(Platform)\</OutDir>
+ <IntDir>..\bin\$(Configuration)_$(Platform)\$(ProjectName)\</IntDir>
+ </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>..\bin\$(Configuration)\</OutDir>
<IntDir>..\bin\$(Configuration)\$(ProjectName)\</IntDir>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>..\bin\$(Configuration)_$(Platform)\</OutDir>
+ <IntDir>..\bin\$(Configuration)_$(Platform)\$(ProjectName)\</IntDir>
+ </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<AdditionalOptions>/wd4996 %(AdditionalOptions)</AdditionalOptions>
@@ -72,6 +108,27 @@
<MinimumRequiredVersion>5.1</MinimumRequiredVersion>
</Link>
</ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <AdditionalOptions>/wd4996 %(AdditionalOptions)</AdditionalOptions>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <TreatWChar_tAsBuiltInType>false</TreatWChar_tAsBuiltInType>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>dbghelp.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Console</SubSystem>
+ <MinimumRequiredVersion>5.1</MinimumRequiredVersion>
+ </Link>
+ </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalOptions>/wd4996 %(AdditionalOptions)</AdditionalOptions>
@@ -96,6 +153,30 @@
<MinimumRequiredVersion>5.1</MinimumRequiredVersion>
</Link>
</ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <AdditionalOptions>/wd4996 %(AdditionalOptions)</AdditionalOptions>
+ <Optimization>MaxSpeed</Optimization>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <TreatWChar_tAsBuiltInType>false</TreatWChar_tAsBuiltInType>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Link>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Console</SubSystem>
+ <OptimizeReferences>true</OptimizeReferences>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <Profile>true</Profile>
+ <MinimumRequiredVersion>5.1</MinimumRequiredVersion>
+ </Link>
+ </ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="cv2pdb.cpp" />
<ClCompile Include="cvutil.cpp" />
@@ -121,7 +202,14 @@
<ClInclude Include="readDwarf.h" />
<ClInclude Include="symutil.h" />
</ItemGroup>
+ <ItemGroup>
+ <MASM Include="cvt80to64.asm">
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+ </MASM>
+ </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
+ <Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" />
</ImportGroup>
</Project> \ No newline at end of file
diff --git a/src/cv2pdb.vcxproj.filters b/src/cv2pdb.vcxproj.filters
index 76247b2..87f8a84 100644
--- a/src/cv2pdb.vcxproj.filters
+++ b/src/cv2pdb.vcxproj.filters
@@ -73,4 +73,9 @@
<Filter>Source Files</Filter>
</ClInclude>
</ItemGroup>
+ <ItemGroup>
+ <MASM Include="cvt80to64.asm">
+ <Filter>Source Files</Filter>
+ </MASM>
+ </ItemGroup>
</Project> \ No newline at end of file
diff --git a/src/cv2pdb_vs12.sln b/src/cv2pdb_vs12.sln
index 7cdaa57..f41fc4d 100644
--- a/src/cv2pdb_vs12.sln
+++ b/src/cv2pdb_vs12.sln
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
-VisualStudioVersion = 12.0.21005.1
+VisualStudioVersion = 12.0.30501.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{7F4A9B6A-05A2-45D0-AFC3-3754B7FB77B9}"
ProjectSection(SolutionItems) = preProject
@@ -44,10 +44,12 @@ Global
{5E2BD27D-446A-4C99-9829-135F7C000D90}.Debug GDC|x64.ActiveCfg = Debug|Win32
{5E2BD27D-446A-4C99-9829-135F7C000D90}.Debug|Win32.ActiveCfg = Debug|Win32
{5E2BD27D-446A-4C99-9829-135F7C000D90}.Debug|Win32.Build.0 = Debug|Win32
- {5E2BD27D-446A-4C99-9829-135F7C000D90}.Debug|x64.ActiveCfg = Debug|Win32
+ {5E2BD27D-446A-4C99-9829-135F7C000D90}.Debug|x64.ActiveCfg = Debug|x64
+ {5E2BD27D-446A-4C99-9829-135F7C000D90}.Debug|x64.Build.0 = Debug|x64
{5E2BD27D-446A-4C99-9829-135F7C000D90}.Release|Win32.ActiveCfg = Release|Win32
{5E2BD27D-446A-4C99-9829-135F7C000D90}.Release|Win32.Build.0 = Release|Win32
- {5E2BD27D-446A-4C99-9829-135F7C000D90}.Release|x64.ActiveCfg = Release|Win32
+ {5E2BD27D-446A-4C99-9829-135F7C000D90}.Release|x64.ActiveCfg = Release|x64
+ {5E2BD27D-446A-4C99-9829-135F7C000D90}.Release|x64.Build.0 = Release|x64
{5E2BD27D-446A-4C99-9829-135F7C000D90}.Win32 COFF|Win32.ActiveCfg = Debug|Win32
{5E2BD27D-446A-4C99-9829-135F7C000D90}.Win32 COFF|Win32.Build.0 = Debug|Win32
{5E2BD27D-446A-4C99-9829-135F7C000D90}.Win32 COFF|x64.ActiveCfg = Release|Win32
diff --git a/src/cvt80to64.asm b/src/cvt80to64.asm
new file mode 100644
index 0000000..70a5128
--- /dev/null
+++ b/src/cvt80to64.asm
@@ -0,0 +1,12 @@
+_TEXT SEGMENT
+
+PUBLIC cvt80to64
+
+cvt80to64 PROC
+ fld tbyte ptr [rcx]
+ fstp qword ptr [rdx]
+ ret 0
+cvt80to64 ENDP
+
+_TEXT ENDS
+END \ No newline at end of file
diff --git a/src/demangle.cpp b/src/demangle.cpp
index 8fa3053..a2a4c13 100644
--- a/src/demangle.cpp
+++ b/src/demangle.cpp
@@ -18,6 +18,10 @@
#include "symutil.h"
+#ifdef _M_X64
+extern "C" void cvt80to64(void * in, long double * out);
+#endif
+
#define USE_STDSTRING 1
#if USE_STDSTRING
@@ -458,10 +462,14 @@ public:
p[i] = b;
}
// extract 10-byte double from rdata
+#ifdef _M_X64
+ cvt80to64(rdata, &r);
+#else
__asm {
fld TBYTE PTR rdata;
fstp r;
}
+#endif
char num[30];
sprintf(num, "%g", r);
diff --git a/src/mspdb.cpp b/src/mspdb.cpp
index e0e38ee..fbb9434 100644
--- a/src/mspdb.cpp
+++ b/src/mspdb.cpp
@@ -45,13 +45,19 @@ void tryLoadLibrary(const char* mspdb)
modMsPdb = NULL;
}
+#if _M_X64
+#define KEY_OPEN_FLAGS KEY_QUERY_VALUE | KEY_WOW64_32KEY
+#else
+#define KEY_OPEN_FLAGS KEY_QUERY_VALUE
+#endif
+
bool getInstallDir(const char* version, char* installDir, DWORD size)
{
char key[260] = "SOFTWARE\\Microsoft\\";
strcat(key, version);
HKEY hkey;
- if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, key, 0, KEY_QUERY_VALUE, &hkey) != ERROR_SUCCESS)
+ if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, key, 0, KEY_OPEN_FLAGS, &hkey) != ERROR_SUCCESS)
return false;
bool rc = RegQueryValueExA(hkey, "InstallDir", 0, 0, (LPBYTE)installDir, &size) == ERROR_SUCCESS;
@@ -75,19 +81,27 @@ bool tryLoadMsPdb(const char* version, const char* mspdb, const char* path = 0)
return modMsPdb != 0;
}
+#ifdef _M_X64
+#define BIN_DIR_GE_VS12 "..\\..\\VC\\bin\\amd64\\"
+#define BIN_DIR_LT_VS12 BIN_DIR_GE_VS12
+#else
+#define BIN_DIR_GE_VS12 "..\\..\\VC\\bin\\"
+#define BIN_DIR_LT_VS12 0
+#endif
+
void tryLoadMsPdb80(bool throughPath)
{
if (!modMsPdb && throughPath)
tryLoadLibrary(mspdb80_dll);
if (!modMsPdb && !throughPath)
- tryLoadMsPdb("VisualStudio\\9.0", mspdb80_dll);
+ tryLoadMsPdb("VisualStudio\\9.0", mspdb80_dll, BIN_DIR_LT_VS12);
if (!modMsPdb && !throughPath)
- tryLoadMsPdb("VisualStudio\\8.0", mspdb80_dll);
+ tryLoadMsPdb("VisualStudio\\8.0", mspdb80_dll, BIN_DIR_LT_VS12);
if (!modMsPdb && !throughPath)
- tryLoadMsPdb("VCExpress\\9.0", mspdb80_dll);
+ tryLoadMsPdb("VCExpress\\9.0", mspdb80_dll, BIN_DIR_LT_VS12);
if (!modMsPdb && !throughPath)
- tryLoadMsPdb("VCExpress\\8.0", mspdb80_dll);
+ tryLoadMsPdb("VCExpress\\8.0", mspdb80_dll, BIN_DIR_LT_VS12);
}
void tryLoadMsPdb100(bool throughPath)
@@ -97,9 +111,9 @@ void tryLoadMsPdb100(bool throughPath)
if(throughPath)
modMsPdb = LoadLibraryA(mspdb100_dll);
if (!modMsPdb && !throughPath)
- tryLoadMsPdb("VisualStudio\\10.0", mspdb100_dll);
+ tryLoadMsPdb("VisualStudio\\10.0", mspdb100_dll, BIN_DIR_LT_VS12);
if (!modMsPdb && !throughPath)
- tryLoadMsPdb("VCExpress\\10.0", mspdb100_dll);
+ tryLoadMsPdb("VCExpress\\10.0", mspdb100_dll, BIN_DIR_LT_VS12);
if (modMsPdb)
mspdb::vsVersion = 10;
}
@@ -112,9 +126,9 @@ void tryLoadMsPdb110(bool throughPath)
if (throughPath)
modMsPdb = LoadLibraryA(mspdb110_dll);
if (!modMsPdb && !throughPath)
- tryLoadMsPdb("VisualStudio\\11.0", mspdb110_dll);
+ tryLoadMsPdb("VisualStudio\\11.0", mspdb110_dll, BIN_DIR_LT_VS12);
if (!modMsPdb && !throughPath)
- tryLoadMsPdb("VSWinExpress\\11.0", mspdb110_dll);
+ tryLoadMsPdb("VSWinExpress\\11.0", mspdb110_dll, BIN_DIR_LT_VS12);
if (modMsPdb)
mspdb::vsVersion = 11;
}
@@ -127,9 +141,9 @@ void tryLoadMsPdb120(bool throughPath)
if(throughPath)
modMsPdb = LoadLibraryA(mspdb120_dll);
if (!modMsPdb && !throughPath)
- tryLoadMsPdb("VisualStudio\\12.0", mspdb120_dll, "..\\..\\VC\\bin\\");
+ tryLoadMsPdb("VisualStudio\\12.0", mspdb120_dll, BIN_DIR_GE_VS12);
if (!modMsPdb && !throughPath)
- tryLoadMsPdb("VSWinExpress\\12.0", mspdb120_dll, "..\\..\\VC\\bin\\");
+ tryLoadMsPdb("VSWinExpress\\12.0", mspdb120_dll, BIN_DIR_GE_VS12);
if (modMsPdb)
mspdb::vsVersion = 12;
}
@@ -142,9 +156,9 @@ void tryLoadMsPdb140(bool throughPath)
if(throughPath)
modMsPdb = LoadLibraryA(mspdb140_dll);
if (!modMsPdb && !throughPath)
- tryLoadMsPdb("VisualStudio\\14.0", mspdb140_dll, "..\\..\\VC\\bin\\");
+ tryLoadMsPdb("VisualStudio\\14.0", mspdb140_dll, BIN_DIR_GE_VS12);
if (!modMsPdb && !throughPath)
- tryLoadMsPdb("VSWinExpress\\14.0", mspdb140_dll, "..\\..\\VC\\bin\\");
+ tryLoadMsPdb("VSWinExpress\\14.0", mspdb140_dll, BIN_DIR_GE_VS12);
if (modMsPdb)
mspdb::vsVersion = 14;
}