mirror of https://github.com/Icinga/icinga2.git
parent
28d7051aed
commit
97168378e8
|
@ -149,10 +149,8 @@ if(NOT HAVE_COUNTER_MACRO AND ICINGA2_UNITY_BUILD)
|
|||
set(ICINGA2_UNITY_BUILD FALSE)
|
||||
endif()
|
||||
|
||||
if(NOT MSVC)
|
||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG")
|
||||
endif()
|
||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DI2_DEBUG")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DI2_DEBUG")
|
||||
|
||||
check_function_exists(vfork HAVE_VFORK)
|
||||
check_function_exists(backtrace_symbols HAVE_BACKTRACE_SYMBOLS)
|
||||
|
|
|
@ -277,9 +277,9 @@ int Main(void)
|
|||
std::cout << appName << " " << "- The Icinga 2 network monitoring daemon (version: "
|
||||
<< ConsoleColorTag(vm.count("version") ? Console_ForegroundRed : Console_Normal)
|
||||
<< Application::GetVersion()
|
||||
#ifdef _DEBUG
|
||||
#ifdef I2_DEBUG
|
||||
<< "; debug"
|
||||
#endif /* _DEBUG */
|
||||
#endif /* I2_DEBUG */
|
||||
<< ConsoleColorTag(Console_Normal)
|
||||
<< ")" << std::endl << std::endl;
|
||||
|
||||
|
|
|
@ -110,11 +110,11 @@ void Application::Exit(int rc)
|
|||
|
||||
UninitializeBase();
|
||||
|
||||
#ifdef _DEBUG
|
||||
#ifdef I2_DEBUG
|
||||
exit(rc);
|
||||
#else /* _DEBUG */
|
||||
#else /* I2_DEBUG */
|
||||
_exit(rc); // Yay, our static destructors are pretty much beyond repair at this point.
|
||||
#endif /* _DEBUG */
|
||||
#endif /* I2_DEBUG */
|
||||
}
|
||||
|
||||
void Application::InitializeBase(void)
|
||||
|
@ -128,10 +128,10 @@ void Application::InitializeBase(void)
|
|||
maxfds = 65536;
|
||||
|
||||
for (rlim_t i = 3; i < maxfds; i++) {
|
||||
#ifdef _DEBUG
|
||||
#ifdef I2_DEBUG
|
||||
if (close(i) >= 0)
|
||||
std::cerr << "Closed FD " << i << " which we inherited from our parent process." << std::endl;
|
||||
#endif /* _DEBUG */
|
||||
#endif /* I2_DEBUG */
|
||||
}
|
||||
}
|
||||
#endif /* _WIN32 */
|
||||
|
|
|
@ -22,11 +22,11 @@
|
|||
|
||||
#include "i2-base.hpp"
|
||||
|
||||
#ifndef _DEBUG
|
||||
#ifndef I2_DEBUG
|
||||
# define ASSERT(expr) ((void)0)
|
||||
#else /* _DEBUG */
|
||||
#else /* I2_DEBUG */
|
||||
# define ASSERT(expr) ((expr) ? 0 : icinga_assert_fail(#expr, __FILE__, __LINE__))
|
||||
#endif /* _DEBUG */
|
||||
#endif /* I2_DEBUG */
|
||||
|
||||
#define VERIFY(expr) ((expr) ? 0 : icinga_assert_fail(#expr, __FILE__, __LINE__))
|
||||
|
||||
|
|
|
@ -289,10 +289,10 @@ void DynamicObject::RestoreObject(const String& message, int attributeTypes)
|
|||
return;
|
||||
|
||||
ASSERT(!object->IsActive());
|
||||
#ifdef _DEBUG
|
||||
#ifdef I2_DEBUG
|
||||
Log(LogDebug, "DynamicObject")
|
||||
<< "Restoring object '" << name << "' of type '" << type << "'.";
|
||||
#endif /* _DEBUG */
|
||||
#endif /* I2_DEBUG */
|
||||
Dictionary::Ptr update = persistentObject->Get("update");
|
||||
Deserialize(object, update, false, attributeTypes);
|
||||
object->OnStateLoaded();
|
||||
|
|
|
@ -32,9 +32,9 @@ REGISTER_PRIMITIVE_TYPE(Object, Object::GetPrototype());
|
|||
*/
|
||||
Object::Object(void)
|
||||
: m_References(0)
|
||||
#ifdef _DEBUG
|
||||
#ifdef I2_DEBUG
|
||||
, m_LockOwner(0)
|
||||
#endif /* _DEBUG */
|
||||
#endif /* I2_DEBUG */
|
||||
{ }
|
||||
|
||||
/**
|
||||
|
@ -51,7 +51,7 @@ String Object::ToString(void) const
|
|||
return "Object of type '" + Utility::GetTypeName(typeid(*this)) + "'";
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
#ifdef I2_DEBUG
|
||||
/**
|
||||
* Checks if the calling thread owns the lock on this object.
|
||||
*
|
||||
|
@ -69,7 +69,7 @@ bool Object::OwnsLock(void) const
|
|||
return (tid == pthread_self());
|
||||
#endif /* _WIN32 */
|
||||
}
|
||||
#endif /* _DEBUG */
|
||||
#endif /* I2_DEBUG */
|
||||
|
||||
void Object::InflateMutex(void)
|
||||
{
|
||||
|
|
|
@ -25,11 +25,11 @@
|
|||
#include "base/thinmutex.hpp"
|
||||
#include <boost/thread/thread.hpp>
|
||||
|
||||
#ifndef _DEBUG
|
||||
#ifndef I2_DEBUG
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#else /* _DEBUG */
|
||||
#else /* I2_DEBUG */
|
||||
#include <boost/thread/recursive_mutex.hpp>
|
||||
#endif /* _DEBUG */
|
||||
#endif /* I2_DEBUG */
|
||||
|
||||
#include <boost/smart_ptr/intrusive_ptr.hpp>
|
||||
|
||||
|
@ -98,9 +98,9 @@ public:
|
|||
virtual void SetField(int id, const Value& value);
|
||||
virtual Value GetField(int id) const;
|
||||
|
||||
#ifdef _DEBUG
|
||||
#ifdef I2_DEBUG
|
||||
bool OwnsLock(void) const;
|
||||
#endif /* _DEBUG */
|
||||
#endif /* I2_DEBUG */
|
||||
|
||||
void InflateMutex(void);
|
||||
|
||||
|
@ -113,13 +113,13 @@ private:
|
|||
uintptr_t m_References;
|
||||
mutable ThinMutex m_Mutex;
|
||||
|
||||
#ifdef _DEBUG
|
||||
#ifdef I2_DEBUG
|
||||
# ifndef _WIN32
|
||||
mutable pthread_t m_LockOwner;
|
||||
# else /* _WIN32 */
|
||||
mutable DWORD m_LockOwner;
|
||||
# endif /* _WIN32 */
|
||||
#endif /* _DEBUG */
|
||||
#endif /* I2_DEBUG */
|
||||
|
||||
friend struct ObjectLock;
|
||||
|
||||
|
|
|
@ -61,18 +61,18 @@ public:
|
|||
m_Object->m_Mutex.Lock();
|
||||
m_Locked = true;
|
||||
|
||||
#ifdef _DEBUG
|
||||
#ifdef I2_DEBUG
|
||||
# ifdef _WIN32
|
||||
InterlockedExchange(&m_Object->m_LockOwner, GetCurrentThreadId());
|
||||
# else /* _WIN32 */
|
||||
__sync_lock_test_and_set(&m_Object->m_LockOwner, pthread_self());
|
||||
# endif /* _WIN32 */
|
||||
#endif /* _DEBUG */
|
||||
#endif /* I2_DEBUG */
|
||||
}
|
||||
|
||||
inline void Unlock(void)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
#ifdef I2_DEBUG
|
||||
if (m_Locked) {
|
||||
# ifdef _WIN32
|
||||
InterlockedExchange(&m_Object->m_LockOwner, 0);
|
||||
|
@ -80,7 +80,7 @@ public:
|
|||
__sync_lock_release(&m_Object->m_LockOwner);
|
||||
# endif /* _WIN32 */
|
||||
}
|
||||
#endif /* _DEBUG */
|
||||
#endif /* I2_DEBUG */
|
||||
|
||||
if (m_Locked) {
|
||||
m_Object->m_Mutex.Unlock();
|
||||
|
|
|
@ -117,13 +117,13 @@ void ThreadPool::WorkerThread::ThreadProc(Queue& queue)
|
|||
|
||||
double st = Utility::GetTime();;
|
||||
|
||||
#ifdef _DEBUG
|
||||
#ifdef I2_DEBUG
|
||||
# ifdef RUSAGE_THREAD
|
||||
struct rusage usage_start, usage_end;
|
||||
|
||||
(void) getrusage(RUSAGE_THREAD, &usage_start);
|
||||
# endif /* RUSAGE_THREAD */
|
||||
#endif /* _DEBUG */
|
||||
#endif /* I2_DEBUG */
|
||||
|
||||
try {
|
||||
if (wi.Callback)
|
||||
|
@ -147,7 +147,7 @@ void ThreadPool::WorkerThread::ThreadProc(Queue& queue)
|
|||
queue.TaskCount++;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
#ifdef I2_DEBUG
|
||||
# ifdef RUSAGE_THREAD
|
||||
(void) getrusage(RUSAGE_THREAD, &usage_end);
|
||||
|
||||
|
@ -173,7 +173,7 @@ void ThreadPool::WorkerThread::ThreadProc(Queue& queue)
|
|||
<< "Event call took " << (et - st) << "s";
|
||||
# endif /* RUSAGE_THREAD */
|
||||
}
|
||||
#endif /* _DEBUG */
|
||||
#endif /* I2_DEBUG */
|
||||
}
|
||||
|
||||
boost::mutex::scoped_lock lock(queue.Mutex);
|
||||
|
|
|
@ -319,9 +319,9 @@ int DaemonCommand::Run(const po::variables_map& vm, const std::vector<std::strin
|
|||
|
||||
Log(LogInformation, "cli")
|
||||
<< "Icinga application loader (version: " << Application::GetVersion()
|
||||
#ifdef _DEBUG
|
||||
#ifdef I2_DEBUG
|
||||
<< "; debug"
|
||||
#endif /* _DEBUG */
|
||||
#endif /* I2_DEBUG */
|
||||
<< ")";
|
||||
|
||||
String appType = LoadAppType(Application::GetApplicationType());
|
||||
|
|
|
@ -263,10 +263,10 @@ int PkiUtility::RequestCertificate(const String& host, const String& port, const
|
|||
|
||||
if (response && response->Contains("error")) {
|
||||
Log(LogCritical, "cli", "Could not fetch valid response. Please check the master log (notice or debug).");
|
||||
#ifdef _DEBUG
|
||||
#ifdef I2_DEBUG
|
||||
/* we shouldn't expose master errors to the user in production environments */
|
||||
Log(LogCritical, "cli", response->Get("error"));
|
||||
#endif /* _DEBUG */
|
||||
#endif /* I2_DEBUG */
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -142,10 +142,10 @@ DynamicObject::Ptr ConfigItem::Commit(bool discard)
|
|||
{
|
||||
ASSERT(!OwnsLock());
|
||||
|
||||
#ifdef _DEBUG
|
||||
#ifdef I2_DEBUG
|
||||
Log(LogDebug, "ConfigItem")
|
||||
<< "Commit called for ConfigItem Type=" << GetType() << ", Name=" << GetName();
|
||||
#endif /* _DEBUG */
|
||||
#endif /* I2_DEBUG */
|
||||
|
||||
/* Make sure the type is valid. */
|
||||
Type::Ptr type = Type::GetByName(GetType());
|
||||
|
@ -369,23 +369,23 @@ bool ConfigItem::ActivateItems(void)
|
|||
if (object->IsActive())
|
||||
continue;
|
||||
|
||||
#ifdef _DEBUG
|
||||
#ifdef I2_DEBUG
|
||||
Log(LogDebug, "ConfigItem")
|
||||
<< "Activating object '" << object->GetName() << "' of type '" << object->GetType()->GetName() << "'";
|
||||
#endif /* _DEBUG */
|
||||
#endif /* I2_DEBUG */
|
||||
upq.Enqueue(boost::bind(&DynamicObject::Activate, object));
|
||||
}
|
||||
}
|
||||
|
||||
upq.Join();
|
||||
|
||||
#ifdef _DEBUG
|
||||
#ifdef I2_DEBUG
|
||||
BOOST_FOREACH(const DynamicType::Ptr& type, DynamicType::GetTypes()) {
|
||||
BOOST_FOREACH(const DynamicObject::Ptr& object, type->GetObjects()) {
|
||||
ASSERT(object->IsActive());
|
||||
}
|
||||
}
|
||||
#endif /* _DEBUG */
|
||||
#endif /* I2_DEBUG */
|
||||
|
||||
Log(LogInformation, "ConfigItem", "Activated all objects.");
|
||||
|
||||
|
|
|
@ -38,12 +38,12 @@ Expression::~Expression(void)
|
|||
Value Expression::Evaluate(ScriptFrame& frame, DebugHint *dhint) const
|
||||
{
|
||||
try {
|
||||
#ifdef _DEBUG
|
||||
#ifdef I2_DEBUG
|
||||
/* std::ostringstream msgbuf;
|
||||
ShowCodeFragment(msgbuf, GetDebugInfo(), false);
|
||||
Log(LogDebug, "Expression")
|
||||
<< "Executing:\n" << msgbuf.str();*/
|
||||
#endif /* _DEBUG */
|
||||
#endif /* I2_DEBUG */
|
||||
|
||||
return DoEvaluate(frame, dhint);
|
||||
} catch (const InterruptExecutionError&) {
|
||||
|
|
|
@ -165,9 +165,9 @@ Comment::Ptr Checkable::GetCommentByID(const String& id)
|
|||
|
||||
void Checkable::AddCommentsToCache(void)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
#ifdef I2_DEBUG
|
||||
Log(LogDebug, "Checkable", "Updating Checkable comments cache.");
|
||||
#endif /* _DEBUG */
|
||||
#endif /* I2_DEBUG */
|
||||
|
||||
Dictionary::Ptr comments = GetComments();
|
||||
|
||||
|
|
|
@ -251,9 +251,9 @@ void Checkable::StartDowntimesExpiredTimer(void)
|
|||
|
||||
void Checkable::AddDowntimesToCache(void)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
#ifdef I2_DEBUG
|
||||
Log(LogDebug, "Checkable", "Updating Checkable downtimes cache.");
|
||||
#endif /* _DEBUG */
|
||||
#endif /* I2_DEBUG */
|
||||
|
||||
Dictionary::Ptr downtimes = GetDowntimes();
|
||||
|
||||
|
|
|
@ -452,25 +452,25 @@ Array::Ptr LegacyTimePeriod::ScriptFunc(const TimePeriod::Ptr& tp, double begin,
|
|||
time_t refts = begin + i * 24 * 60 * 60;
|
||||
tm reference = Utility::LocalTime(refts);
|
||||
|
||||
#ifdef _DEBUG
|
||||
#ifdef I2_DEBUG
|
||||
Log(LogDebug, "LegacyTimePeriod")
|
||||
<< "Checking reference time " << refts;
|
||||
#endif /* _DEBUG */
|
||||
#endif /* I2_DEBUG */
|
||||
|
||||
ObjectLock olock(ranges);
|
||||
BOOST_FOREACH(const Dictionary::Pair& kv, ranges) {
|
||||
if (!IsInDayDefinition(kv.first, &reference)) {
|
||||
#ifdef _DEBUG
|
||||
#ifdef I2_DEBUG
|
||||
Log(LogDebug, "LegacyTimePeriod")
|
||||
<< "Not in day definition '" << kv.first << "'.";
|
||||
#endif /* _DEBUG */
|
||||
#endif /* I2_DEBUG */
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
#ifdef I2_DEBUG
|
||||
Log(LogDebug, "LegacyTimePeriod")
|
||||
<< "In day definition '" << kv.first << "'.";
|
||||
#endif /* _DEBUG */
|
||||
#endif /* I2_DEBUG */
|
||||
|
||||
ProcessTimeRanges(kv.second, &reference, segments);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue