From d31c8b02925a1b20c09ee9ab771322353aea6267 Mon Sep 17 00:00:00 2001 From: waylonis Date: Tue, 23 Jan 2007 19:17:03 +0000 Subject: Changes to support patch #108: - Calculate unique file id for mach-o files - Add file id support to dump_syms and symupload tools - Fix return values of tools to indicate success or failure - Change dump_syms class to be Objective-C++ git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@109 4c0a9323-5329-0410-9bdc-e9ce6186880e --- src/tools/mac/symupload/symupload.m | 42 +++++++++++----------- .../symupload/symupload.xcodeproj/project.pbxproj | 2 +- 2 files changed, 23 insertions(+), 21 deletions(-) (limited to 'src/tools/mac/symupload') diff --git a/src/tools/mac/symupload/symupload.m b/src/tools/mac/symupload/symupload.m index 6f7db19f..15e6ad80 100644 --- a/src/tools/mac/symupload/symupload.m +++ b/src/tools/mac/symupload/symupload.m @@ -34,7 +34,6 @@ // debug_identifier: the debug file's identifier, usually consisting of // the guid and age embedded in the pdb, e.g. // "11111111BBBB3333DDDD555555555555F" -// version: the file version of the module, e.g. "1.2.3.4" // os: the operating system that the module was built for // cpu: the CPU that the module was built for (x86 or ppc) // symbol_file: the contents of the airbag-format symbol file @@ -47,7 +46,6 @@ typedef struct { NSString *symbolsPath; NSString *uploadURLStr; - NSString *version; BOOL success; } Options; @@ -69,11 +67,11 @@ static NSArray *ModuleDataForSymbolFile(NSString *file) { } //============================================================================= -static NSString *CompactIdentifier(NSString *uuid, NSString *age) { +static NSString *CompactIdentifier(NSString *uuid) { NSMutableString *str = [NSMutableString stringWithString:uuid]; [str replaceOccurrencesOfString:@"-" withString:@"" options:0 range:NSMakeRange(0, [str length])]; - [str appendString:age]; + return str; } @@ -83,22 +81,30 @@ static void Start(Options *options) { HTTPMultipartUpload *ul = [[HTTPMultipartUpload alloc] initWithURL:url]; NSMutableDictionary *parameters = [NSMutableDictionary dictionary]; NSArray *moduleParts = ModuleDataForSymbolFile(options->symbolsPath); - NSString *compactedID = CompactIdentifier([moduleParts objectAtIndex:3], - [moduleParts objectAtIndex:4]); + NSMutableString *compactedID = + [NSMutableString stringWithString:[moduleParts objectAtIndex:3]]; + [compactedID replaceOccurrencesOfString:@"-" withString:@"" options:0 + range:NSMakeRange(0, [compactedID length])]; // Add parameters - if (options->version) - [parameters setObject:options->version forKey:@"version"]; + [parameters setObject:compactedID forKey:@"debug_identifier"]; - // MODULE - // 0 1 2 3 4 5 - [parameters setObject:@"1" forKey:@"age"]; + // MODULE + // 0 1 2 3 4 [parameters setObject:[moduleParts objectAtIndex:1] forKey:@"os"]; [parameters setObject:[moduleParts objectAtIndex:2] forKey:@"cpu"]; - [parameters setObject:[moduleParts objectAtIndex:5] forKey:@"debug_file"]; - [parameters setObject:[moduleParts objectAtIndex:5] forKey:@"code_file"]; - [parameters setObject:compactedID forKey:@"debug_identifier"]; + [parameters setObject:[moduleParts objectAtIndex:4] forKey:@"debug_file"]; + [parameters setObject:[moduleParts objectAtIndex:4] forKey:@"code_file"]; [ul setParameters:parameters]; + + NSArray *keys = [parameters allKeys]; + int count = [keys count]; + for (int i = 0; i < count; ++i) { + NSString *key = [keys objectAtIndex:i]; + NSString *value = [parameters objectForKey:key]; + fprintf(stdout, "'%s' = '%s'\n", [key UTF8String], + [value UTF8String]); + } // Add file [ul addFileAtPath:options->symbolsPath name:@"symbol_file"]; @@ -123,10 +129,9 @@ static void Start(Options *options) { static void Usage(int argc, const char *argv[]) { fprintf(stderr, "Submit symbol information.\n"); - fprintf(stderr, "Usage: %s [-v version] \n", argv[0]); + fprintf(stderr, "Usage: %s \n", argv[0]); fprintf(stderr, " should be created by using the dump_syms tool.\n"); fprintf(stderr, " is the destination for the upload\n"); - fprintf(stderr, "\t-v: Version information (e.g., 1.2.3.4)\n"); fprintf(stderr, "\t-h: Usage\n"); fprintf(stderr, "\t-?: Usage\n"); } @@ -137,11 +142,8 @@ SetupOptions(int argc, const char *argv[], Options *options) { extern int optind; char ch; - while ((ch = getopt(argc, (char * const *)argv, "v:h?")) != -1) { + while ((ch = getopt(argc, (char * const *)argv, "h?")) != -1) { switch (ch) { - case 'v': - options->version = [NSString stringWithCString:optarg]; - break; default: Usage(argc, argv); exit(0); diff --git a/src/tools/mac/symupload/symupload.xcodeproj/project.pbxproj b/src/tools/mac/symupload/symupload.xcodeproj/project.pbxproj index d2f4a1ca..f9550364 100644 --- a/src/tools/mac/symupload/symupload.xcodeproj/project.pbxproj +++ b/src/tools/mac/symupload/symupload.xcodeproj/project.pbxproj @@ -31,7 +31,7 @@ /* Begin PBXFileReference section */ 08FB7796FE84155DC02AAC07 /* symupload.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = symupload.m; sourceTree = ""; }; 08FB779EFE84155DC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; - 8DD76FA10486AA7600D96B5E /* symupload */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = symupload; sourceTree = BUILT_PRODUCTS_DIR; }; + 8DD76FA10486AA7600D96B5E /* symupload */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = "compiled.mach-o.executable"; path = symupload; sourceTree = BUILT_PRODUCTS_DIR; }; 9BD833680B03E4080055103E /* HTTPMultipartUpload.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HTTPMultipartUpload.h; path = ../../../common/mac/HTTPMultipartUpload.h; sourceTree = ""; }; 9BD833690B03E4080055103E /* HTTPMultipartUpload.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HTTPMultipartUpload.m; path = ../../../common/mac/HTTPMultipartUpload.m; sourceTree = ""; }; 9BD835FB0B0544950055103E /* minidump_upload */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = minidump_upload; sourceTree = BUILT_PRODUCTS_DIR; }; -- cgit v1.2.1