Unify how we get host version on Mac OS X & iOS.

Also remove our dependency on UIKit & AppKit.
Cleaned up the project files a bit.

<rdar://problem/11814498>

llvm-svn: 160147
This commit is contained in:
Jim Ingham 2012-07-12 23:16:43 +00:00
parent 1d60909e81
commit 9aa15a4562
3 changed files with 81 additions and 85 deletions

View File

@ -452,6 +452,7 @@
49DA65031485C92A005FF180 /* AppleObjCSymbolVendor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49DA65021485C92A005FF180 /* AppleObjCSymbolVendor.cpp */; };
4C6649A014EEE7F100B0316F /* StreamCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C66499F14EEE7F100B0316F /* StreamCallback.h */; };
4C6649A314EEE81000B0316F /* StreamCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C6649A214EEE81000B0316F /* StreamCallback.cpp */; };
4C701C1E15ABB70C00B50001 /* libxml2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 26D55234159A7DB100708D8D /* libxml2.dylib */; };
4CAA56151422D986001FFA01 /* BreakpointResolverFileRegex.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CAA56141422D986001FFA01 /* BreakpointResolverFileRegex.cpp */; };
4CABA9E0134A8BCD00539BDD /* ValueObjectMemory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CABA9DF134A8BCD00539BDD /* ValueObjectMemory.cpp */; };
4CCA644D13B40B82003BDF98 /* ItaniumABILanguageRuntime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CCA643D13B40B82003BDF98 /* ItaniumABILanguageRuntime.cpp */; };
@ -461,6 +462,7 @@
4CCA645613B40B82003BDF98 /* AppleObjCTrampolineHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CCA644813B40B82003BDF98 /* AppleObjCTrampolineHandler.cpp */; };
4CCA645813B40B82003BDF98 /* AppleThreadPlanStepThroughObjCTrampoline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CCA644A13B40B82003BDF98 /* AppleThreadPlanStepThroughObjCTrampoline.cpp */; };
4CD0BD0F134BFADF00CB44D4 /* ValueObjectDynamicValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CD0BD0E134BFADF00CB44D4 /* ValueObjectDynamicValue.cpp */; };
4CF3D80C15AF4DC800845BF3 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EDB919B414F6F10D008FF64B /* Security.framework */; };
4CF52AF51428291E0051E832 /* SBFileSpecList.h in Headers */ = {isa = PBXBuildFile; fileRef = 4CF52AF41428291E0051E832 /* SBFileSpecList.h */; settings = {ATTRIBUTES = (Public, ); }; };
4CF52AF8142829390051E832 /* SBFileSpecList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CF52AF7142829390051E832 /* SBFileSpecList.cpp */; };
94031A9E13CF486700DCFF3C /* InputReaderEZ.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 94031A9D13CF486600DCFF3C /* InputReaderEZ.cpp */; };
@ -517,7 +519,6 @@
B299580B14F2FA1400050A04 /* DisassemblerLLVMC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B299580A14F2FA1400050A04 /* DisassemblerLLVMC.cpp */; };
B2A58722143119810092BFBA /* SBWatchpoint.h in Headers */ = {isa = PBXBuildFile; fileRef = B2A58721143119810092BFBA /* SBWatchpoint.h */; settings = {ATTRIBUTES = (Public, ); }; };
B2A58724143119D50092BFBA /* SBWatchpoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2A58723143119D50092BFBA /* SBWatchpoint.cpp */; };
ED236E0814F84F6800153F6F /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EDB919B414F6F10D008FF64B /* Security.framework */; };
ED88244E15114A9200BC98B9 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EDB919B414F6F10D008FF64B /* Security.framework */; };
ED88245015114CA200BC98B9 /* main.mm in Sources */ = {isa = PBXBuildFile; fileRef = ED88244F15114CA200BC98B9 /* main.mm */; };
ED88245115114CA200BC98B9 /* main.mm in Sources */ = {isa = PBXBuildFile; fileRef = ED88244F15114CA200BC98B9 /* main.mm */; };
@ -1582,7 +1583,7 @@
268901161335BBC300698AC0 /* liblldb-core.a in Frameworks */,
2668022F115FD19D008E1FE4 /* CoreFoundation.framework in Frameworks */,
26680233115FD1A7008E1FE4 /* libobjc.dylib in Frameworks */,
ED236E0814F84F6800153F6F /* Security.framework in Frameworks */,
4CF3D80C15AF4DC800845BF3 /* Security.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -1597,6 +1598,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
4C701C1E15ABB70C00B50001 /* libxml2.dylib in Frameworks */,
26DC6A171337FE8000FF7998 /* liblldb-core.a in Frameworks */,
26B1FCB813381071002886E2 /* CoreFoundation.framework in Frameworks */,
26B1FCBC13381071002886E2 /* libobjc.dylib in Frameworks */,
@ -3310,7 +3312,6 @@
buildPhases = (
26DC6A0D1337FE6900FF7998 /* Sources */,
26DC6A0E1337FE6900FF7998 /* Frameworks */,
261CE9C014D327DE006D8EFE /* Codesign */,
);
buildRules = (
);
@ -3464,20 +3465,6 @@
shellPath = /bin/sh;
shellScript = "cd \"${TARGET_BUILD_DIR}/${PUBLIC_HEADERS_FOLDER_PATH}\"\nfor file in *.h\ndo\n\t/usr/bin/sed -i '' 's/\\(#include\\)[ ]*\"lldb\\/\\(API\\/\\)\\{0,1\\}\\(.*\\)\"/\\1 <LLDB\\/\\3>/1' \"$file\"\n\t/usr/bin/sed -i '' 's|<LLDB/Utility|<LLDB|' \"$file\"\n\tTRUNCATED_VERSION=`echo ${CURRENT_PROJECT_VERSION} | /usr/bin/sed -E 's/^([0-9]+)(\\.[0-9]+)?$/\\1/g'`\n\t/usr/bin/sed -i '' \"s|//#define LLDB_VERSION|#define LLDB_VERSION $TRUNCATED_VERSION |\" \"$file\"\ndone\n";
};
261CE9C014D327DE006D8EFE /* Codesign */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = Codesign;
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = "/bin/sh -x";
shellScript = "if [ $CONFIGURATION != BuildAndIntegration -a $PLATFORM_NAME = macosx ]; then /usr/bin/codesign -s lldb_codesign -f \"$TARGET_BUILD_DIR/$TARGET_NAME\"; fi";
};
261EECA21337D399001D193C /* Build llvm and clang */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
@ -4097,7 +4084,7 @@
"-flimit-debug-info",
"-Wparentheses",
);
SDKROOT = macosx;
SDKROOT = "";
STRIP_INSTALLED_PRODUCT = NO;
STRIP_STYLE = debugging;
VALID_ARCHS = "armv4t armv5 armv6 armv7 armv7s i386 ppc ppc64 ppc7400 ppc970 x86_64";
@ -4148,10 +4135,12 @@
LLVM_BUILD_DIR_ARCH = "$(CURRENT_ARCH)/";
LLVM_CONFIGURATION = Release;
LLVM_SOURCE_DIR = "$(SRCROOT)/llvm";
ONLY_ACTIVE_ARCH = YES;
OTHER_CFLAGS = (
"-flimit-debug-info",
"-Wparentheses",
);
SDKROOT = "";
STRIP_INSTALLED_PRODUCT = NO;
STRIP_STYLE = debugging;
VALID_ARCHS = "armv4t armv5 armv6 armv7 armv7s i386 ppc ppc64 ppc7400 ppc970 x86_64";
@ -4238,8 +4227,6 @@
"-lllvmclang",
"-framework",
Foundation,
"-framework",
AppKit,
"-v",
"-t",
"-Wl,-v",
@ -4250,8 +4237,6 @@
"-t",
"-Wl,-v",
"-framework",
UIKit,
"-framework",
Foundation,
);
PRODUCT_NAME = LLDB;
@ -4312,8 +4297,6 @@
"-t",
"-Wl,-v",
"-framework",
UIKit,
"-framework",
Foundation,
);
PRODUCT_NAME = LLDB;
@ -4523,6 +4506,7 @@
"-flimit-debug-info",
"-Wparentheses",
);
SDKROOT = "";
STRIP_INSTALLED_PRODUCT = NO;
STRIP_STYLE = debugging;
VALID_ARCHS = "armv4t armv5 armv6 armv7 armv7s i386 ppc ppc64 ppc7400 ppc970 x86_64";
@ -4620,8 +4604,6 @@
"-t",
"-Wl,-v",
"-framework",
UIKit,
"-framework",
Foundation,
);
PRODUCT_NAME = LLDB;
@ -4697,6 +4679,8 @@
26DC6A121337FE6A00FF7998 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "-";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = lldb_codesign;
DEAD_CODE_STRIPPING = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@ -4750,6 +4734,8 @@
UIKit,
);
PRODUCT_NAME = "lldb-platform";
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "";
"PROVISIONING_PROFILE[sdk=macosx*]" = "";
SKIP_INSTALL = YES;
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/include $(SRCROOT)/source $(LLVM_SOURCE_DIR)/include $(LLVM_SOURCE_DIR)/tools/clang/include $(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)/include $(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)/tools/clang/include";
};
@ -4758,6 +4744,8 @@
26DC6A131337FE6A00FF7998 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "-";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = lldb_codesign;
DEAD_CODE_STRIPPING = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@ -4809,6 +4797,8 @@
UIKit,
);
PRODUCT_NAME = "lldb-platform";
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "";
"PROVISIONING_PROFILE[sdk=macosx*]" = "";
SKIP_INSTALL = YES;
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/include $(SRCROOT)/source $(LLVM_SOURCE_DIR)/include $(LLVM_SOURCE_DIR)/tools/clang/include $(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)/include $(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)/tools/clang/include";
};

