[llvm-branch-commits] [lldb] r180260 - Update Windows branch to trunk 180252

Carlo Kok ck at remobjects.com
Thu Apr 25 05:31:55 PDT 2013


Author: carlokok
Date: Thu Apr 25 07:31:53 2013
New Revision: 180260

URL: http://llvm.org/viewvc/llvm-project?rev=180260&view=rev
Log:
Update Windows branch to trunk 180252

Added:
    lldb/branches/windows/examples/python/unwind_diagnose.py
      - copied unchanged from r180252, lldb/trunk/examples/python/unwind_diagnose.py
    lldb/branches/windows/source/Plugins/Process/Utility/RegisterContextDummy.cpp
      - copied unchanged from r180252, lldb/trunk/source/Plugins/Process/Utility/RegisterContextDummy.cpp
    lldb/branches/windows/source/Plugins/Process/Utility/RegisterContextDummy.h
      - copied unchanged from r180252, lldb/trunk/source/Plugins/Process/Utility/RegisterContextDummy.h
    lldb/branches/windows/source/Utility/UuidCompatibility.h
      - copied unchanged from r179747, lldb/trunk/source/Utility/UuidCompatibility.h
    lldb/branches/windows/test/functionalities/recursion/
      - copied from r180252, lldb/trunk/test/functionalities/recursion/
    lldb/branches/windows/test/functionalities/thread/state/
      - copied from r180252, lldb/trunk/test/functionalities/thread/state/
    lldb/branches/windows/test/lang/cpp/overloaded-functions/
      - copied from r180252, lldb/trunk/test/lang/cpp/overloaded-functions/
    lldb/branches/windows/test/lang/objc/objc-static-method-stripped/
      - copied from r180252, lldb/trunk/test/lang/objc/objc-static-method-stripped/
    lldb/branches/windows/test/lang/objc/objc-super/
      - copied from r180252, lldb/trunk/test/lang/objc/objc-super/
Modified:
    lldb/branches/windows/   (props changed)
    lldb/branches/windows/CMakeLists.txt
    lldb/branches/windows/examples/python/operating_system.py
    lldb/branches/windows/include/lldb/API/SBAddress.h
    lldb/branches/windows/include/lldb/API/SBCommandReturnObject.h
    lldb/branches/windows/include/lldb/API/SBDeclaration.h
    lldb/branches/windows/include/lldb/API/SBError.h
    lldb/branches/windows/include/lldb/API/SBExpressionOptions.h
    lldb/branches/windows/include/lldb/API/SBFileSpec.h
    lldb/branches/windows/include/lldb/API/SBFileSpecList.h
    lldb/branches/windows/include/lldb/API/SBLineEntry.h
    lldb/branches/windows/include/lldb/API/SBSourceManager.h
    lldb/branches/windows/include/lldb/API/SBStream.h
    lldb/branches/windows/include/lldb/API/SBStringList.h
    lldb/branches/windows/include/lldb/API/SBSymbolContext.h
    lldb/branches/windows/include/lldb/API/SBSymbolContextList.h
    lldb/branches/windows/include/lldb/API/SBType.h
    lldb/branches/windows/include/lldb/API/SBValue.h
    lldb/branches/windows/include/lldb/API/SBValueList.h
    lldb/branches/windows/include/lldb/Breakpoint/Breakpoint.h
    lldb/branches/windows/include/lldb/Breakpoint/BreakpointLocation.h
    lldb/branches/windows/include/lldb/Breakpoint/BreakpointOptions.h
    lldb/branches/windows/include/lldb/Breakpoint/BreakpointSite.h
    lldb/branches/windows/include/lldb/Breakpoint/Watchpoint.h
    lldb/branches/windows/include/lldb/Breakpoint/WatchpointOptions.h
    lldb/branches/windows/include/lldb/Core/Address.h
    lldb/branches/windows/include/lldb/Core/Broadcaster.h
    lldb/branches/windows/include/lldb/Core/Debugger.h
    lldb/branches/windows/include/lldb/Core/Disassembler.h
    lldb/branches/windows/include/lldb/Core/Event.h
    lldb/branches/windows/include/lldb/Core/Module.h
    lldb/branches/windows/include/lldb/Core/ModuleSpec.h
    lldb/branches/windows/include/lldb/Core/PluginManager.h
    lldb/branches/windows/include/lldb/Core/Section.h
    lldb/branches/windows/include/lldb/Core/SourceManager.h
    lldb/branches/windows/include/lldb/Core/Timer.h
    lldb/branches/windows/include/lldb/Core/Value.h
    lldb/branches/windows/include/lldb/Core/ValueObject.h
    lldb/branches/windows/include/lldb/Core/ValueObjectSyntheticFilter.h
    lldb/branches/windows/include/lldb/DataFormatters/FormatNavigator.h
    lldb/branches/windows/include/lldb/DataFormatters/TypeCategory.h
    lldb/branches/windows/include/lldb/DataFormatters/TypeFormat.h
    lldb/branches/windows/include/lldb/DataFormatters/TypeSummary.h
    lldb/branches/windows/include/lldb/DataFormatters/TypeSynthetic.h
    lldb/branches/windows/include/lldb/Expression/ClangASTSource.h
    lldb/branches/windows/include/lldb/Expression/ClangExpression.h
    lldb/branches/windows/include/lldb/Expression/ClangExpressionDeclMap.h
    lldb/branches/windows/include/lldb/Expression/ClangExpressionParser.h
    lldb/branches/windows/include/lldb/Expression/ClangExpressionVariable.h
    lldb/branches/windows/include/lldb/Expression/ClangFunction.h
    lldb/branches/windows/include/lldb/Expression/ClangUserExpression.h
    lldb/branches/windows/include/lldb/Expression/ClangUtilityFunction.h
    lldb/branches/windows/include/lldb/Expression/IRDynamicChecks.h
    lldb/branches/windows/include/lldb/Expression/IRExecutionUnit.h
    lldb/branches/windows/include/lldb/Expression/IRForTarget.h
    lldb/branches/windows/include/lldb/Expression/IRInterpreter.h
    lldb/branches/windows/include/lldb/Expression/IRMemoryMap.h
    lldb/branches/windows/include/lldb/Expression/Materializer.h
    lldb/branches/windows/include/lldb/Host/DynamicLibrary.h
    lldb/branches/windows/include/lldb/Host/Terminal.h
    lldb/branches/windows/include/lldb/Host/freebsd/Config.h
    lldb/branches/windows/include/lldb/Interpreter/Args.h
    lldb/branches/windows/include/lldb/Interpreter/CommandInterpreter.h
    lldb/branches/windows/include/lldb/Interpreter/OptionValueProperties.h
    lldb/branches/windows/include/lldb/Interpreter/ScriptInterpreter.h
    lldb/branches/windows/include/lldb/Interpreter/ScriptInterpreterPython.h
    lldb/branches/windows/include/lldb/Symbol/ClangASTContext.h
    lldb/branches/windows/include/lldb/Symbol/ClangASTImporter.h
    lldb/branches/windows/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h
    lldb/branches/windows/include/lldb/Symbol/CompileUnit.h
    lldb/branches/windows/include/lldb/Symbol/DWARFCallFrameInfo.h
    lldb/branches/windows/include/lldb/Symbol/FuncUnwinders.h
    lldb/branches/windows/include/lldb/Symbol/ObjectFile.h
    lldb/branches/windows/include/lldb/Symbol/SymbolContext.h
    lldb/branches/windows/include/lldb/Symbol/SymbolVendor.h
    lldb/branches/windows/include/lldb/Symbol/Type.h
    lldb/branches/windows/include/lldb/Symbol/UnwindPlan.h
    lldb/branches/windows/include/lldb/Target/Memory.h
    lldb/branches/windows/include/lldb/Target/ObjCLanguageRuntime.h
    lldb/branches/windows/include/lldb/Target/Process.h
    lldb/branches/windows/include/lldb/Target/RegisterContext.h
    lldb/branches/windows/include/lldb/Target/StackFrame.h
    lldb/branches/windows/include/lldb/Target/StackFrameList.h
    lldb/branches/windows/include/lldb/Target/Target.h
    lldb/branches/windows/include/lldb/Target/Thread.h
    lldb/branches/windows/include/lldb/Target/ThreadPlanStepInRange.h
    lldb/branches/windows/include/lldb/Utility/PriorityPointerPair.h
    lldb/branches/windows/include/lldb/Utility/PythonPointer.h
    lldb/branches/windows/include/lldb/Utility/SharingPtr.h
    lldb/branches/windows/include/lldb/lldb-forward.h
    lldb/branches/windows/include/lldb/lldb-private-interfaces.h
    lldb/branches/windows/include/lldb/lldb-types.h
    lldb/branches/windows/include/lldb/lldb-windows.h
    lldb/branches/windows/lldb.xcodeproj/project.pbxproj
    lldb/branches/windows/scripts/Python/finish-swig-Python-LLDB.sh
    lldb/branches/windows/scripts/Python/interface/SBExpressionOptions.i
    lldb/branches/windows/scripts/Python/interface/SBSection.i
    lldb/branches/windows/scripts/Python/interface/SBType.i
    lldb/branches/windows/scripts/Python/python-wrapper.swig
    lldb/branches/windows/source/API/SBTypeCategory.cpp
    lldb/branches/windows/source/API/SBValue.cpp
    lldb/branches/windows/source/API/SBValueList.cpp
    lldb/branches/windows/source/Breakpoint/BreakpointLocation.cpp
    lldb/branches/windows/source/Breakpoint/BreakpointOptions.cpp
    lldb/branches/windows/source/Breakpoint/WatchpointOptions.cpp
    lldb/branches/windows/source/CMakeLists.txt
    lldb/branches/windows/source/Commands/CommandObjectBreakpointCommand.cpp
    lldb/branches/windows/source/Commands/CommandObjectCommands.cpp
    lldb/branches/windows/source/Commands/CommandObjectPlatform.cpp
    lldb/branches/windows/source/Commands/CommandObjectPlugin.cpp
    lldb/branches/windows/source/Commands/CommandObjectSource.cpp
    lldb/branches/windows/source/Commands/CommandObjectTarget.cpp
    lldb/branches/windows/source/Commands/CommandObjectType.cpp
    lldb/branches/windows/source/Commands/CommandObjectWatchpointCommand.cpp
    lldb/branches/windows/source/Core/Address.cpp
    lldb/branches/windows/source/Core/Communication.cpp
    lldb/branches/windows/source/Core/ConnectionFileDescriptor.cpp
    lldb/branches/windows/source/Core/Debugger.cpp
    lldb/branches/windows/source/Core/Disassembler.cpp
    lldb/branches/windows/source/Core/DynamicLoader.cpp
    lldb/branches/windows/source/Core/Listener.cpp
    lldb/branches/windows/source/Core/Module.cpp
    lldb/branches/windows/source/Core/PluginManager.cpp
    lldb/branches/windows/source/Core/StreamAsynchronousIO.cpp
    lldb/branches/windows/source/Core/ValueObject.cpp
    lldb/branches/windows/source/Core/ValueObjectRegister.cpp
    lldb/branches/windows/source/DataFormatters/CXXFormatterFunctions.cpp
    lldb/branches/windows/source/DataFormatters/Cocoa.cpp
    lldb/branches/windows/source/DataFormatters/FormatManager.cpp
    lldb/branches/windows/source/DataFormatters/LibCxxList.cpp
    lldb/branches/windows/source/DataFormatters/NSArray.cpp
    lldb/branches/windows/source/DataFormatters/NSDictionary.cpp
    lldb/branches/windows/source/Expression/ClangASTSource.cpp
    lldb/branches/windows/source/Expression/ClangExpressionDeclMap.cpp
    lldb/branches/windows/source/Expression/ClangExpressionParser.cpp
    lldb/branches/windows/source/Expression/ClangFunction.cpp
    lldb/branches/windows/source/Expression/ClangUserExpression.cpp
    lldb/branches/windows/source/Expression/ClangUtilityFunction.cpp
    lldb/branches/windows/source/Expression/DWARFExpression.cpp
    lldb/branches/windows/source/Expression/IRExecutionUnit.cpp
    lldb/branches/windows/source/Expression/IRForTarget.cpp
    lldb/branches/windows/source/Expression/IRInterpreter.cpp
    lldb/branches/windows/source/Expression/IRMemoryMap.cpp
    lldb/branches/windows/source/Expression/Materializer.cpp
    lldb/branches/windows/source/Host/CMakeLists.txt
    lldb/branches/windows/source/Host/common/DynamicLibrary.cpp
    lldb/branches/windows/source/Host/common/File.cpp
    lldb/branches/windows/source/Host/common/FileSpec.cpp
    lldb/branches/windows/source/Host/common/Host.cpp
    lldb/branches/windows/source/Host/common/Mutex.cpp
    lldb/branches/windows/source/Host/common/Terminal.cpp
    lldb/branches/windows/source/Host/freebsd/Host.cpp
    lldb/branches/windows/source/Host/linux/Host.cpp
    lldb/branches/windows/source/Host/macosx/CMakeLists.txt
    lldb/branches/windows/source/Host/macosx/Host.mm
    lldb/branches/windows/source/Interpreter/Args.cpp
    lldb/branches/windows/source/Interpreter/CommandInterpreter.cpp
    lldb/branches/windows/source/Interpreter/OptionGroupValueObjectDisplay.cpp
    lldb/branches/windows/source/Interpreter/OptionValueProperties.cpp
    lldb/branches/windows/source/Interpreter/Options.cpp
    lldb/branches/windows/source/Interpreter/ScriptInterpreter.cpp
    lldb/branches/windows/source/Interpreter/ScriptInterpreterPython.cpp
    lldb/branches/windows/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp
    lldb/branches/windows/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.h
    lldb/branches/windows/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
    lldb/branches/windows/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
    lldb/branches/windows/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
    lldb/branches/windows/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h
    lldb/branches/windows/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
    lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h
    lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
    lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h
    lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
    lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h
    lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.h
    lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeVendor.cpp
    lldb/branches/windows/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
    lldb/branches/windows/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h
    lldb/branches/windows/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp
    lldb/branches/windows/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h
    lldb/branches/windows/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
    lldb/branches/windows/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
    lldb/branches/windows/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
    lldb/branches/windows/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
    lldb/branches/windows/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
    lldb/branches/windows/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
    lldb/branches/windows/source/Plugins/OperatingSystem/CMakeLists.txt
    lldb/branches/windows/source/Plugins/OperatingSystem/Darwin-Kernel/OperatingSystemDarwinKernel.h
    lldb/branches/windows/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
    lldb/branches/windows/source/Plugins/OperatingSystem/Python/OperatingSystemPython.h
    lldb/branches/windows/source/Plugins/Platform/CMakeLists.txt
    lldb/branches/windows/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
    lldb/branches/windows/source/Plugins/Process/CMakeLists.txt
    lldb/branches/windows/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
    lldb/branches/windows/source/Plugins/Process/Linux/ProcessMonitor.cpp
    lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
    lldb/branches/windows/source/Plugins/Process/POSIX/POSIXThread.cpp
    lldb/branches/windows/source/Plugins/Process/POSIX/POSIXThread.h
    lldb/branches/windows/source/Plugins/Process/POSIX/RegisterContext_x86_64.cpp
    lldb/branches/windows/source/Plugins/Process/Utility/CMakeLists.txt
    lldb/branches/windows/source/Plugins/Process/Utility/RegisterContextLLDB.h
    lldb/branches/windows/source/Plugins/Process/Utility/StopInfoMachException.cpp
    lldb/branches/windows/source/Plugins/Process/Utility/ThreadMemory.cpp
    lldb/branches/windows/source/Plugins/Process/Utility/ThreadMemory.h
    lldb/branches/windows/source/Plugins/Process/Utility/UnwindLLDB.h
    lldb/branches/windows/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
    lldb/branches/windows/source/Plugins/Process/mach-core/CMakeLists.txt
    lldb/branches/windows/source/Plugins/Process/mach-core/ProcessMachCore.h
    lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
    lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
    lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
    lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.h
    lldb/branches/windows/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
    lldb/branches/windows/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
    lldb/branches/windows/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
    lldb/branches/windows/source/Plugins/SymbolVendor/CMakeLists.txt
    lldb/branches/windows/source/Plugins/SymbolVendor/MacOSX/CMakeLists.txt
    lldb/branches/windows/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
    lldb/branches/windows/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.h
    lldb/branches/windows/source/Symbol/ClangASTContext.cpp
    lldb/branches/windows/source/Symbol/FuncUnwinders.cpp
    lldb/branches/windows/source/Symbol/LineTable.cpp
    lldb/branches/windows/source/Symbol/ObjectFile.cpp
    lldb/branches/windows/source/Symbol/SymbolFile.cpp
    lldb/branches/windows/source/Symbol/SymbolVendor.cpp
    lldb/branches/windows/source/Symbol/Symtab.cpp
    lldb/branches/windows/source/Symbol/Type.cpp
    lldb/branches/windows/source/Target/LanguageRuntime.cpp
    lldb/branches/windows/source/Target/Memory.cpp
    lldb/branches/windows/source/Target/ObjCLanguageRuntime.cpp
    lldb/branches/windows/source/Target/OperatingSystem.cpp
    lldb/branches/windows/source/Target/Platform.cpp
    lldb/branches/windows/source/Target/Process.cpp
    lldb/branches/windows/source/Target/StackFrameList.cpp
    lldb/branches/windows/source/Target/StopInfo.cpp
    lldb/branches/windows/source/Target/Target.cpp
    lldb/branches/windows/source/Target/TargetList.cpp
    lldb/branches/windows/source/Target/Thread.cpp
    lldb/branches/windows/source/Target/ThreadList.cpp
    lldb/branches/windows/source/Target/UnwindAssembly.cpp
    lldb/branches/windows/source/Utility/CMakeLists.txt
    lldb/branches/windows/source/Utility/KQueue.h
    lldb/branches/windows/test/api/check_public_api_headers/Makefile
    lldb/branches/windows/test/dosep.ty
    lldb/branches/windows/test/functionalities/completion/TestCompletion.py
    lldb/branches/windows/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
    lldb/branches/windows/test/functionalities/inferior-crashing/TestInferiorCrashing.py
    lldb/branches/windows/test/functionalities/register/TestRegisters.py
    lldb/branches/windows/test/lang/c/anonymous/TestAnonymous.py
    lldb/branches/windows/test/lang/c/anonymous/main.c
    lldb/branches/windows/test/lang/c/strings/TestCStrings.py
    lldb/branches/windows/test/lang/cpp/char1632_t/TestChar1632T.py
    lldb/branches/windows/test/lang/cpp/wchar_t/TestCxxWCharT.py
    lldb/branches/windows/test/redo.py
    lldb/branches/windows/tools/darwin-debug/darwin-debug.cpp
    lldb/branches/windows/tools/debugserver/source/DNB.cpp
    lldb/branches/windows/tools/debugserver/source/DNB.h
    lldb/branches/windows/tools/debugserver/source/DNBDefs.h
    lldb/branches/windows/tools/debugserver/source/DNBTimer.h
    lldb/branches/windows/tools/debugserver/source/MacOSX/MachThread.h
    lldb/branches/windows/tools/debugserver/source/RNBDefs.h
    lldb/branches/windows/tools/driver/Driver.h
    lldb/branches/windows/tools/lldb-perf/common/clang/lldb_perf_clang.cpp
    lldb/branches/windows/tools/lldb-perf/lib/Gauge.cpp
    lldb/branches/windows/tools/lldb-perf/lib/MemoryGauge.cpp
    lldb/branches/windows/tools/lldb-perf/lib/Results.h
    lldb/branches/windows/tools/lldb-platform/lldb-platform.cpp
    lldb/branches/windows/www/lldb-gdb.html

Propchange: lldb/branches/windows/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Apr 25 07:31:53 2013
@@ -1,2 +1,2 @@
 /lldb/branches/apple/python-GIL:156467-162159
-/lldb/trunk:163223-179594
+/lldb/trunk:163223-180252

Modified: lldb/branches/windows/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/CMakeLists.txt?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/CMakeLists.txt (original)
+++ lldb/branches/windows/CMakeLists.txt Thu Apr 25 07:31:53 2013
@@ -83,18 +83,43 @@ include_directories(/usr/include/python2
 include_directories(../clang/include)
 include_directories("${CMAKE_CURRENT_BINARY_DIR}/../clang/include")
 
-if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
-  if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.7")
-    set(CMAKE_CXX_FLAGS "-std=c++0x")
-  else()
-    set(CMAKE_CXX_FLAGS "-std=c++11")
+# lldb requires c++11 to build. Make sure that we have a compiler and standard
+# library combination that can do that.
+if (MSVC11)
+  # Do nothing, we're good.
+elseif (NOT MSVC)
+  # gcc and clang require the -std=c++0x or -std=c++11 flag.
+  if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" OR
+      "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
+    if (NOT ("${CMAKE_CXX_FLAGS}" MATCHES "-std=c\\+\\+0x" OR
+             "${CMAKE_CXX_FLAGS}" MATCHES "-std=gnu\\+\\+0x" OR
+             "${CMAKE_CXX_FLAGS}" MATCHES "-std=c\\+\\+11" OR
+             "${CMAKE_CXX_FLAGS}" MATCHES "-std=gnu\\+\\+11"))
+      if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+        if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.7")
+          set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
+        else()
+          set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
+        endif()
+      else()
+        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
+      endif()
+    endif()
   endif()
 else()
-  if (NOT( CMAKE_SYSTEM_NAME MATCHES "Windows" ))
-    set(CMAKE_CXX_FLAGS "-std=c++11")
+    if (NOT( CMAKE_SYSTEM_NAME MATCHES "Windows" ))
+      message(FATAL_ERROR "The selected compiler does not support c++11 which is "
+            "required to build lldb.")
   endif()
 endif()
 
+# Disable Clang warnings
+if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+  add_lldb_definitions(
+    -Wno-deprecated-declarations # Suppress "deprecated auto_ptr" warnings
+  )
+endif()
+
 # Disable MSVC warnings
 if( MSVC )
   add_lldb_definitions(
@@ -149,7 +174,11 @@ macro(add_lldb_library name)
   #endif()
 
   if(LLDB_USED_LIBS)
-    target_link_libraries(${name} -Wl,--start-group ${LLDB_USED_LIBS} -Wl,--end-group)
+    if (CMAKE_SYSTEM_NAME MATCHES "Linux")
+      target_link_libraries(${name} -Wl,--start-group ${LLDB_USED_LIBS} -Wl,--end-group)
+    else()
+      target_link_libraries(${name} ${LLDB_USED_LIBS})
+    endif()
   endif()
   target_link_libraries(${name} ${CLANG_USED_LIBS})
   target_link_libraries(${name} ${LLVM_USED_LIBS})
@@ -199,6 +228,23 @@ install(DIRECTORY include/
   PATTERN ".svn" EXCLUDE
   )
 
+
+# Find libraries or frameworks that may be needed
+if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
+  find_library(CARBON_LIBRARY Carbon)
+  find_library(FOUNDATION_LIBRARY Foundation)
+  find_library(CORE_FOUNDATION_LIBRARY CoreFoundation)
+  find_library(CORE_SERVICES_LIBRARY CoreServices)
+  find_library(SECURITY_LIBRARY Security)
+  find_library(DEBUG_SYMBOLS_LIBRARY DebugSymbols PATHS "/System/Library/PrivateFrameworks")
+
+  set(LIBXML2_INCLUDE_DIR "/usr/include/libxml2")
+  list(APPEND system_libs xml2)
+  list(APPEND system_libs ${CARBON_LIBRARY} ${FOUNDATION_LIBRARY}
+  ${CORE_FOUNDATION_LIBRARY} ${CORE_SERVICES_LIBRARY} ${SECURITY_LIBRARY}
+  ${DEBUG_SYMBOLS_LIBRARY})
+endif()
+
 #add_subdirectory(include)
 add_subdirectory(scripts)
 add_subdirectory(source)

Modified: lldb/branches/windows/examples/python/operating_system.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/examples/python/operating_system.py?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/examples/python/operating_system.py (original)
+++ lldb/branches/windows/examples/python/operating_system.py Thu Apr 25 07:31:53 2013
@@ -25,7 +25,6 @@ class OperatingSystemPlugIn(object):
         return self.process.target
 
     def create_thread(self, tid, context):
-        print 'tid type is: ' + str(type(tid))
         if tid == 0x444444444:
             thread_info = { 'tid' : tid, 'name' : 'four'  , 'queue' : 'queue4', 'state' : 'stopped', 'stop_reason' : 'none' }
             self.threads.append(thread_info)

Modified: lldb/branches/windows/include/lldb/API/SBAddress.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/API/SBAddress.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/API/SBAddress.h (original)
+++ lldb/branches/windows/include/lldb/API/SBAddress.h Thu Apr 25 07:31:53 2013
@@ -141,7 +141,7 @@ protected:
 
 private:
 
-    std::auto_ptr<lldb_private::Address> m_opaque_ap;
+    std::unique_ptr<lldb_private::Address> m_opaque_ap;
 };
 
 

Modified: lldb/branches/windows/include/lldb/API/SBCommandReturnObject.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/API/SBCommandReturnObject.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/API/SBCommandReturnObject.h (original)
+++ lldb/branches/windows/include/lldb/API/SBCommandReturnObject.h Thu Apr 25 07:31:53 2013
@@ -118,7 +118,7 @@ protected:
     SetLLDBObjectPtr (lldb_private::CommandReturnObject *ptr);
 
  private:
-    std::auto_ptr<lldb_private::CommandReturnObject> m_opaque_ap;
+    std::unique_ptr<lldb_private::CommandReturnObject> m_opaque_ap;
 };
 
 } // namespace lldb

Modified: lldb/branches/windows/include/lldb/API/SBDeclaration.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/API/SBDeclaration.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/API/SBDeclaration.h (original)
+++ lldb/branches/windows/include/lldb/API/SBDeclaration.h Thu Apr 25 07:31:53 2013
@@ -80,7 +80,7 @@ namespace lldb {
         void
         SetDeclaration (const lldb_private::Declaration &lldb_object_ref);
         
-        std::auto_ptr<lldb_private::Declaration> m_opaque_ap;
+        std::unique_ptr<lldb_private::Declaration> m_opaque_ap;
     };
     
     

Modified: lldb/branches/windows/include/lldb/API/SBError.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/API/SBError.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/API/SBError.h (original)
+++ lldb/branches/windows/include/lldb/API/SBError.h Thu Apr 25 07:31:53 2013
@@ -93,7 +93,7 @@ protected:
     SetError (const lldb_private::Error &lldb_error);
 
 private:
-    std::auto_ptr<lldb_private::Error> m_opaque_ap;
+    std::unique_ptr<lldb_private::Error> m_opaque_ap;
 
     void
     CreateIfNeeded ();

Modified: lldb/branches/windows/include/lldb/API/SBExpressionOptions.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/API/SBExpressionOptions.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/API/SBExpressionOptions.h (original)
+++ lldb/branches/windows/include/lldb/API/SBExpressionOptions.h Thu Apr 25 07:31:53 2013
@@ -12,7 +12,6 @@
 
 #include "lldb/API/SBDefines.h"
 
-#include <memory>
 #include <vector>
 
 namespace lldb {
@@ -82,7 +81,7 @@ protected:
 
 private:
     // This auto_pointer is made in the constructor and is always valid.
-    mutable std::auto_ptr<lldb_private::EvaluateExpressionOptions> m_opaque_ap;
+    mutable std::unique_ptr<lldb_private::EvaluateExpressionOptions> m_opaque_ap;
 };
 
 } // namespace lldb

Modified: lldb/branches/windows/include/lldb/API/SBFileSpec.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/API/SBFileSpec.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/API/SBFileSpec.h (original)
+++ lldb/branches/windows/include/lldb/API/SBFileSpec.h Thu Apr 25 07:31:53 2013
@@ -84,7 +84,7 @@ private:
     const lldb_private::FileSpec &
     ref() const;
 
-    std::auto_ptr <lldb_private::FileSpec> m_opaque_ap;
+    std::unique_ptr<lldb_private::FileSpec> m_opaque_ap;
 };
 
 

Modified: lldb/branches/windows/include/lldb/API/SBFileSpecList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/API/SBFileSpecList.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/API/SBFileSpecList.h (original)
+++ lldb/branches/windows/include/lldb/API/SBFileSpecList.h Thu Apr 25 07:31:53 2013
@@ -63,7 +63,7 @@ friend class SBTarget;
     const lldb_private::FileSpecList &
     ref() const;
 
-    std::auto_ptr <lldb_private::FileSpecList> m_opaque_ap;
+    std::unique_ptr<lldb_private::FileSpecList> m_opaque_ap;
 };
 
 

Modified: lldb/branches/windows/include/lldb/API/SBLineEntry.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/API/SBLineEntry.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/API/SBLineEntry.h (original)
+++ lldb/branches/windows/include/lldb/API/SBLineEntry.h Thu Apr 25 07:31:53 2013
@@ -90,7 +90,7 @@ private:
     void
     SetLineEntry (const lldb_private::LineEntry &lldb_object_ref);
 
-    std::auto_ptr<lldb_private::LineEntry> m_opaque_ap;
+    std::unique_ptr<lldb_private::LineEntry> m_opaque_ap;
 };
 
 

Modified: lldb/branches/windows/include/lldb/API/SBSourceManager.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/API/SBSourceManager.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/API/SBSourceManager.h (original)
+++ lldb/branches/windows/include/lldb/API/SBSourceManager.h Thu Apr 25 07:31:53 2013
@@ -45,7 +45,7 @@ protected:
 
 private:
 
-    std::auto_ptr<lldb_private::SourceManagerImpl> m_opaque_ap;
+    std::unique_ptr<lldb_private::SourceManagerImpl> m_opaque_ap;
 };
 
 } // namespace lldb

Modified: lldb/branches/windows/include/lldb/API/SBStream.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/API/SBStream.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/API/SBStream.h (original)
+++ lldb/branches/windows/include/lldb/API/SBStream.h Thu Apr 25 07:31:53 2013
@@ -100,7 +100,7 @@ protected:
 private:
 
     DISALLOW_COPY_AND_ASSIGN (SBStream);
-    std::auto_ptr<lldb_private::Stream> m_opaque_ap;
+    std::unique_ptr<lldb_private::Stream> m_opaque_ap;
     bool m_is_file;
 };
 

Modified: lldb/branches/windows/include/lldb/API/SBStringList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/API/SBStringList.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/API/SBStringList.h (original)
+++ lldb/branches/windows/include/lldb/API/SBStringList.h Thu Apr 25 07:31:53 2013
@@ -62,7 +62,7 @@ protected:
 
 private:
 
-    std::auto_ptr<lldb_private::StringList> m_opaque_ap;
+    std::unique_ptr<lldb_private::StringList> m_opaque_ap;
 
 };
 

Modified: lldb/branches/windows/include/lldb/API/SBSymbolContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/API/SBSymbolContext.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/API/SBSymbolContext.h (original)
+++ lldb/branches/windows/include/lldb/API/SBSymbolContext.h Thu Apr 25 07:31:53 2013
@@ -85,7 +85,7 @@ protected:
     SetSymbolContext (const lldb_private::SymbolContext *sc_ptr);
 
 private:
-    std::auto_ptr<lldb_private::SymbolContext> m_opaque_ap;
+    std::unique_ptr<lldb_private::SymbolContext> m_opaque_ap;
 };
 
 

Modified: lldb/branches/windows/include/lldb/API/SBSymbolContextList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/API/SBSymbolContextList.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/API/SBSymbolContextList.h (original)
+++ lldb/branches/windows/include/lldb/API/SBSymbolContextList.h Thu Apr 25 07:31:53 2013
@@ -60,7 +60,7 @@ protected:
     operator*() const;
 
 private:
-    std::auto_ptr<lldb_private::SymbolContextList> m_opaque_ap;
+    std::unique_ptr<lldb_private::SymbolContextList> m_opaque_ap;
 };
 
 

Modified: lldb/branches/windows/include/lldb/API/SBType.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/API/SBType.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/API/SBType.h (original)
+++ lldb/branches/windows/include/lldb/API/SBType.h Thu Apr 25 07:31:53 2013
@@ -65,7 +65,7 @@ protected:
     const lldb_private::TypeMemberImpl &
     ref () const;
 
-    std::auto_ptr<lldb_private::TypeMemberImpl> m_opaque_ap;
+    std::unique_ptr<lldb_private::TypeMemberImpl> m_opaque_ap;
 };
 
 class SBType
@@ -234,7 +234,7 @@ public:
     
     
 private:
-    std::auto_ptr<lldb_private::TypeListImpl> m_opaque_ap;
+    std::unique_ptr<lldb_private::TypeListImpl> m_opaque_ap;
 };
     
 

Modified: lldb/branches/windows/include/lldb/API/SBValue.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/API/SBValue.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/API/SBValue.h (original)
+++ lldb/branches/windows/include/lldb/API/SBValue.h Thu Apr 25 07:31:53 2013
@@ -14,9 +14,7 @@
 #include "lldb/API/SBDefines.h"
 #include "lldb/API/SBType.h"
 
-namespace {
-    class ValueImpl;
-}
+class ValueImpl;
 
 namespace lldb {
 
@@ -440,7 +438,7 @@ protected:
     SetSP (const lldb::ValueObjectSP &sp, lldb::DynamicValueType use_dynamic, bool use_synthetic);
     
 private:
-    typedef STD_SHARED_PTR(ValueImpl) ValueImplSP;
+    typedef std::shared_ptr<ValueImpl> ValueImplSP;
     ValueImplSP m_opaque_sp;
     
     void

Modified: lldb/branches/windows/include/lldb/API/SBValueList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/API/SBValueList.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/API/SBValueList.h (original)
+++ lldb/branches/windows/include/lldb/API/SBValueList.h Thu Apr 25 07:31:53 2013
@@ -12,9 +12,7 @@
 
 #include "lldb/API/SBDefines.h"
 
-namespace {
-    class ValueListImpl;
-}
+class ValueListImpl;
 
 namespace lldb {
 

Modified: lldb/branches/windows/include/lldb/Breakpoint/Breakpoint.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Breakpoint/Breakpoint.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Breakpoint/Breakpoint.h (original)
+++ lldb/branches/windows/include/lldb/Breakpoint/Breakpoint.h Thu Apr 25 07:31:53 2013
@@ -74,7 +74,7 @@ namespace lldb_private {
 /// not by the breakpoint.
 //----------------------------------------------------------------------
 class Breakpoint:
-    public STD_ENABLE_SHARED_FROM_THIS(Breakpoint),
+    public std::enable_shared_from_this<Breakpoint>,
     public Stoppoint
 {
 public:

Modified: lldb/branches/windows/include/lldb/Breakpoint/BreakpointLocation.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Breakpoint/BreakpointLocation.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Breakpoint/BreakpointLocation.h (original)
+++ lldb/branches/windows/include/lldb/Breakpoint/BreakpointLocation.h Thu Apr 25 07:31:53 2013
@@ -14,7 +14,6 @@
 
 // C++ Includes
 #include <list>
-#include <memory>
 
 // Other libraries and framework includes
 
@@ -25,6 +24,7 @@
 #include "lldb/Core/Address.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Core/StringList.h"
+#include "lldb/Expression/ClangUserExpression.h"
 
 namespace lldb_private {
 
@@ -47,7 +47,7 @@ namespace lldb_private {
 //----------------------------------------------------------------------
 
 class BreakpointLocation : 
-    public STD_ENABLE_SHARED_FROM_THIS(BreakpointLocation),
+    public std::enable_shared_from_this<BreakpointLocation>,
     public StoppointLocation
 {
 public:
@@ -176,7 +176,10 @@ public:
     //     condition has been set.
     //------------------------------------------------------------------
     const char *
-    GetConditionText () const;
+    GetConditionText (size_t *hash = NULL) const;
+    
+    bool
+    ConditionSaysStop (ExecutionContext &exe_ctx, Error &error);
 
 
     //------------------------------------------------------------------
@@ -380,8 +383,10 @@ private:
     bool m_being_created;
     Address m_address; ///< The address defining this location.
     Breakpoint &m_owner; ///< The breakpoint that produced this object.
-    std::auto_ptr<BreakpointOptions> m_options_ap; ///< Breakpoint options pointer, NULL if we're using our breakpoint's options.
+    std::unique_ptr<BreakpointOptions> m_options_ap; ///< Breakpoint options pointer, NULL if we're using our breakpoint's options.
     lldb::BreakpointSiteSP m_bp_site_sp; ///< Our breakpoint site (it may be shared by more than one location.)
+    ClangUserExpression::ClangUserExpressionSP m_user_expression_sp; ///< The compiled expression to use in testing our condition.
+    size_t m_condition_hash; ///< For testing whether the condition source code changed.
 
     void
     SendBreakpointLocationChangedEvent (lldb::BreakpointEventType eventKind);

Modified: lldb/branches/windows/include/lldb/Breakpoint/BreakpointOptions.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Breakpoint/BreakpointOptions.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Breakpoint/BreakpointOptions.h (original)
+++ lldb/branches/windows/include/lldb/Breakpoint/BreakpointOptions.h Thu Apr 25 07:31:53 2013
@@ -12,7 +12,6 @@
 
 // C Includes
 // C++ Includes
-#include <memory>
 // Other libraries and framework includes
 // Project includes
 #include "lldb/lldb-private.h"
@@ -184,7 +183,7 @@ public:
     ///    A pointer to the condition expression text, or NULL if no
     //     condition has been set.
     //------------------------------------------------------------------
-    const char *GetConditionText () const;
+    const char *GetConditionText (size_t *hash = NULL) const;
     
     //------------------------------------------------------------------
     // Enabled/Ignore Count
@@ -349,9 +348,9 @@ private:
     bool m_enabled;
     bool m_one_shot;
     uint32_t m_ignore_count; // Number of times to ignore this breakpoint
-    std::auto_ptr<ThreadSpec> m_thread_spec_ap; // Thread for which this breakpoint will take
-    std::auto_ptr<ClangUserExpression> m_condition_ap;  // The condition to test.
-
+    std::unique_ptr<ThreadSpec> m_thread_spec_ap; // Thread for which this breakpoint will take
+    std::string m_condition_text;  // The condition to test.
+    size_t m_condition_text_hash; // Its hash, so that locations know when the condition is updated.
 };
 
 } // namespace lldb_private

Modified: lldb/branches/windows/include/lldb/Breakpoint/BreakpointSite.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Breakpoint/BreakpointSite.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Breakpoint/BreakpointSite.h (original)
+++ lldb/branches/windows/include/lldb/Breakpoint/BreakpointSite.h Thu Apr 25 07:31:53 2013
@@ -39,7 +39,7 @@ namespace lldb_private {
 //----------------------------------------------------------------------
 
 class BreakpointSite : 
-    public STD_ENABLE_SHARED_FROM_THIS(BreakpointSite),
+    public std::enable_shared_from_this<BreakpointSite>,
     public StoppointLocation
 {
 public:

Modified: lldb/branches/windows/include/lldb/Breakpoint/Watchpoint.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Breakpoint/Watchpoint.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Breakpoint/Watchpoint.h (original)
+++ lldb/branches/windows/include/lldb/Breakpoint/Watchpoint.h Thu Apr 25 07:31:53 2013
@@ -28,7 +28,7 @@
 namespace lldb_private {
 
 class Watchpoint :
-    public STD_ENABLE_SHARED_FROM_THIS(Watchpoint),
+    public std::enable_shared_from_this<Watchpoint>,
     public StoppointLocation
 {
 public:
@@ -234,7 +234,7 @@ private:
                                        // the callback machinery.
     bool        m_being_created;
 
-    std::auto_ptr<ClangUserExpression> m_condition_ap;  // The condition to test.
+    std::unique_ptr<ClangUserExpression> m_condition_ap;  // The condition to test.
 
     void SetID(lldb::watch_id_t id) { m_loc_id = id; }
     

Modified: lldb/branches/windows/include/lldb/Breakpoint/WatchpointOptions.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Breakpoint/WatchpointOptions.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Breakpoint/WatchpointOptions.h (original)
+++ lldb/branches/windows/include/lldb/Breakpoint/WatchpointOptions.h Thu Apr 25 07:31:53 2013
@@ -12,7 +12,6 @@
 
 // C Includes
 // C++ Includes
-#include <memory>
 // Other libraries and framework includes
 // Project includes
 #include "lldb/lldb-private.h"
@@ -248,7 +247,7 @@ private:
     WatchpointHitCallback m_callback; // This is the callback function pointer
     lldb::BatonSP m_callback_baton_sp; // This is the client data for the callback
     bool m_callback_is_synchronous;
-    std::auto_ptr<ThreadSpec> m_thread_spec_ap; // Thread for which this watchpoint will take
+    std::unique_ptr<ThreadSpec> m_thread_spec_ap; // Thread for which this watchpoint will take
 };
 
 } // namespace lldb_private

Modified: lldb/branches/windows/include/lldb/Core/Address.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Core/Address.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Core/Address.h (original)
+++ lldb/branches/windows/include/lldb/Core/Address.h Thu Apr 25 07:31:53 2013
@@ -12,6 +12,9 @@
 
 // C Includes
 // C++ Includes
+#ifndef _MSC_VER
+#include <atomic>
+#endif
 // Other libraries and framework includes
 // Project includes
 #include "lldb/lldb-private.h"
@@ -115,7 +118,11 @@ public:
     //------------------------------------------------------------------
     Address (const Address& rhs) :
         m_section_wp (rhs.m_section_wp),
-        m_offset (rhs.m_offset)
+#ifdef _MSC_VER
+        m_offset(rhs.m_offset)
+#else
+        m_offset(rhs.m_offset.load())
+#endif
     {
     }
 
@@ -538,7 +545,11 @@ protected:
     // Member variables.
     //------------------------------------------------------------------
     lldb::SectionWP m_section_wp;   ///< The section for the address, can be NULL.
-    lldb::addr_t m_offset;      ///< Offset into section if \a m_section_wp is valid...
+#if _MSC_VER
+    volatile lldb::addr_t m_offset;
+#else
+    std::atomic<lldb::addr_t> m_offset;      ///< Offset into section if \a m_section_wp is valid...
+#endif
 };
 
 

Modified: lldb/branches/windows/include/lldb/Core/Broadcaster.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Core/Broadcaster.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Core/Broadcaster.h (original)
+++ lldb/branches/windows/include/lldb/Core/Broadcaster.h Thu Apr 25 07:31:53 2013
@@ -85,6 +85,8 @@ private:
 class BroadcasterManager
 {
 public:
+    friend class Listener;
+
     BroadcasterManager ();
 
     ~BroadcasterManager () {}

Modified: lldb/branches/windows/include/lldb/Core/Debugger.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Core/Debugger.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Core/Debugger.h (original)
+++ lldb/branches/windows/include/lldb/Core/Debugger.h Thu Apr 25 07:31:53 2013
@@ -46,7 +46,7 @@ namespace lldb_private {
 
 
 class Debugger :
-    public STD_ENABLE_SHARED_FROM_THIS(Debugger),
+    public std::enable_shared_from_this<Debugger>,
     public UserID,
     public Properties,
     public BroadcasterManager
@@ -329,7 +329,7 @@ public:
     typedef bool (*LLDBCommandPluginInit) (lldb::SBDebugger& debugger);
     
     bool
-    LoadPlugin (const FileSpec& spec);
+    LoadPlugin (const FileSpec& spec, Error& error);
 
 protected:
 
@@ -358,10 +358,10 @@ protected:
     TargetList m_target_list;
     PlatformList m_platform_list;
     Listener m_listener;
-    std::auto_ptr<SourceManager> m_source_manager_ap;    // This is a scratch source manager that we return if we have no targets.
+    std::unique_ptr<SourceManager> m_source_manager_ap;    // This is a scratch source manager that we return if we have no targets.
     SourceManager::SourceFileCache m_source_file_cache; // All the source managers for targets created in this debugger used this shared
                                                         // source file cache.
-    std::auto_ptr<CommandInterpreter> m_command_interpreter_ap;
+    std::unique_ptr<CommandInterpreter> m_command_interpreter_ap;
 
     InputReaderStack m_input_reader_stack;
     std::string m_input_reader_data;

Modified: lldb/branches/windows/include/lldb/Core/Disassembler.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Core/Disassembler.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Core/Disassembler.h (original)
+++ lldb/branches/windows/include/lldb/Core/Disassembler.h Thu Apr 25 07:31:53 2013
@@ -234,7 +234,7 @@ protected:
 };
 
 class Disassembler :
-    public STD_ENABLE_SHARED_FROM_THIS(Disassembler),
+    public std::enable_shared_from_this<Disassembler>,
     public PluginInterface
 {
 public:

Modified: lldb/branches/windows/include/lldb/Core/Event.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Core/Event.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Core/Event.h (original)
+++ lldb/branches/windows/include/lldb/Core/Event.h Thu Apr 25 07:31:53 2013
@@ -205,7 +205,7 @@ private:
 
     Broadcaster *   m_broadcaster;  // The broadcaster that sent this event
     uint32_t        m_type;         // The bit describing this event
-    std::auto_ptr<EventData> m_data_ap;         // User specific data for this event
+    std::unique_ptr<EventData> m_data_ap;         // User specific data for this event
 
 
     DISALLOW_COPY_AND_ASSIGN (Event);

Modified: lldb/branches/windows/include/lldb/Core/Module.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Core/Module.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Core/Module.h (original)
+++ lldb/branches/windows/include/lldb/Core/Module.h Thu Apr 25 07:31:53 2013
@@ -41,7 +41,7 @@ namespace lldb_private {
 /// made.
 //----------------------------------------------------------------------
 class Module :
-    public STD_ENABLE_SHARED_FROM_THIS(Module),
+    public std::enable_shared_from_this<Module>,
     public SymbolContextScope
 {
 public:
@@ -526,12 +526,7 @@ public:
     }
     
     void
-    SetSymbolFileFileSpec (const FileSpec &file)
-    {
-        m_symfile_spec = file;
-        m_symfile_ap.reset();
-        m_did_load_symbol_vendor = false;
-    }
+    SetSymbolFileFileSpec (const FileSpec &file);
 
     const TimeValue &
     GetModificationTime () const;
@@ -946,7 +941,7 @@ protected:
     ConstString                 m_object_name;  ///< The name an object within this module that is selected, or empty of the module is represented by \a m_file.
     uint64_t                    m_object_offset;
     lldb::ObjectFileSP          m_objfile_sp;   ///< A shared pointer to the object file parser for this module as it may or may not be shared with the SymbolFile
-    std::auto_ptr<SymbolVendor> m_symfile_ap;   ///< A pointer to the symbol vendor for this module.
+    std::unique_ptr<SymbolVendor> m_symfile_ap;   ///< A pointer to the symbol vendor for this module.
     ClangASTContext             m_ast;          ///< The AST context for this module.
     PathMappingList             m_source_mappings; ///< Module specific source remappings for when you have debug info for a module that doesn't match where the sources currently are
 

Modified: lldb/branches/windows/include/lldb/Core/ModuleSpec.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Core/ModuleSpec.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Core/ModuleSpec.h (original)
+++ lldb/branches/windows/include/lldb/Core/ModuleSpec.h Thu Apr 25 07:31:53 2013
@@ -255,6 +255,19 @@ public:
         return m_source_mappings;
     }
 
+    void
+    Clear ()
+    {
+        m_file.Clear();
+        m_platform_file.Clear();
+        m_symbol_file.Clear();
+        m_arch.Clear();
+        m_uuid.Clear();
+        m_object_name.Clear();
+        m_object_offset = 0;
+        m_source_mappings.Clear(false);
+    }
+
 protected:
     FileSpec m_file;
     FileSpec m_platform_file;
@@ -266,6 +279,121 @@ protected:
     mutable PathMappingList m_source_mappings;
 };
 
+class ModuleSpecList
+{
+public:
+    ModuleSpecList () :
+        m_specs(),
+        m_mutex(Mutex::eMutexTypeRecursive) 
+    {
+    }
+
+    ModuleSpecList (const ModuleSpecList &rhs) :
+        m_specs(),
+        m_mutex(Mutex::eMutexTypeRecursive)
+    {
+        Mutex::Locker lhs_locker(m_mutex);
+        Mutex::Locker rhs_locker(rhs.m_mutex);
+        m_specs = rhs.m_specs;
+    }
+
+    ~ModuleSpecList ()
+    {
+    }
+    
+    size_t
+    GetSize() const
+    {
+        Mutex::Locker locker(m_mutex);
+        return m_specs.size();
+    }
+
+    void
+    Clear ()
+    {
+        Mutex::Locker locker(m_mutex);
+        m_specs.clear();
+    }
+
+    void
+    Append (const ModuleSpec &spec)
+    {
+        Mutex::Locker locker(m_mutex);
+        m_specs.push_back (spec);
+    }
+    
+    bool
+    GetModuleSpecAtIndex (size_t i, ModuleSpec &module_spec) const
+    {
+        Mutex::Locker locker(m_mutex);
+        if (i < m_specs.size())
+        {
+            module_spec = m_specs[i];
+            return true;
+        }
+        module_spec.Clear();
+        return false;
+    }
+    
+    bool
+    FindMatchingModuleSpec (const ModuleSpec &module_spec, ModuleSpec &match_module_spec) const
+    {
+        const FileSpec *file_ptr = module_spec.GetFileSpecPtr();
+        const FileSpec *platform_file_ptr = module_spec.GetPlatformFileSpecPtr();
+        const FileSpec *symbol_file_ptr = module_spec.GetSymbolFileSpecPtr();
+        const ArchSpec *arch_ptr = module_spec.GetArchitecturePtr();
+        const UUID *uuid_ptr = module_spec.GetUUIDPtr();
+        const bool check_module_name = (bool)module_spec.GetObjectName();
+        Mutex::Locker locker(m_mutex);
+        for (auto spec = m_specs.begin(); spec != m_specs.end(); spec++)
+        {
+            if (uuid_ptr && spec->GetUUID() != *uuid_ptr)
+                continue;
+            if (check_module_name && module_spec.GetObjectName() != spec->GetObjectName())
+                continue;
+            if (file_ptr && !FileSpec::Equal(*file_ptr, spec->GetFileSpec(), file_ptr->GetDirectory().IsEmpty() == false))
+                continue;
+            if (platform_file_ptr && !FileSpec::Equal(*platform_file_ptr, spec->GetFileSpec(), platform_file_ptr->GetDirectory().IsEmpty() == false))
+                continue;
+            if (symbol_file_ptr && !FileSpec::Equal(*symbol_file_ptr, spec->GetFileSpec(), symbol_file_ptr->GetDirectory().IsEmpty() == false))
+                continue;
+            if (arch_ptr && !spec->GetArchitecture().IsExactMatch(*arch_ptr))
+                continue;
+            match_module_spec = *spec;
+            return true;
+        }
+        
+        // If there was an architecture, retry with a compatible arch
+        if (arch_ptr)
+        {
+            for (auto spec = m_specs.begin(); spec != m_specs.end(); spec++)
+            {
+                if (uuid_ptr && spec->GetUUID() != *uuid_ptr)
+                    continue;
+                if (check_module_name && module_spec.GetObjectName() != spec->GetObjectName())
+                    continue;
+                if (file_ptr && !FileSpec::Equal(*file_ptr, spec->GetFileSpec(), file_ptr->GetDirectory().IsEmpty() == false))
+                    continue;
+                if (platform_file_ptr && !FileSpec::Equal(*platform_file_ptr, spec->GetFileSpec(), platform_file_ptr->GetDirectory().IsEmpty() == false))
+                    continue;
+                if (symbol_file_ptr && !FileSpec::Equal(*symbol_file_ptr, spec->GetFileSpec(), symbol_file_ptr->GetDirectory().IsEmpty() == false))
+                    continue;
+                if (arch_ptr && !spec->GetArchitecture().IsCompatibleMatch(*arch_ptr))
+                    continue;
+                match_module_spec = *spec;
+                return true;
+            }
+        }
+        match_module_spec.Clear();
+        return false;
+    }
+
+protected:
+    typedef std::vector<ModuleSpec> collection; ///< The module collection type.
+    collection m_specs; ///< The collection of modules.
+    mutable Mutex m_mutex;
+};
+
 } // namespace lldb_private
 
 #endif  // liblldb_ModuleSpec_h_

Modified: lldb/branches/windows/include/lldb/Core/PluginManager.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Core/PluginManager.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Core/PluginManager.h (original)
+++ lldb/branches/windows/include/lldb/Core/PluginManager.h Thu Apr 25 07:31:53 2013
@@ -138,7 +138,8 @@ public:
     RegisterPlugin (const char *name,
                     const char *description,
                     ObjectFileCreateInstance create_callback,
-                    ObjectFileCreateMemoryInstance create_memory_callback);
+                    ObjectFileCreateMemoryInstance create_memory_callback,
+                    ObjectFileGetModuleSpecifications get_module_specifications);
 
     static bool
     UnregisterPlugin (ObjectFileCreateInstance create_callback);
@@ -149,6 +150,9 @@ public:
     static ObjectFileCreateMemoryInstance
     GetObjectFileCreateMemoryCallbackAtIndex (uint32_t idx);
 
+    static ObjectFileGetModuleSpecifications
+    GetObjectFileGetModuleSpecificationsCallbackAtIndex (uint32_t idx);
+
     static ObjectFileCreateInstance
     GetObjectFileCreateCallbackForPluginName (const char *name);
 
@@ -162,7 +166,8 @@ public:
     static bool
     RegisterPlugin (const char *name,
                     const char *description,
-                    ObjectContainerCreateInstance create_callback);
+                    ObjectContainerCreateInstance create_callback,
+                    ObjectFileGetModuleSpecifications get_module_specifications);
 
     static bool
     UnregisterPlugin (ObjectContainerCreateInstance create_callback);
@@ -173,6 +178,9 @@ public:
     static ObjectContainerCreateInstance
     GetObjectContainerCreateCallbackForPluginName (const char *name);
 
+    static ObjectFileGetModuleSpecifications
+    GetObjectContainerGetModuleSpecificationsCallbackAtIndex (uint32_t idx);
+
     //------------------------------------------------------------------
     // LogChannel
     //------------------------------------------------------------------

Modified: lldb/branches/windows/include/lldb/Core/Section.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Core/Section.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Core/Section.h (original)
+++ lldb/branches/windows/include/lldb/Core/Section.h Thu Apr 25 07:31:53 2013
@@ -100,7 +100,7 @@ protected:
 
 
 class Section :
-    public STD_ENABLE_SHARED_FROM_THIS(Section),
+    public std::enable_shared_from_this<Section>,
     public ModuleChild,
     public UserID,
     public Flags

Modified: lldb/branches/windows/include/lldb/Core/SourceManager.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Core/SourceManager.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Core/SourceManager.h (original)
+++ lldb/branches/windows/include/lldb/Core/SourceManager.h Thu Apr 25 07:31:53 2013
@@ -86,7 +86,7 @@ public:
 
 #endif // SWIG
 
-    typedef STD_SHARED_PTR(File) FileSP;
+    typedef std::shared_ptr<File> FileSP;
 
 #ifndef SWIG
 

Modified: lldb/branches/windows/include/lldb/Core/Timer.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Core/Timer.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Core/Timer.h (original)
+++ lldb/branches/windows/include/lldb/Core/Timer.h Thu Apr 25 07:31:53 2013
@@ -13,7 +13,6 @@
 
 #include <stdarg.h>
 #include <stdio.h>
-#include <memory>
 #include <string>
 #include "lldb/lldb-private.h"
 #include "lldb/Host/TimeValue.h"

Modified: lldb/branches/windows/include/lldb/Core/Value.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Core/Value.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Core/Value.h (original)
+++ lldb/branches/windows/include/lldb/Core/Value.h Thu Apr 25 07:31:53 2013
@@ -56,10 +56,7 @@ public:
         eContextTypeVariable            // lldb_private::Variable *
     };
 
-    enum
-    {
-        kMaxByteSize = 32u
-    };
+    const static size_t kMaxByteSize = 32u;
 
     struct Vector
     {
@@ -80,12 +77,12 @@ public:
         const Vector& 
 		operator=(const Vector& vector) 
 		{
-            SetBytes((uint8_t *)vector.bytes, vector.length, vector.byte_order);
+            SetBytes(vector.bytes, vector.length, vector.byte_order);
             return *this;
         }
 
         bool 
-		SetBytes(uint8_t *bytes, size_t length, lldb::ByteOrder byte_order)
+		SetBytes(const void *bytes, size_t length, lldb::ByteOrder byte_order)
 		{
             this->length = length;
             this->byte_order = byte_order;

Modified: lldb/branches/windows/include/lldb/Core/ValueObject.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Core/ValueObject.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Core/ValueObject.h (original)
+++ lldb/branches/windows/include/lldb/Core/ValueObject.h Thu Apr 25 07:31:53 2013
@@ -12,6 +12,9 @@
 
 // C Includes
 // C++ Includes
+#ifndef _MSC_VER
+#include <initializer_list>
+#endif
 #include <map>
 #include <vector>
 // Other libraries and framework includes

Modified: lldb/branches/windows/include/lldb/Core/ValueObjectSyntheticFilter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Core/ValueObjectSyntheticFilter.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Core/ValueObjectSyntheticFilter.h (original)
+++ lldb/branches/windows/include/lldb/Core/ValueObjectSyntheticFilter.h Thu Apr 25 07:31:53 2013
@@ -151,7 +151,7 @@ protected:
 
     // we need to hold on to the SyntheticChildren because someone might delete the type binding while we are alive
     lldb::SyntheticChildrenSP m_synth_sp;
-    std::auto_ptr<SyntheticChildrenFrontEnd> m_synth_filter_ap;
+    std::unique_ptr<SyntheticChildrenFrontEnd> m_synth_filter_ap;
     
     typedef std::map<uint32_t, ValueObject*> ByIndexMap;
     typedef std::map<const char*, uint32_t> NameToIndexMap;

Modified: lldb/branches/windows/include/lldb/DataFormatters/FormatNavigator.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/DataFormatters/FormatNavigator.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/DataFormatters/FormatNavigator.h (original)
+++ lldb/branches/windows/include/lldb/DataFormatters/FormatNavigator.h Thu Apr 25 07:31:53 2013
@@ -256,11 +256,7 @@ public:
     typedef typename MapType::key_type MapKeyType;
     typedef typename MapType::mapped_type MapValueType;
     typedef typename BackEndType::CallbackType CallbackType;
-#ifdef _LIBCPP_VERSION
     typedef typename std::shared_ptr<FormatNavigator<KeyType, ValueType> > SharedPointer;
-#else
-    typedef typename std::tr1::shared_ptr<FormatNavigator<KeyType, ValueType> > SharedPointer;
-#endif
     
     friend class TypeCategoryImpl;
 

Modified: lldb/branches/windows/include/lldb/DataFormatters/TypeCategory.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/DataFormatters/TypeCategory.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/DataFormatters/TypeCategory.h (original)
+++ lldb/branches/windows/include/lldb/DataFormatters/TypeCategory.h Thu Apr 25 07:31:53 2013
@@ -180,7 +180,7 @@ namespace lldb_private {
                     const char** matching_category = NULL,
                     FormatCategoryItems* matching_type = NULL);
         
-        typedef STD_SHARED_PTR(TypeCategoryImpl) SharedPointer;
+        typedef std::shared_ptr<TypeCategoryImpl> SharedPointer;
         
     private:
         SummaryNavigator::SharedPointer m_summary_nav;

Modified: lldb/branches/windows/include/lldb/DataFormatters/TypeFormat.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/DataFormatters/TypeFormat.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/DataFormatters/TypeFormat.h (original)
+++ lldb/branches/windows/include/lldb/DataFormatters/TypeFormat.h Thu Apr 25 07:31:53 2013
@@ -133,7 +133,7 @@ namespace lldb_private {
         TypeFormatImpl (lldb::Format f = lldb::eFormatInvalid,
                         const Flags& flags = Flags());
         
-        typedef STD_SHARED_PTR(TypeFormatImpl) SharedPointer;
+        typedef std::shared_ptr<TypeFormatImpl> SharedPointer;
         typedef bool(*ValueCallback)(void*, ConstString, const lldb::TypeFormatImplSP&);
         
         ~TypeFormatImpl ()

Modified: lldb/branches/windows/include/lldb/DataFormatters/TypeSummary.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/DataFormatters/TypeSummary.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/DataFormatters/TypeSummary.h (original)
+++ lldb/branches/windows/include/lldb/DataFormatters/TypeSummary.h Thu Apr 25 07:31:53 2013
@@ -333,7 +333,7 @@ namespace lldb_private {
             return m_my_revision;
         }
         
-        typedef STD_SHARED_PTR(TypeSummaryImpl) SharedPointer;
+        typedef std::shared_ptr<TypeSummaryImpl> SharedPointer;
         typedef bool(*SummaryCallback)(void*, ConstString, const lldb::TypeSummaryImplSP&);
         typedef bool(*RegexSummaryCallback)(void*, lldb::RegularExpressionSP, const lldb::TypeSummaryImplSP&);
         
@@ -463,7 +463,7 @@ namespace lldb_private {
             return TypeSummaryImpl::eTypeCallback;
         }
         
-        typedef STD_SHARED_PTR(CXXFunctionSummaryFormat) SharedPointer;
+        typedef std::shared_ptr<CXXFunctionSummaryFormat> SharedPointer;
         
     private:
         DISALLOW_COPY_AND_ASSIGN(CXXFunctionSummaryFormat);
@@ -537,7 +537,7 @@ namespace lldb_private {
             return TypeSummaryImpl::eTypeScript;
         }
         
-        typedef STD_SHARED_PTR(ScriptSummaryFormat) SharedPointer;
+        typedef std::shared_ptr<ScriptSummaryFormat> SharedPointer;
         
         
     private:

Modified: lldb/branches/windows/include/lldb/DataFormatters/TypeSynthetic.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/DataFormatters/TypeSynthetic.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/DataFormatters/TypeSynthetic.h (original)
+++ lldb/branches/windows/include/lldb/DataFormatters/TypeSynthetic.h Thu Apr 25 07:31:53 2013
@@ -70,8 +70,8 @@ namespace lldb_private {
         virtual bool
         MightHaveChildren () = 0;
         
-        typedef STD_SHARED_PTR(SyntheticChildrenFrontEnd) SharedPointer;
-        typedef std::auto_ptr<SyntheticChildrenFrontEnd> AutoPointer;
+        typedef std::shared_ptr<SyntheticChildrenFrontEnd> SharedPointer;
+        typedef std::unique_ptr<SyntheticChildrenFrontEnd> AutoPointer;
         
     private:
         DISALLOW_COPY_AND_ASSIGN(SyntheticChildrenFrontEnd);
@@ -249,7 +249,7 @@ namespace lldb_private {
         virtual SyntheticChildrenFrontEnd::AutoPointer
         GetFrontEnd (ValueObject &backend) = 0;
         
-        typedef STD_SHARED_PTR(SyntheticChildren) SharedPointer;
+        typedef std::shared_ptr<SyntheticChildren> SharedPointer;
         typedef bool(*SyntheticChildrenCallback)(void*, ConstString, const SyntheticChildren::SharedPointer&);
         
         uint32_t&
@@ -419,7 +419,7 @@ namespace lldb_private {
                 return UINT32_MAX;
             }
             
-            typedef STD_SHARED_PTR(SyntheticChildrenFrontEnd) SharedPointer;
+            typedef std::shared_ptr<SyntheticChildrenFrontEnd> SharedPointer;
             
         private:
             DISALLOW_COPY_AND_ASSIGN(FrontEnd);
@@ -577,7 +577,7 @@ namespace lldb_private {
                 return m_interpreter->GetIndexOfChildWithName(m_wrapper_sp, name.GetCString());
             }
             
-            typedef STD_SHARED_PTR(SyntheticChildrenFrontEnd) SharedPointer;
+            typedef std::shared_ptr<SyntheticChildrenFrontEnd> SharedPointer;
             
         private:
             DISALLOW_COPY_AND_ASSIGN(FrontEnd);

Modified: lldb/branches/windows/include/lldb/Expression/ClangASTSource.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Expression/ClangASTSource.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Expression/ClangASTSource.h (original)
+++ lldb/branches/windows/include/lldb/Expression/ClangASTSource.h Thu Apr 25 07:31:53 2013
@@ -17,6 +17,8 @@
 #include "lldb/Symbol/ClangASTImporter.h"
 #include "lldb/Target/Target.h"
 
+#include "llvm/ADT/SmallSet.h"
+
 namespace lldb_private {
     
 //----------------------------------------------------------------------
@@ -427,11 +429,12 @@ protected:
 /// Decls given appropriate type information.
 //----------------------------------------------------------------------
 struct NameSearchContext {
-    ClangASTSource &m_ast_source;                       ///< The AST source making the request
-    llvm::SmallVectorImpl<clang::NamedDecl*> &m_decls;  ///< The list of declarations already constructed
-    ClangASTImporter::NamespaceMapSP m_namespace_map;   ///< The mapping of all namespaces found for this request back to their modules
-    const clang::DeclarationName &m_decl_name;          ///< The name being looked for
-    const clang::DeclContext *m_decl_context;           ///< The DeclContext to put declarations into
+    ClangASTSource &m_ast_source;                               ///< The AST source making the request
+    llvm::SmallVectorImpl<clang::NamedDecl*> &m_decls;          ///< The list of declarations already constructed
+    ClangASTImporter::NamespaceMapSP m_namespace_map;           ///< The mapping of all namespaces found for this request back to their modules
+    const clang::DeclarationName &m_decl_name;                  ///< The name being looked for
+    const clang::DeclContext *m_decl_context;                   ///< The DeclContext to put declarations into
+    llvm::SmallSet <lldb::clang_type_t, 5> m_function_types;    ///< All the types of functions that have been reported, so we don't report conflicts
     
     struct {
         bool variable                   : 1;

Modified: lldb/branches/windows/include/lldb/Expression/ClangExpression.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Expression/ClangExpression.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Expression/ClangExpression.h (original)
+++ lldb/branches/windows/include/lldb/Expression/ClangExpression.h Thu Apr 25 07:31:53 2013
@@ -14,7 +14,6 @@
 // C++ Includes
 #include <string>
 #include <map>
-#include <memory>
 #include <vector>
 
 // Other libraries and framework includes

Modified: lldb/branches/windows/include/lldb/Expression/ClangExpressionDeclMap.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Expression/ClangExpressionDeclMap.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Expression/ClangExpressionDeclMap.h (original)
+++ lldb/branches/windows/include/lldb/Expression/ClangExpressionDeclMap.h Thu Apr 25 07:31:53 2013
@@ -27,6 +27,7 @@
 #include "lldb/Core/Value.h"
 #include "lldb/Expression/ClangASTSource.h"
 #include "lldb/Expression/ClangExpressionVariable.h"
+#include "lldb/Expression/Materializer.h"
 #include "lldb/Symbol/TaggedASTType.h"
 #include "lldb/Symbol/SymbolContext.h"
 #include "lldb/Target/ExecutionContext.h"
@@ -116,60 +117,6 @@ public:
     DidParse ();
     
     //------------------------------------------------------------------
-    /// [Used by IRForTarget] Get a new result variable name of the form
-    ///     $n, where n is a natural number starting with 0.
-    ///
-    /// @param[in] name
-    ///     The std::string to place the name into.
-    //------------------------------------------------------------------
-    const ConstString &
-    GetPersistentResultName ();
-
-    //------------------------------------------------------------------
-    /// [Used by IRForTarget] Get a constant variable given a name,
-    ///     a type, and an llvm::APInt.
-    ///
-    /// @param[in] name
-    ///     The name of the variable
-    ///
-    /// @param[in] type
-    ///     The type of the variable, which will be imported into the
-    ///     target's AST context
-    ///
-    /// @param[in] value
-    ///     The value of the variable
-    ///
-    /// @return
-    ///     The created variable
-    //------------------------------------------------------------------
-    lldb::ClangExpressionVariableSP
-    BuildIntegerVariable (const ConstString &name,
-                          lldb_private::TypeFromParser type,
-                          const llvm::APInt& value);
-    
-    //------------------------------------------------------------------
-    /// [Used by IRForTarget] Cast an existing variable given a Decl and
-    ///     a type.
-    ///
-    /// @param[in] name
-    ///     The name of the new variable
-    ///
-    /// @param[in] decl
-    ///     The Clang variable declaration for the original variable,
-    ///     which must be looked up in the map
-    ///
-    /// @param[in] type
-    ///     The desired type of the variable after casting
-    ///
-    /// @return
-    ///     The created variable
-    //------------------------------------------------------------------
-    lldb::ClangExpressionVariableSP
-    BuildCastVariable (const ConstString &name,
-                       clang::VarDecl *decl,
-                       lldb_private::TypeFromParser type);
-    
-    //------------------------------------------------------------------
     /// [Used by IRForTarget] Add a variable to the list of persistent
     ///     variables for the process.
     ///
@@ -390,239 +337,6 @@ public:
     TargetInfo GetTargetInfo();
     
     //------------------------------------------------------------------
-    /// [Used by IRInterpreter] Promote an unknown address to a
-    ///     LoadAddress or FileAddress depending on the presence of a
-    ///     process.
-    ///
-    /// @param[in] addr
-    ///     The address to promote.
-    ///
-    /// @return
-    ///     The wrapped entity.
-    //------------------------------------------------------------------
-    lldb_private::Value WrapBareAddress (lldb::addr_t addr);
-    
-    //------------------------------------------------------------------
-    /// [Used by IRInterpreter] Write to the target.
-    ///
-    /// @param[in] value
-    ///     The address to write to.
-    ///
-    /// @param[in] addr
-    ///     The address of the data buffer to read from.
-    ///
-    /// @param[in] length
-    ///     The amount of data to write, in bytes.
-    ///
-    /// @return
-    ///     True if the write could be performed; false otherwise.
-    //------------------------------------------------------------------
-    bool
-    WriteTarget (lldb_private::Value &value,
-                 const uint8_t *data,
-                 size_t length);
-    
-    //------------------------------------------------------------------
-    /// [Used by IRInterpreter] Read from the target.
-    ///
-    /// @param[in] data
-    ///     The address of the data buffer to write to.
-    ///
-    /// @param[in] value
-    ///     The address to read from.
-    ///
-    /// @param[in] length
-    ///     The amount of data to read, in bytes.
-    ///
-    /// @return
-    ///     True if the read could be performed; false otherwise.
-    //------------------------------------------------------------------
-    bool
-    ReadTarget (uint8_t *data,
-                lldb_private::Value &value,
-                size_t length);
-
-    //------------------------------------------------------------------
-    /// [Used by IRInterpreter] Get the Value for a NamedDecl.
-    ///
-    /// @param[in] decl
-    ///     The Decl whose value is to be found.
-    ///
-    /// @param[out] flags
-    ///     The flags for the found variable.
-    ///
-    /// @return
-    ///     The value, or NULL.
-    //------------------------------------------------------------------
-    lldb_private::Value
-    LookupDecl (clang::NamedDecl *decl,
-                ClangExpressionVariable::FlagType &flags);
-    
-    //------------------------------------------------------------------
-    /// [Used by IRInterpreter] Get the Value for "this", "self", or
-    ///   "_cmd".
-    ///
-    /// @param[in] name
-    ///     The name of the entity to be found.
-    ///
-    /// @return
-    ///     The value, or NULL.
-    //------------------------------------------------------------------
-    lldb_private::Value
-    GetSpecialValue (const ConstString &name);
-    
-    //------------------------------------------------------------------
-    /// [Used by IRInterpreter] Returns true if the result is a
-    ///   reference to data in the target, meaning it must be
-    ///   dereferenced once more to get its data.
-    ///
-    /// @param[in] name
-    ///     The name of the result.
-    ///
-    /// @return
-    ///     True if the result is a reference; false otherwise (or on
-    ///     error).
-    //------------------------------------------------------------------
-    bool
-    ResultIsReference (const ConstString &name);
-    
-    //------------------------------------------------------------------
-    /// [Used by IRInterpreter] Find the result persistent variable,
-    ///   propagate the given value to it, and return it.
-    ///
-    /// @param[out] valobj
-    ///     Set to the complete object.
-    ///
-    /// @param[in] value
-    ///     A value indicating the location of the value's contents.
-    ///
-    /// @param[in] name
-    ///     The name of the result.
-    ///
-    /// @param[in] type
-    ///     The type of the data.
-    ///
-    /// @param[in] transient
-    ///     True if the data should be treated as disappearing after the
-    ///     expression completes.  In that case, it gets no live data.
-    ///
-    /// @param[in] maybe_make_load
-    ///     True if the value is a file address but should be potentially
-    ///     upgraded to a load address if a target is presence.
-    ///
-    /// @return
-    ///     True on success; false otherwise.
-    //------------------------------------------------------------------
-    bool
-    CompleteResultVariable (lldb::ClangExpressionVariableSP &valobj, 
-                            lldb_private::Value &value,
-                            const ConstString &name,
-                            lldb_private::TypeFromParser type,
-                            bool transient,
-                            bool maybe_make_load);
-    
-    
-    void
-    RemoveResultVariable (const ConstString &name);
-    
-    //------------------------------------------------------------------
-    /// [Used by CommandObjectExpression] Materialize the entire struct
-    /// at a given address, which should be aligned as specified by 
-    /// GetStructInfo().
-    ///
-    /// @param[in] struct_address
-    ///     The address at which the struct should be written.
-    ///
-    /// @param[in] error
-    ///     An Error to populate with any messages related to
-    ///     materializing the struct.
-    ///
-    /// @return
-    ///     True on success; false otherwise.
-    //------------------------------------------------------------------
-    bool 
-    Materialize (lldb::addr_t &struct_address,
-                 Error &error);
-    
-    //------------------------------------------------------------------
-    /// [Used by CommandObjectExpression] Get the "this" pointer
-    /// from a given execution context.
-    ///
-    /// @param[out] object_ptr
-    ///     The this pointer.
-    ///
-    /// @param[in] object_name
-    ///     The name of the object pointer -- "this," "self," or similar
-    ///     depending on language
-    ///
-    /// @param[in] error
-    ///     An Error to populate with any messages related to
-    ///     finding the "this" pointer.
-    ///
-    /// @param[in] suppress_type_check
-    ///     True if the type is not needed.
-    ///
-    /// @return
-    ///     True on success; false otherwise.
-    //------------------------------------------------------------------
-    bool
-    GetObjectPointer (lldb::addr_t &object_ptr,
-                      ConstString &object_name,
-                      Error &error,
-                      bool suppress_type_check = false);
-    
-    //------------------------------------------------------------------
-    /// [Used by CommandObjectExpression] Pretty-print a materialized
-    /// struct, which must have been materialized by Materialize(),
-    /// byte for byte on a given stream.
-    ///
-    /// @param[in] exe_ctx
-    ///     The execution context from which to read the struct.
-    ///
-    /// @param[in] s
-    ///     The stream on which to write the pretty-printed output.
-    ///
-    /// @param[in] error
-    ///     An Error to populate with any messages related to
-    ///     pretty-printing the struct.
-    ///
-    /// @return
-    ///     True on success; false otherwise.
-    //------------------------------------------------------------------
-    bool 
-    DumpMaterializedStruct (Stream &s,
-                            Error &error);
-    
-    //------------------------------------------------------------------
-    /// [Used by CommandObjectExpression] Deaterialize the entire struct.
-    ///
-    /// @param[in] exe_ctx
-    ///     The execution context from which to read the struct.
-    ///
-    /// @param[out] result
-    ///     A ClangExpressionVariable containing the result of the
-    ///     expression, for potential re-use.
-    ///
-    /// @param[in] stack_frame_top, stack_frame_bottom
-    ///     If not LLDB_INVALID_ADDRESS, the bounds for the stack frame
-    ///     in which the expression ran.  A result whose address falls
-    ///     inside this stack frame is dematerialized as a value
-    ///     requiring rematerialization.
-    ///
-    /// @param[in] error
-    ///     An Error to populate with any messages related to
-    ///     dematerializing the struct.
-    ///
-    /// @return
-    ///     True on success; false otherwise.
-    //------------------------------------------------------------------
-    bool 
-    Dematerialize (lldb::ClangExpressionVariableSP &result_sp,
-                   lldb::addr_t stack_frame_top,
-                   lldb::addr_t stack_frame_bottom,
-                   Error &error);
-    
-    //------------------------------------------------------------------
     /// [Used by ClangASTSource] Find all entities matching a given name,
     /// using a NameSearchContext to make Decls for them.
     ///
@@ -708,7 +422,7 @@ private:
         DISALLOW_COPY_AND_ASSIGN (ParserVars);
     };
     
-    std::auto_ptr<ParserVars> m_parser_vars;
+    std::unique_ptr<ParserVars> m_parser_vars;
     
     //----------------------------------------------------------------------
     /// Activate parser-specific variables
@@ -750,7 +464,7 @@ private:
         TypeFromUser                m_object_pointer_type;      ///< The type of the "this" variable, if one exists
     };
     
-    std::auto_ptr<StructVars> m_struct_vars;
+    std::unique_ptr<StructVars> m_struct_vars;
     
     //----------------------------------------------------------------------
     /// Activate struct variables
@@ -772,43 +486,6 @@ private:
     }
     
     //----------------------------------------------------------------------
-    /// The following values refer to a specific materialization of the
-    /// structure in a process
-    //----------------------------------------------------------------------
-    struct MaterialVars {
-        MaterialVars() :
-            m_allocated_area(0),
-            m_materialized_location(0)
-        {
-        }
-        
-        Process                    *m_process;                  ///< The process that the struct is materialized into.
-        lldb::addr_t                m_allocated_area;           ///< The base of the memory allocated for the struct.  Starts on a potentially unaligned address and may therefore be larger than the struct.
-        lldb::addr_t                m_materialized_location;    ///< The address at which the struct is placed.  Falls inside the allocated area.
-    };
-    
-    std::auto_ptr<MaterialVars> m_material_vars;
-    
-    //----------------------------------------------------------------------
-    /// Activate materialization-specific variables
-    //----------------------------------------------------------------------
-    void 
-    EnableMaterialVars()
-    {
-        if (!m_material_vars.get())
-            m_material_vars.reset(new struct MaterialVars);
-    }
-    
-    //----------------------------------------------------------------------
-    /// Deallocate materialization-specific variables
-    //----------------------------------------------------------------------
-    void 
-    DisableMaterialVars()
-    {
-        m_material_vars.reset();
-    }
-    
-    //----------------------------------------------------------------------
     /// Get this parser's ID for use in extracting parser- and JIT-specific
     /// data from persistent variables.
     //----------------------------------------------------------------------
@@ -819,36 +496,6 @@ private:
     }
     
     //------------------------------------------------------------------
-    /// Given a stack frame, find a variable that matches the given name and 
-    /// type.  We need this for expression re-use; we may not always get the
-    /// same lldb::Variable back, and we want the expression to work wherever 
-    /// it can.  Returns the variable defined in the tightest scope.
-    ///
-    /// @param[in] frame
-    ///     The stack frame to use as a basis for finding the variable.
-    ///
-    /// @param[in] name
-    ///     The name as a plain C string.
-    ///
-    /// @param[in] type
-    ///     The required type for the variable.  This function may be called
-    ///     during parsing, in which case we don't know its type; hence the
-    ///     default.
-    ///
-    /// @param[in] object_pointer
-    ///     The type expected is an object type.  This means we will ignore
-    ///     constness of the pointer target.
-    ///
-    /// @return
-    ///     The LLDB Variable found, or NULL if none was found.
-    //------------------------------------------------------------------
-    lldb::VariableSP
-    FindVariableInScope (StackFrame &frame,
-                         const ConstString &name,
-                         TypeFromUser *type = NULL,
-                         bool object_pointer = false);
-    
-    //------------------------------------------------------------------
     /// Given a target, find a data symbol that has the given name.
     ///
     /// @param[in] target
@@ -1044,191 +691,6 @@ private:
     TypeFromParser
     CopyClassType(TypeFromUser &type,
                   unsigned int current_id);
-    
-    //------------------------------------------------------------------
-    /// Actually do the task of materializing or dematerializing the struct.
-    /// Since both tasks are very similar, although ClangExpressionDeclMap
-    /// exposes two functions to the outside, both call DoMaterialize.
-    ///
-    /// @param[in] dematerialize
-    ///     True if the struct is to be dematerialized; false if it is to
-    ///     be materialized.
-    ///
-    /// @param[in] stack_frame_top, stack_frame_bottom
-    ///     If not LLDB_INVALID_ADDRESS, the bounds for the stack frame
-    ///     in which the expression ran.  A result whose address falls
-    ///     inside this stack frame is dematerialized as a value
-    ///     requiring rematerialization.
-    ///
-    /// @param[out] result
-    ///     If the struct is being dematerialized, a pointer into which the
-    ///     location of the result persistent variable is placed.  If not,
-    ///     NULL.
-    ///
-    /// @param[in] err
-    ///     An Error to populate with any messages related to
-    ///     (de)materializing the struct.
-    ///
-    /// @return
-    ///     True on success; false otherwise.
-    //------------------------------------------------------------------
-    bool 
-    DoMaterialize (bool dematerialize,
-                   lldb::addr_t stack_frame_top,
-                   lldb::addr_t stack_frame_bottom,
-                   lldb::ClangExpressionVariableSP *result_sp_ptr,
-                   Error &err);
-    
-    //------------------------------------------------------------------
-    /// Clean up the state required to dematerialize the variable.
-    //------------------------------------------------------------------
-    void 
-    DidDematerialize ();
-
-    //------------------------------------------------------------------
-    /// Actually do the task of materializing or dematerializing a persistent
-    /// variable.
-    ///
-    /// @param[in] dematerialize
-    ///     True if the variable is to be dematerialized; false if it is to
-    ///     be materialized.
-    ///
-    /// @param[in] var_sp
-    ///     The persistent variable to materialize
-    ///
-    /// @param[in] addr
-    ///     The address at which to materialize the variable.
-    ///
-    /// @param[in] stack_frame_top, stack_frame_bottom
-    ///     If not LLDB_INVALID_ADDRESS, the bounds for the stack frame
-    ///     in which the expression ran.  A result whose address falls
-    ///     inside this stack frame is dematerialized as a value
-    ///     requiring rematerialization.
-    ///
-    /// @param[in] err
-    ///     An Error to populate with any messages related to
-    ///     (de)materializing the persistent variable.
-    ///
-    /// @return
-    ///     True on success; false otherwise.
-    //------------------------------------------------------------------
-    bool 
-    DoMaterializeOnePersistentVariable (bool dematerialize,
-                                        lldb::ClangExpressionVariableSP &var_sp,
-                                        lldb::addr_t addr,
-                                        lldb::addr_t stack_frame_top,
-                                        lldb::addr_t stack_frame_bottom,
-                                        Error &err);
-    
-    //------------------------------------------------------------------
-    /// Create a temporary buffer in the target process to store the value
-    /// of a persistent variable that would otherwise not be accessible in
-    /// memory (e.g., register values or constants).
-    ///
-    /// @param[in] process
-    ///     The process to use when allocating the memory.
-    ///
-    /// @param[in] expr_var
-    ///     The variable whose live data will hold this buffer.
-    ///
-    /// @param[in] err
-    ///     An Error to populate with any messages related to
-    ///     allocating the memory.
-    ///
-    /// @return
-    ///     True on success; false otherwise.
-    //------------------------------------------------------------------
-    bool
-    CreateLiveMemoryForExpressionVariable (Process &process,
-                                           lldb::ClangExpressionVariableSP &expr_var,
-                                           Error &err);
-    
-    //------------------------------------------------------------------
-    /// Delete a temporary buffer created with
-    /// CreateLiveMemoryForExpressionVariable.
-    ///
-    /// @param[in] process
-    ///     The process to use when deallocating the memory.
-    ///
-    /// @param[in] expr_var
-    ///     The variable whose live data will hold this buffer.
-    ///
-    /// @param[in] err
-    ///     An Error to populate with any messages related to
-    ///     allocating the memory.
-    ///
-    /// @return
-    ///     True on success; false otherwise.
-    //------------------------------------------------------------------
-    bool
-    DeleteLiveMemoryForExpressionVariable (Process &process,
-                                           lldb::ClangExpressionVariableSP &expr_var,
-                                           Error &err);
-    
-    //------------------------------------------------------------------
-    /// Actually do the task of materializing or dematerializing a 
-    /// variable.
-    ///
-    /// @param[in] dematerialize
-    ///     True if the variable is to be dematerialized; false if it is to
-    ///     be materialized.
-    ///
-    /// @param[in] sym_ctx
-    ///     The symbol context to use (for looking the variable up).
-    ///
-    /// @param[in] expr_var
-    ///     The entity that the expression parser uses for the variable.
-    ///     In case the variable needs to be copied into the target's
-    ///     memory, this location is stored in the variable during
-    ///     materialization and cleared when it is demateralized.
-    ///
-    /// @param[in] addr
-    ///     The address at which to materialize the variable.
-    ///
-    /// @param[in] err
-    ///     An Error to populate with any messages related to
-    ///     (de)materializing the persistent variable.
-    ///
-    /// @return
-    ///     True on success; false otherwise.
-    //------------------------------------------------------------------
-    bool 
-    DoMaterializeOneVariable (bool dematerialize,
-                              const SymbolContext &sym_ctx,
-                              lldb::ClangExpressionVariableSP &expr_var,
-                              lldb::addr_t addr, 
-                              Error &err);
-    
-    //------------------------------------------------------------------
-    /// Actually do the task of materializing or dematerializing a 
-    /// register variable.
-    ///
-    /// @param[in] dematerialize
-    ///     True if the variable is to be dematerialized; false if it is to
-    ///     be materialized.
-    ///
-    /// @param[in] reg_ctx
-    ///     The register context to use.
-    ///
-    /// @param[in] reg_info
-    ///     The information for the register to read/write.
-    ///
-    /// @param[in] addr
-    ///     The address at which to materialize the variable.
-    ///
-    /// @param[in] err
-    ///     An Error to populate with any messages related to
-    ///     (de)materializing the persistent variable.
-    ///
-    /// @return
-    ///     True on success; false otherwise.
-    //------------------------------------------------------------------
-    bool 
-    DoMaterializeOneRegister (bool dematerialize,
-                              RegisterContext &reg_ctx,
-                              const RegisterInfo &reg_info,
-                              lldb::addr_t addr, 
-                              Error &err);
 };
     
 } // namespace lldb_private

Modified: lldb/branches/windows/include/lldb/Expression/ClangExpressionParser.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Expression/ClangExpressionParser.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Expression/ClangExpressionParser.h (original)
+++ lldb/branches/windows/include/lldb/Expression/ClangExpressionParser.h Thu Apr 25 07:31:53 2013
@@ -86,7 +86,7 @@ public:
     ///
     /// @param[in] execution_unit_ap
     ///     After parsing, ownership of the execution unit for
-    ///     for the expression is handed to this auto_ptr.
+    ///     for the expression is handed to this unique pointer.
     ///
     /// @param[in] exe_ctx
     ///     The execution context to write the function into.
@@ -112,10 +112,9 @@ public:
     Error
     PrepareForExecution (lldb::addr_t &func_addr,
                          lldb::addr_t &func_end,
-                         std::auto_ptr<IRExecutionUnit> &execution_unit_ap,
+                         std::unique_ptr<IRExecutionUnit> &execution_unit_ap,
                          ExecutionContext &exe_ctx,
-                         bool &evaluated_statically,
-                         lldb::ClangExpressionVariableSP &const_result,
+                         bool &can_interpret,
                          lldb_private::ExecutionPolicy execution_policy);
         
     //------------------------------------------------------------------
@@ -136,16 +135,15 @@ public:
                          ExecutionContext &exe_ctx);
     
 private:
-    ClangExpression                            &m_expr;                 ///< The expression to be parsed
-    
-    std::auto_ptr<llvm::LLVMContext>            m_llvm_context;         ///< The LLVM context to generate IR into
-    std::auto_ptr<clang::FileManager>           m_file_manager;         ///< The Clang file manager object used by the compiler
-    std::auto_ptr<clang::CompilerInstance>      m_compiler;             ///< The Clang compiler used to parse expressions into IR
-    std::auto_ptr<clang::Builtin::Context>      m_builtin_context;      ///< Context for Clang built-ins
-    std::auto_ptr<clang::SelectorTable>         m_selector_table;       ///< Selector table for Objective-C methods
-    std::auto_ptr<clang::ASTContext>            m_ast_context;          ///< The AST context used to hold types and names for the parser
-    std::auto_ptr<clang::CodeGenerator>         m_code_generator;       ///< The Clang object that generates IR
-    std::auto_ptr<IRExecutionUnit>              m_execution_unit;       ///< The container for the finished Module
+    ClangExpression &                       m_expr;                 ///< The expression to be parsed
+    std::unique_ptr<llvm::LLVMContext>       m_llvm_context;         ///< The LLVM context to generate IR into
+    std::unique_ptr<clang::FileManager>      m_file_manager;         ///< The Clang file manager object used by the compiler
+    std::unique_ptr<clang::CompilerInstance> m_compiler;             ///< The Clang compiler used to parse expressions into IR
+    std::unique_ptr<clang::Builtin::Context> m_builtin_context;      ///< Context for Clang built-ins
+    std::unique_ptr<clang::SelectorTable>    m_selector_table;       ///< Selector table for Objective-C methods
+    std::unique_ptr<clang::ASTContext>       m_ast_context;          ///< The AST context used to hold types and names for the parser
+    std::unique_ptr<clang::CodeGenerator>    m_code_generator;       ///< The Clang object that generates IR
+    std::unique_ptr<IRExecutionUnit>         m_execution_unit;       ///< The container for the finished Module
 };
     
 }

Modified: lldb/branches/windows/include/lldb/Expression/ClangExpressionVariable.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Expression/ClangExpressionVariable.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Expression/ClangExpressionVariable.h (original)
+++ lldb/branches/windows/include/lldb/Expression/ClangExpressionVariable.h Thu Apr 25 07:31:53 2013
@@ -248,7 +248,7 @@ public:
     void
     TransferAddress (bool force = false);
 
-    typedef STD_SHARED_PTR(ValueObjectConstResult) ValueObjectConstResultSP;
+    typedef std::shared_ptr<ValueObjectConstResult> ValueObjectConstResultSP;
 
     //----------------------------------------------------------------------
     /// Members

Modified: lldb/branches/windows/include/lldb/Expression/ClangFunction.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Expression/ClangFunction.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Expression/ClangFunction.h (original)
+++ lldb/branches/windows/include/lldb/Expression/ClangFunction.h Thu Apr 25 07:31:53 2013
@@ -619,8 +619,8 @@ private:
 	// For ClangFunction only
 	//------------------------------------------------------------------
 
-    std::auto_ptr<ClangExpressionParser>    m_parser;               ///< The parser responsible for compiling the function.
-    std::auto_ptr<IRExecutionUnit>          m_execution_unit_ap;
+    std::unique_ptr<ClangExpressionParser> m_parser;                 ///< The parser responsible for compiling the function.
+    std::unique_ptr<IRExecutionUnit> m_execution_unit_ap;
     
     Function                       *m_function_ptr;                 ///< The function we're going to call.  May be NULL if we don't have debug info for the function.
     Address                         m_function_addr;                ///< If we don't have the FunctionSP, we at least need the address & return type.

Modified: lldb/branches/windows/include/lldb/Expression/ClangUserExpression.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Expression/ClangUserExpression.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Expression/ClangUserExpression.h (original)
+++ lldb/branches/windows/include/lldb/Expression/ClangUserExpression.h Thu Apr 25 07:31:53 2013
@@ -14,7 +14,6 @@
 // C++ Includes
 #include <string>
 #include <map>
-#include <memory>
 #include <vector>
 
 // Other libraries and framework includes
@@ -22,10 +21,12 @@
 
 #include "lldb/lldb-forward.h"
 #include "lldb/lldb-private.h"
+#include "lldb/Core/Address.h"
 #include "lldb/Core/ClangForward.h"
 #include "lldb/Expression/ClangExpression.h"
 #include "lldb/Expression/ClangExpressionVariable.h"
 #include "lldb/Expression/IRForTarget.h"
+#include "lldb/Expression/Materializer.h"
 #include "lldb/Symbol/TaggedASTType.h"
 #include "lldb/Target/ExecutionContext.h"
 
@@ -46,7 +47,7 @@ namespace lldb_private
 class ClangUserExpression : public ClangExpression
 {
 public:
-    typedef STD_SHARED_PTR(ClangUserExpression) ClangUserExpressionSP;
+    typedef std::shared_ptr<ClangUserExpression> ClangUserExpressionSP;
     
     enum { kDefaultTimeout = 500000u };
     //------------------------------------------------------------------
@@ -106,6 +107,15 @@ public:
            lldb_private::ExecutionPolicy execution_policy,
            bool keep_result_in_memory);
     
+    bool
+    CanInterpret ()
+    {
+        return m_can_interpret;
+    }
+    
+    bool
+    MatchesContext (ExecutionContext &exe_ctx);
+    
     //------------------------------------------------------------------
     /// Execute the parsed expression
     ///
@@ -376,41 +386,17 @@ private:
                                    lldb::addr_t &object_ptr,
                                    lldb::addr_t &cmd_ptr);
     
-    bool
-    EvaluatedStatically ()
-    {
-        return m_evaluated_statically;
-    }
-    
     void
-    InstallContext (ExecutionContext &exe_ctx)
-    {
-        m_process_wp = exe_ctx.GetProcessSP();
-        m_target_wp = exe_ctx.GetTargetSP();
-        m_frame_wp = exe_ctx.GetFrameSP();
-    }
+    InstallContext (ExecutionContext &exe_ctx);
     
     bool
     LockAndCheckContext (ExecutionContext &exe_ctx,
                          lldb::TargetSP &target_sp,
                          lldb::ProcessSP &process_sp,
-                         lldb::StackFrameSP &frame_sp)
-    {
-        target_sp = m_target_wp.lock();
-        process_sp = m_process_wp.lock();
-        frame_sp = m_frame_wp.lock();
-        
-        if ((target_sp && target_sp.get() != exe_ctx.GetTargetPtr()) || 
-            (process_sp && process_sp.get() != exe_ctx.GetProcessPtr()) ||
-            (frame_sp && frame_sp.get() != exe_ctx.GetFramePtr()))
-            return false;
-        
-        return true;
-    }
+                         lldb::StackFrameSP &frame_sp);
     
-    lldb::TargetWP                              m_target_wp;            ///< The target used as the context for the expression.
     lldb::ProcessWP                             m_process_wp;           ///< The process used as the context for the expression.
-    lldb::StackFrameWP                          m_frame_wp;             ///< The stack frame used as context for the expression.
+    Address                                     m_address;              ///< The address the process is stopped in.
     
     std::string                                 m_expr_text;            ///< The text of the expression, as typed by the user
     std::string                                 m_expr_prefix;          ///< The text of the translation-level definitions, as provided by the user
@@ -420,12 +406,10 @@ private:
     std::string                                 m_transformed_text;     ///< The text of the expression, as send to the parser
     ResultType                                  m_desired_type;         ///< The type to coerce the expression's result to.  If eResultTypeAny, inferred from the expression.
     
-    std::auto_ptr<ClangExpressionDeclMap>       m_expr_decl_map;        ///< The map to use when parsing the expression.
-    
-    std::auto_ptr<IRExecutionUnit>              m_execution_unit_ap;    ///< The execution unit the expression is stored in.
-    std::auto_ptr<Materializer>                 m_materializer_ap;      ///< The materializer to use when running the expression.
-    
-    std::auto_ptr<ASTResultSynthesizer>         m_result_synthesizer;   ///< The result synthesizer, if one is needed.
+    std::unique_ptr<ClangExpressionDeclMap>      m_expr_decl_map;        ///< The map to use when parsing the expression.
+    std::unique_ptr<IRExecutionUnit>             m_execution_unit_ap;    ///< The execution unit the expression is stored in.
+    std::unique_ptr<Materializer>                m_materializer_ap;      ///< The materializer to use when running the expression.
+    std::unique_ptr<ASTResultSynthesizer>        m_result_synthesizer;   ///< The result synthesizer, if one is needed.
     
     bool                                        m_enforce_valid_object; ///< True if the expression parser should enforce the presence of a valid class pointer in order to generate the expression as a method.
     bool                                        m_cplusplus;            ///< True if the expression is compiled as a C++ member function (true if it was parsed when exe_ctx was in a C++ method).
@@ -435,8 +419,9 @@ private:
     bool                                        m_const_object;         ///< True if "this" is const.
     Target                                     *m_target;               ///< The target for storing persistent data like types and variables.
     
-    bool                                        m_evaluated_statically; ///< True if the expression could be evaluated statically; false otherwise.
-    lldb::ClangExpressionVariableSP             m_const_result;         ///< The statically-computed result of the expression.  NULL if it could not be computed statically or the expression has side effects.
+    bool                                        m_can_interpret;        ///< True if the expression could be evaluated statically; false otherwise.
+    lldb::addr_t                                m_materialized_address; ///< The address at which the arguments to the expression have been materialized.
+    Materializer::DematerializerSP              m_dematerializer_sp;    ///< The dematerializer.
 };
     
 } // namespace lldb_private

Modified: lldb/branches/windows/include/lldb/Expression/ClangUtilityFunction.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Expression/ClangUtilityFunction.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Expression/ClangUtilityFunction.h (original)
+++ lldb/branches/windows/include/lldb/Expression/ClangUtilityFunction.h Thu Apr 25 07:31:53 2013
@@ -14,7 +14,6 @@
 // C++ Includes
 #include <string>
 #include <map>
-#include <memory>
 #include <vector>
 
 // Other libraries and framework includes
@@ -168,8 +167,8 @@ public:
     }
     
 private:
-    std::auto_ptr<ClangExpressionDeclMap>   m_expr_decl_map;    ///< The map to use when parsing and materializing the expression.
-    std::auto_ptr<IRExecutionUnit>          m_execution_unit_ap;
+    std::unique_ptr<ClangExpressionDeclMap>  m_expr_decl_map;    ///< The map to use when parsing and materializing the expression.
+    std::unique_ptr<IRExecutionUnit>         m_execution_unit_ap;
     
     std::string                             m_function_text;    ///< The text of the function.  Must be a well-formed translation unit.
     std::string                             m_function_name;    ///< The name of the function.

Modified: lldb/branches/windows/include/lldb/Expression/IRDynamicChecks.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Expression/IRDynamicChecks.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Expression/IRDynamicChecks.h (original)
+++ lldb/branches/windows/include/lldb/Expression/IRDynamicChecks.h Thu Apr 25 07:31:53 2013
@@ -77,8 +77,8 @@ public:
     
     bool DoCheckersExplainStop (lldb::addr_t addr, Stream &message);
     
-    std::auto_ptr<ClangUtilityFunction> m_valid_pointer_check;
-    std::auto_ptr<ClangUtilityFunction> m_objc_object_check;
+    std::unique_ptr<ClangUtilityFunction> m_valid_pointer_check;
+    std::unique_ptr<ClangUtilityFunction> m_objc_object_check;
 };
 
 //----------------------------------------------------------------------

Modified: lldb/branches/windows/include/lldb/Expression/IRExecutionUnit.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Expression/IRExecutionUnit.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Expression/IRExecutionUnit.h (original)
+++ lldb/branches/windows/include/lldb/Expression/IRExecutionUnit.h Thu Apr 25 07:31:53 2013
@@ -20,6 +20,8 @@
 #include <map>
 
 // Other libraries and framework includes
+#include "llvm/IR/Module.h"
+
 // Project includes
 #include "lldb/lldb-forward.h"
 #include "lldb/lldb-private.h"
@@ -66,7 +68,8 @@ public:
     //------------------------------------------------------------------
     /// Constructor
     //------------------------------------------------------------------
-    IRExecutionUnit (std::auto_ptr<llvm::Module> &module_ap,
+    IRExecutionUnit (std::unique_ptr<llvm::LLVMContext> &context_ap,
+                     std::unique_ptr<llvm::Module> &module_ap,
                      ConstString &name,
                      const lldb::TargetSP &target_sp,
                      std::vector<std::string> &cpu_features);
@@ -81,6 +84,14 @@ public:
         return m_module;
     }
     
+    llvm::Function *GetFunction()
+    {
+        if (m_module)
+            return m_module->getFunction (m_name.AsCString());
+        else
+            return NULL;
+    }
+    
     void GetRunnableInfo(Error &error,
                          lldb::addr_t &func_addr,
                          lldb::addr_t &func_end);
@@ -413,7 +424,7 @@ private:
             return m_default_mm_ap->getPointerToNamedFunction(Name, AbortOnFailure);
         }
     private:
-        std::auto_ptr<JITMemoryManager>     m_default_mm_ap;    ///< The memory allocator to use in actually creating space.  All calls are passed through to it.
+        std::unique_ptr<JITMemoryManager>    m_default_mm_ap;    ///< The memory allocator to use in actually creating space.  All calls are passed through to it.
         IRExecutionUnit                    &m_parent;           ///< The execution unit this is a proxy for.
     };
     
@@ -493,8 +504,9 @@ private:
     typedef std::vector<AllocationRecord>   RecordVector;
     RecordVector                            m_records;
 
-    std::auto_ptr<llvm::ExecutionEngine>    m_execution_engine_ap;
-    std::auto_ptr<llvm::Module>             m_module_ap;            ///< Holder for the module until it's been handed off
+    std::unique_ptr<llvm::LLVMContext>       m_context_ap;
+    std::unique_ptr<llvm::ExecutionEngine>   m_execution_engine_ap;
+    std::unique_ptr<llvm::Module>            m_module_ap;            ///< Holder for the module until it's been handed off
     llvm::Module                           *m_module;               ///< Owned by the execution engine
     std::vector<std::string>                m_cpu_features;
     llvm::SmallVector<JittedFunction, 1>    m_jitted_functions;     ///< A vector of all functions that have been JITted into machine code

Modified: lldb/branches/windows/include/lldb/Expression/IRForTarget.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Expression/IRForTarget.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Expression/IRForTarget.h (original)
+++ lldb/branches/windows/include/lldb/Expression/IRForTarget.h Thu Apr 25 07:31:53 2013
@@ -37,6 +37,7 @@ namespace llvm {
 namespace lldb_private {
     class ClangExpressionDeclMap;
     class IRExecutionUnit;
+    class IRMemoryMap;
 }
 
 //----------------------------------------------------------------------
@@ -89,8 +90,6 @@ public:
     //------------------------------------------------------------------
     IRForTarget(lldb_private::ClangExpressionDeclMap *decl_map,
                 bool resolve_vars,
-                lldb_private::ExecutionPolicy execution_policy,
-                lldb::ClangExpressionVariableSP &const_result,
                 lldb_private::IRExecutionUnit &execution_unit,
                 lldb_private::Stream *error_stream,
                 const char* func_name = "$__lldb_expr");
@@ -138,18 +137,6 @@ public:
     //------------------------------------------------------------------
     virtual llvm::PassManagerType 
     getPotentialPassManagerType() const;
-    
-    //------------------------------------------------------------------
-    /// Checks whether the IR interpreter successfully interpreted the
-    /// expression.
-    ///
-    /// Returns true if it did; false otherwise.
-    //------------------------------------------------------------------
-    lldb_private::Error &
-    getInterpreterError ()
-    {
-        return m_interpreter_error;
-    }
 
 private:
     //------------------------------------------------------------------
@@ -663,20 +650,17 @@ private:
     
     /// Flags
     bool                                    m_resolve_vars;             ///< True if external variable references and persistent variable references should be resolved
-    lldb_private::ExecutionPolicy           m_execution_policy;         ///< True if the interpreter should be used to attempt to get a static result
-    bool                                    m_interpret_success;        ///< True if the interpreter successfully handled the whole expression
     std::string                             m_func_name;                ///< The name of the function to translate
     lldb_private::ConstString               m_result_name;              ///< The name of the result variable ($0, $1, ...)
     lldb_private::TypeFromParser            m_result_type;              ///< The type of the result variable.
     llvm::Module                           *m_module;                   ///< The module being processed, or NULL if that has not been determined yet.
-    std::auto_ptr<llvm::DataLayout>         m_target_data;              ///< The target data for the module being processed, or NULL if there is no module.
+    std::unique_ptr<llvm::DataLayout>        m_target_data;              ///< The target data for the module being processed, or NULL if there is no module.
     lldb_private::ClangExpressionDeclMap   *m_decl_map;                 ///< The DeclMap containing the Decls 
     StaticDataAllocator                     m_data_allocator;           ///< The allocator to use for constant strings
+    lldb_private::IRMemoryMap              &m_memory_map;               ///< The memory map to pass to the IR interpreter
     llvm::Constant                         *m_CFStringCreateWithBytes;  ///< The address of the function CFStringCreateWithBytes, cast to the appropriate function pointer type
     llvm::Constant                         *m_sel_registerName;         ///< The address of the function sel_registerName, cast to the appropriate function pointer type
-    lldb::ClangExpressionVariableSP        &m_const_result;             ///< This value should be set to the return value of the expression if it is constant and the expression has no side effects
     lldb_private::Stream                   *m_error_stream;             ///< If non-NULL, the stream on which errors should be printed
-    lldb_private::Error                     m_interpreter_error;        ///< The error result from the IR interpreter
     
     bool                                    m_has_side_effects;         ///< True if the function's result cannot be simply determined statically
     llvm::StoreInst                        *m_result_store;             ///< If non-NULL, the store instruction that writes to the result variable.  If m_has_side_effects is true, this is NULL.

Modified: lldb/branches/windows/include/lldb/Expression/IRInterpreter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Expression/IRInterpreter.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Expression/IRInterpreter.h (original)
+++ lldb/branches/windows/include/lldb/Expression/IRInterpreter.h Thu Apr 25 07:31:53 2013
@@ -14,6 +14,7 @@
 #include "lldb/Core/ConstString.h"
 #include "lldb/Core/Stream.h"
 #include "lldb/Symbol/TaggedASTType.h"
+#include "llvm/ADT/ArrayRef.h"
 #include "llvm/Pass.h"
 
 namespace llvm {
@@ -24,6 +25,7 @@ namespace llvm {
 namespace lldb_private {
 
 class ClangExpressionDeclMap;
+class IRMemoryMap;
     
 }
 
@@ -39,74 +41,22 @@ class ClangExpressionDeclMap;
 class IRInterpreter
 {
 public:
-    //------------------------------------------------------------------
-    /// Constructor
-    ///
-    /// @param[in] decl_map
-    ///     The list of externally-referenced variables for the expression,
-    ///     for use in looking up globals and allocating the argument
-    ///     struct.  See the documentation for ClangExpressionDeclMap.
-    ///
-    /// @param[in] error_stream
-    ///     If non-NULL, a stream on which errors can be printed.
-    //------------------------------------------------------------------
-    IRInterpreter(lldb_private::ClangExpressionDeclMap &decl_map,
-                  lldb_private::Stream *error_stream);
+    static bool
+    CanInterpret (llvm::Module &module,
+                  llvm::Function &function,
+                  lldb_private::Error &error);
     
-    //------------------------------------------------------------------
-    /// Destructor
-    //------------------------------------------------------------------
-    ~IRInterpreter();
-    
-    //------------------------------------------------------------------
-    /// Run the IR interpreter on a single function
-    ///
-    /// @param[in] result
-    ///     This variable is populated with the return value of the
-    ///     function, if it could be interpreted completely.
-    ///
-    /// @param[in] result_name
-    ///     The name of the result in the IR.  If this name got a
-    ///     value written to it as part of execution, then that value
-    ///     will be used to create the result variable.
-    ///
-    /// @param[in] result_type
-    ///     The type of the result.
-    ///
-    /// @param[in] llvm_function
-    ///     The function to interpret.
-    ///
-    /// @param[in] llvm_module
-    ///     The module containing the function.
-    ///
-    /// @param[in] error
-    ///     If the expression fails to interpret, a reason why.
-    ///
-    /// @return
-    ///     True on success; false otherwise
-    //------------------------------------------------------------------
-    bool 
-    maybeRunOnFunction (lldb::ClangExpressionVariableSP &result,
-                        const lldb_private::ConstString &result_name,
-                        lldb_private::TypeFromParser result_type,
-                        llvm::Function &llvm_function,
-                        llvm::Module &llvm_module,
-                        lldb_private::Error &err);
-private:
-    /// Flags
-    lldb_private::ClangExpressionDeclMap &m_decl_map;       ///< The DeclMap containing the Decls 
-    
-    bool
+    static bool
+    Interpret (llvm::Module &module,
+               llvm::Function &function,
+               llvm::ArrayRef<lldb::addr_t> args,
+               lldb_private::IRMemoryMap &memory_map,
+               lldb_private::Error &error);
+                  
+private:   
+    static bool
     supportsFunction (llvm::Function &llvm_function,
                       lldb_private::Error &err);
-    
-    bool 
-    runOnFunction (lldb::ClangExpressionVariableSP &result,
-                   const lldb_private::ConstString &result_name,
-                   lldb_private::TypeFromParser result_type,
-                   llvm::Function &llvm_function,
-                   llvm::Module &llvm_module,
-                   lldb_private::Error &err);
 };
 
 #endif

Modified: lldb/branches/windows/include/lldb/Expression/IRMemoryMap.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Expression/IRMemoryMap.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Expression/IRMemoryMap.h (original)
+++ lldb/branches/windows/include/lldb/Expression/IRMemoryMap.h Thu Apr 25 07:31:53 2013
@@ -83,14 +83,26 @@ private:
         size_t          m_size;             ///< The size of the requested allocation
         uint32_t        m_permissions;      ///< The access permissions on the memory in the process.  In the host, the memory is always read/write.
         uint8_t         m_alignment;        ///< The alignment of the requested allocation
-        
-        std::unique_ptr<DataBufferHeap> m_data;
-        
+        DataBufferHeap  m_data;
         AllocationPolicy    m_policy;
-		Allocation() {}
-		Allocation(const Allocation&) {}
-	private:
-		Allocation& operator=(const Allocation&) { return *this; }
+    public:
+        Allocation (lldb::addr_t process_alloc,
+                    lldb::addr_t process_start,
+                    size_t size,
+                    uint32_t permissions,
+                    uint8_t alignment,
+                    AllocationPolicy m_policy);
+
+        Allocation () :
+            m_process_alloc (LLDB_INVALID_ADDRESS),
+            m_process_start (LLDB_INVALID_ADDRESS),
+            m_size (0),
+            m_permissions (0),
+            m_alignment (0),
+            m_data (),
+            m_policy (eAllocationPolicyInvalid)
+        {
+        }
     };
     
     lldb::ProcessWP                             m_process_wp;
@@ -101,6 +113,7 @@ private:
     lldb::addr_t FindSpace (size_t size);
     bool ContainsHostOnlyAllocations ();
     AllocationMap::iterator FindAllocation (lldb::addr_t addr, size_t size);
+    bool IntersectsAllocation (lldb::addr_t addr, size_t size);
 };
     
 }

Modified: lldb/branches/windows/include/lldb/Expression/Materializer.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Expression/Materializer.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Expression/Materializer.h (original)
+++ lldb/branches/windows/include/lldb/Expression/Materializer.h Thu Apr 25 07:31:53 2013
@@ -25,13 +25,34 @@ class Materializer
 {
 public:
     Materializer ();
+    ~Materializer ();
     
     class Dematerializer
     {
     public:
-        void Dematerialize(Error &err,
-                           lldb::addr_t frame_top,
-                           lldb::addr_t frame_bottom);
+        Dematerializer () :
+            m_materializer(NULL),
+            m_map(NULL),
+            m_process_address(LLDB_INVALID_ADDRESS)
+        {
+        }
+        
+        ~Dematerializer ()
+        {
+            Wipe ();
+        }
+        
+        void Dematerialize (Error &err,
+                            lldb::ClangExpressionVariableSP &result_sp,
+                            lldb::addr_t frame_top,
+                            lldb::addr_t frame_bottom);
+        
+        void Wipe ();
+        
+        bool IsValid ()
+        {
+            return m_materializer && m_map && (m_process_address != LLDB_INVALID_ADDRESS);
+        }
     private:
         friend class Materializer;
 
@@ -39,24 +60,27 @@ public:
                         lldb::StackFrameSP &frame_sp,
                         IRMemoryMap &map,
                         lldb::addr_t process_address) :
-            m_materializer(materializer),
+            m_materializer(&materializer),
             m_frame_wp(frame_sp),
-            m_map(map),
+            m_map(&map),
             m_process_address(process_address)
         {
         }
         
-        Materializer       &m_materializer;
+        Materializer       *m_materializer;
         lldb::StackFrameWP  m_frame_wp;
-        IRMemoryMap        &m_map;
+        IRMemoryMap        *m_map;
         lldb::addr_t        m_process_address;
     };
     
-    Dematerializer Materialize (lldb::StackFrameSP &frame_sp, lldb::ClangExpressionVariableSP &result_sp, IRMemoryMap &map, lldb::addr_t process_address, Error &err);
+    typedef std::shared_ptr<Dematerializer> DematerializerSP;
+    typedef std::weak_ptr<Dematerializer> DematerializerWP;
+    
+    DematerializerSP Materialize (lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address, Error &err);
     
     uint32_t AddPersistentVariable (lldb::ClangExpressionVariableSP &persistent_variable_sp, Error &err);
     uint32_t AddVariable (lldb::VariableSP &variable_sp, Error &err);
-    uint32_t AddResultVariable (const ClangASTType &type, bool keep_in_memory, Error &err);
+    uint32_t AddResultVariable (const TypeFromUser &type, bool is_lvalue, bool keep_in_memory, Error &err);
     uint32_t AddSymbol (const Symbol &symbol_sp, Error &err);
     uint32_t AddRegister (const RegisterInfo &register_info, Error &err);
     
@@ -70,6 +94,14 @@ public:
         return m_current_offset;
     }
     
+    uint32_t GetResultOffset ()
+    {
+        if (m_result_entity)
+            return m_result_entity->GetOffset();
+        else
+            return UINT32_MAX;
+    }
+    
     class Entity
     {
     public:
@@ -88,6 +120,7 @@ public:
         virtual void Dematerialize (lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address,
                                     lldb::addr_t frame_top, lldb::addr_t frame_bottom, Error &err) = 0;
         virtual void DumpToLog (IRMemoryMap &map, lldb::addr_t process_address, Log *log) = 0;
+        virtual void Wipe (IRMemoryMap &map, lldb::addr_t process_address) = 0;
         
         uint32_t GetAlignment ()
         {
@@ -119,14 +152,15 @@ public:
 private:
     uint32_t AddStructMember (Entity &entity);
     
-    typedef std::unique_ptr<Entity> EntityUP;
+    typedef std::unique_ptr<Entity>  EntityUP;
     typedef std::vector<EntityUP>   EntityVector;
     
-    unsigned            m_result_index;
-    Mutex               m_needs_dematerialize;
-    EntityVector        m_entities;
-    uint32_t            m_current_offset;
-    uint32_t            m_struct_alignment;
+    unsigned                        m_result_index;
+    DematerializerWP                m_dematerializer_wp;
+    EntityVector                    m_entities;
+    Entity                         *m_result_entity;
+    uint32_t                        m_current_offset;
+    uint32_t                        m_struct_alignment;
 };
     
 }

Modified: lldb/branches/windows/include/lldb/Host/DynamicLibrary.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Host/DynamicLibrary.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Host/DynamicLibrary.h (original)
+++ lldb/branches/windows/include/lldb/Host/DynamicLibrary.h Thu Apr 25 07:31:53 2013
@@ -40,6 +40,9 @@ public:
         return (T)symbol;
     }
     
+    bool
+    IsValid ();
+    
 private:
     lldb_private::FileSpec m_filespec;
     void* m_handle;

Modified: lldb/branches/windows/include/lldb/Host/Terminal.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Host/Terminal.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Host/Terminal.h (original)
+++ lldb/branches/windows/include/lldb/Host/Terminal.h Thu Apr 25 07:31:53 2013
@@ -13,7 +13,9 @@
 
 #include "lldb/lldb-private.h"
 
+#ifdef LLDB_CONFIG_TERMIOS_SUPPORTED
 struct termios;
+#endif
 
 namespace lldb_private {
 
@@ -173,7 +175,9 @@ protected:
     //------------------------------------------------------------------
     Terminal        m_tty;          ///< A terminal
     int             m_tflags;       ///< Cached tflags information.
-    std::auto_ptr<struct termios> m_termios_ap; ///< Cached terminal state information.
+#ifdef LLDB_CONFIG_TERMIOS_SUPPORTED
+    std::unique_ptr<struct termios> m_termios_ap; ///< Cached terminal state information.
+#endif
     lldb::pid_t     m_process_group;///< Cached process group information.
 
 };

Modified: lldb/branches/windows/include/lldb/Host/freebsd/Config.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Host/freebsd/Config.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Host/freebsd/Config.h (original)
+++ lldb/branches/windows/include/lldb/Host/freebsd/Config.h Thu Apr 25 07:31:53 2013
@@ -19,8 +19,6 @@
 
 #define LLDB_CONFIG_TERMIOS_SUPPORTED 1
 
-#define LLDB_CONFIG_TERMIOS_SUPPORTED 1
-
 #define LLDB_CONFIG_TILDE_RESOLVES_TO_USER 1
 
 //#define LLDB_CONFIG_DLOPEN_RTLD_FIRST_SUPPORTED 1

Modified: lldb/branches/windows/include/lldb/Interpreter/Args.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Interpreter/Args.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Interpreter/Args.h (original)
+++ lldb/branches/windows/include/lldb/Interpreter/Args.h Thu Apr 25 07:31:53 2013
@@ -27,7 +27,7 @@ namespace lldb_private {
 typedef std::pair<int, std::string> OptionArgValue;
 typedef std::pair<std::string, OptionArgValue> OptionArgPair;
 typedef std::vector<OptionArgPair> OptionArgVector;
-typedef STD_SHARED_PTR(OptionArgVector) OptionArgVectorSP;
+typedef std::shared_ptr<OptionArgVector> OptionArgVectorSP;
 
 struct OptionArgElement
 {

Modified: lldb/branches/windows/include/lldb/Interpreter/CommandInterpreter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Interpreter/CommandInterpreter.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Interpreter/CommandInterpreter.h (original)
+++ lldb/branches/windows/include/lldb/Interpreter/CommandInterpreter.h Thu Apr 25 07:31:53 2013
@@ -463,7 +463,7 @@ private:
     OptionArgMap m_alias_options;               // Stores any options (with or without arguments) that go with any alias.
     std::vector<std::string> m_command_history;
     std::string m_repeat_command;               // Stores the command that will be executed for an empty command string.
-    std::auto_ptr<ScriptInterpreter> m_script_interpreter_ap;
+    std::unique_ptr<ScriptInterpreter> m_script_interpreter_ap;
     char m_comment_char;
     char m_repeat_char;
     bool m_batch_command_mode;

Modified: lldb/branches/windows/include/lldb/Interpreter/OptionValueProperties.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Interpreter/OptionValueProperties.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Interpreter/OptionValueProperties.h (original)
+++ lldb/branches/windows/include/lldb/Interpreter/OptionValueProperties.h Thu Apr 25 07:31:53 2013
@@ -21,7 +21,9 @@
 
 namespace lldb_private {
 
-class OptionValueProperties : public OptionValue, public STD_ENABLE_SHARED_FROM_THIS(OptionValueProperties)
+class OptionValueProperties :
+    public OptionValue,
+    public std::enable_shared_from_this<OptionValueProperties>
 {
 public:
 
@@ -30,7 +32,9 @@ public:
     //---------------------------------------------------------------------
     OptionValueProperties () :
         OptionValue(),
-        m_name ()
+        m_name (),
+        m_properties (),
+        m_name_to_index ()
     {
     }
 

Modified: lldb/branches/windows/include/lldb/Interpreter/ScriptInterpreter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Interpreter/ScriptInterpreter.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Interpreter/ScriptInterpreter.h (original)
+++ lldb/branches/windows/include/lldb/Interpreter/ScriptInterpreter.h Thu Apr 25 07:31:53 2013
@@ -425,7 +425,7 @@ public:
         return lldb::ScriptInterpreterObjectSP(new ScriptInterpreterObject(object));
     }
     
-    virtual std::auto_ptr<ScriptInterpreterLocker>
+    virtual std::unique_ptr<ScriptInterpreterLocker>
     AcquireInterpreterLock ();
     
     const char *

Modified: lldb/branches/windows/include/lldb/Interpreter/ScriptInterpreterPython.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Interpreter/ScriptInterpreterPython.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Interpreter/ScriptInterpreterPython.h (original)
+++ lldb/branches/windows/include/lldb/Interpreter/ScriptInterpreterPython.h Thu Apr 25 07:31:53 2013
@@ -181,7 +181,7 @@ public:
     virtual lldb::ScriptInterpreterObjectSP
     MakeScriptObject (void* object);
     
-    virtual std::auto_ptr<ScriptInterpreterLocker>
+    virtual std::unique_ptr<ScriptInterpreterLocker>
     AcquireInterpreterLock ();
     
     void

Modified: lldb/branches/windows/include/lldb/Symbol/ClangASTContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Symbol/ClangASTContext.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Symbol/ClangASTContext.h (original)
+++ lldb/branches/windows/include/lldb/Symbol/ClangASTContext.h Thu Apr 25 07:31:53 2013
@@ -11,11 +11,11 @@
 #define liblldb_ClangASTContext_h_
 
 // C Includes
+#include <stdint.h>
+
 // C++ Includes
 #include <string>
 #include <vector>
-#include <memory>
-#include <stdint.h>
 
 // Other libraries and framework includes
 #include "llvm/ADT/OwningPtr.h"
@@ -1013,22 +1013,22 @@ protected:
     //------------------------------------------------------------------
     // Classes that inherit from ClangASTContext can see and modify these
     //------------------------------------------------------------------
-    std::string                             m_target_triple;
-    std::auto_ptr<clang::ASTContext>        m_ast_ap;
-    std::auto_ptr<clang::LangOptions>       m_language_options_ap;
-    std::auto_ptr<clang::FileManager>       m_file_manager_ap;
-    std::auto_ptr<clang::FileSystemOptions> m_file_system_options_ap;
-    std::auto_ptr<clang::SourceManager>     m_source_manager_ap;
-    std::auto_ptr<clang::DiagnosticsEngine>  m_diagnostics_engine_ap;
-    std::auto_ptr<clang::DiagnosticConsumer> m_diagnostic_consumer_ap;
+    std::string                                     m_target_triple;
+    std::unique_ptr<clang::ASTContext>               m_ast_ap;
+    std::unique_ptr<clang::LangOptions>              m_language_options_ap;
+    std::unique_ptr<clang::FileManager>              m_file_manager_ap;
+    std::unique_ptr<clang::FileSystemOptions>        m_file_system_options_ap;
+    std::unique_ptr<clang::SourceManager>            m_source_manager_ap;
+    std::unique_ptr<clang::DiagnosticsEngine>        m_diagnostics_engine_ap;
+    std::unique_ptr<clang::DiagnosticConsumer>       m_diagnostic_consumer_ap;
     llvm::IntrusiveRefCntPtr<clang::TargetOptions>  m_target_options_rp;
-    std::auto_ptr<clang::TargetInfo>        m_target_info_ap;
-    std::auto_ptr<clang::IdentifierTable>   m_identifier_table_ap;
-    std::auto_ptr<clang::SelectorTable>     m_selector_table_ap;
-    std::auto_ptr<clang::Builtin::Context>  m_builtins_ap;
-    CompleteTagDeclCallback                 m_callback_tag_decl;
-    CompleteObjCInterfaceDeclCallback       m_callback_objc_decl;
-    void *                                  m_callback_baton;
+    std::unique_ptr<clang::TargetInfo>               m_target_info_ap;
+    std::unique_ptr<clang::IdentifierTable>          m_identifier_table_ap;
+    std::unique_ptr<clang::SelectorTable>            m_selector_table_ap;
+    std::unique_ptr<clang::Builtin::Context>         m_builtins_ap;
+    CompleteTagDeclCallback                         m_callback_tag_decl;
+    CompleteObjCInterfaceDeclCallback               m_callback_objc_decl;
+    void *                                          m_callback_baton;
 private:
     //------------------------------------------------------------------
     // For ClangASTContext only

Modified: lldb/branches/windows/include/lldb/Symbol/ClangASTImporter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Symbol/ClangASTImporter.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Symbol/ClangASTImporter.h (original)
+++ lldb/branches/windows/include/lldb/Symbol/ClangASTImporter.h Thu Apr 25 07:31:53 2013
@@ -162,7 +162,7 @@ public:
     //
     
     typedef std::vector < std::pair<lldb::ModuleSP, ClangNamespaceDecl> > NamespaceMap;
-    typedef STD_SHARED_PTR(NamespaceMap) NamespaceMapSP;
+    typedef std::shared_ptr<NamespaceMap> NamespaceMapSP;
     
     void RegisterNamespaceMap (const clang::NamespaceDecl *decl, 
                                NamespaceMapSP &namespace_map);
@@ -290,7 +290,7 @@ private:
         clang::ASTContext              *m_source_ctx;
     };
     
-    typedef STD_SHARED_PTR(Minion) MinionSP;
+    typedef std::shared_ptr<Minion> MinionSP;
     typedef std::map<clang::ASTContext *, MinionSP> MinionMap;
     typedef std::map<const clang::NamespaceDecl *, NamespaceMapSP> NamespaceMetaMap;
     
@@ -313,7 +313,7 @@ private:
         MapCompleter           *m_map_completer;
     };
     
-    typedef STD_SHARED_PTR(ASTContextMetadata) ASTContextMetadataSP;    
+    typedef std::shared_ptr<ASTContextMetadata> ASTContextMetadataSP;    
     typedef std::map<const clang::ASTContext *, ASTContextMetadataSP> ContextMetadataMap;
     
     ContextMetadataMap m_metadata_map;

Modified: lldb/branches/windows/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h (original)
+++ lldb/branches/windows/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h Thu Apr 25 07:31:53 2013
@@ -14,7 +14,6 @@
 // C++ Includes
 #include <string>
 #include <vector>
-#include <memory>
 #include <stdint.h>
 
 // Other libraries and framework includes

Modified: lldb/branches/windows/include/lldb/Symbol/CompileUnit.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Symbol/CompileUnit.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Symbol/CompileUnit.h (original)
+++ lldb/branches/windows/include/lldb/Symbol/CompileUnit.h Thu Apr 25 07:31:53 2013
@@ -32,7 +32,7 @@ namespace lldb_private {
 /// files), and a line table.
 //----------------------------------------------------------------------
 class CompileUnit :
-    public STD_ENABLE_SHARED_FROM_THIS(CompileUnit),
+    public std::enable_shared_from_this<CompileUnit>,
     public ModuleChild,
     public FileSpec,
     public UserID,
@@ -401,7 +401,7 @@ protected:
     std::vector<lldb::FunctionSP> m_functions; ///< The sparsely populated list of shared pointers to functions
                                          ///< that gets populated as functions get partially parsed.
     FileSpecList m_support_files; ///< Files associated with this compile unit's line table and declarations.
-    std::auto_ptr<LineTable> m_line_table_ap; ///< Line table that will get parsed on demand.
+    std::unique_ptr<LineTable> m_line_table_ap; ///< Line table that will get parsed on demand.
     lldb::VariableListSP m_variables; ///< Global and static variable list that will get parsed on demand.
 
 private:

Modified: lldb/branches/windows/include/lldb/Symbol/DWARFCallFrameInfo.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Symbol/DWARFCallFrameInfo.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Symbol/DWARFCallFrameInfo.h (original)
+++ lldb/branches/windows/include/lldb/Symbol/DWARFCallFrameInfo.h Thu Apr 25 07:31:53 2013
@@ -98,7 +98,7 @@ private:
                                   inst_length (0), ptr_encoding (0), initial_row() {}
     };
 
-    typedef STD_SHARED_PTR(CIE) CIESP;
+    typedef std::shared_ptr<CIE> CIESP;
 
     typedef std::map<off_t, CIESP> cie_map_t;
 

Modified: lldb/branches/windows/include/lldb/Symbol/FuncUnwinders.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Symbol/FuncUnwinders.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Symbol/FuncUnwinders.h (original)
+++ lldb/branches/windows/include/lldb/Symbol/FuncUnwinders.h Thu Apr 25 07:31:53 2013
@@ -1,9 +1,6 @@
 #ifndef liblldb_FuncUnwinders_h
 #define liblldb_FuncUnwinders_h
 
-
-#include <memory>
-
 #include "lldb/Core/AddressRange.h"
 #include "lldb/Core/ArchSpec.h"
 #include "lldb/Core/AddressRange.h"

Modified: lldb/branches/windows/include/lldb/Symbol/ObjectFile.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Symbol/ObjectFile.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Symbol/ObjectFile.h (original)
+++ lldb/branches/windows/include/lldb/Symbol/ObjectFile.h Thu Apr 25 07:31:53 2013
@@ -50,7 +50,7 @@ namespace lldb_private {
 /// this abstract class.
 //----------------------------------------------------------------------
 class ObjectFile:
-    public STD_ENABLE_SHARED_FROM_THIS(ObjectFile),
+    public std::enable_shared_from_this<ObjectFile>,
     public PluginInterface,
     public ModuleChild
 {
@@ -178,6 +178,18 @@ public:
                 lldb::DataBufferSP &file_data_sp);
 
     
+    static size_t
+    GetModuleSpecifications (const FileSpec &file,
+                             lldb::offset_t file_offset,
+                             ModuleSpecList &specs);
+    
+    static size_t
+    GetModuleSpecifications (const lldb_private::FileSpec& file,
+                             lldb::DataBufferSP& data_sp,
+                             lldb::offset_t data_offset,
+                             lldb::offset_t file_offset,
+                             lldb::offset_t length,
+                             lldb_private::ModuleSpecList &specs);
     //------------------------------------------------------------------
     /// Split a path into a file path with object name.
     ///
@@ -621,8 +633,8 @@ protected:
     lldb_private::UnwindTable m_unwind_table; /// < Table of FuncUnwinders objects created for this ObjectFile's functions
     lldb::ProcessWP m_process_wp;
     const lldb::addr_t m_memory_addr;
-    std::auto_ptr<lldb_private::SectionList> m_sections_ap;
-    std::auto_ptr<lldb_private::Symtab> m_symtab_ap;
+    std::unique_ptr<lldb_private::SectionList> m_sections_ap;
+    std::unique_ptr<lldb_private::Symtab> m_symtab_ap;
     
     //------------------------------------------------------------------
     /// Sets the architecture for a module.  At present the architecture

Modified: lldb/branches/windows/include/lldb/Symbol/SymbolContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Symbol/SymbolContext.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Symbol/SymbolContext.h (original)
+++ lldb/branches/windows/include/lldb/Symbol/SymbolContext.h Thu Apr 25 07:31:53 2013
@@ -367,12 +367,12 @@ private:
     lldb::TargetSP                 m_target_sp;
     std::string                    m_module_spec;
     lldb::ModuleSP                 m_module_sp;
-    std::auto_ptr<FileSpec>        m_file_spec_ap;
+    std::unique_ptr<FileSpec>       m_file_spec_ap;
     size_t                         m_start_line;
     size_t                         m_end_line;
     std::string                    m_function_spec;
     std::string                    m_class_name;
-    std::auto_ptr<AddressRange>    m_address_range_ap;
+    std::unique_ptr<AddressRange>   m_address_range_ap;
     uint32_t                       m_type; // Or'ed bits from SpecificationType
 
 };

Modified: lldb/branches/windows/include/lldb/Symbol/SymbolVendor.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Symbol/SymbolVendor.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Symbol/SymbolVendor.h (original)
+++ lldb/branches/windows/include/lldb/Symbol/SymbolVendor.h Thu Apr 25 07:31:53 2013
@@ -191,7 +191,7 @@ protected:
     TypeList m_type_list; // Uniqued types for all parsers owned by this module
     CompileUnits m_compile_units; // The current compile units
     lldb::ObjectFileSP m_objfile_sp;    // Keep a reference to the object file in case it isn't the same as the module object file (debug symbols in a separate file)
-    std::auto_ptr<SymbolFile> m_sym_file_ap; // A single symbol file. Suclasses can add more of these if needed.
+    std::unique_ptr<SymbolFile> m_sym_file_ap; // A single symbol file. Suclasses can add more of these if needed.
 
 private:
     //------------------------------------------------------------------

Modified: lldb/branches/windows/include/lldb/Symbol/Type.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Symbol/Type.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Symbol/Type.h (original)
+++ lldb/branches/windows/include/lldb/Symbol/Type.h Thu Apr 25 07:31:53 2013
@@ -21,7 +21,7 @@
 namespace lldb_private {
 
 class SymbolFileType :
-    public STD_ENABLE_SHARED_FROM_THIS(SymbolFileType),
+    public std::enable_shared_from_this<SymbolFileType>,
     public UserID
     {
     public:
@@ -50,7 +50,7 @@ class SymbolFileType :
     };
     
 class Type :
-    public STD_ENABLE_SHARED_FROM_THIS(Type),
+    public std::enable_shared_from_this<Type>,
     public UserID
 {
 public:

Modified: lldb/branches/windows/include/lldb/Symbol/UnwindPlan.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Symbol/UnwindPlan.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Symbol/UnwindPlan.h (original)
+++ lldb/branches/windows/include/lldb/Symbol/UnwindPlan.h Thu Apr 25 07:31:53 2013
@@ -342,7 +342,7 @@ public:
 
 public:
 
-    typedef STD_SHARED_PTR(Row) RowSP;
+    typedef std::shared_ptr<Row> RowSP;
 
     UnwindPlan (lldb::RegisterKind reg_kind) : 
         m_row_list (), 

Modified: lldb/branches/windows/include/lldb/Target/Memory.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Target/Memory.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Target/Memory.h (original)
+++ lldb/branches/windows/include/lldb/Target/Memory.h Thu Apr 25 07:31:53 2013
@@ -170,7 +170,7 @@ namespace lldb_private {
         DeallocateMemory (lldb::addr_t ptr);
         
     protected:
-        typedef STD_SHARED_PTR(AllocatedBlock) AllocatedBlockSP;
+        typedef std::shared_ptr<AllocatedBlock> AllocatedBlockSP;
 
         AllocatedBlockSP
         AllocatePage (uint32_t byte_size, 

Modified: lldb/branches/windows/include/lldb/Target/ObjCLanguageRuntime.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Target/ObjCLanguageRuntime.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Target/ObjCLanguageRuntime.h (original)
+++ lldb/branches/windows/include/lldb/Target/ObjCLanguageRuntime.h Thu Apr 25 07:31:53 2013
@@ -138,7 +138,7 @@ public:
     typedef lldb::addr_t ObjCISA;
     
     class ClassDescriptor;
-    typedef STD_SHARED_PTR(ClassDescriptor) ClassDescriptorSP;
+    typedef std::shared_ptr<ClassDescriptor> ClassDescriptorSP;
     
     // the information that we want to support retrieving from an ObjC class
     // this needs to be pure virtual since there are at least 2 different implementations
@@ -199,7 +199,8 @@ public:
         
         virtual bool
         GetTaggedPointerInfo (uint64_t* info_bits = NULL,
-                              uint64_t* value_bits = NULL) = 0;
+                              uint64_t* value_bits = NULL,
+                              uint64_t* payload = NULL) = 0;
         
         virtual uint64_t
         GetInstanceSize () = 0;
@@ -258,10 +259,10 @@ public:
     GetNonKVOClassDescriptor (ValueObject& in_value);
 
     virtual ClassDescriptorSP
-    GetClassDescriptor (const ConstString &class_name);
+    GetClassDescriptorFromClassName (const ConstString &class_name);
 
     virtual ClassDescriptorSP
-    GetClassDescriptor (ObjCISA isa);
+    GetClassDescriptorFromISA (ObjCISA isa);
 
     ClassDescriptorSP
     GetNonKVOClassDescriptor (ObjCISA isa);

Modified: lldb/branches/windows/include/lldb/Target/Process.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Target/Process.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Target/Process.h (original)
+++ lldb/branches/windows/include/lldb/Target/Process.h Thu Apr 25 07:31:53 2013
@@ -97,7 +97,7 @@ public:
     SetStopOnSharedLibraryEvents (bool stop);
 };
 
-typedef STD_SHARED_PTR(ProcessProperties) ProcessPropertiesSP;
+typedef std::shared_ptr<ProcessProperties> ProcessPropertiesSP;
 
 //----------------------------------------------------------------------
 // ProcessInfo
@@ -1349,7 +1349,7 @@ protected:
 /// @brief A plug-in interface definition class for debugging a process.
 //----------------------------------------------------------------------
 class Process :
-    public STD_ENABLE_SHARED_FROM_THIS(Process),
+    public std::enable_shared_from_this<Process>,
     public ProcessProperties,
     public UserID,
     public Broadcaster,
@@ -2688,6 +2688,42 @@ public:
                 Error &error);
 
     //------------------------------------------------------------------
+    /// Read a NULL terminated string from memory
+    ///
+    /// This function will read a cache page at a time until a NULL
+    /// string terminator is found. It will stop reading if an aligned
+    /// sequence of NULL termination \a type_width bytes is not found
+    /// before reading \a cstr_max_len bytes.  The results are always 
+    /// guaranteed to be NULL terminated, and that no more than
+    /// (max_bytes - type_width) bytes will be read.
+    ///
+    /// @param[in] vm_addr
+    ///     The virtual load address to start the memory read.
+    ///
+    /// @param[in] str
+    ///     A character buffer containing at least max_bytes.
+    ///
+    /// @param[in] max_bytes
+    ///     The maximum number of bytes to read.
+    ///
+    /// @param[in] error
+    ///     The error status of the read operation.
+    ///
+    /// @param[in] type_width
+    ///     The size of the null terminator (1 to 4 bytes per
+    ///     character).  Defaults to 1.
+    ///
+    /// @return
+    ///     The error status or the number of bytes prior to the null terminator.
+    //------------------------------------------------------------------
+    size_t
+    ReadStringFromMemory (lldb::addr_t vm_addr, 
+                           char *str, 
+                           size_t max_bytes,
+                           Error &error,
+                           size_t type_width = 1);
+
+    //------------------------------------------------------------------
     /// Read a NULL terminated C string from memory
     ///
     /// This function will read a cache page at a time until the NULL
@@ -3463,10 +3499,17 @@ public:
     ReadWriteLock &
     GetRunLock ()
     {
+#if defined(__APPLE__)
+        // The "m_private_run_lock" causes problems for other platforms
+        // right now, so we are leaving this in for Apple builds only
+        // until we can get the kinks worked out.
         if (Host::GetCurrentThread() == m_private_state_thread)
             return m_private_run_lock;
         else
             return m_public_run_lock;
+#else
+        return m_public_run_lock;
+#endif
     }
 
 protected:
@@ -3587,9 +3630,9 @@ protected:
     std::vector<lldb::addr_t>   m_image_tokens;
     Listener                    &m_listener;
     BreakpointSiteList          m_breakpoint_site_list; ///< This is the list of breakpoint locations we intend to insert in the target.
-    std::auto_ptr<DynamicLoader> m_dyld_ap;
-    std::auto_ptr<DynamicCheckerFunctions> m_dynamic_checkers_ap; ///< The functions used by the expression parser to validate data that expressions use.
-    std::auto_ptr<OperatingSystem> m_os_ap;
+    std::unique_ptr<DynamicLoader> m_dyld_ap;
+    std::unique_ptr<DynamicCheckerFunctions> m_dynamic_checkers_ap; ///< The functions used by the expression parser to validate data that expressions use.
+    std::unique_ptr<OperatingSystem> m_os_ap;
     UnixSignals                 m_unix_signals;         /// This is the current signal set for this process.
     lldb::ABISP                 m_abi_sp;
     lldb::InputReaderSP         m_process_input_reader;
@@ -3603,10 +3646,12 @@ protected:
     AllocatedMemoryCache        m_allocated_memory_cache;
     bool                        m_should_detach;   /// Should we detach if the process object goes away with an explicit call to Kill or Detach?
     LanguageRuntimeCollection   m_language_runtimes;
-    std::auto_ptr<NextEventAction> m_next_event_action_ap;
+    std::unique_ptr<NextEventAction> m_next_event_action_ap;
     std::vector<PreResumeCallbackAndBaton> m_pre_resume_actions;
     ReadWriteLock               m_public_run_lock;
+#if defined(__APPLE__)
     ReadWriteLock               m_private_run_lock;
+#endif
     Predicate<bool>             m_currently_handling_event;
     bool                        m_finalize_called;
     lldb::StateType             m_last_broadcast_state;   /// This helps with the Public event coalescing in ShouldBroadcastEvent.

Modified: lldb/branches/windows/include/lldb/Target/RegisterContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Target/RegisterContext.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Target/RegisterContext.h (original)
+++ lldb/branches/windows/include/lldb/Target/RegisterContext.h Thu Apr 25 07:31:53 2013
@@ -20,7 +20,7 @@
 namespace lldb_private {
 
 class RegisterContext :
-    public STD_ENABLE_SHARED_FROM_THIS(RegisterContext),
+    public std::enable_shared_from_this<RegisterContext>,
     public ExecutionContextScope
 {
 public:

Modified: lldb/branches/windows/include/lldb/Target/StackFrame.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Target/StackFrame.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Target/StackFrame.h (original)
+++ lldb/branches/windows/include/lldb/Target/StackFrame.h Thu Apr 25 07:31:53 2013
@@ -27,7 +27,7 @@
 namespace lldb_private {
 
 class StackFrame :
-    public STD_ENABLE_SHARED_FROM_THIS(StackFrame),
+    public std::enable_shared_from_this<StackFrame>,
     public ExecutionContextScope
 {
 public:

Modified: lldb/branches/windows/include/lldb/Target/StackFrameList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Target/StackFrameList.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Target/StackFrameList.h (original)
+++ lldb/branches/windows/include/lldb/Target/StackFrameList.h Thu Apr 25 07:31:53 2013
@@ -98,7 +98,7 @@ protected:
     SetFrameAtIndex (uint32_t idx, lldb::StackFrameSP &frame_sp);
 
     static void
-    Merge (std::auto_ptr<StackFrameList>& curr_ap, 
+    Merge (std::unique_ptr<StackFrameList>& curr_ap,
            lldb::StackFrameListSP& prev_sp);
 
     void

Modified: lldb/branches/windows/include/lldb/Target/Target.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Target/Target.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Target/Target.h (original)
+++ lldb/branches/windows/include/lldb/Target/Target.h Thu Apr 25 07:31:53 2013
@@ -149,7 +149,7 @@ public:
     
 };
 
-typedef STD_SHARED_PTR(TargetProperties) TargetPropertiesSP;
+typedef std::shared_ptr<TargetProperties> TargetPropertiesSP;
 
 class EvaluateExpressionOptions
 {
@@ -285,7 +285,7 @@ private:
 // Target
 //----------------------------------------------------------------------
 class Target :
-    public STD_ENABLE_SHARED_FROM_THIS(Target),
+    public std::enable_shared_from_this<Target>,
     public TargetProperties,
     public Broadcaster,
     public ExecutionContextScope,
@@ -1023,7 +1023,7 @@ public:
         lldb::TargetSP m_target_sp;
         StringList   m_commands;
         lldb::SymbolContextSpecifierSP m_specifier_sp;
-        std::auto_ptr<ThreadSpec> m_thread_spec_ap;
+        std::unique_ptr<ThreadSpec> m_thread_spec_ap;
         bool m_active;
         
         // Use AddStopHook to make a new empty stop hook.  The GetCommandPointer and fill it with commands,
@@ -1031,7 +1031,7 @@ public:
         StopHook (lldb::TargetSP target_sp, lldb::user_id_t uid);
         friend class Target;
     };
-    typedef STD_SHARED_PTR(StopHook) StopHookSP;
+    typedef std::shared_ptr<StopHook> StopHookSP;
     
     // Add an empty stop hook to the Target's stop hook list, and returns a shared pointer to it in new_hook.  
     // Returns the id of the new hook.        
@@ -1159,12 +1159,12 @@ protected:
     bool m_valid;
     lldb::SearchFilterSP  m_search_filter_sp;
     PathMappingList m_image_search_paths;
-    std::auto_ptr<ClangASTContext> m_scratch_ast_context_ap;
-    std::auto_ptr<ClangASTSource> m_scratch_ast_source_ap;
-    std::auto_ptr<ClangASTImporter> m_ast_importer_ap;
+    std::unique_ptr<ClangASTContext> m_scratch_ast_context_ap;
+    std::unique_ptr<ClangASTSource> m_scratch_ast_source_ap;
+    std::unique_ptr<ClangASTImporter> m_ast_importer_ap;
     ClangPersistentVariables m_persistent_variables;      ///< These are the persistent variables associated with this process for the expression parser.
 
-    std::auto_ptr<SourceManager> m_source_manager_ap;
+    std::unique_ptr<SourceManager> m_source_manager_ap;
 
     typedef std::map<lldb::user_id_t, StopHookSP> StopHookCollection;
     StopHookCollection      m_stop_hooks;

Modified: lldb/branches/windows/include/lldb/Target/Thread.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Target/Thread.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Target/Thread.h (original)
+++ lldb/branches/windows/include/lldb/Target/Thread.h Thu Apr 25 07:31:53 2013
@@ -47,18 +47,15 @@ public:
     GetTraceEnabledState() const;
 };
 
-typedef STD_SHARED_PTR(ThreadProperties) ThreadPropertiesSP;
+typedef std::shared_ptr<ThreadProperties> ThreadPropertiesSP;
 
 class Thread :
-    public STD_ENABLE_SHARED_FROM_THIS(Thread),
+    public std::enable_shared_from_this<Thread>,
     public ThreadProperties,
     public UserID,
     public ExecutionContextScope,
     public Broadcaster
 {
-friend class ThreadEventData;
-friend class ThreadList;
-
 public:
     //------------------------------------------------------------------
     /// Broadcaster event bits definitions.
@@ -421,6 +418,12 @@ public:
     {
         return false;
     }
+    
+    virtual lldb::ThreadSP
+    GetBackingThread () const
+    {
+        return lldb::ThreadSP();
+    }
 
     virtual void
     ClearBackingThread ()
@@ -899,6 +902,7 @@ protected:
 
     friend class ThreadPlan;
     friend class ThreadList;
+    friend class ThreadEventData;
     friend class StackFrameList;
     friend class StackFrame;
     
@@ -968,7 +972,7 @@ protected:
     lldb::StateType     m_resume_state;         ///< This state is used to force a thread to be suspended from outside the ThreadPlan logic.
     lldb::StateType     m_temporary_resume_state; ///< This state records what the thread was told to do by the thread plan logic for the current resume.
                                                   /// It gets set in Thread::WillResume.
-    std::auto_ptr<lldb_private::Unwind> m_unwinder_ap;
+    std::unique_ptr<lldb_private::Unwind> m_unwinder_ap;
     bool                m_destroy_called;       // This is used internally to make sure derived Thread classes call DestroyThread.
     uint32_t m_thread_stop_reason_stop_id;      // This is the stop id for which the StopInfo is valid.  Can use this so you know that
                                                 // the thread's m_actual_stop_info_sp is current and you don't have to fetch it again

Modified: lldb/branches/windows/include/lldb/Target/ThreadPlanStepInRange.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Target/ThreadPlanStepInRange.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Target/ThreadPlanStepInRange.h (original)
+++ lldb/branches/windows/include/lldb/Target/ThreadPlanStepInRange.h Thu Apr 25 07:31:53 2013
@@ -93,7 +93,7 @@ private:
     // from step in.
 
     static uint32_t s_default_flag_values;
-    std::auto_ptr<RegularExpression> m_avoid_regexp_ap;
+    std::unique_ptr<RegularExpression> m_avoid_regexp_ap;
     bool m_step_past_prologue;  // FIXME: For now hard-coded to true, we could put a switch in for this if there's
                                 // demand for that.
     bool m_virtual_step;        // true if we've just done a "virtual step", i.e. just moved the inline stack depth.

Modified: lldb/branches/windows/include/lldb/Utility/PriorityPointerPair.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Utility/PriorityPointerPair.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Utility/PriorityPointerPair.h (original)
+++ lldb/branches/windows/include/lldb/Utility/PriorityPointerPair.h Thu Apr 25 07:31:53 2013
@@ -30,7 +30,7 @@ public:
     typedef T& reference_type;
     typedef T* pointer_type;
     
-    typedef typename STD_SHARED_PTR(T) T_SP;
+    typedef typename std::shared_ptr<T> T_SP;
     
     PriorityPointerPair() : 
     m_high(),

Modified: lldb/branches/windows/include/lldb/Utility/PythonPointer.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Utility/PythonPointer.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Utility/PythonPointer.h (original)
+++ lldb/branches/windows/include/lldb/Utility/PythonPointer.h Thu Apr 25 07:31:53 2013
@@ -11,7 +11,6 @@
 #define utility_PythonPointer_h_
 
 #include <algorithm>
-#include <memory>
 
 #if defined (__APPLE__)
 #include <Python/Python.h>

Modified: lldb/branches/windows/include/lldb/Utility/SharingPtr.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Utility/SharingPtr.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Utility/SharingPtr.h (original)
+++ lldb/branches/windows/include/lldb/Utility/SharingPtr.h Thu Apr 25 07:31:53 2013
@@ -213,7 +213,7 @@ template<class Y>
 SharingPtr<T>::SharingPtr(Y* p)
     : ptr_(p), cntrl_(0)
 {
-    std::auto_ptr<Y> hold(p);
+    std::unique_ptr<Y> hold(p);
     typedef imp::shared_ptr_pointer<Y*> _CntrlBlk;
     cntrl_ = new _CntrlBlk(p);
     hold.release();

Modified: lldb/branches/windows/include/lldb/lldb-forward.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/lldb-forward.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/lldb-forward.h (original)
+++ lldb/branches/windows/include/lldb/lldb-forward.h Thu Apr 25 07:31:53 2013
@@ -12,22 +12,6 @@
 
 #if defined(__cplusplus)
 
-#include <ciso646>  // detect C++ lib
-
-#if defined(_LIBCPP_VERSION) || defined(_MSC_VER)
-#include <memory>
-#define STD_SHARED_PTR(T) std::shared_ptr<T>
-#define STD_WEAK_PTR(T) std::weak_ptr<T>
-#define STD_ENABLE_SHARED_FROM_THIS(T) std::enable_shared_from_this<T>
-#define STD_STATIC_POINTER_CAST(T,V) std::static_pointer_cast<T>(V)
-#else
-#include <tr1/memory>
-#define STD_SHARED_PTR(T) std::tr1::shared_ptr<T>
-#define STD_WEAK_PTR(T) std::tr1::weak_ptr<T>
-#define STD_ENABLE_SHARED_FROM_THIS(T) std::tr1::enable_shared_from_this<T>
-#define STD_STATIC_POINTER_CAST(T,V) std::tr1::static_pointer_cast<T>(V)
-#endif
-
 #include "lldb/Utility/SharingPtr.h"
 
 //----------------------------------------------------------------------
@@ -129,6 +113,7 @@ class   Materializer;
 class   Module;
 class   ModuleList;
 class   ModuleSpec;
+class   ModuleSpecList;
 class   Mutex;
 struct  NameSearchContext;
 class   ObjCLanguageRuntime;
@@ -275,116 +260,116 @@ struct  LineEntry;
 //----------------------------------------------------------------------
 namespace lldb {
     
-    typedef STD_SHARED_PTR(lldb_private::ABI) ABISP;
-    typedef STD_SHARED_PTR(lldb_private::Baton) BatonSP;
-    typedef STD_SHARED_PTR(lldb_private::Block) BlockSP;
-    typedef STD_SHARED_PTR(lldb_private::Breakpoint) BreakpointSP;
-    typedef STD_WEAK_PTR(  lldb_private::Breakpoint) BreakpointWP;
-    typedef STD_SHARED_PTR(lldb_private::BreakpointSite) BreakpointSiteSP;
-    typedef STD_WEAK_PTR(  lldb_private::BreakpointSite) BreakpointSiteWP;
-    typedef STD_SHARED_PTR(lldb_private::BreakpointLocation) BreakpointLocationSP;
-    typedef STD_WEAK_PTR(  lldb_private::BreakpointLocation) BreakpointLocationWP;
-    typedef STD_SHARED_PTR(lldb_private::BreakpointResolver) BreakpointResolverSP;
-    typedef STD_SHARED_PTR(lldb_private::Broadcaster) BroadcasterSP;
-    typedef STD_SHARED_PTR(lldb_private::ClangExpressionVariable) ClangExpressionVariableSP;
-    typedef STD_SHARED_PTR(lldb_private::CommandObject) CommandObjectSP;
-    typedef STD_SHARED_PTR(lldb_private::Communication) CommunicationSP;
-    typedef STD_SHARED_PTR(lldb_private::Connection) ConnectionSP;
-    typedef STD_SHARED_PTR(lldb_private::CompileUnit) CompUnitSP;
-    typedef STD_SHARED_PTR(lldb_private::DataBuffer) DataBufferSP;
-    typedef STD_SHARED_PTR(lldb_private::DataExtractor) DataExtractorSP;
-    typedef STD_SHARED_PTR(lldb_private::Debugger) DebuggerSP;
-    typedef STD_WEAK_PTR(  lldb_private::Debugger) DebuggerWP;
-    typedef STD_SHARED_PTR(lldb_private::Disassembler) DisassemblerSP;
-    typedef STD_SHARED_PTR(lldb_private::DynamicLibrary) DynamicLibrarySP;
-    typedef STD_SHARED_PTR(lldb_private::DynamicLoader) DynamicLoaderSP;
-    typedef STD_SHARED_PTR(lldb_private::Event) EventSP;
-    typedef STD_SHARED_PTR(lldb_private::ExecutionContextRef) ExecutionContextRefSP;
-    typedef STD_SHARED_PTR(lldb_private::Function) FunctionSP;
-    typedef STD_SHARED_PTR(lldb_private::FuncUnwinders) FuncUnwindersSP;
-    typedef STD_SHARED_PTR(lldb_private::InlineFunctionInfo) InlineFunctionInfoSP;
-    typedef STD_SHARED_PTR(lldb_private::InputReader) InputReaderSP;
-    typedef STD_SHARED_PTR(lldb_private::Instruction) InstructionSP;
-    typedef STD_SHARED_PTR(lldb_private::LanguageRuntime) LanguageRuntimeSP;
-    typedef STD_SHARED_PTR(lldb_private::LineTable) LineTableSP;
-    typedef STD_SHARED_PTR(lldb_private::Listener) ListenerSP;
-    typedef STD_SHARED_PTR(lldb_private::LogChannel) LogChannelSP;
-    typedef STD_SHARED_PTR(lldb_private::Module) ModuleSP;
-    typedef STD_WEAK_PTR(  lldb_private::Module) ModuleWP;
-    typedef STD_SHARED_PTR(lldb_private::ObjectFile) ObjectFileSP;
-    typedef STD_WEAK_PTR(  lldb_private::ObjectFile) ObjectFileWP;
-    typedef STD_SHARED_PTR(lldb_private::OptionValue) OptionValueSP;
-    typedef STD_WEAK_PTR(  lldb_private::OptionValue) OptionValueWP;
-    typedef STD_SHARED_PTR(lldb_private::OptionValueArch) OptionValueArchSP;
-    typedef STD_SHARED_PTR(lldb_private::OptionValueArgs) OptionValueArgsSP;
-    typedef STD_SHARED_PTR(lldb_private::OptionValueArray) OptionValueArraySP;
-    typedef STD_SHARED_PTR(lldb_private::OptionValueBoolean) OptionValueBooleanSP;
-    typedef STD_SHARED_PTR(lldb_private::OptionValueDictionary) OptionValueDictionarySP;
-    typedef STD_SHARED_PTR(lldb_private::OptionValueFileSpec) OptionValueFileSpecSP;
-    typedef STD_SHARED_PTR(lldb_private::OptionValueFileSpecList) OptionValueFileSpecListSP;
-    typedef STD_SHARED_PTR(lldb_private::OptionValueFormat) OptionValueFormatSP;
-    typedef STD_SHARED_PTR(lldb_private::OptionValuePathMappings) OptionValuePathMappingsSP;
-    typedef STD_SHARED_PTR(lldb_private::OptionValueProperties) OptionValuePropertiesSP;
-    typedef STD_SHARED_PTR(lldb_private::OptionValueRegex) OptionValueRegexSP;
-    typedef STD_SHARED_PTR(lldb_private::OptionValueSInt64) OptionValueSInt64SP;
-    typedef STD_SHARED_PTR(lldb_private::OptionValueString) OptionValueStringSP;
-    typedef STD_SHARED_PTR(lldb_private::OptionValueUInt64) OptionValueUInt64SP;
-    typedef STD_SHARED_PTR(lldb_private::OptionValueUUID) OptionValueUUIDSP;
-    typedef STD_SHARED_PTR(lldb_private::Platform) PlatformSP;
-    typedef STD_SHARED_PTR(lldb_private::Process) ProcessSP;
-    typedef STD_SHARED_PTR(lldb_private::ProcessAttachInfo) ProcessAttachInfoSP;
-    typedef STD_SHARED_PTR(lldb_private::ProcessLaunchInfo) ProcessLaunchInfoSP;
-    typedef STD_WEAK_PTR(  lldb_private::Process) ProcessWP;
-    typedef STD_SHARED_PTR(lldb_private::Property) PropertySP;
-    typedef STD_SHARED_PTR(lldb_private::RegisterContext) RegisterContextSP;
-    typedef STD_SHARED_PTR(lldb_private::RegularExpression) RegularExpressionSP;
-    typedef STD_SHARED_PTR(lldb_private::ScriptInterpreterObject) ScriptInterpreterObjectSP;
+    typedef std::shared_ptr<lldb_private::ABI> ABISP;
+    typedef std::shared_ptr<lldb_private::Baton> BatonSP;
+    typedef std::shared_ptr<lldb_private::Block> BlockSP;
+    typedef std::shared_ptr<lldb_private::Breakpoint> BreakpointSP;
+    typedef std::weak_ptr<lldb_private::Breakpoint> BreakpointWP;
+    typedef std::shared_ptr<lldb_private::BreakpointSite> BreakpointSiteSP;
+    typedef std::weak_ptr<lldb_private::BreakpointSite> BreakpointSiteWP;
+    typedef std::shared_ptr<lldb_private::BreakpointLocation> BreakpointLocationSP;
+    typedef std::weak_ptr<lldb_private::BreakpointLocation> BreakpointLocationWP;
+    typedef std::shared_ptr<lldb_private::BreakpointResolver> BreakpointResolverSP;
+    typedef std::shared_ptr<lldb_private::Broadcaster> BroadcasterSP;
+    typedef std::shared_ptr<lldb_private::ClangExpressionVariable> ClangExpressionVariableSP;
+    typedef std::shared_ptr<lldb_private::CommandObject> CommandObjectSP;
+    typedef std::shared_ptr<lldb_private::Communication> CommunicationSP;
+    typedef std::shared_ptr<lldb_private::Connection> ConnectionSP;
+    typedef std::shared_ptr<lldb_private::CompileUnit> CompUnitSP;
+    typedef std::shared_ptr<lldb_private::DataBuffer> DataBufferSP;
+    typedef std::shared_ptr<lldb_private::DataExtractor> DataExtractorSP;
+    typedef std::shared_ptr<lldb_private::Debugger> DebuggerSP;
+    typedef std::weak_ptr<lldb_private::Debugger> DebuggerWP;
+    typedef std::shared_ptr<lldb_private::Disassembler> DisassemblerSP;
+    typedef std::shared_ptr<lldb_private::DynamicLibrary> DynamicLibrarySP;
+    typedef std::shared_ptr<lldb_private::DynamicLoader> DynamicLoaderSP;
+    typedef std::shared_ptr<lldb_private::Event> EventSP;
+    typedef std::shared_ptr<lldb_private::ExecutionContextRef> ExecutionContextRefSP;
+    typedef std::shared_ptr<lldb_private::Function> FunctionSP;
+    typedef std::shared_ptr<lldb_private::FuncUnwinders> FuncUnwindersSP;
+    typedef std::shared_ptr<lldb_private::InlineFunctionInfo> InlineFunctionInfoSP;
+    typedef std::shared_ptr<lldb_private::InputReader> InputReaderSP;
+    typedef std::shared_ptr<lldb_private::Instruction> InstructionSP;
+    typedef std::shared_ptr<lldb_private::LanguageRuntime> LanguageRuntimeSP;
+    typedef std::shared_ptr<lldb_private::LineTable> LineTableSP;
+    typedef std::shared_ptr<lldb_private::Listener> ListenerSP;
+    typedef std::shared_ptr<lldb_private::LogChannel> LogChannelSP;
+    typedef std::shared_ptr<lldb_private::Module> ModuleSP;
+    typedef std::weak_ptr<lldb_private::Module> ModuleWP;
+    typedef std::shared_ptr<lldb_private::ObjectFile> ObjectFileSP;
+    typedef std::weak_ptr<lldb_private::ObjectFile> ObjectFileWP;
+    typedef std::shared_ptr<lldb_private::OptionValue> OptionValueSP;
+    typedef std::weak_ptr<lldb_private::OptionValue> OptionValueWP;
+    typedef std::shared_ptr<lldb_private::OptionValueArch> OptionValueArchSP;
+    typedef std::shared_ptr<lldb_private::OptionValueArgs> OptionValueArgsSP;
+    typedef std::shared_ptr<lldb_private::OptionValueArray> OptionValueArraySP;
+    typedef std::shared_ptr<lldb_private::OptionValueBoolean> OptionValueBooleanSP;
+    typedef std::shared_ptr<lldb_private::OptionValueDictionary> OptionValueDictionarySP;
+    typedef std::shared_ptr<lldb_private::OptionValueFileSpec> OptionValueFileSpecSP;
+    typedef std::shared_ptr<lldb_private::OptionValueFileSpecList> OptionValueFileSpecListSP;
+    typedef std::shared_ptr<lldb_private::OptionValueFormat> OptionValueFormatSP;
+    typedef std::shared_ptr<lldb_private::OptionValuePathMappings> OptionValuePathMappingsSP;
+    typedef std::shared_ptr<lldb_private::OptionValueProperties> OptionValuePropertiesSP;
+    typedef std::shared_ptr<lldb_private::OptionValueRegex> OptionValueRegexSP;
+    typedef std::shared_ptr<lldb_private::OptionValueSInt64> OptionValueSInt64SP;
+    typedef std::shared_ptr<lldb_private::OptionValueString> OptionValueStringSP;
+    typedef std::shared_ptr<lldb_private::OptionValueUInt64> OptionValueUInt64SP;
+    typedef std::shared_ptr<lldb_private::OptionValueUUID> OptionValueUUIDSP;
+    typedef std::shared_ptr<lldb_private::Platform> PlatformSP;
+    typedef std::shared_ptr<lldb_private::Process> ProcessSP;
+    typedef std::shared_ptr<lldb_private::ProcessAttachInfo> ProcessAttachInfoSP;
+    typedef std::shared_ptr<lldb_private::ProcessLaunchInfo> ProcessLaunchInfoSP;
+    typedef std::weak_ptr<lldb_private::Process> ProcessWP;
+    typedef std::shared_ptr<lldb_private::Property> PropertySP;
+    typedef std::shared_ptr<lldb_private::RegisterContext> RegisterContextSP;
+    typedef std::shared_ptr<lldb_private::RegularExpression> RegularExpressionSP;
+    typedef std::shared_ptr<lldb_private::ScriptInterpreterObject> ScriptInterpreterObjectSP;
 #ifndef LLDB_DISABLE_PYTHON
-    typedef STD_SHARED_PTR(lldb_private::ScriptSummaryFormat) ScriptSummaryFormatSP;
+    typedef std::shared_ptr<lldb_private::ScriptSummaryFormat> ScriptSummaryFormatSP;
 #endif // #ifndef LLDB_DISABLE_PYTHON
-    typedef STD_SHARED_PTR(lldb_private::Section) SectionSP;
-    typedef STD_WEAK_PTR(  lldb_private::Section) SectionWP;
-    typedef STD_SHARED_PTR(lldb_private::SearchFilter) SearchFilterSP;
-    typedef STD_SHARED_PTR(lldb_private::Settings) SettingsSP;
-    typedef STD_SHARED_PTR(lldb_private::StackFrame) StackFrameSP;
-    typedef STD_WEAK_PTR(  lldb_private::StackFrame) StackFrameWP;
-    typedef STD_SHARED_PTR(lldb_private::StackFrameList) StackFrameListSP;
-    typedef STD_SHARED_PTR(lldb_private::StopInfo) StopInfoSP;
-    typedef STD_SHARED_PTR(lldb_private::StoppointLocation) StoppointLocationSP;
-    typedef STD_SHARED_PTR(lldb_private::Stream) StreamSP;
-    typedef STD_WEAK_PTR  (lldb_private::Stream) StreamWP;
-    typedef STD_SHARED_PTR(lldb_private::StringSummaryFormat) StringTypeSummaryImplSP;
-    typedef STD_SHARED_PTR(lldb_private::SymbolFile) SymbolFileSP;
-    typedef STD_SHARED_PTR(lldb_private::SymbolFileType) SymbolFileTypeSP;
-    typedef STD_WEAK_PTR(  lldb_private::SymbolFileType) SymbolFileTypeWP;
-    typedef STD_SHARED_PTR(lldb_private::SymbolContextSpecifier) SymbolContextSpecifierSP;
-    typedef STD_SHARED_PTR(lldb_private::SyntheticChildren) SyntheticChildrenSP;
-    typedef STD_SHARED_PTR(lldb_private::SyntheticChildrenFrontEnd) SyntheticChildrenFrontEndSP;
-    typedef STD_SHARED_PTR(lldb_private::Target) TargetSP;
-    typedef STD_WEAK_PTR(  lldb_private::Target) TargetWP;
-    typedef STD_SHARED_PTR(lldb_private::Thread) ThreadSP;
-    typedef STD_WEAK_PTR(  lldb_private::Thread) ThreadWP;
-    typedef STD_SHARED_PTR(lldb_private::ThreadPlan) ThreadPlanSP;
-    typedef STD_SHARED_PTR(lldb_private::ThreadPlanTracer) ThreadPlanTracerSP;
-    typedef STD_SHARED_PTR(lldb_private::Type) TypeSP;
-    typedef STD_WEAK_PTR(  lldb_private::Type) TypeWP;
-    typedef STD_SHARED_PTR(lldb_private::TypeCategoryImpl) TypeCategoryImplSP;
-    typedef STD_SHARED_PTR(lldb_private::TypeImpl) TypeImplSP;
-    typedef STD_SHARED_PTR(lldb_private::TypeFilterImpl) TypeFilterImplSP;
-    typedef STD_SHARED_PTR(lldb_private::TypeFormatImpl) TypeFormatImplSP;
-    typedef STD_SHARED_PTR(lldb_private::TypeNameSpecifierImpl) TypeNameSpecifierImplSP;
-    typedef STD_SHARED_PTR(lldb_private::TypeSummaryImpl) TypeSummaryImplSP;
+    typedef std::shared_ptr<lldb_private::Section> SectionSP;
+    typedef std::weak_ptr<lldb_private::Section> SectionWP;
+    typedef std::shared_ptr<lldb_private::SearchFilter> SearchFilterSP;
+    typedef std::shared_ptr<lldb_private::Settings> SettingsSP;
+    typedef std::shared_ptr<lldb_private::StackFrame> StackFrameSP;
+    typedef std::weak_ptr<lldb_private::StackFrame> StackFrameWP;
+    typedef std::shared_ptr<lldb_private::StackFrameList> StackFrameListSP;
+    typedef std::shared_ptr<lldb_private::StopInfo> StopInfoSP;
+    typedef std::shared_ptr<lldb_private::StoppointLocation> StoppointLocationSP;
+    typedef std::shared_ptr<lldb_private::Stream> StreamSP;
+    typedef std::weak_ptr<lldb_private::Stream> StreamWP;
+    typedef std::shared_ptr<lldb_private::StringSummaryFormat> StringTypeSummaryImplSP;
+    typedef std::shared_ptr<lldb_private::SymbolFile> SymbolFileSP;
+    typedef std::shared_ptr<lldb_private::SymbolFileType> SymbolFileTypeSP;
+    typedef std::weak_ptr<lldb_private::SymbolFileType> SymbolFileTypeWP;
+    typedef std::shared_ptr<lldb_private::SymbolContextSpecifier> SymbolContextSpecifierSP;
+    typedef std::shared_ptr<lldb_private::SyntheticChildren> SyntheticChildrenSP;
+    typedef std::shared_ptr<lldb_private::SyntheticChildrenFrontEnd> SyntheticChildrenFrontEndSP;
+    typedef std::shared_ptr<lldb_private::Target> TargetSP;
+    typedef std::weak_ptr<lldb_private::Target> TargetWP;
+    typedef std::shared_ptr<lldb_private::Thread> ThreadSP;
+    typedef std::weak_ptr<lldb_private::Thread> ThreadWP;
+    typedef std::shared_ptr<lldb_private::ThreadPlan> ThreadPlanSP;
+    typedef std::shared_ptr<lldb_private::ThreadPlanTracer> ThreadPlanTracerSP;
+    typedef std::shared_ptr<lldb_private::Type> TypeSP;
+    typedef std::weak_ptr<lldb_private::Type> TypeWP;
+    typedef std::shared_ptr<lldb_private::TypeCategoryImpl> TypeCategoryImplSP;
+    typedef std::shared_ptr<lldb_private::TypeImpl> TypeImplSP;
+    typedef std::shared_ptr<lldb_private::TypeFilterImpl> TypeFilterImplSP;
+    typedef std::shared_ptr<lldb_private::TypeFormatImpl> TypeFormatImplSP;
+    typedef std::shared_ptr<lldb_private::TypeNameSpecifierImpl> TypeNameSpecifierImplSP;
+    typedef std::shared_ptr<lldb_private::TypeSummaryImpl> TypeSummaryImplSP;
 #ifndef LLDB_DISABLE_PYTHON
-    typedef STD_SHARED_PTR(lldb_private::ScriptedSyntheticChildren) ScriptedSyntheticChildrenSP;
+    typedef std::shared_ptr<lldb_private::ScriptedSyntheticChildren> ScriptedSyntheticChildrenSP;
 #endif
-    typedef STD_SHARED_PTR(lldb_private::UnwindPlan) UnwindPlanSP;
+    typedef std::shared_ptr<lldb_private::UnwindPlan> UnwindPlanSP;
     typedef lldb_private::SharingPtr<lldb_private::ValueObject> ValueObjectSP;
-    typedef STD_SHARED_PTR(lldb_private::Value) ValueSP;
-    typedef STD_SHARED_PTR(lldb_private::ValueList) ValueListSP;
-    typedef STD_SHARED_PTR(lldb_private::Variable) VariableSP;
-    typedef STD_SHARED_PTR(lldb_private::VariableList) VariableListSP;
-    typedef STD_SHARED_PTR(lldb_private::ValueObjectList) ValueObjectListSP;
-    typedef STD_SHARED_PTR(lldb_private::Watchpoint) WatchpointSP;
+    typedef std::shared_ptr<lldb_private::Value> ValueSP;
+    typedef std::shared_ptr<lldb_private::ValueList> ValueListSP;
+    typedef std::shared_ptr<lldb_private::Variable> VariableSP;
+    typedef std::shared_ptr<lldb_private::VariableList> VariableListSP;
+    typedef std::shared_ptr<lldb_private::ValueObjectList> ValueObjectListSP;
+    typedef std::shared_ptr<lldb_private::Watchpoint> WatchpointSP;
     
 } // namespace lldb
 

Modified: lldb/branches/windows/include/lldb/lldb-private-interfaces.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/lldb-private-interfaces.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/lldb-private-interfaces.h (original)
+++ lldb/branches/windows/include/lldb/lldb-private-interfaces.h Thu Apr 25 07:31:53 2013
@@ -20,6 +20,7 @@ namespace lldb_private
     typedef Disassembler* (*DisassemblerCreateInstance) (const ArchSpec &arch, const char *flavor);
     typedef DynamicLoader* (*DynamicLoaderCreateInstance) (Process* process, bool force);
     typedef ObjectContainer* (*ObjectContainerCreateInstance) (const lldb::ModuleSP &module_sp, lldb::DataBufferSP& data_sp, lldb::offset_t data_offset, const FileSpec *file, lldb::offset_t offset, lldb::offset_t length);
+    typedef size_t (*ObjectFileGetModuleSpecifications) (const FileSpec &file, lldb::DataBufferSP& data_sp, lldb::offset_t data_offset, lldb::offset_t file_offset, lldb::offset_t length, ModuleSpecList &module_specs);
     typedef ObjectFile* (*ObjectFileCreateInstance) (const lldb::ModuleSP &module_sp, lldb::DataBufferSP& data_sp, lldb::offset_t data_offset, const FileSpec* file, lldb::offset_t file_offset, lldb::offset_t length);
     typedef ObjectFile* (*ObjectFileCreateMemoryInstance) (const lldb::ModuleSP &module_sp, lldb::DataBufferSP& data_sp, const lldb::ProcessSP &process_sp, lldb::addr_t offset);
     typedef LogChannel* (*LogChannelCreateInstance) ();

Modified: lldb/branches/windows/include/lldb/lldb-types.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/lldb-types.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/lldb-types.h (original)
+++ lldb/branches/windows/include/lldb/lldb-types.h Thu Apr 25 07:31:53 2013
@@ -25,7 +25,6 @@
 //  lldb::thread_arg_t      The type of the one any only thread creation argument for the host system
 //  lldb::thread_result_t   The return type that gets returned when a thread finishes.
 //  lldb::thread_func_t     The function prototype used to spawn a thread on the host system.
-//  lldb::SharedPtr         The template that wraps up the host version of a reference counted pointer (like boost::shared_ptr)
 //  #define LLDB_INVALID_PROCESS_ID ...
 //  #define LLDB_INVALID_THREAD_ID ...
 //  #define LLDB_INVALID_HOST_THREAD ...

Modified: lldb/branches/windows/include/lldb/lldb-windows.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/lldb-windows.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/lldb-windows.h (original)
+++ lldb/branches/windows/include/lldb/lldb-windows.h Thu Apr 25 07:31:53 2013
@@ -163,7 +163,6 @@ extern int optreset;
 #define SIGUSR2 31	
 
 
-
 #endif  // defined(__cplusplus)
 
 

Modified: lldb/branches/windows/lldb.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/lldb.xcodeproj/project.pbxproj?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/branches/windows/lldb.xcodeproj/project.pbxproj Thu Apr 25 07:31:53 2013
@@ -522,6 +522,8 @@
 		941BCC8014E48C4000BB969C /* SBTypeFormat.h in Headers */ = {isa = PBXBuildFile; fileRef = 9461568714E355F2003A195C /* SBTypeFormat.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		941BCC8114E48C4000BB969C /* SBTypeSummary.h in Headers */ = {isa = PBXBuildFile; fileRef = 9461568814E355F2003A195C /* SBTypeSummary.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		941BCC8214E48C4000BB969C /* SBTypeSynthetic.h in Headers */ = {isa = PBXBuildFile; fileRef = 9461568914E355F2003A195C /* SBTypeSynthetic.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		944372DC171F6B4300E57C32 /* RegisterContextDummy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 944372DA171F6B4300E57C32 /* RegisterContextDummy.cpp */; };
+		944372DD171F6B4300E57C32 /* RegisterContextDummy.h in Headers */ = {isa = PBXBuildFile; fileRef = 944372DB171F6B4300E57C32 /* RegisterContextDummy.h */; };
 		9443B122140C18C40013457C /* SBData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9443B121140C18C10013457C /* SBData.cpp */; };
 		9443B123140C26AB0013457C /* SBData.h in Headers */ = {isa = PBXBuildFile; fileRef = 9443B120140C18A90013457C /* SBData.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		9452573A16262D0200325455 /* SBDeclaration.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9452573916262D0200325455 /* SBDeclaration.cpp */; };
@@ -1557,6 +1559,8 @@
 		940DB8E116EA674000D3C2F1 /* Xcode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Xcode.cpp; sourceTree = "<group>"; };
 		940DB8E216EA674000D3C2F1 /* Xcode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Xcode.h; sourceTree = "<group>"; };
 		940DB8E616EA709400D3C2F1 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = "<group>"; };
+		944372DA171F6B4300E57C32 /* RegisterContextDummy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RegisterContextDummy.cpp; path = Utility/RegisterContextDummy.cpp; sourceTree = "<group>"; };
+		944372DB171F6B4300E57C32 /* RegisterContextDummy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RegisterContextDummy.h; path = Utility/RegisterContextDummy.h; sourceTree = "<group>"; };
 		9443B120140C18A90013457C /* SBData.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SBData.h; path = include/lldb/API/SBData.h; sourceTree = "<group>"; };
 		9443B121140C18C10013457C /* SBData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBData.cpp; path = source/API/SBData.cpp; sourceTree = "<group>"; };
 		9452573616262CD000325455 /* SBDeclaration.i */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c.preprocessed; path = SBDeclaration.i; sourceTree = "<group>"; };
@@ -2511,6 +2515,8 @@
 				26957D9513D381C900670048 /* RegisterContextDarwin_i386.h */,
 				26957D9613D381C900670048 /* RegisterContextDarwin_x86_64.cpp */,
 				26957D9713D381C900670048 /* RegisterContextDarwin_x86_64.h */,
+				944372DA171F6B4300E57C32 /* RegisterContextDummy.cpp */,
+				944372DB171F6B4300E57C32 /* RegisterContextDummy.h */,
 				AF68D2541255416E002FF25B /* RegisterContextLLDB.cpp */,
 				AF68D2551255416E002FF25B /* RegisterContextLLDB.h */,
 				262D24E413FB8710002D1960 /* RegisterContextMemory.cpp */,
@@ -3599,6 +3605,7 @@
 				260D9B2715EC369500960137 /* ModuleSpec.h in Headers */,
 				947A1D651616476B0017C8D1 /* CommandObjectPlugin.h in Headers */,
 				262ED0051631FA2800879631 /* OptionGroupString.h in Headers */,
+				944372DD171F6B4300E57C32 /* RegisterContextDummy.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -4146,6 +4153,7 @@
 				268900CB13353E5F00698AC0 /* LogChannelDWARF.cpp in Sources */,
 				268900CC13353E5F00698AC0 /* SymbolFileDWARFDebugMap.cpp in Sources */,
 				268900CD13353E5F00698AC0 /* UniqueDWARFASTType.cpp in Sources */,
+				944372DC171F6B4300E57C32 /* RegisterContextDummy.cpp in Sources */,
 				268900CE13353E5F00698AC0 /* SymbolFileSymtab.cpp in Sources */,
 				268900CF13353E5F00698AC0 /* SymbolVendorMacOSX.cpp in Sources */,
 				268900D013353E6F00698AC0 /* Block.cpp in Sources */,

Modified: lldb/branches/windows/scripts/Python/finish-swig-Python-LLDB.sh
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/scripts/Python/finish-swig-Python-LLDB.sh?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/scripts/Python/finish-swig-Python-LLDB.sh (original)
+++ lldb/branches/windows/scripts/Python/finish-swig-Python-LLDB.sh Thu Apr 25 07:31:53 2013
@@ -244,7 +244,8 @@ if [ ${OS_NAME} = "Darwin" ]
 then
     # lldb/macosx
     package_files="${SRC_ROOT}/examples/python/crashlog.py
-    ${SRC_ROOT}/examples/darwin/heap_find/heap.py"
+    ${SRC_ROOT}/examples/darwin/heap_find/heap.py
+    ${SRC_ROOT}/examples/python/unwind_diagnose.py"
     create_python_package "/macosx" "${package_files}"
 
     # Copy files needed by lldb/macosx/heap.py to build libheap.dylib

Modified: lldb/branches/windows/scripts/Python/interface/SBExpressionOptions.i
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/scripts/Python/interface/SBExpressionOptions.i?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/scripts/Python/interface/SBExpressionOptions.i (original)
+++ lldb/branches/windows/scripts/Python/interface/SBExpressionOptions.i Thu Apr 25 07:31:53 2013
@@ -83,7 +83,7 @@ protected:
 
 private:
     // This auto_pointer is made in the constructor and is always valid.
-    mutable std::auto_ptr<lldb_private::EvaluateExpressionOptions> m_opaque_ap;
+    mutable std::unique_ptr<lldb_private::EvaluateExpressionOptions> m_opaque_ap;
 };
 
 } // namespace lldb

Modified: lldb/branches/windows/scripts/Python/interface/SBSection.i
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/scripts/Python/interface/SBSection.i?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/scripts/Python/interface/SBSection.i (original)
+++ lldb/branches/windows/scripts/Python/interface/SBSection.i Thu Apr 25 07:31:53 2013
@@ -122,7 +122,7 @@ public:
 
 private:
 
-    std::auto_ptr<lldb_private::SectionImpl> m_opaque_ap;
+    std::unique_ptr<lldb_private::SectionImpl> m_opaque_ap;
 };
 
 } // namespace lldb

Modified: lldb/branches/windows/scripts/Python/interface/SBType.i
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/scripts/Python/interface/SBType.i?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/scripts/Python/interface/SBType.i (original)
+++ lldb/branches/windows/scripts/Python/interface/SBType.i Thu Apr 25 07:31:53 2013
@@ -65,7 +65,7 @@ public:
     %}
 
 protected:
-    std::auto_ptr<lldb_private::TypeMemberImpl> m_opaque_ap;
+    std::unique_ptr<lldb_private::TypeMemberImpl> m_opaque_ap;
 };
 
 %feature("docstring",

Modified: lldb/branches/windows/scripts/Python/python-wrapper.swig
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/scripts/Python/python-wrapper.swig?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/scripts/Python/python-wrapper.swig (original)
+++ lldb/branches/windows/scripts/Python/python-wrapper.swig Thu Apr 25 07:31:53 2013
@@ -652,11 +652,11 @@ LLDBSWIGPython_CastPyObjectToSBValue
     return sb_ptr;
 }
 
-// Currently, SBCommandReturnObjectReleaser wraps an std::auto_ptr to an
+// Currently, SBCommandReturnObjectReleaser wraps a unique pointer to an
 // lldb_private::CommandReturnObject. This means that the destructor for the
 // SB object will deallocate its contained CommandReturnObject. Because that
 // object is used as the real return object for Python-based commands, we want
-// it to stay around. Thus, we release the auto_ptr before returning from
+// it to stay around. Thus, we release the unique pointer before returning from
 // LLDBSwigPythonCallCommand, and to guarantee that the release will occur no
 // matter how we exit from the function, we have a releaser object whose
 // destructor does the right thing for us

Modified: lldb/branches/windows/source/API/SBTypeCategory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/API/SBTypeCategory.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/API/SBTypeCategory.cpp (original)
+++ lldb/branches/windows/source/API/SBTypeCategory.cpp Thu Apr 25 07:31:53 2013
@@ -169,7 +169,7 @@ SBTypeCategory::GetFilterForType (SBType
     if (!children_sp)
         return lldb::SBTypeFilter();
     
-    TypeFilterImplSP filter_sp = STD_STATIC_POINTER_CAST(TypeFilterImpl,children_sp);
+    TypeFilterImplSP filter_sp = std::static_pointer_cast<TypeFilterImpl>(children_sp);
     
     return lldb::SBTypeFilter(filter_sp);
 
@@ -233,7 +233,7 @@ SBTypeCategory::GetSyntheticForType (SBT
     if (!children_sp)
         return lldb::SBTypeSynthetic();
     
-    ScriptedSyntheticChildrenSP synth_sp = STD_STATIC_POINTER_CAST(ScriptedSyntheticChildren,children_sp);
+    ScriptedSyntheticChildrenSP synth_sp = std::static_pointer_cast<ScriptedSyntheticChildren>(children_sp);
     
     return lldb::SBTypeSynthetic(synth_sp);
 }
@@ -250,7 +250,7 @@ SBTypeCategory::GetFilterAtIndex (uint32
     if (!children_sp.get())
         return lldb::SBTypeFilter();
     
-    TypeFilterImplSP filter_sp = STD_STATIC_POINTER_CAST(TypeFilterImpl,children_sp);
+    TypeFilterImplSP filter_sp = std::static_pointer_cast<TypeFilterImpl>(children_sp);
     
     return lldb::SBTypeFilter(filter_sp);
 }
@@ -285,7 +285,7 @@ SBTypeCategory::GetSyntheticAtIndex (uin
     if (!children_sp.get())
         return lldb::SBTypeSynthetic();
     
-    ScriptedSyntheticChildrenSP synth_sp = STD_STATIC_POINTER_CAST(ScriptedSyntheticChildren,children_sp);
+    ScriptedSyntheticChildrenSP synth_sp = std::static_pointer_cast<ScriptedSyntheticChildren>(children_sp);
     
     return lldb::SBTypeSynthetic(synth_sp);
 }

Modified: lldb/branches/windows/source/API/SBValue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/API/SBValue.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/API/SBValue.cpp (original)
+++ lldb/branches/windows/source/API/SBValue.cpp Thu Apr 25 07:31:53 2013
@@ -52,103 +52,101 @@
 using namespace lldb;
 using namespace lldb_private;
 
-namespace {
-    class ValueImpl
+class ValueImpl
+{
+public:
+    ValueImpl ()
     {
-    public:
-        ValueImpl ()
-        {
-        }
-        
-        ValueImpl (lldb::ValueObjectSP opaque_sp,
-                   lldb::DynamicValueType use_dynamic,
-                   bool use_synthetic) :
-            m_opaque_sp(opaque_sp),
-            m_use_dynamic(use_dynamic),
-            m_use_synthetic(use_synthetic)
-        {
-        }
-        
-        ValueImpl (const ValueImpl& rhs) :
-            m_opaque_sp(rhs.m_opaque_sp),
-            m_use_dynamic(rhs.m_use_dynamic),
-            m_use_synthetic(rhs.m_use_synthetic)
-        {
-        }
-        
-        ValueImpl &
-        operator = (const ValueImpl &rhs)
-        {
-            if (this != &rhs)
-            {
-                m_opaque_sp = rhs.m_opaque_sp;
-                m_use_dynamic = rhs.m_use_dynamic;
-                m_use_synthetic = rhs.m_use_synthetic;
-            }
-            return *this;
-        }
-        
-        bool
-        IsValid ()
+    }
+    
+    ValueImpl (lldb::ValueObjectSP opaque_sp,
+               lldb::DynamicValueType use_dynamic,
+               bool use_synthetic) :
+        m_opaque_sp(opaque_sp),
+        m_use_dynamic(use_dynamic),
+        m_use_synthetic(use_synthetic)
+    {
+    }
+    
+    ValueImpl (const ValueImpl& rhs) :
+        m_opaque_sp(rhs.m_opaque_sp),
+        m_use_dynamic(rhs.m_use_dynamic),
+        m_use_synthetic(rhs.m_use_synthetic)
+    {
+    }
+    
+    ValueImpl &
+    operator = (const ValueImpl &rhs)
+    {
+        if (this != &rhs)
         {
-            return m_opaque_sp.get() != NULL;
+            m_opaque_sp = rhs.m_opaque_sp;
+            m_use_dynamic = rhs.m_use_dynamic;
+            m_use_synthetic = rhs.m_use_synthetic;
         }
-        
-        lldb::ValueObjectSP
-        GetRootSP ()
-        {
+        return *this;
+    }
+    
+    bool
+    IsValid ()
+    {
+        return m_opaque_sp.get() != NULL;
+    }
+    
+    lldb::ValueObjectSP
+    GetRootSP ()
+    {
+        return m_opaque_sp;
+    }
+    
+    lldb::ValueObjectSP
+    GetSP ()
+    {
+        if (!m_opaque_sp)
             return m_opaque_sp;
-        }
-        
-        lldb::ValueObjectSP
-        GetSP ()
-        {
-            if (!m_opaque_sp)
-                return m_opaque_sp;
-            lldb::ValueObjectSP value_sp = m_opaque_sp;
-            
-            Mutex::Locker api_lock;
-            Target *target = value_sp->GetTargetSP().get();
-            if (target)
-                api_lock.Lock(target->GetAPIMutex());
-            
-            if (value_sp->GetDynamicValue(m_use_dynamic))
-                value_sp = value_sp->GetDynamicValue(m_use_dynamic);
-            if (value_sp->GetSyntheticValue(m_use_synthetic))
-                value_sp = value_sp->GetSyntheticValue(m_use_synthetic);
-            return value_sp;
-        }
-        
-        void
-        SetUseDynamic (lldb::DynamicValueType use_dynamic)
-        {
-            m_use_dynamic = use_dynamic;
-        }
+        lldb::ValueObjectSP value_sp = m_opaque_sp;
         
-        void
-        SetUseSynthetic (bool use_synthetic)
-        {
-            m_use_synthetic = use_synthetic;
-        }
-        
-        lldb::DynamicValueType
-        GetUseDynamic ()
-        {
-            return m_use_dynamic;
-        }
-        
-        bool
-        GetUseSynthetic ()
-        {
-            return m_use_synthetic;
-        }
-        
-    private:
-        lldb::ValueObjectSP m_opaque_sp;
-        lldb::DynamicValueType m_use_dynamic;
-        bool m_use_synthetic;
-    };
-}
+        Mutex::Locker api_lock;
+        Target *target = value_sp->GetTargetSP().get();
+        if (target)
+            api_lock.Lock(target->GetAPIMutex());
+        
+        if (value_sp->GetDynamicValue(m_use_dynamic))
+            value_sp = value_sp->GetDynamicValue(m_use_dynamic);
+        if (value_sp->GetSyntheticValue(m_use_synthetic))
+            value_sp = value_sp->GetSyntheticValue(m_use_synthetic);
+        return value_sp;
+    }
+    
+    void
+    SetUseDynamic (lldb::DynamicValueType use_dynamic)
+    {
+        m_use_dynamic = use_dynamic;
+    }
+    
+    void
+    SetUseSynthetic (bool use_synthetic)
+    {
+        m_use_synthetic = use_synthetic;
+    }
+    
+    lldb::DynamicValueType
+    GetUseDynamic ()
+    {
+        return m_use_dynamic;
+    }
+    
+    bool
+    GetUseSynthetic ()
+    {
+        return m_use_synthetic;
+    }
+    
+private:
+    lldb::ValueObjectSP m_opaque_sp;
+    lldb::DynamicValueType m_use_dynamic;
+    bool m_use_synthetic;
+};
 
 SBValue::SBValue () :
     m_opaque_sp ()
@@ -708,7 +706,7 @@ SBValue::GetTypeFilter ()
                     
                     if (synthetic_sp && !synthetic_sp->IsScripted())
                     {
-                        TypeFilterImplSP filter_sp = STD_STATIC_POINTER_CAST(TypeFilterImpl,synthetic_sp);
+                        TypeFilterImplSP filter_sp = std::static_pointer_cast<TypeFilterImpl>(synthetic_sp);
                         filter.SetSP(filter_sp);
                     }
                 }
@@ -746,7 +744,7 @@ SBValue::GetTypeSynthetic ()
                     
                     if (children_sp && children_sp->IsScripted())
                     {
-                        ScriptedSyntheticChildrenSP synth_sp = STD_STATIC_POINTER_CAST(ScriptedSyntheticChildren,children_sp);
+                        ScriptedSyntheticChildrenSP synth_sp = std::static_pointer_cast<ScriptedSyntheticChildren>(children_sp);
                         synthetic.SetSP(synth_sp);
                     }
                 }

Modified: lldb/branches/windows/source/API/SBValueList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/API/SBValueList.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/API/SBValueList.cpp (original)
+++ lldb/branches/windows/source/API/SBValueList.cpp Thu Apr 25 07:31:53 2013
@@ -19,10 +19,9 @@
 using namespace lldb;
 using namespace lldb_private;
 
-namespace {
-    class ValueListImpl
-    {
-    public:
+class ValueListImpl
+{
+public:
         ValueListImpl () :
         m_values()
         {
@@ -80,11 +79,9 @@ namespace {
             return lldb::SBValue();
         }
 
-    private:
+private:
         std::vector<lldb::SBValue> m_values;
-    };
-}
-
+};
 
 SBValueList::SBValueList () :
     m_opaque_ap ()

Modified: lldb/branches/windows/source/Breakpoint/BreakpointLocation.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Breakpoint/BreakpointLocation.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Breakpoint/BreakpointLocation.cpp (original)
+++ lldb/branches/windows/source/Breakpoint/BreakpointLocation.cpp Thu Apr 25 07:31:53 2013
@@ -240,9 +240,109 @@ BreakpointLocation::SetCondition (const
 }
 
 const char *
-BreakpointLocation::GetConditionText () const
+BreakpointLocation::GetConditionText (size_t *hash) const
 {
-    return GetOptionsNoCreate()->GetConditionText();
+    return GetOptionsNoCreate()->GetConditionText(hash);
+}
+
+bool
+BreakpointLocation::ConditionSaysStop (ExecutionContext &exe_ctx, Error &error)
+{
+    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
+    
+    size_t condition_hash;
+    const char *condition_text = GetConditionText(&condition_hash);
+    
+    if (!condition_text)
+        return false;
+    
+    if (condition_hash != m_condition_hash ||
+        !m_user_expression_sp ||
+        !m_user_expression_sp->MatchesContext(exe_ctx))
+    {
+        m_user_expression_sp.reset(new ClangUserExpression(condition_text,
+                                                           NULL,
+                                                           lldb::eLanguageTypeUnknown,
+                                                           ClangUserExpression::eResultTypeAny));
+        
+        StreamString errors;
+        
+        if (!m_user_expression_sp->Parse(errors,
+                                         exe_ctx,
+                                         eExecutionPolicyOnlyWhenNeeded,
+                                         true))
+        {
+            error.SetErrorStringWithFormat("Couldn't parse conditional expression:\n%s",
+                                           errors.GetData());
+            m_user_expression_sp.reset();
+            return false;
+        }
+        
+        m_condition_hash = condition_hash;
+    }
+
+    // We need to make sure the user sees any parse errors in their condition, so we'll hook the
+    // constructor errors up to the debugger's Async I/O.
+        
+    ValueObjectSP result_value_sp;
+    const bool unwind_on_error = true;
+    const bool ignore_breakpoints = true;
+    const bool try_all_threads = true;
+    
+    Error expr_error;
+    
+    StreamString execution_errors;
+    
+    ClangExpressionVariableSP result_variable_sp;
+    
+    ExecutionResults result_code =
+    m_user_expression_sp->Execute(execution_errors,
+                                  exe_ctx,
+                                  unwind_on_error,
+                                  ignore_breakpoints,
+                                  m_user_expression_sp,
+                                  result_variable_sp,
+                                  try_all_threads,
+                                  ClangUserExpression::kDefaultTimeout);
+    
+    bool ret;
+    
+    if (result_code == eExecutionCompleted)
+    {
+        result_value_sp = result_variable_sp->GetValueObject();
+
+        if (result_value_sp)
+        {
+            Scalar scalar_value;
+            if (result_value_sp->ResolveValue (scalar_value))
+            {
+                if (scalar_value.ULongLong(1) == 0)
+                    ret = false;
+                else
+                    ret = true;
+                if (log)
+                    log->Printf("Condition successfully evaluated, result is %s.\n",
+                                ret ? "true" : "false");
+            }
+            else
+            {
+                ret = false;
+                error.SetErrorString("Failed to get an integer result from the expression");
+            }
+        }
+        else
+        {
+            ret = false;
+            error.SetErrorString("Failed to get any result from the expression");
+        }
+    }
+    else
+    {
+        ret = false;
+        error.SetErrorStringWithFormat("Couldn't execute expression:\n%s", execution_errors.GetData());
+    }
+    
+    return ret;
 }
 
 uint32_t

Modified: lldb/branches/windows/source/Breakpoint/BreakpointOptions.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Breakpoint/BreakpointOptions.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Breakpoint/BreakpointOptions.cpp (original)
+++ lldb/branches/windows/source/Breakpoint/BreakpointOptions.cpp Thu Apr 25 07:31:53 2013
@@ -41,8 +41,9 @@ BreakpointOptions::BreakpointOptions() :
     m_enabled (true),
     m_one_shot (false),
     m_ignore_count (0),
-    m_thread_spec_ap (NULL),
-    m_condition_ap()
+    m_thread_spec_ap (),
+    m_condition_text (),
+    m_condition_text_hash (0)
 {
 }
 
@@ -56,13 +57,12 @@ BreakpointOptions::BreakpointOptions(con
     m_enabled (rhs.m_enabled),
     m_one_shot (rhs.m_one_shot),
     m_ignore_count (rhs.m_ignore_count),
-    m_thread_spec_ap (NULL),
-    m_condition_ap (NULL)
+    m_thread_spec_ap ()
 {
     if (rhs.m_thread_spec_ap.get() != NULL)
         m_thread_spec_ap.reset (new ThreadSpec(*rhs.m_thread_spec_ap.get()));
-    if (rhs.m_condition_ap.get())
-        m_condition_ap.reset (new ClangUserExpression (rhs.m_condition_ap->GetUserText(), NULL, lldb::eLanguageTypeUnknown, ClangUserExpression::eResultTypeAny));
+    m_condition_text = rhs.m_condition_text;
+    m_condition_text_hash = rhs.m_condition_text_hash;
 }
 
 //----------------------------------------------------------------------
@@ -79,8 +79,8 @@ BreakpointOptions::operator=(const Break
     m_ignore_count = rhs.m_ignore_count;
     if (rhs.m_thread_spec_ap.get() != NULL)
         m_thread_spec_ap.reset(new ThreadSpec(*rhs.m_thread_spec_ap.get()));
-    if (rhs.m_condition_ap.get())
-        m_condition_ap.reset (new ClangUserExpression (rhs.m_condition_ap->GetUserText(), NULL, lldb::eLanguageTypeUnknown, ClangUserExpression::eResultTypeAny));
+    m_condition_text = rhs.m_condition_text;
+    m_condition_text_hash = rhs.m_condition_text_hash;
     return *this;
 }
 
@@ -162,24 +162,25 @@ BreakpointOptions::HasCallback ()
 void 
 BreakpointOptions::SetCondition (const char *condition)
 {
-    if (condition == NULL || condition[0] == '\0')
-    {
-        if (m_condition_ap.get())
-            m_condition_ap.reset();
-    }
-    else
-    {
-        m_condition_ap.reset(new ClangUserExpression (condition, NULL, lldb::eLanguageTypeUnknown, ClangUserExpression::eResultTypeAny));
-    }
+    m_condition_text.assign(condition);
+    std::hash<std::string> hasher;
+    m_condition_text_hash = hasher(m_condition_text);
 }
 
 const char *
-BreakpointOptions::GetConditionText () const
+BreakpointOptions::GetConditionText (size_t *hash) const
 {
-    if (m_condition_ap.get())
-        return m_condition_ap->GetUserText();
+    if (!m_condition_text.empty())
+    {
+        if (hash)
+            *hash = m_condition_text_hash;
+        
+        return m_condition_text.c_str();
+    }
     else
+    {
         return NULL;
+    }
 }
 
 const ThreadSpec *
@@ -250,12 +251,12 @@ BreakpointOptions::GetDescription (Strea
             m_callback_baton_sp->GetDescription (s, level);
         }
     }
-    if (m_condition_ap.get())
+    if (!m_condition_text.empty())
     {
        if (level != eDescriptionLevelBrief)
        {
             s->EOL();
-            s->Printf("Condition: %s\n", m_condition_ap->GetUserText());
+            s->Printf("Condition: %s\n", m_condition_text.c_str());
         }
     }    
 }

Modified: lldb/branches/windows/source/Breakpoint/WatchpointOptions.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Breakpoint/WatchpointOptions.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Breakpoint/WatchpointOptions.cpp (original)
+++ lldb/branches/windows/source/Breakpoint/WatchpointOptions.cpp Thu Apr 25 07:31:53 2013
@@ -38,7 +38,7 @@ WatchpointOptions::WatchpointOptions() :
     m_callback (WatchpointOptions::NullCallback),
     m_callback_baton_sp (),
     m_callback_is_synchronous (false),
-    m_thread_spec_ap (NULL)
+    m_thread_spec_ap ()
 {
 }
 
@@ -49,7 +49,7 @@ WatchpointOptions::WatchpointOptions(con
     m_callback (rhs.m_callback),
     m_callback_baton_sp (rhs.m_callback_baton_sp),
     m_callback_is_synchronous (rhs.m_callback_is_synchronous),
-    m_thread_spec_ap (NULL)
+    m_thread_spec_ap ()
 {
     if (rhs.m_thread_spec_ap.get() != NULL)
         m_thread_spec_ap.reset (new ThreadSpec(*rhs.m_thread_spec_ap.get()));

Modified: lldb/branches/windows/source/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/CMakeLists.txt?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/CMakeLists.txt (original)
+++ lldb/branches/windows/source/CMakeLists.txt Thu Apr 25 07:31:53 2013
@@ -38,12 +38,14 @@ set( LLDB_USED_LIBS
   lldbPluginSymbolFileDWARF
   lldbPluginSymbolFileSymtab
   lldbPluginDynamicLoaderStatic
+  lldbPluginDynamicLoaderPosixDYLD
   
   lldbPluginObjectFileMachO
   lldbPluginObjectFileELF
   lldbPluginObjectContainerBSDArchive
   lldbPluginObjectContainerMachOArchive
   lldbPluginProcessGDBRemote  
+  lldbPluginProcessMachCore
   lldbPluginProcessUtility
   lldbPluginPlatformGDB
   lldbPluginPlatformWindows
@@ -54,7 +56,6 @@ set( LLDB_USED_LIBS
   lldbPluginObjectContainerBSDArchive
   lldbPluginPlatformMacOSX
   lldbPluginDynamicLoaderMacOSXDYLD
-  lldbPluginDynamicLoaderPosixDYLD
   lldbPluginUnwindAssemblyInstEmulation
   lldbPluginUnwindAssemblyX86
   lldbPluginDynamicLoaderDarwinKernel
@@ -86,6 +87,16 @@ if ( CMAKE_SYSTEM_NAME MATCHES "Linux" )
     )
 endif ()
 
+# Darwin-only libraries
+if ( CMAKE_SYSTEM_NAME MATCHES "Darwin" )
+  list(APPEND LLDB_USED_LIBS
+    lldbHostMacOSX
+    lldbPluginOSDarwinKernel
+    lldbPluginProcessMacOSXKernel
+    lldbPluginSymbolVendorMacOSX
+    )
+endif()
+
 set( CLANG_USED_LIBS
   clangAnalysis
   clangAST

Modified: lldb/branches/windows/source/Commands/CommandObjectBreakpointCommand.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Commands/CommandObjectBreakpointCommand.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Commands/CommandObjectBreakpointCommand.cpp (original)
+++ lldb/branches/windows/source/Commands/CommandObjectBreakpointCommand.cpp Thu Apr 25 07:31:53 2013
@@ -206,7 +206,7 @@ one command per line.\n" );
                                              CommandReturnObject &result)
     {
         InputReaderSP reader_sp (new InputReader(m_interpreter.GetDebugger()));
-        std::auto_ptr<BreakpointOptions::CommandData> data_ap(new BreakpointOptions::CommandData());
+        std::unique_ptr<BreakpointOptions::CommandData> data_ap(new BreakpointOptions::CommandData());
         if (reader_sp && data_ap.get())
         {
             BatonSP baton_sp (new BreakpointOptions::CommandBaton (data_ap.release()));
@@ -242,7 +242,7 @@ one command per line.\n" );
     SetBreakpointCommandCallback (BreakpointOptions *bp_options,
                                   const char *oneliner)
     {
-        std::auto_ptr<BreakpointOptions::CommandData> data_ap(new BreakpointOptions::CommandData());
+        std::unique_ptr<BreakpointOptions::CommandData> data_ap(new BreakpointOptions::CommandData());
 
         // It's necessary to set both user_source and script_source to the oneliner.
         // The former is used to generate callback description (as in breakpoint command list)

Modified: lldb/branches/windows/source/Commands/CommandObjectCommands.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Commands/CommandObjectCommands.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Commands/CommandObjectCommands.cpp (original)
+++ lldb/branches/windows/source/Commands/CommandObjectCommands.cpp Thu Apr 25 07:31:53 2013
@@ -1066,7 +1066,7 @@ protected:
     }
 
 private:
-    std::auto_ptr<CommandObjectRegexCommand> m_regex_cmd_ap;    
+    std::unique_ptr<CommandObjectRegexCommand> m_regex_cmd_ap;
 
      class CommandOptions : public Options
      {

Modified: lldb/branches/windows/source/Commands/CommandObjectPlatform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Commands/CommandObjectPlatform.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Commands/CommandObjectPlatform.cpp (original)
+++ lldb/branches/windows/source/Commands/CommandObjectPlatform.cpp Thu Apr 25 07:31:53 2013
@@ -744,21 +744,21 @@ protected:
 OptionDefinition
 CommandObjectPlatformProcessList::CommandOptions::g_option_table[] =
 {
-{   LLDB_OPT_SET_1, false, "pid"              , 'p', required_argument, NULL, 0, eArgTypePid          , "List the process info for a specific process ID." },
-{   LLDB_OPT_SET_2, true , "name"             , 'n', required_argument, NULL, 0, eArgTypeProcessName  , "Find processes with executable basenames that match a string." },
-{   LLDB_OPT_SET_3, true , "ends-with"        , 'e', required_argument, NULL, 0, eArgTypeNone         , "Find processes with executable basenames that end with a string." },
-{   LLDB_OPT_SET_4, true , "starts-with"      , 's', required_argument, NULL, 0, eArgTypeNone         , "Find processes with executable basenames that start with a string." },
-{   LLDB_OPT_SET_5, true , "contains"         , 'c', required_argument, NULL, 0, eArgTypeNone         , "Find processes with executable basenames that contain a string." },
-{   LLDB_OPT_SET_6, true , "regex"            , 'r', required_argument, NULL, 0, eArgTypeNone         , "Find processes with executable basenames that match a regular expression." },
-{  ~LLDB_OPT_SET_1, false, "parent"           , 'P', required_argument, NULL, 0, eArgTypePid          , "Find processes that have a matching parent process ID." },
-{  ~LLDB_OPT_SET_1, false, "uid"              , 'u', required_argument, NULL, 0, eArgTypeNone         , "Find processes that have a matching user ID." },
-{  ~LLDB_OPT_SET_1, false, "euid"             , 'U', required_argument, NULL, 0, eArgTypeNone         , "Find processes that have a matching effective user ID." },
-{  ~LLDB_OPT_SET_1, false, "gid"              , 'g', required_argument, NULL, 0, eArgTypeNone         , "Find processes that have a matching group ID." },
-{  ~LLDB_OPT_SET_1, false, "egid"             , 'G', required_argument, NULL, 0, eArgTypeNone         , "Find processes that have a matching effective group ID." },
-{  ~LLDB_OPT_SET_1, false, "arch"             , 'a', required_argument, NULL, 0, eArgTypeArchitecture , "Find processes that have a matching architecture." },
-{ LLDB_OPT_SET_ALL, false, "show-args"        , 'A', no_argument      , NULL, 0, eArgTypeNone         , "Show process arguments instead of the process executable basename." },
-{ LLDB_OPT_SET_ALL, false, "verbose"          , 'v', no_argument      , NULL, 0, eArgTypeNone         , "Enable verbose output." },
-{  0              , false, NULL               ,  0 , 0                , NULL, 0, eArgTypeNone         , NULL }
+{ LLDB_OPT_SET_1            , true , "pid"        , 'p', required_argument, NULL, 0, eArgTypePid              , "List the process info for a specific process ID." },
+{ LLDB_OPT_SET_2            , true , "name"       , 'n', required_argument, NULL, 0, eArgTypeProcessName      , "Find processes with executable basenames that match a string." },
+{ LLDB_OPT_SET_3            , true , "ends-with"  , 'e', required_argument, NULL, 0, eArgTypeProcessName      , "Find processes with executable basenames that end with a string." },
+{ LLDB_OPT_SET_4            , true , "starts-with", 's', required_argument, NULL, 0, eArgTypeProcessName      , "Find processes with executable basenames that start with a string." },
+{ LLDB_OPT_SET_5            , true , "contains"   , 'c', required_argument, NULL, 0, eArgTypeProcessName      , "Find processes with executable basenames that contain a string." },
+{ LLDB_OPT_SET_6            , true , "regex"      , 'r', required_argument, NULL, 0, eArgTypeRegularExpression, "Find processes with executable basenames that match a regular expression." },
+{ LLDB_OPT_SET_FROM_TO(2, 6), false, "parent"     , 'P', required_argument, NULL, 0, eArgTypePid              , "Find processes that have a matching parent process ID." },
+{ LLDB_OPT_SET_FROM_TO(2, 6), false, "uid"        , 'u', required_argument, NULL, 0, eArgTypeUnsignedInteger  , "Find processes that have a matching user ID." },
+{ LLDB_OPT_SET_FROM_TO(2, 6), false, "euid"       , 'U', required_argument, NULL, 0, eArgTypeUnsignedInteger  , "Find processes that have a matching effective user ID." },
+{ LLDB_OPT_SET_FROM_TO(2, 6), false, "gid"        , 'g', required_argument, NULL, 0, eArgTypeUnsignedInteger  , "Find processes that have a matching group ID." },
+{ LLDB_OPT_SET_FROM_TO(2, 6), false, "egid"       , 'G', required_argument, NULL, 0, eArgTypeUnsignedInteger  , "Find processes that have a matching effective group ID." },
+{ LLDB_OPT_SET_FROM_TO(2, 6), false, "arch"       , 'a', required_argument, NULL, 0, eArgTypeArchitecture     , "Find processes that have a matching architecture." },
+{ LLDB_OPT_SET_FROM_TO(1, 6), false, "show-args"  , 'A', no_argument      , NULL, 0, eArgTypeNone             , "Show process arguments instead of the process executable basename." },
+{ LLDB_OPT_SET_FROM_TO(1, 6), false, "verbose"    , 'v', no_argument      , NULL, 0, eArgTypeNone             , "Enable verbose output." },
+{ 0                         , false, NULL         ,  0 , 0                , NULL, 0, eArgTypeNone             , NULL }
 };
 
 //----------------------------------------------------------------------

Modified: lldb/branches/windows/source/Commands/CommandObjectPlugin.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Commands/CommandObjectPlugin.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Commands/CommandObjectPlugin.cpp (original)
+++ lldb/branches/windows/source/Commands/CommandObjectPlugin.cpp Thu Apr 25 07:31:53 2013
@@ -96,10 +96,13 @@ protected:
         
         FileSpec dylib_fspec(path,true);
         
-        if (m_interpreter.GetDebugger().LoadPlugin(dylib_fspec))
+        if (m_interpreter.GetDebugger().LoadPlugin(dylib_fspec, error))
             result.SetStatus(eReturnStatusSuccessFinishResult);
         else
+        {
+            result.AppendError(error.AsCString());
             result.SetStatus(eReturnStatusFailed);
+        }
         
         return result.Succeeded();
     }

Modified: lldb/branches/windows/source/Commands/CommandObjectSource.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Commands/CommandObjectSource.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Commands/CommandObjectSource.cpp (original)
+++ lldb/branches/windows/source/Commands/CommandObjectSource.cpp Thu Apr 25 07:31:53 2013
@@ -778,7 +778,8 @@ CommandObjectMultiwordSource::CommandObj
                             "A set of commands for accessing source file information",
                             "source <subcommand> [<subcommand-options>]")
 {
-    LoadSubCommand ("info",   CommandObjectSP (new CommandObjectSourceInfo (interpreter)));
+    // "source info" isn't implemented yet...
+    //LoadSubCommand ("info",   CommandObjectSP (new CommandObjectSourceInfo (interpreter)));
     LoadSubCommand ("list",   CommandObjectSP (new CommandObjectSourceList (interpreter)));
 }
 

Modified: lldb/branches/windows/source/Commands/CommandObjectTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Commands/CommandObjectTarget.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/branches/windows/source/Commands/CommandObjectTarget.cpp Thu Apr 25 07:31:53 2013
@@ -3474,16 +3474,21 @@ public:
             switch (short_option)
             {
                 case 'a':
+                {
+                    ExecutionContext exe_ctx (m_interpreter.GetExecutionContext());
                     m_type = eLookupTypeAddress;
-                    m_addr = Args::StringToUInt64(option_arg, LLDB_INVALID_ADDRESS);
+                    m_addr = Args::StringToAddress(&exe_ctx, option_arg, LLDB_INVALID_ADDRESS, &error);
                     if (m_addr == LLDB_INVALID_ADDRESS)
                         error.SetErrorStringWithFormat ("invalid address string '%s'", option_arg);
                     break;
+                }
 
                 case 'n':
+                {
                     m_str = option_arg;
                     m_type = eLookupTypeFunctionOrSymbol;
                     break;
+                }
             }
 
             return error;
@@ -3573,78 +3578,94 @@ protected:
             return false;
         }
 
+        SymbolContextList sc_list;
+        
         if (m_options.m_type == eLookupTypeFunctionOrSymbol)
         {
-            SymbolContextList sc_list;
-            size_t num_matches;
             ConstString function_name (m_options.m_str.c_str());
-            num_matches = target->GetImages().FindFunctions (function_name, eFunctionNameTypeAuto, true, false, true, sc_list);
-            for (uint32_t idx = 0; idx < num_matches; idx++)
+            target->GetImages().FindFunctions (function_name, eFunctionNameTypeAuto, true, false, true, sc_list);
+        }
+        else if (m_options.m_type == eLookupTypeAddress && target)
+        {
+            Address addr;
+            if (target->GetSectionLoadList().ResolveLoadAddress (m_options.m_addr, addr))
             {
                 SymbolContext sc;
-                sc_list.GetContextAtIndex(idx, sc);
-                if (sc.symbol == NULL && sc.function == NULL)
-                    continue;
-                if (sc.module_sp.get() == NULL || sc.module_sp->GetObjectFile() == NULL)
-                    continue;
-                AddressRange range;
-                if (!sc.GetAddressRange (eSymbolContextFunction | eSymbolContextSymbol, 0, false, range))
-                    continue;
-                if (!range.GetBaseAddress().IsValid())
-                    continue;
-                ConstString funcname(sc.GetFunctionName());
-                if (funcname.IsEmpty())
-                    continue;
-                addr_t start_addr = range.GetBaseAddress().GetLoadAddress(target);
-                if (abi)
-                    start_addr = abi->FixCodeAddress(start_addr);
-
-                FuncUnwindersSP func_unwinders_sp (sc.module_sp->GetObjectFile()->GetUnwindTable().GetUncachedFuncUnwindersContainingAddress(start_addr, sc));
-                if (func_unwinders_sp.get() == NULL)
-                    continue;
-
-                Address first_non_prologue_insn (func_unwinders_sp->GetFirstNonPrologueInsn(*target));
-                if (first_non_prologue_insn.IsValid())
-                {
-                    result.GetOutputStream().Printf("First non-prologue instruction is at address 0x%" PRIx64 " or offset %" PRId64 " into the function.\n", first_non_prologue_insn.GetLoadAddress(target), first_non_prologue_insn.GetLoadAddress(target) - start_addr);
-                    result.GetOutputStream().Printf ("\n");
+                ModuleSP module_sp (addr.GetModule());
+                module_sp->ResolveSymbolContextForAddress (addr, eSymbolContextEverything, sc);
+                if (sc.function || sc.symbol)
+                {
+                    sc_list.Append(sc);
                 }
+            }
+        }
 
-                UnwindPlanSP non_callsite_unwind_plan = func_unwinders_sp->GetUnwindPlanAtNonCallSite(*thread.get());
-                if (non_callsite_unwind_plan.get())
-                {
-                    result.GetOutputStream().Printf("Asynchronous (not restricted to call-sites) UnwindPlan for %s`%s (start addr 0x%" PRIx64 "):\n", sc.module_sp->GetPlatformFileSpec().GetFilename().AsCString(), funcname.AsCString(), start_addr);
-                    non_callsite_unwind_plan->Dump(result.GetOutputStream(), thread.get(), LLDB_INVALID_ADDRESS);
-                    result.GetOutputStream().Printf ("\n");
-                }
+        size_t num_matches = sc_list.GetSize();
+        for (uint32_t idx = 0; idx < num_matches; idx++)
+        {
+            SymbolContext sc;
+            sc_list.GetContextAtIndex(idx, sc);
+            if (sc.symbol == NULL && sc.function == NULL)
+                continue;
+            if (sc.module_sp.get() == NULL || sc.module_sp->GetObjectFile() == NULL)
+                continue;
+            AddressRange range;
+            if (!sc.GetAddressRange (eSymbolContextFunction | eSymbolContextSymbol, 0, false, range))
+                continue;
+            if (!range.GetBaseAddress().IsValid())
+                continue;
+            ConstString funcname(sc.GetFunctionName());
+            if (funcname.IsEmpty())
+                continue;
+            addr_t start_addr = range.GetBaseAddress().GetLoadAddress(target);
+            if (abi)
+                start_addr = abi->FixCodeAddress(start_addr);
+
+            FuncUnwindersSP func_unwinders_sp (sc.module_sp->GetObjectFile()->GetUnwindTable().GetUncachedFuncUnwindersContainingAddress(start_addr, sc));
+            if (func_unwinders_sp.get() == NULL)
+                continue;
 
-                UnwindPlanSP callsite_unwind_plan = func_unwinders_sp->GetUnwindPlanAtCallSite(-1);
-                if (callsite_unwind_plan.get())
-                {
-                    result.GetOutputStream().Printf("Synchronous (restricted to call-sites) UnwindPlan for %s`%s (start addr 0x%" PRIx64 "):\n", sc.module_sp->GetPlatformFileSpec().GetFilename().AsCString(), funcname.AsCString(), start_addr);
-                    callsite_unwind_plan->Dump(result.GetOutputStream(), thread.get(), LLDB_INVALID_ADDRESS);
-                    result.GetOutputStream().Printf ("\n");
-                }
+            Address first_non_prologue_insn (func_unwinders_sp->GetFirstNonPrologueInsn(*target));
+            if (first_non_prologue_insn.IsValid())
+            {
+                result.GetOutputStream().Printf("First non-prologue instruction is at address 0x%" PRIx64 " or offset %" PRId64 " into the function.\n", first_non_prologue_insn.GetLoadAddress(target), first_non_prologue_insn.GetLoadAddress(target) - start_addr);
+                result.GetOutputStream().Printf ("\n");
+            }
 
-                UnwindPlanSP arch_default_unwind_plan = func_unwinders_sp->GetUnwindPlanArchitectureDefault(*thread.get());
-                if (arch_default_unwind_plan.get())
-                {
-                    result.GetOutputStream().Printf("Architecture default UnwindPlan for %s`%s (start addr 0x%" PRIx64 "):\n", sc.module_sp->GetPlatformFileSpec().GetFilename().AsCString(), funcname.AsCString(), start_addr);
-                    arch_default_unwind_plan->Dump(result.GetOutputStream(), thread.get(), LLDB_INVALID_ADDRESS);
-                    result.GetOutputStream().Printf ("\n");
-                }
+            UnwindPlanSP non_callsite_unwind_plan = func_unwinders_sp->GetUnwindPlanAtNonCallSite(*thread.get());
+            if (non_callsite_unwind_plan.get())
+            {
+                result.GetOutputStream().Printf("Asynchronous (not restricted to call-sites) UnwindPlan for %s`%s (start addr 0x%" PRIx64 "):\n", sc.module_sp->GetPlatformFileSpec().GetFilename().AsCString(), funcname.AsCString(), start_addr);
+                non_callsite_unwind_plan->Dump(result.GetOutputStream(), thread.get(), LLDB_INVALID_ADDRESS);
+                result.GetOutputStream().Printf ("\n");
+            }
 
-                UnwindPlanSP fast_unwind_plan = func_unwinders_sp->GetUnwindPlanFastUnwind(*thread.get());
-                if (fast_unwind_plan.get())
-                {
-                    result.GetOutputStream().Printf("Fast UnwindPlan for %s`%s (start addr 0x%" PRIx64 "):\n", sc.module_sp->GetPlatformFileSpec().GetFilename().AsCString(), funcname.AsCString(), start_addr);
-                    fast_unwind_plan->Dump(result.GetOutputStream(), thread.get(), LLDB_INVALID_ADDRESS);
-                    result.GetOutputStream().Printf ("\n");
-                }
+            UnwindPlanSP callsite_unwind_plan = func_unwinders_sp->GetUnwindPlanAtCallSite(-1);
+            if (callsite_unwind_plan.get())
+            {
+                result.GetOutputStream().Printf("Synchronous (restricted to call-sites) UnwindPlan for %s`%s (start addr 0x%" PRIx64 "):\n", sc.module_sp->GetPlatformFileSpec().GetFilename().AsCString(), funcname.AsCString(), start_addr);
+                callsite_unwind_plan->Dump(result.GetOutputStream(), thread.get(), LLDB_INVALID_ADDRESS);
+                result.GetOutputStream().Printf ("\n");
+            }
 
+            UnwindPlanSP arch_default_unwind_plan = func_unwinders_sp->GetUnwindPlanArchitectureDefault(*thread.get());
+            if (arch_default_unwind_plan.get())
+            {
+                result.GetOutputStream().Printf("Architecture default UnwindPlan for %s`%s (start addr 0x%" PRIx64 "):\n", sc.module_sp->GetPlatformFileSpec().GetFilename().AsCString(), funcname.AsCString(), start_addr);
+                arch_default_unwind_plan->Dump(result.GetOutputStream(), thread.get(), LLDB_INVALID_ADDRESS);
+                result.GetOutputStream().Printf ("\n");
+            }
 
+            UnwindPlanSP fast_unwind_plan = func_unwinders_sp->GetUnwindPlanFastUnwind(*thread.get());
+            if (fast_unwind_plan.get())
+            {
+                result.GetOutputStream().Printf("Fast UnwindPlan for %s`%s (start addr 0x%" PRIx64 "):\n", sc.module_sp->GetPlatformFileSpec().GetFilename().AsCString(), funcname.AsCString(), start_addr);
+                fast_unwind_plan->Dump(result.GetOutputStream(), thread.get(), LLDB_INVALID_ADDRESS);
                 result.GetOutputStream().Printf ("\n");
             }
+
+
+            result.GetOutputStream().Printf ("\n");
         }
         return result.Succeeded();
     }
@@ -3655,7 +3676,8 @@ protected:
 OptionDefinition
 CommandObjectTargetModulesShowUnwind::CommandOptions::g_option_table[] =
 {
-    { LLDB_OPT_SET_1,   true,  "name",       'n', required_argument, NULL, 0, eArgTypeFunctionName, "Lookup a function or symbol by name in one or more target modules."},
+    { LLDB_OPT_SET_1,   false,  "name",       'n', required_argument, NULL, 0, eArgTypeFunctionName, "Show unwind instructions for a function or symbol name."},
+    { LLDB_OPT_SET_2,   false,  "address",    'a', required_argument, NULL, 0, eArgTypeAddressOrExpression, "Show unwind instructions for a function or symbol containing an address"},
     { 0,                false, NULL,           0, 0,                 NULL, 0, eArgTypeNone, NULL }
 };
 
@@ -4882,7 +4904,7 @@ protected:
             target->AddStopHook (new_hook_sp);
 
             //  First step, make the specifier.
-            std::auto_ptr<SymbolContextSpecifier> specifier_ap;
+            std::unique_ptr<SymbolContextSpecifier> specifier_ap;
             if (m_options.m_sym_ctx_specified)
             {
                 specifier_ap.reset(new SymbolContextSpecifier(m_interpreter.GetDebugger().GetSelectedTarget()));

Modified: lldb/branches/windows/source/Commands/CommandObjectType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Commands/CommandObjectType.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Commands/CommandObjectType.cpp (original)
+++ lldb/branches/windows/source/Commands/CommandObjectType.cpp Thu Apr 25 07:31:53 2013
@@ -61,7 +61,7 @@ public:
     {
     }
     
-    typedef STD_SHARED_PTR(ScriptAddOptions) SharedPointer;
+    typedef std::shared_ptr<ScriptAddOptions> SharedPointer;
     
 };
 
@@ -94,7 +94,7 @@ public:
     {
     }
     
-    typedef STD_SHARED_PTR(SynthAddOptions) SharedPointer;
+    typedef std::shared_ptr<SynthAddOptions> SharedPointer;
     
 };
 

Modified: lldb/branches/windows/source/Commands/CommandObjectWatchpointCommand.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Commands/CommandObjectWatchpointCommand.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Commands/CommandObjectWatchpointCommand.cpp (original)
+++ lldb/branches/windows/source/Commands/CommandObjectWatchpointCommand.cpp Thu Apr 25 07:31:53 2013
@@ -190,7 +190,7 @@ but do NOT enter more than one command p
                                              CommandReturnObject &result)
     {
         InputReaderSP reader_sp (new InputReader(m_interpreter.GetDebugger()));
-        std::auto_ptr<WatchpointOptions::CommandData> data_ap(new WatchpointOptions::CommandData());
+        std::unique_ptr<WatchpointOptions::CommandData> data_ap(new WatchpointOptions::CommandData());
         if (reader_sp && data_ap.get())
         {
             BatonSP baton_sp (new WatchpointOptions::CommandBaton (data_ap.release()));
@@ -226,7 +226,7 @@ but do NOT enter more than one command p
     SetWatchpointCommandCallback (WatchpointOptions *wp_options,
                                   const char *oneliner)
     {
-        std::auto_ptr<WatchpointOptions::CommandData> data_ap(new WatchpointOptions::CommandData());
+        std::unique_ptr<WatchpointOptions::CommandData> data_ap(new WatchpointOptions::CommandData());
 
         // It's necessary to set both user_source and script_source to the oneliner.
         // The former is used to generate callback description (as in watchpoint command list)
@@ -830,7 +830,6 @@ CommandObjectWatchpointCommand::CommandO
                             "A set of commands for adding, removing and examining bits of code to be executed when the watchpoint is hit (watchpoint 'commmands').",
                             "command <sub-command> [<sub-command-options>] <watchpoint-id>")
 {
-    bool status;
     CommandObjectSP add_command_object (new CommandObjectWatchpointCommandAdd (interpreter));
     CommandObjectSP delete_command_object (new CommandObjectWatchpointCommandDelete (interpreter));
     CommandObjectSP list_command_object (new CommandObjectWatchpointCommandList (interpreter));
@@ -839,9 +838,9 @@ CommandObjectWatchpointCommand::CommandO
     delete_command_object->SetCommandName ("watchpoint command delete");
     list_command_object->SetCommandName ("watchpoint command list");
 
-    status = LoadSubCommand ("add",    add_command_object);
-    status = LoadSubCommand ("delete", delete_command_object);
-    status = LoadSubCommand ("list",   list_command_object);
+    LoadSubCommand ("add",    add_command_object);
+    LoadSubCommand ("delete", delete_command_object);
+    LoadSubCommand ("list",   list_command_object);
 }
 
 CommandObjectWatchpointCommand::~CommandObjectWatchpointCommand ()

Modified: lldb/branches/windows/source/Core/Address.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Core/Address.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Core/Address.cpp (original)
+++ lldb/branches/windows/source/Core/Address.cpp Thu Apr 25 07:31:53 2013
@@ -231,7 +231,11 @@ Address::operator= (const Address& rhs)
     if (this != &rhs)
     {
         m_section_wp = rhs.m_section_wp;
+#if _WIN32
         m_offset = rhs.m_offset;
+#else
+        m_offset = rhs.m_offset.load();
+#endif
     }
     return *this;
 }
@@ -391,7 +395,11 @@ Address::Dump (Stream *s, ExecutionConte
         if (section_sp)
         {
             section_sp->DumpName(s);
+#if _MSC_VER
             s->Printf (" + %" PRIu64, m_offset);
+#else
+            s->Printf (" + %" PRIu64, m_offset.load());
+#endif
         }
         else
         {

Modified: lldb/branches/windows/source/Core/Communication.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Core/Communication.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Core/Communication.cpp (original)
+++ lldb/branches/windows/source/Core/Communication.cpp Thu Apr 25 07:31:53 2013
@@ -108,7 +108,7 @@ Communication::Disconnect (Error *error_
         // don't want to pay for the overhead it might cause if every time we
         // access the connection we have to take a lock.
         //
-        // This auto_ptr will cleanup after itself when this object goes away,
+        // This unique pointer will cleanup after itself when this object goes away,
         // so there is no need to currently have it destroy itself immediately
         // upon disconnnect.
         //connection_sp.reset();

Modified: lldb/branches/windows/source/Core/ConnectionFileDescriptor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Core/ConnectionFileDescriptor.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Core/ConnectionFileDescriptor.cpp (original)
+++ lldb/branches/windows/source/Core/ConnectionFileDescriptor.cpp Thu Apr 25 07:31:53 2013
@@ -26,6 +26,7 @@
 #include <netinet/tcp.h>
 #include <sys/socket.h>
 #include <sys/un.h>
+#include <sys/termios.h>
 #include <sys/types.h>
 #include <string.h>
 #include <stdlib.h>
@@ -288,6 +289,26 @@ ConnectionFileDescriptor::Connect (const
                 return eConnectionStatusError;
             }
 #ifdef _POSIX_SOURCE
+            if (::isatty(m_fd_send))
+            {
+                // Set up serial terminal emulation
+                struct termios options;
+                ::tcgetattr (m_fd_send, &options);
+
+                // Set port speed to maximum
+                ::cfsetospeed (&options, B115200);
+                ::cfsetispeed (&options, B115200);
+
+                // Raw input, disable echo and signals
+                options.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG);
+
+                // Make sure only one character is needed to return from a read
+                options.c_cc[VMIN]  = 1;
+                options.c_cc[VTIME] = 0;
+
+                ::tcsetattr (m_fd_send, TCSANOW, &options);
+            }
+
             int flags = ::fcntl (m_fd_send, F_GETFL, 0);
 #else
 			int flags = -1;

Modified: lldb/branches/windows/source/Core/Debugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Core/Debugger.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Core/Debugger.cpp (original)
+++ lldb/branches/windows/source/Core/Debugger.cpp Thu Apr 25 07:31:53 2013
@@ -344,20 +344,32 @@ Debugger::SettingsTerminate ()
 }
 
 bool
-Debugger::LoadPlugin (const FileSpec& spec)
+Debugger::LoadPlugin (const FileSpec& spec, Error& error)
 {
     lldb::DynamicLibrarySP dynlib_sp(new lldb_private::DynamicLibrary(spec));
+    if (!dynlib_sp || dynlib_sp->IsValid() == false)
+    {
+        if (spec.Exists())
+            error.SetErrorString("this file does not represent a loadable dylib");
+        else
+            error.SetErrorString("no such file");
+        return false;
+    }
     lldb::DebuggerSP debugger_sp(shared_from_this());
     lldb::SBDebugger debugger_sb(debugger_sp);
     // TODO: mangle this differently for your system - on OSX, the first underscore needs to be removed and the second one stays
     LLDBCommandPluginInit init_func = dynlib_sp->GetSymbol<LLDBCommandPluginInit>("_ZN4lldb16PluginInitializeENS_10SBDebuggerE");
     if (!init_func)
+    {
+        error.SetErrorString("cannot find the initialization function lldb::PluginInitialize(lldb::SBDebugger)");
         return false;
+    }
     if (init_func(debugger_sb))
     {
         m_loaded_plugins.push_back(dynlib_sp);
         return true;
     }
+    error.SetErrorString("dylib refused to be loaded");
     return false;
 }
 
@@ -392,7 +404,8 @@ LoadPluginCallback
         if (plugin_file_spec.GetFileNameExtension() != g_dylibext)
             return FileSpec::eEnumerateDirectoryResultNext;
 
-        debugger->LoadPlugin (plugin_file_spec);
+        Error plugin_load_error;
+        debugger->LoadPlugin (plugin_file_spec, plugin_load_error);
         
         return FileSpec::eEnumerateDirectoryResultNext;
     }

Modified: lldb/branches/windows/source/Core/Disassembler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Core/Disassembler.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Core/Disassembler.cpp (original)
+++ lldb/branches/windows/source/Core/Disassembler.cpp Thu Apr 25 07:31:53 2013
@@ -638,7 +638,7 @@ Instruction::Dump (lldb_private::Stream
 bool
 Instruction::DumpEmulation (const ArchSpec &arch)
 {
-	std::auto_ptr<EmulateInstruction> insn_emulator_ap (EmulateInstruction::FindPlugin (arch, eInstructionTypeAny, NULL));
+	std::unique_ptr<EmulateInstruction> insn_emulator_ap (EmulateInstruction::FindPlugin (arch, eInstructionTypeAny, NULL));
 	if (insn_emulator_ap.get())
 	{
         insn_emulator_ap->SetInstruction (GetOpcode(), GetAddress(), NULL);
@@ -904,7 +904,7 @@ Instruction::TestEmulation (Stream *out_
     arch.SetTriple (llvm::Triple (value_sp->GetStringValue()));
 
     bool success = false;
-    std::auto_ptr<EmulateInstruction> insn_emulator_ap (EmulateInstruction::FindPlugin (arch, eInstructionTypeAny, NULL));
+    std::unique_ptr<EmulateInstruction> insn_emulator_ap (EmulateInstruction::FindPlugin (arch, eInstructionTypeAny, NULL));
     if (insn_emulator_ap.get())
         success = insn_emulator_ap->TestEmulation (out_stream, arch, data_dictionary);
 
@@ -925,7 +925,7 @@ Instruction::Emulate (const ArchSpec &ar
                       EmulateInstruction::ReadRegisterCallback read_reg_callback,
                       EmulateInstruction::WriteRegisterCallback write_reg_callback)
 {
-	std::auto_ptr<EmulateInstruction> insn_emulator_ap (EmulateInstruction::FindPlugin (arch, eInstructionTypeAny, NULL));
+	std::unique_ptr<EmulateInstruction> insn_emulator_ap (EmulateInstruction::FindPlugin (arch, eInstructionTypeAny, NULL));
 	if (insn_emulator_ap.get())
 	{
 		insn_emulator_ap->SetBaton (baton);

Modified: lldb/branches/windows/source/Core/DynamicLoader.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Core/DynamicLoader.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Core/DynamicLoader.cpp (original)
+++ lldb/branches/windows/source/Core/DynamicLoader.cpp Thu Apr 25 07:31:53 2013
@@ -24,7 +24,7 @@ DynamicLoader::FindPlugin (Process *proc
         create_callback  = PluginManager::GetDynamicLoaderCreateCallbackForPluginName (plugin_name);
         if (create_callback)
         {
-            std::auto_ptr<DynamicLoader> instance_ap(create_callback(process, true));
+            std::unique_ptr<DynamicLoader> instance_ap(create_callback(process, true));
             if (instance_ap.get())
                 return instance_ap.release();
         }
@@ -33,7 +33,7 @@ DynamicLoader::FindPlugin (Process *proc
     {
         for (uint32_t idx = 0; (create_callback = PluginManager::GetDynamicLoaderCreateCallbackAtIndex(idx)) != NULL; ++idx)
         {
-            std::auto_ptr<DynamicLoader> instance_ap(create_callback(process, false));
+            std::unique_ptr<DynamicLoader> instance_ap(create_callback(process, false));
             if (instance_ap.get())
                 return instance_ap.release();
         }

Modified: lldb/branches/windows/source/Core/Listener.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Core/Listener.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Core/Listener.cpp (original)
+++ lldb/branches/windows/source/Core/Listener.cpp Thu Apr 25 07:31:53 2013
@@ -533,6 +533,9 @@ uint32_t
 Listener::StartListeningForEventSpec (BroadcasterManager &manager, 
                              const BroadcastEventSpec &event_spec)
 {
+    // The BroadcasterManager mutex must be locked before m_broadcasters_mutex 
+    // to avoid violating the lock hierarchy (manager before broadcasters).
+    Mutex::Locker manager_locker(manager.m_manager_mutex);
     Mutex::Locker locker(m_broadcasters_mutex);
 
     uint32_t bits_acquired = manager.RegisterListenerForEvents(*this, event_spec);

Modified: lldb/branches/windows/source/Core/Module.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Core/Module.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Core/Module.cpp (original)
+++ lldb/branches/windows/source/Core/Module.cpp Thu Apr 25 07:31:53 2013
@@ -254,7 +254,7 @@ Module::GetMemoryObjectFile (const lldb:
         if (process_sp)
         {
             m_did_load_objfile = true;
-            std::auto_ptr<DataBufferHeap> data_ap (new DataBufferHeap (512, 0));
+            std::unique_ptr<DataBufferHeap> data_ap (new DataBufferHeap (512, 0));
             Error readmem_error;
             const size_t bytes_read = process_sp->ReadMemory (header_addr, 
                                                               data_ap->GetBytes(), 
@@ -1185,6 +1185,15 @@ Module::GetModificationTime () const
     return m_mod_time;
 }
 
+void
+Module::SetSymbolFileFileSpec (const FileSpec &file)
+{
+    m_symfile_spec = file;
+    m_symfile_ap.reset();
+    m_did_load_symbol_vendor = false;
+}
+
+
 bool
 Module::IsExecutable ()
 {

Modified: lldb/branches/windows/source/Core/PluginManager.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Core/PluginManager.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Core/PluginManager.cpp (original)
+++ lldb/branches/windows/source/Core/PluginManager.cpp Thu Apr 25 07:31:53 2013
@@ -35,11 +35,15 @@ enum PluginAction
     ePluginGetInstanceAtIndex
 };
 
+
+typedef bool (*PluginInitCallback) (void);
+typedef void (*PluginTermCallback) (void);
+
 struct PluginInfo
 {
     void *plugin_handle;
-    void *plugin_init_callback;
-    void *plugin_term_callback;
+    PluginInitCallback plugin_init_callback;
+    PluginTermCallback plugin_term_callback;
 };
 
 typedef std::map<FileSpec, PluginInfo> PluginTerminateMap;
@@ -111,17 +115,17 @@ LoadPluginCallback
             if (plugin_info.plugin_handle)
             {
                 bool success = false;
-                plugin_info.plugin_init_callback = Host::DynamicLibraryGetSymbol (plugin_info.plugin_handle, "LLDBPluginInitialize", error);
+                plugin_info.plugin_init_callback = (PluginInitCallback)Host::DynamicLibraryGetSymbol (plugin_info.plugin_handle, "LLDBPluginInitialize", error);
                 if (plugin_info.plugin_init_callback)
                 {
                     // Call the plug-in "bool LLDBPluginInitialize(void)" function
-                    success = ((bool (*)(void))plugin_info.plugin_init_callback)();
+                    success = plugin_info.plugin_init_callback();
                 }
 
                 if (success)
                 {
                     // It is ok for the "LLDBPluginTerminate" symbol to be NULL
-                    plugin_info.plugin_term_callback = Host::DynamicLibraryGetSymbol (plugin_info.plugin_handle, "LLDBPluginTerminate", error);
+                    plugin_info.plugin_term_callback = (PluginTermCallback)Host::DynamicLibraryGetSymbol (plugin_info.plugin_handle, "LLDBPluginTerminate", error);
                 }
                 else 
                 {
@@ -209,7 +213,7 @@ PluginManager::Terminate ()
         if (pos->second.plugin_handle)
         {
             if (pos->second.plugin_term_callback)
-                ((void (*)(void))pos->second.plugin_term_callback)();
+                pos->second.plugin_term_callback();
             Host::DynamicLibraryClose (pos->second.plugin_handle);
         }
     }
@@ -866,7 +870,9 @@ struct ObjectFileInstance
     ObjectFileInstance() :
         name(),
         description(),
-        create_callback(NULL)
+        create_callback(NULL),
+        create_memory_callback (NULL),
+        get_module_specifications (NULL)
     {
     }
 
@@ -874,7 +880,7 @@ struct ObjectFileInstance
     std::string description;
     ObjectFileCreateInstance create_callback;
     ObjectFileCreateMemoryInstance create_memory_callback;
-
+    ObjectFileGetModuleSpecifications get_module_specifications;
 };
 
 typedef std::vector<ObjectFileInstance> ObjectFileInstances;
@@ -895,13 +901,11 @@ GetObjectFileInstances ()
 
 
 bool
-PluginManager::RegisterPlugin
-(
-    const char *name,
-    const char *description,
-    ObjectFileCreateInstance create_callback,
-    ObjectFileCreateMemoryInstance create_memory_callback
-)
+PluginManager::RegisterPlugin (const char *name,
+                               const char *description,
+                               ObjectFileCreateInstance create_callback,
+                               ObjectFileCreateMemoryInstance create_memory_callback,
+                               ObjectFileGetModuleSpecifications get_module_specifications)
 {
     if (create_callback)
     {
@@ -912,6 +916,7 @@ PluginManager::RegisterPlugin
             instance.description = description;
         instance.create_callback = create_callback;
         instance.create_memory_callback = create_memory_callback;
+        instance.get_module_specifications = get_module_specifications;
         Mutex::Locker locker (GetObjectFileMutex ());
         GetObjectFileInstances ().push_back (instance);
     }
@@ -960,6 +965,16 @@ PluginManager::GetObjectFileCreateMemory
     return NULL;
 }
 
+ObjectFileGetModuleSpecifications
+PluginManager::GetObjectFileGetModuleSpecificationsCallbackAtIndex (uint32_t idx)
+{
+    Mutex::Locker locker (GetObjectFileMutex ());
+    ObjectFileInstances &instances = GetObjectFileInstances ();
+    if (idx < instances.size())
+        return instances[idx].get_module_specifications;
+    return NULL;
+}
+
 ObjectFileCreateInstance
 PluginManager::GetObjectFileCreateCallbackForPluginName (const char *name)
 {
@@ -1008,13 +1023,16 @@ struct ObjectContainerInstance
     ObjectContainerInstance() :
         name(),
         description(),
-        create_callback(NULL)
+        create_callback (NULL),
+        get_module_specifications (NULL)
     {
     }
 
     std::string name;
     std::string description;
     ObjectContainerCreateInstance create_callback;
+    ObjectFileGetModuleSpecifications get_module_specifications;
+
 };
 
 typedef std::vector<ObjectContainerInstance> ObjectContainerInstances;
@@ -1034,12 +1052,10 @@ GetObjectContainerInstances ()
 }
 
 bool
-PluginManager::RegisterPlugin
-(
-    const char *name,
-    const char *description,
-    ObjectContainerCreateInstance create_callback
-)
+PluginManager::RegisterPlugin (const char *name,
+                               const char *description,
+                               ObjectContainerCreateInstance create_callback,
+                               ObjectFileGetModuleSpecifications get_module_specifications)
 {
     if (create_callback)
     {
@@ -1049,6 +1065,7 @@ PluginManager::RegisterPlugin
         if (description && description[0])
             instance.description = description;
         instance.create_callback = create_callback;
+        instance.get_module_specifications = get_module_specifications;
         Mutex::Locker locker (GetObjectContainerMutex ());
         GetObjectContainerInstances ().push_back (instance);
     }
@@ -1105,6 +1122,16 @@ PluginManager::GetObjectContainerCreateC
     return NULL;
 }
 
+ObjectFileGetModuleSpecifications
+PluginManager::GetObjectContainerGetModuleSpecificationsCallbackAtIndex (uint32_t idx)
+{
+    Mutex::Locker locker (GetObjectContainerMutex ());
+    ObjectContainerInstances &instances = GetObjectContainerInstances ();
+    if (idx < instances.size())
+        return instances[idx].get_module_specifications;
+    return NULL;
+}
+
 #pragma mark LogChannel
 
 struct LogInstance

Modified: lldb/branches/windows/source/Core/StreamAsynchronousIO.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Core/StreamAsynchronousIO.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Core/StreamAsynchronousIO.cpp (original)
+++ lldb/branches/windows/source/Core/StreamAsynchronousIO.cpp Thu Apr 25 07:31:53 2013
@@ -35,7 +35,7 @@ StreamAsynchronousIO::Flush ()
 {
     if (m_accumulated_data.GetSize() > 0)
     {
-        std::auto_ptr<EventDataBytes> data_bytes_ap (new EventDataBytes);
+        std::unique_ptr<EventDataBytes> data_bytes_ap (new EventDataBytes);
         // Let's swap the bytes to avoid LARGE string copies.
         data_bytes_ap->SwapBytes (m_accumulated_data.GetString());
         EventSP new_event_sp (new Event (m_broadcast_event_type, data_bytes_ap.release()));

Modified: lldb/branches/windows/source/Core/ValueObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Core/ValueObject.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Core/ValueObject.cpp (original)
+++ lldb/branches/windows/source/Core/ValueObject.cpp Thu Apr 25 07:31:53 2013
@@ -1009,7 +1009,17 @@ ValueObject::GetData (DataExtractor& dat
     ExecutionContext exe_ctx (GetExecutionContextRef());
     Error error = m_value.GetValueAsData(&exe_ctx, GetClangAST(), data, 0, GetModule().get());
     if (error.Fail())
+    {
+        if (m_data.GetByteSize())
+        {
+            data = m_data;
+            return data.GetByteSize();
+        }
+        else
+        {
         return 0;
+        }
+    }
     data.SetAddressByteSize(m_data.GetAddressByteSize());
     data.SetByteOrder(m_data.GetByteOrder());
     return data.GetByteSize();
@@ -3402,7 +3412,13 @@ DumpValueObject_Impl (Stream &s,
                 show_type = options.m_show_types || (curr_depth == 0 && !options.m_flat_output);
             
             if (show_type)
-                s.Printf("(%s) ", valobj->GetQualifiedTypeName().AsCString("<invalid type>"));
+            {
+                // Some ValueObjects don't have types (like registers sets). Only print
+                // the type if there is one to print
+                ConstString qualified_type_name(valobj->GetQualifiedTypeName());
+                if (qualified_type_name)
+                    s.Printf("(%s) ", qualified_type_name.GetCString());
+            }
 
             if (options.m_flat_output)
             {
@@ -3535,9 +3551,8 @@ DumpValueObject_Impl (Stream &s,
                 
                 if (print_children && (!entry || entry->DoesPrintChildren() || !sum_cstr))
                 {
-                    ValueObject* synth_valobj;
                     ValueObjectSP synth_valobj_sp = valobj->GetSyntheticValue (options.m_use_synthetic);
-                    synth_valobj = (synth_valobj_sp ? synth_valobj_sp.get() : valobj);
+                    ValueObject* synth_valobj = (synth_valobj_sp ? synth_valobj_sp.get() : valobj);
                     
                     size_t num_children = synth_valobj->GetNumChildren();
                     bool print_dotdotdot = false;
@@ -3834,6 +3849,13 @@ ValueObject::AddressOf (Error &error)
             break;
         }
     }
+    else
+    {
+        StreamString expr_path_strm;
+        GetExpressionPath(expr_path_strm, true);
+        error.SetErrorStringWithFormat("'%s' doesn't have a valid address", expr_path_strm.GetString().c_str());
+    }
+    
     return m_addr_of_valobj_sp;
 }
 

Modified: lldb/branches/windows/source/Core/ValueObjectRegister.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Core/ValueObjectRegister.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Core/ValueObjectRegister.cpp (original)
+++ lldb/branches/windows/source/Core/ValueObjectRegister.cpp Thu Apr 25 07:31:53 2013
@@ -344,7 +344,7 @@ ValueObjectRegister::GetTypeName()
 size_t
 ValueObjectRegister::CalculateNumChildren()
 {
-    return 0;
+    return ClangASTContext::GetNumChildren(GetClangAST(), GetClangType(), true);
 }
 
 clang::ASTContext *

Modified: lldb/branches/windows/source/DataFormatters/CXXFormatterFunctions.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/DataFormatters/CXXFormatterFunctions.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/DataFormatters/CXXFormatterFunctions.cpp (original)
+++ lldb/branches/windows/source/DataFormatters/CXXFormatterFunctions.cpp Thu Apr 25 07:31:53 2013
@@ -216,9 +216,9 @@ DumpUTFBufferToStream (ConversionResult
         
         if (ConvertFunction)
         {
-            utf8_data_buffer_sp.reset(new DataBufferHeap(bufferSPSize,0));
+            utf8_data_buffer_sp.reset(new DataBufferHeap(4*bufferSPSize,0));
             utf8_data_ptr = (UTF8*)utf8_data_buffer_sp->GetBytes();
-            utf8_data_end_ptr = utf8_data_ptr + bufferSPSize;
+            utf8_data_end_ptr = utf8_data_ptr + utf8_data_buffer_sp->GetByteSize();
             ConvertFunction ( (const SourceDataType**)&data_ptr, data_end_ptr, &utf8_data_ptr, utf8_data_end_ptr, lenientConversion );
             utf8_data_ptr = (UTF8*)utf8_data_buffer_sp->GetBytes(); // needed because the ConvertFunction will change the value of the data_ptr
         }
@@ -246,54 +246,201 @@ DumpUTFBufferToStream (ConversionResult
 }
 
 template<typename SourceDataType>
-static bool
-ReadUTFBufferAndDumpToStream (ConversionResult (*ConvertFunction) (const SourceDataType**,
+class ReadUTFBufferAndDumpToStreamOptions
+{
+public:
+    typedef ConversionResult (*ConvertFunctionType) (const SourceDataType**,
                                                                    const SourceDataType*,
                                                                    UTF8**,
                                                                    UTF8*,
-                                                                   ConversionFlags),
-                              uint64_t location,
-                              const ProcessSP& process_sp,
-                              Stream& stream,
-                              char prefix_token = '@',
-                              char quote = '"',
-                              uint32_t sourceSize = 0)
+                                                     ConversionFlags);
+    
+    ReadUTFBufferAndDumpToStreamOptions () :
+    m_conversion_function(NULL),
+    m_location(0),
+    m_process_sp(),
+    m_stream(NULL),
+    m_prefix_token('@'),
+    m_quote('"'),
+    m_source_size(0),
+    m_needs_zero_termination(true)
+    {
+    }
+    
+    ReadUTFBufferAndDumpToStreamOptions&
+    SetConversionFunction (ConvertFunctionType f)
+    {
+        m_conversion_function = f;
+        return *this;
+    }
+    
+    ConvertFunctionType
+    GetConversionFunction () const
+    {
+        return m_conversion_function;
+    }
+    
+    ReadUTFBufferAndDumpToStreamOptions&
+    SetLocation (uint64_t l)
+    {
+        m_location = l;
+        return *this;
+    }
+    
+    uint64_t
+    GetLocation () const
+    {
+        return m_location;
+    }
+    
+    ReadUTFBufferAndDumpToStreamOptions&
+    SetProcessSP (ProcessSP p)
+    {
+        m_process_sp = p;
+        return *this;
+    }
+    
+    ProcessSP
+    GetProcessSP () const
+    {
+        return m_process_sp;
+    }
+    
+    ReadUTFBufferAndDumpToStreamOptions&
+    SetStream (Stream* s)
+    {
+        m_stream = s;
+        return *this;
+    }
+    
+    Stream*
+    GetStream () const
+    {
+        return m_stream;
+    }
+    
+    ReadUTFBufferAndDumpToStreamOptions&
+    SetPrefixToken (char p)
+    {
+        m_prefix_token = p;
+        return *this;
+    }
+    
+    char
+    GetPrefixToken () const
+    {
+        return m_prefix_token;
+    }
+    
+    ReadUTFBufferAndDumpToStreamOptions&
+    SetQuote (char q)
+    {
+        m_quote = q;
+        return *this;
+    }
+    
+    char
+    GetQuote () const
+    {
+        return m_quote;
+    }
+    
+    ReadUTFBufferAndDumpToStreamOptions&
+    SetSourceSize (uint32_t s)
+    {
+        m_source_size = s;
+        return *this;
+    }
+    
+    uint32_t
+    GetSourceSize () const
+    {
+        return m_source_size;
+    }
+    
+    ReadUTFBufferAndDumpToStreamOptions&
+    SetNeedsZeroTermination (bool z)
+    {
+        m_needs_zero_termination = z;
+        return *this;
+    }
+    
+    bool
+    GetNeedsZeroTermination () const
+    {
+        return m_needs_zero_termination;
+    }
+    
+private:
+    ConvertFunctionType m_conversion_function;
+    uint64_t m_location;
+    ProcessSP m_process_sp;
+    Stream* m_stream;
+    char m_prefix_token;
+    char m_quote;
+    uint32_t m_source_size;
+    bool m_needs_zero_termination;
+};
+
+template<typename SourceDataType>
+static bool
+ReadUTFBufferAndDumpToStream (const ReadUTFBufferAndDumpToStreamOptions<SourceDataType>& options)
 {
-    if (location == 0 || location == LLDB_INVALID_ADDRESS)
+    if (options.GetLocation() == 0 || options.GetLocation() == LLDB_INVALID_ADDRESS)
         return false;
+    
+    ProcessSP process_sp(options.GetProcessSP());
+    
     if (!process_sp)
         return false;
 
-    const int origin_encoding = 8*sizeof(SourceDataType);
+    const int type_width = sizeof(SourceDataType);
+    const int origin_encoding = 8 * type_width ;
     if (origin_encoding != 8 && origin_encoding != 16 && origin_encoding != 32)
         return false;
     // if not UTF8, I need a conversion function to return proper UTF8
-    if (origin_encoding != 8 && !ConvertFunction)
+    if (origin_encoding != 8 && !options.GetConversionFunction())
+        return false;
+    
+    if (!options.GetStream())
         return false;
 
+    uint32_t sourceSize = options.GetSourceSize();
+    bool needs_zero_terminator = options.GetNeedsZeroTermination();
+    
     if (!sourceSize)
+    {
         sourceSize = process_sp->GetTarget().GetMaximumSizeOfStringSummary();
+        needs_zero_terminator = true;
+    }
     else
         sourceSize = std::min(sourceSize,process_sp->GetTarget().GetMaximumSizeOfStringSummary());
     
-    const int bufferSPSize = sourceSize * (origin_encoding >> 2);
+    const int bufferSPSize = sourceSize * type_width;
 
-    Error error;
     lldb::DataBufferSP buffer_sp(new DataBufferHeap(bufferSPSize,0));
     
     if (!buffer_sp->GetBytes())
         return false;
     
-    size_t data_read = process_sp->ReadMemoryFromInferior(location, (char*)buffer_sp->GetBytes(), bufferSPSize, error);
+    Error error;
+    char *buffer = reinterpret_cast<char *>(buffer_sp->GetBytes()); 
+
+    size_t data_read = 0;
+    if (needs_zero_terminator)
+        data_read = process_sp->ReadStringFromMemory(options.GetLocation(), buffer, bufferSPSize, error, type_width);
+    else
+        data_read = process_sp->ReadMemoryFromInferior(options.GetLocation(), (char*)buffer_sp->GetBytes(), bufferSPSize, error);
+
     if (error.Fail() || data_read == 0)
     {
-        stream.Printf("unable to read data");
+        options.GetStream()->Printf("unable to read data");
         return true;
     }
     
     DataExtractor data(buffer_sp, process_sp->GetByteOrder(), process_sp->GetAddressByteSize());
     
-    return DumpUTFBufferToStream(ConvertFunction, data, stream, prefix_token, quote, sourceSize);
+    return DumpUTFBufferToStream(options.GetConversionFunction(), data, *options.GetStream(), options.GetPrefixToken(), options.GetQuote(), sourceSize);
 }
 
 bool
@@ -308,10 +455,14 @@ lldb_private::formatters::Char16StringSu
     if (!valobj_addr)
         return false;
     
-    if (!ReadUTFBufferAndDumpToStream<UTF16>(ConvertUTF16toUTF8,valobj_addr,
-                                                                 process_sp,
-                                                                 stream,
-                                                                 'u'))
+    ReadUTFBufferAndDumpToStreamOptions<UTF16> options;
+    options.SetLocation(valobj_addr);
+    options.SetConversionFunction(ConvertUTF16toUTF8);
+    options.SetProcessSP(process_sp);
+    options.SetStream(&stream);
+    options.SetPrefixToken('u');
+    
+    if (!ReadUTFBufferAndDumpToStream(options))
     {
         stream.Printf("Summary Unavailable");
         return true;
@@ -332,10 +483,14 @@ lldb_private::formatters::Char32StringSu
     if (!valobj_addr)
         return false;
     
-    if (!ReadUTFBufferAndDumpToStream<UTF32>(ConvertUTF32toUTF8,valobj_addr,
-                                                                 process_sp,
-                                                                 stream,
-                                                                 'U'))
+    ReadUTFBufferAndDumpToStreamOptions<UTF32> options;
+    options.SetLocation(valobj_addr);
+    options.SetConversionFunction(ConvertUTF32toUTF8);
+    options.SetProcessSP(process_sp);
+    options.SetStream(&stream);
+    options.SetPrefixToken('U');
+    
+    if (!ReadUTFBufferAndDumpToStream(options))
     {
         stream.Printf("Summary Unavailable");
         return true;
@@ -371,23 +526,42 @@ lldb_private::formatters::WCharStringSum
     switch (wchar_size)
     {
         case 8:
+        {
             // utf 8
-            return ReadUTFBufferAndDumpToStream<UTF8>(nullptr, data_addr,
-                                                               process_sp,
-                                                               stream,
-                                                               'L');
+            
+            ReadUTFBufferAndDumpToStreamOptions<UTF8> options;
+            options.SetLocation(data_addr);
+            options.SetConversionFunction(nullptr);
+            options.SetProcessSP(process_sp);
+            options.SetStream(&stream);
+            options.SetPrefixToken('L');
+
+            return ReadUTFBufferAndDumpToStream(options);
+        }
         case 16:
+        {
             // utf 16
-            return ReadUTFBufferAndDumpToStream<UTF16>(ConvertUTF16toUTF8, data_addr,
-                                                                           process_sp,
-                                                                           stream,
-                                                                           'L');
+            ReadUTFBufferAndDumpToStreamOptions<UTF16> options;
+            options.SetLocation(data_addr);
+            options.SetConversionFunction(ConvertUTF16toUTF8);
+            options.SetProcessSP(process_sp);
+            options.SetStream(&stream);
+            options.SetPrefixToken('L');
+            
+            return ReadUTFBufferAndDumpToStream(options);
+        }
         case 32:
+        {
             // utf 32
-            return ReadUTFBufferAndDumpToStream<UTF32>(ConvertUTF32toUTF8, data_addr,
-                                                                           process_sp,
-                                                                           stream,
-                                                                           'L');
+            ReadUTFBufferAndDumpToStreamOptions<UTF32> options;
+            options.SetLocation(data_addr);
+            options.SetConversionFunction(ConvertUTF32toUTF8);
+            options.SetProcessSP(process_sp);
+            options.SetStream(&stream);
+            options.SetPrefixToken('L');
+            
+            return ReadUTFBufferAndDumpToStream(options);
+        }
         default:
             stream.Printf("size for wchar_t is not valid");
             return true;
@@ -582,7 +756,7 @@ lldb_private::formatters::ObjCClassSumma
     if (!runtime)
         return false;
     
-    ObjCLanguageRuntime::ClassDescriptorSP descriptor(runtime->GetClassDescriptor(valobj.GetValueAsUnsigned(0)));
+    ObjCLanguageRuntime::ClassDescriptorSP descriptor(runtime->GetClassDescriptorFromISA(valobj.GetValueAsUnsigned(0)));
     
     if (!descriptor.get() || !descriptor->IsValid())
         return false;
@@ -778,11 +952,11 @@ lldb_private::formatters::NSStringSummar
     if (!has_null && has_explicit_length && !is_special)
     {
         lldb::addr_t explicit_length_offset = 2*ptr_size;
-        if (is_mutable and not is_inline)
+        if (is_mutable && !is_inline)
             explicit_length_offset = explicit_length_offset + ptr_size; //  notInlineMutable.length;
         else if (is_inline)
             explicit_length = explicit_length + 0; // inline1.length;
-        else if (not is_inline and not is_mutable)
+        else if (!is_inline && !is_mutable)
             explicit_length_offset = explicit_length_offset + ptr_size; // notInlineImmutable1.length;
         else
             explicit_length_offset = 0;
@@ -831,7 +1005,7 @@ lldb_private::formatters::NSStringSummar
 #endif
                    void* contentsAllocator = %p
                }
-           } variants;
+           } variants; ==> (M:%dI:%dL:%zuU:%dS:%dN:%d)
            };\n)",
     my_string_data._cfisa,
     my_string_data._cfinfo[0],my_string_data._cfinfo[1],my_string_data._cfinfo[2],my_string_data._cfinfo[3],
@@ -851,7 +1025,13 @@ lldb_private::formatters::NSStringSummar
     my_string_data.variants.notInlineMutable.capacityProvidedExternally,
     my_string_data.variants.notInlineMutable.desiredCapacity,
     my_string_data.variants.notInlineMutable.desiredCapacity,
-    my_string_data.variants.notInlineMutable.contentsAllocator);
+    my_string_data.variants.notInlineMutable.contentsAllocator,
+    is_mutable,
+    is_inline,
+    explicit_length,
+    is_unicode,
+    is_special,
+    has_null);
 #endif
     
     if (strcmp(class_name,"NSString") &&
@@ -868,24 +1048,25 @@ lldb_private::formatters::NSStringSummar
         return true;
     }
     
-#ifdef WANT_DEEP_PRNT
-    stream.Printf("(M:%dI:%dL:%zuU:%dS:%dN:%d) ",
-                  is_mutable,
-                  is_inline,
-                  explicit_length,
-                  is_unicode,
-                  is_special,
-                  has_null);
-#endif
-    
     if (is_mutable)
     {
         uint64_t location = 2 * ptr_size + valobj_addr;
         location = process_sp->ReadPointerFromMemory(location, error);
         if (error.Fail())
             return false;
-        if (has_explicit_length and is_unicode)
-            return ReadUTFBufferAndDumpToStream<UTF16> (ConvertUTF16toUTF8,location, process_sp, stream, '@', '"', explicit_length);
+        if (has_explicit_length && is_unicode)
+        {
+            ReadUTFBufferAndDumpToStreamOptions<UTF16> options;
+            options.SetConversionFunction(ConvertUTF16toUTF8);
+            options.SetLocation(location);
+            options.SetProcessSP(process_sp);
+            options.SetStream(&stream);
+            options.SetPrefixToken('@');
+            options.SetQuote('"');
+            options.SetSourceSize(explicit_length);
+            options.SetNeedsZeroTermination(false);
+            return ReadUTFBufferAndDumpToStream (options);
+        }
         else
             return ReadAsciiBufferAndDumpToStream(location+1,process_sp,stream, explicit_length);
     }
@@ -913,12 +1094,30 @@ lldb_private::formatters::NSStringSummar
             if (error.Fail())
                 return false;
         }
-        return ReadUTFBufferAndDumpToStream<UTF16> (ConvertUTF16toUTF8, location, process_sp, stream, '@', '"', explicit_length);
+        ReadUTFBufferAndDumpToStreamOptions<UTF16> options;
+        options.SetConversionFunction(ConvertUTF16toUTF8);
+        options.SetLocation(location);
+        options.SetProcessSP(process_sp);
+        options.SetStream(&stream);
+        options.SetPrefixToken('@');
+        options.SetQuote('"');
+        options.SetSourceSize(explicit_length);
+        options.SetNeedsZeroTermination(has_explicit_length == false);
+        return ReadUTFBufferAndDumpToStream (options);
     }
     else if (is_special)
     {
         uint64_t location = valobj_addr + (ptr_size == 8 ? 12 : 8);
-        return ReadUTFBufferAndDumpToStream<UTF16> (ConvertUTF16toUTF8, location, process_sp, stream, '@', '"', explicit_length);
+        ReadUTFBufferAndDumpToStreamOptions<UTF16> options;
+        options.SetConversionFunction(ConvertUTF16toUTF8);
+        options.SetLocation(location);
+        options.SetProcessSP(process_sp);
+        options.SetStream(&stream);
+        options.SetPrefixToken('@');
+        options.SetQuote('"');
+        options.SetSourceSize(explicit_length);
+        options.SetNeedsZeroTermination(has_explicit_length == false);
+        return ReadUTFBufferAndDumpToStream (options);
     }
     else if (is_inline)
     {

Modified: lldb/branches/windows/source/DataFormatters/Cocoa.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/DataFormatters/Cocoa.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/DataFormatters/Cocoa.cpp (original)
+++ lldb/branches/windows/source/DataFormatters/Cocoa.cpp Thu Apr 25 07:31:53 2013
@@ -330,12 +330,15 @@ lldb_private::formatters::NSNumberSummar
                 case 0:
                     stream.Printf("(char)%hhd",(char)value);
                     break;
+                case 1:
                 case 4:
                     stream.Printf("(short)%hd",(short)value);
                     break;
+                case 2:
                 case 8:
                     stream.Printf("(int)%d",(int)value);
                     break;
+                case 3:
                 case 12:
                     stream.Printf("(long)%" PRId64,value);
                     break;

Modified: lldb/branches/windows/source/DataFormatters/FormatManager.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/DataFormatters/FormatManager.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/DataFormatters/FormatManager.cpp (original)
+++ lldb/branches/windows/source/DataFormatters/FormatManager.cpp Thu Apr 25 07:31:53 2013
@@ -565,7 +565,7 @@ FormatManager::LoadLibStdcppFormatters()
                                                        SyntheticChildrenSP(new ScriptedSyntheticChildren(stl_synth_flags,
                                                                                                  "lldb.formatters.cpp.gnu_libstdcpp.StdListSynthProvider")));
     
-    stl_summary_flags.SetDontShowChildren(false);
+    stl_summary_flags.SetDontShowChildren(false);stl_summary_flags.SetSkipPointers(true);
     gnu_category_sp->GetRegexSummaryNavigator()->Add(RegularExpressionSP(new RegularExpression("^std::vector<.+>(( )?&)?$")),
                                                      TypeSummaryImplSP(new StringSummaryFormat(stl_summary_flags,
                                                                                                "size=${svar%#}")));
@@ -900,6 +900,8 @@ FormatManager::LoadObjCFormatters()
     AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("NSArray"), ScriptedSyntheticChildren::Flags());
     AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("NSMutableArray"), ScriptedSyntheticChildren::Flags());
     AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("__NSCFArray"), ScriptedSyntheticChildren::Flags());
+    AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("CFMutableArrayRef"), ScriptedSyntheticChildren::Flags());
+    AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("CFArrayRef"), ScriptedSyntheticChildren::Flags());
 
     AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("__NSDictionaryM"), ScriptedSyntheticChildren::Flags());
     AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("__NSDictionaryI"), ScriptedSyntheticChildren::Flags());

Modified: lldb/branches/windows/source/DataFormatters/LibCxxList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/DataFormatters/LibCxxList.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/DataFormatters/LibCxxList.cpp (original)
+++ lldb/branches/windows/source/DataFormatters/LibCxxList.cpp Thu Apr 25 07:31:53 2013
@@ -181,26 +181,44 @@ lldb_private::formatters::LibcxxStdListS
         return m_count;
     if (!m_head || !m_tail || m_node_address == 0)
         return 0;
-    uint64_t next_val = m_head->GetValueAsUnsigned(0);
-    uint64_t prev_val = m_tail->GetValueAsUnsigned(0);
-    if (next_val == 0 || prev_val == 0)
-        return 0;
-    if (next_val == m_node_address)
-        return 0;
-    if (next_val == prev_val)
-        return 1;
-    if (HasLoop())
-        return 0;
-    uint64_t size = 2;
-    ListEntry current(m_head);
-    while (current.next() && current.next()->GetValueAsUnsigned(0) != m_node_address)
+    ValueObjectSP size_alloc(m_backend.GetChildMemberWithName(ConstString("__size_alloc_"), true));
+    if (size_alloc)
+    {
+        ValueObjectSP first(size_alloc->GetChildMemberWithName(ConstString("__first_"), true));
+        if (first)
+        {
+            m_count = first->GetValueAsUnsigned(UINT32_MAX);
+        }
+    }
+    if (m_count != UINT32_MAX)
+    {
+        if (!HasLoop())
+            return m_count;
+        return m_count = 0;
+    }
+    else
     {
-        size++;
-        current.SetEntry(current.next());
-        if (size > m_list_capping_size)
-            break;
+        uint64_t next_val = m_head->GetValueAsUnsigned(0);
+        uint64_t prev_val = m_tail->GetValueAsUnsigned(0);
+        if (next_val == 0 || prev_val == 0)
+            return 0;
+        if (next_val == m_node_address)
+            return 0;
+        if (next_val == prev_val)
+            return 1;
+        if (HasLoop())
+            return 0;
+        uint64_t size = 2;
+        ListEntry current(m_head);
+        while (current.next() && current.next()->GetValueAsUnsigned(0) != m_node_address)
+        {
+            size++;
+            current.SetEntry(current.next());
+            if (size > m_list_capping_size)
+                break;
+        }
+        return m_count = (size-1);
     }
-    return m_count = (size-1);
 }
 
 lldb::ValueObjectSP

Modified: lldb/branches/windows/source/DataFormatters/NSArray.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/DataFormatters/NSArray.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/DataFormatters/NSArray.cpp (original)
+++ lldb/branches/windows/source/DataFormatters/NSArray.cpp Thu Apr 25 07:31:53 2013
@@ -97,10 +97,7 @@ m_data_32(NULL),
 m_data_64(NULL)
 {
     if (valobj_sp)
-    {
         m_id_type = ClangASTType(valobj_sp->GetClangAST(),valobj_sp->GetClangAST()->ObjCBuiltinIdTy.getAsOpaquePtr());
-        Update();
-    }
 }
 
 size_t
@@ -150,18 +147,12 @@ lldb_private::formatters::NSArrayMSynthe
         return false;
     m_exe_ctx_ref = valobj_sp->GetExecutionContextRef();
     Error error;
-    if (valobj_sp->IsPointerType())
-    {
-        valobj_sp = valobj_sp->Dereference(error);
-        if (error.Fail() || !valobj_sp)
-            return false;
-    }
     error.Clear();
     lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
     if (!process_sp)
         return false;
     m_ptr_size = process_sp->GetAddressByteSize();
-    uint64_t data_location = valobj_sp->GetAddressOf() + m_ptr_size;
+    uint64_t data_location = valobj_sp->GetValueAsUnsigned(0) + m_ptr_size;
     if (m_ptr_size == 4)
     {
         m_data_32 = new DataDescriptor_32();
@@ -211,10 +202,7 @@ m_items(0),
 m_data_ptr(0)
 {
     if (valobj_sp)
-    {
         m_id_type = ClangASTType(valobj_sp->GetClangAST(),valobj_sp->GetClangAST()->ObjCBuiltinIdTy.getAsOpaquePtr());
-        Update();
-    }
 }
 
 lldb_private::formatters::NSArrayISyntheticFrontEnd::~NSArrayISyntheticFrontEnd ()
@@ -249,18 +237,12 @@ lldb_private::formatters::NSArrayISynthe
         return false;
     m_exe_ctx_ref = valobj_sp->GetExecutionContextRef();
     Error error;
-    if (valobj_sp->IsPointerType())
-    {
-        valobj_sp = valobj_sp->Dereference(error);
-        if (error.Fail() || !valobj_sp)
-            return false;
-    }
     error.Clear();
     lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
     if (!process_sp)
         return false;
     m_ptr_size = process_sp->GetAddressByteSize();
-    uint64_t data_location = valobj_sp->GetAddressOf() + m_ptr_size;
+    uint64_t data_location = valobj_sp->GetValueAsUnsigned(0) + m_ptr_size;
     m_items = process_sp->ReadPointerFromMemory(data_location, error);
     if (error.Fail())
         return false;

Modified: lldb/branches/windows/source/DataFormatters/NSDictionary.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/DataFormatters/NSDictionary.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/DataFormatters/NSDictionary.cpp (original)
+++ lldb/branches/windows/source/DataFormatters/NSDictionary.cpp Thu Apr 25 07:31:53 2013
@@ -255,8 +255,6 @@ m_data_32(NULL),
 m_data_64(NULL),
 m_pair_type()
 {
-    if (valobj_sp)
-        Update();
 }
 
 lldb_private::formatters::NSDictionaryISyntheticFrontEnd::~NSDictionaryISyntheticFrontEnd ()
@@ -297,23 +295,15 @@ lldb_private::formatters::NSDictionaryIS
     ValueObjectSP valobj_sp = m_backend.GetSP();
     if (!valobj_sp)
         return false;
-    if (!valobj_sp)
-        return false;
     m_exe_ctx_ref = valobj_sp->GetExecutionContextRef();
     Error error;
-    if (valobj_sp->IsPointerType())
-    {
-        valobj_sp = valobj_sp->Dereference(error);
-        if (error.Fail() || !valobj_sp)
-            return false;
-    }
     error.Clear();
     lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
     if (!process_sp)
         return false;
     m_ptr_size = process_sp->GetAddressByteSize();
     m_order = process_sp->GetByteOrder();
-    uint64_t data_location = valobj_sp->GetAddressOf() + m_ptr_size;
+    uint64_t data_location = valobj_sp->GetValueAsUnsigned(0) + m_ptr_size;
     if (m_ptr_size == 4)
     {
         m_data_32 = new DataDescriptor_32();
@@ -427,8 +417,6 @@ m_data_32(NULL),
 m_data_64(NULL),
 m_pair_type()
 {
-    if (valobj_sp)
-        Update ();
 }
 
 lldb_private::formatters::NSDictionaryMSyntheticFrontEnd::~NSDictionaryMSyntheticFrontEnd ()
@@ -469,23 +457,15 @@ lldb_private::formatters::NSDictionaryMS
     m_data_64 = NULL;
     if (!valobj_sp)
         return false;
-    if (!valobj_sp)
-        return false;
     m_exe_ctx_ref = valobj_sp->GetExecutionContextRef();
     Error error;
-    if (valobj_sp->IsPointerType())
-    {
-        valobj_sp = valobj_sp->Dereference(error);
-        if (error.Fail() || !valobj_sp)
-            return false;
-    }
     error.Clear();
     lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
     if (!process_sp)
         return false;
     m_ptr_size = process_sp->GetAddressByteSize();
     m_order = process_sp->GetByteOrder();
-    uint64_t data_location = valobj_sp->GetAddressOf() + m_ptr_size;
+    uint64_t data_location = valobj_sp->GetValueAsUnsigned(0) + m_ptr_size;
     if (m_ptr_size == 4)
     {
         m_data_32 = new DataDescriptor_32();

Modified: lldb/branches/windows/source/Expression/ClangASTSource.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Expression/ClangASTSource.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Expression/ClangASTSource.cpp (original)
+++ lldb/branches/windows/source/Expression/ClangASTSource.cpp Thu Apr 25 07:31:53 2013
@@ -1724,6 +1724,11 @@ NameSearchContext::AddFunDecl (void *typ
 {
     assert (type && "Type for variable must be non-NULL!");
     
+    if (m_function_types.count(type))
+        return NULL;
+    
+    m_function_types.insert(type);
+    
     clang::FunctionDecl *func_decl = FunctionDecl::Create (*m_ast_source.m_ast_context,
                                                            const_cast<DeclContext*>(m_decl_context),
                                                            SourceLocation(),

Modified: lldb/branches/windows/source/Expression/ClangExpressionDeclMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Expression/ClangExpressionDeclMap.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Expression/ClangExpressionDeclMap.cpp (original)
+++ lldb/branches/windows/source/Expression/ClangExpressionDeclMap.cpp Thu Apr 25 07:31:53 2013
@@ -70,7 +70,6 @@ ClangExpressionDeclMap::~ClangExpression
     //   that valuable lookup data (like namespaces) doesn't vanish, but 
     
     DidParse();
-    DidDematerialize();
     DisableStructVars();
 }
 
@@ -131,7 +130,7 @@ ClangExpressionDeclMap::DidParse()
             if (var_sp)
             {
                 ClangExpressionVariable::ParserVars *parser_vars = var_sp->GetParserVars(GetParserID());
-            
+                
                 if (parser_vars && parser_vars->m_lldb_value)
                     delete parser_vars->m_lldb_value;
             
@@ -182,282 +181,63 @@ ClangExpressionDeclMap::GetTargetInfo()
     return ret;
 }
 
-const ConstString &
-ClangExpressionDeclMap::GetPersistentResultName ()
-{
-    assert (m_struct_vars.get());
-    assert (m_parser_vars.get());
-    if (!m_struct_vars->m_result_name)
-    {
-        Target *target = m_parser_vars->GetTarget();
-        assert (target);
-        m_struct_vars->m_result_name = target->GetPersistentVariables().GetNextPersistentVariableName();
-    }
-    return m_struct_vars->m_result_name;
-}
-
-lldb::ClangExpressionVariableSP
-ClangExpressionDeclMap::BuildIntegerVariable (const ConstString &name,
-                                              lldb_private::TypeFromParser type,
-                                              const llvm::APInt& value)
+bool 
+ClangExpressionDeclMap::AddPersistentVariable 
+(
+    const NamedDecl *decl, 
+    const ConstString &name, 
+    TypeFromParser parser_type,
+    bool is_result,
+    bool is_lvalue
+)
 {
     assert (m_parser_vars.get());
     
-    ExecutionContext &exe_ctx = m_parser_vars->m_exe_ctx;
-    
-    Target *target = exe_ctx.GetTargetPtr();
-    
-    if (!target)
-        return ClangExpressionVariableSP();
-
-    ASTContext *context(target->GetScratchClangASTContext()->getASTContext());
-    
-    TypeFromUser user_type(m_ast_importer->CopyType(context, 
-                                                    type.GetASTContext(),
-                                                    type.GetOpaqueQualType()),
-                           context);
-    
-    if (!user_type.GetOpaqueQualType())
+    if (m_parser_vars->m_materializer && is_result)
     {
-        Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
-
-        if (log)
-            log->Printf("ClangExpressionDeclMap::BuildIntegerVariable - Couldn't export the type for a constant integer result");
-        
-        return lldb::ClangExpressionVariableSP();
-    }
-    
-    if (!m_parser_vars->m_persistent_vars->CreatePersistentVariable (exe_ctx.GetBestExecutionContextScope (),
-                                                                     name, 
-                                                                     user_type, 
-                                                                     m_parser_vars->m_target_info.byte_order,
-                                                                     m_parser_vars->m_target_info.address_byte_size))
-        return lldb::ClangExpressionVariableSP();
-    
-    ClangExpressionVariableSP pvar_sp (m_parser_vars->m_persistent_vars->GetVariable(name));
-    
-    if (!pvar_sp)
-        return lldb::ClangExpressionVariableSP();
-    
-    uint8_t *pvar_data = pvar_sp->GetValueBytes();
-    if (pvar_data == NULL)
-        return lldb::ClangExpressionVariableSP();
-    
-    uint64_t value64 = value.getLimitedValue();
+        Error err;
         
-    size_t num_val_bytes = sizeof(value64);
-    size_t num_data_bytes = pvar_sp->GetByteSize();
-    
-    size_t num_bytes = num_val_bytes;
-    if (num_bytes > num_data_bytes)
-        num_bytes = num_data_bytes;
-    
-    for (size_t byte_idx = 0;
-         byte_idx < num_bytes;
-         ++byte_idx)
-    {
-        uint64_t shift = byte_idx * 8;
-        uint64_t mask = 0xffll << shift;
-        uint8_t cur_byte = (uint8_t)((value64 & mask) >> shift);
+        ExecutionContext &exe_ctx = m_parser_vars->m_exe_ctx;
+        Target *target = exe_ctx.GetTargetPtr();
+        if (target == NULL)
+            return false;
         
-        switch (m_parser_vars->m_target_info.byte_order)
-        {
-            case eByteOrderBig:
-                //                    High         Low
-                // Original:         |AABBCCDDEEFFGGHH|
-                // Target:                   |EEFFGGHH|
-                
-                pvar_data[num_data_bytes - (1 + byte_idx)] = cur_byte;
-                break;
-            case eByteOrderLittle:
-                // Target:                   |HHGGFFEE|
-                pvar_data[byte_idx] = cur_byte;
-                break;
-            default:
-                return lldb::ClangExpressionVariableSP();    
-        }
-    }
-    
-    pvar_sp->m_flags |= ClangExpressionVariable::EVIsFreezeDried;
-    pvar_sp->m_flags |= ClangExpressionVariable::EVIsLLDBAllocated;
-    pvar_sp->m_flags |= ClangExpressionVariable::EVNeedsAllocation;
-
-    return pvar_sp;
-}
-
-lldb::ClangExpressionVariableSP
-ClangExpressionDeclMap::BuildCastVariable (const ConstString &name,
-                                           VarDecl *decl,
-                                           lldb_private::TypeFromParser type)
-{
-    assert (m_parser_vars.get());
-    
-    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
-    
-    ExecutionContext &exe_ctx = m_parser_vars->m_exe_ctx;
-    Target *target = exe_ctx.GetTargetPtr();
-    if (target == NULL)
-        return lldb::ClangExpressionVariableSP();
-
-    ASTContext *context(target->GetScratchClangASTContext()->getASTContext());
-    
-    ClangExpressionVariableSP var_sp (m_found_entities.GetVariable(decl, GetParserID()));
-    
-    if (!var_sp)
-        var_sp = m_parser_vars->m_persistent_vars->GetVariable(decl, GetParserID());
-    
-    if (!var_sp)
-        return ClangExpressionVariableSP();
-    
-    TypeFromUser user_type(m_ast_importer->CopyType(context, 
-                                                    type.GetASTContext(),
-                                                    type.GetOpaqueQualType()),
-                           context);
-    
-    if (!user_type.GetOpaqueQualType())
-    {        
-        if (log)
-            log->Printf("ClangExpressionDeclMap::BuildCastVariable - Couldn't export the type for a constant cast result");
+        ASTContext *context(target->GetScratchClangASTContext()->getASTContext());
         
-        return lldb::ClangExpressionVariableSP();
-    }
-    
-    TypeFromUser var_type = var_sp->GetTypeFromUser();
-    
-    StackFrame *frame = exe_ctx.GetFramePtr();
-    if (frame == NULL)
-        return lldb::ClangExpressionVariableSP();
-    
-    VariableSP var = FindVariableInScope (*frame, var_sp->GetName(), &var_type);
-    
-    if (!var)
-        return lldb::ClangExpressionVariableSP(); // but we should handle this; it may be a persistent variable
-    
-    ValueObjectSP var_valobj = frame->GetValueObjectForFrameVariable(var, lldb::eNoDynamicValues);
-
-    if (!var_valobj)
-        return lldb::ClangExpressionVariableSP();
-    
-    ValueObjectSP var_casted_valobj = var_valobj->CastPointerType(name.GetCString(), user_type);
-    
-    if (!var_casted_valobj)
-        return lldb::ClangExpressionVariableSP();
-    
-    if (log)
-    {
-        StreamString my_stream_string;
+        TypeFromUser user_type(m_ast_importer->DeportType(context,
+                                                          parser_type.GetASTContext(),
+                                                          parser_type.GetOpaqueQualType()),
+                               context);
         
-        ClangASTType::DumpTypeDescription (var_type.GetASTContext(),
-                                           var_type.GetOpaqueQualType(),
-                                           &my_stream_string);
+        uint32_t offset = m_parser_vars->m_materializer->AddResultVariable(user_type, is_lvalue, m_keep_result_in_memory, err);
         
+        m_found_entities.CreateVariable(exe_ctx.GetBestExecutionContextScope(),
+                                        name,
+                                        user_type,
+                                        m_parser_vars->m_target_info.byte_order,
+                                        m_parser_vars->m_target_info.address_byte_size);
         
-        log->Printf("Building cast variable to type: %s", my_stream_string.GetString().c_str());
-    }
-    
-    ClangExpressionVariableSP pvar_sp = m_parser_vars->m_persistent_vars->CreatePersistentVariable (var_casted_valobj);
-    
-    if (!pvar_sp)
-        return lldb::ClangExpressionVariableSP();
-    
-    if (pvar_sp != m_parser_vars->m_persistent_vars->GetVariable(name))
-        return lldb::ClangExpressionVariableSP();
-    
-    pvar_sp->m_flags |= ClangExpressionVariable::EVIsFreezeDried;
-    pvar_sp->m_flags |= ClangExpressionVariable::EVIsLLDBAllocated;
-    pvar_sp->m_flags |= ClangExpressionVariable::EVNeedsAllocation;
-            
-    return pvar_sp;
-}
-
-bool
-ClangExpressionDeclMap::ResultIsReference (const ConstString &name)
-{
-    ClangExpressionVariableSP pvar_sp = m_parser_vars->m_persistent_vars->GetVariable(name);
-    
-    return (pvar_sp->m_flags & ClangExpressionVariable::EVIsProgramReference);
-}
-
-bool
-ClangExpressionDeclMap::CompleteResultVariable (lldb::ClangExpressionVariableSP &valobj, 
-                                                lldb_private::Value &value,
-                                                const ConstString &name,
-                                                lldb_private::TypeFromParser type,
-                                                bool transient,
-                                                bool maybe_make_load)
-{
-    assert (m_parser_vars.get());
+        ClangExpressionVariableSP var_sp (m_found_entities.GetVariable(name));
         
-    ClangExpressionVariableSP pvar_sp = m_parser_vars->m_persistent_vars->GetVariable(name);
-    
-    if (!pvar_sp)
-        return false;
+        if (!var_sp)
+            return false;
         
-    if (maybe_make_load && 
-        value.GetValueType() == Value::eValueTypeFileAddress &&
-        m_parser_vars->m_exe_ctx.GetProcessPtr())
-    {
-        value.SetValueType(Value::eValueTypeLoadAddress);
-    }
-    
-    if (pvar_sp->m_flags & ClangExpressionVariable::EVIsProgramReference &&
-        !pvar_sp->m_live_sp &&
-        !transient)
-    {
-        // The reference comes from the program.  We need to set up a live SP for it.
+        var_sp->EnableParserVars(GetParserID());
         
-        unsigned long long address = value.GetScalar().ULongLong();
-        AddressType address_type = value.GetValueAddressType();
+        ClangExpressionVariable::ParserVars *parser_vars = var_sp->GetParserVars(GetParserID());
+
+        parser_vars->m_named_decl = decl;
+        parser_vars->m_parser_type = parser_type;
         
-        pvar_sp->m_live_sp = ValueObjectConstResult::Create(m_parser_vars->m_exe_ctx.GetBestExecutionContextScope(),
-                                                            pvar_sp->GetTypeFromUser().GetASTContext(),
-                                                            pvar_sp->GetTypeFromUser().GetOpaqueQualType(),
-                                                            pvar_sp->GetName(),
-                                                            address,
-                                                            address_type,
-                                                            pvar_sp->GetByteSize());
-    }
-    
-    if (pvar_sp->m_flags & ClangExpressionVariable::EVNeedsFreezeDry)
-    {
-        pvar_sp->ValueUpdated();
+        var_sp->EnableJITVars(GetParserID());
         
-        const size_t pvar_byte_size = pvar_sp->GetByteSize();
-        uint8_t *pvar_data = pvar_sp->GetValueBytes();
+        ClangExpressionVariable::JITVars *jit_vars = var_sp->GetJITVars(GetParserID());
         
-        if (!ReadTarget(pvar_data, value, pvar_byte_size))
-            return false;
+        jit_vars->m_offset = offset;
         
-        pvar_sp->m_flags &= ~(ClangExpressionVariable::EVNeedsFreezeDry);
+        return true;
     }
     
-    valobj = pvar_sp;
-    
-    return true;
-}
-
-void
-ClangExpressionDeclMap::RemoveResultVariable
-(
-    const ConstString &name
-)
-{
-    ClangExpressionVariableSP pvar_sp = m_parser_vars->m_persistent_vars->GetVariable(name);
-    m_parser_vars->m_persistent_vars->RemovePersistentVariable(pvar_sp);
-}
-
-bool 
-ClangExpressionDeclMap::AddPersistentVariable 
-(
-    const NamedDecl *decl, 
-    const ConstString &name, 
-    TypeFromParser parser_type,
-    bool is_result,
-    bool is_lvalue
-)
-{
-    assert (m_parser_vars.get());
-    
     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
     ExecutionContext &exe_ctx = m_parser_vars->m_exe_ctx;
     Target *target = exe_ctx.GetTargetPtr();
@@ -525,12 +305,6 @@ ClangExpressionDeclMap::AddPersistentVar
     parser_vars->m_named_decl = decl;
     parser_vars->m_parser_type = parser_type;
     
-    if (m_parser_vars->m_materializer)
-    {
-        Error err;
-        m_parser_vars->m_materializer->AddResultVariable(user_type, m_keep_result_in_memory, err);
-    }
-    
     return true;
 }
 
@@ -580,6 +354,14 @@ ClangExpressionDeclMap::AddValueToStruct
 
     parser_vars->m_llvm_value = value;
     
+    if (ClangExpressionVariable::JITVars *jit_vars = var_sp->GetJITVars(GetParserID()))
+    {
+        // We already laid this out; do not touch
+        
+        if (log)
+            log->Printf("Already placed at 0x%llx", (unsigned long long)jit_vars->m_offset);
+    }
+    
     var_sp->EnableJITVars(GetParserID());
     
     ClangExpressionVariable::JITVars *jit_vars = var_sp->GetJITVars(GetParserID());
@@ -629,44 +411,11 @@ ClangExpressionDeclMap::DoStructLayout (
     if (m_struct_vars->m_struct_laid_out)
         return true;
     
-    if (m_parser_vars->m_materializer)
-    {
-        m_struct_vars->m_struct_alignment = m_parser_vars->m_materializer->GetStructAlignment();
-        m_struct_vars->m_struct_size = m_parser_vars->m_materializer->GetStructByteSize();
-        m_struct_vars->m_struct_laid_out = true;
-        return true;
-    }
-    
-    off_t cursor = 0;
-    
-    m_struct_vars->m_struct_alignment = 0;
-    m_struct_vars->m_struct_size = 0;
-    
-    for (size_t member_index = 0, num_members = m_struct_members.GetSize();
-         member_index < num_members;
-         ++member_index)
-    {
-        ClangExpressionVariableSP member_sp(m_struct_members.GetVariableAtIndex(member_index));
-        if (!member_sp)
-            return false;
-        
-        ClangExpressionVariable::JITVars *jit_vars = member_sp->GetJITVars(GetParserID());
-
-        if (!jit_vars)
-            return false;
-        
-        if (member_index == 0)
-            m_struct_vars->m_struct_alignment = jit_vars->m_alignment;
-        
-        if (cursor % jit_vars->m_alignment)
-            cursor += (jit_vars->m_alignment - (cursor % jit_vars->m_alignment));
-        
-        jit_vars->m_offset = cursor;
-        cursor += jit_vars->m_size;
-    }
-    
-    m_struct_vars->m_struct_size = cursor;
+    if (!m_parser_vars->m_materializer)
+        return false;
     
+    m_struct_vars->m_struct_alignment = m_parser_vars->m_materializer->GetStructAlignment();
+    m_struct_vars->m_struct_size = m_parser_vars->m_materializer->GetStructByteSize();
     m_struct_vars->m_struct_laid_out = true;
     return true;
 }
@@ -706,1864 +455,239 @@ ClangExpressionDeclMap::GetStructElement
         return false;
     
     if (index >= m_struct_members.GetSize())
-        return false;
-    
-    ClangExpressionVariableSP member_sp(m_struct_members.GetVariableAtIndex(index));
-    
-    if (!member_sp)
-        return false;
-    
-    ClangExpressionVariable::ParserVars *parser_vars = member_sp->GetParserVars(GetParserID());
-    ClangExpressionVariable::JITVars *jit_vars = member_sp->GetJITVars(GetParserID());
-    
-    if (!parser_vars ||
-        !jit_vars ||
-        !member_sp->GetValueObject())
-        return false;
-    
-    decl = parser_vars->m_named_decl;
-    value = parser_vars->m_llvm_value;
-    offset = jit_vars->m_offset;
-    name = member_sp->GetName();
-        
-    return true;
-}
-
-bool
-ClangExpressionDeclMap::GetFunctionInfo 
-(
-    const NamedDecl *decl, 
-    uint64_t &ptr
-)
-{
-    ClangExpressionVariableSP entity_sp(m_found_entities.GetVariable(decl, GetParserID()));
-
-    if (!entity_sp)
-        return false;
-    
-    // We know m_parser_vars is valid since we searched for the variable by
-    // its NamedDecl
-    
-    ClangExpressionVariable::ParserVars *parser_vars = entity_sp->GetParserVars(GetParserID());
-
-    ptr = parser_vars->m_lldb_value->GetScalar().ULongLong();
-    
-    return true;
-}
-
-static void
-FindCodeSymbolInContext
-(
-    const ConstString &name,
-    SymbolContext &sym_ctx,
-    SymbolContextList &sc_list
-)
-{
-    SymbolContextList temp_sc_list;
-    if (sym_ctx.module_sp)
-        sym_ctx.module_sp->FindSymbolsWithNameAndType(name, eSymbolTypeAny, temp_sc_list);
-    
-    if (!sc_list.GetSize() && sym_ctx.target_sp)
-        sym_ctx.target_sp->GetImages().FindSymbolsWithNameAndType(name, eSymbolTypeAny, temp_sc_list);
-
-    unsigned temp_sc_list_size = temp_sc_list.GetSize();
-    for (unsigned i = 0; i < temp_sc_list_size; i++)
-    {
-        SymbolContext sym_ctx;
-        temp_sc_list.GetContextAtIndex(i, sym_ctx);
-        if (sym_ctx.symbol)
-        {
-            switch (sym_ctx.symbol->GetType())
-            {
-                case eSymbolTypeCode:
-                case eSymbolTypeResolver:
-                    sc_list.Append(sym_ctx);
-                    break;
-
-                default:
-                    break;
-            }
-        }
-    }
-}
-
-bool
-ClangExpressionDeclMap::GetFunctionAddress 
-(
-    const ConstString &name,
-    uint64_t &func_addr
-)
-{
-    assert (m_parser_vars.get());
-    
-    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
-    ExecutionContext &exe_ctx = m_parser_vars->m_exe_ctx;
-    Target *target = exe_ctx.GetTargetPtr();
-    // Back out in all cases where we're not fully initialized
-    if (target == NULL)
-        return false;
-    if (!m_parser_vars->m_sym_ctx.target_sp)
-        return false;
-
-    SymbolContextList sc_list;
-    
-    FindCodeSymbolInContext(name, m_parser_vars->m_sym_ctx, sc_list);
-
-    if (!sc_list.GetSize())
-    {
-        // We occasionally get debug information in which a const function is reported 
-        // as non-const, so the mangled name is wrong.  This is a hack to compensate.
-        
-        if (!strncmp(name.GetCString(), "_ZN", 3) &&
-            strncmp(name.GetCString(), "_ZNK", 4))
-        {
-            std::string fixed_scratch("_ZNK");
-            fixed_scratch.append(name.GetCString() + 3);
-            ConstString fixed_name(fixed_scratch.c_str());
-            
-            if (log)
-                log->Printf("Failed to find symbols given non-const name %s; trying %s", name.GetCString(), fixed_name.GetCString());
-            
-            FindCodeSymbolInContext(fixed_name, m_parser_vars->m_sym_ctx, sc_list);
-        }
-    }
-    
-    if (!sc_list.GetSize())
-        return false;
-
-    SymbolContext sym_ctx;
-    sc_list.GetContextAtIndex(0, sym_ctx);
-
-    const Address *func_so_addr = NULL;
-    bool is_indirect_function = false;
-
-    if (sym_ctx.function)
-        func_so_addr = &sym_ctx.function->GetAddressRange().GetBaseAddress();
-    else if (sym_ctx.symbol) {
-        func_so_addr = &sym_ctx.symbol->GetAddress();
-        is_indirect_function = sym_ctx.symbol->IsIndirect();
-    } else
-        return false;
-
-    if (!func_so_addr || !func_so_addr->IsValid())
-        return false;
-
-    func_addr = func_so_addr->GetCallableLoadAddress (target, is_indirect_function);
-
-    return true;
-}
-
-addr_t
-ClangExpressionDeclMap::GetSymbolAddress (Target &target, Process *process, const ConstString &name, lldb::SymbolType symbol_type)
-{
-    SymbolContextList sc_list;
-    
-    target.GetImages().FindSymbolsWithNameAndType(name, symbol_type, sc_list);
-    
-    const uint32_t num_matches = sc_list.GetSize();
-    addr_t symbol_load_addr = LLDB_INVALID_ADDRESS;
-
-    for (uint32_t i=0; i<num_matches && (symbol_load_addr == 0 || symbol_load_addr == LLDB_INVALID_ADDRESS); i++)
-    {
-        SymbolContext sym_ctx;
-        sc_list.GetContextAtIndex(i, sym_ctx);
-    
-        const Address *sym_address = &sym_ctx.symbol->GetAddress();
-        
-        if (!sym_address || !sym_address->IsValid())
-            return LLDB_INVALID_ADDRESS;
-        
-        if (sym_address)
-        {
-            switch (sym_ctx.symbol->GetType())
-            {
-                case eSymbolTypeCode:
-                case eSymbolTypeTrampoline:
-                    symbol_load_addr = sym_address->GetCallableLoadAddress (&target);
-                    break;
-
-                case eSymbolTypeResolver:
-                    symbol_load_addr = sym_address->GetCallableLoadAddress (&target, true);
-                    break;
-
-                case eSymbolTypeData:
-                case eSymbolTypeRuntime:
-                case eSymbolTypeVariable:
-                case eSymbolTypeLocal:
-                case eSymbolTypeParam:
-                case eSymbolTypeInvalid:
-                case eSymbolTypeAbsolute:
-                case eSymbolTypeException:
-                case eSymbolTypeSourceFile:
-                case eSymbolTypeHeaderFile:
-                case eSymbolTypeObjectFile:
-                case eSymbolTypeCommonBlock:
-                case eSymbolTypeBlock:
-                case eSymbolTypeVariableType:
-                case eSymbolTypeLineEntry:
-                case eSymbolTypeLineHeader:
-                case eSymbolTypeScopeBegin:
-                case eSymbolTypeScopeEnd:
-                case eSymbolTypeAdditional:
-                case eSymbolTypeCompiler:
-                case eSymbolTypeInstrumentation:
-                case eSymbolTypeUndefined:
-                case eSymbolTypeObjCClass:
-                case eSymbolTypeObjCMetaClass:
-                case eSymbolTypeObjCIVar:
-                    symbol_load_addr = sym_address->GetLoadAddress (&target);
-                    break;
-            }
-        }
-    }
-    
-    if (symbol_load_addr == LLDB_INVALID_ADDRESS && process)
-    {
-        ObjCLanguageRuntime *runtime = process->GetObjCLanguageRuntime();
-        
-        if (runtime)
-        {
-            symbol_load_addr = runtime->LookupRuntimeSymbol(name);
-        }
-    }
-    
-    return symbol_load_addr;
-}
-
-addr_t
-ClangExpressionDeclMap::GetSymbolAddress (const ConstString &name, lldb::SymbolType symbol_type)
-{
-    assert (m_parser_vars.get());
-    
-    if (!m_parser_vars->m_exe_ctx.GetTargetPtr())
-        return false;
-    
-    return GetSymbolAddress(m_parser_vars->m_exe_ctx.GetTargetRef(), m_parser_vars->m_exe_ctx.GetProcessPtr(), name, symbol_type);
-}
-
-// Interface for IRInterpreter
-
-Value 
-ClangExpressionDeclMap::WrapBareAddress (lldb::addr_t addr)
-{
-    Value ret;
-
-    ret.SetContext(Value::eContextTypeInvalid, NULL);
-
-    if (m_parser_vars->m_exe_ctx.GetProcessPtr())
-        ret.SetValueType(Value::eValueTypeLoadAddress);
-    else
-        ret.SetValueType(Value::eValueTypeFileAddress);
-
-    ret.GetScalar() = (unsigned long long)addr;
-
-    return ret;
-}
-
-bool
-ClangExpressionDeclMap::WriteTarget (lldb_private::Value &value,
-                                     const uint8_t *data,
-                                     size_t length)
-{
-    assert (m_parser_vars.get());
-    
-    ExecutionContext &exe_ctx = m_parser_vars->m_exe_ctx;
-    
-    Process *process = exe_ctx.GetProcessPtr();
-    if (value.GetContextType() == Value::eContextTypeRegisterInfo)
-    {
-        if (!process)
-            return false;
-        
-        RegisterContext *reg_ctx = exe_ctx.GetRegisterContext();
-        RegisterInfo *reg_info = value.GetRegisterInfo();
-        
-        if (!reg_ctx)
-            return false;
-        
-        lldb_private::RegisterValue reg_value;
-        Error err;
-        
-        if (!reg_value.SetFromMemoryData (reg_info, data, length, process->GetByteOrder(), err))
-            return false;
-        
-        return reg_ctx->WriteRegister(reg_info, reg_value);
-    }
-    else
-    {
-        switch (value.GetValueType())
-        {
-        default:
-            return false;
-        case Value::eValueTypeFileAddress:
-            {
-                if (!process)
-                    return false;
-                
-                Target *target = exe_ctx.GetTargetPtr();
-                Address file_addr;
-                
-                if (!target->GetImages().ResolveFileAddress((lldb::addr_t)value.GetScalar().ULongLong(), file_addr))
-                    return false;
-                
-                lldb::addr_t load_addr = file_addr.GetLoadAddress(target);
-                
-                Error err;
-                process->WriteMemory(load_addr, data, length, err);
-                
-                return err.Success();
-            }
-        case Value::eValueTypeLoadAddress:
-            {
-                if (!process)
-                    return false;
-                
-                Error err;
-                process->WriteMemory((lldb::addr_t)value.GetScalar().ULongLong(), data, length, err);
-    
-                return err.Success();
-            }
-        case Value::eValueTypeHostAddress:
-            {
-                if (value.GetScalar().ULongLong() == 0 || data == NULL)
-                    return false;
-                memcpy ((void *)value.GetScalar().ULongLong(), data, length);
-                return true;
-            }
-        case Value::eValueTypeScalar:
-            return false;
-        }
-    }
-}
-
-bool
-ClangExpressionDeclMap::ReadTarget (uint8_t *data,
-                                    lldb_private::Value &value,
-                                    size_t length)
-{
-    assert (m_parser_vars.get());
-    
-    ExecutionContext &exe_ctx = m_parser_vars->m_exe_ctx;
-
-    Process *process = exe_ctx.GetProcessPtr();
-
-    if (value.GetContextType() == Value::eContextTypeRegisterInfo)
-    {
-        if (!process)
-            return false;
-        
-        RegisterContext *reg_ctx = exe_ctx.GetRegisterContext();
-        RegisterInfo *reg_info = value.GetRegisterInfo();
-        
-        if (!reg_ctx)
-            return false;
-        
-        lldb_private::RegisterValue reg_value;
-        Error err;
-        
-        if (!reg_ctx->ReadRegister(reg_info, reg_value))
-            return false;
-        
-        return reg_value.GetAsMemoryData(reg_info, data, length, process->GetByteOrder(), err);        
-    }
-    else
-    {
-        switch (value.GetValueType())
-        {
-            default:
-                return false;
-            case Value::eValueTypeFileAddress:
-            {
-                Target *target = exe_ctx.GetTargetPtr();
-                if (target == NULL)
-                    return false;
-                
-                Address file_addr;
-                
-                if (!target->GetImages().ResolveFileAddress((lldb::addr_t)value.GetScalar().ULongLong(), file_addr))
-                    return false;
-                
-                Error err;
-                target->ReadMemory(file_addr, false, data, length, err);
-                
-                return err.Success();
-            }
-            case Value::eValueTypeLoadAddress:
-            {
-                if (!process)
-                    return false;
-                
-                Error err;
-                process->ReadMemory((lldb::addr_t)value.GetScalar().ULongLong(), data, length, err);
-                
-                return err.Success();
-            }
-            case Value::eValueTypeHostAddress:
-            {
-                void *host_addr = (void*)value.GetScalar().ULongLong();
-                
-                if (!host_addr)
-                    return false;
-                
-                memcpy (data, host_addr, length);
-                return true;
-            }
-            case Value::eValueTypeScalar:
-                return false;
-        }
-    }
-}
-
-lldb_private::Value
-ClangExpressionDeclMap::LookupDecl (clang::NamedDecl *decl, ClangExpressionVariable::FlagType &flags)
-{
-    assert (m_parser_vars.get());
-            
-    ClangExpressionVariableSP expr_var_sp (m_found_entities.GetVariable(decl, GetParserID()));
-    ClangExpressionVariableSP persistent_var_sp (m_parser_vars->m_persistent_vars->GetVariable(decl, GetParserID()));
-    
-    if (isa<FunctionDecl>(decl))
-    {
-        ClangExpressionVariableSP entity_sp(m_found_entities.GetVariable(decl, GetParserID()));
-        
-        if (!entity_sp)
-            return Value();
-        
-        // We know m_parser_vars is valid since we searched for the variable by
-        // its NamedDecl
-        
-        ClangExpressionVariable::ParserVars *parser_vars = entity_sp->GetParserVars(GetParserID());
-        
-        return *parser_vars->m_lldb_value;
-    }
-    
-    if (expr_var_sp)
-    {
-        flags = expr_var_sp->m_flags;
-
-        ClangExpressionVariable::ParserVars *parser_vars = expr_var_sp->GetParserVars(GetParserID());
-
-        if (!parser_vars)
-            return Value();
-        
-        bool is_reference = expr_var_sp->m_flags & ClangExpressionVariable::EVTypeIsReference;
-
-        if (parser_vars->m_lldb_var)
-        {
-            std::auto_ptr<Value> value(GetVariableValue(parser_vars->m_lldb_var, NULL));
-            
-            if (is_reference && value.get() && value->GetValueType() == Value::eValueTypeLoadAddress)
-            {
-                Process *process = m_parser_vars->m_exe_ctx.GetProcessPtr();
-                
-                if (!process)
-                    return Value();
-                
-                lldb::addr_t value_addr = value->GetScalar().ULongLong();
-                Error read_error;
-                addr_t ref_value = process->ReadPointerFromMemory (value_addr, read_error);
-                
-                if (!read_error.Success())
-                    return Value();
-                
-                value->GetScalar() = (unsigned long long)ref_value;
-            }
-        
-            if (value.get())
-                return *value;
-            else
-                return Value();
-        }
-        else if (parser_vars->m_lldb_sym)
-        {
-            const Address sym_address = parser_vars->m_lldb_sym->GetAddress();
-            
-            if (!sym_address.IsValid())
-                return Value();
-                        
-            Value ret;
-        
-            ProcessSP process_sp (m_parser_vars->m_exe_ctx.GetProcessSP());
-            
-            if (process_sp)
-            {
-                uint64_t symbol_load_addr = sym_address.GetLoadAddress(&process_sp->GetTarget());
-                
-                ret.GetScalar() = symbol_load_addr;
-                ret.SetValueType(Value::eValueTypeLoadAddress);
-            }
-            else 
-            {
-                uint64_t symbol_file_addr = sym_address.GetFileAddress();
-                
-                ret.GetScalar() = symbol_file_addr;
-                ret.SetValueType(Value::eValueTypeFileAddress);
-            }
-            
-            return ret;
-        }
-        else if (RegisterInfo *reg_info = expr_var_sp->GetRegisterInfo())
-        {
-            StackFrame *frame = m_parser_vars->m_exe_ctx.GetFramePtr();
-            
-            if (!frame)
-                return Value();
-            
-            RegisterContextSP reg_context_sp(frame->GetRegisterContextSP());
-            
-            RegisterValue reg_value;
-            
-            if (!reg_context_sp->ReadRegister(reg_info, reg_value))
-                return Value();
-            
-            Value ret;
-            
-            ret.SetContext(Value::eContextTypeRegisterInfo, reg_info);
-            if (reg_info->encoding == eEncodingVector) 
-			{
-                if (ret.SetVectorBytes((uint8_t *)reg_value.GetBytes(), reg_value.GetByteSize(), reg_value.GetByteOrder()))
-                    ret.SetScalarFromVector();
-            }
-            else if (!reg_value.GetScalarValue(ret.GetScalar()))
-				return Value();
-            
-            return ret;
-        }
-        else
-        {
-            return Value();
-        }
-    }
-    else if (persistent_var_sp)
-    {
-        flags = persistent_var_sp->m_flags;
-        
-        if ((persistent_var_sp->m_flags & ClangExpressionVariable::EVIsProgramReference ||
-             persistent_var_sp->m_flags & ClangExpressionVariable::EVIsLLDBAllocated) &&
-            persistent_var_sp->m_live_sp &&
-            ((persistent_var_sp->m_live_sp->GetValue().GetValueType() == Value::eValueTypeLoadAddress &&
-              m_parser_vars->m_exe_ctx.GetProcessSP() &&
-              m_parser_vars->m_exe_ctx.GetProcessSP()->IsAlive()) ||
-             (persistent_var_sp->m_live_sp->GetValue().GetValueType() == Value::eValueTypeFileAddress)))
-        {
-            return persistent_var_sp->m_live_sp->GetValue();
-        }
-        else
-        {
-            lldb_private::Value ret;
-            ret.SetValueType(Value::eValueTypeHostAddress);
-            ret.SetContext(Value::eContextTypeInvalid, NULL);
-            ret.GetScalar() = (lldb::addr_t)persistent_var_sp->GetValueBytes();
-            return ret;
-        }
-    }
-    else
-    {
-        return Value();
-    }
-}
-
-Value
-ClangExpressionDeclMap::GetSpecialValue (const ConstString &name)
-{
-    assert(m_parser_vars.get());
-    
-    StackFrame *frame = m_parser_vars->m_exe_ctx.GetFramePtr();
-    
-    if (!frame)
-        return Value();
-    
-    VariableList *vars = frame->GetVariableList(false);
-    
-    if (!vars)
-        return Value();
-    
-    lldb::VariableSP var = vars->FindVariable(name);
-    
-    if (!var ||
-        !var->IsInScope(frame) || 
-        !var->LocationIsValidForFrame (frame))
-        return Value();
-    
-    std::auto_ptr<Value> value(GetVariableValue(var, NULL));
-    
-    if (value.get() && value->GetValueType() == Value::eValueTypeLoadAddress)
-    {
-        Process *process = m_parser_vars->m_exe_ctx.GetProcessPtr();
-        
-        if (!process)
-            return Value();
-        
-        lldb::addr_t value_addr = value->GetScalar().ULongLong();
-        Error read_error;
-        addr_t ptr_value = process->ReadPointerFromMemory (value_addr, read_error);
-        
-        if (!read_error.Success())
-            return Value();
-        
-        value->GetScalar() = (unsigned long long)ptr_value;
-    }
-    
-    if (value.get())
-        return *value;
-    else
-        return Value();
-}
-
-// Interface for CommandObjectExpression
-
-bool 
-ClangExpressionDeclMap::Materialize 
-(
-    lldb::addr_t &struct_address,
-    Error &err
-)
-{
-    if (!m_parser_vars.get())
-        return false;
-    
-    EnableMaterialVars();
-    
-    m_material_vars->m_process = m_parser_vars->m_exe_ctx.GetProcessPtr();
-    
-    bool result = DoMaterialize(false /* dematerialize */, 
-                                LLDB_INVALID_ADDRESS /* top of stack frame */, 
-                                LLDB_INVALID_ADDRESS /* bottom of stack frame */, 
-                                NULL, /* result SP */
-                                err);
-    
-    if (result)
-        struct_address = m_material_vars->m_materialized_location;
-    
-    return result;
-}
-
-bool 
-ClangExpressionDeclMap::GetObjectPointer
-(
-    lldb::addr_t &object_ptr,
-    ConstString &object_name,
-    Error &err,
-    bool suppress_type_check
-)
-{
-    assert (m_struct_vars.get());
-    
-    Target *target = m_parser_vars->m_exe_ctx.GetTargetPtr();
-    Process *process = m_parser_vars->m_exe_ctx.GetProcessPtr();
-    StackFrame *frame = m_parser_vars->m_exe_ctx.GetFramePtr();
-
-    if (frame == NULL || process == NULL || target == NULL)
-    {
-        err.SetErrorStringWithFormat("Couldn't load '%s' because the context is incomplete", object_name.AsCString());
-        return false;
-    }
-    
-    if (!m_struct_vars->m_object_pointer_type.GetOpaqueQualType())
-    {
-        err.SetErrorStringWithFormat("Couldn't load '%s' because its type is unknown", object_name.AsCString());
-        return false;
-    }
-    
-    const bool object_pointer = true;
-    
-    VariableSP object_ptr_var = FindVariableInScope (*frame,
-                                                     object_name, 
-                                                     (suppress_type_check ? NULL : &m_struct_vars->m_object_pointer_type),
-                                                     object_pointer);
-    
-    if (!object_ptr_var)
-    {
-        err.SetErrorStringWithFormat("Couldn't find '%s' with appropriate type in scope", object_name.AsCString());
-        return false;
-    }
-    
-    std::auto_ptr<lldb_private::Value> location_value(GetVariableValue(object_ptr_var,
-                                                                       NULL));
-    
-    if (!location_value.get())
-    {
-        err.SetErrorStringWithFormat("Couldn't get the location for '%s'", object_name.GetCString());
-        return false;
-    }
-    
-    switch (location_value->GetValueType())
-    {
-    default:
-        err.SetErrorStringWithFormat("'%s' is not in memory; LLDB must be extended to handle registers", object_name.GetCString());
-        return false;
-    case Value::eValueTypeLoadAddress:
-        {
-            lldb::addr_t value_addr = location_value->GetScalar().ULongLong();
-            uint32_t address_byte_size = target->GetArchitecture().GetAddressByteSize();
-            
-            if (ClangASTType::GetClangTypeBitWidth(m_struct_vars->m_object_pointer_type.GetASTContext(), 
-                                                   m_struct_vars->m_object_pointer_type.GetOpaqueQualType()) != address_byte_size * 8)
-            {
-                err.SetErrorStringWithFormat("'%s' is not of an expected pointer size", object_name.GetCString());
-                return false;
-            }
-            
-            Error read_error;
-            object_ptr = process->ReadPointerFromMemory (value_addr, read_error);
-            if (read_error.Fail() || object_ptr == LLDB_INVALID_ADDRESS)
-            {
-                err.SetErrorStringWithFormat("Coldn't read '%s' from the target: %s", object_name.GetCString(), read_error.AsCString());
-                return false;
-            }            
-            return true;
-        }
-    case Value::eValueTypeScalar:
-        {
-            if (location_value->GetContextType() != Value::eContextTypeRegisterInfo)
-            {
-                StreamString ss;
-                location_value->Dump(&ss);
-                
-                err.SetErrorStringWithFormat("%s is a scalar of unhandled type: %s", object_name.GetCString(), ss.GetString().c_str());
-                return false;
-            }
-                        
-            RegisterInfo *reg_info = location_value->GetRegisterInfo();
-            
-            if (!reg_info)
-            {
-                err.SetErrorStringWithFormat("Couldn't get the register information for %s", object_name.GetCString());
-                return false;
-            }
-            
-            RegisterContext *reg_ctx = m_parser_vars->m_exe_ctx.GetRegisterContext();
-            
-            if (!reg_ctx)
-            {
-                err.SetErrorStringWithFormat("Couldn't read register context to read %s from %s", object_name.GetCString(), reg_info->name);
-                return false;
-            }
-            
-            uint32_t register_number = reg_info->kinds[lldb::eRegisterKindLLDB];
-            
-            object_ptr = reg_ctx->ReadRegisterAsUnsigned(register_number, 0x0);
-            
-            return true;
-        }
-    }
-}
-
-bool 
-ClangExpressionDeclMap::Dematerialize 
-(
-    ClangExpressionVariableSP &result_sp,
-    lldb::addr_t stack_frame_top,
-    lldb::addr_t stack_frame_bottom,
-    Error &err
-)
-{
-    return DoMaterialize(true, stack_frame_top, stack_frame_bottom, &result_sp, err);
-    
-    DidDematerialize();
-}
-
-void
-ClangExpressionDeclMap::DidDematerialize()
-{
-    if (m_material_vars.get())
-    {
-        if (m_material_vars->m_materialized_location)
-        {        
-            //#define SINGLE_STEP_EXPRESSIONS
-            
-#ifndef SINGLE_STEP_EXPRESSIONS
-            m_material_vars->m_process->DeallocateMemory(m_material_vars->m_materialized_location);
-#endif
-            m_material_vars->m_materialized_location = 0;
-        }
-        
-        DisableMaterialVars();
-    }
-}
-
-bool
-ClangExpressionDeclMap::DumpMaterializedStruct
-(
-    Stream &s,
-    Error &err
-)
-{
-    assert (m_struct_vars.get());
-    assert (m_material_vars.get());
-    
-    if (!m_struct_vars->m_struct_laid_out)
-    {
-        err.SetErrorString("Structure hasn't been laid out yet");
-        return false;
-    }
-    Process *process = m_parser_vars->m_exe_ctx.GetProcessPtr();
-
-    if (!process)
-    {
-        err.SetErrorString("Couldn't find the process");
-        return false;
-    }
-    
-    Target *target = m_parser_vars->m_exe_ctx.GetTargetPtr();
-    if (!target)
-    {
-        err.SetErrorString("Couldn't find the target");
-        return false;
-    }
-    
-    if (!m_material_vars->m_materialized_location)
-    {
-        err.SetErrorString("No materialized location");
-        return false;
-    }
-    
-    lldb::DataBufferSP data_sp(new DataBufferHeap(m_struct_vars->m_struct_size, 0));    
-    
-    Error error;
-    if (process->ReadMemory (m_material_vars->m_materialized_location, 
-                                     data_sp->GetBytes(), 
-                                     data_sp->GetByteSize(), error) != data_sp->GetByteSize())
-    {
-        err.SetErrorStringWithFormat ("Couldn't read struct from the target: %s", error.AsCString());
-        return false;
-    }
-    
-    DataExtractor extractor(data_sp, process->GetByteOrder(), target->GetArchitecture().GetAddressByteSize());
-    
-    for (size_t member_idx = 0, num_members = m_struct_members.GetSize();
-         member_idx < num_members;
-         ++member_idx)
-    {
-        ClangExpressionVariableSP member_sp(m_struct_members.GetVariableAtIndex(member_idx));
-        
-        if (!member_sp)
-            return false;
-
-        s.Printf("[%s]\n", member_sp->GetName().GetCString());
-        
-        ClangExpressionVariable::JITVars *jit_vars = member_sp->GetJITVars(GetParserID());
-
-        if (!jit_vars)
-            return false;
-        
-        extractor.Dump (&s,                                                                          // stream
-                        jit_vars->m_offset,                                                          // offset
-                        lldb::eFormatBytesWithASCII,                                                 // format
-                        1,                                                                           // byte size of individual entries
-                        jit_vars->m_size,                                                            // number of entries
-                        16,                                                                          // entries per line
-                        m_material_vars->m_materialized_location + jit_vars->m_offset,               // address to print
-                        0,                                                                           // bit size (bitfields only; 0 means ignore)
-                        0);                                                                          // bit alignment (bitfields only; 0 means ignore)
-        
-        s.PutChar('\n');
-    }
-    
-    return true;
-}
-
-bool 
-ClangExpressionDeclMap::DoMaterialize 
-(
-    bool dematerialize,
-    lldb::addr_t stack_frame_top,
-    lldb::addr_t stack_frame_bottom,
-    lldb::ClangExpressionVariableSP *result_sp_ptr,
-    Error &err
-)
-{
-    if (result_sp_ptr)
-        result_sp_ptr->reset();
-
-    assert (m_struct_vars.get());
-    
-    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
-    
-    if (!m_struct_vars->m_struct_laid_out)
-    {
-        err.SetErrorString("Structure hasn't been laid out yet");
-        return false;
-    }
-    
-    StackFrame *frame = m_parser_vars->m_exe_ctx.GetFramePtr();
-    if (!frame)
-    {
-        err.SetErrorString("Received null execution frame");
-        return false;
-    }
-    Target *target = m_parser_vars->m_exe_ctx.GetTargetPtr();
-    
-    ClangPersistentVariables &persistent_vars = target->GetPersistentVariables();
-        
-    if (!m_struct_vars->m_struct_size)
-    {
-        if (log)
-            log->PutCString("Not bothering to allocate a struct because no arguments are needed");
-        
-        m_material_vars->m_allocated_area = 0UL;
-        
-        return true;
-    }
-    
-    const SymbolContext &sym_ctx(frame->GetSymbolContext(lldb::eSymbolContextEverything));
-    
-    if (!dematerialize)
-    {
-        Process *process = m_parser_vars->m_exe_ctx.GetProcessPtr();
-        if (m_material_vars->m_materialized_location)
-        {
-            process->DeallocateMemory(m_material_vars->m_materialized_location);
-            m_material_vars->m_materialized_location = 0;
-        }
-        
-        if (log)
-            log->PutCString("Allocating memory for materialized argument struct");
-        
-        lldb::addr_t mem = process->AllocateMemory(m_struct_vars->m_struct_alignment + m_struct_vars->m_struct_size, 
-                                                   lldb::ePermissionsReadable | lldb::ePermissionsWritable,
-                                                   err);
-        
-        if (mem == LLDB_INVALID_ADDRESS)
-        {
-            err.SetErrorStringWithFormat("Couldn't allocate 0x%llx bytes for materialized argument struct",
-                                         (unsigned long long)(m_struct_vars->m_struct_alignment + m_struct_vars->m_struct_size));
-            return false;
-        }
-            
-        m_material_vars->m_allocated_area = mem;
-    }
-    
-    m_material_vars->m_materialized_location = m_material_vars->m_allocated_area;
-    
-    if (m_material_vars->m_materialized_location % m_struct_vars->m_struct_alignment)
-        m_material_vars->m_materialized_location += (m_struct_vars->m_struct_alignment - (m_material_vars->m_materialized_location % m_struct_vars->m_struct_alignment));
-    
-    for (uint64_t member_index = 0, num_members = m_struct_members.GetSize();
-         member_index < num_members;
-         ++member_index)
-    {
-        ClangExpressionVariableSP member_sp(m_struct_members.GetVariableAtIndex(member_index));
-        
-        ClangExpressionVariable::JITVars *jit_vars = member_sp->GetJITVars(GetParserID());
-        
-        if (!jit_vars)
-        {
-            err.SetErrorString("Variable being materialized doesn't have JIT state");
-            return false;
-        }
-        
-        if (m_found_entities.ContainsVariable (member_sp))
-        {
-            if (!member_sp->GetValueObject())
-            {
-                err.SetErrorString("Variable being materialized doesn't have a frozen version");
-                return false;
-            }
-            
-            RegisterInfo *reg_info = member_sp->GetRegisterInfo ();
-            if (reg_info)
-            {
-                // This is a register variable
-                
-                RegisterContext *reg_ctx = m_parser_vars->m_exe_ctx.GetRegisterContext();
-                
-                if (!reg_ctx)
-                {
-                    err.SetErrorString("Couldn't get register context");
-                    return false;
-                }
-                    
-                if (!DoMaterializeOneRegister (dematerialize, 
-                                               *reg_ctx, 
-                                               *reg_info, 
-                                               m_material_vars->m_materialized_location + jit_vars->m_offset,
-                                               err))
-                    return false;
-            }
-            else
-            {                
-                if (!DoMaterializeOneVariable (dematerialize, 
-                                               sym_ctx,
-                                               member_sp,
-                                               m_material_vars->m_materialized_location + jit_vars->m_offset,
-                                               err))
-                    return false;
-            }
-        }
-        else
-        {
-            // No need to look for presistent variables if the name doesn't start 
-            // with with a '$' character...
-            if (member_sp->GetName().AsCString ("!")[0] == '$' && persistent_vars.ContainsVariable(member_sp))
-            {
-                
-                if (member_sp->GetName() == m_struct_vars->m_result_name)
-                {
-                    if (log)
-                        log->PutCString("Found result member in the struct");
-
-                    if (result_sp_ptr)
-                        *result_sp_ptr = member_sp;
-                    
-                }
-
-                if (!DoMaterializeOnePersistentVariable (dematerialize, 
-                                                         member_sp, 
-                                                         m_material_vars->m_materialized_location + jit_vars->m_offset,
-                                                         stack_frame_top,
-                                                         stack_frame_bottom,
-                                                         err))
-                    return false;
-            }
-            else
-            {
-                err.SetErrorStringWithFormat("Unexpected variable %s", member_sp->GetName().GetCString());
-                return false;
-            }
-        }
-    }
-    
-    return true;
-}
-
-bool
-ClangExpressionDeclMap::DoMaterializeOnePersistentVariable
-(
-    bool dematerialize,
-    ClangExpressionVariableSP &var_sp,
-    lldb::addr_t addr,
-    lldb::addr_t stack_frame_top,
-    lldb::addr_t stack_frame_bottom,
-    Error &err
-)
-{
-    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
-
-    if (!var_sp)
-    {
-        err.SetErrorString("Invalid persistent variable");
-        return /*LLDB_INVALID_ADDRESS*/false;
-    }
-    
-    const size_t pvar_byte_size = var_sp->GetByteSize();
-    
-    uint8_t *pvar_data = var_sp->GetValueBytes();
-    if (pvar_data == NULL)
-    {
-        err.SetErrorString("Persistent variable being materialized contains no data");
-        return false;
-    }
-    
-    Error error;
-    Process *process = m_parser_vars->m_exe_ctx.GetProcessPtr();
-
-    lldb::addr_t mem; // The address of a spare memory area used to hold the persistent variable.
-    
-    if (dematerialize)
-    {
-        if (log)
-            log->Printf("Dematerializing persistent variable with flags 0x%hx", var_sp->m_flags);
-        
-        if ((var_sp->m_flags & ClangExpressionVariable::EVIsLLDBAllocated) ||
-            (var_sp->m_flags & ClangExpressionVariable::EVIsProgramReference))
-        {
-            // Get the location of the target out of the struct.
-            
-            Error read_error;
-            mem = process->ReadPointerFromMemory (addr, read_error);
-            
-            if (mem == LLDB_INVALID_ADDRESS)
-            {
-                err.SetErrorStringWithFormat("Couldn't read address of %s from struct: %s", var_sp->GetName().GetCString(), error.AsCString());
-                return false;
-            }
-            
-            if (var_sp->m_flags & ClangExpressionVariable::EVIsProgramReference &&
-                !var_sp->m_live_sp)
-            {
-                // If the reference comes from the program, then the ClangExpressionVariable's
-                // live variable data hasn't been set up yet.  Do this now.
-                
-                var_sp->m_live_sp = ValueObjectConstResult::Create (m_parser_vars->m_exe_ctx.GetBestExecutionContextScope (),
-                                                                    var_sp->GetTypeFromUser().GetASTContext(),
-                                                                    var_sp->GetTypeFromUser().GetOpaqueQualType(),
-                                                                    var_sp->GetName(),
-                                                                    mem,
-                                                                    eAddressTypeLoad,
-                                                                    pvar_byte_size);
-            }
-            
-            if (!var_sp->m_live_sp)
-            {
-                err.SetErrorStringWithFormat("Couldn't find the memory area used to store %s", var_sp->GetName().GetCString());
-                return false;
-            }
-            
-            if (var_sp->m_live_sp->GetValue().GetValueAddressType() != eAddressTypeLoad)
-            {
-                err.SetErrorStringWithFormat("The address of the memory area for %s is in an incorrect format", var_sp->GetName().GetCString());
-                return false;
-            }
-            
-            if (var_sp->m_flags & ClangExpressionVariable::EVNeedsFreezeDry ||
-                var_sp->m_flags & ClangExpressionVariable::EVKeepInTarget)
-            {
-                mem = var_sp->m_live_sp->GetValue().GetScalar().ULongLong();
-                
-                if (log)
-                    log->Printf("Dematerializing %s from 0x%" PRIx64 " (size = %u)", var_sp->GetName().GetCString(), (uint64_t)mem, (unsigned)pvar_byte_size);
-                
-                // Read the contents of the spare memory area
-                                
-                var_sp->ValueUpdated ();
-                if (process->ReadMemory (mem, pvar_data, pvar_byte_size, error) != pvar_byte_size)
-                {
-                    err.SetErrorStringWithFormat ("Couldn't read a composite type from the target: %s", error.AsCString());
-                    return false;
-                }
-                
-                if (stack_frame_top != LLDB_INVALID_ADDRESS &&
-                    stack_frame_bottom != LLDB_INVALID_ADDRESS &&
-                    mem >= stack_frame_bottom &&
-                    mem <= stack_frame_top)
-                {
-                    // If the variable is resident in the stack frame created by the expression,
-                    // then it cannot be relied upon to stay around.  We treat it as needing
-                    // reallocation.
-                    
-                    var_sp->m_flags |= ClangExpressionVariable::EVIsLLDBAllocated;
-                    var_sp->m_flags |= ClangExpressionVariable::EVNeedsAllocation;
-                    var_sp->m_flags &= ~ClangExpressionVariable::EVIsProgramReference;
-                }
-                
-                var_sp->m_flags &= ~ClangExpressionVariable::EVNeedsFreezeDry;
-            }
-            
-            if (var_sp->m_flags & ClangExpressionVariable::EVNeedsAllocation &&
-                !(var_sp->m_flags & ClangExpressionVariable::EVKeepInTarget))
-            {
-                if (m_keep_result_in_memory)
-                {
-                    var_sp->m_flags |= ClangExpressionVariable::EVKeepInTarget;
-                }
-                else
-                {
-                    Error deallocate_error = process->DeallocateMemory(mem);
-                    
-                    if (!err.Success())
-                    {
-                        err.SetErrorStringWithFormat ("Couldn't deallocate memory for %s: %s", var_sp->GetName().GetCString(), deallocate_error.AsCString());
-                        return false;
-                    }
-                }
-            }
-        }
-        else
-        {
-            err.SetErrorStringWithFormat("Persistent variables without separate allocations are not currently supported.");
-            return false;
-        }
-    }
-    else 
-    {
-        if (log)
-            log->Printf("Materializing persistent variable with flags 0x%hx", var_sp->m_flags);
-        
-        if (var_sp->m_flags & ClangExpressionVariable::EVNeedsAllocation)
-        {
-            // Allocate a spare memory area to store the persistent variable's contents.
-            
-            Error allocate_error;
-            
-            mem = process->AllocateMemory(pvar_byte_size, 
-                                          lldb::ePermissionsReadable | lldb::ePermissionsWritable, 
-                                          allocate_error);
-            
-            if (mem == LLDB_INVALID_ADDRESS)
-            {
-                err.SetErrorStringWithFormat("Couldn't allocate a memory area to store %s: %s", var_sp->GetName().GetCString(), allocate_error.AsCString());
-                return false;
-            }
-            
-            if (log)
-                log->Printf("Allocated %s (0x%" PRIx64 ") sucessfully", var_sp->GetName().GetCString(), mem);
-            
-            // Put the location of the spare memory into the live data of the ValueObject.
-            
-            var_sp->m_live_sp = ValueObjectConstResult::Create (m_parser_vars->m_exe_ctx.GetBestExecutionContextScope(),
-                                                                var_sp->GetTypeFromUser().GetASTContext(),
-                                                                var_sp->GetTypeFromUser().GetOpaqueQualType(),
-                                                                var_sp->GetName(),
-                                                                mem,
-                                                                eAddressTypeLoad,
-                                                                pvar_byte_size);
-            
-            // Clear the flag if the variable will never be deallocated.
-            
-            if (var_sp->m_flags & ClangExpressionVariable::EVKeepInTarget)
-                var_sp->m_flags &= ~ClangExpressionVariable::EVNeedsAllocation;
-            
-            // Write the contents of the variable to the area.
-            
-            if (process->WriteMemory (mem, pvar_data, pvar_byte_size, error) != pvar_byte_size)
-            {
-                err.SetErrorStringWithFormat ("Couldn't write a composite type to the target: %s", error.AsCString());
-                return false;
-            }
-        }
-        
-        if ((var_sp->m_flags & ClangExpressionVariable::EVIsProgramReference && var_sp->m_live_sp) ||
-            var_sp->m_flags & ClangExpressionVariable::EVIsLLDBAllocated)
-        {
-            // Now write the location of the area into the struct.
-            Error write_error;
-            if (!process->WriteScalarToMemory (addr, 
-                                               var_sp->m_live_sp->GetValue().GetScalar(), 
-                                               process->GetAddressByteSize(), 
-                                               write_error))
-            {
-                err.SetErrorStringWithFormat ("Couldn't write %s to the target: %s", var_sp->GetName().GetCString(), write_error.AsCString());
-                return false;
-            }
-            
-            if (log)
-                log->Printf("Materialized %s into 0x%llx", var_sp->GetName().GetCString(), var_sp->m_live_sp->GetValue().GetScalar().ULongLong());
-        }
-        else if (!(var_sp->m_flags & ClangExpressionVariable::EVIsProgramReference))
-        {
-            err.SetErrorStringWithFormat("Persistent variables without separate allocations are not currently supported.");
-            return false;
-        }
-    }
-    
-    return true;
-}
-
-bool
-ClangExpressionDeclMap::CreateLiveMemoryForExpressionVariable
-(
-    Process &process,
-    ClangExpressionVariableSP &expr_var,
-    Error &err
-)
-{
-    Error allocate_error;
-    TypeFromUser type(expr_var->GetTypeFromUser());
-    const ConstString &name(expr_var->GetName());
-    
-    size_t value_bit_size = ClangASTType::GetClangTypeBitWidth(type.GetASTContext(), type.GetOpaqueQualType());
-    size_t value_byte_size = value_bit_size % 8 ? ((value_bit_size + 8) / 8) : (value_bit_size / 8);
-
-    Scalar val_addr (process.AllocateMemory (value_byte_size,
-                                             lldb::ePermissionsReadable | lldb::ePermissionsWritable,
-                                             allocate_error));
-    
-    if (val_addr.ULongLong() == LLDB_INVALID_ADDRESS)
-    {
-        err.SetErrorStringWithFormat ("Couldn't allocate a memory area to store %s: %s",
-                                      name.GetCString(),
-                                      allocate_error.AsCString());
-        return false;
-    }
-    
-    // Put the location of the spare memory into the live data of the ValueObject.
-    
-    expr_var->m_live_sp = ValueObjectConstResult::Create (m_parser_vars->m_exe_ctx.GetBestExecutionContextScope(),
-                                                          type.GetASTContext(),
-                                                          type.GetOpaqueQualType(),
-                                                          name,
-                                                          val_addr.ULongLong(),
-                                                          eAddressTypeLoad,
-                                                          value_byte_size);
-    
-    return true;
-}
-
-bool
-ClangExpressionDeclMap::DeleteLiveMemoryForExpressionVariable
-(
-    Process &process,
-    ClangExpressionVariableSP &expr_var,
-    Error &err
-)
-{
-    const ConstString &name(expr_var->GetName());
-    
-    Scalar &val_addr = expr_var->m_live_sp->GetValue().GetScalar();
-    
-    Error deallocate_error = process.DeallocateMemory(val_addr.ULongLong());
-    
-    if (!deallocate_error.Success())
-    {
-        err.SetErrorStringWithFormat ("Couldn't deallocate spare memory area for %s: %s",
-                                      name.GetCString(),
-                                      deallocate_error.AsCString());
-        return false;
-    }
-    
-    expr_var->m_live_sp.reset();
-    
-    return true;
-}
-
-bool
-ClangExpressionDeclMap::DoMaterializeOneVariable
-(
-    bool dematerialize,
-    const SymbolContext &sym_ctx,
-    ClangExpressionVariableSP &expr_var,
-    lldb::addr_t addr,
-    Error &err
-)
-{
-    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
-    Target *target = m_parser_vars->m_exe_ctx.GetTargetPtr();
-    Process *process = m_parser_vars->m_exe_ctx.GetProcessPtr();
-    StackFrame *frame = m_parser_vars->m_exe_ctx.GetFramePtr();
-    
-    ClangExpressionVariable::ParserVars *var_parser_vars = expr_var->GetParserVars(GetParserID());
-
-    if (!frame || !process || !target || !m_parser_vars.get() || !var_parser_vars)
-    {
-        err.SetErrorString("Necessary state for variable materialization isn't present");
-        return false;
-    }
-    
-    // Vital information about the value
-    
-    const ConstString &name(expr_var->GetName());
-    TypeFromUser type(expr_var->GetTypeFromUser());
-    
-    VariableSP &var(var_parser_vars->m_lldb_var);
-    const lldb_private::Symbol *symbol = var_parser_vars->m_lldb_sym;
-    
-    bool is_reference(expr_var->m_flags & ClangExpressionVariable::EVTypeIsReference);
-    
-    std::auto_ptr<lldb_private::Value> location_value;
-
-    if (var)
-    {
-        location_value.reset(GetVariableValue(var,
-                                              NULL));
-    }
-    else if (symbol)
-    {
-        addr_t location_load_addr = GetSymbolAddress(*target, process, name, lldb::eSymbolTypeAny);
-        
-        if (location_load_addr == LLDB_INVALID_ADDRESS)
-        {
-            if (log)
-                err.SetErrorStringWithFormat ("Couldn't find value for global symbol %s", 
-                                              name.GetCString());
-        }
-        
-        location_value.reset(new Value);
-        
-        location_value->SetValueType(Value::eValueTypeLoadAddress);
-        location_value->GetScalar() = location_load_addr;
-    }
-    else
-    {
-        err.SetErrorStringWithFormat ("Couldn't find %s with appropriate type", 
-                                      name.GetCString());
-        return false;
-    }
-    
-    if (log)
-    {
-        StreamString my_stream_string;
-        
-        ClangASTType::DumpTypeDescription (type.GetASTContext(),
-                                           type.GetOpaqueQualType(),
-                                           &my_stream_string);
-        
-        log->Printf ("%s %s with type %s", 
-                     dematerialize ? "Dematerializing" : "Materializing", 
-                     name.GetCString(), 
-                     my_stream_string.GetString().c_str());
-    }
-    
-    if (!location_value.get())
-    {
-        err.SetErrorStringWithFormat("Couldn't get value for %s", name.GetCString());
-        return false;
-    }
-
-    // The size of the type contained in addr
-    
-    size_t value_bit_size = ClangASTType::GetClangTypeBitWidth(type.GetASTContext(), type.GetOpaqueQualType());
-    size_t value_byte_size = value_bit_size % 8 ? ((value_bit_size + 8) / 8) : (value_bit_size / 8);
-    
-    Value::ValueType value_type = location_value->GetValueType();
-    
-    switch (value_type)
-    {
-    default:
-        {
-            StreamString ss;
-            
-            location_value->Dump(&ss);
-            
-            err.SetErrorStringWithFormat ("%s has a value of unhandled type: %s", 
-                                          name.GetCString(), 
-                                          ss.GetString().c_str());
-            return false;
-        }
-        break;
-    case Value::eValueTypeHostAddress:
-        {
-            if (dematerialize)
-            {
-                if (!DeleteLiveMemoryForExpressionVariable(*process, expr_var, err))
-                    return false;
-            }
-            else
-            {                
-                DataExtractor value_data_extractor;
-                
-                if (location_value->GetData(value_data_extractor))
-                {
-                    if (value_byte_size != value_data_extractor.GetByteSize())
-                    {
-                        err.SetErrorStringWithFormat ("Size mismatch for %s: %" PRIu64 " versus %" PRIu64,
-                                                      name.GetCString(),
-                                                      (uint64_t)value_data_extractor.GetByteSize(),
-                                                      (uint64_t)value_byte_size);
-                        return false;
-                    }
-                    
-                    if (!CreateLiveMemoryForExpressionVariable(*process, expr_var, err))
-                        return false;
-                    
-                    Scalar &buf_addr = expr_var->m_live_sp->GetValue().GetScalar();
-
-                    Error write_error;
-                    
-                    if (!process->WriteMemory(buf_addr.ULongLong(),
-                                              value_data_extractor.GetDataStart(),
-                                              value_data_extractor.GetByteSize(),
-                                              write_error))
-                    {
-                        err.SetErrorStringWithFormat ("Couldn't write %s to the target: %s",
-                                                      name.GetCString(),
-                                                      write_error.AsCString());
-                        return false;
-                    }
-                    
-                    if (!process->WriteScalarToMemory(addr,
-                                                      buf_addr,
-                                                      process->GetAddressByteSize(),
-                                                      write_error))
-                    {
-                        err.SetErrorStringWithFormat ("Couldn't write the address of %s to the target: %s",
-                                                      name.GetCString(),
-                                                      write_error.AsCString());
-                        return false;
-                    }
-                }
-                else
-                {
-                    err.SetErrorStringWithFormat ("%s is marked as a host address but doesn't contain any data",
-                                                  name.GetCString());
-                    return false;
-                }
-            }
-        }
-        break;
-    case Value::eValueTypeLoadAddress:
-        {
-            if (!dematerialize)
-            {
-                Error write_error;
-
-                if (is_reference)
-                {
-                    Error read_error;
-                    
-                    addr_t ref_value = process->ReadPointerFromMemory(location_value->GetScalar().ULongLong(), read_error);
-                    
-                    if (!read_error.Success())
-                    {
-                        err.SetErrorStringWithFormat ("Couldn't read reference to %s from the target: %s",
-                                                      name.GetCString(),
-                                                      read_error.AsCString());
-                        return false;
-                    }
-                    
-                    if (!process->WritePointerToMemory(addr,
-                                                       ref_value,
-                                                       write_error))
-                    {
-                        err.SetErrorStringWithFormat ("Couldn't write %s to the target: %s", 
-                                                      name.GetCString(), 
-                                                      write_error.AsCString());
-                        return false;
-                    }
-                }
-                else
-                {
-                    if (!process->WriteScalarToMemory (addr, 
-                                                       location_value->GetScalar(), 
-                                                       process->GetAddressByteSize(), 
-                                                       write_error))
-                    {
-                        err.SetErrorStringWithFormat ("Couldn't write %s to the target: %s", 
-                                                      name.GetCString(), 
-                                                      write_error.AsCString());
-                        return false;
-                    }
-                }
-            }
-        }
-        break;
-    case Value::eValueTypeScalar:
-        {
-            if (location_value->GetContextType() == Value::eContextTypeRegisterInfo)
-            {
-            RegisterInfo *reg_info = location_value->GetRegisterInfo();
-            
-            if (!reg_info)
-            {
-                err.SetErrorStringWithFormat ("Couldn't get the register information for %s", 
-                                              name.GetCString());
-                return false;
-            }
-            
-            RegisterValue reg_value;
-
-            RegisterContext *reg_ctx = m_parser_vars->m_exe_ctx.GetRegisterContext();
-            
-            if (!reg_ctx)
-            {
-                err.SetErrorStringWithFormat ("Couldn't read register context to read %s from %s", 
-                                              name.GetCString(), 
-                                              reg_info->name);
-                return false;
-            }
-            
-            uint32_t register_byte_size = reg_info->byte_size;
-            
-            if (dematerialize)
-            {
-                if (is_reference)
-                    return true; // reference types don't need demateralizing
-                
-                // Get the location of the spare memory area out of the variable's live data.
-                
-                if (!expr_var->m_live_sp)
-                {
-                    err.SetErrorStringWithFormat("Couldn't find the memory area used to store %s", name.GetCString());
-                    return false;
-                }
-                
-                if (expr_var->m_live_sp->GetValue().GetValueAddressType() != eAddressTypeLoad)
-                {
-                    err.SetErrorStringWithFormat("The address of the memory area for %s is in an incorrect format", name.GetCString());
-                    return false;
-                }
-                
-                Scalar &reg_addr = expr_var->m_live_sp->GetValue().GetScalar();
-                
-                err = reg_ctx->ReadRegisterValueFromMemory (reg_info, 
-                                                            reg_addr.ULongLong(), 
-                                                            value_byte_size, 
-                                                            reg_value);
-                if (err.Fail())
-                    return false;
-
-                if (!reg_ctx->WriteRegister (reg_info, reg_value))
-                {
-                    err.SetErrorStringWithFormat ("Couldn't write %s to register %s", 
-                                                  name.GetCString(), 
-                                                  reg_info->name);
-                    return false;
-                }
-                
-                    if (!DeleteLiveMemoryForExpressionVariable(*process, expr_var, err))
-                    return false;
-                }
-            else
-            {
-                Error write_error;
-                
-                RegisterValue reg_value;
-                
-                if (!reg_ctx->ReadRegister (reg_info, reg_value))
-                {
-                    err.SetErrorStringWithFormat ("Couldn't read %s from %s", 
-                                                  name.GetCString(), 
-                                                  reg_info->name);
-                    return false;
-                }
-
-                if (is_reference)
-                {
-                    write_error = reg_ctx->WriteRegisterValueToMemory(reg_info, 
-                                                                      addr,
-                                                                      process->GetAddressByteSize(), 
-                                                                      reg_value);
-                    
-                    if (!write_error.Success())
-                    {
-                        err.SetErrorStringWithFormat ("Couldn't write %s from register %s to the target: %s", 
-                                                      name.GetCString(),
-                                                      reg_info->name,
-                                                      write_error.AsCString());
-                        return false;
-                    }
-                    
-                    return true;
-                }
-                    
-                // Allocate a spare memory area to place the register's contents into.  This memory area will be pointed to by the slot in the
-                // struct.
-                
-                    if (!CreateLiveMemoryForExpressionVariable (*process, expr_var, err))
-                    return false;
-                
-                    // Now write the location of the area into the struct.
-                
-                    Scalar &reg_addr = expr_var->m_live_sp->GetValue().GetScalar();
-                
-                if (!process->WriteScalarToMemory (addr, 
-                                                   reg_addr, 
-                                                   process->GetAddressByteSize(), 
-                                                   write_error))
-                {
-                    err.SetErrorStringWithFormat ("Couldn't write %s to the target: %s", 
-                                                  name.GetCString(), 
-                                                  write_error.AsCString());
-                    return false;
-                }
-                
-                if (value_byte_size > register_byte_size)
-                {
-                    err.SetErrorStringWithFormat ("%s is too big to store in %s", 
-                                                  name.GetCString(), 
-                                                  reg_info->name);
-                    return false;
-                }
-
-                if (!reg_ctx->ReadRegister (reg_info, reg_value))
-                {
-                    err.SetErrorStringWithFormat ("Couldn't read %s from %s", 
-                                                  name.GetCString(), 
-                                                  reg_info->name);
-                    return false;
-                }
-                
-                err = reg_ctx->WriteRegisterValueToMemory (reg_info, 
-                                                           reg_addr.ULongLong(), 
-                                                           value_byte_size, 
-                                                           reg_value);
-                if (err.Fail())
-                    return false;
-            }
-        }
-            else
-            {
-                // The location_value is a scalar. We need to make space for it
-                // or delete the space we made previously.
-                if (dematerialize)
-                {
-                    if (!DeleteLiveMemoryForExpressionVariable(*process, expr_var, err))
-                        return false;
-    }
-                else
-                {
-                    DataExtractor value_data_extractor;
-
-                    if (location_value->GetData(value_data_extractor))
-                    {
-                        if (value_byte_size != value_data_extractor.GetByteSize())
-                        {
-                            err.SetErrorStringWithFormat ("Size mismatch for %s: %" PRIu64 " versus %" PRIu64,
-                                                          name.GetCString(),
-                                                          (uint64_t)value_data_extractor.GetByteSize(),
-                                                          (uint64_t)value_byte_size);
-                            return false;
-                        }
-
-                        if (!CreateLiveMemoryForExpressionVariable(*process, expr_var, err))
-                            return false;
-
-                        Scalar &buf_addr = expr_var->m_live_sp->GetValue().GetScalar();
+        return false;
+    
+    ClangExpressionVariableSP member_sp(m_struct_members.GetVariableAtIndex(index));
+    
+    if (!member_sp)
+        return false;
+    
+    ClangExpressionVariable::ParserVars *parser_vars = member_sp->GetParserVars(GetParserID());
+    ClangExpressionVariable::JITVars *jit_vars = member_sp->GetJITVars(GetParserID());
+    
+    if (!parser_vars ||
+        !jit_vars ||
+        !member_sp->GetValueObject())
+        return false;
+    
+    decl = parser_vars->m_named_decl;
+    value = parser_vars->m_llvm_value;
+    offset = jit_vars->m_offset;
+    name = member_sp->GetName();
+        
+    return true;
+}
 
-                        Error write_error;
+bool
+ClangExpressionDeclMap::GetFunctionInfo 
+(
+    const NamedDecl *decl, 
+    uint64_t &ptr
+)
+{
+    ClangExpressionVariableSP entity_sp(m_found_entities.GetVariable(decl, GetParserID()));
 
-                        if (!process->WriteMemory(buf_addr.ULongLong(),
-                                                  value_data_extractor.GetDataStart(),
-                                                  value_data_extractor.GetByteSize(),
-                                                  write_error))
-                        {
-                            err.SetErrorStringWithFormat ("Couldn't write %s to the target: %s",
-                                                          name.GetCString(),
-                                                          write_error.AsCString());
-                            return false;
-                        }
+    if (!entity_sp)
+        return false;
+    
+    // We know m_parser_vars is valid since we searched for the variable by
+    // its NamedDecl
+    
+    ClangExpressionVariable::ParserVars *parser_vars = entity_sp->GetParserVars(GetParserID());
 
-                        if (!process->WriteScalarToMemory(addr,
-                                                          buf_addr,
-                                                          process->GetAddressByteSize(),
-                                                          write_error))
-                        {
-                            err.SetErrorStringWithFormat ("Couldn't write the address of %s to the target: %s",
-                                                          name.GetCString(),
-                                                          write_error.AsCString());
-                            return false;
-                        }
-                    }
-                    else
-                    {
-                        err.SetErrorStringWithFormat ("%s is marked as a scalar value but doesn't contain any data",
-                                                      name.GetCString());
-                        return false;
-                    }
-                }
-            }
-        }
-    }
+    ptr = parser_vars->m_lldb_value->GetScalar().ULongLong();
     
     return true;
 }
 
-bool 
-ClangExpressionDeclMap::DoMaterializeOneRegister
+static void
+FindCodeSymbolInContext
 (
-    bool dematerialize,
-    RegisterContext &reg_ctx,
-    const RegisterInfo &reg_info,
-    lldb::addr_t addr, 
-    Error &err
+    const ConstString &name,
+    SymbolContext &sym_ctx,
+    SymbolContextList &sc_list
 )
 {
-    uint32_t register_byte_size = reg_info.byte_size;
-    RegisterValue reg_value;
-    if (dematerialize)
+    SymbolContextList temp_sc_list;
+    if (sym_ctx.module_sp)
+        sym_ctx.module_sp->FindSymbolsWithNameAndType(name, eSymbolTypeAny, temp_sc_list);
+    
+    if (!sc_list.GetSize() && sym_ctx.target_sp)
+        sym_ctx.target_sp->GetImages().FindSymbolsWithNameAndType(name, eSymbolTypeAny, temp_sc_list);
+
+    unsigned temp_sc_list_size = temp_sc_list.GetSize();
+    for (unsigned i = 0; i < temp_sc_list_size; i++)
     {
-        Error read_error (reg_ctx.ReadRegisterValueFromMemory(&reg_info, addr, register_byte_size, reg_value));
-        if (read_error.Fail())
-        {
-            err.SetErrorStringWithFormat ("Couldn't read %s from the target: %s", reg_info.name, read_error.AsCString());
-            return false;
-        }
-        
-        if (!reg_ctx.WriteRegister (&reg_info, reg_value))
+        SymbolContext sym_ctx;
+        temp_sc_list.GetContextAtIndex(i, sym_ctx);
+        if (sym_ctx.symbol)
         {
-            err.SetErrorStringWithFormat("Couldn't write register %s (dematerialize)", reg_info.name);
-            return false;
+            switch (sym_ctx.symbol->GetType())
+            {
+                case eSymbolTypeCode:
+                case eSymbolTypeResolver:
+                    sc_list.Append(sym_ctx);
+                    break;
+
+                default:
+                    break;
+            }
         }
     }
-    else
+}
+
+bool
+ClangExpressionDeclMap::GetFunctionAddress 
+(
+    const ConstString &name,
+    uint64_t &func_addr
+)
+{
+    assert (m_parser_vars.get());
+    
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
+    ExecutionContext &exe_ctx = m_parser_vars->m_exe_ctx;
+    Target *target = exe_ctx.GetTargetPtr();
+    // Back out in all cases where we're not fully initialized
+    if (target == NULL)
+        return false;
+    if (!m_parser_vars->m_sym_ctx.target_sp)
+        return false;
+
+    SymbolContextList sc_list;
+    
+    FindCodeSymbolInContext(name, m_parser_vars->m_sym_ctx, sc_list);
+
+    if (!sc_list.GetSize())
     {
+        // We occasionally get debug information in which a const function is reported 
+        // as non-const, so the mangled name is wrong.  This is a hack to compensate.
         
-        if (!reg_ctx.ReadRegister(&reg_info, reg_value))
-        {
-            err.SetErrorStringWithFormat("Couldn't read %s (materialize)", reg_info.name);
-            return false;
-        }
-        
-        Error write_error (reg_ctx.WriteRegisterValueToMemory(&reg_info, addr, register_byte_size, reg_value));
-        if (write_error.Fail())
+        if (!strncmp(name.GetCString(), "_ZN", 3) &&
+            strncmp(name.GetCString(), "_ZNK", 4))
         {
-            err.SetErrorStringWithFormat ("Couldn't write %s to the target: %s", reg_info.name, write_error.AsCString());
-            return false;
+            std::string fixed_scratch("_ZNK");
+            fixed_scratch.append(name.GetCString() + 3);
+            ConstString fixed_name(fixed_scratch.c_str());
+            
+            if (log)
+                log->Printf("Failed to find symbols given non-const name %s; trying %s", name.GetCString(), fixed_name.GetCString());
+            
+            FindCodeSymbolInContext(fixed_name, m_parser_vars->m_sym_ctx, sc_list);
         }
     }
     
+    if (!sc_list.GetSize())
+        return false;
+
+    SymbolContext sym_ctx;
+    sc_list.GetContextAtIndex(0, sym_ctx);
+
+    const Address *func_so_addr = NULL;
+    bool is_indirect_function = false;
+
+    if (sym_ctx.function)
+        func_so_addr = &sym_ctx.function->GetAddressRange().GetBaseAddress();
+    else if (sym_ctx.symbol) {
+        func_so_addr = &sym_ctx.symbol->GetAddress();
+        is_indirect_function = sym_ctx.symbol->IsIndirect();
+    } else
+        return false;
+
+    if (!func_so_addr || !func_so_addr->IsValid())
+        return false;
+
+    func_addr = func_so_addr->GetCallableLoadAddress (target, is_indirect_function);
+
     return true;
 }
 
-lldb::VariableSP
-ClangExpressionDeclMap::FindVariableInScope
-(
-    StackFrame &frame,
-    const ConstString &name,
-    TypeFromUser *type,
-    bool object_pointer
-)
-{    
-    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
+addr_t
+ClangExpressionDeclMap::GetSymbolAddress (Target &target, Process *process, const ConstString &name, lldb::SymbolType symbol_type)
+{
+    SymbolContextList sc_list;
     
-    ValueObjectSP valobj;
-    VariableSP var_sp;
-    Error err;
+    target.GetImages().FindSymbolsWithNameAndType(name, symbol_type, sc_list);
     
-    valobj = frame.GetValueForVariableExpressionPath(name.GetCString(),
-                                                     eNoDynamicValues, 
-                                                     StackFrame::eExpressionPathOptionCheckPtrVsMember ||
-                                                     StackFrame::eExpressionPathOptionsAllowDirectIVarAccess ||
-                                                     StackFrame::eExpressionPathOptionsNoFragileObjcIvar ||
-                                                     StackFrame::eExpressionPathOptionsNoSyntheticChildren ||
-                                                     StackFrame::eExpressionPathOptionsNoSyntheticArrayRange,
-                                                     var_sp,
-                                                     err);
-        
-    if (!err.Success() ||
-        !var_sp ||
-        !var_sp->IsInScope(&frame) ||
-        !var_sp->LocationIsValidForFrame (&frame))
-        return lldb::VariableSP();
-
-    if (var_sp)
+    const uint32_t num_matches = sc_list.GetSize();
+    addr_t symbol_load_addr = LLDB_INVALID_ADDRESS;
+
+    for (uint32_t i=0; i<num_matches && (symbol_load_addr == 0 || symbol_load_addr == LLDB_INVALID_ADDRESS); i++)
     {
-        if (!type)
-            return var_sp;
-        
-        TypeFromUser candidate_type(var_sp->GetType()->GetClangFullType(),
-                                    var_sp->GetType()->GetClangAST());
+        SymbolContext sym_ctx;
+        sc_list.GetContextAtIndex(i, sym_ctx);
+    
+        const Address *sym_address = &sym_ctx.symbol->GetAddress();
         
-        if (candidate_type.GetASTContext() != type->GetASTContext())
-        {
-            if (log)
-                log->PutCString("Skipping a candidate variable because of different AST contexts");
-            return lldb::VariableSP();
-        }
+        if (!sym_address || !sym_address->IsValid())
+            return LLDB_INVALID_ADDRESS;
         
-        if (object_pointer)
+        if (sym_address)
         {
-            clang::QualType desired_qual_type = clang::QualType::getFromOpaquePtr(type->GetOpaqueQualType());
-            clang::QualType candidate_qual_type = clang::QualType::getFromOpaquePtr(candidate_type.GetOpaqueQualType());
-            
-            const clang::ObjCObjectPointerType *desired_objc_ptr_type = desired_qual_type->getAs<clang::ObjCObjectPointerType>();
-            const clang::ObjCObjectPointerType *candidate_objc_ptr_type = desired_qual_type->getAs<clang::ObjCObjectPointerType>();
-            
-            if (desired_objc_ptr_type && candidate_objc_ptr_type) {
-                clang::QualType desired_target_type = desired_objc_ptr_type->getPointeeType().getUnqualifiedType();
-                clang::QualType candidate_target_type = candidate_objc_ptr_type->getPointeeType().getUnqualifiedType();
-                
-                if (ClangASTContext::AreTypesSame(type->GetASTContext(),
-                                                  desired_target_type.getAsOpaquePtr(),
-                                                  candidate_target_type.getAsOpaquePtr()))
-                    return var_sp;
-            }
-            
-            const clang::PointerType *desired_ptr_type = desired_qual_type->getAs<clang::PointerType>();
-            const clang::PointerType *candidate_ptr_type = candidate_qual_type->getAs<clang::PointerType>();
-            
-            if (desired_ptr_type && candidate_ptr_type) {
-                clang::QualType desired_target_type = desired_ptr_type->getPointeeType().getUnqualifiedType();
-                clang::QualType candidate_target_type = candidate_ptr_type->getPointeeType().getUnqualifiedType();
-                
-                if (ClangASTContext::AreTypesSame(type->GetASTContext(),
-                                                  desired_target_type.getAsOpaquePtr(),
-                                                  candidate_target_type.getAsOpaquePtr()))
-                    return var_sp;
+            switch (sym_ctx.symbol->GetType())
+            {
+                case eSymbolTypeCode:
+                case eSymbolTypeTrampoline:
+                    symbol_load_addr = sym_address->GetCallableLoadAddress (&target);
+                    break;
+
+                case eSymbolTypeResolver:
+                    symbol_load_addr = sym_address->GetCallableLoadAddress (&target, true);
+                    break;
+
+                case eSymbolTypeData:
+                case eSymbolTypeRuntime:
+                case eSymbolTypeVariable:
+                case eSymbolTypeLocal:
+                case eSymbolTypeParam:
+                case eSymbolTypeInvalid:
+                case eSymbolTypeAbsolute:
+                case eSymbolTypeException:
+                case eSymbolTypeSourceFile:
+                case eSymbolTypeHeaderFile:
+                case eSymbolTypeObjectFile:
+                case eSymbolTypeCommonBlock:
+                case eSymbolTypeBlock:
+                case eSymbolTypeVariableType:
+                case eSymbolTypeLineEntry:
+                case eSymbolTypeLineHeader:
+                case eSymbolTypeScopeBegin:
+                case eSymbolTypeScopeEnd:
+                case eSymbolTypeAdditional:
+                case eSymbolTypeCompiler:
+                case eSymbolTypeInstrumentation:
+                case eSymbolTypeUndefined:
+                case eSymbolTypeObjCClass:
+                case eSymbolTypeObjCMetaClass:
+                case eSymbolTypeObjCIVar:
+                    symbol_load_addr = sym_address->GetLoadAddress (&target);
+                    break;
             }
-            
-            return lldb::VariableSP();
         }
-        else
+    }
+    
+    if (symbol_load_addr == LLDB_INVALID_ADDRESS && process)
+    {
+        ObjCLanguageRuntime *runtime = process->GetObjCLanguageRuntime();
+        
+        if (runtime)
         {
-            if (ClangASTContext::AreTypesSame(type->GetASTContext(),
-                                               type->GetOpaqueQualType(), 
-                                               var_sp->GetType()->GetClangFullType()))
-                return var_sp;
+            symbol_load_addr = runtime->LookupRuntimeSymbol(name);
         }
     }
+    
+    return symbol_load_addr;
+}
 
-    return lldb::VariableSP();
+addr_t
+ClangExpressionDeclMap::GetSymbolAddress (const ConstString &name, lldb::SymbolType symbol_type)
+{
+    assert (m_parser_vars.get());
+    
+    if (!m_parser_vars->m_exe_ctx.GetTargetPtr())
+        return false;
+    
+    return GetSymbolAddress(m_parser_vars->m_exe_ctx.GetTargetRef(), m_parser_vars->m_exe_ctx.GetProcessPtr(), name, symbol_type);
 }
 
 const Symbol *
@@ -2949,7 +1073,7 @@ ClangExpressionDeclMap::FindExternalVisi
                     return;
                 
                 const clang::Type *interface_type = self_interface->getTypeForDecl();
-                        
+                
                 if (!interface_type)
                     return; // This is unlikely, but we have seen crashes where this occurred
                         
@@ -3016,7 +1140,7 @@ ClangExpressionDeclMap::FindExternalVisi
                     }
                     else if (self_qual_type->isObjCObjectPointerType())
                     {
-                    const ObjCObjectPointerType *class_pointer_type = self_qual_type->getAs<ObjCObjectPointerType>();
+                        const ObjCObjectPointerType *class_pointer_type = self_qual_type->getAs<ObjCObjectPointerType>();
                     
                         QualType class_type = class_pointer_type->getPointeeType();
                         
@@ -3027,8 +1151,8 @@ ClangExpressionDeclMap::FindExternalVisi
                         }
                         
                         TypeFromUser class_user_type (class_type.getAsOpaquePtr(),
-                                                        self_type->GetClangAST());
-                                    
+                                                      self_type->GetClangAST());
+                        
                         AddOneType(context, class_user_type, current_id);
                                     
                         TypeFromUser self_user_type(self_type->GetClangFullType(),
@@ -3204,10 +1328,7 @@ ClangExpressionDeclMap::FindExternalVisi
                         if (dyn_cast<clang::CXXMethodDecl>(decl_ctx))
                             continue;
                         
-                        // TODO only do this if it's a C function; C++ functions may be
-                        // overloaded
-                        if (!context.m_found.function_with_type_info)
-                            AddOneFunction(context, sym_ctx.function, NULL, current_id);
+                        AddOneFunction(context, sym_ctx.function, NULL, current_id);
                         context.m_found.function_with_type_info = true;
                         context.m_found.function = true;
                     }
@@ -3333,7 +1454,7 @@ ClangExpressionDeclMap::GetVariableValue
     
     DWARFExpression &var_location_expr = var->LocationExpression();
     
-    std::auto_ptr<Value> var_location(new Value);
+    std::unique_ptr<Value> var_location(new Value);
     
     lldb::addr_t loclist_base_load_addr = LLDB_INVALID_ADDRESS;
     
@@ -3358,7 +1479,7 @@ ClangExpressionDeclMap::GetVariableValue
         }
         else
         {
-        if (log)
+            if (log)
                 log->Printf("Error evaluating constant variable: %s", err.AsCString());
             return NULL;
         }
@@ -3555,7 +1676,7 @@ ClangExpressionDeclMap::AddOneGenericVar
                                                                       m_parser_vars->m_target_info.address_byte_size));
     assert (entity.get());
     
-    std::auto_ptr<Value> symbol_location(new Value);
+    std::unique_ptr<Value> symbol_location(new Value);
     
     const Address &symbol_address = symbol.GetAddress();
     lldb::addr_t symbol_load_addr = symbol_address.GetLoadAddress(target);
@@ -3699,7 +1820,7 @@ ClangExpressionDeclMap::AddOneFunction (
     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
     
     NamedDecl *fun_decl = NULL;
-    std::auto_ptr<Value> fun_location(new Value);
+    std::unique_ptr<Value> fun_location(new Value);
     const Address *fun_address = NULL;
     
     // only valid for Functions, not for Symbols
@@ -3735,6 +1856,18 @@ ClangExpressionDeclMap::AddOneFunction (
         if (copied_type)
         {
             fun_decl = context.AddFunDecl(copied_type);
+            
+            if (!fun_decl)
+            {
+                if (log)
+                {
+                    log->Printf ("  Failed to create a function decl for '%s' {0x%8.8" PRIx64 "}",
+                                 fun_type->GetName().GetCString(),
+                                 fun_type->GetID());
+                }
+                
+                return;
+            }
         }
         else
         {
@@ -3768,13 +1901,13 @@ ClangExpressionDeclMap::AddOneFunction (
     
     if (load_addr != LLDB_INVALID_ADDRESS)
     {
-    fun_location->SetValueType(Value::eValueTypeLoadAddress);
-    fun_location->GetScalar() = load_addr;
+        fun_location->SetValueType(Value::eValueTypeLoadAddress);
+        fun_location->GetScalar() = load_addr;
     }
     else
     {
         // We have to try finding a file address.
-    
+        
         lldb::addr_t file_addr = fun_address->GetFileAddress();
         
         fun_location->SetValueType(Value::eValueTypeFileAddress);

Modified: lldb/branches/windows/source/Expression/ClangExpressionParser.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Expression/ClangExpressionParser.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Expression/ClangExpressionParser.cpp (original)
+++ lldb/branches/windows/source/Expression/ClangExpressionParser.cpp Thu Apr 25 07:31:53 2013
@@ -22,6 +22,7 @@
 #include "lldb/Expression/ClangExpressionDeclMap.h"
 #include "lldb/Expression/IRExecutionUnit.h"
 #include "lldb/Expression/IRDynamicChecks.h"
+#include "lldb/Expression/IRInterpreter.h"
 #include "lldb/Target/ExecutionContext.h"
 #include "lldb/Target/ObjCLanguageRuntime.h"
 #include "lldb/Target/Process.h"
@@ -189,7 +190,7 @@ ClangExpressionParser::ClangExpressionPa
                                               ClangExpression &expr) :
     m_expr (expr),
     m_compiler (),
-    m_code_generator (NULL)
+    m_code_generator ()
 {
     // Initialize targets first, so that --version shows registered targets.
     static struct InitializeLLVM {
@@ -353,7 +354,7 @@ ClangExpressionParser::ClangExpressionPa
     m_selector_table.reset(new SelectorTable());
     m_builtin_context.reset(new Builtin::Context());
     
-    std::auto_ptr<clang::ASTContext> ast_context(new ASTContext(m_compiler->getLangOpts(),
+    std::unique_ptr<clang::ASTContext> ast_context(new ASTContext(m_compiler->getLangOpts(),
                                                                 m_compiler->getSourceManager(),
                                                                 &m_compiler->getTarget(),
                                                                 m_compiler->getPreprocessor().getIdentifierTable(),
@@ -464,21 +465,20 @@ static bool FindFunctionInModule (ConstS
 Error
 ClangExpressionParser::PrepareForExecution (lldb::addr_t &func_addr, 
                                             lldb::addr_t &func_end,
-                                            std::auto_ptr<IRExecutionUnit> &execution_unit_ap,
+                                            std::unique_ptr<IRExecutionUnit> &execution_unit_ap,
                                             ExecutionContext &exe_ctx,
-                                            bool &evaluated_statically,
-                                            lldb::ClangExpressionVariableSP &const_result,
+                                            bool &can_interpret,
                                             ExecutionPolicy execution_policy)
 {
 	func_addr = LLDB_INVALID_ADDRESS;
 	func_end = LLDB_INVALID_ADDRESS;
     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
 
-    std::auto_ptr<llvm::ExecutionEngine> execution_engine_ap;
+    std::unique_ptr<llvm::ExecutionEngine> execution_engine_ap;
     
     Error err;
     
-    std::auto_ptr<llvm::Module> module_ap (m_code_generator->ReleaseModule());
+    std::unique_ptr<llvm::Module> module_ap (m_code_generator->ReleaseModule());
 
     if (!module_ap.get())
     {
@@ -503,7 +503,8 @@ ClangExpressionParser::PrepareForExecuti
             log->Printf("Found function %s for %s", function_name.AsCString(), m_expr.FunctionName());
     }
     
-    m_execution_unit.reset(new IRExecutionUnit(module_ap, // handed off here
+    m_execution_unit.reset(new IRExecutionUnit(m_llvm_context, // handed off here
+                                               module_ap, // handed off here
                                                function_name,
                                                exe_ctx.GetTargetSP(),
                                                m_compiler->getTargetOpts().Features));
@@ -519,50 +520,39 @@ ClangExpressionParser::PrepareForExecuti
     
         IRForTarget ir_for_target(decl_map,
                                   m_expr.NeedsVariableResolution(),
-                                  execution_policy,
-                                  const_result,
                                   *m_execution_unit,
                                   error_stream,
                                   function_name.AsCString());
         
         bool ir_can_run = ir_for_target.runOnModule(*m_execution_unit->GetModule());
         
-        Error &interpreter_error(ir_for_target.getInterpreterError());
+        Error interpret_error;
         
-        if (execution_policy != eExecutionPolicyAlways && interpreter_error.Success())
+        can_interpret = IRInterpreter::CanInterpret(*m_execution_unit->GetModule(), *m_execution_unit->GetFunction(), interpret_error);
+        
+        Process *process = exe_ctx.GetProcessPtr();
+        
+        if (!ir_can_run)
         {
-            if (const_result)
-                const_result->TransferAddress();
-            evaluated_statically = true;
-            err.Clear();
+            err.SetErrorString("The expression could not be prepared to run in the target");
             return err;
         }
         
-        Process *process = exe_ctx.GetProcessPtr();
-
-        if (!process || execution_policy == eExecutionPolicyNever)
+        if (!can_interpret && execution_policy == eExecutionPolicyNever)
         {
-            err.SetErrorToGenericError();
-            if (execution_policy == eExecutionPolicyAlways)
-                err.SetErrorString("Execution needed to run in the target, but the target can't be run");
-            else
-                err.SetErrorStringWithFormat("Interpreting the expression locally failed: %s", interpreter_error.AsCString());
-
+            err.SetErrorStringWithFormat("Can't run the expression locally: %s", interpret_error.AsCString());
             return err;
         }
-        else if (!ir_can_run)
+        
+        if (!process && execution_policy == eExecutionPolicyAlways)
         {
-            err.SetErrorToGenericError();
-            err.SetErrorString("The expression could not be prepared to run in the target");
-            
+            err.SetErrorString("Expression needed to run in the target, but the target can't be run");
             return err;
         }
         
-        if (execution_policy != eExecutionPolicyNever &&
-            m_expr.NeedsValidation() && 
-            process)
+        if (execution_policy == eExecutionPolicyAlways || !can_interpret)
         {
-            if (!process->GetDynamicCheckers())
+            if (!process->GetDynamicCheckers() && m_expr.NeedsValidation())
             {                
                 DynamicCheckerFunctions *dynamic_checkers = new DynamicCheckerFunctions();
                 
@@ -582,7 +572,6 @@ ClangExpressionParser::PrepareForExecuti
                 
                 if (log)
                     log->Printf("== [ClangUserExpression::Evaluate] Finished installing dynamic checkers ==");
-            }
             
             IRDynamicChecks ir_dynamic_checks(*process->GetDynamicCheckers(), function_name.AsCString());
         
@@ -593,11 +582,16 @@ ClangExpressionParser::PrepareForExecuti
                 return err;
             }
         }
-    }
     
     m_execution_unit->GetRunnableInfo(err, func_addr, func_end);
+        }
+    }
+    else
+    {
+        m_execution_unit->GetRunnableInfo(err, func_addr, func_end);
+    }
     
-    execution_unit_ap = m_execution_unit;
+    execution_unit_ap.reset (m_execution_unit.release());
         
         return err;
 }

Modified: lldb/branches/windows/source/Expression/ClangFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Expression/ClangFunction.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Expression/ClangFunction.cpp (original)
+++ lldb/branches/windows/source/Expression/ClangFunction.cpp Thu Apr 25 07:31:53 2013
@@ -25,6 +25,7 @@
 #include "lldb/Expression/ASTStructExtractor.h"
 #include "lldb/Expression/ClangExpressionParser.h"
 #include "lldb/Expression/ClangFunction.h"
+#include "lldb/Expression/IRExecutionUnit.h"
 #include "lldb/Symbol/Type.h"
 #include "lldb/Core/DataExtractor.h"
 #include "lldb/Core/State.h"
@@ -259,17 +260,14 @@ ClangFunction::WriteFunctionWrapper (Exe
 
     if (m_JITted)
         return true;
-    
-    lldb::ClangExpressionVariableSP const_result;
-    
-    bool evaluated_statically = false; // should stay that way
+        
+    bool can_interpret = false; // should stay that way
     
     Error jit_error (m_parser->PrepareForExecution (m_jit_start_addr,
                                                     m_jit_end_addr,
                                                     m_execution_unit_ap,
                                                     exe_ctx, 
-                                                    evaluated_statically,
-                                                    const_result,
+                                                    can_interpret,
                                                     eExecutionPolicyAlways));
     
     if (!jit_error.Success())

Modified: lldb/branches/windows/source/Expression/ClangUserExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Expression/ClangUserExpression.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Expression/ClangUserExpression.cpp (original)
+++ lldb/branches/windows/source/Expression/ClangUserExpression.cpp Thu Apr 25 07:31:53 2013
@@ -29,6 +29,8 @@
 #include "lldb/Expression/ClangFunction.h"
 #include "lldb/Expression/ClangUserExpression.h"
 #include "lldb/Expression/ExpressionSourceCode.h"
+#include "lldb/Expression/IRExecutionUnit.h"
+#include "lldb/Expression/IRInterpreter.h"
 #include "lldb/Expression/Materializer.h"
 #include "lldb/Host/Host.h"
 #include "lldb/Symbol/Block.h"
@@ -66,8 +68,7 @@ ClangUserExpression::ClangUserExpression
     m_needs_object_ptr (false),
     m_const_object (false),
     m_target (NULL),
-    m_evaluated_statically (false),
-    m_const_result ()
+    m_can_interpret (false)
 {
     switch (m_language)
     {
@@ -328,6 +329,54 @@ ClangUserExpression::ScanContext(Executi
     }
 }
 
+void
+ClangUserExpression::InstallContext (ExecutionContext &exe_ctx)
+{
+    m_process_wp = exe_ctx.GetProcessSP();
+    
+    lldb::StackFrameSP frame_sp = exe_ctx.GetFrameSP();
+    
+    if (frame_sp)
+        m_address = frame_sp->GetFrameCodeAddress();
+}
+
+bool
+ClangUserExpression::LockAndCheckContext (ExecutionContext &exe_ctx,
+                                          lldb::TargetSP &target_sp,
+                                          lldb::ProcessSP &process_sp,
+                                          lldb::StackFrameSP &frame_sp)
+{
+    lldb::ProcessSP expected_process_sp = m_process_wp.lock();
+    process_sp = exe_ctx.GetProcessSP();
+
+    if (process_sp != expected_process_sp)
+        return false;
+    
+    process_sp = exe_ctx.GetProcessSP();
+    target_sp = exe_ctx.GetTargetSP();
+    frame_sp = exe_ctx.GetFrameSP();
+    
+    if (m_address.IsValid())
+    {
+        if (!frame_sp)
+            return false;
+        else
+            return (0 == Address::CompareLoadAddress(m_address, frame_sp->GetFrameCodeAddress(), target_sp.get()));
+    }
+    
+    return true;
+}
+
+bool
+ClangUserExpression::MatchesContext (ExecutionContext &exe_ctx)
+{
+    lldb::TargetSP target_sp;
+    lldb::ProcessSP process_sp;
+    lldb::StackFrameSP frame_sp;
+    
+    return LockAndCheckContext(exe_ctx, target_sp, process_sp, frame_sp);
+}
+
 // This is a really nasty hack, meant to fix Objective-C expressions of the form
 // (int)[myArray count].  Right now, because the type information for count is
 // not available, [myArray count] returns id, which can't be directly cast to
@@ -395,7 +444,7 @@ ClangUserExpression::Parse (Stream &erro
     ApplyObjcCastHack(m_expr_text);
     //ApplyUnicharHack(m_expr_text);
 
-    std::auto_ptr <ExpressionSourceCode> source_code (ExpressionSourceCode::CreateWrapped(m_expr_prefix.c_str(), m_expr_text.c_str()));
+    std::unique_ptr<ExpressionSourceCode> source_code (ExpressionSourceCode::CreateWrapped(m_expr_prefix.c_str(), m_expr_text.c_str()));
     
     lldb::LanguageType lang_type;
     
@@ -468,8 +517,7 @@ ClangUserExpression::Parse (Stream &erro
                                                   m_jit_end_addr,
                                                   m_execution_unit_ap,
                                                   exe_ctx,
-                                                  m_evaluated_statically,
-                                                  m_const_result,
+                                                  m_can_interpret,
                                                   execution_policy);
         
     if (jit_error.Success())
@@ -489,6 +537,46 @@ ClangUserExpression::Parse (Stream &erro
     }
 }
 
+static lldb::addr_t
+GetObjectPointer (lldb::StackFrameSP frame_sp,
+                  ConstString &object_name,
+                  Error &err)
+{
+    err.Clear();
+    
+    if (!frame_sp)
+    {
+        err.SetErrorStringWithFormat("Couldn't load '%s' because the context is incomplete", object_name.AsCString());
+        return LLDB_INVALID_ADDRESS;
+    }
+    
+    lldb::VariableSP var_sp;
+    lldb::ValueObjectSP valobj_sp;
+    
+    valobj_sp = frame_sp->GetValueForVariableExpressionPath(object_name.AsCString(),
+                                                            lldb::eNoDynamicValues,
+                                                            StackFrame::eExpressionPathOptionCheckPtrVsMember ||
+                                                            StackFrame::eExpressionPathOptionsAllowDirectIVarAccess ||
+                                                            StackFrame::eExpressionPathOptionsNoFragileObjcIvar ||
+                                                            StackFrame::eExpressionPathOptionsNoSyntheticChildren ||
+                                                            StackFrame::eExpressionPathOptionsNoSyntheticArrayRange,
+                                                            var_sp,
+                                                            err);
+    
+    if (!err.Success())
+        return LLDB_INVALID_ADDRESS;
+    
+    lldb::addr_t ret = valobj_sp->GetValueAsUnsigned(LLDB_INVALID_ADDRESS);
+    
+    if (ret == LLDB_INVALID_ADDRESS)
+    {
+        err.SetErrorStringWithFormat("Couldn't load '%s' because its value couldn't be evaluated", object_name.AsCString());
+        return LLDB_INVALID_ADDRESS;
+    }
+    
+    return ret;
+}
+
 bool
 ClangUserExpression::PrepareToExecuteJITExpression (Stream &error_stream,
                                                     ExecutionContext &exe_ctx,
@@ -496,8 +584,6 @@ ClangUserExpression::PrepareToExecuteJIT
                                                     lldb::addr_t &object_ptr,
                                                     lldb::addr_t &cmd_ptr)
 {
-    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
-
     lldb::TargetSP target;
     lldb::ProcessSP process;
     lldb::StackFrameSP frame;
@@ -507,14 +593,12 @@ ClangUserExpression::PrepareToExecuteJIT
                              process, 
                              frame))
     {
-        error_stream.Printf("The context has changed before we could JIT the expression!");
+        error_stream.Printf("The context has changed before we could JIT the expression!\n");
         return false;
     }
     
-    if (m_jit_start_addr != LLDB_INVALID_ADDRESS)
-    {
-        Error materialize_error;
-        
+    if (m_jit_start_addr != LLDB_INVALID_ADDRESS || m_can_interpret)
+    {        
         if (m_needs_object_ptr)
         {
             ConstString object_name;
@@ -533,9 +617,13 @@ ClangUserExpression::PrepareToExecuteJIT
                 return false;
             }
             
-            if (!(m_expr_decl_map->GetObjectPointer(object_ptr, object_name, materialize_error)))
+            Error object_ptr_error;
+            
+            object_ptr = GetObjectPointer(frame, object_name, object_ptr_error);
+            
+            if (!object_ptr_error.Success())
             {
-                error_stream.Printf("warning: couldn't get required object pointer (substituting NULL): %s\n", materialize_error.AsCString());
+                error_stream.Printf("warning: couldn't get required object pointer (substituting NULL): %s\n", object_ptr_error.AsCString());
                 object_ptr = 0;
             }
             
@@ -543,52 +631,40 @@ ClangUserExpression::PrepareToExecuteJIT
             {
                 ConstString cmd_name("_cmd");
                 
-                if (!(m_expr_decl_map->GetObjectPointer(cmd_ptr, cmd_name, materialize_error, true)))
+                cmd_ptr = GetObjectPointer(frame, cmd_name, object_ptr_error);
+                
+                if (!object_ptr_error.Success())
                 {
-                    error_stream.Printf("warning: couldn't get object pointer (substituting NULL): %s\n", materialize_error.AsCString());
+                    error_stream.Printf("warning: couldn't get cmd pointer (substituting NULL): %s\n", object_ptr_error.AsCString());
                     cmd_ptr = 0;
                 }
             }
         }
-                
-        if (!m_expr_decl_map->Materialize(struct_address, materialize_error))
+        
+        Error alloc_error;
+        
+        struct_address = m_execution_unit_ap->Malloc(m_materializer_ap->GetStructByteSize(),
+                                                     m_materializer_ap->GetStructAlignment(),
+                                                     lldb::ePermissionsReadable | lldb::ePermissionsWritable,
+                                                     IRMemoryMap::eAllocationPolicyMirror,
+                                                     alloc_error);
+        
+        if (!alloc_error.Success())
         {
-            error_stream.Printf("Couldn't materialize struct: %s\n", materialize_error.AsCString());
+            error_stream.Printf("Couldn't allocate space for materialized struct: %s\n", alloc_error.AsCString());
             return false;
         }
-
-#if 0
-		// jingham: look here
-        StreamFile logfile ("/tmp/exprs.txt", "a");
-        logfile.Printf("0x%16.16" PRIx64 ": thread = 0x%4.4x, expr = '%s'\n", m_jit_start_addr, exe_ctx.thread ? exe_ctx.thread->GetID() : -1, m_expr_text.c_str());
-#endif
         
-        if (log)
+        m_materialized_address = struct_address;
+        
+        Error materialize_error;
+        
+        m_dematerializer_sp = m_materializer_ap->Materialize(frame, *m_execution_unit_ap, struct_address, materialize_error);
+        
+        if (!materialize_error.Success())
         {
-            log->Printf("-- [ClangUserExpression::PrepareToExecuteJITExpression] Materializing for execution --");
-            
-            log->Printf("  Function address  : 0x%" PRIx64, (uint64_t)m_jit_start_addr);
-            
-            if (m_needs_object_ptr)
-                log->Printf("  Object pointer    : 0x%" PRIx64, (uint64_t)object_ptr);
-            
-            log->Printf("  Structure address : 0x%" PRIx64, (uint64_t)struct_address);
-                    
-            StreamString args;
-            
-            Error dump_error;
-            
-            if (struct_address)
-            {
-                if (!m_expr_decl_map->DumpMaterializedStruct(args, dump_error))
-                {
-                    log->Printf("  Couldn't extract variable values : %s", dump_error.AsCString("unknown error"));
-                }
-                else
-                {
-                    log->Printf("  Structure contents:\n%s", args.GetData());
-                }
-            }
+            error_stream.Printf("Couldn't materialize struct: %s\n", materialize_error.AsCString());
+            return false;
         }
     }
     return true;
@@ -634,35 +710,31 @@ ClangUserExpression::FinalizeJITExecutio
     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
     
     if (log)
-    {
         log->Printf("-- [ClangUserExpression::FinalizeJITExecution] Dematerializing after execution --");
     
-        StreamString args;
-        
-        Error dump_error;
-        
-        if (!m_expr_decl_map->DumpMaterializedStruct(args, dump_error))
-        {
-            log->Printf("  Couldn't extract variable values : %s", dump_error.AsCString("unknown error"));
-        }
-        else
-        {
-            log->Printf("  Structure contents:\n%s", args.GetData());
-        }
+    lldb::addr_t function_stack_bottom = function_stack_pointer - Host::GetPageSize();
+    
+    if (!m_dematerializer_sp)
+    {
+        error_stream.Printf ("Couldn't dematerialize struct : no dematerializer is present");
+        return false;
     }
     
-    lldb::addr_t function_stack_bottom = function_stack_pointer - Host::GetPageSize();
+    Error dematerialize_error;
     
-        
-    if (!m_expr_decl_map->Dematerialize(result, function_stack_pointer, function_stack_bottom, expr_error))
+    m_dematerializer_sp->Dematerialize(dematerialize_error, result, function_stack_pointer, function_stack_bottom);
+
+    if (!dematerialize_error.Success())
     {
         error_stream.Printf ("Couldn't dematerialize struct : %s\n", expr_error.AsCString("unknown error"));
         return false;
     }
-    
+        
     if (result)
         result->TransferAddress();
     
+    m_dematerializer_sp.reset();
+    
     return true;
 }        
 
@@ -680,7 +752,7 @@ ClangUserExpression::Execute (Stream &er
     // expression, it's quite convenient to have these logs come out with the STEP log as well.
     Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_EXPRESSIONS | LIBLLDB_LOG_STEP));
 
-    if (m_jit_start_addr != LLDB_INVALID_ADDRESS)
+    if (m_jit_start_addr != LLDB_INVALID_ADDRESS || m_can_interpret)
     {
         lldb::addr_t struct_address = LLDB_INVALID_ADDRESS;
                 
@@ -693,73 +765,115 @@ ClangUserExpression::Execute (Stream &er
             return eExecutionSetupError;
         }
         
-        const bool stop_others = true;
-        const bool try_all_threads = run_others;
+        lldb::addr_t function_stack_pointer = 0;
         
-        Address wrapper_address (m_jit_start_addr);
-        lldb::ThreadPlanSP call_plan_sp(new ThreadPlanCallUserExpression (exe_ctx.GetThreadRef(), 
-                                                                          wrapper_address, 
-                                                                          struct_address, 
-                                                                          stop_others, 
-                                                                          unwind_on_error,
-                                                                          ignore_breakpoints,
-                                                                          (m_needs_object_ptr ? &object_ptr : NULL),
-                                                                          ((m_needs_object_ptr && m_objectivec) ? &cmd_ptr : NULL),
-                                                                          shared_ptr_to_me));
-        
-        if (!call_plan_sp || !call_plan_sp->ValidatePlan (&error_stream))
-            return eExecutionSetupError;
-        
-        lldb::addr_t function_stack_pointer = static_cast<ThreadPlanCallFunction *>(call_plan_sp.get())->GetFunctionStackPointer();
+        if (m_can_interpret)
+        {            
+            llvm::Module *module = m_execution_unit_ap->GetModule();
+            llvm::Function *function = m_execution_unit_ap->GetFunction();
+            
+            if (!module || !function)
+            {
+                error_stream.Printf("Supposed to interpret, but nothing is there");
+                return eExecutionSetupError;
+            }
 
-        if (log)
-            log->Printf("-- [ClangUserExpression::Execute] Execution of expression begins --");
-        
-        if (exe_ctx.GetProcessPtr())
-            exe_ctx.GetProcessPtr()->SetRunningUserExpression(true);
+            Error interpreter_error;
             
-        ExecutionResults execution_result = exe_ctx.GetProcessRef().RunThreadPlan (exe_ctx, 
-                                                                                   call_plan_sp, 
-                                                                                   stop_others, 
-                                                                                   try_all_threads, 
-                                                                                   unwind_on_error,
-                                                                                   ignore_breakpoints,
-                                                                                   timeout_usec, 
-                                                                                   error_stream);
-        
-        if (exe_ctx.GetProcessPtr())
-            exe_ctx.GetProcessPtr()->SetRunningUserExpression(false);
+            llvm::SmallVector <lldb::addr_t, 3> args;
             
-        if (log)
-            log->Printf("-- [ClangUserExpression::Execute] Execution of expression completed --");
-
-        if (execution_result == eExecutionInterrupted || execution_result == eExecutionHitBreakpoint)
-        {
-            const char *error_desc = NULL;
+            if (m_needs_object_ptr)
+            {
+                args.push_back(object_ptr);
+                
+                if (m_objectivec)
+                    args.push_back(cmd_ptr);
+            }
+            
+            args.push_back(struct_address);
             
-            if (call_plan_sp)
+            IRInterpreter::Interpret (*module,
+                                      *function,
+                                      args,
+                                      *m_execution_unit_ap.get(),
+                                      interpreter_error);
+            
+            if (!interpreter_error.Success())
             {
-                lldb::StopInfoSP real_stop_info_sp = call_plan_sp->GetRealStopInfo();
-                if (real_stop_info_sp)
-                    error_desc = real_stop_info_sp->GetDescription();
+                error_stream.Printf("Supposed to interpret, but failed: %s", interpreter_error.AsCString());
+                return eExecutionDiscarded;
             }
-            if (error_desc)
-                error_stream.Printf ("Execution was interrupted, reason: %s.", error_desc);
-            else
-                error_stream.Printf ("Execution was interrupted.");
-                
-            if ((execution_result == eExecutionInterrupted && unwind_on_error)
-                || (execution_result == eExecutionHitBreakpoint && ignore_breakpoints))
-                error_stream.Printf ("\nThe process has been returned to the state before expression evaluation.");
-            else
-                error_stream.Printf ("\nThe process has been left at the point where it was interrupted, use \"thread return -x\" to return to the state before expression evaluation.");
-
-            return execution_result;
         }
-        else if (execution_result != eExecutionCompleted)
+        else
         {
-            error_stream.Printf ("Couldn't execute function; result was %s\n", Process::ExecutionResultAsCString (execution_result));
-            return execution_result;
+            const bool stop_others = true;
+            const bool try_all_threads = run_others;
+            
+            Address wrapper_address (m_jit_start_addr);
+            lldb::ThreadPlanSP call_plan_sp(new ThreadPlanCallUserExpression (exe_ctx.GetThreadRef(), 
+                                                                              wrapper_address, 
+                                                                              struct_address, 
+                                                                              stop_others, 
+                                                                              unwind_on_error,
+                                                                              ignore_breakpoints,
+                                                                              (m_needs_object_ptr ? &object_ptr : NULL),
+                                                                              ((m_needs_object_ptr && m_objectivec) ? &cmd_ptr : NULL),
+                                                                              shared_ptr_to_me));
+            
+            if (!call_plan_sp || !call_plan_sp->ValidatePlan (&error_stream))
+                return eExecutionSetupError;
+            
+            function_stack_pointer = static_cast<ThreadPlanCallFunction *>(call_plan_sp.get())->GetFunctionStackPointer();
+
+            if (log)
+                log->Printf("-- [ClangUserExpression::Execute] Execution of expression begins --");
+            
+            if (exe_ctx.GetProcessPtr())
+                exe_ctx.GetProcessPtr()->SetRunningUserExpression(true);
+                
+            ExecutionResults execution_result = exe_ctx.GetProcessRef().RunThreadPlan (exe_ctx, 
+                                                                                       call_plan_sp, 
+                                                                                       stop_others, 
+                                                                                       try_all_threads, 
+                                                                                       unwind_on_error,
+                                                                                       ignore_breakpoints,
+                                                                                       timeout_usec, 
+                                                                                       error_stream);
+            
+            if (exe_ctx.GetProcessPtr())
+                exe_ctx.GetProcessPtr()->SetRunningUserExpression(false);
+                
+            if (log)
+                log->Printf("-- [ClangUserExpression::Execute] Execution of expression completed --");
+
+            if (execution_result == eExecutionInterrupted || execution_result == eExecutionHitBreakpoint)
+            {
+                const char *error_desc = NULL;
+                
+                if (call_plan_sp)
+                {
+                    lldb::StopInfoSP real_stop_info_sp = call_plan_sp->GetRealStopInfo();
+                    if (real_stop_info_sp)
+                        error_desc = real_stop_info_sp->GetDescription();
+                }
+                if (error_desc)
+                    error_stream.Printf ("Execution was interrupted, reason: %s.", error_desc);
+                else
+                    error_stream.Printf ("Execution was interrupted.");
+                    
+                if ((execution_result == eExecutionInterrupted && unwind_on_error)
+                    || (execution_result == eExecutionHitBreakpoint && ignore_breakpoints))
+                    error_stream.Printf ("\nThe process has been returned to the state before expression evaluation.");
+                else
+                    error_stream.Printf ("\nThe process has been left at the point where it was interrupted, use \"thread return -x\" to return to the state before expression evaluation.");
+
+                return execution_result;
+            }
+            else if (execution_result != eExecutionCompleted)
+            {
+                error_stream.Printf ("Couldn't execute function; result was %s\n", Process::ExecutionResultAsCString (execution_result));
+                return execution_result;
+            }
         }
         
         if  (FinalizeJITExecution (error_stream, exe_ctx, result, function_stack_pointer))
@@ -861,19 +975,8 @@ ClangUserExpression::EvaluateWithError (
     {
         lldb::ClangExpressionVariableSP expr_result;
 
-        if (user_expression_sp->EvaluatedStatically())
-        {
-            if (log)
-                log->Printf("== [ClangUserExpression::Evaluate] Expression evaluated as a constant ==");
-            
-            if (user_expression_sp->m_const_result)
-                result_valobj_sp = user_expression_sp->m_const_result->GetValueObject();
-            else
-                error.SetError(ClangUserExpression::kNoResult, lldb::eErrorTypeGeneric);
-            
-            execution_results = eExecutionCompleted;
-        }
-        else if (execution_policy == eExecutionPolicyNever)
+        if (execution_policy == eExecutionPolicyNever &&
+            !user_expression_sp->CanInterpret())
         {
             if (log)
                 log->Printf("== [ClangUserExpression::Evaluate] Expression may not run, but is not constant ==");

Modified: lldb/branches/windows/source/Expression/ClangUtilityFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Expression/ClangUtilityFunction.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Expression/ClangUtilityFunction.cpp (original)
+++ lldb/branches/windows/source/Expression/ClangUtilityFunction.cpp Thu Apr 25 07:31:53 2013
@@ -23,6 +23,7 @@
 #include "lldb/Expression/ClangExpressionParser.h"
 #include "lldb/Expression/ClangUtilityFunction.h"
 #include "lldb/Expression/ExpressionSourceCode.h"
+#include "lldb/Expression/IRExecutionUnit.h"
 #include "lldb/Host/Host.h"
 #include "lldb/Target/ExecutionContext.h"
 #include "lldb/Target/Target.h"
@@ -124,17 +125,14 @@ ClangUtilityFunction::Install (Stream &e
     //////////////////////////////////
     // JIT the output of the parser
     //
-    
-    lldb::ClangExpressionVariableSP const_result;
-    
-    bool evaluated_statically = false; // should stay that way
+        
+    bool can_interpret = false; // should stay that way
     
     Error jit_error = parser.PrepareForExecution (m_jit_start_addr, 
                                                   m_jit_end_addr,
                                                   m_execution_unit_ap,
                                                   exe_ctx,
-                                                  evaluated_statically,
-                                                  const_result,
+                                                  can_interpret,
                                                   eExecutionPolicyAlways);
     
     if (m_jit_start_addr != LLDB_INVALID_ADDRESS)

Modified: lldb/branches/windows/source/Expression/DWARFExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Expression/DWARFExpression.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Expression/DWARFExpression.cpp (original)
+++ lldb/branches/windows/source/Expression/DWARFExpression.cpp Thu Apr 25 07:31:53 2013
@@ -1062,8 +1062,8 @@ DWARFExpression::Update_DW_OP_addr (lldb
             // we then replace the data for this expression
             
             // So first we copy the data into a heap buffer
-            std::auto_ptr<DataBufferHeap> head_data_ap (new DataBufferHeap (m_data.GetDataStart(), 
-                                                                            m_data.GetByteSize()));
+            std::unique_ptr<DataBufferHeap> head_data_ap (new DataBufferHeap (m_data.GetDataStart(),
+                                                                             m_data.GetByteSize()));
             
             // Make en encoder so we can write the address into the buffer using
             // the correct byte order (endianness)

Modified: lldb/branches/windows/source/Expression/IRExecutionUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Expression/IRExecutionUnit.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Expression/IRExecutionUnit.cpp (original)
+++ lldb/branches/windows/source/Expression/IRExecutionUnit.cpp Thu Apr 25 07:31:53 2013
@@ -25,12 +25,14 @@
 
 using namespace lldb_private;
 
-IRExecutionUnit::IRExecutionUnit (std::auto_ptr<llvm::Module> &module_ap,
+IRExecutionUnit::IRExecutionUnit (std::unique_ptr<llvm::LLVMContext> &context_ap,
+                                  std::unique_ptr<llvm::Module> &module_ap,
                                   ConstString &name,
                                   const lldb::TargetSP &target_sp,
                                   std::vector<std::string> &cpu_features) :
     IRMemoryMap(target_sp),
-    m_module_ap(module_ap),
+    m_context_ap(context_ap.release()),
+    m_module_ap(module_ap.release()),
     m_module(m_module_ap.get()),
     m_cpu_features(cpu_features),
     m_name(name),
@@ -410,6 +412,9 @@ IRExecutionUnit::GetRunnableInfo(Error &
 
 IRExecutionUnit::~IRExecutionUnit ()
 {
+    m_module_ap.reset();
+    m_execution_engine_ap.reset();
+    m_context_ap.reset();
 }
 
 IRExecutionUnit::MemoryManager::MemoryManager (IRExecutionUnit &parent) :

Modified: lldb/branches/windows/source/Expression/IRForTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Expression/IRForTarget.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Expression/IRForTarget.cpp (original)
+++ lldb/branches/windows/source/Expression/IRForTarget.cpp Thu Apr 25 07:31:53 2013
@@ -42,6 +42,7 @@ static char ID;
 
 IRForTarget::StaticDataAllocator::StaticDataAllocator(lldb_private::IRExecutionUnit &execution_unit) :
     m_execution_unit(execution_unit),
+    m_stream_string(lldb_private::Stream::eBinary, execution_unit.GetAddressByteSize(), execution_unit.GetByteOrder()),
     m_allocation(LLDB_INVALID_ADDRESS)
 {
 }
@@ -63,22 +64,18 @@ lldb::addr_t IRForTarget::StaticDataAllo
 
 IRForTarget::IRForTarget (lldb_private::ClangExpressionDeclMap *decl_map,
                           bool resolve_vars,
-                          lldb_private::ExecutionPolicy execution_policy,
-                          lldb::ClangExpressionVariableSP &const_result,
                           lldb_private::IRExecutionUnit &execution_unit,
                           lldb_private::Stream *error_stream,
                           const char *func_name) :
     ModulePass(ID),
     m_resolve_vars(resolve_vars),
-    m_execution_policy(execution_policy),
-    m_interpret_success(false),
     m_func_name(func_name),
     m_module(NULL),
     m_decl_map(decl_map),
     m_data_allocator(execution_unit),
+    m_memory_map(execution_unit),
     m_CFStringCreateWithBytes(NULL),
     m_sel_registerName(NULL),
-    m_const_result(const_result),
     m_error_stream(error_stream),
     m_has_side_effects(false),
     m_result_store(NULL),
@@ -284,6 +281,10 @@ IRForTarget::GetFunctionAddress (llvm::F
                         m_error_stream->Printf("error: call to a function '%s' (alternate name '%s') that is not present in the target\n",
                                                mangled_name.GetName().GetCString(),
                                                alt_mangled_name.GetName().GetCString());
+                    else if (mangled_name.GetMangledName())
+                        m_error_stream->Printf("error: call to a function '%s' ('%s') that is not present in the target\n",
+                                               mangled_name.GetName().GetCString(),
+                                               mangled_name.GetMangledName().GetCString());
                     else
                         m_error_stream->Printf("error: call to a function '%s' that is not present in the target\n",
                                                mangled_name.GetName().GetCString());
@@ -445,97 +446,6 @@ IRForTarget::DeclForGlobal (GlobalValue
     return DeclForGlobal(global_val, m_module);
 }
 
-void 
-IRForTarget::MaybeSetConstantResult (llvm::Constant *initializer,
-                                     const lldb_private::ConstString &name,
-                                     lldb_private::TypeFromParser type)
-{
-    if (llvm::ConstantExpr *init_expr = dyn_cast<llvm::ConstantExpr>(initializer))
-    {
-        switch (init_expr->getOpcode())
-        {
-        default:
-            return;
-        case Instruction::IntToPtr:
-            MaybeSetConstantResult (init_expr->getOperand(0), name, type);
-            return;
-        }
-    }
-    else if (llvm::ConstantInt *init_int = dyn_cast<llvm::ConstantInt>(initializer))
-    {
-        m_const_result = m_decl_map->BuildIntegerVariable(name, type, init_int->getValue());
-    }
-}
-
-void
-IRForTarget::MaybeSetCastResult (lldb_private::TypeFromParser type)
-{
-    lldb_private::Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
-    
-    if (!m_result_store)
-        return;
-    
-    LoadInst *original_load = NULL;
-        
-    for (llvm::Value *current_value = m_result_store->getValueOperand(), *next_value;
-         current_value != NULL;
-         current_value = next_value)
-    {
-        CastInst *cast_inst = dyn_cast<CastInst>(current_value);
-        LoadInst *load_inst = dyn_cast<LoadInst>(current_value);
-        
-        if (cast_inst)
-        {
-            next_value = cast_inst->getOperand(0);
-        }
-        else if (load_inst)
-        {
-            if (isa<LoadInst>(load_inst->getPointerOperand()))
-            {
-                next_value = load_inst->getPointerOperand();
-            }
-            else
-            {
-                original_load = load_inst;
-                break;
-            }
-        }
-        else
-        {
-            return;
-        }
-    }
-    
-    if (!original_load)
-        return;
-    
-    Value *loaded_value = original_load->getPointerOperand();
-    GlobalVariable *loaded_global = dyn_cast<GlobalVariable>(loaded_value);
-    
-    if (!loaded_global)
-        return;
-    
-    clang::NamedDecl *loaded_decl = DeclForGlobal(loaded_global);
-    
-    if (!loaded_decl)
-        return;
-    
-    clang::VarDecl *loaded_var = dyn_cast<clang::VarDecl>(loaded_decl);
-    
-    if (!loaded_var)
-        return;
-    
-    if (log)
-    {
-        lldb_private::StreamString type_desc_stream;
-        type.DumpTypeDescription(&type_desc_stream);
-        
-        log->Printf("Type to cast variable to: \"%s\"", type_desc_stream.GetString().c_str());
-    }
-    
-    m_const_result = m_decl_map->BuildCastVariable(m_result_name, loaded_var, type);
-}
-
 bool 
 IRForTarget::CreateResultVariable (llvm::Function &llvm_function)
 {
@@ -715,7 +625,7 @@ IRForTarget::CreateResultVariable (llvm:
         log->Printf("Result decl type: \"%s\"", type_desc_stream.GetData());
     }
     
-    m_result_name = m_decl_map->GetPersistentResultName();
+    m_result_name = lldb_private::ConstString("$RESULT_NAME");
     
     if (log)
         log->Printf("Creating a new result global: \"%s\" with size 0x%" PRIx64,
@@ -808,8 +718,7 @@ IRForTarget::CreateResultVariable (llvm:
         result_global->replaceAllUsesWith(new_result_global);
     }
     
-    if (!m_const_result)
-        if (!m_decl_map->AddPersistentVariable(result_decl, 
+    if (!m_decl_map->AddPersistentVariable(result_decl,
                                                m_result_name, 
                                                m_result_type,
                                                true,
@@ -1558,6 +1467,11 @@ IRForTarget::MaterializeInitializer (uin
         }
         return true;
     }
+    else if (isa<ConstantAggregateZero>(initializer))
+    {
+        memset(data, 0, m_target_data->getTypeStoreSize(initializer_type));
+        return true;
+    }
     return false;
 }
 
@@ -1957,6 +1871,16 @@ IRForTarget::ResolveExternals (Function
                 return false;
             }
         }
+        else if (global_name.find("OBJC_CLASSLIST_SUP_REFS_$") != global_name.npos)
+        {
+            if (!HandleObjCClass(global))
+            {
+                if (m_error_stream)
+                    m_error_stream->Printf("Error [IRForTarget]: Couldn't resolve the class for an Objective-C static method call\n");
+                
+                return false;
+            }
+        }
         else if (DeclForGlobal(global))
         {
             if (!MaybeHandleVariable (global))
@@ -2139,10 +2063,11 @@ IRForTarget::ReplaceStaticLiterals (llvm
         llvm::Instruction *inst = *user_iter;
 
         ConstantFP *operand_constant_fp = dyn_cast<ConstantFP>(operand_val);
-        Type *operand_type = operand_constant_fp->getType();
         
         if (operand_constant_fp)
         {
+            Type *operand_type = operand_constant_fp->getType();
+
             APFloat operand_apfloat = operand_constant_fp->getValueAPF();
             APInt operand_apint = operand_apfloat.bitcastToAPInt();
             
@@ -2196,7 +2121,7 @@ IRForTarget::ReplaceStaticLiterals (llvm
             
             llvm::Type *fp_ptr_ty = operand_constant_fp->getType()->getPointerTo();
             
-            Constant *new_pointer = BuildRelocation(fp_ptr_ty, offset);
+            Constant *new_pointer = BuildRelocation(fp_ptr_ty, aligned_offset);
             
             llvm::LoadInst *fp_load = new llvm::LoadInst(new_pointer, "fp_load", inst);
             
@@ -2764,12 +2689,6 @@ IRForTarget::runOnModule (Module &llvm_m
         return false;
     }
         
-    if (m_const_result && m_execution_policy != lldb_private::eExecutionPolicyAlways)
-    {
-        m_interpret_success = true;
-        return true;
-    }
-    
     for (bbi = function->begin();
          bbi != function->end();
          ++bbi)
@@ -2805,23 +2724,6 @@ IRForTarget::runOnModule (Module &llvm_m
         }
     }
     
-    if (m_decl_map && m_execution_policy != lldb_private::eExecutionPolicyAlways)
-    {
-        IRInterpreter interpreter (*m_decl_map,
-                                   m_error_stream);
-
-        interpreter.maybeRunOnFunction(m_const_result, m_result_name, m_result_type, *function, llvm_module, m_interpreter_error);
-        
-        if (m_interpreter_error.Success())
-            return true;
-    }
-    
-    if (m_execution_policy == lldb_private::eExecutionPolicyNever) {
-        if (m_result_name)
-            m_decl_map->RemoveResultVariable(m_result_name);
-        return false;
-    }
-    
     if (log && log->GetVerbose())
     {
         std::string s;

Modified: lldb/branches/windows/source/Expression/IRInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Expression/IRInterpreter.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Expression/IRInterpreter.cpp (original)
+++ lldb/branches/windows/source/Expression/IRInterpreter.cpp Thu Apr 25 07:31:53 2013
@@ -26,18 +26,6 @@
 
 using namespace llvm;
 
-IRInterpreter::IRInterpreter(lldb_private::ClangExpressionDeclMap &decl_map,
-                                           lldb_private::Stream *error_stream) :
-    m_decl_map(decl_map)
-{
-    
-}
-
-IRInterpreter::~IRInterpreter()
-{
-    
-}
-
 static std::string 
 PrintValue(const Value *value, bool truncate = false)
 {
@@ -69,362 +57,81 @@ PrintType(const Type *type, bool truncat
     return s;
 }
 
-typedef STD_SHARED_PTR(lldb_private::DataEncoder) DataEncoderSP;
-typedef STD_SHARED_PTR(lldb_private::DataExtractor) DataExtractorSP;
-
-class Memory
+class InterpreterStackFrame
 {
 public:
-    typedef uint32_t                    index_t;
+    typedef std::map <const Value*, lldb::addr_t> ValueMap;
     
-    struct Allocation
+    struct PlacedValue
     {
-        // m_virtual_address is always the address of the variable in the virtual memory
-        // space provided by Memory.
-        //
-        // m_origin is always non-NULL and describes the source of the data (possibly
-        // m_data if this allocation is the authoritative source).
-        //
-        // Possible value configurations:
-        //
-        // Allocation type  getValueType()          getContextType()            m_origin->GetScalar()       m_data
-        // =========================================================================================================================
-        // FileAddress      eValueTypeFileAddress   eContextTypeInvalid         A location in a binary      NULL
-        //                                                                      image
-        //                                                      
-        // LoadAddress      eValueTypeLoadAddress   eContextTypeInvalid         A location in the target's  NULL
-        //                                                                      virtual memory
-        //
-        // Alloca           eValueTypeHostAddress   eContextTypeInvalid         == m_data->GetBytes()       Deleted at end of 
-        //                                                                                                  execution
-        //
-        // PersistentVar    eValueTypeHostAddress   eContextTypeClangType       A persistent variable's     NULL
-        //                                                                      location in LLDB's memory
-        //
-        // Register         [ignored]               eContextTypeRegister        [ignored]                   Flushed to the register
-        //                                                                                                  at the end of execution
-        
-        lldb::addr_t        m_virtual_address;
-        size_t              m_extent;
-        lldb_private::Value m_origin;
-        lldb::DataBufferSP  m_data;
-        
-        Allocation (lldb::addr_t virtual_address,
-                    size_t extent,
-                    lldb::DataBufferSP data) :
-            m_virtual_address(virtual_address),
-            m_extent(extent),
-            m_data(data)
-        {
-        }
-        
-        Allocation (const Allocation &allocation) :
-            m_virtual_address(allocation.m_virtual_address),
-            m_extent(allocation.m_extent),
-            m_origin(allocation.m_origin),
-            m_data(allocation.m_data)
+        lldb_private::Value     lldb_value;
+        lldb::addr_t            process_address;
+        size_t                  size;
+        
+        PlacedValue (lldb_private::Value &_lldb_value,
+                     lldb::addr_t _process_address,
+                     size_t _size) :
+            lldb_value(_lldb_value),
+            process_address(_process_address),
+            size(_size)
         {
         }
     };
     
-    typedef STD_SHARED_PTR(Allocation)  AllocationSP;
+    typedef std::vector <PlacedValue> PlacedValueVector;
+
+    ValueMap                                m_values;
+    PlacedValueVector                       m_placed_values;
+    DataLayout                             &m_target_data;
+    lldb_private::IRMemoryMap              &m_memory_map;
+    const BasicBlock                       *m_bb;
+    BasicBlock::const_iterator              m_ii;
+    BasicBlock::const_iterator              m_ie;
     
-    struct Region
-    {
-        AllocationSP m_allocation;
-        uint64_t m_base;
-        uint64_t m_extent;
-        
-        Region () :
-            m_allocation(),
-            m_base(0),
-            m_extent(0)
-        {
-        }
-        
-        Region (AllocationSP allocation, uint64_t base, uint64_t extent) :
-            m_allocation(allocation),
-            m_base(base),
-            m_extent(extent)
-        {
-        }
-        
-        Region (const Region &region) :
-            m_allocation(region.m_allocation),
-            m_base(region.m_base),
-            m_extent(region.m_extent)
-        {
-        }
-        
-        bool IsValid ()
-        {
-            return (bool) m_allocation;
-        }
-        
-        bool IsInvalid ()
-        {
-            return !m_allocation;
-        }
-    };
+    lldb::addr_t                            m_frame_process_address;
+    size_t                                  m_frame_size;
+    lldb::addr_t                            m_stack_pointer;
     
-    typedef std::vector <AllocationSP>          MemoryMap;
-
-private:
-    lldb::addr_t        m_addr_base;
-    lldb::addr_t        m_addr_max;
-    MemoryMap           m_memory;
-    lldb::ByteOrder     m_byte_order;
-    lldb::addr_t        m_addr_byte_size;
-    DataLayout         &m_target_data;
-    
-    lldb_private::ClangExpressionDeclMap   &m_decl_map;
-    
-    MemoryMap::iterator LookupInternal (lldb::addr_t addr)
-    {
-        for (MemoryMap::iterator i = m_memory.begin(), e = m_memory.end();
-             i != e;
-             ++i)
-        {
-            if ((*i)->m_virtual_address <= addr &&
-                (*i)->m_virtual_address + (*i)->m_extent > addr)
-                return i;
-        }
-        
-        return m_memory.end();
-    }
+    lldb::ByteOrder                         m_byte_order;
+    size_t                                  m_addr_byte_size;
     
-public:
-    Memory (DataLayout &target_data,
-            lldb_private::ClangExpressionDeclMap &decl_map,
-            lldb::addr_t alloc_start,
-            lldb::addr_t alloc_max) :
-        m_addr_base(alloc_start),
-        m_addr_max(alloc_max),
-        m_target_data(target_data),
-        m_decl_map(decl_map)
+    InterpreterStackFrame (DataLayout &target_data,
+                           lldb_private::IRMemoryMap &memory_map) :
+        m_target_data (target_data),
+        m_memory_map (memory_map)
     {
         m_byte_order = (target_data.isLittleEndian() ? lldb::eByteOrderLittle : lldb::eByteOrderBig);
         m_addr_byte_size = (target_data.getPointerSize(0));
-    }
-    
-    Region Malloc (size_t size, size_t align)
-    {
-        lldb::DataBufferSP data(new lldb_private::DataBufferHeap(size, 0));
-        
-        if (data)
-        {
-            index_t index = m_memory.size();
-            
-            const size_t mask = (align - 1);
-            
-            m_addr_base += mask;
-            m_addr_base &= ~mask;
-            
-            if (m_addr_base + size < m_addr_base ||
-                m_addr_base + size > m_addr_max)
-                return Region();
-            
-            uint64_t base = m_addr_base;
-                        
-            m_memory.push_back(AllocationSP(new Allocation(base, size, data)));
-            
-            m_addr_base += size;
-            
-            AllocationSP alloc = m_memory[index];
-            
-            alloc->m_origin.GetScalar() = (unsigned long long)data->GetBytes();
-            alloc->m_origin.SetContext(lldb_private::Value::eContextTypeInvalid, NULL);
-            alloc->m_origin.SetValueType(lldb_private::Value::eValueTypeHostAddress);
-            
-            return Region(alloc, base, size);
-        }
-        
-        return Region();
-    }
-    
-    Region Malloc (Type *type)
-    {
-        return Malloc (m_target_data.getTypeAllocSize(type),
-                       m_target_data.getPrefTypeAlignment(type));
-    }
-    
-    Region Place (Type *type, lldb::addr_t base, lldb_private::Value &value)
-    {
-        index_t index = m_memory.size();
-        size_t size = m_target_data.getTypeAllocSize(type);
-        
-        m_memory.push_back(AllocationSP(new Allocation(base, size, lldb::DataBufferSP())));
-        
-        AllocationSP alloc = m_memory[index];
-        
-        alloc->m_origin = value;
-        
-        return Region(alloc, base, size);
-    }
-    
-    void Free (lldb::addr_t addr)
-    {
-        MemoryMap::iterator i = LookupInternal (addr);
         
-        if (i != m_memory.end())
-            m_memory.erase(i);
-    }
-    
-    Region Lookup (lldb::addr_t addr, Type *type)
-    {
-        MemoryMap::iterator i = LookupInternal(addr);
-        
-        if (i == m_memory.end() || !type->isSized())
-            return Region();
-    
-        size_t size = m_target_data.getTypeStoreSize(type);
-                
-        return Region(*i, addr, size);
-    }
+        m_frame_size = 512 * 1024;
         
-    DataEncoderSP GetEncoder (Region region)
-    {
-        if (region.m_allocation->m_origin.GetValueType() != lldb_private::Value::eValueTypeHostAddress)
-            return DataEncoderSP();
+        lldb_private::Error alloc_error;
         
-        lldb::DataBufferSP buffer = region.m_allocation->m_data;
+        m_frame_process_address = memory_map.Malloc(m_frame_size,
+                                                    m_addr_byte_size,
+                                                    lldb::ePermissionsReadable | lldb::ePermissionsWritable,
+                                                    lldb_private::IRMemoryMap::eAllocationPolicyMirror,
+                                                    alloc_error);
         
-        if (!buffer)
-            return DataEncoderSP();
-        
-        size_t base_offset = (size_t)(region.m_base - region.m_allocation->m_virtual_address);
-                
-        return DataEncoderSP(new lldb_private::DataEncoder(buffer->GetBytes() + base_offset, region.m_extent, m_byte_order, m_addr_byte_size));
-    }
-    
-    DataExtractorSP GetExtractor (Region region)
-    {
-        if (region.m_allocation->m_origin.GetValueType() != lldb_private::Value::eValueTypeHostAddress)
-            return DataExtractorSP();
-        
-        lldb::DataBufferSP buffer = region.m_allocation->m_data;
-        size_t base_offset = (size_t)(region.m_base - region.m_allocation->m_virtual_address);
-
-        if (buffer)
-            return DataExtractorSP(new lldb_private::DataExtractor(buffer->GetBytes() + base_offset, region.m_extent, m_byte_order, m_addr_byte_size));
-        else
-            return DataExtractorSP(new lldb_private::DataExtractor((uint8_t*)region.m_allocation->m_origin.GetScalar().ULongLong() + base_offset, region.m_extent, m_byte_order, m_addr_byte_size));
-    }
-    
-    lldb_private::Value GetAccessTarget(lldb::addr_t addr)
-    {
-        MemoryMap::iterator i = LookupInternal(addr);
-        
-        if (i == m_memory.end())
-            return lldb_private::Value();
-        
-        lldb_private::Value target = (*i)->m_origin;
-        
-        if (target.GetContextType() == lldb_private::Value::eContextTypeRegisterInfo)
+        if (alloc_error.Success())
         {
-            target.SetContext(lldb_private::Value::eContextTypeInvalid, NULL);
-            target.SetValueType(lldb_private::Value::eValueTypeHostAddress);
-            target.GetScalar() = (unsigned long long)(*i)->m_data->GetBytes();
+            m_stack_pointer = m_frame_process_address + m_frame_size;
         }
-        
-        target.GetScalar() += (addr - (*i)->m_virtual_address);
-        
-        return target;
-    }
-    
-    bool Write (lldb::addr_t addr, const uint8_t *data, size_t length)
-    {
-        lldb_private::Value target = GetAccessTarget(addr);
-        
-        return m_decl_map.WriteTarget(target, data, length);
-    }
-    
-    bool Read (uint8_t *data, lldb::addr_t addr, size_t length)
-    {
-        lldb_private::Value source = GetAccessTarget(addr);
-        
-        return m_decl_map.ReadTarget(data, source, length);
-    }
-    
-    bool WriteToRawPtr (lldb::addr_t addr, const uint8_t *data, size_t length)
-    {
-        lldb_private::Value target = m_decl_map.WrapBareAddress(addr);
-        
-        return m_decl_map.WriteTarget(target, data, length);
-    }
-    
-    bool ReadFromRawPtr (uint8_t *data, lldb::addr_t addr, size_t length)
-    {
-        lldb_private::Value source = m_decl_map.WrapBareAddress(addr);
-        
-        return m_decl_map.ReadTarget(data, source, length);
+        else
+        {
+            m_frame_process_address = LLDB_INVALID_ADDRESS;
+            m_stack_pointer = LLDB_INVALID_ADDRESS;
+        }    
     }
     
-    std::string PrintData (lldb::addr_t addr, size_t length)
+    ~InterpreterStackFrame ()
     {
-        lldb_private::Value target = GetAccessTarget(addr);
-        
-        lldb_private::DataBufferHeap buf(length, 0);
-        
-        if (!m_decl_map.ReadTarget(buf.GetBytes(), target, length))
-            return std::string("<couldn't read data>");
-        
-        lldb_private::StreamString ss;
-        
-        for (size_t i = 0; i < length; i++)
+        if (m_frame_process_address != LLDB_INVALID_ADDRESS)
         {
-            if ((!(i & 0xf)) && i)
-                ss.Printf("%02hhx - ", buf.GetBytes()[i]);
-            else
-                ss.Printf("%02hhx ", buf.GetBytes()[i]);
+            lldb_private::Error free_error;
+            m_memory_map.Free(m_frame_process_address, free_error);
+            m_frame_process_address = LLDB_INVALID_ADDRESS;
         }
-        
-        return ss.GetString();
-    }
-    
-    std::string SummarizeRegion (Region &region)
-    {
-        lldb_private::StreamString ss;
-
-        lldb_private::Value base = GetAccessTarget(region.m_base);
-        
-        ss.Printf("%" PRIx64 " [%s - %s %llx]",
-                  region.m_base,
-                  lldb_private::Value::GetValueTypeAsCString(base.GetValueType()),
-                  lldb_private::Value::GetContextTypeAsCString(base.GetContextType()),
-                  base.GetScalar().ULongLong());
-        
-        ss.Printf(" %s", PrintData(region.m_base, region.m_extent).c_str());
-        
-        return ss.GetString();
-    }
-};
-
-class InterpreterStackFrame
-{
-public:
-    typedef std::map <const Value*, Memory::Region> ValueMap;
-
-    ValueMap                                m_values;
-    Memory                                 &m_memory;
-    DataLayout                             &m_target_data;
-    lldb_private::ClangExpressionDeclMap   &m_decl_map;
-    const BasicBlock                       *m_bb;
-    BasicBlock::const_iterator              m_ii;
-    BasicBlock::const_iterator              m_ie;
-    
-    lldb::ByteOrder                         m_byte_order;
-    size_t                                  m_addr_byte_size;
-    
-    InterpreterStackFrame (DataLayout &target_data,
-                           Memory &memory,
-                           lldb_private::ClangExpressionDeclMap &decl_map) :
-        m_memory (memory),
-        m_target_data (target_data),
-        m_decl_map (decl_map)
-    {
-        m_byte_order = (target_data.isLittleEndian() ? lldb::eByteOrderLittle : lldb::eByteOrderBig);
-        m_addr_byte_size = (target_data.getPointerSize(0));
     }
     
     void Jump (const BasicBlock *bb)
@@ -434,14 +141,6 @@ public:
         m_ie = m_bb->end();
     }
     
-    bool Cache (Memory::AllocationSP allocation, Type *type)
-    {
-        if (allocation->m_origin.GetContextType() != lldb_private::Value::eContextTypeRegisterInfo)
-            return false;
-        
-        return m_decl_map.ReadTarget(allocation->m_data->GetBytes(), allocation->m_origin, allocation->m_data->GetByteSize());
-    }
-    
     std::string SummarizeValue (const Value *value)
     {
         lldb_private::StreamString ss;
@@ -452,9 +151,9 @@ public:
 
         if (i != m_values.end())
         {
-            Memory::Region region = i->second;
+            lldb::addr_t addr = i->second;
             
-            ss.Printf(" %s", m_memory.SummarizeRegion(region).c_str());
+            ss.Printf(" 0x%llx", (unsigned long long)addr);
         }
         
         return ss.GetString();
@@ -498,18 +197,23 @@ public:
         }
         else
         {
-            Memory::Region region = ResolveValue(value, module);
-            DataExtractorSP value_extractor = m_memory.GetExtractor(region);
+            lldb::addr_t process_address = ResolveValue(value, module);
+            size_t value_size = m_target_data.getTypeStoreSize(value->getType());
+        
+            lldb_private::DataExtractor value_extractor;
+            lldb_private::Error extract_error;
             
-            if (!value_extractor)
+            m_memory_map.GetMemoryData(value_extractor, process_address, value_size, extract_error);
+            
+            if (!extract_error.Success())
                 return false;
             
-            size_t value_size = m_target_data.getTypeStoreSize(value->getType());
-                        
             lldb::offset_t offset = 0;
-            uint64_t u64value = value_extractor->GetMaxU64(&offset, value_size);
-                    
-            return AssignToMatchType(scalar, u64value, value->getType());
+            if (value_size <= 8)
+            {
+                uint64_t u64value = value_extractor.GetMaxU64(&offset, value_size);
+                return AssignToMatchType(scalar, u64value, value->getType());
+            }
         }
         
         return false;
@@ -517,476 +221,250 @@ public:
     
     bool AssignValue (const Value *value, lldb_private::Scalar &scalar, Module &module)
     {
-        Memory::Region region = ResolveValue (value, module);
+        lldb::addr_t process_address = ResolveValue (value, module);
+        
+        if (process_address == LLDB_INVALID_ADDRESS)
+            return false;
     
         lldb_private::Scalar cast_scalar;
         
         if (!AssignToMatchType(cast_scalar, scalar.GetRawBits64(0), value->getType()))
             return false;
+                
+        size_t value_byte_size = m_target_data.getTypeStoreSize(value->getType());
         
-        lldb_private::DataBufferHeap buf(region.m_extent, 0);
+        lldb_private::DataBufferHeap buf(value_byte_size, 0);
         
-        lldb_private::Error err;
+        lldb_private::Error get_data_error;
         
-        if (!cast_scalar.GetAsMemoryData(buf.GetBytes(), buf.GetByteSize(), m_byte_order, err))
+        if (!cast_scalar.GetAsMemoryData(buf.GetBytes(), buf.GetByteSize(), m_byte_order, get_data_error))
             return false;
         
-        DataEncoderSP region_encoder = m_memory.GetEncoder(region);
+        lldb_private::Error write_error;
         
-        if (buf.GetByteSize() > region_encoder->GetByteSize())
-            return false; // This should not happen
+        m_memory_map.WriteMemory(process_address, buf.GetBytes(), buf.GetByteSize(), write_error);
         
-        memcpy(region_encoder->GetDataStart(), buf.GetBytes(), buf.GetByteSize());
-        
-        return true;
+        return write_error.Success();
     }
     
     bool ResolveConstantValue (APInt &value, const Constant *constant)
     {
-        if (const ConstantInt *constant_int = dyn_cast<ConstantInt>(constant))
+        switch (constant->getValueID())
         {
-            value = constant_int->getValue();
-            return true;
-        }
-        else if (const ConstantFP *constant_fp = dyn_cast<ConstantFP>(constant))
-        {
-            value = constant_fp->getValueAPF().bitcastToAPInt();
-            return true;
-        }
-        else if (const ConstantExpr *constant_expr = dyn_cast<ConstantExpr>(constant))
-        {
-            switch (constant_expr->getOpcode())
+        default:
+            break;
+        case Value::ConstantIntVal:
+            if (const ConstantInt *constant_int = dyn_cast<ConstantInt>(constant))
             {
-                default:
-                    return false;
-                case Instruction::IntToPtr:
-                case Instruction::PtrToInt:
-                case Instruction::BitCast:
-                    return ResolveConstantValue(value, constant_expr->getOperand(0));
-                case Instruction::GetElementPtr:
-                {
-                    ConstantExpr::const_op_iterator op_cursor = constant_expr->op_begin();
-                    ConstantExpr::const_op_iterator op_end = constant_expr->op_end();
-                                    
-                    Constant *base = dyn_cast<Constant>(*op_cursor);
-                    
-                    if (!base)
-                        return false;
-                    
-                    if (!ResolveConstantValue(value, base))
-                        return false;
-                    
-                    op_cursor++;
-                    
-                    if (op_cursor == op_end)
-                        return true; // no offset to apply!
-                    
-                    SmallVector <Value *, 8> indices (op_cursor, op_end);
-                    
-                    uint64_t offset = m_target_data.getIndexedOffset(base->getType(), indices);
-                    
-                    const bool is_signed = true;
-                    value += APInt(value.getBitWidth(), offset, is_signed);
-                    
-                    return true;
-                }
-            }
-        }
-        
-        return false;
-    }
-    
-    bool ResolveConstant (Memory::Region &region, const Constant *constant)
-    {
-        APInt resolved_value;
-        
-        if (!ResolveConstantValue(resolved_value, constant))
-            return false;
-        
-        const uint64_t *raw_data = resolved_value.getRawData();
-            
-        size_t constant_size = m_target_data.getTypeStoreSize(constant->getType());
-        return m_memory.Write(region.m_base, (const uint8_t*)raw_data, constant_size);
-    }
-        
-    Memory::Region ResolveValue (const Value *value, Module &module)
-    {
-        ValueMap::iterator i = m_values.find(value);
-        
-        if (i != m_values.end())
-            return i->second;
-        
-        const GlobalValue *global_value = dyn_cast<GlobalValue>(value);
-        
-        // If the variable is indirected through the argument
-        // array then we need to build an extra level of indirection
-        // for it.  This is the default; only magic arguments like
-        // "this", "self", and "_cmd" are direct.
-        bool variable_is_this = false;
-        
-        // If the variable is a function pointer, we do not need to
-        // build an extra layer of indirection for it because it is
-        // accessed directly.
-        bool variable_is_function_address = false;
-        
-        // Attempt to resolve the value using the program's data.
-        // If it is, the values to be created are:
-        //
-        // data_region - a region of memory in which the variable's data resides.
-        // ref_region - a region of memory in which its address (i.e., &var) resides.
-        //   In the JIT case, this region would be a member of the struct passed in.
-        // pointer_region - a region of memory in which the address of the pointer
-        //   resides.  This is an IR-level variable.
-        do
-        {
-            lldb_private::Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
-
-            lldb_private::Value resolved_value;
-            lldb_private::ClangExpressionVariable::FlagType flags = 0;
-            
-            if (global_value)
-            {            
-                clang::NamedDecl *decl = IRForTarget::DeclForGlobal(global_value, &module);
-
-                if (!decl)
-                    break;
-                
-                if (isa<clang::FunctionDecl>(decl))
-                    variable_is_function_address = true;
-                    
-                resolved_value = m_decl_map.LookupDecl(decl, flags);
+                value = constant_int->getValue();
+                return true;
             }
-            else
+            break;
+        case Value::ConstantFPVal:
+            if (const ConstantFP *constant_fp = dyn_cast<ConstantFP>(constant))
             {
-                // Special-case "this", "self", and "_cmd"
-                
-                std::string name_str = value->getName().str();
-                
-                if (name_str == "this" ||
-                    name_str == "self" ||
-                    name_str == "_cmd")
-                {
-                    resolved_value = m_decl_map.GetSpecialValue(lldb_private::ConstString(name_str.c_str()));
-                variable_is_this = true;
-            }
+                value = constant_fp->getValueAPF().bitcastToAPInt();
+                return true;
             }
-            
-            if (resolved_value.GetScalar().GetType() != lldb_private::Scalar::e_void)
+            break;
+        case Value::ConstantExprVal:
+            if (const ConstantExpr *constant_expr = dyn_cast<ConstantExpr>(constant))
             {
-                if (resolved_value.GetContextType() == lldb_private::Value::eContextTypeRegisterInfo)
+                switch (constant_expr->getOpcode())
                 {
-                    if (variable_is_this)
+                    default:
+                        return false;
+                    case Instruction::IntToPtr:
+                    case Instruction::PtrToInt:
+                    case Instruction::BitCast:
+                        return ResolveConstantValue(value, constant_expr->getOperand(0));
+                    case Instruction::GetElementPtr:
                     {
-                        Memory::Region data_region = m_memory.Place(value->getType(), resolved_value.GetScalar().ULongLong(), resolved_value);
-                        
-                        lldb_private::Value origin;
-                        
-                        origin.SetValueType(lldb_private::Value::eValueTypeLoadAddress);
-                        origin.SetContext(lldb_private::Value::eContextTypeInvalid, NULL);
-                        origin.GetScalar() = resolved_value.GetScalar();
-                        
-                        data_region.m_allocation->m_origin = origin;
-                        
-                        Memory::Region ref_region = m_memory.Malloc(value->getType());
-                         
-                        if (ref_region.IsInvalid())
-                            return Memory::Region();
-                        
-                        DataEncoderSP ref_encoder = m_memory.GetEncoder(ref_region);
-                        
-                        if (ref_encoder->PutAddress(0, data_region.m_base) == UINT32_MAX)
-                            return Memory::Region();
-                        
-                        if (log)
-                        {
-                            log->Printf("Made an allocation for \"this\" register variable %s", PrintValue(value).c_str());
-                            log->Printf("  Data region    : %llx", (unsigned long long)data_region.m_base);
-                            log->Printf("  Ref region     : %llx", (unsigned long long)ref_region.m_base);
-                        }
-                        
-                        m_values[value] = ref_region;
-                        return ref_region;
-                    }
-                    else if (flags & lldb_private::ClangExpressionVariable::EVBareRegister)
-                    {                        
-                        lldb_private::RegisterInfo *reg_info = resolved_value.GetRegisterInfo();
-                        Memory::Region data_region = (reg_info->encoding == lldb::eEncodingVector) ?
-                        m_memory.Malloc(reg_info->byte_size, m_target_data.getPrefTypeAlignment(value->getType())) :
-                        m_memory.Malloc(value->getType());
-                        
-                        data_region.m_allocation->m_origin = resolved_value;
-                        Memory::Region ref_region = m_memory.Malloc(value->getType());
-                        
-                        if (!Cache(data_region.m_allocation, value->getType()))
-                            return Memory::Region();
-                        
-                        if (ref_region.IsInvalid())
-                            return Memory::Region();
-                        
-                        DataEncoderSP ref_encoder = m_memory.GetEncoder(ref_region);
-                        
-                        if (ref_encoder->PutAddress(0, data_region.m_base) == UINT32_MAX)
-                            return Memory::Region();
-                        
-                        if (log)
-                        {
-                            log->Printf("Made an allocation for bare register variable %s", PrintValue(value).c_str());
-                            log->Printf("  Data contents  : %s", m_memory.PrintData(data_region.m_base, data_region.m_extent).c_str());
-                            log->Printf("  Data region    : %llx", (unsigned long long)data_region.m_base);
-                            log->Printf("  Ref region     : %llx", (unsigned long long)ref_region.m_base);
-                        }
-                        
-                        m_values[value] = ref_region;
-                        return ref_region;
-                    }
-                    else
-                    {                        
-                        lldb_private::RegisterInfo *reg_info = resolved_value.GetRegisterInfo();
-                        Memory::Region data_region = (reg_info->encoding == lldb::eEncodingVector) ?
-                        m_memory.Malloc(reg_info->byte_size, m_target_data.getPrefTypeAlignment(value->getType())) :
-                        m_memory.Malloc(value->getType());
-                        
-                        data_region.m_allocation->m_origin = resolved_value;
-                        Memory::Region ref_region = m_memory.Malloc(value->getType());
-                        Memory::Region pointer_region;
+                        ConstantExpr::const_op_iterator op_cursor = constant_expr->op_begin();
+                        ConstantExpr::const_op_iterator op_end = constant_expr->op_end();
                         
-                        pointer_region = m_memory.Malloc(value->getType());
+                        Constant *base = dyn_cast<Constant>(*op_cursor);
                         
-                        if (!Cache(data_region.m_allocation, value->getType()))
-                            return Memory::Region();
+                        if (!base)
+                            return false;
                         
-                        if (ref_region.IsInvalid())
-                            return Memory::Region();
+                        if (!ResolveConstantValue(value, base))
+                            return false;
                         
-                        if (pointer_region.IsInvalid())
-                            return Memory::Region();
+                        op_cursor++;
                         
-                        DataEncoderSP ref_encoder = m_memory.GetEncoder(ref_region);
+                        if (op_cursor == op_end)
+                            return true; // no offset to apply!
                         
-                        if (ref_encoder->PutAddress(0, data_region.m_base) == UINT32_MAX)
-                            return Memory::Region();
+                        SmallVector <Value *, 8> indices (op_cursor, op_end);
                         
-                        if (log)
-                        {
-                            log->Printf("Made an allocation for ordinary register variable %s", PrintValue(value).c_str());
-                            log->Printf("  Data contents  : %s", m_memory.PrintData(data_region.m_base, data_region.m_extent).c_str());
-                            log->Printf("  Data region    : %llx", (unsigned long long)data_region.m_base);
-                            log->Printf("  Ref region     : %llx", (unsigned long long)ref_region.m_base);
-                            log->Printf("  Pointer region : %llx", (unsigned long long)pointer_region.m_base);
-                        }
+                        uint64_t offset = m_target_data.getIndexedOffset(base->getType(), indices);
                         
-                        DataEncoderSP pointer_encoder = m_memory.GetEncoder(pointer_region);
-                            
-                        if (pointer_encoder->PutAddress(0, ref_region.m_base) == UINT32_MAX)
-                            return Memory::Region();
+                        const bool is_signed = true;
+                        value += APInt(value.getBitWidth(), offset, is_signed);
                         
-                        m_values[value] = pointer_region;
-                        return pointer_region;
+                        return true;
                     }
                 }
-                else
-                {
-                    bool no_extra_redirect = (variable_is_this || variable_is_function_address);
-                    
-                    Memory::Region data_region = m_memory.Place(value->getType(), resolved_value.GetScalar().ULongLong(), resolved_value);
-                    Memory::Region ref_region = m_memory.Malloc(value->getType());
-                    Memory::Region pointer_region;
-                    
-                    if (!no_extra_redirect)
-                        pointer_region = m_memory.Malloc(value->getType());
-                           
-                    if (ref_region.IsInvalid())
-                        return Memory::Region();
-                    
-                    if (pointer_region.IsInvalid() && !no_extra_redirect)
-                        return Memory::Region();
-                    
-                    DataEncoderSP ref_encoder = m_memory.GetEncoder(ref_region);
-                    
-                    if (ref_encoder->PutAddress(0, data_region.m_base) == UINT32_MAX)
-                        return Memory::Region();
-                    
-                    if (!no_extra_redirect)
-                    {
-                        DataEncoderSP pointer_encoder = m_memory.GetEncoder(pointer_region);
-                    
-                        if (pointer_encoder->PutAddress(0, ref_region.m_base) == UINT32_MAX)
-                            return Memory::Region();
-                        
-                        m_values[value] = pointer_region;
-                    }
-                    
-                    if (log)
-                    {
-                        log->Printf("Made an allocation for %s", PrintValue(value).c_str());
-                        log->Printf("  Data contents  : %s", m_memory.PrintData(data_region.m_base, data_region.m_extent).c_str());
-                        log->Printf("  Data region    : %llx", (unsigned long long)data_region.m_base);
-                        log->Printf("  Ref region     : %llx", (unsigned long long)ref_region.m_base);
-                        if (!variable_is_this)
-                            log->Printf("  Pointer region : %llx", (unsigned long long)pointer_region.m_base);
-                    }
-                    
-                    if (no_extra_redirect)
-                        return ref_region;
-                    else
-                        return pointer_region;
-                }
             }
+            break;
+        case Value::ConstantPointerNullVal:
+            if (isa<ConstantPointerNull>(constant))
+            {
+                value = APInt(m_target_data.getPointerSizeInBits(), 0);
+                return true;
+            }
+            break;
         }
-        while(0);
+        return false;
+    }
+    
+    bool MakeArgument(const Argument *value, uint64_t address)
+    {
+        lldb::addr_t data_address = Malloc(value->getType());
         
-        // Fall back and allocate space [allocation type Alloca]
+        if (data_address == LLDB_INVALID_ADDRESS)
+            return false;
         
-        Type *type = value->getType();
+        lldb_private::Error write_error;
         
-        Memory::Region data_region = m_memory.Malloc(type);
-        data_region.m_allocation->m_origin.GetScalar() = (unsigned long long)data_region.m_allocation->m_data->GetBytes();
-        data_region.m_allocation->m_origin.SetContext(lldb_private::Value::eContextTypeInvalid, NULL);
-        data_region.m_allocation->m_origin.SetValueType(lldb_private::Value::eValueTypeHostAddress);
+        m_memory_map.WritePointerToMemory(data_address, address, write_error);
         
-        const Constant *constant = dyn_cast<Constant>(value);
+        if (!write_error.Success())
+        {
+            lldb_private::Error free_error;
+            m_memory_map.Free(data_address, free_error);
+            return false;
+        }
+        
+        m_values[value] = data_address;
         
-        do
+        lldb_private::Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
+
+        if (log)
         {
-            if (!constant)
-                break;
-            
-            if (!ResolveConstant (data_region, constant))
-                return Memory::Region();
+            log->Printf("Made an allocation for argument %s", PrintValue(value).c_str());
+            log->Printf("  Data region    : %llx", (unsigned long long)address);
+            log->Printf("  Ref region     : %llx", (unsigned long long)data_address);
         }
-        while(0);
         
-        m_values[value] = data_region;
-        return data_region;
+        return true;
     }
     
-    bool ConstructResult (lldb::ClangExpressionVariableSP &result,
-                          const GlobalValue *result_value,
-                          const lldb_private::ConstString &result_name,
-                          lldb_private::TypeFromParser result_type,
-                          Module &module)
+    bool ResolveConstant (lldb::addr_t process_address, const Constant *constant)
     {
-        // The result_value resolves to P, a pointer to a region R containing the result data.
-        // If the result variable is a reference, the region R contains a pointer to the result R_final in the original process.
+        APInt resolved_value;
+        
+        if (!ResolveConstantValue(resolved_value, constant))
+            return false;
         
-        if (!result_value)
-            return true; // There was no slot for a result – the expression doesn't return one.
+        const uint64_t *raw_data = resolved_value.getRawData();
+            
+        size_t constant_size = m_target_data.getTypeStoreSize(constant->getType());
         
-        ValueMap::iterator i = m_values.find(result_value);
-
-        if (i == m_values.end())
-            return false; // There was a slot for the result, but we didn't write into it.
+        lldb_private::Error write_error;
         
-        Memory::Region P = i->second;
-        DataExtractorSP P_extractor = m_memory.GetExtractor(P);
+        m_memory_map.WriteMemory(process_address, (uint8_t*)raw_data, constant_size, write_error);
         
-        if (!P_extractor)
-            return false;
+        return write_error.Success();
+    }
+    
+    lldb::addr_t Malloc (size_t size, uint8_t byte_alignment)
+    {
+        lldb::addr_t ret = m_stack_pointer;
         
-        Type *pointer_ty = result_value->getType();
-        PointerType *pointer_ptr_ty = dyn_cast<PointerType>(pointer_ty);
-        if (!pointer_ptr_ty)
-            return false;
-        Type *R_ty = pointer_ptr_ty->getElementType();
-                
-        lldb::offset_t offset = 0;
-        lldb::addr_t pointer = P_extractor->GetAddress(&offset);
+        ret -= size;
+        ret -= (ret % byte_alignment);
         
-        Memory::Region R = m_memory.Lookup(pointer, R_ty);
+        if (ret < m_frame_process_address)
+            return LLDB_INVALID_ADDRESS;
         
-        if (R.m_allocation->m_origin.GetValueType() != lldb_private::Value::eValueTypeHostAddress ||
-            !R.m_allocation->m_data)
-            return false;
+        m_stack_pointer = ret;
+        return ret;
+    }
+        
+    lldb::addr_t MallocPointer ()
+    {
+        return Malloc(m_target_data.getPointerSize(), m_target_data.getPointerPrefAlignment());
+    }
+    
+    lldb::addr_t Malloc (llvm::Type *type)
+    {
+        lldb_private::Error alloc_error;
+        
+        return Malloc(m_target_data.getTypeAllocSize(type), m_target_data.getPrefTypeAlignment(type));
+    }
+    
+    std::string PrintData (lldb::addr_t addr, llvm::Type *type)
+    {
+        size_t length = m_target_data.getTypeStoreSize(type);
+        
+        lldb_private::DataBufferHeap buf(length, 0);
         
-        lldb_private::Value base;
+        lldb_private::Error read_error;
         
-        bool transient = false;
-        bool maybe_make_load = false;
+        m_memory_map.ReadMemory(buf.GetBytes(), addr, length, read_error);
         
-        if (m_decl_map.ResultIsReference(result_name))
+        if (!read_error.Success())
+            return std::string("<couldn't read data>");
+        
+        lldb_private::StreamString ss;
+        
+        for (size_t i = 0; i < length; i++)
         {
-            PointerType *R_ptr_ty = dyn_cast<PointerType>(R_ty);           
-            if (!R_ptr_ty)
-                return false;
-            Type *R_final_ty = R_ptr_ty->getElementType();
-            
-            DataExtractorSP R_extractor = m_memory.GetExtractor(R);
-            
-            if (!R_extractor)
-                return false;
-            
-            offset = 0;
-            lldb::addr_t R_pointer = R_extractor->GetAddress(&offset);
-            
-            Memory::Region R_final = m_memory.Lookup(R_pointer, R_final_ty);
-            
-            if (R_final.m_allocation)
-            {            
-                if (R_final.m_allocation->m_data)
-                    transient = true; // this is a stack allocation
-            
-                base = R_final.m_allocation->m_origin;
-                base.GetScalar() += (R_final.m_base - R_final.m_allocation->m_virtual_address);
-            }
+            if ((!(i & 0xf)) && i)
+                ss.Printf("%02hhx - ", buf.GetBytes()[i]);
             else
+                ss.Printf("%02hhx ", buf.GetBytes()[i]);
+        }
+        
+        return ss.GetString();
+    }
+    
+    lldb::addr_t ResolveValue (const Value *value, Module &module)
+    {
+        ValueMap::iterator i = m_values.find(value);
+        
+        if (i != m_values.end())
+            return i->second;
+        
+        // Fall back and allocate space [allocation type Alloca]
+        
+        lldb::addr_t data_address = Malloc(value->getType());
+        
+        if (const Constant *constant = dyn_cast<Constant>(value))
+        {
+            if (!ResolveConstant (data_address, constant))
             {
-                // We got a bare pointer.  We are going to treat it as a load address
-                // or a file address, letting decl_map make the choice based on whether
-                // or not a process exists.
-                
-                base.SetContext(lldb_private::Value::eContextTypeInvalid, NULL);
-                base.SetValueType(lldb_private::Value::eValueTypeFileAddress);
-                base.GetScalar() = (unsigned long long)R_pointer;
-                maybe_make_load = true;
+                lldb_private::Error free_error;
+                m_memory_map.Free(data_address, free_error);
+                return LLDB_INVALID_ADDRESS;
             }
         }
-        else
-        {
-            base.SetContext(lldb_private::Value::eContextTypeInvalid, NULL);
-            base.SetValueType(lldb_private::Value::eValueTypeHostAddress);
-            base.GetScalar() = (unsigned long long)R.m_allocation->m_data->GetBytes() + (R.m_base - R.m_allocation->m_virtual_address);
-        }                     
-                        
-        return m_decl_map.CompleteResultVariable (result, base, result_name, result_type, transient, maybe_make_load);
+        
+        m_values[value] = data_address;
+        return data_address;
     }
 };
 
-bool
-IRInterpreter::maybeRunOnFunction (lldb::ClangExpressionVariableSP &result,
-                                   const lldb_private::ConstString &result_name,
-                                   lldb_private::TypeFromParser result_type,
-                                   Function &llvm_function,
-                                   Module &llvm_module,
-                                   lldb_private::Error &err)
-{
-    if (supportsFunction (llvm_function, err))
-        return runOnFunction(result,
-                             result_name, 
-                             result_type, 
-                             llvm_function,
-                             llvm_module,
-                             err);
-    else
-        return false;
-}
-
 static const char *unsupported_opcode_error         = "Interpreter doesn't handle one of the expression's opcodes";
-static const char *interpreter_initialization_error = "Interpreter couldn't be initialized";
+//static const char *interpreter_initialization_error = "Interpreter couldn't be initialized";
 static const char *interpreter_internal_error       = "Interpreter encountered an internal error";
 static const char *bad_value_error                  = "Interpreter couldn't resolve a value during execution";
 static const char *memory_allocation_error          = "Interpreter couldn't allocate memory";
 static const char *memory_write_error               = "Interpreter couldn't write to memory";
 static const char *memory_read_error                = "Interpreter couldn't read from memory";
 static const char *infinite_loop_error              = "Interpreter ran for too many cycles";
-static const char *bad_result_error                 = "Result of expression is in bad memory";
+//static const char *bad_result_error                 = "Result of expression is in bad memory";
 
 bool
-IRInterpreter::supportsFunction (Function &llvm_function, 
-                                 lldb_private::Error &err)
+IRInterpreter::CanInterpret (llvm::Module &module,
+                             llvm::Function &function,
+                             lldb_private::Error &error)
 {
     lldb_private::Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
     
-    for (Function::iterator bbi = llvm_function.begin(), bbe = llvm_function.end();
+    for (Function::iterator bbi = function.begin(), bbe = function.end();
          bbi != bbe;
          ++bbi)
     {
@@ -1000,8 +478,8 @@ IRInterpreter::supportsFunction (Functio
                 {
                     if (log)
                         log->Printf("Unsupported instruction: %s", PrintValue(ii).c_str());
-                    err.SetErrorToGenericError();
-                    err.SetErrorString(unsupported_opcode_error);
+                    error.SetErrorToGenericError();
+                    error.SetErrorString(unsupported_opcode_error);
                     return false;
                 }
             case Instruction::Add:
@@ -1016,22 +494,22 @@ IRInterpreter::supportsFunction (Functio
                     
                     if (!icmp_inst)
                     {
-                        err.SetErrorToGenericError();
-                        err.SetErrorString(interpreter_internal_error);
+                        error.SetErrorToGenericError();
+                        error.SetErrorString(interpreter_internal_error);
                         return false;
                     }
                     
                     switch (icmp_inst->getPredicate())
                     {
                     default:
-                        {
-                            if (log)
-                                log->Printf("Unsupported ICmp predicate: %s", PrintValue(ii).c_str());
-                            
-                            err.SetErrorToGenericError();
-                            err.SetErrorString(unsupported_opcode_error);
-                            return false;
-                        }
+                    {
+                        if (log)
+                            log->Printf("Unsupported ICmp predicate: %s", PrintValue(ii).c_str());
+                        
+                        error.SetErrorToGenericError();
+                        error.SetErrorString(unsupported_opcode_error);
+                        return false;
+                    }
                     case CmpInst::ICMP_EQ:
                     case CmpInst::ICMP_NE:
                     case CmpInst::ICMP_UGT:
@@ -1069,8 +547,7 @@ IRInterpreter::supportsFunction (Functio
         }
     }
     
-    return true;
-}
+    return true;}
 
 #ifdef _MSC_VER
 #define LLDB_ULL
@@ -1078,64 +555,56 @@ IRInterpreter::supportsFunction (Functio
 #define LLDB_ULL ull
 #endif
 
-bool 
-IRInterpreter::runOnFunction (lldb::ClangExpressionVariableSP &result,
-                              const lldb_private::ConstString &result_name,
-                              lldb_private::TypeFromParser result_type,
-                              Function &llvm_function,
-                              Module &llvm_module,
-                              lldb_private::Error &err)
+bool
+IRInterpreter::Interpret (llvm::Module &module,
+                          llvm::Function &function,
+                          llvm::ArrayRef<lldb::addr_t> args,
+                          lldb_private::IRMemoryMap &memory_map,
+                          lldb_private::Error &error)
 {
     lldb_private::Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
     
-    lldb_private::ClangExpressionDeclMap::TargetInfo target_info = m_decl_map.GetTargetInfo();
-    
-    if (!target_info.IsValid())
+    if (log)
     {
-        err.SetErrorToGenericError();
-        err.SetErrorString(interpreter_initialization_error);
-        return false;
+        std::string s;
+        raw_string_ostream oss(s);
+        
+        module.print(oss, NULL);
+        
+        oss.flush();
+        
+        log->Printf("Module as passed in to IRInterpreter::Interpret: \n\"%s\"", s.c_str());
     }
     
-    lldb::addr_t alloc_min;
-    lldb::addr_t alloc_max;
+    DataLayout data_layout(&module);
     
-    switch (target_info.address_byte_size)
-    {
-    default:
-        err.SetErrorToGenericError();
-        err.SetErrorString(interpreter_initialization_error);
-        return false;    
-    case 4:
-        alloc_min = 0x00001000 LLDB_ULL;
-        alloc_max = 0x0000ffff LLDB_ULL;
-        break;
-    case 8:
-        alloc_min = 0x0000000000001000 LLDB_ULL;
-        alloc_max = 0x000000000000ffff LLDB_ULL;
-        break;
-    }
+    InterpreterStackFrame frame(data_layout, memory_map);
     
-    DataLayout target_data(&llvm_module);
-    if (target_data.getPointerSize(0) != target_info.address_byte_size)
+    if (frame.m_frame_process_address == LLDB_INVALID_ADDRESS)
     {
-        err.SetErrorToGenericError();
-        err.SetErrorString(interpreter_initialization_error);
-        return false;
+        error.SetErrorString("Couldn't allocate stack frame");
     }
-    if (target_data.isLittleEndian() != (target_info.byte_order == lldb::eByteOrderLittle))
+    
+    int arg_index = 0;
+    
+    for (llvm::Function::arg_iterator ai = function.arg_begin(), ae = function.arg_end();
+         ai != ae;
+         ++ai, ++arg_index)
     {
-        err.SetErrorToGenericError();
-        err.SetErrorString(interpreter_initialization_error);
-        return false;
+        if (args.size() < arg_index)
+        {
+            error.SetErrorString ("Not enough arguments passed in to function");
+            return false;
+        }
+        
+        lldb::addr_t ptr = args[arg_index];
+
+        frame.MakeArgument(ai, ptr);
     }
     
-    Memory memory(target_data, m_decl_map, alloc_min, alloc_max);
-    InterpreterStackFrame frame(target_data, memory, m_decl_map);
-
     uint32_t num_insts = 0;
     
-    frame.Jump(llvm_function.begin());
+    frame.Jump(function.begin());
     
     while (frame.m_ii != frame.m_ie && (++num_insts < 4096))
     {
@@ -1146,21 +615,21 @@ IRInterpreter::runOnFunction (lldb::Clan
         
         switch (inst->getOpcode())
         {
-        default:
-            break;
-        case Instruction::Add:
-        case Instruction::Sub:
-        case Instruction::Mul:
-        case Instruction::SDiv:
-        case Instruction::UDiv:
-        case Instruction::SRem:
-        case Instruction::URem:
-        case Instruction::Shl:
-        case Instruction::LShr:
-        case Instruction::AShr:
-        case Instruction::And:
-        case Instruction::Or:
-        case Instruction::Xor:
+            default:
+                break;
+            case Instruction::Add:
+            case Instruction::Sub:
+            case Instruction::Mul:
+            case Instruction::SDiv:
+            case Instruction::UDiv:
+            case Instruction::SRem:
+            case Instruction::URem:
+            case Instruction::Shl:
+            case Instruction::LShr:
+            case Instruction::AShr:
+            case Instruction::And:
+            case Instruction::Or:
+            case Instruction::Xor:
             {
                 const BinaryOperator *bin_op = dyn_cast<BinaryOperator>(inst);
                 
@@ -1168,9 +637,9 @@ IRInterpreter::runOnFunction (lldb::Clan
                 {
                     if (log)
                         log->Printf("getOpcode() returns %s, but instruction is not a BinaryOperator", inst->getOpcodeName());
-                    err.SetErrorToGenericError();
-                    err.SetErrorString(interpreter_internal_error);
-                    return false;                
+                    error.SetErrorToGenericError();
+                    error.SetErrorString(interpreter_internal_error);
+                    return false;
                 }
                 
                 Value *lhs = inst->getOperand(0);
@@ -1179,21 +648,21 @@ IRInterpreter::runOnFunction (lldb::Clan
                 lldb_private::Scalar L;
                 lldb_private::Scalar R;
                 
-                if (!frame.EvaluateValue(L, lhs, llvm_module))
+                if (!frame.EvaluateValue(L, lhs, module))
                 {
                     if (log)
                         log->Printf("Couldn't evaluate %s", PrintValue(lhs).c_str());
-                    err.SetErrorToGenericError();
-                    err.SetErrorString(bad_value_error);
+                    error.SetErrorToGenericError();
+                    error.SetErrorString(bad_value_error);
                     return false;
                 }
                 
-                if (!frame.EvaluateValue(R, rhs, llvm_module))
+                if (!frame.EvaluateValue(R, rhs, module))
                 {
                     if (log)
                         log->Printf("Couldn't evaluate %s", PrintValue(rhs).c_str());
-                    err.SetErrorToGenericError();
-                    err.SetErrorString(bad_value_error);                 
+                    error.SetErrorToGenericError();
+                    error.SetErrorString(bad_value_error);
                     return false;
                 }
                 
@@ -1201,51 +670,51 @@ IRInterpreter::runOnFunction (lldb::Clan
                 
                 switch (inst->getOpcode())
                 {
-                default:
-                    break;
-                case Instruction::Add:
-                    result = L + R;
-                    break;
-                case Instruction::Mul:
-                    result = L * R;
-                    break;
-                case Instruction::Sub:
-                    result = L - R;
-                    break;
-                case Instruction::SDiv:
-                    result = L / R;
-                    break;
-                case Instruction::UDiv:
-                    result = L.GetRawBits64(0) / R.GetRawBits64(1);
-                    break;
-                case Instruction::SRem:
-                    result = L % R;
-                    break;
-                case Instruction::URem:
-                    result = L.GetRawBits64(0) % R.GetRawBits64(1);
-                    break;
-                case Instruction::Shl:
-                    result = L << R;
-                    break;
-                case Instruction::AShr:
-                    result = L >> R;
-                    break;
-                case Instruction::LShr:
-                    result = L;
-                    result.ShiftRightLogical(R);
-                    break;
-                case Instruction::And:
-                    result = L & R;
-                    break;
-                case Instruction::Or:
-                    result = L | R;
-                    break;
-                case Instruction::Xor:
-                    result = L ^ R;
-                    break;
+                    default:
+                        break;
+                    case Instruction::Add:
+                        result = L + R;
+                        break;
+                    case Instruction::Mul:
+                        result = L * R;
+                        break;
+                    case Instruction::Sub:
+                        result = L - R;
+                        break;
+                    case Instruction::SDiv:
+                        result = L / R;
+                        break;
+                    case Instruction::UDiv:
+                        result = L.GetRawBits64(0) / R.GetRawBits64(1);
+                        break;
+                    case Instruction::SRem:
+                        result = L % R;
+                        break;
+                    case Instruction::URem:
+                        result = L.GetRawBits64(0) % R.GetRawBits64(1);
+                        break;
+                    case Instruction::Shl:
+                        result = L << R;
+                        break;
+                    case Instruction::AShr:
+                        result = L >> R;
+                        break;
+                    case Instruction::LShr:
+                        result = L;
+                        result.ShiftRightLogical(R);
+                        break;
+                    case Instruction::And:
+                        result = L & R;
+                        break;
+                    case Instruction::Or:
+                        result = L | R;
+                        break;
+                    case Instruction::Xor:
+                        result = L ^ R;
+                        break;
                 }
-                                
-                frame.AssignValue(inst, result, llvm_module);
+                
+                frame.AssignValue(inst, result, module);
                 
                 if (log)
                 {
@@ -1255,8 +724,8 @@ IRInterpreter::runOnFunction (lldb::Clan
                     log->Printf("  = : %s", frame.SummarizeValue(inst).c_str());
                 }
             }
-            break;
-        case Instruction::Alloca:
+                break;
+            case Instruction::Alloca:
             {
                 const AllocaInst *alloca_inst = dyn_cast<AllocaInst>(inst);
                 
@@ -1264,8 +733,8 @@ IRInterpreter::runOnFunction (lldb::Clan
                 {
                     if (log)
                         log->Printf("getOpcode() returns Alloca, but instruction is not an AllocaInst");
-                    err.SetErrorToGenericError();
-                    err.SetErrorString(interpreter_internal_error);
+                    error.SetErrorToGenericError();
+                    error.SetErrorString(interpreter_internal_error);
                     return false;
                 }
                 
@@ -1273,8 +742,8 @@ IRInterpreter::runOnFunction (lldb::Clan
                 {
                     if (log)
                         log->Printf("AllocaInsts are not handled if isArrayAllocation() is true");
-                    err.SetErrorToGenericError();
-                    err.SetErrorString(unsupported_opcode_error);
+                    error.SetErrorToGenericError();
+                    error.SetErrorString(unsupported_opcode_error);
                     return false;
                 }
                 
@@ -1286,36 +755,41 @@ IRInterpreter::runOnFunction (lldb::Clan
                 Type *T = alloca_inst->getAllocatedType();
                 Type *Tptr = alloca_inst->getType();
                 
-                Memory::Region R = memory.Malloc(T);
+                lldb::addr_t R = frame.Malloc(T);
                 
-                if (R.IsInvalid())
+                if (R == LLDB_INVALID_ADDRESS)
                 {
                     if (log)
                         log->Printf("Couldn't allocate memory for an AllocaInst");
-                    err.SetErrorToGenericError();
-                    err.SetErrorString(memory_allocation_error);
+                    error.SetErrorToGenericError();
+                    error.SetErrorString(memory_allocation_error);
                     return false;
                 }
                 
-                Memory::Region P = memory.Malloc(Tptr);
+                lldb::addr_t P = frame.Malloc(Tptr);
                 
-                if (P.IsInvalid())
+                if (P == LLDB_INVALID_ADDRESS)
                 {
                     if (log)
                         log->Printf("Couldn't allocate the result pointer for an AllocaInst");
-                    err.SetErrorToGenericError();
-                    err.SetErrorString(memory_allocation_error);
+                    error.SetErrorToGenericError();
+                    error.SetErrorString(memory_allocation_error);
                     return false;
                 }
                 
-                DataEncoderSP P_encoder = memory.GetEncoder(P);
+                lldb_private::Error write_error;
                 
-                if (P_encoder->PutAddress(0, R.m_base) == UINT32_MAX)
+                memory_map.WritePointerToMemory(P, R, write_error);
+                
+                if (!write_error.Success())
                 {
                     if (log)
                         log->Printf("Couldn't write the result pointer for an AllocaInst");
-                    err.SetErrorToGenericError();
-                    err.SetErrorString(memory_write_error);
+                    error.SetErrorToGenericError();
+                    error.SetErrorString(memory_write_error);
+                    lldb_private::Error free_error;
+                    memory_map.Free(P, free_error);
+                    memory_map.Free(R, free_error);
                     return false;
                 }
                 
@@ -1324,13 +798,13 @@ IRInterpreter::runOnFunction (lldb::Clan
                 if (log)
                 {
                     log->Printf("Interpreted an AllocaInst");
-                    log->Printf("  R : %s", memory.SummarizeRegion(R).c_str());
-                    log->Printf("  P : %s", frame.SummarizeValue(alloca_inst).c_str());
+                    log->Printf("  R : 0x%llx", R);
+                    log->Printf("  P : 0x%llx", P);
                 }
             }
-            break;
-        case Instruction::BitCast:
-        case Instruction::ZExt:
+                break;
+            case Instruction::BitCast:
+            case Instruction::ZExt:
             {
                 const CastInst *cast_inst = dyn_cast<CastInst>(inst);
                 
@@ -1338,8 +812,8 @@ IRInterpreter::runOnFunction (lldb::Clan
                 {
                     if (log)
                         log->Printf("getOpcode() returns %s, but instruction is not a BitCastInst", cast_inst->getOpcodeName());
-                    err.SetErrorToGenericError();
-                    err.SetErrorString(interpreter_internal_error);
+                    error.SetErrorToGenericError();
+                    error.SetErrorString(interpreter_internal_error);
                     return false;
                 }
                 
@@ -1347,19 +821,19 @@ IRInterpreter::runOnFunction (lldb::Clan
                 
                 lldb_private::Scalar S;
                 
-                if (!frame.EvaluateValue(S, source, llvm_module))
+                if (!frame.EvaluateValue(S, source, module))
                 {
                     if (log)
                         log->Printf("Couldn't evaluate %s", PrintValue(source).c_str());
-                    err.SetErrorToGenericError();
-                    err.SetErrorString(bad_value_error);
+                    error.SetErrorToGenericError();
+                    error.SetErrorString(bad_value_error);
                     return false;
                 }
                 
-                frame.AssignValue(inst, S, llvm_module);
+                frame.AssignValue(inst, S, module);
             }
-            break;
-        case Instruction::Br:
+                break;
+            case Instruction::Br:
             {
                 const BranchInst *br_inst = dyn_cast<BranchInst>(inst);
                 
@@ -1367,8 +841,8 @@ IRInterpreter::runOnFunction (lldb::Clan
                 {
                     if (log)
                         log->Printf("getOpcode() returns Br, but instruction is not a BranchInst");
-                    err.SetErrorToGenericError();
-                    err.SetErrorString(interpreter_internal_error);
+                    error.SetErrorToGenericError();
+                    error.SetErrorString(interpreter_internal_error);
                     return false;
                 }
                 
@@ -1378,15 +852,15 @@ IRInterpreter::runOnFunction (lldb::Clan
                     
                     lldb_private::Scalar C;
                     
-                    if (!frame.EvaluateValue(C, condition, llvm_module))
+                    if (!frame.EvaluateValue(C, condition, module))
                     {
                         if (log)
                             log->Printf("Couldn't evaluate %s", PrintValue(condition).c_str());
-                        err.SetErrorToGenericError();
-                        err.SetErrorString(bad_value_error);
+                        error.SetErrorToGenericError();
+                        error.SetErrorString(bad_value_error);
                         return false;
                     }
-                
+                    
                     if (C.GetRawBits64(0))
                         frame.Jump(br_inst->getSuccessor(0));
                     else
@@ -1408,8 +882,8 @@ IRInterpreter::runOnFunction (lldb::Clan
                     }
                 }
             }
-            continue;
-        case Instruction::GetElementPtr:
+                continue;
+            case Instruction::GetElementPtr:
             {
                 const GetElementPtrInst *gep_inst = dyn_cast<GetElementPtrInst>(inst);
                 
@@ -1417,25 +891,25 @@ IRInterpreter::runOnFunction (lldb::Clan
                 {
                     if (log)
                         log->Printf("getOpcode() returns GetElementPtr, but instruction is not a GetElementPtrInst");
-                    err.SetErrorToGenericError();
-                    err.SetErrorString(interpreter_internal_error);
+                    error.SetErrorToGenericError();
+                    error.SetErrorString(interpreter_internal_error);
                     return false;
                 }
-             
+                
                 const Value *pointer_operand = gep_inst->getPointerOperand();
                 Type *pointer_type = pointer_operand->getType();
                 
                 lldb_private::Scalar P;
                 
-                if (!frame.EvaluateValue(P, pointer_operand, llvm_module))
+                if (!frame.EvaluateValue(P, pointer_operand, module))
                 {
                     if (log)
                         log->Printf("Couldn't evaluate %s", PrintValue(pointer_operand).c_str());
-                    err.SetErrorToGenericError();
-                    err.SetErrorString(bad_value_error);
+                    error.SetErrorToGenericError();
+                    error.SetErrorString(bad_value_error);
                     return false;
                 }
-                    
+                
                 typedef SmallVector <Value *, 8> IndexVector;
                 typedef IndexVector::iterator IndexIterator;
                 
@@ -1454,12 +928,12 @@ IRInterpreter::runOnFunction (lldb::Clan
                     {
                         lldb_private::Scalar I;
                         
-                        if (!frame.EvaluateValue(I, *ii, llvm_module))
+                        if (!frame.EvaluateValue(I, *ii, module))
                         {
                             if (log)
                                 log->Printf("Couldn't evaluate %s", PrintValue(*ii).c_str());
-                            err.SetErrorToGenericError();
-                            err.SetErrorString(bad_value_error);
+                            error.SetErrorToGenericError();
+                            error.SetErrorString(bad_value_error);
                             return false;
                         }
                         
@@ -1472,11 +946,11 @@ IRInterpreter::runOnFunction (lldb::Clan
                     const_indices.push_back(constant_index);
                 }
                 
-                uint64_t offset = target_data.getIndexedOffset(pointer_type, const_indices);
+                uint64_t offset = data_layout.getIndexedOffset(pointer_type, const_indices);
                 
                 lldb_private::Scalar Poffset = P + offset;
                 
-                frame.AssignValue(inst, Poffset, llvm_module);
+                frame.AssignValue(inst, Poffset, module);
                 
                 if (log)
                 {
@@ -1485,8 +959,8 @@ IRInterpreter::runOnFunction (lldb::Clan
                     log->Printf("  Poffset : %s", frame.SummarizeValue(inst).c_str());
                 }
             }
-            break;
-        case Instruction::ICmp:
+                break;
+            case Instruction::ICmp:
             {
                 const ICmpInst *icmp_inst = dyn_cast<ICmpInst>(inst);
                 
@@ -1494,8 +968,8 @@ IRInterpreter::runOnFunction (lldb::Clan
                 {
                     if (log)
                         log->Printf("getOpcode() returns ICmp, but instruction is not an ICmpInst");
-                    err.SetErrorToGenericError();
-                    err.SetErrorString(interpreter_internal_error);
+                    error.SetErrorToGenericError();
+                    error.SetErrorString(interpreter_internal_error);
                     return false;
                 }
                 
@@ -1507,63 +981,63 @@ IRInterpreter::runOnFunction (lldb::Clan
                 lldb_private::Scalar L;
                 lldb_private::Scalar R;
                 
-                if (!frame.EvaluateValue(L, lhs, llvm_module))
+                if (!frame.EvaluateValue(L, lhs, module))
                 {
                     if (log)
                         log->Printf("Couldn't evaluate %s", PrintValue(lhs).c_str());
-                    err.SetErrorToGenericError();
-                    err.SetErrorString(bad_value_error);
+                    error.SetErrorToGenericError();
+                    error.SetErrorString(bad_value_error);
                     return false;
                 }
                 
-                if (!frame.EvaluateValue(R, rhs, llvm_module))
+                if (!frame.EvaluateValue(R, rhs, module))
                 {
                     if (log)
                         log->Printf("Couldn't evaluate %s", PrintValue(rhs).c_str());
-                    err.SetErrorToGenericError();
-                    err.SetErrorString(bad_value_error);
+                    error.SetErrorToGenericError();
+                    error.SetErrorString(bad_value_error);
                     return false;
                 }
                 
                 lldb_private::Scalar result;
-
+                
                 switch (predicate)
                 {
-                default:
-                    return false;
-                case CmpInst::ICMP_EQ:
-                    result = (L == R);
-                    break;
-                case CmpInst::ICMP_NE:
-                    result = (L != R);
-                    break;    
-                case CmpInst::ICMP_UGT:
-                    result = (L.GetRawBits64(0) > R.GetRawBits64(0));
-                    break;
-                case CmpInst::ICMP_UGE:
-                    result = (L.GetRawBits64(0) >= R.GetRawBits64(0));
-                    break;
-                case CmpInst::ICMP_ULT:
-                    result = (L.GetRawBits64(0) < R.GetRawBits64(0));
-                    break;
-                case CmpInst::ICMP_ULE:
-                    result = (L.GetRawBits64(0) <= R.GetRawBits64(0));
-                    break;
-                case CmpInst::ICMP_SGT:
-                    result = (L > R);
-                    break;
-                case CmpInst::ICMP_SGE:
-                    result = (L >= R);
-                    break;
-                case CmpInst::ICMP_SLT:
-                    result = (L < R);
-                    break;
-                case CmpInst::ICMP_SLE:
-                    result = (L <= R);
-                    break;
+                    default:
+                        return false;
+                    case CmpInst::ICMP_EQ:
+                        result = (L == R);
+                        break;
+                    case CmpInst::ICMP_NE:
+                        result = (L != R);
+                        break;
+                    case CmpInst::ICMP_UGT:
+                        result = (L.GetRawBits64(0) > R.GetRawBits64(0));
+                        break;
+                    case CmpInst::ICMP_UGE:
+                        result = (L.GetRawBits64(0) >= R.GetRawBits64(0));
+                        break;
+                    case CmpInst::ICMP_ULT:
+                        result = (L.GetRawBits64(0) < R.GetRawBits64(0));
+                        break;
+                    case CmpInst::ICMP_ULE:
+                        result = (L.GetRawBits64(0) <= R.GetRawBits64(0));
+                        break;
+                    case CmpInst::ICMP_SGT:
+                        result = (L > R);
+                        break;
+                    case CmpInst::ICMP_SGE:
+                        result = (L >= R);
+                        break;
+                    case CmpInst::ICMP_SLT:
+                        result = (L < R);
+                        break;
+                    case CmpInst::ICMP_SLE:
+                        result = (L <= R);
+                        break;
                 }
                 
-                frame.AssignValue(inst, result, llvm_module);
+                frame.AssignValue(inst, result, module);
                 
                 if (log)
                 {
@@ -1573,8 +1047,8 @@ IRInterpreter::runOnFunction (lldb::Clan
                     log->Printf("  = : %s", frame.SummarizeValue(inst).c_str());
                 }
             }
-            break;
-        case Instruction::IntToPtr:
+                break;
+            case Instruction::IntToPtr:
             {
                 const IntToPtrInst *int_to_ptr_inst = dyn_cast<IntToPtrInst>(inst);
                 
@@ -1582,8 +1056,8 @@ IRInterpreter::runOnFunction (lldb::Clan
                 {
                     if (log)
                         log->Printf("getOpcode() returns IntToPtr, but instruction is not an IntToPtrInst");
-                    err.SetErrorToGenericError();
-                    err.SetErrorString(interpreter_internal_error);
+                    error.SetErrorToGenericError();
+                    error.SetErrorString(interpreter_internal_error);
                     return false;
                 }
                 
@@ -1591,26 +1065,26 @@ IRInterpreter::runOnFunction (lldb::Clan
                 
                 lldb_private::Scalar I;
                 
-                if (!frame.EvaluateValue(I, src_operand, llvm_module))
+                if (!frame.EvaluateValue(I, src_operand, module))
                 {
                     if (log)
                         log->Printf("Couldn't evaluate %s", PrintValue(src_operand).c_str());
-                    err.SetErrorToGenericError();
-                    err.SetErrorString(bad_value_error);
+                    error.SetErrorToGenericError();
+                    error.SetErrorString(bad_value_error);
                     return false;
                 }
                 
-                frame.AssignValue(inst, I, llvm_module);
+                frame.AssignValue(inst, I, module);
                 
                 if (log)
                 {
                     log->Printf("Interpreted an IntToPtr");
                     log->Printf("  Src : %s", frame.SummarizeValue(src_operand).c_str());
-                    log->Printf("  =   : %s", frame.SummarizeValue(inst).c_str()); 
+                    log->Printf("  =   : %s", frame.SummarizeValue(inst).c_str());
                 }
             }
-            break;
-        case Instruction::PtrToInt:
+                break;
+            case Instruction::PtrToInt:
             {
                 const PtrToIntInst *ptr_to_int_inst = dyn_cast<PtrToIntInst>(inst);
                 
@@ -1618,8 +1092,8 @@ IRInterpreter::runOnFunction (lldb::Clan
                 {
                     if (log)
                         log->Printf("getOpcode() returns PtrToInt, but instruction is not an PtrToIntInst");
-                    err.SetErrorToGenericError();
-                    err.SetErrorString(interpreter_internal_error);
+                    error.SetErrorToGenericError();
+                    error.SetErrorString(interpreter_internal_error);
                     return false;
                 }
                 
@@ -1627,16 +1101,16 @@ IRInterpreter::runOnFunction (lldb::Clan
                 
                 lldb_private::Scalar I;
                 
-                if (!frame.EvaluateValue(I, src_operand, llvm_module))
+                if (!frame.EvaluateValue(I, src_operand, module))
                 {
                     if (log)
                         log->Printf("Couldn't evaluate %s", PrintValue(src_operand).c_str());
-                    err.SetErrorToGenericError();
-                    err.SetErrorString(bad_value_error);
+                    error.SetErrorToGenericError();
+                    error.SetErrorString(bad_value_error);
                     return false;
                 }
                 
-                frame.AssignValue(inst, I, llvm_module);
+                frame.AssignValue(inst, I, module);
                 
                 if (log)
                 {
@@ -1645,8 +1119,8 @@ IRInterpreter::runOnFunction (lldb::Clan
                     log->Printf("  =   : %s", frame.SummarizeValue(inst).c_str());
                 }
             }
-            break;
-        case Instruction::Load:
+                break;
+            case Instruction::Load:
             {
                 const LoadInst *load_inst = dyn_cast<LoadInst>(inst);
                 
@@ -1654,8 +1128,8 @@ IRInterpreter::runOnFunction (lldb::Clan
                 {
                     if (log)
                         log->Printf("getOpcode() returns Load, but instruction is not a LoadInst");
-                    err.SetErrorToGenericError();
-                    err.SetErrorString(interpreter_internal_error);
+                    error.SetErrorToGenericError();
+                    error.SetErrorString(interpreter_internal_error);
                     return false;
                 }
                 
@@ -1664,7 +1138,7 @@ IRInterpreter::runOnFunction (lldb::Clan
                 //   Resolve the region P containing a pointer
                 //   Dereference P to get the region R that the data should be loaded from
                 //   Transfer a unit of type type(D) from R to D
-                                
+                
                 const Value *pointer_operand = load_inst->getPointerOperand();
                 
                 Type *pointer_ty = pointer_operand->getType();
@@ -1673,95 +1147,85 @@ IRInterpreter::runOnFunction (lldb::Clan
                 {
                     if (log)
                         log->Printf("getPointerOperand()->getType() is not a PointerType");
-                    err.SetErrorToGenericError();
-                    err.SetErrorString(interpreter_internal_error);
+                    error.SetErrorToGenericError();
+                    error.SetErrorString(interpreter_internal_error);
                     return false;
                 }
                 Type *target_ty = pointer_ptr_ty->getElementType();
                 
-                Memory::Region D = frame.ResolveValue(load_inst, llvm_module);
-                Memory::Region P = frame.ResolveValue(pointer_operand, llvm_module);
+                lldb::addr_t D = frame.ResolveValue(load_inst, module);
+                lldb::addr_t P = frame.ResolveValue(pointer_operand, module);
                 
-                if (D.IsInvalid())
+                if (D == LLDB_INVALID_ADDRESS)
                 {
                     if (log)
                         log->Printf("LoadInst's value doesn't resolve to anything");
-                    err.SetErrorToGenericError();
-                    err.SetErrorString(bad_value_error);
+                    error.SetErrorToGenericError();
+                    error.SetErrorString(bad_value_error);
                     return false;
                 }
                 
-                if (P.IsInvalid())
+                if (P == LLDB_INVALID_ADDRESS)
                 {
                     if (log)
                         log->Printf("LoadInst's pointer doesn't resolve to anything");
-                    err.SetErrorToGenericError();
-                    err.SetErrorString(bad_value_error);
+                    error.SetErrorToGenericError();
+                    error.SetErrorString(bad_value_error);
                     return false;
                 }
                 
-                DataExtractorSP P_extractor(memory.GetExtractor(P));
-                DataEncoderSP D_encoder(memory.GetEncoder(D));
-
-                lldb::offset_t offset = 0;
-                lldb::addr_t pointer = P_extractor->GetAddress(&offset);
+                lldb::addr_t R;
+                lldb_private::Error read_error;
+                memory_map.ReadPointerFromMemory(&R, P, read_error);
                 
-                Memory::Region R = memory.Lookup(pointer, target_ty);
+                if (!read_error.Success())
+                {
+                    if (log)
+                        log->Printf("Couldn't read the address to be loaded for a LoadInst");
+                    error.SetErrorToGenericError();
+                    error.SetErrorString(memory_read_error);
+                    return false;
+                }
                 
-                if (R.IsValid())
+                size_t target_size = data_layout.getTypeStoreSize(target_ty);
+                lldb_private::DataBufferHeap buffer(target_size, 0);
+                
+                read_error.Clear();
+                memory_map.ReadMemory(buffer.GetBytes(), R, buffer.GetByteSize(), read_error);
+                if (!read_error.Success())
                 {
-                    if (!memory.Read(D_encoder->GetDataStart(), R.m_base, target_data.getTypeStoreSize(target_ty)))
-                    {
-                        if (log)
-                            log->Printf("Couldn't read from a region on behalf of a LoadInst");
-                        err.SetErrorToGenericError();
-                        err.SetErrorString(memory_read_error);
-                        return false;
-                    }
+                    if (log)
+                        log->Printf("Couldn't read from a region on behalf of a LoadInst");
+                    error.SetErrorToGenericError();
+                    error.SetErrorString(memory_read_error);
+                    return false;
                 }
-                else
+                
+                lldb_private::Error write_error;
+                memory_map.WriteMemory(D, buffer.GetBytes(), buffer.GetByteSize(), write_error);
+                if (!write_error.Success())
                 {
-                    if (!memory.ReadFromRawPtr(D_encoder->GetDataStart(), pointer, target_data.getTypeStoreSize(target_ty)))
-                    {
-                        if (log)
-                            log->Printf("Couldn't read from a raw pointer on behalf of a LoadInst");
-                        err.SetErrorToGenericError();
-                        err.SetErrorString(memory_read_error);
-                        return false;
-                    }
+                    if (log)
+                        log->Printf("Couldn't write to a region on behalf of a LoadInst");
+                    error.SetErrorToGenericError();
+                    error.SetErrorString(memory_read_error);
+                    return false;
                 }
                 
                 if (log)
                 {
                     log->Printf("Interpreted a LoadInst");
-                    log->Printf("  P : %s", frame.SummarizeValue(pointer_operand).c_str());
-                    if (R.IsValid())
-                        log->Printf("  R : %s", memory.SummarizeRegion(R).c_str());
-                    else
-                        log->Printf("  R : raw pointer 0x%llx", (unsigned long long)pointer);
-                    log->Printf("  D : %s", frame.SummarizeValue(load_inst).c_str());
+                    log->Printf("  P : 0x%llx", P);
+                    log->Printf("  R : 0x%llx", R);
+                    log->Printf("  D : 0x%llx", D);
                 }
             }
-            break;
-        case Instruction::Ret:
+                break;
+            case Instruction::Ret:
             {
-                if (result_name.IsEmpty())
-                    return true;
-                
-                GlobalValue *result_value = llvm_module.getNamedValue(result_name.GetCString());
-                
-                if (!frame.ConstructResult(result, result_value, result_name, result_type, llvm_module))
-                {
-                    if (log)
-                        log->Printf("Couldn't construct the expression's result");
-                    err.SetErrorToGenericError();
-                    err.SetErrorString(bad_result_error);
-                    return false;
-                }
-                
                 return true;
             }
-        case Instruction::Store:
+            case Instruction::Store:
             {
                 const StoreInst *store_inst = dyn_cast<StoreInst>(inst);
                 
@@ -1769,8 +1233,8 @@ IRInterpreter::runOnFunction (lldb::Clan
                 {
                     if (log)
                         log->Printf("getOpcode() returns Store, but instruction is not a StoreInst");
-                    err.SetErrorToGenericError();
-                    err.SetErrorString(interpreter_internal_error);
+                    error.SetErrorToGenericError();
+                    error.SetErrorString(interpreter_internal_error);
                     return false;
                 }
                 
@@ -1789,71 +1253,74 @@ IRInterpreter::runOnFunction (lldb::Clan
                     return false;
                 Type *target_ty = pointer_ptr_ty->getElementType();
                 
-                Memory::Region D = frame.ResolveValue(value_operand, llvm_module);
-                Memory::Region P = frame.ResolveValue(pointer_operand, llvm_module);
+                lldb::addr_t D = frame.ResolveValue(value_operand, module);
+                lldb::addr_t P = frame.ResolveValue(pointer_operand, module);
                 
-                if (D.IsInvalid())
+                if (D == LLDB_INVALID_ADDRESS)
                 {
                     if (log)
                         log->Printf("StoreInst's value doesn't resolve to anything");
-                    err.SetErrorToGenericError();
-                    err.SetErrorString(bad_value_error);
+                    error.SetErrorToGenericError();
+                    error.SetErrorString(bad_value_error);
                     return false;
                 }
                 
-                if (P.IsInvalid())
+                if (P == LLDB_INVALID_ADDRESS)
                 {
                     if (log)
                         log->Printf("StoreInst's pointer doesn't resolve to anything");
-                    err.SetErrorToGenericError();
-                    err.SetErrorString(bad_value_error);
+                    error.SetErrorToGenericError();
+                    error.SetErrorString(bad_value_error);
                     return false;
                 }
                 
-                DataExtractorSP P_extractor(memory.GetExtractor(P));
-                DataExtractorSP D_extractor(memory.GetExtractor(D));
-
-                if (!P_extractor || !D_extractor)
-                    return false;
+                lldb::addr_t R;
+                lldb_private::Error read_error;
+                memory_map.ReadPointerFromMemory(&R, P, read_error);
                 
-                lldb::offset_t offset = 0;
-                lldb::addr_t pointer = P_extractor->GetAddress(&offset);
+                if (!read_error.Success())
+                {
+                    if (log)
+                        log->Printf("Couldn't read the address to be loaded for a LoadInst");
+                    error.SetErrorToGenericError();
+                    error.SetErrorString(memory_read_error);
+                    return false;
+                }
                 
-                Memory::Region R = memory.Lookup(pointer, target_ty);
+                size_t target_size = data_layout.getTypeStoreSize(target_ty);
+                lldb_private::DataBufferHeap buffer(target_size, 0);
                 
-                if (R.IsValid())
+                read_error.Clear();
+                memory_map.ReadMemory(buffer.GetBytes(), D, buffer.GetByteSize(), read_error);
+                if (!read_error.Success())
                 {
-                    if (!memory.Write(R.m_base, D_extractor->GetDataStart(), target_data.getTypeStoreSize(target_ty)))
-                    {
-                        if (log)
-                            log->Printf("Couldn't write to a region on behalf of a LoadInst");
-                        err.SetErrorToGenericError();
-                        err.SetErrorString(memory_write_error);
-                        return false;
-                    }
+                    if (log)
+                        log->Printf("Couldn't read from a region on behalf of a StoreInst");
+                    error.SetErrorToGenericError();
+                    error.SetErrorString(memory_read_error);
+                    return false;
                 }
-                else
+                
+                lldb_private::Error write_error;
+                memory_map.WriteMemory(R, buffer.GetBytes(), buffer.GetByteSize(), write_error);
+                if (!write_error.Success())
                 {
-                    if (!memory.WriteToRawPtr(pointer, D_extractor->GetDataStart(), target_data.getTypeStoreSize(target_ty)))
-                    {
-                        if (log)
-                            log->Printf("Couldn't write to a raw pointer on behalf of a LoadInst");
-                        err.SetErrorToGenericError();
-                        err.SetErrorString(memory_write_error);
-                        return false;
-                    }
+                    if (log)
+                        log->Printf("Couldn't write to a region on behalf of a StoreInst");
+                    error.SetErrorToGenericError();
+                    error.SetErrorString(memory_write_error);
+                    return false;
                 }
                 
-                
                 if (log)
                 {
                     log->Printf("Interpreted a StoreInst");
-                    log->Printf("  D : %s", frame.SummarizeValue(value_operand).c_str());
-                    log->Printf("  P : %s", frame.SummarizeValue(pointer_operand).c_str());
-                    log->Printf("  R : %s", memory.SummarizeRegion(R).c_str());
+                    log->Printf("  D : 0x%llx", D);
+                    log->Printf("  P : 0x%llx", P);
+                    log->Printf("  R : 0x%llx", R);
                 }
             }
-            break;
+                break;
         }
         
         ++frame.m_ii;
@@ -1861,10 +1328,10 @@ IRInterpreter::runOnFunction (lldb::Clan
     
     if (num_insts >= 4096)
     {
-        err.SetErrorToGenericError();
-        err.SetErrorString(infinite_loop_error);
+        error.SetErrorToGenericError();
+        error.SetErrorString(infinite_loop_error);
         return false;
     }
-        
-    return false; 
+    
+    return false;
 }

Modified: lldb/branches/windows/source/Expression/IRMemoryMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Expression/IRMemoryMap.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Expression/IRMemoryMap.cpp (original)
+++ lldb/branches/windows/source/Expression/IRMemoryMap.cpp Thu Apr 25 07:31:53 2013
@@ -50,47 +50,73 @@ IRMemoryMap::~IRMemoryMap ()
 lldb::addr_t
 IRMemoryMap::FindSpace (size_t size)
 {
-    // Yup, this is just plain O(n) insertion.  We'll use a range tree if we
-    // start caring.
-    
-    lldb::addr_t remote_address = 0x1000; // skip first page of memory
-    
-    for (auto allocation = m_allocations.begin(); allocation != m_allocations.end(); allocation++)
-    {
-        if (remote_address < allocation->second.m_process_start &&
-            remote_address + size <= allocation->second.m_process_start)
-            return remote_address;
+    lldb::TargetSP target_sp = m_target_wp.lock();
+    lldb::ProcessSP process_sp = m_process_wp.lock();
         
-        remote_address = allocation->second.m_process_start = allocation->second.m_size;
-    }
-    
-    if (remote_address + size < remote_address)
-        return LLDB_INVALID_ADDRESS; // massively unlikely
+    lldb::addr_t ret = LLDB_INVALID_ADDRESS;
     
-    return remote_address;
-}
-
-bool
-IRMemoryMap::ContainsHostOnlyAllocations ()
-{
-    for (auto allocation = m_allocations.begin(); allocation != m_allocations.end(); allocation ++)
+    for (int iterations = 0; iterations < 16; ++iterations)
     {
-        if (allocation->second.m_policy == eAllocationPolicyHostOnly)
-            return true;
+        lldb::addr_t candidate;
+        
+        switch (target_sp->GetArchitecture().GetAddressByteSize())
+        {
+        case 4:
+            {
+#if _WIN32
+                uint32_t random_data = rand();
+#else
+                uint32_t random_data = random();
+#endif
+                candidate = random_data;
+                candidate &= ~0xfffull;
+                break;
+            }
+        case 8:
+            {
+#if _WIN32
+                uint32_t random_low = rand();
+                uint32_t random_high = rand();
+#else
+                uint32_t random_low = random();
+                uint32_t random_high = random();
+#endif
+                candidate = random_high;
+                candidate <<= 32ull;
+                candidate |= random_low;
+                candidate &= ~0xfffull;
+                break;
+            }
+        }
+        
+        if (IntersectsAllocation(candidate, size))
+            continue;
+        
+        char buf[1];
+        
+        Error err;
+        
+        if (process_sp &&
+            (process_sp->ReadMemory(candidate, buf, 1, err) == 1 ||
+             process_sp->ReadMemory(candidate + size, buf, 1, err) == 1))
+            continue;
+        
+        ret = candidate;
     }
     
-    return false;
+    return ret;
 }
 
 IRMemoryMap::AllocationMap::iterator
 IRMemoryMap::FindAllocation (lldb::addr_t addr, size_t size)
 {
-    AllocationMap::iterator iter = m_allocations.lower_bound (addr);
+    if (addr == LLDB_INVALID_ADDRESS)
+        return m_allocations.end();
     
-    if (iter == m_allocations.end())
-        return iter;
+    AllocationMap::iterator iter = m_allocations.lower_bound (addr);
     
-    if (iter->first > addr)
+    if (iter == m_allocations.end() ||
+        iter->first > addr)
     {
         if (iter == m_allocations.begin())
             return m_allocations.end();
@@ -103,6 +129,34 @@ IRMemoryMap::FindAllocation (lldb::addr_
     return m_allocations.end();
 }
 
+bool
+IRMemoryMap::IntersectsAllocation (lldb::addr_t addr, size_t size)
+{
+    if (addr == LLDB_INVALID_ADDRESS)
+        return false;
+    
+    AllocationMap::iterator iter = m_allocations.lower_bound (addr);
+    
+    if (iter == m_allocations.end() ||
+        iter->first > addr)
+    {
+        if (iter == m_allocations.begin())
+            return false;
+        
+        iter--;
+    }
+    
+    while (iter != m_allocations.end() && iter->second.m_process_alloc < addr + size)
+    {
+        if (iter->second.m_process_start + iter->second.m_size > addr)
+            return true;
+        
+        ++iter;
+    }
+    
+    return false;
+}
+
 lldb::ByteOrder
 IRMemoryMap::GetByteOrder()
 {
@@ -114,7 +168,7 @@ IRMemoryMap::GetByteOrder()
     lldb::TargetSP target_sp = m_target_wp.lock();
     
     if (target_sp)
-        return target_sp->GetDefaultArchitecture().GetByteOrder();
+        return target_sp->GetArchitecture().GetByteOrder();
     
     return lldb::eByteOrderInvalid;
 }
@@ -130,7 +184,7 @@ IRMemoryMap::GetAddressByteSize()
     lldb::TargetSP target_sp = m_target_wp.lock();
     
     if (target_sp)
-        return target_sp->GetDefaultArchitecture().GetAddressByteSize();
+        return target_sp->GetArchitecture().GetAddressByteSize();
     
     return UINT32_MAX;
 }
@@ -151,9 +205,42 @@ IRMemoryMap::GetBestExecutionContextScop
     return NULL;
 }
 
+IRMemoryMap::Allocation::Allocation (lldb::addr_t process_alloc,
+                                     lldb::addr_t process_start,
+                                     size_t size,
+                                     uint32_t permissions,
+                                     uint8_t alignment,
+                                     AllocationPolicy policy)
+{
+    m_process_alloc = process_alloc;
+    m_process_start = process_start;
+    m_size = size;
+    m_permissions = permissions;
+    m_alignment = alignment;
+    m_policy = policy;
+    
+    switch (policy)
+    {
+        default:
+            assert (0 && "We cannot reach this!");
+        case eAllocationPolicyHostOnly:
+            m_data.SetByteSize(size);
+            memset(m_data.GetBytes(), 0, size);
+            break;
+        case eAllocationPolicyProcessOnly:
+            break;
+        case eAllocationPolicyMirror:
+            m_data.SetByteSize(size);
+            memset(m_data.GetBytes(), 0, size);
+            break;
+    }
+}
+
 lldb::addr_t
 IRMemoryMap::Malloc (size_t size, uint8_t alignment, uint32_t permissions, AllocationPolicy policy, Error &error)
 {
+    error.Clear();
+    
     lldb::ProcessSP process_sp;
     lldb::addr_t    allocation_address  = LLDB_INVALID_ADDRESS;
     lldb::addr_t    aligned_address     = LLDB_INVALID_ADDRESS;
@@ -176,14 +263,8 @@ IRMemoryMap::Malloc (size_t size, uint8_
         }
         break;
     case eAllocationPolicyMirror:
-        if (ContainsHostOnlyAllocations())
-        {
-            error.SetErrorToGenericError();
-            error.SetErrorString("Couldn't malloc: host-only allocations are polluting the address space");
-            return LLDB_INVALID_ADDRESS;
-        }
         process_sp = m_process_wp.lock();
-        if (process_sp)
+        if (process_sp && process_sp->CanJIT())
         {
             allocation_address = process_sp->AllocateMemory(allocation_size, permissions, error);
             if (!error.Success())
@@ -191,6 +272,7 @@ IRMemoryMap::Malloc (size_t size, uint8_
         }
         else
         {
+            policy = eAllocationPolicyHostOnly;
             allocation_address = FindSpace(allocation_size);
             if (allocation_address == LLDB_INVALID_ADDRESS)
             {
@@ -201,18 +283,21 @@ IRMemoryMap::Malloc (size_t size, uint8_
         }
         break;
     case eAllocationPolicyProcessOnly:
-        if (ContainsHostOnlyAllocations())
-        {
-            error.SetErrorToGenericError();
-            error.SetErrorString("Couldn't malloc: host-only allocations are polluting the address space");
-            return LLDB_INVALID_ADDRESS;
-        }
         process_sp = m_process_wp.lock();
         if (process_sp)
         {
-            allocation_address = process_sp->AllocateMemory(allocation_size, permissions, error);
-            if (!error.Success())
+            if (process_sp->CanJIT())
+            {
+                allocation_address = process_sp->AllocateMemory(allocation_size, permissions, error);
+                if (!error.Success())
+                    return LLDB_INVALID_ADDRESS;
+            }
+            else
+            {
+                error.SetErrorToGenericError();
+                error.SetErrorString("Couldn't malloc: process doesn't support allocating memory");
                 return LLDB_INVALID_ADDRESS;
+            }
         }
         else
         {
@@ -227,28 +312,12 @@ IRMemoryMap::Malloc (size_t size, uint8_
     lldb::addr_t mask = alignment - 1;
     aligned_address = (allocation_address + mask) & (~mask);
 
-    Allocation &allocation(m_allocations[aligned_address]);
-    
-    allocation.m_process_alloc = allocation_address;
-    allocation.m_process_start = aligned_address;
-    allocation.m_size = size;
-    allocation.m_permissions = permissions;
-    allocation.m_alignment = alignment;
-    allocation.m_policy = policy;
-    
-    switch (policy)
-    {
-    default:
-        assert (0 && "We cannot reach this!");
-    case eAllocationPolicyHostOnly:
-        allocation.m_data.reset(new DataBufferHeap(size, 0));
-        break;
-    case eAllocationPolicyProcessOnly:
-        break;
-    case eAllocationPolicyMirror:
-        allocation.m_data.reset(new DataBufferHeap(size, 0));
-        break;
-    }
+    m_allocations[aligned_address] = Allocation(allocation_address,
+                                                aligned_address,
+                                                size,
+                                                permissions,
+                                                alignment,
+                                                policy);
     
     if (lldb_private::Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS))
     {
@@ -284,6 +353,8 @@ IRMemoryMap::Malloc (size_t size, uint8_
 void
 IRMemoryMap::Free (lldb::addr_t process_address, Error &error)
 {
+    error.Clear();
+    
     AllocationMap::iterator iter = m_allocations.find(process_address);
     
     if (iter == m_allocations.end())
@@ -321,6 +392,8 @@ IRMemoryMap::Free (lldb::addr_t process_
 void
 IRMemoryMap::WriteMemory (lldb::addr_t process_address, const uint8_t *bytes, size_t size, Error &error)
 {
+    error.Clear();
+    
     AllocationMap::iterator iter = FindAllocation(process_address, size);
     
     if (iter == m_allocations.end())
@@ -351,22 +424,22 @@ IRMemoryMap::WriteMemory (lldb::addr_t p
         error.SetErrorString("Couldn't write: invalid allocation policy");
         return;
     case eAllocationPolicyHostOnly:
-        if (!allocation.m_data)
+        if (!allocation.m_data.GetByteSize())
         {
             error.SetErrorToGenericError();
             error.SetErrorString("Couldn't write: data buffer is empty");
             return;
         }
-        ::memcpy (allocation.m_data->GetBytes() + offset, bytes, size);
+        ::memcpy (allocation.m_data.GetBytes() + offset, bytes, size);
         break;
     case eAllocationPolicyMirror:
-        if (!allocation.m_data)
+        if (!allocation.m_data.GetByteSize())
         {
             error.SetErrorToGenericError();
             error.SetErrorString("Couldn't write: data buffer is empty");
             return;
         }
-        ::memcpy (allocation.m_data->GetBytes() + offset, bytes, size);
+        ::memcpy (allocation.m_data.GetBytes() + offset, bytes, size);
         process_sp = m_process_wp.lock();
         if (process_sp)
         {
@@ -399,7 +472,9 @@ IRMemoryMap::WriteMemory (lldb::addr_t p
 
 void
 IRMemoryMap::WriteScalarToMemory (lldb::addr_t process_address, Scalar &scalar, size_t size, Error &error)
-{    
+{
+    error.Clear();
+    
     if (size == UINT32_MAX)
         size = scalar.GetByteSize();
     
@@ -428,6 +503,8 @@ IRMemoryMap::WriteScalarToMemory (lldb::
 void
 IRMemoryMap::WritePointerToMemory (lldb::addr_t process_address, lldb::addr_t address, Error &error)
 {
+    error.Clear();
+    
     Scalar scalar(address);
     
     WriteScalarToMemory(process_address, scalar, GetAddressByteSize(), error);
@@ -436,6 +513,8 @@ IRMemoryMap::WritePointerToMemory (lldb:
 void
 IRMemoryMap::ReadMemory (uint8_t *bytes, lldb::addr_t process_address, size_t size, Error &error)
 {
+    error.Clear();
+    
     AllocationMap::iterator iter = FindAllocation(process_address, size);
     
     if (iter == m_allocations.end())
@@ -475,13 +554,13 @@ IRMemoryMap::ReadMemory (uint8_t *bytes,
         error.SetErrorString("Couldn't read: invalid allocation policy");
         return;
     case eAllocationPolicyHostOnly:
-        if (!allocation.m_data)
+        if (!allocation.m_data.GetByteSize())
         {
             error.SetErrorToGenericError();
             error.SetErrorString("Couldn't read: data buffer is empty");
             return;
         }
-        ::memcpy (bytes, allocation.m_data->GetBytes() + offset, size);
+        ::memcpy (bytes, allocation.m_data.GetBytes() + offset, size);
         break;
     case eAllocationPolicyMirror:
         process_sp = m_process_wp.lock();
@@ -493,13 +572,13 @@ IRMemoryMap::ReadMemory (uint8_t *bytes,
         }
         else
         {
-            if (!allocation.m_data)
+            if (!allocation.m_data.GetByteSize())
             {
                 error.SetErrorToGenericError();
                 error.SetErrorString("Couldn't read: data buffer is empty");
                 return;
             }
-            ::memcpy (bytes, allocation.m_data->GetBytes() + offset, size);
+            ::memcpy (bytes, allocation.m_data.GetBytes() + offset, size);
         }
         break;
     case eAllocationPolicyProcessOnly:
@@ -526,7 +605,9 @@ IRMemoryMap::ReadMemory (uint8_t *bytes,
 
 void
 IRMemoryMap::ReadScalarFromMemory (Scalar &scalar, lldb::addr_t process_address, size_t size, Error &error)
-{ 
+{
+    error.Clear();
+    
     if (size > 0)
     {
         DataBufferHeap buf(size, 0);
@@ -562,6 +643,8 @@ IRMemoryMap::ReadScalarFromMemory (Scala
 void
 IRMemoryMap::ReadPointerFromMemory (lldb::addr_t *address, lldb::addr_t process_address, Error &error)
 {
+    error.Clear();
+    
     Scalar pointer_scalar;
     ReadScalarFromMemory(pointer_scalar, process_address, GetAddressByteSize(), error);
     
@@ -576,6 +659,8 @@ IRMemoryMap::ReadPointerFromMemory (lldb
 void
 IRMemoryMap::GetMemoryData (DataExtractor &extractor, lldb::addr_t process_address, size_t size, Error &error)
 {
+    error.Clear();
+    
     if (size > 0)
     {
         AllocationMap::iterator iter = FindAllocation(process_address, size);
@@ -603,7 +688,7 @@ IRMemoryMap::GetMemoryData (DataExtracto
             {
                 lldb::ProcessSP process_sp = m_process_wp.lock();
 
-                if (!allocation.m_data.get())
+                if (!allocation.m_data.GetByteSize())
                 {
                     error.SetErrorToGenericError();
                     error.SetErrorString("Couldn't get memory data: data buffer is empty");
@@ -611,23 +696,23 @@ IRMemoryMap::GetMemoryData (DataExtracto
                 }
                 if (process_sp)
                 {
-                    process_sp->ReadMemory(allocation.m_process_start, allocation.m_data->GetBytes(), allocation.m_data->GetByteSize(), error);
+                    process_sp->ReadMemory(allocation.m_process_start, allocation.m_data.GetBytes(), allocation.m_data.GetByteSize(), error);
                     if (!error.Success())
                         return;
                     uint64_t offset = process_address - allocation.m_process_start;
-                    extractor = DataExtractor(allocation.m_data->GetBytes() + offset, size, GetByteOrder(), GetAddressByteSize());
+                    extractor = DataExtractor(allocation.m_data.GetBytes() + offset, size, GetByteOrder(), GetAddressByteSize());
                     return;
                 }
             }
         case eAllocationPolicyHostOnly:
-            if (!allocation.m_data.get())
+            if (!allocation.m_data.GetByteSize())
             {
                 error.SetErrorToGenericError();
                 error.SetErrorString("Couldn't get memory data: data buffer is empty");
                 return;
             }
             uint64_t offset = process_address - allocation.m_process_start;
-            extractor = DataExtractor(allocation.m_data->GetBytes() + offset, size, GetByteOrder(), GetAddressByteSize());
+            extractor = DataExtractor(allocation.m_data.GetBytes() + offset, size, GetByteOrder(), GetAddressByteSize());
             return;
         }
     }

Modified: lldb/branches/windows/source/Expression/Materializer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Expression/Materializer.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Expression/Materializer.cpp (original)
+++ lldb/branches/windows/source/Expression/Materializer.cpp Thu Apr 25 07:31:53 2013
@@ -20,6 +20,7 @@
 #include "lldb/Target/ExecutionContext.h"
 #include "lldb/Target/RegisterContext.h"
 #include "lldb/Target/StackFrame.h"
+#include "lldb/Target/Target.h"
 
 using namespace lldb_private;
 
@@ -67,10 +68,9 @@ public:
         Entity(),
         m_persistent_variable_sp(persistent_variable_sp)
     {
-        ClangASTType type(m_persistent_variable_sp->GetClangAST(),
-                          m_persistent_variable_sp->GetClangType());
-
-        SetSizeAndAlignmentFromType(type);
+        // Hard-coding to maximum size of a pointer since persistent variables are materialized by reference
+        m_size = 8;
+        m_alignment = 8;
     }
     
     void MakeAllocation (IRMemoryMap &map, Error &err)
@@ -135,6 +135,8 @@ public:
         Error deallocate_error;
         
         map.Free((lldb::addr_t)m_persistent_variable_sp->m_live_sp->GetValue().GetScalar().ULongLong(), deallocate_error);
+        
+        m_persistent_variable_sp->m_live_sp.reset();
             
         if (!deallocate_error.Success())
         {
@@ -143,7 +145,7 @@ public:
         }
     }
     
-    virtual void Materialize (lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address, Error &err)
+    void Materialize (lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address, Error &err)
     {
         Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
 
@@ -158,6 +160,8 @@ public:
         if (m_persistent_variable_sp->m_flags & ClangExpressionVariable::EVNeedsAllocation)
         {
             MakeAllocation(map, err);
+            m_persistent_variable_sp->m_flags |= ClangExpressionVariable::EVIsLLDBAllocated;
+            
             if (!err.Success())
                 return;
         }
@@ -166,10 +170,10 @@ public:
             m_persistent_variable_sp->m_flags & ClangExpressionVariable::EVIsLLDBAllocated)
         {
             Error write_error;
-            
+                        
             map.WriteScalarToMemory(process_address + m_offset,
                                     m_persistent_variable_sp->m_live_sp->GetValue().GetScalar(),
-                                    m_persistent_variable_sp->m_live_sp->GetProcessSP()->GetAddressByteSize(),
+                                    map.GetAddressByteSize(),
                                     write_error);
             
             if (!write_error.Success())
@@ -186,8 +190,8 @@ public:
         }
     }
     
-    virtual void Dematerialize (lldb::StackFrameSP &frame_sp, IRMemoryMap &map,
-                                lldb::addr_t frame_top, lldb::addr_t frame_bottom, lldb::addr_t process_address, Error &err)
+    void Dematerialize (lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address,
+                                lldb::addr_t frame_top, lldb::addr_t frame_bottom, Error &err)
     {
         Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
         
@@ -208,10 +212,10 @@ public:
                 // If the reference comes from the program, then the ClangExpressionVariable's
                 // live variable data hasn't been set up yet.  Do this now.
                 
-                Scalar location_scalar;
+                lldb::addr_t location;
                 Error read_error;
                 
-                map.ReadScalarFromMemory(location_scalar, process_address + m_offset, map.GetAddressByteSize(), read_error);
+                map.ReadPointerFromMemory(&location, process_address + m_offset, read_error);
                                 
                 if (!read_error.Success())
                 {
@@ -219,9 +223,7 @@ public:
                     err.SetErrorStringWithFormat("Couldn't read the address of program-allocated variable %s: %s", m_persistent_variable_sp->GetName().GetCString(), read_error.AsCString());
                     return;
                 }
-                
-                lldb::addr_t location = location_scalar.ULongLong();
-                
+                                
                 m_persistent_variable_sp->m_live_sp = ValueObjectConstResult::Create (map.GetBestExecutionContextScope (),
                                                                                       m_persistent_variable_sp->GetTypeFromUser().GetASTContext(),
                                                                                       m_persistent_variable_sp->GetTypeFromUser().GetOpaqueQualType(),
@@ -280,6 +282,7 @@ public:
                 
                 if (!read_error.Success())
                 {
+                    err.SetErrorToGenericError();
                     err.SetErrorStringWithFormat ("Couldn't read the contents of %s from memory: %s", m_persistent_variable_sp->GetName().GetCString(), read_error.AsCString());
                     return;
                 }
@@ -294,8 +297,20 @@ public:
             return;
         }
         
-        if (m_persistent_variable_sp->m_flags & ClangExpressionVariable::EVNeedsAllocation &&
-            !(m_persistent_variable_sp->m_flags & ClangExpressionVariable::EVKeepInTarget))
+        lldb::ProcessSP process_sp = map.GetBestExecutionContextScope()->CalculateProcess();
+        if (!process_sp ||
+            !process_sp->CanJIT())
+        {
+            // Allocations are not persistent so persistent variables cannot stay materialized.
+            
+            m_persistent_variable_sp->m_flags |= ClangExpressionVariable::EVNeedsAllocation;
+
+            DestroyAllocation(map, err);
+            if (!err.Success())
+                return;
+        }
+        else if (m_persistent_variable_sp->m_flags & ClangExpressionVariable::EVNeedsAllocation &&
+                 !(m_persistent_variable_sp->m_flags & ClangExpressionVariable::EVKeepInTarget))
         {
             DestroyAllocation(map, err);
             if (!err.Success())
@@ -327,6 +342,8 @@ public:
                 DataExtractor extractor (data.GetBytes(), data.GetByteSize(), map.GetByteOrder(), map.GetAddressByteSize());
                 
                 extractor.DumpHexBytes(&dump_stream, data.GetBytes(), data.GetByteSize(), 16, process_address + m_offset);
+                
+                dump_stream.PutChar('\n');
             }
         }
         
@@ -356,6 +373,8 @@ public:
                     DataExtractor extractor (data.GetBytes(), data.GetByteSize(), map.GetByteOrder(), map.GetAddressByteSize());
                     
                     extractor.DumpHexBytes(&dump_stream, data.GetBytes(), data.GetByteSize(), 16, target_address);
+                    
+                    dump_stream.PutChar('\n');
                 }
             }
         }
@@ -363,7 +382,9 @@ public:
         log->PutCString(dump_stream.GetData());
     }
     
-    
+    void Wipe (IRMemoryMap &map, lldb::addr_t process_address)
+    {
+    }
 private:
     lldb::ClangExpressionVariableSP m_persistent_variable_sp;
 };
@@ -394,7 +415,7 @@ public:
         m_is_reference = ClangASTContext::IsReferenceType(m_variable_sp->GetType()->GetClangForwardType());
     }
     
-    virtual void Materialize (lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address, Error &err)
+    void Materialize (lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address, Error &err)
     {
         Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
         
@@ -462,7 +483,7 @@ public:
                 DataExtractor data;
                 valobj_sp->GetData(data);
                 
-                if (m_temporary_allocation == LLDB_INVALID_ADDRESS)
+                if (m_temporary_allocation != LLDB_INVALID_ADDRESS)
                 {
                     err.SetErrorToGenericError();
                     err.SetErrorStringWithFormat("Trying to create a temporary region for %s but one exists", m_variable_sp->GetName().AsCString());
@@ -515,8 +536,8 @@ public:
         }
     }
     
-    virtual void Dematerialize (lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address,
-                                lldb::addr_t frame_top, lldb::addr_t frame_bottom, Error &err)
+    void Dematerialize (lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address,
+                        lldb::addr_t frame_top, lldb::addr_t frame_bottom, Error &err)
     {
         Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
 
@@ -574,7 +595,7 @@ public:
             if (!free_error.Success())
             {
                 err.SetErrorToGenericError();
-                err.SetErrorStringWithFormat("Couldn'tfree the temporary region for %s: %s", m_variable_sp->GetName().AsCString(), free_error.AsCString());
+                err.SetErrorStringWithFormat("Couldn't free the temporary region for %s: %s", m_variable_sp->GetName().AsCString(), free_error.AsCString());
                 return;
             }
             
@@ -587,9 +608,11 @@ public:
     {
         StreamString dump_stream;
         
-        Error err;
+        dump_stream.Printf("0x%llx: EntityVariable\n", (unsigned long long)process_address + m_offset);
         
-        dump_stream.Printf("0x%llx: EntityVariable (%s)\n", (unsigned long long)process_address + m_offset, m_variable_sp->GetName().AsCString());
+        Error err;
+                
+        lldb::addr_t ptr = LLDB_INVALID_ADDRESS;
         
         {
             dump_stream.Printf("Pointer:\n");
@@ -607,42 +630,64 @@ public:
                 DataExtractor extractor (data.GetBytes(), data.GetByteSize(), map.GetByteOrder(), map.GetAddressByteSize());
                 
                 extractor.DumpHexBytes(&dump_stream, data.GetBytes(), data.GetByteSize(), 16, process_address + m_offset);
+                
+                lldb::offset_t offset;
+                
+                ptr = extractor.GetPointer(&offset);
+                
+                dump_stream.PutChar('\n');
             }
         }
         
-        if (m_is_reference)
+        if (m_temporary_allocation == LLDB_INVALID_ADDRESS)
         {
-            dump_stream.Printf("Points to process memory.\n");
+            dump_stream.Printf("Points to process memory:\n");
         }
         else
         {
             dump_stream.Printf("Temporary allocation:\n");
+        }
+        
+        if (ptr == LLDB_INVALID_ADDRESS)
+        {
+            dump_stream.Printf("  <could not be be found>\n");
+        }
+        else
+        {
+            DataBufferHeap data (m_temporary_allocation_size, 0);
+            
+            map.ReadMemory(data.GetBytes(), m_temporary_allocation, m_temporary_allocation_size, err);
             
-            if (m_temporary_allocation == LLDB_INVALID_ADDRESS)
+            if (!err.Success())
             {
                 dump_stream.Printf("  <could not be read>\n");
             }
             else
             {
-                DataBufferHeap data (m_temporary_allocation_size, 0);
+                DataExtractor extractor (data.GetBytes(), data.GetByteSize(), map.GetByteOrder(), map.GetAddressByteSize());
                 
-                map.ReadMemory(data.GetBytes(), m_temporary_allocation, m_temporary_allocation_size, err);
+                extractor.DumpHexBytes(&dump_stream, data.GetBytes(), data.GetByteSize(), 16, process_address + m_offset);
                 
-                if (!err.Success())
-                {
-                    dump_stream.Printf("  <could not be read>\n");
-                }
-                else
-                {
-                    DataExtractor extractor (data.GetBytes(), data.GetByteSize(), map.GetByteOrder(), map.GetAddressByteSize());
-                    
-                    extractor.DumpHexBytes(&dump_stream, data.GetBytes(), data.GetByteSize(), 16, process_address + m_offset);
-                }
+                dump_stream.PutChar('\n');
             }
         }
         
         log->PutCString(dump_stream.GetData());
     }
+    
+    void Wipe (IRMemoryMap &map, lldb::addr_t process_address)
+    {
+        if (m_temporary_allocation != LLDB_INVALID_ADDRESS)
+        {
+            Error free_error;
+            
+            map.Free(m_temporary_allocation, free_error);
+            
+            m_temporary_allocation = LLDB_INVALID_ADDRESS;
+            m_temporary_allocation_size = 0;
+        }
+
+    }
 private:
     lldb::VariableSP    m_variable_sp;
     bool                m_is_reference;
@@ -663,21 +708,166 @@ Materializer::AddVariable (lldb::Variabl
 class EntityResultVariable : public Materializer::Entity
 {
 public:
-    EntityResultVariable (const ClangASTType &type, bool keep_in_memory) :
+    EntityResultVariable (const TypeFromUser &type, bool is_program_reference, bool keep_in_memory) :
         Entity(),
         m_type(type),
-        m_keep_in_memory(keep_in_memory)
+        m_is_program_reference(is_program_reference),
+        m_keep_in_memory(keep_in_memory),
+        m_temporary_allocation(LLDB_INVALID_ADDRESS),
+        m_temporary_allocation_size(0)
     {
-        SetSizeAndAlignmentFromType(m_type);
+        // Hard-coding to maximum size of a pointer since all results are materialized by reference
+        m_size = 8;
+        m_alignment = 8;
     }
     
-    virtual void Materialize (lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address, Error &err)
+    void Materialize (lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address, Error &err)
     {
+        if (!m_is_program_reference)
+        {
+            if (m_temporary_allocation != LLDB_INVALID_ADDRESS)
+            {
+                err.SetErrorToGenericError();
+                err.SetErrorString("Trying to create a temporary region for the result but one exists");
+                return;
+            }
+            
+            size_t byte_size = m_type.GetTypeByteSize();
+            size_t bit_align = m_type.GetTypeBitAlign();
+            size_t byte_align = (bit_align + 7) / 8;
+            
+            Error alloc_error;
+            
+            m_temporary_allocation = map.Malloc(byte_size, byte_align, lldb::ePermissionsReadable | lldb::ePermissionsWritable, IRMemoryMap::eAllocationPolicyMirror, alloc_error);
+            m_temporary_allocation_size = byte_size;
+            
+            if (!alloc_error.Success())
+            {
+                err.SetErrorToGenericError();
+                err.SetErrorStringWithFormat("Couldn't allocate a temporary region for the result: %s", alloc_error.AsCString());
+                return;
+            }
+                        
+            Error pointer_write_error;
+            
+            map.WritePointerToMemory(process_address + m_offset, m_temporary_allocation, pointer_write_error);
+            
+            if (!pointer_write_error.Success())
+            {
+                err.SetErrorToGenericError();
+                err.SetErrorStringWithFormat("Couldn't write the address of the temporary region for the result: %s", pointer_write_error.AsCString());
+            }
+        }
     }
     
-    virtual void Dematerialize (lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address,
-                                lldb::addr_t frame_top, lldb::addr_t frame_bottom, Error &err)
+    void Dematerialize (lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address,
+                        lldb::addr_t frame_top, lldb::addr_t frame_bottom, Error &err)
     {
+        err.SetErrorToGenericError();
+        err.SetErrorString("Tried to detmaterialize a result variable with the normal Dematerialize method");
+    }
+    
+    void Dematerialize (lldb::ClangExpressionVariableSP &result_variable_sp,
+                        lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address,
+                        lldb::addr_t frame_top, lldb::addr_t frame_bottom, Error &err)
+    {
+        err.Clear();
+        
+        ExecutionContextScope *exe_scope = map.GetBestExecutionContextScope();
+        
+        if (!exe_scope)
+        {
+            err.SetErrorToGenericError();
+            err.SetErrorString("Couldn't dematerialize a result variable: invalid execution context scope");
+            return;
+        }
+        
+        lldb::addr_t address;
+        Error read_error;
+        
+        map.ReadPointerFromMemory (&address, process_address + m_offset, read_error);
+        
+        if (!read_error.Success())
+        {
+            err.SetErrorToGenericError();
+            err.SetErrorString("Couldn't dematerialize a result variable: couldn't read its address");
+            return;
+        }
+        
+        lldb::TargetSP target_sp = exe_scope->CalculateTarget();
+        
+        if (!target_sp)
+        {
+            err.SetErrorToGenericError();
+            err.SetErrorString("Couldn't dematerialize a result variable: no target");
+            return;
+        }
+        
+        ConstString name = target_sp->GetPersistentVariables().GetNextPersistentVariableName();
+        
+        lldb::ClangExpressionVariableSP ret;
+        
+        ret = target_sp->GetPersistentVariables().CreateVariable(exe_scope,
+                                                                 name,
+                                                                 m_type,
+                                                                 map.GetByteOrder(),
+                                                                 map.GetAddressByteSize());
+        
+        if (!ret)
+        {
+            err.SetErrorToGenericError();
+            err.SetErrorStringWithFormat("Couldn't dematerialize a result variable: failed to make persistent variable %s", name.AsCString());
+            return;
+        }
+        
+        lldb::ProcessSP process_sp = map.GetBestExecutionContextScope()->CalculateProcess();
+        
+        bool can_persist = (process_sp && process_sp->CanJIT());
+
+        if (can_persist && m_keep_in_memory)
+        {
+            ret->m_live_sp = ValueObjectConstResult::Create(exe_scope,
+                                                            m_type.GetASTContext(),
+                                                            m_type.GetOpaqueQualType(),
+                                                            name,
+                                                            address,
+                                                            eAddressTypeLoad,
+                                                            ret->GetByteSize());
+        }
+        
+        ret->ValueUpdated();
+        
+        const size_t pvar_byte_size = ret->GetByteSize();
+        uint8_t *pvar_data = ret->GetValueBytes();
+                
+        map.ReadMemory(pvar_data, address, pvar_byte_size, read_error);
+        
+        if (!read_error.Success())
+        {
+            err.SetErrorToGenericError();
+            err.SetErrorString("Couldn't dematerialize a result variable: couldn't read its memory");
+            return;
+        }
+                
+        result_variable_sp = ret;
+        
+        if (!can_persist || !m_keep_in_memory)
+        {
+            ret->m_flags |= ClangExpressionVariable::EVNeedsAllocation;
+            
+            if (m_temporary_allocation != LLDB_INVALID_ADDRESS)
+            {
+                Error free_error;
+                map.Free(m_temporary_allocation, free_error);
+            }
+        }
+        else
+        {
+            ret->m_flags |= ClangExpressionVariable::EVIsLLDBAllocated;
+        }
+        
+        m_temporary_allocation = LLDB_INVALID_ADDRESS;
+        m_temporary_allocation_size = 0;
     }
     
     void DumpToLog (IRMemoryMap &map, lldb::addr_t process_address, Log *log)
@@ -686,20 +876,100 @@ public:
                 
         dump_stream.Printf("0x%llx: EntityResultVariable\n", (unsigned long long)process_address + m_offset);
         
+        Error err;
+        
+        lldb::addr_t ptr = LLDB_INVALID_ADDRESS;
+        
+        {
+            dump_stream.Printf("Pointer:\n");
+            
+            DataBufferHeap data (m_size, 0);
+            
+            map.ReadMemory(data.GetBytes(), process_address + m_offset, m_size, err);
+            
+            if (!err.Success())
+            {
+                dump_stream.Printf("  <could not be read>\n");
+            }
+            else
+            {
+                DataExtractor extractor (data.GetBytes(), data.GetByteSize(), map.GetByteOrder(), map.GetAddressByteSize());
+                
+                extractor.DumpHexBytes(&dump_stream, data.GetBytes(), data.GetByteSize(), 16, process_address + m_offset);
+                
+                lldb::offset_t offset;
+                
+                ptr = extractor.GetPointer(&offset);
+                
+                dump_stream.PutChar('\n');
+            }
+        }
+                
+        if (m_temporary_allocation == LLDB_INVALID_ADDRESS)
+        {
+            dump_stream.Printf("Points to process memory:\n");
+        }
+        else
+        {
+            dump_stream.Printf("Temporary allocation:\n");
+        }
+        
+        if (ptr == LLDB_INVALID_ADDRESS)
+        {
+            dump_stream.Printf("  <could not be be found>\n");
+        }
+        else
+        {
+            DataBufferHeap data (m_temporary_allocation_size, 0);
+            
+            map.ReadMemory(data.GetBytes(), m_temporary_allocation, m_temporary_allocation_size, err);
+            
+            if (!err.Success())
+            {
+                dump_stream.Printf("  <could not be read>\n");
+            }
+            else
+            {
+                DataExtractor extractor (data.GetBytes(), data.GetByteSize(), map.GetByteOrder(), map.GetAddressByteSize());
+                
+                extractor.DumpHexBytes(&dump_stream, data.GetBytes(), data.GetByteSize(), 16, process_address + m_offset);
+                
+                dump_stream.PutChar('\n');
+            }
+        }
+        
         log->PutCString(dump_stream.GetData());
     }
+    
+    void Wipe (IRMemoryMap &map, lldb::addr_t process_address)
+    {
+        if (!m_keep_in_memory && m_temporary_allocation != LLDB_INVALID_ADDRESS)
+        {
+            Error free_error;
+            
+            map.Free(m_temporary_allocation, free_error);
+        }
+        
+        m_temporary_allocation = LLDB_INVALID_ADDRESS;
+        m_temporary_allocation_size = 0;
+    }
 private:
-    ClangASTType    m_type;
+    TypeFromUser    m_type;
+    bool            m_is_program_reference;
     bool            m_keep_in_memory;
+    
+    lldb::addr_t    m_temporary_allocation;
+    size_t          m_temporary_allocation_size;
 };
 
 uint32_t
-Materializer::AddResultVariable (const ClangASTType &type, bool keep_in_memory, Error &err)
+Materializer::AddResultVariable (const TypeFromUser &type, bool is_program_reference, bool keep_in_memory, Error &err)
 {
     EntityVector::iterator iter = m_entities.insert(m_entities.end(), EntityUP());
-    iter->reset (new EntityResultVariable (type, keep_in_memory));
+    iter->reset (new EntityResultVariable (type, is_program_reference, keep_in_memory));
     uint32_t ret = AddStructMember(**iter);
     (*iter)->SetOffset(ret);
+    m_result_entity = iter->get();
     return ret;
 }
 
@@ -715,7 +985,7 @@ public:
         m_alignment = 8;
     }
     
-    virtual void Materialize (lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address, Error &err)
+    void Materialize (lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address, Error &err)
     {
         Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
 
@@ -759,7 +1029,7 @@ public:
         }
     }
     
-    virtual void Dematerialize (lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address,
+    void Dematerialize (lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address,
                                 lldb::addr_t frame_top, lldb::addr_t frame_bottom, Error &err)
     {
         Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
@@ -798,11 +1068,17 @@ public:
                 DataExtractor extractor (data.GetBytes(), data.GetByteSize(), map.GetByteOrder(), map.GetAddressByteSize());
                 
                 extractor.DumpHexBytes(&dump_stream, data.GetBytes(), data.GetByteSize(), 16, process_address + m_offset);
+                
+                dump_stream.PutChar('\n');
             }
         }
         
         log->PutCString(dump_stream.GetData());
     }
+    
+    void Wipe (IRMemoryMap &map, lldb::addr_t process_address)
+    {
+    }
 private:
     Symbol m_symbol;
 };
@@ -829,7 +1105,7 @@ public:
         m_alignment = m_register_info.byte_size;
     }
     
-    virtual void Materialize (lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address, Error &err)
+    void Materialize (lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address, Error &err)
     {
         Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
         
@@ -886,7 +1162,7 @@ public:
         }
     }
     
-    virtual void Dematerialize (lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address,
+    void Dematerialize (lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address,
                                 lldb::addr_t frame_top, lldb::addr_t frame_bottom, Error &err)
     {
         Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
@@ -954,11 +1230,17 @@ public:
                 DataExtractor extractor (data.GetBytes(), data.GetByteSize(), map.GetByteOrder(), map.GetAddressByteSize());
                 
                 extractor.DumpHexBytes(&dump_stream, data.GetBytes(), data.GetByteSize(), 16, process_address + m_offset);
+                
+                dump_stream.PutChar('\n');
             }
         }
         
         log->PutCString(dump_stream.GetData());
     }
+    
+    void Wipe (IRMemoryMap &map, lldb::addr_t process_address)
+    {
+    }
 private:
     RegisterInfo m_register_info;
 };
@@ -974,25 +1256,43 @@ Materializer::AddRegister (const Registe
 }
 
 Materializer::Materializer () :
-    m_needs_dematerialize(Mutex::eMutexTypeNormal),
+    m_dematerializer_wp(),
+    m_result_entity(NULL),
     m_current_offset(0),
     m_struct_alignment(8)
 {
 }
 
+Materializer::~Materializer ()
+{
+    DematerializerSP dematerializer_sp = m_dematerializer_wp.lock();
+    
+    if (dematerializer_sp)
+        dematerializer_sp->Wipe();
+}
 
-Materializer::Dematerializer
-Materializer::Materialize (lldb::StackFrameSP &frame_sp, lldb::ClangExpressionVariableSP &result_sp, IRMemoryMap &map, lldb::addr_t process_address, Error &error)
+Materializer::DematerializerSP
+Materializer::Materialize (lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address, Error &error)
 {
     ExecutionContextScope *exe_scope = frame_sp.get();
-    
+        
     if (!exe_scope)
         exe_scope = map.GetBestExecutionContextScope();
     
+    DematerializerSP dematerializer_sp = m_dematerializer_wp.lock();
+    
+    if (dematerializer_sp)
+    {
+        error.SetErrorToGenericError();
+        error.SetErrorString("Couldn't materialize: already materialized");
+    }
+    
+    DematerializerSP ret(new Dematerializer(*this, frame_sp, map, process_address));
+    
     if (!exe_scope)
     {
         error.SetErrorToGenericError();
-        error.SetErrorString("Couldn't dematerialize: target doesn't exist");
+        error.SetErrorString("Couldn't materialize: target doesn't exist");
     }
     
     for (auto entity_up = m_entities.begin(); entity_up != m_entities.end(); entity_up++)
@@ -1000,27 +1300,33 @@ Materializer::Materialize (lldb::StackFr
         (*entity_up)->Materialize(frame_sp, map, process_address, error);
         
         if (!error.Success())
-            return Dematerializer (*this, frame_sp, map, LLDB_INVALID_ADDRESS);
+            return DematerializerSP();
     }
     
-    if (Log *log =lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS))
+    if (Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS))
     {
         log->Printf("Materializer::Materialize (frame_sp = %p, process_address = 0x%llx) materialized:", frame_sp.get(), process_address);
         for (auto entity_up = m_entities.begin(); entity_up != m_entities.end(); entity_up++)
             (*entity_up)->DumpToLog(map, process_address, log);
     }
-        
-    m_needs_dematerialize.Lock();
     
-    return Dematerializer (*this, frame_sp, map, process_address);
+    m_dematerializer_wp = ret;
+    
+    return ret;
 }
 
 void
-Materializer::Dematerializer::Dematerialize (Error &error, lldb::addr_t frame_top, lldb::addr_t frame_bottom)
+Materializer::Dematerializer::Dematerialize (Error &error, lldb::ClangExpressionVariableSP &result_sp, lldb::addr_t frame_top, lldb::addr_t frame_bottom)
 {
     lldb::StackFrameSP frame_sp = m_frame_wp.lock();
     
-    ExecutionContextScope *exe_scope = m_map.GetBestExecutionContextScope();
+    ExecutionContextScope *exe_scope = m_map->GetBestExecutionContextScope();
+    
+    if (!IsValid())
+    {
+        error.SetErrorToGenericError();
+        error.SetErrorString("Couldn't dematerialize: invalid dematerializer");
+    }
     
     if (!exe_scope)
     {
@@ -1032,18 +1338,41 @@ Materializer::Dematerializer::Dematerial
         if (Log *log =lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS))
         {
             log->Printf("Materializer::Dematerialize (frame_sp = %p, process_address = 0x%llx) about to dematerialize:", frame_sp.get(), m_process_address);
-            for (auto entity_up = m_materializer.m_entities.begin(); entity_up != m_materializer.m_entities.end(); entity_up++)
-                (*entity_up)->DumpToLog(m_map, m_process_address, log);
+            for (auto entity_up = m_materializer->m_entities.begin(); entity_up != m_materializer->m_entities.end(); entity_up ++)
+                (*entity_up)->DumpToLog(*m_map, m_process_address, log);
         }
         
-        for (auto entity_up = m_materializer.m_entities.begin(); entity_up != m_materializer.m_entities.end(); entity_up++)
+        for (auto entity_up = m_materializer->m_entities.begin(); entity_up != m_materializer->m_entities.end(); entity_up ++)
         {
-            (*entity_up)->Dematerialize (frame_sp, m_map, m_process_address, frame_top, frame_bottom, error);
-            
+            if (entity_up->get() == m_materializer->m_result_entity)
+            {
+                static_cast<EntityResultVariable*>(m_materializer->m_result_entity)->Dematerialize (result_sp, frame_sp, *m_map, m_process_address, frame_top, frame_bottom, error);
+            }
+            else
+            {
+                (*entity_up)->Dematerialize (frame_sp, *m_map, m_process_address, frame_top, frame_bottom, error);
+            }
+                
             if (!error.Success())
                 break;
         }
     }
     
-    m_materializer.m_needs_dematerialize.Unlock();
+    Wipe();
+}
+
+void
+Materializer::Dematerializer::Wipe ()
+{
+    if (!IsValid())
+        return;
+    
+    for (auto entity_up = m_materializer->m_entities.begin(); entity_up != m_materializer->m_entities.end(); entity_up ++)
+    {
+        (*entity_up)->Wipe (*m_map, m_process_address);
+    }
+
+    m_materializer = NULL;
+    m_map = NULL;
+    m_process_address = LLDB_INVALID_ADDRESS;
 }

Modified: lldb/branches/windows/source/Host/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Host/CMakeLists.txt?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Host/CMakeLists.txt (original)
+++ lldb/branches/windows/source/Host/CMakeLists.txt Thu Apr 25 07:31:53 2013
@@ -1,3 +1,11 @@
 add_subdirectory(common)
-add_subdirectory(linux)
-add_subdirectory(windows)
+
+if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
+  add_subdirectory(macosx)
+elseif (CMAKE_SYSTEM_NAME MATCHES "Linux")
+  add_subdirectory(linux)
+elseif (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
+  add_subdirectory(freebsd)
+elseif (CMAKE_SYSTEM_NAME MATCHES "Windows")
+  add_subdirectory(windows)
+endif()

Modified: lldb/branches/windows/source/Host/common/DynamicLibrary.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Host/common/DynamicLibrary.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Host/common/DynamicLibrary.cpp (original)
+++ lldb/branches/windows/source/Host/common/DynamicLibrary.cpp Thu Apr 25 07:31:53 2013
@@ -20,6 +20,12 @@ DynamicLibrary::DynamicLibrary (const Fi
         m_handle = NULL;
 }
 
+bool
+DynamicLibrary::IsValid ()
+{
+    return m_handle != NULL;
+}
+
 DynamicLibrary::~DynamicLibrary ()
 {
     if (m_handle)

Modified: lldb/branches/windows/source/Host/common/File.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Host/common/File.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Host/common/File.cpp (original)
+++ lldb/branches/windows/source/Host/common/File.cpp Thu Apr 25 07:31:53 2013
@@ -584,7 +584,7 @@ File::Read (size_t &num_bytes, off_t &of
                     if (num_bytes > bytes_left)
                         num_bytes = bytes_left;
                         
-                    std::auto_ptr<DataBufferHeap> data_heap_ap;
+                    std::unique_ptr<DataBufferHeap> data_heap_ap;
                     data_heap_ap.reset(new DataBufferHeap(num_bytes + (null_terminate ? 1 : 0), '\0'));
                         
                     if (data_heap_ap.get())

Modified: lldb/branches/windows/source/Host/common/FileSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Host/common/FileSpec.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Host/common/FileSpec.cpp (original)
+++ lldb/branches/windows/source/Host/common/FileSpec.cpp Thu Apr 25 07:31:53 2013
@@ -39,7 +39,6 @@
 
 using namespace lldb;
 using namespace lldb_private;
-using namespace std;
 
 static bool
 GetFileStats (const FileSpec *file_spec, struct stat *stats_ptr)
@@ -349,11 +348,11 @@ FileSpec::SetFile (const char *pathname,
                     m_directory.SetCString(directory);
                 else
                 {
-                    char *last_resolved_path_slash = 
+                    char *last_resolved_path_slash = strrchr(resolved_path, '/');
 #ifdef _WIN32
-                        max(strrchr(resolved_path, '/'), strrchr(resolved_path, '\\'));
-#else
-                        strrchr(resolved_path, '/');
+                    char* last_resolved_path_slash_windows = strrchr(resolved_path, '\\');
+                    if (last_resolved_path_slash_windows > last_resolved_path_slash)
+                        last_resolved_path_slash = last_resolved_path_slash_windows;
 #endif
 
                     if (last_resolved_path_slash)
@@ -767,10 +766,11 @@ DataBufferSP
 FileSpec::MemoryMapFileContents(off_t file_offset, size_t file_size) const
 {
     DataBufferSP data_sp;
-    auto_ptr<DataBufferMemoryMap> mmap_data(new DataBufferMemoryMap());
+    std::unique_ptr<DataBufferMemoryMap> mmap_data(new DataBufferMemoryMap());
     if (mmap_data.get())
     {
-        if (mmap_data->MemoryMapFromFileSpec (this, file_offset, file_size) >= file_size)
+        const size_t mapped_length = mmap_data->MemoryMapFromFileSpec (this, file_offset, file_size);
+        if (((file_size == SIZE_MAX) && (mapped_length > 0)) || (mapped_length >= file_size))
             data_sp.reset(mmap_data.release());
     }
     return data_sp;
@@ -885,7 +885,7 @@ FileSpec::ReadFileLines (STLStringArray
     char path[PATH_MAX];
     if (GetPath(path, sizeof(path)))
     {
-        ifstream file_stream (path);
+        std::ifstream file_stream (path);
 
         if (file_stream)
         {

Modified: lldb/branches/windows/source/Host/common/Host.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Host/common/Host.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Host/common/Host.cpp (original)
+++ lldb/branches/windows/source/Host/common/Host.cpp Thu Apr 25 07:31:53 2013
@@ -1393,7 +1393,7 @@ Host::RunShellCommand (const char *comma
     }
     
     // The process monitor callback will delete the 'shell_info_ptr' below...
-    std::auto_ptr<ShellInfo> shell_info_ap (new ShellInfo());
+    std::unique_ptr<ShellInfo> shell_info_ap (new ShellInfo());
     
     const bool monitor_signals = false;
     launch_info.SetMonitorProcessCallback(MonitorShellCommand, shell_info_ap.get(), monitor_signals);
@@ -1404,7 +1404,7 @@ Host::RunShellCommand (const char *comma
     {
         // The process successfully launched, so we can defer ownership of
         // "shell_info" to the MonitorShellCommand callback function that will
-        // get called when the process dies. We release the std::auto_ptr as it
+        // get called when the process dies. We release the unique pointer as it
         // doesn't need to delete the ShellInfo anymore.
         ShellInfo *shell_info = shell_info_ap.release();
         TimeValue timeout_time(TimeValue::Now());

Modified: lldb/branches/windows/source/Host/common/Mutex.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Host/common/Mutex.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Host/common/Mutex.cpp (original)
+++ lldb/branches/windows/source/Host/common/Mutex.cpp Thu Apr 25 07:31:53 2013
@@ -249,8 +249,8 @@ Mutex::~Mutex()
     DeleteCriticalSection(&m_mutex);
     
 #else
-    int err;
-    err = ::pthread_mutex_destroy (&m_mutex);
+    int err = ::pthread_mutex_destroy (&m_mutex);
+
 #if ENABLE_MUTEX_ERROR_CHECKING
     if (err == 0)
         error_check_mutex (&m_mutex, eMutexActionDestroyed);

Modified: lldb/branches/windows/source/Host/common/Terminal.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Host/common/Terminal.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Host/common/Terminal.cpp (original)
+++ lldb/branches/windows/source/Host/common/Terminal.cpp Thu Apr 25 07:31:53 2013
@@ -111,7 +111,9 @@ Terminal::SetCanonical (bool enabled)
 TerminalState::TerminalState() :
     m_tty(),
     m_tflags(-1),
+#ifdef LLDB_CONFIG_TERMIOS_SUPPORTED
     m_termios_ap(),
+#endif
     m_process_group(-1)
 {
 }
@@ -128,7 +130,9 @@ TerminalState::Clear ()
 {
     m_tty.Clear();
     m_tflags = -1;
+#ifdef LLDB_CONFIG_TERMIOS_SUPPORTED
     m_termios_ap.reset();
+#endif
     m_process_group = -1;
 }
 
@@ -165,7 +169,9 @@ TerminalState::Save (int fd, bool save_p
     {
         m_tty.Clear();
         m_tflags = -1;
+#ifdef LLDB_CONFIG_TERMIOS_SUPPORTED
         m_termios_ap.reset();
+#endif
         m_process_group = -1;
     }
     return IsValid();
@@ -236,7 +242,11 @@ TerminalState::TFlagsIsValid() const
 bool
 TerminalState::TTYStateIsValid() const
 {
+#ifdef LLDB_CONFIG_TERMIOS_SUPPORTED
     return m_termios_ap.get() != 0;
+#else
+    return false;
+#endif
 }
 
 //----------------------------------------------------------------------

Modified: lldb/branches/windows/source/Host/freebsd/Host.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Host/freebsd/Host.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Host/freebsd/Host.cpp (original)
+++ lldb/branches/windows/source/Host/freebsd/Host.cpp Thu Apr 25 07:31:53 2013
@@ -294,7 +294,7 @@ Host::GetAuxvData(lldb_private::Process
    struct ps_strings ps_strings;
    struct ptrace_io_desc pid;
    DataBufferSP buf_sp;
-   std::auto_ptr<DataBufferHeap> buf_ap(new DataBufferHeap(1024, 0));
+   std::unique_ptr<DataBufferHeap> buf_ap(new DataBufferHeap(1024, 0));
 
    if (::sysctl(mib, 2, &ps_strings_addr, &ps_strings_size, NULL, 0) == 0) {
            pid.piod_op = PIOD_READ_D;

Modified: lldb/branches/windows/source/Host/linux/Host.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Host/linux/Host.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Host/linux/Host.cpp (original)
+++ lldb/branches/windows/source/Host/linux/Host.cpp Thu Apr 25 07:31:53 2013
@@ -85,7 +85,7 @@ Host::GetAuxvData(lldb_private::Process
         return buf_sp;
 
     size_t bytes_read = 0;
-    std::auto_ptr<DataBufferHeap> buf_ap(new DataBufferHeap(1024, 0));
+    std::unique_ptr<DataBufferHeap> buf_ap(new DataBufferHeap(1024, 0));
     for (;;) 
     {
         size_t avail = buf_ap->GetByteSize() - bytes_read;

Modified: lldb/branches/windows/source/Host/macosx/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Host/macosx/CMakeLists.txt?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Host/macosx/CMakeLists.txt (original)
+++ lldb/branches/windows/source/Host/macosx/CMakeLists.txt Thu Apr 25 07:31:53 2013
@@ -1,6 +1,14 @@
 set(LLVM_NO_RTTI 1)
 
+include_directories(${LIBXML2_INCLUDE_DIR})
+
 add_lldb_library(lldbHostMacOSX
-  Host.cpp
+  Host.mm
   Symbols.cpp
+  cfcpp/CFCBundle.cpp
+  cfcpp/CFCData.cpp
+  cfcpp/CFCMutableArray.cpp
+  cfcpp/CFCMutableDictionary.cpp
+  cfcpp/CFCMutableSet.cpp
+  cfcpp/CFCString.cpp
   )

Modified: lldb/branches/windows/source/Host/macosx/Host.mm
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Host/macosx/Host.mm?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Host/macosx/Host.mm (original)
+++ lldb/branches/windows/source/Host/macosx/Host.mm Thu Apr 25 07:31:53 2013
@@ -527,6 +527,32 @@ LaunchInNewTerminalWithAppleScript (cons
     if (launch_info.GetFlags().Test (eLaunchFlagDisableASLR))
         command.PutCString(" --disable-aslr");
     
+    // We are launching on this host in a terminal. So compare the environemnt on the host
+    // to what is supplied in the launch_info. Any items that aren't in the host environemnt
+    // need to be sent to darwin-debug. If we send all environment entries, we might blow the
+    // max command line length, so we only send user modified entries.
+    const char **envp = launch_info.GetEnvironmentEntries().GetConstArgumentVector ();
+    StringList host_env;
+    const size_t host_env_count = Host::GetEnvironment (host_env);
+    const char *env_entry;
+    for (size_t env_idx = 0; (env_entry = envp[env_idx]) != NULL; ++env_idx)
+    {
+        bool add_entry = true;
+        for (size_t i=0; i<host_env_count; ++i)
+        {
+            const char *host_env_entry = host_env.GetStringAtIndex(i);
+            if (strcmp(env_entry, host_env_entry) == 0)
+            {
+                add_entry = false;
+                break;
+            }
+        }
+        if (add_entry)
+        {
+            command.Printf(" --env='%s'", env_entry);
+        }
+    }
+
     command.PutCString(" -- ");
 
     const char **argv = launch_info.GetArguments().GetConstArgumentVector ();

Modified: lldb/branches/windows/source/Interpreter/Args.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Interpreter/Args.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Interpreter/Args.cpp (original)
+++ lldb/branches/windows/source/Interpreter/Args.cpp Thu Apr 25 07:31:53 2013
@@ -1509,7 +1509,6 @@ Args::ParseArgsForCompletion
     while (1)
     {
         bool missing_argument = false;
-        int parse_start = optind;
         int long_options_index = -1;
         
         val = ::getopt_long_only (dummy_vec.size() - 1,
@@ -1603,7 +1602,7 @@ Args::ParseArgsForCompletion
             switch (long_options[long_options_index].has_arg)
             {
             case no_argument:
-                option_element_vector.push_back (OptionArgElement (opt_defs_index, parse_start, 0));
+                option_element_vector.push_back (OptionArgElement (opt_defs_index, optind - 1, 0));
                 break;
             case required_argument:
                 if (optarg != NULL)

Modified: lldb/branches/windows/source/Interpreter/CommandInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Interpreter/CommandInterpreter.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Interpreter/CommandInterpreter.cpp (original)
+++ lldb/branches/windows/source/Interpreter/CommandInterpreter.cpp Thu Apr 25 07:31:53 2013
@@ -284,9 +284,7 @@ CommandInterpreter::Initialize ()
     
     cmd_obj_sp = GetCommandSPExact ("expression", false);
     if (cmd_obj_sp)
-    {
-        AddAlias ("expr", cmd_obj_sp);
-        
+    {        
         ProcessAliasOptionsArgs (cmd_obj_sp, "--", alias_arguments_vector_sp);
         AddAlias ("p", cmd_obj_sp);
         AddAlias ("print", cmd_obj_sp);
@@ -395,7 +393,7 @@ CommandInterpreter::LoadCommandDictionar
     
     size_t num_regexes = sizeof break_regexes/sizeof(char *[2]);
         
-    std::auto_ptr<CommandObjectRegexCommand>
+    std::unique_ptr<CommandObjectRegexCommand>
     break_regex_cmd_ap(new CommandObjectRegexCommand (*this,
                                                       "_regexp-break",
                                                       "Set a breakpoint using a regular expression to specify the location, where <linenum> is in decimal and <address> is in hex.",
@@ -422,7 +420,7 @@ CommandInterpreter::LoadCommandDictionar
         }
     }
 
-    std::auto_ptr<CommandObjectRegexCommand>
+    std::unique_ptr<CommandObjectRegexCommand>
     tbreak_regex_cmd_ap(new CommandObjectRegexCommand (*this,
                                                       "_regexp-tbreak",
                                                       "Set a one shot breakpoint using a regular expression to specify the location, where <linenum> is in decimal and <address> is in hex.",
@@ -453,7 +451,7 @@ CommandInterpreter::LoadCommandDictionar
         }
     }
 
-    std::auto_ptr<CommandObjectRegexCommand>
+    std::unique_ptr<CommandObjectRegexCommand>
     attach_regex_cmd_ap(new CommandObjectRegexCommand (*this,
                                                        "_regexp-attach",
                                                        "Attach to a process id if in decimal, otherwise treat the argument as a process name to attach to.",
@@ -471,7 +469,7 @@ CommandInterpreter::LoadCommandDictionar
         }
     }
     
-    std::auto_ptr<CommandObjectRegexCommand>
+    std::unique_ptr<CommandObjectRegexCommand>
     down_regex_cmd_ap(new CommandObjectRegexCommand (*this,
                                                      "_regexp-down",
                                                      "Go down \"n\" frames in the stack (1 frame by default).",
@@ -486,7 +484,7 @@ CommandInterpreter::LoadCommandDictionar
         }
     }
     
-    std::auto_ptr<CommandObjectRegexCommand>
+    std::unique_ptr<CommandObjectRegexCommand>
     up_regex_cmd_ap(new CommandObjectRegexCommand (*this,
                                                    "_regexp-up",
                                                    "Go up \"n\" frames in the stack (1 frame by default).",
@@ -501,7 +499,7 @@ CommandInterpreter::LoadCommandDictionar
         }
     }
 
-    std::auto_ptr<CommandObjectRegexCommand>
+    std::unique_ptr<CommandObjectRegexCommand>
     display_regex_cmd_ap(new CommandObjectRegexCommand (*this,
                                                    "_regexp-display",
                                                    "Add an expression evaluation stop-hook.",
@@ -515,7 +513,7 @@ CommandInterpreter::LoadCommandDictionar
         }
     }
 
-    std::auto_ptr<CommandObjectRegexCommand>
+    std::unique_ptr<CommandObjectRegexCommand>
     undisplay_regex_cmd_ap(new CommandObjectRegexCommand (*this,
                                                    "_regexp-undisplay",
                                                    "Remove an expression evaluation stop-hook.",
@@ -529,7 +527,7 @@ CommandInterpreter::LoadCommandDictionar
         }
     }
 
-    std::auto_ptr<CommandObjectRegexCommand>
+    std::unique_ptr<CommandObjectRegexCommand>
     connect_gdb_remote_cmd_ap(new CommandObjectRegexCommand (*this,
                                                       "gdb-remote",
                                                       "Connect to a remote GDB server.  If no hostname is provided, localhost is assumed.",
@@ -544,7 +542,7 @@ CommandInterpreter::LoadCommandDictionar
         }
     }
 
-    std::auto_ptr<CommandObjectRegexCommand>
+    std::unique_ptr<CommandObjectRegexCommand>
     connect_kdp_remote_cmd_ap(new CommandObjectRegexCommand (*this,
                                                              "kdp-remote",
                                                              "Connect to a remote KDP server.  udp port 41139 is the default port number.",
@@ -559,7 +557,7 @@ CommandInterpreter::LoadCommandDictionar
         }
     }
 
-    std::auto_ptr<CommandObjectRegexCommand>
+    std::unique_ptr<CommandObjectRegexCommand>
     bt_regex_cmd_ap(new CommandObjectRegexCommand (*this,
                                                      "_regexp-bt",
                                                      "Show a backtrace.  An optional argument is accepted; if that argument is a number, it specifies the number of frames to display.  If that argument is 'all', full backtraces of all threads are displayed.",
@@ -579,7 +577,7 @@ CommandInterpreter::LoadCommandDictionar
         }
     }
 
-    std::auto_ptr<CommandObjectRegexCommand>
+    std::unique_ptr<CommandObjectRegexCommand>
     list_regex_cmd_ap(new CommandObjectRegexCommand (*this,
                                                      "_regexp-list",
                                                      "Implements the GDB 'list' command in all of its forms except FILE:FUNCTION and maps them to the appropriate 'source list' commands.",
@@ -601,7 +599,7 @@ CommandInterpreter::LoadCommandDictionar
         }
     }
 
-    std::auto_ptr<CommandObjectRegexCommand>
+    std::unique_ptr<CommandObjectRegexCommand>
     env_regex_cmd_ap(new CommandObjectRegexCommand (*this,
                                                     "_regexp-env",
                                                     "Implements a shortcut to viewing and setting environment variables.",
@@ -852,9 +850,14 @@ CommandInterpreter::GetCommandObject (co
         command_obj = GetCommandSP (cmd_cstr, true, true, matches).get();
     }
 
-    // Finally, if there wasn't an exact match among the aliases, look for an inexact match
-    // in both the commands and the aliases.
+    // If there wasn't an exact match among the aliases, look for an inexact match
+    // in just the commands.
+
+    if (command_obj == NULL)
+        command_obj = GetCommandSP(cmd_cstr, false, false, matches).get();
 
+    // Finally, if there wasn't an inexact match among the commands, look for an inexact
+    // match in both the commands and aliases.
     if (command_obj == NULL)
         command_obj = GetCommandSP(cmd_cstr, true, false, matches).get();
 

Modified: lldb/branches/windows/source/Interpreter/OptionGroupValueObjectDisplay.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Interpreter/OptionGroupValueObjectDisplay.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Interpreter/OptionGroupValueObjectDisplay.cpp (original)
+++ lldb/branches/windows/source/Interpreter/OptionGroupValueObjectDisplay.cpp Thu Apr 25 07:31:53 2013
@@ -6,9 +6,7 @@
 // License. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
-
 #include "lldb/lldb-python.h"
-
 #include "lldb/Interpreter/OptionGroupValueObjectDisplay.h"
 
 // C Includes

Modified: lldb/branches/windows/source/Interpreter/OptionValueProperties.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Interpreter/OptionValueProperties.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Interpreter/OptionValueProperties.cpp (original)
+++ lldb/branches/windows/source/Interpreter/OptionValueProperties.cpp Thu Apr 25 07:31:53 2013
@@ -26,11 +26,15 @@ using namespace lldb_private;
 
 
 OptionValueProperties::OptionValueProperties (const ConstString &name) :
-    m_name (name)
+    OptionValue (),
+    m_name (name),
+    m_properties (),
+    m_name_to_index ()
 {
 }
 
 OptionValueProperties::OptionValueProperties (const OptionValueProperties &global_properties) :
+    OptionValue (global_properties),
     m_name (global_properties.m_name),
     m_properties (global_properties.m_properties),
     m_name_to_index (global_properties.m_name_to_index)

Modified: lldb/branches/windows/source/Interpreter/Options.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Interpreter/Options.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Interpreter/Options.cpp (original)
+++ lldb/branches/windows/source/Interpreter/Options.cpp Thu Apr 25 07:31:53 2013
@@ -522,8 +522,7 @@ Options::GenerateOptionUsage
 
         std::set<int> options;
         std::set<int>::const_iterator options_pos, options_end;
-        bool first;
-        for (i = 0, first = true; i < num_options; ++i)
+        for (i = 0; i < num_options; ++i)
         {
             if (opt_defs[i].usage_mask & opt_set_mask && isprint8(opt_defs[i].short_option))
             {
@@ -901,7 +900,7 @@ Options::HandleOptionArgumentCompletion
 )
 {
     const OptionDefinition *opt_defs = GetDefinitions();
-    std::auto_ptr<SearchFilter> filter_ap;
+    std::unique_ptr<SearchFilter> filter_ap;
 
     int opt_arg_pos = opt_element_vector[opt_element_index].opt_arg_pos;
     int opt_defs_index = opt_element_vector[opt_element_index].opt_defs_index;

Modified: lldb/branches/windows/source/Interpreter/ScriptInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Interpreter/ScriptInterpreter.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Interpreter/ScriptInterpreter.cpp (original)
+++ lldb/branches/windows/source/Interpreter/ScriptInterpreter.cpp Thu Apr 25 07:31:53 2013
@@ -81,10 +81,10 @@ ScriptInterpreter::LanguageToString (lld
     return return_value;
 }
 
-std::auto_ptr<ScriptInterpreterLocker>
+std::unique_ptr<ScriptInterpreterLocker>
 ScriptInterpreter::AcquireInterpreterLock ()
 {
-    return std::auto_ptr<ScriptInterpreterLocker>(new ScriptInterpreterLocker());
+    return std::unique_ptr<ScriptInterpreterLocker>(new ScriptInterpreterLocker());
 }
 
 void

Modified: lldb/branches/windows/source/Interpreter/ScriptInterpreterPython.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Interpreter/ScriptInterpreterPython.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Interpreter/ScriptInterpreterPython.cpp (original)
+++ lldb/branches/windows/source/Interpreter/ScriptInterpreterPython.cpp Thu Apr 25 07:31:53 2013
@@ -1321,7 +1321,7 @@ ScriptInterpreterPython::GenerateBreakpo
     case eInputReaderDone:
         {
             BreakpointOptions *bp_options = (BreakpointOptions *)baton;
-            std::auto_ptr<BreakpointOptions::CommandData> data_ap(new BreakpointOptions::CommandData());
+            std::unique_ptr<BreakpointOptions::CommandData> data_ap(new BreakpointOptions::CommandData());
             data_ap->user_source.AppendList (commands_in_progress);
             if (data_ap.get())
             {
@@ -1427,7 +1427,7 @@ ScriptInterpreterPython::GenerateWatchpo
     case eInputReaderDone:
         {
             WatchpointOptions *wp_options = (WatchpointOptions *)baton;
-            std::auto_ptr<WatchpointOptions::CommandData> data_ap(new WatchpointOptions::CommandData());
+            std::unique_ptr<WatchpointOptions::CommandData> data_ap(new WatchpointOptions::CommandData());
             data_ap->user_source.AppendList (commands_in_progress);
             if (data_ap.get())
             {
@@ -1534,7 +1534,7 @@ void
 ScriptInterpreterPython::SetBreakpointCommandCallback (BreakpointOptions *bp_options,
                                                        const char *oneliner)
 {
-    std::auto_ptr<BreakpointOptions::CommandData> data_ap(new BreakpointOptions::CommandData());
+    std::unique_ptr<BreakpointOptions::CommandData> data_ap(new BreakpointOptions::CommandData());
 
     // It's necessary to set both user_source and script_source to the oneliner.
     // The former is used to generate callback description (as in breakpoint command list)
@@ -1557,7 +1557,7 @@ void
 ScriptInterpreterPython::SetWatchpointCommandCallback (WatchpointOptions *wp_options,
                                                        const char *oneliner)
 {
-    std::auto_ptr<WatchpointOptions::CommandData> data_ap(new WatchpointOptions::CommandData());
+    std::unique_ptr<WatchpointOptions::CommandData> data_ap(new WatchpointOptions::CommandData());
 
     // It's necessary to set both user_source and script_source to the oneliner.
     // The former is used to generate callback description (as in watchpoint command list)
@@ -2807,10 +2807,10 @@ ScriptInterpreterPython::GetDocumentatio
     }
 }
 
-std::auto_ptr<ScriptInterpreterLocker>
+std::unique_ptr<ScriptInterpreterLocker>
 ScriptInterpreterPython::AcquireInterpreterLock ()
 {
-    std::auto_ptr<ScriptInterpreterLocker> py_lock(new Locker(this,
+    std::unique_ptr<ScriptInterpreterLocker> py_lock(new Locker(this,
                                                               Locker::AcquireLock | Locker::InitSession,
                                                               Locker::FreeLock | Locker::TearDownSession));
     return py_lock;

Modified: lldb/branches/windows/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp (original)
+++ lldb/branches/windows/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp Thu Apr 25 07:31:53 2013
@@ -473,6 +473,10 @@ DisassemblerLLVMC::LLVMCDisassembler::LL
         m_is_valid = false;
 }
 
+DisassemblerLLVMC::LLVMCDisassembler::~LLVMCDisassembler()
+{
+}
+
 namespace {
     // This is the memory object we use in GetInstruction.
     class LLDBDisasmMemoryObject : public llvm::MemoryObject {
@@ -564,7 +568,7 @@ DisassemblerLLVMC::CreateInstance (const
 {
     if (arch.GetTriple().getArch() != llvm::Triple::UnknownArch)
     {
-        std::auto_ptr<DisassemblerLLVMC> disasm_ap (new DisassemblerLLVMC(arch, flavor));
+        std::unique_ptr<DisassemblerLLVMC> disasm_ap (new DisassemblerLLVMC(arch, flavor));
     
         if (disasm_ap.get() && disasm_ap->IsValid())
             return disasm_ap.release();

Modified: lldb/branches/windows/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.h (original)
+++ lldb/branches/windows/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.h Thu Apr 25 07:31:53 2013
@@ -43,7 +43,7 @@ class DisassemblerLLVMC : public lldb_pr
     public:
         LLVMCDisassembler (const char *triple, unsigned flavor, DisassemblerLLVMC &owner);
         
-        ~LLVMCDisassembler() {};
+        ~LLVMCDisassembler();
         
         uint64_t GetMCInst (const uint8_t *opcode_data, size_t opcode_data_len, lldb::addr_t pc, llvm::MCInst &mc_inst);
         uint64_t PrintMCInst (llvm::MCInst &mc_inst, char *output_buffer, size_t out_buffer_len);
@@ -54,14 +54,14 @@ class DisassemblerLLVMC : public lldb_pr
         }
         
     private:
-        bool                                 m_is_valid;
-        std::auto_ptr<llvm::MCContext>       m_context_ap;
-        std::auto_ptr<llvm::MCAsmInfo>       m_asm_info_ap;
-        std::auto_ptr<llvm::MCSubtargetInfo> m_subtarget_info_ap;
-        std::auto_ptr<llvm::MCInstrInfo>     m_instr_info_ap;
-        std::auto_ptr<llvm::MCRegisterInfo>  m_reg_info_ap;
-        std::auto_ptr<llvm::MCInstPrinter>   m_instr_printer_ap;
-        std::auto_ptr<llvm::MCDisassembler>  m_disasm_ap;
+        bool                                    m_is_valid;
+        std::unique_ptr<llvm::MCContext>         m_context_ap;
+        std::unique_ptr<llvm::MCAsmInfo>         m_asm_info_ap;
+        std::unique_ptr<llvm::MCSubtargetInfo>   m_subtarget_info_ap;
+        std::unique_ptr<llvm::MCInstrInfo>       m_instr_info_ap;
+        std::unique_ptr<llvm::MCRegisterInfo>    m_reg_info_ap;
+        std::unique_ptr<llvm::MCInstPrinter>     m_instr_printer_ap;
+        std::unique_ptr<llvm::MCDisassembler>    m_disasm_ap;
     };
 
 public:
@@ -164,8 +164,8 @@ protected:
     lldb_private::Mutex m_mutex;
     bool m_data_from_file;
     
-    std::auto_ptr<LLVMCDisassembler> m_disasm_ap;
-    std::auto_ptr<LLVMCDisassembler> m_alternate_disasm_ap;
+    std::unique_ptr<LLVMCDisassembler> m_disasm_ap;
+    std::unique_ptr<LLVMCDisassembler> m_alternate_disasm_ap;
 };
 
 #endif  // liblldb_DisassemblerLLVM_h_

Modified: lldb/branches/windows/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp (original)
+++ lldb/branches/windows/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp Thu Apr 25 07:31:53 2013
@@ -116,7 +116,7 @@ public:
 
 };
 
-typedef STD_SHARED_PTR(DynamicLoaderDarwinKernelProperties) DynamicLoaderDarwinKernelPropertiesSP;
+typedef std::shared_ptr<DynamicLoaderDarwinKernelProperties> DynamicLoaderDarwinKernelPropertiesSP;
 
 static const DynamicLoaderDarwinKernelPropertiesSP &
 GetGlobalProperties()
@@ -294,21 +294,19 @@ DynamicLoaderDarwinKernel::SearchForKern
     if (pc == LLDB_INVALID_ADDRESS)
         return LLDB_INVALID_ADDRESS;
 
-    addr_t kernel_range_low, kernel_range_high;
+    addr_t kernel_range_low;
     if (process->GetTarget().GetArchitecture().GetAddressByteSize() == 8)
     {
         kernel_range_low = 1ULL << 63;
-        kernel_range_high = UINT64_MAX;
     }
     else
     {
         kernel_range_low = 1ULL << 31;
-        kernel_range_high = UINT32_MAX;
     }
 
     // Outside the normal kernel address range, this is probably userland code running right now
     if (pc < kernel_range_low)
-        LLDB_INVALID_ADDRESS;
+        return LLDB_INVALID_ADDRESS;
 
     // The kernel will load at at one megabyte boundary (0x100000), or at that boundary plus 
     // an offset of one page (0x1000) or two, depending on the device.

Modified: lldb/branches/windows/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp (original)
+++ lldb/branches/windows/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp Thu Apr 25 07:31:53 2013
@@ -38,6 +38,10 @@
 #define DEBUG_PRINTF(fmt, ...)
 #endif
 
+#ifndef __APPLE__
+#include "Utility/UuidCompatibility.h"
+#endif
+
 using namespace lldb;
 using namespace lldb_private;
 

Modified: lldb/branches/windows/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp (original)
+++ lldb/branches/windows/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp Thu Apr 25 07:31:53 2013
@@ -98,7 +98,7 @@ DynamicLoaderPOSIXDYLD::DynamicLoaderPOS
       m_rendezvous(process),
       m_load_offset(LLDB_INVALID_ADDRESS),
       m_entry_point(LLDB_INVALID_ADDRESS),
-      m_auxv(NULL)
+      m_auxv()
 {
 }
 

Modified: lldb/branches/windows/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h (original)
+++ lldb/branches/windows/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h Thu Apr 25 07:31:53 2013
@@ -93,7 +93,7 @@ protected:
     lldb::addr_t m_entry_point;
 
     /// Auxiliary vector of the inferior process.
-    std::auto_ptr<AuxVector> m_auxv;
+    std::unique_ptr<AuxVector> m_auxv;
 
     /// Enables a breakpoint on a function called by the runtime
     /// linker each time a module is loaded or unloaded.

Modified: lldb/branches/windows/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp (original)
+++ lldb/branches/windows/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp Thu Apr 25 07:31:53 2013
@@ -193,14 +193,14 @@ EmulateInstructionARM::CreateInstance (c
     {
         if (arch.GetTriple().getArch() == llvm::Triple::arm)
         {
-            std::auto_ptr<EmulateInstructionARM> emulate_insn_ap (new EmulateInstructionARM (arch));
+            std::unique_ptr<EmulateInstructionARM> emulate_insn_ap (new EmulateInstructionARM (arch));
             
             if (emulate_insn_ap.get())
                 return emulate_insn_ap.release();
         }
         else if (arch.GetTriple().getArch() == llvm::Triple::thumb)
         {
-            std::auto_ptr<EmulateInstructionARM> emulate_insn_ap (new EmulateInstructionARM (arch));
+            std::unique_ptr<EmulateInstructionARM> emulate_insn_ap (new EmulateInstructionARM (arch));
             
             if (emulate_insn_ap.get())
                 return emulate_insn_ap.release();

Modified: lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h (original)
+++ lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h Thu Apr 25 07:31:53 2013
@@ -104,17 +104,19 @@ protected:
     Address *
     GetPrintForDebuggerAddr();
     
-    std::auto_ptr<Address>  m_PrintForDebugger_addr;
+    std::unique_ptr<Address>  m_PrintForDebugger_addr;
     bool m_read_objc_library;
-    std::auto_ptr<lldb_private::AppleObjCTrampolineHandler> m_objc_trampoline_handler_ap;
+    std::unique_ptr<lldb_private::AppleObjCTrampolineHandler> m_objc_trampoline_handler_ap;
     lldb::BreakpointSP m_objc_exception_bp_sp;
     lldb::ModuleWP m_objc_module_wp;
 
     AppleObjCRuntime(Process *process) :
         lldb_private::ObjCLanguageRuntime(process),
         m_read_objc_library (false),
-        m_objc_trampoline_handler_ap(NULL)
-     { } // Call CreateInstance instead.
+        m_objc_trampoline_handler_ap ()
+     {
+         // Call CreateInstance instead.
+     }
 };
     
 } // namespace lldb_private

Modified: lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp (original)
+++ lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp Thu Apr 25 07:31:53 2013
@@ -150,7 +150,7 @@ struct BufStruct {
 ClangUtilityFunction *
 AppleObjCRuntimeV1::CreateObjectChecker(const char *name)
 {
-    std::auto_ptr<BufStruct> buf(new BufStruct);
+    std::unique_ptr<BufStruct> buf(new BufStruct);
     
     assert(snprintf(&buf->contents[0], sizeof(buf->contents),
                     "struct __objc_class                                                    \n"

Modified: lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h (original)
+++ lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h Thu Apr 25 07:31:53 2013
@@ -49,7 +49,8 @@ public:
         // v1 does not support tagged pointers
         virtual bool
         GetTaggedPointerInfo (uint64_t* info_bits = NULL,
-                              uint64_t* value_bits = NULL)
+                              uint64_t* value_bits = NULL,
+                              uint64_t* payload = NULL)
         {
             return false;
         }
@@ -184,7 +185,7 @@ protected:
     
     HashTableSignature m_hash_signature;
     lldb::addr_t m_isa_hash_table_ptr;
-    std::auto_ptr<TypeVendor> m_type_vendor_ap;
+    std::unique_ptr<TypeVendor> m_type_vendor_ap;
 private:
     AppleObjCRuntimeV1(Process *process);
 };

Modified: lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp (original)
+++ lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp Thu Apr 25 07:31:53 2013
@@ -11,7 +11,6 @@
 
 #include <string>
 #include <vector>
-#include <memory>
 #include <stdint.h>
 
 #include "lldb/lldb-enumerations.h"
@@ -28,12 +27,14 @@
 #include "lldb/Core/Section.h"
 #include "lldb/Core/StreamString.h"
 #include "lldb/Core/Timer.h"
+#include "lldb/Core/ValueObjectVariable.h"
 #include "lldb/Expression/ClangFunction.h"
 #include "lldb/Expression/ClangUtilityFunction.h"
 #include "lldb/Symbol/ClangASTContext.h"
 #include "lldb/Symbol/ObjectFile.h"
 #include "lldb/Symbol/Symbol.h"
 #include "lldb/Symbol/TypeList.h"
+#include "lldb/Symbol/VariableList.h"
 #include "lldb/Target/ExecutionContext.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/RegisterContext.h"
@@ -60,231 +61,277 @@ static const char *g_get_dynamic_class_i
 // Testing using the new C++11 raw string literals. If this breaks GCC then we will
 // need to revert to the code above...
 static const char *g_get_dynamic_class_info_body = 
-"\n"
-"extern \"C\"\n"
-"{\n"
-"    size_t strlen(const char *);\n"
-"    char *strncpy (char * s1, const char * s2, size_t n);\n"
-"    int printf(const char * format, ...);\n"
-"}\n"
-"//#define ENABLE_DEBUG_PRINTF // COMMENT THIS LINE OUT PRIOR TO CHECKIN\n"
-"#ifdef ENABLE_DEBUG_PRINTF\n"
-"#define DEBUG_PRINTF(fmt, ...) printf(fmt, ## __VA_ARGS__)\n"
-"#else\n"
-"#define DEBUG_PRINTF(fmt, ...)\n"
-"#endif\n"
-"\n"
-"typedef struct _NXMapTable {\n"
-"    void *prototype;\n"
-"    unsigned num_classes;\n"
-"    unsigned num_buckets_minus_one;\n"
-"    void *buckets;\n"
-"} NXMapTable;\n"
-"\n"
-"#define NX_MAPNOTAKEY   ((void *)(-1))\n"
-"\n"
-"typedef struct BucketInfo\n"
-"{\n"
-"    const char *name_ptr;\n"
-"    Class isa;\n"
-"} BucketInfo;\n"
-"\n"
-"struct ClassInfo\n"
-"{\n"
-"    Class isa;\n"
-"    uint32_t hash;\n"
-"} __attribute__((__packed__));\n"
-"\n"
-"uint32_t\n"
-"__lldb_apple_objc_v2_get_dynamic_class_info (void *gdb_objc_realized_classes_ptr,\n"
-"                                             void *class_infos_ptr,\n"
-"                                             uint32_t class_infos_byte_size)\n"
-"{\n"
-"    DEBUG_PRINTF (\"gdb_objc_realized_classes_ptr = %p\\n\", gdb_objc_realized_classes_ptr);\n"
-"    DEBUG_PRINTF (\"class_infos_ptr = %p\\n\", class_infos_ptr);\n"
-"    DEBUG_PRINTF (\"class_infos_byte_size = %u\\n\", class_infos_byte_size);\n"
-"    const NXMapTable *grc = (const NXMapTable *)gdb_objc_realized_classes_ptr;\n"
-"    if (grc)\n"
-"    {\n"
-"        const unsigned num_classes = grc->num_classes;\n"
-"        if (class_infos_ptr)\n"
-"        {\n"
-"            const size_t max_class_infos = class_infos_byte_size/sizeof(ClassInfo);\n"
-"            ClassInfo *class_infos = (ClassInfo *)class_infos_ptr;\n"
-"            BucketInfo *buckets = (BucketInfo *)grc->buckets;\n"
-"            \n"
-"            uint32_t idx = 0;\n"
-"            for (unsigned i=0; i<=grc->num_buckets_minus_one; ++i)\n"
-"            {\n"
-"                if (buckets[i].name_ptr != NX_MAPNOTAKEY)\n"
-"                {\n"
-"                    if (idx < max_class_infos)\n"
-"                    {\n"
-"                        const char *s = buckets[i].name_ptr;\n"
-"                        uint32_t h = 5381;\n"
-"                        for (unsigned char c = *s; c; c = *++s)\n"
-"                            h = ((h << 5) + h) + c;\n"
-"                        class_infos[idx].hash = h;\n"
-"                        class_infos[idx].isa = buckets[i].isa;\n"
-"                    }\n"
-"                    ++idx;\n"
-"                }\n"
-"            }\n"
-"            if (idx < max_class_infos)\n"
-"            {\n"
-"                class_infos[idx].isa = NULL;\n"
-"                class_infos[idx].hash = 0;\n"
-"            }\n"
-"        }\n"
-"        return num_classes;\n"
-"    }\n"
-"    return 0;\n"
-"}\n"
+"\n"
+"extern \"C\"\n"
+"{\n"
+"    size_t strlen(const char *);\n"
+"    char *strncpy (char * s1, const char * s2, size_t n);\n"
+"    int printf(const char * format, ...);\n"
+"}\n"
+"//#define ENABLE_DEBUG_PRINTF // COMMENT THIS LINE OUT PRIOR TO CHECKIN\n"
+"#ifdef ENABLE_DEBUG_PRINTF\n"
+"#define DEBUG_PRINTF(fmt, ...) printf(fmt, ## __VA_ARGS__)\n"
+"#else\n"
+"#define DEBUG_PRINTF(fmt, ...)\n"
+"#endif\n"
+"\n"
+"typedef struct _NXMapTable {\n"
+"    void *prototype;\n"
+"    unsigned num_classes;\n"
+"    unsigned num_buckets_minus_one;\n"
+"    void *buckets;\n"
+"} NXMapTable;\n"
+"\n"
+"#define NX_MAPNOTAKEY   ((void *)(-1))\n"
+"\n"
+"typedef struct BucketInfo\n"
+"{\n"
+"    const char *name_ptr;\n"
+"    Class isa;\n"
+"} BucketInfo;\n"
+"\n"
+"struct ClassInfo\n"
+"{\n"
+"    Class isa;\n"
+"    uint32_t hash;\n"
+"} __attribute__((__packed__));\n"
+"\n"
+"uint32_t\n"
+"__lldb_apple_objc_v2_get_dynamic_class_info (void *gdb_objc_realized_classes_ptr,\n"
+"                                             void *class_infos_ptr,\n"
+"                                             uint32_t class_infos_byte_size)\n"
+"{\n"
+"    DEBUG_PRINTF (\"gdb_objc_realized_classes_ptr = %p\\n\", gdb_objc_realized_classes_ptr);\n"
+"    DEBUG_PRINTF (\"class_infos_ptr = %p\\n\", class_infos_ptr);\n"
+"    DEBUG_PRINTF (\"class_infos_byte_size = %u\\n\", class_infos_byte_size);\n"
+"    const NXMapTable *grc = (const NXMapTable *)gdb_objc_realized_classes_ptr;\n"
+"    if (grc)\n"
+"    {\n"
+"        const unsigned num_classes = grc->num_classes;\n"
+"        if (class_infos_ptr)\n"
+"        {\n"
+"            const size_t max_class_infos = class_infos_byte_size/sizeof(ClassInfo);\n"
+"            ClassInfo *class_infos = (ClassInfo *)class_infos_ptr;\n"
+"            BucketInfo *buckets = (BucketInfo *)grc->buckets;\n"
+"            \n"
+"            uint32_t idx = 0;\n"
+"            for (unsigned i=0; i<=grc->num_buckets_minus_one; ++i)\n"
+"            {\n"
+"                if (buckets[i].name_ptr != NX_MAPNOTAKEY)\n"
+"                {\n"
+"                    if (idx < max_class_infos)\n"
+"                    {\n"
+"                        const char *s = buckets[i].name_ptr;\n"
+"                        uint32_t h = 5381;\n"
+"                        for (unsigned char c = *s; c; c = *++s)\n"
+"                            h = ((h << 5) + h) + c;\n"
+"                        class_infos[idx].hash = h;\n"
+"                        class_infos[idx].isa = buckets[i].isa;\n"
+"                    }\n"
+"                    ++idx;\n"
+"                }\n"
+"            }\n"
+"            if (idx < max_class_infos)\n"
+"            {\n"
+"                class_infos[idx].isa = NULL;\n"
+"                class_infos[idx].hash = 0;\n"
+"            }\n"
+"        }\n"
+"        return num_classes;\n"
+"    }\n"
+"    return 0;\n"
+"}\n"
 "\n";
 
 static const char *g_get_shared_cache_class_info_name = "__lldb_apple_objc_v2_get_shared_cache_class_info";
 // Testing using the new C++11 raw string literals. If this breaks GCC then we will
 // need to revert to the code above...
 static const char *g_get_shared_cache_class_info_body = 
-	"\n"
-"extern \"C\"\n"
-"{\n"
-"    const char *class_getName(void *objc_class);\n"
-"    size_t strlen(const char *);\n"
-"    char *strncpy (char * s1, const char * s2, size_t n);\n"
-"    int printf(const char * format, ...);\n"
-"}\n"
-"\n"
-"//#define ENABLE_DEBUG_PRINTF // COMMENT THIS LINE OUT PRIOR TO CHECKIN\n"
-"#ifdef ENABLE_DEBUG_PRINTF\n"
-"#define DEBUG_PRINTF(fmt, ...) printf(fmt, ## __VA_ARGS__)\n"
-"#else\n"
-"#define DEBUG_PRINTF(fmt, ...)\n"
-"#endif\n"
-"\n"
-"\n"
-"struct objc_classheader_t {\n"
-"    int32_t clsOffset;\n"
-"    int32_t hiOffset;\n"
-"};\n"
-"\n"
-"struct objc_clsopt_t {\n"
-"    uint32_t capacity;\n"
-"    uint32_t occupied;\n"
-"    uint32_t shift;\n"
-"    uint32_t mask;\n"
-"    uint32_t zero;\n"
-"    uint32_t unused;\n"
-"    uint64_t salt;\n"
-"    uint32_t scramble[256];\n"
-"    uint8_t tab[0]; // tab[mask+1]\n"
-"    //  uint8_t checkbytes[capacity];\n"
-"    //  int32_t offset[capacity];\n"
-"    //  objc_classheader_t clsOffsets[capacity];\n"
-"    //  uint32_t duplicateCount;\n"
-"    //  objc_classheader_t duplicateOffsets[duplicateCount];\n"
-"};\n"
-"\n"
-"struct objc_opt_t {\n"
-"    uint32_t version;\n"
-"    int32_t selopt_offset;\n"
-"    int32_t headeropt_offset;\n"
-"    int32_t clsopt_offset;\n"
-"};\n"
-"\n"
-"struct ClassInfo\n"
-"{\n"
-"    Class isa;\n"
-"    uint32_t hash;\n"
-"}  __attribute__((__packed__));\n"
-"\n"
-"uint32_t\n"
-"__lldb_apple_objc_v2_get_shared_cache_class_info (void *objc_opt_ro_ptr,\n"
-"                                                  void *class_infos_ptr,\n"
-"                                                  uint32_t class_infos_byte_size)\n"
-"{\n"
-"    uint32_t idx = 0;\n"
-"    DEBUG_PRINTF (\"objc_opt_ro_ptr = %p\\n\", objc_opt_ro_ptr);\n"
-"    DEBUG_PRINTF (\"class_infos_ptr = %p\\n\", class_infos_ptr);\n"
-"    DEBUG_PRINTF (\"class_infos_byte_size = %u (%zu class infos)\\n\", class_infos_byte_size, (size_t)(class_infos_byte_size/sizeof(ClassInfo)));\n"
-"    if (objc_opt_ro_ptr)\n"
-"    {\n"
-"        const objc_opt_t *objc_opt = (objc_opt_t *)objc_opt_ro_ptr;\n"
-"        DEBUG_PRINTF (\"objc_opt->version = %u\\n\", objc_opt->version);\n"
-"        DEBUG_PRINTF (\"objc_opt->selopt_offset = %d\\n\", objc_opt->selopt_offset);\n"
-"        DEBUG_PRINTF (\"objc_opt->headeropt_offset = %d\\n\", objc_opt->headeropt_offset);\n"
-"        DEBUG_PRINTF (\"objc_opt->clsopt_offset = %d\\n\", objc_opt->clsopt_offset);\n"
-"        if (objc_opt->version == 12)\n"
-"        {\n"
-"            const objc_clsopt_t* clsopt = (const objc_clsopt_t*)((uint8_t *)objc_opt + objc_opt->clsopt_offset);\n"
-"            const size_t max_class_infos = class_infos_byte_size/sizeof(ClassInfo);\n"
-"            ClassInfo *class_infos = (ClassInfo *)class_infos_ptr;\n"
-"            int32_t zeroOffset = 16;\n"
-"            const uint8_t *checkbytes = &clsopt->tab[clsopt->mask+1];\n"
-"            const int32_t *offsets = (const int32_t *)(checkbytes + clsopt->capacity);\n"
-"            const objc_classheader_t *classOffsets = (const objc_classheader_t *)(offsets + clsopt->capacity);\n"
-"            DEBUG_PRINTF (\"clsopt->capacity = %u\\n\", clsopt->capacity);\n"
-"            DEBUG_PRINTF (\"clsopt->mask = 0x%8.8x\\n\", clsopt->mask);\n"
-"            DEBUG_PRINTF (\"classOffsets = %p\\n\", classOffsets);\n"
-"            for (uint32_t i=0; i<clsopt->capacity; ++i)\n"
-"            {\n"
-"                const int32_t clsOffset = classOffsets[i].clsOffset;\n"
-"                if (clsOffset & 1)\n"
-"                    continue; // duplicate\n"
-"                else if (clsOffset == zeroOffset)\n"
-"                    continue; // zero offset\n"
-"                \n"
-"                if (class_infos && idx < max_class_infos)\n"
-"                {\n"
-"                    class_infos[idx].isa = (Class)((uint8_t *)clsopt + clsOffset);\n"
-"                    const char *name = class_getName (class_infos[idx].isa);\n"
-"                    DEBUG_PRINTF (\"[%u] isa = %8p %s\\n\", idx, class_infos[idx].isa, name);\n"
-"                    // Hash the class name so we don't have to read it\n"
-"                    const char *s = name;\n"
-"                    uint32_t h = 5381;\n"
-"                    for (unsigned char c = *s; c; c = *++s)\n"
-"                        h = ((h << 5) + h) + c;\n"
-"                    class_infos[idx].hash = h;\n"
-"                }\n"
-"                ++idx;\n"
-"            }\n"
-"            \n"
-"            const uint32_t *duplicate_count_ptr = (uint32_t *)&classOffsets[clsopt->capacity];\n"
-"            const uint32_t duplicate_count = *duplicate_count_ptr;\n"
-"            const objc_classheader_t *duplicateClassOffsets = (const objc_classheader_t *)(&duplicate_count_ptr[1]);\n"
-"            DEBUG_PRINTF (\"duplicate_count = %u\\n\", duplicate_count);\n"
-"            DEBUG_PRINTF (\"duplicateClassOffsets = %p\\n\", duplicateClassOffsets);\n"
-"            for (uint32_t i=0; i<duplicate_count; ++i)\n"
-"            {\n"
-"                const int32_t clsOffset = duplicateClassOffsets[i].clsOffset;\n"
-"                if (clsOffset & 1)\n"
-"                    continue; // duplicate\n"
-"                else if (clsOffset == zeroOffset)\n"
-"                    continue; // zero offset\n"
-"                \n"
-"                if (class_infos && idx < max_class_infos)\n"
-"                {\n"
-"                    class_infos[idx].isa = (Class)((uint8_t *)clsopt + clsOffset);\n"
-"                    const char *name = class_getName (class_infos[idx].isa);\n"
-"                    DEBUG_PRINTF (\"[%u] isa = %8p %s\\n\", idx, class_infos[idx].isa, name);\n"
-"                    // Hash the class name so we don't have to read it\n"
-"                    const char *s = name;\n"
-"                    uint32_t h = 5381;\n"
-"                    for (unsigned char c = *s; c; c = *++s)\n"
-"                        h = ((h << 5) + h) + c;\n"
-"                    class_infos[idx].hash = h;\n"
-"                }\n"
-"                ++idx;\n"
-"            }\n"
-"        }\n"
-"        DEBUG_PRINTF (\"%u class_infos\\n\", idx);\n"
-"        DEBUG_PRINTF (\"done\\n\");\n"
-"    }\n"
-"    return idx;\n"
-"}\n"
-"\n"
+	"\n"
+"extern \"C\"\n"
+"{\n"
+"    const char *class_getName(void *objc_class);\n"
+"    size_t strlen(const char *);\n"
+"    char *strncpy (char * s1, const char * s2, size_t n);\n"
+"    int printf(const char * format, ...);\n"
+"}\n"
+"\n"
+"//#define ENABLE_DEBUG_PRINTF // COMMENT THIS LINE OUT PRIOR TO CHECKIN\n"
+"#ifdef ENABLE_DEBUG_PRINTF\n"
+"#define DEBUG_PRINTF(fmt, ...) printf(fmt, ## __VA_ARGS__)\n"
+"#else\n"
+"#define DEBUG_PRINTF(fmt, ...)\n"
+"#endif\n"
+"\n"
+"\n"
+"struct objc_classheader_t {\n"
+"    int32_t clsOffset;\n"
+"    int32_t hiOffset;\n"
+"};\n"
+"\n"
+"struct objc_clsopt_t {\n"
+"    uint32_t capacity;\n"
+"    uint32_t occupied;\n"
+"    uint32_t shift;\n"
+"    uint32_t mask;\n"
+"    uint32_t zero;\n"
+"    uint32_t unused;\n"
+"    uint64_t salt;\n"
+"    uint32_t scramble[256];\n"
+"    uint8_t tab[0]; // tab[mask+1]\n"
+"    //  uint8_t checkbytes[capacity];\n"
+"    //  int32_t offset[capacity];\n"
+"    //  objc_classheader_t clsOffsets[capacity];\n"
+"    //  uint32_t duplicateCount;\n"
+"    //  objc_classheader_t duplicateOffsets[duplicateCount];\n"
+"};\n"
+"\n"
+"struct objc_opt_t {\n"
+"    uint32_t version;\n"
+"    int32_t selopt_offset;\n"
+"    int32_t headeropt_offset;\n"
+"    int32_t clsopt_offset;\n"
+"};\n"
+"\n"
+"struct ClassInfo\n"
+"{\n"
+"    Class isa;\n"
+"    uint32_t hash;\n"
+"}  __attribute__((__packed__));\n"
+"\n"
+"uint32_t\n"
+"__lldb_apple_objc_v2_get_shared_cache_class_info (void *objc_opt_ro_ptr,\n"
+"                                                  void *class_infos_ptr,\n"
+"                                                  uint32_t class_infos_byte_size)\n"
+"{\n"
+"    uint32_t idx = 0;\n"
+"    DEBUG_PRINTF (\"objc_opt_ro_ptr = %p\\n\", objc_opt_ro_ptr);\n"
+"    DEBUG_PRINTF (\"class_infos_ptr = %p\\n\", class_infos_ptr);\n"
+"    DEBUG_PRINTF (\"class_infos_byte_size = %u (%zu class infos)\\n\", class_infos_byte_size, (size_t)(class_infos_byte_size/sizeof(ClassInfo)));\n"
+"    if (objc_opt_ro_ptr)\n"
+"    {\n"
+"        const objc_opt_t *objc_opt = (objc_opt_t *)objc_opt_ro_ptr;\n"
+"        DEBUG_PRINTF (\"objc_opt->version = %u\\n\", objc_opt->version);\n"
+"        DEBUG_PRINTF (\"objc_opt->selopt_offset = %d\\n\", objc_opt->selopt_offset);\n"
+"        DEBUG_PRINTF (\"objc_opt->headeropt_offset = %d\\n\", objc_opt->headeropt_offset);\n"
+"        DEBUG_PRINTF (\"objc_opt->clsopt_offset = %d\\n\", objc_opt->clsopt_offset);\n"
+"        if (objc_opt->version == 12)\n"
+"        {\n"
+"            const objc_clsopt_t* clsopt = (const objc_clsopt_t*)((uint8_t *)objc_opt + objc_opt->clsopt_offset);\n"
+"            const size_t max_class_infos = class_infos_byte_size/sizeof(ClassInfo);\n"
+"            ClassInfo *class_infos = (ClassInfo *)class_infos_ptr;\n"
+"            int32_t zeroOffset = 16;\n"
+"            const uint8_t *checkbytes = &clsopt->tab[clsopt->mask+1];\n"
+"            const int32_t *offsets = (const int32_t *)(checkbytes + clsopt->capacity);\n"
+"            const objc_classheader_t *classOffsets = (const objc_classheader_t *)(offsets + clsopt->capacity);\n"
+"            DEBUG_PRINTF (\"clsopt->capacity = %u\\n\", clsopt->capacity);\n"
+"            DEBUG_PRINTF (\"clsopt->mask = 0x%8.8x\\n\", clsopt->mask);\n"
+"            DEBUG_PRINTF (\"classOffsets = %p\\n\", classOffsets);\n"
+"            for (uint32_t i=0; i<clsopt->capacity; ++i)\n"
+"            {\n"
+"                const int32_t clsOffset = classOffsets[i].clsOffset;\n"
+"                if (clsOffset & 1)\n"
+"                    continue; // duplicate\n"
+"                else if (clsOffset == zeroOffset)\n"
+"                    continue; // zero offset\n"
+"                \n"
+"                if (class_infos && idx < max_class_infos)\n"
+"                {\n"
+"                    class_infos[idx].isa = (Class)((uint8_t *)clsopt + clsOffset);\n"
+"                    const char *name = class_getName (class_infos[idx].isa);\n"
+"                    DEBUG_PRINTF (\"[%u] isa = %8p %s\\n\", idx, class_infos[idx].isa, name);\n"
+"                    // Hash the class name so we don't have to read it\n"
+"                    const char *s = name;\n"
+"                    uint32_t h = 5381;\n"
+"                    for (unsigned char c = *s; c; c = *++s)\n"
+"                        h = ((h << 5) + h) + c;\n"
+"                    class_infos[idx].hash = h;\n"
+"                }\n"
+"                ++idx;\n"
+"            }\n"
+"            \n"
+"            const uint32_t *duplicate_count_ptr = (uint32_t *)&classOffsets[clsopt->capacity];\n"
+"            const uint32_t duplicate_count = *duplicate_count_ptr;\n"
+"            const objc_classheader_t *duplicateClassOffsets = (const objc_classheader_t *)(&duplicate_count_ptr[1]);\n"
+"            DEBUG_PRINTF (\"duplicate_count = %u\\n\", duplicate_count);\n"
+"            DEBUG_PRINTF (\"duplicateClassOffsets = %p\\n\", duplicateClassOffsets);\n"
+"            for (uint32_t i=0; i<duplicate_count; ++i)\n"
+"            {\n"
+"                const int32_t clsOffset = duplicateClassOffsets[i].clsOffset;\n"
+"                if (clsOffset & 1)\n"
+"                    continue; // duplicate\n"
+"                else if (clsOffset == zeroOffset)\n"
+"                    continue; // zero offset\n"
+"                \n"
+"                if (class_infos && idx < max_class_infos)\n"
+"                {\n"
+"                    class_infos[idx].isa = (Class)((uint8_t *)clsopt + clsOffset);\n"
+"                    const char *name = class_getName (class_infos[idx].isa);\n"
+"                    DEBUG_PRINTF (\"[%u] isa = %8p %s\\n\", idx, class_infos[idx].isa, name);\n"
+"                    // Hash the class name so we don't have to read it\n"
+"                    const char *s = name;\n"
+"                    uint32_t h = 5381;\n"
+"                    for (unsigned char c = *s; c; c = *++s)\n"
+"                        h = ((h << 5) + h) + c;\n"
+"                    class_infos[idx].hash = h;\n"
+"                }\n"
+"                ++idx;\n"
+"            }\n"
+"        }\n"
+"        DEBUG_PRINTF (\"%u class_infos\\n\", idx);\n"
+"        DEBUG_PRINTF (\"done\\n\");\n"
+"    }\n"
+"    return idx;\n"
+"}\n"
+"\n"
 "\n";
 
+static uint64_t
+ExtractRuntimeGlobalSymbol (Process* process,
+                            ConstString name,
+                            const ModuleSP &module_sp,
+                            Error& error,
+                            bool read_value = true,
+                            uint8_t byte_size = 0,
+                            uint64_t default_value = LLDB_INVALID_ADDRESS,
+                            SymbolType sym_type = lldb::eSymbolTypeData)
+{
+    if (!process)
+    {
+        error.SetErrorString("no process");
+        return default_value;
+    }
+    if (!module_sp)
+    {
+        error.SetErrorString("no module");
+        return default_value;
+    }
+    if (!byte_size)
+        byte_size = process->GetAddressByteSize();
+    const Symbol *symbol = module_sp->FindFirstSymbolWithNameAndType(name, lldb::eSymbolTypeData);
+    if (symbol)
+    {
+        lldb::addr_t symbol_load_addr = symbol->GetAddress().GetLoadAddress(&process->GetTarget());
+        if (symbol_load_addr != LLDB_INVALID_ADDRESS)
+        {
+            if (read_value)
+                return process->ReadUnsignedIntegerFromMemory(symbol_load_addr, byte_size, default_value, error);
+            else
+                return symbol_load_addr;
+        }
+        else
+        {
+            error.SetErrorString("symbol address invalid");
+            return default_value;
+        }
+    }
+    else
+    {
+        error.SetErrorString("no symbol");
+        return default_value;
+    }
+
+}
 
 AppleObjCRuntimeV2::AppleObjCRuntimeV2 (Process *process,
                                         const ModuleSP &objc_module_sp) :
@@ -301,14 +348,20 @@ AppleObjCRuntimeV2::AppleObjCRuntimeV2 (
     m_isa_hash_table_ptr (LLDB_INVALID_ADDRESS),
     m_hash_signature (),
     m_has_object_getClass (false),
-    m_loaded_objc_opt (false)
+    m_loaded_objc_opt (false),
+    m_non_pointer_isa_cache_ap(NonPointerISACache::CreateInstance(*this,objc_module_sp)),
+    m_tagged_pointer_vendor_ap(TaggedPointerVendor::CreateInstance(*this,objc_module_sp))
 {
     static const ConstString g_gdb_object_getClass("gdb_object_getClass");
     m_has_object_getClass = (objc_module_sp->FindFirstSymbolWithNameAndType(g_gdb_object_getClass, eSymbolTypeCode) != NULL);
 }
 
+AppleObjCRuntimeV2::~AppleObjCRuntimeV2()
+{
+}
+
 bool
-AppleObjCRuntimeV2::GetDynamicTypeAndAddress (ValueObject &in_value, 
+AppleObjCRuntimeV2::GetDynamicTypeAndAddress (ValueObject &in_value,
                                               DynamicValueType use_dynamic, 
                                               TypeAndOrName &class_type_or_name, 
                                               Address &address)
@@ -517,15 +570,16 @@ AppleObjCRuntimeV2::GetByteOffsetForIvar
     return ivar_offset;
 }
 
-// tagged pointers are marked by having their least-significant bit
-// set. this makes them "invalid" as pointers because they violate
-// the alignment requirements. of course, this detection algorithm
-// is not accurate (it might become better by incorporating further
-// knowledge about the internals of tagged pointers)
+
+// tagged pointers are special not-a-real-pointer values that contain both type and value information
+// this routine attempts to check with as little computational effort as possible whether something
+// could possibly be a tagged pointer - false positives are possible but false negatives shouldn't
 bool
 AppleObjCRuntimeV2::IsTaggedPointer(addr_t ptr)
 {
-    return (ptr & 1);
+    if (!m_tagged_pointer_vendor_ap)
+        return false;
+    return m_tagged_pointer_vendor_ap->IsPossibleTaggedPointer(ptr);
 }
 
 class RemoteNXMapTable
@@ -815,9 +869,9 @@ public:
 
             if (process)
             {
-                std::auto_ptr<objc_class_t> objc_class;
-                std::auto_ptr<class_ro_t> class_ro;
-                std::auto_ptr<class_rw_t> class_rw;
+                std::unique_ptr<objc_class_t> objc_class;
+                std::unique_ptr<class_ro_t> class_ro;
+                std::unique_ptr<class_rw_t> class_rw;
                 
                 if (!Read_objc_class(process, objc_class))
                     return m_name;
@@ -838,12 +892,12 @@ public:
         if (!process)
             return ObjCLanguageRuntime::ClassDescriptorSP();
         
-        std::auto_ptr<objc_class_t> objc_class;
+        std::unique_ptr<objc_class_t> objc_class;
 
         if (!Read_objc_class(process, objc_class))
             return ObjCLanguageRuntime::ClassDescriptorSP();
 
-        return m_runtime.ObjCLanguageRuntime::GetClassDescriptor(objc_class->m_superclass);
+        return m_runtime.ObjCLanguageRuntime::GetClassDescriptorFromISA(objc_class->m_superclass);
     }
     
     virtual bool
@@ -855,7 +909,8 @@ public:
     // a custom descriptor is used for tagged pointers
     virtual bool
     GetTaggedPointerInfo (uint64_t* info_bits = NULL,
-                          uint64_t* value_bits = NULL)
+                          uint64_t* value_bits = NULL,
+                          uint64_t* payload = NULL)
     {
         return false;
     }
@@ -867,9 +922,9 @@ public:
         
         if (process)
         {
-            std::auto_ptr<objc_class_t> objc_class;
-            std::auto_ptr<class_ro_t> class_ro;
-            std::auto_ptr<class_rw_t> class_rw;
+            std::unique_ptr<objc_class_t> objc_class;
+            std::unique_ptr<class_ro_t> class_ro;
+            std::unique_ptr<class_rw_t> class_rw;
             
             if (!Read_objc_class(process, objc_class))
                 return 0;
@@ -896,9 +951,9 @@ public:
     {
         lldb_private::Process *process = m_runtime.GetProcess();
 
-        std::auto_ptr<objc_class_t> objc_class;
-        std::auto_ptr<class_ro_t> class_ro;
-        std::auto_ptr<class_rw_t> class_rw;
+        std::unique_ptr<objc_class_t> objc_class;
+        std::unique_ptr<class_ro_t> class_ro;
+        std::unique_ptr<class_rw_t> class_rw;
         
         if (!Read_objc_class(process, objc_class))
             return 0;
@@ -912,7 +967,7 @@ public:
         
         if (instance_method_func)
         {
-            std::auto_ptr <method_list_t> base_method_list;
+            std::unique_ptr<method_list_t> base_method_list;
             
             base_method_list.reset(new method_list_t);
             if (!base_method_list->Read(process, class_ro->m_baseMethods_ptr))
@@ -921,7 +976,7 @@ public:
             if (base_method_list->m_entsize != method_t::GetSize(process))
                 return false;
             
-            std::auto_ptr <method_t> method;
+            std::unique_ptr<method_t> method;
             method.reset(new method_t);
             
             for (uint32_t i = 0, e = base_method_list->m_count; i < e; ++i)
@@ -948,23 +1003,20 @@ public:
         
         if (ivar_func)
         {
-            std::auto_ptr <ivar_list_t> ivar_list;
-            
-            ivar_list.reset(new ivar_list_t);
-            if (!ivar_list->Read(process, class_ro->m_ivars_ptr))
+            ivar_list_t ivar_list;
+            if (!ivar_list.Read(process, class_ro->m_ivars_ptr))
                 return false;
             
-            if (ivar_list->m_entsize != ivar_t::GetSize(process))
+            if (ivar_list.m_entsize != ivar_t::GetSize(process))
                 return false;
             
-            std::auto_ptr <ivar_t> ivar;
-            ivar.reset(new ivar_t);
+            ivar_t ivar;
             
-            for (uint32_t i = 0, e = ivar_list->m_count; i < e; ++i)
+            for (uint32_t i = 0, e = ivar_list.m_count; i < e; ++i)
             {
-                ivar->Read(process, ivar_list->m_first_ptr + (i * ivar_list->m_entsize));
+                ivar.Read(process, ivar_list.m_first_ptr + (i * ivar_list.m_entsize));
                 
-                if (ivar_func(ivar->m_name.c_str(), ivar->m_type.c_str(), ivar->m_offset_ptr, ivar->m_size))
+                if (ivar_func(ivar.m_name.c_str(), ivar.m_type.c_str(), ivar.m_offset_ptr, ivar.m_size))
                     break;
             }
         }
@@ -1352,7 +1404,7 @@ private:
         }
     };
     
-    bool Read_objc_class (Process* process, std::auto_ptr<objc_class_t> &objc_class)
+    bool Read_objc_class (Process* process, std::unique_ptr<objc_class_t> &objc_class)
     {
         objc_class.reset(new objc_class_t);
         
@@ -1364,7 +1416,7 @@ private:
         return ret;
     }
     
-    bool Read_class_row (Process* process, const objc_class_t &objc_class, std::auto_ptr<class_ro_t> &class_ro, std::auto_ptr<class_rw_t> &class_rw)
+    bool Read_class_row (Process* process, const objc_class_t &objc_class, std::unique_ptr<class_ro_t> &class_ro, std::unique_ptr<class_rw_t> &class_rw)
     {
         class_ro.reset();
         class_rw.reset();
@@ -1412,88 +1464,43 @@ private:
     ConstString         m_name;             // May be NULL
 };
 
+// tagged pointer descriptor
 class ClassDescriptorV2Tagged : public ObjCLanguageRuntime::ClassDescriptor
 {
 public:
-    ClassDescriptorV2Tagged (ValueObject &isa_pointer)
+    ClassDescriptorV2Tagged (ConstString class_name,
+                             uint64_t payload)
     {
-        m_valid = false;
-        uint64_t value = isa_pointer.GetValueAsUnsigned(0);
-        ProcessSP process_sp = isa_pointer.GetProcessSP();
-        if (process_sp)
-            m_pointer_size = process_sp->GetAddressByteSize();
-        else
+        m_name = class_name;
+        if (!m_name)
         {
-            m_name = ConstString("");
-            m_pointer_size = 0;
+            m_valid = false;
             return;
         }
-        
         m_valid = true;
-        m_class_bits = (value & 0xE) >> 1;
-        lldb::TargetSP target_sp = isa_pointer.GetTargetSP();
-        
-        uint32_t foundation_version = GetFoundationVersion(target_sp);
-        
-        // TODO: check for OSX version - for now assume Mtn Lion
-        if (foundation_version == UINT32_MAX)
+        m_payload = payload;
+        m_info_bits = (m_payload & 0xF0ULL) >> 4;
+        m_value_bits = (m_payload & ~0x0000000000000000FFULL) >> 8;
+    }
+    
+    ClassDescriptorV2Tagged (ObjCLanguageRuntime::ClassDescriptorSP actual_class_sp,
+                             uint64_t payload)
+    {
+        if (!actual_class_sp)
         {
-            // if we can't determine the matching table (e.g. we have no Foundation),
-            // assume this is not a valid tagged pointer
             m_valid = false;
+            return;
         }
-        else if (foundation_version >= 900)
-        {
-            switch (m_class_bits)
-            {
-                case 0:
-                    m_name = ConstString("NSAtom");
-                    break;
-                case 3:
-                    m_name = ConstString("NSNumber");
-                    break;
-                case 4:
-                    m_name = ConstString("NSDateTS");
-                    break;
-                case 5:
-                    m_name = ConstString("NSManagedObject");
-                    break;
-                case 6:
-                    m_name = ConstString("NSDate");
-                    break;
-                default:
-                    m_valid = false;
-                    break;
-            }
-        }
-        else
-        {
-            switch (m_class_bits)
-            {
-                case 1:
-                    m_name = ConstString("NSNumber");
-                    break;
-                case 5:
-                    m_name = ConstString("NSManagedObject");
-                    break;
-                case 6:
-                    m_name = ConstString("NSDate");
-                    break;
-                case 7:
-                    m_name = ConstString("NSDateTS");
-                    break;
-                default:
-                    m_valid = false;
-                    break;
-            }
-        }
-        if (!m_valid)
-            m_name = ConstString("");
-        else
+        m_name = actual_class_sp->GetClassName();
+        if (!m_name)
         {
-            m_info_bits = (value & 0xF0ULL) >> 4;
-            m_value_bits = (value & ~0x0000000000000000FFULL) >> 8;
+            m_valid = false;
+            return;
         }
+        m_valid = true;
+        m_payload = payload;
+        m_info_bits = (m_payload & 0x0FULL);
+        m_value_bits = (m_payload & ~0x0FULL) >> 4;
     }
     
     virtual ConstString
@@ -1531,12 +1538,15 @@ public:
     
     virtual bool
     GetTaggedPointerInfo (uint64_t* info_bits = NULL,
-                          uint64_t* value_bits = NULL)
+                          uint64_t* value_bits = NULL,
+                          uint64_t* payload = NULL)
     {
         if (info_bits)
             *info_bits = GetInfoBits();
         if (value_bits)
             *value_bits = GetValueBits();
+        if (payload)
+            *payload = GetPayload();
         return true;
     }
     
@@ -1552,12 +1562,6 @@ public:
         return 0; // tagged pointers have no ISA
     }
     
-    virtual uint64_t
-    GetClassBits ()
-    {
-        return (IsValid() ? m_class_bits : 0);
-    }
-    
     // these calls are not part of any formal tagged pointers specification
     virtual uint64_t
     GetValueBits ()
@@ -1571,43 +1575,38 @@ public:
         return (IsValid() ? m_info_bits : 0);
     }
     
-    virtual
-    ~ClassDescriptorV2Tagged ()
-    {}
-    
-protected:
-    // we use the version of Foundation to make assumptions about the ObjC runtime on a target
-    uint32_t
-    GetFoundationVersion (lldb::TargetSP &target_sp)
+    virtual uint64_t
+    GetPayload ()
     {
-        if (!target_sp)
-            return eLazyBoolCalculate;
-        const ModuleList& modules = target_sp->GetImages();
-        uint32_t major = UINT32_MAX;
-        for (uint32_t idx = 0; idx < modules.GetSize(); idx++)
-        {
-            lldb::ModuleSP module_sp = modules.GetModuleAtIndex(idx);
-            if (!module_sp)
-                continue;
-            if (strcmp(module_sp->GetFileSpec().GetFilename().AsCString(""),"Foundation") == 0)
-            {
-                module_sp->GetVersion(&major,1);
-                break;
-            }
-        }
-        return major;
+        return (IsValid() ? m_payload : 0);
     }
     
+    virtual
+    ~ClassDescriptorV2Tagged ()
+    {}
+
 private:
     ConstString m_name;
     uint8_t m_pointer_size;
     bool m_valid;
-    uint64_t m_class_bits;
     uint64_t m_info_bits;
     uint64_t m_value_bits;
+    uint64_t m_payload;
+
 };
 
 ObjCLanguageRuntime::ClassDescriptorSP
+AppleObjCRuntimeV2::GetClassDescriptor (ObjCISA isa)
+{
+    ObjCLanguageRuntime::ClassDescriptorSP class_descriptor_sp;
+    if (m_non_pointer_isa_cache_ap.get())
+        class_descriptor_sp = m_non_pointer_isa_cache_ap->GetClassDescriptor(isa);
+    if (!class_descriptor_sp)
+        class_descriptor_sp = ObjCLanguageRuntime::GetClassDescriptorFromISA(isa);
+    return class_descriptor_sp;
+}
+
+ObjCLanguageRuntime::ClassDescriptorSP
 AppleObjCRuntimeV2::GetClassDescriptor (ValueObject& valobj)
 {
     ClassDescriptorSP objc_class_sp;
@@ -1621,13 +1620,7 @@ AppleObjCRuntimeV2::GetClassDescriptor (
         // tagged pointer
         if (IsTaggedPointer(isa_pointer))
         {
-            objc_class_sp.reset (new ClassDescriptorV2Tagged(valobj));
-            
-            // probably an invalid tagged pointer - say it's wrong
-            if (objc_class_sp->IsValid())
-                return objc_class_sp;
-            else
-                objc_class_sp.reset();
+            return m_tagged_pointer_vendor_ap->GetClassDescriptor(isa_pointer);
         }
         else
         {
@@ -1640,7 +1633,7 @@ AppleObjCRuntimeV2::GetClassDescriptor (
                 ObjCISA isa = process->ReadPointerFromMemory(isa_pointer, error);
                 if (isa != LLDB_INVALID_ADDRESS)
                 {
-                    objc_class_sp = ObjCLanguageRuntime::GetClassDescriptor (isa);
+                    objc_class_sp = ObjCLanguageRuntime::GetClassDescriptorFromISA (isa);
                     if (isa && !objc_class_sp)
                     {
                         Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
@@ -2315,6 +2308,7 @@ AppleObjCRuntimeV2::LookupRuntimeSymbol
         llvm::StringRef name_strref(name_cstr);
         
         static const llvm::StringRef ivar_prefix("OBJC_IVAR_$_");
+        static const llvm::StringRef class_prefix("OBJC_CLASS_$_");
         
         if (name_strref.startswith(ivar_prefix))
         {
@@ -2324,7 +2318,7 @@ AppleObjCRuntimeV2::LookupRuntimeSymbol
             if (class_and_ivar.first.size() && class_and_ivar.second.size())
             {
                 const ConstString class_name_cs(class_and_ivar.first);
-                ClassDescriptorSP descriptor = ObjCLanguageRuntime::GetClassDescriptor(class_name_cs);
+                ClassDescriptorSP descriptor = ObjCLanguageRuntime::GetClassDescriptorFromClassName(class_name_cs);
                                 
                 if (descriptor)
                 {
@@ -2348,7 +2342,312 @@ AppleObjCRuntimeV2::LookupRuntimeSymbol
                 }
             }
         }
-    } 
+        else if (name_strref.startswith(class_prefix))
+        {
+            llvm::StringRef class_skipped_prefix = name_strref.substr(class_prefix.size());
+            const ConstString class_name_cs(class_skipped_prefix);
+            ClassDescriptorSP descriptor = GetClassDescriptorFromClassName(class_name_cs);
+            
+            if (descriptor)
+                ret = descriptor->GetISA();
+        }
+    }
     
     return ret;
 }
+
+AppleObjCRuntimeV2::NonPointerISACache*
+AppleObjCRuntimeV2::NonPointerISACache::CreateInstance (AppleObjCRuntimeV2& runtime, const lldb::ModuleSP& objc_module_sp)
+{
+    Process* process(runtime.GetProcess());
+    
+    Error error;
+    
+    auto objc_debug_isa_magic_mask = ExtractRuntimeGlobalSymbol(process,
+                                                                ConstString("objc_debug_isa_magic_mask"),
+                                                                objc_module_sp,
+                                                                error);
+    if (error.Fail())
+        return NULL;
+
+    auto objc_debug_isa_magic_value = ExtractRuntimeGlobalSymbol(process,
+                                                                 ConstString("objc_debug_isa_magic_value"),
+                                                                 objc_module_sp,
+                                                                 error);
+    if (error.Fail())
+        return NULL;
+
+    auto objc_debug_isa_class_mask = ExtractRuntimeGlobalSymbol(process,
+                                                                ConstString("objc_debug_isa_class_mask"),
+                                                                objc_module_sp,
+                                                                error);
+    if (error.Fail())
+        return NULL;
+
+    // we might want to have some rules to outlaw these other values (e.g if the mask is zero but the value is non-zero, ...)
+    
+    return new NonPointerISACache(runtime,
+                                  objc_debug_isa_class_mask,
+                                  objc_debug_isa_magic_mask,
+                                  objc_debug_isa_magic_value);
+}
+
+AppleObjCRuntimeV2::TaggedPointerVendor*
+AppleObjCRuntimeV2::TaggedPointerVendor::CreateInstance (AppleObjCRuntimeV2& runtime, const lldb::ModuleSP& objc_module_sp)
+{
+    Process* process(runtime.GetProcess());
+    
+    Error error;
+    
+    auto objc_debug_taggedpointer_mask = ExtractRuntimeGlobalSymbol(process,
+                                                                    ConstString("objc_debug_taggedpointer_mask"),
+                                                                    objc_module_sp,
+                                                                    error);
+    if (error.Fail())
+        return new TaggedPointerVendorLegacy(runtime);
+    
+    auto objc_debug_taggedpointer_slot_shift = ExtractRuntimeGlobalSymbol(process,
+                                                                          ConstString("objc_debug_taggedpointer_slot_shift"),
+                                                                          objc_module_sp,
+                                                                          error,
+                                                                          true,
+                                                                          4);
+    if (error.Fail())
+        return new TaggedPointerVendorLegacy(runtime);
+    
+    auto objc_debug_taggedpointer_slot_mask = ExtractRuntimeGlobalSymbol(process,
+                                                                          ConstString("objc_debug_taggedpointer_slot_mask"),
+                                                                          objc_module_sp,
+                                                                          error,
+                                                                          true,
+                                                                          4);
+    if (error.Fail())
+        return new TaggedPointerVendorLegacy(runtime);
+
+    auto objc_debug_taggedpointer_payload_lshift = ExtractRuntimeGlobalSymbol(process,
+                                                                              ConstString("objc_debug_taggedpointer_payload_lshift"),
+                                                                              objc_module_sp,
+                                                                              error,
+                                                                              true,
+                                                                              4);
+    if (error.Fail())
+        return new TaggedPointerVendorLegacy(runtime);
+    
+    auto objc_debug_taggedpointer_payload_rshift = ExtractRuntimeGlobalSymbol(process,
+                                                                              ConstString("objc_debug_taggedpointer_payload_rshift"),
+                                                                              objc_module_sp,
+                                                                              error,
+                                                                              true,
+                                                                              4);
+    if (error.Fail())
+        return new TaggedPointerVendorLegacy(runtime);
+    
+    auto objc_debug_taggedpointer_classes = ExtractRuntimeGlobalSymbol(process,
+                                                                       ConstString("objc_debug_taggedpointer_classes"),
+                                                                       objc_module_sp,
+                                                                       error,
+                                                                       false);
+    if (error.Fail())
+        return new TaggedPointerVendorLegacy(runtime);
+
+    
+    // we might want to have some rules to outlaw these values (e.g if the table's address is zero)
+    
+    return new TaggedPointerVendorRuntimeAssisted(runtime,
+                                                  objc_debug_taggedpointer_mask,
+                                                  objc_debug_taggedpointer_slot_shift,
+                                                  objc_debug_taggedpointer_slot_mask,
+                                                  objc_debug_taggedpointer_payload_lshift,
+                                                  objc_debug_taggedpointer_payload_rshift,
+                                                  objc_debug_taggedpointer_classes);
+}
+
+bool
+AppleObjCRuntimeV2::TaggedPointerVendorLegacy::IsPossibleTaggedPointer (lldb::addr_t ptr)
+{
+    return (ptr & 1);
+}
+
+// we use the version of Foundation to make assumptions about the ObjC runtime on a target
+uint32_t
+AppleObjCRuntimeV2::TaggedPointerVendorLegacy::GetFoundationVersion (Target &target)
+{
+    const ModuleList& modules = target.GetImages();
+    uint32_t major = UINT32_MAX;
+    for (uint32_t idx = 0; idx < modules.GetSize(); idx++)
+    {
+        lldb::ModuleSP module_sp = modules.GetModuleAtIndex(idx);
+        if (!module_sp)
+            continue;
+        if (strcmp(module_sp->GetFileSpec().GetFilename().AsCString(""),"Foundation") == 0)
+        {
+            module_sp->GetVersion(&major,1);
+            break;
+        }
+    }
+    return major;
+}
+
+ObjCLanguageRuntime::ClassDescriptorSP
+AppleObjCRuntimeV2::TaggedPointerVendorLegacy::GetClassDescriptor (lldb::addr_t ptr)
+{
+    if (!IsPossibleTaggedPointer(ptr))
+        return ObjCLanguageRuntime::ClassDescriptorSP();
+
+    Process* process(m_runtime.GetProcess());
+    
+    if (m_Foundation_version == 0)
+        m_Foundation_version = GetFoundationVersion(process->GetTarget());
+    
+    if (m_Foundation_version == UINT32_MAX)
+        return ObjCLanguageRuntime::ClassDescriptorSP();
+    
+    uint64_t class_bits = (ptr & 0xE) >> 1;
+    ConstString name;
+    
+    // TODO: make a table
+    if (m_Foundation_version >= 900)
+    {
+        switch (class_bits)
+        {
+            case 0:
+                name = ConstString("NSAtom");
+                break;
+            case 3:
+                name = ConstString("NSNumber");
+                break;
+            case 4:
+                name = ConstString("NSDateTS");
+                break;
+            case 5:
+                name = ConstString("NSManagedObject");
+                break;
+            case 6:
+                name = ConstString("NSDate");
+                break;
+            default:
+                return ObjCLanguageRuntime::ClassDescriptorSP();
+        }
+    }
+    else
+    {
+        switch (class_bits)
+        {
+            case 1:
+                name = ConstString("NSNumber");
+                break;
+            case 5:
+                name = ConstString("NSManagedObject");
+                break;
+            case 6:
+                name = ConstString("NSDate");
+                break;
+            case 7:
+                name = ConstString("NSDateTS");
+                break;
+            default:
+                return ObjCLanguageRuntime::ClassDescriptorSP();
+        }
+    }
+    return ClassDescriptorSP(new ClassDescriptorV2Tagged(name,ptr));
+}
+
+AppleObjCRuntimeV2::TaggedPointerVendorRuntimeAssisted::TaggedPointerVendorRuntimeAssisted (AppleObjCRuntimeV2& runtime,
+                                                                                            uint64_t objc_debug_taggedpointer_mask,
+                                                                                            uint32_t objc_debug_taggedpointer_slot_shift,
+                                                                                            uint32_t objc_debug_taggedpointer_slot_mask,
+                                                                                            uint32_t objc_debug_taggedpointer_payload_lshift,
+                                                                                            uint32_t objc_debug_taggedpointer_payload_rshift,
+                                                                                            lldb::addr_t objc_debug_taggedpointer_classes) :
+TaggedPointerVendor(runtime),
+m_cache(),
+m_objc_debug_taggedpointer_mask(objc_debug_taggedpointer_mask),
+m_objc_debug_taggedpointer_slot_shift(objc_debug_taggedpointer_slot_shift),
+m_objc_debug_taggedpointer_slot_mask(objc_debug_taggedpointer_slot_mask),
+m_objc_debug_taggedpointer_payload_lshift(objc_debug_taggedpointer_payload_lshift),
+m_objc_debug_taggedpointer_payload_rshift(objc_debug_taggedpointer_payload_rshift),
+m_objc_debug_taggedpointer_classes(objc_debug_taggedpointer_classes)
+{
+}
+
+bool
+AppleObjCRuntimeV2::TaggedPointerVendorRuntimeAssisted::IsPossibleTaggedPointer (lldb::addr_t ptr)
+{
+    return (ptr & m_objc_debug_taggedpointer_mask) != 0;
+}
+
+ObjCLanguageRuntime::ClassDescriptorSP
+AppleObjCRuntimeV2::TaggedPointerVendorRuntimeAssisted::GetClassDescriptor (lldb::addr_t ptr)
+{
+    ClassDescriptorSP actual_class_descriptor_sp;
+    uint64_t data_payload;
+
+    if (!IsPossibleTaggedPointer(ptr))
+        return ObjCLanguageRuntime::ClassDescriptorSP();
+    
+    uintptr_t slot = (ptr >> m_objc_debug_taggedpointer_slot_shift) & m_objc_debug_taggedpointer_slot_mask;
+    
+    CacheIterator iterator = m_cache.find(slot),
+    end = m_cache.end();
+    if (iterator != end)
+    {
+        actual_class_descriptor_sp = iterator->second;
+    }
+    else
+    {
+        Process* process(m_runtime.GetProcess());
+        uintptr_t slot_ptr = slot*process->GetAddressByteSize()+m_objc_debug_taggedpointer_classes;
+        Error error;
+        uintptr_t slot_data = process->ReadPointerFromMemory(slot_ptr, error);
+        if (error.Fail() || slot_data == 0 || slot_data == LLDB_INVALID_ADDRESS)
+            return false;
+        actual_class_descriptor_sp = m_runtime.GetClassDescriptor(slot_data);
+        if (!actual_class_descriptor_sp)
+            return ObjCLanguageRuntime::ClassDescriptorSP();
+        m_cache[slot] = actual_class_descriptor_sp;
+    }
+    
+    data_payload = (((uint64_t)ptr << m_objc_debug_taggedpointer_payload_lshift) >> m_objc_debug_taggedpointer_payload_rshift);
+    
+    return ClassDescriptorSP(new ClassDescriptorV2Tagged(actual_class_descriptor_sp,data_payload));
+}
+
+AppleObjCRuntimeV2::NonPointerISACache::NonPointerISACache (AppleObjCRuntimeV2& runtime,
+                                                            uint64_t objc_debug_isa_class_mask,
+                                                            uint64_t objc_debug_isa_magic_mask,
+                                                            uint64_t objc_debug_isa_magic_value) :
+m_runtime(runtime),
+m_cache(),
+m_objc_debug_isa_class_mask(objc_debug_isa_class_mask),
+m_objc_debug_isa_magic_mask(objc_debug_isa_magic_mask),
+m_objc_debug_isa_magic_value(objc_debug_isa_magic_value)
+{
+}
+
+ObjCLanguageRuntime::ClassDescriptorSP
+AppleObjCRuntimeV2::NonPointerISACache::GetClassDescriptor (ObjCISA isa)
+{
+    ObjCISA real_isa = 0;
+    if (EvaluateNonPointerISA(isa, real_isa) == false)
+        return ObjCLanguageRuntime::ClassDescriptorSP();
+    auto cache_iter = m_cache.find(real_isa);
+    if (cache_iter != m_cache.end())
+        return cache_iter->second;
+    auto descriptor_sp = m_runtime.ObjCLanguageRuntime::GetClassDescriptorFromISA(real_isa);
+    if (descriptor_sp) // cache only positive matches since the table might grow
+        m_cache[real_isa] = descriptor_sp;
+    return descriptor_sp;
+}
+
+bool
+AppleObjCRuntimeV2::NonPointerISACache::EvaluateNonPointerISA (ObjCISA isa, ObjCISA& ret_isa)
+{
+    if ( (isa & ~m_objc_debug_isa_class_mask) == 0)
+        return false;
+    if ( (isa & m_objc_debug_isa_magic_mask) == m_objc_debug_isa_magic_value)
+    {
+        ret_isa = isa & m_objc_debug_isa_class_mask;
+        return (ret_isa != 0); // this is a pointer so 0 is not a valid value
+    }
+    return false;
+}

Modified: lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h (original)
+++ lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h Thu Apr 25 07:31:53 2013
@@ -14,6 +14,7 @@
 // C++ Includes
 
 #include <map>
+#include <memory>
 
 // Other libraries and framework includes
 // Project includes
@@ -29,7 +30,7 @@ class AppleObjCRuntimeV2 :
         public AppleObjCRuntime
 {
 public:
-    virtual ~AppleObjCRuntimeV2() { }
+    virtual ~AppleObjCRuntimeV2();
     
     // These are generic runtime functions:
     virtual bool
@@ -95,6 +96,9 @@ public:
     virtual ClassDescriptorSP
     GetClassDescriptor (ValueObject& in_value);
     
+    virtual ClassDescriptorSP
+    GetClassDescriptor (ObjCISA isa);
+    
     virtual TypeVendor *
     GetTypeVendor();
     
@@ -125,6 +129,118 @@ private:
         lldb::addr_t m_buckets_ptr;
     };
 
+    class NonPointerISACache
+    {
+    public:
+        static NonPointerISACache*
+        CreateInstance (AppleObjCRuntimeV2& runtime,
+                        const lldb::ModuleSP& objc_module_sp);
+        
+
+        ObjCLanguageRuntime::ClassDescriptorSP
+        GetClassDescriptor (ObjCISA isa);
+    private:
+        NonPointerISACache (AppleObjCRuntimeV2& runtime,
+                            uint64_t objc_debug_isa_class_mask,
+                            uint64_t objc_debug_isa_magic_mask,
+                            uint64_t objc_debug_isa_magic_value);
+        
+        bool
+        EvaluateNonPointerISA (ObjCISA isa, ObjCISA& ret_isa);
+        
+        AppleObjCRuntimeV2&                                         m_runtime;
+        std::map<ObjCISA,ObjCLanguageRuntime::ClassDescriptorSP>    m_cache;
+        uint64_t                                                    m_objc_debug_isa_class_mask;
+        uint64_t                                                    m_objc_debug_isa_magic_mask;
+        uint64_t                                                    m_objc_debug_isa_magic_value;
+
+        DISALLOW_COPY_AND_ASSIGN(NonPointerISACache);
+    };
+    
+    class TaggedPointerVendor
+    {
+    public:
+        static TaggedPointerVendor*
+        CreateInstance (AppleObjCRuntimeV2& runtime,
+                        const lldb::ModuleSP& objc_module_sp);
+        
+        virtual bool
+        IsPossibleTaggedPointer (lldb::addr_t ptr) = 0;
+        
+        virtual ObjCLanguageRuntime::ClassDescriptorSP
+        GetClassDescriptor (lldb::addr_t ptr) = 0;
+        
+        virtual
+        ~TaggedPointerVendor () { }
+    protected:
+        AppleObjCRuntimeV2&                                         m_runtime;
+        
+        TaggedPointerVendor (AppleObjCRuntimeV2& runtime) :
+        m_runtime(runtime)
+        {
+        }
+    private:
+        
+        DISALLOW_COPY_AND_ASSIGN(TaggedPointerVendor);
+    };
+    
+    class TaggedPointerVendorRuntimeAssisted : public TaggedPointerVendor
+    {
+    public:
+        virtual bool
+        IsPossibleTaggedPointer (lldb::addr_t ptr);
+        
+        virtual ObjCLanguageRuntime::ClassDescriptorSP
+        GetClassDescriptor (lldb::addr_t ptr);
+    protected:
+        TaggedPointerVendorRuntimeAssisted (AppleObjCRuntimeV2& runtime,
+                                             uint64_t objc_debug_taggedpointer_mask,
+                                             uint32_t objc_debug_taggedpointer_slot_shift,
+                                             uint32_t objc_debug_taggedpointer_slot_mask,
+                                             uint32_t objc_debug_taggedpointer_payload_lshift,
+                                             uint32_t objc_debug_taggedpointer_payload_rshift,
+                                             lldb::addr_t objc_debug_taggedpointer_classes);
+        
+        typedef std::map<uint8_t,ObjCLanguageRuntime::ClassDescriptorSP> Cache;
+        typedef Cache::iterator CacheIterator;
+        Cache                                                       m_cache;
+        uint64_t                                                    m_objc_debug_taggedpointer_mask;
+        uint32_t                                                    m_objc_debug_taggedpointer_slot_shift;
+        uint32_t                                                    m_objc_debug_taggedpointer_slot_mask;
+        uint32_t                                                    m_objc_debug_taggedpointer_payload_lshift;
+        uint32_t                                                    m_objc_debug_taggedpointer_payload_rshift;
+        lldb::addr_t                                                m_objc_debug_taggedpointer_classes;
+        
+        friend class AppleObjCRuntimeV2::TaggedPointerVendor;
+        
+        DISALLOW_COPY_AND_ASSIGN(TaggedPointerVendorRuntimeAssisted);
+    };
+    
+    class TaggedPointerVendorLegacy : public TaggedPointerVendor
+    {
+    public:
+        virtual bool
+        IsPossibleTaggedPointer (lldb::addr_t ptr);
+        
+        virtual ObjCLanguageRuntime::ClassDescriptorSP
+        GetClassDescriptor (lldb::addr_t ptr);
+    protected:
+        TaggedPointerVendorLegacy (AppleObjCRuntimeV2& runtime) :
+        TaggedPointerVendor (runtime),
+        m_Foundation_version(0)
+        {
+        }
+        
+        static uint32_t
+        GetFoundationVersion (Target& target);
+        
+        uint32_t m_Foundation_version;
+        
+        friend class AppleObjCRuntimeV2::TaggedPointerVendor;
+        
+        DISALLOW_COPY_AND_ASSIGN(TaggedPointerVendorLegacy);
+    };
+    
     AppleObjCRuntimeV2 (Process *process,
                         const lldb::ModuleSP &objc_module_sp);
     
@@ -150,22 +266,23 @@ private:
     lldb::addr_t
     GetSharedCacheReadOnlyAddress();
     
-    std::auto_ptr<ClangFunction>        m_get_class_info_function;
-    std::auto_ptr<ClangUtilityFunction> m_get_class_info_code;
-    lldb::addr_t                        m_get_class_info_args;
-    Mutex                               m_get_class_info_args_mutex;
-
-    std::auto_ptr<ClangFunction>        m_get_shared_cache_class_info_function;
-    std::auto_ptr<ClangUtilityFunction> m_get_shared_cache_class_info_code;
-    lldb::addr_t                        m_get_shared_cache_class_info_args;
-    Mutex                               m_get_shared_cache_class_info_args_mutex;
-
-    std::auto_ptr<TypeVendor>           m_type_vendor_ap;
-    lldb::addr_t                        m_isa_hash_table_ptr;
-    HashTableSignature                  m_hash_signature;
-    bool                                m_has_object_getClass;
-    bool                                m_loaded_objc_opt;
-    
+    std::unique_ptr<ClangFunction>            m_get_class_info_function;
+    std::unique_ptr<ClangUtilityFunction>     m_get_class_info_code;
+    lldb::addr_t                            m_get_class_info_args;
+    Mutex                                   m_get_class_info_args_mutex;
+
+    std::unique_ptr<ClangFunction>            m_get_shared_cache_class_info_function;
+    std::unique_ptr<ClangUtilityFunction>     m_get_shared_cache_class_info_code;
+    lldb::addr_t                            m_get_shared_cache_class_info_args;
+    Mutex                                   m_get_shared_cache_class_info_args_mutex;
+
+    std::unique_ptr<TypeVendor>               m_type_vendor_ap;
+    lldb::addr_t                            m_isa_hash_table_ptr;
+    HashTableSignature                      m_hash_signature;
+    bool                                    m_has_object_getClass;
+    bool                                    m_loaded_objc_opt;
+    std::unique_ptr<NonPointerISACache>       m_non_pointer_isa_cache_ap;
+    std::unique_ptr<TaggedPointerVendor>    m_tagged_pointer_vendor_ap;
 };
     
 } // namespace lldb_private

Modified: lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.h (original)
+++ lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.h Thu Apr 25 07:31:53 2013
@@ -197,14 +197,14 @@ private:
     MsgsendMap m_msgSend_map;
     lldb::ProcessSP m_process_sp;
     lldb::ModuleSP m_objc_module_sp;
-    std::auto_ptr<ClangFunction> m_impl_function;
-    std::auto_ptr<ClangUtilityFunction> m_impl_code;
+    std::unique_ptr<ClangFunction> m_impl_function;
+    std::unique_ptr<ClangUtilityFunction> m_impl_code;
     Mutex m_impl_function_mutex;
     lldb::addr_t m_impl_fn_addr;
     lldb::addr_t m_impl_stret_fn_addr;
     lldb::addr_t m_msg_forward_addr;
     lldb::addr_t m_msg_forward_stret_addr;
-    std::auto_ptr<AppleObjCVTables> m_vtables_ap;
+    std::unique_ptr<AppleObjCVTables> m_vtables_ap;
     
      
 };

Modified: lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeVendor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeVendor.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeVendor.cpp (original)
+++ lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeVendor.cpp Thu Apr 25 07:31:53 2013
@@ -182,7 +182,7 @@ AppleObjCTypeVendor::GetDeclForISA(ObjCL
     
     clang::ASTContext *ast_ctx = m_ast_ctx.getASTContext();
     
-    ObjCLanguageRuntime::ClassDescriptorSP descriptor = m_runtime.GetClassDescriptor(isa);
+    ObjCLanguageRuntime::ClassDescriptorSP descriptor = m_runtime.GetClassDescriptorFromISA(isa);
     
     if (!descriptor)
         return NULL;
@@ -513,7 +513,7 @@ AppleObjCTypeVendor::FinishDecl(clang::O
     interface_decl->setHasExternalVisibleStorage(false);
     interface_decl->setHasExternalLexicalStorage(false);
     
-    ObjCLanguageRuntime::ClassDescriptorSP descriptor = m_runtime.GetClassDescriptor(objc_isa);
+    ObjCLanguageRuntime::ClassDescriptorSP descriptor = m_runtime.GetClassDescriptorFromISA(objc_isa);
     
     if (!descriptor)
         return false;

Modified: lldb/branches/windows/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp (original)
+++ lldb/branches/windows/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp Thu Apr 25 07:31:53 2013
@@ -255,7 +255,8 @@ ObjectContainerBSDArchive::Initialize()
 {
     PluginManager::RegisterPlugin (GetPluginNameStatic(),
                                    GetPluginDescriptionStatic(),
-                                   CreateInstance);
+                                   CreateInstance,
+                                   GetModuleSpecifications);
 }
 
 void
@@ -312,7 +313,7 @@ ObjectContainerBSDArchive::CreateInstanc
                 lldb::offset_t archive_data_offset = 0;
 
         Archive::shared_ptr archive_sp (Archive::FindCachedArchive (*file, module_sp->GetArchitecture(), module_sp->GetModificationTime()));
-                std::auto_ptr<ObjectContainerBSDArchive> container_ap(new ObjectContainerBSDArchive (module_sp,
+                std::unique_ptr<ObjectContainerBSDArchive> container_ap(new ObjectContainerBSDArchive (module_sp,
                                                                                                      archive_data_sp,
                                                                                                      archive_data_offset,
                                                                                                      file,
@@ -338,7 +339,7 @@ ObjectContainerBSDArchive::CreateInstanc
             Archive::shared_ptr archive_sp (Archive::FindCachedArchive (*file, module_sp->GetArchitecture(), module_sp->GetModificationTime()));
             if (archive_sp)
             {
-                std::auto_ptr<ObjectContainerBSDArchive> container_ap(new ObjectContainerBSDArchive (module_sp, data_sp, data_offset, file, file_offset, length));
+                std::unique_ptr<ObjectContainerBSDArchive> container_ap(new ObjectContainerBSDArchive (module_sp, data_sp, data_offset, file, file_offset, length));
                 
                 if (container_ap.get())
                 {
@@ -488,3 +489,14 @@ ObjectContainerBSDArchive::GetPluginVers
     return 1;
 }
 
+
+size_t
+ObjectContainerBSDArchive::GetModuleSpecifications (const lldb_private::FileSpec& file,
+                                                    lldb::DataBufferSP& data_sp,
+                                                    lldb::offset_t data_offset,
+                                                    lldb::offset_t file_offset,
+                                                    lldb::offset_t length,
+                                                    lldb_private::ModuleSpecList &specs)
+{
+    return 0;
+}

Modified: lldb/branches/windows/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h (original)
+++ lldb/branches/windows/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h Thu Apr 25 07:31:53 2013
@@ -46,6 +46,14 @@ public:
                     lldb::offset_t offset,
                     lldb::offset_t length);
 
+    static size_t
+    GetModuleSpecifications (const lldb_private::FileSpec& file,
+                             lldb::DataBufferSP& data_sp,
+                             lldb::offset_t data_offset,
+                             lldb::offset_t file_offset,
+                             lldb::offset_t length,
+                             lldb_private::ModuleSpecList &specs);
+
     static bool
     MagicBytesMatch (const lldb_private::DataExtractor &data);
 
@@ -119,7 +127,7 @@ protected:
     class Archive
     {
     public:
-        typedef STD_SHARED_PTR(Archive) shared_ptr;
+        typedef std::shared_ptr<Archive> shared_ptr;
         typedef std::multimap<lldb_private::FileSpec, shared_ptr> Map;
 
         static Map &

Modified: lldb/branches/windows/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp (original)
+++ lldb/branches/windows/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp Thu Apr 25 07:31:53 2013
@@ -11,6 +11,7 @@
 #include "lldb/Core/ArchSpec.h"
 #include "lldb/Core/DataBuffer.h"
 #include "lldb/Core/Module.h"
+#include "lldb/Core/ModuleSpec.h"
 #include "lldb/Core/PluginManager.h"
 #include "lldb/Core/Stream.h"
 #include "lldb/Symbol/ObjectFile.h"
@@ -25,7 +26,8 @@ ObjectContainerUniversalMachO::Initializ
 {
     PluginManager::RegisterPlugin (GetPluginNameStatic(),
                                    GetPluginDescriptionStatic(),
-                                   CreateInstance);
+                                   CreateInstance,
+                                   GetModuleSpecifications);
 }
 
 void
@@ -67,7 +69,7 @@ ObjectContainerUniversalMachO::CreateIns
         data.SetData (data_sp, data_offset, length);
         if (ObjectContainerUniversalMachO::MagicBytesMatch(data))
         {
-            std::auto_ptr<ObjectContainerUniversalMachO> container_ap(new ObjectContainerUniversalMachO (module_sp, data_sp, data_offset, file, file_offset, length));
+            std::unique_ptr<ObjectContainerUniversalMachO> container_ap(new ObjectContainerUniversalMachO (module_sp, data_sp, data_offset, file, file_offset, length));
             if (container_ap->ParseHeader())
             {
                 return container_ap.release();
@@ -109,44 +111,52 @@ ObjectContainerUniversalMachO::~ObjectCo
 bool
 ObjectContainerUniversalMachO::ParseHeader ()
 {
+    bool success = ParseHeader (m_data, m_header, m_fat_archs);
+    // We no longer need any data, we parsed all we needed to parse
+    // and cached it in m_header and m_fat_archs
+    m_data.Clear();
+    return success;
+}
+
+bool
+ObjectContainerUniversalMachO::ParseHeader (lldb_private::DataExtractor &data,
+                                            llvm::MachO::fat_header &header,
+                                            std::vector<llvm::MachO::fat_arch> &fat_archs)
+{
     bool success = false;
     // Store the file offset for this universal file as we could have a universal .o file
     // in a BSD archive, or be contained in another kind of object.
-    lldb::offset_t offset = 0;
     // Universal mach-o files always have their headers in big endian.
-    m_data.SetByteOrder (eByteOrderBig);
-    m_header.magic = m_data.GetU32(&offset);
+    lldb::offset_t offset = 0;
+    data.SetByteOrder (eByteOrderBig);
+    header.magic = data.GetU32(&offset);
+    fat_archs.clear();
 
-    if (m_header.magic == UniversalMagic)
+    if (header.magic == UniversalMagic)
     {
-        m_data.SetAddressByteSize(4);
-
-        m_header.nfat_arch = m_data.GetU32(&offset);
 
+        data.SetAddressByteSize(4);
+        
+        header.nfat_arch = data.GetU32(&offset);
+        
         // Now we should have enough data for all of the fat headers, so lets index
         // them so we know how many architectures that this universal binary contains.
         uint32_t arch_idx = 0;
-        for (arch_idx = 0; arch_idx < m_header.nfat_arch; ++arch_idx)
+        for (arch_idx = 0; arch_idx < header.nfat_arch; ++arch_idx)
         {
-            if (m_data.ValidOffsetForDataOfSize(offset, sizeof(fat_arch)))
+            if (data.ValidOffsetForDataOfSize(offset, sizeof(fat_arch)))
             {
                 fat_arch arch;
-                if (m_data.GetU32(&offset, &arch, sizeof(fat_arch)/sizeof(uint32_t)))
-                {
-                    m_fat_archs.push_back(arch);
-                }
+                if (data.GetU32(&offset, &arch, sizeof(fat_arch)/sizeof(uint32_t)))
+                    fat_archs.push_back(arch);
             }
         }
         success = true;
     }
     else
     {
-        memset(&m_header, 0, sizeof(m_header));
+        memset(&header, 0, sizeof(header));
     }
-
-    // We no longer need any data, we parsed all we needed to parse
-    // and cached it in m_header and m_fat_archs
-    m_data.Clear();
     return success;
 }
 
@@ -268,3 +278,33 @@ ObjectContainerUniversalMachO::GetPlugin
 }
 
 
+size_t
+ObjectContainerUniversalMachO::GetModuleSpecifications (const lldb_private::FileSpec& file,
+                                                        lldb::DataBufferSP& data_sp,
+                                                        lldb::offset_t data_offset,
+                                                        lldb::offset_t file_offset,
+                                                        lldb::offset_t length,
+                                                        lldb_private::ModuleSpecList &specs)
+{
+    const size_t initial_count = specs.GetSize();
+    
+    DataExtractor data;
+    data.SetData (data_sp, data_offset, length);
+
+    if (ObjectContainerUniversalMachO::MagicBytesMatch(data))
+    {
+        llvm::MachO::fat_header header;
+        std::vector<llvm::MachO::fat_arch> fat_archs;
+        if (ParseHeader (data, header, fat_archs))
+        {
+            for (auto fat_arch = fat_archs.begin(); fat_arch != fat_archs.end(); fat_arch++)
+            {
+                ObjectFile::GetModuleSpecifications (file,
+                                                     fat_arch->offset + file_offset,
+                                                     specs);
+            }
+        }
+    }
+    return specs.GetSize() - initial_count;
+}
+

Modified: lldb/branches/windows/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h (original)
+++ lldb/branches/windows/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h Thu Apr 25 07:31:53 2013
@@ -42,6 +42,14 @@ public:
                     lldb::offset_t offset,
                     lldb::offset_t length);
 
+    static size_t
+    GetModuleSpecifications (const lldb_private::FileSpec& file,
+                             lldb::DataBufferSP& data_sp,
+                             lldb::offset_t data_offset,
+                             lldb::offset_t file_offset,
+                             lldb::offset_t length,
+                             lldb_private::ModuleSpecList &specs);
+
     static bool
     MagicBytesMatch (const lldb_private::DataExtractor &data);
 
@@ -88,6 +96,12 @@ public:
 protected:
     llvm::MachO::fat_header m_header;
     std::vector<llvm::MachO::fat_arch> m_fat_archs;
+    
+    static bool
+    ParseHeader (lldb_private::DataExtractor &data,
+                 llvm::MachO::fat_header &header,
+                 std::vector<llvm::MachO::fat_arch> &fat_archs);
+
 };
 
 #endif  // liblldb_ObjectContainerUniversalMachO_h_

Modified: lldb/branches/windows/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp (original)
+++ lldb/branches/windows/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Thu Apr 25 07:31:53 2013
@@ -17,6 +17,7 @@
 #include "lldb/Core/Error.h"
 #include "lldb/Core/FileSpecList.h"
 #include "lldb/Core/Module.h"
+#include "lldb/Core/ModuleSpec.h"
 #include "lldb/Core/PluginManager.h"
 #include "lldb/Core/Section.h"
 #include "lldb/Core/Stream.h"
@@ -149,7 +150,8 @@ ObjectFileELF::Initialize()
     PluginManager::RegisterPlugin(GetPluginNameStatic(),
                                   GetPluginDescriptionStatic(),
                                   CreateInstance,
-                                  CreateMemoryInstance);
+                                  CreateMemoryInstance,
+                                  GetModuleSpecifications);
 }
 
 void
@@ -198,7 +200,7 @@ ObjectFileELF::CreateInstance (const lld
             unsigned address_size = ELFHeader::AddressSizeInBytes(magic);
             if (address_size == 4 || address_size == 8)
             {
-                std::auto_ptr<ObjectFileELF> objfile_ap(new ObjectFileELF(module_sp, data_sp, data_offset, file, file_offset, length));
+                std::unique_ptr<ObjectFileELF> objfile_ap(new ObjectFileELF(module_sp, data_sp, data_offset, file, file_offset, length));
                 ArchSpec spec;
                 if (objfile_ap->GetArchitecture(spec) &&
                     objfile_ap->SetModulesArchitecture(spec))
@@ -220,6 +222,17 @@ ObjectFileELF::CreateMemoryInstance (con
 }
 
 
+size_t
+ObjectFileELF::GetModuleSpecifications (const lldb_private::FileSpec& file,
+                                        lldb::DataBufferSP& data_sp,
+                                        lldb::offset_t data_offset,
+                                        lldb::offset_t file_offset,
+                                        lldb::offset_t length,
+                                        lldb_private::ModuleSpecList &specs)
+{
+    return 0;
+}
+
 //------------------------------------------------------------------
 // PluginInterface protocol
 //------------------------------------------------------------------

Modified: lldb/branches/windows/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/ObjectFile/ELF/ObjectFileELF.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/ObjectFile/ELF/ObjectFileELF.h (original)
+++ lldb/branches/windows/source/Plugins/ObjectFile/ELF/ObjectFileELF.h Thu Apr 25 07:31:53 2013
@@ -58,6 +58,13 @@ public:
                           const lldb::ProcessSP &process_sp, 
                           lldb::addr_t header_addr);
 
+    static size_t
+    GetModuleSpecifications (const lldb_private::FileSpec& file,
+                             lldb::DataBufferSP& data_sp,
+                             lldb::offset_t data_offset,
+                             lldb::offset_t file_offset,
+                             lldb::offset_t length,
+                             lldb_private::ModuleSpecList &specs);
     //------------------------------------------------------------------
     // PluginInterface protocol
     //------------------------------------------------------------------
@@ -155,7 +162,7 @@ private:
 
     /// List of file specifications corresponding to the modules (shared
     /// libraries) on which this object file depends.
-    mutable std::auto_ptr<lldb_private::FileSpecList> m_filespec_ap;
+    mutable std::unique_ptr<lldb_private::FileSpecList> m_filespec_ap;
 
     /// Data extractor holding the string table used to resolve section names.
     lldb_private::DataExtractor m_shstr_data;

Modified: lldb/branches/windows/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original)
+++ lldb/branches/windows/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Thu Apr 25 07:31:53 2013
@@ -19,6 +19,7 @@
 #include "lldb/Core/FileSpecList.h"
 #include "lldb/Core/Log.h"
 #include "lldb/Core/Module.h"
+#include "lldb/Core/ModuleSpec.h"
 #include "lldb/Core/PluginManager.h"
 #include "lldb/Core/RangeMap.h"
 #include "lldb/Core/Section.h"
@@ -43,14 +44,14 @@
 #include <dlfcn.h>
 #endif
 
+#ifndef __APPLE__
+#include "Utility/UuidCompatibility.h"
+#endif
+
 using namespace lldb;
 using namespace lldb_private;
 using namespace llvm::MachO;
 
-#ifdef _WIN32
-typedef char uuid_t[16];
-#endif
-
 class RegisterContextDarwin_x86_64_Mach : public RegisterContextDarwin_x86_64
 {
 public:
@@ -367,7 +368,8 @@ ObjectFileMachO::Initialize()
     PluginManager::RegisterPlugin (GetPluginNameStatic(),
                                    GetPluginDescriptionStatic(),
                                    CreateInstance,
-                                   CreateMemoryInstance);
+                                   CreateMemoryInstance,
+                                   GetModuleSpecifications);
 }
 
 void
@@ -411,7 +413,7 @@ ObjectFileMachO::CreateInstance (const l
             data_sp = file->MemoryMapFileContents(file_offset, length);
             data_offset = 0;
         }
-        std::auto_ptr<ObjectFile> objfile_ap(new ObjectFileMachO (module_sp, data_sp, data_offset, file, file_offset, length));
+        std::unique_ptr<ObjectFile> objfile_ap(new ObjectFileMachO (module_sp, data_sp, data_offset, file, file_offset, length));
         if (objfile_ap.get() && objfile_ap->ParseHeader())
             return objfile_ap.release();
     }
@@ -426,13 +428,54 @@ ObjectFileMachO::CreateMemoryInstance (c
 {
     if (ObjectFileMachO::MagicBytesMatch(data_sp, 0, data_sp->GetByteSize()))
     {
-        std::auto_ptr<ObjectFile> objfile_ap(new ObjectFileMachO (module_sp, data_sp, process_sp, header_addr));
+        std::unique_ptr<ObjectFile> objfile_ap(new ObjectFileMachO (module_sp, data_sp, process_sp, header_addr));
         if (objfile_ap.get() && objfile_ap->ParseHeader())
             return objfile_ap.release();
     }
     return NULL;
 }
 
+size_t
+ObjectFileMachO::GetModuleSpecifications (const lldb_private::FileSpec& file,
+                                          lldb::DataBufferSP& data_sp,
+                                          lldb::offset_t data_offset,
+                                          lldb::offset_t file_offset,
+                                          lldb::offset_t length,
+                                          lldb_private::ModuleSpecList &specs)
+{
+    const size_t initial_count = specs.GetSize();
+    
+    if (ObjectFileMachO::MagicBytesMatch(data_sp, 0, data_sp->GetByteSize()))
+    {
+        DataExtractor data;
+        data.SetData(data_sp);
+        llvm::MachO::mach_header header;
+        if (ParseHeader (data, &data_offset, header))
+        {
+            if (header.sizeofcmds >= data_sp->GetByteSize())
+            {
+                data_sp = file.ReadFileContents(file_offset, header.sizeofcmds);
+                data_offset = 0;
+            }
+            if (data_sp)
+            {
+                ModuleSpec spec;
+                spec.GetFileSpec() = file;
+                spec.GetArchitecture().SetArchitecture(eArchTypeMachO,
+                                                       header.cputype,
+                                                       header.cpusubtype);
+                if (spec.GetArchitecture().IsValid())
+                {
+                    GetUUID (header, data, data_offset, spec.GetUUID());
+                    specs.Append(spec);
+                }
+            }
+        }
+    }
+    return specs.GetSize() - initial_count;
+}
+
+
 
 const ConstString &
 ObjectFileMachO::GetSegmentNameTEXT()
@@ -541,6 +584,61 @@ ObjectFileMachO::~ObjectFileMachO()
 {
 }
 
+bool
+ObjectFileMachO::ParseHeader (DataExtractor &data,
+                              lldb::offset_t *data_offset_ptr,
+                              llvm::MachO::mach_header &header)
+{
+    data.SetByteOrder (lldb::endian::InlHostByteOrder());
+    // Leave magic in the original byte order
+    header.magic = data.GetU32(data_offset_ptr);
+    bool can_parse = false;
+    bool is_64_bit = false;
+    switch (header.magic)
+    {
+        case HeaderMagic32:
+            data.SetByteOrder (lldb::endian::InlHostByteOrder());
+            data.SetAddressByteSize(4);
+            can_parse = true;
+            break;
+            
+        case HeaderMagic64:
+            data.SetByteOrder (lldb::endian::InlHostByteOrder());
+            data.SetAddressByteSize(8);
+            can_parse = true;
+            is_64_bit = true;
+            break;
+            
+        case HeaderMagic32Swapped:
+            data.SetByteOrder(lldb::endian::InlHostByteOrder() == eByteOrderBig ? eByteOrderLittle : eByteOrderBig);
+            data.SetAddressByteSize(4);
+            can_parse = true;
+            break;
+            
+        case HeaderMagic64Swapped:
+            data.SetByteOrder(lldb::endian::InlHostByteOrder() == eByteOrderBig ? eByteOrderLittle : eByteOrderBig);
+            data.SetAddressByteSize(8);
+            is_64_bit = true;
+            can_parse = true;
+            break;
+            
+        default:
+            break;
+    }
+    
+    if (can_parse)
+    {
+        data.GetU32(data_offset_ptr, &header.cputype, 6);
+        if (is_64_bit)
+            *data_offset_ptr += 4;
+        return true;
+    }
+    else
+    {
+        memset(&header, 0, sizeof(header));
+    }
+    return false;
+}
 
 bool
 ObjectFileMachO::ParseHeader ()
@@ -848,25 +946,36 @@ ObjectFileMachO::ParseSections ()
                 load_cmd.filesize = m_data.GetAddress(&offset);
                 if (m_length != 0 && load_cmd.filesize != 0)
                 {
+                    if (load_cmd.fileoff > m_length)
+                    {
+                        // We have a load command that says it extends past the end of hte file.  This is likely
+                        // a corrupt file.  We don't have any way to return an error condition here (this method
+                        // was likely invokved from something like ObjectFile::GetSectionList()) -- all we can do
+                        // is null out the SectionList vector and if a process has been set up, dump a message
+                        // to stdout.  The most common case here is core file debugging with a truncated file.
+                        const char *lc_segment_name = load_cmd.cmd == LoadCommandSegment64 ? "LC_SEGMENT_64" : "LC_SEGMENT";
+                        GetModule()->ReportError("is a corrupt mach-o file: load command %u %s has a fileoff (0x%" PRIx64 ") that extends beyond the end of the file (0x%" PRIx64 ")",
+                                                 i,
+                                                 lc_segment_name,
+                                                 load_cmd.fileoff,
+                                                 m_length);
+                        m_sections_ap->Clear();
+                        return 0;
+                    }
+                    
                     if (load_cmd.fileoff + load_cmd.filesize > m_length)
                     {
                         // We have a load command that says it extends past the end of hte file.  This is likely
                         // a corrupt file.  We don't have any way to return an error condition here (this method
                         // was likely invokved from something like ObjectFile::GetSectionList()) -- all we can do
                         // is null out the SectionList vector and if a process has been set up, dump a message
-                        // to stdout.  The most common case here is core file debugging with a truncated file - and
-                        // in that case we don't have a Process yet so nothing will be printed.  Not really ideal;
-                        // the ObjectFile needs some way of reporting an error message for methods like GetSectionList
-                        // which fail.
-                        ProcessSP process_sp (m_process_wp.lock());
-                        if (process_sp)
-                        {
-                            Stream *s = &process_sp->GetTarget().GetDebugger().GetOutputStream();
-                            if (s)
-                            {
-                                s->Printf ("Corrupt/invalid Mach-O object file -- a load command extends past the end of the file.\n");
-                            }
-                        }
+                        // to stdout.  The most common case here is core file debugging with a truncated file.
+                        const char *lc_segment_name = load_cmd.cmd == LoadCommandSegment64 ? "LC_SEGMENT_64" : "LC_SEGMENT";
+                        GetModule()->ReportError("is a corrupt mach-o file: load command %u %s has a fileoff + filesize (0x%" PRIx64 ") that extends beyond the end of the file (0x%" PRIx64 ")",
+                                                 i,
+                                                 lc_segment_name,
+                                                 load_cmd.fileoff + load_cmd.filesize,
+                                                 m_length);
                         m_sections_ap->Clear();
                         return 0;
                     }
@@ -1388,6 +1497,10 @@ ObjectFileMachO::ParseSymtab (bool minim
                     if (lldb_shared_cache.IsValid() && process_shared_cache.IsValid() && lldb_shared_cache != process_shared_cache)
                     {
                             use_lldb_cache = false;
+                            ModuleSP module_sp (GetModule());
+                            if (module_sp)
+                                module_sp->ReportWarning ("shared cache in process does not match lldb's own shared cache, startup will be slow.");
+
                     }
 
                     PlatformSP platform_sp (target.GetPlatform());
@@ -1715,6 +1828,9 @@ ObjectFileMachO::ParseSymtab (bool minim
                         // The on-disk dyld_shared_cache file is not the same as the one in this
                         // process' memory, don't use it.
                         uuid_match = false;
+                        ModuleSP module_sp (GetModule());
+                        if (module_sp)
+                            module_sp->ReportWarning ("process shared cache does not match on-disk dyld_shared_cache file, some symbol names will be missing.");
                     }
                 }
 
@@ -3463,48 +3579,59 @@ ObjectFileMachO::Dump (Stream *s)
     }
 }
 
-
 bool
-ObjectFileMachO::GetUUID (lldb_private::UUID* uuid)
+ObjectFileMachO::GetUUID (const llvm::MachO::mach_header &header,
+                          const lldb_private::DataExtractor &data,
+                          lldb::offset_t lc_offset,
+                          lldb_private::UUID& uuid)
 {
-    ModuleSP module_sp(GetModule());
-    if (module_sp)
-    {
-        lldb_private::Mutex::Locker locker(module_sp->GetMutex());
+    uint32_t i;
         struct uuid_command load_cmd;
-        lldb::offset_t offset = MachHeaderSizeFromMagic(m_header.magic);
-        uint32_t i;
-        for (i=0; i<m_header.ncmds; ++i)
+
+    lldb::offset_t offset = lc_offset;
+    for (i=0; i<header.ncmds; ++i)
         {
             const lldb::offset_t cmd_offset = offset;
-            if (m_data.GetU32(&offset, &load_cmd, 2) == NULL)
+        if (data.GetU32(&offset, &load_cmd, 2) == NULL)
                 break;
-
+        
             if (load_cmd.cmd == LoadCommandUUID)
             {
-                const uint8_t *uuid_bytes = m_data.PeekData(offset, 16);
-
+            const uint8_t *uuid_bytes = data.PeekData(offset, 16);
+            
                 if (uuid_bytes)
                 {
                     // OpenCL on Mac OS X uses the same UUID for each of its object files.
                     // We pretend these object files have no UUID to prevent crashing.
-
+                
                     const uint8_t opencl_uuid[] = { 0x8c, 0x8e, 0xb3, 0x9b,
                                                     0x3b, 0xa8,
                                                     0x4b, 0x16,
                                                     0xb6, 0xa4,
                                                     0x27, 0x63, 0xbb, 0x14, 0xf0, 0x0d };
-
+                
                     if (!memcmp(uuid_bytes, opencl_uuid, 16))
                         return false;
-
-                    uuid->SetBytes (uuid_bytes);
+                
+                uuid.SetBytes (uuid_bytes);
                     return true;
                 }
                 return false;
             }
             offset = cmd_offset + load_cmd.cmdsize;
         }
+    return false;
+}
+
+bool
+ObjectFileMachO::GetUUID (lldb_private::UUID* uuid)
+{
+    ModuleSP module_sp(GetModule());
+    if (module_sp)
+    {
+        lldb_private::Mutex::Locker locker(module_sp->GetMutex());
+        lldb::offset_t offset = MachHeaderSizeFromMagic(m_header.magic);
+        return GetUUID (m_header, m_data, offset, *uuid);
     }
     return false;
 }
@@ -4031,12 +4158,10 @@ ObjectFileMachO::GetLLDBSharedCacheUUID
         uint8_t *dyld_all_image_infos_address = dyld_get_all_image_infos();
         if (dyld_all_image_infos_address)
         {
-            uint32_t version;
-            memcpy (&version, dyld_all_image_infos_address, 4);
-            if (version >= 13)
+            uint32_t *version = (uint32_t*) dyld_all_image_infos_address;              // version <mach-o/dyld_images.h>
+            if (*version >= 13)
             {
-                uint8_t *sharedCacheUUID_address = 0;
-                sharedCacheUUID_address = dyld_all_image_infos_address + 84;  // sharedCacheUUID <mach-o/dyld_images.h>
+                uuid_t *sharedCacheUUID_address = (uuid_t*) ((uint8_t*) dyld_all_image_infos_address + 84);  // sharedCacheUUID <mach-o/dyld_images.h>
                 uuid.SetBytes (sharedCacheUUID_address);
             }
         }

Modified: lldb/branches/windows/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h (original)
+++ lldb/branches/windows/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h Thu Apr 25 07:31:53 2013
@@ -55,6 +55,14 @@ public:
                           const lldb::ProcessSP &process_sp, 
                           lldb::addr_t header_addr);
 
+    static size_t
+    GetModuleSpecifications (const lldb_private::FileSpec& file,
+                             lldb::DataBufferSP& data_sp,
+                             lldb::offset_t data_offset,
+                             lldb::offset_t file_offset,
+                             lldb::offset_t length,
+                             lldb_private::ModuleSpecList &specs);
+
     static bool
     MagicBytesMatch (lldb::DataBufferSP& data_sp,
                      lldb::addr_t offset, 
@@ -146,7 +154,19 @@ public:
 
 protected:
 
-    // Intended for same-host arm device debugging where lldb needs to 
+    static bool
+    ParseHeader (lldb_private::DataExtractor &data,
+                 lldb::offset_t *data_offset_ptr,
+                 llvm::MachO::mach_header &header);
+    
+    
+    static bool
+    GetUUID (const llvm::MachO::mach_header &header,
+             const lldb_private::DataExtractor &data,
+             lldb::offset_t lc_offset, // Offset to the first load command
+             lldb_private::UUID& uuid);
+    
+    // Intended for same-host arm device debugging where lldb needs to
     // detect libraries in the shared cache and augment the nlist entries
     // with an on-disk dyld_shared_cache file.  The process will record
     // the shared cache UUID so the on-disk cache can be matched or rejected

Modified: lldb/branches/windows/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp (original)
+++ lldb/branches/windows/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp Thu Apr 25 07:31:53 2013
@@ -16,6 +16,7 @@
 #include "lldb/Host/FileSpec.h"
 #include "lldb/Core/FileSpecList.h"
 #include "lldb/Core/Module.h"
+#include "lldb/Core/ModuleSpec.h"
 #include "lldb/Core/PluginManager.h"
 #include "lldb/Core/Section.h"
 #include "lldb/Core/StreamFile.h"
@@ -124,7 +125,8 @@ ObjectFilePECOFF::Initialize()
     PluginManager::RegisterPlugin (GetPluginNameStatic(),
                                    GetPluginDescriptionStatic(),
                                    CreateInstance,
-                                   CreateMemoryInstance);
+                                   CreateMemoryInstance,
+                                   GetModuleSpecifications);
 }
 
 void
@@ -166,7 +168,7 @@ ObjectFilePECOFF::CreateInstance (const
         // Update the data to contain the entire file if it doesn't already
         if (data_sp->GetByteSize() < length)
             data_sp = file->MemoryMapFileContents(file_offset, length);
-        std::auto_ptr<ObjectFile> objfile_ap(new ObjectFilePECOFF (module_sp, data_sp, data_offset, file, file_offset, length));
+        std::unique_ptr<ObjectFile> objfile_ap(new ObjectFilePECOFF (module_sp, data_sp, data_offset, file, file_offset, length));
         if (objfile_ap.get() && objfile_ap->ParseHeader())
             return objfile_ap.release();
     }
@@ -182,6 +184,18 @@ ObjectFilePECOFF::CreateMemoryInstance (
     return NULL;
 }
 
+size_t
+ObjectFilePECOFF::GetModuleSpecifications (const lldb_private::FileSpec& file,
+                                           lldb::DataBufferSP& data_sp,
+                                           lldb::offset_t data_offset,
+                                           lldb::offset_t file_offset,
+                                           lldb::offset_t length,
+                                           lldb_private::ModuleSpecList &specs)
+{
+    return 0;
+}
+
+
 bool
 ObjectFilePECOFF::MagicBytesMatch (DataBufferSP& data_sp)
 {

Modified: lldb/branches/windows/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h (original)
+++ lldb/branches/windows/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h Thu Apr 25 07:31:53 2013
@@ -47,6 +47,15 @@ public:
                           lldb::DataBufferSP& data_sp, 
                           const lldb::ProcessSP &process_sp, 
                           lldb::addr_t header_addr);
+    
+    static size_t
+    GetModuleSpecifications (const lldb_private::FileSpec& file,
+                             lldb::DataBufferSP& data_sp,
+                             lldb::offset_t data_offset,
+                             lldb::offset_t file_offset,
+                             lldb::offset_t length,
+                             lldb_private::ModuleSpecList &specs);
+
     static bool
     MagicBytesMatch (lldb::DataBufferSP& data_sp);
     

Modified: lldb/branches/windows/source/Plugins/OperatingSystem/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/OperatingSystem/CMakeLists.txt?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/OperatingSystem/CMakeLists.txt (original)
+++ lldb/branches/windows/source/Plugins/OperatingSystem/CMakeLists.txt Thu Apr 25 07:31:53 2013
@@ -1,2 +1,4 @@
-#add_subdirectory(Darwin-Kernel)
+if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
+  add_subdirectory(Darwin-Kernel)
+endif()
 add_subdirectory(Python)

Modified: lldb/branches/windows/source/Plugins/OperatingSystem/Darwin-Kernel/OperatingSystemDarwinKernel.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/OperatingSystem/Darwin-Kernel/OperatingSystemDarwinKernel.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/OperatingSystem/Darwin-Kernel/OperatingSystemDarwinKernel.h (original)
+++ lldb/branches/windows/source/Plugins/OperatingSystem/Darwin-Kernel/OperatingSystemDarwinKernel.h Thu Apr 25 07:31:53 2013
@@ -84,7 +84,7 @@ protected:
     GetDynamicRegisterInfo ();
 
     lldb::ValueObjectSP m_thread_list_valobj_sp;
-    std::auto_ptr<DynamicRegisterInfo> m_register_info_ap;
+    std::unique_ptr<DynamicRegisterInfo> m_register_info_ap;
     
 };
 

Modified: lldb/branches/windows/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp (original)
+++ lldb/branches/windows/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp Thu Apr 25 07:31:53 2013
@@ -33,6 +33,7 @@
 #include "lldb/Target/ThreadList.h"
 #include "lldb/Target/Thread.h"
 #include "Plugins/Process/Utility/DynamicRegisterInfo.h"
+#include "Plugins/Process/Utility/RegisterContextDummy.h"
 #include "Plugins/Process/Utility/RegisterContextMemory.h"
 #include "Plugins/Process/Utility/ThreadMemory.h"
 
@@ -60,7 +61,7 @@ OperatingSystemPython::CreateInstance (P
     FileSpec python_os_plugin_spec (process->GetPythonOSPluginPath());
     if (python_os_plugin_spec && python_os_plugin_spec.Exists())
     {
-        std::auto_ptr<OperatingSystemPython> os_ap (new OperatingSystemPython (process, python_os_plugin_spec));
+        std::unique_ptr<OperatingSystemPython> os_ap (new OperatingSystemPython (process, python_os_plugin_spec));
         if (os_ap.get() && os_ap->IsValid())
             return os_ap.release();
     }
@@ -195,8 +196,6 @@ OperatingSystemPython::UpdateThreadList
     {
         ThreadList core_thread_list(new_thread_list);
 
-        threads_list.Dump(); // REMOVE THIS
-
         uint32_t i;
         const uint32_t num_threads = threads_list.GetSize();
         for (i=0; i<num_threads; ++i)
@@ -335,6 +334,13 @@ OperatingSystemPython::CreateRegisterCon
             }
         }
     }
+    // if we still have no register data, fallback on a dummy context to avoid crashing
+    if (!reg_ctx_sp)
+    {
+        if (log)
+            log->Printf ("OperatingSystemPython::CreateRegisterContextForThread (tid = 0x%" PRIx64 ") forcing a dummy register context", thread->GetID());
+        reg_ctx_sp.reset(new RegisterContextDummy(*thread,0,target.GetArchitecture().GetAddressByteSize()));
+    }
     return reg_ctx_sp;
 }
 

Modified: lldb/branches/windows/source/Plugins/OperatingSystem/Python/OperatingSystemPython.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/OperatingSystem/Python/OperatingSystemPython.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/OperatingSystem/Python/OperatingSystemPython.h (original)
+++ lldb/branches/windows/source/Plugins/OperatingSystem/Python/OperatingSystemPython.h Thu Apr 25 07:31:53 2013
@@ -101,7 +101,7 @@ protected:
     GetDynamicRegisterInfo ();
 
     lldb::ValueObjectSP m_thread_list_valobj_sp;
-    std::auto_ptr<DynamicRegisterInfo> m_register_info_ap;
+    std::unique_ptr<DynamicRegisterInfo> m_register_info_ap;
     lldb_private::ScriptInterpreter *m_interpreter;
     lldb::ScriptInterpreterObjectSP m_python_object_sp;
     

Modified: lldb/branches/windows/source/Plugins/Platform/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Platform/CMakeLists.txt?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Platform/CMakeLists.txt (original)
+++ lldb/branches/windows/source/Plugins/Platform/CMakeLists.txt Thu Apr 25 07:31:53 2013
@@ -3,3 +3,4 @@ add_subdirectory(gdb-server)
 add_subdirectory(Linux)
 add_subdirectory(MacOSX)
 add_subdirectory(Windows)
+

Modified: lldb/branches/windows/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp (original)
+++ lldb/branches/windows/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp Thu Apr 25 07:31:53 2013
@@ -224,7 +224,7 @@ public:
     }
 };
 
-typedef STD_SHARED_PTR(PlatformDarwinKernelProperties) PlatformDarwinKernelPropertiesSP;
+typedef std::shared_ptr<PlatformDarwinKernelProperties> PlatformDarwinKernelPropertiesSP;
 
 static const PlatformDarwinKernelPropertiesSP &
 GetGlobalProperties()
@@ -394,6 +394,12 @@ PlatformDarwinKernel::GetMacDirectoriesT
         directories.push_back(sle);
     }
 
+    FileSpec le("/Library/Extensions", true);
+    if (le.Exists() && le.GetFileType() == FileSpec::eFileTypeDirectory)
+    {
+        directories.push_back(le);
+    }
+
     FileSpec kdk("/Volumes/KernelDebugKit", true);
     if (kdk.Exists() && kdk.GetFileType() == FileSpec::eFileTypeDirectory)
     {

Modified: lldb/branches/windows/source/Plugins/Process/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Process/CMakeLists.txt?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/CMakeLists.txt (original)
+++ lldb/branches/windows/source/Plugins/Process/CMakeLists.txt Thu Apr 25 07:31:53 2013
@@ -1,13 +1,13 @@
-if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
-add_subdirectory(FreeBSD)
+if (CMAKE_SYSTEM_NAME MATCHES "Linux")
+  add_subdirectory(Linux)
+  add_subdirectory(POSIX)
+elseif (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
+  #add_subdirectory(FreeBSD)
+  add_subdirectory(POSIX)
+elseif (CMAKE_SYSTEM_NAME MATCHES "Darwin")
+  add_subdirectory(MacOSX-Kernel)
 endif()
+
 add_subdirectory(gdb-remote)
-if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
-add_subdirectory(Linux)
-endif()
-#add_subdirectory(mach-core)
-#add_subdirectory(MacOSx-Kernel)
-if(NOT(CMAKE_SYSTEM_NAME STREQUAL "Windows"))
-add_subdirectory(POSIX)
-endif()
 add_subdirectory(Utility)
+add_subdirectory(mach-core)

Modified: lldb/branches/windows/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp (original)
+++ lldb/branches/windows/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp Thu Apr 25 07:31:53 2013
@@ -691,7 +691,7 @@ ProcessMonitor::ProcessMonitor(ProcessPO
       m_client_fd(-1),
       m_server_fd(-1)
 {
-    std::auto_ptr<LaunchArgs> args;
+    std::unique_ptr<LaunchArgs> args;
 
     args.reset(new LaunchArgs(this, module, argv, envp,
                               stdin_path, stdout_path, stderr_path, working_dir));
@@ -752,7 +752,7 @@ ProcessMonitor::ProcessMonitor(ProcessPO
       m_client_fd(-1),
       m_server_fd(-1)
 {
-    std::auto_ptr<AttachArgs> args;
+    std::unique_ptr<AttachArgs> args;
 
     args.reset(new AttachArgs(this, pid));
 

Modified: lldb/branches/windows/source/Plugins/Process/Linux/ProcessMonitor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Process/Linux/ProcessMonitor.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/Linux/ProcessMonitor.cpp (original)
+++ lldb/branches/windows/source/Plugins/Process/Linux/ProcessMonitor.cpp Thu Apr 25 07:31:53 2013
@@ -924,7 +924,7 @@ ProcessMonitor::ProcessMonitor(ProcessPO
       m_client_fd(-1),
       m_server_fd(-1)
 {
-    std::auto_ptr<LaunchArgs> args;
+    std::unique_ptr<LaunchArgs> args;
 
     args.reset(new LaunchArgs(this, module, argv, envp,
                               stdin_path, stdout_path, stderr_path, working_dir));
@@ -984,7 +984,7 @@ ProcessMonitor::ProcessMonitor(ProcessPO
       m_client_fd(-1),
       m_server_fd(-1)
 {
-    std::auto_ptr<AttachArgs> args;
+    std::unique_ptr<AttachArgs> args;
 
     args.reset(new AttachArgs(this, pid));
 

Modified: lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp (original)
+++ lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp Thu Apr 25 07:31:53 2013
@@ -196,7 +196,7 @@ ProcessKDP::DoConnectRemote (Stream *str
         return error;
     }
 
-    std::auto_ptr<ConnectionFileDescriptor> conn_ap(new ConnectionFileDescriptor());
+    std::unique_ptr<ConnectionFileDescriptor> conn_ap(new ConnectionFileDescriptor());
     if (conn_ap.get())
     {
         // Only try once for now.

Modified: lldb/branches/windows/source/Plugins/Process/POSIX/POSIXThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Process/POSIX/POSIXThread.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/POSIX/POSIXThread.cpp (original)
+++ lldb/branches/windows/source/Plugins/Process/POSIX/POSIXThread.cpp Thu Apr 25 07:31:53 2013
@@ -37,7 +37,7 @@ using namespace lldb_private;
 
 POSIXThread::POSIXThread(Process &process, lldb::tid_t tid)
     : Thread(process, tid),
-      m_frame_ap(0)
+      m_frame_ap()
 {
     Log *log (ProcessPOSIXLog::GetLogIfAllCategoriesSet (POSIX_LOG_THREAD));
     if (log && log->GetMask().Test(POSIX_LOG_VERBOSE))

Modified: lldb/branches/windows/source/Plugins/Process/POSIX/POSIXThread.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Process/POSIX/POSIXThread.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/POSIX/POSIXThread.h (original)
+++ lldb/branches/windows/source/Plugins/Process/POSIX/POSIXThread.h Thu Apr 25 07:31:53 2013
@@ -81,7 +81,7 @@ private:
         return (RegisterContextPOSIX *)m_reg_context_sp.get();
     }
     
-    std::auto_ptr<lldb_private::StackFrame> m_frame_ap;
+    std::unique_ptr<lldb_private::StackFrame> m_frame_ap;
 
     lldb::BreakpointSiteSP m_breakpoint;
     lldb::StopInfoSP m_stop_info;

Modified: lldb/branches/windows/source/Plugins/Process/POSIX/RegisterContext_x86_64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Process/POSIX/RegisterContext_x86_64.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/POSIX/RegisterContext_x86_64.cpp (original)
+++ lldb/branches/windows/source/Plugins/Process/POSIX/RegisterContext_x86_64.cpp Thu Apr 25 07:31:53 2013
@@ -688,11 +688,55 @@ RegisterContext_x86_64::WriteRegister(co
                                            const lldb_private::RegisterValue &value)
 {
     const uint32_t reg = reg_info->kinds[eRegisterKindLLDB];
-    if (IsAVX(reg))
-        return false;
+    if (IsGPR(reg)) {
+        ProcessMonitor &monitor = GetMonitor();
+        return monitor.WriteRegisterValue(m_thread.GetID(), GetRegOffset(reg), value);
+    }
 
-    ProcessMonitor &monitor = GetMonitor();
-    return monitor.WriteRegisterValue(m_thread.GetID(), GetRegOffset(reg), value);
+    if (IsFPR(reg)) {
+        // Note that lldb uses slightly different naming conventions from sys/user.h
+        switch (reg)
+        {
+        default:
+            if (reg_info->encoding != eEncodingVector)
+                return false;
+
+            if (reg >= fpu_stmm0 && reg <= fpu_stmm7)
+               ::memcpy (user.i387.stmm[reg - fpu_stmm0].bytes, value.GetBytes(), value.GetByteSize());
+            
+            if (reg >= fpu_xmm0 && reg <= fpu_xmm15)
+               ::memcpy (user.i387.xmm[reg - fpu_xmm0].bytes, value.GetBytes(), value.GetByteSize());
+            break;
+        case fpu_dp:
+            user.i387.dp = value.GetAsUInt64();
+            break;
+        case fpu_fcw:
+            user.i387.fcw = value.GetAsUInt16();
+            break;
+        case fpu_fsw:
+            user.i387.fsw = value.GetAsUInt16();
+            break;
+        case fpu_ip:
+            user.i387.ip = value.GetAsUInt64();
+            break;
+        case fpu_fop:
+            user.i387.fop = value.GetAsUInt16();
+            break;
+        case fpu_ftw:
+            user.i387.ftw = value.GetAsUInt16();
+            break;
+        case fpu_mxcsr:
+            user.i387.mxcsr = value.GetAsUInt32();
+            break;
+        case fpu_mxcsrmask:
+            user.i387.mxcsrmask = value.GetAsUInt32();
+            break;
+        }
+        if (WriteFPR()) {
+            return true;
+        }
+    }
+    return false;
 }
 
 bool

Modified: lldb/branches/windows/source/Plugins/Process/Utility/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Process/Utility/CMakeLists.txt?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/Utility/CMakeLists.txt (original)
+++ lldb/branches/windows/source/Plugins/Process/Utility/CMakeLists.txt Thu Apr 25 07:31:53 2013
@@ -1,3 +1,5 @@
+include_directories(../../../Utility/)
+
 set(LLVM_NO_RTTI 1)
 
 add_lldb_library(lldbPluginProcessUtility
@@ -6,6 +8,7 @@ add_lldb_library(lldbPluginProcessUtilit
   RegisterContextDarwin_arm.cpp
   RegisterContextDarwin_i386.cpp
   RegisterContextDarwin_x86_64.cpp
+  RegisterContextDummy.cpp
   RegisterContextLLDB.cpp
   RegisterContextMach_arm.cpp
   RegisterContextMach_i386.cpp
@@ -16,4 +19,4 @@ add_lldb_library(lldbPluginProcessUtilit
   ThreadMemory.cpp
   UnwindLLDB.cpp
   UnwindMacOSXFrameBackchain.cpp
-  )
\ No newline at end of file
+  )

Modified: lldb/branches/windows/source/Plugins/Process/Utility/RegisterContextLLDB.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Process/Utility/RegisterContextLLDB.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/Utility/RegisterContextLLDB.h (original)
+++ lldb/branches/windows/source/Plugins/Process/Utility/RegisterContextLLDB.h Thu Apr 25 07:31:53 2013
@@ -25,7 +25,7 @@ class UnwindLLDB;
 class RegisterContextLLDB : public lldb_private::RegisterContext
 {
 public:
-    typedef STD_SHARED_PTR(RegisterContextLLDB) SharedPtr;
+    typedef std::shared_ptr<RegisterContextLLDB> SharedPtr;
 
     RegisterContextLLDB (lldb_private::Thread &thread,
                          const SharedPtr& next_frame,

Modified: lldb/branches/windows/source/Plugins/Process/Utility/StopInfoMachException.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Process/Utility/StopInfoMachException.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/Utility/StopInfoMachException.cpp (original)
+++ lldb/branches/windows/source/Plugins/Process/Utility/StopInfoMachException.cpp Thu Apr 25 07:31:53 2013
@@ -193,6 +193,8 @@ StopInfoMachException::GetDescription ()
                     case 0x101: code_desc = "EXC_ARM_DA_ALIGN"; break;
                     case 0x102: code_desc = "EXC_ARM_DA_DEBUG"; break;
                     case 1: code_desc = "EXC_ARM_BREAKPOINT"; break;
+                    // FIXME temporary workaround, exc_code 0 does not really mean EXC_ARM_BREAKPOINT
+                    case 0: code_desc = "EXC_ARM_BREAKPOINT"; break;
                     }
                     break;
 
@@ -419,6 +421,11 @@ StopInfoMachException::CreateStopReasonW
                     {
                         is_actual_breakpoint = true;
                         is_trace_if_actual_breakpoint_missing = true;
+                    }
+                    else if (exc_code == 0) // FIXME not EXC_ARM_BREAKPOINT but a kernel is currently returning this so accept it as indicating a breakpoint until the kernel is fixed
+                    {
+                        is_actual_breakpoint = true;
+                        is_trace_if_actual_breakpoint_missing = true;
                     }
                     break;
 

Modified: lldb/branches/windows/source/Plugins/Process/Utility/ThreadMemory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Process/Utility/ThreadMemory.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/Utility/ThreadMemory.cpp (original)
+++ lldb/branches/windows/source/Plugins/Process/Utility/ThreadMemory.cpp Thu Apr 25 07:31:53 2013
@@ -57,10 +57,10 @@ bool
 ThreadMemory::WillResume (StateType resume_state)
 {
     ClearStackFrames();
-    // Call the Thread::WillResume first. If we stop at a signal, the stop info
-    // class for signal will set the resume signal that we need below. The signal
-    // stuff obeys the Process::UnixSignal defaults. 
     Thread::WillResume(resume_state);
+
+    if (m_backing_thread_sp)
+        return m_backing_thread_sp->WillResume(resume_state);
     return true;
 }
 

Modified: lldb/branches/windows/source/Plugins/Process/Utility/ThreadMemory.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Process/Utility/ThreadMemory.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/Utility/ThreadMemory.h (original)
+++ lldb/branches/windows/source/Plugins/Process/Utility/ThreadMemory.h Thu Apr 25 07:31:53 2013
@@ -101,6 +101,12 @@ public:
         m_backing_thread_sp = thread_sp;
         return (bool)thread_sp;
     }
+    
+    virtual lldb::ThreadSP
+    GetBackingThread () const
+    {
+        return m_backing_thread_sp;
+    }
 
 protected:
     //------------------------------------------------------------------

Modified: lldb/branches/windows/source/Plugins/Process/Utility/UnwindLLDB.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Process/Utility/UnwindLLDB.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/Utility/UnwindLLDB.h (original)
+++ lldb/branches/windows/source/Plugins/Process/Utility/UnwindLLDB.h Thu Apr 25 07:31:53 2013
@@ -77,7 +77,7 @@ protected:
     lldb::RegisterContextSP
     DoCreateRegisterContextForFrame (lldb_private::StackFrame *frame);
 
-    typedef STD_SHARED_PTR(RegisterContextLLDB) RegisterContextLLDBSP;
+    typedef std::shared_ptr<RegisterContextLLDB> RegisterContextLLDBSP;
 
     // Needed to retrieve the "next" frame (e.g. frame 2 needs to retrieve frame 1's RegisterContextLLDB)
     // The RegisterContext for frame_num must already exist or this returns an empty shared pointer.
@@ -104,7 +104,7 @@ private:
         DISALLOW_COPY_AND_ASSIGN (Cursor);
     };
 
-    typedef STD_SHARED_PTR(Cursor) CursorSP;
+    typedef std::shared_ptr<Cursor> CursorSP;
     std::vector<CursorSP> m_frames;
     bool m_unwind_complete; // If this is true, we've enumerated all the frames in the stack, and m_frames.size() is the 
                             // number of frames, etc.  Otherwise we've only gone as far as directly asked, and m_frames.size()

Modified: lldb/branches/windows/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/branches/windows/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Thu Apr 25 07:31:53 2013
@@ -751,7 +751,7 @@ ProcessGDBRemote::ConnectToDebugserver (
 {
     Error error;
     // Sleep and wait a bit for debugserver to start to listen...
-    std::auto_ptr<ConnectionFileDescriptor> conn_ap(new ConnectionFileDescriptor());
+    std::unique_ptr<ConnectionFileDescriptor> conn_ap(new ConnectionFileDescriptor());
     if (conn_ap.get())
     {
         const uint32_t max_retry_count = 50;
@@ -1058,10 +1058,19 @@ ProcessGDBRemote::DoResume ()
     {
         listener.StartListeningForEvents (&m_async_broadcaster, ProcessGDBRemote::eBroadcastBitAsyncThreadDidExit);
         
+        const size_t num_threads = GetThreadList().GetSize();
+
         StreamString continue_packet;
         bool continue_packet_error = false;
         if (m_gdb_comm.HasAnyVContSupport ())
         {
+            if (m_continue_c_tids.size() == num_threads)
+            {
+                // All threads are continuing, just send a "c" packet
+                continue_packet.PutCString ("c");
+            }
+            else
+            {
             continue_packet.PutCString ("vCont");
         
             if (!m_continue_c_tids.empty())
@@ -1111,6 +1120,7 @@ ProcessGDBRemote::DoResume ()
             if (continue_packet_error)
                 continue_packet.GetString().clear();
         }
+        }
         else
             continue_packet_error = true;
         
@@ -1119,7 +1129,6 @@ ProcessGDBRemote::DoResume ()
             // Either no vCont support, or we tried to use part of the vCont
             // packet that wasn't supported by the remote GDB server.
             // We need to try and make a simple packet that can do our continue
-            const size_t num_threads = GetThreadList().GetSize();
             const size_t num_continue_c_tids = m_continue_c_tids.size();
             const size_t num_continue_C_tids = m_continue_C_tids.size();
             const size_t num_continue_s_tids = m_continue_s_tids.size();
@@ -1407,6 +1416,29 @@ ProcessGDBRemote::SetThreadStopInfo (Str
                     thread_sp = m_thread_list.FindThreadByID(tid, false);
                     if (!thread_sp)
                     {
+                        // If there is an operating system plug-in it might hiding the actual API
+                        // thread inside a ThreadMemory...
+                        if (GetOperatingSystem())
+                        {
+                            bool found_backing_thread = false;
+                            const uint32_t num_threads = m_thread_list.GetSize();
+                            for (uint32_t thread_idx = 0; thread_idx < num_threads; ++thread_idx)
+                            {
+                                thread_sp = m_thread_list.GetThreadAtIndex(thread_idx)->GetBackingThread();
+                                if (thread_sp && thread_sp->GetID() == tid)
+                                {
+                                    found_backing_thread = true;
+                                    break;
+                                }
+                            }
+                            
+                            if (!found_backing_thread)
+                                thread_sp.reset();
+                        }
+                    }
+                    
+                    if (!thread_sp)
+                    {
                         // Create the thread if we need to
                         thread_sp.reset (new ThreadGDBRemote (*this, tid));
                         m_thread_list.AddThread(thread_sp);

Modified: lldb/branches/windows/source/Plugins/Process/mach-core/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Process/mach-core/CMakeLists.txt?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/mach-core/CMakeLists.txt (original)
+++ lldb/branches/windows/source/Plugins/Process/mach-core/CMakeLists.txt Thu Apr 25 07:31:53 2013
@@ -1,3 +1,5 @@
+include_directories(../Utility)
+
 set(LLVM_NO_RTTI 1)
 
 add_lldb_library(lldbPluginProcessMachCore

Modified: lldb/branches/windows/source/Plugins/Process/mach-core/ProcessMachCore.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Process/mach-core/ProcessMachCore.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/mach-core/ProcessMachCore.h (original)
+++ lldb/branches/windows/source/Plugins/Process/mach-core/ProcessMachCore.h Thu Apr 25 07:31:53 2013
@@ -129,7 +129,7 @@ private:
     //------------------------------------------------------------------
     // For ProcessMachCore only
     //------------------------------------------------------------------
-    typedef lldb_private::Range<uint32_t, uint32_t> FileRange;
+    typedef lldb_private::Range<lldb::addr_t, lldb::addr_t> FileRange;
     typedef lldb_private::RangeDataVector<lldb::addr_t, lldb::addr_t, FileRange> VMRangeToFileOffset;
 
     VMRangeToFileOffset m_core_aranges;

Modified: lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp (original)
+++ lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp Thu Apr 25 07:31:53 2013
@@ -817,6 +817,9 @@ DWARFCompileUnit::Index (const uint32_t
                         func_methods.Insert (ConstString(name), die.GetOffset());
                     else
                         func_basenames.Insert (ConstString(name), die.GetOffset());
+
+                    if (!is_method && !mangled_cstr && !objc_method.IsValid(true))
+                        func_fullnames.Insert (ConstString(name), die.GetOffset());
                 }
                 if (mangled_cstr)
                 {
@@ -854,6 +857,8 @@ DWARFCompileUnit::Index (const uint32_t
                             func_fullnames.Insert (mangled.GetDemangledName(), die.GetOffset());
                     }
                 }
+                else
+                    func_fullnames.Insert (ConstString(name), die.GetOffset());
             }
             break;
         

Modified: lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h (original)
+++ lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h Thu Apr 25 07:31:53 2013
@@ -190,7 +190,7 @@ protected:
     const DWARFAbbreviationDeclarationSet *m_abbrevs;
     void *              m_user_data;
     DWARFDebugInfoEntry::collection m_die_array;    // The compile unit debug information entry item
-    std::auto_ptr<DWARFDebugAranges> m_func_aranges_ap;   // A table similar to the .debug_aranges table, but this one points to the exact DW_TAG_subprogram DIEs
+    std::unique_ptr<DWARFDebugAranges> m_func_aranges_ap;   // A table similar to the .debug_aranges table, but this one points to the exact DW_TAG_subprogram DIEs
     dw_addr_t           m_base_addr;
     dw_offset_t         m_offset;
     uint32_t            m_length;

Modified: lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h (original)
+++ lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h Thu Apr 25 07:31:53 2013
@@ -21,7 +21,7 @@ typedef std::multimap<const char*, dw_of
 typedef CStringToDIEMap::iterator CStringToDIEMapIter;
 typedef CStringToDIEMap::const_iterator CStringToDIEMapConstIter;
 
-typedef STD_SHARED_PTR(DWARFCompileUnit) DWARFCompileUnitSP;
+typedef std::shared_ptr<DWARFCompileUnit> DWARFCompileUnitSP;
 
 class DWARFDebugInfo
 {
@@ -77,7 +77,7 @@ protected:
     SymbolFileDWARF* m_dwarf2Data;
     typedef std::vector<DWARFCompileUnitSP>     CompileUnitColl;
     CompileUnitColl m_compile_units;
-    std::auto_ptr<DWARFDebugAranges> m_cu_aranges_ap; // A quick address to compile unit table
+    std::unique_ptr<DWARFDebugAranges> m_cu_aranges_ap; // A quick address to compile unit table
 
 private:
     // All parsing needs to be done partially any managed by this class as accessors are called.

Modified: lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.h (original)
+++ lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.h Thu Apr 25 07:31:53 2013
@@ -68,7 +68,7 @@ public:
         {
         }
 
-        typedef STD_SHARED_PTR(Prologue) shared_ptr;
+        typedef std::shared_ptr<Prologue> shared_ptr;
 
         uint32_t    total_length;   // The size in bytes of the statement information for this compilation unit (not including the total_length field itself).
         uint16_t    version;        // Version identifier for the statement information format.
@@ -135,7 +135,7 @@ public:
     //------------------------------------------------------------------
     struct LineTable
     {
-        typedef STD_SHARED_PTR(LineTable) shared_ptr;
+        typedef std::shared_ptr<LineTable> shared_ptr;
 
         LineTable() :
             prologue(),

Modified: lldb/branches/windows/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/branches/windows/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Thu Apr 25 07:31:53 2013
@@ -880,7 +880,7 @@ SymbolFileDWARF::ParseCompileUnitFunctio
                 func_name.SetValue(ConstString(name), false);
 
             FunctionSP func_sp;
-            std::auto_ptr<Declaration> decl_ap;
+            std::unique_ptr<Declaration> decl_ap;
             if (decl_file != 0 || decl_line != 0 || decl_column != 0)
                 decl_ap.reset(new Declaration (sc.comp_unit->GetSupportFiles().GetFileSpecAtIndex(decl_file), 
                                                decl_line, 
@@ -995,7 +995,7 @@ SymbolFileDWARF::ParseCompileUnitSupport
 struct ParseDWARFLineTableCallbackInfo
 {
     LineTable* line_table;
-    std::auto_ptr<LineSequence> sequence_ap;
+    std::unique_ptr<LineSequence> sequence_ap;
 };
 
 //----------------------------------------------------------------------
@@ -1060,7 +1060,7 @@ SymbolFileDWARF::ParseCompileUnitLineTab
             const dw_offset_t cu_line_offset = dwarf_cu_die->GetAttributeValueAsUnsigned(this, dwarf_cu, DW_AT_stmt_list, DW_INVALID_OFFSET);
             if (cu_line_offset != DW_INVALID_OFFSET)
             {
-                std::auto_ptr<LineTable> line_table_ap(new LineTable(sc.comp_unit));
+                std::unique_ptr<LineTable> line_table_ap(new LineTable(sc.comp_unit));
                 if (line_table_ap.get())
                 {
                     ParseDWARFLineTableCallbackInfo info;
@@ -1170,12 +1170,12 @@ SymbolFileDWARF::ParseFunctionBlocks
 
                     if (tag != DW_TAG_subprogram && (name != NULL || mangled_name != NULL))
                     {
-                        std::auto_ptr<Declaration> decl_ap;
+                        std::unique_ptr<Declaration> decl_ap;
                         if (decl_file != 0 || decl_line != 0 || decl_column != 0)
                             decl_ap.reset(new Declaration(sc.comp_unit->GetSupportFiles().GetFileSpecAtIndex(decl_file), 
                                                           decl_line, decl_column));
 
-                        std::auto_ptr<Declaration> call_ap;
+                        std::unique_ptr<Declaration> call_ap;
                         if (call_file != 0 || call_line != 0 || call_column != 0)
                             call_ap.reset(new Declaration(sc.comp_unit->GetSupportFiles().GetFileSpecAtIndex(call_file), 
                                                           call_line, call_column));
@@ -1273,15 +1273,26 @@ SymbolFileDWARF::ParseTemplateDIE (DWARF
                     }
                 }
                 
-                if (name && lldb_type && clang_type)
+                clang::ASTContext *ast = GetClangASTContext().getASTContext();
+                if (!clang_type)
+                    clang_type = ast->VoidTy.getAsOpaquePtr();
+
+                if (clang_type)
                 {
                     bool is_signed = false;
-                    template_param_infos.names.push_back(name);
+                    if (name && name[0])
+                        template_param_infos.names.push_back(name);
+                    else
+                        template_param_infos.names.push_back(NULL);
+    
                     clang::QualType clang_qual_type (clang::QualType::getFromOpaquePtr (clang_type));
-                    if (tag == DW_TAG_template_value_parameter && ClangASTContext::IsIntegerType (clang_type, is_signed) && uval64_valid)
+                    if (tag == DW_TAG_template_value_parameter &&
+                        lldb_type != NULL &&
+                        ClangASTContext::IsIntegerType (clang_type, is_signed) &&
+                        uval64_valid)
                     {
                         llvm::APInt apint (lldb_type->GetByteSize() * 8, uval64, is_signed);
-                        template_param_infos.args.push_back (clang::TemplateArgument (*GetClangASTContext().getASTContext(),
+                        template_param_infos.args.push_back (clang::TemplateArgument (*ast,
                                                                                       llvm::APSInt(apint),
                                                                                       clang_qual_type));
                     }
@@ -1435,7 +1446,7 @@ private:
     const char             *m_property_setter_name;
     const char             *m_property_getter_name;
     uint32_t                m_property_attributes;
-    std::auto_ptr<ClangASTMetadata> m_metadata_ap;
+    std::unique_ptr<ClangASTMetadata> m_metadata_ap;
 };
 
 struct BitfieldInfo

Modified: lldb/branches/windows/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h (original)
+++ lldb/branches/windows/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h Thu Apr 25 07:31:53 2013
@@ -13,7 +13,6 @@
 // C Includes
 // C++ Includes
 #include <list>
-#include <memory>
 #include <map>
 #include <vector>
 
@@ -567,15 +566,15 @@ protected:
     lldb_private::DataExtractor     m_data_apple_namespaces;
     lldb_private::DataExtractor     m_data_apple_objc;
 
-    // The auto_ptr items below are generated on demand if and when someone accesses
+    // The unique pointer items below are generated on demand if and when someone accesses
     // them through a non const version of this class.
-    std::auto_ptr<DWARFDebugAbbrev>     m_abbr;
-    std::auto_ptr<DWARFDebugInfo>       m_info;
-    std::auto_ptr<DWARFDebugLine>       m_line;
-    std::auto_ptr<DWARFMappedHash::MemoryTable> m_apple_names_ap;
-    std::auto_ptr<DWARFMappedHash::MemoryTable> m_apple_types_ap;
-    std::auto_ptr<DWARFMappedHash::MemoryTable> m_apple_namespaces_ap;
-    std::auto_ptr<DWARFMappedHash::MemoryTable> m_apple_objc_ap;
+    std::unique_ptr<DWARFDebugAbbrev>     m_abbr;
+    std::unique_ptr<DWARFDebugInfo>       m_info;
+    std::unique_ptr<DWARFDebugLine>       m_line;
+    std::unique_ptr<DWARFMappedHash::MemoryTable> m_apple_names_ap;
+    std::unique_ptr<DWARFMappedHash::MemoryTable> m_apple_types_ap;
+    std::unique_ptr<DWARFMappedHash::MemoryTable> m_apple_namespaces_ap;
+    std::unique_ptr<DWARFMappedHash::MemoryTable> m_apple_objc_ap;
     NameToDIE                           m_function_basename_index;  // All concrete functions
     NameToDIE                           m_function_fullname_index;  // All concrete functions
     NameToDIE                           m_function_method_index;    // All inlined functions
@@ -589,7 +588,7 @@ protected:
                                         m_using_apple_tables:1;
     lldb_private::LazyBool              m_supports_DW_AT_APPLE_objc_complete_type;
 
-    std::auto_ptr<DWARFDebugRanges>     m_ranges;
+    std::unique_ptr<DWARFDebugRanges>     m_ranges;
     UniqueDWARFASTTypeMap m_unique_ast_type_map;
     typedef llvm::SmallPtrSet<const DWARFDebugInfoEntry *, 4> DIEPointerSet;
     typedef llvm::DenseMap<const DWARFDebugInfoEntry *, clang::DeclContext *> DIEToDeclContextMap;

Modified: lldb/branches/windows/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h (original)
+++ lldb/branches/windows/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h Thu Apr 25 07:31:53 2013
@@ -142,7 +142,7 @@ protected:
         }
     };
     
-    typedef STD_SHARED_PTR(OSOInfo) OSOInfoSP;
+    typedef std::shared_ptr<OSOInfo> OSOInfoSP;
 
     typedef lldb_private::RangeDataVector<lldb::addr_t, lldb::addr_t, lldb::addr_t> FileRangeMap;
 

Modified: lldb/branches/windows/source/Plugins/SymbolVendor/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/SymbolVendor/CMakeLists.txt?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/SymbolVendor/CMakeLists.txt (original)
+++ lldb/branches/windows/source/Plugins/SymbolVendor/CMakeLists.txt Thu Apr 25 07:31:53 2013
@@ -1 +1,3 @@
-#add_subdirectory(MacOSX)
+if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
+  add_subdirectory(MacOSX)
+endif()

Modified: lldb/branches/windows/source/Plugins/SymbolVendor/MacOSX/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/SymbolVendor/MacOSX/CMakeLists.txt?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/SymbolVendor/MacOSX/CMakeLists.txt (original)
+++ lldb/branches/windows/source/Plugins/SymbolVendor/MacOSX/CMakeLists.txt Thu Apr 25 07:31:53 2013
@@ -1,5 +1,7 @@
 set(LLVM_NO_RTTI 1)
 
+include_directories(${LIBXML2_INCLUDE_DIR})
+
 add_lldb_library(lldbPluginSymbolVendorMacOSX
   SymbolVendorMacOSX.cpp
   )

Modified: lldb/branches/windows/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp (original)
+++ lldb/branches/windows/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp Thu Apr 25 07:31:53 2013
@@ -298,7 +298,7 @@ UnwindAssemblyInstEmulation::FirstNonPro
 UnwindAssembly *
 UnwindAssemblyInstEmulation::CreateInstance (const ArchSpec &arch)
 {
-    std::auto_ptr<EmulateInstruction> inst_emulator_ap (EmulateInstruction::FindPlugin (arch, eInstructionTypePrologueEpilogue, NULL));
+    std::unique_ptr<EmulateInstruction> inst_emulator_ap (EmulateInstruction::FindPlugin (arch, eInstructionTypePrologueEpilogue, NULL));
     // Make sure that all prologue instructions are handled
     if (inst_emulator_ap.get())
         return new UnwindAssemblyInstEmulation (arch, inst_emulator_ap.release());

Modified: lldb/branches/windows/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.h (original)
+++ lldb/branches/windows/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.h Thu Apr 25 07:31:53 2013
@@ -160,7 +160,7 @@ private:
     GetRegisterValue (const lldb_private::RegisterInfo &reg_info, 
                       lldb_private::RegisterValue &reg_value);
 
-    std::auto_ptr<lldb_private::EmulateInstruction> m_inst_emulator_ap;    
+    std::unique_ptr<lldb_private::EmulateInstruction> m_inst_emulator_ap;    
     lldb_private::AddressRange* m_range_ptr; 
     lldb_private::Thread* m_thread_ptr;
     lldb_private::UnwindPlan* m_unwind_plan_ptr;

Modified: lldb/branches/windows/source/Symbol/ClangASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Symbol/ClangASTContext.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/branches/windows/source/Symbol/ClangASTContext.cpp Thu Apr 25 07:31:53 2013
@@ -1194,6 +1194,10 @@ CreateTemplateParameterList (ASTContext
     for (size_t i=0; i<num_template_params; ++i)
     {
         const char *name = template_param_infos.names[i];
+        
+        IdentifierInfo *identifier_info = NULL;
+        if (name && name[0])
+            identifier_info = &ast->Idents.get(name);
         if (template_param_infos.args[i].getKind() == TemplateArgument::Integral)
         {
             template_param_decls.push_back (NonTypeTemplateParmDecl::Create (*ast,
@@ -1202,7 +1206,7 @@ CreateTemplateParameterList (ASTContext
                                                                              SourceLocation(), 
                                                                              depth, 
                                                                              i,
-                                                                             &ast->Idents.get(name), 
+                                                                             identifier_info,
                                                                              template_param_infos.args[i].getIntegralType(), 
                                                                              parameter_pack, 
                                                                              NULL));
@@ -1216,7 +1220,7 @@ CreateTemplateParameterList (ASTContext
                                                                           SourceLocation(),
                                                                           depth, 
                                                                           i,
-                                                                          &ast->Idents.get(name), 
+                                                                          identifier_info,
                                                                           is_typename,
                                                                           parameter_pack));
         }
@@ -1796,8 +1800,9 @@ ClangASTContext::AddMethodToCXXRecordTyp
     }
     else
     {   
-    
+        clang::StorageClass SC = is_static ? SC_Static : SC_None; 
         OverloadedOperatorKind op_kind = NUM_OVERLOADED_OPERATORS;
+
         if (IsOperator (name, op_kind))
         {
             if (op_kind != NUM_OVERLOADED_OPERATORS)
@@ -1815,7 +1820,7 @@ ClangASTContext::AddMethodToCXXRecordTyp
                                                          DeclarationNameInfo (ast->DeclarationNames.getCXXOperatorName (op_kind), SourceLocation()),
                                                          method_qual_type,
                                                          NULL, // TypeSourceInfo *
-                                                         SC_None,
+                                                         SC,
                                                          is_inline,
                                                          false /*is_constexpr*/,
                                                          SourceLocation());
@@ -1844,7 +1849,7 @@ ClangASTContext::AddMethodToCXXRecordTyp
                                                      DeclarationNameInfo (decl_name, SourceLocation()),
                                                      method_qual_type,
                                                      NULL, // TypeSourceInfo *
-                                                     SC_None,
+                                                     SC,
                                                      is_inline,
                                                      false /*is_constexpr*/,
                                                      SourceLocation());

Modified: lldb/branches/windows/source/Symbol/FuncUnwinders.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Symbol/FuncUnwinders.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Symbol/FuncUnwinders.cpp (original)
+++ lldb/branches/windows/source/Symbol/FuncUnwinders.cpp Thu Apr 25 07:31:53 2013
@@ -102,8 +102,8 @@ FuncUnwinders::GetUnwindPlanAtNonCallSit
     // information. We want to make sure if someone requests an unwind
     // plan, that they get one and don't run into a race condition where one
     // thread has started to create the unwind plan and has put it into 
-    // the auto_ptr member variable, and have another thread enter this function
-    // and return the partially filled pointer contained in the auto_ptr.
+    // the unique pointer member variable, and have another thread enter this function
+    // and return the partially filled pointer contained in the unique pointer.
     // We also want to make sure that we lock out other unwind plans from
     // being accessed until this one is done creating itself in case someone
     // had some code like:
@@ -128,8 +128,8 @@ FuncUnwinders::GetUnwindPlanFastUnwind (
     // information. We want to make sure if someone requests an unwind
     // plan, that they get one and don't run into a race condition where one
     // thread has started to create the unwind plan and has put it into 
-    // the auto_ptr member variable, and have another thread enter this function
-    // and return the partially filled pointer contained in the auto_ptr.
+    // the unique pointer member variable, and have another thread enter this function
+    // and return the partially filled pointer contained in the unique pointer.
     // We also want to make sure that we lock out other unwind plans from
     // being accessed until this one is done creating itself in case someone
     // had some code like:
@@ -154,8 +154,8 @@ FuncUnwinders::GetUnwindPlanArchitecture
     // information. We want to make sure if someone requests an unwind
     // plan, that they get one and don't run into a race condition where one
     // thread has started to create the unwind plan and has put it into 
-    // the auto_ptr member variable, and have another thread enter this function
-    // and return the partially filled pointer contained in the auto_ptr.
+    // the unique pointer member variable, and have another thread enter this function
+    // and return the partially filled pointer contained in the unique pointer.
     // We also want to make sure that we lock out other unwind plans from
     // being accessed until this one is done creating itself in case someone
     // had some code like:
@@ -190,8 +190,8 @@ FuncUnwinders::GetUnwindPlanArchitecture
     // information. We want to make sure if someone requests an unwind
     // plan, that they get one and don't run into a race condition where one
     // thread has started to create the unwind plan and has put it into 
-    // the auto_ptr member variable, and have another thread enter this function
-    // and return the partially filled pointer contained in the auto_ptr.
+    // the unique pointer member variable, and have another thread enter this function
+    // and return the partially filled pointer contained in the unique pointer.
     // We also want to make sure that we lock out other unwind plans from
     // being accessed until this one is done creating itself in case someone
     // had some code like:

Modified: lldb/branches/windows/source/Symbol/LineTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Symbol/LineTable.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Symbol/LineTable.cpp (original)
+++ lldb/branches/windows/source/Symbol/LineTable.cpp Thu Apr 25 07:31:53 2013
@@ -489,7 +489,7 @@ LineTable::GetContiguousFileAddressRange
 LineTable *
 LineTable::LinkLineTable (const FileRangeMap &file_range_map)
 {
-    std::auto_ptr<LineTable> line_table_ap (new LineTable (m_comp_unit));
+    std::unique_ptr<LineTable> line_table_ap (new LineTable (m_comp_unit));
     LineSequenceImpl sequence;
     const size_t count = m_entries.size();
     LineEntry line_entry;

Modified: lldb/branches/windows/source/Symbol/ObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Symbol/ObjectFile.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Symbol/ObjectFile.cpp (original)
+++ lldb/branches/windows/source/Symbol/ObjectFile.cpp Thu Apr 25 07:31:53 2013
@@ -13,6 +13,7 @@
 #include "lldb/Core/DataBufferHeap.h"
 #include "lldb/Core/Log.h"
 #include "lldb/Core/Module.h"
+#include "lldb/Core/ModuleSpec.h"
 #include "lldb/Core/PluginManager.h"
 #include "lldb/Core/RegularExpression.h"
 #include "lldb/Core/Section.h"
@@ -59,7 +60,7 @@ ObjectFile::FindPlugin (const lldb::Modu
                 {
                     for (uint32_t idx = 0; (create_object_container_callback = PluginManager::GetObjectContainerCreateCallbackAtIndex(idx)) != NULL; ++idx)
                     {
-                        std::auto_ptr<ObjectContainer> object_container_ap(create_object_container_callback(module_sp, data_sp, data_offset, file, file_offset, file_size));
+                        std::unique_ptr<ObjectContainer> object_container_ap(create_object_container_callback(module_sp, data_sp, data_offset, file, file_offset, file_size));
                         
                         if (object_container_ap.get())
                             object_file_sp = object_container_ap->GetObjectFile(file);
@@ -101,7 +102,7 @@ ObjectFile::FindPlugin (const lldb::Modu
                         // (like BSD archives caching the contained objects within an file).
                         for (uint32_t idx = 0; (create_object_container_callback = PluginManager::GetObjectContainerCreateCallbackAtIndex(idx)) != NULL; ++idx)
                         {
-                            std::auto_ptr<ObjectContainer> object_container_ap(create_object_container_callback(module_sp, data_sp, data_offset, file, file_offset, file_size));
+                            std::unique_ptr<ObjectContainer> object_container_ap(create_object_container_callback(module_sp, data_sp, data_offset, file, file_offset, file_size));
                             
                             if (object_container_ap.get())
                                 object_file_sp = object_container_ap->GetObjectFile(file);
@@ -133,7 +134,7 @@ ObjectFile::FindPlugin (const lldb::Modu
                 // an object file from the container.
                 for (uint32_t idx = 0; (create_object_container_callback = PluginManager::GetObjectContainerCreateCallbackAtIndex(idx)) != NULL; ++idx)
                 {
-                    std::auto_ptr<ObjectContainer> object_container_ap(create_object_container_callback(module_sp, data_sp, data_offset, file, file_offset, file_size));
+                    std::unique_ptr<ObjectContainer> object_container_ap(create_object_container_callback(module_sp, data_sp, data_offset, file, file_offset, file_size));
 
                     if (object_container_ap.get())
                         object_file_sp = object_container_ap->GetObjectFile(file);
@@ -184,8 +185,51 @@ ObjectFile::FindPlugin (const lldb::Modu
     return object_file_sp;
 }
 
-ObjectFile::ObjectFile (const lldb::ModuleSP &module_sp, 
-                        const FileSpec *file_spec_ptr, 
+size_t
+ObjectFile::GetModuleSpecifications (const FileSpec &file,
+                        lldb::offset_t file_offset,
+                                     ModuleSpecList &specs)
+{
+    DataBufferSP data_sp (file.ReadFileContents(file_offset, 512));
+    if (data_sp)
+        return ObjectFile::GetModuleSpecifications (file,                    // file spec
+                                                    data_sp,                 // data bytes
+                                                    0,                       // data offset
+                                                    file_offset,             // file offset
+                                                    data_sp->GetByteSize(),  // data length
+                                                    specs);
+    return 0;
+}
+
+size_t
+ObjectFile::GetModuleSpecifications (const lldb_private::FileSpec& file,
+                                     lldb::DataBufferSP& data_sp,
+                                     lldb::offset_t data_offset,
+                                     lldb::offset_t file_offset,
+                        lldb::offset_t length,
+                                     lldb_private::ModuleSpecList &specs)
+{
+    const size_t initial_count = specs.GetSize();
+    ObjectFileGetModuleSpecifications callback;
+    uint32_t i;
+    // Try the ObjectFile plug-ins
+    for (i = 0; (callback = PluginManager::GetObjectFileGetModuleSpecificationsCallbackAtIndex(i)) != NULL; ++i)
+    {
+        if (callback (file, data_sp, data_offset, file_offset, length, specs) > 0)
+            return specs.GetSize() - initial_count;
+    }
+
+    // Try the ObjectContainer plug-ins
+    for (i = 0; (callback = PluginManager::GetObjectContainerGetModuleSpecificationsCallbackAtIndex(i)) != NULL; ++i)
+    {
+        if (callback (file, data_sp, data_offset, file_offset, length, specs) > 0)
+            return specs.GetSize() - initial_count;
+    }
+    return 0;
+}
+
+ObjectFile::ObjectFile (const lldb::ModuleSP &module_sp,
+                        const FileSpec *file_spec_ptr,
                         lldb::offset_t file_offset,
                         lldb::offset_t length,
                         lldb::DataBufferSP& data_sp,
@@ -392,7 +436,7 @@ ObjectFile::ReadMemory (const ProcessSP
     DataBufferSP data_sp;
     if (process_sp)
     {
-        std::auto_ptr<DataBufferHeap> data_ap (new DataBufferHeap (byte_size, 0));
+        std::unique_ptr<DataBufferHeap> data_ap (new DataBufferHeap (byte_size, 0));
         Error error;
         const size_t bytes_read = process_sp->ReadMemory (addr, 
                                                           data_ap->GetBytes(), 

Modified: lldb/branches/windows/source/Symbol/SymbolFile.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Symbol/SymbolFile.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Symbol/SymbolFile.cpp (original)
+++ lldb/branches/windows/source/Symbol/SymbolFile.cpp Thu Apr 25 07:31:53 2013
@@ -21,7 +21,7 @@ using namespace lldb_private;
 SymbolFile*
 SymbolFile::FindPlugin (ObjectFile* obj_file)
 {
-    std::auto_ptr<SymbolFile> best_symfile_ap;
+    std::unique_ptr<SymbolFile> best_symfile_ap;
     if (obj_file != NULL)
     {
         // TODO: Load any plug-ins in the appropriate plug-in search paths and
@@ -32,7 +32,7 @@ SymbolFile::FindPlugin (ObjectFile* obj_
         SymbolFileCreateInstance create_callback;
         for (uint32_t idx = 0; (create_callback = PluginManager::GetSymbolFileCreateCallbackAtIndex(idx)) != NULL; ++idx)
         {
-            std::auto_ptr<SymbolFile> curr_symfile_ap(create_callback(obj_file));
+            std::unique_ptr<SymbolFile> curr_symfile_ap(create_callback(obj_file));
 
             if (curr_symfile_ap.get())
             {
@@ -40,7 +40,7 @@ SymbolFile::FindPlugin (ObjectFile* obj_
                 if (sym_file_abilities > best_symfile_abilities)
                 {
                     best_symfile_abilities = sym_file_abilities;
-                    best_symfile_ap = curr_symfile_ap;
+                    best_symfile_ap.reset (curr_symfile_ap.release());
                     // If any symbol file parser has all of the abilities, then
                     // we should just stop looking.
                     if ((kAllAbilities & sym_file_abilities) == kAllAbilities)

Modified: lldb/branches/windows/source/Symbol/SymbolVendor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Symbol/SymbolVendor.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Symbol/SymbolVendor.cpp (original)
+++ lldb/branches/windows/source/Symbol/SymbolVendor.cpp Thu Apr 25 07:31:53 2013
@@ -34,7 +34,7 @@ using namespace lldb_private;
 SymbolVendor*
 SymbolVendor::FindPlugin (const lldb::ModuleSP &module_sp, lldb_private::Stream *feedback_strm)
 {
-    std::auto_ptr<SymbolVendor> instance_ap;
+    std::unique_ptr<SymbolVendor> instance_ap;
     //----------------------------------------------------------------------
     // We currently only have one debug symbol parser...
     //----------------------------------------------------------------------

Modified: lldb/branches/windows/source/Symbol/Symtab.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Symbol/Symtab.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Symbol/Symtab.cpp (original)
+++ lldb/branches/windows/source/Symbol/Symtab.cpp Thu Apr 25 07:31:53 2013
@@ -1119,7 +1119,31 @@ Symtab::FindFunctionSymbols (const Const
 
     if (name_type_mask & (eFunctionNameTypeBase | eFunctionNameTypeFull))
     {
-        FindAllSymbolsWithNameAndType (name, eSymbolTypeCode, symbol_indexes);
+        std::vector<uint32_t> temp_symbol_indexes;
+        FindAllSymbolsWithNameAndType (name, eSymbolTypeAny, temp_symbol_indexes);
+
+        unsigned temp_symbol_indexes_size = temp_symbol_indexes.size();
+        if (temp_symbol_indexes_size > 0)
+        {
+            Mutex::Locker locker (m_mutex);
+            for (unsigned i = 0; i < temp_symbol_indexes_size; i++)
+            {
+                SymbolContext sym_ctx;
+                sym_ctx.symbol = SymbolAtIndex (temp_symbol_indexes[i]);
+                if (sym_ctx.symbol)
+                {
+                    switch (sym_ctx.symbol->GetType())
+                    {
+                    case eSymbolTypeCode:
+                    case eSymbolTypeResolver:
+                        symbol_indexes.push_back(temp_symbol_indexes[i]);
+                        break;
+                    default:
+                        break;
+    }
+                }
+            }
+        }
     }
     
     if (name_type_mask & eFunctionNameTypeBase)

Modified: lldb/branches/windows/source/Symbol/Type.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Symbol/Type.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Symbol/Type.cpp (original)
+++ lldb/branches/windows/source/Symbol/Type.cpp Thu Apr 25 07:31:53 2013
@@ -59,6 +59,7 @@ Type::Type
     clang_type_t clang_type,
     ResolveState clang_type_resolve_state
 ) :
+    std::enable_shared_from_this<Type> (),
     UserID (uid),
     m_name (name),
     m_symbol_file (symbol_file),
@@ -75,6 +76,7 @@ Type::Type
 }
 
 Type::Type () :
+    std::enable_shared_from_this<Type> (),
     UserID (0),
     m_name ("<INVALID TYPE>"),
     m_symbol_file (NULL),
@@ -92,6 +94,7 @@ Type::Type () :
 
 
 Type::Type (const Type &rhs) :
+    std::enable_shared_from_this<Type> (rhs),
     UserID (rhs),
     m_name (rhs.m_name),
     m_symbol_file (rhs.m_symbol_file),

Modified: lldb/branches/windows/source/Target/LanguageRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/LanguageRuntime.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/LanguageRuntime.cpp (original)
+++ lldb/branches/windows/source/Target/LanguageRuntime.cpp Thu Apr 25 07:31:53 2013
@@ -228,7 +228,7 @@ protected:
 LanguageRuntime*
 LanguageRuntime::FindPlugin (Process *process, lldb::LanguageType language)
 {
-    std::auto_ptr<LanguageRuntime> language_runtime_ap;
+    std::unique_ptr<LanguageRuntime> language_runtime_ap;
     LanguageRuntimeCreateInstance create_callback;
 
     for (uint32_t idx = 0;

Modified: lldb/branches/windows/source/Target/Memory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/Memory.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/Memory.cpp (original)
+++ lldb/branches/windows/source/Target/Memory.cpp Thu Apr 25 07:31:53 2013
@@ -178,7 +178,7 @@ MemoryCache::Read (addr_t addr,
             if (bytes_left > 0)
             {
                 assert ((curr_addr % cache_line_byte_size) == 0);
-                std::auto_ptr<DataBufferHeap> data_buffer_heap_ap(new DataBufferHeap (cache_line_byte_size, 0));
+                std::unique_ptr<DataBufferHeap> data_buffer_heap_ap(new DataBufferHeap (cache_line_byte_size, 0));
                 size_t process_bytes_read = m_process.ReadMemoryFromInferior (curr_addr, 
                                                                               data_buffer_heap_ap->GetBytes(), 
                                                                               data_buffer_heap_ap->GetByteSize(), 

Modified: lldb/branches/windows/source/Target/ObjCLanguageRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/ObjCLanguageRuntime.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/ObjCLanguageRuntime.cpp (original)
+++ lldb/branches/windows/source/Target/ObjCLanguageRuntime.cpp Thu Apr 25 07:31:53 2013
@@ -497,7 +497,7 @@ ObjCLanguageRuntime::GetDescriptorIterat
 ObjCLanguageRuntime::ObjCISA
 ObjCLanguageRuntime::GetParentClass(ObjCLanguageRuntime::ObjCISA isa)
 {
-    ClassDescriptorSP objc_class_sp (GetClassDescriptor(isa));
+    ClassDescriptorSP objc_class_sp (GetClassDescriptorFromISA(isa));
     if (objc_class_sp)
     {
         ClassDescriptorSP objc_super_class_sp (objc_class_sp->GetSuperclass());
@@ -517,7 +517,7 @@ ObjCLanguageRuntime::GetActualTypeName(O
 }
 
 ObjCLanguageRuntime::ClassDescriptorSP
-ObjCLanguageRuntime::GetClassDescriptor (const ConstString &class_name)
+ObjCLanguageRuntime::GetClassDescriptorFromClassName (const ConstString &class_name)
 {
     ISAToDescriptorIterator pos = GetDescriptorIterator (class_name);
     if (pos != m_isa_to_descriptor.end())
@@ -547,7 +547,7 @@ ObjCLanguageRuntime::GetClassDescriptor
                 Error error;
                 ObjCISA isa = process->ReadPointerFromMemory(isa_pointer, error);
                 if (isa != LLDB_INVALID_ADDRESS)
-                    objc_class_sp = GetClassDescriptor (isa);
+                    objc_class_sp = GetClassDescriptorFromISA (isa);
             }
         }
     }
@@ -572,7 +572,7 @@ ObjCLanguageRuntime::GetNonKVOClassDescr
 
 
 ObjCLanguageRuntime::ClassDescriptorSP
-ObjCLanguageRuntime::GetClassDescriptor (ObjCISA isa)
+ObjCLanguageRuntime::GetClassDescriptorFromISA (ObjCISA isa)
 {
     if (isa)
     {
@@ -589,7 +589,7 @@ ObjCLanguageRuntime::GetNonKVOClassDescr
 {
     if (isa)
     {
-        ClassDescriptorSP objc_class_sp = GetClassDescriptor (isa);
+        ClassDescriptorSP objc_class_sp = GetClassDescriptorFromISA (isa);
         if (objc_class_sp && objc_class_sp->IsValid())
         {
             if (!objc_class_sp->IsKVO())

Modified: lldb/branches/windows/source/Target/OperatingSystem.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/OperatingSystem.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/OperatingSystem.cpp (original)
+++ lldb/branches/windows/source/Target/OperatingSystem.cpp Thu Apr 25 07:31:53 2013
@@ -28,7 +28,7 @@ OperatingSystem::FindPlugin (Process *pr
         create_callback  = PluginManager::GetOperatingSystemCreateCallbackForPluginName (plugin_name);
         if (create_callback)
         {
-            std::auto_ptr<OperatingSystem> instance_ap(create_callback(process, true));
+            std::unique_ptr<OperatingSystem> instance_ap(create_callback(process, true));
             if (instance_ap.get())
                 return instance_ap.release();
         }
@@ -37,7 +37,7 @@ OperatingSystem::FindPlugin (Process *pr
     {
         for (uint32_t idx = 0; (create_callback = PluginManager::GetOperatingSystemCreateCallbackAtIndex(idx)) != NULL; ++idx)
         {
-            std::auto_ptr<OperatingSystem> instance_ap(create_callback(process, false));
+            std::unique_ptr<OperatingSystem> instance_ap(create_callback(process, false));
             if (instance_ap.get())
                 return instance_ap.release();
         }

Modified: lldb/branches/windows/source/Target/Platform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/Platform.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/Platform.cpp (original)
+++ lldb/branches/windows/source/Target/Platform.cpp Thu Apr 25 07:31:53 2013
@@ -109,7 +109,7 @@ Platform::FindPlugin (Process *process,
             {
                 arch = process->GetTarget().GetArchitecture();
             }
-            std::auto_ptr<Platform> instance_ap(create_callback(process, &arch));
+            std::unique_ptr<Platform> instance_ap(create_callback(process, &arch));
             if (instance_ap.get())
                 return instance_ap.release();
         }
@@ -118,7 +118,7 @@ Platform::FindPlugin (Process *process,
     {
         for (uint32_t idx = 0; (create_callback = PluginManager::GetPlatformCreateCallbackAtIndex(idx)) != NULL; ++idx)
         {
-            std::auto_ptr<Platform> instance_ap(create_callback(process, false));
+            std::unique_ptr<Platform> instance_ap(create_callback(process, false));
             if (instance_ap.get())
                 return instance_ap.release();
         }

Modified: lldb/branches/windows/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/Process.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/Process.cpp (original)
+++ lldb/branches/windows/source/Target/Process.cpp Thu Apr 25 07:31:53 2013
@@ -1024,7 +1024,9 @@ Process::Process(Target &target, Listene
     m_should_detach (false),
     m_next_event_action_ap(),
     m_public_run_lock (),
+#if defined(__APPLE__)
     m_private_run_lock (),
+#endif
     m_currently_handling_event(false),
     m_finalize_called(false),
     m_last_broadcast_state (eStateInvalid),
@@ -1032,7 +1034,6 @@ Process::Process(Target &target, Listene
     m_can_jit(eCanJITDontKnow)
 {
     CheckInWithManager ();
-	m_private_run_lock.WriteLock();
 
     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
     if (log)
@@ -1145,7 +1146,9 @@ Process::Finalize()
     // process around forever. These events need to be cleared out.
     m_private_state_listener.Clear();
     //m_public_run_lock.WriteUnlock();
+#if defined(__APPLE__)
     m_private_run_lock.WriteUnlock();
+#endif
     m_finalize_called = true;
 }
 
@@ -2358,6 +2361,60 @@ Process::ReadCStringFromMemory (addr_t a
 
 
 size_t
+Process::ReadStringFromMemory (addr_t addr, char *dst, size_t max_bytes, Error &error,
+                                size_t type_width)
+{
+    size_t total_bytes_read = 0;
+    if (dst && max_bytes && type_width && max_bytes >= type_width)
+    {
+        // Ensure a null terminator independent of the number of bytes that is read.
+        memset (dst, 0, max_bytes);
+        size_t bytes_left = max_bytes - type_width;
+
+        const char terminator[4] = {'\0', '\0', '\0', '\0'};
+        assert(sizeof(terminator) >= type_width &&
+               "Attempting to validate a string with more than 4 bytes per character!");
+
+        addr_t curr_addr = addr;
+        const size_t cache_line_size = m_memory_cache.GetMemoryCacheLineSize();
+        char *curr_dst = dst;
+
+        error.Clear();
+        while (bytes_left > 0 && error.Success())
+        {
+            addr_t cache_line_bytes_left = cache_line_size - (curr_addr % cache_line_size);
+            addr_t bytes_to_read = std::min<addr_t>(bytes_left, cache_line_bytes_left);
+            size_t bytes_read = ReadMemory (curr_addr, curr_dst, bytes_to_read, error);
+
+            if (bytes_read == 0)
+                break;
+
+            // Search for a null terminator of correct size and alignment in bytes_read
+            size_t aligned_start = total_bytes_read - total_bytes_read % type_width;
+            for (size_t i = aligned_start; i + type_width <= total_bytes_read + bytes_read; i += type_width)
+                if (::strncmp(&dst[i], terminator, type_width) == 0)
+                {
+                    error.Clear();
+                    return i;
+                }
+
+            total_bytes_read += bytes_read;
+            curr_dst += bytes_read;
+            curr_addr += bytes_read;
+            bytes_left -= bytes_read;
+        }
+    }
+    else
+    {
+        if (max_bytes)
+            error.SetErrorString("invalid arguments");
+    }
+    return total_bytes_read;
+}
+
+// Deprecated in favor of ReadStringFromMemory which has wchar support and correct code to find
+// null terminators.
+size_t
 Process::ReadCStringFromMemory (addr_t addr, char *dst, size_t dst_max_len, Error &result_error)
 {
     size_t total_cstr_len = 0;
@@ -3151,14 +3208,16 @@ Process::ConnectRemote (Stream *strm, co
         
             if (state == eStateStopped || state == eStateCrashed)
             {
-                // If we attached and actually have a process on the other end, then 
-                // this ended up being the equivalent of an attach.
-                CompleteAttach ();
-                
-                // This delays passing the stopped event to listeners till 
-                // CompleteAttach gets a chance to complete...
-                HandlePrivateEvent (event_sp);
+                if (m_public_run_lock.WriteTryLock())
+                {
+                    // If we attached and actually have a process on the other end, then 
+                    // this ended up being the equivalent of an attach.
+                    CompleteAttach ();
                 
+                    // This delays passing the stopped event to listeners till 
+                    // CompleteAttach gets a chance to complete...
+                    HandlePrivateEvent (event_sp);
+                }
             }
         }
 
@@ -3203,7 +3262,9 @@ Process::PrivateResume ()
             else
             {
                 m_mod_id.BumpResumeID();
+#if defined(__APPLE__)
                 m_private_run_lock.WriteLock();
+#endif
                 error = DoResume();
                 if (error.Success())
                 {
@@ -3212,10 +3273,12 @@ Process::PrivateResume ()
                     if (log)
                         log->Printf ("Process thinks the process has resumed.");
                 }
+#if defined(__APPLE__)
                 else
                 {
                     m_private_run_lock.WriteUnlock();
                 }
+#endif
             }
         }
         else
@@ -3584,8 +3647,9 @@ Process::ShouldBroadcastEvent (Event *ev
             // If we aren't going to stop, let the thread plans decide if we're going to report this event.
             // If no thread has an opinion, we don't report it.
             
+#if defined(__APPLE__)
             m_private_run_lock.WriteUnlock();
-
+#endif
             RefreshStateAfterStop ();
             if (ProcessEventData::GetInterruptedFromEvent (event_ptr))
             {
@@ -4044,6 +4108,12 @@ Process::ProcessEventData::DoOnRemoval (
         
         bool still_should_stop = false;
         
+        // Sometimes - for instance if we have a bug in the stub we are talking to, we stop but no thread has a
+        // valid stop reason.  In that case we should just stop, because we have no way of telling what the right
+        // thing to do is, and it's better to let the user decide than continue behind their backs.
+        
+        bool does_anybody_have_an_opinion = false;
+        
         for (idx = 0; idx < num_threads; ++idx)
         {
             curr_thread_list = m_process_sp->GetThreadList();
@@ -4071,6 +4141,7 @@ Process::ProcessEventData::DoOnRemoval (
             StopInfoSP stop_info_sp = thread_sp->GetStopInfo ();
             if (stop_info_sp && stop_info_sp->IsValid())
             {
+                does_anybody_have_an_opinion = true;
                 bool this_thread_wants_to_stop;
                 if (stop_info_sp->GetOverrideShouldStop())
                 {
@@ -4099,10 +4170,10 @@ Process::ProcessEventData::DoOnRemoval (
             }
         }
 
-		lldb::StateType state = m_process_sp->GetPrivateState();
-		if (state != eStateRunning && state != eStateCrashed && state != eStateDetached && state != eStateExited)
+        
+        if (m_process_sp->GetPrivateState() != eStateRunning)
         {
-            if (!still_should_stop)
+            if (!still_should_stop && does_anybody_have_an_opinion)
             {
                 // We've been asked to continue, so do that here.
                 SetRestarted(true);
@@ -4444,7 +4515,7 @@ Process::SetSTDIOFileDescriptor (int fil
 {
     // First set up the Read Thread for reading/handling process I/O
     
-    std::auto_ptr<ConnectionFileDescriptor> conn_ap (new ConnectionFileDescriptor (file_descriptor, true));
+    std::unique_ptr<ConnectionFileDescriptor> conn_ap (new ConnectionFileDescriptor (file_descriptor, true));
     
     if (conn_ap.get())
     {
@@ -4697,7 +4768,7 @@ Process::RunThreadPlan (ExecutionContext
                 one_thread_timeout.OffsetWithMicroSeconds(default_one_thread_timeout_usec);
             else
             {
-                uint64_t computed_timeout = computed_timeout = timeout_usec / 2;
+                uint64_t computed_timeout = timeout_usec / 2;
                 if (computed_timeout > default_one_thread_timeout_usec)
                     computed_timeout = default_one_thread_timeout_usec;
                 one_thread_timeout.OffsetWithMicroSeconds(computed_timeout);

Modified: lldb/branches/windows/source/Target/StackFrameList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/StackFrameList.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/StackFrameList.cpp (original)
+++ lldb/branches/windows/source/Target/StackFrameList.cpp Thu Apr 25 07:31:53 2013
@@ -717,7 +717,7 @@ StackFrameList::InvalidateFrames (uint32
 }
 
 void
-StackFrameList::Merge (std::auto_ptr<StackFrameList>& curr_ap, lldb::StackFrameListSP& prev_sp)
+StackFrameList::Merge (std::unique_ptr<StackFrameList>& curr_ap, lldb::StackFrameListSP& prev_sp)
 {
     Mutex::Locker curr_locker (curr_ap.get() ? &curr_ap->m_mutex : NULL);
     Mutex::Locker prev_locker (prev_sp.get() ? &prev_sp->m_mutex : NULL);

Modified: lldb/branches/windows/source/Target/StopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/StopInfo.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/StopInfo.cpp (original)
+++ lldb/branches/windows/source/Target/StopInfo.cpp Thu Apr 25 07:31:53 2013
@@ -387,79 +387,36 @@ protected:
                     // First run the condition for the breakpoint.  If that says we should stop, then we'll run
                     // the callback for the breakpoint.  If the callback says we shouldn't stop that will win.                    
                     
-                    bool condition_says_stop = true;
                     if (bp_loc_sp->GetConditionText() != NULL)
                     {
-                        // We need to make sure the user sees any parse errors in their condition, so we'll hook the
-                        // constructor errors up to the debugger's Async I/O.
+                        Error condition_error;
+                        bool condition_says_stop = bp_loc_sp->ConditionSaysStop(exe_ctx, condition_error);
                         
-                        ValueObjectSP result_valobj_sp;
-                        
-                        ExecutionResults result_code;
-                        ValueObjectSP result_value_sp;
-                        const bool unwind_on_error = true;
-                        const bool ignore_breakpoints = true;
-                        Error error;
-                        result_code = ClangUserExpression::EvaluateWithError (exe_ctx,
-                                                                              eExecutionPolicyOnlyWhenNeeded,
-                                                                              lldb::eLanguageTypeUnknown,
-                                                                              ClangUserExpression::eResultTypeAny,
-                                                                              unwind_on_error,
-                                                                              ignore_breakpoints,
-                                                                              bp_loc_sp->GetConditionText(),
-                                                                              NULL,
-                                                                              result_value_sp,
-                                                                              error,
-                                                                              true,
-                                                                              ClangUserExpression::kDefaultTimeout);
-                        if (result_code == eExecutionCompleted)
-                        {
-                            if (result_value_sp)
-                            {
-                                Scalar scalar_value;
-                                if (result_value_sp->ResolveValue (scalar_value))
-                                {
-                                    if (scalar_value.ULongLong(1) == 0)
-                                        condition_says_stop = false;
-                                    else
-                                        condition_says_stop = true;
-                                    if (log)
-                                        log->Printf("Condition successfully evaluated, result is %s.\n", 
-                                                    m_should_stop ? "true" : "false");
-                                }
-                                else
-                                {
-                                    condition_says_stop = true;
-                                    if (log)
-                                        log->Printf("Failed to get an integer result from the expression.");
-                                }
-                            }
-                        }
-                        else
+                        if (!condition_error.Success())
                         {
                             Debugger &debugger = exe_ctx.GetTargetRef().GetDebugger();
                             StreamSP error_sp = debugger.GetAsyncErrorStream ();
                             error_sp->Printf ("Stopped due to an error evaluating condition of breakpoint ");
                             bp_loc_sp->GetDescription (error_sp.get(), eDescriptionLevelBrief);
-                            error_sp->Printf (": \"%s\"", 
+                            error_sp->Printf (": \"%s\"",
                                               bp_loc_sp->GetConditionText());
                             error_sp->EOL();
-                            const char *err_str = error.AsCString("<Unknown Error>");
+                            const char *err_str = condition_error.AsCString("<Unknown Error>");
                             if (log)
                                 log->Printf("Error evaluating condition: \"%s\"\n", err_str);
                             
                             error_sp->PutCString (err_str);
-                            error_sp->EOL();                       
+                            error_sp->EOL();
                             error_sp->Flush();
                             // If the condition fails to be parsed or run, we should stop.
                             condition_says_stop = true;
                         }
+                        else
+                        {
+                            if (!condition_says_stop)
+                                continue;
+                        }
                     }
-                                            
-                    // If this location's condition says we should aren't going to stop, 
-                    // then don't run the callback for this location.
-                    if (!condition_says_stop)
-                        continue;
                                 
                     bool callback_says_stop;
                     

Modified: lldb/branches/windows/source/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/Target.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/Target.cpp (original)
+++ lldb/branches/windows/source/Target/Target.cpp Thu Apr 25 07:31:53 2013
@@ -76,9 +76,9 @@ Target::Target(Debugger &debugger, const
     m_valid (true),
     m_search_filter_sp (),
     m_image_search_paths (ImageSearchPathsChanged, this),
-    m_scratch_ast_context_ap (NULL),
-    m_scratch_ast_source_ap (NULL),
-    m_ast_importer_ap (NULL),
+    m_scratch_ast_context_ap (),
+    m_scratch_ast_source_ap (),
+    m_ast_importer_ap (),
     m_persistent_variables (),
     m_source_manager_ap(),
     m_stop_hooks (),
@@ -296,11 +296,14 @@ Target::CreateBreakpoint (const FileSpec
     {
         filter_sp = GetSearchFilterForModuleList (containingModules);
     }
+    if (skip_prologue == eLazyBoolCalculate)
+        skip_prologue = GetSkipPrologue() ? eLazyBoolYes : eLazyBoolNo;
+
     BreakpointResolverSP resolver_sp(new BreakpointResolverFileLine (NULL,
                                                                      file,
                                                                      line_no,
                                                                      check_inlines,
-                                                                     skip_prologue == eLazyBoolCalculate ? GetSkipPrologue() : skip_prologue));
+                                                                     skip_prologue));
     return CreateBreakpoint (filter_sp, resolver_sp, internal);
 }
 
@@ -343,12 +346,15 @@ Target::CreateBreakpoint (const FileSpec
     if (func_name)
     {
         SearchFilterSP filter_sp(GetSearchFilterForModuleAndCUList (containingModules, containingSourceFiles));
-        
+
+        if (skip_prologue == eLazyBoolCalculate)
+            skip_prologue = GetSkipPrologue() ? eLazyBoolYes : eLazyBoolNo;
+
         BreakpointResolverSP resolver_sp (new BreakpointResolverName (NULL, 
                                                                       func_name, 
                                                                       func_name_type_mask, 
                                                                       Breakpoint::Exact, 
-                                                                      skip_prologue == eLazyBoolCalculate ? GetSkipPrologue() : skip_prologue));
+                                                                      skip_prologue));
         bp_sp = CreateBreakpoint (filter_sp, resolver_sp, internal);
     }
     return bp_sp;
@@ -367,11 +373,14 @@ Target::CreateBreakpoint (const FileSpec
     if (num_names > 0)
     {
         SearchFilterSP filter_sp(GetSearchFilterForModuleAndCUList (containingModules, containingSourceFiles));
-        
-        BreakpointResolverSP resolver_sp (new BreakpointResolverName (NULL, 
+
+        if (skip_prologue == eLazyBoolCalculate)
+            skip_prologue = GetSkipPrologue() ? eLazyBoolYes : eLazyBoolNo;
+
+        BreakpointResolverSP resolver_sp (new BreakpointResolverName (NULL,
                                                                       func_names,
                                                                       func_name_type_mask,
-                                                                      skip_prologue == eLazyBoolCalculate ? GetSkipPrologue() : skip_prologue));
+                                                                      skip_prologue));
         bp_sp = CreateBreakpoint (filter_sp, resolver_sp, internal);
     }
     return bp_sp;
@@ -391,11 +400,14 @@ Target::CreateBreakpoint (const FileSpec
     {
         SearchFilterSP filter_sp(GetSearchFilterForModuleAndCUList (containingModules, containingSourceFiles));
         
-        BreakpointResolverSP resolver_sp (new BreakpointResolverName (NULL, 
+        if (skip_prologue == eLazyBoolCalculate)
+            skip_prologue = GetSkipPrologue() ? eLazyBoolYes : eLazyBoolNo;
+
+        BreakpointResolverSP resolver_sp (new BreakpointResolverName (NULL,
                                                                       func_names,
                                                                       num_names, 
                                                                       func_name_type_mask,
-                                                                      skip_prologue == eLazyBoolCalculate ? GetSkipPrologue() : skip_prologue));
+                                                                      skip_prologue));
         bp_sp = CreateBreakpoint (filter_sp, resolver_sp, internal);
     }
     return bp_sp;
@@ -2143,7 +2155,7 @@ Target::StopHook::StopHook (lldb::Target
         m_target_sp (target_sp),
         m_commands (),
         m_specifier_sp (),
-        m_thread_spec_ap(NULL),
+        m_thread_spec_ap(),
         m_active (true)
 {
 }
@@ -2153,7 +2165,7 @@ Target::StopHook::StopHook (const StopHo
         m_target_sp (rhs.m_target_sp),
         m_commands (rhs.m_commands),
         m_specifier_sp (rhs.m_specifier_sp),
-        m_thread_spec_ap (NULL),
+        m_thread_spec_ap (),
         m_active (rhs.m_active)
 {
     if (rhs.m_thread_spec_ap.get() != NULL)

Modified: lldb/branches/windows/source/Target/TargetList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/TargetList.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/TargetList.cpp (original)
+++ lldb/branches/windows/source/Target/TargetList.cpp Thu Apr 25 07:31:53 2013
@@ -17,11 +17,13 @@
 #include "lldb/Core/Debugger.h"
 #include "lldb/Core/Event.h"
 #include "lldb/Core/Module.h"
+#include "lldb/Core/ModuleSpec.h"
 #include "lldb/Core/State.h"
 #include "lldb/Core/Timer.h"
 #include "lldb/Host/Host.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
 #include "lldb/Interpreter/OptionGroupPlatform.h"
+#include "lldb/Symbol/ObjectFile.h"
 #include "lldb/Target/Platform.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/TargetList.h"
@@ -80,8 +82,67 @@ TargetList::CreateTarget (Debugger &debu
             return error;
         }
     }
-
+    
     ArchSpec platform_arch(arch);
+
+    
+    if (user_exe_path && user_exe_path[0])
+    {
+        ModuleSpecList module_specs;
+        ModuleSpec module_spec;
+        module_spec.GetFileSpec().SetFile(user_exe_path, true);
+        lldb::offset_t file_offset = 0;
+        const size_t num_specs = ObjectFile::GetModuleSpecifications (module_spec.GetFileSpec(), file_offset, module_specs);
+        if (num_specs > 0)
+        {
+            ModuleSpec matching_module_spec;
+
+            if (num_specs == 1)
+            {
+                if (module_specs.GetModuleSpecAtIndex(0, matching_module_spec))
+                {
+                    if (platform_arch.IsValid())
+                    {
+                        if (!platform_arch.IsCompatibleMatch(matching_module_spec.GetArchitecture()))
+                        {
+                            error.SetErrorStringWithFormat("the specified architecture '%s' is not compatible with '%s' in '%s%s%s'",
+                                                           platform_arch.GetTriple().str().c_str(),
+                                                           matching_module_spec.GetArchitecture().GetTriple().str().c_str(),
+                                                           module_spec.GetFileSpec().GetDirectory() ? module_spec.GetFileSpec().GetDirectory().GetCString() : "",
+                                                           module_spec.GetFileSpec().GetDirectory() ? "/" : "",
+                                                           module_spec.GetFileSpec().GetFilename().GetCString());
+                            return error;
+                        }
+                    }
+                    else
+                    {
+                        // Only one arch and none was specified
+                        platform_arch = matching_module_spec.GetArchitecture();
+                    }
+                }
+            }
+            else
+            {
+                if (arch.IsValid())
+                {
+                    module_spec.GetArchitecture() = arch;
+                    if (module_specs.FindMatchingModuleSpec(module_spec, matching_module_spec))
+                    {
+                        platform_arch = matching_module_spec.GetArchitecture();
+                    }
+                }
+                else
+                {
+                    // No arch specified, select the first arch
+                    if (module_specs.GetModuleSpecAtIndex(0, matching_module_spec))
+                    {
+                        platform_arch = matching_module_spec.GetArchitecture();
+                    }
+                }
+            }
+        }
+    }
+
     CommandInterpreter &interpreter = debugger.GetCommandInterpreter();
     if (platform_options)
     {
@@ -162,6 +223,10 @@ TargetList::CreateTarget (Debugger &debu
         arch = specified_arch;
 
     FileSpec file (user_exe_path, false);
+    if (!file.Exists() && user_exe_path && user_exe_path[0] == '~')
+    {
+        file = FileSpec(user_exe_path, true);
+    }
     bool user_exe_path_is_bundle = false;
     char resolved_bundle_exe_path[PATH_MAX];
     resolved_bundle_exe_path[0] = '\0';

Modified: lldb/branches/windows/source/Target/Thread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/Thread.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/Thread.cpp (original)
+++ lldb/branches/windows/source/Target/Thread.cpp Thu Apr 25 07:31:53 2013
@@ -542,8 +542,11 @@ Thread::WillResume (StateType resume_sta
     // We distinguish between the plan on the top of the stack and the lower
     // plans in case a plan needs to do any special business before it runs.
     
+    bool need_to_resume = false;
     ThreadPlan *plan_ptr = GetCurrentPlan();
-    bool need_to_resume = plan_ptr->WillResume(resume_state, true);
+    if (plan_ptr)
+    {
+        need_to_resume = plan_ptr->WillResume(resume_state, true);
 
     while ((plan_ptr = GetPreviousPlan(plan_ptr)) != NULL)
     {
@@ -557,6 +560,7 @@ Thread::WillResume (StateType resume_sta
     {
         m_actual_stop_info_sp.reset();
     }
+    }
 
     return need_to_resume;
 }
@@ -571,6 +575,7 @@ bool
 Thread::ShouldStop (Event* event_ptr)
 {
     ThreadPlan *current_plan = GetCurrentPlan();
+    
     bool should_stop = true;
 
     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
@@ -955,8 +960,8 @@ Thread::GetCurrentPlan ()
 {
     // There will always be at least the base plan.  If somebody is mucking with a
     // thread with an empty plan stack, we should assert right away.
-    assert (!m_plan_stack.empty());
-
+    if (m_plan_stack.empty())
+        return NULL;
     return m_plan_stack.back().get();
 }
 

Modified: lldb/branches/windows/source/Target/ThreadList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/ThreadList.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/ThreadList.cpp (original)
+++ lldb/branches/windows/source/Target/ThreadList.cpp Thu Apr 25 07:31:53 2013
@@ -232,7 +232,18 @@ ThreadList::ShouldStop (Event *event_ptr
     }
 
     bool did_anybody_stop_for_a_reason = false;
-    bool should_stop = false;    
+    bool should_stop = false;
+    
+    // Now we run through all the threads and get their stop info's.  We want to make sure to do this first before
+    // we start running the ShouldStop, because one thread's ShouldStop could destroy information (like deleting a
+    // thread specific breakpoint another thread had stopped at) which could lead us to compute the StopInfo incorrectly.
+    // We don't need to use it here, we just want to make sure it gets computed.
+    
+    for (pos = threads_copy.begin(); pos != end; ++pos)
+    {
+        ThreadSP thread_sp(*pos);
+        thread_sp->GetStopInfo();
+    }
     
     for (pos = threads_copy.begin(); pos != end; ++pos)
     {

Modified: lldb/branches/windows/source/Target/UnwindAssembly.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/UnwindAssembly.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/UnwindAssembly.cpp (original)
+++ lldb/branches/windows/source/Target/UnwindAssembly.cpp Thu Apr 25 07:31:53 2013
@@ -24,7 +24,7 @@ UnwindAssembly::FindPlugin (const ArchSp
          (create_callback = PluginManager::GetUnwindAssemblyCreateCallbackAtIndex(idx)) != NULL;
          ++idx)
     {
-        std::auto_ptr<UnwindAssembly> assembly_profiler_ap (create_callback (arch));
+        std::unique_ptr<UnwindAssembly> assembly_profiler_ap (create_callback (arch));
         if (assembly_profiler_ap.get ())
             return assembly_profiler_ap.release ();
     }

Modified: lldb/branches/windows/source/Utility/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Utility/CMakeLists.txt?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Utility/CMakeLists.txt (original)
+++ lldb/branches/windows/source/Utility/CMakeLists.txt Thu Apr 25 07:31:53 2013
@@ -10,4 +10,3 @@ add_lldb_library(lldbUtility
   StringExtractorGDBRemote.cpp
   TimeSpecTimeout.cpp
   )
-

Modified: lldb/branches/windows/source/Utility/KQueue.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Utility/KQueue.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/source/Utility/KQueue.h (original)
+++ lldb/branches/windows/source/Utility/KQueue.h Thu Apr 25 07:31:53 2013
@@ -20,7 +20,7 @@
 #include <sys/event.h>
 #include <sys/time.h>
 
-#include "lldb-defines.h"
+#include "lldb/lldb-defines.h"
 
 namespace lldb_private {
 

Modified: lldb/branches/windows/test/api/check_public_api_headers/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/api/check_public_api_headers/Makefile?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/test/api/check_public_api_headers/Makefile (original)
+++ lldb/branches/windows/test/api/check_public_api_headers/Makefile Thu Apr 25 07:31:53 2013
@@ -9,6 +9,11 @@ else
     LD_EXTRAS ?= $(LLDB_LIB_DIR)/liblldb.so
 endif
 
+# If no c++ std was specified on CXXFLAGS, use c++11
+ifeq (,$(findstring -std=c++,$(CXXFLAGS)))
+  CFLAGS_EXTRAS := -std=c++11
+endif
+
 # Example dictionary to pass to the Python build method:
 # 
 # FRAMEWORK_INCLUDES=-F/Volumes/data/lldb/svn/trunk/build/Debug

Modified: lldb/branches/windows/test/dosep.ty
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/dosep.ty?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/test/dosep.ty (original)
+++ lldb/branches/windows/test/dosep.ty Thu Apr 25 07:31:53 2013
@@ -4,7 +4,7 @@
 Run the test suite using a separate process for each test file.
 """
 
-import os, sys
+import os, sys, platform
 from optparse import OptionParser
 
 # Command template of the invocation of the test driver.
@@ -48,15 +48,15 @@ Run lldb test suite using a separate pro
     opts, args = parser.parse_args()
     dotest_options = opts.dotest_options
 
-    print "dotest.py options:", dotest_options
-
+    system_info = " ".join(platform.uname())
     (failed, passed) = walk_and_invoke(test_root, dotest_options)
     num_tests = len(failed) + len(passed)
+
     print "Ran %d tests." % num_tests
     if len(failed) > 0:
         print "Failing Tests (%d)" % len(failed)
         for f in failed:
-          print "FAIL: LLDB :: (%s)" % f
+          print "FAIL: LLDB (suite) :: %s (%s)" % (f, system_info)
         sys.exit(1)
     sys.exit(0)
 

Modified: lldb/branches/windows/test/functionalities/completion/TestCompletion.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/completion/TestCompletion.py?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/completion/TestCompletion.py (original)
+++ lldb/branches/windows/test/functionalities/completion/TestCompletion.py Thu Apr 25 07:31:53 2013
@@ -29,7 +29,6 @@ class CommandLineCompletionTestCase(Test
         """Test that 'de' completes to 'detach '."""
         self.complete_from_to('de', 'detach ')
 
-    @expectedFailureLinux # PR-14425: completion broken for strings that begin with --
     def test_process_attach_dash_dash_con(self):
         """Test that 'process attach --con' completes to 'process attach --continue '."""
         self.complete_from_to('process attach --con', 'process attach --continue ')

Modified: lldb/branches/windows/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py (original)
+++ lldb/branches/windows/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py Thu Apr 25 07:31:53 2013
@@ -28,19 +28,140 @@ class ObjCDataFormatterTestCase(TestBase
         self.buildDwarf()
         self.plain_data_formatter_commands()
 
+    def appkit_tester_impl(self,builder,commands):
+        builder()
+        self.appkit_common_data_formatters_command()
+        commands()
+
     @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
     @dsym_test
-    def test_appkit_with_dsym_and_run_command(self):
-        """Test formatters for AppKit classes."""
-        self.buildDsym()
-        self.appkit_data_formatter_commands()
+    def test_nsnumber_with_dsym_and_run_command(self):
+        """Test formatters for NSNumber."""
+        self.appkit_tester_impl(self.buildDsym,self.nsnumber_data_formatter_commands)
 
     @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
     @dwarf_test
-    def test_appkit_with_dwarf_and_run_command(self):
-        """Test formatters for AppKit classes."""
-        self.buildDwarf()
-        self.appkit_data_formatter_commands()
+    def test_nsnumber_with_dwarf_and_run_command(self):
+        """Test formatters for NSNumber."""
+        self.appkit_tester_impl(self.buildDwarf,self.nsnumber_data_formatter_commands)
+
+
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+    @dsym_test
+    def test_nsstring_with_dsym_and_run_command(self):
+        """Test formatters for NSString."""
+        self.appkit_tester_impl(self.buildDsym,self.nsstring_data_formatter_commands)
+
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+    @dwarf_test
+    def test_nsstring_with_dwarf_and_run_command(self):
+        """Test formatters for NSString."""
+        self.appkit_tester_impl(self.buildDwarf,self.nsstring_data_formatter_commands)
+
+
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+    @dsym_test
+    def test_nscontainers_with_dsym_and_run_command(self):
+        """Test formatters for NS container classes."""
+        self.appkit_tester_impl(self.buildDsym,self.nscontainers_data_formatter_commands)
+
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+    @dwarf_test
+    def test_nscontainers_with_dwarf_and_run_command(self):
+        """Test formatters for  NS container classes."""
+        self.appkit_tester_impl(self.buildDwarf,self.nscontainers_data_formatter_commands)
+
+
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+    @dsym_test
+    def test_nsdata_with_dsym_and_run_command(self):
+        """Test formatters for NSData."""
+        self.appkit_tester_impl(self.buildDsym,self.nsdata_data_formatter_commands)
+
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+    @dwarf_test
+    def test_nsdata_with_dwarf_and_run_command(self):
+        """Test formatters for  NSData."""
+        self.appkit_tester_impl(self.buildDwarf,self.nsdata_data_formatter_commands)
+
+
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+    @dsym_test
+    def test_nsurl_with_dsym_and_run_command(self):
+        """Test formatters for NSURL."""
+        self.appkit_tester_impl(self.buildDsym,self.nsurl_data_formatter_commands)
+
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+    @dwarf_test
+    def test_nsurl_with_dwarf_and_run_command(self):
+        """Test formatters for NSURL."""
+        self.appkit_tester_impl(self.buildDwarf,self.nsurl_data_formatter_commands)
+
+
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+    @dsym_test
+    def test_nserror_with_dsym_and_run_command(self):
+        """Test formatters for NSError."""
+        self.appkit_tester_impl(self.buildDsym,self.nserror_data_formatter_commands)
+
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+    @dwarf_test
+    def test_nserror_with_dwarf_and_run_command(self):
+        """Test formatters for NSError."""
+        self.appkit_tester_impl(self.buildDwarf,self.nserror_data_formatter_commands)
+
+
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+    @dsym_test
+    def test_nsbundle_with_dsym_and_run_command(self):
+        """Test formatters for NSBundle."""
+        self.appkit_tester_impl(self.buildDsym,self.nsbundle_data_formatter_commands)
+
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+    @dwarf_test
+    def test_nsbundle_with_dwarf_and_run_command(self):
+        """Test formatters for NSBundle."""
+        self.appkit_tester_impl(self.buildDwarf,self.nsbundle_data_formatter_commands)
+
+
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+    @dsym_test
+    def test_nsexception_with_dsym_and_run_command(self):
+        """Test formatters for NSException."""
+        self.appkit_tester_impl(self.buildDsym,self.nsexception_data_formatter_commands)
+
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+    @dwarf_test
+    def test_nsexception_with_dwarf_and_run_command(self):
+        """Test formatters for NSException."""
+        self.appkit_tester_impl(self.buildDwarf,self.nsexception_data_formatter_commands)
+
+
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+    @dsym_test
+    def test_nsmisc_with_dsym_and_run_command(self):
+        """Test formatters for misc NS classes."""
+        self.appkit_tester_impl(self.buildDsym,self.nsmisc_data_formatter_commands)
+
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+    @dwarf_test
+    def test_nsmisc_with_dwarf_and_run_command(self):
+        """Test formatters for misc NS classes."""
+        self.appkit_tester_impl(self.buildDwarf,self.nsmisc_data_formatter_commands)
+
+
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+    @dsym_test
+    def test_nsdate_with_dsym_and_run_command(self):
+        """Test formatters for NSDate."""
+        self.appkit_tester_impl(self.buildDsym,self.nsdate_data_formatter_commands)
+
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+    @dwarf_test
+    def test_nsdate_with_dwarf_and_run_command(self):
+        """Test formatters for NSDate."""
+        self.appkit_tester_impl(self.buildDwarf,self.nsdate_data_formatter_commands)
+
 
     @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
     @dsym_test
@@ -189,7 +310,18 @@ class ObjCDataFormatterTestCase(TestBase
         self.expect("frame variable *object",
                     substrs = ['a test']);
 
-    def appkit_data_formatter_commands(self):
+        self.expect('frame variable myclass',
+                    substrs = ['(Class) myclass = NSValue'])
+        self.expect('frame variable myclass2',
+                    substrs = ['(Class) myclass2 = __NSCFConstantString'])
+        self.expect('frame variable myclass3',
+                    substrs = ['(Class) myclass3 = Molecule'])
+        self.expect('frame variable myclass4',
+                    substrs = ['(Class) myclass4 = NSMutableArray'])
+        self.expect('frame variable myclass5',
+                    substrs = ['(Class) myclass5 = nil'])
+
+    def appkit_common_data_formatters_command(self):
         """Test formatters for AppKit classes."""
         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
 
@@ -211,7 +343,8 @@ class ObjCDataFormatterTestCase(TestBase
 
         # Execute the cleanup function during test case tear down.
         self.addTearDownHook(cleanup)
-
+    
+    def nsnumber_data_formatter_commands(self):
         # Now enable AppKit and check we are displaying Cocoa classes correctly
         self.expect('frame variable num1 num2 num3 num4 num5 num6 num7 num8_Y num8_N num9',
                     substrs = ['(NSNumber *) num1 = ',' (int)5',
@@ -234,7 +367,7 @@ class ObjCDataFormatterTestCase(TestBase
                     '(NSNumber *) num_at3 = ',' (double)12.5',
                     '(NSNumber *) num_at4 = ',' (double)-12.5'])
 
-        
+    def nsstring_data_formatter_commands(self):
         self.expect('frame variable str0 str1 str2 str3 str4 str5 str6 str8 str9 str10 str11 label1 label2 processName str12',
                     substrs = ['(NSString *) str1 = ',' @"A rather short ASCII NSString object is here"',
                     '(NSString *) str0 = ',' @"255"',
@@ -251,7 +384,16 @@ class ObjCDataFormatterTestCase(TestBase
                     '(NSString *) label1 = ',' @"Process Name: "',
                     '(NSString *) label2 = ',' @"Process Id: "',
                     '(NSString *) str12 = ',' @"Process Name:  a.out Process Id:'])
+        self.expect('frame variable attrString mutableAttrString mutableGetConst',
+                    substrs = ['(NSAttributedString *) attrString = ',' @"hello world from foo"',
+                    '(NSAttributedString *) mutableAttrString = ',' @"hello world from foo"',
+                    '(NSString *) mutableGetConst = ',' @"foo said this string needs to be very long so much longer than whatever other string has been seen ever before by anyone of the mankind that of course this is still not long enough given what foo our friend foo our lovely dearly friend foo desired of us so i am adding more stuff here for the sake of it and for the joy of our friend who is named guess what just foo. hence, dear friend foo, stay safe, your string is now  long enough to accommodate your testing need and I will make sure that if not we extend it with even more fuzzy random meaningless words pasted one after the other from a long tiresome friday evening spent working in my office. my office mate went home but I am still randomly typing just for the fun of seeing what happens of the length of a Mutable String in Cocoa if it goes beyond one byte.. so be it, dear foo"'])
 
+        self.expect('expr -d run-target -- path',substrs = ['usr/blah/stuff'])
+        self.expect('frame variable path',substrs = ['usr/blah/stuff'])
+
+
+    def nscontainers_data_formatter_commands(self):
         self.expect('frame variable newArray newDictionary newMutableDictionary cfdict_ref mutable_dict_ref cfarray_ref mutable_array_ref',
                     substrs = ['(NSArray *) newArray = ','@"50 objects"',
                     '(NSDictionary *) newDictionary = ',' 12 key/value pairs',
@@ -261,14 +403,18 @@ class ObjCDataFormatterTestCase(TestBase
                     '(CFArrayRef) cfarray_ref = ','@"3 objects"',
                     '(CFMutableArrayRef) mutable_array_ref = ','@"11 objects"'])
 
-        self.expect('frame variable attrString mutableAttrString mutableGetConst',
-                    substrs = ['(NSAttributedString *) attrString = ',' @"hello world from foo"',
-                    '(NSAttributedString *) mutableAttrString = ',' @"hello world from foo"',
-                    '(NSString *) mutableGetConst = ',' @"foo said this string needs to be very long so much longer than whatever other string has been seen ever before by anyone of the mankind that of course this is still not long enough given what foo our friend foo our lovely dearly friend foo desired of us so i am adding more stuff here for the sake of it and for the joy of our friend who is named guess what just foo. hence, dear friend foo, stay safe, your string is now  long enough to accommodate your testing need and I will make sure that if not we extend it with even more fuzzy random meaningless words pasted one after the other from a long tiresome friday evening spent working in my office. my office mate went home but I am still randomly typing just for the fun of seeing what happens of the length of a Mutable String in Cocoa if it goes beyond one byte.. so be it, dear foo"'])
+        self.expect('frame variable nscounted_set',
+                    substrs = ['(NSCountedSet *) nscounted_set = ','5 objects'])
 
-        self.expect('expr -d run-target -- path',substrs = ['usr/blah/stuff'])
-        self.expect('frame variable path',substrs = ['usr/blah/stuff'])
+        self.expect('frame variable iset1 iset2 imset',
+                    substrs = ['4 indexes','512 indexes','10 indexes'])
+
+        self.expect('frame variable mutable_bag_ref cfbag_ref binheap_ref',
+                    substrs = ['(CFMutableBagRef) mutable_bag_ref = ','@"17 values"',
+                    '(CFBagRef) cfbag_ref = ','@"15 values"',
+                    '(CFBinaryHeapRef) binheap_ref = ','@"21 items"'])
 
+    def nsdata_data_formatter_commands(self):
         self.expect('frame variable immutableData mutableData data_ref mutable_data_ref mutable_string_ref',
                     substrs = ['(NSData *) immutableData = ',' 4 bytes',
                     '(NSData *) mutableData = ',' 14 bytes',
@@ -276,11 +422,7 @@ class ObjCDataFormatterTestCase(TestBase
                     '(CFMutableDataRef) mutable_data_ref = ','@"5 bytes"',
                     '(CFMutableStringRef) mutable_string_ref = ',' @"Wish ya knew"'])
 
-        self.expect('frame variable mutable_bag_ref cfbag_ref binheap_ref',
-                    substrs = ['(CFMutableBagRef) mutable_bag_ref = ','@"17 values"',
-                    '(CFBagRef) cfbag_ref = ','@"15 values"',
-                    '(CFBinaryHeapRef) binheap_ref = ','@"21 items"'])
-
+    def nsurl_data_formatter_commands(self):
         self.expect('frame variable cfurl_ref cfchildurl_ref cfgchildurl_ref',
                     substrs = ['(CFURLRef) cfurl_ref = ','@"http://www.foo.bar',
                     'cfchildurl_ref = ','@"page.html -- http://www.foo.bar',
@@ -291,6 +433,7 @@ class ObjCDataFormatterTestCase(TestBase
                     '(NSURL *) nsurl2 =','@"page.html -- http://www.foo.bar',
                     '(NSURL *) nsurl3 = ','@"?whatever -- http://www.foo.bar/page.html"'])
 
+    def nserror_data_formatter_commands(self):
         self.expect('frame variable nserror',
                     substrs = ['domain: @"Foobar" - code: 12'])
 
@@ -300,23 +443,20 @@ class ObjCDataFormatterTestCase(TestBase
         self.expect('frame variable nserror->_userInfo --ptr-depth 1 -d run-target',
                     substrs = ['@"a"','@"b"',"1","2"])
 
+    def nsbundle_data_formatter_commands(self):
         self.expect('frame variable bundle_string bundle_url main_bundle',
                     substrs = ['(NSBundle *) bundle_string = ',' @"/System/Library/Frameworks/Accelerate.framework"',
                     '(NSBundle *) bundle_url = ',' @"/System/Library/Frameworks/Cocoa.framework"',
                     '(NSBundle *) main_bundle = ','test/functionalities/data-formatter/data-formatter-objc'])
 
+    def nsexception_data_formatter_commands(self):
         self.expect('frame variable except0 except1 except2 except3',
                     substrs = ['(NSException *) except0 = ','name:@"TheGuyWhoHasNoName" reason:@"cuz it\'s funny"',
                     '(NSException *) except1 = ','name:@"TheGuyWhoHasNoName~1" reason:@"cuz it\'s funny"',
                     '(NSException *) except2 = ','name:@"TheGuyWhoHasNoName`2" reason:@"cuz it\'s funny"',
                     '(NSException *) except3 = ','name:@"TheGuyWhoHasNoName/3" reason:@"cuz it\'s funny"'])
 
-        self.expect('frame variable port',
-                    substrs = ['(NSMachPort *) port = ',' mach port: '])
-
-        self.expect('frame variable date1 date2',
-                    substrs = ['1985-04','2011-01'])
-
+    def nsmisc_data_formatter_commands(self):
         self.expect('frame variable localhost',
                     substrs = ['<NSHost ','> localhost ((','"127.0.0.1"'])
 
@@ -326,6 +466,13 @@ class ObjCDataFormatterTestCase(TestBase
         self.expect('frame variable range_value',
                     substrs = ['NSRange: {4, 4}'])
 
+        self.expect('frame variable port',
+                    substrs = ['(NSMachPort *) port = ',' mach port: '])
+
+    def nsdate_data_formatter_commands(self):
+        self.expect('frame variable date1 date2',
+                    substrs = ['1985-04','2011-01'])
+
         # this test might fail if we hit the breakpoint late on December 31st of some given year
         # and midnight comes between hitting the breakpoint and running this line of code
         # hopefully the output will be revealing enough in that case :-)
@@ -340,43 +487,18 @@ class ObjCDataFormatterTestCase(TestBase
         self.expect('frame variable date3_abs date4_abs',
                     substrs = [now_year,'1970'])
 
-        #self.runCmd('mem read `&date4_abs`')
-
-        #self.runCmd('mem read `nscounted_set`')
-
-        self.expect('frame variable nscounted_set',
-                    substrs = ['(NSCountedSet *) nscounted_set = ','5 objects'])
-
-        #self.runCmd('mem read `imset`')
-        #self.runCmd("p (int)[imset count]")
-
-        self.expect('frame variable iset1 iset2 imset',
-                    substrs = ['4 indexes','512 indexes','10 indexes'])
-
         self.expect('frame variable cupertino home europe',
                     substrs = ['@"America/Los_Angeles"',
                     '@"Europe/Rome"',
                     '@"Europe/Paris"'])
 
-        self.expect('frame variable mut_bv',
-                    substrs = ['(CFMutableBitVectorRef) mut_bv = ', '1110 0110 1011 0000 1101 1010 1000 1111 0011 0101 1101 0001 00'])
-
         self.expect('frame variable cupertino_ns home_ns europe_ns',
                     substrs = ['@"America/Los_Angeles"',
                     '@"Europe/Rome"',
                     '@"Europe/Paris"'])
 
-        self.runCmd('type summary list')
-        self.expect('frame variable myclass',
-                    substrs = ['(Class) myclass = NSValue'])
-        self.expect('frame variable myclass2',
-                    substrs = ['(Class) myclass2 = __NSCFConstantString'])
-        self.expect('frame variable myclass3',
-                    substrs = ['(Class) myclass3 = Molecule'])
-        self.expect('frame variable myclass4',
-                    substrs = ['(Class) myclass4 = NSMutableArray'])
-        self.expect('frame variable myclass5',
-                    substrs = ['(Class) myclass5 = nil'])
+        self.expect('frame variable mut_bv',
+                    substrs = ['(CFMutableBitVectorRef) mut_bv = ', '1110 0110 1011 0000 1101 1010 1000 1111 0011 0101 1101 0001 00'])
 
 
     def expr_objc_data_formatter_commands(self):

Modified: lldb/branches/windows/test/functionalities/inferior-crashing/TestInferiorCrashing.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/inferior-crashing/TestInferiorCrashing.py?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/inferior-crashing/TestInferiorCrashing.py (original)
+++ lldb/branches/windows/test/functionalities/inferior-crashing/TestInferiorCrashing.py Thu Apr 25 07:31:53 2013
@@ -1,4 +1,4 @@
-"""Test that lldb reliably catches the inferior crashing."""
+"""Test that lldb functions correctly after the inferior has crashed."""
 
 import os, time
 import unittest2
@@ -20,12 +20,36 @@ class CrashingInferiorTestCase(TestBase)
         self.buildDwarf()
         self.inferior_crashing()
 
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+    def test_inferior_crashing_registers_dsym(self):
+        """Test that lldb reliably reads registers from the inferior after crashing (command)."""
+        self.buildDsym()
+        self.inferior_crashing_registers()
+
+    def test_inferior_crashing_register_dwarf(self):
+        """Test that lldb reliably reads registers from the inferior after crashing (command)."""
+        self.buildDwarf()
+        self.inferior_crashing_registers()
+
     @python_api_test
     def test_inferior_crashing_python(self):
         """Test that lldb reliably catches the inferior crashing (Python API)."""
         self.buildDefault()
         self.inferior_crashing_python()
 
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+    @unittest2.expectedFailure # bugzilla 15784?
+    def test_inferior_crashing_expr(self):
+        """Test that the lldb expression interpreter can read from the inferior after crashing (command)."""
+        self.buildDsym()
+        self.inferior_crashing_expr()
+
+    @unittest2.expectedFailure # bugzilla 15784
+    def test_inferior_crashing_expr(self):
+        """Test that the lldb expression interpreter can read from the inferior after crashing (command)."""
+        self.buildDwarf()
+        self.inferior_crashing_expr()
+
     def setUp(self):
         # Call super's setUp().
         TestBase.setUp(self)
@@ -78,6 +102,38 @@ class CrashingInferiorTestCase(TestBase)
         if self.TraceOn():
             lldbutil.print_stacktrace(thread)
 
+    def inferior_crashing_registers(self):
+        """Test that lldb can read registers after crashing."""
+        exe = os.path.join(os.getcwd(), "a.out")
+        self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+
+        self.runCmd("run", RUN_SUCCEEDED)
+
+        if sys.platform.startswith("darwin"):
+            stop_reason = 'stop reason = EXC_BAD_ACCESS'
+        else:
+            stop_reason = 'stop reason = invalid address'
+
+        # lldb should be able to read from registers from the inferior after crashing.
+        self.expect("register read rax",
+            substrs = ['rax = 0x'])
+
+    def inferior_crashing_expr(self):
+        """Test that the lldb expression interpreter can read symbols after crashing."""
+        exe = os.path.join(os.getcwd(), "a.out")
+        self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+
+        self.runCmd("run", RUN_SUCCEEDED)
+
+        if sys.platform.startswith("darwin"):
+            stop_reason = 'stop reason = EXC_BAD_ACCESS'
+        else:
+            stop_reason = 'stop reason = invalid address'
+
+        # The lldb expression interpreter should be able to read from addresses of the inferior during process exit.
+        self.expect("p argc",
+            startstr = ['(int) $0 = 1'])
+
 if __name__ == '__main__':
     import atexit
     lldb.SBDebugger.Initialize()

Modified: lldb/branches/windows/test/functionalities/register/TestRegisters.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/register/TestRegisters.py?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/register/TestRegisters.py (original)
+++ lldb/branches/windows/test/functionalities/register/TestRegisters.py Thu Apr 25 07:31:53 2013
@@ -14,12 +14,26 @@ class RegisterCommandsTestCase(TestBase)
     mydir = os.path.join("functionalities", "register")
 
     def test_register_commands(self):
-        """Test commands related to registers, in particular xmm registers."""
+        """Test commands related to registers, in particular vector registers."""
         if not self.getArchitecture() in ['i386', 'x86_64']:
             self.skipTest("This test requires i386 or x86_64 as the architecture for the inferior")
         self.buildDefault()
         self.register_commands()
 
+    def test_fp_register_write(self):
+        """Test commands that write to registers, in particular floating-point registers."""
+        if not self.getArchitecture() in ['i386', 'x86_64']:
+            self.skipTest("This test requires i386 or x86_64 as the architecture for the inferior")
+        self.buildDefault()
+        self.fp_register_write()
+
+    def test_register_expressions(self):
+        """Test expression evaluation with commands related to registers."""
+        if not self.getArchitecture() in ['i386', 'x86_64']:
+            self.skipTest("This test requires i386 or x86_64 as the architecture for the inferior")
+        self.buildDefault()
+        self.register_expressions()
+
     @expectedFailureLinux # bugzilla 14600 - Convenience registers not supported on Linux
     def test_convenience_registers(self):
         """Test convenience registers."""
@@ -36,9 +50,7 @@ class RegisterCommandsTestCase(TestBase)
         self.buildDefault()
         self.convenience_registers_with_process_attach()
 
-    @expectedFailureLinux # bugzilla 14661 - Expressions involving XMM registers fail on Linux
-    def register_commands(self):
-        """Test commands related to registers, in particular xmm registers."""
+    def common_setup(self):
         exe = os.path.join(os.getcwd(), "a.out")
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
@@ -51,7 +63,9 @@ class RegisterCommandsTestCase(TestBase)
         self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
             substrs = ['stopped', 'stop reason = breakpoint'])
 
-        # Test some register-related commands.
+    def register_commands(self):
+        """Test commands related to registers, in particular vector registers."""
+        self.common_setup()
 
         self.expect("register read -a", MISSING_EXPECTED_REGISTERS,
             substrs = ['registers were unavailable'], matching = False)
@@ -61,6 +75,74 @@ class RegisterCommandsTestCase(TestBase)
         self.expect("register read -s 3",
             substrs = ['invalid register set index: 3'], error = True)
 
+    def write_and_restore(self, frame, register):
+        value = frame.FindValue(register, lldb.eValueTypeRegister)
+        self.assertTrue(value.IsValid(), "finding a value for register " + register)
+
+        error = lldb.SBError()
+        register_value = value.GetValueAsUnsigned(error, 0)
+        self.assertTrue(error.Success(), "reading a value for " + register)
+
+        self.runCmd("register write " + register + " 0xff0e")
+        self.expect("register read " + register,
+            substrs = [register + ' = 0x', 'ff0e'])
+
+        self.runCmd("register write " + register + " " + str(register_value))
+        self.expect("register read " + register,
+            substrs = [register + ' = 0x'])
+
+    def vector_write_and_read(self, frame, register, new_value):
+        value = frame.FindValue(register, lldb.eValueTypeRegister)
+        self.assertTrue(value.IsValid(), "finding a value for register " + register)
+
+        self.runCmd("register write " + register + " \'" + new_value + "\'")
+        self.expect("register read " + register,
+            substrs = [register + ' = ', new_value])
+
+    def fp_register_write(self):
+        exe = os.path.join(os.getcwd(), "a.out")
+
+        # Create a target by the debugger.
+        target = self.dbg.CreateTarget(exe)
+        self.assertTrue(target, VALID_TARGET)
+
+        lldbutil.run_break_set_by_symbol (self, "main", num_expected_locations=-1)
+
+        # Launch the process, and do not stop at the entry point.
+        process = target.LaunchSimple(None, None, os.getcwd())
+
+        process = target.GetProcess()
+        self.assertTrue(process.GetState() == lldb.eStateStopped,
+                        PROCESS_STOPPED)
+
+        thread = process.GetThreadAtIndex(0)
+        self.assertTrue(thread.IsValid(), "current thread is valid")
+
+        currentFrame = thread.GetFrameAtIndex(0)
+        self.assertTrue(currentFrame.IsValid(), "current frame is valid")
+
+        self.write_and_restore(currentFrame, "fcw")
+        self.write_and_restore(currentFrame, "fsw")
+        self.write_and_restore(currentFrame, "ftw")
+        self.write_and_restore(currentFrame, "ip")
+        self.write_and_restore(currentFrame, "dp")
+        self.write_and_restore(currentFrame, "mxcsr")
+        self.write_and_restore(currentFrame, "mxcsrmask")
+
+        new_value = "{0x01 0x02 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00}"
+        self.vector_write_and_read(currentFrame, "stmm0", new_value)
+        new_value = "{0x01 0x02 0x03 0x00 0x00 0x00 0x00 0x00 0x09 0x0a}"
+        self.vector_write_and_read(currentFrame, "stmm7", new_value)
+
+        new_value = "{0x01 0x02 0x03 0x00 0x00 0x00 0x00 0x00 0x09 0x0a 0x2f 0x2f 0x2f 0x2f 0x2f 0x2f}"
+        self.vector_write_and_read(currentFrame, "xmm0", new_value)
+        new_value = "{0x01 0x02 0x03 0x00 0x00 0x00 0x00 0x00 0x09 0x0a 0x2f 0x2f 0x2f 0x2f 0x0e 0x0f}"
+        self.vector_write_and_read(currentFrame, "xmm15", new_value)
+
+    def register_expressions(self):
+        """Test expression evaluation with commands related to registers."""
+        self.common_setup()
+
         # rdar://problem/10611315
         # expression command doesn't handle xmm or stmm registers...
         self.expect("expr $xmm0",
@@ -71,17 +153,7 @@ class RegisterCommandsTestCase(TestBase)
 
     def convenience_registers(self):
         """Test convenience registers."""
-        exe = os.path.join(os.getcwd(), "a.out")
-        self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
-
-        # Break in main().
-        lldbutil.run_break_set_by_symbol (self, "main", num_expected_locations=-1)
-
-        self.runCmd("run", RUN_SUCCEEDED)
-
-        # The stop reason of the thread should be breakpoint.
-        self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
-            substrs = ['stopped', 'stop reason = breakpoint'])
+        self.common_setup()
 
         # The vanilla "register read" command does not output derived register like eax.
         self.expect("register read", matching=False,
@@ -91,7 +163,8 @@ class RegisterCommandsTestCase(TestBase)
             substrs = ['eax'])
         
         # Test reading of rax and eax.
-        self.runCmd("register read rax eax")
+        self.expect("register read rax eax",
+            substrs = ['rax = 0x', 'eax = 0x'])
 
         # Now write rax with a unique bit pattern and test that eax indeed represents the lower half of rax.
         self.runCmd("register write rax 0x1234567887654321")

Modified: lldb/branches/windows/test/lang/c/anonymous/TestAnonymous.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/c/anonymous/TestAnonymous.py?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/c/anonymous/TestAnonymous.py (original)
+++ lldb/branches/windows/test/lang/c/anonymous/TestAnonymous.py Thu Apr 25 07:31:53 2013
@@ -11,29 +11,76 @@ class AnonymousTestCase(TestBase):
     mydir = os.path.join("lang", "c", "anonymous")
 
     @dsym_test
-    def test_expr_with_dsym(self):
+    def test_expr_nest_with_dsym(self):
         self.buildDsym()
-        self.expr()
+        self.expr_nest()
 
-    @skipIfGcc # llvm.org/pr15036: LLDB is unable to parse DWARF generated by GCC
+    @dsym_test
+    def test_expr_child_with_dsym(self):
+        self.buildDsym()
+        self.expr_child()
+
+    @dsym_test
+    def test_expr_grandchild_with_dsym(self):
+        self.buildDsym()
+        self.expr_grandchild()
+
+    @dsym_test
+    def test_expr_parent(self):
+        self.buildDsym()
+        self.expr_parent()
+
+    @unittest2.expectedFailure # llvm.org/pr15591 
+    @dsym_test
+    def test_expr_null(self):
+        self.buildDsym()
+        self.expr_null()
+
+    @skipIfGcc # llvm.org/pr15036: LLDB generates an incorrect AST layout for an anonymous struct when DWARF is generated by GCC
     @skipIfIcc # llvm.org/pr15036: LLDB generates an incorrect AST layout for an anonymous struct when DWARF is generated by ICC
     @dwarf_test
-    def test_expr_with_dwarf(self):
+    def test_expr_nest_with_dwarf(self):
+        self.buildDwarf()
+        self.expr_nest()
+
+    @dwarf_test
+    def test_expr_child_with_dwarf(self):
+        self.skipTest("Skipped because LLDB asserts due to an incorrect AST layout for an anonymous struct: see llvm.org/pr15036")
+        self.buildDwarf()
+        self.expr_child()
+
+    @expectedFailureGcc # llvm.org/pr15036: LLDB generates an incorrect AST layout for an anonymous struct when DWARF is generated by GCC 
+    @expectedFailureIcc # llvm.org/pr15036: LLDB generates an incorrect AST layout for an anonymous struct when DWARF is generated by ICC
+    @dwarf_test
+    def test_expr_grandchild_with_dwarf(self):
+        self.buildDwarf()
+        self.expr_grandchild()
+
+    @dwarf_test
+    def test_expr_parent(self):
+        self.buildDwarf()
+        self.expr_parent()
+
+    @unittest2.expectedFailure # llvm.org/pr15591 
+    @dwarf_test
+    def test_expr_null(self):
         self.buildDwarf()
-        self.expr()
+        self.expr_null()
 
     def setUp(self):
         # Call super's setUp().
         TestBase.setUp(self)
-        # Find the line number to break inside main().
-        self.line = line_number('main.c', '// Set breakpoint 0 here.')
+        # Find the line numbers to break in main.c.
+        self.line0 = line_number('main.c', '// Set breakpoint 0 here.')
+        self.line1 = line_number('main.c', '// Set breakpoint 1 here.')
+        self.line2 = line_number('main.c', '// Set breakpoint 2 here.')
 
-    def common_setup(self):
+    def common_setup(self, line):
         exe = os.path.join(os.getcwd(), "a.out")
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
-        # Break inside the foo function which takes a bar_ptr argument.
-        lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
+        # Set breakpoints inside and outside methods that take pointers to the containing struct.
+        lldbutil.run_break_set_by_file_and_line (self, "main.c", line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 
@@ -46,16 +93,59 @@ class AnonymousTestCase(TestBase):
         self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
             substrs = [' resolved, hit count = 1'])
 
-    def expr(self):
-        self.common_setup()
+    def expr_nest(self):
+        self.common_setup(self.line0)
+
+        # These should display correctly.
+        self.expect("expression n->foo.d", VARIABLES_DISPLAYED_CORRECTLY,
+            substrs = ["= 4"])
+            
+        self.expect("expression n->b", VARIABLES_DISPLAYED_CORRECTLY,
+            substrs = ["= 2"])
+
+    def expr_child(self):
+        self.common_setup(self.line1)
 
-        # This should display correctly.
+        # These should display correctly.
         self.expect("expression c->foo.d", VARIABLES_DISPLAYED_CORRECTLY,
             substrs = ["= 4"])
             
-        self.expect("expression c->b", VARIABLES_DISPLAYED_CORRECTLY,
+        self.expect("expression c->grandchild.b", VARIABLES_DISPLAYED_CORRECTLY,
             substrs = ["= 2"])
 
+        self.expect("expression z", VARIABLES_DISPLAYED_CORRECTLY,
+            substrs = ["dummy = 2"])
+
+    def expr_grandchild(self):
+        self.common_setup(self.line2)
+
+        # These should display correctly.
+        self.expect("expression g.child.foo.d", VARIABLES_DISPLAYED_CORRECTLY,
+            substrs = ["= 4"])
+            
+        self.expect("expression g.child.b", VARIABLES_DISPLAYED_CORRECTLY,
+            substrs = ["= 2"])
+
+    def expr_parent(self):
+        self.common_setup(self.line2)
+
+        # These should display correctly.
+        self.expect("expression pz", VARIABLES_DISPLAYED_CORRECTLY,
+            substrs = ["(type_z *) $0 = 0x0000"])
+
+        self.expect("expression z.y", VARIABLES_DISPLAYED_CORRECTLY,
+            substrs = ["(type_y) $1 = {"])
+
+    def expr_null(self):
+        self.common_setup(self.line2)
+
+        # This should fail because pz is 0, but it succeeds on OS/X.
+        # This fails on Linux with an upstream error "Couldn't dematerialize struct", as does "p *n" with "int *n = 0".
+        # Note that this can also trigger llvm.org/pr15036 when run interactively at the lldb command prompt.
+        self.expect("expression *(type_z *)pz",
+            substrs = ["Cannot access memory at address 0x0"], error = True)
+
+
 if __name__ == '__main__':
     import atexit
     lldb.SBDebugger.Initialize()

Modified: lldb/branches/windows/test/lang/c/anonymous/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/c/anonymous/main.c?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/c/anonymous/main.c (original)
+++ lldb/branches/windows/test/lang/c/anonymous/main.c Thu Apr 25 07:31:53 2013
@@ -1,28 +1,82 @@
 #include <stdio.h>
 
-struct container {
+struct anonymous_nest {
   struct {
     struct {
       int a;
       int b;
-    };
+    }; // anonymous
     struct {
       int c;
       int d;
     } foo;
-  };
+  }; // anonymous
 };
 
-int processor (struct container *c)
+struct anonymous_child {
+  struct {
+    struct {
+      int a;
+      int b;
+    } grandchild;
+    struct {
+      int c;
+      int d;
+    } foo;
+  }; // anonymous
+};
+
+struct anonymous_grandchild {
+  struct {
+    struct {
+      int a;
+      int b;
+    }; // anonymous
+    struct {
+      int c;
+      int d;
+    } foo;
+  } child;
+};
+
+int processor_nest (struct anonymous_nest *n)
+{
+  return n->foo.d + n->b; // Set breakpoint 0 here.
+}
+
+int processor_child (struct anonymous_child *c)
+{
+  return c->foo.d + c->grandchild.b; // Set breakpoint 1 here.
+}
+
+int processor_grandchild (struct anonymous_grandchild *g)
 {
-  return c->foo.d + c->b; // Set breakpoint 0 here.
+  return g->child.foo.d + g->child.b;
 }
 
+
+
+typedef struct {
+    int dummy;
+} type_y;
+
+typedef struct {
+    type_y y;
+} type_z;
+
+
+
 int main()
 {
-  struct container c = { 0, 2, 0, 4 };
-  
-  printf("%d\n", processor(&c));
+  struct anonymous_nest n = { 0, 2, 0, 4 };
+  struct anonymous_child c = { 0, 2, 0, 4 };
+  struct anonymous_grandchild g = { 0, 2, 0, 4 };
+  type_z *pz = 0;
+  type_z z = {{2}};
+
+  printf("%d\n", processor_nest(&n));
+  printf("%d\n", processor_child(&c));
+  printf("%d\n", processor_grandchild(&g)); // Set breakpoint 2 here.
 
   return 0;
 }

Modified: lldb/branches/windows/test/lang/c/strings/TestCStrings.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/c/strings/TestCStrings.py?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/c/strings/TestCStrings.py (original)
+++ lldb/branches/windows/test/lang/c/strings/TestCStrings.py Thu Apr 25 07:31:53 2013
@@ -63,6 +63,9 @@ class CStringsTestCase(TestBase):
                     substrs = ['(char *) $', ' = 0x',
                                'hello'])
 
+        self.expect("p (int)strlen(\"\")",
+                    substrs = ['(int) $', ' = 0'])
+
 if __name__ == '__main__':
     import atexit
     lldb.SBDebugger.Initialize()

Modified: lldb/branches/windows/test/lang/cpp/char1632_t/TestChar1632T.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/cpp/char1632_t/TestChar1632T.py?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/cpp/char1632_t/TestChar1632T.py (original)
+++ lldb/branches/windows/test/lang/cpp/char1632_t/TestChar1632T.py Thu Apr 25 07:31:53 2013
@@ -20,7 +20,6 @@ class Char1632TestCase(TestBase):
         self.buildDsym()
         self.char1632()
 
-    @expectedFailureLinux # bugzilla 15038: missing wide char support on Linux
     @dwarf_test
     def test_with_dwarf(self):
         """Test that the C++11 support for char16_t and char32_t works correctly."""

Modified: lldb/branches/windows/test/lang/cpp/wchar_t/TestCxxWCharT.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/cpp/wchar_t/TestCxxWCharT.py?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/cpp/wchar_t/TestCxxWCharT.py (original)
+++ lldb/branches/windows/test/lang/cpp/wchar_t/TestCxxWCharT.py Thu Apr 25 07:31:53 2013
@@ -20,7 +20,6 @@ class CxxWCharTTestCase(TestBase):
         self.buildDsym()
         self.wchar_t()
 
-    @expectedFailureLinux # bugzilla 15038: missing wide char support on Linux
     @dwarf_test
     def test_with_dwarf(self):
         """Test that C++ supports wchar_t correctly."""

Modified: lldb/branches/windows/test/redo.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/redo.py?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/test/redo.py (original)
+++ lldb/branches/windows/test/redo.py Thu Apr 25 07:31:53 2013
@@ -28,6 +28,8 @@ redo_specs = []
 # will be considered for re-run.  Examples: ['X86_64', 'clang'].
 filename_components = []
 
+do_delay = False
+
 # There is a known bug with respect to comp_specs and arch_specs, in that if we
 # encountered "-C clang" and "-C gcc" when visiting the session files, both
 # compilers will end up in the invocation of the test driver when rerunning.
@@ -40,12 +42,13 @@ arch_specs = set()
 
 def usage():
     print"""\
-Usage: redo.py [-F filename_component] [-n] [session_dir]
+Usage: redo.py [-F filename_component] [-n] [session_dir] [-d]
 where options:
 -F : only consider the test for re-run if the session filename conatins the filename component
      for example: -F x86_64
 -n : when running the tests, do not turn on trace mode, i.e, no '-t' option
      is passed to the test driver (this will run the tests faster)
+-d : pass -d down to the test driver (introduces a delay so you can attach with a debugger)
 
 and session_dir specifies the session directory which contains previously
 recorded session infos for all the test cases which either failed or errored.
@@ -81,6 +84,7 @@ def redo(suffix, dir, names):
     global comp_pattern
     global arch_pattern
     global filename_components
+    global do_delay
 
     for name in names:
         if name.endswith(suffix):
@@ -111,6 +115,7 @@ def main():
     global no_trace
     global redo_specs
     global filename_components
+    global do_delay
 
     test_dir = sys.path[0]
     if not test_dir:
@@ -139,6 +144,8 @@ def main():
             filename_components.append(sys.argv[index])
         elif sys.argv[index] == '-n':
             no_trace = True
+        elif sys.argv[index] == '-d':
+            do_delay = True
 
         index += 1
 
@@ -176,7 +183,7 @@ def main():
     for arch in arch_specs:
         archs += "--arch %s " % (arch)
 
-    command = "./dotest.py %s %s -v %s -f " % (compilers, archs, "" if no_trace else "-t")
+    command = "./dotest.py %s %s -v %s %s -f " % (compilers, archs, "" if no_trace else "-t", "-d" if do_delay else "")
 
 
     print "Running %s" % (command + filters)

Modified: lldb/branches/windows/tools/darwin-debug/darwin-debug.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/tools/darwin-debug/darwin-debug.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/tools/darwin-debug/darwin-debug.cpp (original)
+++ lldb/branches/windows/tools/darwin-debug/darwin-debug.cpp Thu Apr 25 07:31:53 2013
@@ -24,6 +24,7 @@
 //----------------------------------------------------------------------
 #if defined (__APPLE__)
 
+#include <crt_externs.h> // for _NSGetEnviron()
 #include <getopt.h>
 #include <limits.h>
 #include <mach/machine.h>
@@ -54,6 +55,7 @@ static struct option g_long_options[] =
 	{ "setsid",         no_argument,		NULL,           's'		},
 	{ "unix-socket",    required_argument,  NULL,           'u'		},
     { "working-dir",    required_argument,  NULL,           'w'     },
+    { "env",            required_argument,  NULL,           'E'     },
 	{ NULL,				0,					NULL,            0		}
 };
 
@@ -181,10 +183,10 @@ int main (int argc, char *const *argv, c
     bool show_usage = false;
     int ch;
     int disable_aslr = 0; // By default we disable ASLR
-    int pass_env = 1;
+    bool pass_env = true;
     std::string unix_socket_name;
     std::string working_dir;
-	while ((ch = getopt_long_only(argc, argv, "a:dehsu:?", g_long_options, NULL)) != -1)
+	while ((ch = getopt_long_only(argc, argv, "a:deE:hsu:?", g_long_options, NULL)) != -1)
 	{
 		switch (ch) 
 		{
@@ -213,9 +215,29 @@ int main (int argc, char *const *argv, c
             break;            
 
         case 'e':
-            pass_env = 0;
+            pass_env = false;
             break;
-        
+            
+        case 'E':
+            {
+                // Since we will exec this program into our new program, we can just set environment
+                // varaibles in this process and they will make it into the child process.
+                std::string name;
+                std::string value;
+                const char *equal_pos = strchr (optarg, '=');
+                if (equal_pos)
+                {
+                    name.assign (optarg, equal_pos - optarg);
+                    value.assign (equal_pos + 1);
+                }
+                else
+                {
+                    name = optarg;
+                }
+                ::setenv (name.c_str(), value.c_str(), 1);
+            }
+            break;
+            
         case 's':
             // Create a new session to avoid having control-C presses kill our current
             // terminal session when this program is launched from a .command file
@@ -309,8 +331,8 @@ int main (int argc, char *const *argv, c
 
     // Now we posix spawn to exec this process into the inferior that we want
     // to debug.
-    posix_spawn_for_debug (argv, 
-                           pass_env ? envp : NULL, 
+    posix_spawn_for_debug (argv,
+                           pass_env ? *_NSGetEnviron() : NULL, // Pass current environment as we may have modified it if "--env" options was used, do NOT pass "envp" here
                            working_dir.empty() ? NULL : working_dir.c_str(),
                            cpu_type, 
                            disable_aslr);

Modified: lldb/branches/windows/tools/debugserver/source/DNB.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/tools/debugserver/source/DNB.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/tools/debugserver/source/DNB.cpp (original)
+++ lldb/branches/windows/tools/debugserver/source/DNB.cpp Thu Apr 25 07:31:53 2013
@@ -36,7 +36,7 @@
 #include "CFBundle.h"
 
 
-typedef STD_SHARED_PTR(MachProcess) MachProcessSP;
+typedef std::shared_ptr<MachProcess> MachProcessSP;
 typedef std::map<nub_process_t, MachProcessSP> ProcessMap;
 typedef ProcessMap::iterator ProcessMapIter;
 typedef ProcessMap::const_iterator ProcessMapConstIter;

Modified: lldb/branches/windows/tools/debugserver/source/DNB.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/tools/debugserver/source/DNB.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/tools/debugserver/source/DNB.h (original)
+++ lldb/branches/windows/tools/debugserver/source/DNB.h Thu Apr 25 07:31:53 2013
@@ -16,6 +16,7 @@
 
 #include "DNBDefs.h"
 #include <mach/thread_info.h>
+#include <string>
 
 #define DNB_EXPORT __attribute__((visibility("default")))
 

Modified: lldb/branches/windows/tools/debugserver/source/DNBDefs.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/tools/debugserver/source/DNBDefs.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/tools/debugserver/source/DNBDefs.h (original)
+++ lldb/branches/windows/tools/debugserver/source/DNBDefs.h Thu Apr 25 07:31:53 2013
@@ -20,20 +20,6 @@
 #include <sys/syslimits.h>
 #include <unistd.h>
 
-#include <ciso646>  // detect C++ lib
-
-#ifdef _LIBCPP_VERSION
-#include <memory>
-#define STD_SHARED_PTR(T) std::shared_ptr<T>
-#define STD_WEAK_PTR(T) std::weak_ptr<T>
-#define STD_ENABLE_SHARED_FROM_THIS(T) std::enable_shared_from_this<T>
-#else
-#include <tr1/memory>
-#define STD_SHARED_PTR(T) std::tr1::shared_ptr<T>
-#define STD_WEAK_PTR(T) std::tr1::weak_ptr<T>
-#define STD_ENABLE_SHARED_FROM_THIS(T) std::tr1::enable_shared_from_this<T>
-#endif
-
 //----------------------------------------------------------------------
 // Define nub_addr_t and the invalid address value from the architecture
 //----------------------------------------------------------------------

Modified: lldb/branches/windows/tools/debugserver/source/DNBTimer.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/tools/debugserver/source/DNBTimer.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/tools/debugserver/source/DNBTimer.h (original)
+++ lldb/branches/windows/tools/debugserver/source/DNBTimer.h Thu Apr 25 07:31:53 2013
@@ -17,6 +17,7 @@
 #include <sys/time.h>
 #include <stdint.h>
 #include <memory>
+#include "DNBDefs.h"
 #include "PThreadMutex.h"
 
 class DNBTimer
@@ -155,7 +156,7 @@ protected:
     //------------------------------------------------------------------
     // Classes that inherit from DNBTimer can see and modify these
     //------------------------------------------------------------------
-        std::auto_ptr<PThreadMutex> m_mutexAP;
+        std::unique_ptr<PThreadMutex> m_mutexAP;
         struct timeval  m_timeval;
 };
 

Modified: lldb/branches/windows/tools/debugserver/source/MacOSX/MachThread.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/tools/debugserver/source/MacOSX/MachThread.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/tools/debugserver/source/MacOSX/MachThread.h (original)
+++ lldb/branches/windows/tools/debugserver/source/MacOSX/MachThread.h Thu Apr 25 07:31:53 2013
@@ -130,7 +130,7 @@ protected:
     int32_t                         m_suspend_count; // The current suspend count > 0 means we have suspended m_suspendCount times,
                                                     //                           < 0 means we have resumed it m_suspendCount times.
     MachException::Data             m_stop_exception; // The best exception that describes why this thread is stopped
-    std::auto_ptr<DNBArchProtocol>  m_arch_ap;      // Arch specific information for register state and more
+    std::unique_ptr<DNBArchProtocol> m_arch_ap;      // Arch specific information for register state and more
     const DNBRegisterSetInfo *      m_reg_sets;      // Register set information for this thread
     nub_size_t                      m_num_reg_sets;
     thread_identifier_info_data_t   m_ident_info;
@@ -142,6 +142,6 @@ private:
     void HardwareWatchpointStateChanged(); // Provide a chance to update the global view of the hardware watchpoint state
 };
 
-typedef STD_SHARED_PTR(MachThread) MachThreadSP;
+typedef std::shared_ptr<MachThread> MachThreadSP;
 
 #endif

Modified: lldb/branches/windows/tools/debugserver/source/RNBDefs.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/tools/debugserver/source/RNBDefs.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/tools/debugserver/source/RNBDefs.h (original)
+++ lldb/branches/windows/tools/debugserver/source/RNBDefs.h Thu Apr 25 07:31:53 2013
@@ -15,6 +15,7 @@
 #define __RNBDefs_h__
 
 #include "DNBDefs.h"
+#include <memory>
 
 extern "C" const unsigned char debugserverVersionString[];
 extern "C" const double debugserverVersionNumber;
@@ -49,7 +50,7 @@ extern "C" const double debugserverVersi
 #endif
 
 class RNBRemote;
-typedef STD_SHARED_PTR(RNBRemote) RNBRemoteSP;
+typedef std::shared_ptr<RNBRemote> RNBRemoteSP;
 
 typedef enum
 {

Modified: lldb/branches/windows/tools/driver/Driver.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/tools/driver/Driver.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/tools/driver/Driver.h (original)
+++ lldb/branches/windows/tools/driver/Driver.h Thu Apr 25 07:31:53 2013
@@ -160,7 +160,7 @@ private:
     lldb_utility::PseudoTerminal m_editline_pty;
     FILE *m_editline_slave_fh;
     lldb::SBInputReader m_editline_reader;
-    std::auto_ptr<IOChannel> m_io_channel_ap;
+    std::unique_ptr<IOChannel> m_io_channel_ap;
     OptionData m_option_data;
     bool m_waiting_for_command;
     bool m_done;

Modified: lldb/branches/windows/tools/lldb-perf/common/clang/lldb_perf_clang.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/tools/lldb-perf/common/clang/lldb_perf_clang.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/tools/lldb-perf/common/clang/lldb_perf_clang.cpp (original)
+++ lldb/branches/windows/tools/lldb-perf/common/clang/lldb_perf_clang.cpp Thu Apr 25 07:31:53 2013
@@ -46,15 +46,15 @@ public:
         m_expr_first_evaluate([this] (SBFrame frame) -> void
                           {
                               frame.EvaluateExpression("Diags.DiagArgumentsStr[0].size()").GetError();
-                          }, "time-expr", "Elapsed time it takes evaluate an expression for the first time."),
+                          }, "time-expr", "Elapsed time it takes to evaluate an expression for the first time."),
         m_expr_frame_zero ([this] (SBFrame frame) -> void
                        {
                            frame.EvaluateExpression("Diags.DiagArgumentsStr[0].size()").GetError();
-                       }, "time-expr-frame-zero", "Elapsed time it takes evaluate an expression 3 times at frame zero."),
+                       }, "time-expr-frame-zero", "Elapsed time it takes to evaluate an expression 3 times at frame zero."),
         m_expr_frame_non_zero ([this] (SBFrame frame) -> void
                            {
                                frame.EvaluateExpression("Diags.DiagArgumentsStr[0].size()").GetError();
-                           }, "time-expr-frame-non-zero", "Elapsed time it takes evaluate an expression 3 times at a non-zero frame."),
+                           }, "time-expr-frame-non-zero", "Elapsed time it takes to evaluate an expression 3 times at a non-zero frame."),
         m_exe_path(),
         m_out_path(),
         m_launch_info (NULL),

Modified: lldb/branches/windows/tools/lldb-perf/lib/Gauge.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/tools/lldb-perf/lib/Gauge.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/tools/lldb-perf/lib/Gauge.cpp (original)
+++ lldb/branches/windows/tools/lldb-perf/lib/Gauge.cpp Thu Apr 25 07:31:53 2013
@@ -8,6 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "Gauge.h"
+#include "lldb/lldb-forward.h"
 
 template <>
 lldb_perf::Results::ResultSP

Modified: lldb/branches/windows/tools/lldb-perf/lib/MemoryGauge.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/tools/lldb-perf/lib/MemoryGauge.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/tools/lldb-perf/lib/MemoryGauge.cpp (original)
+++ lldb/branches/windows/tools/lldb-perf/lib/MemoryGauge.cpp Thu Apr 25 07:31:53 2013
@@ -8,6 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "MemoryGauge.h"
+#include "lldb/lldb-forward.h"
 #include <assert.h>
 #include <cmath>
 #include <mach/mach.h>

Modified: lldb/branches/windows/tools/lldb-perf/lib/Results.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/tools/lldb-perf/lib/Results.h?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/tools/lldb-perf/lib/Results.h (original)
+++ lldb/branches/windows/tools/lldb-perf/lib/Results.h Thu Apr 25 07:31:53 2013
@@ -10,7 +10,7 @@
 #ifndef __PerfTestDriver_Results_h__
 #define __PerfTestDriver_Results_h__
 
-#include <memory>
+#include "lldb/lldb-forward.h"
 #include <map>
 #include <string>
 #include <vector>

Modified: lldb/branches/windows/tools/lldb-platform/lldb-platform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/tools/lldb-platform/lldb-platform.cpp?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/tools/lldb-platform/lldb-platform.cpp (original)
+++ lldb/branches/windows/tools/lldb-platform/lldb-platform.cpp Thu Apr 25 07:31:53 2013
@@ -185,7 +185,7 @@ main (int argc, char *argv[])
     GDBRemoteCommunicationServer gdb_server (true);
     if (!listen_host_port.empty())
     {
-        std::auto_ptr<ConnectionFileDescriptor> conn_ap(new ConnectionFileDescriptor());
+        std::unique_ptr<ConnectionFileDescriptor> conn_ap(new ConnectionFileDescriptor());
         if (conn_ap.get())
         {
             std::string connect_url ("listen://");

Modified: lldb/branches/windows/www/lldb-gdb.html
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/www/lldb-gdb.html?rev=180260&r1=180259&r2=180260&view=diff
==============================================================================
--- lldb/branches/windows/www/lldb-gdb.html (original)
+++ lldb/branches/windows/www/lldb-gdb.html Thu Apr 25 07:31:53 2013
@@ -1103,6 +1103,33 @@
                         </td>
                     </tr>
 
+                    <tr><td class="header" colspan="2">Find full souce line information.</td></tr>
+                    <tr>
+                        <td class="content">
+                            <b>(gdb)</b> info line 0x1ec4<br>
+                        </td>
+                        <td class="content">
+                          This one is a bit messy at present.  Do:<br><br>
+                            <b>(lldb)</b> image lookup -v --address 0x1ec4<br><br>
+                          and look for the LineEntry line, which will have the full source path and
+                          line range information.<br>
+                        </td>
+                    </tr>
+
+                    <tr><td class="header" colspan="2">Look up functions matching a regular expression in a binary.</td></tr>
+                    <tr>
+                        <td class="content">
+                            <b>(gdb)</b> info function <FUNC_REGEX><br>
+                        </td>
+                        <td class="content">
+                            This one finds debug symbols:<br>
+                            <b>(lldb)</b> image lookup -r -n <FUNC_REGEX><br><br>
+                            This one finds non-debug symbols:<br>
+                            <b>(lldb)</b> image lookup -r -s <FUNC_REGEX><br><br>
+                            Provide a list of binaries as arguments to limit the search.
+                        </td>
+                    </tr>
+
                     <tr><td class="header" colspan="2">Look up information for an address in <b>a.out</a> only.</td></tr>
                     <tr>
                         <td class="content">





More information about the llvm-branch-commits mailing list