From e9017f323907c5d28ae54f1fe26f73b924fee23c Mon Sep 17 00:00:00 2001 From: ladderbreaker Date: Wed, 11 Apr 2007 00:45:00 +0000 Subject: Issue 147 - reviewer Waylonis git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@144 4c0a9323-5329-0410-9bdc-e9ce6186880e --- src/common/mac/dump_syms.mm | 42 ++++++++++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 10 deletions(-) (limited to 'src/common') diff --git a/src/common/mac/dump_syms.mm b/src/common/mac/dump_syms.mm index 13368292..6541285e 100644 --- a/src/common/mac/dump_syms.mm +++ b/src/common/mac/dump_syms.mm @@ -207,18 +207,40 @@ static BOOL StringTailMatches(NSString *str, NSString *tail) { [symbols addObject:symbol]; } - NSArray *converted = [self convertCPlusPlusSymbols:symbols]; - [symbols release]; - - for (unsigned int i = 0; i < count; ++i) { - NSMutableDictionary *dict = [addresses_ objectForKey: - [addresses objectAtIndex:i]]; - NSString *symbol = [converted objectAtIndex:i]; + // In order to deal with crashing problems in c++filt, we setup + // a while loop to handle the case where convertCPlusPlusSymbols + // only returns partial results. + // We then attempt to continue from the point where c++filt failed + // and add the partial results to the total results until we're + // completely done. + + unsigned int totalIndex = 0; + unsigned int totalCount = count; + + while (totalIndex < totalCount) { + NSRange range = NSMakeRange(totalIndex, totalCount - totalIndex); + NSArray *subarray = [symbols subarrayWithRange:range]; + NSArray *converted = [self convertCPlusPlusSymbols:subarray]; + unsigned int convertedCount = [converted count]; + + if (convertedCount == 0) { + break; // we give up at this point + } + + for (unsigned int convertedIndex = 0; + convertedIndex < convertedCount && totalIndex < totalCount; + ++totalIndex, ++convertedIndex) { + NSMutableDictionary *dict = [addresses_ objectForKey: + [addresses objectAtIndex:totalIndex]]; + NSString *symbol = [converted objectAtIndex:convertedIndex]; - // Only add if this is a non-zero length symbol - if ([symbol length]) - [dict setObject:symbol forKey:kAddressConvertedSymbolKey]; + // Only add if this is a non-zero length symbol + if ([symbol length]) + [dict setObject:symbol forKey:kAddressConvertedSymbolKey]; + } } + + [symbols release]; } //============================================================================= -- cgit v1.2.1