mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-08 07:45:00 +01:00
improve stacktraces on macOS involving Objective C
This commit is contained in:
parent
12b215b0d6
commit
809d605a4a
1 changed files with 31 additions and 3 deletions
|
|
@ -17,6 +17,7 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
#include "pbd/demangle.h"
|
#include "pbd/demangle.h"
|
||||||
|
|
||||||
#if defined(__GLIBCXX__) || defined(__APPLE__)
|
#if defined(__GLIBCXX__) || defined(__APPLE__)
|
||||||
|
|
@ -60,7 +61,6 @@ PBD::demangle (std::string const& str)
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
|
|
||||||
std::string foo;
|
std::string foo;
|
||||||
std::string symbol;
|
|
||||||
std::stringstream sstr (str);
|
std::stringstream sstr (str);
|
||||||
|
|
||||||
/* format is:
|
/* format is:
|
||||||
|
|
@ -74,10 +74,38 @@ PBD::demangle (std::string const& str)
|
||||||
sstr >> foo;
|
sstr >> foo;
|
||||||
sstr >> foo;
|
sstr >> foo;
|
||||||
sstr >> foo;
|
sstr >> foo;
|
||||||
sstr >> symbol;
|
|
||||||
|
|
||||||
|
/* Read as far as the "offset" */
|
||||||
|
|
||||||
|
char sym[1024];
|
||||||
|
sstr.getline (sym, sizeof (sym), '+');
|
||||||
|
if (sstr.bad() || strlen (sym) < 2) {
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* There's a space at the beginning which we don't care about, and one
|
||||||
|
* at the end too
|
||||||
|
*/
|
||||||
|
|
||||||
|
sym[strlen(sym)-1] = '\0';
|
||||||
|
std::string symbol = &sym[1];
|
||||||
|
|
||||||
|
if (symbol.size() > 2) {
|
||||||
|
if (symbol[0] == '-' && symbol[1] == '[') {
|
||||||
|
/* Objective C */
|
||||||
|
std::string::size_type bracket = symbol.find_last_of (']');
|
||||||
|
if (bracket == std::string::npos) {
|
||||||
|
/* Apparently no Objective C, despite early indications that it was */
|
||||||
return demangle_symbol (symbol);
|
return demangle_symbol (symbol);
|
||||||
|
}
|
||||||
|
return symbol.substr (0, bracket + 1);
|
||||||
|
} else {
|
||||||
|
/* Not Objective C */
|
||||||
|
return demangle_symbol (symbol);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return str;
|
||||||
#else
|
#else
|
||||||
|
|
||||||
std::string::size_type const b = str.find_first_of ("(");
|
std::string::size_type const b = str.find_first_of ("(");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue