Index: include/lldb/Host/SafeMachO.h =================================================================== --- include/lldb/Host/SafeMachO.h +++ include/lldb/Host/SafeMachO.h @@ -0,0 +1,116 @@ +//===-- SafeMachO.h -----------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +#ifndef liblldb_SafeMachO_h_ +#define liblldb_SafeMachO_h_ + +// This header file is required to work around collisions between the defines +// in mach/machine.h, and enum members of the same name in llvm's MachO.h. If +// you want to use llvm/Support/MachO.h, use this file instead. The caveats +// are: 1) You can only use the MachO.h enums, you can't use the defines. That +// won't make a difference since the values +// are the same. +// 2) If you need any header file that relies on mach/machine.h, you must +// include that first. 3) This isn't a total solution, it doesn't undef every +// define that MachO.h has borrowed from various system headers, +// only the ones that come from mach/machine.h because that is the one we +// ended up pulling in from various places. +// + +#undef CPU_ARCH_MASK +#undef CPU_ARCH_ABI64 + +#undef CPU_TYPE_ANY +#undef CPU_TYPE_X86 +#undef CPU_TYPE_I386 +#undef CPU_TYPE_X86_64 +#undef CPU_TYPE_MC98000 +#undef CPU_TYPE_ARM +#undef CPU_TYPE_ARM64 +#undef CPU_TYPE_SPARC +#undef CPU_TYPE_POWERPC +#undef CPU_TYPE_POWERPC64 + +#undef CPU_SUB_TYPE_MASK +#undef CPU_SUB_TYPE_LIB64 + +#undef CPU_SUBTYPE_MULTIPLE + +#undef CPU_SUBTYPE_I386_ALL +#undef CPU_SUBTYPE_386 +#undef CPU_SUBTYPE_486 +#undef CPU_SUBTYPE_486SX +#undef CPU_SUBTYPE_586 +#undef CPU_SUBTYPE_PENT +#undef CPU_SUBTYPE_PENTPRO +#undef CPU_SUBTYPE_PENTII_M3 +#undef CPU_SUBTYPE_PENTII_M5 +#undef CPU_SUBTYPE_CELERON +#undef CPU_SUBTYPE_CELERON_MOBILE +#undef CPU_SUBTYPE_PENTIUM_3 +#undef CPU_SUBTYPE_PENTIUM_3_M +#undef CPU_SUBTYPE_PENTIUM_3_XEON +#undef CPU_SUBTYPE_PENTIUM_M +#undef CPU_SUBTYPE_PENTIUM_4 +#undef CPU_SUBTYPE_PENTIUM_4_M +#undef CPU_SUBTYPE_ITANIUM +#undef CPU_SUBTYPE_ITANIUM_2 +#undef CPU_SUBTYPE_XEON +#undef CPU_SUBTYPE_XEON_MP + +#undef CPU_SUBTYPE_X86_ALL +#undef CPU_SUBTYPE_X86_64_ALL +#undef CPU_SUBTYPE_X86_ARCH1 +#undef CPU_SUBTYPE_X86_64_H + +#undef CPU_SUBTYPE_INTEL +#undef CPU_SUBTYPE_INTEL_FAMILY +#undef CPU_SUBTYPE_INTEL_FAMILY_MAX +#undef CPU_SUBTYPE_INTEL_MODEL +#undef CPU_SUBTYPE_INTEL_MODEL_ALL + +#undef CPU_SUBTYPE_ARM +#undef CPU_SUBTYPE_ARM_ALL +#undef CPU_SUBTYPE_ARM_V4T +#undef CPU_SUBTYPE_ARM_V6 +#undef CPU_SUBTYPE_ARM_V5 +#undef CPU_SUBTYPE_ARM_V5TEJ +#undef CPU_SUBTYPE_ARM_XSCALE +#undef CPU_SUBTYPE_ARM_V7 + +#undef CPU_SUBTYPE_ARM_V7S +#undef CPU_SUBTYPE_ARM_V7K +#undef CPU_SUBTYPE_ARM_V6M +#undef CPU_SUBTYPE_ARM_V7M +#undef CPU_SUBTYPE_ARM_V7EM + +#undef CPU_SUBTYPE_ARM64_ALL + +#undef CPU_SUBTYPE_SPARC_ALL + +#undef CPU_SUBTYPE_POWERPC +#undef CPU_SUBTYPE_POWERPC_ALL +#undef CPU_SUBTYPE_POWERPC_601 +#undef CPU_SUBTYPE_POWERPC_602 +#undef CPU_SUBTYPE_POWERPC_603 +#undef CPU_SUBTYPE_POWERPC_603e +#undef CPU_SUBTYPE_POWERPC_603ev +#undef CPU_SUBTYPE_POWERPC_604 +#undef CPU_SUBTYPE_POWERPC_604e +#undef CPU_SUBTYPE_POWERPC_620 +#undef CPU_SUBTYPE_POWERPC_750 +#undef CPU_SUBTYPE_POWERPC_7400 +#undef CPU_SUBTYPE_POWERPC_7450 +#undef CPU_SUBTYPE_POWERPC_970 + +#undef CPU_SUBTYPE_MC980000_ALL +#undef CPU_SUBTYPE_MC98601 + +#include "llvm/BinaryFormat/MachO.h" + +#endif // liblldb_SafeMachO_h_ Index: include/lldb/Utility/SafeMachO.h =================================================================== --- include/lldb/Utility/SafeMachO.h +++ include/lldb/Utility/SafeMachO.h @@ -1,116 +0,0 @@ -//===-- SafeMachO.h -----------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -#ifndef liblldb_SafeMachO_h_ -#define liblldb_SafeMachO_h_ - -// This header file is required to work around collisions between the defines -// in mach/machine.h, and enum members of the same name in llvm's MachO.h. If -// you want to use llvm/Support/MachO.h, use this file instead. The caveats -// are: 1) You can only use the MachO.h enums, you can't use the defines. That -// won't make a difference since the values -// are the same. -// 2) If you need any header file that relies on mach/machine.h, you must -// include that first. 3) This isn't a total solution, it doesn't undef every -// define that MachO.h has borrowed from various system headers, -// only the ones that come from mach/machine.h because that is the one we -// ended up pulling in from various places. -// - -#undef CPU_ARCH_MASK -#undef CPU_ARCH_ABI64 - -#undef CPU_TYPE_ANY -#undef CPU_TYPE_X86 -#undef CPU_TYPE_I386 -#undef CPU_TYPE_X86_64 -#undef CPU_TYPE_MC98000 -#undef CPU_TYPE_ARM -#undef CPU_TYPE_ARM64 -#undef CPU_TYPE_SPARC -#undef CPU_TYPE_POWERPC -#undef CPU_TYPE_POWERPC64 - -#undef CPU_SUB_TYPE_MASK -#undef CPU_SUB_TYPE_LIB64 - -#undef CPU_SUBTYPE_MULTIPLE - -#undef CPU_SUBTYPE_I386_ALL -#undef CPU_SUBTYPE_386 -#undef CPU_SUBTYPE_486 -#undef CPU_SUBTYPE_486SX -#undef CPU_SUBTYPE_586 -#undef CPU_SUBTYPE_PENT -#undef CPU_SUBTYPE_PENTPRO -#undef CPU_SUBTYPE_PENTII_M3 -#undef CPU_SUBTYPE_PENTII_M5 -#undef CPU_SUBTYPE_CELERON -#undef CPU_SUBTYPE_CELERON_MOBILE -#undef CPU_SUBTYPE_PENTIUM_3 -#undef CPU_SUBTYPE_PENTIUM_3_M -#undef CPU_SUBTYPE_PENTIUM_3_XEON -#undef CPU_SUBTYPE_PENTIUM_M -#undef CPU_SUBTYPE_PENTIUM_4 -#undef CPU_SUBTYPE_PENTIUM_4_M -#undef CPU_SUBTYPE_ITANIUM -#undef CPU_SUBTYPE_ITANIUM_2 -#undef CPU_SUBTYPE_XEON -#undef CPU_SUBTYPE_XEON_MP - -#undef CPU_SUBTYPE_X86_ALL -#undef CPU_SUBTYPE_X86_64_ALL -#undef CPU_SUBTYPE_X86_ARCH1 -#undef CPU_SUBTYPE_X86_64_H - -#undef CPU_SUBTYPE_INTEL -#undef CPU_SUBTYPE_INTEL_FAMILY -#undef CPU_SUBTYPE_INTEL_FAMILY_MAX -#undef CPU_SUBTYPE_INTEL_MODEL -#undef CPU_SUBTYPE_INTEL_MODEL_ALL - -#undef CPU_SUBTYPE_ARM -#undef CPU_SUBTYPE_ARM_ALL -#undef CPU_SUBTYPE_ARM_V4T -#undef CPU_SUBTYPE_ARM_V6 -#undef CPU_SUBTYPE_ARM_V5 -#undef CPU_SUBTYPE_ARM_V5TEJ -#undef CPU_SUBTYPE_ARM_XSCALE -#undef CPU_SUBTYPE_ARM_V7 - -#undef CPU_SUBTYPE_ARM_V7S -#undef CPU_SUBTYPE_ARM_V7K -#undef CPU_SUBTYPE_ARM_V6M -#undef CPU_SUBTYPE_ARM_V7M -#undef CPU_SUBTYPE_ARM_V7EM - -#undef CPU_SUBTYPE_ARM64_ALL - -#undef CPU_SUBTYPE_SPARC_ALL - -#undef CPU_SUBTYPE_POWERPC -#undef CPU_SUBTYPE_POWERPC_ALL -#undef CPU_SUBTYPE_POWERPC_601 -#undef CPU_SUBTYPE_POWERPC_602 -#undef CPU_SUBTYPE_POWERPC_603 -#undef CPU_SUBTYPE_POWERPC_603e -#undef CPU_SUBTYPE_POWERPC_603ev -#undef CPU_SUBTYPE_POWERPC_604 -#undef CPU_SUBTYPE_POWERPC_604e -#undef CPU_SUBTYPE_POWERPC_620 -#undef CPU_SUBTYPE_POWERPC_750 -#undef CPU_SUBTYPE_POWERPC_7400 -#undef CPU_SUBTYPE_POWERPC_7450 -#undef CPU_SUBTYPE_POWERPC_970 - -#undef CPU_SUBTYPE_MC980000_ALL -#undef CPU_SUBTYPE_MC98601 - -#include "llvm/BinaryFormat/MachO.h" - -#endif // liblldb_SafeMachO_h_ Index: include/lldb/module.modulemap =================================================================== --- include/lldb/module.modulemap +++ include/lldb/module.modulemap @@ -41,6 +41,7 @@ module ProcessLauncher { header "Host/ProcessLauncher.h" export * } module ProcessRunLock { header "Host/ProcessRunLock.h" export * } module PseudoTerminal { header "Host/PseudoTerminal.h" export * } + module SafeMachO { header "Host/SafeMachO.h" export * } module SocketAddress { header "Host/SocketAddress.h" export * } module Socket { header "Host/Socket.h" export * } module StringConvert { header "Host/StringConvert.h" export * } Index: source/Host/common/Symbols.cpp =================================================================== --- source/Host/common/Symbols.cpp +++ source/Host/common/Symbols.cpp @@ -16,7 +16,6 @@ #include "lldb/Utility/DataBuffer.h" #include "lldb/Utility/DataExtractor.h" #include "lldb/Utility/Log.h" -#include "lldb/Utility/SafeMachO.h" #include "lldb/Utility/StreamString.h" #include "lldb/Utility/Timer.h" #include "lldb/Utility/UUID.h" @@ -29,7 +28,6 @@ using namespace lldb; using namespace lldb_private; -using namespace llvm::MachO; #if defined(__APPLE__) Index: source/Host/macosx/Symbols.cpp =================================================================== --- source/Host/macosx/Symbols.cpp +++ source/Host/macosx/Symbols.cpp @@ -10,7 +10,6 @@ #include "lldb/Host/Symbols.h" // C Includes -#include "lldb/Utility/SafeMachO.h" #include #include @@ -42,7 +41,6 @@ using namespace lldb; using namespace lldb_private; -using namespace llvm::MachO; #if !defined(__arm__) && !defined(__arm64__) && \ !defined(__aarch64__) // No DebugSymbols on the iOS devices Index: source/Host/macosx/objcxx/HostInfoMacOSX.mm =================================================================== --- source/Host/macosx/objcxx/HostInfoMacOSX.mm +++ source/Host/macosx/objcxx/HostInfoMacOSX.mm @@ -11,7 +11,6 @@ #include "lldb/Host/macosx/HostInfoMacOSX.h" #include "lldb/Utility/Args.h" #include "lldb/Utility/Log.h" -#include "lldb/Utility/SafeMachO.h" #include "llvm/ADT/SmallString.h" #include "llvm/Support/FileSystem.h" Index: source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h =================================================================== --- source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h +++ source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h @@ -18,7 +18,7 @@ // Other libraries and framework includes -#include "lldb/Utility/SafeMachO.h" +#include "lldb/Host/SafeMachO.h" // Project includes #include "lldb/Target/DynamicLoader.h" Index: source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.h =================================================================== --- source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.h +++ source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.h @@ -18,10 +18,10 @@ // Other libraries and framework includes // Project includes +#include "lldb/Host/SafeMachO.h" #include "lldb/Target/DynamicLoader.h" #include "lldb/Target/Process.h" #include "lldb/Utility/FileSpec.h" -#include "lldb/Utility/SafeMachO.h" #include "lldb/Utility/StructuredData.h" #include "lldb/Utility/UUID.h" Index: source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h =================================================================== --- source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h +++ source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h @@ -28,7 +28,6 @@ #include "lldb/Target/DynamicLoader.h" #include "lldb/Target/Process.h" #include "lldb/Utility/FileSpec.h" -#include "lldb/Utility/SafeMachO.h" #include "lldb/Utility/StructuredData.h" #include "lldb/Utility/UUID.h" Index: source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h =================================================================== --- source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h +++ source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h @@ -28,10 +28,10 @@ // Other libraries and framework includes // Project includes +#include "lldb/Host/SafeMachO.h" #include "lldb/Target/DynamicLoader.h" #include "lldb/Target/Process.h" #include "lldb/Utility/FileSpec.h" -#include "lldb/Utility/SafeMachO.h" #include "lldb/Utility/StructuredData.h" #include "lldb/Utility/UUID.h" Index: source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h =================================================================== --- source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h +++ source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h @@ -14,9 +14,9 @@ // C++ Includes // Other libraries and framework includes // Project includes +#include "lldb/Host/SafeMachO.h" #include "lldb/Symbol/ObjectContainer.h" #include "lldb/Utility/FileSpec.h" -#include "lldb/Utility/SafeMachO.h" class ObjectContainerUniversalMachO : public lldb_private::ObjectContainer { public: Index: source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h =================================================================== --- source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h +++ source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h @@ -17,9 +17,9 @@ #include "lldb/Core/Address.h" #include "lldb/Core/FileSpecList.h" #include "lldb/Core/RangeMap.h" +#include "lldb/Host/SafeMachO.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Utility/FileSpec.h" -#include "lldb/Utility/SafeMachO.h" #include "lldb/Utility/UUID.h" //---------------------------------------------------------------------- Index: source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp =================================================================== --- source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp +++ source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp @@ -46,7 +46,7 @@ #include "lldb/Utility/Timer.h" #include "lldb/Utility/UUID.h" -#include "lldb/Utility/SafeMachO.h" +#include "lldb/Host/SafeMachO.h" #include "llvm/Support/MemoryBuffer.h" Index: source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp =================================================================== --- source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp +++ source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp @@ -9,7 +9,7 @@ #include "ThreadKDP.h" -#include "lldb/Utility/SafeMachO.h" +#include "lldb/Host/SafeMachO.h" #include "lldb/Breakpoint/Watchpoint.h" #include "lldb/Target/Process.h" Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp =================================================================== --- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp +++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp @@ -28,6 +28,7 @@ #include "lldb/Host/FileSystem.h" #include "lldb/Host/Host.h" #include "lldb/Host/HostInfo.h" +#include "lldb/Host/SafeMachO.h" #include "lldb/Interpreter/OptionArgParser.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Target/FileAction.h" @@ -36,7 +37,6 @@ #include "lldb/Utility/Endian.h" #include "lldb/Utility/JSON.h" #include "lldb/Utility/Log.h" -#include "lldb/Utility/SafeMachO.h" #include "lldb/Utility/StreamGDBRemote.h" #include "lldb/Utility/StreamString.h" #include "llvm/ADT/Triple.h" Index: source/Plugins/Process/mach-core/ProcessMachCore.cpp =================================================================== --- source/Plugins/Process/mach-core/ProcessMachCore.cpp +++ source/Plugins/Process/mach-core/ProcessMachCore.cpp @@ -39,7 +39,7 @@ #include "ThreadMachCore.h" // Needed for the plug-in names for the dynamic loaders. -#include "lldb/Utility/SafeMachO.h" +#include "lldb/Host/SafeMachO.h" #include "Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h" #include "Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h" Index: source/Plugins/Process/mach-core/ThreadMachCore.cpp =================================================================== --- source/Plugins/Process/mach-core/ThreadMachCore.cpp +++ source/Plugins/Process/mach-core/ThreadMachCore.cpp @@ -9,8 +9,6 @@ #include "ThreadMachCore.h" -#include "lldb/Utility/SafeMachO.h" - #include "lldb/Breakpoint/Watchpoint.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Target/Process.h"