Browse Source

Merge pull request #2 from zrax/posix_debugging

POSIX Debugging
Darryl Pogue 10 years ago
parent
commit
c1e50a96f8
  1. 11
      Sources/Plasma/CoreLib/HeadSpin.cpp
  2. 4
      Sources/Plasma/CoreLib/HeadSpin.h
  3. 4
      Sources/Plasma/PubUtilLib/plFile/plSecureStream.cpp
  4. 7
      cmake/CompilerChecks.cmake

11
Sources/Plasma/CoreLib/HeadSpin.cpp

@ -93,15 +93,14 @@ void hsDebugMessage (const char* message, long val)
gHSDebugProc(&s[1]);
else
#if HS_BUILD_FOR_WIN32
{ OutputDebugString(&s[1]);
{
OutputDebugString(&s[1]);
OutputDebugString("\n");
}
#elif HS_BUILD_FOR_UNIX
{ fprintf(stderr, "%s\n", &s[1]);
// hsThrow(&s[1]);
}
#else
hsThrow(&s[1]);
{
fprintf(stderr, "%s\n", &s[1]);
}
#endif
}
#endif

4
Sources/Plasma/CoreLib/HeadSpin.h

@ -45,9 +45,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// Ensure these get set consistently regardless of what module includes it
#include "hsCompilerSpecific.h"
#if (defined(_DEBUG) || defined(UNIX_DEBUG))
#if defined(_DEBUG)
# define HS_DEBUGGING
#endif // defined(_DEBUG) || defined(UNIX_DENUG)
#endif
//======================================
// Some standard includes

4
Sources/Plasma/PubUtilLib/plFile/plSecureStream.cpp

@ -48,6 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "hsSTLStream.h"
#if !HS_BUILD_FOR_WIN32
#include <errno.h>
#define INVALID_HANDLE_VALUE 0
#endif
@ -325,9 +326,10 @@ uint32_t plSecureStream::IRead(uint32_t bytes, void* buffer)
}
else
{
// TODO: errno equivalent for *nix
#if HS_BUILD_FOR_WIN32
hsDebugMessage("Error on Windows read", GetLastError());
#else
hsDebugMessage("Error on POSIX read", errno);
#endif
}
}

7
cmake/CompilerChecks.cmake

@ -11,6 +11,13 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX)
endif()
endif()
# MSVC automatically defines -D_DEBUG when /MTd or /MDd is set, so we
# need to make sure it gets added for other compilers too
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG")
endif()
# Compile-time type size checks
include(CheckTypeSize)

Loading…
Cancel
Save