mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-29 16:44:29 +02:00
Fixed compilations errors.
Added some more debugging code.
This commit is contained in:
parent
cac3c2109a
commit
6fea4d6baa
@ -15,6 +15,7 @@ libbase_la_SOURCES = \
|
|||||||
confighive.h \
|
confighive.h \
|
||||||
configobject.cpp \
|
configobject.cpp \
|
||||||
configobject.h \
|
configobject.h \
|
||||||
|
cxx11-compat.h \
|
||||||
delegate.h \
|
delegate.h \
|
||||||
event.h \
|
event.h \
|
||||||
exception.cpp \
|
exception.cpp \
|
||||||
|
@ -17,6 +17,9 @@ Application::Application(void)
|
|||||||
lt_dlinit();
|
lt_dlinit();
|
||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
|
|
||||||
|
char *debugging = getenv("_DEBUG");
|
||||||
|
m_Debugging = (debugging && strtol(debugging, NULL, 10) != 0);
|
||||||
|
|
||||||
m_ShuttingDown = false;
|
m_ShuttingDown = false;
|
||||||
m_ConfigHive = make_shared<ConfigHive>();
|
m_ConfigHive = make_shared<ConfigHive>();
|
||||||
}
|
}
|
||||||
@ -30,6 +33,8 @@ Application::~Application(void)
|
|||||||
i->second->Stop();
|
i->second->Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_Components.clear();
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
WSACleanup();
|
WSACleanup();
|
||||||
#else /* _WIN32 */
|
#else /* _WIN32 */
|
||||||
@ -349,3 +354,8 @@ void Application::AddComponentSearchDir(const string& componentDirectory)
|
|||||||
lt_dladdsearchdir(componentDirectory.c_str());
|
lt_dladdsearchdir(componentDirectory.c_str());
|
||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Application::IsDebugging(void) const
|
||||||
|
{
|
||||||
|
return m_Debugging;
|
||||||
|
}
|
||||||
|
@ -13,6 +13,7 @@ private:
|
|||||||
ConfigHive::Ptr m_ConfigHive;
|
ConfigHive::Ptr m_ConfigHive;
|
||||||
map< string, shared_ptr<Component> > m_Components;
|
map< string, shared_ptr<Component> > m_Components;
|
||||||
vector<string> m_Arguments;
|
vector<string> m_Arguments;
|
||||||
|
bool m_Debugging;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef shared_ptr<Application> Ptr;
|
typedef shared_ptr<Application> Ptr;
|
||||||
@ -42,6 +43,8 @@ public:
|
|||||||
void AddComponentSearchDir(const string& componentDirectory);
|
void AddComponentSearchDir(const string& componentDirectory);
|
||||||
|
|
||||||
const string& GetExeDirectory(void);
|
const string& GetExeDirectory(void);
|
||||||
|
|
||||||
|
bool IsDebugging(void) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
@ -58,32 +61,32 @@ int application_main(int argc, char **argv)
|
|||||||
|
|
||||||
Application::Instance->SetArguments(args);
|
Application::Instance->SetArguments(args);
|
||||||
|
|
||||||
#ifndef _DEBUG
|
if (Application::Instance->IsDebugging()) {
|
||||||
try {
|
|
||||||
#endif /* !_DEBUG */
|
|
||||||
result = Application::Instance->Main(args);
|
result = Application::Instance->Main(args);
|
||||||
#ifndef _DEBUG
|
} else {
|
||||||
} catch (const Exception& ex) {
|
try {
|
||||||
cout << "---" << endl;
|
result = Application::Instance->Main(args);
|
||||||
|
} catch (const Exception& ex) {
|
||||||
|
cout << "---" << endl;
|
||||||
|
|
||||||
string klass = typeid(ex).name();
|
string klass = typeid(ex).name();
|
||||||
|
|
||||||
#ifdef HAVE_GCC_ABI_DEMANGLE
|
#ifdef HAVE_GCC_ABI_DEMANGLE
|
||||||
int status;
|
int status;
|
||||||
char *realname = abi::__cxa_demangle(klass.c_str(), 0, 0, &status);
|
char *realname = abi::__cxa_demangle(klass.c_str(), 0, 0, &status);
|
||||||
|
|
||||||
if (realname != NULL) {
|
if (realname != NULL) {
|
||||||
klass = string(realname);
|
klass = string(realname);
|
||||||
free(realname);
|
free(realname);
|
||||||
|
}
|
||||||
|
#endif /* HAVE_GCC_ABI_DEMANGLE */
|
||||||
|
|
||||||
|
cout << "Exception: " << klass << endl;
|
||||||
|
cout << "Message: " << ex.GetMessage() << endl;
|
||||||
|
|
||||||
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
#endif /* HAVE_GCC_ABI_DEMANGLE */
|
|
||||||
|
|
||||||
cout << "Exception: " << klass << endl;
|
|
||||||
cout << "Message: " << ex.GetMessage() << endl;
|
|
||||||
|
|
||||||
return EXIT_FAILURE;
|
|
||||||
}
|
}
|
||||||
#endif /* !_DEBUG */
|
|
||||||
|
|
||||||
Application::Instance.reset();
|
Application::Instance.reset();
|
||||||
|
|
||||||
|
@ -71,7 +71,8 @@ void ConnectionManager::RegisterMethod(string method, function<int (NewMessageEv
|
|||||||
|
|
||||||
void ConnectionManager::UnregisterMethod(string method, function<int (NewMessageEventArgs::Ptr)> callback)
|
void ConnectionManager::UnregisterMethod(string method, function<int (NewMessageEventArgs::Ptr)> callback)
|
||||||
{
|
{
|
||||||
m_Methods[method] -= callback;
|
// TODO: implement
|
||||||
|
//m_Methods[method] -= callback;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConnectionManager::SendMessage(JsonRpcMessage::Ptr message)
|
void ConnectionManager::SendMessage(JsonRpcMessage::Ptr message)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user