Added better debug
Now triggers a breakpoint when a function fails
This commit is contained in:
@@ -1,44 +0,0 @@
|
|||||||
{
|
|
||||||
"version": 3,
|
|
||||||
|
|
||||||
"configurePresets": [
|
|
||||||
{
|
|
||||||
"name": "windows-base",
|
|
||||||
"hidden": true,
|
|
||||||
"generator": "Ninja",
|
|
||||||
"binaryDir": "${sourceDir}/out/build/${presetName}",
|
|
||||||
"installDir": "${sourceDir}/out/install/${presetName}",
|
|
||||||
"cacheVariables": {
|
|
||||||
"CMAKE_C_COMPILER": "cl.exe",
|
|
||||||
"CMAKE_CXX_COMPILER": "cl.exe"
|
|
||||||
},
|
|
||||||
"condition": {
|
|
||||||
"type": "equals",
|
|
||||||
"lhs": "${hostSystemName}",
|
|
||||||
"rhs": "Windows"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
"name": "x64-debug",
|
|
||||||
"displayName": "x64 Debug",
|
|
||||||
"inherits": "windows-base",
|
|
||||||
"architecture": {
|
|
||||||
"value": "x64",
|
|
||||||
"strategy": "external"
|
|
||||||
},
|
|
||||||
"cacheVariables": {
|
|
||||||
"CMAKE_BUILD_TYPE": "Debug"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
"name": "x64-release",
|
|
||||||
"displayName": "x64 Release",
|
|
||||||
"inherits": "x64-debug",
|
|
||||||
"cacheVariables": {
|
|
||||||
"CMAKE_BUILD_TYPE": "Release"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
15
CMakeSettings.json
Normal file
15
CMakeSettings.json
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "x64-Debug",
|
||||||
|
"generator": "Ninja",
|
||||||
|
"configurationType": "Debug",
|
||||||
|
"inheritEnvironments": [ "msvc_x64_x64" ],
|
||||||
|
"buildRoot": "${projectDir}\\out\\build\\${name}",
|
||||||
|
"installRoot": "${projectDir}\\out\\install\\${name}",
|
||||||
|
"cmakeCommandArgs": "",
|
||||||
|
"buildCommandArgs": "",
|
||||||
|
"ctestCommandArgs": ""
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -1,13 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
// Platform specific includes //
|
#include <OS.h>
|
||||||
#ifdef _WIN32
|
|
||||||
#define NOMINMAX
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
|
||||||
#include <Windows.h>
|
|
||||||
#else
|
|
||||||
#error "Code is currently only supported on Win32"
|
|
||||||
#endif // _WIN32
|
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
|
|||||||
10
Common/OS.h
Normal file
10
Common/OS.h
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
// Platform specific includes //
|
||||||
|
#ifdef _WIN32
|
||||||
|
#define NOMINMAX
|
||||||
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#include <Windows.h>
|
||||||
|
#else
|
||||||
|
#error "Code is currently only supported on Win32"
|
||||||
|
#endif // _WIN32
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <OS.h>
|
||||||
|
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
@@ -11,6 +13,14 @@ namespace LXC::Util
|
|||||||
explicit FunctionFail(ErrorType _err)
|
explicit FunctionFail(ErrorType _err)
|
||||||
: error(_err)
|
: error(_err)
|
||||||
{
|
{
|
||||||
|
// Only checks for a debugger when compiled in Debug mode //
|
||||||
|
#ifdef _DEBUG
|
||||||
|
|
||||||
|
// Triggers a breakpoint when a debugger is attached as a function has failed //
|
||||||
|
if (IsDebuggerPresent())
|
||||||
|
DebugBreak();
|
||||||
|
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorType error;
|
ErrorType error;
|
||||||
|
|||||||
Reference in New Issue
Block a user