After review pr#66

This commit is contained in:
Rafal Crypto Tigusoft 2017-06-29 10:21:02 +00:00
parent dd552a10c8
commit e1bf45fd0c
No known key found for this signature in database
GPG Key ID: E9931012E40A3391

View File

@ -752,23 +752,17 @@ public:
while (*funcname && *funcname != '(') {
funcname += 1;
}
trace.object_filename.assign(filename, funcname); // it is ok if funcname is the ending \0, then we select string till end
trace.object_filename.assign(filename, funcname); // ok even if funcname is the ending \0 (then we assign entire string)
if ( ! (*funcname) ) { // we already hit end of string. This happens for the last address 0xffff for ip==0
trace.object_function = "(none)";
trace.source.function = "(none)";
return trace;
if (*funcname) { // if it's not end of string (e.g. from last frame ip==0)
char* funcname_end = funcname + 1;
while (*funcname_end && *funcname_end != ')' && *funcname_end != '+') {
funcname_end += 1;
}
*funcname_end = '\0';
trace.object_function = this->demangle(funcname);
trace.source.function = trace.object_function; // we cannot do better.
}
// else normal string, we are at the opening '(' now
funcname++;
char* funcname_end = funcname;
while (*funcname_end && *funcname_end != ')' && *funcname_end != '+') {
funcname_end += 1;
}
*funcname_end = '\0';
trace.object_function = this->demangle(funcname);
trace.source.function = trace.object_function; // we cannot do better.
return trace;
}