From 9b6b41b8ca2dc0a1c15d998e82eee472cc93bfe4 Mon Sep 17 00:00:00 2001 From: "qsr@chromium.org" Date: Wed, 3 Oct 2012 16:20:53 +0000 Subject: [PATCH] Add custom implementation of NXGetArchInfoXXX to allow adding new arch. NXGetArchInfoXXX depends on the OS knowledge of architecture. This CL adds a custom implementation of those methods to be able to handle newer CPU before they are handled by the OS. It also add handling for armv7s architecture. Review URL: https://breakpad.appspot.com/475002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1057 4c0a9323-5329-0410-9bdc-e9ce6186880e --- .../mac/Breakpad.xcodeproj/project.pbxproj | 12 +++ src/common/mac/arch_utilities.cc | 80 +++++++++++++++++++ src/common/mac/arch_utilities.h | 47 +++++++++++ src/common/mac/dump_syms.mm | 15 ++-- .../crash_report.xcodeproj/project.pbxproj | 6 ++ .../dump_syms.xcodeproj/project.pbxproj | 8 ++ src/tools/mac/dump_syms/dump_syms_tool.mm | 7 +- src/tools/mac/dump_syms/macho_dump.cc | 6 +- 8 files changed, 170 insertions(+), 11 deletions(-) create mode 100644 src/common/mac/arch_utilities.cc create mode 100644 src/common/mac/arch_utilities.h diff --git a/src/client/mac/Breakpad.xcodeproj/project.pbxproj b/src/client/mac/Breakpad.xcodeproj/project.pbxproj index 3c364c37..9864ed4a 100644 --- a/src/client/mac/Breakpad.xcodeproj/project.pbxproj +++ b/src/client/mac/Breakpad.xcodeproj/project.pbxproj @@ -35,6 +35,10 @@ /* End PBXAggregateTarget section */ /* Begin PBXBuildFile section */ + 162F64F2161C577500CD68D5 /* arch_utilities.cc in Sources */ = {isa = PBXBuildFile; fileRef = 162F64F0161C577500CD68D5 /* arch_utilities.cc */; }; + 162F64F3161C577500CD68D5 /* arch_utilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 162F64F1161C577500CD68D5 /* arch_utilities.h */; }; + 162F64F4161C579B00CD68D5 /* arch_utilities.cc in Sources */ = {isa = PBXBuildFile; fileRef = 162F64F0161C577500CD68D5 /* arch_utilities.cc */; }; + 162F64F5161C579B00CD68D5 /* arch_utilities.h in Sources */ = {isa = PBXBuildFile; fileRef = 162F64F1161C577500CD68D5 /* arch_utilities.h */; }; 163201D61443019E00C4DBF5 /* ConfigFile.h in Headers */ = {isa = PBXBuildFile; fileRef = 163201D41443019E00C4DBF5 /* ConfigFile.h */; }; 163201D71443019E00C4DBF5 /* ConfigFile.mm in Sources */ = {isa = PBXBuildFile; fileRef = 163201D51443019E00C4DBF5 /* ConfigFile.mm */; }; 163201E31443029300C4DBF5 /* ConfigFile.mm in Sources */ = {isa = PBXBuildFile; fileRef = 163201D51443019E00C4DBF5 /* ConfigFile.mm */; }; @@ -555,6 +559,8 @@ 0867D69BFE84028FC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 0867D6A5FE840307C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; }; 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; + 162F64F0161C577500CD68D5 /* arch_utilities.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = arch_utilities.cc; path = ../../common/mac/arch_utilities.cc; sourceTree = ""; }; + 162F64F1161C577500CD68D5 /* arch_utilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = arch_utilities.h; path = ../../common/mac/arch_utilities.h; sourceTree = ""; }; 163201D41443019E00C4DBF5 /* ConfigFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ConfigFile.h; path = crash_generation/ConfigFile.h; sourceTree = ""; }; 163201D51443019E00C4DBF5 /* ConfigFile.mm */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = ConfigFile.mm; path = crash_generation/ConfigFile.mm; sourceTree = ""; }; 163202431443201300C4DBF5 /* uploader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = uploader.h; path = sender/uploader.h; sourceTree = ""; }; @@ -940,6 +946,8 @@ F92C53840ECCE68D009BE4BA /* mac */ = { isa = PBXGroup; children = ( + 162F64F0161C577500CD68D5 /* arch_utilities.cc */, + 162F64F1161C577500CD68D5 /* arch_utilities.h */, 8B31022211F0CE1000FCF3E4 /* GTMGarbageCollection.h */, 8B31007011F0CD3C00FCF3E4 /* GTMDefines.h */, F9C77E0F0F7DDF650045F7DB /* testing */, @@ -1142,6 +1150,7 @@ D2F9A4CC121336C7002747C1 /* crash_generation_server.h in Headers */, 163201D61443019E00C4DBF5 /* ConfigFile.h in Headers */, 16C7C918147D45AE00776EAD /* BreakpadDefines.h in Headers */, + 162F64F3161C577500CD68D5 /* arch_utilities.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1666,6 +1675,7 @@ D2F9A4CB121336C7002747C1 /* crash_generation_client.cc in Sources */, D2F9A4CD121336C7002747C1 /* crash_generation_server.cc in Sources */, 163201D71443019E00C4DBF5 /* ConfigFile.mm in Sources */, + 162F64F2161C577500CD68D5 /* arch_utilities.cc in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1747,6 +1757,8 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 162F64F4161C579B00CD68D5 /* arch_utilities.cc in Sources */, + 162F64F5161C579B00CD68D5 /* arch_utilities.h in Sources */, D2A5DD301188633800081F03 /* breakpad_nlist_64.cc in Sources */, F92C563F0ECD10CA009BE4BA /* convert_UTF.c in Sources */, F92C56400ECD10CA009BE4BA /* dynamic_images.cc in Sources */, diff --git a/src/common/mac/arch_utilities.cc b/src/common/mac/arch_utilities.cc new file mode 100644 index 00000000..6f7c494c --- /dev/null +++ b/src/common/mac/arch_utilities.cc @@ -0,0 +1,80 @@ +// Copyright (c) 2012, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include "common/mac/arch_utilities.h" + +#include +#include +#include + +#ifndef CPU_TYPE_ARM +#define CPU_TYPE_ARM (static_cast(12)) +#endif // CPU_TYPE_ARM + +#ifndef CPU_SUBTYPE_ARM_V7 +#define CPU_SUBTYPE_ARM_V7 (static_cast(9)) +#endif // CPU_SUBTYPE_ARM_V7 + +#ifndef CPU_SUBTYPE_ARM_V7S +#define CPU_SUBTYPE_ARM_V7S (static_cast(11)) +#endif // CPU_SUBTYPE_ARM_V7S + +namespace { + +const NXArchInfo* ArchInfo_armv7s() { + NXArchInfo* armv7s = new NXArchInfo; + *armv7s = *NXGetArchInfoFromCpuType(CPU_TYPE_ARM, + CPU_SUBTYPE_ARM_V7); + armv7s->name = "armv7s"; + armv7s->cpusubtype = CPU_SUBTYPE_ARM_V7S; + return armv7s; +} + +} // namespace + +namespace google_breakpad { + +const NXArchInfo* BreakpadGetArchInfoFromName(const char* arch_name) { + // TODO: Remove this when the OS knows about armv7s. + if (!strcmp("armv7s", arch_name)) + return BreakpadGetArchInfoFromCpuType(CPU_TYPE_ARM, CPU_SUBTYPE_ARM_V7S); + return NXGetArchInfoFromName(arch_name); +} + +const NXArchInfo* BreakpadGetArchInfoFromCpuType(cpu_type_t cpu_type, + cpu_subtype_t cpu_subtype) { + // TODO: Remove this when the OS knows about armv7s. + if (cpu_type == CPU_TYPE_ARM && cpu_subtype == CPU_SUBTYPE_ARM_V7S) { + static const NXArchInfo* armv7s = ArchInfo_armv7s(); + return armv7s; + } + return NXGetArchInfoFromCpuType(cpu_type, cpu_subtype); +} + +} // namespace google_breakpad diff --git a/src/common/mac/arch_utilities.h b/src/common/mac/arch_utilities.h new file mode 100644 index 00000000..397c1f58 --- /dev/null +++ b/src/common/mac/arch_utilities.h @@ -0,0 +1,47 @@ +// Copyright (c) 2012, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// arch_utilities.h: Utilities for architecture introspection for Mac platform. + +#ifndef COMMON_MAC_ARCH_UTILITIES_H__ +#define COMMON_MAC_ARCH_UTILITIES_H__ + +#include + +namespace google_breakpad { + +// Custom implementation of |NXGetArchInfoFromName| and +// |NXGetArchInfoFromCpuType| that handle newer CPU on older OSes. +const NXArchInfo* BreakpadGetArchInfoFromName(const char* arch_name); +const NXArchInfo* BreakpadGetArchInfoFromCpuType(cpu_type_t cpu_type, + cpu_subtype_t cpu_subtype); + +} // namespace google_breakpad + +#endif // COMMON_MAC_ARCH_UTILITIES_H__ diff --git a/src/common/mac/dump_syms.mm b/src/common/mac/dump_syms.mm index 9783514f..ad2afd01 100644 --- a/src/common/mac/dump_syms.mm +++ b/src/common/mac/dump_syms.mm @@ -50,6 +50,7 @@ #include "common/dwarf_cu_to_module.h" #include "common/dwarf_line_to_module.h" #include "common/mac/file_id.h" +#include "common/mac/arch_utilities.h" #include "common/mac/macho_reader.h" #include "common/module.h" #include "common/stabs_reader.h" @@ -191,7 +192,8 @@ bool DumpSymbols::SetArchitecture(cpu_type_t cpu_type, bool DumpSymbols::SetArchitecture(const std::string &arch_name) { bool arch_set = false; - const NXArchInfo *arch_info = NXGetArchInfoFromName(arch_name.c_str()); + const NXArchInfo *arch_info = + google_breakpad::BreakpadGetArchInfoFromName(arch_name.c_str()); if (arch_info) { arch_set = SetArchitecture(arch_info->cputype, arch_info->cpusubtype); } @@ -312,9 +314,8 @@ bool DumpSymbols::ReadCFI(google_breakpad::Module *module, register_names = DwarfCFIToModule::RegisterNames::ARM(); break; default: { - const NXArchInfo *arch = - NXGetArchInfoFromCpuType(macho_reader.cpu_type(), - macho_reader.cpu_subtype()); + const NXArchInfo *arch = google_breakpad::BreakpadGetArchInfoFromCpuType( + macho_reader.cpu_type(), macho_reader.cpu_subtype()); fprintf(stderr, "%s: cannot convert DWARF call frame information for ", selected_object_name_.c_str()); if (arch) @@ -446,9 +447,9 @@ bool DumpSymbols::WriteSymbolFile(std::ostream &stream, bool cfi) { // Find the name of the selected file's architecture, to appear in // the MODULE record and in error messages. - const NXArchInfo *selected_arch_info - = NXGetArchInfoFromCpuType(selected_object_file_->cputype, - selected_object_file_->cpusubtype); + const NXArchInfo *selected_arch_info = + google_breakpad::BreakpadGetArchInfoFromCpuType( + selected_object_file_->cputype, selected_object_file_->cpusubtype); const char *selected_arch_name = selected_arch_info->name; if (strcmp(selected_arch_name, "i386") == 0) 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 8d5dece5..9c20ea19 100644 --- a/src/tools/mac/crash_report/crash_report.xcodeproj/project.pbxproj +++ b/src/tools/mac/crash_report/crash_report.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 162F64FE161C5ECB00CD68D5 /* arch_utilities.cc in Sources */ = {isa = PBXBuildFile; fileRef = 162F64FC161C5ECB00CD68D5 /* arch_utilities.cc */; }; 4D2C721B126F9ACC00B43EAF /* source_line_resolver_base.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D2C721A126F9ACC00B43EAF /* source_line_resolver_base.cc */; }; 4D2C721F126F9ADE00B43EAF /* exploitability.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D2C721E126F9ADE00B43EAF /* exploitability.cc */; }; 4D2C7223126F9AF900B43EAF /* exploitability_win.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D2C7222126F9AF900B43EAF /* exploitability_win.cc */; }; @@ -66,6 +67,8 @@ /* Begin PBXFileReference section */ 08FB7796FE84155DC02AAC07 /* crash_report.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = crash_report.mm; sourceTree = ""; }; 08FB779EFE84155DC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + 162F64FC161C5ECB00CD68D5 /* arch_utilities.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = arch_utilities.cc; path = ../../../common/mac/arch_utilities.cc; sourceTree = ""; }; + 162F64FD161C5ECB00CD68D5 /* arch_utilities.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = arch_utilities.h; path = ../../../common/mac/arch_utilities.h; sourceTree = ""; }; 4D2C721A126F9ACC00B43EAF /* source_line_resolver_base.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = source_line_resolver_base.cc; path = ../../../processor/source_line_resolver_base.cc; sourceTree = SOURCE_ROOT; }; 4D2C721E126F9ADE00B43EAF /* exploitability.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = exploitability.cc; path = ../../../processor/exploitability.cc; sourceTree = SOURCE_ROOT; }; 4D2C7222126F9AF900B43EAF /* exploitability_win.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = exploitability_win.cc; path = ../../../processor/exploitability_win.cc; sourceTree = SOURCE_ROOT; }; @@ -183,6 +186,8 @@ 8B3102DA11F0D65600FCF3E4 /* BreakpadDebug.xcconfig */, 8B3102DB11F0D65600FCF3E4 /* BreakpadRelease.xcconfig */, F9C7ECE10E8ABC7F00E953AD /* DWARF */, + 162F64FC161C5ECB00CD68D5 /* arch_utilities.cc */, + 162F64FD161C5ECB00CD68D5 /* arch_utilities.h */, 5578003E0BE1F28500EC23E0 /* macho_utilities.cc */, 5578003F0BE1F28500EC23E0 /* macho_utilities.h */, 8B31FF7211F0C6E000FCF3E4 /* macho_reader.cc */, @@ -410,6 +415,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 162F64FE161C5ECB00CD68D5 /* arch_utilities.cc in Sources */, 8DD76F9A0486AA7600D96B5E /* crash_report.mm in Sources */, 9BDF172C0B1B8B2400F8391B /* call_stack.cc in Sources */, 9BDF172D0B1B8B2400F8391B /* minidump_processor.cc in Sources */, 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 43b49d96..16759f4c 100644 --- a/src/tools/mac/dump_syms/dump_syms.xcodeproj/project.pbxproj +++ b/src/tools/mac/dump_syms/dump_syms.xcodeproj/project.pbxproj @@ -33,6 +33,8 @@ /* End PBXAggregateTarget section */ /* Begin PBXBuildFile section */ + 162F64FA161C591500CD68D5 /* arch_utilities.cc in Sources */ = {isa = PBXBuildFile; fileRef = 162F64F8161C591500CD68D5 /* arch_utilities.cc */; }; + 162F6500161C5F2200CD68D5 /* arch_utilities.cc in Sources */ = {isa = PBXBuildFile; fileRef = 162F64F8161C591500CD68D5 /* arch_utilities.cc */; }; 4D72CAF513DFBAC2006CABE3 /* md5.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D72CAF413DFBAC2006CABE3 /* md5.cc */; }; B84A91F8116CF78F006C210E /* libgtestmockall.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B88FB024116BDFFF00407530 /* libgtestmockall.a */; }; B84A91FB116CF7AF006C210E /* module.cc in Sources */ = {isa = PBXBuildFile; fileRef = B88FAE241166603300407530 /* module.cc */; }; @@ -270,6 +272,8 @@ /* Begin PBXFileReference section */ 08FB7796FE84155DC02AAC07 /* dump_syms.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = dump_syms.mm; path = ../../../common/mac/dump_syms.mm; sourceTree = ""; }; 08FB779EFE84155DC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + 162F64F8161C591500CD68D5 /* arch_utilities.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = arch_utilities.cc; path = ../../../common/mac/arch_utilities.cc; sourceTree = ""; }; + 162F64F9161C591500CD68D5 /* arch_utilities.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = arch_utilities.h; path = ../../../common/mac/arch_utilities.h; sourceTree = ""; }; 4D72CAF413DFBAC2006CABE3 /* md5.cc */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; fileEncoding = 4; name = md5.cc; path = ../../../common/md5.cc; sourceTree = SOURCE_ROOT; }; 557800890BE1F3AB00EC23E0 /* macho_utilities.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = macho_utilities.cc; path = ../../../common/mac/macho_utilities.cc; sourceTree = SOURCE_ROOT; }; 5578008A0BE1F3AB00EC23E0 /* macho_utilities.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = macho_utilities.h; path = ../../../common/mac/macho_utilities.h; sourceTree = SOURCE_ROOT; }; @@ -481,6 +485,8 @@ B89E0E6C1166569700DD08C9 /* MACHO */, B88FAE3811666A1700407530 /* STABS */, B88FAE1C11665FFD00407530 /* MODULE */, + 162F64F8161C591500CD68D5 /* arch_utilities.cc */, + 162F64F9161C591500CD68D5 /* arch_utilities.h */, B88FAE1D1166603300407530 /* byte_cursor.h */, B88FB0D4116CEC0600407530 /* byte_cursor_unittest.cc */, B8E8CA0C1156C854009E61B2 /* byteswap.h */, @@ -1044,6 +1050,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 162F6500161C5F2200CD68D5 /* arch_utilities.cc in Sources */, B89E0E781166576C00DD08C9 /* macho_reader.cc in Sources */, B89E0E7A1166576C00DD08C9 /* macho_dump.cc in Sources */, ); @@ -1062,6 +1069,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 162F64FA161C591500CD68D5 /* arch_utilities.cc in Sources */, B88FAE2C1166606200407530 /* macho_reader.cc in Sources */, B8C5B5171166534700D34F4E /* dwarf2reader.cc in Sources */, B8C5B5181166534700D34F4E /* bytereader.cc in Sources */, diff --git a/src/tools/mac/dump_syms/dump_syms_tool.mm b/src/tools/mac/dump_syms/dump_syms_tool.mm index 92ebf211..14bbcbbd 100644 --- a/src/tools/mac/dump_syms/dump_syms_tool.mm +++ b/src/tools/mac/dump_syms/dump_syms_tool.mm @@ -39,6 +39,7 @@ #include #include "common/mac/dump_syms.h" +#include "common/mac/arch_utilities.h" #include "common/mac/macho_utilities.h" using google_breakpad::DumpSymbols; @@ -73,7 +74,8 @@ static bool Start(const Options &options) { for (size_t i = 0; i < available_size; i++) { const struct fat_arch *arch = &available[i]; const NXArchInfo *arch_info = - NXGetArchInfoFromCpuType(arch->cputype, arch->cpusubtype); + google_breakpad::BreakpadGetArchInfoFromCpuType( + arch->cputype, arch->cpusubtype); if (arch_info) fprintf(stderr, "%s (%s)\n", arch_info->name, arch_info->description); else @@ -107,7 +109,8 @@ static void SetupOptions(int argc, const char *argv[], Options *options) { while ((ch = getopt(argc, (char * const *)argv, "a:ch?")) != -1) { switch (ch) { case 'a': { - const NXArchInfo *arch_info = NXGetArchInfoFromName(optarg); + const NXArchInfo *arch_info = + google_breakpad::BreakpadGetArchInfoFromName(optarg); if (!arch_info) { fprintf(stderr, "%s: Invalid architecture: %s\n", argv[0], optarg); Usage(argc, argv); diff --git a/src/tools/mac/dump_syms/macho_dump.cc b/src/tools/mac/dump_syms/macho_dump.cc index 940df25b..4402bf4e 100644 --- a/src/tools/mac/dump_syms/macho_dump.cc +++ b/src/tools/mac/dump_syms/macho_dump.cc @@ -47,6 +47,7 @@ #include #include "common/byte_cursor.h" +#include "common/mac/arch_utilities.h" #include "common/mac/macho_reader.h" using google_breakpad::ByteBuffer; @@ -142,8 +143,9 @@ void DumpFile(const char *filename) { printf(" object file count: %ld\n", object_files_size); for (size_t i = 0; i < object_files_size; i++) { const struct fat_arch &file = object_files[i]; - const NXArchInfo *fat_arch_info - = NXGetArchInfoFromCpuType(file.cputype, file.cpusubtype); + const NXArchInfo *fat_arch_info = + google_breakpad::BreakpadGetArchInfoFromCpuType( + file.cputype, file.cpusubtype); printf("\n object file %ld:\n" " fat header:\n:" " CPU type: %s (%s)\n"