diff options
author | waylonis <waylonis@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2007-01-23 19:17:03 +0000 |
---|---|---|
committer | waylonis <waylonis@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2007-01-23 19:17:03 +0000 |
commit | d31c8b02925a1b20c09ee9ab771322353aea6267 (patch) | |
tree | 42696ec49303b9b114b05e8d8352b43e2f0b0a0a /src/tools/mac | |
parent | Library to handle SymSrv integration (#111). r=bryner (diff) | |
download | breakpad-d31c8b02925a1b20c09ee9ab771322353aea6267.tar.xz |
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
Diffstat (limited to 'src/tools/mac')
-rw-r--r-- | src/tools/mac/crash_report/crash_report.mm | 1 | ||||
-rw-r--r-- | src/tools/mac/crash_report/crash_report.xcodeproj/project.pbxproj | 42 | ||||
-rw-r--r-- | src/tools/mac/dump_syms/dump_syms.xcodeproj/project.pbxproj | 40 | ||||
-rw-r--r-- | src/tools/mac/dump_syms/dump_syms_tool.m | 38 | ||||
-rw-r--r-- | src/tools/mac/symupload/symupload.m | 42 | ||||
-rw-r--r-- | src/tools/mac/symupload/symupload.xcodeproj/project.pbxproj | 2 |
6 files changed, 116 insertions, 49 deletions
diff --git a/src/tools/mac/crash_report/crash_report.mm b/src/tools/mac/crash_report/crash_report.mm index bd026cf1..1a42fc03 100644 --- a/src/tools/mac/crash_report/crash_report.mm +++ b/src/tools/mac/crash_report/crash_report.mm @@ -309,6 +309,7 @@ static void SetupOptions(int argc, const char *argv[], Options *options) { if ((argc - optind) != 1) { fprintf(stderr, "%s: Missing minidump file\n", argv[0]); Usage(argc, argv); + exit(1); } options->minidumpPath = [[NSFileManager defaultManager] diff --git a/src/tools/mac/crash_report/crash_report.xcodeproj/project.pbxproj b/src/tools/mac/crash_report/crash_report.xcodeproj/project.pbxproj index 2c1eccc1..eb43b3a8 100644 --- a/src/tools/mac/crash_report/crash_report.xcodeproj/project.pbxproj +++ b/src/tools/mac/crash_report/crash_report.xcodeproj/project.pbxproj @@ -32,7 +32,13 @@ 9BDF1AFC0B1BEB6300F8391B /* address_map-inl.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9BDF1AFA0B1BEB6300F8391B /* address_map-inl.h */; }; 9BDF1AFD0B1BEB6300F8391B /* address_map.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9BDF1AFB0B1BEB6300F8391B /* address_map.h */; }; 9BDF21A60B1E825400F8391B /* dump_syms.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9BDF192D0B1BC15D00F8391B /* dump_syms.h */; }; - 9BDF21A70B1E825400F8391B /* dump_syms.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BDF192E0B1BC15D00F8391B /* dump_syms.m */; }; + 9BDF21A70B1E825400F8391B /* dump_syms.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9BDF192E0B1BC15D00F8391B /* dump_syms.mm */; }; + 9BE650B20B52FE3000611104 /* file_id.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9BE650AC0B52FE3000611104 /* file_id.cc */; }; + 9BE650B30B52FE3000611104 /* file_id.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9BE650AD0B52FE3000611104 /* file_id.h */; }; + 9BE650B40B52FE3000611104 /* macho_id.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9BE650AE0B52FE3000611104 /* macho_id.cc */; }; + 9BE650B50B52FE3000611104 /* macho_id.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9BE650AF0B52FE3000611104 /* macho_id.h */; }; + 9BE650B60B52FE3000611104 /* macho_walker.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9BE650B00B52FE3000611104 /* macho_walker.cc */; }; + 9BE650B70B52FE3000611104 /* macho_walker.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9BE650B10B52FE3000611104 /* macho_walker.h */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -54,6 +60,9 @@ 9B35FEEB0B26761C008DE8C7 /* basic_code_modules.h in CopyFiles */, 9B3904960B2E52D90059FABE /* basic_source_line_resolver.h in CopyFiles */, 9B3904970B2E52D90059FABE /* source_line_resolver_interface.h in CopyFiles */, + 9BE650B30B52FE3000611104 /* file_id.h in CopyFiles */, + 9BE650B50B52FE3000611104 /* macho_id.h in CopyFiles */, + 9BE650B70B52FE3000611104 /* macho_walker.h in CopyFiles */, ); runOnlyForDeploymentPostprocessing = 1; }; @@ -92,12 +101,18 @@ 9BDF176B0B1B8CB100F8391B /* on_demand_symbol_supplier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = on_demand_symbol_supplier.h; sourceTree = "<group>"; }; 9BDF176C0B1B8CB100F8391B /* on_demand_symbol_supplier.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = on_demand_symbol_supplier.mm; sourceTree = "<group>"; }; 9BDF192D0B1BC15D00F8391B /* dump_syms.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = dump_syms.h; path = ../../../common/mac/dump_syms.h; sourceTree = SOURCE_ROOT; }; - 9BDF192E0B1BC15D00F8391B /* dump_syms.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = dump_syms.m; path = ../../../common/mac/dump_syms.m; sourceTree = SOURCE_ROOT; }; + 9BDF192E0B1BC15D00F8391B /* dump_syms.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; name = dump_syms.mm; path = ../../../common/mac/dump_syms.mm; sourceTree = SOURCE_ROOT; }; 9BDF1A270B1BD58200F8391B /* pathname_stripper.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = pathname_stripper.cc; path = ../../../processor/pathname_stripper.cc; sourceTree = SOURCE_ROOT; }; 9BDF1A7A0B1BE30100F8391B /* range_map-inl.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = "range_map-inl.h"; path = "../../../processor/range_map-inl.h"; sourceTree = SOURCE_ROOT; }; 9BDF1A7B0B1BE30100F8391B /* range_map.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = range_map.h; path = ../../../processor/range_map.h; sourceTree = SOURCE_ROOT; }; 9BDF1AFA0B1BEB6300F8391B /* address_map-inl.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = "address_map-inl.h"; path = "../../../processor/address_map-inl.h"; sourceTree = SOURCE_ROOT; }; 9BDF1AFB0B1BEB6300F8391B /* address_map.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = address_map.h; path = ../../../processor/address_map.h; sourceTree = SOURCE_ROOT; }; + 9BE650AC0B52FE3000611104 /* file_id.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = file_id.cc; path = ../../../common/mac/file_id.cc; sourceTree = SOURCE_ROOT; }; + 9BE650AD0B52FE3000611104 /* file_id.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = file_id.h; path = ../../../common/mac/file_id.h; sourceTree = SOURCE_ROOT; }; + 9BE650AE0B52FE3000611104 /* macho_id.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = macho_id.cc; path = ../../../common/mac/macho_id.cc; sourceTree = SOURCE_ROOT; }; + 9BE650AF0B52FE3000611104 /* macho_id.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = macho_id.h; path = ../../../common/mac/macho_id.h; sourceTree = SOURCE_ROOT; }; + 9BE650B00B52FE3000611104 /* macho_walker.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = macho_walker.cc; path = ../../../common/mac/macho_walker.cc; sourceTree = SOURCE_ROOT; }; + 9BE650B10B52FE3000611104 /* macho_walker.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = macho_walker.h; path = ../../../common/mac/macho_walker.h; sourceTree = SOURCE_ROOT; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -116,7 +131,7 @@ isa = PBXGroup; children = ( 9BDF192D0B1BC15D00F8391B /* dump_syms.h */, - 9BDF192E0B1BC15D00F8391B /* dump_syms.m */, + 9BDF192E0B1BC15D00F8391B /* dump_syms.mm */, 08FB7796FE84155DC02AAC07 /* crash_report.mm */, 9BDF176B0B1B8CB100F8391B /* on_demand_symbol_supplier.h */, 9BDF176C0B1B8CB100F8391B /* on_demand_symbol_supplier.mm */, @@ -130,6 +145,7 @@ 08FB7795FE84155DC02AAC07 /* airbag */ = { isa = PBXGroup; children = ( + 9BE650AB0B52FE1A00611104 /* common */, 9BDF17280B1B8B0200F8391B /* processor */, 9BDF16F70B1B8ACD00F8391B /* google_airbag */, ); @@ -214,6 +230,19 @@ name = processor; sourceTree = "<group>"; }; + 9BE650AB0B52FE1A00611104 /* common */ = { + isa = PBXGroup; + children = ( + 9BE650AC0B52FE3000611104 /* file_id.cc */, + 9BE650AD0B52FE3000611104 /* file_id.h */, + 9BE650AE0B52FE3000611104 /* macho_id.cc */, + 9BE650AF0B52FE3000611104 /* macho_id.h */, + 9BE650B00B52FE3000611104 /* macho_walker.cc */, + 9BE650B10B52FE3000611104 /* macho_walker.h */, + ); + name = common; + sourceTree = "<group>"; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -265,9 +294,12 @@ 9BDF175D0B1B8C1B00F8391B /* process_state.cc in Sources */, 9BDF176E0B1B8CB100F8391B /* on_demand_symbol_supplier.mm in Sources */, 9BDF1A280B1BD58200F8391B /* pathname_stripper.cc in Sources */, - 9BDF21A70B1E825400F8391B /* dump_syms.m in Sources */, + 9BDF21A70B1E825400F8391B /* dump_syms.mm in Sources */, 9B35FEEA0B26761C008DE8C7 /* basic_code_modules.cc in Sources */, 9B3904990B2E52FD0059FABE /* basic_source_line_resolver.cc in Sources */, + 9BE650B20B52FE3000611104 /* file_id.cc in Sources */, + 9BE650B40B52FE3000611104 /* macho_id.cc in Sources */, + 9BE650B60B52FE3000611104 /* macho_walker.cc in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -286,6 +318,7 @@ GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = NO; INSTALL_PATH = "$(HOME)/bin"; + OTHER_LDFLAGS = "-lcrypto"; PRODUCT_NAME = crash_report; USER_HEADER_SEARCH_PATHS = "../../../../** $(inherited)"; ZERO_LINK = NO; @@ -305,6 +338,7 @@ GCC_MODEL_TUNING = G5; GCC_PRECOMPILE_PREFIX_HEADER = NO; INSTALL_PATH = "$(HOME)/bin"; + OTHER_LDFLAGS = "-lcrypto"; PRODUCT_NAME = crash_report; USER_HEADER_SEARCH_PATHS = "../../../../** $(inherited)"; ZERO_LINK = NO; diff --git a/src/tools/mac/dump_syms/dump_syms.xcodeproj/project.pbxproj b/src/tools/mac/dump_syms/dump_syms.xcodeproj/project.pbxproj index b51a3f19..80f94097 100644 --- a/src/tools/mac/dump_syms/dump_syms.xcodeproj/project.pbxproj +++ b/src/tools/mac/dump_syms/dump_syms.xcodeproj/project.pbxproj @@ -7,10 +7,16 @@ objects = { /* Begin PBXBuildFile section */ - 8DD76F9A0486AA7600D96B5E /* dump_syms.m in Sources */ = {isa = PBXBuildFile; fileRef = 08FB7796FE84155DC02AAC07 /* dump_syms.m */; settings = {ATTRIBUTES = (); }; }; + 8DD76F9A0486AA7600D96B5E /* dump_syms.mm in Sources */ = {isa = PBXBuildFile; fileRef = 08FB7796FE84155DC02AAC07 /* dump_syms.mm */; settings = {ATTRIBUTES = (); }; }; 8DD76F9C0486AA7600D96B5E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 08FB779EFE84155DC02AAC07 /* Foundation.framework */; }; 9BDF186F0B1BB43700F8391B /* dump_syms.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9BDF186D0B1BB43700F8391B /* dump_syms.h */; }; 9BDF18700B1BB43700F8391B /* dump_syms_tool.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BDF186E0B1BB43700F8391B /* dump_syms_tool.m */; }; + 9BE650470B52F6D800611104 /* file_id.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9BE650410B52F6D800611104 /* file_id.cc */; }; + 9BE650480B52F6D800611104 /* file_id.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9BE650420B52F6D800611104 /* file_id.h */; }; + 9BE650490B52F6D800611104 /* macho_id.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9BE650430B52F6D800611104 /* macho_id.cc */; }; + 9BE6504A0B52F6D800611104 /* macho_id.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9BE650440B52F6D800611104 /* macho_id.h */; }; + 9BE6504B0B52F6D800611104 /* macho_walker.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9BE650450B52F6D800611104 /* macho_walker.cc */; }; + 9BE6504C0B52F6D800611104 /* macho_walker.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9BE650460B52F6D800611104 /* macho_walker.h */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -21,17 +27,26 @@ dstSubfolderSpec = 0; files = ( 9BDF186F0B1BB43700F8391B /* dump_syms.h in CopyFiles */, + 9BE650480B52F6D800611104 /* file_id.h in CopyFiles */, + 9BE6504A0B52F6D800611104 /* macho_id.h in CopyFiles */, + 9BE6504C0B52F6D800611104 /* macho_walker.h in CopyFiles */, ); runOnlyForDeploymentPostprocessing = 1; }; /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 08FB7796FE84155DC02AAC07 /* dump_syms.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = dump_syms.m; path = ../../../common/mac/dump_syms.m; sourceTree = "<group>"; }; + 08FB7796FE84155DC02AAC07 /* dump_syms.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = dump_syms.mm; path = ../../../common/mac/dump_syms.mm; sourceTree = "<group>"; }; 08FB779EFE84155DC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; }; 8DD76FA10486AA7600D96B5E /* dump_syms */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = dump_syms; sourceTree = BUILT_PRODUCTS_DIR; }; 9BDF186D0B1BB43700F8391B /* dump_syms.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = dump_syms.h; path = ../../../common/mac/dump_syms.h; sourceTree = "<group>"; }; 9BDF186E0B1BB43700F8391B /* dump_syms_tool.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = dump_syms_tool.m; sourceTree = "<group>"; }; + 9BE650410B52F6D800611104 /* file_id.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = file_id.cc; path = ../../../common/mac/file_id.cc; sourceTree = SOURCE_ROOT; }; + 9BE650420B52F6D800611104 /* file_id.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = file_id.h; path = ../../../common/mac/file_id.h; sourceTree = SOURCE_ROOT; }; + 9BE650430B52F6D800611104 /* macho_id.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = macho_id.cc; path = ../../../common/mac/macho_id.cc; sourceTree = SOURCE_ROOT; }; + 9BE650440B52F6D800611104 /* macho_id.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = macho_id.h; path = ../../../common/mac/macho_id.h; sourceTree = SOURCE_ROOT; }; + 9BE650450B52F6D800611104 /* macho_walker.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = macho_walker.cc; path = ../../../common/mac/macho_walker.cc; sourceTree = SOURCE_ROOT; }; + 9BE650460B52F6D800611104 /* macho_walker.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = macho_walker.h; path = ../../../common/mac/macho_walker.h; sourceTree = SOURCE_ROOT; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -49,8 +64,14 @@ 08FB7794FE84155DC02AAC07 /* dump_syms */ = { isa = PBXGroup; children = ( + 9BE650410B52F6D800611104 /* file_id.cc */, + 9BE650420B52F6D800611104 /* file_id.h */, + 9BE650430B52F6D800611104 /* macho_id.cc */, + 9BE650440B52F6D800611104 /* macho_id.h */, + 9BE650450B52F6D800611104 /* macho_walker.cc */, + 9BE650460B52F6D800611104 /* macho_walker.h */, 9BDF186D0B1BB43700F8391B /* dump_syms.h */, - 08FB7796FE84155DC02AAC07 /* dump_syms.m */, + 08FB7796FE84155DC02AAC07 /* dump_syms.mm */, 9BDF186E0B1BB43700F8391B /* dump_syms_tool.m */, 08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */, 1AB674ADFE9D54B511CA2CBB /* Products */, @@ -115,8 +136,11 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 8DD76F9A0486AA7600D96B5E /* dump_syms.m in Sources */, + 8DD76F9A0486AA7600D96B5E /* dump_syms.mm in Sources */, 9BDF18700B1BB43700F8391B /* dump_syms_tool.m in Sources */, + 9BE650470B52F6D800611104 /* file_id.cc in Sources */, + 9BE650490B52F6D800611104 /* macho_id.cc in Sources */, + 9BE6504B0B52F6D800611104 /* macho_walker.cc in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -127,7 +151,7 @@ isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = NO; - GCC_C_LANGUAGE_STANDARD = c99; + GCC_C_LANGUAGE_STANDARD = "compiler-default"; GCC_DYNAMIC_NO_PIC = NO; GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_ENABLE_OBJC_EXCEPTIONS = YES; @@ -140,7 +164,9 @@ "$(inherited)", ); INSTALL_PATH = "$(HOME)/bin"; + OTHER_LDFLAGS = "-lcrypto"; PRODUCT_NAME = dump_syms; + WARNING_CFLAGS = "-Wall"; ZERO_LINK = NO; }; name = Debug; @@ -152,7 +178,7 @@ ppc, i386, ); - GCC_C_LANGUAGE_STANDARD = c99; + GCC_C_LANGUAGE_STANDARD = "compiler-default"; GCC_ENABLE_OBJC_EXCEPTIONS = YES; GCC_GENERATE_DEBUGGING_SYMBOLS = NO; GCC_MODEL_TUNING = G5; @@ -163,7 +189,9 @@ "$(inherited)", ); INSTALL_PATH = "$(HOME)/bin"; + OTHER_LDFLAGS = "-lcrypto"; PRODUCT_NAME = dump_syms; + WARNING_CFLAGS = "-Wall"; ZERO_LINK = NO; }; name = Release; 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] <mach-o-file>\n", + fprintf(stderr, "Output an Airbag symbol file from a Mach-o file.\n"); + fprintf(stderr, "Usage: %s [-a ppc|i386|x86] <Mach-o file>\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; } 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 <os> <cpu> <uuid> <age> <module-name> - // 0 1 2 3 4 5 - [parameters setObject:@"1" forKey:@"age"]; + // MODULE <os> <cpu> <uuid> <module-name> + // 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] <symbols> <upload-URL>\n", argv[0]); + fprintf(stderr, "Usage: %s <symbols> <upload-URL>\n", argv[0]); fprintf(stderr, "<symbols> should be created by using the dump_syms tool.\n"); fprintf(stderr, "<upload-URL> 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 = "<group>"; }; 08FB779EFE84155DC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; }; - 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 = "<group>"; }; 9BD833690B03E4080055103E /* HTTPMultipartUpload.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HTTPMultipartUpload.m; path = ../../../common/mac/HTTPMultipartUpload.m; sourceTree = "<group>"; }; 9BD835FB0B0544950055103E /* minidump_upload */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = minidump_upload; sourceTree = BUILT_PRODUCTS_DIR; }; |