Author: jmolenda Date: Wed Oct 10 17:28:35 2018 New Revision: 344209 URL: http://llvm.org/viewvc/llvm-project?rev=344209&view=rev Log: Upstreaming the BridgeOS device support and the LC_BUILD_VERSION load command handling - this commit is a combination of patches by Adrian Prantl and myself. llvm::Triple::BridgeOS isn't defined yet, so all references to that are currently commented out.
Also update Xcode project file to build the NativePDB etc plugins. <rdar://problem/43353615> Added: lldb/trunk/lit/Modules/lc_build_version.yaml lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.h Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj lldb/trunk/scripts/Xcode/package-clang-headers.py lldb/trunk/source/API/SystemInitializerFull.cpp lldb/trunk/source/Host/macosx/objcxx/HostInfoMacOSX.mm lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp lldb/trunk/source/Plugins/Platform/MacOSX/CMakeLists.txt lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp lldb/trunk/source/Utility/ArchSpec.cpp Added: lldb/trunk/lit/Modules/lc_build_version.yaml URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Modules/lc_build_version.yaml?rev=344209&view=auto ============================================================================== --- lldb/trunk/lit/Modules/lc_build_version.yaml (added) +++ lldb/trunk/lit/Modules/lc_build_version.yaml Wed Oct 10 17:28:35 2018 @@ -0,0 +1,210 @@ +# RUN: yaml2obj %s > %t.out +# RUN: lldb-test symbols %t.out | FileCheck %s +# REQUIRES: darwin +# Test that the deployment target is parsed from the load commands. +# CHECK: x86_64-apple-macosx10.14.0 +--- !mach-o +FileHeader: + magic: 0xFEEDFACF + cputype: 0x01000007 + cpusubtype: 0x80000003 + filetype: 0x00000002 + ncmds: 14 + sizeofcmds: 744 + flags: 0x00200085 + reserved: 0x00000000 +LoadCommands: + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: __PAGEZERO + vmaddr: 0 + vmsize: 4294967296 + fileoff: 0 + filesize: 0 + maxprot: 0 + initprot: 0 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 232 + segname: __TEXT + vmaddr: 4294967296 + vmsize: 4096 + fileoff: 0 + filesize: 4096 + maxprot: 7 + initprot: 5 + nsects: 2 + flags: 0 + Sections: + - sectname: __text + segname: __TEXT + addr: 0x0000000100000FB0 + size: 8 + offset: 0x00000FB0 + align: 4 + reloff: 0x00000000 + nreloc: 0 + flags: 0x80000400 + reserved1: 0x00000000 + reserved2: 0x00000000 + reserved3: 0x00000000 + - sectname: __unwind_info + segname: __TEXT + addr: 0x0000000100000FB8 + size: 72 + offset: 0x00000FB8 + align: 2 + reloff: 0x00000000 + nreloc: 0 + flags: 0x00000000 + reserved1: 0x00000000 + reserved2: 0x00000000 + reserved3: 0x00000000 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: __LINKEDIT + vmaddr: 4294971392 + vmsize: 4096 + fileoff: 4096 + filesize: 152 + maxprot: 7 + initprot: 1 + nsects: 0 + flags: 0 + - cmd: LC_DYLD_INFO_ONLY + cmdsize: 48 + rebase_off: 0 + rebase_size: 0 + bind_off: 0 + bind_size: 0 + weak_bind_off: 0 + weak_bind_size: 0 + lazy_bind_off: 0 + lazy_bind_size: 0 + export_off: 4096 + export_size: 48 + - cmd: LC_SYMTAB + cmdsize: 24 + symoff: 4152 + nsyms: 3 + stroff: 4200 + strsize: 48 + - cmd: LC_DYSYMTAB + cmdsize: 80 + ilocalsym: 0 + nlocalsym: 0 + iextdefsym: 0 + nextdefsym: 2 + iundefsym: 2 + nundefsym: 1 + tocoff: 0 + ntoc: 0 + modtaboff: 0 + nmodtab: 0 + extrefsymoff: 0 + nextrefsyms: 0 + indirectsymoff: 0 + nindirectsyms: 0 + extreloff: 0 + nextrel: 0 + locreloff: 0 + nlocrel: 0 + - cmd: LC_LOAD_DYLINKER + cmdsize: 32 + name: 12 + PayloadString: /usr/lib/dyld + ZeroPadBytes: 7 + - cmd: LC_UUID + cmdsize: 24 + uuid: 8F41E140-23B9-3720-AC28-4E7AF9D159BA + - cmd: LC_BUILD_VERSION + cmdsize: 32 + platform: 1 + minos: 658944 + sdk: 658944 + ntools: 1 + Tools: + - tool: 3 + version: 26738944 + - cmd: LC_SOURCE_VERSION + cmdsize: 16 + version: 0 + - cmd: LC_MAIN + cmdsize: 24 + entryoff: 4016 + stacksize: 0 + - cmd: LC_LOAD_DYLIB + cmdsize: 56 + dylib: + name: 24 + timestamp: 2 + current_version: 82102276 + compatibility_version: 65536 + PayloadString: /usr/lib/libSystem.B.dylib + ZeroPadBytes: 6 + - cmd: LC_FUNCTION_STARTS + cmdsize: 16 + dataoff: 4144 + datasize: 8 + - cmd: LC_DATA_IN_CODE + cmdsize: 16 + dataoff: 4152 + datasize: 0 +LinkEditData: + ExportTrie: + TerminalSize: 0 + NodeOffset: 0 + Name: '' + Flags: 0x0000000000000000 + Address: 0x0000000000000000 + Other: 0x0000000000000000 + ImportName: '' + Children: + - TerminalSize: 0 + NodeOffset: 5 + Name: _ + Flags: 0x0000000000000000 + Address: 0x0000000000000000 + Other: 0x0000000000000000 + ImportName: '' + Children: + - TerminalSize: 2 + NodeOffset: 33 + Name: _mh_execute_header + Flags: 0x0000000000000000 + Address: 0x0000000000000000 + Other: 0x0000000000000000 + ImportName: '' + - TerminalSize: 3 + NodeOffset: 37 + Name: main + Flags: 0x0000000000000000 + Address: 0x0000000000000FB0 + Other: 0x0000000000000000 + ImportName: '' + NameList: + - n_strx: 2 + n_type: 0x0F + n_sect: 1 + n_desc: 16 + n_value: 4294967296 + - n_strx: 22 + n_type: 0x0F + n_sect: 1 + n_desc: 0 + n_value: 4294971312 + - n_strx: 28 + n_type: 0x01 + n_sect: 0 + n_desc: 256 + n_value: 0 + StringTable: + - ' ' + - __mh_execute_header + - _main + - dyld_stub_binder + - '' + - '' + - '' +... Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=344209&r1=344208&r2=344209&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Wed Oct 10 17:28:35 2018 @@ -210,6 +210,7 @@ 2642FBAE13D003B400ED6808 /* CommunicationKDP.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2642FBA813D003B400ED6808 /* CommunicationKDP.cpp */; }; 964463EC1A330C0500154ED8 /* CompactUnwindInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 964463EB1A330C0500154ED8 /* CompactUnwindInfo.cpp */; }; 268900D513353E6F00698AC0 /* CompileUnit.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7F1510F1B8EC00F91463 /* CompileUnit.cpp */; }; + AF9BB7F8216EC7220093FA65 /* CompileUnitIndex.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF9BB7F5216EC7210093FA65 /* CompileUnitIndex.cpp */; }; 265192C61BA8E905002F08F6 /* CompilerDecl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 265192C51BA8E905002F08F6 /* CompilerDecl.cpp */; }; 2657AFB71B86910100958979 /* CompilerDeclContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2657AFB61B86910100958979 /* CompilerDeclContext.cpp */; }; 268900D213353E6F00698AC0 /* CompilerType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49E45FAD11F660FE008F7B28 /* CompilerType.cpp */; }; @@ -586,6 +587,8 @@ 4CA0C6CC20F929C700CFE6BB /* PDBLocationToDWARFExpression.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CA0C6CA20F929C600CFE6BB /* PDBLocationToDWARFExpression.cpp */; }; 268900EE13353E6F00698AC0 /* PathMappingList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 495BBACB119A0DBE00418BEA /* PathMappingList.cpp */; }; 2668A2EE20AF417D00D94111 /* PathMappingListTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2668A2ED20AF417D00D94111 /* PathMappingListTest.cpp */; }; + AF9BB7F6216EC7220093FA65 /* PdbIndex.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF9BB7F3216EC7210093FA65 /* PdbIndex.cpp */; }; + AF9BB7F7216EC7220093FA65 /* PdbUtil.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF9BB7F4216EC7210093FA65 /* PdbUtil.cpp */; }; 25420ED21A649D88009ADBCB /* PipeBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 25420ED11A649D88009ADBCB /* PipeBase.cpp */; }; 2377C2F819E613C100737875 /* PipePosix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2377C2F719E613C100737875 /* PipePosix.cpp */; }; 268900EF13353E6F00698AC0 /* Platform.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 264A43BD1320BCEB005B4096 /* Platform.cpp */; }; @@ -607,6 +610,7 @@ 26EFB61C1BFE8D3E00544801 /* PlatformNetBSD.h in Headers */ = {isa = PBXBuildFile; fileRef = 26EFB6191BFE8D3E00544801 /* PlatformNetBSD.h */; }; 4CE4EFAA1E8999B900A80C06 /* PlatformOpenBSD.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CE4EFA61E8999B000A80C06 /* PlatformOpenBSD.cpp */; }; 945759671534941F005A9070 /* PlatformPOSIX.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 945759651534941F005A9070 /* PlatformPOSIX.cpp */; }; + AF663250216EB9C300BB510D /* PlatformRemoteAppleBridge.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF66324E216EB9C300BB510D /* PlatformRemoteAppleBridge.cpp */; }; AF8AD6371BEC28C400150209 /* PlatformRemoteAppleTV.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF8AD6331BEC28C400150209 /* PlatformRemoteAppleTV.cpp */; }; AF8AD6381BEC28C400150209 /* PlatformRemoteAppleTV.h in Headers */ = {isa = PBXBuildFile; fileRef = AF8AD6341BEC28C400150209 /* PlatformRemoteAppleTV.h */; }; AF8AD6391BEC28C400150209 /* PlatformRemoteAppleWatch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF8AD6351BEC28C400150209 /* PlatformRemoteAppleWatch.cpp */; }; @@ -911,8 +915,8 @@ 4C7D48251F5099B2005314B4 /* SymbolFileDWARFDwoDwp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C7D481F1F509964005314B4 /* SymbolFileDWARFDwoDwp.cpp */; }; 4C7D48241F5099A1005314B4 /* SymbolFileDWARFDwp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C7D481C1F509963005314B4 /* SymbolFileDWARFDwp.cpp */; }; 9A2057121F3B824B00F6C293 /* SymbolFileDWARFTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A20570A1F3B81F300F6C293 /* SymbolFileDWARFTests.cpp */; }; + AF9BB7F2216EC6EF0093FA65 /* SymbolFileNativePDB.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF9BB7F1216EC6EF0093FA65 /* SymbolFileNativePDB.cpp */; }; AF6335E21C87B21E00F7D554 /* SymbolFilePDB.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF6335E01C87B21E00F7D554 /* SymbolFilePDB.cpp */; }; - AF6335E31C87B21E00F7D554 /* SymbolFilePDB.h in Headers */ = {isa = PBXBuildFile; fileRef = AF6335E11C87B21E00F7D554 /* SymbolFilePDB.h */; }; 268900CE13353E5F00698AC0 /* SymbolFileSymtab.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260C89DE10F57C5600BB2B04 /* SymbolFileSymtab.cpp */; }; 268900E013353E6F00698AC0 /* SymbolVendor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF94005711C03F6500085DB9 /* SymbolVendor.cpp */; }; 2635879417822FC2004C30BA /* SymbolVendorELF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2635879017822E56004C30BA /* SymbolVendorELF.cpp */; }; @@ -1663,6 +1667,7 @@ 964463ED1A330C1B00154ED8 /* CompactUnwindInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CompactUnwindInfo.h; path = include/lldb/Symbol/CompactUnwindInfo.h; sourceTree = "<group>"; }; 26BC7F1510F1B8EC00F91463 /* CompileUnit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CompileUnit.cpp; path = source/Symbol/CompileUnit.cpp; sourceTree = "<group>"; }; 26BC7C5710F1B6E900F91463 /* CompileUnit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CompileUnit.h; path = include/lldb/Symbol/CompileUnit.h; sourceTree = "<group>"; }; + AF9BB7F5216EC7210093FA65 /* CompileUnitIndex.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CompileUnitIndex.cpp; path = source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.cpp; sourceTree = SOURCE_ROOT; }; 265192C51BA8E905002F08F6 /* CompilerDecl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CompilerDecl.cpp; path = source/Symbol/CompilerDecl.cpp; sourceTree = "<group>"; }; 265192C41BA8E8F8002F08F6 /* CompilerDecl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CompilerDecl.h; path = include/lldb/Symbol/CompilerDecl.h; sourceTree = "<group>"; }; 2657AFB61B86910100958979 /* CompilerDeclContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CompilerDeclContext.cpp; path = source/Symbol/CompilerDeclContext.cpp; sourceTree = "<group>"; }; @@ -2421,6 +2426,8 @@ 495BBACB119A0DBE00418BEA /* PathMappingList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PathMappingList.cpp; path = source/Target/PathMappingList.cpp; sourceTree = "<group>"; }; 495BBACF119A0DE700418BEA /* PathMappingList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PathMappingList.h; path = include/lldb/Target/PathMappingList.h; sourceTree = "<group>"; }; 2668A2ED20AF417D00D94111 /* PathMappingListTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PathMappingListTest.cpp; path = Target/PathMappingListTest.cpp; sourceTree = "<group>"; }; + AF9BB7F3216EC7210093FA65 /* PdbIndex.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PdbIndex.cpp; path = source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp; sourceTree = SOURCE_ROOT; }; + AF9BB7F4216EC7210093FA65 /* PdbUtil.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PdbUtil.cpp; path = source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp; sourceTree = SOURCE_ROOT; }; 260A39A519647A3A004B4130 /* Pipe.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Pipe.h; path = include/lldb/Host/Pipe.h; sourceTree = "<group>"; }; 25420ED11A649D88009ADBCB /* PipeBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PipeBase.cpp; sourceTree = "<group>"; }; 3F5E8AF31A40D4A500A73232 /* PipeBase.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = PipeBase.h; path = include/lldb/Host/PipeBase.h; sourceTree = "<group>"; }; @@ -2458,6 +2465,8 @@ 4CE4EFA71E8999B000A80C06 /* PlatformOpenBSD.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformOpenBSD.h; sourceTree = "<group>"; }; 945759651534941F005A9070 /* PlatformPOSIX.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PlatformPOSIX.cpp; path = POSIX/PlatformPOSIX.cpp; sourceTree = "<group>"; }; 945759661534941F005A9070 /* PlatformPOSIX.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PlatformPOSIX.h; path = POSIX/PlatformPOSIX.h; sourceTree = "<group>"; }; + AF66324E216EB9C300BB510D /* PlatformRemoteAppleBridge.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlatformRemoteAppleBridge.cpp; sourceTree = "<group>"; }; + AF66324F216EB9C300BB510D /* PlatformRemoteAppleBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformRemoteAppleBridge.h; sourceTree = "<group>"; }; AF8AD6331BEC28C400150209 /* PlatformRemoteAppleTV.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlatformRemoteAppleTV.cpp; sourceTree = "<group>"; }; AF8AD6341BEC28C400150209 /* PlatformRemoteAppleTV.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformRemoteAppleTV.h; sourceTree = "<group>"; }; AF8AD6351BEC28C400150209 /* PlatformRemoteAppleWatch.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlatformRemoteAppleWatch.cpp; sourceTree = "<group>"; }; @@ -2995,6 +3004,7 @@ 4C7D481C1F509963005314B4 /* SymbolFileDWARFDwp.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SymbolFileDWARFDwp.cpp; sourceTree = "<group>"; }; 4C7D481E1F509964005314B4 /* SymbolFileDWARFDwp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SymbolFileDWARFDwp.h; sourceTree = "<group>"; }; 9A20570A1F3B81F300F6C293 /* SymbolFileDWARFTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SymbolFileDWARFTests.cpp; path = DWARF/SymbolFileDWARFTests.cpp; sourceTree = "<group>"; }; + AF9BB7F1216EC6EF0093FA65 /* SymbolFileNativePDB.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SymbolFileNativePDB.cpp; path = source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp; sourceTree = SOURCE_ROOT; }; AF6335E01C87B21E00F7D554 /* SymbolFilePDB.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SymbolFilePDB.cpp; path = PDB/SymbolFilePDB.cpp; sourceTree = "<group>"; }; AF6335E11C87B21E00F7D554 /* SymbolFilePDB.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SymbolFilePDB.h; path = PDB/SymbolFilePDB.h; sourceTree = "<group>"; }; 23CB15141D66CF8700EDDDE1 /* SymbolFilePDBTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SymbolFilePDBTests.cpp; sourceTree = "<group>"; }; @@ -4028,6 +4038,7 @@ 260C89B110F57C5600BB2B04 /* SymbolFile */ = { isa = PBXGroup; children = ( + AF9BB7F0216EC6CD0093FA65 /* NativePDB */, AF6335DF1C87B20A00F7D554 /* PDB */, 260C89B210F57C5600BB2B04 /* DWARF */, 260C89DD10F57C5600BB2B04 /* Symtab */, @@ -5813,6 +5824,8 @@ AF3A4AD11EA05C4700B5DEB4 /* PlatformRemoteDarwinDevice.h */, AF8AD6331BEC28C400150209 /* PlatformRemoteAppleTV.cpp */, AF8AD6341BEC28C400150209 /* PlatformRemoteAppleTV.h */, + AF66324E216EB9C300BB510D /* PlatformRemoteAppleBridge.cpp */, + AF66324F216EB9C300BB510D /* PlatformRemoteAppleBridge.h */, AF8AD6351BEC28C400150209 /* PlatformRemoteAppleWatch.cpp */, AF8AD6361BEC28C400150209 /* PlatformRemoteAppleWatch.h */, 2675F6FE1332BE690067997B /* PlatformRemoteiOS.cpp */, @@ -6885,6 +6898,18 @@ path = ../Disassembler; sourceTree = "<group>"; }; + AF9BB7F0216EC6CD0093FA65 /* NativePDB */ = { + isa = PBXGroup; + children = ( + AF9BB7F5216EC7210093FA65 /* CompileUnitIndex.cpp */, + AF9BB7F3216EC7210093FA65 /* PdbIndex.cpp */, + AF9BB7F4216EC7210093FA65 /* PdbUtil.cpp */, + AF9BB7F1216EC6EF0093FA65 /* SymbolFileNativePDB.cpp */, + ); + name = NativePDB; + path = "New Group"; + sourceTree = "<group>"; + }; AFAFD8081E57E19E0017A14F /* Target */ = { isa = PBXGroup; children = ( @@ -7060,7 +7085,6 @@ AF3A4AD31EA05C4700B5DEB4 /* PlatformRemoteDarwinDevice.h in Headers */, AF9113FE1FBE78EA004320CD /* RegisterContextPOSIXCore_ppc64le.h in Headers */, AF33B4BF1C1FA441001B28D9 /* NetBSDSignals.h in Headers */, - AF6335E31C87B21E00F7D554 /* SymbolFilePDB.h in Headers */, AF6CA6681FBBAF37005A0DC3 /* ArchSpec.h in Headers */, AF235EB41FBE7858009C5541 /* RegisterInfoPOSIX_ppc64le.h in Headers */, AF2E02A41FA2CEAF00A86C34 /* ArchitectureArm.h in Headers */, @@ -7889,6 +7913,7 @@ 6D0F614E1C80AB0700A4ECEE /* JavaLanguageRuntime.cpp in Sources */, 2666ADC61B3CB675001FAFD3 /* DynamicLoaderHexagonDYLD.cpp in Sources */, 3F8169331ABB7A6D001DA9DF /* SystemLifetimeManager.cpp in Sources */, + AF9BB7F7216EC7220093FA65 /* PdbUtil.cpp in Sources */, AF2E02A31FA2CEAF00A86C34 /* ArchitectureArm.cpp in Sources */, 4959511F1A1BC4BC00F6F8FC /* ClangModulesDeclVendor.cpp in Sources */, 26BC179918C7F2B300D2196D /* JITLoader.cpp in Sources */, @@ -7924,6 +7949,7 @@ 26764CA01E48F528008D3573 /* RegularExpression.cpp in Sources */, 2689003B13353E0400698AC0 /* EmulateInstruction.cpp in Sources */, 2689003D13353E0400698AC0 /* Event.cpp in Sources */, + AF9BB7F8216EC7220093FA65 /* CompileUnitIndex.cpp in Sources */, AFC2DCE91E6E2F2C00283714 /* Baton.cpp in Sources */, 26B75B441AD6E29A001F7A57 /* MipsLinuxSignals.cpp in Sources */, 2689003E13353E0400698AC0 /* FileSpecList.cpp in Sources */, @@ -8090,6 +8116,7 @@ 268900AF13353E5000698AC0 /* UnwindLLDB.cpp in Sources */, 268900B013353E5000698AC0 /* RegisterContextLLDB.cpp in Sources */, 23E2E5451D904913006F38BB /* MinidumpTypes.cpp in Sources */, + AF9BB7F2216EC6EF0093FA65 /* SymbolFileNativePDB.cpp in Sources */, AF33B4BE1C1FA441001B28D9 /* NetBSDSignals.cpp in Sources */, 949EEDA31BA76577008C63CF /* Cocoa.cpp in Sources */, 3FDFE56C19AF9C44009756A7 /* HostProcessPosix.cpp in Sources */, @@ -8110,6 +8137,7 @@ 268900BB13353E5F00698AC0 /* DWARFDebugArangeSet.cpp in Sources */, 268900BC13353E5F00698AC0 /* DWARFDebugInfo.cpp in Sources */, 268900BD13353E5F00698AC0 /* DWARFDebugInfoEntry.cpp in Sources */, + AF663250216EB9C300BB510D /* PlatformRemoteAppleBridge.cpp in Sources */, 268900BE13353E5F00698AC0 /* DWARFDebugLine.cpp in Sources */, 268900BF13353E5F00698AC0 /* DWARFDebugMacinfo.cpp in Sources */, 268900C013353E5F00698AC0 /* DWARFDebugMacinfoEntry.cpp in Sources */, @@ -8449,6 +8477,7 @@ 262ED0081631FA3A00879631 /* OptionGroupString.cpp in Sources */, 94F48F251A01C687005C0EC6 /* StringPrinter.cpp in Sources */, 94094C6B163B6F840083A547 /* ValueObjectCast.cpp in Sources */, + AF9BB7F6216EC7220093FA65 /* PdbIndex.cpp in Sources */, AF9107EF168570D200DBCD3C /* RegisterContextDarwin_arm64.cpp in Sources */, 94CB255C16B069770059775D /* DataVisualization.cpp in Sources */, 94CB255D16B069770059775D /* FormatClasses.cpp in Sources */, Modified: lldb/trunk/scripts/Xcode/package-clang-headers.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Xcode/package-clang-headers.py?rev=344209&r1=344208&r2=344209&view=diff ============================================================================== --- lldb/trunk/scripts/Xcode/package-clang-headers.py (original) +++ lldb/trunk/scripts/Xcode/package-clang-headers.py Wed Oct 10 17:28:35 2018 @@ -37,6 +37,9 @@ if not os.path.isdir(llvm_build_dir): llvm_build_dir = re.sub("-appletvos-", "-watchos-", llvm_build_dir) if not os.path.isdir(llvm_build_dir): + llvm_build_dir = re.sub("-watchos-", "-bridgeos-", llvm_build_dir) + +if not os.path.isdir(llvm_build_dir): print llvm_build_dir + " doesn't exist" sys.exit(1) Modified: lldb/trunk/source/API/SystemInitializerFull.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SystemInitializerFull.cpp?rev=344209&r1=344208&r2=344209&view=diff ============================================================================== --- lldb/trunk/source/API/SystemInitializerFull.cpp (original) +++ lldb/trunk/source/API/SystemInitializerFull.cpp Wed Oct 10 17:28:35 2018 @@ -106,6 +106,7 @@ #include "Plugins/Platform/MacOSX/PlatformDarwinKernel.h" #include "Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h" #include "Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h" +#include "Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.h" #include "Plugins/Platform/MacOSX/PlatformiOSSimulator.h" #include "Plugins/Process/MacOSX-Kernel/ProcessKDP.h" #include "Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h" @@ -378,6 +379,7 @@ void SystemInitializerFull::Initialize() PlatformAppleWatchSimulator::Initialize(); PlatformRemoteAppleTV::Initialize(); PlatformRemoteAppleWatch::Initialize(); + PlatformRemoteAppleBridge::Initialize(); DynamicLoaderDarwinKernel::Initialize(); #endif @@ -499,6 +501,7 @@ void SystemInitializerFull::Terminate() PlatformAppleWatchSimulator::Terminate(); PlatformRemoteAppleTV::Terminate(); PlatformRemoteAppleWatch::Terminate(); + PlatformRemoteAppleBridge::Terminate(); #endif #if defined(__FreeBSD__) Modified: lldb/trunk/source/Host/macosx/objcxx/HostInfoMacOSX.mm URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/objcxx/HostInfoMacOSX.mm?rev=344209&r1=344208&r2=344209&view=diff ============================================================================== --- lldb/trunk/source/Host/macosx/objcxx/HostInfoMacOSX.mm (original) +++ lldb/trunk/source/Host/macosx/objcxx/HostInfoMacOSX.mm Wed Oct 10 17:28:35 2018 @@ -253,6 +253,9 @@ void HostInfoMacOSX::ComputeHostArchitec #if defined(TARGET_OS_TV) && TARGET_OS_TV == 1 arch_32.GetTriple().setOS(llvm::Triple::TvOS); arch_64.GetTriple().setOS(llvm::Triple::TvOS); +#elif defined(TARGET_OS_BRIDGE) && TARGET_OS_BRIDGE == 1 + arch_32.GetTriple().setOS(llvm::Triple::BridgeOS); + arch_64.GetTriple().setOS(llvm::Triple::BridgeOS); #else arch_32.GetTriple().setOS(llvm::Triple::IOS); arch_64.GetTriple().setOS(llvm::Triple::IOS); Modified: lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp?rev=344209&r1=344208&r2=344209&view=diff ============================================================================== --- lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp (original) +++ lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp Wed Oct 10 17:28:35 2018 @@ -147,6 +147,7 @@ DynamicLoader *DynamicLoaderDarwinKernel case llvm::Triple::IOS: case llvm::Triple::TvOS: case llvm::Triple::WatchOS: + // NEED_BRIDGEOS_TRIPLE case llvm::Triple::BridgeOS: if (triple_ref.getVendor() != llvm::Triple::Apple) { return NULL; } Modified: lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp?rev=344209&r1=344208&r2=344209&view=diff ============================================================================== --- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp (original) +++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp Wed Oct 10 17:28:35 2018 @@ -400,6 +400,8 @@ bool DynamicLoaderDarwin::JSONImageInfor image_infos[i].os_type = llvm::Triple::TvOS; else if (os_name == "watchos") image_infos[i].os_type = llvm::Triple::WatchOS; + // NEED_BRIDGEOS_TRIPLE else if (os_name == "bridgeos") + // NEED_BRIDGEOS_TRIPLE image_infos[i].os_type = llvm::Triple::BridgeOS; } if (image->HasKey("min_version_os_sdk")) { image_infos[i].min_version_os_sdk = @@ -513,11 +515,12 @@ void DynamicLoaderDarwin::UpdateSpecialB const size_t image_infos_size = image_infos.size(); for (size_t i = 0; i < image_infos_size; i++) { if (image_infos[i].header.filetype == llvm::MachO::MH_DYLINKER) { - // In a "simulator" process (an x86 process that is ios/tvos/watchos) we - // will have two dyld modules -- a "dyld" that we want to keep track of, - // and a "dyld_sim" which we don't need to keep track of here. If the - // target is an x86 system and the OS of the dyld binary is - // ios/tvos/watchos, then we are looking at dyld_sym. + // In a "simulator" process (an x86 process that is + // ios/tvos/watchos/bridgeos) we will have two dyld modules -- + // a "dyld" that we want to keep track of, and a "dyld_sim" which + // we don't need to keep track of here. If the target is an x86 + // system and the OS of the dyld binary is ios/tvos/watchos/bridgeos, + // then we are looking at dyld_sym. // debugserver has only recently (late 2016) started sending up the os // type for each binary it sees -- so if we don't have an os type, use a @@ -531,6 +534,7 @@ void DynamicLoaderDarwin::UpdateSpecialB if (image_infos[i].os_type != llvm::Triple::OSType::IOS && image_infos[i].os_type != llvm::Triple::TvOS && image_infos[i].os_type != llvm::Triple::WatchOS) { + // NEED_BRIDGEOS_TRIPLE image_infos[i].os_type != llvm::Triple::BridgeOS) { dyld_idx = i; } } @@ -1123,6 +1127,10 @@ bool DynamicLoaderDarwin::UseDYLDSPI(Pro // watchOS 3 and newer if (os_type == llvm::Triple::WatchOS && version >= llvm::VersionTuple(3)) use_new_spi_interface = true; + + // NEED_BRIDGEOS_TRIPLE // Any BridgeOS + // NEED_BRIDGEOS_TRIPLE if (os_type == llvm::Triple::BridgeOS) + // NEED_BRIDGEOS_TRIPLE use_new_spi_interface = true; } if (log) { Modified: lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp?rev=344209&r1=344208&r2=344209&view=diff ============================================================================== --- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp (original) +++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp Wed Oct 10 17:28:35 2018 @@ -55,6 +55,7 @@ DynamicLoader *DynamicLoaderMacOS::Creat case llvm::Triple::IOS: case llvm::Triple::TvOS: case llvm::Triple::WatchOS: + // NEED_BRIDGEOS_TRIPLE case llvm::Triple::BridgeOS: create = triple_ref.getVendor() == llvm::Triple::Apple; break; default: Modified: lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h?rev=344209&r1=344208&r2=344209&view=diff ============================================================================== --- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h (original) +++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h Wed Oct 10 17:28:35 2018 @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// // This is the DynamicLoader plugin for Darwin (macOS / iPhoneOS / tvOS / -// watchOS) +// watchOS / BridgeOS) // platforms late 2016 and newer, where lldb will call dyld SPI functions to get // information about shared libraries, information about the shared cache, and // the _dyld_debugger_notification function we put a breakpoint on give us an Modified: lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp?rev=344209&r1=344208&r2=344209&view=diff ============================================================================== --- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp (original) +++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp Wed Oct 10 17:28:35 2018 @@ -75,6 +75,7 @@ DynamicLoader *DynamicLoaderMacOSXDYLD:: case llvm::Triple::IOS: case llvm::Triple::TvOS: case llvm::Triple::WatchOS: + // NEED_BRIDGEOS_TRIPLE case llvm::Triple::BridgeOS: create = triple_ref.getVendor() == llvm::Triple::Apple; break; default: Modified: lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h?rev=344209&r1=344208&r2=344209&view=diff ============================================================================== --- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h (original) +++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h Wed Oct 10 17:28:35 2018 @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// // This is the DynamicLoader plugin for Darwin (macOS / iPhoneOS / tvOS / -// watchOS) +// watchOS / BridgeOS) // platforms earlier than 2016, where lldb would read the "dyld_all_image_infos" // dyld internal structure to understand where things were loaded and the // solib loaded/unloaded notification function we put a breakpoint on gives us Modified: lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp?rev=344209&r1=344208&r2=344209&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp (original) +++ lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp Wed Oct 10 17:28:35 2018 @@ -850,6 +850,7 @@ uint32_t EmulateInstructionARM::GetFrame case llvm::Triple::IOS: case llvm::Triple::TvOS: case llvm::Triple::WatchOS: + // NEED_BRIDGEOS_TRIPLE case llvm::Triple::BridgeOS: is_apple = true; break; default: Modified: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp?rev=344209&r1=344208&r2=344209&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original) +++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Wed Oct 10 17:28:35 2018 @@ -4880,21 +4880,78 @@ bool ObjectFileMachO::GetUUID(const llvm return false; } -static const char *GetOSName(uint32_t cmd) { +static llvm::StringRef GetOSName(uint32_t cmd) { switch (cmd) { case llvm::MachO::LC_VERSION_MIN_IPHONEOS: - return "ios"; + return llvm::Triple::getOSTypeName(llvm::Triple::IOS); case llvm::MachO::LC_VERSION_MIN_MACOSX: - return "macosx"; + return llvm::Triple::getOSTypeName(llvm::Triple::MacOSX); case llvm::MachO::LC_VERSION_MIN_TVOS: - return "tvos"; + return llvm::Triple::getOSTypeName(llvm::Triple::TvOS); case llvm::MachO::LC_VERSION_MIN_WATCHOS: - return "watchos"; + return llvm::Triple::getOSTypeName(llvm::Triple::WatchOS); default: llvm_unreachable("unexpected LC_VERSION load command"); } } +namespace { + struct OSEnv { + llvm::StringRef os_type; + llvm::StringRef environment; + OSEnv(uint32_t cmd) { + switch (cmd) { + case PLATFORM_MACOS: + os_type = llvm::Triple::getOSTypeName(llvm::Triple::MacOSX); + return; + case PLATFORM_IOS: + os_type = llvm::Triple::getOSTypeName(llvm::Triple::IOS); + return; + case PLATFORM_TVOS: + os_type = llvm::Triple::getOSTypeName(llvm::Triple::TvOS); + return; + case PLATFORM_WATCHOS: + os_type = llvm::Triple::getOSTypeName(llvm::Triple::WatchOS); + return; +// NEED_BRIDGEOS_TRIPLE case PLATFORM_BRIDGEOS: +// NEED_BRIDGEOS_TRIPLE os_type = llvm::Triple::getOSTypeName(llvm::Triple::BridgeOS); +// NEED_BRIDGEOS_TRIPLE return; +#if defined (PLATFORM_IOSSIMULATOR) && defined (PLATFORM_TVOSSIMULATOR) && defined (PLATFORM_WATCHOSSIMULATOR) + case PLATFORM_IOSSIMULATOR: + os_type = llvm::Triple::getOSTypeName(llvm::Triple::IOS); + environment = + llvm::Triple::getEnvironmentTypeName(llvm::Triple::Simulator); + return; + case PLATFORM_TVOSSIMULATOR: + os_type = llvm::Triple::getOSTypeName(llvm::Triple::TvOS); + environment = + llvm::Triple::getEnvironmentTypeName(llvm::Triple::Simulator); + return; + case PLATFORM_WATCHOSSIMULATOR: + os_type = llvm::Triple::getOSTypeName(llvm::Triple::WatchOS); + environment = + llvm::Triple::getEnvironmentTypeName(llvm::Triple::Simulator); + return; +#endif + default: { + Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS | + LIBLLDB_LOG_PROCESS)); + if (log) + log->Printf("unsupported platform in LC_BUILD_VERSION"); + } + } + } + }; + + struct MinOS { + uint32_t major, minor, patch; + MinOS(uint32_t version) + : major(version >> 16), + minor((version >> 8) & 0xffu), + patch(version & 0xffu) {} + }; +} // namespace + bool ObjectFileMachO::GetArchitecture(const llvm::MachO::mach_header &header, const lldb_private::DataExtractor &data, lldb::offset_t lc_offset, @@ -4926,36 +4983,34 @@ bool ObjectFileMachO::GetArchitecture(co return true; } else { struct load_command load_cmd; + llvm::SmallString<16> os_name; + llvm::raw_svector_ostream os(os_name); + // See if there is an LC_VERSION_MIN_* load command that can give + // us the OS type. lldb::offset_t offset = lc_offset; for (uint32_t i = 0; i < header.ncmds; ++i) { const lldb::offset_t cmd_offset = offset; if (data.GetU32(&offset, &load_cmd, 2) == NULL) break; - uint32_t major, minor, patch; struct version_min_command version_min; - - llvm::SmallString<16> os_name; - llvm::raw_svector_ostream os(os_name); - switch (load_cmd.cmd) { case llvm::MachO::LC_VERSION_MIN_IPHONEOS: case llvm::MachO::LC_VERSION_MIN_MACOSX: case llvm::MachO::LC_VERSION_MIN_TVOS: - case llvm::MachO::LC_VERSION_MIN_WATCHOS: + case llvm::MachO::LC_VERSION_MIN_WATCHOS: { if (load_cmd.cmdsize != sizeof(version_min)) break; - data.ExtractBytes(cmd_offset, - sizeof(version_min), data.GetByteOrder(), - &version_min); - major = version_min.version >> 16; - minor = (version_min.version >> 8) & 0xffu; - patch = version_min.version & 0xffu; - os << GetOSName(load_cmd.cmd) << major << '.' << minor << '.' - << patch; + if (data.ExtractBytes(cmd_offset, sizeof(version_min), + data.GetByteOrder(), &version_min) == 0) + break; + MinOS min_os(version_min.version); + os << GetOSName(load_cmd.cmd) << min_os.major << '.' << min_os.minor + << '.' << min_os.patch; triple.setOSName(os.str()); return true; + } default: break; } @@ -4963,6 +5018,35 @@ bool ObjectFileMachO::GetArchitecture(co offset = cmd_offset + load_cmd.cmdsize; } + // See if there is an LC_BUILD_VERSION load command that can give + // us the OS type. + + offset = lc_offset; + for (uint32_t i = 0; i < header.ncmds; ++i) { + const lldb::offset_t cmd_offset = offset; + if (data.GetU32(&offset, &load_cmd, 2) == NULL) + break; + + if (load_cmd.cmd == llvm::MachO::LC_BUILD_VERSION) { + struct build_version_command build_version; + if (load_cmd.cmdsize != sizeof(build_version)) + if (data.ExtractBytes(cmd_offset, sizeof(build_version), + data.GetByteOrder(), &build_version) == 0) + continue; + MinOS min_os(build_version.minos); + OSEnv os_env(build_version.platform); + if (os_env.os_type.empty()) + continue; + os << os_env.os_type << min_os.major << '.' << min_os.minor << '.' + << min_os.patch; + triple.setOSName(os.str()); + if (!os_env.environment.empty()) + triple.setEnvironmentName(os_env.environment); + return true; + } + offset = cmd_offset + load_cmd.cmdsize; + } + if (header.filetype != MH_KEXT_BUNDLE) { // We didn't find a LC_VERSION_MIN load command and this isn't a KEXT // so lets not say our Vendor is Apple, leave it as an unspecified @@ -5727,8 +5811,30 @@ llvm::VersionTuple ObjectFileMachO::GetM m_min_os_version = llvm::VersionTuple(xxxx, yy, zz); break; } + } + } else if (lc.cmd == llvm::MachO::LC_BUILD_VERSION) { + // struct build_version_command { + // uint32_t cmd; /* LC_BUILD_VERSION */ + // uint32_t cmdsize; /* sizeof(struct build_version_command) plus */ + // /* ntools * sizeof(struct build_tool_version) */ + // uint32_t platform; /* platform */ + // uint32_t minos; /* X.Y.Z is encoded in nibbles xxxx.yy.zz */ + // uint32_t sdk; /* X.Y.Z is encoded in nibbles xxxx.yy.zz */ + // uint32_t ntools; /* number of tool entries following this */ + // }; + + offset += 4; // skip platform + uint32_t minos = m_data.GetU32(&offset); + + const uint32_t xxxx = minos >> 16; + const uint32_t yy = (minos >> 8) & 0xffu; + const uint32_t zz = minos & 0xffu; + if (xxxx) { + m_min_os_version = llvm::VersionTuple(xxxx, yy, zz); + break; } } + offset = load_cmd_offset + lc.cmdsize; } @@ -5775,6 +5881,46 @@ uint32_t ObjectFileMachO::GetSDKVersion( offset = load_cmd_offset + lc.cmdsize; } + if (success == false) + { + offset = MachHeaderSizeFromMagic(m_header.magic); + for (uint32_t i = 0; success == false && i < m_header.ncmds; ++i) + { + const lldb::offset_t load_cmd_offset = offset; + + version_min_command lc; + if (m_data.GetU32(&offset, &lc.cmd, 2) == NULL) + break; + if (lc.cmd == llvm::MachO::LC_BUILD_VERSION) + { + // struct build_version_command { + // uint32_t cmd; /* LC_BUILD_VERSION */ + // uint32_t cmdsize; /* sizeof(struct build_version_command) plus */ + // /* ntools * sizeof(struct build_tool_version) */ + // uint32_t platform; /* platform */ + // uint32_t minos; /* X.Y.Z is encoded in nibbles xxxx.yy.zz */ + // uint32_t sdk; /* X.Y.Z is encoded in nibbles xxxx.yy.zz */ + // uint32_t ntools; /* number of tool entries following this */ + // }; + + offset += 4; // skip platform + uint32_t minos = m_data.GetU32(&offset); + + const uint32_t xxxx = minos >> 16; + const uint32_t yy = (minos >> 8) & 0xffu; + const uint32_t zz = minos & 0xffu; + if (xxxx) + { + m_sdk_versions.push_back (xxxx); + m_sdk_versions.push_back (yy); + m_sdk_versions.push_back (zz); + } + success = true; + } + offset = load_cmd_offset + lc.cmdsize; + } + } + if (success == false) { // Push an invalid value so we don't try to find // the version # again on the next call to this @@ -5944,6 +6090,7 @@ bool ObjectFileMachO::SaveCore(const lld target_triple.getOS() == llvm::Triple::IOS || target_triple.getOS() == llvm::Triple::WatchOS || target_triple.getOS() == llvm::Triple::TvOS)) { + // NEED_BRIDGEOS_TRIPLE target_triple.getOS() == llvm::Triple::BridgeOS)) { bool make_core = false; switch (target_arch.GetMachine()) { case llvm::Triple::aarch64: Modified: lldb/trunk/source/Plugins/Platform/MacOSX/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/CMakeLists.txt?rev=344209&r1=344208&r2=344209&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Platform/MacOSX/CMakeLists.txt (original) +++ lldb/trunk/source/Plugins/Platform/MacOSX/CMakeLists.txt Wed Oct 10 17:28:35 2018 @@ -6,6 +6,7 @@ list(APPEND PLUGIN_PLATFORM_MACOSX_SOURC PlatformRemoteAppleTV.cpp PlatformRemoteAppleWatch.cpp PlatformRemoteDarwinDevice.cpp + PlatformRemoteAppleBridge.cpp ) list(APPEND PLUGIN_PLATFORM_MACOSX_DARWIN_ONLY_SOURCES Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp?rev=344209&r1=344208&r2=344209&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp (original) +++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp Wed Oct 10 17:28:35 2018 @@ -129,6 +129,7 @@ PlatformSP PlatformDarwinKernel::CreateI case llvm::Triple::IOS: case llvm::Triple::WatchOS: case llvm::Triple::TvOS: + // NEED_BRIDGEOS_TRIPLE case llvm::Triple::BridgeOS: break; // Only accept "vendor" for vendor if the host is Apple and it "unknown" // wasn't specified (it was just returned because it was NOT specified) @@ -353,6 +354,8 @@ void PlatformDarwinKernel::CollectKextAn "/Platforms/AppleTVOS.platform/Developer/SDKs"); AddSDKSubdirsToSearchPaths(developer_dir + "/Platforms/WatchOS.platform/Developer/SDKs"); + AddSDKSubdirsToSearchPaths(developer_dir + + "/Platforms/BridgeOS.platform/Developer/SDKs"); } if (m_ios_debug_session != eLazyBoolYes) { AddSDKSubdirsToSearchPaths(developer_dir + Added: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.cpp?rev=344209&view=auto ============================================================================== --- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.cpp (added) +++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.cpp Wed Oct 10 17:28:35 2018 @@ -0,0 +1,190 @@ +//===-- PlatformRemoteAppleBridge.cpp -------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// C Includes +// C++ Includes +#include <string> +#include <vector> + +// Other libraries and framework includes +// Project includes +#include "PlatformRemoteAppleBridge.h" + +#include "lldb/Breakpoint/BreakpointLocation.h" +#include "lldb/Core/Module.h" +#include "lldb/Core/ModuleList.h" +#include "lldb/Core/ModuleSpec.h" +#include "lldb/Core/PluginManager.h" +#include "lldb/Host/Host.h" +#include "lldb/Target/Process.h" +#include "lldb/Target/Target.h" +#include "lldb/Utility/ArchSpec.h" +#include "lldb/Utility/FileSpec.h" +#include "lldb/Utility/Log.h" +#include "lldb/Utility/StreamString.h" + +using namespace lldb; +using namespace lldb_private; + +//------------------------------------------------------------------ +/// Default Constructor +//------------------------------------------------------------------ +PlatformRemoteAppleBridge::PlatformRemoteAppleBridge() + : PlatformRemoteDarwinDevice () {} + +//------------------------------------------------------------------ +// Static Variables +//------------------------------------------------------------------ +static uint32_t g_initialize_count = 0; + +//------------------------------------------------------------------ +// Static Functions +//------------------------------------------------------------------ +void PlatformRemoteAppleBridge::Initialize() { + PlatformDarwin::Initialize(); + + if (g_initialize_count++ == 0) { + PluginManager::RegisterPlugin(PlatformRemoteAppleBridge::GetPluginNameStatic(), + PlatformRemoteAppleBridge::GetDescriptionStatic(), + PlatformRemoteAppleBridge::CreateInstance); + } +} + +void PlatformRemoteAppleBridge::Terminate() { + if (g_initialize_count > 0) { + if (--g_initialize_count == 0) { + PluginManager::UnregisterPlugin(PlatformRemoteAppleBridge::CreateInstance); + } + } + + PlatformDarwin::Terminate(); +} + +PlatformSP PlatformRemoteAppleBridge::CreateInstance(bool force, + const ArchSpec *arch) { + Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); + if (log) { + const char *arch_name; + if (arch && arch->GetArchitectureName()) + arch_name = arch->GetArchitectureName(); + else + arch_name = "<null>"; + + const char *triple_cstr = + arch ? arch->GetTriple().getTriple().c_str() : "<null>"; + + log->Printf("PlatformRemoteAppleBridge::%s(force=%s, arch={%s,%s})", + __FUNCTION__, force ? "true" : "false", arch_name, triple_cstr); + } + + bool create = force; + if (!create && arch && arch->IsValid()) { + switch (arch->GetMachine()) { + case llvm::Triple::aarch64: { + const llvm::Triple &triple = arch->GetTriple(); + llvm::Triple::VendorType vendor = triple.getVendor(); + switch (vendor) { + case llvm::Triple::Apple: + create = true; + break; + +#if defined(__APPLE__) + // Only accept "unknown" for the vendor if the host is Apple and + // it "unknown" wasn't specified (it was just returned because it + // was NOT specified) + case llvm::Triple::UnknownArch: + create = !arch->TripleVendorWasSpecified(); + break; + +#endif + default: + break; + } + if (create) { + switch (triple.getOS()) { + // FIXMEJSM case llvm::Triple::BridgeOS: + break; + + default: + create = false; + break; + } + } + } break; + default: + break; + } + } + + if (create) { + if (log) + log->Printf("PlatformRemoteAppleBridge::%s() creating platform", + __FUNCTION__); + + return lldb::PlatformSP(new PlatformRemoteAppleBridge()); + } + + if (log) + log->Printf("PlatformRemoteAppleBridge::%s() aborting creation of platform", + __FUNCTION__); + + return lldb::PlatformSP(); +} + +lldb_private::ConstString PlatformRemoteAppleBridge::GetPluginNameStatic() { + static ConstString g_name("remote-bridgeos"); + return g_name; +} + +const char *PlatformRemoteAppleBridge::GetDescriptionStatic() { + return "Remote BridgeOS platform plug-in."; +} + +bool PlatformRemoteAppleBridge::GetSupportedArchitectureAtIndex(uint32_t idx, + ArchSpec &arch) { + ArchSpec system_arch(GetSystemArchitecture()); + + const ArchSpec::Core system_core = system_arch.GetCore(); + switch (system_core) { + default: + switch (idx) { + case 0: + arch.SetTriple("arm64-apple-bridgeos"); + return true; + default: + break; + } + break; + + case ArchSpec::eCore_arm_arm64: + switch (idx) { + case 0: + arch.SetTriple("arm64-apple-bridgeos"); + return true; + default: + break; + } + break; + } + arch.Clear(); + return false; +} + + +void PlatformRemoteAppleBridge::GetDeviceSupportDirectoryNames (std::vector<std::string> &dirnames) +{ + dirnames.clear(); + dirnames.push_back("BridgeOS DeviceSupport"); +} + +std::string PlatformRemoteAppleBridge::GetPlatformName () +{ + return "BridgeOS.platform"; +} + Added: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.h?rev=344209&view=auto ============================================================================== --- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.h (added) +++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.h Wed Oct 10 17:28:35 2018 @@ -0,0 +1,77 @@ +//===-- PlatformRemoteAppleBridge.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_PlatformRemoteAppleBridge_h_ +#define liblldb_PlatformRemoteAppleBridge_h_ + +// C Includes +// C++ Includes +#include <string> + +// Other libraries and framework includes +// Project includes +#include "lldb/Utility/FileSpec.h" + +#include "llvm/Support/FileSystem.h" + +#include "PlatformRemoteDarwinDevice.h" + +class PlatformRemoteAppleBridge : public PlatformRemoteDarwinDevice { +public: + PlatformRemoteAppleBridge(); + + ~PlatformRemoteAppleBridge() override = default; + + //------------------------------------------------------------ + // Class Functions + //------------------------------------------------------------ + static lldb::PlatformSP CreateInstance(bool force, + const lldb_private::ArchSpec *arch); + + static void Initialize(); + + static void Terminate(); + + static lldb_private::ConstString GetPluginNameStatic(); + + static const char *GetDescriptionStatic(); + + //------------------------------------------------------------ + // lldb_private::PluginInterface functions + //------------------------------------------------------------ + lldb_private::ConstString GetPluginName() override { + return GetPluginNameStatic(); + } + + uint32_t GetPluginVersion() override { return 1; } + + //------------------------------------------------------------ + // lldb_private::Platform functions + //------------------------------------------------------------ + + const char *GetDescription() override { return GetDescriptionStatic(); } + + bool GetSupportedArchitectureAtIndex(uint32_t idx, + lldb_private::ArchSpec &arch) override; + +protected: + + //------------------------------------------------------------ + // lldb_private::PlatformRemoteDarwinDevice functions + //------------------------------------------------------------ + + void GetDeviceSupportDirectoryNames (std::vector<std::string> &dirnames) override; + + std::string GetPlatformName () override; + +private: + DISALLOW_COPY_AND_ASSIGN(PlatformRemoteAppleBridge); +}; + +#endif // liblldb_PlatformRemoteAppleBridge_h_ Modified: lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp?rev=344209&r1=344208&r2=344209&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp (original) +++ lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp Wed Oct 10 17:28:35 2018 @@ -59,6 +59,7 @@ SystemRuntime *SystemRuntimeMacOSX::Crea case llvm::Triple::IOS: case llvm::Triple::TvOS: case llvm::Triple::WatchOS: + // NEED_BRIDGEOS_TRIPLE case llvm::Triple::BridgeOS: create = triple_ref.getVendor() == llvm::Triple::Apple; break; default: Modified: lldb/trunk/source/Utility/ArchSpec.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/ArchSpec.cpp?rev=344209&r1=344208&r2=344209&view=diff ============================================================================== --- lldb/trunk/source/Utility/ArchSpec.cpp (original) +++ lldb/trunk/source/Utility/ArchSpec.cpp Wed Oct 10 17:28:35 2018 @@ -947,13 +947,13 @@ bool ArchSpec::SetArchitecture(Architect m_triple.setVendor(llvm::Triple::Apple); // Don't set the OS. It could be simulator, macosx, ios, watchos, - // tvos. We could get close with the cpu type - but we can't get it - // right all of the time. Better to leave this unset so other - // sections of code will set it when they have more information. - // NB: don't call m_triple.setOS (llvm::Triple::UnknownOS). That sets - // the OSName to - // "unknown" and the ArchSpec::TripleVendorWasSpecified() method says - // that any OSName setting means it was specified. + // tvos, bridgeos. We could get close with the cpu type - but we + // can't get it right all of the time. Better to leave this unset + // so other sections of code will set it when they have more + // information. NB: don't call m_triple.setOS (llvm::Triple::UnknownOS). + // That sets the OSName to "unknown" and the + // ArchSpec::TripleVendorWasSpecified() method says that any OSName + // setting means it was specified. } else if (arch_type == eArchTypeELF) { switch (os) { case llvm::ELF::ELFOSABI_AIX: _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits