Index: lib/Makefile =================================================================== --- lib/Makefile +++ lib/Makefile @@ -96,7 +96,8 @@ lldbPluginObjectFileMachO.a \ lldbPluginSymbolVendorMacOSX.a \ lldbPluginProcessDarwin.a \ - lldbPluginProcessMachCore.a + lldbPluginProcessMachCore.a \ + lldbPluginSystemRuntimeMacOSX.a endif ifeq ($(HOST_OS),Linux) Index: scripts/generate-vers.pl =================================================================== --- scripts/generate-vers.pl +++ scripts/generate-vers.pl @@ -2,11 +2,11 @@ sub usage() { - print "Usage: generate-vers.pl /path/toproject.pbxproj"; + print "Usage: generate-vers.pl /path/toproject.pbxproj program_name"; exit(0); } -(scalar @ARGV == 1) or usage(); +(scalar @ARGV == 2) or usage(); open $pbxproj, $ARGV[0] or die "Couldn't open ".$ARGV[0]; @@ -51,6 +51,6 @@ close $pbxproj; -$file_string = " const unsigned char liblldb_coreVersionString[] __attribute__ ((used)) = \"@(#)PROGRAM:".$uppercase_name." PROJECT:".$lowercase_name."-".$lldb_version_string."\" \"\\n\"; const double liblldb_coreVersionNumber __attribute__ ((used)) = (double)".$lldb_version.".".$lldb_train.";\n"; +$file_string = " const unsigned char ".$ARGV[1]."VersionString[] __attribute__ ((used)) = \"@(#)PROGRAM:".$uppercase_name." PROJECT:".$lowercase_name."-".$lldb_version_string."\" \"\\n\"; const double ".$ARGV[1]."VersionNumber __attribute__ ((used)) = (double)".$lldb_version.".".$lldb_train.";\n"; print $file_string; Index: source/CMakeLists.txt =================================================================== --- source/CMakeLists.txt +++ source/CMakeLists.txt @@ -110,7 +110,7 @@ set(LLDB_VERS_GENERATED_FILE ${LLDB_BINARY_DIR}/source/LLDB_vers.c) add_custom_command(OUTPUT ${LLDB_VERS_GENERATED_FILE} COMMAND ${LLDB_SOURCE_DIR}/scripts/generate-vers.pl - ${LLDB_SOURCE_DIR}/lldb.xcodeproj/project.pbxproj + ${LLDB_SOURCE_DIR}/lldb.xcodeproj/project.pbxproj liblldb_core > ${LLDB_VERS_GENERATED_FILE}) set_source_files_properties(${LLDB_VERS_GENERATED_FILE} PROPERTIES GENERATED 1) Index: source/Host/common/Host.cpp =================================================================== --- source/Host/common/Host.cpp +++ source/Host/common/Host.cpp @@ -1099,19 +1099,23 @@ { framework_pos += strlen("LLDB.framework"); ::strncpy (framework_pos, "/Resources/Python", PATH_MAX - (framework_pos - raw_path)); - } -#else - llvm::SmallString<256> python_version_dir; - llvm::raw_svector_ostream os(python_version_dir); - os << "/python" << PY_MAJOR_VERSION << '.' << PY_MINOR_VERSION << "/site-packages"; - os.flush(); + } + else + { +#endif + llvm::SmallString<256> python_version_dir; + llvm::raw_svector_ostream os(python_version_dir); + os << "/python" << PY_MAJOR_VERSION << '.' << PY_MINOR_VERSION << "/site-packages"; + os.flush(); - // We may get our string truncated. Should we protect - // this with an assert? + // We may get our string truncated. Should we protect + // this with an assert? - ::strncat(raw_path, python_version_dir.c_str(), - sizeof(raw_path) - strlen(raw_path) - 1); + ::strncat(raw_path, python_version_dir.c_str(), + sizeof(raw_path) - strlen(raw_path) - 1); +#if defined (__APPLE__) + } #endif FileSpec::Resolve (raw_path, resolved_path, sizeof(resolved_path)); g_lldb_python_dir.SetCString(resolved_path); Index: source/Makefile =================================================================== --- source/Makefile +++ source/Makefile @@ -25,7 +25,7 @@ ifeq ($(HOST_OS),Darwin) LLDB_vers.c: $(PROJ_SRC_DIR)/$(LLDB_LEVEL)/scripts/generate-vers.pl $(PROJ_SRC_DIR)/$(LLDB_LEVEL)/lldb.xcodeproj/project.pbxproj - "$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/scripts/generate-vers.pl" "$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/lldb.xcodeproj/project.pbxproj" > LLDB_vers.c + "$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/scripts/generate-vers.pl" "$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/lldb.xcodeproj/project.pbxproj" liblldb_core > LLDB_vers.c else LLDB_REVISION := $(strip \ $(shell $(LLVM_SRC_ROOT)/utils/GetSourceVersion $(LLVM_SRC_ROOT)/tools/lldb)) Index: source/Plugins/Makefile =================================================================== --- source/Plugins/Makefile +++ source/Plugins/Makefile @@ -30,6 +30,7 @@ DIRS += SymbolVendor/MacOSX #DIRS += Process/MacOSX-User DIRS += Process/mach-core +DIRS += SystemRuntime/MacOSX endif ifeq ($(HOST_OS),Linux) Index: source/Plugins/SystemRuntime/MacOSX/Makefile =================================================================== --- /dev/null +++ source/Plugins/SystemRuntime/MacOSX/Makefile @@ -0,0 +1,14 @@ +##===- source/Plugins/SystemRuntime/MacOSX ----*- Makefile -*-===## +# +# The LLVM Compiler Infrastructure +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## + +LLDB_LEVEL := ../../../.. +LIBRARYNAME := lldbPluginSystemRuntimeMacOSX +BUILD_ARCHIVE = 1 + +include $(LLDB_LEVEL)/Makefile Index: tools/Makefile =================================================================== --- tools/Makefile +++ tools/Makefile @@ -15,4 +15,8 @@ DIRS := driver lldb-platform endif +ifeq ($(HOST_OS),Darwin) +DIRS += debugserver +endif + include $(LLDB_LEVEL)/Makefile Index: tools/debugserver/Makefile =================================================================== --- /dev/null +++ tools/debugserver/Makefile @@ -0,0 +1,13 @@ +##===- tools/debugserver/Makefile --------------------------*- Makefile -*-===## +# +# The LLVM Compiler Infrastructure +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## +LLDB_LEVEL := ../.. + +DIRS := scripts source + +include $(LLDB_LEVEL)/Makefile \ No newline at end of file Index: tools/debugserver/scripts/Makefile =================================================================== --- /dev/null +++ tools/debugserver/scripts/Makefile @@ -0,0 +1,21 @@ +##===- tools/debugserver/scripts/Makefile ------------------*- Makefile -*-===## +# +# The LLVM Compiler Infrastructure +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## + +LLDB_LEVEL := ../../.. + +include $(LLDB_LEVEL)/Makefile + +DBCONFIG_FILE = "$(PROJ_OBJ_DIR)/../DNBConfig.h" + +$(DBCONFIG_FILE): + SCRIPT_OUTPUT_FILE_0=$(DBCONFIG_FILE) perl $(PROJ_SRC_DIR)/dbgnub-config.pl + +all:: $(DBCONFIG_FILE) + +.PHONY: all \ No newline at end of file Index: tools/debugserver/scripts/dbgnub-config.pl =================================================================== --- tools/debugserver/scripts/dbgnub-config.pl +++ tools/debugserver/scripts/dbgnub-config.pl @@ -33,7 +33,7 @@ my $val; while (($key, $val) = each %ENV) { - $val =~ s/\n/\n\/\/ /; + $val =~ s/\n/\n\/\/ /g; printf CONFIG "// %s = %s\n", $key, $val; } print CONFIG "//" . "-" x 72 . "\n"; Index: tools/debugserver/source/MacOSX/Makefile =================================================================== --- /dev/null +++ tools/debugserver/source/MacOSX/Makefile @@ -0,0 +1,54 @@ +##===- tools/debugserver/source/MacOSX/Makefile ------------*- Makefile -*-===## +# +# The LLVM Compiler Infrastructure +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## +LLDB_LEVEL := ../../../.. + +DIRS := i386 x86_64 + +TOOLNAME = debugserver + +CODESIGN_TOOLS := 1 + +TOOL_CODESIGN_IDENTITY := lldb_codesign + +LLVMLibsOptions += -llldbDebugserverCommon -llldbUtility -llldbDebugserverMacOSX_I386 -llldbDebugserverMacOSX_X86_64 \ + -framework Foundation -framework CoreFoundation + +GENERATED_MACH_SOURCES = $(PROJ_OBJ_DIR)/mach_excServer.c $(PROJ_OBJ_DIR)/mach_excUser.c + +SOURCES := CFBundle.cpp \ + CFData.cpp \ + CFString.cpp \ + MachException.cpp \ + MachProcess.cpp \ + MachTask.cpp \ + MachThread.cpp \ + MachThreadList.cpp \ + MachVMMemory.cpp \ + MachVMRegion.cpp + +BUILT_SOURCES = $(GENERATED_MACH_SOURCES) $(PROJ_OBJ_DIR)/HasAVX.o + +CPP.Flags += -I$(PROJ_OBJ_DIR)/../.. -I$(PROJ_SRC_DIR)/.. + +LD.Flags += -Wl,-sectcreate,__TEXT,__info_plist,$(PROJ_SRC_DIR)/../../resources/lldb-debugserver-Info.plist + +include $(LLDB_LEVEL)/Makefile + +ObjectsO += $(PROJ_OBJ_DIR)/HasAVX.o + +$(PROJ_OBJ_DIR)/HasAVX.o: $(PROJ_SRC_DIR)/HasAVX.s + $(Echo) "Compiling HasAVX.s for $(BuildMode) build" $(PIC_FLAG) + $(CC) $(TargetCommonOpts) $(CompileCommonOpts) -c $< -o $@ + +ifeq ($(HOST_OS),Darwin) +LLVMLibsOptions += -Wl,-rpath,@loader_path/../lib/ +endif + +$(GENERATED_MACH_SOURCES): + mig -I$(PROJ_OBJ_DIR)/../.. $(PROJ_SRC_DIR)/dbgnub-mig.defs \ No newline at end of file Index: tools/debugserver/source/MacOSX/i386/Makefile =================================================================== --- /dev/null +++ tools/debugserver/source/MacOSX/i386/Makefile @@ -0,0 +1,19 @@ +##===- tools/debugserver/source/MacOSX/i386/Makefile -------*- Makefile -*-===## +# +# The LLVM Compiler Infrastructure +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## + +LLDB_LEVEL := ../../../../.. + +LIBRARYNAME := lldbDebugserverMacOSX_I386 +BUILD_ARCHIVE = 1 + +SOURCES := DNBArchImplI386.cpp + +include $(LLDB_LEVEL)/Makefile + +CPP.Flags += -I$(PROJ_SRC_DIR)/.. -I$(PROJ_SRC_DIR)/../.. -I$(PROJ_OBJ_DIR)/../../.. \ No newline at end of file Index: tools/debugserver/source/MacOSX/x86_64/Makefile =================================================================== --- /dev/null +++ tools/debugserver/source/MacOSX/x86_64/Makefile @@ -0,0 +1,19 @@ +##===- tools/debugserver/source/MacOSX/i386/Makefile -------*- Makefile -*-===## +# +# The LLVM Compiler Infrastructure +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## + +LLDB_LEVEL := ../../../../.. + +LIBRARYNAME := lldbDebugserverMacOSX_X86_64 +BUILD_ARCHIVE = 1 + +SOURCES := DNBArchImplX86_64.cpp + +include $(LLDB_LEVEL)/Makefile + +CPP.Flags += -I$(PROJ_SRC_DIR)/.. -I$(PROJ_SRC_DIR)/../.. -I$(PROJ_OBJ_DIR)/../../.. \ No newline at end of file Index: tools/debugserver/source/Makefile =================================================================== --- /dev/null +++ tools/debugserver/source/Makefile @@ -0,0 +1,46 @@ +##===- tools/debugserver/source/Makefile -------------------*- Makefile -*-===## +# +# The LLVM Compiler Infrastructure +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## +LLDB_LEVEL := ../../.. + +LIBRARYNAME := lldbDebugserverCommon +BUILD_ARCHIVE = 1 + +SOURCES := debugserver.cpp \ + DNBArch.cpp \ + DNBBreakpoint.cpp \ + DNB.cpp \ + DNBDataRef.cpp \ + DNBError.cpp \ + DNBLog.cpp \ + DNBRegisterInfo.cpp \ + DNBThreadResumeActions.cpp \ + libdebugserver.cpp \ + PseudoTerminal.cpp \ + PThreadEvent.cpp \ + PThreadMutex.cpp \ + RNBContext.cpp \ + RNBRemote.cpp \ + RNBServices.cpp \ + RNBSocket.cpp \ + SysSignal.cpp \ + TTYState.cpp + +include $(LLDB_LEVEL)/Makefile + +ifeq ($(HOST_OS),Darwin) +DIRS := MacOSX/i386 MacOSX/x86_64 MacOSX +CPP.Flags += -I$(PROJ_SRC_DIR)/MacOSX +CPP.Flags += -I$(PROJ_OBJ_DIR)/.. +BUILT_SOURCES = debugserver_vers.c +endif + +ifeq ($(HOST_OS),Darwin) +debugserver_vers.c: $(PROJ_SRC_DIR)/$(LLDB_LEVEL)/scripts/generate-vers.pl $(PROJ_SRC_DIR)/../debugserver.xcodeproj/project.pbxproj + "$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/scripts/generate-vers.pl" "$(PROJ_SRC_DIR)/../debugserver.xcodeproj/project.pbxproj" debugserver > debugserver_vers.c +endif