some changes for solaris

master
Marc Wäckerlin 20 years ago
parent 027537dbcf
commit cabcaa0475
  1. 11
      mrw/stacktrace.cpp

@ -9,6 +9,9 @@
@license LGPL, see file <a href="license.html">COPYING</a> @license LGPL, see file <a href="license.html">COPYING</a>
$Log$ $Log$
Revision 1.9 2005/01/07 00:34:38 marc
some changes for solaris
Revision 1.8 2004/12/20 13:22:25 marc Revision 1.8 2004/12/20 13:22:25 marc
mrw string now throws exceptions, catch needed mrw string now throws exceptions, catch needed
@ -103,8 +106,12 @@ namespace mrw {
confusing the demangler. */ confusing the demangler. */
const char* p(name); const char* p(name);
while (p && *p == '.') ++p; while (p && *p == '.') ++p;
# ifdef __solaris__
char res[1024];
if (cplus_demangle(p, res, 1024)) return name;
# else
Auto<char*>::Free res(cplus_demangle(p, DMGL_ANSI | DMGL_PARAMS)); Auto<char*>::Free res(cplus_demangle(p, DMGL_ANSI | DMGL_PARAMS));
# endif
if (res) { if (res) {
/* Now put back any stripped dots. */ /* Now put back any stripped dots. */
if (p==name) return static_cast<const char*>(res); if (p==name) return static_cast<const char*>(res);
@ -248,7 +255,7 @@ mrw::StackTrace::BinFiles mrw::StackTrace::filename()
{ {
std::string s; std::string s;
s<<"/proc/"<<getpid(); s<<"/proc/"<<getpid();
AutoFile fd(open(s.str(), O_RDONLY)); AutoFile fd(open(s.c_str(), O_RDONLY));
prpsinfo_t status; prpsinfo_t status;
if (fd==-1 || ioctl(fd, PIOCPSINFO, &status)==-1) return res; if (fd==-1 || ioctl(fd, PIOCPSINFO, &status)==-1) return res;
s = status.pr_psargs; s = status.pr_psargs;

Loading…
Cancel
Save