13
0

make PBD::stacktrace() be clear if it cannot generate stacktraces for some (runtime) reason. not sure why this is an issue, but it is, right now, on my machine

This commit is contained in:
Paul Davis 2013-03-20 17:20:13 -04:00
parent 16ce39c230
commit a5d3f2d578

View File

@ -77,15 +77,21 @@ PBD::stacktrace (std::ostream& out, int levels)
size_t i;
size = backtrace (array, 200);
strings = backtrace_symbols (array, size);
if (strings) {
for (i = 0; i < size && (levels == 0 || i < size_t(levels)); i++) {
out << " " << demangle (strings[i]) << std::endl;
if (size) {
strings = backtrace_symbols (array, size);
if (strings) {
for (i = 0; i < size && (levels == 0 || i < size_t(levels)); i++) {
out << " " << demangle (strings[i]) << std::endl;
std::cerr << " " << demangle (strings[i]) << std::endl;
}
free (strings);
}
free (strings);
} else {
out << "no stacktrace available!" << std::endl;
}
}