Skip to content

Commit

Permalink
boost::uuids::uuid visualizer fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
KindDragon committed Sep 13, 2014
1 parent f7332f6 commit 669bb31
Show file tree
Hide file tree
Showing 18 changed files with 365 additions and 88 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Debug/
Release/
obj/
ipch/*
_ReSharper.*/
*.sdf
*.suo
Expand Down
22 changes: 21 additions & 1 deletion CPPDebuggerVisualizers.VS2013.sln
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.30110.0
VisualStudioVersion = 12.0.30723.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BoostTest", "Tests\BoostTest\BoostTest.vcxproj", "{48A389F6-E2E8-4318-8DB5-65DB8206BA6B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{074968F7-C3B2-4F5C-8F6F-D8F46582267C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CPPDebuggerVisualizers.VS2013", "VS2013\CPPDebuggerVisualizers.VS2013.csproj", "{D97ABE0D-8F29-4728-8A3F-FF63F42E6A87}"
ProjectSection(ProjectDependencies) = postProject
{A1C04A4B-8BDE-48B6-9106-CADC8D39C99C} = {A1C04A4B-8BDE-48B6-9106-CADC8D39C99C}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BoostTest.VS2013", "Tests\BoostTest\BoostTest.VS2013.vcxproj", "{26925C3F-9C66-44B9-A0A2-7E53D13C5BA4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CPPDebuggerVisualizers.VS2012", "VS2012\CPPDebuggerVisualizers.VS2012.csproj", "{6D42FE63-9BF1-4966-AE17-A8C9A112AC53}"
ProjectSection(ProjectDependencies) = postProject
{A1C04A4B-8BDE-48B6-9106-CADC8D39C99C} = {A1C04A4B-8BDE-48B6-9106-CADC8D39C99C}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CPPDebuggerVisualizersNatvisAddIn", "CPPDebuggerVisualizersNatvisAddIn\CPPDebuggerVisualizersNatvisAddIn.vcxproj", "{A1C04A4B-8BDE-48B6-9106-CADC8D39C99C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -77,6 +85,18 @@ Global
{6D42FE63-9BF1-4966-AE17-A8C9A112AC53}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{6D42FE63-9BF1-4966-AE17-A8C9A112AC53}.Release|Win32.ActiveCfg = Release|Any CPU
{6D42FE63-9BF1-4966-AE17-A8C9A112AC53}.Release|x64.ActiveCfg = Release|Any CPU
{A1C04A4B-8BDE-48B6-9106-CADC8D39C99C}.Debug|Any CPU.ActiveCfg = Debug|Win32
{A1C04A4B-8BDE-48B6-9106-CADC8D39C99C}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
{A1C04A4B-8BDE-48B6-9106-CADC8D39C99C}.Debug|Mixed Platforms.Build.0 = Debug|Win32
{A1C04A4B-8BDE-48B6-9106-CADC8D39C99C}.Debug|Win32.ActiveCfg = Debug|Win32
{A1C04A4B-8BDE-48B6-9106-CADC8D39C99C}.Debug|Win32.Build.0 = Debug|Win32
{A1C04A4B-8BDE-48B6-9106-CADC8D39C99C}.Debug|x64.ActiveCfg = Debug|Win32
{A1C04A4B-8BDE-48B6-9106-CADC8D39C99C}.Release|Any CPU.ActiveCfg = Release|Win32
{A1C04A4B-8BDE-48B6-9106-CADC8D39C99C}.Release|Mixed Platforms.ActiveCfg = Release|Win32
{A1C04A4B-8BDE-48B6-9106-CADC8D39C99C}.Release|Mixed Platforms.Build.0 = Release|Win32
{A1C04A4B-8BDE-48B6-9106-CADC8D39C99C}.Release|Win32.ActiveCfg = Release|Win32
{A1C04A4B-8BDE-48B6-9106-CADC8D39C99C}.Release|Win32.Build.0 = Release|Win32
{A1C04A4B-8BDE-48B6-9106-CADC8D39C99C}.Release|x64.ActiveCfg = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#include "stdafx.h"
#include <string>
#include <algorithm>
#include <windows.h>
#include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_io.hpp>

#define ADDIN_API __declspec(dllexport)

typedef struct tagDEBUGHELPER
{
DWORD dwVersion;
HRESULT(WINAPI *ReadDebuggeeMemory)(struct tagDEBUGHELPER *pThis, DWORD dwAddr, DWORD nWant, VOID* pWhere, DWORD *nGot);
// from here only when dwVersion >= 0x20000
DWORDLONG(WINAPI *GetRealAddress)(struct tagDEBUGHELPER *pThis);
HRESULT(WINAPI *ReadDebuggeeMemoryEx)(struct tagDEBUGHELPER *pThis, DWORDLONG qwAddr, DWORD nWant, VOID* pWhere, DWORD *nGot);
int (WINAPI *GetProcessorType)(struct tagDEBUGHELPER *pThis);
} DEBUGHELPER;

typedef HRESULT(WINAPI *CUSTOMVIEWER)(DWORD dwAddress, DEBUGHELPER *pHelper, int nBase, BOOL bUniStrings, char *pResult, size_t max, DWORD reserved);

extern "C" ADDIN_API HRESULT BoostUuidFormatter(DWORD dwAddress, DEBUGHELPER *pHelper, int nBase, BOOL bUniStrings, char *pResult, size_t max, DWORD reserved);

ADDIN_API HRESULT BoostUuidFormatter(DWORD dwAddress, DEBUGHELPER *pHelper, int nBase, BOOL bUniStrings, char *pResult, size_t max, DWORD reserved)
{
char uuid_data[16];
DWORD bytesRead;
HRESULT hr = pHelper->ReadDebuggeeMemoryEx(pHelper, pHelper->GetRealAddress(pHelper), sizeof(uuid_data), &uuid_data, &bytesRead);
if (FAILED(hr))
return hr;

boost::uuids::uuid uuid;
memcpy(&uuid, uuid_data, std::min<DWORD>(bytesRead, 16));
std::string str = "{" + boost::uuids::to_string(uuid) + "}";
sprintf_s(pResult, max, str.c_str());
return S_OK;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// The following ifdef block is the standard way of creating macros which make exporting
// from a DLL simpler. All files within this DLL are compiled with the CPPDEBUGGERVISUALIZERSNATVISADDIN_EXPORTS
// symbol defined on the command line. This symbol should not be defined on any project
// that uses this DLL. This way any other project whose source files include this file see
// ADDIN_API functions as being imported from a DLL, whereas this DLL sees symbols
// defined with this macro as being exported.
#ifdef CPPDEBUGGERVISUALIZERSNATVISADDIN_EXPORTS
#define ADDIN_API __declspec(dllexport)
#else
#define ADDIN_API __declspec(dllimport)
#endif

// This class is exported from the CPPDebuggerVisualizersNatvisAddIn.dll
class ADDIN_API CCPPDebuggerVisualizersNatvisAddIn {
public:
CCPPDebuggerVisualizersNatvisAddIn(void);
// TODO: add your methods here.
};

extern ADDIN_API int nCPPDebuggerVisualizersNatvisAddIn;

ADDIN_API int fnCPPDebuggerVisualizersNatvisAddIn(void);
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{A1C04A4B-8BDE-48B6-9106-CADC8D39C99C}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>CPPDebuggerVisualizersNatvisAddIn</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120_xp</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120_xp</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(Configuration)\$(Platform)\</OutDir>
<IntDir>$(Configuration)\$(Platform)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(Configuration)\$(Platform)\</OutDir>
<IntDir>$(Configuration)\$(Platform)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;NOMINMAX;_DEBUG;_WINDOWS;_USRDLL;CPPDEBUGGERVISUALIZERSNATVISADDIN_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<AdditionalIncludeDirectories>c:\Work\boost\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>c:\Work\boost\stage\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>Use</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NOMINMAX;NDEBUG;_WINDOWS;_USRDLL;CPPDEBUGGERVISUALIZERSNATVISADDIN_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<AdditionalIncludeDirectories>c:\Work\boost\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalLibraryDirectories>c:\Work\boost\stage\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="CPPDebuggerVisualizersNatvisAddIn.h" />
<ClInclude Include="stdafx.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="CPPDebuggerVisualizersNatvisAddIn.cpp" />
<ClCompile Include="dllmain.cpp">
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsManaged>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsManaged>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="CPPDebuggerVisualizersNatvisAddIn.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="CPPDebuggerVisualizersNatvisAddIn.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="dllmain.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>
19 changes: 19 additions & 0 deletions CPPDebuggerVisualizersNatvisAddIn/dllmain.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// dllmain.cpp : Defines the entry point for the DLL application.
#include "stdafx.h"

BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}

8 changes: 8 additions & 0 deletions CPPDebuggerVisualizersNatvisAddIn/stdafx.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// stdafx.cpp : source file that includes just the standard includes
// CPPDebuggerVisualizersNatvisAddIn.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information

#include "stdafx.h"

// TODO: reference any additional headers you need in STDAFX.H
// and not in this file
10 changes: 10 additions & 0 deletions CPPDebuggerVisualizersNatvisAddIn/stdafx.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//

#pragma once

#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
// Windows Header Files:
#include <windows.h>
5 changes: 5 additions & 0 deletions Changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ Legend:
* Changed
! Fixed

1.0.16 - 14.09.2014
=========================
+ Add visualization of boost::variant<over_sequence<MPL vectors... > > (Antony Polukhin)
! boost::uuids::uuid visualizer fixed

1.0.15 - 23.03.2014
=========================
+ Support changed boost::container::* and boost::intrusive::* in boost 1.55
Expand Down
8 changes: 4 additions & 4 deletions Tests/BoostTest/BoostTest.VS2013.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(Configuration)\$(Platform)\</OutDir>
<IntDir>$(Configuration)\$(Platform)\</IntDir>
<OutDir>$(Configuration)\$(PlatformToolset)-$(Platform)\</OutDir>
<IntDir>$(Configuration)\$(PlatformToolset)-$(Platform)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
Expand All @@ -79,8 +79,8 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(Configuration)\$(Platform)\</OutDir>
<IntDir>$(Configuration)\$(Platform)\</IntDir>
<OutDir>$(Configuration)\$(PlatformToolset)-$(Platform)\</OutDir>
<IntDir>$(Configuration)\$(PlatformToolset)-$(Platform)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
Expand Down
14 changes: 3 additions & 11 deletions Tests/BoostTest/BoostTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <boost/logic/tribool.hpp>
#include <boost/chrono.hpp>
#include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_generators.hpp>
#include <boost/circular_buffer.hpp>
#include <boost/filesystem.hpp>
#include <boost/intrusive/list.hpp>
Expand Down Expand Up @@ -596,10 +597,6 @@ int main(int argc, const char* argv[])

auto tupl = boost::make_tuple(1, "terterwt", true);

unsigned char uuid_data[16];
// fill uuid_data

boost::uuids::uuid u;
std::pair<int const, bool> p1;
std::pair<int const, s> p2;
std::pair<int const, const s> p3;
Expand All @@ -609,13 +606,8 @@ int main(int argc, const char* argv[])
std::pair<int const, boost::unordered_set<int>> p7;
std::pair<int const, std::unique_ptr<s>> p8;

boost::uuids::uuid u2 =
{ 0x12 ,0x34, 0x56, 0x78
, 0x90, 0xab
, 0xcd, 0xef
, 0x12, 0x34
, 0x56, 0x78, 0x90, 0xab, 0xcd, 0xef
};
boost::uuids::string_generator gen;
boost::uuids::uuid u1 = gen("{92EC2A54-C1FA-42CB-B9F9-2602D507AD17}");

TestPointerContainerLibrary();

Expand Down
4 changes: 4 additions & 0 deletions VS2012/CPPDebuggerVisualizers.VS2012.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<Content Include="Visualizers\CPPDebuggerVisualizersNatvisAddIn.dll">
<IncludeInVSIX>true</IncludeInVSIX>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Visualizers\directx.natvis">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<IncludeInVSIX>true</IncludeInVSIX>
Expand Down
2 changes: 1 addition & 1 deletion VS2012/Visualizers/boost.natvis
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,6 @@
</Type>

<Type Name="boost::uuids::uuid">
<DisplayString>{*(_GUID*)this}</DisplayString>
<DisplayString LegacyAddin="CPPDebuggerVisualizersNatvisAddIn.dll" Export="BoostUuidFormatter"></DisplayString>
</Type>
</AutoVisualizer>
Loading

0 comments on commit 669bb31

Please sign in to comment.