25 #error *****Isis.h MUST be included before any other files!*****
28 #include "IsisDebug.h"
32 #include <QCoreApplication>
38 #define APPLICATION IsisMain
88 std::map<QString, void *> empty;
95 void startMonitoringMemory();
96 void stopMonitoringMemory();
97 void SegmentationFault(
int);
99 void InterruptSignal(
int);
109 int main(
int argc,
char *argv[]) {
111 startMonitoringMemory();
112 signal(SIGSEGV, SegmentationFault);
113 signal(SIGABRT, Abort);
114 signal(SIGINT, InterruptSignal);
117 Isis::Application::p_applicationForceGuiApp =
false;
120 Isis::Application::p_applicationForceGuiApp =
true;
125 QCoreApplication::addLibraryPath(qtpluginpath.expanded());
129 int status = app->Run(APPLICATION);
131 delete QCoreApplication::instance();
136 void startMonitoringMemory() {
138 MyMutex *mutex =
new MyMutex();
139 std::fstream *alloc_output =
new std::fstream(
"/dev/null");
140 Debug(make_all_allocations_invisible_except(NULL));
141 ForAllDebugChannels(
if(debugChannel.is_on()) debugChannel.off());
142 Debug(dc::malloc.on());
143 Debug(libcw_do.on());
144 Debug(libcw_do.set_ostream(alloc_output));
145 Debug(libcw_do.set_ostream(alloc_output, mutex));
146 atexit(stopMonitoringMemory);
151 void stopMonitoringMemory() {
154 alloc_filter_ct alloc_filter;
155 std::vector<std::string> objmasks;
156 objmasks.push_back(
"libc.so*");
157 objmasks.push_back(
"libstdc++*");
158 std::vector<std::string> srcmasks;
159 srcmasks.push_back(
"*new_allocator.h*");
160 srcmasks.push_back(
"*set_ostream.inl*");
161 alloc_filter.hide_objectfiles_matching(objmasks);
162 alloc_filter.hide_sourcefiles_matching(srcmasks);
163 alloc_filter.hide_unknown_locations();
164 delete libcw_do.get_ostream();
165 libcw_do.set_ostream(&std::cout);
166 list_allocations_on(libcw_do, alloc_filter);
174 void SegmentationFault(
int) {
175 std::vector<std::string> currentStack;
176 StackTrace::GetStackTrace(¤tStack);
178 std::cerr <<
"Segmentation Fault" << std::endl;
179 for(
unsigned int i = 1; i < currentStack.size(); i++) {
180 std::cerr << currentStack[i] << std::endl;
187 std::vector<std::string> currentStack;
188 StackTrace::GetStackTrace(¤tStack);
190 std::cerr <<
"Abort" << std::endl;
191 for(
unsigned int i = 1; i < currentStack.size(); i++) {
192 std::cerr << currentStack[i] << std::endl;
199 void InterruptSignal(
int) {
File name manipulation and expansion.
std::map< QString, void * > GuiHelpers()
Base include file for all Isis applications.
int main(int argc, char *argv[])
The programmer supplied main function.