View File

@ -60,12 +60,11 @@
#include <objc/objc-auto.h>
#if defined(__arm__)
#include <UIKit/UIKit.h>
#else
#include <ApplicationServices/ApplicationServices.h>
#include <CoreFoundation/CoreFoundation.h>
#include <Foundation/Foundation.h>
#if !defined(__arm__)
#include <Carbon/Carbon.h>
#include <Security/Security.h>
#endif
#ifndef _POSIX_SPAWN_DISABLE_ASLR
@ -931,6 +930,9 @@ Host::GetOSKernelDescription (std::string &s)
return false;
}
#include <libxml/parser.h>
#include <libxml/tree.h>
bool
Host::GetOSVersion
(
@ -939,51 +941,60 @@ Host::GetOSVersion
uint32_t &update
)
{
static const char *version_plist_file = "/System/Library/CoreServices/SystemVersion.plist";
char buffer[256];
const char *product_version_str = NULL;
#if defined (__arm__)
major = UINT32_MAX;
minor = UINT32_MAX;
update = UINT32_MAX;
NSString *system_version_nstr = [[UIDevice currentDevice] systemVersion];
if (system_version_nstr)
CFCReleaser<CFURLRef> plist_url(CFURLCreateFromFileSystemRepresentation(kCFAllocatorDefault,
(UInt8 *) version_plist_file,
strlen (version_plist_file), NO));
if (plist_url.get())
{
const char *system_version_cstr = system_version_nstr.UTF8String;
Args::StringToVersion(system_version_cstr, major, minor, update);
CFCReleaser<CFPropertyListRef> property_list;
CFCReleaser<CFStringRef> error_string;
CFCReleaser<CFDataRef> resource_data;
Boolean status;
SInt32 error_code;
// Read the XML file.
status = CFURLCreateDataAndPropertiesFromResource (kCFAllocatorDefault,
plist_url.get(),
resource_data.ptr_address(),
NULL,
NULL,
&error_code);
// Reconstitute the dictionary using the XML data.
property_list = CFPropertyListCreateFromXMLData (kCFAllocatorDefault,
resource_data.get(),
kCFPropertyListImmutable,
error_string.ptr_address());
if (CFGetTypeID(property_list.get()) == CFDictionaryGetTypeID())
{
CFDictionaryRef property_dict = (CFDictionaryRef) property_list.get();
CFStringRef product_version_key = CFSTR("ProductVersion");
CFPropertyListRef product_version_value;
product_version_value = CFDictionaryGetValue(property_dict, product_version_key);
if (product_version_value && CFGetTypeID(product_version_value) == CFStringGetTypeID())
{
CFStringRef product_version_cfstr = (CFStringRef) product_version_value;
product_version_str = CFStringGetCStringPtr(product_version_cfstr, kCFStringEncodingUTF8);
if (product_version_str == NULL) {
if (CFStringGetCString(product_version_cfstr, buffer, 256, kCFStringEncodingUTF8))
product_version_str = buffer;
}
}
}
}
return major != UINT32_MAX;
#else
SInt32 version;
OSErr err = ::Gestalt (gestaltSystemVersion, &version);
if (err != noErr)
return false;
if (version < 0x1040)
if (product_version_str)
{
major = ((version & 0xF000) >> 12) * 10 + ((version & 0x0F00) >> 8);
minor = (version & 0x00F0) >> 4;
update = (version & 0x000F);
Args::StringToVersion(product_version_str, major, minor, update);
return true;
}
else
{
if (::Gestalt (gestaltSystemVersionMajor, &version) != noErr)
return false;
major = version;
return false;
if (::Gestalt (gestaltSystemVersionMinor, &version) == noErr)
minor = version;
else
minor = 0;
if (::Gestalt (gestaltSystemVersionBugFix, &version) == noErr)
update = version;
else
update = 0;
}
return true;
#endif
}
static bool
@ -1456,6 +1467,9 @@ LaunchProcessXPC (const char *exe_path, ProcessLaunchInfo &launch_info, ::pid_t
}
}
return error;
#else
Error error;
return error;
#endif
}

