*/
#include <signal.h>
#include <iostream>
+#include "../debug/demangle.h"
#include "../time/units.h"
#include "../time/utils.h"
#include "application.h"
catch(const exception &e)
{
cerr<<"An uncaught exception occurred.\n";
- cerr<<" type: "<<typeid(e).name()<<'\n';
+ cerr<<" type: "<<Debug::demangle(typeid(e).name())<<'\n';
cerr<<" what(): "<<e.what()<<'\n';
delete app_;
- terminate();
+ return 124;
}
}
#ifndef MSP_CORE_GETOPT_H_
#define MSP_CORE_GETOPT_H_
-#include <list>
#include <sstream>
#include <string>
+#include <vector>
#include "error.h"
namespace Msp {
OptBase(char s, const std::string &l, ArgType a): shrt(s), lng(l), arg_type(a), seen_count(0) { }
};
- const std::list<std::string> &get_args() const { return args; }
+ const std::vector<std::string> &get_args() const { return args; }
template<typename T>
OptBase &add_option(char s, const std::string &l, T &d, ArgType a=NO_ARG)
};
std::list<OptBase *> opts;
- std::list<std::string> args;
+ std::vector<std::string> args;
OptBase &get_option(char);
OptBase &get_option(const std::string &);
Copyright © 2007 Mikko Rasa, Mikkosoft Productions
Distributed under the LGPL
*/
+
+#include <cxxabi.h>
#include "demangle.h"
using namespace std;
namespace Msp {
namespace Debug {
-string demangle_gcc3(const string &sym)
+string demangle(const string &sym)
{
- string result;
-
- if(sym.compare(0, 2, "_Z"))
- return result;
-
- string::const_iterator i=sym.begin()+2;
-
- bool nested=(*i=='N');
- bool first=true;
- while(first || (nested && *i!='E'))
- {
- unsigned len=0;
- for(; isdigit(*i); ++i)
- len=len*10+(*i-'0');
- string::const_iterator j=i+len;
-
- if(!first)
- result.append("::");
- result.append(i, j);
-
- first=false;
- }
-
- if(nested)
- ++i;
-
- for(; i!=sym.end(); ++i)
- {
- bool ref=(*i=='R');
- if(ref) ++i;
- }
-
+#ifdef __GNUC__
+ int status;
+ char *dm=abi::__cxa_demangle(sym.c_str(), 0, 0, &status);
+ string result(dm);
+ free(dm);
return result;
+#else
+ return sym;
+#endif
}
} // namespace Debug
namespace Msp {
namespace Debug {
-std::string demangle_gcc3(const std::string &);
+std::string demangle(const std::string &);
} // namespace Debug
} // namespace Msp