lt_dlinit();
#endif /* _WIN32 */
+ char *debugging = getenv("_DEBUG");
+ m_Debugging = (debugging && strtol(debugging, NULL, 10) != 0);
+
m_ShuttingDown = false;
m_ConfigHive = make_shared<ConfigHive>();
}
i->second->Stop();
}
+ m_Components.clear();
+
#ifdef _WIN32
WSACleanup();
#else /* _WIN32 */
lt_dladdsearchdir(componentDirectory.c_str());
#endif /* _WIN32 */
}
+
+bool Application::IsDebugging(void) const
+{
+ return m_Debugging;
+}
ConfigHive::Ptr m_ConfigHive;
map< string, shared_ptr<Component> > m_Components;
vector<string> m_Arguments;
+ bool m_Debugging;
public:
typedef shared_ptr<Application> Ptr;
void AddComponentSearchDir(const string& componentDirectory);
const string& GetExeDirectory(void);
+
+ bool IsDebugging(void) const;
};
template<class T>
Application::Instance->SetArguments(args);
-#ifndef _DEBUG
- try {
-#endif /* !_DEBUG */
+ if (Application::Instance->IsDebugging()) {
result = Application::Instance->Main(args);
-#ifndef _DEBUG
- } catch (const Exception& ex) {
- cout << "---" << endl;
+ } else {
+ try {
+ 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
- int status;
- char *realname = abi::__cxa_demangle(klass.c_str(), 0, 0, &status);
+ #ifdef HAVE_GCC_ABI_DEMANGLE
+ int status;
+ char *realname = abi::__cxa_demangle(klass.c_str(), 0, 0, &status);
- if (realname != NULL) {
- klass = string(realname);
- free(realname);
- }
-#endif /* HAVE_GCC_ABI_DEMANGLE */
+ if (realname != NULL) {
+ klass = string(realname);
+ free(realname);
+ }
+ #endif /* HAVE_GCC_ABI_DEMANGLE */
- cout << "Exception: " << klass << endl;
- cout << "Message: " << ex.GetMessage() << endl;
+ cout << "Exception: " << klass << endl;
+ cout << "Message: " << ex.GetMessage() << endl;
- return EXIT_FAILURE;
+ return EXIT_FAILURE;
+ }
}
-#endif /* !_DEBUG */
Application::Instance.reset();