diff options
-rw-r--r-- | Foundation/GTMStackTrace.m | 32 | ||||
-rw-r--r-- | ReleaseNotes.txt | 7 |
2 files changed, 31 insertions, 8 deletions
diff --git a/Foundation/GTMStackTrace.m b/Foundation/GTMStackTrace.m index 1c7bafb..568b5d7 100644 --- a/Foundation/GTMStackTrace.m +++ b/Foundation/GTMStackTrace.m @@ -158,18 +158,34 @@ static NSString *GTMStackTraceFromAddressDescriptors(struct GTMAddressDescriptor if (i) { [trace appendString:@"\n"]; } + NSString *fileName = nil; + if (descs[i].filename) { + fileName = [NSString stringWithCString:descs[i].filename + encoding:NSUTF8StringEncoding]; + fileName = [fileName lastPathComponent]; + } else { + fileName = @"??"; + } if (descs[i].class_name) { - [trace appendFormat:@"#%-2u %#08lx %s[%s %s] (%s)", - i, descs[i].address, + [trace appendFormat:@"#%-2u %-35s %0*p %s[%s %s]", + i, + [fileName UTF8String], + // sizeof(void*) * 2 is the length of the hex address (32 vs 64) and + 2 + // for the 0x prefix + sizeof(void *) * 2 + 2, + descs[i].address, (descs[i].is_class_method ? "+" : "-"), descs[i].class_name, - (descs[i].symbol ? descs[i].symbol : "??"), - (descs[i].filename ? descs[i].filename : "??")]; + (descs[i].symbol ? descs[i].symbol : "??")]; } else { - [trace appendFormat:@"#%-2u %#08lx %s() (%s)", - i, descs[i].address, - (descs[i].symbol ? descs[i].symbol : "??"), - (descs[i].filename ? descs[i].filename : "??")]; + [trace appendFormat:@"#%-2u %-35s %0*p %s()", + i, + [fileName UTF8String], + // sizeof(void*) * 2 is the length of the hex address (32 vs 64) and + 2 + // for the 0x prefix + sizeof(void *) * 2 + 2, + descs[i].address, + (descs[i].symbol ? descs[i].symbol : "??")]; } } return trace; diff --git a/ReleaseNotes.txt b/ReleaseNotes.txt index dee7f93..681c068 100644 --- a/ReleaseNotes.txt +++ b/ReleaseNotes.txt @@ -402,6 +402,13 @@ Changes since 1.5.1 - Added GTM_NONNULL, NS_RETURNS_RETAINED, and CF_RETURNS_RETAINED macrs to support clang analysis. +- Changed GTMStackTrace to put out a cleaner trace, and to work on 64 bit. + NOTE that if you are parsing this format, that it has changed. + eg 32 bit + #0 UnitTest - Foundation 0x0001c392 -[SenTest run] + and 64 bit + #0 UnitTest - Foundation 0x10010000001c3921 -[SenTest run] + Release 1.5.1 Changes since 1.5.0 |