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/dump_syms/dump_syms_tool.m | 38 +++++++++++++++++--------------- 1 file changed, 20 insertions(+), 18 deletions(-) (limited to 'src/tools/mac/dump_syms/dump_syms_tool.m') diff --git a/src/tools/mac/dump_syms/dump_syms_tool.m b/src/tools/mac/dump_syms/dump_syms_tool.m index 60499a88..147989bf 100644 --- a/src/tools/mac/dump_syms/dump_syms_tool.m +++ b/src/tools/mac/dump_syms/dump_syms_tool.m @@ -46,21 +46,31 @@ typedef struct { static void Start(Options *options) { DumpSymbols *dump = [[DumpSymbols alloc] initWithContentsOfFile:options->srcPath]; + + if (!dump) { + fprintf(stderr, "%s is not a valid Mach-o file\n", + [options->srcPath fileSystemRepresentation]); + options->result = NO; + return; + } - [dump setArchitecture:options->arch]; - [dump setUUID:options->uuidStr]; + if (![dump setArchitecture:options->arch]) { + fprintf(stderr, "Architecture: %s not available in %s\n", + [options->arch UTF8String], + [options->srcPath fileSystemRepresentation]); + options->result = NO; + return; + } + options->result = [dump writeSymbolFile:@"-"]; } //============================================================================= static void Usage(int argc, const char *argv[]) { - fprintf(stderr, "Output airbag symbol file. If a UUID is not specified,\n" - "the program will try to locate one in the mach-o-file. If one is\n" - "not found, one will be created.\n"); - fprintf(stderr, "Usage: %s [-a ppc|i386|x86][-u uuid] \n", + fprintf(stderr, "Output an Airbag symbol file from a Mach-o file.\n"); + fprintf(stderr, "Usage: %s [-a ppc|i386|x86] \n", argv[0]); fprintf(stderr, "\t-a: Architecture type [default: native]\n"); - fprintf(stderr, "\t-u: Specify a UUID\n"); fprintf(stderr, "\t-h: Usage\n"); fprintf(stderr, "\t-?: Usage\n"); } @@ -97,9 +107,6 @@ static void SetupOptions(int argc, const char *argv[], Options *options) { exit(1); } break; - case 'u': - options->uuidStr = [NSString stringWithUTF8String:optarg]; - break; case '?': case 'h': Usage(argc, argv); @@ -107,14 +114,9 @@ static void SetupOptions(int argc, const char *argv[], Options *options) { break; } } - - if (!options->uuidStr) { - CFUUIDRef uuid = CFUUIDCreate(NULL); - options->uuidStr = (NSString *)CFUUIDCreateString(NULL, uuid); - } - + if ((argc - optind) != 1) { - fprintf(stderr, "%s: Missing executable\n", argv[0]); + fprintf(stderr, "Must specify Mach-o file\n"); Usage(argc, argv); exit(1); } @@ -135,5 +137,5 @@ int main (int argc, const char * argv[]) { [pool release]; - return options.result; + return !options.result; } -- cgit v1.2.1