From 38bc56cfa88b16015b4399d3f8a2ac8f768852b6 Mon Sep 17 00:00:00 2001 From: nealsid Date: Thu, 5 Jun 2008 21:20:53 +0000 Subject: [PATCH] Modified symupload to correctly handle spaces in module names when processing symbol file Reviewer=mmentovai git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@279 4c0a9323-5329-0410-9bdc-e9ce6186880e --- src/tools/mac/symupload/symupload.m | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/tools/mac/symupload/symupload.m b/src/tools/mac/symupload/symupload.m index 70b2ef73..d4a30150 100644 --- a/src/tools/mac/symupload/symupload.m +++ b/src/tools/mac/symupload/symupload.m @@ -56,10 +56,25 @@ static NSArray *ModuleDataForSymbolFile(NSString *file) { NSString *str = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; NSScanner *scanner = [NSScanner scannerWithString:str]; NSString *line; - NSArray *parts = nil; + NSMutableArray *parts = nil; + const int MODULE_ID_INDEX = 3; + + if ([scanner scanUpToString:@"\n" intoString:&line]) { + parts = [[NSMutableArray alloc] init]; + NSScanner *moduleInfoScanner = [NSScanner scannerWithString:line]; + NSString *moduleInfo; + // Get everything BEFORE the module name. None of these properties + // can have spaces. + for (int i = 0; i <= MODULE_ID_INDEX; i++) { + [moduleInfoScanner scanUpToString:@" " intoString:&moduleInfo]; + [parts addObject:moduleInfo]; + } - if ([scanner scanUpToString:@"\n" intoString:&line]) - parts = [line componentsSeparatedByString:@" "]; + // Now get the module name. This can have a space so we scan to + // the end of the line. + [moduleInfoScanner scanUpToString:@"\n" intoString:&moduleInfo]; + [parts addObject:moduleInfo]; + } [str release];