View File

@ -368,7 +368,6 @@
26CE05C7115C36870022F371 /* ShellScript */,
26CE0591115C31C20022F371 /* Sources */,
26CE0592115C31C20022F371 /* Frameworks */,
261CE9BE14D327CC006D8EFE /* Codesign */,
);
buildRules = (
);
@ -407,20 +406,6 @@
/* End PBXProject section */
/* Begin PBXShellScriptBuildPhase section */
261CE9BE14D327CC006D8EFE /* Codesign */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = Codesign;
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = "/bin/sh -x";
shellScript = "if [ $CONFIGURATION != BuildAndIntegration -a $PLATFORM_NAME = macosx ]; then /usr/bin/codesign -s lldb_codesign -f \"$TARGET_BUILD_DIR/$TARGET_NAME\"; fi";
};
26CE05C7115C36870022F371 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
@ -499,6 +484,7 @@
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = "";
STRIP_INSTALLED_PRODUCT = NO;
VALID_ARCHS = "armv4t armv5 armv6 armv7 armv7s i386 ppc ppc64 ppc7400 ppc970 x86_64";
@ -520,6 +506,7 @@
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = "";
STRIPFLAGS = "-x";
STRIP_STYLE = debugging;
@ -557,7 +544,6 @@
262419A21198A93E00067686 /* BuildAndIntegration */ = {
isa = XCBuildConfiguration;
buildSettings = {
"ARCHS[sdk=iphoneos*]" = "$(ARCHS_STANDARD_32_BIT)";
"CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*]" = "source/debugserver-entitlements.plist";
COPY_PHASE_STRIP = YES;
CURRENT_PROJECT_VERSION = 188;
@ -609,8 +595,9 @@
26CE0596115C31C30022F371 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
"ARCHS[sdk=iphoneos*]" = "$(ARCHS_STANDARD_32_BIT)";
"CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*]" = "source/debugserver-entitlements.plist";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "-";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = lldb_codesign;
COPY_PHASE_STRIP = YES;
CURRENT_PROJECT_VERSION = 188;
FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks;
@ -649,6 +636,8 @@
);
OTHER_MIGFLAGS = "-I$(DERIVED_FILE_DIR)";
PRODUCT_NAME = debugserver;
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "";
"PROVISIONING_PROFILE[sdk=macosx*]" = "";
SKIP_INSTALL = YES;
USER_HEADER_SEARCH_PATHS = "./source ../../source $(DERIVED_SOURCES_DIR)";
ZERO_LINK = NO;
@ -658,8 +647,9 @@
26CE0597115C31C30022F371 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
"ARCHS[sdk=iphoneos*]" = "$(ARCHS_STANDARD_32_BIT)";
"CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*]" = "source/debugserver-entitlements.plist";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "-";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = lldb_codesign;
COPY_PHASE_STRIP = YES;
CURRENT_PROJECT_VERSION = 188;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
@ -698,6 +688,8 @@
);
OTHER_MIGFLAGS = "-I$(DERIVED_FILE_DIR)";
PRODUCT_NAME = debugserver;
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "";
"PROVISIONING_PROFILE[sdk=macosx*]" = "";
SKIP_INSTALL = YES;
USER_HEADER_SEARCH_PATHS = "./source ../../source $(DERIVED_SOURCES_DIR)";
ZERO_LINK = NO;