[Lldb-commits] [lldb] r164820 - in /lldb/branches/windows: ./ examples/python/ examples/summaries/cocoa/ include/lldb/ include/lldb/API/ include/lldb/Core/ include/lldb/Expression/ include/lldb/Host/ include/lldb/Interpreter/ include/lldb/Symbol/ include/lldb/Target/ lib/ lldb.xcodeproj/ resources/ scripts/ scripts/Python/ scripts/Python/interface/ source/API/ source/Breakpoint/ source/Commands/ source/Core/ source/Expression/ source/Host/common/ source/Host/macosx/ source/Host/macosx/launcherXPCService/ source/Interpr...

Carlo Kok ck at remobjects.com
Fri Sep 28 04:07:36 PDT 2012


Author: carlokok
Date: Fri Sep 28 06:07:34 2012
New Revision: 164820

URL: http://llvm.org/viewvc/llvm-project?rev=164820&view=rev
Log:
Upmerge of lldb trunk into Windows branch (the DWARF updates are needed to do any real debugging with it)

Added:
    lldb/branches/windows/test/.categories
      - copied unchanged from r164814, lldb/trunk/test/.categories
    lldb/branches/windows/test/expression_command/.categories
      - copied unchanged from r164814, lldb/trunk/test/expression_command/.categories
    lldb/branches/windows/test/functionalities/data-formatter/.categories
      - copied unchanged from r164814, lldb/trunk/test/functionalities/data-formatter/.categories
    lldb/branches/windows/test/functionalities/data-formatter/data-formatter-objc/.categories
      - copied unchanged from r164814, lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/.categories
    lldb/branches/windows/test/functionalities/expr-doesnt-deadlock/.categories
      - copied unchanged from r164814, lldb/trunk/test/functionalities/expr-doesnt-deadlock/.categories
    lldb/branches/windows/test/lang/objc/.categories
      - copied unchanged from r164814, lldb/trunk/test/lang/objc/.categories
    lldb/branches/windows/test/python_api/.categories
      - copied unchanged from r164814, lldb/trunk/test/python_api/.categories
    lldb/branches/windows/tools/debugserver/scripts/diagnose-termination.d
      - copied unchanged from r164814, lldb/trunk/tools/debugserver/scripts/diagnose-termination.d
Removed:
    lldb/branches/windows/llvm.zip
    lldb/branches/windows/scripts/clang.amalgamated.diff
    lldb/branches/windows/scripts/clang.utfroutines.diff
    lldb/branches/windows/scripts/llvm.amalgamated.diff
Modified:
    lldb/branches/windows/   (props changed)
    lldb/branches/windows/examples/python/crashlog.py
    lldb/branches/windows/examples/python/process_events.py
    lldb/branches/windows/examples/summaries/cocoa/objc_runtime.py
    lldb/branches/windows/include/lldb/API/SBBreakpoint.h
    lldb/branches/windows/include/lldb/Core/ArchSpec.h
    lldb/branches/windows/include/lldb/Core/Stream.h
    lldb/branches/windows/include/lldb/Core/StreamBuffer.h
    lldb/branches/windows/include/lldb/Core/UUID.h
    lldb/branches/windows/include/lldb/Core/ValueObject.h
    lldb/branches/windows/include/lldb/Expression/ClangASTSource.h
    lldb/branches/windows/include/lldb/Expression/IRForTarget.h
    lldb/branches/windows/include/lldb/Expression/RecordingMemoryManager.h
    lldb/branches/windows/include/lldb/Host/Host.h
    lldb/branches/windows/include/lldb/Host/Symbols.h
    lldb/branches/windows/include/lldb/Interpreter/CommandObject.h
    lldb/branches/windows/include/lldb/Interpreter/OptionGroupBoolean.h
    lldb/branches/windows/include/lldb/Interpreter/OptionValueFileSpec.h
    lldb/branches/windows/include/lldb/Interpreter/OptionValueUUID.h
    lldb/branches/windows/include/lldb/Interpreter/ScriptInterpreter.h
    lldb/branches/windows/include/lldb/Interpreter/ScriptInterpreterPython.h
    lldb/branches/windows/include/lldb/Symbol/ClangASTImporter.h
    lldb/branches/windows/include/lldb/Target/ObjCLanguageRuntime.h
    lldb/branches/windows/include/lldb/Target/Thread.h
    lldb/branches/windows/include/lldb/lldb-enumerations.h
    lldb/branches/windows/lib/Makefile
    lldb/branches/windows/lldb.xcodeproj/project.pbxproj
    lldb/branches/windows/resources/LLDB-Info.plist
    lldb/branches/windows/scripts/Python/build-swig-Python.sh
    lldb/branches/windows/scripts/Python/finish-swig-Python-LLDB.sh
    lldb/branches/windows/scripts/Python/interface/SBBreakpoint.i
    lldb/branches/windows/scripts/build-llvm.pl
    lldb/branches/windows/scripts/build-swig-wrapper-classes.sh
    lldb/branches/windows/scripts/finish-swig-wrapper-classes.sh
    lldb/branches/windows/scripts/lldb.swig
    lldb/branches/windows/source/API/SBBreakpoint.cpp
    lldb/branches/windows/source/API/SBTarget.cpp
    lldb/branches/windows/source/API/SBThread.cpp
    lldb/branches/windows/source/Breakpoint/Breakpoint.cpp
    lldb/branches/windows/source/Breakpoint/BreakpointLocation.cpp
    lldb/branches/windows/source/Commands/CommandObjectBreakpoint.cpp
    lldb/branches/windows/source/Commands/CommandObjectCommands.cpp
    lldb/branches/windows/source/Commands/CommandObjectMemory.cpp
    lldb/branches/windows/source/Commands/CommandObjectTarget.cpp
    lldb/branches/windows/source/Core/ArchSpec.cpp
    lldb/branches/windows/source/Core/ModuleList.cpp
    lldb/branches/windows/source/Core/UUID.cpp
    lldb/branches/windows/source/Expression/ASTStructExtractor.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/IRForTarget.cpp
    lldb/branches/windows/source/Host/common/Host.cpp
    lldb/branches/windows/source/Host/common/Symbols.cpp
    lldb/branches/windows/source/Host/macosx/Host.mm
    lldb/branches/windows/source/Host/macosx/Symbols.cpp
    lldb/branches/windows/source/Host/macosx/launcherXPCService/LauncherRootXPCService-Info.plist
    lldb/branches/windows/source/Host/macosx/launcherXPCService/LauncherXPCService-Info.plist
    lldb/branches/windows/source/Interpreter/CommandInterpreter.cpp
    lldb/branches/windows/source/Interpreter/OptionGroupBoolean.cpp
    lldb/branches/windows/source/Interpreter/OptionValueFileSpec.cpp
    lldb/branches/windows/source/Interpreter/OptionValueUUID.cpp
    lldb/branches/windows/source/Interpreter/Property.cpp
    lldb/branches/windows/source/Interpreter/ScriptInterpreterPython.cpp
    lldb/branches/windows/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp
    lldb/branches/windows/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp
    lldb/branches/windows/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
    lldb/branches/windows/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h
    lldb/branches/windows/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp
    lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
    lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeVendor.cpp
    lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeVendor.h
    lldb/branches/windows/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp
    lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp
    lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.h
    lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
    lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h
    lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_arm.cpp
    lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_i386.cpp
    lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_x86_64.cpp
    lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp
    lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.h
    lldb/branches/windows/source/Plugins/Process/Utility/StopInfoMachException.cpp
    lldb/branches/windows/source/Plugins/Process/Utility/StopInfoMachException.h
    lldb/branches/windows/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
    lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
    lldb/branches/windows/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
    lldb/branches/windows/source/Symbol/ClangASTContext.cpp
    lldb/branches/windows/source/Symbol/ClangASTImporter.cpp
    lldb/branches/windows/source/Symbol/ClangASTType.cpp
    lldb/branches/windows/source/Symbol/TypeHierarchyNavigator.cpp
    lldb/branches/windows/source/Target/PathMappingList.cpp
    lldb/branches/windows/source/Target/Thread.cpp
    lldb/branches/windows/test/api/check_public_api_headers/TestPublicAPIHeaders.py
    lldb/branches/windows/test/attic/tester.py
    lldb/branches/windows/test/dotest.py
    lldb/branches/windows/test/example/TestSequenceFunctions.py
    lldb/branches/windows/test/expression_command/call-function/TestCallStdStringFunction.py
    lldb/branches/windows/test/expression_command/call-function/main.cpp
    lldb/branches/windows/test/expression_command/formatters/TestFormatters.py
    lldb/branches/windows/test/expression_command/radar_9531204/TestPrintfAfterUp.py
    lldb/branches/windows/test/expression_command/radar_9673664/TestExprHelpExamples.py
    lldb/branches/windows/test/expression_command/test/TestExprs.py
    lldb/branches/windows/test/expression_command/test/TestExprs2.py
    lldb/branches/windows/test/expression_command/two-files/TestObjCTypeQueryFromOtherCompileUnit.py
    lldb/branches/windows/test/functionalities/abbreviation/TestAbbreviations.py
    lldb/branches/windows/test/functionalities/abbreviation/TestCommonShortSpellings.py
    lldb/branches/windows/test/functionalities/alias/TestAliases.py
    lldb/branches/windows/test/functionalities/archives/TestBSDArchives.py
    lldb/branches/windows/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py
    lldb/branches/windows/test/functionalities/breakpoint/breakpoint_command/TestRegexpBreakCommand.py
    lldb/branches/windows/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py
    lldb/branches/windows/test/functionalities/breakpoint/breakpoint_ids/TestBreakpointIDs.py
    lldb/branches/windows/test/functionalities/breakpoint/breakpoint_ignore_count/TestBreakpointIgnoreCount.py
    lldb/branches/windows/test/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
    lldb/branches/windows/test/functionalities/breakpoint/inlined_breakpoints/TestInlinedBreakpoints.py
    lldb/branches/windows/test/functionalities/completion/TestCompletion.py
    lldb/branches/windows/test/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py
    lldb/branches/windows/test/functionalities/data-formatter/data-formatter-categories/TestDataFormatterCategories.py
    lldb/branches/windows/test/functionalities/data-formatter/data-formatter-cpp/TestDataFormatterCpp.py
    lldb/branches/windows/test/functionalities/data-formatter/data-formatter-disabling/TestDataFormatterDisabling.py
    lldb/branches/windows/test/functionalities/data-formatter/data-formatter-globals/TestDataFormatterGlobals.py
    lldb/branches/windows/test/functionalities/data-formatter/data-formatter-named-summaries/TestDataFormatterNamedSummaries.py
    lldb/branches/windows/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
    lldb/branches/windows/test/functionalities/data-formatter/data-formatter-objc/main.m
    lldb/branches/windows/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py
    lldb/branches/windows/test/functionalities/data-formatter/data-formatter-python-synth/main.cpp
    lldb/branches/windows/test/functionalities/data-formatter/data-formatter-script/TestDataFormatterScript.py
    lldb/branches/windows/test/functionalities/data-formatter/data-formatter-skip-summary/TestDataFormatterSkipSummary.py
    lldb/branches/windows/test/functionalities/data-formatter/data-formatter-smart-array/TestDataFormatterSmartArray.py
    lldb/branches/windows/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/TestDataFormatterLibcxxList.py
    lldb/branches/windows/test/functionalities/data-formatter/data-formatter-stl/libcxx/map/TestDataFormatterLibccMap.py
    lldb/branches/windows/test/functionalities/data-formatter/data-formatter-stl/libcxx/vector/TestDataFormatterLibcxxVector.py
    lldb/branches/windows/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/TestDataFormatterStdList.py
    lldb/branches/windows/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/TestDataFormatterStdMap.py
    lldb/branches/windows/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/TestDataFormatterStdVector.py
    lldb/branches/windows/test/functionalities/data-formatter/data-formatter-synth/TestDataFormatterSynth.py
    lldb/branches/windows/test/functionalities/data-formatter/rdar-10449092/Test-rdar-10449092.py
    lldb/branches/windows/test/functionalities/data-formatter/rdar-10642615/Test-rdar-10642615.py
    lldb/branches/windows/test/functionalities/data-formatter/rdar-10887661/TestRdar10887661.py
    lldb/branches/windows/test/functionalities/data-formatter/rdar-11086338/TestRdar11086338.py
    lldb/branches/windows/test/functionalities/data-formatter/rdar-11628688/TestFormattersBoolRefPtr.py
    lldb/branches/windows/test/functionalities/data-formatter/rdar-11773899/TestFormattersBoolRefPtr.py
    lldb/branches/windows/test/functionalities/data-formatter/rdar-11988289/TestRdar 11988289.py
    lldb/branches/windows/test/functionalities/data-formatter/rdar-3534688/TestFormattersOneIsSingular.py
    lldb/branches/windows/test/functionalities/data-formatter/rdar-9973865/Test-rdar-9973865.py
    lldb/branches/windows/test/functionalities/data-formatter/rdar-9973992/Test-rdar-9973992.py
    lldb/branches/windows/test/functionalities/data-formatter/rdar-9974002/Test-rdar-9974002.py
    lldb/branches/windows/test/functionalities/dead-strip/TestDeadStrip.py
    lldb/branches/windows/test/functionalities/inferior-changed/TestInferiorChanged.py
    lldb/branches/windows/test/functionalities/load_unload/TestLoadUnload.py
    lldb/branches/windows/test/functionalities/memory/read/TestMemoryRead.py
    lldb/branches/windows/test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py
    lldb/branches/windows/test/functionalities/register/TestRegisters.py
    lldb/branches/windows/test/functionalities/signal/TestSendSignal.py
    lldb/branches/windows/test/functionalities/single-quote-in-filename-to-lldb/TestSingleQuoteInFilename.py
    lldb/branches/windows/test/functionalities/stop-hook/TestStopHookCmd.py
    lldb/branches/windows/test/functionalities/target_command/TestTargetCommand.py
    lldb/branches/windows/test/functionalities/type_completion/TestTypeCompletion.py
    lldb/branches/windows/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py
    lldb/branches/windows/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py
    lldb/branches/windows/test/functionalities/watchpoint/multiple_threads/TestWatchpointMultipleThreads.py
    lldb/branches/windows/test/functionalities/watchpoint/variable_out_of_scope/TestWatchedVarHitWhenInScope.py
    lldb/branches/windows/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py
    lldb/branches/windows/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandLLDB.py
    lldb/branches/windows/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py
    lldb/branches/windows/test/functionalities/watchpoint/watchpoint_commands/condition/TestWatchpointConditionCmd.py
    lldb/branches/windows/test/functionalities/watchpoint/watchpoint_set_command/TestWatchLocationWithWatchSet.py
    lldb/branches/windows/test/functionalities/watchpoint/watchpoint_set_command/TestWatchpointSetErrorCases.py
    lldb/branches/windows/test/lang/c/anonymous/TestAnonymous.py
    lldb/branches/windows/test/lang/c/array_types/TestArrayTypes.py
    lldb/branches/windows/test/lang/c/bitfields/TestBitfields.py
    lldb/branches/windows/test/lang/c/blocks/TestBlocks.py
    lldb/branches/windows/test/lang/c/enum_types/TestEnumTypes.py
    lldb/branches/windows/test/lang/c/forward/TestForwardDeclaration.py
    lldb/branches/windows/test/lang/c/function_types/TestFunctionTypes.py
    lldb/branches/windows/test/lang/c/global_variables/TestGlobalVariables.py
    lldb/branches/windows/test/lang/c/set_values/TestSetValues.py
    lldb/branches/windows/test/lang/c/shared_lib/TestSharedLib.py
    lldb/branches/windows/test/lang/c/shared_lib/main.c
    lldb/branches/windows/test/lang/c/stepping/TestThreadStepping.py
    lldb/branches/windows/test/lang/c/strings/TestCStrings.py
    lldb/branches/windows/test/lang/c/struct_types/TestStructTypes.py
    lldb/branches/windows/test/lang/cpp/class_static/TestStaticVariables.py
    lldb/branches/windows/test/lang/cpp/class_types/TestClassTypes.py
    lldb/branches/windows/test/lang/cpp/class_types/TestClassTypesDisassembly.py
    lldb/branches/windows/test/lang/cpp/namespace/TestNamespace.py
    lldb/branches/windows/test/lang/cpp/rvalue-references/TestRvalueReferences.py
    lldb/branches/windows/test/lang/cpp/signed_types/TestSignedTypes.py
    lldb/branches/windows/test/lang/cpp/static_methods/TestCPPStaticMethods.py
    lldb/branches/windows/test/lang/cpp/stl/TestSTL.py
    lldb/branches/windows/test/lang/cpp/stl/TestStdCXXDisassembly.py
    lldb/branches/windows/test/lang/cpp/this/TestCPPThis.py
    lldb/branches/windows/test/lang/cpp/unique-types/TestUniqueTypes.py
    lldb/branches/windows/test/lang/cpp/unsigned_types/TestUnsignedTypes.py
    lldb/branches/windows/test/lang/cpp/virtual/TestVirtual.py
    lldb/branches/windows/test/lang/objc/forward-decl/TestForwardDecl.py
    lldb/branches/windows/test/lang/objc/foundation/TestConstStrings.py
    lldb/branches/windows/test/lang/objc/foundation/TestFoundationDisassembly.py
    lldb/branches/windows/test/lang/objc/foundation/TestObjCMethods.py
    lldb/branches/windows/test/lang/objc/foundation/TestObjCMethods2.py
    lldb/branches/windows/test/lang/objc/foundation/main.m
    lldb/branches/windows/test/lang/objc/hidden-ivars/InternalDefiner.h
    lldb/branches/windows/test/lang/objc/hidden-ivars/InternalDefiner.m
    lldb/branches/windows/test/lang/objc/hidden-ivars/Makefile
    lldb/branches/windows/test/lang/objc/hidden-ivars/TestHiddenIvars.py
    lldb/branches/windows/test/lang/objc/hidden-ivars/main.m
    lldb/branches/windows/test/lang/objc/objc++/TestObjCXX.py
    lldb/branches/windows/test/lang/objc/objc-new-syntax/TestObjCNewSyntax.py
    lldb/branches/windows/test/lang/objc/objc-optimized/TestObjcOptimized.py
    lldb/branches/windows/test/lang/objc/radar-9691614/TestObjCMethodReturningBOOL.py
    lldb/branches/windows/test/lang/objc/rdar-10967107/TestRdar10967107.py
    lldb/branches/windows/test/lang/objc/rdar-10967107/main.m
    lldb/branches/windows/test/lang/objc/rdar-11355592/TestRdar11355592.py
    lldb/branches/windows/test/lang/objc/rdar-11355592/main.m
    lldb/branches/windows/test/lang/objc/real-definition/TestRealDefinition.py
    lldb/branches/windows/test/lang/objc/self/TestObjCSelf.py
    lldb/branches/windows/test/lldbtest.py
    lldb/branches/windows/test/lldbutil.py
    lldb/branches/windows/test/macosx/universal/TestUniversal.py
    lldb/branches/windows/test/make/Makefile.rules
    lldb/branches/windows/test/python_api/formatters/TestFormattersSBAPI.py
    lldb/branches/windows/test/python_api/sbdata/TestSBData.py
    lldb/branches/windows/test/source-manager/TestSourceManager.py
    lldb/branches/windows/test/types/AbstractBase.py
    lldb/branches/windows/tools/debugserver/debugserver.xcodeproj/project.pbxproj
    lldb/branches/windows/www/lldb-gdb.html

Propchange: lldb/branches/windows/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Sep 28 06:07:34 2012
@@ -1,2 +1,2 @@
 /lldb/branches/apple/python-GIL:156467-162159
-/lldb/trunk:163223-164155
+/lldb/trunk:163223-164814

Modified: lldb/branches/windows/examples/python/crashlog.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/examples/python/crashlog.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/examples/python/crashlog.py (original)
+++ lldb/branches/windows/examples/python/crashlog.py Fri Sep 28 06:07:34 2012
@@ -26,7 +26,6 @@
 #   PYTHONPATH=/path/to/LLDB.framework/Resources/Python ./crashlog.py ~/Library/Logs/DiagnosticReports/a.crash
 #----------------------------------------------------------------------
 
-import lldb
 import commands
 import cmd
 import datetime
@@ -42,6 +41,38 @@
 import sys
 import time
 import uuid
+
+try: 
+    # Just try for LLDB in case PYTHONPATH is already correctly setup
+    import lldb
+except ImportError:
+    lldb_python_dirs = list()
+    # lldb is not in the PYTHONPATH, try some defaults for the current platform
+    platform_system = platform.system()
+    if platform_system == 'Darwin':
+        # On Darwin, try the currently selected Xcode directory
+        xcode_dir = commands.getoutput("xcode-select --print-path")
+        if xcode_dir:
+            lldb_python_dirs.append(os.path.realpath(xcode_dir + '/../SharedFrameworks/LLDB.framework/Resources/Python'))
+            lldb_python_dirs.append(xcode_dir + '/Library/PrivateFrameworks/LLDB.framework/Resources/Python')
+        lldb_python_dirs.append('/System/Library/PrivateFrameworks/LLDB.framework/Resources/Python')
+    success = False
+    for lldb_python_dir in lldb_python_dirs:
+        if os.path.exists(lldb_python_dir):
+            if not (sys.path.__contains__(lldb_python_dir)):
+                sys.path.append(lldb_python_dir)
+                try: 
+                    import lldb
+                except ImportError:
+                    pass
+                else:
+                    print 'imported lldb from: "%s"' % (lldb_python_dir)
+                    success = True
+                    break
+    if not success:
+        print "error: couldn't locate the 'lldb' module, please set PYTHONPATH correctly"
+        sys.exit(1)
+
 from lldb.utils import symbolication
 
 PARSE_MODE_NORMAL = 0
@@ -740,7 +771,6 @@
                 SymbolicateCrashLog (crash_log, options)
 if __name__ == '__main__':
     # Create a new debugger instance
-    print 'main'
     lldb.debugger = lldb.SBDebugger.Create()
     SymbolicateCrashLogs (sys.argv[1:])
 elif getattr(lldb, 'debugger', None):

Modified: lldb/branches/windows/examples/python/process_events.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/examples/python/process_events.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/examples/python/process_events.py (original)
+++ lldb/branches/windows/examples/python/process_events.py Fri Sep 28 06:07:34 2012
@@ -92,31 +92,60 @@
     parser.add_option('-c', '--crash-command', action='append', type='string', metavar='CMD', dest='crash_commands', help='LLDB command interpreter commands to run in case the process crashes. This option can be specified more than once.', default=[])
     parser.add_option('-x', '--exit-command', action='append', type='string', metavar='CMD', dest='exit_commands', help='LLDB command interpreter commands to run once after the process has exited. This option can be specified more than once.', default=[])
     parser.add_option('-T', '--no-threads', action='store_false', dest='show_threads', help="Don't show threads when process stops.", default=True)
-    parser.add_option('-e', '--ignore-errors', action='store_false', dest='stop_on_error', help="Don't stop executing LLDB commands if the command returns an error. This applies to all of the LLDB command interpreter commands that get run for launch, stop, crash and exit.", default=True)
+    parser.add_option('--ignore-errors', action='store_false', dest='stop_on_error', help="Don't stop executing LLDB commands if the command returns an error. This applies to all of the LLDB command interpreter commands that get run for launch, stop, crash and exit.", default=True)
     parser.add_option('-n', '--run-count', type='int', dest='run_count', metavar='N', help='How many times to run the process in case the process exits.', default=1)
-    parser.add_option('-t', '--event-timeout', type='int', dest='event_timeout', metavar='SEC', help='Specify the timeout in seconds to wait for process state change events.', default=5)
+    parser.add_option('-t', '--event-timeout', type='int', dest='event_timeout', metavar='SEC', help='Specify the timeout in seconds to wait for process state change events.', default=lldb.UINT32_MAX)
+    parser.add_option('-e', '--environment', action='append', type='string', metavar='ENV', dest='env_vars', help='Environment variables to set in the inferior process when launching a process.')
+    parser.add_option('-d', '--working-dir', type='string', metavar='DIR', dest='working_dir', help='The the current working directory when launching a process.', default=None)
+    parser.add_option('-p', '--attach-pid', type='int', dest='attach_pid', metavar='PID', help='Specify a process to attach to by process ID.', default=-1)
+    parser.add_option('-P', '--attach-name', type='string', dest='attach_name', metavar='PROCESSNAME', help='Specify a process to attach to by name.', default=None)
+    parser.add_option('-w', '--attach-wait', action='store_true', dest='attach_wait', help='Wait for the next process to launch when attaching to a process by name.', default=False)
     try:
         (options, args) = parser.parse_args(argv)
     except:
         return
-    if not args:
+        
+    attach_info = None
+    launch_info = None
+    exe = None
+    if args:
+        exe = args.pop(0)
+        launch_info = lldb.SBLaunchInfo (args)
+        if options.env_vars:
+            launch_info.SetEnvironmentEntries(options.env_vars, True)
+        if options.working_dir:
+            launch_info.SetWorkingDirectory(options.working_dir)
+    elif options.attach_pid != -1:
+        if options.run_count == 1:
+            attach_info = lldb.SBAttachInfo (options.attach_pid)
+        else:
+            print "error: --run-count can't be used with the --attach-pid option"
+            sys.exit(1)
+    elif not options.attach_name is None:
+        if options.run_count == 1:
+            attach_info = lldb.SBAttachInfo (options.attach_name, options.attach_wait)
+        else:
+            print "error: --run-count can't be used with the --attach-name option"
+            sys.exit(1)
+    else:
         print 'error: a program path for a program to debug and its arguments are required'
         sys.exit(1)
+        
     
-    exe = args.pop(0)
 
     # Create a new debugger instance
     debugger = lldb.SBDebugger.Create()
     command_interpreter = debugger.GetCommandInterpreter()
     # Create a target from a file and arch
-    print "Creating a target for '%s'" % exe
     
+    if exe:
+        print "Creating a target for '%s'" % exe
     target = debugger.CreateTargetWithFileAndArch (exe, options.arch)
     
     if target:
         
-        # Set any breakpoints that were specified in the args
-        if options.breakpoints:
+        # Set any breakpoints that were specified in the args if we are launching
+        if launch_info and options.breakpoints:
             for bp in options.breakpoints:
                 debugger.HandleCommand( "_regexp-break %s" % (bp))
             run_commands(command_interpreter, ['breakpoint list'])
@@ -124,15 +153,27 @@
         for run_idx in range(options.run_count):
             # Launch the process. Since we specified synchronous mode, we won't return
             # from this function until we hit the breakpoint at main
-            if options.run_count == 1:
-                print 'Launching "%s"...' % (exe)
-            else:
-                print 'Launching "%s"... (launch %u of %u)' % (exe, run_idx + 1, options.run_count)
+            error = lldb.SBError()
+            
+            if launch_info:
+                if options.run_count == 1:
+                    print 'Launching "%s"...' % (exe)
+                else:
+                    print 'Launching "%s"... (launch %u of %u)' % (exe, run_idx + 1, options.run_count)
             
-            process = target.LaunchSimple (args, None, os.getcwd())
+                process = target.Launch (launch_info, error)
+            else:
+                if options.attach_pid != -1:
+                    print 'Attaching to process %i...' % (options.attach_pid)
+                else:
+                    if options.attach_wait:
+                        print 'Waiting for next to process named "%s" to launch...' % (options.attach_name)
+                    else:
+                        print 'Attaching to existing process named "%s"...' % (options.attach_name)
+                process = target.Attach (attach_info, error)
             
             # Make sure the launch went ok
-            if process:
+            if process and process.GetProcessID() != lldb.LLDB_INVALID_PROCESS_ID:
                 pid = process.GetProcessID()
                 listener = lldb.SBListener("event_listener")
                 # sign up for process state change events
@@ -145,7 +186,16 @@
                         state = lldb.SBProcess.GetStateFromEvent (event)
                         if state == lldb.eStateStopped:
                             if stop_idx == 0:
-                                print "process %u launched" % (pid)
+                                if launch_info:
+                                    print "process %u launched" % (pid)
+                                else:
+                                    print "attached to process %u" % (pid)
+                                    for m in target.modules:
+                                        print m
+                                    if options.breakpoints:
+                                        for bp in options.breakpoints:
+                                            debugger.HandleCommand( "_regexp-break %s" % (bp))
+                                        run_commands(command_interpreter, ['breakpoint list'])
                                 run_commands (command_interpreter, options.launch_commands)
                             else:
                                 if options.verbose:
@@ -188,6 +238,14 @@
                         print "no process event for %u seconds, killing the process..." % (options.event_timeout)
                         done = True
                 process.Kill() # kill the process
+            else:
+                if error:
+                    print error
+                else:
+                    if launch_info:
+                        print 'error: launch failed'
+                    else:
+                        print 'error: attach failed'
     
     lldb.SBDebugger.Terminate()
 

Modified: lldb/branches/windows/examples/summaries/cocoa/objc_runtime.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/examples/summaries/cocoa/objc_runtime.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/examples/summaries/cocoa/objc_runtime.py (original)
+++ lldb/branches/windows/examples/summaries/cocoa/objc_runtime.py Fri Sep 28 06:07:34 2012
@@ -104,9 +104,8 @@
 			return class_data,wrapper
 		if class_data.is_kvo():
 			class_data = class_data.get_superclass()
-		if class_data.is_valid() == 0:
-			statistics.metric_hit('invalid_isa',valobj)
-			wrapper = InvalidISA_Description()
+		if class_data.class_name() == '_NSZombie_OriginalClass':
+			wrapper = ThisIsZombie_Description()
 			return class_data,wrapper
 		return class_data,None
 
@@ -789,3 +788,6 @@
 	def message(self):
 		return '<not an Objective-C object>'
 
+class ThisIsZombie_Description(SpecialSituation_Description):
+	def message(self):
+		return '<freed object>'
\ No newline at end of file

Modified: lldb/branches/windows/include/lldb/API/SBBreakpoint.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/API/SBBreakpoint.h?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/API/SBBreakpoint.h (original)
+++ lldb/branches/windows/include/lldb/API/SBBreakpoint.h Fri Sep 28 06:07:34 2012
@@ -63,6 +63,9 @@
 
     bool
     IsEnabled ();
+    
+    bool
+    IsInternal ();
 
     uint32_t
     GetHitCount () const;

Modified: lldb/branches/windows/include/lldb/Core/ArchSpec.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Core/ArchSpec.h?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Core/ArchSpec.h (original)
+++ lldb/branches/windows/include/lldb/Core/ArchSpec.h Fri Sep 28 06:07:34 2012
@@ -82,6 +82,8 @@
         eCore_x86_32_i486sx,
         
         eCore_x86_64_x86_64,
+        eCore_uknownMach32,
+        eCore_uknownMach64,
         kNumCores,
 
         kCore_invalid,

Modified: lldb/branches/windows/include/lldb/Core/Stream.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Core/Stream.h?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Core/Stream.h (original)
+++ lldb/branches/windows/include/lldb/Core/Stream.h Fri Sep 28 06:07:34 2012
@@ -590,7 +590,7 @@
     static void
     UnitTest(Stream *s);
 
-private:
+protected:
     //------------------------------------------------------------------
     // Member variables
     //------------------------------------------------------------------

Modified: lldb/branches/windows/include/lldb/Core/StreamBuffer.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Core/StreamBuffer.h?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Core/StreamBuffer.h (original)
+++ lldb/branches/windows/include/lldb/Core/StreamBuffer.h Fri Sep 28 06:07:34 2012
@@ -61,6 +61,10 @@
         m_packet.clear();
     }
 
+    // Beware, this might not be NULL terminated as you can expect from
+    // StringString as there may be random bits in the llvm::SmallVector. If
+    // you are using this class to create a C string, be sure the call PutChar ('\0')
+    // after you have created your string, or use StreamString.
     const char *
     GetData () const
     {

Modified: lldb/branches/windows/include/lldb/Core/UUID.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Core/UUID.h?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Core/UUID.h (original)
+++ lldb/branches/windows/include/lldb/Core/UUID.h Fri Sep 28 06:07:34 2012
@@ -58,8 +58,36 @@
     GetAsCString (char *dst, size_t dst_len) const;
 
     size_t
-    SetfromCString (const char *c_str);
+    SetFromCString (const char *c_str);
 
+    // Decode as many UUID bytes (up to 16) as possible from the C string "cstr"
+    // This is used for auto completion where a partial UUID might have been
+    // typed in. It 
+    //------------------------------------------------------------------
+    /// Decode as many UUID bytes (up to 16) as possible from the C
+    /// string \a cstr.
+    ///
+    /// @param[in] cstr
+    ///     A NULL terminate C string that points at a UUID string value
+    ///     (no leading spaces). The string must contain only hex
+    ///     characters and optionally can contain the '-' sepearators.
+    ///
+    /// @param[in] uuid_bytes
+    ///     A buffer of bytes that will contain a full or patially
+    ///     decoded UUID.
+    ///
+    /// @param[out] end
+    ///     If \a end is not NULL, it will be filled in with the a
+    ///     pointer to the character after the last successfully decoded
+    ///     byte.
+    ///
+    /// @return
+    ///     Returns the number of bytes that were successfully decoded
+    ///     which should be 16 if a full UUID value was properly decoded.
+    //------------------------------------------------------------------
+    static size_t
+    DecodeUUIDBytesFromCString (const char *cstr, ValueType &uuid_bytes, const char **end);
+    
 protected:
     //------------------------------------------------------------------
     // Classes that inherit from UUID can see and modify these

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=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Core/ValueObject.h (original)
+++ lldb/branches/windows/include/lldb/Core/ValueObject.h Fri Sep 28 06:07:34 2012
@@ -1065,6 +1065,12 @@
         return m_address_type_of_ptr_or_ref_children;
     }
     
+    void
+    SetHasCompleteType()
+    {
+        m_did_calculate_complete_objc_class_type = true;
+    }
+    
 protected:
     typedef ClusterManager<ValueObject> ValueObjectManager;
     

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=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Expression/ClangASTSource.h (original)
+++ lldb/branches/windows/include/lldb/Expression/ClangASTSource.h Fri Sep 28 06:07:34 2012
@@ -321,6 +321,20 @@
     
 protected:
     //------------------------------------------------------------------
+    /// Look for the complete version of an Objective-C interface, and
+    /// return it if found.
+    ///
+    /// @param[in] interface_decl
+    ///     An ObjCInterfaceDecl that may not be the complete one.
+    ///
+    /// @return
+    ///     NULL if the complete interface couldn't be found;
+    ///     the complete interface otherwise.
+    //------------------------------------------------------------------
+    clang::ObjCInterfaceDecl *
+    GetCompleteObjCInterface (clang::ObjCInterfaceDecl *interface_decl);
+    
+    //------------------------------------------------------------------
     /// Find all entities matching a given name in a given module,
     /// using a NameSearchContext to make Decls for them.
     ///

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=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Expression/IRForTarget.h (original)
+++ lldb/branches/windows/include/lldb/Expression/IRForTarget.h Fri Sep 28 06:07:34 2012
@@ -636,6 +636,23 @@
     bool 
     ReplaceVariables (llvm::Function &llvm_function);
     
+    //------------------------------------------------------------------
+    /// A module-level pass to remove all global variables from the
+    /// module since it no longer should export or import any symbols.
+    //------------------------------------------------------------------
+    
+    //------------------------------------------------------------------
+    /// The top-level pass implementation
+    ///
+    /// @param[in] llvm_module
+    ///     The module currently being processed.
+    ///
+    /// @return
+    ///     True on success; false otherwise
+    //------------------------------------------------------------------
+    bool
+    StripAllGVs (llvm::Module &llvm_module);
+    
     /// 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

Modified: lldb/branches/windows/include/lldb/Expression/RecordingMemoryManager.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Expression/RecordingMemoryManager.h?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Expression/RecordingMemoryManager.h (original)
+++ lldb/branches/windows/include/lldb/Expression/RecordingMemoryManager.h Fri Sep 28 06:07:34 2012
@@ -84,15 +84,6 @@
     //------------------------------------------------------------------
     /// Passthrough interface stub
     //------------------------------------------------------------------
-    virtual void *getPointerToNamedFunction(const std::string &Name,
-                                          bool AbortOnFailure = true)
-    {
-        return m_default_mm_ap->getPointerToNamedFunction(Name, AbortOnFailure);
-    }
-
-    //------------------------------------------------------------------
-    /// Passthrough interface stub
-    //------------------------------------------------------------------
     virtual void AllocateGOT()
     {
         m_default_mm_ap->AllocateGOT();
@@ -290,6 +281,14 @@
     virtual unsigned GetNumStubSlabs() {
         return m_default_mm_ap->GetNumStubSlabs();
     }
+    
+    //------------------------------------------------------------------
+    /// Passthrough interface stub
+    //------------------------------------------------------------------
+    virtual void *getPointerToNamedFunction(const std::string &Name,
+                                            bool AbortOnFailure = true) {
+        return m_default_mm_ap->getPointerToNamedFunction(Name, AbortOnFailure);
+    }
 
     //------------------------------------------------------------------
     /// [Convenience method for ClangExpressionParser] Look up the object in

Modified: lldb/branches/windows/include/lldb/Host/Host.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Host/Host.h?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Host/Host.h (original)
+++ lldb/branches/windows/include/lldb/Host/Host.h Fri Sep 28 06:07:34 2012
@@ -420,7 +420,8 @@
                      int *status_ptr,               // Pass NULL if you don't want the process exit status
                      int *signo_ptr,                // Pass NULL if you don't want the signal that caused the process to exit
                      std::string *command_output,   // Pass NULL if you don't want the command output
-                     uint32_t timeout_sec);         // Timeout in seconds to wait for shell program to finish
+                     uint32_t timeout_sec,
+                     const char *shell = "/bin/bash");
     
     static lldb::DataBufferSP
     GetAuxvData (lldb_private::Process *process);

Modified: lldb/branches/windows/include/lldb/Host/Symbols.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Host/Symbols.h?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Host/Symbols.h (original)
+++ lldb/branches/windows/include/lldb/Host/Symbols.h Fri Sep 28 06:07:34 2012
@@ -23,9 +23,21 @@
 class Symbols
 {
 public:
+    //----------------------------------------------------------------------
+    // Locate the executable file given a module specification.
+    //
+    // Locating the file should happen only on the local computer or using
+    // the current computers global settings.
+    //----------------------------------------------------------------------
     static FileSpec
     LocateExecutableObjectFile (const ModuleSpec &module_spec);
 
+    //----------------------------------------------------------------------
+    // Locate the symbol file given a module specification.
+    //
+    // Locating the file should happen only on the local computer or using
+    // the current computers global settings.
+    //----------------------------------------------------------------------
     static FileSpec
     LocateExecutableSymbolFile (const ModuleSpec &module_spec);
     
@@ -33,6 +45,17 @@
     FindSymbolFileInBundle (const FileSpec& dsym_bundle_fspec,
                             const lldb_private::UUID *uuid,
                             const ArchSpec *arch);
+    
+    //----------------------------------------------------------------------
+    // Locate the object and symbol file given a module specification.
+    //
+    // Locating the file can try to download the file from a corporate build
+    // respository, or using any other meeans necessary to locate both the
+    // unstripped object file and the debug symbols.
+    //----------------------------------------------------------------------
+    static bool
+    DownloadObjectAndSymbolFile (ModuleSpec &module_spec);
+                                 
 };
 
 } // namespace lldb_private

Modified: lldb/branches/windows/include/lldb/Interpreter/CommandObject.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Interpreter/CommandObject.h?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Interpreter/CommandObject.h (original)
+++ lldb/branches/windows/include/lldb/Interpreter/CommandObject.h Fri Sep 28 06:07:34 2012
@@ -99,7 +99,7 @@
     const char *
     GetHelp ();
 
-    const char *
+    virtual const char *
     GetHelpLong ();
 
     const char *

Modified: lldb/branches/windows/include/lldb/Interpreter/OptionGroupBoolean.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Interpreter/OptionGroupBoolean.h?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Interpreter/OptionGroupBoolean.h (original)
+++ lldb/branches/windows/include/lldb/Interpreter/OptionGroupBoolean.h Fri Sep 28 06:07:34 2012
@@ -25,15 +25,16 @@
     class OptionGroupBoolean : public OptionGroup
     {
     public:
-        
+         // When 'no_argument_toggle_default' is true, then setting the option
+         // value does NOT require an argument, it sets the boolean value to the
+         // inverse of the default value
         OptionGroupBoolean (uint32_t usage_mask,
                             bool required,
                             const char *long_option, 
                             char short_option,
-                            uint32_t completion_type,
-                            lldb::CommandArgumentType argument_type,
                             const char *usage_text,
-                            bool default_value);
+                            bool default_value,
+                            bool no_argument_toggle_default);
         
         virtual
         ~OptionGroupBoolean ();
@@ -76,7 +77,7 @@
         OptionDefinition m_option_definition;
         
     };
-    
+
 } // namespace lldb_private
 
 #endif  // liblldb_OptionGroupBoolean_h_

Modified: lldb/branches/windows/include/lldb/Interpreter/OptionValueFileSpec.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Interpreter/OptionValueFileSpec.h?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Interpreter/OptionValueFileSpec.h (original)
+++ lldb/branches/windows/include/lldb/Interpreter/OptionValueFileSpec.h Fri Sep 28 06:07:34 2012
@@ -22,30 +22,12 @@
 class OptionValueFileSpec : public OptionValue
 {
 public:
-    OptionValueFileSpec () :
-        OptionValue(),
-        m_current_value (),
-        m_default_value (),
-        m_data_sp()
-    {
-    }
+    OptionValueFileSpec ();
     
-    OptionValueFileSpec (const FileSpec &value) :
-        OptionValue(),
-        m_current_value (value),
-        m_default_value (value),
-        m_data_sp()
-    {
-    }
+    OptionValueFileSpec (const FileSpec &value);
     
     OptionValueFileSpec (const FileSpec &current_value, 
-                         const FileSpec &default_value) :
-        OptionValue(),
-        m_current_value (current_value),
-        m_default_value (default_value),
-        m_data_sp()
-    {
-    }
+                         const FileSpec &default_value);
     
     virtual 
     ~OptionValueFileSpec()
@@ -129,10 +111,17 @@
     const lldb::DataBufferSP &
     GetFileContents(bool null_terminate);
     
+    void
+    SetCompletionMask (uint32_t mask)
+    {
+        m_completion_mask = mask;
+    }
+
 protected:
     FileSpec m_current_value;
     FileSpec m_default_value;
     lldb::DataBufferSP m_data_sp;
+    uint32_t m_completion_mask;
 };
 
 } // namespace lldb_private

Modified: lldb/branches/windows/include/lldb/Interpreter/OptionValueUUID.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Interpreter/OptionValueUUID.h?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Interpreter/OptionValueUUID.h (original)
+++ lldb/branches/windows/include/lldb/Interpreter/OptionValueUUID.h Fri Sep 28 06:07:34 2012
@@ -89,6 +89,14 @@
         m_uuid = value;
     }
     
+    virtual size_t
+    AutoComplete (CommandInterpreter &interpreter,
+                  const char *s,
+                  int match_start_point,
+                  int max_return_elements,
+                  bool &word_complete,
+                  StringList &matches);
+
 protected:
     UUID m_uuid;
 };

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=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Interpreter/ScriptInterpreter.h (original)
+++ lldb/branches/windows/include/lldb/Interpreter/ScriptInterpreter.h Fri Sep 28 06:07:34 2012
@@ -298,10 +298,11 @@
         return false;
     }
     
-    virtual std::string
-    GetDocumentationForItem (const char* item)
+    virtual bool
+    GetDocumentationForItem (const char* item, std::string& dest)
     {
-        return std::string("");
+		dest.clear();
+        return false;
     }
 
     virtual bool

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=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Interpreter/ScriptInterpreterPython.h (original)
+++ lldb/branches/windows/include/lldb/Interpreter/ScriptInterpreterPython.h Fri Sep 28 06:07:34 2012
@@ -149,8 +149,8 @@
                         lldb::ScriptInterpreterObjectSP& callee_wrapper_sp,
                         std::string& retval);
     
-    virtual std::string
-    GetDocumentationForItem (const char* item);
+    virtual bool
+    GetDocumentationForItem (const char* item, std::string& dest);
     
     virtual bool
     LoadScriptingModule (const char* filename,

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=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Symbol/ClangASTImporter.h (original)
+++ lldb/branches/windows/include/lldb/Symbol/ClangASTImporter.h Fri Sep 28 06:07:34 2012
@@ -80,6 +80,9 @@
         return origin.Valid();
     }
     
+    void
+    SetDeclOrigin (const clang::Decl *decl, clang::Decl *original_decl);
+    
     uint64_t
     GetDeclMetadata (const clang::Decl *decl);
     

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=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Target/ObjCLanguageRuntime.h (original)
+++ lldb/branches/windows/include/lldb/Target/ObjCLanguageRuntime.h Fri Sep 28 06:07:34 2012
@@ -12,6 +12,7 @@
 
 // C Includes
 // C++ Includes
+#include <functional>
 #include <map>
 
 // Other libraries and framework includes
@@ -67,7 +68,8 @@
             if (m_is_kvo == eLazyBoolCalculate)
             {
                 const char* class_name = GetClassName().AsCString();
-                m_is_kvo = (LazyBool)(strstr(class_name,"NSKVONotifying_") == class_name);
+                if (class_name && *class_name)
+                    m_is_kvo = (LazyBool)(strstr(class_name,"NSKVONotifying_") == class_name);
             }
             return (m_is_kvo == eLazyBoolYes);
         }
@@ -80,8 +82,9 @@
             if (m_is_cf == eLazyBoolCalculate)
             {
                 const char* class_name = GetClassName().AsCString();
-                m_is_cf = (LazyBool)(strcmp(class_name,"__NSCFType") == 0 ||
-                                     strcmp(class_name,"NSCFType") == 0);
+                if (class_name && *class_name)
+                    m_is_cf = (LazyBool)(strcmp(class_name,"__NSCFType") == 0 ||
+                                         strcmp(class_name,"NSCFType") == 0);
             }
             return (m_is_cf == eLazyBoolYes);
         }
@@ -113,6 +116,15 @@
         virtual ObjCISA
         GetISA () = 0;
         
+        // This should return true iff the interface could be completed
+        virtual bool
+        Describe (std::function <void (ObjCISA)> const &superclass_func,
+                  std::function <void (const char*, const char*)> const &instance_method_func,
+                  std::function <void (const char*, const char*)> const &class_method_func)
+        {
+            return false;
+        }
+        
         virtual
         ~ClassDescriptor ()
         {}

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=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Target/Thread.h (original)
+++ lldb/branches/windows/include/lldb/Target/Thread.h Fri Sep 28 06:07:34 2012
@@ -226,6 +226,9 @@
     lldb::StopInfoSP
     GetStopInfo ();
 
+    lldb::StopReason
+    GetStopReason();
+
     // This sets the stop reason to a "blank" stop reason, so you can call functions on the thread
     // without having the called function run with whatever stop reason you stopped with.
     void
@@ -721,6 +724,27 @@
     virtual lldb::StopInfoSP
     GetPrivateStopReason () = 0;
 
+    //----------------------------------------------------------------------
+    // Gets the temporary resume state for a thread.
+    //
+    // This value gets set in each thread by complex debugger logic in
+    // Thread::WillResume() and an appropriate thread resume state will get
+    // set in each thread every time the process is resumed prior to calling
+    // Process::DoResume(). The lldb_private::Process subclass should adhere
+    // to the thread resume state request which will be one of:
+    //
+    //  eStateRunning   - thread will resume when process is resumed
+    //  eStateStepping  - thread should step 1 instruction and stop when process
+    //                    is resumed
+    //  eStateSuspended - thread should not execute any instructions when
+    //                    process is resumed
+    //----------------------------------------------------------------------
+    lldb::StateType
+    GetTemporaryResumeState() const
+    {
+        return m_temporary_resume_state;
+    }
+
 protected:
 
     friend class ThreadPlan;
@@ -764,18 +788,6 @@
     lldb::StackFrameListSP
     GetStackFrameList ();
     
-    lldb::StateType GetTemporaryResumeState()
-    {
-        return m_temporary_resume_state;
-    }
-    
-    lldb::StateType SetTemporaryResumeState(lldb::StateType resume_state)
-    {
-        lldb::StateType old_temp_resume_state = m_temporary_resume_state;
-        m_temporary_resume_state = resume_state;
-        return old_temp_resume_state;
-    }
-    
     struct ThreadState
     {
         uint32_t           orig_stop_id;

Modified: lldb/branches/windows/include/lldb/lldb-enumerations.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/lldb-enumerations.h?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/lldb-enumerations.h (original)
+++ lldb/branches/windows/include/lldb/lldb-enumerations.h Fri Sep 28 06:07:34 2012
@@ -137,6 +137,7 @@
         eDescriptionLevelBrief = 0,
         eDescriptionLevelFull,
         eDescriptionLevelVerbose,
+        eDescriptionLevelInitial,
         kNumDescriptionLevels
     } DescriptionLevel;
 

Modified: lldb/branches/windows/lib/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/lib/Makefile?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/lib/Makefile (original)
+++ lldb/branches/windows/lib/Makefile Fri Sep 28 06:07:34 2012
@@ -58,9 +58,7 @@
 	clangFrontend.a \
 	clangDriver.a \
 	clangEdit.a \
-	clangIndex.a \
 	clangLex.a \
-	clangRewrite.a \
 	clangParse.a \
 	clangSema.a \
 	clangSerialization.a \

Modified: lldb/branches/windows/lldb.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/lldb.xcodeproj/project.pbxproj?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/branches/windows/lldb.xcodeproj/project.pbxproj Fri Sep 28 06:07:34 2012
@@ -4276,14 +4276,14 @@
 				LLDB_TOOLS_INSTALL_DIR = /usr/bin;
 				LLVM_BUILD_DIR = "$(SRCROOT)/llvm-build/$(LLVM_CONFIGURATION)";
 				LLVM_BUILD_DIR_ARCH = "$(CURRENT_ARCH)/";
-				LLVM_CONFIGURATION = "Debug+Asserts";
+				LLVM_CONFIGURATION = "Release+Asserts";
 				LLVM_SOURCE_DIR = "$(SRCROOT)/llvm";
 				ONLY_ACTIVE_ARCH = YES;
 				OTHER_CFLAGS = (
 					"-flimit-debug-info",
 					"-Wparentheses",
 				);
-				SDKROOT = "";
+				SDKROOT = macosx;
 				STRIP_INSTALLED_PRODUCT = NO;
 				STRIP_STYLE = debugging;
 				VALID_ARCHS = "armv4t armv5 armv6 armv7 armv7s i386 ppc ppc64 ppc7400 ppc970 x86_64";
@@ -4341,7 +4341,7 @@
 					"-flimit-debug-info",
 					"-Wparentheses",
 				);
-				SDKROOT = "";
+				SDKROOT = macosx;
 				STRIP_INSTALLED_PRODUCT = NO;
 				STRIP_STYLE = debugging;
 				VALID_ARCHS = "armv4t armv5 armv6 armv7 armv7s i386 ppc ppc64 ppc7400 ppc970 x86_64";
@@ -4395,9 +4395,9 @@
 				CLANG_LINK_OBJC_RUNTIME = NO;
 				CLANG_OBJC_RUNTIME = NO;
 				COMBINE_HIDPI_IMAGES = YES;
-				CURRENT_PROJECT_VERSION = 165;
+				CURRENT_PROJECT_VERSION = 168;
 				DYLIB_COMPATIBILITY_VERSION = 1;
-				DYLIB_CURRENT_VERSION = 165;
+				DYLIB_CURRENT_VERSION = 168;
 				EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports";
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
@@ -4452,10 +4452,10 @@
 				CLANG_LINK_OBJC_RUNTIME = NO;
 				CLANG_OBJC_RUNTIME = NO;
 				COMBINE_HIDPI_IMAGES = YES;
-				CURRENT_PROJECT_VERSION = 165;
+				CURRENT_PROJECT_VERSION = 168;
 				DEAD_CODE_STRIPPING = YES;
 				DYLIB_COMPATIBILITY_VERSION = 1;
-				DYLIB_CURRENT_VERSION = 165;
+				DYLIB_CURRENT_VERSION = 168;
 				EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports";
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
@@ -4510,7 +4510,7 @@
 				ARCHS = "$(ARCHS_STANDARD_64_BIT)";
 				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
 				COMBINE_HIDPI_IMAGES = YES;
-				CURRENT_PROJECT_VERSION = 165;
+				CURRENT_PROJECT_VERSION = 168;
 				DEBUGGING_SYMBOLS = YES;
 				GCC_DYNAMIC_NO_PIC = NO;
 				GCC_ENABLE_OBJC_EXCEPTIONS = YES;
@@ -4537,7 +4537,7 @@
 				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
 				COMBINE_HIDPI_IMAGES = YES;
 				COPY_PHASE_STRIP = YES;
-				CURRENT_PROJECT_VERSION = 165;
+				CURRENT_PROJECT_VERSION = 168;
 				GCC_ENABLE_OBJC_EXCEPTIONS = YES;
 				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
 				MACOSX_DEPLOYMENT_TARGET = 10.7;
@@ -4555,7 +4555,7 @@
 				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
 				COMBINE_HIDPI_IMAGES = YES;
 				COPY_PHASE_STRIP = YES;
-				CURRENT_PROJECT_VERSION = 165;
+				CURRENT_PROJECT_VERSION = 168;
 				GCC_ENABLE_OBJC_EXCEPTIONS = YES;
 				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
 				MACOSX_DEPLOYMENT_TARGET = 10.7;
@@ -4570,8 +4570,8 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				COMBINE_HIDPI_IMAGES = YES;
-				CURRENT_PROJECT_VERSION = 165;
-				DYLIB_CURRENT_VERSION = 165;
+				CURRENT_PROJECT_VERSION = 168;
+				DYLIB_CURRENT_VERSION = 168;
 				EXECUTABLE_EXTENSION = a;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
@@ -4601,8 +4601,8 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				COMBINE_HIDPI_IMAGES = YES;
-				CURRENT_PROJECT_VERSION = 165;
-				DYLIB_CURRENT_VERSION = 165;
+				CURRENT_PROJECT_VERSION = 168;
+				DYLIB_CURRENT_VERSION = 168;
 				EXECUTABLE_EXTENSION = a;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
@@ -4632,8 +4632,8 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				COMBINE_HIDPI_IMAGES = YES;
-				CURRENT_PROJECT_VERSION = 165;
-				DYLIB_CURRENT_VERSION = 165;
+				CURRENT_PROJECT_VERSION = 168;
+				DYLIB_CURRENT_VERSION = 168;
 				EXECUTABLE_EXTENSION = a;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
@@ -4713,7 +4713,7 @@
 					"-flimit-debug-info",
 					"-Wparentheses",
 				);
-				SDKROOT = "";
+				SDKROOT = macosx;
 				STRIP_INSTALLED_PRODUCT = NO;
 				STRIP_STYLE = debugging;
 				VALID_ARCHS = "armv4t armv5 armv6 armv7 armv7s i386 ppc ppc64 ppc7400 ppc970 x86_64";
@@ -4725,7 +4725,7 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				COPY_PHASE_STRIP = YES;
-				CURRENT_PROJECT_VERSION = 165;
+				CURRENT_PROJECT_VERSION = 168;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
 					"\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"",
@@ -4766,10 +4766,10 @@
 				CLANG_OBJC_RUNTIME = NO;
 				COMBINE_HIDPI_IMAGES = YES;
 				COPY_PHASE_STRIP = YES;
-				CURRENT_PROJECT_VERSION = 165;
+				CURRENT_PROJECT_VERSION = 168;
 				DEAD_CODE_STRIPPING = YES;
 				DYLIB_COMPATIBILITY_VERSION = 1;
-				DYLIB_CURRENT_VERSION = 165;
+				DYLIB_CURRENT_VERSION = 168;
 				EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports";
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
@@ -5085,7 +5085,7 @@
 		26F5C26C10F3D9A5009D5894 /* Debug */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
-				CURRENT_PROJECT_VERSION = 165;
+				CURRENT_PROJECT_VERSION = 168;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
 					"\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"",
@@ -5115,7 +5115,7 @@
 		26F5C26D10F3D9A5009D5894 /* Release */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
-				CURRENT_PROJECT_VERSION = 165;
+				CURRENT_PROJECT_VERSION = 168;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
 					"\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"",
@@ -5139,6 +5139,385 @@
 			};
 			name = Release;
 		};
+		49BB8F341611172B00BDD462 /* DebugClang */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				ARCHS = "$(NATIVE_ARCH)";
+				"ARCHS[sdk=iphoneos*]" = armv7;
+				"ARCHS[sdk=macosx*]" = (
+					x86_64,
+					i386,
+				);
+				CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
+				CLANG_CXX_LIBRARY = "libc++";
+				COPY_PHASE_STRIP = NO;
+				DEBUG_INFORMATION_FORMAT = dwarf;
+				GCC_C_LANGUAGE_STANDARD = c99;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					__STDC_CONSTANT_MACROS,
+					__STDC_LIMIT_MACROS,
+					LLDB_CONFIGURATION_DEBUG,
+				);
+				"GCC_PREPROCESSOR_DEFINITIONS[sdk=iphoneos*][arch=*]" = (
+					__STDC_CONSTANT_MACROS,
+					__STDC_LIMIT_MACROS,
+					LLDB_CONFIGURATION_DEBUG,
+					LLDB_DISABLE_PYTHON,
+					NO_XPC_SERVICES,
+				);
+				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+				GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES;
+				GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
+				GCC_WARN_ABOUT_RETURN_TYPE = YES;
+				GCC_WARN_EFFECTIVE_CPLUSPLUS_VIOLATIONS = NO;
+				GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES;
+				GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES;
+				GCC_WARN_MISSING_PARENTHESES = YES;
+				GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES;
+				GCC_WARN_UNINITIALIZED_AUTOS = YES;
+				GCC_WARN_UNUSED_LABEL = YES;
+				GCC_WARN_UNUSED_VALUE = YES;
+				GCC_WARN_UNUSED_VARIABLE = YES;
+				LLDB_DISABLE_PYTHON = 0;
+				"LLDB_DISABLE_PYTHON[sdk=iphoneos*]" = 1;
+				LLDB_FRAMEWORK_INSTALL_DIR = /Applications/Xcode.app/Contents/SharedFrameworks;
+				LLDB_TOOLS_INSTALL_DIR = /usr/bin;
+				LLVM_BUILD_DIR = "$(SRCROOT)/llvm-build/$(LLVM_CONFIGURATION)";
+				LLVM_BUILD_DIR_ARCH = "$(CURRENT_ARCH)/";
+				LLVM_CONFIGURATION = "Debug+Asserts";
+				LLVM_SOURCE_DIR = "$(SRCROOT)/llvm";
+				ONLY_ACTIVE_ARCH = YES;
+				OTHER_CFLAGS = (
+					"-flimit-debug-info",
+					"-Wparentheses",
+				);
+				SDKROOT = macosx;
+				STRIP_INSTALLED_PRODUCT = NO;
+				STRIP_STYLE = debugging;
+				VALID_ARCHS = "armv4t armv5 armv6 armv7 armv7s i386 ppc ppc64 ppc7400 ppc970 x86_64";
+				WARNING_CFLAGS = "-Wreorder";
+			};
+			name = DebugClang;
+		};
+		49BB8F351611172B00BDD462 /* DebugClang */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				COMBINE_HIDPI_IMAGES = YES;
+				PRODUCT_NAME = "$(TARGET_NAME)";
+			};
+			name = DebugClang;
+		};
+		49BB8F361611172B00BDD462 /* DebugClang */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				COMBINE_HIDPI_IMAGES = YES;
+				PRODUCT_NAME = "$(TARGET_NAME)";
+			};
+			name = DebugClang;
+		};
+		49BB8F371611172B00BDD462 /* DebugClang */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				COMBINE_HIDPI_IMAGES = YES;
+				PRODUCT_NAME = "$(TARGET_NAME)";
+			};
+			name = DebugClang;
+		};
+		49BB8F381611172B00BDD462 /* DebugClang */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				CURRENT_PROJECT_VERSION = 168;
+				FRAMEWORK_SEARCH_PATHS = (
+					"$(inherited)",
+					"\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"",
+				);
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+				HEADER_SEARCH_PATHS = "";
+				INFOPLIST_FILE = "lldb-Info.plist";
+				INSTALL_PATH = "$(LLDB_TOOLS_INSTALL_DIR)";
+				LIBRARY_SEARCH_PATHS = "$(inherited)";
+				LLVM_BUILD_DIR_ARCH = "$(OBJROOT)/llvm";
+				OTHER_LDFLAGS = (
+					"-sectcreate",
+					__TEXT,
+					__info_plist,
+					"$(PROJECT_DIR)/tools/driver/lldb-Info.plist",
+					"-Wl,-rpath, at loader_path/",
+				);
+				PRODUCT_NAME = lldb;
+				USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/include $(SRCROOT)/source $(LLVM_SOURCE_DIR)/include $(LLVM_SOURCE_DIR)/tools/clang/include $(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)/include $(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)/tools/clang/include";
+				VERSIONING_SYSTEM = "apple-generic";
+			};
+			name = DebugClang;
+		};
+		49BB8F391611172B00BDD462 /* DebugClang */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				CLANG_LINK_OBJC_RUNTIME = NO;
+				CLANG_OBJC_RUNTIME = NO;
+				COMBINE_HIDPI_IMAGES = YES;
+				CURRENT_PROJECT_VERSION = 168;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 168;
+				EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports";
+				FRAMEWORK_SEARCH_PATHS = (
+					"$(inherited)",
+					"\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"",
+				);
+				FRAMEWORK_VERSION = A;
+				GCC_ENABLE_OBJC_GC = supported;
+				GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = "";
+				INFOPLIST_FILE = "resources/LLDB-Info.plist";
+				INSTALL_PATH = "$(LLDB_FRAMEWORK_INSTALL_DIR)";
+				LD_DYLIB_INSTALL_NAME = "@rpath/LLDB.framework/LLDB";
+				LIBRARY_SEARCH_PATHS = (
+					"$(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)",
+					"$(inherited)",
+				);
+				OTHER_CPLUSPLUSFLAGS = (
+					"-fno-rtti",
+					"-Wglobal-constructors",
+					"$(OTHER_CFLAGS)",
+				);
+				OTHER_LDFLAGS = (
+					"-framework",
+					Carbon,
+					"-framework",
+					DebugSymbols,
+					"-lpython",
+					"-lllvmclang",
+					"-framework",
+					Foundation,
+					"-v",
+					"-t",
+				);
+				"OTHER_LDFLAGS[sdk=iphoneos*][arch=*]" = (
+					"-lllvmclang",
+					"-v",
+					"-t",
+					"-framework",
+					Foundation,
+				);
+				PRODUCT_NAME = LLDB;
+				USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/include $(SRCROOT)/source $(LLVM_SOURCE_DIR)/include $(LLVM_SOURCE_DIR)/tools/clang/include $(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)/include $(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)/tools/clang/include";
+				VERSIONING_SYSTEM = "apple-generic";
+			};
+			name = DebugClang;
+		};
+		49BB8F3A1611172B00BDD462 /* DebugClang */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				FRAMEWORK_SEARCH_PATHS = /System/Library/PrivateFrameworks;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				INSTALL_PATH = "$(LLDB_TOOLS_INSTALL_DIR)";
+				ONLY_ACTIVE_ARCH = NO;
+				PRODUCT_NAME = "darwin-debug";
+				SKIP_INSTALL = YES;
+			};
+			name = DebugClang;
+		};
+		49BB8F3B1611172B00BDD462 /* DebugClang */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				COMBINE_HIDPI_IMAGES = YES;
+				CURRENT_PROJECT_VERSION = 168;
+				DYLIB_CURRENT_VERSION = 168;
+				EXECUTABLE_EXTENSION = a;
+				FRAMEWORK_SEARCH_PATHS = (
+					"$(inherited)",
+					"\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"",
+				);
+				GCC_ENABLE_OBJC_GC = supported;
+				GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
+				HEADER_SEARCH_PATHS = /usr/include/libxml2;
+				LD_DYLIB_INSTALL_NAME = "$(DEVELOPER_DIR)/Library/PrivateFrameworks/LLDB.framework/Resources/lldb-core.a";
+				MACH_O_TYPE = staticlib;
+				MACOSX_DEPLOYMENT_TARGET = 10.7;
+				OTHER_CPLUSPLUSFLAGS = (
+					"-fno-rtti",
+					"-Wglobal-constructors",
+					"$(OTHER_CFLAGS)",
+				);
+				OTHER_LDFLAGS = "";
+				PRODUCT_NAME = "lib$(TARGET_NAME)";
+				SKIP_INSTALL = YES;
+				STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = static;
+				USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/include $(SRCROOT)/source $(LLVM_SOURCE_DIR)/include $(LLVM_SOURCE_DIR)/tools/clang/include $(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)/include $(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)/tools/clang/include";
+				VERSIONING_SYSTEM = "apple-generic";
+			};
+			name = DebugClang;
+		};
+		49BB8F3C1611172B00BDD462 /* DebugClang */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "-";
+				"CODE_SIGN_IDENTITY[sdk=macosx*]" = lldb_codesign;
+				DEAD_CODE_STRIPPING = YES;
+				FRAMEWORK_SEARCH_PATHS = (
+					"$(inherited)",
+					"\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"",
+				);
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_CPP_RTTI = NO;
+				GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+				INFOPLIST_PREPROCESSOR_DEFINITIONS = (
+					"-lobjc",
+					"-lpython",
+					"-framework",
+					DebugSymbols,
+					"-framework",
+					Carbon,
+					"-framework",
+					Foundation,
+					"-framework",
+					AppKit,
+					"-v",
+					"-t",
+					"-Wl,-v",
+				);
+				INSTALL_PATH = "$(LLDB_TOOLS_INSTALL_DIR)";
+				LIBRARY_SEARCH_PATHS = (
+					"$(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)",
+					"$(inherited)",
+				);
+				OTHER_LDFLAGS = (
+					"-lllvmclang",
+					"-lpython",
+					"-framework",
+					DebugSymbols,
+					"-framework",
+					Carbon,
+					"-framework",
+					Foundation,
+					"-framework",
+					AppKit,
+					"-v",
+					"-t",
+					"-Wl,-v",
+				);
+				"OTHER_LDFLAGS[sdk=iphoneos*][arch=*]" = (
+					"-lllvmclang",
+					"-framework",
+					Foundation,
+					"-framework",
+					UIKit,
+				);
+				PRODUCT_NAME = "lldb-platform";
+				"PROVISIONING_PROFILE[sdk=iphoneos*]" = "";
+				"PROVISIONING_PROFILE[sdk=macosx*]" = "";
+				SKIP_INSTALL = YES;
+				USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/include $(SRCROOT)/source $(LLVM_SOURCE_DIR)/include $(LLVM_SOURCE_DIR)/tools/clang/include $(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)/include $(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)/tools/clang/include";
+			};
+			name = DebugClang;
+		};
+		49BB8F3D1611172B00BDD462 /* DebugClang */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				CLANG_LINK_OBJC_RUNTIME = NO;
+				CLANG_OBJC_RUNTIME = NO;
+				CODE_SIGN_IDENTITY = "-";
+				COMBINE_HIDPI_IMAGES = YES;
+				DEPLOYMENT_LOCATION = YES;
+				DSTROOT = "$(SYMROOT)";
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_OBJC_EXCEPTIONS = YES;
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					"DEBUG=1",
+					"$(inherited)",
+				);
+				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+				INFOPLIST_FILE = "source/Host/macosx/launcherXPCService/LauncherXPCService-Info.plist";
+				INFOPLIST_PREPROCESS = YES;
+				INFOPLIST_PREPROCESSOR_DEFINITIONS = (
+					"NO0=0",
+					"YES0=1",
+					"RC_XBS=${RC_XBS}0",
+					"RC_BUILDIT=${RC_BUILDIT}0",
+				);
+				INSTALL_PATH = "/$(CONFIGURATION)/LLDB.framework/XPCServices";
+				IS_APPLE_CODE_SIGNED = "(anchor apple or (anchor apple generic and certificate leaf[field.1.2.840.113635.100.6.1.9]) or (anchor apple generic and certificate leaf[field.1.2.840.113635.100.6.1.9.1]))";
+				MACH_O_TYPE = mh_execute;
+				PRODUCT_NAME = "com.apple.lldb.$(TARGET_NAME)";
+				PROVISIONING_PROFILE = "";
+				WRAPPER_EXTENSION = xpc;
+			};
+			name = DebugClang;
+		};
+		49BB8F3E1611172B00BDD462 /* DebugClang */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				CLANG_LINK_OBJC_RUNTIME = NO;
+				CLANG_OBJC_RUNTIME = NO;
+				CODE_SIGN_ENTITLEMENTS = source/Host/macosx/launcherXPCService/LauncherXPCService.entitlements;
+				CODE_SIGN_IDENTITY = "-";
+				COMBINE_HIDPI_IMAGES = YES;
+				DEPLOYMENT_LOCATION = YES;
+				DSTROOT = "$(SYMROOT)";
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_OBJC_EXCEPTIONS = YES;
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					"DEBUG=1",
+					"$(inherited)",
+				);
+				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+				INFOPLIST_FILE = "source/Host/macosx/launcherXPCService/LauncherRootXPCService-Info.plist";
+				INFOPLIST_PREPROCESS = YES;
+				INFOPLIST_PREPROCESSOR_DEFINITIONS = (
+					"NO0=0",
+					"YES0=1",
+					"RC_XBS=${RC_XBS}0",
+					"RC_BUILDIT=${RC_BUILDIT}0",
+				);
+				INSTALL_PATH = "/$(CONFIGURATION)/LLDB.framework/XPCServices";
+				IS_APPLE_CODE_SIGNED = "(anchor apple or (anchor apple generic and certificate leaf[field.1.2.840.113635.100.6.1.9]) or (anchor apple generic and certificate leaf[field.1.2.840.113635.100.6.1.9.1]))";
+				MACH_O_TYPE = mh_execute;
+				PRODUCT_NAME = "com.apple.lldb.$(TARGET_NAME)";
+				PROVISIONING_PROFILE = "";
+				WRAPPER_EXTENSION = xpc;
+			};
+			name = DebugClang;
+		};
+		49BB8F3F1611172B00BDD462 /* DebugClang */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_64_BIT)";
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+				COMBINE_HIDPI_IMAGES = YES;
+				CURRENT_PROJECT_VERSION = 168;
+				DEBUGGING_SYMBOLS = YES;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_OBJC_EXCEPTIONS = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					"DEBUG=1",
+					"$(inherited)",
+				);
+				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+				MACOSX_DEPLOYMENT_TARGET = 10.7;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = "";
+				PRODUCT_NAME = "$(TARGET_NAME)";
+				SDKROOT = macosx;
+			};
+			name = DebugClang;
+		};
 		EDC6D4A714E5C19B001B75F8 /* Debug */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
@@ -5335,6 +5714,7 @@
 			isa = XCConfigurationList;
 			buildConfigurations = (
 				1DEB91F008733DB70010E9CD /* Debug */,
+				49BB8F341611172B00BDD462 /* DebugClang */,
 				1DEB91F108733DB70010E9CD /* Release */,
 				268A89B211963ECA00D953EB /* BuildAndIntegration */,
 			);
@@ -5345,6 +5725,7 @@
 			isa = XCConfigurationList;
 			buildConfigurations = (
 				26579F6A126A25920007C5CB /* Debug */,
+				49BB8F3A1611172B00BDD462 /* DebugClang */,
 				26579F6B126A25920007C5CB /* Release */,
 				26579F6C126A25920007C5CB /* BuildAndIntegration */,
 			);
@@ -5355,6 +5736,7 @@
 			isa = XCConfigurationList;
 			buildConfigurations = (
 				26680209115FD0ED008E1FE4 /* Debug */,
+				49BB8F391611172B00BDD462 /* DebugClang */,
 				2668020A115FD0ED008E1FE4 /* Release */,
 				268A89B511963ECA00D953EB /* BuildAndIntegration */,
 			);
@@ -5365,6 +5747,7 @@
 			isa = XCConfigurationList;
 			buildConfigurations = (
 				2687EAC71508110B00DD8C2E /* Debug */,
+				49BB8F3F1611172B00BDD462 /* DebugClang */,
 				2687EAC81508110B00DD8C2E /* Release */,
 				2687EAC91508110B00DD8C2E /* BuildAndIntegration */,
 			);
@@ -5375,6 +5758,7 @@
 			isa = XCConfigurationList;
 			buildConfigurations = (
 				2689FFD513353D7A00698AC0 /* Debug */,
+				49BB8F3B1611172B00BDD462 /* DebugClang */,
 				2689FFD613353D7A00698AC0 /* Release */,
 				2689FFD713353D7A00698AC0 /* BuildAndIntegration */,
 			);
@@ -5385,6 +5769,7 @@
 			isa = XCConfigurationList;
 			buildConfigurations = (
 				26CEF3AA14FD58BF007286B2 /* Debug */,
+				49BB8F361611172B00BDD462 /* DebugClang */,
 				26CEF3AB14FD58BF007286B2 /* Release */,
 				26CEF3AC14FD58BF007286B2 /* BuildAndIntegration */,
 			);
@@ -5395,6 +5780,7 @@
 			isa = XCConfigurationList;
 			buildConfigurations = (
 				26CEF3B314FD592B007286B2 /* Debug */,
+				49BB8F351611172B00BDD462 /* DebugClang */,
 				26CEF3B414FD592B007286B2 /* Release */,
 				26CEF3B514FD592B007286B2 /* BuildAndIntegration */,
 			);
@@ -5405,6 +5791,7 @@
 			isa = XCConfigurationList;
 			buildConfigurations = (
 				26CEF3BE14FD596A007286B2 /* Debug */,
+				49BB8F371611172B00BDD462 /* DebugClang */,
 				26CEF3BF14FD596A007286B2 /* Release */,
 				26CEF3C014FD596A007286B2 /* BuildAndIntegration */,
 			);
@@ -5415,6 +5802,7 @@
 			isa = XCConfigurationList;
 			buildConfigurations = (
 				26DC6A121337FE6A00FF7998 /* Debug */,
+				49BB8F3C1611172B00BDD462 /* DebugClang */,
 				26DC6A131337FE6A00FF7998 /* Release */,
 				26DC6A141337FE6A00FF7998 /* BuildAndIntegration */,
 			);
@@ -5425,6 +5813,7 @@
 			isa = XCConfigurationList;
 			buildConfigurations = (
 				26F5C26C10F3D9A5009D5894 /* Debug */,
+				49BB8F381611172B00BDD462 /* DebugClang */,
 				26F5C26D10F3D9A5009D5894 /* Release */,
 				268A89B311963ECA00D953EB /* BuildAndIntegration */,
 			);
@@ -5435,6 +5824,7 @@
 			isa = XCConfigurationList;
 			buildConfigurations = (
 				EDC6D4A714E5C19B001B75F8 /* Debug */,
+				49BB8F3D1611172B00BDD462 /* DebugClang */,
 				EDC6D4A814E5C19B001B75F8 /* Release */,
 				EDC6D4A914E5C19B001B75F8 /* BuildAndIntegration */,
 			);
@@ -5445,6 +5835,7 @@
 			isa = XCConfigurationList;
 			buildConfigurations = (
 				EDE274E914EDCE1F005B0F75 /* Debug */,
+				49BB8F3E1611172B00BDD462 /* DebugClang */,
 				EDE274EA14EDCE1F005B0F75 /* Release */,
 				EDE274EB14EDCE1F005B0F75 /* BuildAndIntegration */,
 			);

Removed: lldb/branches/windows/llvm.zip
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/llvm.zip?rev=164819&view=auto
==============================================================================
Binary file - no diff available.

Modified: lldb/branches/windows/resources/LLDB-Info.plist
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/resources/LLDB-Info.plist?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/resources/LLDB-Info.plist (original)
+++ lldb/branches/windows/resources/LLDB-Info.plist Fri Sep 28 06:07:34 2012
@@ -17,7 +17,7 @@
 	<key>CFBundleSignature</key>
 	<string>????</string>
 	<key>CFBundleVersion</key>
-	<string>165</string>
+	<string>168</string>
 	<key>CFBundleName</key>
 	<string>${EXECUTABLE_NAME}</string>
 </dict>

Modified: lldb/branches/windows/scripts/Python/build-swig-Python.sh
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/scripts/Python/build-swig-Python.sh?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/scripts/Python/build-swig-Python.sh (original)
+++ lldb/branches/windows/scripts/Python/build-swig-Python.sh Fri Sep 28 06:07:34 2012
@@ -19,7 +19,7 @@
 SWIG=$6
 
 os_name=`uname -s`
-if [ "$os_name" == "Darwin" ]
+if [ "$os_name" = "Darwin" ]
 then
   swig_output_file=${SRC_ROOT}/source/LLDBWrapPython.cpp
 else
@@ -40,7 +40,7 @@
 
 else
 
-if [ -n "$debug_flag" -a "$debug_flag" == "-debug" ]
+if [ -n "$debug_flag" -a "$debug_flag" = "-debug" ]
 then
     Debug=1
 else
@@ -148,13 +148,13 @@
 " ${SRC_ROOT}/scripts/Python/interface/SBValueList.i"\
 " ${SRC_ROOT}/scripts/Python/interface/SBWatchpoint.i"
 
-if [ $Debug == 1 ]
+if [ $Debug -eq 1 ]
 then
     echo "Header files are:"
     echo ${HEADER_FILES}
 fi
 
-if [ $Debug == 1 ]
+if [ $Debug -eq 1 ]
 then
     echo "SWIG interface files are:"
     echo ${INTERFACE_FILES}
@@ -166,20 +166,20 @@
 if [ ! -f ${swig_output_file} ]
 then
     NeedToUpdate=1
-    if [ $Debug == 1 ]
+    if [ $Debug -eq 1 ]
     then
         echo "Failed to find LLDBWrapPython.cpp"
     fi
 fi
 
-if [ $NeedToUpdate == 0 ]
+if [ $NeedToUpdate -eq 0 ]
 then
     for hdrfile in ${HEADER_FILES}
     do
         if [ $hdrfile -nt ${swig_output_file} ]
         then
             NeedToUpdate=1
-            if [ $Debug == 1 ]
+            if [ $Debug -eq 1 ]
             then
                 echo "${hdrfile} is newer than ${swig_output_file}"
                 echo "swig file will need to be re-built."
@@ -189,14 +189,14 @@
     done
 fi
 
-if [ $NeedToUpdate == 0 ]
+if [ $NeedToUpdate -eq 0 ]
 then
     for intffile in ${INTERFACE_FILES}
     do
         if [ $intffile -nt ${swig_output_file} ]
         then
             NeedToUpdate=1
-            if [ $Debug == 1 ]
+            if [ $Debug -eq 1 ]
             then
                 echo "${intffile} is newer than ${swig_output_file}"
                 echo "swig file will need to be re-built."
@@ -206,12 +206,12 @@
     done
 fi
 
-if [ $NeedToUpdate == 0 ]
+if [ $NeedToUpdate -eq 0 ]
 then
     if [ ${swig_input_file} -nt ${swig_output_file} ]
     then
         NeedToUpdate=1
-        if [ $Debug == 1 ]
+        if [ $Debug -eq 1 ]
         then
             echo "${swig_input_file} is newer than ${swig_output_file}"
             echo "swig file will need to be re-built."
@@ -219,12 +219,12 @@
     fi
 fi
 
-if [ $NeedToUpdate == 0 ]
+if [ $NeedToUpdate -eq 0 ]
 then
     if [ ${swig_python_extensions} -nt ${swig_output_file} ]
     then
         NeedToUpdate=1
-        if [ $Debug == 1 ]
+        if [ $Debug -eq 1 ]
         then
             echo "${swig_python_extensions} is newer than ${swig_output_file}"
             echo "swig file will need to be re-built."
@@ -232,12 +232,12 @@
     fi
 fi
 
-if [ $NeedToUpdate == 0 ]
+if [ $NeedToUpdate -eq 0 ]
 then
     if [ ${swig_python_wrapper} -nt ${swig_output_file} ]
     then
         NeedToUpdate=1
-        if [ $Debug == 1 ]
+        if [ $Debug -eq 1 ]
         then
             echo "${swig_python_wrapper} is newer than ${swig_output_file}"
             echo "swig file will need to be re-built."
@@ -245,12 +245,12 @@
     fi
 fi
 
-if [ $NeedToUpdate == 0 ]
+if [ $NeedToUpdate -eq 0 ]
 then
     if [ ${swig_python_typemaps} -nt ${swig_output_file} ]
     then
         NeedToUpdate=1
-        if [ $Debug == 1 ]
+        if [ $Debug -eq 1 ]
         then
             echo "${swig_python_typemaps} is newer than ${swig_output_file}"
             echo "swig file will need to be re-built."
@@ -260,7 +260,7 @@
 
 python_version=`/usr/bin/env python --version 2>&1 | sed -e 's,Python ,,' -e 's,[.][0-9],,2' -e 's,[a-z][a-z][0-9],,'`
 
-if [ "$os_name" == "Darwin" ]
+if [ "$os_name" = "Darwin" ]
 then
     framework_python_dir="${TARGET_DIR}/LLDB.framework/Resources/Python"
 else
@@ -279,7 +279,7 @@
 fi
 
 
-if [ $NeedToUpdate == 0 ]
+if [ $NeedToUpdate -eq 0 ]
 then
     echo "Everything is up-to-date."
     exit 0

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=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/scripts/Python/finish-swig-Python-LLDB.sh (original)
+++ lldb/branches/windows/scripts/Python/finish-swig-Python-LLDB.sh Fri Sep 28 06:07:34 2012
@@ -39,7 +39,7 @@
 
 if [ ! "$LLDB_DISABLE_PYTHON" = "1" ] ; then
 
-if [ -n "$debug_flag" -a "$debug_flag" == "-debug" ]
+if [ -n "$debug_flag" -a "$debug_flag" = "-debug" ]
 then
     Debug=1
 else
@@ -50,7 +50,7 @@
 PYTHON_VERSION=`/usr/bin/env python --version 2>&1 | sed -e 's,Python ,,' -e 's,[.][0-9],,2' -e 's,[a-z][a-z][0-9],,'`
 
 
-if [ $Debug == 1 ]
+if [ $Debug -eq 1 ]
 then
     echo "The current OS is $OS_NAME"
     echo "The Python version is $PYTHON_VERSION"
@@ -59,7 +59,7 @@
 #
 #  Determine where to put the files.
 
-if [ ${OS_NAME} == "Darwin" ]
+if [ ${OS_NAME} = "Darwin" ]
 then
     # We are on a Darwin system, so all the lldb Python files can go 
     # into the LLDB.framework/Resources/Python subdirectory.
@@ -69,7 +69,7 @@
         echo "Error:  Unable to find LLDB.framework" >&2
         exit 1
     else
-        if [ $Debug == 1 ]
+        if [ $Debug -eq 1 ]
         then
             echo "Found ${TARGET_DIR}/LLDB.framework."
         fi
@@ -91,7 +91,7 @@
 # already exist, attempt to make it.
 #
 
-if [ $Debug == 1 ]
+if [ $Debug -eq 1 ]
 then
     echo "Python files will be put in ${framework_python_dir}"
 fi
@@ -102,13 +102,13 @@
 do
     if [ ! -d "${python_dir}" ]
     then
-        if [ $Debug == 1 ]
+        if [ $Debug -eq 1 ]
         then
             echo "Making directory ${python_dir}"
         fi
         mkdir -p "${python_dir}"
     else
-        if [ $Debug == 1 ]
+        if [ $Debug -eq 1 ]
         then
             echo "${python_dir} already exists."
         fi
@@ -126,17 +126,17 @@
 
 if [ ! -L "${framework_python_dir}/_lldb.so" ]
 then
-    if [ $Debug == 1 ]
+    if [ $Debug -eq 1 ]
     then
         echo "Creating symlink for _lldb.so"
     fi
-    if [ ${OS_NAME} == "Darwin" ]
+    if [ ${OS_NAME} = "Darwin" ]
     then
         cd "${framework_python_dir}"
         ln -s "../../../LLDB" _lldb.so
     fi
 else
-    if [ $Debug == 1 ]
+    if [ $Debug -eq 1 ]
     then
         echo "${framework_python_dir}/_lldb.so already exists."
     fi
@@ -243,7 +243,7 @@
 package_files="${SRC_ROOT}/examples/python/symbolication.py"
 create_python_package "/utils" "${package_files}"
 
-if [ ${OS_NAME} == "Darwin" ]
+if [ ${OS_NAME} = "Darwin" ]
 then
     # lldb/macosx
     package_files="${SRC_ROOT}/examples/python/crashlog.py

Modified: lldb/branches/windows/scripts/Python/interface/SBBreakpoint.i
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/scripts/Python/interface/SBBreakpoint.i?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/scripts/Python/interface/SBBreakpoint.i (original)
+++ lldb/branches/windows/scripts/Python/interface/SBBreakpoint.i Fri Sep 28 06:07:34 2012
@@ -118,6 +118,9 @@
 
     bool
     IsEnabled ();
+    
+    bool
+    IsInternal ();
 
     uint32_t
     GetHitCount () const;

Modified: lldb/branches/windows/scripts/build-llvm.pl
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/scripts/build-llvm.pl?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/scripts/build-llvm.pl (original)
+++ lldb/branches/windows/scripts/build-llvm.pl Fri Sep 28 06:07:34 2012
@@ -21,11 +21,10 @@
 
 our $llvm_configuration = $ENV{LLVM_CONFIGURATION};
 
-our $llvm_revision = "163312";
-our $clang_revision = "163312";
+our $llvm_revision = "HEAD";
+our $clang_revision = "HEAD";
 
 our $SRCROOT = "$ENV{SRCROOT}";
-our $llvm_dstroot_zip = "$SRCROOT/llvm.zip";
 our @archs = split (/\s+/, $ENV{ARCHS});
 my $os_release = 11;
 
@@ -36,6 +35,7 @@
  'Debug+Asserts' => { configure_options => '--disable-optimized --enable-assertions --enable-libcpp' , make_options => 'DEBUG_SYMBOLS=1'},
  'Release'       => { configure_options => '--enable-optimized --disable-assertions --enable-libcpp' , make_options => ''},
  'Release+Debug' => { configure_options => '--enable-optimized --disable-assertions --enable-libcpp' , make_options => 'DEBUG_SYMBOLS=1'},
+ 'Release+Asserts' => { configure_options => '--enable-optimized --enable-assertions --enable-libcpp' , make_options => ''},
 );
 
 our $llvm_config_href = undef;
@@ -57,13 +57,10 @@
     "$llvm_configuration/lib/libclangEdit.a",
 	"$llvm_configuration/lib/libclangFrontend.a",
 	"$llvm_configuration/lib/libclangDriver.a",
-	"$llvm_configuration/lib/libclangIndex.a",
 	"$llvm_configuration/lib/libclangLex.a",
-	"$llvm_configuration/lib/libclangRewrite.a",
 	"$llvm_configuration/lib/libclangParse.a",
 	"$llvm_configuration/lib/libclangSema.a",
     "$llvm_configuration/lib/libclangSerialization.a",
-	"$llvm_configuration/lib/libEnhancedDisassembly.a",
 	"$llvm_configuration/lib/libLLVMAnalysis.a",
 	"$llvm_configuration/lib/libLLVMArchive.a",
 	"$llvm_configuration/lib/libLLVMARMAsmParser.a",
@@ -111,48 +108,6 @@
     print "Using existing llvm sources in: '$llvm_srcroot'\n";
     print "Using standard LLVM build directory:\n  SRC = '$llvm_srcroot'\n  DST = '$llvm_dstroot'\n";
 }
-elsif (-e $llvm_dstroot_zip)
-{
-    # Check for an old llvm source install (not the minimal zip based 
-    # install by looking for a .svn file in the llvm directory
-    chomp(my $llvm_zip_md5 = `md5 -q '$llvm_dstroot_zip'`);
-    my $llvm_zip_md5_file = "$ENV{SRCROOT}/llvm/$llvm_zip_md5";
-    if (!-e "$llvm_zip_md5_file")
-    {
-        print "Updating LLVM to use checkpoint from: '$llvm_dstroot_zip'...\n";
-        if (-d "$ENV{SRCROOT}/llvm")
-        {
-            do_command ("cd '$ENV{SRCROOT}' && rm -rf llvm", "removing old llvm repository", 1);            
-        }
-		do_command ("cd '$ENV{SRCROOT}' && unzip -q llvm.zip && touch '$llvm_zip_md5_file'", "expanding llvm.zip", 1);
-        
-    }
-    my $arch_idx = 0;
-        
-    if (!-d "${llvm_dstroot}")
-    {
-        do_command ("mkdir -p '${llvm_dstroot}'", "Creating directory '${llvm_dstroot}'", 1);
-    }
-        
-    foreach my $arch (@archs)
-    {
-        my $llvm_dstroot_arch = "${llvm_dstroot}/${arch}";
-        # Check for our symlink to our .a file
-        if (!-l "$llvm_dstroot_arch/$llvm_clang_basename")
-        {
-            # Symlink doesn't exist, make sure it isn't a normal file
-            if (-e "$llvm_dstroot_arch/$llvm_clang_basename")
-            {
-                # the .a file is a normal file which means it can't be from the 
-                # zip file, we must remove the previous arch directory
-                do_command ("rm -rf '$llvm_dstroot_arch'", "Removing old '$llvm_dstroot_arch' directory", 1);
-            }            
-            # Create a symlink to the .a file from the zip file
-            do_command ("cd '$llvm_dstroot' ; ln -s $ENV{SRCROOT}/llvm/$arch", "making llvm archive symlink", 1);
-        }
-    }
-    exit 0;
-}
 else
 {
     print "Checking out llvm sources from revision $llvm_revision...\n";

Modified: lldb/branches/windows/scripts/build-swig-wrapper-classes.sh
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/scripts/build-swig-wrapper-classes.sh?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/scripts/build-swig-wrapper-classes.sh (original)
+++ lldb/branches/windows/scripts/build-swig-wrapper-classes.sh Fri Sep 28 06:07:34 2012
@@ -32,7 +32,7 @@
 # Check to see if we are in debug-mode or not.
 #
 
-if [ -n "$debug_flag" -a "$debug_flag" == "-debug" ]
+if [ -n "$debug_flag" -a "$debug_flag" = "-debug" ]
 then
     Debug=1
 else
@@ -49,7 +49,7 @@
     exit 1
 fi
 
-if [ $Debug == 1 ]
+if [ $Debug -eq 1 ]
 then
     echo "Found lldb.swig file"
 fi
@@ -69,7 +69,7 @@
     fi
 fi
 
-if [ ${SWIG}a == a ]
+if [ ${SWIG}a = a ]
 then
     echo Error: could not find the swig binary
     exit 1
@@ -87,7 +87,7 @@
 
 for curlang in $languages
 do
-    if [ $Debug == 1 ]
+    if [ $Debug -eq 1 ]
     then
         echo "Current language is $curlang"
     fi
@@ -98,7 +98,7 @@
         continue
     else
 
-        if [ $Debug == 1 ]
+        if [ $Debug -eq 1 ]
         then
             echo "Found $curlang sub-directory"
         fi
@@ -113,7 +113,7 @@
             continue
         else
 
-            if [ $Debug == 1 ]
+            if [ $Debug -eq 1 ]
             then
                 echo "Found $curlang build script."
                 echo "Executing $curlang build script..."

Removed: lldb/branches/windows/scripts/clang.amalgamated.diff
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/scripts/clang.amalgamated.diff?rev=164819&view=auto
==============================================================================
--- lldb/branches/windows/scripts/clang.amalgamated.diff (original)
+++ lldb/branches/windows/scripts/clang.amalgamated.diff (removed)
@@ -1,1936 +0,0 @@
-Index: include/clang/Basic/StmtNodes.td
-===================================================================
---- include/clang/Basic/StmtNodes.td	(revision 152265)
-+++ include/clang/Basic/StmtNodes.td	(working copy)
-@@ -133,7 +133,7 @@
- 
- // Obj-C Expressions.
- def ObjCStringLiteral : DStmt<Expr>;
--def ObjCNumericLiteral : DStmt<Expr>;
-+def ObjCBoxedExpr : DStmt<Expr>;
- def ObjCArrayLiteral : DStmt<Expr>;
- def ObjCDictionaryLiteral : DStmt<Expr>;
- def ObjCEncodeExpr : DStmt<Expr>;
-Index: include/clang/Basic/DiagnosticSemaKinds.td
-===================================================================
---- include/clang/Basic/DiagnosticSemaKinds.td	(revision 152265)
-+++ include/clang/Basic/DiagnosticSemaKinds.td	(working copy)
-@@ -1489,6 +1489,12 @@
-   "NSNumber must be available to use Objective-C literals">;
- def err_invalid_nsnumber_type : Error<
-   "%0 is not a valid literal type for NSNumber">;
-+def err_undeclared_nsstring : Error<
-+  "cannot box a string value because NSString has not been declared">;
-+def err_objc_illegal_boxed_expression_type : Error<
-+  "illegal type %0 used in a boxed expression">;
-+def err_objc_incomplete_boxed_expression_type : Error<
-+  "incomplete type %0 used in a boxed expression">;
- def err_undeclared_nsarray : Error<
-   "NSArray must be available to use Objective-C array literals">;
- def err_undeclared_nsdictionary : Error<
-Index: include/clang/Sema/Sema.h
-===================================================================
---- include/clang/Sema/Sema.h	(revision 152265)
-+++ include/clang/Sema/Sema.h	(working copy)
-@@ -519,9 +519,21 @@
-   /// \brief The declaration of the Objective-C NSNumber class.
-   ObjCInterfaceDecl *NSNumberDecl;
-   
-+  /// \brief Pointer to NSNumber type (NSNumber *).
-+  QualType NSNumberPointer;
-+  
-   /// \brief The Objective-C NSNumber methods used to create NSNumber literals.
-   ObjCMethodDecl *NSNumberLiteralMethods[NSAPI::NumNSNumberLiteralMethods];
-   
-+  /// \brief The declaration of the Objective-C NSString class.
-+  ObjCInterfaceDecl *NSStringDecl;
-+
-+  /// \brief Pointer to NSString type (NSString *).
-+  QualType NSStringPointer;
-+  
-+  /// \brief The declaration of the stringWithUTF8String: method.
-+  ObjCMethodDecl *StringWithUTF8StringMethod;
-+
-   /// \brief The declaration of the Objective-C NSArray class.
-   ObjCInterfaceDecl *NSArrayDecl;
- 
-@@ -3708,7 +3720,7 @@
-     
-   ExprResult BuildObjCStringLiteral(SourceLocation AtLoc, StringLiteral *S);
-   
--  /// BuildObjCNumericLiteral - builds an ObjCNumericLiteral AST node for the
-+  /// BuildObjCNumericLiteral - builds an ObjCBoxedExpr AST node for the
-   /// numeric literal expression. Type of the expression will be "NSNumber *"
-   /// or "id" if NSNumber is unavailable.
-   ExprResult BuildObjCNumericLiteral(SourceLocation AtLoc, Expr *Number);
-@@ -3716,6 +3728,13 @@
-                                   bool Value);
-   ExprResult BuildObjCArrayLiteral(SourceRange SR, MultiExprArg Elements);
-   
-+  // BuildObjCBoxedExpr - builds an ObjCBoxedExpr AST node for the
-+  // '@' prefixed parenthesized expression. The type of the expression will
-+  // either be "NSNumber *" or "NSString *" depending on the type of
-+  // ValueType, which is allowed to be a built-in numeric type or
-+  // "char *" or "const char *".
-+  ExprResult BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr);
-+  
-   ExprResult BuildObjCSubscriptExpression(SourceLocation RB, Expr *BaseExpr,
-                                           Expr *IndexExpr,
-                                           ObjCMethodDecl *getterMethod,
-Index: include/clang/AST/ASTImporter.h
-===================================================================
---- include/clang/AST/ASTImporter.h	(revision 152265)
-+++ include/clang/AST/ASTImporter.h	(working copy)
-@@ -271,7 +271,8 @@
-     
-     /// \brief Determine whether the given types are structurally
-     /// equivalent.
--    bool IsStructurallyEquivalent(QualType From, QualType To);    
-+    bool IsStructurallyEquivalent(QualType From, QualType To,
-+                                  bool Complain = true);
-   };
- }
- 
-Index: include/clang/AST/Type.h
-===================================================================
---- include/clang/AST/Type.h	(revision 152265)
-+++ include/clang/AST/Type.h	(working copy)
-@@ -1714,9 +1714,9 @@
-   friend class ASTWriter;
- };
- 
--template <> inline const TypedefType *Type::getAs() const {
--  return dyn_cast<TypedefType>(this);
--}
-+/// \brief This will check for a TypedefType by removing any existing sugar
-+/// until it reaches a TypedefType or a non-sugared type.
-+template <> const TypedefType *Type::getAs() const;
- 
- // We can do canonical leaf types faster, because we don't have to
- // worry about preserving child type decoration.
-Index: include/clang/AST/RecursiveASTVisitor.h
-===================================================================
---- include/clang/AST/RecursiveASTVisitor.h	(revision 152265)
-+++ include/clang/AST/RecursiveASTVisitor.h	(working copy)
-@@ -2106,7 +2106,7 @@
- DEF_TRAVERSE_STMT(ImaginaryLiteral, { })
- DEF_TRAVERSE_STMT(StringLiteral, { })
- DEF_TRAVERSE_STMT(ObjCStringLiteral, { })
--DEF_TRAVERSE_STMT(ObjCNumericLiteral, { })
-+DEF_TRAVERSE_STMT(ObjCBoxedExpr, { })
- DEF_TRAVERSE_STMT(ObjCArrayLiteral, { })
- DEF_TRAVERSE_STMT(ObjCDictionaryLiteral, { })
-   
-Index: include/clang/AST/ExprObjC.h
-===================================================================
---- include/clang/AST/ExprObjC.h	(revision 152265)
-+++ include/clang/AST/ExprObjC.h	(working copy)
-@@ -86,43 +86,45 @@
-   child_range children() { return child_range(); }
- };
- 
--/// ObjCNumericLiteral - used for objective-c numeric literals;
--/// as in: @42 or @true (c++/objc++) or @__yes (c/objc)
--class ObjCNumericLiteral : public Expr {
--  /// Number - expression AST node for the numeric literal
--  Stmt *Number;
--  ObjCMethodDecl *ObjCNumericLiteralMethod;
--  SourceLocation AtLoc;
-+/// ObjCBoxedExpr - used for generalized expression boxing.
-+/// as in: @(strdup("hello world")) or @(random())
-+/// Also used for boxing non-parenthesized numeric literals;
-+/// as in: @42 or @true (c++/objc++) or @__yes (c/objc).
-+class ObjCBoxedExpr : public Expr {
-+  Stmt *SubExpr;
-+  ObjCMethodDecl *BoxingMethod;
-+  SourceRange Range;
- public:
--  ObjCNumericLiteral(Stmt *NL, QualType T, ObjCMethodDecl *method,
--                     SourceLocation L)
--  : Expr(ObjCNumericLiteralClass, T, VK_RValue, OK_Ordinary, 
--         false, false, false, false), Number(NL), 
--    ObjCNumericLiteralMethod(method), AtLoc(L) {}
--  explicit ObjCNumericLiteral(EmptyShell Empty)
--  : Expr(ObjCNumericLiteralClass, Empty) {}
-+  ObjCBoxedExpr(Expr *E, QualType T, ObjCMethodDecl *method,
-+                     SourceRange R)
-+  : Expr(ObjCBoxedExprClass, T, VK_RValue, OK_Ordinary, 
-+         E->isTypeDependent(), E->isValueDependent(), 
-+         E->isInstantiationDependent(), E->containsUnexpandedParameterPack()), 
-+         SubExpr(E), BoxingMethod(method), Range(R) {}
-+  explicit ObjCBoxedExpr(EmptyShell Empty)
-+  : Expr(ObjCBoxedExprClass, Empty) {}
-   
--  Expr *getNumber() { return cast<Expr>(Number); }
--  const Expr *getNumber() const { return cast<Expr>(Number); }
-+  Expr *getSubExpr() { return cast<Expr>(SubExpr); }
-+  const Expr *getSubExpr() const { return cast<Expr>(SubExpr); }
-   
--  ObjCMethodDecl *getObjCNumericLiteralMethod() const {
--    return ObjCNumericLiteralMethod; 
-+  ObjCMethodDecl *getBoxingMethod() const {
-+    return BoxingMethod; 
-   }
--    
--  SourceLocation getAtLoc() const { return AtLoc; }
-   
-+  SourceLocation getAtLoc() const { return Range.getBegin(); }
-+  
-   SourceRange getSourceRange() const {
--    return SourceRange(AtLoc, Number->getSourceRange().getEnd());
-+    return Range;
-   }
--
-+  
-   static bool classof(const Stmt *T) {
--      return T->getStmtClass() == ObjCNumericLiteralClass;
-+    return T->getStmtClass() == ObjCBoxedExprClass;
-   }
--  static bool classof(const ObjCNumericLiteral *) { return true; }
-+  static bool classof(const ObjCBoxedExpr *) { return true; }
-   
-   // Iterators
--  child_range children() { return child_range(&Number, &Number+1); }
--    
-+  child_range children() { return child_range(&SubExpr, &SubExpr+1); }
-+  
-   friend class ASTStmtReader;
- };
- 
-Index: include/clang/AST/NSAPI.h
-===================================================================
---- include/clang/AST/NSAPI.h	(revision 152265)
-+++ include/clang/AST/NSAPI.h	(working copy)
-@@ -125,10 +125,19 @@
- 
-   /// \brief Determine the appropriate NSNumber factory method kind for a
-   /// literal of the given type.
--  static llvm::Optional<NSNumberLiteralMethodKind>
--      getNSNumberFactoryMethodKind(QualType T);
-+  llvm::Optional<NSNumberLiteralMethodKind>
-+      getNSNumberFactoryMethodKind(QualType T) const;
- 
-+  /// \brief Returns true if \param T is a typedef of "BOOL" in objective-c.
-+  bool isObjCBOOLType(QualType T) const;
-+  /// \brief Returns true if \param T is a typedef of "NSInteger" in objective-c.
-+  bool isObjCNSIntegerType(QualType T) const;
-+  /// \brief Returns true if \param T is a typedef of "NSUInteger" in objective-c.
-+  bool isObjCNSUIntegerType(QualType T) const;
-+
- private:
-+  bool isObjCTypedef(QualType T, StringRef name, IdentifierInfo *&II) const;
-+
-   ASTContext &Ctx;
- 
-   mutable IdentifierInfo *ClassIds[NumClassIds];
-@@ -144,6 +153,8 @@
-   /// \brief The Objective-C NSNumber selectors used to create NSNumber literals.
-   mutable Selector NSNumberClassSelectors[NumNSNumberLiteralMethods];
-   mutable Selector NSNumberInstanceSelectors[NumNSNumberLiteralMethods];
-+
-+  mutable IdentifierInfo *BOOLId, *NSIntegerId, *NSUIntegerId;
- };
- 
- }  // end namespace clang
-Index: include/clang/Parse/Parser.h
-===================================================================
---- include/clang/Parse/Parser.h	(revision 152265)
-+++ include/clang/Parse/Parser.h	(working copy)
-@@ -1497,6 +1497,7 @@
-   ExprResult ParseObjCBooleanLiteral(SourceLocation AtLoc, bool ArgValue);
-   ExprResult ParseObjCArrayLiteral(SourceLocation AtLoc);
-   ExprResult ParseObjCDictionaryLiteral(SourceLocation AtLoc);
-+  ExprResult ParseObjCBoxedExpr(SourceLocation AtLoc);
-   ExprResult ParseObjCEncodeExpression(SourceLocation AtLoc);
-   ExprResult ParseObjCSelectorExpression(SourceLocation AtLoc);
-   ExprResult ParseObjCProtocolExpression(SourceLocation AtLoc);
-Index: include/clang/Serialization/ASTBitCodes.h
-===================================================================
---- include/clang/Serialization/ASTBitCodes.h	(revision 152265)
-+++ include/clang/Serialization/ASTBitCodes.h	(working copy)
-@@ -1066,7 +1066,7 @@
-       /// \brief An ObjCStringLiteral record.
-       EXPR_OBJC_STRING_LITERAL,
- 
--      EXPR_OBJC_NUMERIC_LITERAL,
-+      EXPR_OBJC_BOXED_EXPRESSION,
-       EXPR_OBJC_ARRAY_LITERAL,
-       EXPR_OBJC_DICTIONARY_LITERAL,
- 
-Index: docs/LanguageExtensions.html
-===================================================================
---- docs/LanguageExtensions.html	(revision 152265)
-+++ docs/LanguageExtensions.html	(working copy)
-@@ -87,7 +87,7 @@
-     <li><a href="#objc_instancetype">Related result types</a></li>
-     <li><a href="#objc_arc">Automatic reference counting</a></li>
-     <li><a href="#objc_fixed_enum">Enumerations with a fixed underlying type</a></li>
--  </ul>
-+ </ul>
- </li>
- <li><a href="#overloading-in-c">Function Overloading in C</a></li>
- <li><a href="#complex-list-init">Initializer lists for complex numbers in C</a></li>
-Index: tools/libclang/IndexBody.cpp
-===================================================================
---- tools/libclang/IndexBody.cpp	(revision 152265)
-+++ tools/libclang/IndexBody.cpp	(working copy)
-@@ -90,13 +90,13 @@
-     return true;
-   }
- 
--  bool VisitObjCNumericLiteral(ObjCNumericLiteral *E) {
--    if (ObjCMethodDecl *MD = E->getObjCNumericLiteralMethod())
-+  bool VisitObjCBoxedExpr(ObjCBoxedExpr *E) {
-+    if (ObjCMethodDecl *MD = E->getBoxingMethod())
-       IndexCtx.handleReference(MD, E->getLocStart(),
-                                Parent, ParentDC, E, CXIdxEntityRef_Implicit);
-     return true;
-   }
--
-+  
-   bool VisitObjCDictionaryLiteral(ObjCDictionaryLiteral *E) {
-     if (ObjCMethodDecl *MD = E->getDictWithObjectsMethod())
-       IndexCtx.handleReference(MD, E->getLocStart(),
-Index: tools/libclang/CXCursor.cpp
-===================================================================
---- tools/libclang/CXCursor.cpp	(revision 152265)
-+++ tools/libclang/CXCursor.cpp	(working copy)
-@@ -229,7 +229,7 @@
-   case Stmt::VAArgExprClass:
-   case Stmt::ObjCArrayLiteralClass:
-   case Stmt::ObjCDictionaryLiteralClass:
--  case Stmt::ObjCNumericLiteralClass:
-+  case Stmt::ObjCBoxedExprClass:
-   case Stmt::ObjCSubscriptRefExprClass:
-     K = CXCursor_UnexposedExpr;
-     break;
-Index: lib/Rewrite/RewriteModernObjC.cpp
-===================================================================
---- lib/Rewrite/RewriteModernObjC.cpp	(revision 152265)
-+++ lib/Rewrite/RewriteModernObjC.cpp	(working copy)
-@@ -309,6 +309,10 @@
-     Stmt *RewriteAtSelector(ObjCSelectorExpr *Exp);
-     Stmt *RewriteMessageExpr(ObjCMessageExpr *Exp);
-     Stmt *RewriteObjCStringLiteral(ObjCStringLiteral *Exp);
-+    Stmt *RewriteObjCBoolLiteralExpr(ObjCBoolLiteralExpr *Exp);
-+    Stmt *RewriteObjCBoxedExpr(ObjCBoxedExpr *Exp);
-+    Stmt *RewriteObjCArrayLiteralExpr(ObjCArrayLiteral *Exp);
-+    Stmt *RewriteObjCDictionaryLiteralExpr(ObjCDictionaryLiteral *Exp);
-     Stmt *RewriteObjCProtocolExpr(ObjCProtocolExpr *Exp);
-     void RewriteTryReturnStmts(Stmt *S);
-     void RewriteSyncReturnStmts(Stmt *S, std::string buf);
-@@ -2587,6 +2591,435 @@
-   return cast;
- }
- 
-+Stmt *RewriteModernObjC::RewriteObjCBoolLiteralExpr(ObjCBoolLiteralExpr *Exp) {
-+  unsigned IntSize =
-+    static_cast<unsigned>(Context->getTypeSize(Context->IntTy));
-+  
-+  Expr *FlagExp = IntegerLiteral::Create(*Context, 
-+                                         llvm::APInt(IntSize, Exp->getValue()), 
-+                                         Context->IntTy, Exp->getLocation());
-+  CastExpr *cast = NoTypeInfoCStyleCastExpr(Context, Context->ObjCBuiltinBoolTy,
-+                                            CK_BitCast, FlagExp);
-+  ParenExpr *PE = new (Context) ParenExpr(Exp->getLocation(), Exp->getExprLoc(), 
-+                                          cast);
-+  ReplaceStmt(Exp, PE);
-+  return PE;
-+}
-+
-+Stmt *RewriteModernObjC::RewriteObjCBoxedExpr(ObjCBoxedExpr *Exp) {
-+  // synthesize declaration of helper functions needed in this routine.
-+  if (!SelGetUidFunctionDecl)
-+    SynthSelGetUidFunctionDecl();
-+  // use objc_msgSend() for all.
-+  if (!MsgSendFunctionDecl)
-+    SynthMsgSendFunctionDecl();
-+  if (!GetClassFunctionDecl)
-+    SynthGetClassFunctionDecl();
-+  
-+  FunctionDecl *MsgSendFlavor = MsgSendFunctionDecl;
-+  SourceLocation StartLoc = Exp->getLocStart();
-+  SourceLocation EndLoc = Exp->getLocEnd();
-+  
-+  // Synthesize a call to objc_msgSend().
-+  SmallVector<Expr*, 4> MsgExprs;
-+  SmallVector<Expr*, 4> ClsExprs;
-+  QualType argType = Context->getPointerType(Context->CharTy);
-+  
-+  // Create a call to objc_getClass("<BoxingClass>"). It will be the 1st argument.
-+  ObjCMethodDecl *BoxingMethod = Exp->getBoxingMethod();
-+  ObjCInterfaceDecl *BoxingClass = BoxingMethod->getClassInterface();
-+  
-+  IdentifierInfo *clsName = BoxingClass->getIdentifier();
-+  ClsExprs.push_back(StringLiteral::Create(*Context,
-+                                           clsName->getName(),
-+                                           StringLiteral::Ascii, false,
-+                                           argType, SourceLocation()));
-+  CallExpr *Cls = SynthesizeCallToFunctionDecl(GetClassFunctionDecl,
-+                                               &ClsExprs[0],
-+                                               ClsExprs.size(), 
-+                                               StartLoc, EndLoc);
-+  MsgExprs.push_back(Cls);
-+  
-+  // Create a call to sel_registerName("<BoxingMethod>:"), etc.
-+  // it will be the 2nd argument.
-+  SmallVector<Expr*, 4> SelExprs;
-+  SelExprs.push_back(StringLiteral::Create(*Context,
-+                                           BoxingMethod->getSelector().getAsString(),
-+                                           StringLiteral::Ascii, false,
-+                                           argType, SourceLocation()));
-+  CallExpr *SelExp = SynthesizeCallToFunctionDecl(SelGetUidFunctionDecl,
-+                                                  &SelExprs[0], SelExprs.size(),
-+                                                  StartLoc, EndLoc);
-+  MsgExprs.push_back(SelExp);
-+  
-+  // User provided sub-expression is the 3rd, and last, argument.
-+  Expr *subExpr  = Exp->getSubExpr();
-+  if (ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(subExpr)) {
-+    QualType type = ICE->getType();
-+    const Expr *SubExpr = ICE->IgnoreParenImpCasts();
-+    CastKind CK = CK_BitCast;
-+    if (SubExpr->getType()->isIntegralType(*Context) && type->isBooleanType())
-+      CK = CK_IntegralToBoolean;
-+    subExpr = NoTypeInfoCStyleCastExpr(Context, type, CK, subExpr);
-+  }
-+  MsgExprs.push_back(subExpr);
-+  
-+  SmallVector<QualType, 4> ArgTypes;
-+  ArgTypes.push_back(Context->getObjCIdType());
-+  ArgTypes.push_back(Context->getObjCSelType());
-+  for (ObjCMethodDecl::param_iterator PI = BoxingMethod->param_begin(),
-+       E = BoxingMethod->param_end(); PI != E; ++PI)
-+    ArgTypes.push_back((*PI)->getType());
-+  
-+  QualType returnType = Exp->getType();
-+  // Get the type, we will need to reference it in a couple spots.
-+  QualType msgSendType = MsgSendFlavor->getType();
-+  
-+  // Create a reference to the objc_msgSend() declaration.
-+  DeclRefExpr *DRE = new (Context) DeclRefExpr(MsgSendFlavor, msgSendType,
-+                                               VK_LValue, SourceLocation());
-+  
-+  CastExpr *cast = NoTypeInfoCStyleCastExpr(Context,
-+                                            Context->getPointerType(Context->VoidTy),
-+                                            CK_BitCast, DRE);
-+  
-+  // Now do the "normal" pointer to function cast.
-+  QualType castType =
-+  getSimpleFunctionType(returnType, &ArgTypes[0], ArgTypes.size(),
-+                        BoxingMethod->isVariadic());
-+  castType = Context->getPointerType(castType);
-+  cast = NoTypeInfoCStyleCastExpr(Context, castType, CK_BitCast,
-+                                  cast);
-+  
-+  // Don't forget the parens to enforce the proper binding.
-+  ParenExpr *PE = new (Context) ParenExpr(StartLoc, EndLoc, cast);
-+  
-+  const FunctionType *FT = msgSendType->getAs<FunctionType>();
-+  CallExpr *CE = new (Context) CallExpr(*Context, PE, &MsgExprs[0],
-+                                        MsgExprs.size(),
-+                                        FT->getResultType(), VK_RValue,
-+                                        EndLoc);
-+  ReplaceStmt(Exp, CE);
-+  return CE;
-+}
-+
-+Stmt *RewriteModernObjC::RewriteObjCArrayLiteralExpr(ObjCArrayLiteral *Exp) {
-+  // synthesize declaration of helper functions needed in this routine.
-+  if (!SelGetUidFunctionDecl)
-+    SynthSelGetUidFunctionDecl();
-+  // use objc_msgSend() for all.
-+  if (!MsgSendFunctionDecl)
-+    SynthMsgSendFunctionDecl();
-+  if (!GetClassFunctionDecl)
-+    SynthGetClassFunctionDecl();
-+  
-+  FunctionDecl *MsgSendFlavor = MsgSendFunctionDecl;
-+  SourceLocation StartLoc = Exp->getLocStart();
-+  SourceLocation EndLoc = Exp->getLocEnd();
-+  
-+  // Build the expression: __NSContainer_literal(int, ...).arr
-+  QualType IntQT = Context->IntTy;
-+  QualType NSArrayFType =
-+    getSimpleFunctionType(Context->VoidTy, &IntQT, 1, true);
-+  std::string NSArrayFName("__NSContainer_literal");
-+  FunctionDecl *NSArrayFD = SynthBlockInitFunctionDecl(NSArrayFName);
-+  DeclRefExpr *NSArrayDRE = 
-+    new (Context) DeclRefExpr(NSArrayFD, NSArrayFType, VK_RValue,
-+                              SourceLocation());
-+
-+  SmallVector<Expr*, 16> InitExprs;
-+  unsigned NumElements = Exp->getNumElements();
-+  unsigned UnsignedIntSize = 
-+    static_cast<unsigned>(Context->getTypeSize(Context->UnsignedIntTy));
-+  Expr *count = IntegerLiteral::Create(*Context,
-+                                       llvm::APInt(UnsignedIntSize, NumElements),
-+                                       Context->UnsignedIntTy, SourceLocation());
-+  InitExprs.push_back(count);
-+  for (unsigned i = 0; i < NumElements; i++)
-+    InitExprs.push_back(Exp->getElement(i));
-+  Expr *NSArrayCallExpr = 
-+    new (Context) CallExpr(*Context, NSArrayDRE, &InitExprs[0], InitExprs.size(),
-+                           NSArrayFType, VK_LValue, SourceLocation());
-+  
-+  FieldDecl *ARRFD = FieldDecl::Create(*Context, 0, SourceLocation(),
-+                                    SourceLocation(),
-+                                    &Context->Idents.get("arr"),
-+                                    Context->getPointerType(Context->VoidPtrTy), 0,
-+                                    /*BitWidth=*/0, /*Mutable=*/true,
-+                                    /*HasInit=*/false);
-+  MemberExpr *ArrayLiteralME = 
-+    new (Context) MemberExpr(NSArrayCallExpr, false, ARRFD, 
-+                             SourceLocation(),
-+                             ARRFD->getType(), VK_LValue,
-+                             OK_Ordinary);
-+  QualType ConstIdT = Context->getObjCIdType().withConst();
-+  CStyleCastExpr * ArrayLiteralObjects = 
-+    NoTypeInfoCStyleCastExpr(Context, 
-+                             Context->getPointerType(ConstIdT),
-+                             CK_BitCast,
-+                             ArrayLiteralME);
-+  
-+  // Synthesize a call to objc_msgSend().
-+  SmallVector<Expr*, 32> MsgExprs;
-+  SmallVector<Expr*, 4> ClsExprs;
-+  QualType argType = Context->getPointerType(Context->CharTy);
-+  QualType expType = Exp->getType();
-+  
-+  // Create a call to objc_getClass("NSArray"). It will be th 1st argument.
-+  ObjCInterfaceDecl *Class = 
-+    expType->getPointeeType()->getAs<ObjCObjectType>()->getInterface();
-+  
-+  IdentifierInfo *clsName = Class->getIdentifier();
-+  ClsExprs.push_back(StringLiteral::Create(*Context,
-+                                           clsName->getName(),
-+                                           StringLiteral::Ascii, false,
-+                                           argType, SourceLocation()));
-+  CallExpr *Cls = SynthesizeCallToFunctionDecl(GetClassFunctionDecl,
-+                                               &ClsExprs[0],
-+                                               ClsExprs.size(), 
-+                                               StartLoc, EndLoc);
-+  MsgExprs.push_back(Cls);
-+  
-+  // Create a call to sel_registerName("arrayWithObjects:count:").
-+  // it will be the 2nd argument.
-+  SmallVector<Expr*, 4> SelExprs;
-+  ObjCMethodDecl *ArrayMethod = Exp->getArrayWithObjectsMethod();
-+  SelExprs.push_back(StringLiteral::Create(*Context,
-+                                           ArrayMethod->getSelector().getAsString(),
-+                                           StringLiteral::Ascii, false,
-+                                           argType, SourceLocation()));
-+  CallExpr *SelExp = SynthesizeCallToFunctionDecl(SelGetUidFunctionDecl,
-+                                                  &SelExprs[0], SelExprs.size(),
-+                                                  StartLoc, EndLoc);
-+  MsgExprs.push_back(SelExp);
-+  
-+  // (const id [])objects
-+  MsgExprs.push_back(ArrayLiteralObjects);
-+  
-+  // (NSUInteger)cnt
-+  Expr *cnt = IntegerLiteral::Create(*Context,
-+                                     llvm::APInt(UnsignedIntSize, NumElements),
-+                                     Context->UnsignedIntTy, SourceLocation());
-+  MsgExprs.push_back(cnt);
-+  
-+  
-+  SmallVector<QualType, 4> ArgTypes;
-+  ArgTypes.push_back(Context->getObjCIdType());
-+  ArgTypes.push_back(Context->getObjCSelType());
-+  for (ObjCMethodDecl::param_iterator PI = ArrayMethod->param_begin(),
-+       E = ArrayMethod->param_end(); PI != E; ++PI)
-+    ArgTypes.push_back((*PI)->getType());
-+  
-+  QualType returnType = Exp->getType();
-+  // Get the type, we will need to reference it in a couple spots.
-+  QualType msgSendType = MsgSendFlavor->getType();
-+  
-+  // Create a reference to the objc_msgSend() declaration.
-+  DeclRefExpr *DRE = new (Context) DeclRefExpr(MsgSendFlavor, msgSendType,
-+                                               VK_LValue, SourceLocation());
-+  
-+  CastExpr *cast = NoTypeInfoCStyleCastExpr(Context,
-+                                            Context->getPointerType(Context->VoidTy),
-+                                            CK_BitCast, DRE);
-+  
-+  // Now do the "normal" pointer to function cast.
-+  QualType castType =
-+  getSimpleFunctionType(returnType, &ArgTypes[0], ArgTypes.size(),
-+                        ArrayMethod->isVariadic());
-+  castType = Context->getPointerType(castType);
-+  cast = NoTypeInfoCStyleCastExpr(Context, castType, CK_BitCast,
-+                                  cast);
-+  
-+  // Don't forget the parens to enforce the proper binding.
-+  ParenExpr *PE = new (Context) ParenExpr(StartLoc, EndLoc, cast);
-+  
-+  const FunctionType *FT = msgSendType->getAs<FunctionType>();
-+  CallExpr *CE = new (Context) CallExpr(*Context, PE, &MsgExprs[0],
-+                                        MsgExprs.size(),
-+                                        FT->getResultType(), VK_RValue,
-+                                        EndLoc);
-+  ReplaceStmt(Exp, CE);
-+  return CE;
-+}
-+
-+Stmt *RewriteModernObjC::RewriteObjCDictionaryLiteralExpr(ObjCDictionaryLiteral *Exp) {
-+  // synthesize declaration of helper functions needed in this routine.
-+  if (!SelGetUidFunctionDecl)
-+    SynthSelGetUidFunctionDecl();
-+  // use objc_msgSend() for all.
-+  if (!MsgSendFunctionDecl)
-+    SynthMsgSendFunctionDecl();
-+  if (!GetClassFunctionDecl)
-+    SynthGetClassFunctionDecl();
-+  
-+  FunctionDecl *MsgSendFlavor = MsgSendFunctionDecl;
-+  SourceLocation StartLoc = Exp->getLocStart();
-+  SourceLocation EndLoc = Exp->getLocEnd();
-+  
-+  // Build the expression: __NSContainer_literal(int, ...).arr
-+  QualType IntQT = Context->IntTy;
-+  QualType NSDictFType =
-+    getSimpleFunctionType(Context->VoidTy, &IntQT, 1, true);
-+  std::string NSDictFName("__NSContainer_literal");
-+  FunctionDecl *NSDictFD = SynthBlockInitFunctionDecl(NSDictFName);
-+  DeclRefExpr *NSDictDRE = 
-+    new (Context) DeclRefExpr(NSDictFD, NSDictFType, VK_RValue,
-+                              SourceLocation());
-+  
-+  SmallVector<Expr*, 16> KeyExprs;
-+  SmallVector<Expr*, 16> ValueExprs;
-+  
-+  unsigned NumElements = Exp->getNumElements();
-+  unsigned UnsignedIntSize = 
-+    static_cast<unsigned>(Context->getTypeSize(Context->UnsignedIntTy));
-+  Expr *count = IntegerLiteral::Create(*Context,
-+                                       llvm::APInt(UnsignedIntSize, NumElements),
-+                                       Context->UnsignedIntTy, SourceLocation());
-+  KeyExprs.push_back(count);
-+  ValueExprs.push_back(count);
-+  for (unsigned i = 0; i < NumElements; i++) {
-+    ObjCDictionaryElement Element = Exp->getKeyValueElement(i);
-+    KeyExprs.push_back(Element.Key);
-+    ValueExprs.push_back(Element.Value);
-+  }
-+  
-+  // (const id [])objects
-+  Expr *NSValueCallExpr = 
-+    new (Context) CallExpr(*Context, NSDictDRE, &ValueExprs[0], ValueExprs.size(),
-+                           NSDictFType, VK_LValue, SourceLocation());
-+  
-+  FieldDecl *ARRFD = FieldDecl::Create(*Context, 0, SourceLocation(),
-+                                       SourceLocation(),
-+                                       &Context->Idents.get("arr"),
-+                                       Context->getPointerType(Context->VoidPtrTy), 0,
-+                                       /*BitWidth=*/0, /*Mutable=*/true,
-+                                       /*HasInit=*/false);
-+  MemberExpr *DictLiteralValueME = 
-+    new (Context) MemberExpr(NSValueCallExpr, false, ARRFD, 
-+                             SourceLocation(),
-+                             ARRFD->getType(), VK_LValue,
-+                             OK_Ordinary);
-+  QualType ConstIdT = Context->getObjCIdType().withConst();
-+  CStyleCastExpr * DictValueObjects = 
-+    NoTypeInfoCStyleCastExpr(Context, 
-+                             Context->getPointerType(ConstIdT),
-+                             CK_BitCast,
-+                             DictLiteralValueME);
-+  // (const id <NSCopying> [])keys
-+  Expr *NSKeyCallExpr = 
-+    new (Context) CallExpr(*Context, NSDictDRE, &KeyExprs[0], KeyExprs.size(),
-+                           NSDictFType, VK_LValue, SourceLocation());
-+  
-+  MemberExpr *DictLiteralKeyME = 
-+    new (Context) MemberExpr(NSKeyCallExpr, false, ARRFD, 
-+                             SourceLocation(),
-+                             ARRFD->getType(), VK_LValue,
-+                             OK_Ordinary);
-+  
-+  CStyleCastExpr * DictKeyObjects = 
-+    NoTypeInfoCStyleCastExpr(Context, 
-+                             Context->getPointerType(ConstIdT),
-+                             CK_BitCast,
-+                             DictLiteralKeyME);
-+  
-+  
-+  
-+  // Synthesize a call to objc_msgSend().
-+  SmallVector<Expr*, 32> MsgExprs;
-+  SmallVector<Expr*, 4> ClsExprs;
-+  QualType argType = Context->getPointerType(Context->CharTy);
-+  QualType expType = Exp->getType();
-+  
-+  // Create a call to objc_getClass("NSArray"). It will be th 1st argument.
-+  ObjCInterfaceDecl *Class = 
-+  expType->getPointeeType()->getAs<ObjCObjectType>()->getInterface();
-+  
-+  IdentifierInfo *clsName = Class->getIdentifier();
-+  ClsExprs.push_back(StringLiteral::Create(*Context,
-+                                           clsName->getName(),
-+                                           StringLiteral::Ascii, false,
-+                                           argType, SourceLocation()));
-+  CallExpr *Cls = SynthesizeCallToFunctionDecl(GetClassFunctionDecl,
-+                                               &ClsExprs[0],
-+                                               ClsExprs.size(), 
-+                                               StartLoc, EndLoc);
-+  MsgExprs.push_back(Cls);
-+  
-+  // Create a call to sel_registerName("arrayWithObjects:count:").
-+  // it will be the 2nd argument.
-+  SmallVector<Expr*, 4> SelExprs;
-+  ObjCMethodDecl *DictMethod = Exp->getDictWithObjectsMethod();
-+  SelExprs.push_back(StringLiteral::Create(*Context,
-+                                           DictMethod->getSelector().getAsString(),
-+                                           StringLiteral::Ascii, false,
-+                                           argType, SourceLocation()));
-+  CallExpr *SelExp = SynthesizeCallToFunctionDecl(SelGetUidFunctionDecl,
-+                                                  &SelExprs[0], SelExprs.size(),
-+                                                  StartLoc, EndLoc);
-+  MsgExprs.push_back(SelExp);
-+  
-+  // (const id [])objects
-+  MsgExprs.push_back(DictValueObjects);
-+  
-+  // (const id <NSCopying> [])keys
-+  MsgExprs.push_back(DictKeyObjects);
-+  
-+  // (NSUInteger)cnt
-+  Expr *cnt = IntegerLiteral::Create(*Context,
-+                                     llvm::APInt(UnsignedIntSize, NumElements),
-+                                     Context->UnsignedIntTy, SourceLocation());
-+  MsgExprs.push_back(cnt);
-+  
-+  
-+  SmallVector<QualType, 8> ArgTypes;
-+  ArgTypes.push_back(Context->getObjCIdType());
-+  ArgTypes.push_back(Context->getObjCSelType());
-+  for (ObjCMethodDecl::param_iterator PI = DictMethod->param_begin(),
-+       E = DictMethod->param_end(); PI != E; ++PI) {
-+    QualType T = (*PI)->getType();
-+    if (const PointerType* PT = T->getAs<PointerType>()) {
-+      QualType PointeeTy = PT->getPointeeType();
-+      convertToUnqualifiedObjCType(PointeeTy);
-+      T = Context->getPointerType(PointeeTy);
-+    }
-+    ArgTypes.push_back(T);
-+  }
-+  
-+  QualType returnType = Exp->getType();
-+  // Get the type, we will need to reference it in a couple spots.
-+  QualType msgSendType = MsgSendFlavor->getType();
-+  
-+  // Create a reference to the objc_msgSend() declaration.
-+  DeclRefExpr *DRE = new (Context) DeclRefExpr(MsgSendFlavor, msgSendType,
-+                                               VK_LValue, SourceLocation());
-+  
-+  CastExpr *cast = NoTypeInfoCStyleCastExpr(Context,
-+                                            Context->getPointerType(Context->VoidTy),
-+                                            CK_BitCast, DRE);
-+  
-+  // Now do the "normal" pointer to function cast.
-+  QualType castType =
-+  getSimpleFunctionType(returnType, &ArgTypes[0], ArgTypes.size(),
-+                        DictMethod->isVariadic());
-+  castType = Context->getPointerType(castType);
-+  cast = NoTypeInfoCStyleCastExpr(Context, castType, CK_BitCast,
-+                                  cast);
-+  
-+  // Don't forget the parens to enforce the proper binding.
-+  ParenExpr *PE = new (Context) ParenExpr(StartLoc, EndLoc, cast);
-+  
-+  const FunctionType *FT = msgSendType->getAs<FunctionType>();
-+  CallExpr *CE = new (Context) CallExpr(*Context, PE, &MsgExprs[0],
-+                                        MsgExprs.size(),
-+                                        FT->getResultType(), VK_RValue,
-+                                        EndLoc);
-+  ReplaceStmt(Exp, CE);
-+  return CE;
-+}
-+
-+// struct __rw_objc_super { 
-+//   struct objc_object *object; struct objc_object *superClass; 
-+// };
- // struct objc_super { struct objc_object *receiver; struct objc_class *super; };
- QualType RewriteModernObjC::getSuperStructType() {
-   if (!SuperStructDecl) {
-@@ -4801,6 +5234,19 @@
- 
-   if (ObjCStringLiteral *AtString = dyn_cast<ObjCStringLiteral>(S))
-     return RewriteObjCStringLiteral(AtString);
-+  
-+  if (ObjCBoolLiteralExpr *BoolLitExpr = dyn_cast<ObjCBoolLiteralExpr>(S))
-+    return RewriteObjCBoolLiteralExpr(BoolLitExpr);
-+  
-+  if (ObjCBoxedExpr *BoxedExpr = dyn_cast<ObjCBoxedExpr>(S))
-+    return RewriteObjCBoxedExpr(BoxedExpr);
-+  
-+  if (ObjCArrayLiteral *ArrayLitExpr = dyn_cast<ObjCArrayLiteral>(S))
-+    return RewriteObjCArrayLiteralExpr(ArrayLitExpr);
-+  
-+  if (ObjCDictionaryLiteral *DictionaryLitExpr = 
-+        dyn_cast<ObjCDictionaryLiteral>(S))
-+    return RewriteObjCDictionaryLiteralExpr(DictionaryLitExpr);
- 
-   if (ObjCMessageExpr *MessExpr = dyn_cast<ObjCMessageExpr>(S)) {
- #if 0
-Index: lib/Sema/TreeTransform.h
-===================================================================
---- lib/Sema/TreeTransform.h	(revision 152265)
-+++ lib/Sema/TreeTransform.h	(working copy)
-@@ -2211,6 +2211,14 @@
-                                                 RParenLoc);
-   }
- 
-+  /// \brief Build a new Objective-C boxed expression.
-+  ///
-+  /// By default, performs semantic analysis to build the new expression.
-+  /// Subclasses may override this routine to provide different behavior.
-+  ExprResult RebuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr) {
-+    return getSema().BuildObjCBoxedExpr(SR, ValueExpr);
-+  }
-+  
-   /// \brief Build a new Objective-C array literal.
-   ///
-   /// By default, performs semantic analysis to build the new expression.
-@@ -8298,8 +8306,16 @@
- 
- template<typename Derived>
- ExprResult
--TreeTransform<Derived>::TransformObjCNumericLiteral(ObjCNumericLiteral *E) {
--  return SemaRef.MaybeBindToTemporary(E);
-+TreeTransform<Derived>::TransformObjCBoxedExpr(ObjCBoxedExpr *E) {
-+  ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
-+  if (SubExpr.isInvalid())
-+    return ExprError();
-+
-+  if (!getDerived().AlwaysRebuild() &&
-+      SubExpr.get() == E->getSubExpr())
-+    return SemaRef.Owned(E);
-+
-+  return getDerived().RebuildObjCBoxedExpr(E->getSourceRange(), SubExpr.get());
- }
- 
- template<typename Derived>
-Index: lib/Sema/SemaExprCXX.cpp
-===================================================================
---- lib/Sema/SemaExprCXX.cpp	(revision 152265)
-+++ lib/Sema/SemaExprCXX.cpp	(working copy)
-@@ -4469,8 +4469,8 @@
-       ObjCMethodDecl *D = 0;
-       if (ObjCMessageExpr *Send = dyn_cast<ObjCMessageExpr>(E)) {
-         D = Send->getMethodDecl();
--      } else if (ObjCNumericLiteral *NumLit = dyn_cast<ObjCNumericLiteral>(E)) {
--        D = NumLit->getObjCNumericLiteralMethod();
-+      } else if (ObjCBoxedExpr *BoxedExpr = dyn_cast<ObjCBoxedExpr>(E)) {
-+        D = BoxedExpr->getBoxingMethod();
-       } else if (ObjCArrayLiteral *ArrayLit = dyn_cast<ObjCArrayLiteral>(E)) {
-         D = ArrayLit->getArrayWithObjectsMethod();
-       } else if (ObjCDictionaryLiteral *DictLit
-@@ -4529,6 +4529,17 @@
-   if (RD->isInvalidDecl() || RD->isDependentContext())
-     return Owned(E);
- 
-+  if (!RD->getDefinition()) {
-+    if (RD->hasExternalLexicalStorage()) {
-+      ExternalASTSource *ext_source = RD->getASTContext().getExternalSource();
-+      if (ext_source)
-+        ext_source->CompleteType(RD);
-+    }
-+  }
-+
-+  if (!RD->getDefinition())
-+    return Owned(E);
-+
-   bool IsDecltype = ExprEvalContexts.back().IsDecltype;
-   CXXDestructorDecl *Destructor = IsDecltype ? 0 : LookupDestructor(RD);
- 
-Index: lib/Sema/SemaExceptionSpec.cpp
-===================================================================
---- lib/Sema/SemaExceptionSpec.cpp	(revision 152265)
-+++ lib/Sema/SemaExceptionSpec.cpp	(working copy)
-@@ -726,4 +726,4 @@
-                                   New->getLocation());
- }
- 
--} // end namespace clang
-+}
-Index: lib/Sema/SemaChecking.cpp
-===================================================================
---- lib/Sema/SemaChecking.cpp	(revision 152265)
-+++ lib/Sema/SemaChecking.cpp	(working copy)
-@@ -4416,12 +4416,16 @@
- 
-   // Don't consider sizes resulting from macro expansions or template argument
-   // substitution to form C89 tail-padded arrays.
--  ConstantArrayTypeLoc TL =
--    cast<ConstantArrayTypeLoc>(FD->getTypeSourceInfo()->getTypeLoc());
--  const Expr *SizeExpr = dyn_cast<IntegerLiteral>(TL.getSizeExpr());
--  if (!SizeExpr || SizeExpr->getExprLoc().isMacroID())
--    return false;
- 
-+  TypeSourceInfo *TInfo = FD->getTypeSourceInfo();
-+  if (TInfo) {
-+    ConstantArrayTypeLoc TL =
-+      cast<ConstantArrayTypeLoc>(TInfo->getTypeLoc());
-+    const Expr *SizeExpr = dyn_cast<IntegerLiteral>(TL.getSizeExpr());
-+    if (!SizeExpr || SizeExpr->getExprLoc().isMacroID())
-+      return false;
-+  }
-+
-   const RecordDecl *RD = dyn_cast<RecordDecl>(FD->getDeclContext());
-   if (!RD) return false;
-   if (RD->isUnion()) return false;
-Index: lib/Sema/SemaExprObjC.cpp
-===================================================================
---- lib/Sema/SemaExprObjC.cpp	(revision 152265)
-+++ lib/Sema/SemaExprObjC.cpp	(working copy)
-@@ -111,7 +111,7 @@
-       Ty = Context.getObjCIdType();
-     }
-   } else {
--    IdentifierInfo *NSIdent = &Context.Idents.get("NSString");
-+    IdentifierInfo *NSIdent = NSAPIObj->getNSClassId(NSAPI::ClassId_NSString);
-     NamedDecl *IF = LookupSingleName(TUScope, NSIdent, AtLoc,
-                                      LookupOrdinaryName);
-     if (ObjCInterfaceDecl *StrIF = dyn_cast_or_null<ObjCInterfaceDecl>(IF)) {
-@@ -143,41 +143,70 @@
- /// \brief Retrieve the NSNumber factory method that should be used to create
- /// an Objective-C literal for the given type.
- static ObjCMethodDecl *getNSNumberFactoryMethod(Sema &S, SourceLocation Loc,
--                                                QualType T, QualType ReturnType,
--                                                SourceRange Range) {
-+                                                QualType NumberType,
-+                                                bool isLiteral = false,
-+                                                SourceRange R = SourceRange()) {
-   llvm::Optional<NSAPI::NSNumberLiteralMethodKind> Kind 
--    = S.NSAPIObj->getNSNumberFactoryMethodKind(T);
-+    = S.NSAPIObj->getNSNumberFactoryMethodKind(NumberType);
-   
-   if (!Kind) {
--    S.Diag(Loc, diag::err_invalid_nsnumber_type)
--      << T << Range;
-+    if (isLiteral) {
-+      S.Diag(Loc, diag::err_invalid_nsnumber_type)
-+        << NumberType << R;
-+    }
-     return 0;
-   }
--    
-+  
-   // If we already looked up this method, we're done.
-   if (S.NSNumberLiteralMethods[*Kind])
-     return S.NSNumberLiteralMethods[*Kind];
-   
-   Selector Sel = S.NSAPIObj->getNSNumberLiteralSelector(*Kind,
-                                                         /*Instance=*/false);
-+
-+  ASTContext &CX = S.Context;
-   
-+  // Look up the NSNumber class, if we haven't done so already. It's cached
-+  // in the Sema instance.
-+  if (!S.NSNumberDecl) {
-+    IdentifierInfo *NSNumberId = S.NSAPIObj->getNSClassId(NSAPI::ClassId_NSNumber);
-+    if (S.getLangOptions().DebuggerObjCLiteral) {
-+      // Create a stub definition of NSNumber.
-+      S.NSNumberDecl =  ObjCInterfaceDecl::Create (CX,
-+                                                   CX.getTranslationUnitDecl(),
-+                                                   SourceLocation(),  NSNumberId,
-+                                                   0, SourceLocation());
-+    } else {
-+      // Otherwise, require a declaration of NSNumber.
-+      NamedDecl *IF = S.LookupSingleName(S.TUScope, NSNumberId,
-+                                         Loc, Sema::LookupOrdinaryName);
-+      S.NSNumberDecl = dyn_cast_or_null<ObjCInterfaceDecl>(IF);
-+      if (!S.NSNumberDecl || !S.NSNumberDecl->hasDefinition()) {
-+        S.Diag(Loc, diag::err_undeclared_nsnumber);
-+        return 0;
-+      }
-+    }
-+    
-+    // generate the pointer to NSNumber type.
-+    S.NSNumberPointer = CX.getObjCObjectPointerType(CX.getObjCInterfaceType(S.NSNumberDecl));
-+  }
-+  
-   // Look for the appropriate method within NSNumber.
-   ObjCMethodDecl *Method = S.NSNumberDecl->lookupClassMethod(Sel);;
-   if (!Method && S.getLangOptions().DebuggerObjCLiteral) {
-+    // create a stub definition this NSNumber factory method.
-     TypeSourceInfo *ResultTInfo = 0;
--    Method = ObjCMethodDecl::Create(S.Context, SourceLocation(), SourceLocation(), Sel,
--                           ReturnType,
--                           ResultTInfo,
--                           S.Context.getTranslationUnitDecl(),
--                           false /*Instance*/, false/*isVariadic*/,
--                           /*isSynthesized=*/false,
--                           /*isImplicitlyDeclared=*/true, /*isDefined=*/false,
--                           ObjCMethodDecl::Required,
--                           false);
-+    Method = ObjCMethodDecl::Create(CX, SourceLocation(), SourceLocation(), Sel,
-+                                    S.NSNumberPointer, ResultTInfo, S.NSNumberDecl,
-+                                    /*isInstance=*/false, /*isVariadic=*/false,
-+                                    /*isSynthesized=*/false,
-+                                    /*isImplicitlyDeclared=*/true,
-+                                    /*isDefined=*/false, ObjCMethodDecl::Required,
-+                                    /*HasRelatedResultType=*/false);
-     ParmVarDecl *value = ParmVarDecl::Create(S.Context, Method,
-                                              SourceLocation(), SourceLocation(),
--                                             &S.Context.Idents.get("value"),
--                                             T, /*TInfo=*/0, SC_None, SC_None, 0);
-+                                             &CX.Idents.get("value"),
-+                                             NumberType, /*TInfo=*/0, SC_None, SC_None, 0);
-     Method->setMethodParams(S.Context, value, ArrayRef<SourceLocation>());
-   }
- 
-@@ -202,29 +231,9 @@
-   return Method;
- }
- 
--/// BuildObjCNumericLiteral - builds an ObjCNumericLiteral AST node for the
--/// numeric literal expression. Type of the expression will be "NSNumber *"
--/// or "id" if NSNumber is unavailable.
-+/// BuildObjCNumericLiteral - builds an ObjCBoxedExpr AST node for the
-+/// numeric literal expression. Type of the expression will be "NSNumber *".
- ExprResult Sema::BuildObjCNumericLiteral(SourceLocation AtLoc, Expr *Number) {
--  // Look up the NSNumber class, if we haven't done so already.
--  if (!NSNumberDecl) {
--    NamedDecl *IF = LookupSingleName(TUScope,
--                                NSAPIObj->getNSClassId(NSAPI::ClassId_NSNumber),
--                                AtLoc, LookupOrdinaryName);
--    NSNumberDecl = dyn_cast_or_null<ObjCInterfaceDecl>(IF);
--    
--    if (!NSNumberDecl && getLangOptions().DebuggerObjCLiteral)
--      NSNumberDecl =  ObjCInterfaceDecl::Create (Context,
--                        Context.getTranslationUnitDecl(),
--                        SourceLocation(), 
--                        NSAPIObj->getNSClassId(NSAPI::ClassId_NSNumber),
--                        0, SourceLocation());
--    if (!NSNumberDecl) {
--      Diag(AtLoc, diag::err_undeclared_nsnumber);
--      return ExprError();
--    }
--  }
--  
-   // Determine the type of the literal.
-   QualType NumberType = Number->getType();
-   if (CharacterLiteral *Char = dyn_cast<CharacterLiteral>(Number)) {
-@@ -249,29 +258,29 @@
-     }
-   }
-   
--  ObjCMethodDecl *Method = 0;
-   // Look for the appropriate method within NSNumber.
-   // Construct the literal.
--  QualType Ty
--    = Context.getObjCObjectPointerType(
--                                    Context.getObjCInterfaceType(NSNumberDecl));
--  Method  = getNSNumberFactoryMethod(*this, AtLoc, 
--                                     NumberType, Ty, 
--                                     Number->getSourceRange());
--
-+  SourceRange NR(Number->getSourceRange());
-+  ObjCMethodDecl *Method = getNSNumberFactoryMethod(*this, AtLoc, NumberType,
-+                                                    true, NR);
-   if (!Method)
-     return ExprError();
- 
-   // Convert the number to the type that the parameter expects.
--  QualType ElementT = Method->param_begin()[0]->getType();
--  ExprResult ConvertedNumber = PerformImplicitConversion(Number, ElementT,
--                                                         AA_Sending);
-+  ParmVarDecl *ParamDecl = Method->param_begin()[0];
-+  InitializedEntity Entity = InitializedEntity::InitializeParameter(Context,
-+                                                                    ParamDecl);
-+  ExprResult ConvertedNumber = PerformCopyInitialization(Entity,
-+                                                         SourceLocation(),
-+                                                         Owned(Number));
-   if (ConvertedNumber.isInvalid())
-     return ExprError();
-   Number = ConvertedNumber.get();
-   
-+  // Use the effective source range of the literal, including the leading '@'.
-   return MaybeBindToTemporary(
--           new (Context) ObjCNumericLiteral(Number, Ty, Method, AtLoc));
-+           new (Context) ObjCBoxedExpr(Number, NSNumberPointer, Method,
-+                                       SourceRange(AtLoc, NR.getEnd())));
- }
- 
- ExprResult Sema::ActOnObjCBoolLiteral(SourceLocation AtLoc, 
-@@ -385,6 +394,154 @@
-            Element->getLocStart(), Element);
- }
- 
-+ExprResult Sema::BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr) {
-+  if (ValueExpr->isTypeDependent()) {
-+    ObjCBoxedExpr *BoxedExpr = 
-+      new (Context) ObjCBoxedExpr(ValueExpr, Context.DependentTy, NULL, SR);
-+    return Owned(BoxedExpr);
-+  }
-+  ObjCMethodDecl *BoxingMethod = NULL;
-+  QualType BoxedType;
-+  // Convert the expression to an RValue, so we can check for pointer types...
-+  ExprResult RValue = DefaultFunctionArrayLvalueConversion(ValueExpr);
-+  if (RValue.isInvalid()) {
-+    return ExprError();
-+  }
-+  ValueExpr = RValue.get();
-+  QualType ValueType(ValueExpr->getType());
-+  if (const PointerType *PT = ValueType->getAs<PointerType>()) {
-+    QualType PointeeType = PT->getPointeeType();
-+    if (Context.hasSameUnqualifiedType(PointeeType, Context.CharTy)) {
-+      IdentifierInfo *NSStringId =
-+        NSAPIObj->getNSClassId(NSAPI::ClassId_NSString);
-+      if (getLangOptions().DebuggerObjCLiteral) {
-+        // Support boxed expressions in the debugger w/o NSString declaration.
-+        NSStringDecl = ObjCInterfaceDecl::Create(Context,
-+                                                 Context.getTranslationUnitDecl(),
-+                                                 SourceLocation(), NSStringId,
-+                                                 0, SourceLocation());
-+      }
-+      else {
-+        NamedDecl *Decl = LookupSingleName(TUScope, NSStringId,
-+                                           SR.getBegin(), LookupOrdinaryName);
-+        NSStringDecl = dyn_cast_or_null<ObjCInterfaceDecl>(Decl);
-+
-+        if (!NSStringDecl || !NSStringDecl->hasDefinition()) {
-+          Diag(SR.getBegin(), diag::err_undeclared_nsstring);
-+          return ExprError();
-+        }
-+      }
-+      assert(NSStringDecl && "NSStringDecl should not be NULL");
-+      NSStringPointer =
-+        Context.getObjCObjectPointerType(Context.getObjCInterfaceType(NSStringDecl));
-+      
-+      if (!StringWithUTF8StringMethod) {
-+        IdentifierInfo *II = &Context.Idents.get("stringWithUTF8String");
-+        Selector stringWithUTF8String = Context.Selectors.getUnarySelector(II);
-+
-+        // Look for the appropriate method within NSString.
-+        StringWithUTF8StringMethod = NSStringDecl->lookupClassMethod(stringWithUTF8String);
-+        if (!StringWithUTF8StringMethod && getLangOptions().DebuggerObjCLiteral) {
-+          // Debugger needs to work even if NSString hasn't been defined.
-+          TypeSourceInfo *ResultTInfo = 0;
-+          ObjCMethodDecl *M =
-+            ObjCMethodDecl::Create(Context, SourceLocation(), SourceLocation(),
-+                                   stringWithUTF8String, NSStringPointer,
-+                                   ResultTInfo, NSStringDecl,
-+                                   /*isInstance=*/false, /*isVariadic=*/false,
-+                                   /*isSynthesized=*/false,
-+                                   /*isImplicitlyDeclared=*/true,
-+                                   /*isDefined=*/false,
-+                                   ObjCMethodDecl::Required,
-+                                   /*HasRelatedResultType=*/false);
-+          ParmVarDecl *value =
-+            ParmVarDecl::Create(Context, M,
-+                                SourceLocation(), SourceLocation(),
-+                                &Context.Idents.get("value"),
-+                                Context.getPointerType(Context.CharTy.withConst()),
-+                                /*TInfo=*/0,
-+                                SC_None, SC_None, 0);
-+          M->setMethodParams(Context, value, ArrayRef<SourceLocation>());
-+          StringWithUTF8StringMethod = M;
-+        }
-+        assert(StringWithUTF8StringMethod &&
-+               "StringWithUTF8StringMethod should not be NULL");
-+      }
-+      
-+      BoxingMethod = StringWithUTF8StringMethod;
-+      BoxedType = NSStringPointer;
-+    }
-+  } else if (ValueType->isBuiltinType()) {
-+    // The other types we support are numeric, char and BOOL/bool. We could also
-+    // provide limited support for structure types, such as NSRange, NSRect, and
-+    // NSSize. See NSValue (NSValueGeometryExtensions) in <Foundation/NSGeometry.h>
-+    // for more details.
-+
-+    // Check for a top-level character literal.
-+    if (const CharacterLiteral *Char =
-+        dyn_cast<CharacterLiteral>(ValueExpr->IgnoreParens())) {
-+      // In C, character literals have type 'int'. That's not the type we want
-+      // to use to determine the Objective-c literal kind.
-+      switch (Char->getKind()) {
-+      case CharacterLiteral::Ascii:
-+        ValueType = Context.CharTy;
-+        break;
-+        
-+      case CharacterLiteral::Wide:
-+        ValueType = Context.getWCharType();
-+        break;
-+        
-+      case CharacterLiteral::UTF16:
-+        ValueType = Context.Char16Ty;
-+        break;
-+        
-+      case CharacterLiteral::UTF32:
-+        ValueType = Context.Char32Ty;
-+        break;
-+      }
-+    }
-+    
-+    // FIXME:  Do I need to do anything special with BoolTy expressions?
-+    
-+    // Look for the appropriate method within NSNumber.
-+    BoxingMethod = getNSNumberFactoryMethod(*this, SR.getBegin(), ValueType);
-+    BoxedType = NSNumberPointer;
-+
-+  } else if (const EnumType *ET = ValueType->getAs<EnumType>()) {
-+    if (!ET->getDecl()->isComplete()) {
-+      Diag(SR.getBegin(), diag::err_objc_incomplete_boxed_expression_type)
-+        << ValueType << ValueExpr->getSourceRange();
-+      return ExprError();
-+    }
-+
-+    BoxingMethod = getNSNumberFactoryMethod(*this, SR.getBegin(),
-+                                            ET->getDecl()->getIntegerType());
-+    BoxedType = NSNumberPointer;
-+  }
-+
-+  if (!BoxingMethod) {
-+    Diag(SR.getBegin(), diag::err_objc_illegal_boxed_expression_type)
-+      << ValueType << ValueExpr->getSourceRange();
-+    return ExprError();
-+  }
-+  
-+  // Convert the expression to the type that the parameter requires.
-+  ParmVarDecl *ParamDecl = BoxingMethod->param_begin()[0];
-+  InitializedEntity Entity = InitializedEntity::InitializeParameter(Context,
-+                                                                    ParamDecl);
-+  ExprResult ConvertedValueExpr = PerformCopyInitialization(Entity,
-+                                                            SourceLocation(),
-+                                                            Owned(ValueExpr));
-+  if (ConvertedValueExpr.isInvalid())
-+    return ExprError();
-+  ValueExpr = ConvertedValueExpr.get();
-+  
-+  ObjCBoxedExpr *BoxedExpr = 
-+    new (Context) ObjCBoxedExpr(ValueExpr, BoxedType,
-+                                      BoxingMethod, SR);
-+  return MaybeBindToTemporary(BoxedExpr);
-+}
-+
- ExprResult Sema::BuildObjCSubscriptExpression(SourceLocation RB, Expr *BaseExpr,
-                                         Expr *IndexExpr,
-                                         ObjCMethodDecl *getterMethod,
-@@ -417,21 +574,22 @@
- ExprResult Sema::BuildObjCArrayLiteral(SourceRange SR, MultiExprArg Elements) {
-   // Look up the NSArray class, if we haven't done so already.
-   if (!NSArrayDecl) {
--    NamedDecl *IF = LookupSingleName(TUScope,
--                                 NSAPIObj->getNSClassId(NSAPI::ClassId_NSArray),
--                                 SR.getBegin(),
--                                 LookupOrdinaryName);
--    NSArrayDecl = dyn_cast_or_null<ObjCInterfaceDecl>(IF);
--    if (!NSArrayDecl && getLangOptions().DebuggerObjCLiteral)
-+    if (getLangOptions().DebuggerObjCLiteral) {
-       NSArrayDecl =  ObjCInterfaceDecl::Create (Context,
-                             Context.getTranslationUnitDecl(),
-                             SourceLocation(),
-                             NSAPIObj->getNSClassId(NSAPI::ClassId_NSArray),
-                             0, SourceLocation());
--
--    if (!NSArrayDecl) {
--      Diag(SR.getBegin(), diag::err_undeclared_nsarray);
--      return ExprError();
-+    } else {
-+      NamedDecl *IF = LookupSingleName(TUScope,
-+                                   NSAPIObj->getNSClassId(NSAPI::ClassId_NSArray),
-+                                   SR.getBegin(),
-+                                   LookupOrdinaryName);
-+      NSArrayDecl = dyn_cast_or_null<ObjCInterfaceDecl>(IF);
-+      if (!NSArrayDecl) {
-+        Diag(SR.getBegin(), diag::err_undeclared_nsarray);
-+        return ExprError();
-+      }
-     }
-   }
-   
-Index: lib/Sema/Sema.cpp
-===================================================================
---- lib/Sema/Sema.cpp	(revision 152265)
-+++ lib/Sema/Sema.cpp	(working copy)
-@@ -90,7 +90,9 @@
-     PackContext(0), MSStructPragmaOn(false), VisContext(0),
-     ExprNeedsCleanups(false), LateTemplateParser(0), OpaqueParser(0),
-     IdResolver(pp), StdInitializerList(0), CXXTypeInfoDecl(0), MSVCGuidDecl(0),
--    NSNumberDecl(0), NSArrayDecl(0), ArrayWithObjectsMethod(0), 
-+    NSNumberDecl(0),
-+    NSStringDecl(0), StringWithUTF8StringMethod(0),
-+    NSArrayDecl(0), ArrayWithObjectsMethod(0), 
-     NSDictionaryDecl(0), DictionaryWithObjectsMethod(0),
-     GlobalNewDeleteDeclared(false), 
-     ObjCShouldCallSuperDealloc(false),
-Index: lib/AST/DeclObjC.cpp
-===================================================================
---- lib/AST/DeclObjC.cpp	(revision 152265)
-+++ lib/AST/DeclObjC.cpp	(working copy)
-@@ -330,6 +330,10 @@
-     LoadExternalDefinition();
- 
-   while (ClassDecl != NULL) {
-+    // FIXME: Should make sure no callers ever do this.
-+    if (!ClassDecl->hasDefinition())
-+      return 0;
-+        
-     if ((MethodDecl = ClassDecl->getMethod(Sel, isInstance)))
-       return MethodDecl;
- 
-Index: lib/AST/ASTImporter.cpp
-===================================================================
---- lib/AST/ASTImporter.cpp	(revision 152265)
-+++ lib/AST/ASTImporter.cpp	(working copy)
-@@ -119,7 +119,8 @@
-     bool ImportTemplateArguments(const TemplateArgument *FromArgs,
-                                  unsigned NumFromArgs,
-                                SmallVectorImpl<TemplateArgument> &ToArgs);
--    bool IsStructuralMatch(RecordDecl *FromRecord, RecordDecl *ToRecord);
-+    bool IsStructuralMatch(RecordDecl *FromRecord, RecordDecl *ToRecord,
-+                           bool Complain = true);
-     bool IsStructuralMatch(EnumDecl *FromEnum, EnumDecl *ToRecord);
-     bool IsStructuralMatch(ClassTemplateDecl *From, ClassTemplateDecl *To);
-     Decl *VisitDecl(Decl *D);
-@@ -201,12 +202,16 @@
-     /// \brief Whether we're being strict about the spelling of types when 
-     /// unifying two types.
-     bool StrictTypeSpelling;
--    
-+
-+    /// \brief Whether to complain about failures.
-+    bool Complain;
-+
-     StructuralEquivalenceContext(ASTContext &C1, ASTContext &C2,
-                llvm::DenseSet<std::pair<Decl *, Decl *> > &NonEquivalentDecls,
--                                 bool StrictTypeSpelling = false)
-+                                 bool StrictTypeSpelling = false,
-+                                 bool Complain = true)
-       : C1(C1), C2(C2), NonEquivalentDecls(NonEquivalentDecls),
--        StrictTypeSpelling(StrictTypeSpelling) { }
-+        StrictTypeSpelling(StrictTypeSpelling), Complain(Complain) { }
- 
-     /// \brief Determine whether the two declarations are structurally
-     /// equivalent.
-@@ -223,10 +228,16 @@
-     
-   public:
-     DiagnosticBuilder Diag1(SourceLocation Loc, unsigned DiagID) {
-+      if (!Complain)
-+        return DiagnosticBuilder(DiagnosticBuilder::Suppress);
-+
-       return C1.getDiagnostics().Report(Loc, DiagID);
-     }
- 
-     DiagnosticBuilder Diag2(SourceLocation Loc, unsigned DiagID) {
-+      if (!Complain)
-+        return DiagnosticBuilder(DiagnosticBuilder::Suppress);
-+      
-       return C2.getDiagnostics().Report(Loc, DiagID);
-     }
-   };
-@@ -2050,10 +2061,12 @@
- }
- 
- bool ASTNodeImporter::IsStructuralMatch(RecordDecl *FromRecord, 
--                                        RecordDecl *ToRecord) {
-+                                        RecordDecl *ToRecord,
-+                                        bool Complain) {
-   StructuralEquivalenceContext Ctx(Importer.getFromContext(),
-                                    Importer.getToContext(),
--                                   Importer.getNonEquivalentDecls());
-+                                   Importer.getNonEquivalentDecls(),
-+                                   false, Complain);
-   return Ctx.IsStructurallyEquivalent(FromRecord, ToRecord);
- }
- 
-@@ -2333,7 +2346,7 @@
- 
-   // We may already have a record of the same name; try to find and match it.
-   RecordDecl *AdoptDecl = 0;
--  if (!DC->isFunctionOrMethod() && SearchName) {
-+  if (!DC->isFunctionOrMethod()) {
-     SmallVector<NamedDecl *, 4> ConflictingDecls;
-     llvm::SmallVector<NamedDecl *, 2> FoundDecls;
-     DC->localUncachedLookup(SearchName, FoundDecls);
-@@ -2349,26 +2362,32 @@
-       
-       if (RecordDecl *FoundRecord = dyn_cast<RecordDecl>(Found)) {
-         if (RecordDecl *FoundDef = FoundRecord->getDefinition()) {
--          if (!D->isCompleteDefinition() || IsStructuralMatch(D, FoundDef)) {
-+          if ((SearchName && !D->isCompleteDefinition()) ||
-+              (D->isCompleteDefinition() &&
-+               D->isAnonymousStructOrUnion()
-+                 == FoundDef->isAnonymousStructOrUnion() &&
-+               IsStructuralMatch(D, FoundDef, SearchName))) {
-             // The record types structurally match, or the "from" translation
-             // unit only had a forward declaration anyway; call it the same
-             // function.
-             // FIXME: For C++, we should also merge methods here.
-             return Importer.Imported(D, FoundDef);
-           }
--        } else {
-+        } else if (!D->isCompleteDefinition()) {
-           // We have a forward declaration of this type, so adopt that forward
-           // declaration rather than building a new one.
-           AdoptDecl = FoundRecord;
-           continue;
--        }          
-+        } else if (!SearchName) {
-+          continue;
-+        }
-       }
-       
-       ConflictingDecls.push_back(FoundDecls[I]);
-     }
-     
--    if (!ConflictingDecls.empty()) {
--      Name = Importer.HandleNameConflict(Name, DC, IDNS,
-+    if (!ConflictingDecls.empty() && SearchName) {
-+      Name = Importer.HandleNameConflict(SearchName, DC, IDNS,
-                                          ConflictingDecls.data(), 
-                                          ConflictingDecls.size());
-     }
-@@ -2393,6 +2412,8 @@
-     D2->setQualifierInfo(Importer.Import(D->getQualifierLoc()));
-     D2->setLexicalDeclContext(LexicalDC);
-     LexicalDC->addDeclInternal(D2);
-+    if (D->isAnonymousStructOrUnion())
-+      D2->setAnonymousStructOrUnion(true);
-   }
-   
-   Importer.Imported(D, D2);
-@@ -2631,12 +2652,17 @@
-   DC->localUncachedLookup(Name, FoundDecls);
-   for (unsigned I = 0, N = FoundDecls.size(); I != N; ++I) {
-     if (FieldDecl *FoundField = dyn_cast<FieldDecl>(FoundDecls[I])) {
--      if (Importer.IsStructurallyEquivalent(D->getType(), 
--                                            FoundField->getType())) {
-+      if (Importer.IsStructurallyEquivalent(D->getType(),
-+                                            FoundField->getType(),
-+                                            Name)) {
-         Importer.Imported(D, FoundField);
-         return FoundField;
-       }
--      
-+
-+      // If there are more anonymous fields to check, continue.
-+      if (!Name && I < N-1)
-+        continue;
-+
-       Importer.ToDiag(Loc, diag::err_odr_field_type_inconsistent)
-         << Name << D->getType() << FoundField->getType();
-       Importer.ToDiag(FoundField->getLocation(), diag::note_odr_value_here)
-@@ -4662,12 +4688,14 @@
-   return To;
- }
- 
--bool ASTImporter::IsStructurallyEquivalent(QualType From, QualType To) {
-+bool ASTImporter::IsStructurallyEquivalent(QualType From, QualType To,
-+                                           bool Complain) {
-   llvm::DenseMap<const Type *, const Type *>::iterator Pos
-    = ImportedTypes.find(From.getTypePtr());
-   if (Pos != ImportedTypes.end() && ToContext.hasSameType(Import(From), To))
-     return true;
-       
--  StructuralEquivalenceContext Ctx(FromContext, ToContext, NonEquivalentDecls);
-+  StructuralEquivalenceContext Ctx(FromContext, ToContext, NonEquivalentDecls,
-+                                   false, Complain);
-   return Ctx.IsStructurallyEquivalent(From, To);
- }
-Index: lib/AST/NSAPI.cpp
-===================================================================
---- lib/AST/NSAPI.cpp	(revision 152265)
-+++ lib/AST/NSAPI.cpp	(working copy)
-@@ -13,7 +13,7 @@
- using namespace clang;
- 
- NSAPI::NSAPI(ASTContext &ctx)
--  : Ctx(ctx), ClassIds() {
-+  : Ctx(ctx), ClassIds(), BOOLId(0), NSIntegerId(0), NSUIntegerId(0) {
- }
- 
- IdentifierInfo *NSAPI::getNSClassId(NSClassIdKindKind K) const {
-@@ -250,11 +250,22 @@
- }
- 
- llvm::Optional<NSAPI::NSNumberLiteralMethodKind>
--NSAPI::getNSNumberFactoryMethodKind(QualType T) {
-+NSAPI::getNSNumberFactoryMethodKind(QualType T) const {
-   const BuiltinType *BT = T->getAs<BuiltinType>();
-   if (!BT)
-     return llvm::Optional<NSAPI::NSNumberLiteralMethodKind>();
--  
-+
-+  const TypedefType *TDT = T->getAs<TypedefType>();
-+  if (TDT) {
-+    QualType TDTTy = QualType(TDT, 0);
-+    if (isObjCBOOLType(TDTTy))
-+      return NSAPI::NSNumberWithBool;
-+    if (isObjCNSIntegerType(TDTTy))
-+      return NSAPI::NSNumberWithInteger;
-+    if (isObjCNSUIntegerType(TDTTy))
-+      return NSAPI::NSNumberWithUnsignedInteger;
-+  }
-+
-   switch (BT->getKind()) {
-   case BuiltinType::Char_S:
-   case BuiltinType::SChar:
-@@ -309,3 +320,35 @@
-   
-   return llvm::Optional<NSAPI::NSNumberLiteralMethodKind>();
- }
-+
-+/// \brief Returns true if \param T is a typedef of "BOOL" in objective-c.
-+bool NSAPI::isObjCBOOLType(QualType T) const {
-+  return isObjCTypedef(T, "BOOL", BOOLId);
-+}
-+/// \brief Returns true if \param T is a typedef of "NSInteger" in objective-c.
-+bool NSAPI::isObjCNSIntegerType(QualType T) const {
-+  return isObjCTypedef(T, "NSInteger", NSIntegerId);
-+}
-+/// \brief Returns true if \param T is a typedef of "NSUInteger" in objective-c.
-+bool NSAPI::isObjCNSUIntegerType(QualType T) const {
-+  return isObjCTypedef(T, "NSUInteger", NSUIntegerId);
-+}
-+
-+bool NSAPI::isObjCTypedef(QualType T,
-+                          StringRef name, IdentifierInfo *&II) const {
-+  if (!Ctx.getLangOptions().ObjC1)
-+    return false;
-+  if (T.isNull())
-+    return false;
-+
-+  if (!II)
-+    II = &Ctx.Idents.get(name);
-+
-+  while (const TypedefType *TDT = T->getAs<TypedefType>()) {
-+    if (TDT->getDecl()->getDeclName().getAsIdentifierInfo() == II)
-+      return true;
-+    T = TDT->desugar();
-+  }
-+
-+  return false;
-+}
-Index: lib/AST/DeclPrinter.cpp
-===================================================================
---- lib/AST/DeclPrinter.cpp	(revision 152265)
-+++ lib/AST/DeclPrinter.cpp	(working copy)
-@@ -114,6 +114,8 @@
-       BaseType = FTy->getResultType();
-     else if (const VectorType *VTy = BaseType->getAs<VectorType>())
-       BaseType = VTy->getElementType();
-+    else if (const ReferenceType *RTy = BaseType->getAs<ReferenceType>())
-+      BaseType = RTy->getPointeeType();
-     else
-       llvm_unreachable("Unknown declarator!");
-   }
-Index: lib/AST/Type.cpp
-===================================================================
---- lib/AST/Type.cpp	(revision 152265)
-+++ lib/AST/Type.cpp	(working copy)
-@@ -288,6 +288,28 @@
-   return T;
- }
- 
-+/// \brief This will check for a TypedefType by removing any existing sugar
-+/// until it reaches a TypedefType or a non-sugared type.
-+template <> const TypedefType *Type::getAs() const {
-+  const Type *Cur = this;
-+
-+  while (true) {
-+    if (const TypedefType *TDT = dyn_cast<TypedefType>(Cur))
-+      return TDT;
-+    switch (Cur->getTypeClass()) {
-+#define ABSTRACT_TYPE(Class, Parent)
-+#define TYPE(Class, Parent) \
-+    case Class: { \
-+      const Class##Type *Ty = cast<Class##Type>(Cur); \
-+      if (!Ty->isSugared()) return 0; \
-+      Cur = Ty->desugar().getTypePtr(); \
-+      break; \
-+    }
-+#include "clang/AST/TypeNodes.def"
-+    }
-+  }
-+}
-+
- /// getUnqualifiedDesugaredType - Pull any qualifiers and syntactic
- /// sugar off the given type.  This should produce an object of the
- /// same dynamic type as the canonical type.
-Index: lib/AST/RecordLayoutBuilder.cpp
-===================================================================
---- lib/AST/RecordLayoutBuilder.cpp	(revision 152265)
-+++ lib/AST/RecordLayoutBuilder.cpp	(working copy)
-@@ -2313,6 +2313,8 @@
- ASTContext::getObjCLayout(const ObjCInterfaceDecl *D,
-                           const ObjCImplementationDecl *Impl) const {
-   // Retrieve the definition
-+  if (D->hasExternalLexicalStorage() && !D->getDefinition())
-+    getExternalSource()->CompleteType(const_cast<ObjCInterfaceDecl*>(D));
-   D = D->getDefinition();
-   assert(D && D->isThisDeclarationADefinition() && "Invalid interface decl!");
- 
-Index: lib/AST/ExprConstant.cpp
-===================================================================
---- lib/AST/ExprConstant.cpp	(revision 152265)
-+++ lib/AST/ExprConstant.cpp	(working copy)
-@@ -3054,7 +3054,7 @@
-   bool VisitUnaryAddrOf(const UnaryOperator *E);
-   bool VisitObjCStringLiteral(const ObjCStringLiteral *E)
-       { return Success(E); }
--  bool VisitObjCNumericLiteral(const ObjCNumericLiteral *E)
-+  bool VisitObjCBoxedExpr(const ObjCBoxedExpr *E)
-       { return Success(E); }    
-   bool VisitAddrLabelExpr(const AddrLabelExpr *E)
-       { return Success(E); }
-@@ -4210,7 +4210,7 @@
- /// character of a string literal.
- template<typename LValue>
- static bool EvaluateBuiltinConstantPForLValue(const LValue &LV) {
--  const Expr *E = LV.getLValueBase().dyn_cast<const Expr*>();
-+  const Expr *E = LV.getLValueBase().template dyn_cast<const Expr*>();
-   return E && isa<StringLiteral>(E) && LV.getLValueOffset().isZero();
- }
- 
-@@ -6259,7 +6259,7 @@
-   case Expr::CXXDependentScopeMemberExprClass:
-   case Expr::UnresolvedMemberExprClass:
-   case Expr::ObjCStringLiteralClass:
--  case Expr::ObjCNumericLiteralClass:
-+  case Expr::ObjCBoxedExprClass:
-   case Expr::ObjCArrayLiteralClass:
-   case Expr::ObjCDictionaryLiteralClass:
-   case Expr::ObjCEncodeExprClass:
-Index: lib/AST/ItaniumMangle.cpp
-===================================================================
---- lib/AST/ItaniumMangle.cpp	(revision 152265)
-+++ lib/AST/ItaniumMangle.cpp	(working copy)
-@@ -2374,7 +2374,7 @@
-   case Expr::ObjCProtocolExprClass:
-   case Expr::ObjCSelectorExprClass:
-   case Expr::ObjCStringLiteralClass:
--  case Expr::ObjCNumericLiteralClass:
-+  case Expr::ObjCBoxedExprClass:
-   case Expr::ObjCArrayLiteralClass:
-   case Expr::ObjCDictionaryLiteralClass:
-   case Expr::ObjCSubscriptRefExprClass:
-Index: lib/AST/StmtPrinter.cpp
-===================================================================
---- lib/AST/StmtPrinter.cpp	(revision 152265)
-+++ lib/AST/StmtPrinter.cpp	(working copy)
-@@ -1679,9 +1679,9 @@
-   VisitStringLiteral(Node->getString());
- }
- 
--void StmtPrinter::VisitObjCNumericLiteral(ObjCNumericLiteral *E) {
-+void StmtPrinter::VisitObjCBoxedExpr(ObjCBoxedExpr *E) {
-   OS << "@";
--  Visit(E->getNumber());
-+  Visit(E->getSubExpr());
- }
- 
- void StmtPrinter::VisitObjCArrayLiteral(ObjCArrayLiteral *E) {
-Index: lib/AST/DeclBase.cpp
-===================================================================
---- lib/AST/DeclBase.cpp	(revision 152265)
-+++ lib/AST/DeclBase.cpp	(working copy)
-@@ -1153,14 +1153,14 @@
-   
-   // If there's no external storage, just perform a normal lookup and copy
-   // the results.
--  if (!hasExternalVisibleStorage() && !hasExternalLexicalStorage()) {
-+  if (!hasExternalVisibleStorage() && !hasExternalLexicalStorage() && Name) {
-     lookup_result LookupResults = lookup(Name);
-     Results.insert(Results.end(), LookupResults.first, LookupResults.second);
-     return;
-   }
- 
-   // If we have a lookup table, check there first. Maybe we'll get lucky.
--  if (LookupPtr) {
-+  if (LookupPtr && Name) {
-     StoredDeclsMap::iterator Pos = LookupPtr->find(Name);
-     if (Pos != LookupPtr->end()) {
-       Results.insert(Results.end(), 
-Index: lib/AST/StmtProfile.cpp
-===================================================================
---- lib/AST/StmtProfile.cpp	(revision 152265)
-+++ lib/AST/StmtProfile.cpp	(working copy)
-@@ -982,7 +982,7 @@
-   VisitExpr(S);
- }
- 
--void StmtProfiler::VisitObjCNumericLiteral(const ObjCNumericLiteral *E) {
-+void StmtProfiler::VisitObjCBoxedExpr(const ObjCBoxedExpr *E) {
-   VisitExpr(E);
- }
- 
-Index: lib/AST/Expr.cpp
-===================================================================
---- lib/AST/Expr.cpp	(revision 152265)
-+++ lib/AST/Expr.cpp	(working copy)
-@@ -2100,7 +2100,7 @@
-   case ObjCArrayLiteralClass:
-   case ObjCBoolLiteralExprClass:
-   case ObjCDictionaryLiteralClass:
--  case ObjCNumericLiteralClass:
-+  case ObjCBoxedExprClass:
-     return CT_Can;
- 
-     // Many other things have subexpressions, so we have to test those.
-Index: lib/AST/ExprClassification.cpp
-===================================================================
---- lib/AST/ExprClassification.cpp	(revision 152265)
-+++ lib/AST/ExprClassification.cpp	(working copy)
-@@ -158,7 +158,7 @@
-   case Expr::ObjCSelectorExprClass:
-   case Expr::ObjCProtocolExprClass:
-   case Expr::ObjCStringLiteralClass:
--  case Expr::ObjCNumericLiteralClass:
-+  case Expr::ObjCBoxedExprClass:
-   case Expr::ObjCArrayLiteralClass:
-   case Expr::ObjCDictionaryLiteralClass:
-   case Expr::ObjCBoolLiteralExprClass:
-Index: lib/Lex/PPMacroExpansion.cpp
-===================================================================
---- lib/Lex/PPMacroExpansion.cpp	(revision 152265)
-+++ lib/Lex/PPMacroExpansion.cpp	(working copy)
-@@ -634,6 +634,7 @@
-            .Case("objc_subscripting", LangOpts.ObjCNonFragileABI)
-            .Case("objc_array_literals", LangOpts.ObjC2)
-            .Case("objc_dictionary_literals", LangOpts.ObjC2)
-+           .Case("objc_boxed_expressions", LangOpts.ObjC2)
-            .Case("arc_cf_code_audited", true)
-            // C11 features
-            .Case("c_alignas", LangOpts.C11)
-Index: lib/StaticAnalyzer/Core/ExprEngine.cpp
-===================================================================
---- lib/StaticAnalyzer/Core/ExprEngine.cpp	(revision 152265)
-+++ lib/StaticAnalyzer/Core/ExprEngine.cpp	(working copy)
-@@ -590,7 +590,7 @@
-     case Stmt::ObjCIsaExprClass:
-     case Stmt::ObjCProtocolExprClass:
-     case Stmt::ObjCSelectorExprClass:
--    case Expr::ObjCNumericLiteralClass:
-+    case Expr::ObjCBoxedExprClass:
-     case Stmt::ParenListExprClass:
-     case Stmt::PredefinedExprClass:
-     case Stmt::ShuffleVectorExprClass:
-Index: lib/CodeGen/CGExprScalar.cpp
-===================================================================
---- lib/CodeGen/CGExprScalar.cpp	(revision 152265)
-+++ lib/CodeGen/CGExprScalar.cpp	(working copy)
-@@ -531,8 +531,8 @@
-   Value *VisitObjCStringLiteral(const ObjCStringLiteral *E) {
-     return CGF.EmitObjCStringLiteral(E);
-   }
--  Value *VisitObjCNumericLiteral(ObjCNumericLiteral *E) {
--    return CGF.EmitObjCNumericLiteral(E);
-+  Value *VisitObjCBoxedExpr(ObjCBoxedExpr *E) {
-+    return CGF.EmitObjCBoxedExpr(E);
-   }
-   Value *VisitObjCArrayLiteral(ObjCArrayLiteral *E) {
-     return CGF.EmitObjCArrayLiteral(E);
-Index: lib/CodeGen/CGObjC.cpp
-===================================================================
---- lib/CodeGen/CGObjC.cpp	(revision 152265)
-+++ lib/CodeGen/CGObjC.cpp	(working copy)
-@@ -51,35 +51,36 @@
-   return llvm::ConstantExpr::getBitCast(C, ConvertType(E->getType()));
- }
- 
--/// EmitObjCNumericLiteral - This routine generates code for
--/// the appropriate +[NSNumber numberWith<Type>:] method.
-+/// EmitObjCBoxedExpr - This routine generates code to call
-+/// the appropriate expression boxing method. This will either be
-+/// one of +[NSNumber numberWith<Type>:], or +[NSString stringWithUTF8String:].
- ///
--llvm::Value *CodeGenFunction::EmitObjCNumericLiteral(const ObjCNumericLiteral *E) {
-+llvm::Value *
-+CodeGenFunction::EmitObjCBoxedExpr(const ObjCBoxedExpr *E) {
-   // Generate the correct selector for this literal's concrete type.
--  const Expr *NL = E->getNumber();
-+  const Expr *SubExpr = E->getSubExpr();
-   // Get the method.
--  const ObjCMethodDecl *Method = E->getObjCNumericLiteralMethod();
--  assert(Method && "NSNumber method is null");
--  Selector Sel = Method->getSelector();
-+  const ObjCMethodDecl *BoxingMethod = E->getBoxingMethod();
-+  assert(BoxingMethod && "BoxingMethod is null");
-+  assert(BoxingMethod->isClassMethod() && "BoxingMethod must be a class method");
-+  Selector Sel = BoxingMethod->getSelector();
-   
-   // Generate a reference to the class pointer, which will be the receiver.
--  QualType ResultType = E->getType(); // should be NSNumber *
--  const ObjCObjectPointerType *InterfacePointerType = 
--    ResultType->getAsObjCInterfacePointerType();
--  ObjCInterfaceDecl *NSNumberDecl = 
--    InterfacePointerType->getObjectType()->getInterface();
-+  // Assumes that the method was introduced in the class that should be
-+  // messaged (avoids pulling it out of the result type).
-   CGObjCRuntime &Runtime = CGM.getObjCRuntime();
--  llvm::Value *Receiver = Runtime.GetClass(Builder, NSNumberDecl);
--
--  const ParmVarDecl *argDecl = *Method->param_begin();
-+  const ObjCInterfaceDecl *ClassDecl = BoxingMethod->getClassInterface();
-+  llvm::Value *Receiver = Runtime.GetClass(Builder, ClassDecl);
-+  
-+  const ParmVarDecl *argDecl = *BoxingMethod->param_begin();
-   QualType ArgQT = argDecl->getType().getUnqualifiedType();
--  RValue RV = EmitAnyExpr(NL);
-+  RValue RV = EmitAnyExpr(SubExpr);
-   CallArgList Args;
-   Args.add(RV, ArgQT);
--
-+  
-   RValue result = Runtime.GenerateMessageSend(*this, ReturnValueSlot(), 
--                                              ResultType, Sel, Receiver, Args, 
--                                              NSNumberDecl, Method);
-+                                              BoxingMethod->getResultType(), Sel, Receiver, Args, 
-+                                              ClassDecl, BoxingMethod);
-   return Builder.CreateBitCast(result.getScalarVal(), 
-                                ConvertType(E->getType()));
- }
-Index: lib/CodeGen/CodeGenTypes.cpp
-===================================================================
---- lib/CodeGen/CodeGenTypes.cpp	(revision 152265)
-+++ lib/CodeGen/CodeGenTypes.cpp	(working copy)
-@@ -133,6 +133,14 @@
-   // when a class is translated, even though they aren't embedded by-value into
-   // the class.
-   if (const CXXRecordDecl *CRD = dyn_cast<CXXRecordDecl>(RD)) {
-+    if (!CRD->hasDefinition() && CRD->hasExternalLexicalStorage()) {
-+      ExternalASTSource *EAS = CRD->getASTContext().getExternalSource();
-+      if (!EAS)
-+        return false;
-+      EAS->CompleteType(const_cast<CXXRecordDecl*>(CRD));
-+      if (!CRD->hasDefinition())
-+        return false;
-+    }
-     for (CXXRecordDecl::base_class_const_iterator I = CRD->bases_begin(),
-          E = CRD->bases_end(); I != E; ++I)
-       if (!isSafeToConvert(I->getType()->getAs<RecordType>()->getDecl(),
-Index: lib/CodeGen/CodeGenFunction.h
-===================================================================
---- lib/CodeGen/CodeGenFunction.h	(revision 152265)
-+++ lib/CodeGen/CodeGenFunction.h	(working copy)
-@@ -2238,7 +2238,7 @@
- 
-   llvm::Value *EmitObjCProtocolExpr(const ObjCProtocolExpr *E);
-   llvm::Value *EmitObjCStringLiteral(const ObjCStringLiteral *E);
--  llvm::Value *EmitObjCNumericLiteral(const ObjCNumericLiteral *E);
-+  llvm::Value *EmitObjCBoxedExpr(const ObjCBoxedExpr *E);
-   llvm::Value *EmitObjCArrayLiteral(const ObjCArrayLiteral *E);
-   llvm::Value *EmitObjCDictionaryLiteral(const ObjCDictionaryLiteral *E);
-   llvm::Value *EmitObjCCollectionLiteral(const Expr *E,
-Index: lib/Parse/ParseObjc.cpp
-===================================================================
---- lib/Parse/ParseObjc.cpp	(revision 152265)
-+++ lib/Parse/ParseObjc.cpp	(working copy)
-@@ -2067,6 +2067,10 @@
-     // Objective-C dictionary literal
-     return ParsePostfixExpressionSuffix(ParseObjCDictionaryLiteral(AtLoc));
-           
-+  case tok::l_paren:
-+    // Objective-C boxed expression
-+    return ParsePostfixExpressionSuffix(ParseObjCBoxedExpr(AtLoc));
-+          
-   default:
-     if (Tok.getIdentifierInfo() == 0)
-       return ExprError(Diag(AtLoc, diag::err_unexpected_at));
-@@ -2581,6 +2585,31 @@
-   return Owned(Actions.BuildObjCNumericLiteral(AtLoc, Lit.take()));
- }
- 
-+/// ParseObjCBoxedExpr -
-+/// objc-box-expression:
-+///       @( assignment-expression )
-+ExprResult
-+Parser::ParseObjCBoxedExpr(SourceLocation AtLoc) {
-+  if (Tok.isNot(tok::l_paren))
-+    return ExprError(Diag(Tok, diag::err_expected_lparen_after) << "@");
-+
-+  BalancedDelimiterTracker T(*this, tok::l_paren);
-+  T.consumeOpen();
-+  ExprResult ValueExpr(ParseAssignmentExpression());
-+  if (T.consumeClose())
-+    return ExprError();
-+
-+  if (ValueExpr.isInvalid())
-+    return ExprError();
-+  
-+  // Wrap the sub-expression in a parenthesized expression, to distinguish
-+  // a boxed expression from a literal.
-+  SourceLocation LPLoc = T.getOpenLocation(), RPLoc = T.getCloseLocation();
-+  ValueExpr = Actions.ActOnParenExpr(LPLoc, RPLoc, ValueExpr.take());
-+  return Owned(Actions.BuildObjCBoxedExpr(SourceRange(AtLoc, RPLoc),
-+                                          ValueExpr.take()));
-+}
-+
- ExprResult Parser::ParseObjCArrayLiteral(SourceLocation AtLoc) {
-   ExprVector ElementExprs(Actions);                   // array elements.
-   ConsumeBracket(); // consume the l_square.
-Index: lib/Serialization/ASTReaderStmt.cpp
-===================================================================
---- lib/Serialization/ASTReaderStmt.cpp	(revision 152265)
-+++ lib/Serialization/ASTReaderStmt.cpp	(working copy)
-@@ -823,12 +823,12 @@
-   E->setAtLoc(ReadSourceLocation(Record, Idx));
- }
- 
--void ASTStmtReader::VisitObjCNumericLiteral(ObjCNumericLiteral *E) {
-+void ASTStmtReader::VisitObjCBoxedExpr(ObjCBoxedExpr *E) {
-   VisitExpr(E);
-   // could be one of several IntegerLiteral, FloatLiteral, etc.
--  E->Number = Reader.ReadSubStmt();
--  E->ObjCNumericLiteralMethod = ReadDeclAs<ObjCMethodDecl>(Record, Idx);
--  E->AtLoc = ReadSourceLocation(Record, Idx);
-+  E->SubExpr = Reader.ReadSubStmt();
-+  E->BoxingMethod = ReadDeclAs<ObjCMethodDecl>(Record, Idx);
-+  E->Range = ReadSourceRange(Record, Idx);
- }
- 
- void ASTStmtReader::VisitObjCArrayLiteral(ObjCArrayLiteral *E) {
-@@ -1893,8 +1893,8 @@
-     case EXPR_OBJC_STRING_LITERAL:
-       S = new (Context) ObjCStringLiteral(Empty);
-       break;
--    case EXPR_OBJC_NUMERIC_LITERAL:
--      S = new (Context) ObjCNumericLiteral(Empty);
-+    case EXPR_OBJC_BOXED_EXPRESSION:
-+      S = new (Context) ObjCBoxedExpr(Empty);
-       break;
-     case EXPR_OBJC_ARRAY_LITERAL:
-       S = ObjCArrayLiteral::CreateEmpty(Context,
-Index: lib/Serialization/ASTWriter.cpp
-===================================================================
---- lib/Serialization/ASTWriter.cpp	(revision 152265)
-+++ lib/Serialization/ASTWriter.cpp	(working copy)
-@@ -696,7 +696,7 @@
-   RECORD(EXPR_BLOCK_DECL_REF);
-   RECORD(EXPR_GENERIC_SELECTION);
-   RECORD(EXPR_OBJC_STRING_LITERAL);
--  RECORD(EXPR_OBJC_NUMERIC_LITERAL);
-+  RECORD(EXPR_OBJC_BOXED_EXPRESSION);
-   RECORD(EXPR_OBJC_ARRAY_LITERAL);
-   RECORD(EXPR_OBJC_DICTIONARY_LITERAL);
-   RECORD(EXPR_OBJC_ENCODE);
-Index: lib/Serialization/ASTWriterStmt.cpp
-===================================================================
---- lib/Serialization/ASTWriterStmt.cpp	(revision 152265)
-+++ lib/Serialization/ASTWriterStmt.cpp	(working copy)
-@@ -783,12 +783,12 @@
-   Code = serialization::EXPR_OBJC_STRING_LITERAL;
- }
- 
--void ASTStmtWriter::VisitObjCNumericLiteral(ObjCNumericLiteral *E) {
-+void ASTStmtWriter::VisitObjCBoxedExpr(ObjCBoxedExpr *E) {
-   VisitExpr(E);
--  Writer.AddStmt(E->getNumber());
--  Writer.AddDeclRef(E->getObjCNumericLiteralMethod(), Record);
--  Writer.AddSourceLocation(E->getAtLoc(), Record);
--  Code = serialization::EXPR_OBJC_NUMERIC_LITERAL;
-+  Writer.AddStmt(E->getSubExpr());
-+  Writer.AddDeclRef(E->getBoxingMethod(), Record);
-+  Writer.AddSourceRange(E->getSourceRange(), Record);
-+  Code = serialization::EXPR_OBJC_BOXED_EXPRESSION;
- }
- 
- void ASTStmtWriter::VisitObjCArrayLiteral(ObjCArrayLiteral *E) {

Removed: lldb/branches/windows/scripts/clang.utfroutines.diff
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/scripts/clang.utfroutines.diff?rev=164819&view=auto
==============================================================================
--- lldb/branches/windows/scripts/clang.utfroutines.diff (original)
+++ lldb/branches/windows/scripts/clang.utfroutines.diff (removed)
@@ -1,12 +0,0 @@
-Index: include/clang/Basic/ConvertUTF.h
-===================================================================
---- include/clang/Basic/ConvertUTF.h	(revision 152265)
-+++ include/clang/Basic/ConvertUTF.h	(working copy)
-@@ -135,6 +135,7 @@
-   const UTF8** sourceStart, const UTF8* sourceEnd,
-   UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags);
- 
-+#define CLANG_NEEDS_THESE_ONE_DAY // LLDB wants these functions
- #ifdef CLANG_NEEDS_THESE_ONE_DAY
- ConversionResult ConvertUTF16toUTF8 (
-   const UTF16** sourceStart, const UTF16* sourceEnd,

Modified: lldb/branches/windows/scripts/finish-swig-wrapper-classes.sh
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/scripts/finish-swig-wrapper-classes.sh?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/scripts/finish-swig-wrapper-classes.sh (original)
+++ lldb/branches/windows/scripts/finish-swig-wrapper-classes.sh Fri Sep 28 06:07:34 2012
@@ -28,7 +28,7 @@
 PREFIX=$4
 debug_flag=$5
 
-if [ -n "$debug_flag" -a "$debug_flag" == "-debug" ]
+if [ -n "$debug_flag" -a "$debug_flag" = "-debug" ]
 then
     Debug=1
 else
@@ -48,7 +48,7 @@
 
 for curlang in $languages
 do
-    if [ $Debug == 1 ]
+    if [ $Debug -eq 1 ]
     then
         echo "Current language is $curlang"
     fi
@@ -59,7 +59,7 @@
         continue
     else
 
-        if [ $Debug == 1 ]
+        if [ $Debug -eq 1 ]
         then
             echo "Found $curlang sub-directory"
         fi
@@ -70,7 +70,7 @@
 
         if [ -f $filename ]
         then
-            if [ $Debug == 1 ]
+            if [ $Debug -eq 1 ]
             then
                 echo "Found $curlang post-processing script for LLDB"
                 echo "Executing $curlang post-processing script..."

Modified: lldb/branches/windows/scripts/lldb.swig
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/scripts/lldb.swig?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/scripts/lldb.swig (original)
+++ lldb/branches/windows/scripts/lldb.swig Fri Sep 28 06:07:34 2012
@@ -100,7 +100,7 @@
 
 /* Various liblldb typedefs that SWIG needs to know about.  */
 #define __extension__ /* Undefine GCC keyword to make Swig happy when processing glibc's stdint.h. */
-%include <stdint.h>
+%include "stdint.i"
 %include "lldb/lldb-defines.h"
 %include "lldb/lldb-enumerations.h"
 %include "lldb/lldb-forward.h"

Removed: lldb/branches/windows/scripts/llvm.amalgamated.diff
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/scripts/llvm.amalgamated.diff?rev=164819&view=auto
==============================================================================
--- lldb/branches/windows/scripts/llvm.amalgamated.diff (original)
+++ lldb/branches/windows/scripts/llvm.amalgamated.diff (removed)
@@ -1,1543 +0,0 @@
-Index: include/llvm/ADT/PointerUnion.h
-===================================================================
---- include/llvm/ADT/PointerUnion.h	(revision 152265)
-+++ include/llvm/ADT/PointerUnion.h	(working copy)
-@@ -266,7 +266,7 @@
-         ::llvm::PointerUnionTypeSelector<PT1, T, IsInnerUnion,
-           ::llvm::PointerUnionTypeSelector<PT2, T, IsInnerUnion, IsPT3 >
-                                                                    >::Return Ty;
--      return Ty(Val).is<T>();
-+      return Ty(Val).template is<T>();
-     }
-     
-     /// get<T>() - Return the value of the specified pointer type. If the
-@@ -279,7 +279,7 @@
-         ::llvm::PointerUnionTypeSelector<PT1, T, IsInnerUnion,
-           ::llvm::PointerUnionTypeSelector<PT2, T, IsInnerUnion, IsPT3 >
-                                                                    >::Return Ty;
--      return Ty(Val).get<T>();
-+      return Ty(Val).template get<T>();
-     }
-     
-     /// dyn_cast<T>() - If the current value is of the specified pointer type,
-Index: include/llvm/ADT/IntervalMap.h
-===================================================================
---- include/llvm/ADT/IntervalMap.h	(revision 152265)
-+++ include/llvm/ADT/IntervalMap.h	(working copy)
-@@ -1977,7 +1977,7 @@
-     CurSize[Nodes] = CurSize[NewNode];
-     Node[Nodes] = Node[NewNode];
-     CurSize[NewNode] = 0;
--    Node[NewNode] = this->map->newNode<NodeT>();
-+    Node[NewNode] = this->map->template newNode<NodeT>();
-     ++Nodes;
-   }
- 
-Index: utils/TableGen/X86RecognizableInstr.cpp
-===================================================================
---- utils/TableGen/X86RecognizableInstr.cpp	(revision 152265)
-+++ utils/TableGen/X86RecognizableInstr.cpp	(working copy)
-@@ -405,13 +405,13 @@
-     return FILTER_STRONG;
-     
-     
--  // Filter out artificial instructions
-+  // Filter out artificial instructions but leave in the LOCK_PREFIX so it is
-+  // printed as a separate "instruction".
-     
-   if (Name.find("_Int") != Name.npos       ||
-       Name.find("Int_") != Name.npos       ||
-       Name.find("_NOREX") != Name.npos     ||
--      Name.find("2SDL") != Name.npos       ||
--      Name == "LOCK_PREFIX")
-+      Name.find("2SDL") != Name.npos)
-     return FILTER_STRONG;
- 
-   // Filter out instructions with segment override prefixes.
-Index: lib/Target/ARM/ARMJITInfo.cpp
-===================================================================
---- lib/Target/ARM/ARMJITInfo.cpp	(revision 152265)
-+++ lib/Target/ARM/ARMJITInfo.cpp	(working copy)
-@@ -61,7 +61,7 @@
-     // concerned, so we can't just preserve the callee saved regs.
-     "stmdb sp!, {r0, r1, r2, r3, lr}\n"
- #if (defined(__VFP_FP__) && !defined(__SOFTFP__))
--    "fstmfdd sp!, {d0, d1, d2, d3, d4, d5, d6, d7}\n"
-+    "vstmdb sp!, {d0, d1, d2, d3, d4, d5, d6, d7}\n"
- #endif
-     // The LR contains the address of the stub function on entry.
-     // pass it as the argument to the C part of the callback
-@@ -85,7 +85,7 @@
-     //
- #if (defined(__VFP_FP__) && !defined(__SOFTFP__))
-     // Restore VFP caller-saved registers.
--    "fldmfdd sp!, {d0, d1, d2, d3, d4, d5, d6, d7}\n"
-+    "vldmia sp!, {d0, d1, d2, d3, d4, d5, d6, d7}\n"
- #endif
-     //
-     //      We need to exchange the values in slots 0 and 1 so we can
-Index: lib/Target/ARM/ARMInstrNEON.td
-===================================================================
---- lib/Target/ARM/ARMInstrNEON.td	(revision 152265)
-+++ lib/Target/ARM/ARMInstrNEON.td	(working copy)
-@@ -4795,12 +4795,12 @@
- 
- // Vector Swap
- def  VSWPd    : N2VX<0b11, 0b11, 0b00, 0b10, 0b00000, 0, 0,
--                     (outs DPR:$Vd, DPR:$Vd1), (ins DPR:$Vm, DPR:$Vm1),
--                     NoItinerary, "vswp", "$Vd, $Vd1", "$Vm = $Vd, $Vm1 = $Vd1",
-+                     (outs DPR:$Vd, DPR:$Vm), (ins DPR:$in1, DPR:$in2),
-+                     NoItinerary, "vswp", "$Vd, $Vm", "$in1 = $Vd, $in2 = $Vm",
-                      []>;
- def  VSWPq    : N2VX<0b11, 0b11, 0b00, 0b10, 0b00000, 1, 0,
--                     (outs QPR:$Vd, QPR:$Vd1), (ins QPR:$Vm, QPR:$Vm1),
--                     NoItinerary, "vswp", "$Vd, $Vd1", "$Vm = $Vd, $Vm1 = $Vd1",
-+                     (outs QPR:$Vd, QPR:$Vm), (ins QPR:$in1, QPR:$in2),
-+                     NoItinerary, "vswp", "$Vd, $Vm", "$in1 = $Vd, $in2 = $Vm",
-                      []>;
- 
- // Vector Move Operations.
-Index: lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp
-===================================================================
---- lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp	(revision 152265)
-+++ lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp	(working copy)
-@@ -212,12 +212,12 @@
-   } else {
-     assert(Op.isExpr() && "unknown operand kind in printOperand");
-     // If a symbolic branch target was added as a constant expression then print
--    // that address in hex.
-+    // that address in hex. And only print 32 unsigned bits for the address.
-     const MCConstantExpr *BranchTarget = dyn_cast<MCConstantExpr>(Op.getExpr());
-     int64_t Address;
-     if (BranchTarget && BranchTarget->EvaluateAsAbsolute(Address)) {
-       O << "0x";
--      O.write_hex(Address);
-+      O.write_hex((uint32_t)Address);
-     }
-     else {
-       // Otherwise, just print the expression.
-Index: lib/Target/ARM/ARMInstrThumb2.td
-===================================================================
---- lib/Target/ARM/ARMInstrThumb2.td	(revision 152265)
-+++ lib/Target/ARM/ARMInstrThumb2.td	(working copy)
-@@ -3198,6 +3198,7 @@
-   let Inst{13} = target{17};
-   let Inst{21-16} = target{16-11};
-   let Inst{10-0} = target{10-0};
-+  let DecoderMethod = "DecodeT2BInstruction";
- }
- 
- let isNotDuplicable = 1, isIndirectBranch = 1 in {
-Index: lib/Target/ARM/ARMInstrThumb.td
-===================================================================
---- lib/Target/ARM/ARMInstrThumb.td	(revision 152265)
-+++ lib/Target/ARM/ARMInstrThumb.td	(working copy)
-@@ -413,11 +413,11 @@
-                   "bl${p}\t$func",
-                   [(ARMtcall tglobaladdr:$func)]>,
-              Requires<[IsThumb, IsNotIOS]> {
--    bits<22> func;
--    let Inst{26} = func{21};
-+    bits<24> func;
-+    let Inst{26} = func{23};
-     let Inst{25-16} = func{20-11};
--    let Inst{13} = 1;
--    let Inst{11} = 1;
-+    let Inst{13} = func{22};
-+    let Inst{11} = func{21};
-     let Inst{10-0} = func{10-0};
-   }
- 
-@@ -427,10 +427,11 @@
-                    "blx${p}\t$func",
-                    [(ARMcall tglobaladdr:$func)]>,
-               Requires<[IsThumb, HasV5T, IsNotIOS]> {
--    bits<21> func;
-+    bits<24> func;
-+    let Inst{26} = func{23};
-     let Inst{25-16} = func{20-11};
--    let Inst{13} = 1;
--    let Inst{11} = 1;
-+    let Inst{13} = func{22};
-+    let Inst{11} = func{21};
-     let Inst{10-1} = func{10-1};
-     let Inst{0} = 0; // func{0} is assumed zero
-   }
-Index: lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp
-===================================================================
---- lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp	(revision 152265)
-+++ lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp	(working copy)
-@@ -397,39 +397,65 @@
-     return swapped;
-   }
-   case ARM::fixup_arm_thumb_bl: {
--    // The value doesn't encode the low bit (always zero) and is offset by
--    // four. The value is encoded into disjoint bit positions in the destination
--    // opcode. x = unchanged, I = immediate value bit, S = sign extension bit
--    //
--    //   BL:  xxxxxSIIIIIIIIII xxxxxIIIIIIIIIII
--    //
--    // Note that the halfwords are stored high first, low second; so we need
--    // to transpose the fixup value here to map properly.
--    unsigned isNeg = (int64_t(Value - 4) < 0) ? 1 : 0;
--    uint32_t Binary = 0;
--    Value = 0x3fffff & ((Value - 4) >> 1);
--    Binary  = (Value & 0x7ff) << 16;    // Low imm11 value.
--    Binary |= (Value & 0x1ffc00) >> 11; // High imm10 value.
--    Binary |= isNeg << 10;              // Sign bit.
--    return Binary;
-+     // The value doesn't encode the low bit (always zero) and is offset by
-+     // four. The 32-bit immediate value is encoded as
-+     //   imm32 = SignExtend(S:I1:I2:imm10:imm11:0)
-+     // where I1 = NOT(J1 ^ S) and I2 = NOT(J2 ^ S).
-+     // The value is encoded into disjoint bit positions in the destination
-+     // opcode. x = unchanged, I = immediate value bit, S = sign extension bit,
-+     // J = either J1 or J2 bit
-+     //
-+     //   BL:  xxxxxSIIIIIIIIII xxJxJIIIIIIIIIII
-+     //
-+     // Note that the halfwords are stored high first, low second; so we need
-+     // to transpose the fixup value here to map properly.
-+     uint32_t offset = (Value - 4) >> 1;
-+     uint32_t signBit = (offset & 0x800000) >> 23;
-+     uint32_t I1Bit = (offset & 0x400000) >> 22;
-+     uint32_t J1Bit = (I1Bit ^ 0x1) ^ signBit;
-+     uint32_t I2Bit = (offset & 0x200000) >> 21;
-+     uint32_t J2Bit = (I2Bit ^ 0x1) ^ signBit;
-+     uint32_t imm10Bits = (offset & 0x1FF800) >> 11;
-+     uint32_t imm11Bits = (offset & 0x000007FF);
-+ 
-+     uint32_t Binary = 0;
-+     uint32_t firstHalf = (((uint16_t)signBit << 10) | (uint16_t)imm10Bits);
-+     uint32_t secondHalf = (((uint16_t)J1Bit << 13) | ((uint16_t)J2Bit << 11) |
-+                           (uint16_t)imm11Bits);
-+     Binary |= secondHalf << 16;
-+     Binary |= firstHalf;
-+     return Binary;
-+
-   }
-   case ARM::fixup_arm_thumb_blx: {
--    // The value doesn't encode the low two bits (always zero) and is offset by
--    // four (see fixup_arm_thumb_cp). The value is encoded into disjoint bit
--    // positions in the destination opcode. x = unchanged, I = immediate value
--    // bit, S = sign extension bit, 0 = zero.
--    //
--    //   BLX: xxxxxSIIIIIIIIII xxxxxIIIIIIIIII0
--    //
--    // Note that the halfwords are stored high first, low second; so we need
--    // to transpose the fixup value here to map properly.
--    unsigned isNeg = (int64_t(Value-4) < 0) ? 1 : 0;
--    uint32_t Binary = 0;
--    Value = 0xfffff & ((Value - 2) >> 2);
--    Binary  = (Value & 0x3ff) << 17;    // Low imm10L value.
--    Binary |= (Value & 0xffc00) >> 10;  // High imm10H value.
--    Binary |= isNeg << 10;              // Sign bit.
--    return Binary;
-+     // The value doesn't encode the low two bits (always zero) and is offset by
-+     // four (see fixup_arm_thumb_cp). The 32-bit immediate value is encoded as
-+     //   imm32 = SignExtend(S:I1:I2:imm10H:imm10L:00)
-+     // where I1 = NOT(J1 ^ S) and I2 = NOT(J2 ^ S).
-+     // The value is encoded into disjoint bit positions in the destination 
-+     // opcode. x = unchanged, I = immediate value bit, S = sign extension bit, 
-+     // J = either J1 or J2 bit, 0 = zero.
-+     //
-+     //   BLX: xxxxxSIIIIIIIIII xxJxJIIIIIIIIII0
-+     //
-+     // Note that the halfwords are stored high first, low second; so we need
-+     // to transpose the fixup value here to map properly.
-+     uint32_t offset = (Value - 2) >> 2;
-+     uint32_t signBit = (offset & 0x400000) >> 22;
-+     uint32_t I1Bit = (offset & 0x200000) >> 21;
-+     uint32_t J1Bit = (I1Bit ^ 0x1) ^ signBit;
-+     uint32_t I2Bit = (offset & 0x100000) >> 20;
-+     uint32_t J2Bit = (I2Bit ^ 0x1) ^ signBit;
-+     uint32_t imm10HBits = (offset & 0xFFC00) >> 10;
-+     uint32_t imm10LBits = (offset & 0x3FF);
-+ 
-+     uint32_t Binary = 0;
-+     uint32_t firstHalf = (((uint16_t)signBit << 10) | (uint16_t)imm10HBits);
-+     uint32_t secondHalf = (((uint16_t)J1Bit << 13) | ((uint16_t)J2Bit << 11) | 
-+                           ((uint16_t)imm10LBits) << 1);
-+     Binary |= secondHalf << 16;
-+     Binary |= firstHalf;
-+     return Binary;
-   }
-   case ARM::fixup_arm_thumb_cp:
-     // Offset by 4, and don't encode the low two bits. Two bytes of that
-Index: lib/Target/ARM/Disassembler/ARMDisassembler.cpp
-===================================================================
---- lib/Target/ARM/Disassembler/ARMDisassembler.cpp	(revision 152265)
-+++ lib/Target/ARM/Disassembler/ARMDisassembler.cpp	(working copy)
-@@ -182,6 +182,8 @@
-                                uint64_t Address, const void *Decoder);
- static DecodeStatus DecodeAddrMode7Operand(llvm::MCInst &Inst, unsigned Val,
-                                uint64_t Address, const void *Decoder);
-+static DecodeStatus DecodeT2BInstruction(MCInst &Inst, unsigned Insn,
-+                               uint64_t Address, const void *Decoder);
- static DecodeStatus DecodeBranchImmInstruction(llvm::MCInst &Inst,unsigned Insn,
-                                uint64_t Address, const void *Decoder);
- static DecodeStatus DecodeAddrMode6Operand(llvm::MCInst &Inst, unsigned Val,
-@@ -1945,6 +1947,21 @@
- }
- 
- static DecodeStatus
-+DecodeT2BInstruction(MCInst &Inst, unsigned Insn,
-+                     uint64_t Address, const void *Decoder) {
-+  DecodeStatus S = MCDisassembler::Success;
-+  unsigned imm = (fieldFromInstruction32(Insn, 0, 11) << 0) |
-+                 (fieldFromInstruction32(Insn, 11, 1) << 18) |
-+                 (fieldFromInstruction32(Insn, 13, 1) << 17) |
-+                 (fieldFromInstruction32(Insn, 16, 6) << 11) |
-+                 (fieldFromInstruction32(Insn, 26, 1) << 19);
-+  if (!tryAddingSymbolicOperand(Address, Address + SignExtend32<20>(imm<<1) + 4,
-+                                true, 4, Inst, Decoder))
-+    Inst.addOperand(MCOperand::CreateImm(SignExtend32<20>(imm << 1)));
-+  return S;
-+}
-+
-+static DecodeStatus
- DecodeBranchImmInstruction(llvm::MCInst &Inst, unsigned Insn,
-                            uint64_t Address, const void *Decoder) {
-   DecodeStatus S = MCDisassembler::Success;
-@@ -2177,6 +2194,8 @@
-     case ARM::VLD2b8wb_register:
-     case ARM::VLD2b16wb_register:
-     case ARM::VLD2b32wb_register:
-+      Inst.addOperand(MCOperand::CreateImm(0));
-+      break;
-     case ARM::VLD3d8_UPD:
-     case ARM::VLD3d16_UPD:
-     case ARM::VLD3d32_UPD:
-@@ -2245,6 +2264,16 @@
-         !Check(S, DecodeGPRRegisterClass(Inst, Rm, Address, Decoder)))
-       return MCDisassembler::Fail;
-     break;
-+  case ARM::VLD2d8wb_fixed:
-+  case ARM::VLD2d16wb_fixed:
-+  case ARM::VLD2d32wb_fixed:
-+  case ARM::VLD2b8wb_fixed:
-+  case ARM::VLD2b16wb_fixed:
-+  case ARM::VLD2b32wb_fixed:
-+  case ARM::VLD2q8wb_fixed:
-+  case ARM::VLD2q16wb_fixed:
-+  case ARM::VLD2q32wb_fixed:
-+    break;
-   }
- 
-   return S;
-@@ -2313,6 +2342,10 @@
-     case ARM::VST2b8wb_register:
-     case ARM::VST2b16wb_register:
-     case ARM::VST2b32wb_register:
-+      if (Rm == 0xF)
-+        return MCDisassembler::Fail;
-+      Inst.addOperand(MCOperand::CreateImm(0));
-+      break;
-     case ARM::VST3d8_UPD:
-     case ARM::VST3d16_UPD:
-     case ARM::VST3d32_UPD:
-@@ -2354,6 +2387,23 @@
-     case ARM::VST1q16wb_fixed:
-     case ARM::VST1q32wb_fixed:
-     case ARM::VST1q64wb_fixed:
-+    case ARM::VST1d8Twb_fixed:
-+    case ARM::VST1d16Twb_fixed:
-+    case ARM::VST1d32Twb_fixed:
-+    case ARM::VST1d64Twb_fixed:
-+    case ARM::VST1d8Qwb_fixed:
-+    case ARM::VST1d16Qwb_fixed:
-+    case ARM::VST1d32Qwb_fixed:
-+    case ARM::VST1d64Qwb_fixed:
-+    case ARM::VST2d8wb_fixed:
-+    case ARM::VST2d16wb_fixed:
-+    case ARM::VST2d32wb_fixed:
-+    case ARM::VST2q8wb_fixed:
-+    case ARM::VST2q16wb_fixed:
-+    case ARM::VST2q32wb_fixed:
-+    case ARM::VST2b8wb_fixed:
-+    case ARM::VST2b16wb_fixed:
-+    case ARM::VST2b32wb_fixed:
-       break;
-   }
- 
-@@ -2555,7 +2605,6 @@
-   unsigned Rm = fieldFromInstruction32(Insn, 0, 4);
-   unsigned align = fieldFromInstruction32(Insn, 4, 1);
-   unsigned size = 1 << fieldFromInstruction32(Insn, 6, 2);
--  unsigned pred = fieldFromInstruction32(Insn, 22, 4);
-   align *= 2*size;
- 
-   switch (Inst.getOpcode()) {
-@@ -2586,16 +2635,11 @@
-     return MCDisassembler::Fail;
-   Inst.addOperand(MCOperand::CreateImm(align));
- 
--  if (Rm == 0xD)
--    Inst.addOperand(MCOperand::CreateReg(0));
--  else if (Rm != 0xF) {
-+  if (Rm != 0xD && Rm != 0xF) {
-     if (!Check(S, DecodeGPRRegisterClass(Inst, Rm, Address, Decoder)))
-       return MCDisassembler::Fail;
-   }
- 
--  if (!Check(S, DecodePredicateOperand(Inst, pred, Address, Decoder)))
--    return MCDisassembler::Fail;
--
-   return S;
- }
- 
-@@ -2837,19 +2881,25 @@
- 
- static DecodeStatus DecodeThumbBROperand(llvm::MCInst &Inst, unsigned Val,
-                                  uint64_t Address, const void *Decoder) {
--  Inst.addOperand(MCOperand::CreateImm(SignExtend32<12>(Val << 1)));
-+   if (!tryAddingSymbolicOperand(Address, Address + SignExtend32<12>(Val<<1) + 4,
-+                                 true, 2, Inst, Decoder))
-+     Inst.addOperand(MCOperand::CreateImm(SignExtend32<12>(Val << 1)));
-   return MCDisassembler::Success;
- }
- 
- static DecodeStatus DecodeT2BROperand(llvm::MCInst &Inst, unsigned Val,
-                                  uint64_t Address, const void *Decoder) {
--  Inst.addOperand(MCOperand::CreateImm(SignExtend32<21>(Val)));
-+   if (!tryAddingSymbolicOperand(Address, Address + SignExtend32<21>(Val) + 4,
-+                                 true, 4, Inst, Decoder))
-+     Inst.addOperand(MCOperand::CreateImm(SignExtend32<21>(Val)));
-   return MCDisassembler::Success;
- }
- 
- static DecodeStatus DecodeThumbCmpBROperand(llvm::MCInst &Inst, unsigned Val,
-                                  uint64_t Address, const void *Decoder) {
--  Inst.addOperand(MCOperand::CreateImm(SignExtend32<7>(Val << 1)));
-+   if (!tryAddingSymbolicOperand(Address, Address + SignExtend32<7>(Val<<1) + 4,
-+                                 true, 2, Inst, Decoder))
-+     Inst.addOperand(MCOperand::CreateImm(SignExtend32<7>(Val << 1)));
-   return MCDisassembler::Success;
- }
- 
-@@ -3162,10 +3212,25 @@
- 
- static DecodeStatus DecodeThumbBLXOffset(llvm::MCInst &Inst, unsigned Val,
-                                  uint64_t Address, const void *Decoder) {
-+  // Val is passed in as S:J1:J2:imm10H:imm10L:’0’
-+  // Note only one trailing zero not two.  Also the J1 and J2 values are from
-+  // the encoded instruction.  So here change to I1 and I2 values via:
-+  // I1 = NOT(J1 EOR S);
-+  // I2 = NOT(J2 EOR S);
-+  // and build the imm32 with two trailing zeros as documented:
-+  // imm32 = SignExtend(S:I1:I2:imm10H:imm10L:’00’, 32);
-+  unsigned S = (Val >> 23) & 1;
-+  unsigned J1 = (Val >> 22) & 1;
-+  unsigned J2 = (Val >> 21) & 1;
-+  unsigned I1 = !(J1 ^ S);
-+  unsigned I2 = !(J2 ^ S);
-+  unsigned tmp = (Val & ~0x600000) | (I1 << 22) | (I2 << 21);
-+  int imm32 = SignExtend32<25>(tmp << 1);
-+
-   if (!tryAddingSymbolicOperand(Address,
--                                (Address & ~2u) + SignExtend32<22>(Val << 1) + 4,
-+                                (Address & ~2u) + imm32 + 4,
-                                 true, 4, Inst, Decoder))
--    Inst.addOperand(MCOperand::CreateImm(SignExtend32<22>(Val << 1)));
-+    Inst.addOperand(MCOperand::CreateImm(imm32));
-   return MCDisassembler::Success;
- }
- 
-@@ -3271,15 +3336,32 @@
- static DecodeStatus
- DecodeThumbBCCTargetOperand(llvm::MCInst &Inst, unsigned Val,
-                             uint64_t Address, const void *Decoder){
--  Inst.addOperand(MCOperand::CreateImm(Val << 1));
-+  if (!tryAddingSymbolicOperand(Address, Address + SignExtend32<8>(Val<<1) + 4,
-+                                true, 2, Inst, Decoder))
-+    Inst.addOperand(MCOperand::CreateImm(SignExtend32<8>(Val << 1)));
-   return MCDisassembler::Success;
- }
- 
- static DecodeStatus DecodeThumbBLTargetOperand(llvm::MCInst &Inst, unsigned Val,
-                                        uint64_t Address, const void *Decoder){
--  if (!tryAddingSymbolicOperand(Address, Address + SignExtend32<22>(Val<<1) + 4,
-+  // Val is passed in as S:J1:J2:imm10:imm11
-+  // Note no trailing zero after imm11.  Also the J1 and J2 values are from
-+  // the encoded instruction.  So here change to I1 and I2 values via:
-+  // I1 = NOT(J1 EOR S);
-+  // I2 = NOT(J2 EOR S);
-+  // and build the imm32 with one trailing zero as documented:
-+  // imm32 = SignExtend(S:I1:I2:imm10:imm11:’0’, 32);
-+  unsigned S = (Val >> 23) & 1;
-+  unsigned J1 = (Val >> 22) & 1;
-+  unsigned J2 = (Val >> 21) & 1;
-+  unsigned I1 = !(J1 ^ S);
-+  unsigned I2 = !(J2 ^ S);
-+  unsigned tmp = (Val & ~0x600000) | (I1 << 22) | (I2 << 21);
-+  int imm32 = SignExtend32<25>(tmp << 1);
-+
-+  if (!tryAddingSymbolicOperand(Address, Address + imm32 + 4,
-                                 true, 4, Inst, Decoder))
--    Inst.addOperand(MCOperand::CreateImm(SignExtend32<22>(Val << 1)));
-+    Inst.addOperand(MCOperand::CreateImm(imm32));
-   return MCDisassembler::Success;
- }
- 
-Index: lib/Target/X86/Disassembler/X86Disassembler.cpp
-===================================================================
---- lib/Target/X86/Disassembler/X86Disassembler.cpp	(revision 152265)
-+++ lib/Target/X86/Disassembler/X86Disassembler.cpp	(working copy)
-@@ -322,7 +322,12 @@
- 
-   OperandType type = (OperandType)operand.type;
- 
-+  bool isBranch = false;
-+  uint64_t pcrel = 0;
-   if (type == TYPE_RELv) {
-+    isBranch = true;
-+    pcrel = insn.startLocation +
-+            insn.immediateOffset + insn.immediateSize;
-     switch (insn.displacementSize) {
-     default:
-       break;
-@@ -373,8 +378,6 @@
-     }
-   }
- 
--  bool isBranch = false;
--  uint64_t pcrel = 0;
-   switch (type) {
-   case TYPE_XMM128:
-     mcInst.addOperand(MCOperand::CreateReg(X86::XMM0 + (immediate >> 4)));
-Index: lib/Target/X86/Disassembler/X86DisassemblerDecoder.c
-===================================================================
---- lib/Target/X86/Disassembler/X86DisassemblerDecoder.c	(revision 152265)
-+++ lib/Target/X86/Disassembler/X86DisassemblerDecoder.c	(working copy)
-@@ -312,6 +312,13 @@
-     
-     if (consumeByte(insn, &byte))
-       return -1;
-+
-+    // If the the first byte is a LOCK prefix break and let it be disassembled
-+    // as a lock "instruction", by creating an <MCInst #xxxx LOCK_PREFIX>.
-+    // FIXME there is currently no way to get the disassembler to print the
-+    // lock prefix if it is not the first byte.
-+    if (insn->readerCursor - 1 == insn->startLocation && byte == 0xf0)
-+      break;
-     
-     switch (byte) {
-     case 0xf0:  /* LOCK */
-Index: lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp
-===================================================================
---- lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp	(revision 152265)
-+++ lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp	(working copy)
-@@ -24,7 +24,8 @@
- bool RuntimeDyldMachO::
- resolveRelocation(uint8_t *LocalAddress,
-                   uint64_t FinalAddress,
--                  uint64_t Value,
-+                  uint64_t FinalSource1,
-+                  uint64_t FinalSource2,
-                   bool isPCRel,
-                   unsigned Type,
-                   unsigned Size,
-@@ -32,10 +33,20 @@
-   // This just dispatches to the proper target specific routine.
-   switch (CPUType) {
-   default: llvm_unreachable("Unsupported CPU type!");
-+  case mach::CTM_i386:
-+    return resolveI386Relocation(LocalAddress,
-+                                 FinalAddress,
-+                                 FinalSource1,
-+                                 FinalSource2,
-+                                 isPCRel,
-+                                 Type,
-+                                 Size,
-+                                 Addend);
-   case mach::CTM_x86_64:
-     return resolveX86_64Relocation(LocalAddress,
-                                    FinalAddress,
--                                   (uintptr_t)Value,
-+                                   FinalSource1,
-+                                   FinalSource2,
-                                    isPCRel,
-                                    Type,
-                                    Size,
-@@ -43,7 +54,8 @@
-   case mach::CTM_ARM:
-     return resolveARMRelocation(LocalAddress,
-                                 FinalAddress,
--                                (uintptr_t)Value,
-+                                FinalSource1,
-+                                FinalSource2,
-                                 isPCRel,
-                                 Type,
-                                 Size,
-@@ -52,19 +64,52 @@
- }
- 
- bool RuntimeDyldMachO::
-+resolveI386Relocation(uint8_t *LocalAddress,
-+                      uint64_t FinalAddress,
-+                      uint64_t FinalSource1,
-+                      uint64_t FinalSource2,
-+                      bool isPCRel,
-+                      unsigned Type,
-+                      unsigned Size,
-+                      int64_t Addend) {
-+  int64_t ValueToWrite = Addend;
-+
-+  switch (Type) {
-+  default:
-+    llvm_unreachable("Invalid relocation type!");
-+  case macho::RIT_Vanilla:
-+    ValueToWrite += FinalSource1;
-+    break;
-+  case macho::RIT_Difference:
-+  case macho::RIT_Generic_LocalDifference:
-+  case macho::RIT_Generic_PreboundLazyPointer:
-+    ValueToWrite += FinalSource1;
-+    ValueToWrite -= FinalSource2;
-+    break;
-+  }
-+
-+  if (isPCRel)
-+    ValueToWrite -= FinalAddress + 4; // see resolveX86_64Relocation
-+
-+  uint8_t *p = LocalAddress;
-+  for (unsigned i = 0; i < Size; ++i) {
-+    *p++ = (uint8_t)(ValueToWrite & 0xff);
-+    ValueToWrite >>= 8;
-+  }
-+
-+  return false;
-+}
-+
-+bool RuntimeDyldMachO::
- resolveX86_64Relocation(uint8_t *LocalAddress,
-                         uint64_t FinalAddress,
--                        uint64_t Value,
-+                        uint64_t FinalSource1,
-+                        uint64_t FinalSource2,
-                         bool isPCRel,
-                         unsigned Type,
-                         unsigned Size,
-                         int64_t Addend) {
--  // If the relocation is PC-relative, the value to be encoded is the
--  // pointer difference.
--  if (isPCRel)
--    // FIXME: It seems this value needs to be adjusted by 4 for an effective PC
--    // address. Is that expected? Only for branches, perhaps?
--    Value -= FinalAddress + 4;
-+  int64_t ValueToWrite = Addend;
- 
-   switch(Type) {
-   default:
-@@ -74,41 +119,53 @@
-   case macho::RIT_X86_64_Signed4:
-   case macho::RIT_X86_64_Signed:
-   case macho::RIT_X86_64_Unsigned:
--  case macho::RIT_X86_64_Branch: {
--    Value += Addend;
--    // Mask in the target value a byte at a time (we don't have an alignment
--    // guarantee for the target address, so this is safest).
--    uint8_t *p = (uint8_t*)LocalAddress;
--    for (unsigned i = 0; i < Size; ++i) {
--      *p++ = (uint8_t)Value;
--      Value >>= 8;
--    }
--    return false;
--  }
-+  case macho::RIT_X86_64_Branch:
-+    ValueToWrite += FinalSource1;
-+    break;
-   case macho::RIT_X86_64_GOTLoad:
-   case macho::RIT_X86_64_GOT:
-   case macho::RIT_X86_64_Subtractor:
-   case macho::RIT_X86_64_TLV:
-     return Error("Relocation type not implemented yet!");
-   }
-+
-+  // If the relocation is PC-relative, the value to be encoded is the
-+  // pointer difference.
-+  if (isPCRel)
-+    // FIXME: It seems this value needs to be adjusted by 4 for an effective PC
-+    // address. Is that expected? Only for branches, perhaps?
-+    ValueToWrite -= FinalAddress + 4;
-+
-+  // Mask in the target value a byte at a time (we don't have an alignment
-+  // guarantee for the target address, so this is safest).
-+  uint8_t *p = (uint8_t*)LocalAddress;
-+  for (unsigned i = 0; i < Size; ++i) {
-+    *p++ = (uint8_t)(ValueToWrite & 0xff);
-+    ValueToWrite >>= 8;
-+  }
-+
-+  return false;
- }
- 
- bool RuntimeDyldMachO::
- resolveARMRelocation(uint8_t *LocalAddress,
-                      uint64_t FinalAddress,
--                     uint64_t Value,
-+                     uint64_t FinalSource1,
-+                     uint64_t FinalSource2,
-                      bool isPCRel,
-                      unsigned Type,
-                      unsigned Size,
-                      int64_t Addend) {
-+  int64_t ValueToWrite = Addend;
-+
-   // If the relocation is PC-relative, the value to be encoded is the
-   // pointer difference.
-   if (isPCRel) {
--    Value -= FinalAddress;
-+    ValueToWrite -= FinalAddress;
-     // ARM PCRel relocations have an effective-PC offset of two instructions
-     // (four bytes in Thumb mode, 8 bytes in ARM mode).
-     // FIXME: For now, assume ARM mode.
--    Value -= 8;
-+    ValueToWrite -= 8;
-   }
- 
-   switch(Type) {
-@@ -119,8 +176,8 @@
-     // guarantee for the target address, so this is safest).
-     uint8_t *p = (uint8_t*)LocalAddress;
-     for (unsigned i = 0; i < Size; ++i) {
--      *p++ = (uint8_t)Value;
--      Value >>= 8;
-+      *p++ = (uint8_t)(ValueToWrite & 0xff);
-+      ValueToWrite >>= 8;
-     }
-     break;
-   }
-@@ -129,15 +186,15 @@
-     // 32-bit aligned, so we can do it all at once.
-     uint32_t *p = (uint32_t*)LocalAddress;
-     // The low two bits of the value are not encoded.
--    Value >>= 2;
-+    ValueToWrite >>= 2;
-     // Mask the value to 24 bits.
--    Value &= 0xffffff;
-+    ValueToWrite &= 0xffffff;
-     // FIXME: If the destination is a Thumb function (and the instruction
-     // is a non-predicated BL instruction), we need to change it to a BLX
-     // instruction instead.
- 
-     // Insert the value into the instruction.
--    *p = (*p & ~0xffffff) | Value;
-+    *p = (*p & ~0xffffff) | ValueToWrite;
-     break;
-   }
-   case macho::RIT_ARM_ThumbBranch22Bit:
-@@ -153,6 +210,29 @@
-   return false;
- }
- 
-+static bool
-+ResolveSectionAndOffset(const MachOObject *Obj,
-+                        SmallVectorImpl<unsigned> &SectionMap,
-+                        const MachOObject::LoadCommandInfo *SegmentLCI,
-+                        InMemoryStruct<macho::SegmentLoadCommand> &SegmentLC,
-+                        uint64_t Address,
-+                        unsigned &SectionID,
-+                        uint64_t &Offset)
-+{
-+  for (unsigned SI = 0, SE = SegmentLC->NumSections; SI < SE; ++SI) {
-+    InMemoryStruct<macho::Section> CandidateSection;
-+    Obj->ReadSection(*SegmentLCI, SI, CandidateSection);
-+    if (Address >= CandidateSection->Address &&
-+        Address < CandidateSection->Address + CandidateSection->Size) {
-+      SectionID = SectionMap[SI];
-+      Offset = Address - CandidateSection->Address;
-+      return true;
-+    }
-+  }
-+
-+  return false;
-+}
-+
- bool RuntimeDyldMachO::
- loadSegment32(const MachOObject *Obj,
-               const MachOObject::LoadCommandInfo *SegmentLCI,
-@@ -210,6 +290,7 @@
- 
-   // Process the relocations for each section we're loading.
-   Relocations.grow(Relocations.size() + SegmentLC->NumSections);
-+  RelocationSources.grow(RelocationSources.size() + SegmentLC->NumSections);
-   for (unsigned SectNum = 0; SectNum != SegmentLC->NumSections; ++SectNum) {
-     InMemoryStruct<macho::Section> Sect;
-     Obj->ReadSection(*SegmentLCI, SectNum, Sect);
-@@ -218,51 +299,135 @@
-     for (unsigned j = 0; j != Sect->NumRelocationTableEntries; ++j) {
-       InMemoryStruct<macho::RelocationEntry> RE;
-       Obj->ReadRelocationEntry(Sect->RelocationTableOffset, j, RE);
--      if (RE->Word0 & macho::RF_Scattered)
--        return Error("NOT YET IMPLEMENTED: scattered relocations.");
--      // Word0 of the relocation is the offset into the section where the
--      // relocation should be applied. We need to translate that into an
--      // offset into a function since that's our atom.
--      uint32_t Offset = RE->Word0;
--      bool isExtern = (RE->Word1 >> 27) & 1;
--
--      // FIXME: Get the relocation addend from the target address.
--      // FIXME: VERY imporant for internal relocations.
--
--      // Figure out the source symbol of the relocation. If isExtern is true,
--      // this relocation references the symbol table, otherwise it references
--      // a section in the same object, numbered from 1 through NumSections
--      // (SectionBases is [0, NumSections-1]).
--      uint32_t SourceNum = RE->Word1 & 0xffffff; // 24-bit value
--      if (!isExtern) {
--        assert(SourceNum > 0 && "Invalid relocation section number!");
--        unsigned SectionID = SectionMap[SourceNum - 1];
-+      if (RE->Word0 & macho::RF_Scattered) {
-+        // The lower 24 bits of Word0 of the scattered relocation is the offset
-+        // into the section where the relocation should be applied, i.e., the
-+        // current section.
-+        uint32_t OffsetInTarget = RE->Word0 & 0x00ffffff;
-         unsigned TargetID = SectionMap[SectNum];
--        DEBUG(dbgs() << "Internal relocation at Section #"
--                     << TargetID << " + " << Offset
--                     << " from Section #"
--                     << SectionID << " (Word1: "
--                     << format("0x%x", RE->Word1) << ")\n");
--
--        // Store the relocation information. It will get resolved when
--        // the section addresses are assigned.
--        Relocations[SectionID].push_back(RelocationEntry(TargetID,
--                                                         Offset,
--                                                         RE->Word1,
--                                                         0 /*Addend*/));
-+        // Word1 of the scattered relocation is a file offset which needs to
-+        // be resolved into Section+Offset form.  This gives the address of the
-+        // source.
-+        unsigned Source1ID;
-+        uint64_t Source1Offset;
-+        if (!ResolveSectionAndOffset(Obj,
-+                                     SectionMap,
-+                                     SegmentLCI,
-+                                     SegmentLC,
-+                                     RE->Word1,
-+                                     Source1ID,
-+                                     Source1Offset))
-+          return Error("couldn't find scattered relocation value in sections");
-+        // This relocation may have a paired relocation entry. If it does, set
-+        // the source/offset information for it correctly.
-+        unsigned Source2ID = SectionOffset::NoSectionID;
-+        uint64_t Source2Offset = 0;
-+        if (j + 1 < Sect->NumRelocationTableEntries) {
-+          InMemoryStruct<macho::RelocationEntry> PairRE;
-+          Obj->ReadRelocationEntry(Sect->RelocationTableOffset, j+1, PairRE);
-+          if ((PairRE->Word0 & macho::RF_Scattered) &&
-+              ((PairRE->Word0 & 0x0f000000) >> 24) == macho::RIT_Pair) {
-+            if (!ResolveSectionAndOffset(Obj,
-+                                         SectionMap,
-+                                         SegmentLCI,
-+                                         SegmentLC,
-+                                         PairRE->Word1,
-+                                         Source2ID,
-+                                         Source2Offset))
-+              return Error("couldn't find scattered relocation value in sections");
-+            ++j;
-+          }
-+        }
-+        if (Source2ID == SectionOffset::NoSectionID)
-+          DEBUG(dbgs() << "Scattered relocation at Section #"
-+                       << TargetID << " + " << OffsetInTarget
-+                       << " from Section #" << Source1ID
-+                       << "+" << Source1Offset
-+                       << " (Word0: "
-+                       << format("0x%x", RE->Word0) << ")\n");
-+        else
-+          DEBUG(dbgs() << "Scattered relocation at Section #"
-+                       << TargetID << " + " << OffsetInTarget
-+                       << " from Section #" << Source1ID
-+                       << "+" << Source1Offset
-+                       << " and Section #" << Source2ID
-+                       << "+" << Source2Offset
-+                       << " (Word0: "
-+                       << format("0x%x", RE->Word0) << ")\n");
-+        uint32_t RelocationIndex = Relocations[TargetID].size();
-+        // FIXME: Get the relocation addend from the target address.
-+        // FIXME: VERY imporant for internal relocations.
-+        RelocationEntry TranslatedRE(OffsetInTarget,
-+                                     Source1ID,
-+                                     Source1Offset,
-+                                     Source2ID,
-+                                     Source2Offset,
-+                                     RE->Word1,
-+                                     0 /*Addend*/);
-+        Relocations[TargetID].push_back(TranslatedRE);
-+        RelocationSources[Source1ID].push_back(RelocationSource(TargetID,
-+                                                                RelocationIndex,
-+                                                                0));
-+        if (Source2ID != SectionOffset::NoSectionID)
-+          RelocationSources[Source2ID].push_back(RelocationSource(TargetID,
-+                                                                  RelocationIndex,
-+                                                                  1));
-       } else {
--        StringRef SourceName = SymbolNames[SourceNum];
--
--        // Now store the relocation information. Associate it with the source
--        // symbol. Just add it to the unresolved list and let the general
--        // path post-load resolve it if we know where the symbol is.
--        UnresolvedRelocations[SourceName].push_back(RelocationEntry(SectNum,
--                                                                    Offset,
--                                                                    RE->Word1,
--                                                                 0 /*Addend*/));
--        DEBUG(dbgs() << "Relocation at Section #" << SectNum << " + " << Offset
--              << " from '" << SourceName << "(Word1: "
--              << format("0x%x", RE->Word1) << ")\n");
-+        // Word0 of the relocation is the offset into the section where the
-+        // relocation should be applied, i.e., the current section. We need
-+        // to translate that into an offset into a function since that's our atom.
-+        uint32_t OffsetInTarget = RE->Word0;
-+        bool isExtern = (RE->Word1 >> 27) & 1;
-+  
-+        // FIXME: Get the relocation addend from the target address.
-+        // FIXME: VERY imporant for internal relocations.
-+  
-+        // Figure out the source symbol of the relocation. If isExtern is true,
-+        // this relocation references the symbol table, otherwise it references
-+        // a section in the same object, numbered from 1 through NumSections
-+        // (SectionBases is [0, NumSections-1]).
-+        uint32_t SourceNum_OneBased = RE->Word1 & 0xffffff; // 24-bit value
-+        if (!isExtern) {
-+          assert(SourceNum_OneBased > 0 && "Invalid relocation section number!");
-+          unsigned SourceID = SectionMap[SourceNum_OneBased - 1];
-+          unsigned TargetID = SectionMap[SectNum];
-+          DEBUG(dbgs() << "Internal relocation at Section #"
-+                       << TargetID << " + " << OffsetInTarget
-+                       << " from Section #"
-+                       << SourceID << " (Word1: "
-+                       << format("0x%x", RE->Word1) << ")\n");
-+  
-+          // Store the relocation information. It will get resolved when
-+          // the section addresses are assigned.
-+          uint32_t RelocationIndex = Relocations[TargetID].size();
-+          Relocations[TargetID].push_back(RelocationEntry(OffsetInTarget,
-+                                                          SourceID,
-+                                                          SectionOffset::NoSectionID,
-+                                                          RE->Word1,
-+                                                          0 /*Addend*/));
-+          RelocationSources[SourceID].push_back(RelocationSource(TargetID,
-+                                                                 RelocationIndex,
-+                                                                 0));
-+        } else {
-+          StringRef SourceName = SymbolNames[SourceNum_OneBased];
-+  
-+          // Now store the relocation information. Associate it with the source
-+          // symbol. Just add it to the unresolved list and let the general
-+          // path post-load resolve it if we know where the symbol is.
-+          unsigned TargetID = SectionMap[SectNum];
-+          uint32_t RelocationIndex = Relocations[TargetID].size();
-+          Relocations[TargetID].push_back(RelocationEntry(OffsetInTarget,
-+                                                          SectionOffset::UnresolvedSourceID,
-+                                                          SectionOffset::NoSectionID,
-+                                                          RE->Word1,
-+                                                          0 /*Addend*/));
-+          UnresolvedRelocations[SourceName].push_back(RelocationSource(TargetID,
-+                                                                       RelocationIndex,
-+                                                                       0));
-+          DEBUG(dbgs() << "Relocation at Section #" << SectNum << " + " << OffsetInTarget
-+                << " from '" << SourceName << "' (Word1: "
-+                << format("0x%x", RE->Word1) << ")\n");
-+        }
-       }
-     }
-   }
-@@ -332,6 +497,7 @@
- 
-   // Process the relocations for each section we're loading.
-   Relocations.grow(Relocations.size() + Segment64LC->NumSections);
-+  RelocationSources.grow(RelocationSources.size() + Segment64LC->NumSections);
-   for (unsigned SectNum = 0; SectNum != Segment64LC->NumSections; ++SectNum) {
-     InMemoryStruct<macho::Section64> Sect;
-     Obj->ReadSection64(*SegmentLCI, SectNum, Sect);
-@@ -341,11 +507,11 @@
-       InMemoryStruct<macho::RelocationEntry> RE;
-       Obj->ReadRelocationEntry(Sect->RelocationTableOffset, j, RE);
-       if (RE->Word0 & macho::RF_Scattered)
--        return Error("NOT YET IMPLEMENTED: scattered relocations.");
-+        return Error("scattered relocations don't exist on 64-bit platforms");
-       // Word0 of the relocation is the offset into the section where the
-       // relocation should be applied. We need to translate that into an
-       // offset into a function since that's our atom.
--      uint32_t Offset = RE->Word0;
-+      uint32_t OffsetInTarget = RE->Word0;
-       bool isExtern = (RE->Word1 >> 27) & 1;
- 
-       // FIXME: Get the relocation addend from the target address.
-@@ -355,34 +521,45 @@
-       // this relocation references the symbol table, otherwise it references
-       // a section in the same object, numbered from 1 through NumSections
-       // (SectionBases is [0, NumSections-1]).
--      uint32_t SourceNum = RE->Word1 & 0xffffff; // 24-bit value
-+      uint32_t SourceNum_OneBased = RE->Word1 & 0xffffff; // 24-bit value
-       if (!isExtern) {
--        assert(SourceNum > 0 && "Invalid relocation section number!");
--        unsigned SectionID = SectionMap[SourceNum - 1];
-+        assert(SourceNum_OneBased > 0 && "Invalid relocation section number!");
-+        unsigned SourceID = SectionMap[SourceNum_OneBased - 1];
-         unsigned TargetID = SectionMap[SectNum];
-         DEBUG(dbgs() << "Internal relocation at Section #"
--                     << TargetID << " + " << Offset
-+                     << TargetID << " + " << OffsetInTarget
-                      << " from Section #"
--                     << SectionID << " (Word1: "
-+                     << SourceID << " (Word1: "
-                      << format("0x%x", RE->Word1) << ")\n");
- 
-         // Store the relocation information. It will get resolved when
-         // the section addresses are assigned.
--        Relocations[SectionID].push_back(RelocationEntry(TargetID,
--                                                         Offset,
--                                                         RE->Word1,
--                                                         0 /*Addend*/));
-+        uint32_t RelocationIndex = Relocations[TargetID].size();
-+        Relocations[TargetID].push_back(RelocationEntry(OffsetInTarget,
-+                                                        SourceID,
-+                                                        SectionOffset::NoSectionID,
-+                                                        RE->Word1,
-+                                                        0 /*Addend*/));
-+        RelocationSources[SourceID].push_back(RelocationSource(TargetID,
-+                                                               RelocationIndex,
-+                                                               0));
-       } else {
--        StringRef SourceName = SymbolNames[SourceNum];
-+        StringRef SourceName = SymbolNames[SourceNum_OneBased];
- 
-         // Now store the relocation information. Associate it with the source
-         // symbol. Just add it to the unresolved list and let the general
-         // path post-load resolve it if we know where the symbol is.
--        UnresolvedRelocations[SourceName].push_back(RelocationEntry(SectNum,
--                                                                    Offset,
--                                                                    RE->Word1,
--                                                                 0 /*Addend*/));
--        DEBUG(dbgs() << "Relocation at Section #" << SectNum << " + " << Offset
-+        unsigned TargetID = SectionMap[SectNum];
-+        uint32_t RelocationIndex = Relocations[TargetID].size();
-+        Relocations[TargetID].push_back(RelocationEntry(OffsetInTarget,
-+                                                        SectionOffset::UnresolvedSourceID,
-+                                                        SectionOffset::NoSectionID,
-+                                                        RE->Word1,
-+                                                        0 /*Addend*/));
-+        UnresolvedRelocations[SourceName].push_back(RelocationSource(TargetID,
-+                                                                     RelocationIndex,
-+                                                                     0));
-+        DEBUG(dbgs() << "Relocation at Section #" << SectNum << " + " << OffsetInTarget
-               << " from '" << SourceName << "(Word1: "
-               << format("0x%x", RE->Word1) << ")\n");
-       }
-@@ -468,18 +645,22 @@
-   if (Loc == SymbolTable.end())
-     return;
- 
--  RelocationList &Relocs = UnresolvedRelocations[Name];
-+  RelocationSourceList &SourcesForSymbol = UnresolvedRelocations[Name];
-   DEBUG(dbgs() << "Resolving symbol '" << Name << "'\n");
--  for (int i = 0, e = Relocs.size(); i != e; ++i) {
--    // Change the relocation to be section relative rather than symbol
--    // relative and move it to the resolved relocation list.
--    RelocationEntry Entry = Relocs[i];
--    Entry.Addend += Loc->second.second;
--    Relocations[Loc->second.first].push_back(Entry);
-+  for (int i = 0, e = SourcesForSymbol.size(); i != e; ++i) {
-+    // Find the relocation entry corresponding to this source and fill
-+    // in its source information with the resolved information from this
-+    // symbol.
-+    RelocationSource &Source = SourcesForSymbol[i];
-+    RelocationEntry &Entry = Relocations[Source.SectionID][Source.Index];
-+    Entry.Sources[Source.SourceIdx].Offset = Loc->second.second;
-+    Entry.Sources[Source.SourceIdx].ID = Loc->second.first;
-+    // Now create a relocation source in the pointed-to section.
-+    RelocationSources[Loc->second.first].push_back(Source);
-   }
-   // FIXME: Keep a worklist of the relocations we've added so that we can
-   // resolve more selectively later.
--  Relocs.clear();
-+  SourcesForSymbol.clear();
- }
- 
- bool RuntimeDyldMachO::loadObject(MemoryBuffer *InputBuffer) {
-@@ -575,6 +756,56 @@
-   return false;
- }
- 
-+bool RuntimeDyldMachO::resolveRelocationEntry(unsigned SectionID,
-+                                              RelocationEntry &RE)
-+{
-+  uint8_t *Target = (uint8_t*)Sections[SectionID].base() + RE.Offset;
-+  uint64_t FinalTarget = SectionLoadAddress[SectionID] + RE.Offset;
-+
-+  uint64_t FinalSource1 = 0;
-+  uint64_t FinalSource2 = 0;
-+
-+  if (RE.Sources[0].ID == SectionOffset::UnresolvedSourceID ||
-+      RE.Sources[1].ID == SectionOffset::UnresolvedSourceID)
-+    return false;
-+
-+  FinalSource1 = SectionLoadAddress[RE.Sources[0].ID] + RE.Sources[0].Offset;
-+  if (RE.Sources[1].ID != SectionOffset::NoSectionID)
-+    FinalSource2 = SectionLoadAddress[RE.Sources[1].ID] + RE.Sources[1].Offset;
-+
-+  bool isPCRel = RE.isPCRel();
-+  unsigned Type = RE.type();
-+  unsigned Size = RE.length();
-+
-+  if (RE.Sources[1].ID == SectionOffset::NoSectionID)
-+    DEBUG(dbgs() << "Resolving relocation at Section #" << SectionID
-+          << " + " << RE.Offset << " (" << format("%p", Target) << ")"
-+          << " from Section #" << RE.Sources[0].ID << "+" << RE.Sources[0].Offset
-+          << " (" << format("0x%llx", FinalSource1) << ")"
-+          << " (" << (isPCRel ? "pcrel" : "absolute")
-+          << ", type: " << Type << ", Size: " << Size << ", Addend: "
-+          << RE.Addend << ").\n");
-+  else
-+    DEBUG(dbgs() << "Resolving relocation at Section #" << SectionID
-+          << " + " << RE.Offset << " (" << format("%p", Target) << ")"
-+          << " from Section #" << RE.Sources[0].ID << "+" << RE.Sources[0].Offset
-+          << " (" << format("0x%llx", FinalSource1) << ")"
-+          << " and Section #" << RE.Sources[1].ID << "+" << RE.Sources[1].Offset
-+          << " (" << format("0x%llx", FinalSource2) << ")"
-+          << " (" << (isPCRel ? "pcrel" : "absolute")
-+          << ", type: " << Type << ", Size: " << Size << ", Addend: "
-+          << RE.Addend << ").\n");
-+
-+  return resolveRelocation(Target,
-+                           FinalTarget,
-+                           FinalSource1,
-+                           FinalSource2,
-+                           isPCRel,
-+                           Type,
-+                           Size,
-+                           RE.Addend);
-+}
-+
- // Assign an address to a symbol name and resolve all the relocations
- // associated with it.
- void RuntimeDyldMachO::reassignSectionAddress(unsigned SectionID,
-@@ -590,30 +821,17 @@
- 
-   SectionLoadAddress[SectionID] = Addr;
- 
--  RelocationList &Relocs = Relocations[SectionID];
--  for (unsigned i = 0, e = Relocs.size(); i != e; ++i) {
--    RelocationEntry &RE = Relocs[i];
--    uint8_t *Target = (uint8_t*)Sections[RE.SectionID].base() + RE.Offset;
--    uint64_t FinalTarget = (uint64_t)SectionLoadAddress[RE.SectionID] + RE.Offset;
--    bool isPCRel = (RE.Data >> 24) & 1;
--    unsigned Type = (RE.Data >> 28) & 0xf;
--    unsigned Size = 1 << ((RE.Data >> 25) & 3);
--
--    DEBUG(dbgs() << "Resolving relocation at Section #" << RE.SectionID
--          << " + " << RE.Offset << " (" << format("%p", Target) << ")"
--          << " from Section #" << SectionID << " (" << format("%p", Addr) << ")"
--          << "(" << (isPCRel ? "pcrel" : "absolute")
--          << ", type: " << Type << ", Size: " << Size << ", Addend: "
--          << RE.Addend << ").\n");
--
--    resolveRelocation(Target,
--                      FinalTarget,
--                      Addr,
--                      isPCRel,
--                      Type,
--                      Size,
--                      RE.Addend);
-+  RelocationList &RelocsForSection = Relocations[SectionID];
-+  for (unsigned i = 0, e = RelocsForSection.size(); i != e; ++i) {
-+    RelocationEntry &RE = RelocsForSection[i];
-+    resolveRelocationEntry(SectionID, RE);
-   }
-+  RelocationSourceList &SourcesForSection = RelocationSources[SectionID];
-+  for (unsigned i = 0, e = SourcesForSection.size(); i != e; ++i) {
-+    RelocationSource &R = SourcesForSection[i];
-+    RelocationEntry &RE = Relocations[R.SectionID][R.Index];
-+    resolveRelocationEntry(R.SectionID, RE);
-+  }
- }
- 
- bool RuntimeDyldMachO::isKnownFormat(const MemoryBuffer *InputBuffer) {
-Index: lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.h
-===================================================================
---- lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.h	(revision 152265)
-+++ lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.h	(working copy)
-@@ -26,48 +26,183 @@
- namespace llvm {
- class RuntimeDyldMachO : public RuntimeDyldImpl {
- 
--  // For each symbol, keep a list of relocations based on it. Anytime
--  // its address is reassigned (the JIT re-compiled the function, e.g.),
--  // the relocations get re-resolved.
--  // The symbol (or section) the relocation is sourced from is the Key
--  // in the relocation list where it's stored.
-+  // For each section, keep a list of relocatable pieces of data that
-+  // reside in it.  If the section moves, or the sections whose
-+  // locations the data depends on move, re-resolve the relocations
-+  // based on that movement.
-+  //
-+  // RelocationEntry structures correspond to one or two Mach-O
-+  // relocation_info or scattered_relocation_info structures --
-+  // usually one, but two iff the original has a paired structure
-+  // following it.
-+  //
-+  // To facilitate updating a relocation when its sources move, we
-+  // also keep RelocationSource structures associated with the sections
-+  // whose location the data depends on.
-+
-+  // FIXME: Use SymbolLoc for this instead.  Where should the enum live?
-+  struct SectionOffset {
-+    uint64_t    Offset;     // Offset of the location into its section.
-+    unsigned    ID;         // The section the location is contained in.
-+
-+    enum {
-+      NoSectionID        = 0xffff0000,
-+      UnresolvedSourceID = 0xffffffff
-+    };
-+  };
-+
-   struct RelocationEntry {
--    unsigned    SectionID;  // Section the relocation is contained in.
--    uint64_t    Offset;     // Offset into the section for the relocation.
--    uint32_t    Data;       // Second word of the raw macho relocation entry.
--    int64_t     Addend;     // Addend encoded in the instruction itself, if any,
--                            // plus the offset into the source section for
--                            // the symbol once the relocation is resolvable.
-+    SectionOffset Sources[2]; // The section/offset pairs this relocation
-+                              // refers to.
-+                              // If the original Mach-O relocation entries used
-+                              // relocation_info, this data is computed from
-+                              // r_symbolnum and the offsets are locked to 0.
-+                              // (The only offset is determined by the addend.)
-+                              // If the original Mach-O relocation entries used
-+                              // scattered_relocation_info, this data, including
-+                              // offsets, is computed by looking r_value up in
-+                              // the section table.
- 
--    RelocationEntry(unsigned id, uint64_t offset, uint32_t data, int64_t addend)
--      : SectionID(id), Offset(offset), Data(data), Addend(addend) {}
-+    uint64_t      Offset;     // The offset of the data to be relocated.
-+                              // We don't use a SectionOffset because this
-+                              // RelocationEntry is already associated with the
-+                              // proper Section.
-+
-+    int64_t       Addend;     // Addend encoded in the instruction itself, if any,
-+                              // plus the offset into the source section for
-+                              // the symbol once the relocation is resolvable.
-+
-+    uint32_t      Data;       // If the original Mach-O relocation entry was a
-+                              // relocation_info, the bitfield { r_symbolnum,
-+                              // r_pcrel, r_length, r_extern, r_type }.
-+                              // If the original Mach-O relocation entry was a
-+                              // scattered_relocation_info, the bitfield
-+                              // { r_address, r_type, r_length, r_pcrel,
-+                              // r_scattered }.
-+
-+    bool          Scattered;  // True iff this relocation is scattered.
-+
-+    bool isPCRel()
-+    {
-+      if (Scattered)
-+        return (Data & 0x40000000) >> 30;
-+      else
-+        return (Data & 0x01000000) >> 24;
-+    }
-+
-+    uint8_t type()
-+    {
-+      if (Scattered)
-+        return (Data & 0x0f000000) >> 24;
-+      else
-+        return (Data & 0xf0000000) >> 28;
-+    }
-+
-+    // Returns the decoded version of the length field
-+    uint8_t length()
-+    {
-+      if (Scattered)
-+        return 1 << ((Data & 0x30000000) >> 28);
-+      else
-+        return 1 << ((Data & 0x0e000000) >> 25);
-+    }
-+
-+    // Used with an ordinary relocation entry, where the source_offsets are not
-+    // known yet.
-+    RelocationEntry(uint64_t offset,      // See the Offset field.
-+                    unsigned source_id0,  // The section ID for the first source.
-+                    unsigned source_id1,  // The section ID for the second source.
-+                    uint32_t data,        // See the Data field.
-+                    int64_t addend)       // See the Addend field.
-+      : Offset(offset),
-+        Addend(addend),
-+        Data(data),
-+        Scattered(false) {
-+      Sources[0].ID = source_id0;
-+      Sources[0].Offset = 0;
-+      Sources[1].ID = source_id1;
-+      Sources[1].Offset = 0;
-+    }
-+  
-+    // Used with a scattered relocation entry, where the source_offsets can be
-+    // derived from the value.
-+    RelocationEntry(uint64_t offset,      // See the Offset field.
-+                    unsigned source_id0,  // The section ID for the first source.
-+                    uint64_t source_off0, // The offset for the first source.
-+                    unsigned source_id1,  // The section ID for the second source.
-+                    uint64_t source_off1, // The offset for the second source.
-+                    uint32_t data,        // See the Data field.
-+                    int64_t addend)       // See the Addend field.
-+      : Offset(offset),
-+        Addend(addend),
-+        Data(data), 
-+        Scattered(true) {
-+      Sources[0].ID = source_id0;
-+      Sources[0].Offset = source_off0;
-+      Sources[1].ID = source_id1;
-+      Sources[1].Offset = source_off1;
-+    }
-   };
-   typedef SmallVector<RelocationEntry, 4> RelocationList;
--  // Relocations to sections already loaded. Indexed by SectionID which is the
--  // source of the address. The target where the address will be writen is
--  // SectionID/Offset in the relocation itself.
-+
-+  // For each section, keep a list of sources that are used by relocations in
-+  // other sections.  Whenever a relocation gets created, create one or two
-+  // corresponding relocation sources.  Whenever relocations are re-resolved
-+  // for a section, also re-resolve the relocations corresponding to that
-+  // section's relocation targets.
-+  struct RelocationSource {
-+    unsigned    SectionID;      // Section whose RelocationList contains the relocation.
-+    uint32_t    Index : 24;     // Index of the RelocatonEntry in that RelocationList.
-+    uint8_t     SourceIdx : 1;  // Index of this source in the RelocationEntry's Sources.
-+
-+    RelocationSource(unsigned id,
-+                     uint32_t index,
-+                     uint8_t source_idx)
-+      : SectionID(id),
-+        Index(index),
-+        SourceIdx(source_idx) {}
-+  };
-+  typedef SmallVector<RelocationSource, 4> RelocationSourceList;
-+
-+  // Relocations which refer to already-loaded section. Indexed by SectionID
-+  // which is the section containing the relocatable data.
-   IndexedMap<RelocationList> Relocations;
-+  // Targets corresponding to Relocations.
-+  IndexedMap<RelocationSourceList> RelocationSources;
-   // Relocations to symbols that are not yet resolved. Must be external
-   // relocations by definition. Indexed by symbol name.
--  StringMap<RelocationList> UnresolvedRelocations;
-+  StringMap<RelocationSourceList> UnresolvedRelocations;
- 
-+  bool resolveRelocationEntry(unsigned SectionID,
-+                              RelocationEntry &RE);
-   bool resolveRelocation(uint8_t *LocalAddress,
-                          uint64_t FinalAddress,
--                         uint64_t Value,
-+                         uint64_t FinalSource1,
-+                         uint64_t FinalSource2,
-                          bool isPCRel,
-                          unsigned Type,
-                          unsigned Size,
-                          int64_t Addend);
-+  bool resolveI386Relocation(uint8_t *LocalAddress,
-+                             uint64_t FinalAddress,
-+                             uint64_t FinalSource1,
-+                             uint64_t FinalSource2,
-+                             bool isPCRel,
-+                             unsigned Type,
-+                             unsigned Size,
-+                             int64_t Addend);
-   bool resolveX86_64Relocation(uint8_t *LocalAddress,
-                                uint64_t FinalAddress,
--                               uint64_t Value,
-+                               uint64_t FinalSource1,
-+                               uint64_t FinalSource2,
-                                bool isPCRel,
-                                unsigned Type,
-                                unsigned Size,
-                                int64_t Addend);
-   bool resolveARMRelocation(uint8_t *LocalAddress,
-                             uint64_t FinalAddress,
--                            uint64_t Value,
-+                            uint64_t FinalSource1,
-+                            uint64_t FinalSource2,
-                             bool isPCRel,
-                             unsigned Type,
-                             unsigned Size,
-Index: lib/MC/MCDisassembler/Disassembler.cpp
-===================================================================
---- lib/MC/MCDisassembler/Disassembler.cpp	(revision 152265)
-+++ lib/MC/MCDisassembler/Disassembler.cpp	(working copy)
-@@ -15,7 +15,9 @@
- #include "llvm/MC/MCDisassembler.h"
- #include "llvm/MC/MCInst.h"
- #include "llvm/MC/MCInstPrinter.h"
-+#include "llvm/MC/MCInstrInfo.h"
- #include "llvm/MC/MCRegisterInfo.h"
-+#include "llvm/MC/MCSubtargetInfo.h"
- #include "llvm/Support/MemoryObject.h"
- #include "llvm/Support/TargetRegistry.h"
- #include "llvm/Support/TargetSelect.h"
-@@ -86,7 +88,7 @@
-   LLVMDisasmContext *DC = new LLVMDisasmContext(TripleName, DisInfo, TagType,
-                                                 GetOpInfo, SymbolLookUp,
-                                                 TheTarget, MAI, MRI,
--                                                Ctx, DisAsm, IP);
-+                                                STI, Ctx, DisAsm, IP);
-   assert(DC && "Allocation failure!");
- 
-   return DC;
-Index: lib/MC/MCDisassembler/Disassembler.h
-===================================================================
---- lib/MC/MCDisassembler/Disassembler.h	(revision 152265)
-+++ lib/MC/MCDisassembler/Disassembler.h	(working copy)
-@@ -29,6 +29,7 @@
- class MCDisassembler;
- class MCInstPrinter; 
- class MCRegisterInfo;
-+class MCSubtargetInfo;
- class Target;
- 
- //
-@@ -61,6 +62,8 @@
-   llvm::OwningPtr<const llvm::MCAsmInfo> MAI;
-   // The register information for the target architecture.
-   llvm::OwningPtr<const llvm::MCRegisterInfo> MRI;
-+  // The subtarget information for the target architecture.
-+  llvm::OwningPtr<const llvm::MCSubtargetInfo> MSI;
-   // The assembly context for creating symbols and MCExprs.
-   llvm::OwningPtr<const llvm::MCContext> Ctx;
-   // The disassembler for the target architecture.
-@@ -78,6 +81,7 @@
-                     LLVMSymbolLookupCallback symbolLookUp,
-                     const Target *theTarget, const MCAsmInfo *mAI,
-                     const MCRegisterInfo *mRI,
-+                    const MCSubtargetInfo *mSI,
-                     llvm::MCContext *ctx, const MCDisassembler *disAsm,
-                     MCInstPrinter *iP) : TripleName(tripleName),
-                     DisInfo(disInfo), TagType(tagType), GetOpInfo(getOpInfo),
-@@ -85,6 +89,7 @@
-                     CommentStream(CommentsToEmit) {
-     MAI.reset(mAI);
-     MRI.reset(mRI);
-+    MSI.reset(mSI);
-     Ctx.reset(ctx);
-     DisAsm.reset(disAsm);
-     IP.reset(iP);
-Index: tools/llvm-nm/llvm-nm.cpp
-===================================================================
---- tools/llvm-nm/llvm-nm.cpp	(revision 152265)
-+++ tools/llvm-nm/llvm-nm.cpp	(working copy)
-@@ -204,9 +204,9 @@ static void SortAndPrintSymbolList() {
-       strcpy(SymbolSizeStr, "        ");
- 
-     if (i->Address != object::UnknownAddressOrSize)
--      format("%08"PRIx64, i->Address).print(SymbolAddrStr, sizeof(SymbolAddrStr));
-+      format("%08" PRIx64, i->Address).print(SymbolAddrStr, sizeof(SymbolAddrStr));
-     if (i->Size != object::UnknownAddressOrSize)
--      format("%08"PRIx64, i->Size).print(SymbolSizeStr, sizeof(SymbolSizeStr));
-+      format("%08" PRIx64, i->Size).print(SymbolSizeStr, sizeof(SymbolSizeStr));
- 
-     if (OutputFormat == posix) {
-       outs() << i->Name << " " << i->TypeChar << " "
-Index: lib/DebugInfo/DWARFFormValue.cpp
-===================================================================
---- lib/DebugInfo/DWARFFormValue.cpp	(revision 152265)
-+++ lib/DebugInfo/DWARFFormValue.cpp	(working copy)
-@@ -348,7 +348,7 @@ DWARFFormValue::dump(raw_ostream &OS, const DWARFC
-   }
- 
-   if (cu_relative_offset)
--    OS << format(" => {0x%8.8"PRIx64"}", (uvalue + (cu ? cu->getOffset() : 0)));
-+    OS << format(" => {0x%8.8" PRIx64 "}", (uvalue + (cu ? cu->getOffset() : 0)));
- }
- 
- const char*
-Index: tools/llvm-objdump/llvm-objdump.cpp
-===================================================================
---- tools/llvm-objdump/llvm-objdump.cpp	(revision 152265)
-+++ tools/llvm-objdump/llvm-objdump.cpp	(working copy)
-@@ -300,7 +300,7 @@ static void DisassembleObject(const ObjectFile *Ob
- 
-         if (DisAsm->getInstruction(Inst, Size, memoryObject, Index,
-                                    DebugOut, nulls())) {
--          outs() << format("%8"PRIx64":\t", SectionAddr + Index);
-+          outs() << format("%8" PRIx64":\t", SectionAddr + Index);
-           DumpBytes(StringRef(Bytes.data() + Index, Size));
-           IP->printInst(&Inst, outs(), "");
-           outs() << "\n";
-@@ -327,7 +327,7 @@ static void DisassembleObject(const ObjectFile *Ob
-           if (error(rel_cur->getTypeName(name))) goto skip_print_rel;
-           if (error(rel_cur->getValueString(val))) goto skip_print_rel;
- 
--          outs() << format("\t\t\t%8"PRIx64": ", SectionAddr + addr) << name << "\t"
-+          outs() << format("\t\t\t%8" PRIx64 ": ", SectionAddr + addr) << name << "\t"
-                  << val << "\n";
- 
-         skip_print_rel:
-@@ -388,7 +388,7 @@ static void PrintSectionHeaders(const ObjectFile *
-     if (error(si->isBSS(BSS))) return;
-     std::string Type = (std::string(Text ? "TEXT " : "") +
-                         (Data ? "DATA " : "") + (BSS ? "BSS" : ""));
--    outs() << format("%3d %-13s %09"PRIx64" %017"PRIx64" %s\n", i, Name.str().c_str(), Size,
-+    outs() << format("%3d %-13s %09" PRIx64 " %017" PRIx64 " %s\n", i, Name.str().c_str(), Size,
-                      Address, Type.c_str());
-     ++i;
-   }
-@@ -411,7 +411,7 @@ static void PrintSectionContents(const ObjectFile
- 
-     // Dump out the content as hex and printable ascii characters.
-     for (std::size_t addr = 0, end = Contents.size(); addr < end; addr += 16) {
--      outs() << format(" %04"PRIx64" ", BaseAddr + addr);
-+      outs() << format(" %04" PRIx64 " ", BaseAddr + addr);
-       // Dump line of hex.
-       for (std::size_t i = 0; i < 16; ++i) {
-         if (i != 0 && i % 4 == 0)
-@@ -519,7 +519,7 @@ static void PrintSymbolTable(const ObjectFile *o)
-       else if (Type == SymbolRef::ST_Function)
-         FileFunc = 'F';
- 
--      outs() << format("%08"PRIx64, Address) << " "
-+      outs() << format("%08" PRIx64, Address) << " "
-              << GlobLoc // Local -> 'l', Global -> 'g', Neither -> ' '
-              << (Weak ? 'w' : ' ') // Weak?
-              << ' ' // Constructor. Not supported yet.
-@@ -539,7 +539,7 @@ static void PrintSymbolTable(const ObjectFile *o)
-         outs() << SectionName;
-       }
-       outs() << '\t'
--             << format("%08"PRIx64" ", Size)
-+             << format("%08" PRIx64 " ", Size)
-              << Name
-              << '\n';
-     }
-Index: tools/bugpoint/ToolRunner.cpp
-===================================================================
---- tools/bugpoint/ToolRunner.cpp	(revision 152265)
-+++ tools/bugpoint/ToolRunner.cpp	(working copy)
-@@ -128,7 +128,7 @@ static int RunProgramRemotelyWithTimeout(const sys
-       ErrorFile.close();
-     }
- 
--    errs() << OS;
-+    errs() << OS.str();
-   }
- 
-   return ReturnCode;
-Index: tools/llvm-readobj/llvm-readobj.cpp
-===================================================================
---- tools/llvm-readobj/llvm-readobj.cpp	(revision 152265)
-+++ tools/llvm-readobj/llvm-readobj.cpp	(working copy)
-@@ -95,9 +95,9 @@ void DumpSymbol(const SymbolRef &sym) {
-     // format() can't handle StringRefs
-     outs() << format("  %-32s", Name.str().c_str())
-            << format("  %-4s", GetTypeStr(Type))
--           << format("  %16"PRIx64, Address)
--           << format("  %16"PRIx64, Size)
--           << format("  %16"PRIx64, FileOffset)
-+           << format("  %16" PRIx64, Address)
-+           << format("  %16" PRIx64, Size)
-+           << format("  %16" PRIx64, FileOffset)
-            << "  " << GetFlagStr(Flags)
-            << "\n";
- }

Modified: lldb/branches/windows/source/API/SBBreakpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/API/SBBreakpoint.cpp?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/source/API/SBBreakpoint.cpp (original)
+++ lldb/branches/windows/source/API/SBBreakpoint.cpp Fri Sep 28 06:07:34 2012
@@ -234,6 +234,18 @@
         return false;
 }
 
+bool
+SBBreakpoint::IsInternal ()
+{
+    if (m_opaque_sp)
+    {
+        Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+        return m_opaque_sp->IsInternal();
+    }
+    else
+        return false;
+}
+
 void
 SBBreakpoint::SetIgnoreCount (uint32_t count)
 {

Modified: lldb/branches/windows/source/API/SBTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/API/SBTarget.cpp?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/source/API/SBTarget.cpp (original)
+++ lldb/branches/windows/source/API/SBTarget.cpp Fri Sep 28 06:07:34 2012
@@ -853,10 +853,19 @@
             if (attach_pid != LLDB_INVALID_PROCESS_ID)
             {
                 PlatformSP platform_sp = target_sp->GetPlatform();
-                ProcessInstanceInfo instance_info;
-                if (platform_sp->GetProcessInfo(attach_pid, instance_info))
+                // See if we can pre-verify if a process exists or not
+                if (platform_sp && platform_sp->IsConnected())
                 {
-                    attach_info.SetUserID(instance_info.GetEffectiveUserID());
+                    ProcessInstanceInfo instance_info;
+                    if (platform_sp->GetProcessInfo(attach_pid, instance_info))
+                    {
+                        attach_info.SetUserID(instance_info.GetEffectiveUserID());
+                    }
+                    else
+                    {
+                        error.ref().SetErrorStringWithFormat("no process found with process ID %llu", attach_pid);
+                        return sb_process;
+                    }
                 }
             }
             error.SetError (process_sp->Attach (attach_info));
@@ -1792,7 +1801,7 @@
             module_spec.GetFileSpec().SetFile(path, false);
         
         if (uuid_cstr)
-            module_spec.GetUUID().SetfromCString(uuid_cstr);
+            module_spec.GetUUID().SetFromCString(uuid_cstr);
         
         if (triple)
             module_spec.GetArchitecture().SetTriple (triple, target_sp->GetPlatform ().get());

Modified: lldb/branches/windows/source/API/SBThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/API/SBThread.cpp?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/source/API/SBThread.cpp (original)
+++ lldb/branches/windows/source/API/SBThread.cpp Fri Sep 28 06:07:34 2012
@@ -104,9 +104,7 @@
         Process::StopLocker stop_locker;
         if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock()))
         {
-            StopInfoSP stop_info_sp = exe_ctx.GetThreadPtr()->GetStopInfo ();
-            if (stop_info_sp)
-                reason =  stop_info_sp->GetStopReason();
+            return exe_ctx.GetThreadPtr()->GetStopReason();
         }
         else
         {

Modified: lldb/branches/windows/source/Breakpoint/Breakpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Breakpoint/Breakpoint.cpp?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/source/Breakpoint/Breakpoint.cpp (original)
+++ lldb/branches/windows/source/Breakpoint/Breakpoint.cpp Fri Sep 28 06:07:34 2012
@@ -511,14 +511,22 @@
 void
 Breakpoint::GetDescription (Stream *s, lldb::DescriptionLevel level, bool show_locations)
 {
-    assert (s != NULL);
-    s->Printf("%i: ", GetID());
-    GetResolverDescription (s);
-    GetFilterDescription (s);
-
     const size_t num_locations = GetNumLocations ();
     const size_t num_resolved_locations = GetNumResolvedLocations ();
 
+    assert (s != NULL);
+    
+
+    
+    // They just made the breakpoint, they don't need to be told HOW they made it...
+    // Also, we'll print the breakpoint number differently depending on whether there is 1 or more locations.
+    if (level != eDescriptionLevelInitial)
+    {
+        s->Printf("%i: ", GetID());
+        GetResolverDescription (s);
+        GetFilterDescription (s);
+    }
+    
     switch (level)
     {
     case lldb::eDescriptionLevelBrief:
@@ -545,7 +553,32 @@
             s->EOL();
         }
         break;
-
+        
+    case lldb::eDescriptionLevelInitial:
+        s->Printf ("Breakpoint %i: ", GetID());
+        if (num_locations == 0)
+        {
+            s->Printf ("no locations (pending).");
+        }
+        else if (num_locations == 1)
+        {
+            // If there is one location only, we'll just print that location information.  But don't do this if
+            // show locations is true, then that will be handled below.
+            if (show_locations == false)
+            {
+                GetLocationAtIndex(0)->GetDescription(s, level);
+            }
+            else
+            {
+                s->Printf ("%zd locations.", num_locations);
+            }
+        }
+        else
+        {
+            s->Printf ("%zd locations.", num_locations);
+        }
+        s->EOL();
+        break;
     case lldb::eDescriptionLevelVerbose:
         // Verbose mode does a debug dump of the breakpoint
         Dump (s);

Modified: lldb/branches/windows/source/Breakpoint/BreakpointLocation.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Breakpoint/BreakpointLocation.cpp?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/source/Breakpoint/BreakpointLocation.cpp (original)
+++ lldb/branches/windows/source/Breakpoint/BreakpointLocation.cpp Fri Sep 28 06:07:34 2012
@@ -410,13 +410,20 @@
 BreakpointLocation::GetDescription (Stream *s, lldb::DescriptionLevel level)
 {
     SymbolContext sc;
-    s->Indent();
-    BreakpointID::GetCanonicalReference(s, m_owner.GetID(), GetID());
-
+    
+    // If the description level is "initial" then the breakpoint is printing out our initial state,
+    // and we should let it decide how it wants to print our label.
+    if (level != eDescriptionLevelInitial)
+    {
+        s->Indent();
+        BreakpointID::GetCanonicalReference(s, m_owner.GetID(), GetID());
+    }
+    
     if (level == lldb::eDescriptionLevelBrief)
         return;
 
-    s->PutCString(": ");
+    if (level != eDescriptionLevelInitial)
+        s->PutCString(": ");
 
     if (level == lldb::eDescriptionLevelVerbose)
         s->IndentMore();
@@ -425,7 +432,7 @@
     {
         m_address.CalculateSymbolContext(&sc);
 
-        if (level == lldb::eDescriptionLevelFull)
+        if (level == lldb::eDescriptionLevelFull || level == eDescriptionLevelInitial)
         {
             s->PutCString("where = ");
             sc.DumpStopContext (s, m_owner.GetTarget().GetProcessSP().get(), m_address, false, true, false);
@@ -478,7 +485,11 @@
         s->EOL();
         s->Indent();
     }
-    s->Printf ("%saddress = ", (level == lldb::eDescriptionLevelFull && m_address.IsSectionOffset()) ? ", " : "");
+    
+    if (m_address.IsSectionOffset() && (level == eDescriptionLevelFull || level == eDescriptionLevelInitial))
+        s->Printf (", ");
+    s->Printf ("address = ");
+    
     ExecutionContextScope *exe_scope = NULL;
     Target *target = &m_owner.GetTarget();
     if (target)
@@ -486,7 +497,10 @@
     if (exe_scope == NULL)
         exe_scope = target;
 
-    m_address.Dump(s, exe_scope, Address::DumpStyleLoadAddress, Address::DumpStyleModuleWithFileAddress);
+    if (eDescriptionLevelInitial)
+        m_address.Dump(s, exe_scope, Address::DumpStyleLoadAddress, Address::DumpStyleFileAddress);
+    else
+        m_address.Dump(s, exe_scope, Address::DumpStyleLoadAddress, Address::DumpStyleModuleWithFileAddress);
 
     if (level == lldb::eDescriptionLevelVerbose)
     {
@@ -505,7 +519,7 @@
         }
         s->IndentLess();
     }
-    else
+    else if (level != eDescriptionLevelInitial)
     {
         s->Printf(", %sresolved, hit count = %u ",
                   (IsResolved() ? "" : "un"),

Modified: lldb/branches/windows/source/Commands/CommandObjectBreakpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Commands/CommandObjectBreakpoint.cpp?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/source/Commands/CommandObjectBreakpoint.cpp (original)
+++ lldb/branches/windows/source/Commands/CommandObjectBreakpoint.cpp Fri Sep 28 06:07:34 2012
@@ -512,9 +512,8 @@
         if (bp)
         {
             Stream &output_stream = result.GetOutputStream();
-            output_stream.Printf ("Breakpoint created: ");
-            bp->GetDescription(&output_stream, lldb::eDescriptionLevelBrief);
-            output_stream.EOL();
+            const bool show_locations = false;
+            bp->GetDescription(&output_stream, lldb::eDescriptionLevelInitial, show_locations);
             // Don't print out this warning for exception breakpoints.  They can get set before the target
             // is set, but we won't know how to actually set the breakpoint till we run.
             if (bp->GetNumLocations() == 0 && break_type != eSetTypeException)

Modified: lldb/branches/windows/source/Commands/CommandObjectCommands.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Commands/CommandObjectCommands.cpp?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/source/Commands/CommandObjectCommands.cpp (original)
+++ lldb/branches/windows/source/Commands/CommandObjectCommands.cpp Fri Sep 28 06:07:34 2012
@@ -1162,6 +1162,7 @@
 private:
     std::string m_function_name;
     ScriptedCommandSynchronicity m_synchro;
+    bool m_fetched_help_long;
     
 public:
     
@@ -1174,15 +1175,9 @@
                           (std::string("Run Python function ") + funct).c_str(),
                           NULL),
         m_function_name(funct),
-        m_synchro(synch)
+        m_synchro(synch),
+        m_fetched_help_long(false)
     {
-        ScriptInterpreter* scripter = m_interpreter.GetScriptInterpreter();
-        if (scripter)
-        {
-            std::string docstring = scripter->GetDocumentationForItem(funct.c_str());
-            if (!docstring.empty())
-                SetHelpLong(docstring);
-        }
     }
     
     virtual
@@ -1208,6 +1203,23 @@
         return m_synchro;
     }
     
+    virtual const char *
+    GetHelpLong ()
+    {
+        if (!m_fetched_help_long)
+        {
+            ScriptInterpreter* scripter = m_interpreter.GetScriptInterpreter();
+            if (scripter)
+            {
+                std::string docstring;
+                m_fetched_help_long = scripter->GetDocumentationForItem(m_function_name.c_str(),docstring);
+                if (!docstring.empty())
+                    SetHelpLong(docstring);
+            }
+        }
+        return CommandObjectRaw::GetHelpLong();
+    }
+    
 protected:
     virtual bool
     DoExecute (const char *raw_command_line, CommandReturnObject &result)

Modified: lldb/branches/windows/source/Commands/CommandObjectMemory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Commands/CommandObjectMemory.cpp?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/source/Commands/CommandObjectMemory.cpp (original)
+++ lldb/branches/windows/source/Commands/CommandObjectMemory.cpp Fri Sep 28 06:07:34 2012
@@ -39,7 +39,7 @@
 {
     { LLDB_OPT_SET_1, false, "num-per-line" ,'l', required_argument, NULL, 0, eArgTypeNumberPerLine ,"The number of items per line to display."},
     { LLDB_OPT_SET_2, false, "binary"       ,'b', no_argument      , NULL, 0, eArgTypeNone          ,"If true, memory will be saved as binary. If false, the memory is saved save as an ASCII dump that uses the format, size, count and number per line settings."},
-    { LLDB_OPT_SET_3, true , "view-as"      ,'t', required_argument, NULL, 0, eArgTypeNone          ,"The name of a type to view memory as."}, 
+    { LLDB_OPT_SET_3, true , "type"         ,'t', required_argument, NULL, 0, eArgTypeNone          ,"The name of a type to view memory as."}, 
     { LLDB_OPT_SET_4, false, "force"        ,'r', no_argument,       NULL, 0, eArgTypeNone          ,"Necessary if reading over 1024 bytes of memory."},
 };
 

Modified: lldb/branches/windows/source/Commands/CommandObjectTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Commands/CommandObjectTarget.cpp?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/branches/windows/source/Commands/CommandObjectTarget.cpp Fri Sep 28 06:07:34 2012
@@ -24,6 +24,7 @@
 #include "lldb/Core/State.h"
 #include "lldb/Core/Timer.h"
 #include "lldb/Core/ValueObjectVariable.h"
+#include "lldb/Host/Symbols.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
 #include "lldb/Interpreter/Options.h"
@@ -450,7 +451,7 @@
                              NULL,
                              0),
         m_option_group (interpreter),
-        m_cleanup_option (LLDB_OPT_SET_1, false, "clean", 'c', 0, eArgTypeNone, "Perform extra cleanup to minimize memory consumption after deleting the target.", false)
+        m_cleanup_option (LLDB_OPT_SET_1, false, "clean", 'c', "Perform extra cleanup to minimize memory consumption after deleting the target.", false, false)
     {
         m_option_group.Append (&m_cleanup_option, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
         m_option_group.Finalize();
@@ -3983,9 +3984,17 @@
     CommandObjectTargetSymbolsAdd (CommandInterpreter &interpreter) :
         CommandObjectParsed (interpreter,
                              "target symbols add",
-                             "Add a debug symbol file to one of the target's current modules.",
-                             "target symbols add [<symfile>]")
+                             "Add a debug symbol file to one of the target's current modules by specifying a path to a debug symbols file, or using the options to specify a module to download symbols for.",
+                             "target symbols add [<symfile>]"),
+        m_option_group (interpreter),
+        m_file_option (LLDB_OPT_SET_1, false, "shlib", 's', CommandCompletions::eModuleCompletion, eArgTypeShlibName, "Fullpath or basename for module to find debug symbols for."),
+        m_current_frame_option (LLDB_OPT_SET_2, false, "frame", 'F', "Locate the debug symbols the currently selected frame.", false, true)
+
     {
+        m_option_group.Append (&m_uuid_option_group, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
+        m_option_group.Append (&m_file_option, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
+        m_option_group.Append (&m_current_frame_option, LLDB_OPT_SET_2, LLDB_OPT_SET_2);
+        m_option_group.Finalize();
     }
     
     virtual
@@ -4017,112 +4026,260 @@
         return matches.GetSize();
     }
     
+    virtual Options *
+    GetOptions ()
+    {
+        return &m_option_group;
+    }
+    
+
 protected:
+    
+    bool
+    AddModuleSymbols (Target *target,
+                      const FileSpec &symfile_spec,
+                      bool &flush,
+                      CommandReturnObject &result)
+    {
+        ModuleSP symfile_module_sp (new Module (symfile_spec, target->GetArchitecture()));
+        const UUID &symfile_uuid = symfile_module_sp->GetUUID();
+        StreamString ss_symfile_uuid;
+        symfile_uuid.Dump(&ss_symfile_uuid);
+        
+        if (symfile_module_sp)
+        {
+            char symfile_path[PATH_MAX];
+            symfile_spec.GetPath (symfile_path, sizeof(symfile_path));
+            // We now have a module that represents a symbol file
+            // that can be used for a module that might exist in the
+            // current target, so we need to find that module in the
+            // target
+            
+            ModuleSP old_module_sp (target->GetImages().FindModule (symfile_uuid));
+            if (old_module_sp)
+            {
+                // The module has not yet created its symbol vendor, we can just
+                // give the existing target module the symfile path to use for
+                // when it decides to create it!
+                old_module_sp->SetSymbolFileFileSpec (symfile_module_sp->GetFileSpec());
+                
+                // Provide feedback that the symfile has been successfully added.
+                const FileSpec &module_fs = old_module_sp->GetFileSpec();
+                result.AppendMessageWithFormat("symbol file '%s' with UUID %s has been successfully added to the '%s/%s' module\n",
+                                               symfile_path, ss_symfile_uuid.GetData(),
+                                               module_fs.GetDirectory().AsCString(), module_fs.GetFilename().AsCString());
+                
+                // Let clients know something changed in the module
+                // if it is currently loaded
+                ModuleList module_list;
+                module_list.Append (old_module_sp);
+                target->ModulesDidLoad (module_list);
+                flush = true;
+            }
+            else
+            {
+                result.AppendErrorWithFormat ("symbol file '%s' with UUID %s does not match any existing module%s\n",
+                                              symfile_path, ss_symfile_uuid.GetData(),
+                                              (symfile_spec.GetFileType() != FileSpec::eFileTypeRegular)
+                                              ? "\n       please specify the full path to the symbol file"
+                                              : "");
+                return false;
+            }
+        }
+        else
+        {
+            result.AppendError ("one or more executable image paths must be specified");
+            result.SetStatus (eReturnStatusFailed);
+            return false;
+        }
+        result.SetStatus (eReturnStatusSuccessFinishResult);
+        return true;
+    }
+
     virtual bool
     DoExecute (Args& args,
              CommandReturnObject &result)
     {
         ExecutionContext exe_ctx (m_interpreter.GetExecutionContext());
         Target *target = exe_ctx.GetTargetPtr();
+        result.SetStatus (eReturnStatusFailed);
         if (target == NULL)
         {
             result.AppendError ("invalid target, create a debug target using the 'target create' command");
-            result.SetStatus (eReturnStatusFailed);
         }
         else
         {
             bool flush = false;
+            ModuleSpec sym_spec;
+            const bool uuid_option_set = m_uuid_option_group.GetOptionValue().OptionWasSet();
+            const bool file_option_set = m_file_option.GetOptionValue().OptionWasSet();
+            const bool frame_option_set = m_current_frame_option.GetOptionValue().OptionWasSet();
+
             const size_t argc = args.GetArgumentCount();
             if (argc == 0)
             {
-                result.AppendError ("one or more symbol file paths must be specified");
-                result.SetStatus (eReturnStatusFailed);
-            }
-            else
-            {
-                PlatformSP platform_sp (target->GetPlatform());
-
-                for (size_t i=0; i<argc; ++i)
+                if (uuid_option_set || file_option_set || frame_option_set)
                 {
-                    const char *symfile_path = args.GetArgumentAtIndex(i);
-                    if (symfile_path)
+                    bool success = false;
+                    bool error_set = false;
+                    if (frame_option_set)
                     {
-                        ModuleSpec sym_spec;
-                        FileSpec symfile_spec;
-                        sym_spec.GetSymbolFileSpec().SetFile(symfile_path, true);
-                        if (platform_sp)
-                            platform_sp->ResolveSymbolFile(*target, sym_spec, symfile_spec);
-                        else
-                            symfile_spec.SetFile(symfile_path, true);
-                        
-                        ArchSpec arch;
-                        if (symfile_spec.Exists())
+                        Process *process = exe_ctx.GetProcessPtr();
+                        if (process)
                         {
-                            ModuleSP symfile_module_sp (new Module (symfile_spec, target->GetArchitecture()));
-                            const UUID &symfile_uuid = symfile_module_sp->GetUUID();
-                            StreamString ss_symfile_uuid;
-                            symfile_uuid.Dump(&ss_symfile_uuid);
-
-                            if (symfile_module_sp)
+                            const StateType process_state = process->GetState();
+                            if (StateIsStoppedState (process_state, true))
                             {
-                                // We now have a module that represents a symbol file
-                                // that can be used for a module that might exist in the
-                                // current target, so we need to find that module in the
-                                // target
-                                
-                                ModuleSP old_module_sp (target->GetImages().FindModule (symfile_uuid));
-                                if (old_module_sp)
+                                StackFrame *frame = exe_ctx.GetFramePtr();
+                                if (frame)
                                 {
-                                    // The module has not yet created its symbol vendor, we can just
-                                    // give the existing target module the symfile path to use for
-                                    // when it decides to create it!
-                                    old_module_sp->SetSymbolFileFileSpec (symfile_module_sp->GetFileSpec());
-
-                                    // Provide feedback that the symfile has been successfully added.
-                                    const FileSpec &module_fs = old_module_sp->GetFileSpec();
-                                    result.AppendMessageWithFormat("symbol file '%s' with UUID %s has been successfully added to the '%s/%s' module\n",
-                                                                   symfile_path, ss_symfile_uuid.GetData(),
-                                                                   module_fs.GetDirectory().AsCString(), module_fs.GetFilename().AsCString());
-
-                                    // Let clients know something changed in the module
-                                    // if it is currently loaded
-                                    ModuleList module_list;
-                                    module_list.Append (old_module_sp);
-                                    target->ModulesDidLoad (module_list);
-                                    flush = true;
+                                    ModuleSP frame_module_sp (frame->GetSymbolContext(eSymbolContextModule).module_sp);
+                                    if (frame_module_sp)
+                                    {
+                                        if (frame_module_sp->GetPlatformFileSpec().Exists())
+                                        {
+                                            sym_spec.GetArchitecture() = frame_module_sp->GetArchitecture();
+                                            sym_spec.GetFileSpec() = frame_module_sp->GetPlatformFileSpec();
+                                        }
+                                        sym_spec.GetUUID() = frame_module_sp->GetUUID();
+                                        success = sym_spec.GetUUID().IsValid() || sym_spec.GetFileSpec();
+                                    }
+                                    else
+                                    {
+                                        result.AppendError ("frame has no module");
+                                        error_set = true;
+                                    }
                                 }
                                 else
                                 {
-                                    result.AppendErrorWithFormat ("symbol file '%s' with UUID %s does not match any existing module%s\n",
-                                                                  symfile_path, ss_symfile_uuid.GetData(),
-                                                                  (symfile_spec.GetFileType() != FileSpec::eFileTypeRegular)
-                                                                      ? "\n       please specify the full path to the symbol file"
-                                                                      : "");
-                                    break;
+                                    result.AppendError ("invalid current frame");
+                                    error_set = true;
                                 }
                             }
                             else
                             {
-                                result.AppendError ("one or more executable image paths must be specified");
-                                result.SetStatus (eReturnStatusFailed);
-                                break;
+                                result.AppendErrorWithFormat ("process is not stopped: %s", StateAsCString(process_state));
+                                error_set = true;
                             }
-                            result.SetStatus (eReturnStatusSuccessFinishResult);
                         }
                         else
                         {
-                            char resolved_symfile_path[PATH_MAX];
-                            result.SetStatus (eReturnStatusFailed);
-                            if (symfile_spec.GetPath (resolved_symfile_path, sizeof(resolved_symfile_path)))
+                            result.AppendError ("a process must exist in order to use the --frame option");
+                            error_set = true;
+                        }
+                    }
+                    else
+                    {
+                        if (uuid_option_set)
+                        {
+                            sym_spec.GetUUID() = m_uuid_option_group.GetOptionValue().GetCurrentValue();
+                            success |= sym_spec.GetUUID().IsValid();
+                        }
+                        else if (file_option_set)
+                        {
+                            sym_spec.GetFileSpec() = m_file_option.GetOptionValue().GetCurrentValue();
+                            ModuleSP module_sp (target->GetImages().FindFirstModule(sym_spec));
+                            if (module_sp)
                             {
-                                if (strcmp (resolved_symfile_path, symfile_path) != 0)
-                                {
-                                    result.AppendErrorWithFormat ("invalid module path '%s' with resolved path '%s'\n", symfile_path, resolved_symfile_path);
+                                sym_spec.GetFileSpec() = module_sp->GetFileSpec();
+                                sym_spec.GetPlatformFileSpec() = module_sp->GetPlatformFileSpec();
+                                sym_spec.GetUUID() = module_sp->GetUUID();
+                                sym_spec.GetArchitecture() = module_sp->GetArchitecture();
+                            }
+                            else
+                            {
+                                sym_spec.GetArchitecture() = target->GetArchitecture();
+                            }
+                            success |= sym_spec.GetFileSpec().Exists();
+                        }
+                    }
+
+                    if (success)
+                    {
+                        if (Symbols::DownloadObjectAndSymbolFile (sym_spec))
+                        {
+                            if (sym_spec.GetSymbolFileSpec())
+                                success = AddModuleSymbols (target, sym_spec.GetSymbolFileSpec(), flush, result);
+                        }
+                    }
+
+                    if (!success && !error_set)
+                    {
+                        StreamString error_strm;
+                        if (uuid_option_set)
+                        {
+                            error_strm.PutCString("unable to find debug symbols for UUID ");
+                            sym_spec.GetUUID().Dump (&error_strm);
+                        }
+                        else if (file_option_set)
+                        {
+                            error_strm.PutCString("unable to find debug symbols for the executable file ");
+                            error_strm << sym_spec.GetFileSpec();
+                        }
+                        else if (frame_option_set)
+                        {
+                            error_strm.PutCString("unable to find debug symbols for the current frame");                            
+                        }
+                        result.AppendError (error_strm.GetData());
+                    }
+                }
+                else
+                {
+                    result.AppendError ("one or more symbol file paths must be specified, or options must be specified");
+                }
+            }
+            else
+            {
+                if (uuid_option_set)
+                {
+                    result.AppendError ("specify either one or more paths to symbol files or use the --uuid option without arguments");
+                }
+                else if (file_option_set)
+                {
+                    result.AppendError ("specify either one or more paths to symbol files or use the --file option without arguments");
+                }
+                else if (frame_option_set)
+                {
+                    result.AppendError ("specify either one or more paths to symbol files or use the --frame option without arguments");
+                }
+                else
+                {
+                    PlatformSP platform_sp (target->GetPlatform());
+
+                    for (size_t i=0; i<argc; ++i)
+                    {
+                        const char *symfile_path = args.GetArgumentAtIndex(i);
+                        if (symfile_path)
+                        {
+                            FileSpec symfile_spec;
+                            sym_spec.GetSymbolFileSpec().SetFile(symfile_path, true);
+                            if (platform_sp)
+                                platform_sp->ResolveSymbolFile(*target, sym_spec, symfile_spec);
+                            else
+                                symfile_spec.SetFile(symfile_path, true);
+                            
+                            ArchSpec arch;
+                            bool symfile_exists = symfile_spec.Exists();
+
+                            if (symfile_exists)
+                            {
+                                if (!AddModuleSymbols (target, symfile_spec, flush, result))
                                     break;
+                            }
+                            else
+                            {
+                                char resolved_symfile_path[PATH_MAX];
+                                if (symfile_spec.GetPath (resolved_symfile_path, sizeof(resolved_symfile_path)))
+                                {
+                                    if (strcmp (resolved_symfile_path, symfile_path) != 0)
+                                    {
+                                        result.AppendErrorWithFormat ("invalid module path '%s' with resolved path '%s'\n", symfile_path, resolved_symfile_path);
+                                        break;
+                                    }
                                 }
+                                result.AppendErrorWithFormat ("invalid module path '%s'\n", symfile_path);
+                                break;
                             }
-                            result.AppendErrorWithFormat ("invalid module path '%s'\n", symfile_path);
-                            break;
                         }
                     }
                 }
@@ -4138,6 +4295,12 @@
         return result.Succeeded();
     }
     
+    OptionGroupOptions m_option_group;
+    OptionGroupUUID m_uuid_option_group;
+    OptionGroupFile m_file_option;
+    OptionGroupBoolean m_current_frame_option;
+
+    
 };
 
 

Modified: lldb/branches/windows/source/Core/ArchSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Core/ArchSpec.cpp?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/source/Core/ArchSpec.cpp (original)
+++ lldb/branches/windows/source/Core/ArchSpec.cpp Fri Sep 28 06:07:34 2012
@@ -10,6 +10,7 @@
 #include "lldb/Core/ArchSpec.h"
 
 #include <stdio.h>
+#include <errno.h>
 
 #include <string>
 
@@ -91,7 +92,9 @@
     { eByteOrderLittle, 4, 1, 15, llvm::Triple::x86    , ArchSpec::eCore_x86_32_i486    , "i486"      },
     { eByteOrderLittle, 4, 1, 15, llvm::Triple::x86    , ArchSpec::eCore_x86_32_i486sx  , "i486sx"    },
 
-    { eByteOrderLittle, 8, 1, 15, llvm::Triple::x86_64 , ArchSpec::eCore_x86_64_x86_64  , "x86_64"    }
+    { eByteOrderLittle, 8, 1, 15, llvm::Triple::x86_64 , ArchSpec::eCore_x86_64_x86_64  , "x86_64"    },
+    { eByteOrderLittle, 4, 4, 4 , llvm::Triple::UnknownArch , ArchSpec::eCore_uknownMach32  , "unknown-mach-32" },
+    { eByteOrderLittle, 8, 4, 4 , llvm::Triple::UnknownArch , ArchSpec::eCore_uknownMach64  , "unknown-mach-64" }
 };
 
 struct ArchDefinitionEntry
@@ -99,6 +102,8 @@
     ArchSpec::Core core;
     uint32_t cpu;
     uint32_t sub;
+    uint32_t cpu_mask;
+    uint32_t sub_mask;
 };
 
 struct ArchDefinition
@@ -106,8 +111,6 @@
     ArchitectureType type;
     size_t num_entries;
     const ArchDefinitionEntry *entries;
-    uint32_t cpu_mask;
-    uint32_t sub_mask;
     const char *name;
 };
 
@@ -141,60 +144,62 @@
 // convert cpu type and subtypes to architecture names, and to convert
 // architecture names to cpu types and subtypes. The ordering is important and
 // allows the precedence to be set when the table is built.
+#define SUBTYPE_MASK 0x00FFFFFFu
 static const ArchDefinitionEntry g_macho_arch_entries[] =
 {
-    { ArchSpec::eCore_arm_generic     , llvm::MachO::CPUTypeARM       , CPU_ANY },
-    { ArchSpec::eCore_arm_generic     , llvm::MachO::CPUTypeARM       , 0       },
-    { ArchSpec::eCore_arm_armv4       , llvm::MachO::CPUTypeARM       , 5       },
-    { ArchSpec::eCore_arm_armv4t      , llvm::MachO::CPUTypeARM       , 5       },
-    { ArchSpec::eCore_arm_armv6       , llvm::MachO::CPUTypeARM       , 6       },
-    { ArchSpec::eCore_arm_armv5       , llvm::MachO::CPUTypeARM       , 7       },
-    { ArchSpec::eCore_arm_armv5e      , llvm::MachO::CPUTypeARM       , 7       },
-    { ArchSpec::eCore_arm_armv5t      , llvm::MachO::CPUTypeARM       , 7       },
-    { ArchSpec::eCore_arm_xscale      , llvm::MachO::CPUTypeARM       , 8       },
-    { ArchSpec::eCore_arm_armv7       , llvm::MachO::CPUTypeARM       , 9       },
-    { ArchSpec::eCore_arm_armv7f      , llvm::MachO::CPUTypeARM       , 10      },
-    { ArchSpec::eCore_arm_armv7k      , llvm::MachO::CPUTypeARM       , 12      },
-    { ArchSpec::eCore_arm_armv7s      , llvm::MachO::CPUTypeARM       , 11      },
-    { ArchSpec::eCore_thumb           , llvm::MachO::CPUTypeARM       , 0       },
-    { ArchSpec::eCore_thumbv4t        , llvm::MachO::CPUTypeARM       , 5       },
-    { ArchSpec::eCore_thumbv5         , llvm::MachO::CPUTypeARM       , 7       },
-    { ArchSpec::eCore_thumbv5e        , llvm::MachO::CPUTypeARM       , 7       },
-    { ArchSpec::eCore_thumbv6         , llvm::MachO::CPUTypeARM       , 6       },
-    { ArchSpec::eCore_thumbv7         , llvm::MachO::CPUTypeARM       , 9       },
-    { ArchSpec::eCore_thumbv7f        , llvm::MachO::CPUTypeARM       , 10      },
-    { ArchSpec::eCore_thumbv7k        , llvm::MachO::CPUTypeARM       , 12      },
-    { ArchSpec::eCore_thumbv7s        , llvm::MachO::CPUTypeARM       , 11      },
-    { ArchSpec::eCore_ppc_generic     , llvm::MachO::CPUTypePowerPC   , CPU_ANY },
-    { ArchSpec::eCore_ppc_generic     , llvm::MachO::CPUTypePowerPC   , 0       },
-    { ArchSpec::eCore_ppc_ppc601      , llvm::MachO::CPUTypePowerPC   , 1       },
-    { ArchSpec::eCore_ppc_ppc602      , llvm::MachO::CPUTypePowerPC   , 2       },
-    { ArchSpec::eCore_ppc_ppc603      , llvm::MachO::CPUTypePowerPC   , 3       },
-    { ArchSpec::eCore_ppc_ppc603e     , llvm::MachO::CPUTypePowerPC   , 4       },
-    { ArchSpec::eCore_ppc_ppc603ev    , llvm::MachO::CPUTypePowerPC   , 5       },
-    { ArchSpec::eCore_ppc_ppc604      , llvm::MachO::CPUTypePowerPC   , 6       },
-    { ArchSpec::eCore_ppc_ppc604e     , llvm::MachO::CPUTypePowerPC   , 7       },
-    { ArchSpec::eCore_ppc_ppc620      , llvm::MachO::CPUTypePowerPC   , 8       },
-    { ArchSpec::eCore_ppc_ppc750      , llvm::MachO::CPUTypePowerPC   , 9       },
-    { ArchSpec::eCore_ppc_ppc7400     , llvm::MachO::CPUTypePowerPC   , 10      },
-    { ArchSpec::eCore_ppc_ppc7450     , llvm::MachO::CPUTypePowerPC   , 11      },
-    { ArchSpec::eCore_ppc_ppc970      , llvm::MachO::CPUTypePowerPC   , 100     },
-    { ArchSpec::eCore_ppc64_generic   , llvm::MachO::CPUTypePowerPC64 , 0       },
-    { ArchSpec::eCore_ppc64_ppc970_64 , llvm::MachO::CPUTypePowerPC64 , 100     },
-    { ArchSpec::eCore_x86_32_i386     , llvm::MachO::CPUTypeI386      , 3       },
-    { ArchSpec::eCore_x86_32_i486     , llvm::MachO::CPUTypeI386      , 4       },
-    { ArchSpec::eCore_x86_32_i486sx   , llvm::MachO::CPUTypeI386      , 0x84    },
-    { ArchSpec::eCore_x86_32_i386     , llvm::MachO::CPUTypeI386      , CPU_ANY },
-    { ArchSpec::eCore_x86_64_x86_64   , llvm::MachO::CPUTypeX86_64    , 3       },
-    { ArchSpec::eCore_x86_64_x86_64   , llvm::MachO::CPUTypeX86_64    , 4       },
-    { ArchSpec::eCore_x86_64_x86_64   , llvm::MachO::CPUTypeX86_64    , CPU_ANY }
+    { ArchSpec::eCore_arm_generic     , llvm::MachO::CPUTypeARM       , CPU_ANY, UINT32_MAX , UINT32_MAX  },
+    { ArchSpec::eCore_arm_generic     , llvm::MachO::CPUTypeARM       , 0      , UINT32_MAX , SUBTYPE_MASK },
+    { ArchSpec::eCore_arm_armv4       , llvm::MachO::CPUTypeARM       , 5      , UINT32_MAX , SUBTYPE_MASK },
+    { ArchSpec::eCore_arm_armv4t      , llvm::MachO::CPUTypeARM       , 5      , UINT32_MAX , SUBTYPE_MASK },
+    { ArchSpec::eCore_arm_armv6       , llvm::MachO::CPUTypeARM       , 6      , UINT32_MAX , SUBTYPE_MASK },
+    { ArchSpec::eCore_arm_armv5       , llvm::MachO::CPUTypeARM       , 7      , UINT32_MAX , SUBTYPE_MASK },
+    { ArchSpec::eCore_arm_armv5e      , llvm::MachO::CPUTypeARM       , 7      , UINT32_MAX , SUBTYPE_MASK },
+    { ArchSpec::eCore_arm_armv5t      , llvm::MachO::CPUTypeARM       , 7      , UINT32_MAX , SUBTYPE_MASK },
+    { ArchSpec::eCore_arm_xscale      , llvm::MachO::CPUTypeARM       , 8      , UINT32_MAX , SUBTYPE_MASK },
+    { ArchSpec::eCore_arm_armv7       , llvm::MachO::CPUTypeARM       , 9      , UINT32_MAX , SUBTYPE_MASK },
+    { ArchSpec::eCore_arm_armv7f      , llvm::MachO::CPUTypeARM       , 10     , UINT32_MAX , SUBTYPE_MASK },
+    { ArchSpec::eCore_arm_armv7k      , llvm::MachO::CPUTypeARM       , 12     , UINT32_MAX , SUBTYPE_MASK },
+    { ArchSpec::eCore_arm_armv7s      , llvm::MachO::CPUTypeARM       , 11     , UINT32_MAX , SUBTYPE_MASK },
+    { ArchSpec::eCore_thumb           , llvm::MachO::CPUTypeARM       , 0      , UINT32_MAX , SUBTYPE_MASK },
+    { ArchSpec::eCore_thumbv4t        , llvm::MachO::CPUTypeARM       , 5      , UINT32_MAX , SUBTYPE_MASK },
+    { ArchSpec::eCore_thumbv5         , llvm::MachO::CPUTypeARM       , 7      , UINT32_MAX , SUBTYPE_MASK },
+    { ArchSpec::eCore_thumbv5e        , llvm::MachO::CPUTypeARM       , 7      , UINT32_MAX , SUBTYPE_MASK },
+    { ArchSpec::eCore_thumbv6         , llvm::MachO::CPUTypeARM       , 6      , UINT32_MAX , SUBTYPE_MASK },
+    { ArchSpec::eCore_thumbv7         , llvm::MachO::CPUTypeARM       , 9      , UINT32_MAX , SUBTYPE_MASK },
+    { ArchSpec::eCore_thumbv7f        , llvm::MachO::CPUTypeARM       , 10     , UINT32_MAX , SUBTYPE_MASK },
+    { ArchSpec::eCore_thumbv7k        , llvm::MachO::CPUTypeARM       , 12     , UINT32_MAX , SUBTYPE_MASK },
+    { ArchSpec::eCore_thumbv7s        , llvm::MachO::CPUTypeARM       , 11     , UINT32_MAX , SUBTYPE_MASK },
+    { ArchSpec::eCore_ppc_generic     , llvm::MachO::CPUTypePowerPC   , CPU_ANY, UINT32_MAX , UINT32_MAX  },
+    { ArchSpec::eCore_ppc_generic     , llvm::MachO::CPUTypePowerPC   , 0      , UINT32_MAX , SUBTYPE_MASK },
+    { ArchSpec::eCore_ppc_ppc601      , llvm::MachO::CPUTypePowerPC   , 1      , UINT32_MAX , SUBTYPE_MASK },
+    { ArchSpec::eCore_ppc_ppc602      , llvm::MachO::CPUTypePowerPC   , 2      , UINT32_MAX , SUBTYPE_MASK },
+    { ArchSpec::eCore_ppc_ppc603      , llvm::MachO::CPUTypePowerPC   , 3      , UINT32_MAX , SUBTYPE_MASK },
+    { ArchSpec::eCore_ppc_ppc603e     , llvm::MachO::CPUTypePowerPC   , 4      , UINT32_MAX , SUBTYPE_MASK },
+    { ArchSpec::eCore_ppc_ppc603ev    , llvm::MachO::CPUTypePowerPC   , 5      , UINT32_MAX , SUBTYPE_MASK },
+    { ArchSpec::eCore_ppc_ppc604      , llvm::MachO::CPUTypePowerPC   , 6      , UINT32_MAX , SUBTYPE_MASK },
+    { ArchSpec::eCore_ppc_ppc604e     , llvm::MachO::CPUTypePowerPC   , 7      , UINT32_MAX , SUBTYPE_MASK },
+    { ArchSpec::eCore_ppc_ppc620      , llvm::MachO::CPUTypePowerPC   , 8      , UINT32_MAX , SUBTYPE_MASK },
+    { ArchSpec::eCore_ppc_ppc750      , llvm::MachO::CPUTypePowerPC   , 9      , UINT32_MAX , SUBTYPE_MASK },
+    { ArchSpec::eCore_ppc_ppc7400     , llvm::MachO::CPUTypePowerPC   , 10     , UINT32_MAX , SUBTYPE_MASK },
+    { ArchSpec::eCore_ppc_ppc7450     , llvm::MachO::CPUTypePowerPC   , 11     , UINT32_MAX , SUBTYPE_MASK },
+    { ArchSpec::eCore_ppc_ppc970      , llvm::MachO::CPUTypePowerPC   , 100    , UINT32_MAX , SUBTYPE_MASK },
+    { ArchSpec::eCore_ppc64_generic   , llvm::MachO::CPUTypePowerPC64 , 0      , UINT32_MAX , SUBTYPE_MASK },
+    { ArchSpec::eCore_ppc64_ppc970_64 , llvm::MachO::CPUTypePowerPC64 , 100    , UINT32_MAX , SUBTYPE_MASK },
+    { ArchSpec::eCore_x86_32_i386     , llvm::MachO::CPUTypeI386      , 3      , UINT32_MAX , SUBTYPE_MASK },
+    { ArchSpec::eCore_x86_32_i486     , llvm::MachO::CPUTypeI386      , 4      , UINT32_MAX , SUBTYPE_MASK },
+    { ArchSpec::eCore_x86_32_i486sx   , llvm::MachO::CPUTypeI386      , 0x84   , UINT32_MAX , SUBTYPE_MASK },
+    { ArchSpec::eCore_x86_32_i386     , llvm::MachO::CPUTypeI386      , CPU_ANY, UINT32_MAX , UINT32_MAX  },
+    { ArchSpec::eCore_x86_64_x86_64   , llvm::MachO::CPUTypeX86_64    , 3      , UINT32_MAX , SUBTYPE_MASK },
+    { ArchSpec::eCore_x86_64_x86_64   , llvm::MachO::CPUTypeX86_64    , 4      , UINT32_MAX , SUBTYPE_MASK },
+    { ArchSpec::eCore_x86_64_x86_64   , llvm::MachO::CPUTypeX86_64    , CPU_ANY, UINT32_MAX , UINT32_MAX  },
+    // Catch any unknown mach architectures so we can always use the object and symbol mach-o files
+    { ArchSpec::eCore_uknownMach32    , 0                             , 0      , 0xFF000000u, 0x00000000u },
+    { ArchSpec::eCore_uknownMach64    , llvm::MachO::CPUArchABI64     , 0      , 0xFF000000u, 0x00000000u }
 };
 static const ArchDefinition g_macho_arch_def = {
     eArchTypeMachO,
     sizeof(g_macho_arch_entries)/sizeof(g_macho_arch_entries[0]),
     g_macho_arch_entries,
-    UINT32_MAX,     // CPU type mask
-    0x00FFFFFFu,    // CPU subtype mask
     "mach-o"
 };
 
@@ -205,22 +210,20 @@
 // allows the precedence to be set when the table is built.
 static const ArchDefinitionEntry g_elf_arch_entries[] =
 {
-    { ArchSpec::eCore_sparc_generic   , llvm::ELF::EM_SPARC  , LLDB_INVALID_CPUTYPE }, // Sparc
-    { ArchSpec::eCore_x86_32_i386     , llvm::ELF::EM_386    , LLDB_INVALID_CPUTYPE }, // Intel 80386
-    { ArchSpec::eCore_x86_32_i486     , llvm::ELF::EM_486    , LLDB_INVALID_CPUTYPE }, // Intel 486 (deprecated)
-    { ArchSpec::eCore_ppc_generic     , llvm::ELF::EM_PPC    , LLDB_INVALID_CPUTYPE }, // PowerPC
-    { ArchSpec::eCore_ppc64_generic   , llvm::ELF::EM_PPC64  , LLDB_INVALID_CPUTYPE }, // PowerPC64
-    { ArchSpec::eCore_arm_generic     , llvm::ELF::EM_ARM    , LLDB_INVALID_CPUTYPE }, // ARM
-    { ArchSpec::eCore_sparc9_generic  , llvm::ELF::EM_SPARCV9, LLDB_INVALID_CPUTYPE }, // SPARC V9
-    { ArchSpec::eCore_x86_64_x86_64   , llvm::ELF::EM_X86_64 , LLDB_INVALID_CPUTYPE }, // AMD64
+    { ArchSpec::eCore_sparc_generic   , llvm::ELF::EM_SPARC  , LLDB_INVALID_CPUTYPE, 0xFFFFFFFFu, 0xFFFFFFFFu }, // Sparc
+    { ArchSpec::eCore_x86_32_i386     , llvm::ELF::EM_386    , LLDB_INVALID_CPUTYPE, 0xFFFFFFFFu, 0xFFFFFFFFu }, // Intel 80386
+    { ArchSpec::eCore_x86_32_i486     , llvm::ELF::EM_486    , LLDB_INVALID_CPUTYPE, 0xFFFFFFFFu, 0xFFFFFFFFu }, // Intel 486 (deprecated)
+    { ArchSpec::eCore_ppc_generic     , llvm::ELF::EM_PPC    , LLDB_INVALID_CPUTYPE, 0xFFFFFFFFu, 0xFFFFFFFFu }, // PowerPC
+    { ArchSpec::eCore_ppc64_generic   , llvm::ELF::EM_PPC64  , LLDB_INVALID_CPUTYPE, 0xFFFFFFFFu, 0xFFFFFFFFu }, // PowerPC64
+    { ArchSpec::eCore_arm_generic     , llvm::ELF::EM_ARM    , LLDB_INVALID_CPUTYPE, 0xFFFFFFFFu, 0xFFFFFFFFu }, // ARM
+    { ArchSpec::eCore_sparc9_generic  , llvm::ELF::EM_SPARCV9, LLDB_INVALID_CPUTYPE, 0xFFFFFFFFu, 0xFFFFFFFFu }, // SPARC V9
+    { ArchSpec::eCore_x86_64_x86_64   , llvm::ELF::EM_X86_64 , LLDB_INVALID_CPUTYPE, 0xFFFFFFFFu, 0xFFFFFFFFu }  // AMD64
 };
 
 static const ArchDefinition g_elf_arch_def = {
     eArchTypeELF,
     sizeof(g_elf_arch_entries)/sizeof(g_elf_arch_entries[0]),
     g_elf_arch_entries,
-    UINT32_MAX,     // CPU type mask
-    UINT32_MAX,     // CPU subtype mask
     "elf",
 };
 
@@ -228,7 +231,7 @@
 // Table of all ArchDefinitions
 static const ArchDefinition *g_arch_definitions[] = {
     &g_macho_arch_def,
-    &g_elf_arch_def,
+    &g_elf_arch_def
 };
 
 static const size_t k_num_arch_definitions =
@@ -278,14 +281,12 @@
     if (def == NULL)
         return NULL;
 
-    const uint32_t cpu_mask = def->cpu_mask;
-    const uint32_t sub_mask = def->sub_mask;
     const ArchDefinitionEntry *entries = def->entries;
     for (size_t i = 0; i < def->num_entries; ++i)
     {
-        if ((entries[i].cpu == (cpu_mask & cpu)) &&
-            (entries[i].sub == (sub_mask & sub)))
-            return &entries[i];
+        if (entries[i].cpu == (cpu & entries[i].cpu_mask))
+            if (entries[i].sub == (sub & entries[i].sub_mask))
+                return &entries[i];
     }
     return NULL;
 }
@@ -483,49 +484,59 @@
     return IsValid();
 }
 
-bool
-ArchSpec::SetTriple (const char *triple_cstr)
+static bool
+ParseMachCPUDashSubtypeTriple (const char *triple_cstr, ArchSpec &arch)
 {
-    if (triple_cstr && triple_cstr[0])
+    // Accept "12-10" or "12.10" as cpu type/subtype
+    if (isdigit(triple_cstr[0]))
     {
-        if (isdigit(triple_cstr[0]))
-        {
-            // Accept "12-10" or "12.10" as cpu type/subtype
-            char *end = NULL;
-            uint32_t cpu = ::strtoul (triple_cstr, &end, 0);
-            if (cpu != 0 && end && ((*end == '-') || (*end == '.')))
+        char *end = NULL;
+        errno = 0;
+        uint32_t cpu = ::strtoul (triple_cstr, &end, 0);
+        if (errno == 0 && cpu != 0 && end && ((*end == '-') || (*end == '.')))
+        {
+            errno = 0;
+            uint32_t sub = ::strtoul (end + 1, &end, 0);
+            if (errno == 0 && end && ((*end == '-') || (*end == '.') || (*end == '\0')))
             {
-                uint32_t sub = ::strtoul (end + 1, &end, 0);
-                if (sub != 0 && end && ((*end == '-') || (*end == '.') || (*end == '\0')))
+                if (arch.SetArchitecture (eArchTypeMachO, cpu, sub))
                 {
-                    if (SetArchitecture (eArchTypeMachO, cpu, sub))
+                    if (*end == '-')
                     {
-                        if (*end == '-')
+                        llvm::StringRef vendor_os (end + 1);
+                        size_t dash_pos = vendor_os.find('-');
+                        if (dash_pos != llvm::StringRef::npos)
                         {
-                            llvm::StringRef vendor_os (end + 1);
-                            size_t dash_pos = vendor_os.find('-');
-                            if (dash_pos != llvm::StringRef::npos)
+                            llvm::StringRef vendor_str(vendor_os.substr(0, dash_pos));
+                            arch.GetTriple().setVendorName(vendor_str);
+                            const size_t vendor_start_pos = dash_pos+1;
+                            dash_pos = vendor_os.find(vendor_start_pos, '-');
+                            if (dash_pos == llvm::StringRef::npos)
+                            {
+                                if (vendor_start_pos < vendor_os.size())
+                                    arch.GetTriple().setOSName(vendor_os.substr(vendor_start_pos));
+                            }
+                            else
                             {
-                                llvm::StringRef vendor_str(vendor_os.substr(0, dash_pos));
-                                m_triple.setVendorName(vendor_str);
-                                const size_t vendor_start_pos = dash_pos+1;
-                                dash_pos = vendor_os.find(vendor_start_pos, '-');
-                                if (dash_pos == llvm::StringRef::npos)
-                                {
-                                    if (vendor_start_pos < vendor_os.size())
-                                        m_triple.setOSName(vendor_os.substr(vendor_start_pos));
-                                }
-                                else
-                                {
-                                    m_triple.setOSName(vendor_os.substr(vendor_start_pos, dash_pos - vendor_start_pos));
-                                }
+                                arch.GetTriple().setOSName(vendor_os.substr(vendor_start_pos, dash_pos - vendor_start_pos));
                             }
                         }
-                        return true;
                     }
+                    return true;
                 }
             }
         }
+    }
+    return false;
+}
+bool
+ArchSpec::SetTriple (const char *triple_cstr)
+{
+    if (triple_cstr && triple_cstr[0])
+    {
+        if (ParseMachCPUDashSubtypeTriple (triple_cstr, *this))
+            return true;
+        
         llvm::StringRef triple_stref (triple_cstr);
         if (triple_stref.startswith (LLDB_ARCH_DEFAULT))
         {
@@ -554,6 +565,9 @@
 {
     if (triple_cstr && triple_cstr[0])
     {
+        if (ParseMachCPUDashSubtypeTriple (triple_cstr, *this))
+            return true;
+        
         llvm::StringRef triple_stref (triple_cstr);
         if (triple_stref.startswith (LLDB_ARCH_DEFAULT))
         {

Modified: lldb/branches/windows/source/Core/ModuleList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Core/ModuleList.cpp?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/source/Core/ModuleList.cpp (original)
+++ lldb/branches/windows/source/Core/ModuleList.cpp Fri Sep 28 06:07:34 2012
@@ -643,8 +643,14 @@
 static ModuleList &
 GetSharedModuleList ()
 {
-    static ModuleList g_shared_module_list;
-    return g_shared_module_list;
+    // NOTE: Intentionally leak the module list so a program doesn't have to
+    // cleanup all modules and object files as it exits. This just wastes time
+    // doing a bunch of cleanup that isn't required.
+    static ModuleList *g_shared_module_list = NULL;
+    if (g_shared_module_list == NULL)
+        g_shared_module_list = new ModuleList(); // <--- Intentional leak!!!
+    
+    return *g_shared_module_list;
 }
 
 bool

Modified: lldb/branches/windows/source/Core/UUID.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Core/UUID.cpp?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/source/Core/UUID.cpp (original)
+++ lldb/branches/windows/source/Core/UUID.cpp Fri Sep 28 06:07:34 2012
@@ -66,9 +66,12 @@
 UUID::GetAsCString (char *dst, size_t dst_len) const
 {
     const uint8_t *u = (const uint8_t *)GetBytes();
-    snprintf(dst, dst_len, "%2.2X%2.2X%2.2X%2.2X-%2.2X%2.2X-%2.2X%2.2X-%2.2X%2.2X-%2.2X%2.2X%2.2X%2.2X%2.2X%2.2X",
-             u[0],u[1],u[2],u[3],u[4],u[5],u[6],u[7],u[8],u[9],u[10],u[11],u[12],u[13],u[14],u[15]);
-    return dst;
+    if (dst_len > snprintf (dst,
+                            dst_len,
+                            "%2.2X%2.2X%2.2X%2.2X-%2.2X%2.2X-%2.2X%2.2X-%2.2X%2.2X-%2.2X%2.2X%2.2X%2.2X%2.2X%2.2X",
+                            u[0],u[1],u[2],u[3],u[4],u[5],u[6],u[7],u[8],u[9],u[10],u[11],u[12],u[13],u[14],u[15]))
+        return dst;
+    return NULL;
 }
 
 void
@@ -125,47 +128,58 @@
 }
 
 size_t
-UUID::SetfromCString (const char *cstr)
+UUID::DecodeUUIDBytesFromCString (const char *p, ValueType &uuid_bytes, const char **end)
+{
+    size_t uuid_byte_idx = 0;
+    if (p)
+    {
+        while (*p)
+        {
+            if (isxdigit(p[0]) && isxdigit(p[1]))
+            {
+                int hi_nibble = xdigit_to_int(p[0]);
+                int lo_nibble = xdigit_to_int(p[1]);
+                // Translate the two hex nibble characters into a byte
+                uuid_bytes[uuid_byte_idx] = (hi_nibble << 4) + lo_nibble;
+                
+                // Skip both hex digits
+                p += 2;
+                
+                // Increment the byte that we are decoding within the UUID value
+                // and break out if we are done
+                if (++uuid_byte_idx == 16)
+                    break;
+            }
+            else if (*p == '-')
+            {
+                // Skip dashes
+                p++;
+            }
+            else
+            {
+                // UUID values can only consist of hex characters and '-' chars
+                break;
+            }
+        }
+    }
+    if (end)
+        *end = p;
+    return uuid_byte_idx;
+}
+size_t
+UUID::SetFromCString (const char *cstr)
 {
     if (cstr == NULL)
         return 0;
 
-    uint32_t uuid_byte_idx = 0;
     const char *p = cstr;
 
     // Skip leading whitespace characters
     while (isspace(*p))
         ++p;
+    
+    const uint32_t uuid_byte_idx = UUID::DecodeUUIDBytesFromCString (p, m_uuid, &p);
 
-    // Try and decode a UUID
-    while (*p != '\0')
-    {
-        if (isxdigit(*p) && isxdigit(p[1]))
-        {
-            int hi_nibble = xdigit_to_int(p[0]);
-            int lo_nibble = xdigit_to_int(p[1]);
-            // Translate the two hex nibble characters into a byte
-            m_uuid[uuid_byte_idx] = (hi_nibble << 4) + lo_nibble;
-
-            // Skip both hex digits
-            p += 2;
-
-            // Increment the byte that we are decoding within the UUID value
-            // and break out if we are done
-            if (++uuid_byte_idx == 16)
-                break;
-        }
-        else if (*p == '-')
-        {
-            // Skip dashes
-            p++;
-        }
-        else
-        {
-            // UUID values can only consist of hex characters and '-' chars
-            return 0;
-        }
-    }
     // If we successfully decoded a UUID, return the amount of characters that
     // were consumed
     if (uuid_byte_idx == 16)

Modified: lldb/branches/windows/source/Expression/ASTStructExtractor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Expression/ASTStructExtractor.cpp?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/source/Expression/ASTStructExtractor.cpp (original)
+++ lldb/branches/windows/source/Expression/ASTStructExtractor.cpp Fri Sep 28 06:07:34 2012
@@ -59,13 +59,44 @@
 void
 ASTStructExtractor::ExtractFromFunctionDecl(FunctionDecl *F)
 {
-    DeclarationName struct_name(&m_ast_context->Idents.get(m_struct_name.c_str()));
-    RecordDecl::lookup_result struct_lookup = F->lookup(struct_name);
-    
-    if (struct_lookup.first == struct_lookup.second)
+    if (!F->hasBody())
         return;
     
-    RecordDecl *struct_decl = dyn_cast<RecordDecl>(*(struct_lookup.first));
+    Stmt *body_stmt = F->getBody();
+    CompoundStmt *body_compound_stmt = dyn_cast<CompoundStmt>(body_stmt);
+    
+    if (!body_compound_stmt)
+        return; // do we have to handle this?
+    
+    RecordDecl *struct_decl = NULL;
+    
+    StringRef desired_name(m_struct_name.c_str());
+    
+    for (CompoundStmt::const_body_iterator bi = body_compound_stmt->body_begin(), be = body_compound_stmt->body_end();
+         bi != be;
+         ++bi)
+    {
+        Stmt *curr_stmt = *bi;
+        DeclStmt *curr_decl_stmt = dyn_cast<DeclStmt>(curr_stmt);
+        if (!curr_decl_stmt)
+            continue;
+        DeclGroupRef decl_group = curr_decl_stmt->getDeclGroup();
+        
+        for (DeclGroupRef::iterator di = decl_group.begin(), de = decl_group.end(); di != de; ++di)
+        {
+            Decl *candidate_decl = *di;
+            RecordDecl *candidate_record_decl = dyn_cast<RecordDecl>(candidate_decl);
+            if (!candidate_record_decl)
+                continue;
+            if (candidate_record_decl->getName() == desired_name)
+            {
+                struct_decl = candidate_record_decl;
+                break;
+            }
+        }
+        if (struct_decl)
+            break;
+    }
     
     if (!struct_decl)
         return;

Modified: lldb/branches/windows/source/Expression/ClangASTSource.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Expression/ClangASTSource.cpp?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/source/Expression/ClangASTSource.cpp (original)
+++ lldb/branches/windows/source/Expression/ClangASTSource.cpp Fri Sep 28 06:07:34 2012
@@ -313,8 +313,45 @@
     }
 }
 
+clang::ObjCInterfaceDecl *
+ClangASTSource::GetCompleteObjCInterface (clang::ObjCInterfaceDecl *interface_decl)
+{
+    lldb::ProcessSP process(m_target->GetProcessSP());
+    
+    if (!process)
+        return NULL;
+    
+    ObjCLanguageRuntime *language_runtime(process->GetObjCLanguageRuntime());
+    
+    if (!language_runtime)
+        return NULL;
+        
+    ConstString class_name(interface_decl->getNameAsString().c_str());
+    
+    lldb::TypeSP complete_type_sp(language_runtime->LookupInCompleteClassCache(class_name));
+    
+    if (!complete_type_sp)
+        return NULL;
+    
+    TypeFromUser complete_type = TypeFromUser(complete_type_sp->GetClangFullType(), complete_type_sp->GetClangAST());
+    lldb::clang_type_t complete_opaque_type = complete_type.GetOpaqueQualType();
+    
+    if (!complete_opaque_type)
+        return NULL;
+    
+    const clang::Type *complete_clang_type = QualType::getFromOpaquePtr(complete_opaque_type).getTypePtr();
+    const ObjCInterfaceType *complete_interface_type = dyn_cast<ObjCInterfaceType>(complete_clang_type);
+    
+    if (!complete_interface_type)
+        return NULL;
+    
+    ObjCInterfaceDecl *complete_iface_decl(complete_interface_type->getDecl());
+    
+    return complete_iface_decl;
+}
+
 clang::ExternalLoadResult
-ClangASTSource::FindExternalLexicalDecls (const DeclContext *decl_context, 
+ClangASTSource::FindExternalLexicalDecls (const DeclContext *decl_context,
                                           bool (*predicate)(Decl::Kind),
                                           llvm::SmallVectorImpl<Decl*> &decls)
 {    
@@ -364,6 +401,19 @@
         ASTDumper(original_decl).ToLog(log, "    ");
     }
     
+    if (ObjCInterfaceDecl *original_iface_decl = dyn_cast<ObjCInterfaceDecl>(original_decl))
+    {
+        ObjCInterfaceDecl *complete_iface_decl = GetCompleteObjCInterface(original_iface_decl);
+        
+        if (complete_iface_decl && (complete_iface_decl != original_iface_decl))
+        {
+            original_decl = complete_iface_decl;
+            original_ctx = &complete_iface_decl->getASTContext();
+            
+            m_ast_importer->SetDeclOrigin(context_decl, original_iface_decl);
+        }
+    }
+    
     if (TagDecl *original_tag_decl = dyn_cast<TagDecl>(original_decl))
     {
         ExternalASTSource *external_source = original_ctx->getExternalSource();
@@ -389,9 +439,9 @@
             {
                 ASTDumper ast_dumper(decl);
                 if (const NamedDecl *context_named_decl = dyn_cast<NamedDecl>(context_decl))
-                    log->Printf("  FELD[%d] Adding [to %s] lexical decl %s", current_id, context_named_decl->getNameAsString().c_str(), ast_dumper.GetCString());
+                    log->Printf("  FELD[%d] Adding [to %sDecl %s] lexical %sDecl %s", current_id, context_named_decl->getDeclKindName(), context_named_decl->getNameAsString().c_str(), decl->getDeclKindName(), ast_dumper.GetCString());
                 else
-                    log->Printf("  FELD[%d] Adding lexical decl %s", current_id, ast_dumper.GetCString());
+                    log->Printf("  FELD[%d] Adding lexical %sDecl %s", current_id, decl->getDeclKindName(), ast_dumper.GetCString());
             }
             
             Decl *copied_decl = m_ast_importer->CopyDecl(m_ast_context, original_ctx, decl);
@@ -1132,26 +1182,12 @@
     
     do
     {
-        // First see if any other debug information has this property/ivar.
-        
-        lldb::TypeSP complete_type_sp(language_runtime->LookupInCompleteClassCache(class_name));
-        
-        if (!complete_type_sp)
-            break;
-        
-        TypeFromUser complete_type = TypeFromUser(complete_type_sp->GetClangFullType(), complete_type_sp->GetClangAST());
-        lldb::clang_type_t complete_opaque_type = complete_type.GetOpaqueQualType();
-        
-        if (!complete_opaque_type)
-            break;
-        
-        const clang::Type *complete_clang_type = QualType::getFromOpaquePtr(complete_opaque_type).getTypePtr();
-        const ObjCInterfaceType *complete_interface_type = dyn_cast<ObjCInterfaceType>(complete_clang_type);
+        ObjCInterfaceDecl *complete_interface_decl = GetCompleteObjCInterface(const_cast<ObjCInterfaceDecl*>(parser_iface_decl.decl));
         
-        if (!complete_interface_type)
+        if (!complete_interface_decl)
             break;
         
-        DeclFromUser<const ObjCInterfaceDecl> complete_iface_decl(complete_interface_type->getDecl());
+        DeclFromUser<const ObjCInterfaceDecl> complete_iface_decl(complete_interface_decl);
         
         if (complete_iface_decl.decl == origin_iface_decl.decl)
             break; // already checked this one

Modified: lldb/branches/windows/source/Expression/ClangExpressionDeclMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Expression/ClangExpressionDeclMap.cpp?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/source/Expression/ClangExpressionDeclMap.cpp (original)
+++ lldb/branches/windows/source/Expression/ClangExpressionDeclMap.cpp Fri Sep 28 06:07:34 2012
@@ -481,6 +481,8 @@
     if (!var_sp)
         return false;
     
+    var_sp->m_frozen_sp->SetHasCompleteType();
+    
     if (is_result)
         var_sp->m_flags |= ClangExpressionVariable::EVNeedsFreezeDry;
     else
@@ -1665,7 +1667,7 @@
                 mem = var_sp->m_live_sp->GetValue().GetScalar().ULongLong();
                 
                 if (log)
-                    log->Printf("Dematerializing %s from 0x%llx", var_sp->GetName().GetCString(), (uint64_t)mem);
+                    log->Printf("Dematerializing %s from 0x%llx (size = %u)", var_sp->GetName().GetCString(), (uint64_t)mem, (unsigned)pvar_byte_size);
                 
                 // Read the contents of the spare memory area
                                 

Modified: lldb/branches/windows/source/Expression/ClangExpressionParser.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Expression/ClangExpressionParser.cpp?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/source/Expression/ClangExpressionParser.cpp (original)
+++ lldb/branches/windows/source/Expression/ClangExpressionParser.cpp Fri Sep 28 06:07:34 2012
@@ -43,17 +43,14 @@
 #include "clang/Frontend/TextDiagnosticPrinter.h"
 #include "clang/Lex/Preprocessor.h"
 #include "clang/Parse/ParseAST.h"
-#include "clang/Basic/Version.h"
-#if CLANG_VERSION_MAJOR > 3 || (CLANG_VERSION_MAJOR == 3 && CLANG_VERSION_MINOR  >= 2)
 #include "clang/Rewrite/Frontend/FrontendActions.h"
-#else
-#include "clang/Rewrite/FrontendActions.h"
-#endif
+
 #include "clang/Sema/SemaConsumer.h"
 #include "clang/StaticAnalyzer/Frontend/FrontendActions.h"
 
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ExecutionEngine/ExecutionEngine.h"
+#include "llvm/Support/Debug.h"
 #include "llvm/Support/TargetSelect.h"
 
 #if !defined(__APPLE__)
@@ -204,11 +201,56 @@
             llvm::DisablePrettyStackTrace = true;
         }
     } InitializeLLVM;
-        
+    
     // 1. Create a new compiler instance.
     m_compiler.reset(new CompilerInstance());    
     
-    // 2. Set options.
+    // 2. Install the target.
+
+    lldb::TargetSP target_sp;
+    if (exe_scope)
+        target_sp = exe_scope->CalculateTarget();
+    
+    // TODO: figure out what to really do when we don't have a valid target.
+    // Sometimes this will be ok to just use the host target triple (when we
+    // evaluate say "2+3", but other expressions like breakpoint conditions
+    // and other things that _are_ target specific really shouldn't just be
+    // using the host triple. This needs to be fixed in a better way.
+    if (target_sp && target_sp->GetArchitecture().IsValid())
+    {
+        std::string triple = target_sp->GetArchitecture().GetTriple().str();
+        
+        int dash_count = 0;
+        for (size_t i = 0; i < triple.size(); ++i)
+        {
+            if (triple[i] == '-')
+                dash_count++;
+            if (dash_count == 3)
+            {
+                triple.resize(i);
+                break;
+            }
+        }
+        
+        m_compiler->getTargetOpts().Triple = triple;
+    }
+    else
+    {
+        m_compiler->getTargetOpts().Triple = llvm::sys::getDefaultTargetTriple();
+    }
+    
+    if (m_compiler->getTargetOpts().Triple.find("ios") != std::string::npos)
+        m_compiler->getTargetOpts().ABI = "apcs-gnu";
+    
+    m_compiler->createDiagnostics(0, 0);
+    
+    // Create the target instance.
+    m_compiler->setTarget(TargetInfo::CreateTargetInfo(m_compiler->getDiagnostics(),
+                                                       m_compiler->getTargetOpts()));
+    
+    assert (m_compiler->hasTarget());
+    
+    // 3. Set options.
     
     lldb::LanguageType language = expr.Language();
     
@@ -252,17 +294,13 @@
         if (process_sp->GetObjCLanguageRuntime())
         {
             if (process_sp->GetObjCLanguageRuntime()->GetRuntimeVersion() == eAppleObjC_V2)
-            {
-#if CLANG_MAJOR_VERSION == 3 && CLANG_MINOR_VERSION < 2
-                m_compiler->getLangOpts().ObjCNonFragileABI = true;     // NOT i386
-                m_compiler->getLangOpts().ObjCNonFragileABI2 = true;    // NOT i386
-#endif
-            }
+                m_compiler->getLangOpts().ObjCRuntime.set(ObjCRuntime::MacOSX, VersionTuple(10, 7));
+            else
+                m_compiler->getLangOpts().ObjCRuntime.set(ObjCRuntime::FragileMacOSX, VersionTuple(10, 7));
+
             
             if (process_sp->GetObjCLanguageRuntime()->HasNewLiteralsAndIndexing())
-            {
                 m_compiler->getLangOpts().DebuggerObjCLiteral = true;
-            }
         }
     }
 
@@ -277,51 +315,6 @@
     // Disable some warnings.
     m_compiler->getDiagnosticOpts().Warnings.push_back("no-unused-value");
     
-    // Set the target triple.
-    lldb::TargetSP target_sp;
-    if (exe_scope)
-        target_sp = exe_scope->CalculateTarget();
-
-    // TODO: figure out what to really do when we don't have a valid target.
-    // Sometimes this will be ok to just use the host target triple (when we
-    // evaluate say "2+3", but other expressions like breakpoint conditions
-    // and other things that _are_ target specific really shouldn't just be 
-    // using the host triple. This needs to be fixed in a better way.
-    if (target_sp && target_sp->GetArchitecture().IsValid())
-    {
-        std::string triple = target_sp->GetArchitecture().GetTriple().str();
-        
-        int dash_count = 0;
-        for (size_t i = 0; i < triple.size(); ++i)
-        {
-            if (triple[i] == '-')
-                dash_count++;
-            if (dash_count == 3)
-            {
-                triple.resize(i);
-                break;
-            }
-        }
-        
-        m_compiler->getTargetOpts().Triple = triple;
-    }
-    else
-    {
-        m_compiler->getTargetOpts().Triple = llvm::sys::getDefaultTargetTriple();
-    }
-    
-    if (m_compiler->getTargetOpts().Triple.find("ios") != std::string::npos)
-        m_compiler->getTargetOpts().ABI = "apcs-gnu";
-        
-    // 3. Set up various important bits of infrastructure.
-    m_compiler->createDiagnostics(0, 0);
-    
-    // Create the target instance.
-    m_compiler->setTarget(TargetInfo::CreateTargetInfo(m_compiler->getDiagnostics(),
-                                                       m_compiler->getTargetOpts()));
-    
-    assert (m_compiler->hasTarget());
-    
     // Inform the target of the language options
     //
     // FIXME: We shouldn't need to do this, the target should be immutable once
@@ -516,7 +509,7 @@
                                   error_stream,
                                   function_name.c_str());
         
-        ir_for_target.runOnModule(*module);
+        bool ir_can_run = ir_for_target.runOnModule(*module);
         
         Error &interpreter_error(ir_for_target.getInterpreterError());
         
@@ -541,6 +534,13 @@
 
             return err;
         }
+        else if (!ir_can_run)
+        {
+            err.SetErrorToGenericError();
+            err.SetErrorString("The expression could not be prepared to run in the target");
+            
+            return err;
+        }
         
         if (execution_policy != eExecutionPolicyNever &&
             m_expr.NeedsValidation() && 
@@ -606,7 +606,18 @@
         .setAllocateGVsWithCode(true)
         .setCodeModel(CodeModel::Small)
         .setUseMCJIT(true);
-    execution_engine.reset(builder.create());
+    
+    llvm::Triple triple(module->getTargetTriple());
+    StringRef mArch;
+    StringRef mCPU;
+    SmallVector<std::string, 0> mAttrs;
+    
+    TargetMachine *target_machine = builder.selectTarget(triple,
+                                                         mArch,
+                                                         mCPU,
+                                                         mAttrs);
+    
+    execution_engine.reset(builder.create(target_machine));
         
     if (!execution_engine.get())
     {

Modified: lldb/branches/windows/source/Expression/IRForTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Expression/IRForTarget.cpp?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/source/Expression/IRForTarget.cpp (original)
+++ lldb/branches/windows/source/Expression/IRForTarget.cpp Fri Sep 28 06:07:34 2012
@@ -15,7 +15,9 @@
 #include "llvm/Instructions.h"
 #include "llvm/Intrinsics.h"
 #include "llvm/Module.h"
+#include "llvm/PassManager.h"
 #include "llvm/Target/TargetData.h"
+#include "llvm/Transforms/IPO.h"
 #include "llvm/ValueSymbolTable.h"
 
 #include "clang/AST/ASTContext.h"
@@ -2630,6 +2632,55 @@
 }
 
 bool
+IRForTarget::StripAllGVs (Module &llvm_module)
+{
+    lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));    
+    std::vector<GlobalVariable *> global_vars;
+    std::set<GlobalVariable *>erased_vars;
+    
+    bool erased = true;
+    
+    while (erased)
+    {
+        erased = false;
+        
+        for (Module::global_iterator gi = llvm_module.global_begin(), ge = llvm_module.global_end();
+             gi != ge;
+             ++gi)
+        {
+            GlobalVariable *global_var = dyn_cast<GlobalVariable>(gi);
+        
+            global_var->removeDeadConstantUsers();
+            
+            if (global_var->use_empty())
+            {
+                if (log)
+                    log->Printf("Did remove %s",
+                                PrintValue(global_var).c_str());
+                global_var->eraseFromParent();
+                erased = true;
+                break;
+            }
+        }
+    }
+    
+    for (Module::global_iterator gi = llvm_module.global_begin(), ge = llvm_module.global_end();
+         gi != ge;
+         ++gi)
+    {
+        GlobalVariable *global_var = dyn_cast<GlobalVariable>(gi);
+
+        GlobalValue::use_iterator ui = global_var->use_begin();
+        
+        log->Printf("Couldn't remove %s because of %s",
+                    PrintValue(global_var).c_str(),
+                    PrintValue(*ui).c_str());
+    }
+    
+    return true;
+}
+
+bool
 IRForTarget::runOnModule (Module &llvm_module)
 {
     lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
@@ -2674,7 +2725,7 @@
     
     m_reloc_placeholder = new llvm::GlobalVariable((*m_module), 
                                                    intptr_ty,
-                                                   false /* isConstant */,
+                                                   false /* IsConstant */,
                                                    GlobalVariable::InternalLinkage,
                                                    Constant::getNullValue(intptr_ty),
                                                    "reloc_placeholder",
@@ -2876,6 +2927,12 @@
         return false;
     }
     
+    if (!StripAllGVs(llvm_module))
+    {
+        if (log)
+            log->Printf("StripAllGVs() failed");
+    }
+    
     if (log && log->GetVerbose())
     {
         std::string s;

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=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/source/Host/common/Host.cpp (original)
+++ lldb/branches/windows/source/Host/common/Host.cpp Fri Sep 28 06:07:34 2012
@@ -1396,19 +1396,32 @@
                        int *status_ptr,
                        int *signo_ptr,
                        std::string *command_output_ptr,
-                       uint32_t timeout_sec)
+                       uint32_t timeout_sec,
+                       const char *shell)
 {
     Error error;
     ProcessLaunchInfo launch_info;
-    launch_info.SetShell("/bin/bash");
-    launch_info.GetArguments().AppendArgument(command);
-    const bool localhost = true;
-    const bool will_debug = false;
-    const bool first_arg_is_full_shell_command = true;
-    launch_info.ConvertArgumentsForLaunchingInShell (error,
-                                                     localhost,
-                                                     will_debug,
-                                                     first_arg_is_full_shell_command);
+    if (shell && shell[0])
+    {
+        // Run the command in a shell
+        launch_info.SetShell(shell);
+        launch_info.GetArguments().AppendArgument(command);
+        const bool localhost = true;
+        const bool will_debug = false;
+        const bool first_arg_is_full_shell_command = true;
+        launch_info.ConvertArgumentsForLaunchingInShell (error,
+                                                         localhost,
+                                                         will_debug,
+                                                         first_arg_is_full_shell_command);
+    }
+    else
+    {
+        // No shell, just run it
+        Args args (command);
+        const bool first_arg_is_executable = true;
+        const bool first_arg_is_executable_and_argument = true;
+        launch_info.SetArguments(args, first_arg_is_executable, first_arg_is_executable_and_argument);
+    }
     
     if (working_dir)
         launch_info.SetWorkingDirectory(working_dir);
@@ -1422,7 +1435,7 @@
         output_file_path = ::tmpnam(output_file_path_buffer);
         launch_info.AppendSuppressFileAction (STDIN_FILENO, true, false);
         launch_info.AppendOpenFileAction(STDOUT_FILENO, output_file_path, false, true);
-        launch_info.AppendDuplicateFileAction(STDERR_FILENO, STDOUT_FILENO);
+        launch_info.AppendDuplicateFileAction(STDOUT_FILENO, STDERR_FILENO);
     }
     else
     {

Modified: lldb/branches/windows/source/Host/common/Symbols.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Host/common/Symbols.cpp?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/source/Host/common/Symbols.cpp (original)
+++ lldb/branches/windows/source/Host/common/Symbols.cpp Fri Sep 28 06:07:34 2012
@@ -36,5 +36,13 @@
     return FileSpec();
 }
 
+bool
+Symbols::DownloadObjectAndSymbolFile (ModuleSpec &module_spec)
+{
+    // Fill in the module_spec.GetFileSpec() for the object file and/or the
+    // module_spec.GetSymbolFileSpec() for the debug symbols file.
+    return false;
+}
+
 
 #endif

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=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/source/Host/macosx/Host.mm (original)
+++ lldb/branches/windows/source/Host/macosx/Host.mm Fri Sep 28 06:07:34 2012
@@ -1552,7 +1552,6 @@
         argv = (char * const*)tmp_argv;
     }
 
-
     const char *working_dir = launch_info.GetWorkingDirectory();
     if (working_dir)
     {
@@ -1605,13 +1604,21 @@
                         eErrorTypePOSIX);
 
         if (error.Fail() || log)
-            error.PutToLog(log.get(), "::posix_spawnp ( pid => %i, path = '%s', file_actions = %p, attr = %p, argv = %p, envp = %p )", 
+        {
+            error.PutToLog(log.get(), "::posix_spawnp ( pid => %i, path = '%s', file_actions = %p, attr = %p, argv = %p, envp = %p )",
                            pid, 
                            exe_path, 
                            &file_actions, 
                            &attr, 
                            argv, 
                            envp);
+            if (log)
+            {
+                for (int ii=0; argv[ii]; ++ii)
+                    log->Printf("argv[%i] = '%s'", ii, argv[ii]);
+            }
+        }
+
     }
     else
     {
@@ -1624,12 +1631,19 @@
                         eErrorTypePOSIX);
 
         if (error.Fail() || log)
-            error.PutToLog(log.get(), "::posix_spawnp ( pid => %i, path = '%s', file_actions = NULL, attr = %p, argv = %p, envp = %p )", 
+        {
+            error.PutToLog(log.get(), "::posix_spawnp ( pid => %i, path = '%s', file_actions = NULL, attr = %p, argv = %p, envp = %p )",
                            pid, 
                            exe_path, 
                            &attr, 
                            argv, 
                            envp);
+            if (log)
+            {
+                for (int ii=0; argv[ii]; ++ii)
+                    log->Printf("argv[%i] = '%s'", ii, argv[ii]);
+            }
+        }
     }
     
     if (working_dir)

Modified: lldb/branches/windows/source/Host/macosx/Symbols.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Host/macosx/Symbols.cpp?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/source/Host/macosx/Symbols.cpp (original)
+++ lldb/branches/windows/source/Host/macosx/Symbols.cpp Fri Sep 28 06:07:34 2012
@@ -30,6 +30,7 @@
 #include "lldb/Host/Host.h"
 #include "lldb/Utility/CleanUp.h"
 #include "Host/macosx/cfcpp/CFCBundle.h"
+#include "Host/macosx/cfcpp/CFCData.h"
 #include "Host/macosx/cfcpp/CFCReleaser.h"
 #include "Host/macosx/cfcpp/CFCString.h"
 #include "mach/machine.h"
@@ -582,3 +583,183 @@
     }
     return symbol_fspec;
 }
+
+
+static bool
+GetModuleSpecInfoFromUUIDDictionary (CFDictionaryRef uuid_dict, ModuleSpec &module_spec)
+{
+    bool success = false;
+    if (uuid_dict != NULL && CFGetTypeID (uuid_dict) == CFDictionaryGetTypeID ())
+    {
+        std::string str;
+        CFStringRef cf_str;
+        
+        cf_str = (CFStringRef)CFDictionaryGetValue ((CFDictionaryRef) uuid_dict, CFSTR("DBGSymbolRichExecutable"));
+        if (cf_str && CFGetTypeID (cf_str) == CFStringGetTypeID ())
+        {
+            if (CFCString::FileSystemRepresentation(cf_str, str))
+                module_spec.GetFileSpec().SetFile (str.c_str(), true);
+        }
+        
+        cf_str = (CFStringRef)CFDictionaryGetValue ((CFDictionaryRef) uuid_dict, CFSTR("DBGDSYMPath"));
+        if (cf_str && CFGetTypeID (cf_str) == CFStringGetTypeID ())
+        {
+            if (CFCString::FileSystemRepresentation(cf_str, str))
+            {
+                module_spec.GetSymbolFileSpec().SetFile (str.c_str(), true);
+                success = true;
+            }
+        }
+        
+        cf_str = (CFStringRef)CFDictionaryGetValue ((CFDictionaryRef) uuid_dict, CFSTR("DBGArchitecture"));
+        if (cf_str && CFGetTypeID (cf_str) == CFStringGetTypeID ())
+        {
+            if (CFCString::FileSystemRepresentation(cf_str, str))
+                module_spec.GetArchitecture().SetTriple(str.c_str());
+        }
+
+        std::string DBGBuildSourcePath;
+        std::string DBGSourcePath;
+
+        cf_str = (CFStringRef)CFDictionaryGetValue ((CFDictionaryRef) uuid_dict, CFSTR("DBGBuildSourcePath"));
+        if (cf_str && CFGetTypeID (cf_str) == CFStringGetTypeID ())
+        {
+            CFCString::FileSystemRepresentation(cf_str, DBGBuildSourcePath);
+        }
+
+        cf_str = (CFStringRef)CFDictionaryGetValue ((CFDictionaryRef) uuid_dict, CFSTR("DBGSourcePath"));
+        if (cf_str && CFGetTypeID (cf_str) == CFStringGetTypeID ())
+        {
+            CFCString::FileSystemRepresentation(cf_str, DBGSourcePath);
+        }
+        
+        if (!DBGBuildSourcePath.empty() && !DBGSourcePath.empty())
+        {
+            module_spec.GetSourceMappingList().Append (ConstString(DBGBuildSourcePath.c_str()), ConstString(DBGSourcePath.c_str()), true);
+        }
+    }
+    return success;
+}
+
+
+bool
+Symbols::DownloadObjectAndSymbolFile (ModuleSpec &module_spec)
+{
+    bool success = false;
+    const UUID *uuid_ptr = module_spec.GetUUIDPtr();
+    const FileSpec *file_spec_ptr = module_spec.GetFileSpecPtr();
+    if (uuid_ptr || (file_spec_ptr && file_spec_ptr->Exists()))
+    {
+        static bool g_located_dsym_for_uuid_exe = false;
+        static bool g_dsym_for_uuid_exe_exists = false;
+        static char g_dsym_for_uuid_exe_path[PATH_MAX];
+        if (!g_located_dsym_for_uuid_exe)
+        {
+            g_located_dsym_for_uuid_exe = true;
+            const char *dsym_for_uuid_exe_path_cstr = getenv("LLDB_APPLE_DSYMFORUUID_EXECUTABLE");
+            FileSpec dsym_for_uuid_exe_spec;
+            if (dsym_for_uuid_exe_path_cstr)
+            {
+                dsym_for_uuid_exe_spec.SetFile(dsym_for_uuid_exe_path_cstr, true);
+                g_dsym_for_uuid_exe_exists = dsym_for_uuid_exe_spec.Exists();
+            }
+            
+            if (!g_dsym_for_uuid_exe_exists)
+            {
+                dsym_for_uuid_exe_spec.SetFile("~rc/bin/dsymForUUID", true);
+                g_dsym_for_uuid_exe_exists = dsym_for_uuid_exe_spec.Exists();
+                if (!g_dsym_for_uuid_exe_exists)
+                {
+                    dsym_for_uuid_exe_spec.SetFile("/usr/local/bin/dsymForUUID", false);
+                }
+            }
+            
+            if (g_dsym_for_uuid_exe_exists)
+                dsym_for_uuid_exe_spec.GetPath (g_dsym_for_uuid_exe_path, sizeof(g_dsym_for_uuid_exe_path));
+        }
+        if (g_dsym_for_uuid_exe_exists)
+        {
+            char uuid_cstr_buffer[64];
+            char file_path[PATH_MAX];
+            uuid_cstr_buffer[0] = '\0';
+            file_path[0] = '\0';
+            const char *uuid_cstr = NULL;
+
+            if (uuid_ptr)
+                uuid_cstr = uuid_ptr->GetAsCString(uuid_cstr_buffer, sizeof(uuid_cstr_buffer));
+
+            if (file_spec_ptr)
+                file_spec_ptr->GetPath(file_path, sizeof(file_path));
+            
+            StreamString command;
+            if (uuid_cstr)
+                command.Printf("%s --copyExecutable %s", g_dsym_for_uuid_exe_path, uuid_cstr);
+            else if (file_path && file_path[0])
+                command.Printf("%s --copyExecutable %s", g_dsym_for_uuid_exe_path, file_path);
+            
+            if (!command.GetString().empty())
+            {
+                int exit_status = -1;
+                int signo = -1;
+                std::string command_output;
+                Error error = Host::RunShellCommand (command.GetData(),
+                                                     NULL,              // current working directory
+                                                     &exit_status,      // Exit status
+                                                     &signo,            // Signal int *
+                                                     &command_output,   // Command output
+                                                     30,                // Large timeout to allow for long dsym download times
+                                                     NULL);             // Don't run in a shell (we don't need shell expansion)
+                if (error.Success() && exit_status == 0 && !command_output.empty())
+                {
+                    CFCData data (CFDataCreateWithBytesNoCopy (NULL,
+                                                               (const UInt8 *)command_output.data(),
+                                                               command_output.size(),
+                                                               kCFAllocatorNull));
+                    
+                    CFCReleaser<CFDictionaryRef> plist((CFDictionaryRef)::CFPropertyListCreateFromXMLData (NULL, data.get(), kCFPropertyListImmutable, NULL));
+                    
+                    if (CFGetTypeID (plist.get()) == CFDictionaryGetTypeID ())
+                    {
+                        if (uuid_cstr)
+                        {
+                            CFCString uuid_cfstr(uuid_cstr);
+                            CFDictionaryRef uuid_dict = (CFDictionaryRef)CFDictionaryGetValue (plist.get(), uuid_cfstr.get());
+                            success = GetModuleSpecInfoFromUUIDDictionary (uuid_dict, module_spec);
+                        }
+                        else
+                        {
+                            const CFIndex num_values = ::CFDictionaryGetCount(plist.get());
+                            if (num_values > 0)
+                            {
+                                std::vector<CFStringRef> keys (num_values, NULL);
+                                std::vector<CFDictionaryRef> values (num_values, NULL);
+                                ::CFDictionaryGetKeysAndValues(plist.get(), NULL, (const void **)&values[0]);
+                                if (num_values == 1)
+                                {
+                                    return GetModuleSpecInfoFromUUIDDictionary (values[0], module_spec);
+                                }
+                                else
+                                {
+                                    for (CFIndex i=0; i<num_values; ++i)
+                                    {
+                                        ModuleSpec curr_module_spec;
+                                        if (GetModuleSpecInfoFromUUIDDictionary (values[i], curr_module_spec))
+                                        {
+                                            if (module_spec.GetArchitecture() == curr_module_spec.GetArchitecture())
+                                            {
+                                                module_spec = curr_module_spec;
+                                                return true;
+                                            }
+                                        }
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+    return success;
+}
+

Modified: lldb/branches/windows/source/Host/macosx/launcherXPCService/LauncherRootXPCService-Info.plist
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Host/macosx/launcherXPCService/LauncherRootXPCService-Info.plist?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/source/Host/macosx/launcherXPCService/LauncherRootXPCService-Info.plist (original)
+++ lldb/branches/windows/source/Host/macosx/launcherXPCService/LauncherRootXPCService-Info.plist Fri Sep 28 06:07:34 2012
@@ -25,7 +25,7 @@
 	<key>CFBundleSignature</key>
 	<string>????</string>
 	<key>CFBundleVersion</key>
-	<string>165</string>
+	<string>168</string>
 	<key>NSHumanReadableCopyright</key>
 	<string>Copyright © 2012 Apple Inc. All rights reserved.</string>
 	<key>XPCService</key>

Modified: lldb/branches/windows/source/Host/macosx/launcherXPCService/LauncherXPCService-Info.plist
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Host/macosx/launcherXPCService/LauncherXPCService-Info.plist?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/source/Host/macosx/launcherXPCService/LauncherXPCService-Info.plist (original)
+++ lldb/branches/windows/source/Host/macosx/launcherXPCService/LauncherXPCService-Info.plist Fri Sep 28 06:07:34 2012
@@ -25,7 +25,7 @@
 	<key>CFBundleSignature</key>
 	<string>????</string>
 	<key>CFBundleVersion</key>
-	<string>165</string>
+	<string>168</string>
 	<key>NSHumanReadableCopyright</key>
 	<string>Copyright © 2012 Apple Inc. All rights reserved.</string>
 	<key>XPCService</key>

Modified: lldb/branches/windows/source/Interpreter/CommandInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Interpreter/CommandInterpreter.cpp?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/source/Interpreter/CommandInterpreter.cpp (original)
+++ lldb/branches/windows/source/Interpreter/CommandInterpreter.cpp Fri Sep 28 06:07:34 2012
@@ -270,7 +270,10 @@
     
     cmd_obj_sp = GetCommandSPExact ("process kill", false);
     if (cmd_obj_sp)
+    {
         AddAlias ("kill", cmd_obj_sp);
+        AddAlias ("k", cmd_obj_sp);
+    }
     
     cmd_obj_sp = GetCommandSPExact ("process launch", false);
     if (cmd_obj_sp)
@@ -461,6 +464,36 @@
         }
     }
 
+    std::auto_ptr<CommandObjectRegexCommand>
+    connect_gdb_remote_cmd_ap(new CommandObjectRegexCommand (*this,
+                                                      "gdb-remote",
+                                                      "Connect to a remote GDB server.",
+                                                      "gdb-remote [<host>:<port>]\ngdb-remote [<port>]", 2));
+    if (connect_gdb_remote_cmd_ap.get())
+    {
+        if (connect_gdb_remote_cmd_ap->AddRegexCommand("^([^:]+:[[:digit:]]+)$", "process connect --plugin gdb-remote connect://%1") &&
+            connect_gdb_remote_cmd_ap->AddRegexCommand("^([[:digit:]]+)$", "process connect --plugin gdb-remote connect://localhost:%1"))
+        {
+            CommandObjectSP command_sp(connect_gdb_remote_cmd_ap.release());
+            m_command_dict[command_sp->GetCommandName ()] = command_sp;
+        }
+    }
+
+    std::auto_ptr<CommandObjectRegexCommand>
+    connect_kdp_remote_cmd_ap(new CommandObjectRegexCommand (*this,
+                                                             "kdp-remote",
+                                                             "Connect to a remote KDP server.",
+                                                             "kdp-remote [<host>]\nkdp-remote [<host>:<port>]", 2));
+    if (connect_kdp_remote_cmd_ap.get())
+    {
+        if (connect_kdp_remote_cmd_ap->AddRegexCommand("^([^:]+:[[:digit:]]+)$", "process connect --plugin kdp-remote udp://%1") &&
+            connect_kdp_remote_cmd_ap->AddRegexCommand("^(.+)$", "process connect --plugin kdp-remote udp://%1:41139"))
+        {
+            CommandObjectSP command_sp(connect_kdp_remote_cmd_ap.release());
+            m_command_dict[command_sp->GetCommandName ()] = command_sp;
+        }
+    }
+
 }
 
 int

Modified: lldb/branches/windows/source/Interpreter/OptionGroupBoolean.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Interpreter/OptionGroupBoolean.cpp?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/source/Interpreter/OptionGroupBoolean.cpp (original)
+++ lldb/branches/windows/source/Interpreter/OptionGroupBoolean.cpp Fri Sep 28 06:07:34 2012
@@ -21,20 +21,19 @@
                                         bool required,
                                         const char *long_option, 
                                         char short_option,
-                                        uint32_t completion_type,
-                                        lldb::CommandArgumentType argument_type,
                                         const char *usage_text,
-                                        bool default_value) :
+                                        bool default_value,
+                                        bool no_argument_toggle_default) :
     m_value (default_value, default_value)
 {
     m_option_definition.usage_mask = usage_mask;
     m_option_definition.required = required;
     m_option_definition.long_option = long_option;
     m_option_definition.short_option = short_option;
-    m_option_definition.option_has_arg = required_argument;
+    m_option_definition.option_has_arg = no_argument_toggle_default ? no_argument : required_argument;
     m_option_definition.enum_values = NULL;
-    m_option_definition.completion_type = completion_type;
-    m_option_definition.argument_type = argument_type;
+    m_option_definition.completion_type = 0;
+    m_option_definition.argument_type = eArgTypeBoolean;
     m_option_definition.usage_text = usage_text;
 }
 
@@ -47,7 +46,17 @@
                                     uint32_t option_idx,
                                     const char *option_arg)
 {
-    Error error (m_value.SetValueFromCString (option_arg));
+    Error error;
+    if (m_option_definition.option_has_arg == no_argument)
+    {
+        // Not argument, toggle the default value and mark the option as having been set
+        m_value.SetCurrentValue (!m_value.GetDefaultValue());
+        m_value.SetOptionWasSet ();
+    }
+    else
+    {
+        error = m_value.SetValueFromCString (option_arg);
+    }
     return error;
 }
 

Modified: lldb/branches/windows/source/Interpreter/OptionValueFileSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Interpreter/OptionValueFileSpec.cpp?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/source/Interpreter/OptionValueFileSpec.cpp (original)
+++ lldb/branches/windows/source/Interpreter/OptionValueFileSpec.cpp Fri Sep 28 06:07:34 2012
@@ -21,6 +21,35 @@
 using namespace lldb;
 using namespace lldb_private;
 
+
+OptionValueFileSpec::OptionValueFileSpec () :
+    OptionValue(),
+    m_current_value (),
+    m_default_value (),
+    m_data_sp(),
+    m_completion_mask (CommandCompletions::eDiskFileCompletion)
+{
+}
+
+OptionValueFileSpec::OptionValueFileSpec (const FileSpec &value) :
+    OptionValue(),
+    m_current_value (value),
+    m_default_value (value),
+    m_data_sp(),
+    m_completion_mask (CommandCompletions::eDiskFileCompletion)
+{
+}
+
+OptionValueFileSpec::OptionValueFileSpec (const FileSpec &current_value,
+                                          const FileSpec &default_value) :
+    OptionValue(),
+    m_current_value (current_value),
+    m_default_value (default_value),
+    m_data_sp(),
+    m_completion_mask (CommandCompletions::eDiskFileCompletion)
+{
+}
+
 void
 OptionValueFileSpec::DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask)
 {
@@ -101,7 +130,7 @@
     word_complete = false;
     matches.Clear();
     CommandCompletions::InvokeCommonCompletionCallbacks (interpreter,
-                                                         CommandCompletions::eDiskFileCompletion,
+                                                         m_completion_mask,
                                                          s,
                                                          match_start_point,
                                                          max_return_elements,

Modified: lldb/branches/windows/source/Interpreter/OptionValueUUID.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Interpreter/OptionValueUUID.cpp?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/source/Interpreter/OptionValueUUID.cpp (original)
+++ lldb/branches/windows/source/Interpreter/OptionValueUUID.cpp Fri Sep 28 06:07:34 2012
@@ -13,7 +13,10 @@
 // C++ Includes
 // Other libraries and framework includes
 // Project includes
+#include "lldb/Core/Module.h"
 #include "lldb/Core/Stream.h"
+#include "lldb/Core/StringList.h"
+#include "lldb/Interpreter/CommandInterpreter.h"
 
 using namespace lldb;
 using namespace lldb_private;
@@ -45,7 +48,7 @@
         case eVarSetOperationReplace:
         case eVarSetOperationAssign:
             {
-                if (m_uuid.SetfromCString(value_cstr) == 0)
+                if (m_uuid.SetFromCString(value_cstr) == 0)
                     error.SetErrorStringWithFormat ("invalid uuid string value '%s'", value_cstr);
                 else
                     m_value_was_set = true;
@@ -68,3 +71,50 @@
 {
     return OptionValueSP(new OptionValueUUID(*this));
 }
+
+size_t
+OptionValueUUID::AutoComplete (CommandInterpreter &interpreter,
+                               const char *s,
+                               int match_start_point,
+                               int max_return_elements,
+                               bool &word_complete,
+                               StringList &matches)
+{
+    word_complete = false;
+    matches.Clear();
+    ExecutionContext exe_ctx(interpreter.GetExecutionContext());
+    Target *target = exe_ctx.GetTargetPtr();
+    if (target)
+    {
+        const size_t num_modules = target->GetImages().GetSize();
+        if (num_modules > 0)
+        {
+            char uuid_cstr[64];
+            UUID::ValueType uuid_bytes;
+            const size_t num_bytes_decoded = UUID::DecodeUUIDBytesFromCString(s, uuid_bytes, NULL);
+            for (size_t i=0; i<num_modules; ++i)
+            {
+                ModuleSP module_sp (target->GetImages().GetModuleAtIndex(i));
+                if (module_sp)
+                {
+                    const UUID &module_uuid = module_sp->GetUUID();
+                    if (module_uuid.IsValid())
+                    {
+                        bool add_uuid = false;
+                        if (num_bytes_decoded == 0)
+                            add_uuid = true;
+                        else
+                            add_uuid = ::memcmp(module_uuid.GetBytes(), uuid_bytes, num_bytes_decoded) == 0;
+                        if (add_uuid)
+                        {
+                            if (module_uuid.GetAsCString(uuid_cstr, sizeof(uuid_cstr)))
+                                matches.AppendString(uuid_cstr);
+                        }
+                    }
+                }
+            }
+        }
+    }
+    return matches.GetSize();
+}
+

Modified: lldb/branches/windows/source/Interpreter/Property.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Interpreter/Property.cpp?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/source/Interpreter/Property.cpp (original)
+++ lldb/branches/windows/source/Interpreter/Property.cpp Fri Sep 28 06:07:34 2012
@@ -148,7 +148,7 @@
         {
             UUID uuid;
             if (definition.default_cstr_value)
-                uuid.SetfromCString (definition.default_cstr_value);
+                uuid.SetFromCString (definition.default_cstr_value);
             m_value_sp.reset (new OptionValueUUID(uuid));
         }
             break;

Modified: lldb/branches/windows/source/Interpreter/ScriptInterpreterPython.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Interpreter/ScriptInterpreterPython.cpp?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/source/Interpreter/ScriptInterpreterPython.cpp (original)
+++ lldb/branches/windows/source/Interpreter/ScriptInterpreterPython.cpp Fri Sep 28 06:07:34 2012
@@ -2542,9 +2542,12 @@
 // in Python, a special attribute __doc__ contains the docstring
 // for an object (function, method, class, ...) if any is defined
 // Otherwise, the attribute's value is None
-std::string
-ScriptInterpreterPython::GetDocumentationForItem(const char* item)
+bool
+ScriptInterpreterPython::GetDocumentationForItem(const char* item, std::string& dest)
 {
+	dest.clear();
+	if (!item || !*item)
+		return false;
     std::string command(item);
     command += ".__doc__";
     
@@ -2552,12 +2555,19 @@
     
     if (ExecuteOneLineWithReturn (command.c_str(),
                                  ScriptInterpreter::eScriptReturnTypeCharStrOrNone,
-                                 &result_ptr, false) && result_ptr)
+                                 &result_ptr, false))
     {
-        return std::string(result_ptr);
+        if (result_ptr)
+            dest.assign(result_ptr);
+        return true;
     }
     else
-        return std::string("");
+    {
+        StreamString str_stream;
+        str_stream.Printf("Function %s was not found. Containing module might be missing.",item);
+        dest.assign(str_stream.GetData());
+        return false;
+    }
 }
 
 void

Modified: lldb/branches/windows/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp (original)
+++ lldb/branches/windows/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp Fri Sep 28 06:07:34 2012
@@ -508,10 +508,83 @@
 }
 
 Error
-ABIMacOSX_arm::SetReturnValueObject(lldb::StackFrameSP &frame_sp, lldb::ValueObjectSP &new_value)
+ABIMacOSX_arm::SetReturnValueObject(lldb::StackFrameSP &frame_sp, lldb::ValueObjectSP &new_value_sp)
 {
-    Error return_error("I can't do that yet Jim.");
-    return return_error;
+    Error error;
+    if (!new_value_sp)
+    {
+        error.SetErrorString("Empty value object for return value.");
+        return error;
+    }
+    
+    clang_type_t value_type = new_value_sp->GetClangType();
+    if (!value_type)
+    {
+        error.SetErrorString ("Null clang type for return value.");
+        return error;
+    }
+    
+    clang::ASTContext *ast_context = new_value_sp->GetClangAST();
+    if (!ast_context)
+    {
+        error.SetErrorString ("Null clang AST for return value.");
+        return error;
+    }
+    Thread *thread = frame_sp->GetThread().get();
+    
+    bool is_signed;
+    uint32_t count;
+    bool is_complex;
+    
+    RegisterContext *reg_ctx = thread->GetRegisterContext().get();
+
+    bool set_it_simple = false;
+    if (ClangASTContext::IsIntegerType (value_type, is_signed) || ClangASTContext::IsPointerType(value_type))
+    {
+        DataExtractor data;
+        size_t num_bytes = new_value_sp->GetData(data);
+        uint32_t offset = 0;
+        if (num_bytes <= 8)
+        {
+            const RegisterInfo *r0_info = reg_ctx->GetRegisterInfoByName("r0", 0);
+            if (num_bytes <= 4)
+            {
+                uint32_t raw_value = data.GetMaxU32(&offset, num_bytes);
+        
+                if (reg_ctx->WriteRegisterFromUnsigned (r0_info, raw_value))
+                    set_it_simple = true;
+            }
+            else
+            {
+                uint32_t raw_value = data.GetMaxU32(&offset, 4);
+        
+                if (reg_ctx->WriteRegisterFromUnsigned (r0_info, raw_value))
+                {
+                    const RegisterInfo *r1_info = reg_ctx->GetRegisterInfoByName("r1", 0);
+                    uint32_t raw_value = data.GetMaxU32(&offset, num_bytes - offset);
+                
+                    if (reg_ctx->WriteRegisterFromUnsigned (r1_info, raw_value))
+                        set_it_simple = true;
+                }
+            }
+        }
+        else
+        {
+            error.SetErrorString("We don't support returning longer than 64 bit integer values at present.");
+        }
+    }
+    else if (ClangASTContext::IsFloatingPointType (value_type, count, is_complex))
+    {
+        if (is_complex)
+            error.SetErrorString ("We don't support returning complex values at present");
+        else
+            error.SetErrorString ("We don't support returning float values at present");
+    }
+    
+    if (!set_it_simple)
+        error.SetErrorString ("We only support setting simple integer return types at present.");
+    
+    return error;
 }
 
 bool

Modified: lldb/branches/windows/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp (original)
+++ lldb/branches/windows/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp Fri Sep 28 06:07:34 2012
@@ -687,6 +687,86 @@
     return true;
 }
 
+Error
+ABIMacOSX_i386::SetReturnValueObject(lldb::StackFrameSP &frame_sp, lldb::ValueObjectSP &new_value_sp)
+{
+    Error error;
+    if (!new_value_sp)
+    {
+        error.SetErrorString("Empty value object for return value.");
+        return error;
+    }
+    
+    clang_type_t value_type = new_value_sp->GetClangType();
+    if (!value_type)
+    {
+        error.SetErrorString ("Null clang type for return value.");
+        return error;
+    }
+    
+    clang::ASTContext *ast_context = new_value_sp->GetClangAST();
+    if (!ast_context)
+    {
+        error.SetErrorString ("Null clang AST for return value.");
+        return error;
+    }
+    Thread *thread = frame_sp->GetThread().get();
+    
+    bool is_signed;
+    uint32_t count;
+    bool is_complex;
+    
+    RegisterContext *reg_ctx = thread->GetRegisterContext().get();
+
+    bool set_it_simple = false;
+    if (ClangASTContext::IsIntegerType (value_type, is_signed) || ClangASTContext::IsPointerType(value_type))
+    {
+        DataExtractor data;
+        size_t num_bytes = new_value_sp->GetData(data);
+        uint32_t offset = 0;
+        if (num_bytes <= 8)
+        {
+            const RegisterInfo *eax_info = reg_ctx->GetRegisterInfoByName("eax", 0);
+            if (num_bytes <= 4)
+            {
+                uint32_t raw_value = data.GetMaxU32(&offset, num_bytes);
+        
+                if (reg_ctx->WriteRegisterFromUnsigned (eax_info, raw_value))
+                    set_it_simple = true;
+            }
+            else
+            {
+                uint32_t raw_value = data.GetMaxU32(&offset, 4);
+        
+                if (reg_ctx->WriteRegisterFromUnsigned (eax_info, raw_value))
+                {
+                    const RegisterInfo *edx_info = reg_ctx->GetRegisterInfoByName("edx", 0);
+                    uint32_t raw_value = data.GetMaxU32(&offset, num_bytes - offset);
+                
+                    if (reg_ctx->WriteRegisterFromUnsigned (edx_info, raw_value))
+                        set_it_simple = true;
+                }
+            }
+        }
+        else
+        {
+            error.SetErrorString("We don't support returning longer than 64 bit integer values at present.");
+        }
+    }
+    else if (ClangASTContext::IsFloatingPointType (value_type, count, is_complex))
+    {
+        if (is_complex)
+            error.SetErrorString ("We don't support returning complex values at present");
+        else
+            error.SetErrorString ("We don't support returning float values at present");
+    }
+    
+    if (!set_it_simple)
+        error.SetErrorString ("We only support setting simple integer return types at present.");
+    
+    return error;
+}
+
 ValueObjectSP
 ABIMacOSX_i386::GetReturnValueObjectImpl (Thread &thread,
                                 ClangASTType &ast_type) const
@@ -774,13 +854,6 @@
     return return_valobj_sp;
 }
 
-Error
-ABIMacOSX_i386::SetReturnValueObject(lldb::StackFrameSP &frame_sp, lldb::ValueObjectSP &new_value)
-{
-    Error return_error("I can't do that yet Jim.");
-    return return_error;
-}
-
 bool
 ABIMacOSX_i386::CreateFunctionEntryUnwindPlan (UnwindPlan &unwind_plan)
 {
@@ -868,19 +941,19 @@
             {
             case 'b': 
                 if (name[2] == 'x' || name[2] == 'p')
-                    return name[0] == '\0';
+                    return name[3] == '\0';
                 break;
             case 'd':
                 if (name[2] == 'i')
-                    return name[0] == '\0';
+                    return name[3] == '\0';
                 break;
             case 'i': 
                 if (name[2] == 'p')
-                    return name[0] == '\0';
+                    return name[3] == '\0';
                 break;
             case 's':
                 if (name[2] == 'i' || name[2] == 'p')
-                    return name[0] == '\0';
+                    return name[3] == '\0';
                 break;
             }
         }

Modified: lldb/branches/windows/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp (original)
+++ lldb/branches/windows/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp Fri Sep 28 06:07:34 2012
@@ -550,6 +550,100 @@
     return true;
 }
 
+Error
+ABISysV_x86_64::SetReturnValueObject(lldb::StackFrameSP &frame_sp, lldb::ValueObjectSP &new_value_sp)
+{
+    Error error;
+    if (!new_value_sp)
+    {
+        error.SetErrorString("Empty value object for return value.");
+        return error;
+    }
+    
+    clang_type_t value_type = new_value_sp->GetClangType();
+    if (!value_type)
+    {
+        error.SetErrorString ("Null clang type for return value.");
+        return error;
+    }
+    
+    clang::ASTContext *ast_context = new_value_sp->GetClangAST();
+    if (!ast_context)
+    {
+        error.SetErrorString ("Null clang AST for return value.");
+        return error;
+    }
+    Thread *thread = frame_sp->GetThread().get();
+    
+    bool is_signed;
+    uint32_t count;
+    bool is_complex;
+    
+    RegisterContext *reg_ctx = thread->GetRegisterContext().get();
+
+    bool set_it_simple = false;
+    if (ClangASTContext::IsIntegerType (value_type, is_signed) || ClangASTContext::IsPointerType(value_type))
+    {
+        const RegisterInfo *reg_info = reg_ctx->GetRegisterInfoByName("rax", 0);
+
+        DataExtractor data;
+        size_t num_bytes = new_value_sp->GetData(data);
+        uint32_t offset = 0;
+        if (num_bytes <= 8)
+        {
+            uint64_t raw_value = data.GetMaxU64(&offset, num_bytes);
+            
+            if (reg_ctx->WriteRegisterFromUnsigned (reg_info, raw_value))
+                set_it_simple = true;
+        }
+        else
+        {
+            error.SetErrorString("We don't support returning longer than 64 bit integer values at present.");
+        }
+
+    }
+    else if (ClangASTContext::IsFloatingPointType (value_type, count, is_complex))
+    {
+        if (is_complex)
+            error.SetErrorString ("We don't support returning complex values at present");
+        else
+        {
+            size_t bit_width = ClangASTType::GetClangTypeBitWidth(ast_context, value_type);
+            if (bit_width <= 64)
+            {
+                const RegisterInfo *xmm0_info = reg_ctx->GetRegisterInfoByName("xmm0", 0);
+                RegisterValue xmm0_value;
+                DataExtractor data;
+                size_t num_bytes = new_value_sp->GetData(data);
+
+                unsigned char buffer[16];
+                ByteOrder byte_order = data.GetByteOrder();
+                uint32_t return_bytes;
+                
+                return_bytes = data.CopyByteOrderedData (0, num_bytes, buffer, 16, byte_order);
+                xmm0_value.SetBytes(buffer, 16, byte_order);
+                reg_ctx->WriteRegister(xmm0_info, xmm0_value);
+                set_it_simple = true;
+            }
+            else
+            {
+                // FIXME - don't know how to do 80 bit long doubles yet.
+                error.SetErrorString ("We don't support returning float values > 64 bits at present");
+            }
+        }
+    }
+    
+    if (!set_it_simple)
+    {
+        // Okay we've got a structure or something that doesn't fit in a simple register.
+        // We should figure out where it really goes, but we don't support this yet.
+        error.SetErrorString ("We only support setting simple integer and float return types at present.");
+    }
+    
+    return error;
+}
+
+
 ValueObjectSP
 ABISysV_x86_64::GetReturnValueObjectSimple (Thread &thread,
                                 ClangASTType &ast_type) const
@@ -584,7 +678,7 @@
         // Extract the register context so we can read arguments from registers
         
         size_t bit_width = ClangASTType::GetClangTypeBitWidth(ast_context, value_type);
-        unsigned rax_id = reg_ctx->GetRegisterInfoByName("rax", 0)->kinds[eRegisterKindLLDB];
+        uint64_t raw_value = thread.GetRegisterContext()->ReadRegisterAsUnsigned(reg_ctx->GetRegisterInfoByName("rax", 0), 0);
         
         switch (bit_width)
         {
@@ -594,27 +688,27 @@
             return return_valobj_sp;
         case 64:
             if (is_signed)
-                value.GetScalar() = (int64_t)(thread.GetRegisterContext()->ReadRegisterAsUnsigned(rax_id, 0));
+                value.GetScalar() = (int64_t)(raw_value);
             else
-                value.GetScalar() = (uint64_t)(thread.GetRegisterContext()->ReadRegisterAsUnsigned(rax_id, 0));
+                value.GetScalar() = (uint64_t)(raw_value);
             break;
         case 32:
             if (is_signed)
-                value.GetScalar() = (int32_t)(thread.GetRegisterContext()->ReadRegisterAsUnsigned(rax_id, 0) & 0xffffffff);
+                value.GetScalar() = (int32_t)(raw_value & 0xffffffff);
             else
-                value.GetScalar() = (uint32_t)(thread.GetRegisterContext()->ReadRegisterAsUnsigned(rax_id, 0) & 0xffffffff);
+                value.GetScalar() = (uint32_t)(raw_value & 0xffffffff);
             break;
         case 16:
             if (is_signed)
-                value.GetScalar() = (int16_t)(thread.GetRegisterContext()->ReadRegisterAsUnsigned(rax_id, 0) & 0xffff);
+                value.GetScalar() = (int16_t)(raw_value & 0xffff);
             else
-                value.GetScalar() = (uint16_t)(thread.GetRegisterContext()->ReadRegisterAsUnsigned(rax_id, 0) & 0xffff);
+                value.GetScalar() = (uint16_t)(raw_value & 0xffff);
             break;
         case 8:
             if (is_signed)
-                value.GetScalar() = (int8_t)(thread.GetRegisterContext()->ReadRegisterAsUnsigned(rax_id, 0) & 0xff);
+                value.GetScalar() = (int8_t)(raw_value & 0xff);
             else
-                value.GetScalar() = (uint8_t)(thread.GetRegisterContext()->ReadRegisterAsUnsigned(rax_id, 0) & 0xff);
+                value.GetScalar() = (uint8_t)(raw_value & 0xff);
             break;
         }
     }
@@ -959,13 +1053,6 @@
     return return_valobj_sp;
 }
 
-Error
-ABISysV_x86_64::SetReturnValueObject(lldb::StackFrameSP &frame_sp, lldb::ValueObjectSP &new_value)
-{
-    Error return_error("I can't do that yet Jim.");
-    return return_error;
-}
-
 bool
 ABISysV_x86_64::CreateFunctionEntryUnwindPlan (UnwindPlan &unwind_plan)
 {
@@ -1082,6 +1169,16 @@
                     return name[3] == '\0';
                 break;
 
+            default:
+                break;
+            }
+        }
+
+        // Accept shorter-variant versions, rbx/ebx, rip/ eip, etc.
+        if (name[0] == 'r' || name[0] == 'e')
+        {
+            switch (name[1])
+            {
             case 'b': // rbp, rbx
                 if (name[2] == 'p' || name[2] == 'x')
                     return name[3] == '\0';
@@ -1097,8 +1194,6 @@
                     return name[3] == '\0';
                 break;
 
-            default:
-                break;
             }
         }
     }

Modified: lldb/branches/windows/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h (original)
+++ lldb/branches/windows/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h Fri Sep 28 06:07:34 2012
@@ -52,6 +52,7 @@
     lldb::ValueObjectSP
     GetReturnValueObjectSimple (lldb_private::Thread &thread,
                     lldb_private::ClangASTType &ast_type) const;
+    
 public:    
     virtual lldb::ValueObjectSP
     GetReturnValueObjectImpl (lldb_private::Thread &thread,

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=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp (original)
+++ lldb/branches/windows/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp Fri Sep 28 06:07:34 2012
@@ -433,11 +433,13 @@
 Disassembler *
 DisassemblerLLVMC::CreateInstance (const ArchSpec &arch)
 {
-    std::auto_ptr<DisassemblerLLVMC> disasm_ap (new DisassemblerLLVMC(arch));
-    
-    if (disasm_ap.get() && disasm_ap->IsValid())
-        return disasm_ap.release();
+    if (arch.GetTriple().getArch() != llvm::Triple::UnknownArch)
+    {
+        std::auto_ptr<DisassemblerLLVMC> disasm_ap (new DisassemblerLLVMC(arch));
     
+        if (disasm_ap.get() && disasm_ap->IsValid())
+            return disasm_ap.release();
+    }
     return NULL;
 }
 

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=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp (original)
+++ lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp Fri Sep 28 06:07:34 2012
@@ -307,7 +307,7 @@
                 static ConstString g_objc_class_section_name ("__objc_data");
                 if (section_name == g_objc_class_section_name)
                 {
-                    isa_address.CalculateSymbolContext(&sc);
+                    isa_address.CalculateSymbolContext(&sc, eSymbolContextModule | eSymbolContextSymbol);
                     if (sc.symbol)
                     {
                         if (sc.symbol->GetType() == eSymbolTypeObjCClass)
@@ -351,7 +351,6 @@
             class_type_or_name.SetName (class_name);
             
             TypeList class_types;
-            SymbolContext sc;
             const bool exact_match = true;
             uint32_t num_matches = target.GetImages().FindTypes (sc,
                                                                  class_type_or_name.GetName(),
@@ -974,16 +973,24 @@
 class ClassDescriptorV2 : public ObjCLanguageRuntime::ClassDescriptor
 {
 public:
-    ClassDescriptorV2 (ValueObject &isa_pointer)
+    ClassDescriptorV2 (ObjCLanguageRuntime &runtime, ValueObject &ptr_to_object) :
+        m_runtime(runtime)
     {
-        ObjCLanguageRuntime::ObjCISA ptr_value = isa_pointer.GetValueAsUnsigned(0);
+        lldb::addr_t object_la = ptr_to_object.GetValueAsUnsigned(0);
+        lldb::ProcessSP process_sp = ptr_to_object.GetProcessSP();
         
-        lldb::ProcessSP process_sp = isa_pointer.GetProcessSP();
+        Error error;
+        ObjCLanguageRuntime::ObjCISA isa = process_sp->ReadPointerFromMemory(object_la,
+                                                                             error);
         
-        Initialize (ptr_value,process_sp);
+        if (isa == LLDB_INVALID_ADDRESS)
+            m_valid = false;
+        else
+            Initialize (isa, process_sp);
     }
     
-    ClassDescriptorV2 (ObjCLanguageRuntime::ObjCISA isa, lldb::ProcessSP process_sp)
+    ClassDescriptorV2 (ObjCLanguageRuntime &runtime, ObjCLanguageRuntime::ObjCISA isa, lldb::ProcessSP process_sp) :
+        m_runtime(runtime)
     {
         Initialize (isa, process_sp);
     }
@@ -991,6 +998,9 @@
     virtual ConstString
     GetClassName ()
     {
+        if (!m_valid)
+            return ConstString();
+        
         return m_name;
     }
     
@@ -999,10 +1009,8 @@
     {
         if (!m_valid)
             return ObjCLanguageRuntime::ClassDescriptorSP();
-        ProcessSP process_sp = m_process_wp.lock();
-        if (!process_sp)
-            return ObjCLanguageRuntime::ClassDescriptorSP();
-        return AppleObjCRuntime::ClassDescriptorSP(new ClassDescriptorV2(m_parent_isa,process_sp));
+        
+        return m_runtime.GetClassDescriptor(m_objc_class.m_superclass);
     }
     
     virtual bool
@@ -1020,24 +1028,110 @@
     virtual uint64_t
     GetInstanceSize ()
     {
+        if (!m_valid)
+            return 0;
+        
         return m_instance_size;
     }
     
     virtual ObjCLanguageRuntime::ObjCISA
     GetISA ()
     {
-        return m_isa;
+        if (!m_valid)
+            return 0;
+        
+        return m_objc_class_la;
+    }
+    
+    virtual bool
+    Describe (std::function <void (ObjCLanguageRuntime::ObjCISA)> const &superclass_func,
+              std::function <void (const char *, const char *)> const &instance_method_func,
+              std::function <void (const char *, const char *)> const &class_method_func)
+    {
+        if (!m_valid)
+            return false;
+        
+        std::auto_ptr <class_ro_t> ro;
+        std::auto_ptr <class_rw_t> rw;
+        
+        ProcessSP process_sp = m_process_wp.lock();
+        
+        if (!process_sp)
+            return false;
+        
+        if (IsRealized())
+        {
+            rw.reset(new class_rw_t);
+            if (!rw->Read(process_sp, m_objc_class.m_data_la))
+                return false;
+            
+            ro.reset(new class_ro_t);
+            if (!ro->Read(process_sp, rw->m_ro_la))
+                return false;
+        }
+        else
+        {
+            ro.reset(new class_ro_t);
+            if (!ro->Read(process_sp, m_objc_class.m_data_la))
+                return false;
+        }
+    
+        static ConstString NSObject_name("NSObject");
+        
+        if (m_name != NSObject_name && superclass_func)
+            superclass_func(m_objc_class.m_superclass);
+        
+        if (instance_method_func)
+        {
+            std::auto_ptr <method_list_t> base_method_list;
+            
+            base_method_list.reset(new method_list_t);
+            if (!base_method_list->Read(process_sp, ro->m_baseMethods_la))
+                return false;
+            
+            if (base_method_list->m_entsize != method_t::GetSize(process_sp))
+                return false;
+            
+            std::auto_ptr <method_t> method;
+            method.reset(new method_t);
+            
+            for (uint32_t i = 0, e = base_method_list->m_count; i < e; ++i)
+            {
+                method->Read(process_sp, base_method_list->m_first_la + (i * base_method_list->m_entsize));
+                
+                instance_method_func(method->m_name.c_str(), method->m_types.c_str());
+            }
+        }
+        
+        if (class_method_func)
+        {
+            ObjCLanguageRuntime::ClassDescriptorSP metaclass = m_runtime.GetClassDescriptor(m_objc_class.m_isa);
+            
+            // We don't care about the metaclass's superclass, or its class methods.  Its instance methods are
+            // our class methods.
+            
+            metaclass->Describe(std::function <void (ObjCLanguageRuntime::ObjCISA)> (nullptr),
+                                class_method_func,
+                                std::function <void (const char *, const char *)> (nullptr));
+        }
+        while (0);
+            
+        return true;
     }
     
     virtual bool
     IsRealized ()
     {
+        if (!m_valid)
+            return false;
+        
         return m_realized;
     }
     
     virtual
     ~ClassDescriptorV2 ()
-    {}
+    {
+    }
     
 protected:
     virtual bool
@@ -1050,107 +1144,106 @@
     }
     
     void
-    Initialize (ObjCLanguageRuntime::ObjCISA isa, lldb::ProcessSP process_sp)
+    Initialize (ObjCLanguageRuntime::ObjCISA objc_class_la, lldb::ProcessSP process_sp)
     {
-        if (!isa || !process_sp)
-        {
-            m_valid = false;
-            return;
-        }
-        
         m_valid = true;
-        
-        Error error;
-        
-        m_isa = process_sp->ReadPointerFromMemory(isa, error);
-        
-        if (error.Fail())
-        {
-            m_valid = false;
-            return;
-        }
-        
-        uint32_t ptr_size = process_sp->GetAddressByteSize();
-        
-        if (!IsPointerValid(m_isa,ptr_size,false,false,true))
+
+        if (!objc_class_la || !process_sp)
         {
             m_valid = false;
             return;
         }
         
-        lldb::addr_t data_ptr = process_sp->ReadPointerFromMemory(m_isa + 4 * ptr_size, error);
-        
-        if (error.Fail())
+        m_objc_class_la = objc_class_la;
+
+        size_t ptr_size = process_sp->GetAddressByteSize();
+        Error error;
+                
+        const bool allow_NULLs = false;
+        const bool allow_tagged = false;
+        const bool check_version_specific = true;
+
+        if (!IsPointerValid(m_objc_class_la, ptr_size, allow_NULLs, allow_tagged, check_version_specific))
         {
             m_valid = false;
             return;
         }
         
-        if (!IsPointerValid(data_ptr,ptr_size,false,false,true))
+        if (!m_objc_class.Read(process_sp, m_objc_class_la))
         {
             m_valid = false;
             return;
         }
-        
-        m_parent_isa = process_sp->ReadPointerFromMemory(isa + ptr_size,error);
-        
-        if (error.Fail())
+                    
+        // Now we just want to grab the instance size and the name.
+        // Since we find out whether the class is realized on the way, we'll remember that too.
+    
+        // The flags for class_r[ow]_t always are the first uint32_t.  So just read that.
+        if (!IsPointerValid(m_objc_class.m_data_la, ptr_size, allow_NULLs, allow_tagged, check_version_specific))
         {
             m_valid = false;
             return;
         }
         
-        // sanity checks
-        lldb::addr_t cache_ptr = process_sp->ReadPointerFromMemory(m_isa + 2*ptr_size, error);
+        uint32_t class_row_t_flags = process_sp->ReadUnsignedIntegerFromMemory(m_objc_class.m_data_la, sizeof(uint32_t), 0, error);
         if (error.Fail())
         {
             m_valid = false;
             return;
         }
-        if (!IsPointerValid(cache_ptr,ptr_size,true,false,true))
-        {
-            m_valid = false;
-            return;
-        }
         
-        lldb::addr_t rot_pointer;
+        m_realized = class_row_t_flags & RW_REALIZED;
         
-        // now construct the data object
+        lldb::addr_t class_ro_t_la = 0;
         
-        uint32_t flags;
-        process_sp->ReadMemory(data_ptr, &flags, 4, error);
-        if (error.Fail())
-        {
-            m_valid = false;
-            return;
-        }
-
-        if (flags & RW_REALIZED)
+        if (m_realized)
         {
-            m_realized = true;
-            rot_pointer = process_sp->ReadPointerFromMemory(data_ptr + 8, error);
+            lldb::addr_t class_rw_t_la = m_objc_class.m_data_la;
+            
+            class_ro_t_la = process_sp->ReadPointerFromMemory(class_rw_t_la
+                                                              + sizeof(uint32_t)    // uint32_t flags
+                                                              + sizeof(uint32_t),   // uint32_t version
+                                                              error);
+            
+            if (error.Fail())
+            {
+                m_valid = false;
+                return;
+            }
         }
         else
         {
-            m_realized = false;
-            rot_pointer = data_ptr;
+            class_ro_t_la = m_objc_class.m_data_la;
         }
         
-        if (error.Fail())
+        if (!IsPointerValid(class_ro_t_la, ptr_size))
         {
             m_valid = false;
             return;
         }
         
-        if (!IsPointerValid(rot_pointer,ptr_size))
+        // Now that we have a handle on class_ro_t_la, read the desired data out
+        
+        m_instance_size = process_sp->ReadUnsignedIntegerFromMemory(class_ro_t_la
+                                                                    + sizeof(uint32_t)                        // uint32_t flags
+                                                                    + sizeof(uint32_t),                       // uint32_t instanceStart
+                                                                    sizeof(uint32_t),
+                                                                    0,
+                                                                    error);
+        
+        if (error.Fail())
         {
             m_valid = false;
             return;
         }
         
-        // now read from the rot
-        
-        lldb::addr_t name_ptr = process_sp->ReadPointerFromMemory(rot_pointer + (ptr_size == 8 ? 24 : 16) ,error);
+        lldb::addr_t name_ptr = process_sp->ReadPointerFromMemory(class_ro_t_la
+                                                                  + sizeof(uint32_t)                        // uint32_t flags
+                                                                  + sizeof(uint32_t)                        // uint32_t instanceStart
+                                                                  + sizeof(uint32_t)                        // uint32_t instanceSize
+                                                                  + (ptr_size == 8 ? sizeof(uint32_t) : 0)  // uint32_t reserved (__LP64__ only)
+                                                                  + ptr_size,                               // const uint8_t *ivarLayout
+                                                                  error);
         
         if (error.Fail())
         {
@@ -1158,9 +1251,10 @@
             return;
         }
         
-        lldb::DataBufferSP buffer_sp(new DataBufferHeap(1024, 0));
+        const size_t buffer_size = 1024;
         
-        size_t count = process_sp->ReadCStringFromMemory(name_ptr, (char*)buffer_sp->GetBytes(), 1024, error);
+        DataBufferHeap buffer(buffer_size, 0);
+        size_t count = process_sp->ReadCStringFromMemory(name_ptr, (char*)buffer.GetBytes(), buffer_size, error);
         
         if (error.Fail())
         {
@@ -1169,24 +1263,274 @@
         }
         
         if (count)
-            m_name = ConstString((char*)buffer_sp->GetBytes());
+            m_name = ConstString((char*)buffer.GetBytes());
         else
             m_name = ConstString();
-        
-        m_instance_size = process_sp->ReadUnsignedIntegerFromMemory(rot_pointer + 8, ptr_size, 0, error);
-        
+                
         m_process_wp = lldb::ProcessWP(process_sp);
     }
-    
+        
 private:
     static const uint32_t RW_REALIZED = (1 << 31);
-    ConstString m_name;
-    ObjCLanguageRuntime::ObjCISA m_isa;
-    ObjCLanguageRuntime::ObjCISA m_parent_isa;
-    bool m_valid;
+    
+    ObjCLanguageRuntime                &m_runtime;          // The runtime, so we can read our metaclass.
+    bool                                m_valid;            // Gates whether we trust anything here at all.
+    lldb::addr_t                        m_objc_class_la;    // The address of the objc_class_t.
+    
+    struct objc_class_t {
+        ObjCLanguageRuntime::ObjCISA    m_isa;              // The class's metaclass.
+        ObjCLanguageRuntime::ObjCISA    m_superclass;
+        lldb::addr_t                    m_cache_la;
+        lldb::addr_t                    m_vtable_la;
+        lldb::addr_t                    m_data_la;
+        uint8_t                         m_flags;
+        
+        bool Read(ProcessSP &process_sp, lldb::addr_t addr)
+        {
+            size_t ptr_size = process_sp->GetAddressByteSize();
+            
+            size_t objc_class_size = ptr_size   // uintptr_t isa;
+                                   + ptr_size   // Class superclass;
+                                   + ptr_size   // void *cache;
+                                   + ptr_size   // IMP *vtable;
+                                   + ptr_size;  // uintptr_t data_NEVER_USE;
+            
+            DataBufferHeap objc_class_buf (objc_class_size, '\0');
+            Error error;
+            
+            process_sp->ReadMemory(addr, objc_class_buf.GetBytes(), objc_class_size, error);
+            if (error.Fail())
+            {
+                return false;
+            }
+            
+            DataExtractor extractor(objc_class_buf.GetBytes(), objc_class_size, process_sp->GetByteOrder(), process_sp->GetAddressByteSize());
+            
+            uint32_t cursor = 0;
+            
+            m_isa                       = extractor.GetAddress_unchecked(&cursor);   // uintptr_t isa;
+            m_superclass                = extractor.GetAddress_unchecked(&cursor);   // Class superclass;
+            m_cache_la                  = extractor.GetAddress_unchecked(&cursor);   // void *cache;
+            m_vtable_la                 = extractor.GetAddress_unchecked(&cursor);   // IMP *vtable;
+            lldb::addr_t data_NEVER_USE = extractor.GetAddress_unchecked(&cursor);   // uintptr_t data_NEVER_USE;
+            
+            m_flags     = (uint8_t)(data_NEVER_USE & (lldb::addr_t)3);
+            m_data_la   = data_NEVER_USE & ~(lldb::addr_t)3;
+            
+            return true;
+        }
+    };
+    
+    objc_class_t                        m_objc_class;
+    
+    // cached information from the class_r[ow]_t
+    ConstString                         m_name;
+    uint32_t                            m_instance_size;
+    bool                                m_realized;
+    
+    struct class_ro_t {
+        uint32_t                        m_flags;
+        uint32_t                        m_instanceStart;
+        uint32_t                        m_instanceSize;
+        uint32_t                        m_reserved;
+        
+        lldb::addr_t                    m_ivarLayout_la;
+        lldb::addr_t                    m_name_la;
+        lldb::addr_t                    m_baseMethods_la;
+        lldb::addr_t                    m_baseProtocols_la;
+        lldb::addr_t                    m_ivars_la;
+        
+        lldb::addr_t                    m_weakIvarLayout_la;
+        lldb::addr_t                    m_baseProperties_la;
+        
+        bool Read(ProcessSP &process_sp, lldb::addr_t addr)
+        {
+            size_t ptr_size = process_sp->GetAddressByteSize();
+            
+            size_t size = sizeof(uint32_t)                         // uint32_t flags;
+                        + sizeof(uint32_t)                         // uint32_t instanceStart;
+                        + sizeof(uint32_t)                         // uint32_t instanceSize;
+                        + (ptr_size == 8 ? sizeof(uint32_t) : 0)   // uint32_t reserved; // __LP64__ only
+                        + ptr_size                                 // const uint8_t *ivarLayout;
+                        + ptr_size                                 // const char *name;
+                        + ptr_size                                 // const method_list_t *baseMethods;
+                        + ptr_size                                 // const protocol_list_t *baseProtocols;
+                        + ptr_size                                 // const ivar_list_t *ivars;
+                        + ptr_size                                 // const uint8_t *weakIvarLayout;
+                        + ptr_size;                                // const property_list_t *baseProperties;
+            
+            DataBufferHeap buffer (size, '\0');
+            Error error;
+            
+            process_sp->ReadMemory(addr, buffer.GetBytes(), size, error);
+            if (error.Fail())
+            {
+                return false;
+            }
+            
+            DataExtractor extractor(buffer.GetBytes(), size, process_sp->GetByteOrder(), process_sp->GetAddressByteSize());
+            
+            uint32_t cursor = 0;
+            
+            m_flags             = extractor.GetU32_unchecked(&cursor);
+            m_instanceStart     = extractor.GetU32_unchecked(&cursor);
+            m_instanceSize      = extractor.GetU32_unchecked(&cursor);
+            if (ptr_size == 8)
+                m_reserved      = extractor.GetU32_unchecked(&cursor);
+            else
+                m_reserved      = 0;
+            m_ivarLayout_la     = extractor.GetAddress_unchecked(&cursor);
+            m_name_la           = extractor.GetAddress_unchecked(&cursor);
+            m_baseMethods_la    = extractor.GetAddress_unchecked(&cursor);
+            m_baseProtocols_la  = extractor.GetAddress_unchecked(&cursor);
+            m_ivars_la          = extractor.GetAddress_unchecked(&cursor);
+            m_weakIvarLayout_la = extractor.GetAddress_unchecked(&cursor);
+            m_baseProperties_la = extractor.GetAddress_unchecked(&cursor);
+            
+            return true;
+        }
+    };
+    
+    struct class_rw_t {
+        uint32_t                        m_flags;
+        uint32_t                        m_version;
+        
+        lldb::addr_t                    m_ro_la;
+        union {
+            lldb::addr_t                m_method_list_la;
+            lldb::addr_t                m_method_lists_la;
+        };
+        lldb::addr_t                    m_properties_la;
+        lldb::addr_t                    m_protocols_la;
+        
+        ObjCLanguageRuntime::ObjCISA    m_firstSubclass;
+        ObjCLanguageRuntime::ObjCISA    m_nextSiblingClass;
+        
+        bool Read(ProcessSP &process_sp, lldb::addr_t addr)
+        {
+            size_t ptr_size = process_sp->GetAddressByteSize();
+            
+            size_t size = sizeof(uint32_t)  // uint32_t flags;
+                        + sizeof(uint32_t)  // uint32_t version;
+                        + ptr_size          // const class_ro_t *ro;
+                        + ptr_size          // union { method_list_t **method_lists; method_list_t *method_list; };
+                        + ptr_size          // struct chained_property_list *properties;
+                        + ptr_size          // const protocol_list_t **protocols;
+                        + ptr_size          // Class firstSubclass;
+                        + ptr_size;         // Class nextSiblingClass;
+            
+            DataBufferHeap buffer (size, '\0');
+            Error error;
+            
+            process_sp->ReadMemory(addr, buffer.GetBytes(), size, error);
+            if (error.Fail())
+            {
+                return false;
+            }
+            
+            DataExtractor extractor(buffer.GetBytes(), size, process_sp->GetByteOrder(), process_sp->GetAddressByteSize());
+            
+            uint32_t cursor = 0;
+            
+            m_flags             = extractor.GetU32_unchecked(&cursor);
+            m_version           = extractor.GetU32_unchecked(&cursor);
+            m_ro_la             = extractor.GetAddress_unchecked(&cursor);
+            m_method_list_la    = extractor.GetAddress_unchecked(&cursor);
+            m_properties_la     = extractor.GetAddress_unchecked(&cursor);
+            m_firstSubclass     = extractor.GetAddress_unchecked(&cursor);
+            m_nextSiblingClass  = extractor.GetAddress_unchecked(&cursor);
+            
+            return true;
+        }
+    };
+    
+    struct method_list_t
+    {
+        uint32_t        m_entsize;
+        uint32_t        m_count;
+        lldb::addr_t    m_first_la;
+        
+        bool Read(ProcessSP &process_sp, lldb::addr_t addr)
+        {            
+            size_t size = sizeof(uint32_t)  // uint32_t entsize_NEVER_USE;
+                        + sizeof(uint32_t); // uint32_t count;
+            
+            DataBufferHeap buffer (size, '\0');
+            Error error;
+            
+            process_sp->ReadMemory(addr, buffer.GetBytes(), size, error);
+            if (error.Fail())
+            {
+                return false;
+            }
+            
+            DataExtractor extractor(buffer.GetBytes(), size, process_sp->GetByteOrder(), process_sp->GetAddressByteSize());
+            
+            uint32_t cursor = 0;
+            
+            m_entsize   = extractor.GetU32_unchecked(&cursor) & ~(uint32_t)3;
+            m_count     = extractor.GetU32_unchecked(&cursor);
+            m_first_la  = addr + cursor;
+            
+            return true;
+        }
+    };
+    
+    struct method_t
+    {
+        lldb::addr_t    m_name_la;
+        lldb::addr_t    m_types_la;
+        lldb::addr_t    m_imp_la;
+        
+        std::string     m_name;
+        std::string     m_types;
+        
+        static size_t GetSize(ProcessSP &process_sp)
+        {
+            size_t ptr_size = process_sp->GetAddressByteSize();
+
+            return ptr_size     // SEL name;
+                   + ptr_size   // const char *types;
+                   + ptr_size;  // IMP imp;
+        }
+        
+        bool Read(ProcessSP &process_sp, lldb::addr_t addr)
+        {
+            size_t size = GetSize(process_sp);
+            
+            DataBufferHeap buffer (size, '\0');
+            Error error;
+            
+            process_sp->ReadMemory(addr, buffer.GetBytes(), size, error);
+            if (error.Fail())
+            {
+                return false;
+            }
+            
+            DataExtractor extractor(buffer.GetBytes(), size, process_sp->GetByteOrder(), process_sp->GetAddressByteSize());
+            
+            uint32_t cursor = 0;
+            
+            m_name_la   = extractor.GetAddress_unchecked(&cursor);
+            m_types_la  = extractor.GetAddress_unchecked(&cursor);
+            m_imp_la    = extractor.GetAddress_unchecked(&cursor);
+            
+            const size_t buffer_size = 1024;
+            size_t count;
+            
+            DataBufferHeap string_buf(buffer_size, 0);
+            
+            count = process_sp->ReadCStringFromMemory(m_name_la, (char*)string_buf.GetBytes(), buffer_size, error);
+            m_name.assign((char*)string_buf.GetBytes(), count);
+            
+            count = process_sp->ReadCStringFromMemory(m_types_la, (char*)string_buf.GetBytes(), buffer_size, error);
+            m_types.assign((char*)string_buf.GetBytes(), count);
+            
+            return true;
+        }
+    };
+    
     lldb::ProcessWP m_process_wp;
-    uint64_t m_instance_size;
-    bool m_realized;
 };
 
 class ClassDescriptorV2Tagged : public ObjCLanguageRuntime::ClassDescriptor
@@ -1391,7 +1735,7 @@
     if (found != end && found->second)
         return found->second;
     
-    ClassDescriptorSP descriptor = ClassDescriptorSP(new ClassDescriptorV2(isa,m_process->CalculateProcess()));
+    ClassDescriptorSP descriptor = ClassDescriptorSP(new ClassDescriptorV2(*this, isa, m_process->CalculateProcess()));
     if (descriptor && descriptor->IsValid())
         m_isa_to_descriptor_cache[descriptor->GetISA()] = descriptor;
     return descriptor;
@@ -1416,7 +1760,7 @@
     
     if (ptr_value & 1)
         return ClassDescriptorSP(new ClassDescriptorV2Tagged(in_value)); // do not save tagged pointers
-    descriptor = ClassDescriptorSP(new ClassDescriptorV2(in_value));
+    descriptor = ClassDescriptorSP(new ClassDescriptorV2(*this, in_value));
     
     if (descriptor && descriptor->IsValid())
         m_isa_to_descriptor_cache[descriptor->GetISA()] = descriptor;
@@ -1508,9 +1852,9 @@
             if (m_isa_to_descriptor_cache.count(elt.second))
                 continue;
             
-            ClassDescriptorSP descriptor_sp = ClassDescriptorSP(new ClassDescriptorV2(elt.second, process_sp));
+            ClassDescriptorSP descriptor_sp = ClassDescriptorSP(new ClassDescriptorV2(*this, elt.second, process_sp));
             
-            if (log)
+            if (log && log->GetVerbose())
                 log->Printf("AppleObjCRuntimeV2 added (ObjCISA)0x%llx (%s) from dynamic table to isa->descriptor cache", elt.second, elt.first.AsCString());
             
             m_isa_to_descriptor_cache[elt.second] = descriptor_sp;
@@ -1554,9 +1898,9 @@
             if (m_isa_to_descriptor_cache.count(objc_isa))
                 continue;
             
-            ClassDescriptorSP descriptor_sp = ClassDescriptorSP(new ClassDescriptorV2(objc_isa, process_sp));
+            ClassDescriptorSP descriptor_sp = ClassDescriptorSP(new ClassDescriptorV2(*this, objc_isa, process_sp));
             
-            if (log)
+            if (log && log->GetVerbose())
                 log->Printf("AppleObjCRuntimeV2 added (ObjCISA)0x%llx (%s) from static table to isa->descriptor cache", objc_isa, descriptor_sp->GetClassName().AsCString());
             
             m_isa_to_descriptor_cache[objc_isa] = descriptor_sp;

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=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeVendor.cpp (original)
+++ lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeVendor.cpp Fri Sep 28 06:07:34 2012
@@ -31,9 +31,40 @@
     }
     
     clang::DeclContextLookupResult
-    FindExternalVisibleDeclsByName (const clang::DeclContext *DC,
-                                    clang::DeclarationName Name)
+    FindExternalVisibleDeclsByName (const clang::DeclContext *decl_ctx,
+                                    clang::DeclarationName name)
     {
+        static unsigned int invocation_id = 0;
+        unsigned int current_id = invocation_id++;
+
+        lldb::LogSP log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));  // FIXME - a more appropriate log channel?
+
+        if (log)
+        {
+            log->Printf("AppleObjCExternalASTSource::FindExternalVisibleDeclsByName[%u] on (ASTContext*)%p Looking for %s in (%sDecl*)%p",
+                        current_id,
+                        &decl_ctx->getParentASTContext(),
+                        name.getAsString().c_str(),
+                        decl_ctx->getDeclKindName(),
+                        decl_ctx);
+        }
+        
+        do
+        {
+            const clang::ObjCInterfaceDecl *interface_decl = llvm::dyn_cast<clang::ObjCInterfaceDecl>(decl_ctx);
+        
+            if (!interface_decl)
+                break;
+            
+            clang::ObjCInterfaceDecl *non_const_interface_decl = const_cast<clang::ObjCInterfaceDecl*>(interface_decl);
+
+            if (!m_type_vendor.FinishDecl(non_const_interface_decl))
+                break;
+                        
+            return non_const_interface_decl->lookup(name);
+        }
+        while(0);
+        
         return clang::DeclContextLookupResult();
     }
     
@@ -46,14 +77,62 @@
     }
     
     void
-    CompleteType (clang::TagDecl *Tag)
+    CompleteType (clang::TagDecl *tag_decl)
     {
+        static unsigned int invocation_id = 0;
+        unsigned int current_id = invocation_id++;
+
+        lldb::LogSP log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));  // FIXME - a more appropriate log channel?
+        
+        if (log)
+        {
+            log->Printf("AppleObjCExternalASTSource::CompleteType[%u] on (ASTContext*)%p Completing (TagDecl*)%p named %s",
+                        current_id,
+                        &tag_decl->getASTContext(),
+                        tag_decl,
+                        tag_decl->getName().str().c_str());
+            
+            log->Printf("  AOEAS::CT[%u] Before:", current_id);
+            ASTDumper dumper((clang::Decl*)tag_decl);
+            dumper.ToLog(log, "    [CT] ");
+        }
+        
+        if (log)
+        {
+            log->Printf("  AOEAS::CT[%u] After:", current_id);
+            ASTDumper dumper((clang::Decl*)tag_decl);
+            dumper.ToLog(log, "    [CT] ");
+        }
         return;
     }
     
     void
-    CompleteType (clang::ObjCInterfaceDecl *Class)
+    CompleteType (clang::ObjCInterfaceDecl *interface_decl)
     {
+        static unsigned int invocation_id = 0;
+        unsigned int current_id = invocation_id++;
+        
+        lldb::LogSP log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));  // FIXME - a more appropriate log channel?
+        
+        if (log)
+        {
+            log->Printf("AppleObjCExternalASTSource::CompleteType[%u] on (ASTContext*)%p Completing (ObjCInterfaceDecl*)%p named %s",
+                        current_id,
+                        &interface_decl->getASTContext(),
+                        interface_decl,
+                        interface_decl->getName().str().c_str());
+            
+            log->Printf("  AOEAS::CT[%u] Before:", current_id);
+            ASTDumper dumper((clang::Decl*)interface_decl);
+            dumper.ToLog(log, "    [CT] ");
+        }
+                
+        if (log)
+        {
+            log->Printf("  [CT] After:");
+            ASTDumper dumper((clang::Decl*)interface_decl);
+            dumper.ToLog(log, "    [CT] ");
+        }
         return;
     }
     
@@ -75,7 +154,7 @@
         translation_unit_decl->setHasExternalLexicalStorage();
     }
 private:
-    AppleObjCTypeVendor &m_type_vendor;
+    AppleObjCTypeVendor                                    &m_type_vendor;
 };
 
 AppleObjCTypeVendor::AppleObjCTypeVendor(ObjCLanguageRuntime &runtime) :
@@ -88,6 +167,387 @@
     m_ast_ctx.getASTContext()->setExternalSource(external_source_owning_ptr);
 }
 
+clang::ObjCInterfaceDecl*
+AppleObjCTypeVendor::GetDeclForISA(ObjCLanguageRuntime::ObjCISA isa)
+{
+    ISAToInterfaceMap::const_iterator iter = m_isa_to_interface.find(isa);
+    
+    if (iter != m_isa_to_interface.end())
+        return iter->second;
+    
+    clang::ASTContext *ast_ctx = m_ast_ctx.getASTContext();
+    
+    ObjCLanguageRuntime::ClassDescriptorSP descriptor = m_runtime.GetClassDescriptor(isa);
+    
+    if (!descriptor)
+        return NULL;
+    
+    const ConstString &name(descriptor->GetClassName());
+    
+    clang::IdentifierInfo &identifier_info = ast_ctx->Idents.get(name.GetStringRef());
+
+    clang::ObjCInterfaceDecl *new_iface_decl = clang::ObjCInterfaceDecl::Create(*ast_ctx,
+                                                                                ast_ctx->getTranslationUnitDecl(),
+                                                                                clang::SourceLocation(),
+                                                                                &identifier_info,
+                                                                                NULL);
+    
+    m_external_source->SetMetadata((uintptr_t)new_iface_decl, (uint64_t)isa);
+    
+    new_iface_decl->setHasExternalVisibleStorage();
+    
+    ast_ctx->getTranslationUnitDecl()->addDecl(new_iface_decl);
+    
+    m_isa_to_interface[isa] = new_iface_decl;
+    
+    return new_iface_decl;
+}
+
+class ObjCRuntimeMethodType
+{
+public:
+    ObjCRuntimeMethodType (const char *types) : m_is_valid(false)
+    {
+        const char *cursor = types;
+        enum ParserState {
+            Start = 0,
+            InType,
+            InPos
+        } state = Start;
+        const char *type = NULL;
+        int brace_depth = 0;
+        
+        uint32_t stepsLeft = 256;
+        
+        while (1)
+        {
+            if (--stepsLeft == 0)
+            {
+                m_is_valid = false;
+                return;
+            }
+            
+            switch (state)
+            {
+            case Start:
+                {
+                    switch (*cursor)
+                    {
+                    default:
+                        state = InType;
+                        type = cursor;
+                        break;
+                    case '\0':
+                        m_is_valid = true;
+                        return;
+                    case '0': case '1': case '2': case '3': case '4':
+                    case '5': case '6': case '7': case '8': case '9':
+                        m_is_valid = false;
+                        return;
+                    }
+                }
+                break;
+            case InType:
+                {
+                    switch (*cursor)
+                    {
+                    default:
+                        ++cursor;
+                        break;
+                    case '0': case '1': case '2': case '3': case '4':
+                    case '5': case '6': case '7': case '8': case '9':
+                        if (!brace_depth)
+                        {
+                            state = InPos;
+                            if (type)
+                            {
+                                m_type_vector.push_back(std::string(type, (cursor - type)));
+                            }
+                            else
+                            {
+                                m_is_valid = false;
+                                return;
+                            }
+                            type = NULL;
+                        }
+                        else
+                        {
+                            ++cursor;
+                        }
+                        break;
+                    case '[': case '{': case '(':
+                        ++brace_depth;
+                        ++cursor;
+                        break;
+                    case ']': case '}': case ')':
+                        if (!brace_depth)
+                        {
+                            m_is_valid = false;
+                            return;
+                        }
+                        --brace_depth;
+                        ++cursor;
+                        break;
+                    case '\0':
+                        m_is_valid = false;
+                        return;
+                    }
+                }
+                break;
+            case InPos:
+                {
+                    switch (*cursor)
+                    {
+                    default:
+                        state = InType;
+                        type = cursor;
+                        break;
+                    case '0': case '1': case '2': case '3': case '4':
+                    case '5': case '6': case '7': case '8': case '9':
+                        ++cursor;
+                        break;
+                    case '\0':
+                        m_is_valid = true;
+                        return;
+                    }
+                }
+                break;
+            }
+        }
+    }
+    
+    clang::ObjCMethodDecl *BuildMethod (clang::ObjCInterfaceDecl *interface_decl, const char *name, bool instance)
+    {
+        lldb::LogSP log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));  // FIXME - a more appropriate log channel?
+        
+        if (!m_is_valid || m_type_vector.size() < 3)
+            return NULL;
+        
+        clang::ASTContext &ast_ctx(interface_decl->getASTContext());
+        
+        clang::QualType return_qual_type;
+        
+        const bool isInstance = instance;
+        const bool isVariadic = false;
+        const bool isSynthesized = false;
+        const bool isImplicitlyDeclared = true;
+        const bool isDefined = false;
+        const clang::ObjCMethodDecl::ImplementationControl impControl = clang::ObjCMethodDecl::None;
+        const bool HasRelatedResultType = false;
+        
+        std::vector <clang::IdentifierInfo *> selector_components;
+        
+        const char *name_cursor = name;
+        bool is_zero_argument = true;
+        
+        while (*name_cursor != '\0')
+        {
+            char *colon_loc = strchr(name_cursor, ':');
+            if (!colon_loc)
+            {
+                selector_components.push_back(&ast_ctx.Idents.get(llvm::StringRef(name_cursor)));
+                break;
+            }
+            else
+            {
+                is_zero_argument = true;
+                selector_components.push_back(&ast_ctx.Idents.get(llvm::StringRef(name_cursor, colon_loc - name_cursor)));
+                name_cursor = colon_loc + 1;
+            }
+        }
+        
+        clang::Selector sel = ast_ctx.Selectors.getSelector(is_zero_argument ? 0 : selector_components.size(), selector_components.data());
+        
+        clang::QualType ret_type = BuildType(ast_ctx, m_type_vector[0].c_str());
+        
+        if (ret_type.isNull())
+            return NULL;
+        
+        clang::ObjCMethodDecl *ret = clang::ObjCMethodDecl::Create(ast_ctx,
+                                                                   clang::SourceLocation(),
+                                                                   clang::SourceLocation(),
+                                                                   sel,
+                                                                   ret_type,
+                                                                   NULL,
+                                                                   interface_decl,
+                                                                   isInstance,
+                                                                   isVariadic,
+                                                                   isSynthesized,
+                                                                   isImplicitlyDeclared,
+                                                                   isDefined,
+                                                                   impControl,
+                                                                   HasRelatedResultType);
+        
+        std::vector <clang::ParmVarDecl*> parm_vars;
+        
+        for (size_t ai = 3, ae = m_type_vector.size();
+             ai != ae;
+             ++ai)
+        {
+            clang::QualType arg_type = BuildType(ast_ctx, m_type_vector[ai].c_str());
+            
+            if (arg_type.isNull())
+                return NULL; // well, we just wasted a bunch of time.  Wish we could delete the stuff we'd just made!
+
+            parm_vars.push_back(clang::ParmVarDecl::Create(ast_ctx,
+                                                           ret,
+                                                           clang::SourceLocation(),
+                                                           clang::SourceLocation(),
+                                                           NULL,
+                                                           arg_type,
+                                                           NULL,
+                                                           clang::SC_None,
+                                                           clang::SC_None,
+                                                           NULL));
+        }
+        
+        ret->setMethodParams(ast_ctx, llvm::ArrayRef<clang::ParmVarDecl*>(parm_vars), llvm::ArrayRef<clang::SourceLocation>());
+        
+        return ret;
+    }
+private:
+    clang::QualType BuildType (clang::ASTContext &ast_ctx, const char *type)
+    {
+        if (!type)
+            return clang::QualType();
+        
+        switch (*type)
+        {
+        default:
+            return ast_ctx.UnknownAnyTy;
+        case 'r':
+            {
+                clang::QualType target_type = BuildType(ast_ctx, type+1);
+                if (target_type.isNull())
+                    return clang::QualType();
+                else
+                    return ast_ctx.getConstType(target_type);
+            }
+        case '^':
+        {
+            clang::QualType target_type = BuildType(ast_ctx, type+1);
+            if (target_type.isNull())
+                return clang::QualType();
+            else
+                return ast_ctx.getPointerType(target_type);
+        }
+        case 'c':
+            return ast_ctx.CharTy;
+        case 'i':
+            return ast_ctx.IntTy;
+        case 's':
+            return ast_ctx.ShortTy;
+        case 'l':
+            if (ast_ctx.getTypeSize(ast_ctx.VoidTy) == 64)
+                return ast_ctx.IntTy;
+            else
+                return ast_ctx.LongTy;
+        case 'q':
+            return ast_ctx.LongLongTy;
+        case 'C':
+            return ast_ctx.UnsignedCharTy;
+        case 'I':
+            return ast_ctx.UnsignedIntTy;
+        case 'S':
+            return ast_ctx.UnsignedShortTy;
+        case 'L':
+            if (ast_ctx.getTypeSize(ast_ctx.VoidTy) == 64)
+                return ast_ctx.UnsignedIntTy;
+            else
+                return ast_ctx.UnsignedLongTy;
+        case 'Q':
+            return ast_ctx.UnsignedLongLongTy;
+        case 'f':
+            return ast_ctx.FloatTy;
+        case 'd':
+            return ast_ctx.DoubleTy;
+        case 'B':
+            return ast_ctx.BoolTy;
+        case 'v':
+            return ast_ctx.VoidTy;
+        case '*':
+            return ast_ctx.getPointerType(ast_ctx.CharTy);
+        case '@':
+            return ast_ctx.getObjCIdType();
+        case '#':
+            return ast_ctx.getObjCClassType();
+        case ':':
+            return ast_ctx.getObjCSelType();
+        }
+        return clang::QualType();
+    }
+    
+    typedef std::vector <std::string> TypeVector;
+    
+    TypeVector  m_type_vector;
+    bool        m_is_valid;
+};
+
+bool
+AppleObjCTypeVendor::FinishDecl(clang::ObjCInterfaceDecl *interface_decl)
+{
+    lldb::LogSP log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));  // FIXME - a more appropriate log channel?
+    
+    ObjCLanguageRuntime::ObjCISA objc_isa = (ObjCLanguageRuntime::ObjCISA)m_external_source->GetMetadata((uintptr_t)interface_decl);
+    
+    if (!objc_isa)
+        return false;
+    
+    if (!interface_decl->hasExternalVisibleStorage())
+        return true;
+    
+    interface_decl->startDefinition();
+    
+    interface_decl->setHasExternalVisibleStorage(false);
+    
+    ObjCLanguageRuntime::ClassDescriptorSP descriptor = m_runtime.GetClassDescriptor(objc_isa);
+    
+    if (!descriptor)
+        return false;
+    
+    auto superclass_func = [interface_decl, this](ObjCLanguageRuntime::ObjCISA isa)
+    {
+        clang::ObjCInterfaceDecl *superclass_decl = GetDeclForISA(isa);
+        if (!superclass_decl)
+            return;
+        interface_decl->setSuperClass(superclass_decl);
+    };
+    
+    auto instance_method_func = [log, interface_decl, this](const char *name, const char *types)
+    {        
+        ObjCRuntimeMethodType method_type(types);
+        
+        clang::ObjCMethodDecl *method_decl = method_type.BuildMethod (interface_decl, name, true);
+        
+        if (method_decl)
+            interface_decl->addDecl(method_decl);
+    };
+    
+    auto class_method_func = [log, interface_decl, this](const char *name, const char *types)
+    {
+        ObjCRuntimeMethodType method_type(types);
+        
+        clang::ObjCMethodDecl *method_decl = method_type.BuildMethod (interface_decl, name, false);
+        
+        if (method_decl)
+            interface_decl->addDecl(method_decl);
+    };
+    
+    if (!descriptor->Describe(superclass_func, instance_method_func, class_method_func))
+        return false;
+    
+    if (log)
+    {
+        ASTDumper method_dumper ((clang::Decl*)interface_decl);
+        
+        log->Printf("[AppleObjCTypeVendor::FinishDecl] Finished Objective-C interface");
+        
+        method_dumper.ToLog(log, "  [AOTV::FD] ");
+    }
+    
+    return true;
+}
+
 uint32_t
 AppleObjCTypeVendor::FindTypes (const ConstString &name,
                                 bool append,
@@ -111,6 +571,9 @@
     
     uint32_t ret = 0;
     
+    // TODO Remove this return once testing is complete.
+    return ret;
+    
     do
     {
         // See if the type is already in our ASTContext.
@@ -157,10 +620,7 @@
         }
         
         // It's not.  If it exists, we have to put it into our ASTContext.
-        
-        // TODO Actually do this.  But we have to search the class list first.  Until then we'll just give up.
-        break;
-        
+                
         ObjCLanguageRuntime::ObjCISA isa = m_runtime.GetISA(name);
     
         if (!isa)
@@ -172,17 +632,17 @@
             break;
         }
         
-        clang::ObjCInterfaceDecl *new_iface_decl = clang::ObjCInterfaceDecl::Create(*ast_ctx,
-                                                                                    ast_ctx->getTranslationUnitDecl(),
-                                                                                    clang::SourceLocation(),
-                                                                                    &identifier_info,
-                                                                                    NULL);
+        clang::ObjCInterfaceDecl *iface_decl = GetDeclForISA(isa);
         
-        m_external_source->SetMetadata((uintptr_t)new_iface_decl, (uint64_t)isa);
-        
-        new_iface_decl->setHasExternalVisibleStorage();
+        if (!iface_decl)
+        {
+            if (log)
+                log->Printf("AOCTV::FT [%u] Couldn't get the Objective-C interface for isa 0x%llx",
+                            current_id,
+                            (uint64_t)isa);
+        }
         
-        clang::QualType new_iface_type = ast_ctx->getObjCInterfaceType(new_iface_decl);
+        clang::QualType new_iface_type = ast_ctx->getObjCInterfaceType(iface_decl);
         
         if (log)
         {
@@ -192,6 +652,10 @@
                         dumper.GetCString(),
                         (uint64_t)isa);
         }
+        
+        types.push_back(ClangASTType(ast_ctx, new_iface_type.getAsOpaquePtr()));
+        ret++;
+        break;
     } while (0);
     
     return ret;

Modified: lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeVendor.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeVendor.h?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeVendor.h (original)
+++ lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeVendor.h Fri Sep 28 06:07:34 2012
@@ -21,6 +21,7 @@
 #include "lldb/lldb-private.h"
 #include "lldb/Symbol/ClangASTContext.h"
 #include "lldb/Symbol/TypeVendor.h"
+#include "lldb/Target/ObjCLanguageRuntime.h"
 
 namespace lldb_private {
 
@@ -39,9 +40,16 @@
     
     friend class AppleObjCExternalASTSource;
 private:
-    ObjCLanguageRuntime            &m_runtime;
-    ClangASTContext                 m_ast_ctx;
-    AppleObjCExternalASTSource   *m_external_source;
+    clang::ObjCInterfaceDecl   *GetDeclForISA(ObjCLanguageRuntime::ObjCISA isa);
+    bool                        FinishDecl(clang::ObjCInterfaceDecl *decl);
+    
+    ObjCLanguageRuntime        &m_runtime;
+    ClangASTContext             m_ast_ctx;
+    AppleObjCExternalASTSource *m_external_source;
+    
+    typedef llvm::DenseMap<ObjCLanguageRuntime::ObjCISA, clang::ObjCInterfaceDecl *> ISAToInterfaceMap;
+
+    ISAToInterfaceMap           m_isa_to_interface;
 };
 
 } // namespace lldb_private

Modified: lldb/branches/windows/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp (original)
+++ lldb/branches/windows/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp Fri Sep 28 06:07:34 2012
@@ -147,7 +147,7 @@
 /// Default Constructor
 //------------------------------------------------------------------
 PlatformiOSSimulator::PlatformiOSSimulator () :
-    PlatformDarwin (false),
+    PlatformDarwin (true),
     m_sdk_directory ()
 {
 }

Modified: lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp (original)
+++ lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp Fri Sep 28 06:07:34 2012
@@ -42,7 +42,7 @@
     m_byte_order (eByteOrderLittle),
     m_packet_timeout (1),
     m_sequence_mutex (Mutex::eMutexTypeRecursive),
-    m_private_is_running (false),
+    m_is_running (false),
     m_session_key (0u),
     m_request_sequence_id (0u),
     m_exception_sequence_id (0u),
@@ -99,8 +99,23 @@
                                           const PacketStreamType &request_packet, 
                                           DataExtractor &reply_packet)
 {
+    if (IsRunning())
+    {
+        LogSP log (ProcessKDPLog::GetLogIfAllCategoriesSet (KDP_LOG_PACKETS));
+        if (log)
+        {
+            PacketStreamType log_strm;
+            DumpPacket (log_strm, request_packet.GetData(), request_packet.GetSize());
+            log->Printf("error: kdp running, not sending packet: %.*s", (uint32_t)log_strm.GetSize(), log_strm.GetData());
+        }
+        return false;
+    }
 
-    Mutex::Locker locker(m_sequence_mutex);    
+    Mutex::Locker locker(m_sequence_mutex);
+#ifdef LLDB_CONFIGURATION_DEBUG
+    // NOTE: this only works for packets that are in native endian byte order
+    assert (request_packet.GetSize() == *((uint16_t *)(request_packet.GetData() + 2)));
+#endif
     if (SendRequestPacketNoLock(request_packet))
     {
         if (WaitForPacketWithTimeoutMicroSecondsNoLock (reply_packet, GetPacketTimeoutInMicroSeconds ()))
@@ -111,7 +126,11 @@
             if ((reply_command & eCommandTypeMask) == command)
             {
                 if (request_sequence_id == reply_sequence_id)
+                {
+                    if (command == KDP_RESUMECPUS)
+                        m_is_running.SetValue(true, eBroadcastAlways);
                     return true;
+                }
             }
         }
     }
@@ -160,7 +179,7 @@
 bool
 CommunicationKDP::WaitForNotRunningPrivate (const TimeValue *timeout_ptr)
 {
-    return m_private_is_running.WaitForValueEqualTo (false, timeout_ptr, NULL);
+    return m_is_running.WaitForValueEqualTo (false, timeout_ptr, NULL);
 }
 
 size_t
@@ -256,6 +275,21 @@
         uint8_t reply_command = packet.GetU8(&offset);
         switch (reply_command)
         {
+        case ePacketTypeRequest | KDP_EXCEPTION:
+        case ePacketTypeRequest | KDP_TERMINATION:
+            // We got an exception request, so be sure to send an ACK
+            {
+                PacketStreamType request_ack_packet (Stream::eBinary, m_addr_byte_size, m_byte_order);
+                // Set the reply but and make the ACK packet
+                request_ack_packet.PutHex8 (reply_command | ePacketTypeReply);
+                request_ack_packet.PutHex8 (packet.GetU8(&offset));
+                request_ack_packet.PutHex16 (packet.GetU16(&offset));
+                request_ack_packet.PutHex32 (packet.GetU32(&offset));
+                m_is_running.SetValue(false, eBroadcastAlways);
+                // Ack to the exception or termination
+                SendRequestPacketNoLock (request_ack_packet);
+            }
+            // Fall through to case below to get packet contents
         case ePacketTypeReply | KDP_CONNECT:
         case ePacketTypeReply | KDP_DISCONNECT:
         case ePacketTypeReply | KDP_HOSTINFO:
@@ -269,8 +303,6 @@
         case ePacketTypeReply | KDP_IMAGEPATH:
         case ePacketTypeReply | KDP_SUSPEND:
         case ePacketTypeReply | KDP_RESUMECPUS:
-        case ePacketTypeReply | KDP_EXCEPTION:
-        case ePacketTypeReply | KDP_TERMINATION:
         case ePacketTypeReply | KDP_BREAKPOINT_SET:
         case ePacketTypeReply | KDP_BREAKPOINT_REMOVE:
         case ePacketTypeReply | KDP_REGIONS:
@@ -676,12 +708,14 @@
         if (command_name)
         {
             const bool is_reply = ExtractIsReply(first_packet_byte);
-            s.Printf ("%s {%u:%u} <0x%4.4x> %s", 
-                      is_reply ? "<--" : "-->", 
-                      key,
+            s.Printf ("(running=%i) %s %24s: 0x%2.2x 0x%2.2x 0x%4.4x 0x%8.8x ",
+                      IsRunning(),
+                      is_reply ? "<--" : "-->",
+                      command_name,
+                      first_packet_byte,
                       sequence_id,
                       length,
-                      command_name);
+                      key);
             
             if (is_reply)
             {
@@ -932,7 +966,6 @@
                         {
                             const uint32_t count = packet.GetU32 (&offset);
                             
-                            s.Printf(" (count = %u:", count);
                             for (uint32_t i=0; i<count; ++i)
                             {
                                 const uint32_t cpu = packet.GetU32 (&offset);
@@ -956,7 +989,7 @@
                                         break;
                                 }
 
-                                s.Printf ("\n  cpu = 0x%8.8x, exc = %s (%u), code = %u (0x%8.8x), subcode = %u (0x%8.8x)\n", 
+                                s.Printf ("{ cpu = 0x%8.8x, exc = %s (%u), code = %u (0x%8.8x), subcode = %u (0x%8.8x)} ", 
                                           cpu, exc_cstr, exc, code, code, subcode, subcode);
                             }
                         }
@@ -1003,7 +1036,7 @@
 uint32_t
 CommunicationKDP::SendRequestReadRegisters (uint32_t cpu,
                                             uint32_t flavor,
-                                            void *dst, 
+                                            void *dst,
                                             uint32_t dst_len,
                                             Error &error)
 {
@@ -1032,7 +1065,7 @@
                 error.Clear();
                 // Return the number of bytes we could have returned regardless if
                 // we copied them or not, just so we know when things don't match up
-                return src_len; 
+                return src_len;
             }
         }
         if (kdp_error)
@@ -1043,18 +1076,44 @@
     return 0;
 }
 
+uint32_t
+CommunicationKDP::SendRequestWriteRegisters (uint32_t cpu,
+                                             uint32_t flavor,
+                                             const void *src,
+                                             uint32_t src_len,
+                                             Error &error)
+{
+    PacketStreamType request_packet (Stream::eBinary, m_addr_byte_size, m_byte_order);
+    const CommandType command = KDP_WRITEREGS;
+    // Size is header + 4 byte cpu and 4 byte flavor
+    const uint32_t command_length = 8 + 4 + 4 + src_len;
+    const uint32_t request_sequence_id = m_request_sequence_id;
+    MakeRequestPacketHeader (command, request_packet, command_length);
+    request_packet.PutHex32 (cpu);
+    request_packet.PutHex32 (flavor);
+    request_packet.Write(src, src_len);
+    DataExtractor reply_packet;
+    if (SendRequestAndGetReply (command, request_sequence_id, request_packet, reply_packet))
+    {
+        uint32_t offset = 8;
+        uint32_t kdp_error = reply_packet.GetU32 (&offset);
+        if (kdp_error == 0)
+            return src_len;
+        error.SetErrorStringWithFormat("failed to read kdp registers for cpu %u flavor %u (error %u)", cpu, flavor, kdp_error);
+    }
+    return 0;
+}
+
 
 bool
-CommunicationKDP::SendRequestResume (uint32_t cpu_mask)
+CommunicationKDP::SendRequestResume ()
 {
-    if (cpu_mask == 0)
-        cpu_mask = GetCPUMask();
     PacketStreamType request_packet (Stream::eBinary, m_addr_byte_size, m_byte_order);
     const CommandType command = KDP_RESUMECPUS;
     const uint32_t command_length = 12;
     const uint32_t request_sequence_id = m_request_sequence_id;
     MakeRequestPacketHeader (command, request_packet, command_length);
-    request_packet.PutHex32(cpu_mask);
+    request_packet.PutHex32(GetCPUMask());
 
     DataExtractor reply_packet;
     if (SendRequestAndGetReply (command, request_sequence_id, request_packet, reply_packet))

Modified: lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.h?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.h (original)
+++ lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.h Fri Sep 28 06:07:34 2012
@@ -111,7 +111,7 @@
     bool
     IsRunning() const
     {
-        return m_public_is_running.GetValue();
+        return m_is_running.GetValue();
     }
 
     //------------------------------------------------------------------
@@ -177,7 +177,14 @@
                               void *dst, 
                               uint32_t dst_size,
                               lldb_private::Error &error);
-    
+
+    uint32_t
+    SendRequestWriteRegisters (uint32_t cpu,
+                               uint32_t flavor,
+                               const void *src,
+                               uint32_t src_size,
+                               lldb_private::Error &error);
+
     const char *
     GetKernelVersion ();
     
@@ -206,9 +213,8 @@
     uint32_t
     GetCPUSubtype ();
 
-    // If cpu_mask is zero, then we will resume all CPUs
     bool
-    SendRequestResume (uint32_t cpu_mask = 0);
+    SendRequestResume ();
 
     bool
     SendRequestSuspend ();
@@ -303,8 +309,7 @@
     lldb::ByteOrder m_byte_order;
     uint32_t m_packet_timeout;
     lldb_private::Mutex m_sequence_mutex;    // Restrict access to sending/receiving packets to a single thread at a time
-    lldb_private::Predicate<bool> m_public_is_running;
-    lldb_private::Predicate<bool> m_private_is_running;
+    lldb_private::Predicate<bool> m_is_running;
     uint32_t m_session_key;
     uint8_t m_request_sequence_id;
     uint8_t m_exception_sequence_id;

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=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp (original)
+++ lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp Fri Sep 28 06:07:34 2012
@@ -20,6 +20,7 @@
 #include "lldb/Core/State.h"
 #include "lldb/Host/Host.h"
 #include "lldb/Symbol/ObjectFile.h"
+#include "lldb/Target/RegisterContext.h"
 #include "lldb/Target/Target.h"
 #include "lldb/Target/Thread.h"
 
@@ -27,7 +28,6 @@
 #include "ProcessKDP.h"
 #include "ProcessKDPLog.h"
 #include "ThreadKDP.h"
-#include "StopInfoMachException.h"
 
 using namespace lldb;
 using namespace lldb_private;
@@ -101,10 +101,11 @@
     Process (target, listener),
     m_comm("lldb.process.kdp-remote.communication"),
     m_async_broadcaster (NULL, "lldb.process.kdp-remote.async-broadcaster"),
-    m_async_thread (LLDB_INVALID_HOST_THREAD)
+    m_async_thread (LLDB_INVALID_HOST_THREAD),
+    m_destroy_in_process (false)
 {
-//    m_async_broadcaster.SetEventName (eBroadcastBitAsyncThreadShouldExit,   "async thread should exit");
-//    m_async_broadcaster.SetEventName (eBroadcastBitAsyncContinue,           "async thread continue");
+    m_async_broadcaster.SetEventName (eBroadcastBitAsyncThreadShouldExit,   "async thread should exit");
+    m_async_broadcaster.SetEventName (eBroadcastBitAsyncContinue,           "async thread continue");
 }
 
 //----------------------------------------------------------------------
@@ -168,11 +169,18 @@
 Error
 ProcessKDP::DoConnectRemote (const char *remote_url)
 {
-    // TODO: fill in the remote connection to the remote KDP here!
     Error error;
-    
+
+    // Don't let any JIT happen when doing KDP as we can't allocate
+    // memory and we don't want to be mucking with threads that might
+    // already be handling exceptions
+    SetCanJIT(false);
+
     if (remote_url == NULL || remote_url[0] == '\0')
-        remote_url = "udp://localhost:41139";
+    {
+        error.SetErrorStringWithFormat ("invalid connection URL '%s'", remote_url);
+        return error;
+    }
 
     std::auto_ptr<ConnectionFileDescriptor> conn_ap(new ConnectionFileDescriptor());
     if (conn_ap.get())
@@ -206,6 +214,8 @@
                     ArchSpec kernel_arch;
                     kernel_arch.SetArchitecture(eArchTypeMachO, cpu, sub);
                     m_target.SetArchitecture(kernel_arch);
+                    // Set the thread ID
+                    UpdateThreadListIfNeeded ();
                     SetID (1);
                     GetThreadList ();
                     SetPrivateState (eStateStopped);
@@ -225,10 +235,16 @@
 //                      }            
                     }
                 }
+                else
+                {
+                    puts ("KDP_CONNECT failed"); // REMOVE THIS
+                    error.SetErrorString("KDP_REATTACH failed");
+                }
             }
             else
             {
-                error.SetErrorString("KDP reattach failed");
+                puts ("KDP_REATTACH failed"); // REMOVE THIS
+                error.SetErrorString("KDP_REATTACH failed");
             }
         }
         else
@@ -307,11 +323,84 @@
 ProcessKDP::DoResume ()
 {
     Error error;
-    if (!m_comm.SendRequestResume ())
-        error.SetErrorString ("KDP resume failed");
+    LogSP log (ProcessKDPLog::GetLogIfAllCategoriesSet (KDP_LOG_PROCESS));
+    // Only start the async thread if we try to do any process control
+    if (!IS_VALID_LLDB_HOST_THREAD(m_async_thread))
+        StartAsyncThread ();
+
+    bool resume = false;
+    
+    // With KDP there is only one thread we can tell what to do
+    ThreadSP kernel_thread_sp (GetKernelThread(m_thread_list, m_thread_list));
+    if (kernel_thread_sp)
+    {
+        const StateType thread_resume_state = kernel_thread_sp->GetTemporaryResumeState();
+        switch (thread_resume_state)
+        {
+            case eStateSuspended:
+                // Nothing to do here when a thread will stay suspended
+                // we just leave the CPU mask bit set to zero for the thread
+                puts("REMOVE THIS: ProcessKDP::DoResume () -- thread suspended");
+                break;
+                
+            case eStateStepping:
+                puts("REMOVE THIS: ProcessKDP::DoResume () -- thread stepping");
+                kernel_thread_sp->GetRegisterContext()->HardwareSingleStep (true);
+                resume = true;
+                break;
+    
+            case eStateRunning:
+                puts("REMOVE THIS: ProcessKDP::DoResume () -- thread running");
+                kernel_thread_sp->GetRegisterContext()->HardwareSingleStep (false);
+                resume = true;
+                break;
+
+            default:
+                // The only valid thread resume states are listed above
+                assert (!"invalid thread resume state");
+                break;
+        }
+    }
+
+    if (resume)
+    {
+        if (log)
+            log->Printf ("ProcessKDP::DoResume () sending resume");
+        
+        if (m_comm.SendRequestResume ())
+        {
+            m_async_broadcaster.BroadcastEvent (eBroadcastBitAsyncContinue);
+            SetPrivateState(eStateRunning);
+        }
+        else
+            error.SetErrorString ("KDP resume failed");
+    }
+    else
+    {
+        error.SetErrorString ("kernel thread is suspended");        
+    }
+    
     return error;
 }
 
+lldb::ThreadSP
+ProcessKDP::GetKernelThread(ThreadList &old_thread_list, ThreadList &new_thread_list)
+{
+    // KDP only tells us about one thread/core. Any other threads will usually
+    // be the ones that are read from memory by the OS plug-ins.
+    const lldb::tid_t kernel_tid = 1;
+    ThreadSP thread_sp (old_thread_list.FindThreadByID (kernel_tid, false));
+    if (!thread_sp)
+    {
+        thread_sp.reset(new ThreadKDP (shared_from_this(), kernel_tid));
+        new_thread_list.AddThread(thread_sp);
+    }
+    return thread_sp;
+}
+
+
+
+
 bool
 ProcessKDP::UpdateThreadList (ThreadList &old_thread_list, ThreadList &new_thread_list)
 {
@@ -320,29 +409,11 @@
     if (log && log->GetMask().Test(KDP_LOG_VERBOSE))
         log->Printf ("ProcessKDP::%s (pid = %llu)", __FUNCTION__, GetID());
     
-    // We currently are making only one thread per core and we
-    // actually don't know about actual threads. Eventually we
-    // want to get the thread list from memory and note which
-    // threads are on CPU as those are the only ones that we 
-    // will be able to resume.
-    const uint32_t cpu_mask = m_comm.GetCPUMask();
-    for (uint32_t cpu_mask_bit = 1; cpu_mask_bit & cpu_mask; cpu_mask_bit <<= 1)
-    {
-        lldb::tid_t tid = cpu_mask_bit;
-        ThreadSP thread_sp (old_thread_list.FindThreadByID (tid, false));
-        if (!thread_sp)
-            thread_sp.reset(new ThreadKDP (shared_from_this(), tid));
-        new_thread_list.AddThread(thread_sp);
-    }
-    return new_thread_list.GetSize(false) > 0;
-}
+    // Even though there is a CPU mask, it doesn't mean to can see each CPU
+    // indivudually, there is really only one. Lets call this thread 1.
+    GetKernelThread (old_thread_list, new_thread_list);
 
-
-StateType
-ProcessKDP::SetThreadStopInfo (StringExtractor& stop_packet)
-{
-    // TODO: figure out why we stopped given the packet that tells us we stopped...
-    return eStateStopped;
+    return new_thread_list.GetSize(false) > 0;
 }
 
 void
@@ -351,7 +422,6 @@
     // Let all threads recover from stopping and do any clean up based
     // on the previous thread state (if any).
     m_thread_list.RefreshStateAfterStop();
-    //SetThreadStopInfo (m_last_stop_packet);
 }
 
 Error
@@ -359,112 +429,24 @@
 {
     Error error;
     
-//    bool timed_out = false;
-    Mutex::Locker locker;
-    
-    if (m_public_state.GetValue() == eStateAttaching)
-    {
-        // We are being asked to halt during an attach. We need to just close
-        // our file handle and debugserver will go away, and we can be done...
-        m_comm.Disconnect();
-    }
-    else
-    {
-        if (!m_comm.SendRequestSuspend ())
-            error.SetErrorString ("KDP halt failed");
-    }
-    return error;
-}
-
-Error
-ProcessKDP::InterruptIfRunning (bool discard_thread_plans,
-                                bool catch_stop_event,
-                                EventSP &stop_event_sp)
-{
-    Error error;
-    
-    LogSP log (ProcessKDPLog::GetLogIfAllCategoriesSet(KDP_LOG_PROCESS));
-    
-    bool paused_private_state_thread = false;
-    const bool is_running = m_comm.IsRunning();
-    if (log)
-        log->Printf ("ProcessKDP::InterruptIfRunning(discard_thread_plans=%i, catch_stop_event=%i) is_running=%i", 
-                     discard_thread_plans, 
-                     catch_stop_event,
-                     is_running);
-    
-    if (discard_thread_plans)
-    {
-        if (log)
-            log->Printf ("ProcessKDP::InterruptIfRunning() discarding all thread plans");
-        m_thread_list.DiscardThreadPlans();
-    }
-    if (is_running)
+    if (m_comm.IsRunning())
     {
-        if (catch_stop_event)
-        {
-            if (log)
-                log->Printf ("ProcessKDP::InterruptIfRunning() pausing private state thread");
-            PausePrivateStateThread();
-            paused_private_state_thread = true;
-        }
-        
-        bool timed_out = false;
-//        bool sent_interrupt = false;
-        Mutex::Locker locker;
-
-        // TODO: implement halt in CommunicationKDP
-//        if (!m_comm.SendInterrupt (locker, 1, sent_interrupt, timed_out))
-//        {
-//            if (timed_out)
-//                error.SetErrorString("timed out sending interrupt packet");
-//            else
-//                error.SetErrorString("unknown error sending interrupt packet");
-//            if (paused_private_state_thread)
-//                ResumePrivateStateThread();
-//            return error;
-//        }
-        
-        if (catch_stop_event)
+        if (m_destroy_in_process)
         {
-            // LISTEN HERE
-            TimeValue timeout_time;
-            timeout_time = TimeValue::Now();
-            timeout_time.OffsetWithSeconds(5);
-            StateType state = WaitForStateChangedEventsPrivate (&timeout_time, stop_event_sp);
-            
-            timed_out = state == eStateInvalid;
-            if (log)
-                log->Printf ("ProcessKDP::InterruptIfRunning() catch stop event: state = %s, timed-out=%i", StateAsCString(state), timed_out);
-            
-            if (timed_out)
-                error.SetErrorString("unable to verify target stopped");
+            // If we are attemping to destroy, we need to not return an error to
+            // Halt or DoDestroy won't get called.
+            // We are also currently running, so send a process stopped event
+            SetPrivateState (eStateStopped);
         }
-        
-        if (paused_private_state_thread)
+        else
         {
-            if (log)
-                log->Printf ("ProcessKDP::InterruptIfRunning() resuming private state thread");
-            ResumePrivateStateThread();
+            error.SetErrorString ("KDP cannot interrupt a running kernel");
         }
     }
     return error;
 }
 
 Error
-ProcessKDP::WillDetach ()
-{
-    LogSP log (ProcessKDPLog::GetLogIfAllCategoriesSet(KDP_LOG_PROCESS));
-    if (log)
-        log->Printf ("ProcessKDP::WillDetach()");
-    
-    bool discard_thread_plans = true; 
-    bool catch_stop_event = true;
-    EventSP event_sp;
-    return InterruptIfRunning (discard_thread_plans, catch_stop_event, event_sp);
-}
-
-Error
 ProcessKDP::DoDetach()
 {
     Error error;
@@ -472,27 +454,33 @@
     if (log)
         log->Printf ("ProcessKDP::DoDetach()");
     
-    DisableAllBreakpointSites ();
-    
-    m_thread_list.DiscardThreadPlans();
-    
-    if (m_comm.IsConnected())
+    if (m_comm.IsRunning())
+    {
+        // We are running and we can't interrupt a running kernel, so we need
+        // to just close the connection to the kernel and hope for the best
+    }
+    else
     {
+        DisableAllBreakpointSites ();
+        
+        m_thread_list.DiscardThreadPlans();
+        
+        if (m_comm.IsConnected())
+        {
 
-        m_comm.SendRequestDisconnect();
+            m_comm.SendRequestDisconnect();
 
-        size_t response_size = m_comm.Disconnect ();
-        if (log)
-        {
-            if (response_size)
-                log->PutCString ("ProcessKDP::DoDetach() detach packet sent successfully");
-            else
-                log->PutCString ("ProcessKDP::DoDetach() detach packet send failed");
+            size_t response_size = m_comm.Disconnect ();
+            if (log)
+            {
+                if (response_size)
+                    log->PutCString ("ProcessKDP::DoDetach() detach packet sent successfully");
+                else
+                    log->PutCString ("ProcessKDP::DoDetach() detach packet send failed");
+            }
         }
     }
-    // Sleep for one second to let the process get all detached...
-    StopAsyncThread ();
-    
+    StopAsyncThread ();    
     m_comm.Clear();
     
     SetPrivateState (eStateDetached);
@@ -503,38 +491,20 @@
 }
 
 Error
-ProcessKDP::DoDestroy ()
+ProcessKDP::WillDestroy ()
 {
     Error error;
-    LogSP log (ProcessKDPLog::GetLogIfAllCategoriesSet(KDP_LOG_PROCESS));
-    if (log)
-        log->Printf ("ProcessKDP::DoDestroy()");
-    
-    // Interrupt if our inferior is running...
-    if (m_comm.IsConnected())
-    {
-        if (m_public_state.GetValue() == eStateAttaching)
-        {
-            // We are being asked to halt during an attach. We need to just close
-            // our file handle and debugserver will go away, and we can be done...
-            m_comm.Disconnect();
-        }
-        else
-        {
-            DisableAllBreakpointSites ();
-            
-            m_comm.SendRequestDisconnect();
-            
-            StringExtractor response;
-            // TODO: Send kill packet?
-            SetExitStatus(SIGABRT, NULL);
-        }
-    }
-    StopAsyncThread ();
-    m_comm.Clear();
+    m_destroy_in_process = true;
     return error;
 }
 
+Error
+ProcessKDP::DoDestroy ()
+{
+    // For KDP there really is no difference between destroy and detach
+    return DoDetach();
+}
+
 //------------------------------------------------------------------
 // Process Queries
 //------------------------------------------------------------------
@@ -560,7 +530,9 @@
 size_t
 ProcessKDP::DoWriteMemory (addr_t addr, const void *buf, size_t size, Error &error)
 {
-    error.SetErrorString ("ProcessKDP::DoReadMemory not implemented");
+    if (m_comm.IsConnected())
+        return m_comm.SendRequestWriteMemory (addr, buf, size, error);
+    error.SetErrorString ("not connected");
     return 0;
 }
 
@@ -613,10 +585,18 @@
             BreakpointSite::Type bp_type = bp_site->GetType();
             if (bp_type == BreakpointSite::eExternal)
             {
-                if (m_comm.SendRequestBreakpoint(false, bp_site->GetLoadAddress()))
+                if (m_destroy_in_process && m_comm.IsRunning())
+                {
+                    // We are trying to destroy our connection and we are running
                     bp_site->SetEnabled(false);
+                }
                 else
-                    error.SetErrorString ("KDP remove breakpoint failed");
+                {
+                    if (m_comm.SendRequestBreakpoint(false, bp_site->GetLoadAddress()))
+                        bp_site->SetEnabled(false);
+                    else
+                        error.SetErrorString ("KDP remove breakpoint failed");
+                }
             }
             else
             {
@@ -686,10 +666,11 @@
     LogSP log (ProcessKDPLog::GetLogIfAllCategoriesSet(KDP_LOG_PROCESS));
     
     if (log)
-        log->Printf ("ProcessKDP::%s ()", __FUNCTION__);
+        log->Printf ("ProcessKDP::StartAsyncThread ()");
     
-    // Create a thread that watches our internal state and controls which
-    // events make it to clients (into the DCProcess event queue).
+    if (IS_VALID_LLDB_HOST_THREAD(m_async_thread))
+        return true;
+
     m_async_thread = Host::ThreadCreate ("<lldb.process.kdp-remote.async>", ProcessKDP::AsyncThread, this, NULL);
     return IS_VALID_LLDB_HOST_THREAD(m_async_thread);
 }
@@ -700,7 +681,7 @@
     LogSP log (ProcessKDPLog::GetLogIfAllCategoriesSet(KDP_LOG_PROCESS));
     
     if (log)
-        log->Printf ("ProcessKDP::%s ()", __FUNCTION__);
+        log->Printf ("ProcessKDP::StopAsyncThread ()");
     
     m_async_broadcaster.BroadcastEvent (eBroadcastBitAsyncThreadShouldExit);
     
@@ -708,6 +689,7 @@
     if (IS_VALID_LLDB_HOST_THREAD(m_async_thread))
     {
         Host::ThreadJoin (m_async_thread, NULL, NULL);
+        m_async_thread = LLDB_INVALID_HOST_THREAD;
     }
 }
 
@@ -717,113 +699,103 @@
 {
     ProcessKDP *process = (ProcessKDP*) arg;
     
+    const lldb::pid_t pid = process->GetID();
+
     LogSP log (ProcessKDPLog::GetLogIfAllCategoriesSet (KDP_LOG_PROCESS));
     if (log)
-        log->Printf ("ProcessKDP::%s (arg = %p, pid = %llu) thread starting...", __FUNCTION__, arg, process->GetID());
+        log->Printf ("ProcessKDP::AsyncThread (arg = %p, pid = %llu) thread starting...", arg, pid);
     
     Listener listener ("ProcessKDP::AsyncThread");
     EventSP event_sp;
     const uint32_t desired_event_mask = eBroadcastBitAsyncContinue |
                                         eBroadcastBitAsyncThreadShouldExit;
     
+    
     if (listener.StartListeningForEvents (&process->m_async_broadcaster, desired_event_mask) == desired_event_mask)
     {
-        listener.StartListeningForEvents (&process->m_comm, Communication::eBroadcastBitReadThreadDidExit);
-        
         bool done = false;
         while (!done)
         {
             if (log)
-                log->Printf ("ProcessKDP::%s (arg = %p, pid = %llu) listener.WaitForEvent (NULL, event_sp)...", __FUNCTION__, arg, process->GetID());
+                log->Printf ("ProcessKDP::AsyncThread (pid = %llu) listener.WaitForEvent (NULL, event_sp)...",
+                             pid);
             if (listener.WaitForEvent (NULL, event_sp))
             {
-                const uint32_t event_type = event_sp->GetType();
-                if (event_sp->BroadcasterIs (&process->m_async_broadcaster))
+                uint32_t event_type = event_sp->GetType();
+                if (log)
+                    log->Printf ("ProcessKDP::AsyncThread (pid = %llu) Got an event of type: %d...",
+                                 pid,
+                                 event_type);
+                
+                // When we are running, poll for 1 second to try and get an exception
+                // to indicate the process has stopped. If we don't get one, check to
+                // make sure no one asked us to exit
+                bool is_running = false;
+                DataExtractor exc_reply_packet;
+                do
                 {
-                    if (log)
-                        log->Printf ("ProcessKDP::%s (arg = %p, pid = %llu) Got an event of type: %d...", __FUNCTION__, arg, process->GetID(), event_type);
-                    
                     switch (event_type)
                     {
-                        case eBroadcastBitAsyncContinue:
+                    case eBroadcastBitAsyncContinue:
                         {
-                            const EventDataBytes *continue_packet = EventDataBytes::GetEventDataFromEvent(event_sp.get());
-                            
-                            if (continue_packet)
+                            is_running = true;
+                            if (process->m_comm.WaitForPacketWithTimeoutMicroSeconds (exc_reply_packet, 1 * USEC_PER_SEC))
+                            {
+                                ThreadSP thread_sp (process->GetKernelThread(process->GetThreadList(), process->GetThreadList()));
+                                thread_sp->GetRegisterContext()->InvalidateAllRegisters();
+                                static_cast<ThreadKDP *>(thread_sp.get())->SetStopInfoFrom_KDP_EXCEPTION (exc_reply_packet);
+
+                                // TODO: parse the stop reply packet
+                                is_running = false;                                
+                                process->SetPrivateState(eStateStopped);
+                            }
+                            else
                             {
-                                // TODO: do continue support here
-                                
-//                                const char *continue_cstr = (const char *)continue_packet->GetBytes ();
-//                                const size_t continue_cstr_len = continue_packet->GetByteSize ();
-//                                if (log)
-//                                    log->Printf ("ProcessKDP::%s (arg = %p, pid = %i) got eBroadcastBitAsyncContinue: %s", __FUNCTION__, arg, process->GetID(), continue_cstr);
-//                                
-//                                if (::strstr (continue_cstr, "vAttach") == NULL)
-//                                    process->SetPrivateState(eStateRunning);
-//                                StringExtractor response;
-//                                StateType stop_state = process->GetCommunication().SendContinuePacketAndWaitForResponse (process, continue_cstr, continue_cstr_len, response);
-//                                
-//                                switch (stop_state)
-//                                {
-//                                    case eStateStopped:
-//                                    case eStateCrashed:
-//                                    case eStateSuspended:
-//                                        process->m_last_stop_packet = response;
-//                                        process->SetPrivateState (stop_state);
-//                                        break;
-//                                        
-//                                    case eStateExited:
-//                                        process->m_last_stop_packet = response;
-//                                        response.SetFilePos(1);
-//                                        process->SetExitStatus(response.GetHexU8(), NULL);
-//                                        done = true;
-//                                        break;
-//                                        
-//                                    case eStateInvalid:
-//                                        process->SetExitStatus(-1, "lost connection");
-//                                        break;
-//                                        
-//                                    default:
-//                                        process->SetPrivateState (stop_state);
-//                                        break;
-//                                }
+                                // Check to see if we are supposed to exit. There is no way to
+                                // interrupt a running kernel, so all we can do is wait for an
+                                // exception or detach...
+                                if (listener.GetNextEvent(event_sp))
+                                {
+                                    // We got an event, go through the loop again
+                                    event_type = event_sp->GetType();
+                                }
                             }
                         }
-                            break;
+                        break;
                             
-                        case eBroadcastBitAsyncThreadShouldExit:
-                            if (log)
-                                log->Printf ("ProcessKDP::%s (arg = %p, pid = %llu) got eBroadcastBitAsyncThreadShouldExit...", __FUNCTION__, arg, process->GetID());
-                            done = true;
-                            break;
+                    case eBroadcastBitAsyncThreadShouldExit:
+                        if (log)
+                            log->Printf ("ProcessKDP::AsyncThread (pid = %llu) got eBroadcastBitAsyncThreadShouldExit...",
+                                         pid);
+                        done = true;
+                        is_running = false;
+                        break;
                             
-                        default:
-                            if (log)
-                                log->Printf ("ProcessKDP::%s (arg = %p, pid = %llu) got unknown event 0x%8.8x", __FUNCTION__, arg, process->GetID(), event_type);
-                            done = true;
-                            break;
-                    }
-                }
-                else if (event_sp->BroadcasterIs (&process->m_comm))
-                {
-                    if (event_type & Communication::eBroadcastBitReadThreadDidExit)
-                    {
-                        process->SetExitStatus (-1, "lost connection");
+                    default:
+                        if (log)
+                            log->Printf ("ProcessKDP::AsyncThread (pid = %llu) got unknown event 0x%8.8x",
+                                         pid,
+                                         event_type);
                         done = true;
+                        is_running = false;
+                        break;
                     }
-                }
+                } while (is_running);
             }
             else
             {
                 if (log)
-                    log->Printf ("ProcessKDP::%s (arg = %p, pid = %llu) listener.WaitForEvent (NULL, event_sp) => false", __FUNCTION__, arg, process->GetID());
+                    log->Printf ("ProcessKDP::AsyncThread (pid = %llu) listener.WaitForEvent (NULL, event_sp) => false",
+                                 pid);
                 done = true;
             }
         }
     }
     
     if (log)
-        log->Printf ("ProcessKDP::%s (arg = %p, pid = %llu) thread exiting...", __FUNCTION__, arg, process->GetID());
+        log->Printf ("ProcessKDP::AsyncThread (arg = %p, pid = %llu) thread exiting...",
+                     arg,
+                     pid);
     
     process->m_async_thread = LLDB_INVALID_HOST_THREAD;
     return NULL;

Modified: lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h (original)
+++ lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h Fri Sep 28 06:07:34 2012
@@ -129,15 +129,15 @@
     DoHalt (bool &caused_stop);
     
     virtual lldb_private::Error
-    WillDetach ();
-    
-    virtual lldb_private::Error
     DoDetach ();
     
     virtual lldb_private::Error
     DoSignal (int signal);
     
     virtual lldb_private::Error
+    WillDestroy ();
+    
+    virtual lldb_private::Error
     DoDestroy ();
     
     virtual void
@@ -240,11 +240,10 @@
         eBroadcastBitAsyncContinue                  = (1 << 0),
         eBroadcastBitAsyncThreadShouldExit          = (1 << 1)
     };
-
-    lldb_private::Error
-    InterruptIfRunning (bool discard_thread_plans,
-                        bool catch_stop_event,
-                        lldb::EventSP &stop_event_sp);
+    
+    lldb::ThreadSP
+    GetKernelThread (lldb_private::ThreadList &old_thread_list,
+                     lldb_private::ThreadList &new_thread_list);
 
     //------------------------------------------------------------------
     /// Broadcaster event bits definitions.
@@ -252,6 +251,7 @@
     CommunicationKDP m_comm;
     lldb_private::Broadcaster m_async_broadcaster;
     lldb::thread_t m_async_thread;
+    bool m_destroy_in_process;
 
     bool
     StartAsyncThread ();
@@ -262,9 +262,6 @@
     static void *
     AsyncThread (void *arg);
     
-    lldb::StateType
-    SetThreadStopInfo (StringExtractor& stop_packet);
-    
 private:
     //------------------------------------------------------------------
     // For ProcessKDP only

Modified: lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_arm.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_arm.cpp?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_arm.cpp (original)
+++ lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_arm.cpp Fri Sep 28 06:07:34 2012
@@ -97,24 +97,64 @@
 int
 RegisterContextKDP_arm::DoWriteGPR (lldb::tid_t tid, int flavor, const GPR &gpr)
 {
+    ProcessSP process_sp (CalculateProcess());
+    if (process_sp)
+    {
+        Error error;
+        if (static_cast<ProcessKDP *>(process_sp.get())->GetCommunication().SendRequestWriteRegisters (tid, GPRRegSet, &gpr, sizeof(gpr), error))
+        {
+            if (error.Success())
+                return 0;
+        }
+    }
     return -1;
 }
 
 int
 RegisterContextKDP_arm::DoWriteFPU (lldb::tid_t tid, int flavor, const FPU &fpu)
 {
+    ProcessSP process_sp (CalculateProcess());
+    if (process_sp)
+    {
+        Error error;
+        if (static_cast<ProcessKDP *>(process_sp.get())->GetCommunication().SendRequestWriteRegisters (tid, FPURegSet, &fpu, sizeof(fpu), error))
+        {
+            if (error.Success())
+                return 0;
+        }
+    }
     return -1;
 }
 
 int
 RegisterContextKDP_arm::DoWriteEXC (lldb::tid_t tid, int flavor, const EXC &exc)
 {
+    ProcessSP process_sp (CalculateProcess());
+    if (process_sp)
+    {
+        Error error;
+        if (static_cast<ProcessKDP *>(process_sp.get())->GetCommunication().SendRequestWriteRegisters (tid, EXCRegSet, &exc, sizeof(exc), error))
+        {
+            if (error.Success())
+                return 0;
+        }
+    }
     return -1;
 }
 
 int
 RegisterContextKDP_arm::DoWriteDBG (lldb::tid_t tid, int flavor, const DBG &dbg)
 {
+    ProcessSP process_sp (CalculateProcess());
+    if (process_sp)
+    {
+        Error error;
+        if (static_cast<ProcessKDP *>(process_sp.get())->GetCommunication().SendRequestWriteRegisters (tid, DBGRegSet, &dbg, sizeof(dbg), error))
+        {
+            if (error.Success())
+                return 0;
+        }
+    }
     return -1;
 }
 

Modified: lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_i386.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_i386.cpp?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_i386.cpp (original)
+++ lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_i386.cpp Fri Sep 28 06:07:34 2012
@@ -81,18 +81,48 @@
 int
 RegisterContextKDP_i386::DoWriteGPR (lldb::tid_t tid, int flavor, const GPR &gpr)
 {
+    ProcessSP process_sp (CalculateProcess());
+    if (process_sp)
+    {
+        Error error;
+        if (static_cast<ProcessKDP *>(process_sp.get())->GetCommunication().SendRequestWriteRegisters (tid, GPRRegSet, &gpr, sizeof(gpr), error))
+        {
+            if (error.Success())
+                return 0;
+        }
+    }
     return -1;
 }
 
 int
 RegisterContextKDP_i386::DoWriteFPU (lldb::tid_t tid, int flavor, const FPU &fpu)
 {
+    ProcessSP process_sp (CalculateProcess());
+    if (process_sp)
+    {
+        Error error;
+        if (static_cast<ProcessKDP *>(process_sp.get())->GetCommunication().SendRequestWriteRegisters (tid, FPURegSet, &fpu, sizeof(fpu), error))
+        {
+            if (error.Success())
+                return 0;
+        }
+    }
     return -1;
 }
 
 int
 RegisterContextKDP_i386::DoWriteEXC (lldb::tid_t tid, int flavor, const EXC &exc)
 {
+    ProcessSP process_sp (CalculateProcess());
+    if (process_sp)
+    {
+        Error error;
+        if (static_cast<ProcessKDP *>(process_sp.get())->GetCommunication().SendRequestWriteRegisters (tid, EXCRegSet, &exc, sizeof(exc), error))
+        {
+            if (error.Success())
+                return 0;
+        }
+    }
     return -1;
 }
 

Modified: lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_x86_64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_x86_64.cpp?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_x86_64.cpp (original)
+++ lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_x86_64.cpp Fri Sep 28 06:07:34 2012
@@ -33,35 +33,95 @@
 int
 RegisterContextKDP_x86_64::DoReadGPR (lldb::tid_t tid, int flavor, GPR &gpr)
 {
+    ProcessSP process_sp (CalculateProcess());
+    if (process_sp)
+    {
+        Error error;
+        if (static_cast<ProcessKDP *>(process_sp.get())->GetCommunication().SendRequestReadRegisters (tid, GPRRegSet, &gpr, sizeof(gpr), error))
+        {
+            if (error.Success())
+                return 0;
+        }
+    }
     return -1;
 }
 
 int
 RegisterContextKDP_x86_64::DoReadFPU (lldb::tid_t tid, int flavor, FPU &fpu)
 {
+    ProcessSP process_sp (CalculateProcess());
+    if (process_sp)
+    {
+        Error error;
+        if (static_cast<ProcessKDP *>(process_sp.get())->GetCommunication().SendRequestReadRegisters (tid, FPURegSet, &fpu, sizeof(fpu), error))
+        {
+            if (error.Success())
+                return 0;
+        }
+    }
     return -1;
 }
 
 int
 RegisterContextKDP_x86_64::DoReadEXC (lldb::tid_t tid, int flavor, EXC &exc)
 {
+    ProcessSP process_sp (CalculateProcess());
+    if (process_sp)
+    {
+        Error error;
+        if (static_cast<ProcessKDP *>(process_sp.get())->GetCommunication().SendRequestReadRegisters (tid, EXCRegSet, &exc, sizeof(exc), error))
+        {
+            if (error.Success())
+                return 0;
+        }
+    }
     return -1;
 }
 
 int
 RegisterContextKDP_x86_64::DoWriteGPR (lldb::tid_t tid, int flavor, const GPR &gpr)
 {
+    ProcessSP process_sp (CalculateProcess());
+    if (process_sp)
+    {
+        Error error;
+        if (static_cast<ProcessKDP *>(process_sp.get())->GetCommunication().SendRequestWriteRegisters (tid, GPRRegSet, &gpr, sizeof(gpr), error))
+        {
+            if (error.Success())
+                return 0;
+        }
+    }
     return -1;
 }
 
 int
 RegisterContextKDP_x86_64::DoWriteFPU (lldb::tid_t tid, int flavor, const FPU &fpu)
 {
+    ProcessSP process_sp (CalculateProcess());
+    if (process_sp)
+    {
+        Error error;
+        if (static_cast<ProcessKDP *>(process_sp.get())->GetCommunication().SendRequestWriteRegisters (tid, FPURegSet, &fpu, sizeof(fpu), error))
+        {
+            if (error.Success())
+                return 0;
+        }
+    }
     return -1;
 }
 
 int
 RegisterContextKDP_x86_64::DoWriteEXC (lldb::tid_t tid, int flavor, const EXC &exc)
 {
+    ProcessSP process_sp (CalculateProcess());
+    if (process_sp)
+    {
+        Error error;
+        if (static_cast<ProcessKDP *>(process_sp.get())->GetCommunication().SendRequestWriteRegisters (tid, EXCRegSet, &exc, sizeof(exc), error))
+        {
+            if (error.Success())
+                return 0;
+        }
+    }
     return -1;
 }

Modified: lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp (original)
+++ lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp Fri Sep 28 06:07:34 2012
@@ -28,6 +28,7 @@
 #include "RegisterContextKDP_arm.h"
 #include "RegisterContextKDP_i386.h"
 #include "RegisterContextKDP_x86_64.h"
+#include "Plugins/Process/Utility/StopInfoMachException.h"
 
 using namespace lldb;
 using namespace lldb_private;
@@ -68,31 +69,17 @@
 bool
 ThreadKDP::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);
 
+    ClearStackFrames();
+
     lldb::LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STEP));
     if (log)
         log->Printf ("Resuming thread: %4.4llx with state: %s.", GetID(), StateAsCString(resume_state));
 
-//    ProcessKDP &process = GetKDPProcess();
-//    switch (resume_state)
-//    {
-//    case eStateSuspended:
-//    case eStateStopped:
-//        // Don't append anything for threads that should stay stopped.
-//        break;
-//
-//    case eStateRunning:
-//    case eStateStepping:
-//        break;
-//
-//    default:
-//        break;
-//    }
     return true;
 }
 
@@ -192,25 +179,50 @@
         if (m_thread_stop_reason_stop_id != process_stop_id ||
             (m_actual_stop_info_sp && !m_actual_stop_info_sp->IsValid()))
         {
-            // TODO: can we query the initial state of the thread here?
-            // For now I am just going to pretend that a SIGSTOP happened.
-
-            SetStopInfo(StopInfo::CreateStopReasonWithSignal (*this, SIGSTOP));
-
-            // If GetKDPProcess().SetThreadStopInfo() doesn't find a stop reason
-            // for this thread, then m_actual_stop_info_sp will not ever contain
-            // a valid stop reason and the "m_actual_stop_info_sp->IsValid() == false"
-            // check will never be able to tell us if we have the correct stop info
-            // for this thread and we will continually send qThreadStopInfo packets
-            // down to the remote KDP server, so we need to keep our own notion
-            // of the stop ID that m_actual_stop_info_sp is valid for (even if it
-            // contains nothing). We use m_thread_stop_reason_stop_id for this below.
-    //        m_thread_stop_reason_stop_id = process_stop_id;
-    //        m_actual_stop_info_sp.reset();
-
+            if (m_cached_stop_info_sp)
+                SetStopInfo (m_cached_stop_info_sp);
+            else
+                SetStopInfo(StopInfo::CreateStopReasonWithSignal (*this, SIGSTOP));
         }
     }
     return m_actual_stop_info_sp;
 }
 
+void
+ThreadKDP::SetStopInfoFrom_KDP_EXCEPTION (const DataExtractor &exc_reply_packet)
+{
+    uint32_t offset = 0;
+    uint8_t reply_command = exc_reply_packet.GetU8(&offset);
+    if (reply_command == CommunicationKDP::KDP_EXCEPTION)
+    {
+        offset = 8;
+        const uint32_t count = exc_reply_packet.GetU32 (&offset);
+        if (count >= 1)
+        {
+            //const uint32_t cpu = exc_reply_packet.GetU32 (&offset);
+            offset += 4; // Skip the useless CPU field
+            const uint32_t exc_type = exc_reply_packet.GetU32 (&offset);
+            const uint32_t exc_code = exc_reply_packet.GetU32 (&offset);
+            const uint32_t exc_subcode = exc_reply_packet.GetU32 (&offset);
+            // We have to make a copy of the stop info because the thread list
+            // will iterate through the threads and clear all stop infos..
+            
+            // Let the StopInfoMachException::CreateStopReasonWithMachException()
+            // function update the PC if needed as we might hit a software breakpoint
+            // and need to decrement the PC (i386 and x86_64 need this) and KDP
+            // doesn't do this for us.
+            const bool pc_already_adjusted = false;
+            const bool adjust_pc_if_needed = true;
+
+            m_cached_stop_info_sp = StopInfoMachException::CreateStopReasonWithMachException (*this,
+                                                                                              exc_type,
+                                                                                              2,
+                                                                                              exc_code,
+                                                                                              exc_subcode,
+                                                                                              0,
+                                                                                              pc_already_adjusted,
+                                                                                              adjust_pc_if_needed);            
+        }
+    }
+}
 

Modified: lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.h?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.h (original)
+++ lldb/branches/windows/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.h Fri Sep 28 06:07:34 2012
@@ -79,6 +79,9 @@
     {
         m_thread_dispatch_qaddr = thread_dispatch_qaddr;
     }
+    
+    void
+    SetStopInfoFrom_KDP_EXCEPTION (const lldb_private::DataExtractor &exc_reply_packet);
 
 protected:
     
@@ -90,6 +93,7 @@
     std::string m_thread_name;
     std::string m_dispatch_queue_name;
     lldb::addr_t m_thread_dispatch_qaddr;
+    lldb::StopInfoSP m_cached_stop_info_sp;
     //------------------------------------------------------------------
     // Member variables.
     //------------------------------------------------------------------

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=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/Utility/StopInfoMachException.cpp (original)
+++ lldb/branches/windows/source/Plugins/Process/Utility/StopInfoMachException.cpp Fri Sep 28 06:07:34 2012
@@ -242,6 +242,9 @@
 }
 
 
+
+
+
 StopInfoSP
 StopInfoMachException::CreateStopReasonWithMachException 
 (
@@ -250,11 +253,14 @@
     uint32_t exc_data_count,
     uint64_t exc_code,
     uint64_t exc_sub_code,
-    uint64_t exc_sub_sub_code
+    uint64_t exc_sub_sub_code,
+    bool pc_already_adjusted,
+    bool adjust_pc_if_needed
 )
 {
     if (exc_type != 0)
     {
+        uint32_t pc_decrement = 0;
         ExecutionContext exe_ctx (thread.shared_from_this());
         Target *target = exe_ctx.GetTargetPtr();
         const llvm::Triple::ArchType cpu = target ? target->GetArchitecture().GetMachine() : llvm::Triple::UnknownArch;
@@ -300,6 +306,7 @@
         case 6: // EXC_BREAKPOINT
             {
                 bool is_software_breakpoint = false;
+                bool is_trace_if_software_breakpoint_missing = false;
                 switch (cpu)
                 {
                 case llvm::Triple::x86:
@@ -323,9 +330,16 @@
                             return StopInfo::CreateStopReasonWithWatchpointID(thread, wp_sp->GetID());
                         }
                     }
-                    else if (exc_code == 2) // EXC_I386_BPT
+                    else if (exc_code == 2 ||   // EXC_I386_BPT
+                             exc_code == 3)     // EXC_I386_BPTFLT
                     {
+                        // KDP returns EXC_I386_BPTFLT for trace breakpoints
+                        if (exc_code == 3)
+                            is_trace_if_software_breakpoint_missing = true;
+
                         is_software_breakpoint = true;
+                        if (!pc_already_adjusted)
+                            pc_decrement = 1;
                     }
                     break;
 
@@ -353,8 +367,11 @@
                         // EXC_ARM_DA_DEBUG seems to be reused for EXC_BREAKPOINT as well as EXC_BAD_ACCESS
                         return StopInfo::CreateStopReasonToTrace(thread);
                     }
-                    else
-                        is_software_breakpoint = exc_code == 1; // EXC_ARM_BREAKPOINT
+                    else if (exc_code == 1)
+                    {
+                        is_software_breakpoint = true;
+                        is_trace_if_software_breakpoint_missing = true;
+                    }
                     break;
 
                 default:
@@ -363,14 +380,22 @@
 
                 if (is_software_breakpoint)
                 {
-                    addr_t pc = thread.GetRegisterContext()->GetPC();
+                    RegisterContextSP reg_ctx_sp (thread.GetRegisterContext());
+                    addr_t pc = reg_ctx_sp->GetPC() - pc_decrement;
+
                     ProcessSP process_sp (thread.CalculateProcess());
 
                     lldb::BreakpointSiteSP bp_site_sp;
                     if (process_sp)
                         bp_site_sp = process_sp->GetBreakpointSiteList().FindByAddress(pc);
-                    if (bp_site_sp)
+                    if (bp_site_sp && bp_site_sp->IsEnabled())
                     {
+                        // Update the PC if we were asked to do so, but only do
+                        // so if we find a breakpoint that we know about cause
+                        // this could be a trap instruction in the code
+                        if (pc_decrement > 0 && adjust_pc_if_needed)
+                            reg_ctx_sp->SetPC (pc);
+
                         // If the breakpoint is for this thread, then we'll report the hit, but if it is for another thread,
                         // we can just report no reason.  We don't need to worry about stepping over the breakpoint here, that
                         // will be taken care of when the thread resumes and notices that there's a breakpoint under the pc.
@@ -379,7 +404,8 @@
                         else
                             return StopInfoSP();
                     }
-                    else if (cpu == llvm::Triple::arm)
+                    
+                    if (is_trace_if_software_breakpoint_missing)
                     {
                         return StopInfo::CreateStopReasonToTrace (thread);
                     }

Modified: lldb/branches/windows/source/Plugins/Process/Utility/StopInfoMachException.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/Process/Utility/StopInfoMachException.h?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/Utility/StopInfoMachException.h (original)
+++ lldb/branches/windows/source/Plugins/Process/Utility/StopInfoMachException.h Fri Sep 28 06:07:34 2012
@@ -61,8 +61,10 @@
                                        uint32_t exc_data_count,
                                        uint64_t exc_code, 
                                        uint64_t exc_sub_code,
-                                       uint64_t exc_sub_sub_code);
-    
+                                       uint64_t exc_sub_sub_code,
+                                       bool pc_already_adjusted = true,
+                                       bool adjust_pc_if_needed = false);
+
 protected:
     uint32_t m_exc_data_count;
     uint64_t m_exc_code;

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=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/branches/windows/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Fri Sep 28 06:07:34 2012
@@ -1921,11 +1921,11 @@
             return response.GetHexBytes(buf, size, '\xdd');
         }
         else if (response.IsErrorResponse())
-            error.SetErrorStringWithFormat("gdb remote returned an error: %s", response.GetStringRef().c_str());
+            error.SetErrorString("memory read failed");
         else if (response.IsUnsupportedResponse())
-            error.SetErrorStringWithFormat("'%s' packet unsupported", packet);
+            error.SetErrorStringWithFormat("GDB server does not support reading memory");
         else
-            error.SetErrorStringWithFormat("unexpected response to '%s': '%s'", packet, response.GetStringRef().c_str());
+            error.SetErrorStringWithFormat("unexpected response to GDB server memory read packet '%s': '%s'", packet, response.GetStringRef().c_str());
     }
     else
     {
@@ -1957,11 +1957,11 @@
             return size;
         }
         else if (response.IsErrorResponse())
-            error.SetErrorStringWithFormat("gdb remote returned an error: %s", response.GetStringRef().c_str());
+            error.SetErrorString("memory write failed");
         else if (response.IsUnsupportedResponse())
-            error.SetErrorStringWithFormat("'%s' packet unsupported", packet.GetString().c_str());
+            error.SetErrorStringWithFormat("GDB server does not support writing memory");
         else
-            error.SetErrorStringWithFormat("unexpected response to '%s': '%s'", packet.GetString().c_str(), response.GetStringRef().c_str());
+            error.SetErrorStringWithFormat("unexpected response to GDB server memory write packet '%s': '%s'", packet.GetString().c_str(), response.GetStringRef().c_str());
     }
     else
     {

Modified: lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp (original)
+++ lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp Fri Sep 28 06:07:34 2012
@@ -171,65 +171,74 @@
                     {
                     // Blocks if inlined data that have a length field and the data bytes
                     // inlined in the .debug_info
-                    case DW_FORM_block      : form_size = debug_info_data.GetULEB128 (&offset);      break;
-                    case DW_FORM_block1     : form_size = debug_info_data.GetU8_unchecked (&offset); break;
-                    case DW_FORM_block2     : form_size = debug_info_data.GetU16_unchecked (&offset);break;
-                    case DW_FORM_block4     : form_size = debug_info_data.GetU32_unchecked (&offset);break;
+                    case DW_FORM_exprloc     :
+                    case DW_FORM_block       : form_size = debug_info_data.GetULEB128 (&offset);      break;
+                    case DW_FORM_block1      : form_size = debug_info_data.GetU8_unchecked (&offset); break;
+                    case DW_FORM_block2      : form_size = debug_info_data.GetU16_unchecked (&offset);break;
+                    case DW_FORM_block4      : form_size = debug_info_data.GetU32_unchecked (&offset);break;
 
                     // Inlined NULL terminated C-strings
-                    case DW_FORM_string     :
+                    case DW_FORM_string      :
                         debug_info_data.GetCStr (&offset);
                         break;
 
                     // Compile unit address sized values
-                    case DW_FORM_addr       :
-                    case DW_FORM_ref_addr   :
+                    case DW_FORM_addr        :
+                    case DW_FORM_ref_addr    :
                         form_size = cu->GetAddressByteSize();
                         break;
                     
-                    // zero sized field
+                    // 0 sized form
                     case DW_FORM_flag_present:
                         form_size = 0;
                         break;
 
                     // 1 byte values
-                    case DW_FORM_data1      :
-                    case DW_FORM_flag       :
-                    case DW_FORM_ref1       :
+                    case DW_FORM_data1       :
+                    case DW_FORM_flag        :
+                    case DW_FORM_ref1        :
                         form_size = 1;
                         break;
 
                     // 2 byte values
-                    case DW_FORM_data2      :
-                    case DW_FORM_ref2       :
+                    case DW_FORM_data2       :
+                    case DW_FORM_ref2        :
                         form_size = 2;
                         break;
 
                     // 4 byte values
-                    case DW_FORM_strp       :
-                    case DW_FORM_data4      :
-                    case DW_FORM_ref4       :
+                    case DW_FORM_strp        :
+                    case DW_FORM_data4       :
+                    case DW_FORM_ref4        :
                         form_size = 4;
                         break;
 
                     // 8 byte values
-                    case DW_FORM_data8      :
-                    case DW_FORM_ref8       :
+                    case DW_FORM_data8       :
+                    case DW_FORM_ref8        :
+                    case DW_FORM_ref_sig8    :
                         form_size = 8;
                         break;
 
                     // signed or unsigned LEB 128 values
-                    case DW_FORM_sdata      :
-                    case DW_FORM_udata      :
-                    case DW_FORM_ref_udata  :
+                    case DW_FORM_sdata       :
+                    case DW_FORM_udata       :
+                    case DW_FORM_ref_udata   :
                         debug_info_data.Skip_LEB128 (&offset);
                         break;
 
-                    case DW_FORM_indirect   :
+                    case DW_FORM_indirect    :
                         form_is_indirect = true;
                         form = debug_info_data.GetULEB128 (&offset);
                         break;
 
+                    case DW_FORM_sec_offset  :
+                        if (cu->GetAddressByteSize () == 4)
+                            debug_info_data.GetU32 (offset_ptr);
+                        else
+                            debug_info_data.GetU64 (offset_ptr);
+                        break;
+
                     default:
                         *offset_ptr = m_offset;
                         return false;
@@ -323,66 +332,75 @@
                             {
                             // Blocks if inlined data that have a length field and the data bytes
                             // inlined in the .debug_info
-                            case DW_FORM_block      : form_size = debug_info_data.GetULEB128(&offset);  break;
-                            case DW_FORM_block1     : form_size = debug_info_data.GetU8(&offset);       break;
-                            case DW_FORM_block2     : form_size = debug_info_data.GetU16(&offset);      break;
-                            case DW_FORM_block4     : form_size = debug_info_data.GetU32(&offset);      break;
+                            case DW_FORM_exprloc     :
+                            case DW_FORM_block       : form_size = debug_info_data.GetULEB128(&offset);  break;
+                            case DW_FORM_block1      : form_size = debug_info_data.GetU8(&offset);       break;
+                            case DW_FORM_block2      : form_size = debug_info_data.GetU16(&offset);      break;
+                            case DW_FORM_block4      : form_size = debug_info_data.GetU32(&offset);      break;
 
                             // Inlined NULL terminated C-strings
-                            case DW_FORM_string     : debug_info_data.GetCStr(&offset);                 break;
+                            case DW_FORM_string      : debug_info_data.GetCStr(&offset);                 break;
 
                             // Compile unit address sized values
-                            case DW_FORM_addr       :
-                            case DW_FORM_ref_addr   :
+                            case DW_FORM_addr        :
+                            case DW_FORM_ref_addr    :
                                 form_size = cu_addr_size;
                                 break;
 
-                            // zero sized field
+                            // 0 sized form
                             case DW_FORM_flag_present:
                                 form_size = 0;
                                 break;
 
                             // 1 byte values
-                            case DW_FORM_data1      :
-                            case DW_FORM_flag       :
-                            case DW_FORM_ref1       :
+                            case DW_FORM_data1       :
+                            case DW_FORM_flag        :
+                            case DW_FORM_ref1        :
                                 form_size = 1;
                                 break;
 
                             // 2 byte values
-                            case DW_FORM_data2      :
-                            case DW_FORM_ref2       :
+                            case DW_FORM_data2       :
+                            case DW_FORM_ref2        :
                                 form_size = 2;
                                 break;
 
                             // 4 byte values
-                            case DW_FORM_strp       :
+                            case DW_FORM_strp        :
                                 form_size = 4;
                                 break;
 
-                            case DW_FORM_data4      :
-                            case DW_FORM_ref4       :
+                            case DW_FORM_data4       :
+                            case DW_FORM_ref4        :
                                 form_size = 4;
                                 break;
 
                             // 8 byte values
-                            case DW_FORM_data8      :
-                            case DW_FORM_ref8       :
+                            case DW_FORM_data8       :
+                            case DW_FORM_ref8        :
+                            case DW_FORM_ref_sig8    :
                                 form_size = 8;
                                 break;
 
                             // signed or unsigned LEB 128 values
-                            case DW_FORM_sdata      :
-                            case DW_FORM_udata      :
-                            case DW_FORM_ref_udata  :
+                            case DW_FORM_sdata       :
+                            case DW_FORM_udata       :
+                            case DW_FORM_ref_udata   :
                                 debug_info_data.Skip_LEB128(&offset);
                                 break;
 
-                            case DW_FORM_indirect   :
+                            case DW_FORM_indirect    :
                                 form = debug_info_data.GetULEB128(&offset);
                                 form_is_indirect = true;
                                 break;
 
+                            case DW_FORM_sec_offset  :
+                                if (cu->GetAddressByteSize () == 4)
+                                    debug_info_data.GetU32 (offset_ptr);
+                                else
+                                    debug_info_data.GetU64 (offset_ptr);
+                                break;
+
                             default:
                                 *offset_ptr = offset;
                                 return false;

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=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/branches/windows/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Fri Sep 28 06:07:34 2012
@@ -1388,8 +1388,9 @@
                     if (tag == DW_TAG_template_value_parameter && 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(), llvm::APSInt(apint), clang_qual_type));
+                        template_param_infos.args.push_back (clang::TemplateArgument (*GetClangASTContext().getASTContext(),
+                                                                                      llvm::APSInt(apint),
+                                                                                      clang_qual_type));
                     }
                     else
                     {

Modified: lldb/branches/windows/source/Symbol/ClangASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Symbol/ClangASTContext.cpp?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/branches/windows/source/Symbol/ClangASTContext.cpp Fri Sep 28 06:07:34 2012
@@ -359,9 +359,7 @@
     // inlining enabled.
     //
     // FIXME: This is affected by other options (-fno-inline).
-#if (CLANG_VERSION_MAJOR <= 3 && CLANG_VERSION_MINOR < 2)
-    Opts.NoInline = !Opt;
-#endif
+    Opts.NoInlineDefine = !Opt;
 
 //    unsigned SSP = getLastArgIntValue(Args, OPT_stack_protector, 0, Diags);
 //    switch (SSP) {
@@ -1170,7 +1168,7 @@
 
 static TemplateParameterList *
 CreateTemplateParameterList (ASTContext *ast, 
-                             const ClangASTContext::TemplateParameterInfos &template_param_infos, 
+                             const ClangASTContext::TemplateParameterInfos &template_param_infos,
                              llvm::SmallVector<NamedDecl *, 8> &template_param_decls)
 {
     const bool parameter_pack = false;
@@ -1180,7 +1178,7 @@
     for (size_t i=0; i<num_template_params; ++i)
     {
         const char *name = template_param_infos.names[i];
-        if (template_param_infos.args[i].getAsIntegral().getBoolValue())
+        if (template_param_infos.args[i].getKind() == TemplateArgument::Integral)
         {
             template_param_decls.push_back (NonTypeTemplateParmDecl::Create (*ast,
                                                                              ast->getTranslationUnitDecl(), // Is this the right decl context?, SourceLocation StartLoc,
@@ -1951,15 +1949,15 @@
                 bit_width = new (*ast)IntegerLiteral (*ast, bitfield_bit_size_apint, ast->IntTy, SourceLocation());
             }
             field = FieldDecl::Create (*ast,
-                                                  record_decl,
-                                                  SourceLocation(),
-                                                  SourceLocation(),
-                                                  name ? &identifier_table->get(name) : NULL, // Identifier
-                                                  QualType::getFromOpaquePtr(field_type), // Field type
-                                                  NULL,       // TInfo *
-                                                  bit_width,  // BitWidth
-                                                  false,      // Mutable
-                                                  ICIS_NoInit); // HasInit
+                                       record_decl,
+                                       SourceLocation(),
+                                       SourceLocation(),
+                                       name ? &identifier_table->get(name) : NULL, // Identifier
+                                       QualType::getFromOpaquePtr(field_type), // Field type
+                                       NULL,            // TInfo *
+                                       bit_width,       // BitWidth
+                                       false,           // Mutable
+                                       ICIS_NoInit);    // HasInit
             
             if (!name) {
                 // Determine whether this field corresponds to an anonymous
@@ -3701,6 +3699,7 @@
         case clang::BuiltinType::Half:          
         case clang::BuiltinType::ARCUnbridgedCast:          
         case clang::BuiltinType::PseudoObject:
+        case clang::BuiltinType::BuiltinFn:
             return 1;
         }
         break;
@@ -5589,6 +5588,7 @@
                         case clang::BuiltinType::Half:          
                         case clang::BuiltinType::ARCUnbridgedCast:          
                         case clang::BuiltinType::PseudoObject:
+                        case clang::BuiltinType::BuiltinFn:
                             break;
                     }
                     break;

Modified: lldb/branches/windows/source/Symbol/ClangASTImporter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Symbol/ClangASTImporter.cpp?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/source/Symbol/ClangASTImporter.cpp (original)
+++ lldb/branches/windows/source/Symbol/ClangASTImporter.cpp Fri Sep 28 06:07:34 2012
@@ -269,7 +269,27 @@
         return DeclOrigin();
 }
 
-void 
+void
+ClangASTImporter::SetDeclOrigin (const clang::Decl *decl, clang::Decl *original_decl)
+{
+    ASTContextMetadataSP context_md = GetContextMetadata(&decl->getASTContext());
+    
+    OriginMap &origins = context_md->m_origins;
+    
+    OriginMap::iterator iter = origins.find(decl);
+    
+    if (iter != origins.end())
+    {
+        iter->second.decl = original_decl;
+        iter->second.ctx = &original_decl->getASTContext();
+    }
+    else
+    {
+        origins[decl] = DeclOrigin(&original_decl->getASTContext(), original_decl);
+    }
+}
+
+void
 ClangASTImporter::RegisterNamespaceMap(const clang::NamespaceDecl *decl, 
                                        NamespaceMapSP &namespace_map)
 {
@@ -515,7 +535,8 @@
         TagDecl *to_tag_decl = dyn_cast<TagDecl>(to);
         
         to_tag_decl->setHasExternalLexicalStorage();
-                        
+        to_tag_decl->setMustBuildLookupTable();
+                                
         if (log)
             log->Printf("    [ClangASTImporter] To is a TagDecl - attributes %s%s [%s->%s]",
                         (to_tag_decl->hasExternalLexicalStorage() ? " Lexical" : ""),

Modified: lldb/branches/windows/source/Symbol/ClangASTType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Symbol/ClangASTType.cpp?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/source/Symbol/ClangASTType.cpp (original)
+++ lldb/branches/windows/source/Symbol/ClangASTType.cpp Fri Sep 28 06:07:34 2012
@@ -556,6 +556,7 @@
         case clang::BuiltinType::Half:          
         case clang::BuiltinType::ARCUnbridgedCast:          
         case clang::BuiltinType::PseudoObject:
+        case clang::BuiltinType::BuiltinFn:
             return lldb::eFormatHex;
         }
         break;
@@ -1272,11 +1273,9 @@
                     if (class_interface_decl)
                     {
                         clang::PrintingPolicy policy = ast_context->getPrintingPolicy();
-						
-#if CLANG_VERSION_MAJOR > 3 || (CLANG_VERSION_MAJOR == 3 && CLANG_VERSION_MINOR  >= 2)
-#else
-                        policy.Dump = 1;
-#endif
+                        policy.DumpSourceManager = &ast_context->getSourceManager();
+
+
                         class_interface_decl->print(llvm_ostrm, policy, s->GetIndentLevel());
                     }
                 }
@@ -1634,7 +1633,13 @@
     if (ClangASTContext::GetCompleteType (ast_context, opaque_clang_qual_type))
     {
         clang::QualType qual_type(clang::QualType::getFromOpaquePtr(opaque_clang_qual_type));
-        return (ast_context->getTypeSize (qual_type) + 7) / 8;
+        
+        uint32_t byte_size = (ast_context->getTypeSize (qual_type) + 7) / 8;
+        
+        if (ClangASTContext::IsObjCClassType(opaque_clang_qual_type))
+            byte_size += ast_context->getTypeSize(ast_context->ObjCBuiltinClassTy) / 8; // isa
+        
+        return byte_size;
     }
     return 0;
 }

Modified: lldb/branches/windows/source/Symbol/TypeHierarchyNavigator.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Symbol/TypeHierarchyNavigator.cpp?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/source/Symbol/TypeHierarchyNavigator.cpp (original)
+++ lldb/branches/windows/source/Symbol/TypeHierarchyNavigator.cpp Fri Sep 28 06:07:34 2012
@@ -7,6 +7,7 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "clang/AST/ASTContext.h"
 #include "lldb/Core/Error.h"
 #include "lldb/Core/ValueObject.h"
 #include "lldb/Symbol/ClangASTContext.h"

Modified: lldb/branches/windows/source/Target/PathMappingList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/PathMappingList.cpp?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/PathMappingList.cpp (original)
+++ lldb/branches/windows/source/Target/PathMappingList.cpp Fri Sep 28 06:07:34 2012
@@ -172,12 +172,17 @@
 bool
 PathMappingList::RemapPath (const ConstString &path, ConstString &new_path) const
 {
+    const char *path_cstr = path.GetCString();
+    
+    if (!path_cstr)
+        return false;
+    
     const_iterator pos, end = m_pairs.end();
     for (pos = m_pairs.begin(); pos != end; ++pos)
     {
         const size_t prefixLen = pos->first.GetLength();
 
-        if (::strncmp (pos->first.GetCString(), path.GetCString(), prefixLen) == 0)
+        if (::strncmp (pos->first.GetCString(), path_cstr, prefixLen) == 0)
         {
             std::string new_path_str (pos->second.GetCString());
             new_path_str.append(path.GetCString() + prefixLen);

Modified: lldb/branches/windows/source/Target/Thread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/Thread.cpp?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/Thread.cpp (original)
+++ lldb/branches/windows/source/Target/Thread.cpp Fri Sep 28 06:07:34 2012
@@ -15,6 +15,7 @@
 #include "lldb/Core/StreamString.h"
 #include "lldb/Core/RegularExpression.h"
 #include "lldb/Host/Host.h"
+#include "lldb/Symbol/Function.h"
 #include "lldb/Target/DynamicLoader.h"
 #include "lldb/Target/ExecutionContext.h"
 #include "lldb/Target/ObjCLanguageRuntime.h"
@@ -204,6 +205,17 @@
     }
 }
 
+lldb::StopReason
+Thread::GetStopReason()
+{
+    lldb::StopInfoSP stop_info_sp (GetStopInfo ());
+    if (stop_info_sp)
+        stop_info_sp->GetStopReason();
+    return eStopReasonNone;
+}
+
+
+
 void
 Thread::SetStopInfo (const lldb::StopInfoSP &stop_info_sp)
 {
@@ -332,7 +344,7 @@
     m_completed_plan_stack.clear();
     m_discarded_plan_stack.clear();
 
-    SetTemporaryResumeState(resume_state);
+    m_temporary_resume_state = resume_state;
     
     // This is a little dubious, but we are trying to limit how often we actually fetch stop info from
     // the target, 'cause that slows down single stepping.  So assume that if we got to the point where
@@ -1302,14 +1314,37 @@
     StackFrameSP older_frame_sp = thread->GetStackFrameAtIndex(older_frame_idx);
     
     if (return_value_sp)
-    {
-        // TODO: coerce the return_value_sp to the type of the function in frame_sp.
-    
+    {    
         lldb::ABISP abi = thread->GetProcess()->GetABI();
         if (!abi)
         {
             return_error.SetErrorString("Could not find ABI to set return value.");
         }
+        SymbolContext sc = frame_sp->GetSymbolContext(eSymbolContextFunction);
+        
+        // FIXME: ValueObject::Cast doesn't currently work correctly, at least not for scalars.
+        // Turn that back on when that works.
+        if (0 && sc.function != NULL)
+        {
+            Type *function_type = sc.function->GetType();
+            if (function_type)
+            {
+                clang_type_t return_type = sc.function->GetReturnClangType();
+                if (return_type)
+                {
+                    ClangASTType ast_type (function_type->GetClangAST(), return_type);
+                    StreamString s;
+                    ast_type.DumpTypeDescription(&s);
+                    ValueObjectSP cast_value_sp = return_value_sp->Cast(ast_type);
+                    if (cast_value_sp)
+                    {
+                        cast_value_sp->SetFormat(eFormatHex);
+                        return_value_sp = cast_value_sp;
+                    }
+                }
+            }
+        }
+
         return_error = abi->SetReturnValueObject(older_frame_sp, return_value_sp);
         if (!return_error.Success())
             return return_error;

Modified: lldb/branches/windows/test/api/check_public_api_headers/TestPublicAPIHeaders.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/api/check_public_api_headers/TestPublicAPIHeaders.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/api/check_public_api_headers/TestPublicAPIHeaders.py (original)
+++ lldb/branches/windows/test/api/check_public_api_headers/TestPublicAPIHeaders.py Fri Sep 28 06:07:34 2012
@@ -6,6 +6,7 @@
 import os, re, StringIO
 import unittest2
 from lldbtest import *
+import lldbutil
 
 class SBDirCheckerCase(TestBase):
 
@@ -81,10 +82,7 @@
         self.runCmd(env_cmd)
         self.addTearDownHook(lambda: self.runCmd("settings remove target.env-vars %s" % env_var))
 
-        self.expect('breakpoint set -f %s -l %d' % (self.source, self.line_to_break),
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='%s', line = %d" %
-                        (self.source, self.line_to_break))
+        lldbutil.run_break_set_by_file_and_line (self, self.source, self.line_to_break, num_expected_locations = -1)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/attic/tester.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/attic/tester.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/attic/tester.py (original)
+++ lldb/branches/windows/test/attic/tester.py Fri Sep 28 06:07:34 2012
@@ -98,11 +98,15 @@
     else:
       self.fail("Command " + command + " returned an error")
       return None
+  def getCategories(self):
+    return []
 
 class SanityCheckTestCase(LLDBTestCase):
   def runTest(self):
     ret = self.runCommand("show arch", "show-arch")
     #print ret
+  def getCategories(self):
+    return []
 
 suite = unittest.TestLoader().loadTestsFromTestCase(SanityCheckTestCase)
 unittest.TextTestRunner(verbosity=2).run(suite)

Modified: lldb/branches/windows/test/dotest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/dotest.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/dotest.py (original)
+++ lldb/branches/windows/test/dotest.py Fri Sep 28 06:07:34 2012
@@ -66,6 +66,17 @@
 # Global variables:
 #
 
+# Dictionary of categories
+# When you define a new category for your testcases, be sure to add it here, or the test suite
+# will gladly complain as soon as you try to use it. This allows us to centralize which categories
+# exist, and to provide a description for each one
+validCategories = {
+'dataformatters':'Tests related to the type command and the data formatters subsystem',
+'expression':'Tests related to the expression parser',
+'objc':'Tests related to the Objective-C programming language support',
+'pyapi':'Tests related to the Python API'
+}
+
 # The test suite.
 suite = unittest2.TestSuite()
 
@@ -94,6 +105,13 @@
 # The dictionary as a result of sourcing blacklistFile.
 blacklistConfig = {}
 
+# The list of categories we said we care about
+categoriesList = None
+# set to true if we are going to use categories for cherry-picking test cases
+useCategories = False
+# use this to track per-category failures
+failuresPerCategory = {}
+
 # The config file is optional.
 configFile = None
 
@@ -296,6 +314,9 @@
     global dont_do_dwarf_test
     global blacklist
     global blacklistConfig
+    global categoriesList
+    global validCategories
+    global useCategories
     global configFile
     global archs
     global compilers
@@ -353,6 +374,7 @@
     X('-l', "Don't skip long running tests")
     group.add_argument('-p', metavar='pattern', help='Specify a regexp filename pattern for inclusion in the test suite')
     group.add_argument('-X', metavar='directory', help="Exclude a directory from consideration for test discovery. -X types => if 'types' appear in the pathname components of a potential testfile, it will be ignored")
+    group.add_argument('-G', '--category', metavar='category', action='append', dest='categoriesList', help=textwrap.dedent('''Specify categories of test cases of interest. Can be specified more than once.'''))
 
     # Configuration options
     group = parser.add_argument_group('Configuration options')
@@ -400,6 +422,16 @@
         else:
             archs = [platform_machine]
 
+    if args.categoriesList:
+        for category in args.categoriesList:
+            if not(category in validCategories):
+                print "fatal error: category '" + category + "' is not a valid category - edit dotest.py or correct your invocation"
+                sys.exit(1)
+        categoriesList = set(args.categoriesList)
+        useCategories = True
+    else:
+        categoriesList = []
+
     if args.compilers:
         compilers = args.compilers
     else:
@@ -682,6 +714,7 @@
     xcode3_build_dir = ['build']
     xcode4_build_dir = ['build', 'lldb', 'Build', 'Products']
     dbg = ['Debug']
+    dbc = ['DebugClang']
     rel = ['Release']
     bai = ['BuildAndIntegration']
     python_resource_dir = ['LLDB.framework', 'Resources', 'Python']
@@ -699,6 +732,8 @@
     executable = ['lldb']
     dbgExec  = os.path.join(base, *(xcode3_build_dir + dbg + executable))
     dbgExec2 = os.path.join(base, *(xcode4_build_dir + dbg + executable))
+    dbcExec  = os.path.join(base, *(xcode3_build_dir + dbc + executable))
+    dbcExec2 = os.path.join(base, *(xcode4_build_dir + dbc + executable))
     relExec  = os.path.join(base, *(xcode3_build_dir + rel + executable))
     relExec2 = os.path.join(base, *(xcode4_build_dir + rel + executable))
     baiExec  = os.path.join(base, *(xcode3_build_dir + bai + executable))
@@ -710,6 +745,10 @@
         lldbHere = dbgExec
     elif is_exe(dbgExec2):
         lldbHere = dbgExec2
+    elif is_exe(dbcExec):
+        lldbHere = dbcExec
+    elif is_exe(dbcExec2):
+        lldbHere = dbcExec2
     elif is_exe(relExec):
         lldbHere = relExec
     elif is_exe(relExec2):
@@ -758,6 +797,8 @@
 
     dbgPath  = os.path.join(base, *(xcode3_build_dir + dbg + python_resource_dir))
     dbgPath2 = os.path.join(base, *(xcode4_build_dir + dbg + python_resource_dir))
+    dbcPath  = os.path.join(base, *(xcode3_build_dir + dbc + python_resource_dir))
+    dbcPath2 = os.path.join(base, *(xcode4_build_dir + dbc + python_resource_dir))
     relPath  = os.path.join(base, *(xcode3_build_dir + rel + python_resource_dir))
     relPath2 = os.path.join(base, *(xcode4_build_dir + rel + python_resource_dir))
     baiPath  = os.path.join(base, *(xcode3_build_dir + bai + python_resource_dir))
@@ -768,6 +809,10 @@
         lldbPath = dbgPath
     elif os.path.isfile(os.path.join(dbgPath2, 'lldb/__init__.py')):
         lldbPath = dbgPath2
+    elif os.path.isfile(os.path.join(dbcPath, 'lldb/__init__.py')):
+        lldbPath = dbcPath
+    elif os.path.isfile(os.path.join(dbcPath2, 'lldb/__init__.py')):
+        lldbPath = dbcPath2
     elif os.path.isfile(os.path.join(relPath, 'lldb/__init__.py')):
         lldbPath = relPath
     elif os.path.isfile(os.path.join(relPath2, 'lldb/__init__.py')):
@@ -1228,7 +1273,34 @@
                 else:
                     return str(test)
 
+            def getCategoriesForTest(self,test):
+                if hasattr(test,"getCategories"):
+                    test_categories = test.getCategories()
+                elif inspect.ismethod(test) and test.__self__ != None and hasattr(test.__self__,"getCategories"):
+                    test_categories = test.__self__.getCategories()
+                else:
+                    test_categories = []
+                if test_categories == None:
+                    test_categories = []
+                return test_categories
+
+            def shouldSkipBecauseOfCategories(self,test):
+                global useCategories
+                import inspect
+                if useCategories:
+                    global categoriesList
+                    test_categories = self.getCategoriesForTest(test)
+                    if len(test_categories) == 0 or len(categoriesList & set(test_categories)) == 0:
+                        return True
+                return False
+
+            def hardMarkAsSkipped(self,test):
+                getattr(test, test._testMethodName).__func__.__unittest_skip__ = True
+                getattr(test, test._testMethodName).__func__.__unittest_skip_why__ = "test case does not fall in any category of interest for this run"
+
             def startTest(self, test):
+                if self.shouldSkipBecauseOfCategories(test):
+                    self.hardMarkAsSkipped(test)
                 self.counter += 1
                 if self.showAll:
                     self.stream.write(self.fmt % self.counter)
@@ -1244,11 +1316,19 @@
 
             def addFailure(self, test, err):
                 global sdir_has_content
+                global failuresPerCategory
                 sdir_has_content = True
                 super(LLDBTestResult, self).addFailure(test, err)
                 method = getattr(test, "markFailure", None)
                 if method:
                     method()
+                if useCategories:
+                    test_categories = self.getCategoriesForTest(test)
+                    for category in test_categories:
+                        if category in failuresPerCategory:
+                            failuresPerCategory[category] = failuresPerCategory[category] + 1
+                        else:
+                            failuresPerCategory[category] = 1
 
             def addExpectedFailure(self, test, err):
                 global sdir_has_content
@@ -1296,6 +1376,11 @@
     sys.stderr.write("Session logs for test failures/errors/unexpected successes"
                      " can be found in directory '%s'\n" % sdir_name)
 
+if useCategories and len(failuresPerCategory) > 0:
+    sys.stderr.write("Failures per category:\n")
+    for category in failuresPerCategory:
+        sys.stderr.write("%s - %d\n" % (category,failuresPerCategory[category]))
+
 fname = os.path.join(sdir_name, "TestFinished")
 with open(fname, "w") as f:
     print >> f, "Test finished at: %s\n" % datetime.datetime.now().strftime("%Y-%m-%d-%H_%M_%S")

Modified: lldb/branches/windows/test/example/TestSequenceFunctions.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/example/TestSequenceFunctions.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/example/TestSequenceFunctions.py (original)
+++ lldb/branches/windows/test/example/TestSequenceFunctions.py Fri Sep 28 06:07:34 2012
@@ -29,6 +29,8 @@
         for element in random.sample(self.seq, 5):
             self.assertTrue(element in self.seq)
 
+    def getCategories(self):
+        return []
 
 if __name__ == '__main__':
     unittest.main()

Modified: lldb/branches/windows/test/expression_command/call-function/TestCallStdStringFunction.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/expression_command/call-function/TestCallStdStringFunction.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/expression_command/call-function/TestCallStdStringFunction.py (original)
+++ lldb/branches/windows/test/expression_command/call-function/TestCallStdStringFunction.py Fri Sep 28 06:07:34 2012
@@ -35,10 +35,7 @@
         """Test calling std::String member function."""
         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
 
-        self.expect("breakpoint set -f main.cpp -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.cpp', line = %d" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/expression_command/call-function/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/expression_command/call-function/main.cpp?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/expression_command/call-function/main.cpp (original)
+++ lldb/branches/windows/test/expression_command/call-function/main.cpp Fri Sep 28 06:07:34 2012
@@ -6,10 +6,9 @@
     std::string str = "Hello world";
     std::cout << str << std::endl;
     std::cout << str.c_str() << std::endl;
-    // Please test these expressions while stopped at this line:
 #if 0
     print str
     print str.c_str()
 #endif
-    return 0;
+    return 0; // Please test these expressions while stopped at this line:
 }

Modified: lldb/branches/windows/test/expression_command/formatters/TestFormatters.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/expression_command/formatters/TestFormatters.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/expression_command/formatters/TestFormatters.py (original)
+++ lldb/branches/windows/test/expression_command/formatters/TestFormatters.py Fri Sep 28 06:07:34 2012
@@ -45,10 +45,7 @@
         """Test expr + formatters for good interoperability."""
         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
 
-        self.expect("breakpoint set -f main.cpp -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.cpp', line = %d" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
         self.runCmd("script import formatters")

Modified: lldb/branches/windows/test/expression_command/radar_9531204/TestPrintfAfterUp.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/expression_command/radar_9531204/TestPrintfAfterUp.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/expression_command/radar_9531204/TestPrintfAfterUp.py (original)
+++ lldb/branches/windows/test/expression_command/radar_9531204/TestPrintfAfterUp.py Fri Sep 28 06:07:34 2012
@@ -6,6 +6,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class Radar9531204TestCase(TestBase):
 
@@ -18,9 +19,7 @@
 
         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
 
-        self.expect("breakpoint set -n foo",
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: name = 'foo', locations = 1")
+        lldbutil.run_break_set_by_symbol (self, 'foo', sym_exact=True, num_expected_locations=1)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/expression_command/radar_9673664/TestExprHelpExamples.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/expression_command/radar_9673664/TestExprHelpExamples.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/expression_command/radar_9673664/TestExprHelpExamples.py (original)
+++ lldb/branches/windows/test/expression_command/radar_9673664/TestExprHelpExamples.py Fri Sep 28 06:07:34 2012
@@ -6,6 +6,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class Radar9673644TestCase(TestBase):
 
@@ -25,10 +26,7 @@
 
         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
 
-        self.expect("breakpoint set -f %s -l %d" % (self.main_source, self.line),
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
-                        (self.main_source, self.line))
+        lldbutil.run_break_set_by_file_and_line (self, self.main_source, self.line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/expression_command/test/TestExprs.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/expression_command/test/TestExprs.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/expression_command/test/TestExprs.py (original)
+++ lldb/branches/windows/test/expression_command/test/TestExprs.py Fri Sep 28 06:07:34 2012
@@ -34,10 +34,7 @@
 
         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
 
-        self.expect("breakpoint set -f main.cpp -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.cpp', line = %d" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=False)
 
         self.runCmd("run", RUN_SUCCEEDED)
 
@@ -168,10 +165,7 @@
 
         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
 
-        self.expect("breakpoint set -f main.cpp -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.cpp', line = %d" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line(self, "main.cpp", self.line, num_expected_locations=1,loc_exact=False)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/expression_command/test/TestExprs2.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/expression_command/test/TestExprs2.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/expression_command/test/TestExprs2.py (original)
+++ lldb/branches/windows/test/expression_command/test/TestExprs2.py Fri Sep 28 06:07:34 2012
@@ -26,10 +26,7 @@
 
         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
 
-        self.expect("breakpoint set -f main.cpp -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.cpp', line = %d" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line(self, "main.cpp", self.line, num_expected_locations=1,loc_exact=False)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/expression_command/two-files/TestObjCTypeQueryFromOtherCompileUnit.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/expression_command/two-files/TestObjCTypeQueryFromOtherCompileUnit.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/expression_command/two-files/TestObjCTypeQueryFromOtherCompileUnit.py (original)
+++ lldb/branches/windows/test/expression_command/two-files/TestObjCTypeQueryFromOtherCompileUnit.py Fri Sep 28 06:07:34 2012
@@ -7,6 +7,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class ObjCTypeQueryTestCase(TestBase):
 
@@ -36,10 +37,7 @@
         """The expression parser's type search should be wider than the current compilation unit."""
         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
 
-        self.expect("breakpoint set -f main.m -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.m', line = %d" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/functionalities/abbreviation/TestAbbreviations.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/abbreviation/TestAbbreviations.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/abbreviation/TestAbbreviations.py (original)
+++ lldb/branches/windows/test/functionalities/abbreviation/TestAbbreviations.py Fri Sep 28 06:07:34 2012
@@ -6,6 +6,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class AbbreviationsTestCase(TestBase):
     
@@ -90,11 +91,11 @@
         self.expect("_regexp-b product", matching=False,
                     substrs = [ "breakpoint set --name" ])
 
-        self.expect("br s -n sum",
-                    startstr = "Breakpoint created: 2: name = 'sum', locations = 1")
+        match_object = lldbutil.run_break_set_command (self, "br s -n sum")
+        lldbutil.check_breakpoint_result (self, match_object, symbol_name='sum', symbol_match_exact=False, num_locations=1)
 
-        self.expect("br s -f main.cpp -l 32",
-                    startstr = "Breakpoint created: 3: file ='main.cpp', line = 32, locations = 1")
+        match_object = lldbutil.run_break_set_command (self, "br s -f main.cpp -l 32")
+        lldbutil.check_breakpoint_result (self, match_object, file_name='main.cpp', line_number=32, num_locations=1)
 
         self.runCmd("br co a -s python 1 -o 'print frame'")
         self.expect("br co l 1",

Modified: lldb/branches/windows/test/functionalities/abbreviation/TestCommonShortSpellings.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/abbreviation/TestCommonShortSpellings.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/abbreviation/TestCommonShortSpellings.py (original)
+++ lldb/branches/windows/test/functionalities/abbreviation/TestCommonShortSpellings.py Fri Sep 28 06:07:34 2012
@@ -7,6 +7,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class CommonShortSpellingsTestCase(TestBase):
     
@@ -29,8 +30,9 @@
                     patterns = [ "Current executable set to .*a.out.*" ])
 
         # br s -> breakpoint set
-        self.expect("br s -n sum",
-            startstr = "Breakpoint created: 1: name = 'sum', locations = 1")
+        
+        match_object = lldbutil.run_break_set_command (self, "br s -n sum")
+        lldbutil.check_breakpoint_result (self, match_object, symbol_name='sum', symbol_match_exact=False, num_locations=1)
 
         self.runCmd("settings set interpreter.expand-regex-aliases true")
         self.addTearDownHook(

Modified: lldb/branches/windows/test/functionalities/alias/TestAliases.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/alias/TestAliases.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/alias/TestAliases.py (original)
+++ lldb/branches/windows/test/functionalities/alias/TestAliases.py Fri Sep 28 06:07:34 2012
@@ -6,6 +6,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class AliasTestCase(TestBase):
 
@@ -80,15 +81,16 @@
         self.runCmd ("alias bpa bp command add")
         self.runCmd ("alias bpi bp list")
 
-        self.expect ("bp set -n foo",
-                     startstr = "Breakpoint created: 1: name = 'foo', locations = 1")
+        break_results = lldbutil.run_break_set_command (self, "bp set -n foo")
+        lldbutil.check_breakpoint_result (self, break_results, num_locations=1, symbol_name='foo', symbol_match_exact=False)
 
-        self.expect ("bp set -n sum",
-                     startstr = "Breakpoint created: 2: name = 'sum', locations = 1")
+        break_results = lldbutil.run_break_set_command (self, "bp set -n sum")
+        lldbutil.check_breakpoint_result (self, break_results, num_locations=1, symbol_name='sum', symbol_match_exact=False)
 
         self.runCmd ("alias bfl bp set -f %1 -l %2")
-        self.expect ("bfl main.cpp 32",
-                     startstr = "Breakpoint created: 3: file ='main.cpp', line = 32, locations = 1")
+
+        break_results = lldbutil.run_break_set_command (self, "bfl main.cpp 32")
+        lldbutil.check_breakpoint_result (self, break_results, num_locations=1, file_name='main.cpp', line_number=32)
 
         self.expect ("bpi",
                      startstr = "Current breakpoints:",

Modified: lldb/branches/windows/test/functionalities/archives/TestBSDArchives.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/archives/TestBSDArchives.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/archives/TestBSDArchives.py (original)
+++ lldb/branches/windows/test/functionalities/archives/TestBSDArchives.py Fri Sep 28 06:07:34 2012
@@ -4,6 +4,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class BSDArchivesTestCase(TestBase):
 
@@ -26,9 +27,8 @@
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Break inside a() by file and line first.
-        self.expect("breakpoint set -f a.c -l %d" % self.line, BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='a.c', line = %d" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "a.c", self.line, num_expected_locations=1, loc_exact=True)
+
         self.runCmd("run", RUN_SUCCEEDED)
 
         # The stop reason of the thread should be breakpoint.
@@ -43,9 +43,7 @@
             substrs = ['(int) __a_global = 1'])
 
         # Set breakpoint for b() next.
-        self.expect("breakpoint set -n b", BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 2: name = 'b'",
-            substrs = ['resolved = 1'])
+        lldbutil.run_break_set_by_symbol (self, "b", num_expected_locations=1, sym_exact=True)
 
         # Continue the program, we should break at b(int) next.
         self.runCmd("continue")

Modified: lldb/branches/windows/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py (original)
+++ lldb/branches/windows/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py Fri Sep 28 06:07:34 2012
@@ -6,6 +6,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class BreakpointCommandTestCase(TestBase):
 
@@ -45,18 +46,9 @@
 
         # Add three breakpoints on the same line.  The first time we don't specify the file,
         # since the default file is the one containing main:
-        self.expect("breakpoint set -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.c', line = %d, locations = 1" %
-                        self.line)
-        self.expect("breakpoint set -f main.c -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 2: file ='main.c', line = %d, locations = 1" %
-                        self.line)
-        self.expect("breakpoint set -f main.c -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 3: file ='main.c', line = %d, locations = 1" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, None, self.line, num_expected_locations=1, loc_exact=True)
+        lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
+        lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
 
         # Now add callbacks for the breakpoints just created.
         self.runCmd("breakpoint command add -s command -o 'frame variable -T -s' 1")
@@ -93,21 +85,17 @@
         # Next lets try some other breakpoint kinds.  First break with a regular expression
         # and then specify only one file.  The first time we should get two locations,
         # the second time only one:
-        self.expect ("break set -r ._MyFunction",
-                     patterns = ["Breakpoint created: [0-9]+: regex = '\._MyFunction', locations = 2"])
-      
-        self.expect ("break set -r ._MyFunction -f a.c",
-                     patterns = ["Breakpoint created: [0-9]+: regex = '\._MyFunction', locations = 1"])
+
+        lldbutil.run_break_set_by_regexp (self, r"._MyFunction", num_expected_locations=2)
+        
+        lldbutil.run_break_set_by_regexp (self, r"._MyFunction", extra_options="-f a.c", num_expected_locations=1)
       
-        self.expect ("break set -r ._MyFunction -f a.c -f b.c",
-                     patterns = ["Breakpoint created: [0-9]+: regex = '\._MyFunction', locations = 2"])
+        lldbutil.run_break_set_by_regexp (self, r"._MyFunction", extra_options="-f a.c -f b.c", num_expected_locations=2)
 
         # Now try a source regex breakpoint:
-        self.expect ("break set -p \"is about to return [12]0\" -f a.c -f b.c",
-                     patterns = ["Breakpoint created: [0-9]+: source regex = \"is about to return \[12\]0\", locations = 2"])
+        lldbutil.run_break_set_by_source_regexp (self, r"is about to return [12]0", extra_options="-f a.c -f b.c", num_expected_locations=2)
       
-        self.expect ("break set -p \"is about to return [12]0\" -f a.c",
-                     patterns = ["Breakpoint created: [0-9]+: source regex = \"is about to return \[12\]0\", locations = 1"])
+        lldbutil.run_break_set_by_source_regexp (self, r"is about to return [12]0", extra_options="-f a.c", num_expected_locations=1)
       
         # Run the program.  Remove 'output.txt' if it exists.
         self.RemoveTempFile("output.txt")
@@ -181,10 +169,7 @@
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Add a breakpoint.
-        self.expect("breakpoint set -f main.c -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.c', line = %d, locations = 1" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
 
         # Now add callbacks for the breakpoints just created.
         self.runCmd("breakpoint command add -s python -o 'here = open(\"output-2.txt\", \"w\"); print >> here, frame; print >> here, bp_loc; here.close()' 1")

Modified: lldb/branches/windows/test/functionalities/breakpoint/breakpoint_command/TestRegexpBreakCommand.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/breakpoint/breakpoint_command/TestRegexpBreakCommand.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/breakpoint/breakpoint_command/TestRegexpBreakCommand.py (original)
+++ lldb/branches/windows/test/functionalities/breakpoint/breakpoint_command/TestRegexpBreakCommand.py Fri Sep 28 06:07:34 2012
@@ -6,6 +6,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class RegexpBreakCommandTestCase(TestBase):
 
@@ -36,12 +37,11 @@
         exe = os.path.join(os.getcwd(), "a.out")
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
-        self.expect("b %d" % self.line,
-                    BREAKPOINT_CREATED,
-            substrs = ["Breakpoint created: 1: file ='main.c', line = %d, locations = 1" % self.line])
-        self.expect("b %s:%d" % (self.source, self.line),
-                    BREAKPOINT_CREATED,
-            substrs = ["Breakpoint created: 2: file ='main.c', line = %d, locations = 1" % self.line])
+        break_results = lldbutil.run_break_set_command (self, "b %d" % self.line)
+        lldbutil.check_breakpoint_result (self, break_results, file_name='main.c', line_number=self.line, num_locations=1)
+
+        break_results = lldbutil.run_break_set_command (self, "b %s:%d" % (self.source, self.line))
+        lldbutil.check_breakpoint_result (self, break_results, file_name='main.c', line_number=self.line, num_locations=1)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py (original)
+++ lldb/branches/windows/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py Fri Sep 28 06:07:34 2012
@@ -67,12 +67,10 @@
 
         if inline:
             # Create a breakpoint by function name 'c' and set the condition.
-            self.expect("breakpoint set -n c -c 'val == 3'", BREAKPOINT_CREATED,
-                startstr = "Breakpoint created: 1: name = 'c', locations = 1")
+            lldbutil.run_break_set_by_symbol (self, "c", extra_options="-c 'val == 3'", num_expected_locations=1, sym_exact=True)
         else:
             # Create a breakpoint by function name 'c'.
-            self.expect("breakpoint set -n c", BREAKPOINT_CREATED,
-                startstr = "Breakpoint created: 1: name = 'c', locations = 1")
+            lldbutil.run_break_set_by_symbol (self, "c", num_expected_locations=1, sym_exact=True)
 
             # And set a condition on the breakpoint to stop on when 'val == 3'.
             self.runCmd("breakpoint modify -c 'val == 3' 1")

Modified: lldb/branches/windows/test/functionalities/breakpoint/breakpoint_ids/TestBreakpointIDs.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/breakpoint/breakpoint_ids/TestBreakpointIDs.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/breakpoint/breakpoint_ids/TestBreakpointIDs.py (original)
+++ lldb/branches/windows/test/functionalities/breakpoint/breakpoint_ids/TestBreakpointIDs.py Fri Sep 28 06:07:34 2012
@@ -6,6 +6,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class BreakpointIDTestCase(TestBase):
 
@@ -27,15 +28,15 @@
         self.expect("file " + exe,
                     patterns = [ "Current executable set to .*a.out" ])
 
-        self.expect ("breakpoint set -n product",
-                     startstr = "Breakpoint created: 1: name = 'product', locations =")
+        
+        bpno = lldbutil.run_break_set_by_symbol (self, 'product', num_expected_locations=-1, sym_exact=False)
+        self.assertTrue (bpno == 1, "First breakpoint number is 1.")
 
-        self.expect ("breakpoint set -n sum",
-                     startstr = "Breakpoint created: 2: name = 'sum', locations =")
+        bpno = lldbutil.run_break_set_by_symbol (self, 'sum', num_expected_locations=-1, sym_exact=False)
+        self.assertTrue (bpno == 2, "Second breakpoint number is 2.")
 
-        self.expect ("breakpoint set -n junk",
-                     startstr = "Breakpoint created: 3: name = 'junk', locations = 0 (pending)",
-                     substrs = [ "WARNING:  Unable to resolve breakpoint to any actual locations." ] )
+        bpno = lldbutil.run_break_set_by_symbol (self, 'junk', num_expected_locations=0, sym_exact=False)
+        self.assertTrue (bpno == 3, "Third breakpoint number is 3.")
 
         self.expect ("breakpoint disable 1.1 - 2.2 ",
                      COMMAND_FAILED_AS_EXPECTED, error = True,

Modified: lldb/branches/windows/test/functionalities/breakpoint/breakpoint_ignore_count/TestBreakpointIgnoreCount.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/breakpoint/breakpoint_ignore_count/TestBreakpointIgnoreCount.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/breakpoint/breakpoint_ignore_count/TestBreakpointIgnoreCount.py (original)
+++ lldb/branches/windows/test/functionalities/breakpoint/breakpoint_ignore_count/TestBreakpointIgnoreCount.py Fri Sep 28 06:07:34 2012
@@ -55,10 +55,8 @@
         exe = os.path.join(os.getcwd(), "a.out")
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
-        # Create a breakpoint by function name 'c'.
-        self.expect("breakpoint set -i 1 -f main.c -l %d" % self.line1, BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.c', line = %d, locations = 1" %
-                        self.line1)
+        # Create a breakpoint in main.c at line1.
+        lldbutil.run_break_set_by_file_and_line (self, 'main.c', self.line1, extra_options='-i 1', num_expected_locations=1, loc_exact=True)
 
         # Now run the program.
         self.runCmd("run", RUN_SUCCEEDED)

Modified: lldb/branches/windows/test/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py (original)
+++ lldb/branches/windows/test/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py Fri Sep 28 06:07:34 2012
@@ -6,6 +6,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class BreakpointLocationsTestCase(TestBase):
 
@@ -36,10 +37,7 @@
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # This should create a breakpoint with 3 locations.
-        self.expect("breakpoint set -f main.c -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.c', line = %d, locations = 3" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=3)
 
         # The breakpoint list should show 3 locations.
         self.expect("breakpoint list -f", "Breakpoint locations shown correctly",

Modified: lldb/branches/windows/test/functionalities/breakpoint/inlined_breakpoints/TestInlinedBreakpoints.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/breakpoint/inlined_breakpoints/TestInlinedBreakpoints.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/breakpoint/inlined_breakpoints/TestInlinedBreakpoints.py (original)
+++ lldb/branches/windows/test/functionalities/breakpoint/inlined_breakpoints/TestInlinedBreakpoints.py Fri Sep 28 06:07:34 2012
@@ -7,6 +7,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class InlinedBreakpointsTestCase(TestBase):
     """Bug fixed: rdar://problem/8464339"""
@@ -38,9 +39,7 @@
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Set a breakpoint and fail because it is in an inlined source implemenation file
-        self.expect("breakpoint set -f basic_type.cpp -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='basic_type.cpp', line = %d, locations = 0 (pending)" % self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "basic_type.cpp", self.line, num_expected_locations=0)
 
         # Now enable breakpoints in implementation files and see the breakpoint set succeed
         self.runCmd('settings set target.inline-breakpoint-strategy always')
@@ -48,10 +47,7 @@
         self.addTearDownHook(
             lambda: self.runCmd("settings set target.inline-breakpoint-strategy headers"))
 
-        self.expect("breakpoint set -f basic_type.cpp -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 2: file ='basic_type.cpp', line = %d, locations = 1" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "basic_type.cpp", self.line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

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=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/completion/TestCompletion.py (original)
+++ lldb/branches/windows/test/functionalities/completion/TestCompletion.py Fri Sep 28 06:07:34 2012
@@ -15,8 +15,11 @@
     @classmethod
     def classCleanup(cls):
         """Cleanup the test byproducts."""
-        os.remove("child_send.txt")
-        os.remove("child_read.txt")
+        try:
+            os.remove("child_send.txt")
+            os.remove("child_read.txt")
+        except:
+            pass
 
     def test_at(self):
         """Test that 'at' completes to 'attach '."""

Modified: lldb/branches/windows/test/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py (original)
+++ lldb/branches/windows/test/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py Fri Sep 28 06:07:34 2012
@@ -6,6 +6,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class AdvDataFormatterTestCase(TestBase):
 
@@ -34,10 +35,7 @@
         """Test that that file and class static variables display correctly."""
         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
 
-        self.expect("breakpoint set -f main.cpp -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.cpp', line = %d, locations = 1" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/functionalities/data-formatter/data-formatter-categories/TestDataFormatterCategories.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/data-formatter/data-formatter-categories/TestDataFormatterCategories.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/data-formatter/data-formatter-categories/TestDataFormatterCategories.py (original)
+++ lldb/branches/windows/test/functionalities/data-formatter/data-formatter-categories/TestDataFormatterCategories.py Fri Sep 28 06:07:34 2012
@@ -6,6 +6,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class CategoriesDataFormatterTestCase(TestBase):
 
@@ -34,10 +35,7 @@
         """Test that that file and class static variables display correctly."""
         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
 
-        self.expect("breakpoint set -f main.cpp -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.cpp', line = %d, locations = 1" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/functionalities/data-formatter/data-formatter-cpp/TestDataFormatterCpp.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/data-formatter/data-formatter-cpp/TestDataFormatterCpp.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/data-formatter/data-formatter-cpp/TestDataFormatterCpp.py (original)
+++ lldb/branches/windows/test/functionalities/data-formatter/data-formatter-cpp/TestDataFormatterCpp.py Fri Sep 28 06:07:34 2012
@@ -6,6 +6,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class CppDataFormatterTestCase(TestBase):
 
@@ -34,10 +35,7 @@
         """Test that that file and class static variables display correctly."""
         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
 
-        self.expect("breakpoint set -f main.cpp -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.cpp', line = %d, locations = 1" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/functionalities/data-formatter/data-formatter-disabling/TestDataFormatterDisabling.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/data-formatter/data-formatter-disabling/TestDataFormatterDisabling.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/data-formatter/data-formatter-disabling/TestDataFormatterDisabling.py (original)
+++ lldb/branches/windows/test/functionalities/data-formatter/data-formatter-disabling/TestDataFormatterDisabling.py Fri Sep 28 06:07:34 2012
@@ -6,6 +6,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class DataFormatterDisablingTestCase(TestBase):
 
@@ -34,10 +35,7 @@
         """Check that we can properly disable all data formatter categories."""
         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
 
-        self.expect("breakpoint set -f main.cpp -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.cpp', line = %d" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/functionalities/data-formatter/data-formatter-globals/TestDataFormatterGlobals.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/data-formatter/data-formatter-globals/TestDataFormatterGlobals.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/data-formatter/data-formatter-globals/TestDataFormatterGlobals.py (original)
+++ lldb/branches/windows/test/functionalities/data-formatter/data-formatter-globals/TestDataFormatterGlobals.py Fri Sep 28 06:07:34 2012
@@ -6,6 +6,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class GlobalsDataFormatterTestCase(TestBase):
 
@@ -34,10 +35,7 @@
         """Test that that file and class static variables display correctly."""
         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
 
-        self.expect("breakpoint set -f main.cpp -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.cpp', line = %d, locations = 1" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
 
         # This is the function to remove the custom formats in order to have a
         # clean slate for the next test case.

Modified: lldb/branches/windows/test/functionalities/data-formatter/data-formatter-named-summaries/TestDataFormatterNamedSummaries.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/data-formatter/data-formatter-named-summaries/TestDataFormatterNamedSummaries.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/data-formatter/data-formatter-named-summaries/TestDataFormatterNamedSummaries.py (original)
+++ lldb/branches/windows/test/functionalities/data-formatter/data-formatter-named-summaries/TestDataFormatterNamedSummaries.py Fri Sep 28 06:07:34 2012
@@ -6,6 +6,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class NamedSummariesDataFormatterTestCase(TestBase):
 
@@ -34,10 +35,7 @@
         """Test that that file and class static variables display correctly."""
         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
 
-        self.expect("breakpoint set -f main.cpp -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.cpp', line = %d, locations = 1" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

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=164820&r1=164819&r2=164820&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 Fri Sep 28 06:07:34 2012
@@ -8,6 +8,7 @@
 import lldb
 from lldbtest import *
 import datetime
+import lldbutil
 
 class ObjCDataFormatterTestCase(TestBase):
 
@@ -89,6 +90,8 @@
         """Test common cases of expression parser <--> formatters interaction."""
         self.buildDsym()
         self.expr_objc_data_formatter_commands()
+        def getCategories(self):
+            return ['dataformatters','expression','objc']
 
     @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
     @dwarf_test
@@ -96,6 +99,8 @@
         """Test common cases of expression parser <--> formatters interaction."""
         self.buildDwarf()
         self.expr_objc_data_formatter_commands()
+        def getCategories(self):
+            return ['dataformatters','expression','objc']
 
     def setUp(self):
         # Call super's setUp().
@@ -107,10 +112,7 @@
         """Check that Unicode characters come out of CFString summary correctly."""
         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
 
-        self.expect("breakpoint set -f main.m -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.m', line = %d, locations = 1" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 
@@ -141,10 +143,7 @@
         """Test basic ObjC formatting behavior."""
         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
 
-        self.expect("breakpoint set -f main.m -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.m', line = %d, locations = 1" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 
@@ -198,10 +197,7 @@
         """Test formatters for AppKit classes."""
         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
 
-        self.expect("breakpoint set -f main.m -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.m', line = %d, locations = 1" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 
@@ -370,10 +366,7 @@
         """Test common cases of expression parser <--> formatters interaction."""
         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
 
-        self.expect("breakpoint set -f main.m -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.m', line = %d, locations = 1" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 
@@ -416,10 +409,7 @@
         """Test formatters for Core OSX frameworks."""
         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
 
-        self.expect("breakpoint set -f main.m -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.m', line = %d, locations = 1" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 
@@ -473,10 +463,7 @@
         """Test the behavior of formatters when KVO is in use."""
         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
 
-        self.expect("breakpoint set -f main.m -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.m', line = %d, locations = 1" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 
@@ -510,7 +497,8 @@
         # check that NSMutableDictionary's formatter is not confused when dealing with a KVO'd dictionary
         self.expect('frame variable newMutableDictionary', substrs = ['(NSDictionary *) newMutableDictionary = ',' 21 key/value pairs'])
 
-        self.runCmd("breakpoint set -r setAtoms")
+        lldbutil.run_break_set_by_regexp (self, 'setAtoms')
+
         self.runCmd("continue")
         self.expect("frame variable _cmd",substrs = ['setAtoms:'])
 

Modified: lldb/branches/windows/test/functionalities/data-formatter/data-formatter-objc/main.m
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/data-formatter/data-formatter-objc/main.m?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/data-formatter/data-formatter-objc/main.m (original)
+++ lldb/branches/windows/test/functionalities/data-formatter/data-formatter-objc/main.m Fri Sep 28 06:07:34 2012
@@ -653,9 +653,7 @@
 	NSArray *components = @[@"usr", @"blah", @"stuff"];
 	NSString *path = [NSString pathWithComponents: components];
 
-    // Set break point at this line.
-
-    [molecule addObserver:[My_KVO_Observer new] forKeyPath:@"atoms" options:0 context:NULL];
+    [molecule addObserver:[My_KVO_Observer new] forKeyPath:@"atoms" options:0 context:NULL];     // Set break point at this line.
     [newMutableDictionary addObserver:[My_KVO_Observer new] forKeyPath:@"weirdKeyToKVO" options:NSKeyValueObservingOptionNew context:NULL];
 
     [molecule setAtoms:nil];

Modified: lldb/branches/windows/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py (original)
+++ lldb/branches/windows/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py Fri Sep 28 06:07:34 2012
@@ -6,6 +6,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class PythonSynthDataFormatterTestCase(TestBase):
 
@@ -50,10 +51,7 @@
         """Test using Python synthetic children provider."""
         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
 
-        self.expect("breakpoint set -f main.cpp -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.cpp', line = %d, locations = 1" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 
@@ -207,14 +205,9 @@
         """Test that synthetic children persist stoppoints."""
         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
 
-        self.expect("breakpoint set -f main.cpp -l %d" % self.line2,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.cpp', line = %d, locations = 1" %
-                        self.line2)
-        self.expect("breakpoint set -f main.cpp -l %d" % self.line3,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 2: file ='main.cpp', line = %d, locations = 1" %
-                        self.line3)
+        # The second breakpoint is on a multi-line expression, so the comment can't be on the right line...
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line2, num_expected_locations=1, loc_exact=False)
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line3, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/functionalities/data-formatter/data-formatter-python-synth/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/data-formatter/data-formatter-python-synth/main.cpp?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/data-formatter/data-formatter-python-synth/main.cpp (original)
+++ lldb/branches/windows/test/functionalities/data-formatter/data-formatter-python-synth/main.cpp Fri Sep 28 06:07:34 2012
@@ -62,6 +62,5 @@
 	               256*'X' +
 	               256*256*'T'+
 	               256*256*256*'F';
-    // Set second cast break point at this line.
-    return 0;
-}
\ No newline at end of file
+    return 0;     // Set second cast break point at this line.
+}

Modified: lldb/branches/windows/test/functionalities/data-formatter/data-formatter-script/TestDataFormatterScript.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/data-formatter/data-formatter-script/TestDataFormatterScript.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/data-formatter/data-formatter-script/TestDataFormatterScript.py (original)
+++ lldb/branches/windows/test/functionalities/data-formatter/data-formatter-script/TestDataFormatterScript.py Fri Sep 28 06:07:34 2012
@@ -6,6 +6,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class ScriptDataFormatterTestCase(TestBase):
 
@@ -34,10 +35,7 @@
         """Test that that file and class static variables display correctly."""
         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
 
-        self.expect("breakpoint set -f main.cpp -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.cpp', line = %d, locations = 1" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/functionalities/data-formatter/data-formatter-skip-summary/TestDataFormatterSkipSummary.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/data-formatter/data-formatter-skip-summary/TestDataFormatterSkipSummary.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/data-formatter/data-formatter-skip-summary/TestDataFormatterSkipSummary.py (original)
+++ lldb/branches/windows/test/functionalities/data-formatter/data-formatter-skip-summary/TestDataFormatterSkipSummary.py Fri Sep 28 06:07:34 2012
@@ -6,6 +6,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class SkipSummaryDataFormatterTestCase(TestBase):
 
@@ -34,10 +35,9 @@
         """Test that that file and class static variables display correctly."""
         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
 
-        self.expect("breakpoint set -f main.cpp -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.cpp', line = %d, locations = 1" %
-                        self.line)
+        #import lldbutil
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
+
 
         self.runCmd("run", RUN_SUCCEEDED)
 
@@ -134,7 +134,7 @@
         # Bad debugging info on SnowLeopard gcc (Apple Inc. build 5666).
         # Skip the following tests if the condition is met.
         if self.getCompiler().endswith('gcc') and not self.getCompiler().endswith('llvm-gcc'):
-           import re, lldbutil
+           import re
            gcc_version_output = system([lldbutil.which(self.getCompiler()), "-v"])[1]
            #print "my output:", gcc_version_output
            for line in gcc_version_output.split(os.linesep):

Modified: lldb/branches/windows/test/functionalities/data-formatter/data-formatter-smart-array/TestDataFormatterSmartArray.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/data-formatter/data-formatter-smart-array/TestDataFormatterSmartArray.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/data-formatter/data-formatter-smart-array/TestDataFormatterSmartArray.py (original)
+++ lldb/branches/windows/test/functionalities/data-formatter/data-formatter-smart-array/TestDataFormatterSmartArray.py Fri Sep 28 06:07:34 2012
@@ -6,6 +6,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class SmartArrayDataFormatterTestCase(TestBase):
 
@@ -34,10 +35,7 @@
         """Test that that file and class static variables display correctly."""
         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
 
-        self.expect("breakpoint set -f main.cpp -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.cpp', line = %d, locations = 1" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/TestDataFormatterLibcxxList.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/TestDataFormatterLibcxxList.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/TestDataFormatterLibcxxList.py (original)
+++ lldb/branches/windows/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/TestDataFormatterLibcxxList.py Fri Sep 28 06:07:34 2012
@@ -6,6 +6,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class LibcxxListDataFormatterTestCase(TestBase):
 
@@ -35,14 +36,8 @@
         """Test that that file and class static variables display correctly."""
         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
 
-        self.expect("breakpoint set -f main.cpp -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.cpp', line = %d" %
-                        self.line)
-        self.expect("breakpoint set -f main.cpp -l %d" % self.line2,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 2: file ='main.cpp', line = %d" %
-                        self.line2)
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=-1)
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line2, num_expected_locations=-1)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/functionalities/data-formatter/data-formatter-stl/libcxx/map/TestDataFormatterLibccMap.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/data-formatter/data-formatter-stl/libcxx/map/TestDataFormatterLibccMap.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/data-formatter/data-formatter-stl/libcxx/map/TestDataFormatterLibccMap.py (original)
+++ lldb/branches/windows/test/functionalities/data-formatter/data-formatter-stl/libcxx/map/TestDataFormatterLibccMap.py Fri Sep 28 06:07:34 2012
@@ -6,6 +6,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class LibcxxMapDataFormatterTestCase(TestBase):
 
@@ -34,10 +35,7 @@
         """Test that that file and class static variables display correctly."""
         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
 
-        self.expect("breakpoint set -f main.cpp -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.cpp', line = %d" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=-1)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/functionalities/data-formatter/data-formatter-stl/libcxx/vector/TestDataFormatterLibcxxVector.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/data-formatter/data-formatter-stl/libcxx/vector/TestDataFormatterLibcxxVector.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/data-formatter/data-formatter-stl/libcxx/vector/TestDataFormatterLibcxxVector.py (original)
+++ lldb/branches/windows/test/functionalities/data-formatter/data-formatter-stl/libcxx/vector/TestDataFormatterLibcxxVector.py Fri Sep 28 06:07:34 2012
@@ -6,6 +6,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class LibcxxVectorDataFormatterTestCase(TestBase):
 
@@ -35,14 +36,8 @@
         """Test that that file and class static variables display correctly."""
         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
 
-        self.expect("breakpoint set -f main.cpp -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.cpp', line = %d" %
-                        self.line)
-        self.expect("breakpoint set -f main.cpp -l %d" % self.line2,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 2: file ='main.cpp', line = %d" %
-                        self.line2)
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=-1)
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line2, num_expected_locations=-1)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/TestDataFormatterStdList.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/TestDataFormatterStdList.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/TestDataFormatterStdList.py (original)
+++ lldb/branches/windows/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/TestDataFormatterStdList.py Fri Sep 28 06:07:34 2012
@@ -6,6 +6,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class StdListDataFormatterTestCase(TestBase):
 
@@ -34,10 +35,7 @@
         """Test that that file and class static variables display correctly."""
         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
 
-        self.expect("breakpoint set -f main.cpp -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.cpp', line = %d" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=-1)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/TestDataFormatterStdMap.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/TestDataFormatterStdMap.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/TestDataFormatterStdMap.py (original)
+++ lldb/branches/windows/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/TestDataFormatterStdMap.py Fri Sep 28 06:07:34 2012
@@ -6,6 +6,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class StdMapDataFormatterTestCase(TestBase):
 
@@ -34,10 +35,7 @@
         """Test that that file and class static variables display correctly."""
         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
 
-        self.expect("breakpoint set -f main.cpp -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.cpp', line = %d" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=-1)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/TestDataFormatterStdVector.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/TestDataFormatterStdVector.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/TestDataFormatterStdVector.py (original)
+++ lldb/branches/windows/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/TestDataFormatterStdVector.py Fri Sep 28 06:07:34 2012
@@ -6,6 +6,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class StdVectorDataFormatterTestCase(TestBase):
 
@@ -34,10 +35,7 @@
         """Test that that file and class static variables display correctly."""
         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
 
-        self.expect("breakpoint set -f main.cpp -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.cpp', line = %d" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=-1)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/functionalities/data-formatter/data-formatter-synth/TestDataFormatterSynth.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/data-formatter/data-formatter-synth/TestDataFormatterSynth.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/data-formatter/data-formatter-synth/TestDataFormatterSynth.py (original)
+++ lldb/branches/windows/test/functionalities/data-formatter/data-formatter-synth/TestDataFormatterSynth.py Fri Sep 28 06:07:34 2012
@@ -6,6 +6,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class SynthDataFormatterTestCase(TestBase):
 
@@ -34,10 +35,7 @@
         """Test that that file and class static variables display correctly."""
         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
 
-        self.expect("breakpoint set -f main.cpp -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.cpp', line = %d, locations = 1" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/functionalities/data-formatter/rdar-10449092/Test-rdar-10449092.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/data-formatter/rdar-10449092/Test-rdar-10449092.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/data-formatter/rdar-10449092/Test-rdar-10449092.py (original)
+++ lldb/branches/windows/test/functionalities/data-formatter/rdar-10449092/Test-rdar-10449092.py Fri Sep 28 06:07:34 2012
@@ -6,6 +6,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class Radar10449092DataFormatterTestCase(TestBase):
 
@@ -35,10 +36,7 @@
         """Test that that file and class static variables display correctly."""
         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
 
-        self.expect("breakpoint set -f main.cpp -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.cpp', line = %d, locations = 1" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/functionalities/data-formatter/rdar-10642615/Test-rdar-10642615.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/data-formatter/rdar-10642615/Test-rdar-10642615.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/data-formatter/rdar-10642615/Test-rdar-10642615.py (original)
+++ lldb/branches/windows/test/functionalities/data-formatter/rdar-10642615/Test-rdar-10642615.py Fri Sep 28 06:07:34 2012
@@ -6,6 +6,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class Radar10642615DataFormatterTestCase(TestBase):
 
@@ -35,10 +36,7 @@
         """Test that that file and class static variables display correctly."""
         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
 
-        self.expect("breakpoint set -f main.cpp -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.cpp', line = %d" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/functionalities/data-formatter/rdar-10887661/TestRdar10887661.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/data-formatter/rdar-10887661/TestRdar10887661.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/data-formatter/rdar-10887661/TestRdar10887661.py (original)
+++ lldb/branches/windows/test/functionalities/data-formatter/rdar-10887661/TestRdar10887661.py Fri Sep 28 06:07:34 2012
@@ -6,6 +6,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class Rdar10887661TestCase(TestBase):
 
@@ -38,10 +39,7 @@
         """Check for an issue where capping does not work because the Target pointer appears to be changing behind our backs."""
         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
 
-        self.expect("breakpoint set -f main.cpp -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.cpp', line = %d, locations = 1" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/functionalities/data-formatter/rdar-11086338/TestRdar11086338.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/data-formatter/rdar-11086338/TestRdar11086338.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/data-formatter/rdar-11086338/TestRdar11086338.py (original)
+++ lldb/branches/windows/test/functionalities/data-formatter/rdar-11086338/TestRdar11086338.py Fri Sep 28 06:07:34 2012
@@ -7,6 +7,7 @@
 import lldb
 from lldbtest import *
 import datetime
+import lldbutil
 
 class DataFormatterRdar11086338TestCase(TestBase):
 
@@ -36,10 +37,7 @@
         """Test that NSArray reports its synthetic children properly."""
         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
 
-        self.expect("breakpoint set -f main.m -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.m', line = %d, locations = 1" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/functionalities/data-formatter/rdar-11628688/TestFormattersBoolRefPtr.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/data-formatter/rdar-11628688/TestFormattersBoolRefPtr.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/data-formatter/rdar-11628688/TestFormattersBoolRefPtr.py (original)
+++ lldb/branches/windows/test/functionalities/data-formatter/rdar-11628688/TestFormattersBoolRefPtr.py Fri Sep 28 06:07:34 2012
@@ -7,6 +7,7 @@
 import lldb
 from lldbtest import *
 import datetime
+import lldbutil
 
 class DataFormatterOSTypeTestCase(TestBase):
 
@@ -36,10 +37,7 @@
         """Test the formatters we use for OSType."""
         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
 
-        self.expect("breakpoint set -f main.mm -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.mm', line = %d, locations = 1" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.mm", self.line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/functionalities/data-formatter/rdar-11773899/TestFormattersBoolRefPtr.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/data-formatter/rdar-11773899/TestFormattersBoolRefPtr.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/data-formatter/rdar-11773899/TestFormattersBoolRefPtr.py (original)
+++ lldb/branches/windows/test/functionalities/data-formatter/rdar-11773899/TestFormattersBoolRefPtr.py Fri Sep 28 06:07:34 2012
@@ -7,6 +7,7 @@
 import lldb
 from lldbtest import *
 import datetime
+import lldbutil
 
 class DataFormatterBoolRefPtr(TestBase):
 
@@ -36,10 +37,7 @@
         """Test the formatters we use for BOOL& and BOOL* in Objective-C."""
         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
 
-        self.expect("breakpoint set -f main.mm -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.mm', line = %d, locations = 1" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.mm", self.line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/functionalities/data-formatter/rdar-11988289/TestRdar 11988289.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/data-formatter/rdar-11988289/TestRdar%2011988289.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/data-formatter/rdar-11988289/TestRdar 11988289.py (original)
+++ lldb/branches/windows/test/functionalities/data-formatter/rdar-11988289/TestRdar 11988289.py Fri Sep 28 06:07:34 2012
@@ -7,6 +7,7 @@
 import lldb
 from lldbtest import *
 import datetime
+import lldbutil
 
 class DataFormatterRdar11988289TestCase(TestBase):
 
@@ -36,10 +37,7 @@
         """Test that NSDictionary reports its synthetic children properly."""
         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
 
-        self.expect("breakpoint set -f main.m -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.m', line = %d, locations = 1" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/functionalities/data-formatter/rdar-3534688/TestFormattersOneIsSingular.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/data-formatter/rdar-3534688/TestFormattersOneIsSingular.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/data-formatter/rdar-3534688/TestFormattersOneIsSingular.py (original)
+++ lldb/branches/windows/test/functionalities/data-formatter/rdar-3534688/TestFormattersOneIsSingular.py Fri Sep 28 06:07:34 2012
@@ -7,6 +7,7 @@
 import lldb
 from lldbtest import *
 import datetime
+import lldbutil
 
 class DataFormatterOneIsSingularTestCase(TestBase):
 
@@ -36,10 +37,7 @@
         """Test that 1 item is not as reported as 1 items."""
         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
 
-        self.expect("breakpoint set -f main.m -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.m', line = %d, locations = 1" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/functionalities/data-formatter/rdar-9973865/Test-rdar-9973865.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/data-formatter/rdar-9973865/Test-rdar-9973865.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/data-formatter/rdar-9973865/Test-rdar-9973865.py (original)
+++ lldb/branches/windows/test/functionalities/data-formatter/rdar-9973865/Test-rdar-9973865.py Fri Sep 28 06:07:34 2012
@@ -6,6 +6,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class Radar9973865DataFormatterTestCase(TestBase):
 
@@ -35,10 +36,7 @@
         """Test that that file and class static variables display correctly."""
         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
 
-        self.expect("breakpoint set -f main.cpp -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.cpp', line = %d, locations = 1" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/functionalities/data-formatter/rdar-9973992/Test-rdar-9973992.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/data-formatter/rdar-9973992/Test-rdar-9973992.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/data-formatter/rdar-9973992/Test-rdar-9973992.py (original)
+++ lldb/branches/windows/test/functionalities/data-formatter/rdar-9973992/Test-rdar-9973992.py Fri Sep 28 06:07:34 2012
@@ -6,6 +6,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class Radar9973992DataFormatterTestCase(TestBase):
 
@@ -35,10 +36,7 @@
         """Test that that file and class static variables display correctly."""
         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
 
-        self.expect("breakpoint set -f main.cpp -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.cpp', line = %d, locations = 1" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/functionalities/data-formatter/rdar-9974002/Test-rdar-9974002.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/data-formatter/rdar-9974002/Test-rdar-9974002.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/data-formatter/rdar-9974002/Test-rdar-9974002.py (original)
+++ lldb/branches/windows/test/functionalities/data-formatter/rdar-9974002/Test-rdar-9974002.py Fri Sep 28 06:07:34 2012
@@ -6,6 +6,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class Radar9974002DataFormatterTestCase(TestBase):
 
@@ -35,10 +36,7 @@
         """Test that that file and class static variables display correctly."""
         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
 
-        self.expect("breakpoint set -f main.cpp -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.cpp', line = %d, locations = 1" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/functionalities/dead-strip/TestDeadStrip.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/dead-strip/TestDeadStrip.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/dead-strip/TestDeadStrip.py (original)
+++ lldb/branches/windows/test/functionalities/dead-strip/TestDeadStrip.py Fri Sep 28 06:07:34 2012
@@ -6,6 +6,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class DeadStripTestCase(TestBase):
 
@@ -30,16 +31,13 @@
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Break by function name f1 (live code).
-        self.expect("breakpoint set -s a.out -n f1", BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: name = 'f1', module = a.out, locations = 1")
+        lldbutil.run_break_set_by_symbol (self, "f1", extra_options="-s a.out", num_expected_locations=1, module_name="a.out")
 
         # Break by function name f2 (dead code).
-        self.expect("breakpoint set -s a.out -n f2", BREAKPOINT_PENDING_CREATED,
-            startstr = "Breakpoint created: 2: name = 'f2', module = a.out, locations = 0 (pending)")
+        lldbutil.run_break_set_by_symbol (self, "f2", extra_options="-s a.out", num_expected_locations=0)
 
         # Break by function name f3 (live code).
-        self.expect("breakpoint set -s a.out -n f3", BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 3: name = 'f3', module = a.out, locations = 1")
+        lldbutil.run_break_set_by_symbol (self, "f3", extra_options="-s a.out", num_expected_locations=1, module_name="a.out")
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/functionalities/inferior-changed/TestInferiorChanged.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/inferior-changed/TestInferiorChanged.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/inferior-changed/TestInferiorChanged.py (original)
+++ lldb/branches/windows/test/functionalities/inferior-changed/TestInferiorChanged.py Fri Sep 28 06:07:34 2012
@@ -4,6 +4,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class ChangedInferiorTestCase(TestBase):
 
@@ -64,10 +65,7 @@
             self.fail("Inferior changed, but lldb did not perform a reload")
 
         # Break inside the main.
-        self.expect("breakpoint set -f main2.c -l %d" % self.line2,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main2.c', line = %d, locations = 1" %
-                        self.line2)
+        lldbutil.run_break_set_by_file_and_line (self, "main2.c", self.line2, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/functionalities/load_unload/TestLoadUnload.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/load_unload/TestLoadUnload.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/load_unload/TestLoadUnload.py (original)
+++ lldb/branches/windows/test/functionalities/load_unload/TestLoadUnload.py Fri Sep 28 06:07:34 2012
@@ -7,6 +7,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class LoadUnloadTestCase(TestBase):
 
@@ -112,10 +113,8 @@
         remove_dyld_path_cmd = "settings remove target.env-vars " + dylibPath
         self.addTearDownHook(lambda: self.runCmd(remove_dyld_path_cmd))
 
-        self.expect("breakpoint set -f d.c -l %d" % self.line_d_function,
-                    BREAKPOINT_CREATED,
-                    startstr = "Breakpoint created: 1: file ='d.c', line = %d" %
-                        self.line_d_function)
+        lldbutil.run_break_set_by_file_and_line (self, "d.c", self.line_d_function, num_expected_locations=1, loc_exact=True)
+
         # For now we don't track DYLD_LIBRARY_PATH, so the old library will be in
         # the modules list.
         self.expect("target modules list",
@@ -143,10 +142,7 @@
         # Break at main.c before the call to dlopen().
         # Use lldb's process load command to load the dylib, instead.
 
-        self.expect("breakpoint set -f main.c -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.c', line = %d" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 
@@ -190,8 +186,7 @@
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Break by function name a_function (not yet loaded).
-        self.expect("breakpoint set -n a_function", BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: name = 'a_function', locations = 0 (pending)")
+        lldbutil.run_break_set_by_symbol (self, "a_function", num_expected_locations=0)
 
         self.runCmd("run", RUN_SUCCEEDED)
 
@@ -230,9 +225,7 @@
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Break by function name a_function (not yet loaded).
-        self.expect("breakpoint set -f main.c -l %d"%(self.line), BREAKPOINT_CREATED,
-            substrs = ['Breakpoint created:',
-                      "file ='main.c', line = %d, locations = 1"%(self.line)])
+        lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/functionalities/memory/read/TestMemoryRead.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/memory/read/TestMemoryRead.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/memory/read/TestMemoryRead.py (original)
+++ lldb/branches/windows/test/functionalities/memory/read/TestMemoryRead.py Fri Sep 28 06:07:34 2012
@@ -7,6 +7,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class MemoryReadTestCase(TestBase):
 
@@ -37,10 +38,7 @@
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Break in main() aftre the variables are assigned values.
-        self.expect("breakpoint set -f main.cpp -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.cpp', line = %d, locations = 1" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py (original)
+++ lldb/branches/windows/test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py Fri Sep 28 06:07:34 2012
@@ -4,6 +4,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class NonOverlappingIndexVariableCase(TestBase):
 
@@ -26,10 +27,7 @@
         exe = os.path.join(os.getcwd(), exe_name)
         self.runCmd("file %s" % exe, CURRENT_EXECUTABLE_SET)
 
-        self.expect('breakpoint set -f %s -l %d' % (self.source, self.line_to_break),
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
-                        (self.source, self.line_to_break))
+        lldbutil.run_break_set_by_file_and_line (self, self.source, self.line_to_break, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

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=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/register/TestRegisters.py (original)
+++ lldb/branches/windows/test/functionalities/register/TestRegisters.py Fri Sep 28 06:07:34 2012
@@ -7,6 +7,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class RegisterCommandsTestCase(TestBase):
 
@@ -39,9 +40,7 @@
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Break in main().
-        self.expect("breakpoint set -n main",
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: name = 'main'")
+        lldbutil.run_break_set_by_symbol (self, "main", num_expected_locations=-1)
 
         self.runCmd("run", RUN_SUCCEEDED)
 
@@ -68,9 +67,7 @@
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Break in main().
-        self.expect("breakpoint set -n main",
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: name = 'main'")
+        lldbutil.run_break_set_by_symbol (self, "main", num_expected_locations=-1)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/functionalities/signal/TestSendSignal.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/signal/TestSendSignal.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/signal/TestSendSignal.py (original)
+++ lldb/branches/windows/test/functionalities/signal/TestSendSignal.py Fri Sep 28 06:07:34 2012
@@ -4,6 +4,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class SendSignalTestCase(TestBase):
 
@@ -35,10 +36,7 @@
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Break inside the main() function and immediately send a signal to the inferior after resuming.
-        self.expect("breakpoint set -f main.c -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.c', line = %d, locations = 1" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
         self.runCmd("thread backtrace")

Modified: lldb/branches/windows/test/functionalities/single-quote-in-filename-to-lldb/TestSingleQuoteInFilename.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/single-quote-in-filename-to-lldb/TestSingleQuoteInFilename.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/single-quote-in-filename-to-lldb/TestSingleQuoteInFilename.py (original)
+++ lldb/branches/windows/test/functionalities/single-quote-in-filename-to-lldb/TestSingleQuoteInFilename.py Fri Sep 28 06:07:34 2012
@@ -16,9 +16,12 @@
     @classmethod
     def classCleanup(cls):
         """Cleanup the test byproducts."""
-        os.remove("child_send.txt")
-        os.remove("child_read.txt")
-        os.remove(cls.myexe)
+        try:
+            os.remove("child_send.txt")
+            os.remove("child_read.txt")
+            os.remove(cls.myexe)
+        except:
+            pass
 
     def test_lldb_invocation_with_single_quote_in_filename(self):
         """Test that 'lldb my_file_name' works where my_file_name is a string with a single quote char in it."""

Modified: lldb/branches/windows/test/functionalities/stop-hook/TestStopHookCmd.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/stop-hook/TestStopHookCmd.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/stop-hook/TestStopHookCmd.py (original)
+++ lldb/branches/windows/test/functionalities/stop-hook/TestStopHookCmd.py Fri Sep 28 06:07:34 2012
@@ -7,6 +7,7 @@
 import StringIO
 import lldb
 from lldbtest import *
+import lldbutil
 
 class StopHookCmdTestCase(TestBase):
 
@@ -43,14 +44,9 @@
         exe = os.path.join(os.getcwd(), "a.out")
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
-        self.expect('breakpoint set -f main.cpp -l %d' % self.begl,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.cpp', line = %d" %
-                        self.begl)
-        self.expect('breakpoint set -f main.cpp -l %d' % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 2: file ='main.cpp', line = %d" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.begl, num_expected_locations=1, loc_exact=True)
+
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("target stop-hook add -f main.cpp -l %d -e %d -o 'expr ptr'" % (self.begl, self.endl))
 

Modified: lldb/branches/windows/test/functionalities/target_command/TestTargetCommand.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/target_command/TestTargetCommand.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/target_command/TestTargetCommand.py (original)
+++ lldb/branches/windows/test/functionalities/target_command/TestTargetCommand.py Fri Sep 28 06:07:34 2012
@@ -6,6 +6,7 @@
 import lldb
 import sys
 from lldbtest import *
+import lldbutil
 
 class targetCommandTestCase(TestBase):
 
@@ -84,13 +85,11 @@
         self.runCmd("run", RUN_SUCCEEDED)
 
         self.runCmd("target create " + exe_b, CURRENT_EXECUTABLE_SET)
-        self.runCmd("breakpoint set -f %s -l %d" % ('b.c', self.line_b),
-                    BREAKPOINT_CREATED)
+        lldbutil.run_break_set_by_file_and_line (self, 'b.c', self.line_b, num_expected_locations=1, loc_exact=True)
         self.runCmd("run", RUN_SUCCEEDED)
 
         self.runCmd("target create " + exe_c, CURRENT_EXECUTABLE_SET)
-        self.runCmd("breakpoint set -f %s -l %d" % ('c.c', self.line_c),
-                    BREAKPOINT_CREATED)
+        lldbutil.run_break_set_by_file_and_line (self, 'c.c', self.line_c, num_expected_locations=1, loc_exact=True)
         self.runCmd("run", RUN_SUCCEEDED)
 
         self.runCmd("target list")

Modified: lldb/branches/windows/test/functionalities/type_completion/TestTypeCompletion.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/type_completion/TestTypeCompletion.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/type_completion/TestTypeCompletion.py (original)
+++ lldb/branches/windows/test/functionalities/type_completion/TestTypeCompletion.py Fri Sep 28 06:07:34 2012
@@ -6,6 +6,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class TypeCompletionTestCase(TestBase):
 
@@ -34,10 +35,7 @@
         """Check that types only get completed when necessary."""
         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
 
-        self.expect("breakpoint set -f main.cpp -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.cpp', line = %d" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=-1)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py (original)
+++ lldb/branches/windows/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py Fri Sep 28 06:07:34 2012
@@ -7,6 +7,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class HelloWatchLocationTestCase(TestBase):
 
@@ -46,9 +47,7 @@
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Add a breakpoint to set a watchpoint when stopped on the breakpoint.
-        self.expect("breakpoint set -l %d" % self.line, BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
-                       (self.source, self.line))
+        lldbutil.run_break_set_by_file_and_line (self, None, self.line, num_expected_locations=1, loc_exact=False)
 
         # Run the program.
         self.runCmd("run", RUN_SUCCEEDED)

Modified: lldb/branches/windows/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py (original)
+++ lldb/branches/windows/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py Fri Sep 28 06:07:34 2012
@@ -6,6 +6,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class HelloWatchpointTestCase(TestBase):
 
@@ -44,9 +45,7 @@
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Add a breakpoint to set a watchpoint when stopped on the breakpoint.
-        self.expect("breakpoint set -l %d" % self.line, BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
-                       (self.source, self.line))
+        lldbutil.run_break_set_by_file_and_line (self, None, self.line, num_expected_locations=1)
 
         # Run the program.
         self.runCmd("run", RUN_SUCCEEDED)

Modified: lldb/branches/windows/test/functionalities/watchpoint/multiple_threads/TestWatchpointMultipleThreads.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/watchpoint/multiple_threads/TestWatchpointMultipleThreads.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/watchpoint/multiple_threads/TestWatchpointMultipleThreads.py (original)
+++ lldb/branches/windows/test/functionalities/watchpoint/multiple_threads/TestWatchpointMultipleThreads.py Fri Sep 28 06:07:34 2012
@@ -7,6 +7,7 @@
 import re
 import lldb
 from lldbtest import *
+import lldbutil
 
 class WatchpointForMultipleThreadsTestCase(TestBase):
 
@@ -60,14 +61,10 @@
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Add a breakpoint to set a watchpoint when stopped on the breakpoint.
-        self.expect("breakpoint set -l %d" % self.first_stop, BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
-                       (self.source, self.first_stop))
+        lldbutil.run_break_set_by_file_and_line (self, None, self.first_stop, num_expected_locations=1)
 
         # Set this breakpoint to allow newly created thread to inherit the global watchpoint state.
-        self.expect("breakpoint set -l %d" % self.thread_function, BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 2: file ='%s', line = %d, locations = 1" %
-                       (self.source, self.thread_function))
+        lldbutil.run_break_set_by_file_and_line (self, None, self.thread_function, num_expected_locations=1)
 
         # Run the program.
         self.runCmd("run", RUN_SUCCEEDED)
@@ -119,14 +116,10 @@
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Add a breakpoint to set a watchpoint when stopped on the breakpoint.
-        self.expect("breakpoint set -l %d" % self.first_stop, BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
-                       (self.source, self.first_stop))
+        lldbutil.run_break_set_by_file_and_line (self, None, self.first_stop, num_expected_locations=1)
 
         # Set this breakpoint to allow newly created thread to inherit the global watchpoint state.
-        self.expect("breakpoint set -l %d" % self.thread_function, BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 2: file ='%s', line = %d, locations = 1" %
-                       (self.source, self.thread_function))
+        lldbutil.run_break_set_by_file_and_line (self, None, self.thread_function, num_expected_locations=1)
 
         # Run the program.
         self.runCmd("run", RUN_SUCCEEDED)

Modified: lldb/branches/windows/test/functionalities/watchpoint/variable_out_of_scope/TestWatchedVarHitWhenInScope.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/watchpoint/variable_out_of_scope/TestWatchedVarHitWhenInScope.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/watchpoint/variable_out_of_scope/TestWatchedVarHitWhenInScope.py (original)
+++ lldb/branches/windows/test/functionalities/watchpoint/variable_out_of_scope/TestWatchedVarHitWhenInScope.py Fri Sep 28 06:07:34 2012
@@ -6,6 +6,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class WatchedVariableHitWhenInScopeTestCase(TestBase):
 
@@ -39,8 +40,7 @@
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Add a breakpoint to set a watchpoint when stopped in main.
-        self.expect("breakpoint set -n main", BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: name = 'main'")
+        lldbutil.run_break_set_by_symbol (self, "main", num_expected_locations=-1)
 
         # Run the program.
         self.runCmd("run", RUN_SUCCEEDED)

Modified: lldb/branches/windows/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py (original)
+++ lldb/branches/windows/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py Fri Sep 28 06:07:34 2012
@@ -6,6 +6,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class WatchpointCommandsTestCase(TestBase):
 
@@ -106,9 +107,7 @@
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Add a breakpoint to set a watchpoint when stopped on the breakpoint.
-        self.expect("breakpoint set -l %d" % self.line, BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
-                       (self.source, self.line))
+        lldbutil.run_break_set_by_file_and_line (self, None, self.line, num_expected_locations=1)
 
         # Run the program.
         self.runCmd("run", RUN_SUCCEEDED)
@@ -163,9 +162,7 @@
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Add a breakpoint to set a watchpoint when stopped on the breakpoint.
-        self.expect("breakpoint set -l %d" % self.line, BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
-                       (self.source, self.line))
+        lldbutil.run_break_set_by_file_and_line (self, None, self.line, num_expected_locations=1)
 
         # Run the program.
         self.runCmd("run", RUN_SUCCEEDED)
@@ -205,9 +202,7 @@
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Add a breakpoint to set a watchpoint when stopped on the breakpoint.
-        self.expect("breakpoint set -l %d" % self.line, BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
-                       (self.source, self.line))
+        lldbutil.run_break_set_by_file_and_line (self, None, self.line, num_expected_locations=1)
 
         # Run the program.
         self.runCmd("run", RUN_SUCCEEDED)
@@ -251,9 +246,146 @@
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Add a breakpoint to set a watchpoint when stopped on the breakpoint.
-        self.expect("breakpoint set -l %d" % self.line, BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
-                       (self.source, self.line))
+        lldbutil.run_break_set_by_file_and_line (self, "main.m")
+
+        # Run the program.
+        self.runCmd("run", RUN_SUCCEEDED)
+
+        # We should be stopped again due to the breakpoint.
+        # The stop reason of the thread should be breakpoint.
+        self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
+            substrs = ['stopped',
+                       'stop reason = breakpoint'])
+
+        # Now let's set a read_write-type watchpoint for 'global'.
+        # There should be two watchpoint hits (see main.c).
+        self.expect("watchpoint set variable -w read_write global", WATCHPOINT_CREATED,
+            substrs = ['Watchpoint created', 'size = 4', 'type = rw',
+                       '%s:%d' % (self.source, self.decl)])
+
+        # Use the '-v' option to do verbose listing of the watchpoint.
+        # The hit count should be 0 initially.
+        self.expect("watchpoint list -v",
+            substrs = ['Number of supported hardware watchpoints:',
+                       'hit_count = 0'])
+
+        self.runCmd("process continue")
+
+        # We should be stopped again due to the watchpoint (read_write type).
+        # The stop reason of the thread should be watchpoint.
+        self.expect("thread backtrace", STOPPED_DUE_TO_WATCHPOINT,
+            substrs = ['stop reason = watchpoint'])
+
+        self.runCmd("process continue")
+
+        # We should be stopped again due to the watchpoint (read_write type).
+        # The stop reason of the thread should be watchpoint.
+        self.expect("thread backtrace", STOPPED_DUE_TO_WATCHPOINT,
+            substrs = ['stop reason = watchpoint'])
+
+        self.runCmd("process continue")
+
+        # There should be no more watchpoint hit and the process status should
+        # be 'exited'.
+        self.expect("process status",
+            substrs = ['exited'])
+
+        # Use the '-v' option to do verbose listing of the watchpoint.
+        # The hit count should now be 2.
+        self.expect("watchpoint list -v",
+            substrs = ['hit_count = 2'])
+
+    def delete_read_write_watchpoint(self):
+        """Do delete watchpoint immediately and expect not to stop for watchpoint."""
+        exe = os.path.join(os.getcwd(), self.exe_name)
+        self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+
+        # Add a breakpoint to set a watchpoint when stopped on the breakpoint.
+        lldbutil.run_break_set_by_file_and_line (self, None, self.line, num_expected_locations=1)
+
+        # Run the program.
+        self.runCmd("run", RUN_SUCCEEDED)
+
+        # We should be stopped again due to the breakpoint.
+        # The stop reason of the thread should be breakpoint.
+        self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
+            substrs = ['stopped',
+                       'stop reason = breakpoint'])
+
+        # Now let's set a read_write-type watchpoint for 'global'.
+        # There should be two watchpoint hits (see main.c).
+        self.expect("watchpoint set variable -w read_write global", WATCHPOINT_CREATED,
+            substrs = ['Watchpoint created', 'size = 4', 'type = rw',
+                       '%s:%d' % (self.source, self.decl)])
+
+        # Delete the watchpoint immediately, but set auto-confirm to true first.
+        self.runCmd("settings set auto-confirm true")
+        self.expect("watchpoint delete",
+            substrs = ['All watchpoints removed.'])
+        # Restore the original setting of auto-confirm.
+        self.runCmd("settings clear auto-confirm")
+
+        # Use the '-v' option to do verbose listing of the watchpoint.
+        self.runCmd("watchpoint list -v")
+
+        self.runCmd("process continue")
+
+        # There should be no more watchpoint hit and the process status should
+        # be 'exited'.
+        self.expect("process status",
+            substrs = ['exited'])
+
+    def ignore_read_write_watchpoint(self):
+        """Test watchpoint ignore count and expect to not to stop at all."""
+        exe = os.path.join(os.getcwd(), self.exe_name)
+        self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+
+        # Add a breakpoint to set a watchpoint when stopped on the breakpoint.
+        lldbutil.run_break_set_by_file_and_line (self, None, self.line, num_expected_locations=1)
+
+        # Run the program.
+        self.runCmd("run", RUN_SUCCEEDED)
+
+        # We should be stopped again due to the breakpoint.
+        # The stop reason of the thread should be breakpoint.
+        self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
+            substrs = ['stopped',
+                       'stop reason = breakpoint'])
+
+        # Now let's set a read_write-type watchpoint for 'global'.
+        # There should be two watchpoint hits (see main.c).
+        self.expect("watchpoint set variable -w read_write global", WATCHPOINT_CREATED,
+            substrs = ['Watchpoint created', 'size = 4', 'type = rw',
+                       '%s:%d' % (self.source, self.decl)])
+
+        # Set the ignore count of the watchpoint immediately.
+        self.expect("watchpoint ignore -i 2",
+            substrs = ['All watchpoints ignored.'])
+
+        # Use the '-v' option to do verbose listing of the watchpoint.
+        # Expect to find an ignore_count of 2.
+        self.expect("watchpoint list -v",
+            substrs = ['hit_count = 0', 'ignore_count = 2'])
+
+        self.runCmd("process continue")
+
+        # There should be no more watchpoint hit and the process status should
+        # be 'exited'.
+        self.expect("process status",
+            substrs = ['exited'])
+
+        # Use the '-v' option to do verbose listing of the watchpoint.
+        # Expect to find a hit_count of 2 as well.
+        self.expect("watchpoint list -v",
+            substrs = ['hit_count = 2', 'ignore_count = 2'])
+
+    def read_write_watchpoint_disable_after_first_stop(self):
+        """Do read_write watchpoint but disable it after the first stop."""
+        exe = os.path.join(os.getcwd(), self.exe_name)
+        self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+
+        # Add a breakpoint to set a watchpoint when stopped on the breakpoint.
+        lldbutil.run_break_set_by_file_and_line (self, None, self.line, num_expected_locations=1)
 
         # Run the program.
         self.runCmd("run", RUN_SUCCEEDED)
@@ -307,12 +439,8 @@
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Add a breakpoint to set a watchpoint when stopped on the breakpoint.
-        self.expect("breakpoint set -l %d" % self.line, BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
-                       (self.source, self.line))
-        self.expect("breakpoint set -l %d" % self.line2, BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 2: file ='%s', line = %d, locations = 1" %
-                       (self.source, self.line2))
+        lldbutil.run_break_set_by_file_and_line (self, None, self.line, num_expected_locations=1)
+        lldbutil.run_break_set_by_file_and_line (self, None, self.line2, num_expected_locations=1)
 
         # Run the program.
         self.runCmd("run", RUN_SUCCEEDED)

Modified: lldb/branches/windows/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandLLDB.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandLLDB.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandLLDB.py (original)
+++ lldb/branches/windows/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandLLDB.py Fri Sep 28 06:07:34 2012
@@ -6,6 +6,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class WatchpointLLDBCommandTestCase(TestBase):
 
@@ -60,9 +61,7 @@
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Add a breakpoint to set a watchpoint when stopped on the breakpoint.
-        self.expect("breakpoint set -l %d" % self.line, BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
-                       (self.source, self.line))
+        lldbutil.run_break_set_by_file_and_line (self, None, self.line, num_expected_locations=1)
 
         # Run the program.
         self.runCmd("run", RUN_SUCCEEDED)
@@ -111,9 +110,7 @@
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Add a breakpoint to set a watchpoint when stopped on the breakpoint.
-        self.expect("breakpoint set -l %d" % self.line, BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
-                       (self.source, self.line))
+        lldbutil.run_break_set_by_file_and_line (self, None, self.line, num_expected_locations=1)
 
         # Run the program.
         self.runCmd("run", RUN_SUCCEEDED)

Modified: lldb/branches/windows/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py (original)
+++ lldb/branches/windows/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py Fri Sep 28 06:07:34 2012
@@ -6,6 +6,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class WatchpointPythonCommandTestCase(TestBase):
 
@@ -45,9 +46,10 @@
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Add a breakpoint to set a watchpoint when stopped on the breakpoint.
-        self.expect("breakpoint set -l %d" % self.line, BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
-                       (self.source, self.line))
+        lldbutil.run_break_set_by_file_and_line (self, None, self.line, num_expected_locations=1)
+#        self.expect("breakpoint set -l %d" % self.line, BREAKPOINT_CREATED,
+#            startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
+#                       (self.source, self.line))#
 
         # Run the program.
         self.runCmd("run", RUN_SUCCEEDED)

Modified: lldb/branches/windows/test/functionalities/watchpoint/watchpoint_commands/condition/TestWatchpointConditionCmd.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/watchpoint/watchpoint_commands/condition/TestWatchpointConditionCmd.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/watchpoint/watchpoint_commands/condition/TestWatchpointConditionCmd.py (original)
+++ lldb/branches/windows/test/functionalities/watchpoint/watchpoint_commands/condition/TestWatchpointConditionCmd.py Fri Sep 28 06:07:34 2012
@@ -6,6 +6,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class WatchpointConditionCmdTestCase(TestBase):
 
@@ -45,9 +46,7 @@
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Add a breakpoint to set a watchpoint when stopped on the breakpoint.
-        self.expect("breakpoint set -l %d" % self.line, BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
-                       (self.source, self.line))
+        lldbutil.run_break_set_by_file_and_line (self, None, self.line, num_expected_locations=1)
 
         # Run the program.
         self.runCmd("run", RUN_SUCCEEDED)

Modified: lldb/branches/windows/test/functionalities/watchpoint/watchpoint_set_command/TestWatchLocationWithWatchSet.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/watchpoint/watchpoint_set_command/TestWatchLocationWithWatchSet.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/watchpoint/watchpoint_set_command/TestWatchLocationWithWatchSet.py (original)
+++ lldb/branches/windows/test/functionalities/watchpoint/watchpoint_set_command/TestWatchLocationWithWatchSet.py Fri Sep 28 06:07:34 2012
@@ -6,6 +6,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class WatchLocationUsingWatchpointSetTestCase(TestBase):
 
@@ -45,9 +46,7 @@
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Add a breakpoint to set a watchpoint when stopped on the breakpoint.
-        self.expect("breakpoint set -l %d" % self.line, BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
-                       (self.source, self.line))
+        lldbutil.run_break_set_by_file_and_line (self, None, self.line, num_expected_locations=1)
 
         # Run the program.
         self.runCmd("run", RUN_SUCCEEDED)

Modified: lldb/branches/windows/test/functionalities/watchpoint/watchpoint_set_command/TestWatchpointSetErrorCases.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/watchpoint/watchpoint_set_command/TestWatchpointSetErrorCases.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/watchpoint/watchpoint_set_command/TestWatchpointSetErrorCases.py (original)
+++ lldb/branches/windows/test/functionalities/watchpoint/watchpoint_set_command/TestWatchpointSetErrorCases.py Fri Sep 28 06:07:34 2012
@@ -6,6 +6,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class WatchpointSetErrorTestCase(TestBase):
 
@@ -34,9 +35,7 @@
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Add a breakpoint to set a watchpoint when stopped on the breakpoint.
-        self.expect("breakpoint set -l %d" % self.line, BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
-                       (self.source, self.line))
+        lldbutil.run_break_set_by_file_and_line (self, None, self.line, num_expected_locations=1)
 
         # Run the program.
         self.runCmd("run", RUN_SUCCEEDED)

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=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/c/anonymous/TestAnonymous.py (original)
+++ lldb/branches/windows/test/lang/c/anonymous/TestAnonymous.py Fri Sep 28 06:07:34 2012
@@ -4,6 +4,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class AnonymousTestCase(TestBase):
 
@@ -30,8 +31,7 @@
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Break inside the foo function which takes a bar_ptr argument.
-        self.expect("breakpoint set -f main.c -l %d" % self.line, BREAKPOINT_CREATED,
-            startstr = "Breakpoint created")
+        lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/lang/c/array_types/TestArrayTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/c/array_types/TestArrayTypes.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/c/array_types/TestArrayTypes.py (original)
+++ lldb/branches/windows/test/lang/c/array_types/TestArrayTypes.py Fri Sep 28 06:07:34 2012
@@ -4,6 +4,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class ArrayTypesTestCase(TestBase):
 
@@ -48,10 +49,7 @@
         exe = os.path.join(os.getcwd(), "a.out")
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
-        self.expect("breakpoint set -f main.c -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.c', line = %d, locations = 1" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=False)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/lang/c/bitfields/TestBitfields.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/c/bitfields/TestBitfields.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/c/bitfields/TestBitfields.py (original)
+++ lldb/branches/windows/test/lang/c/bitfields/TestBitfields.py Fri Sep 28 06:07:34 2012
@@ -4,6 +4,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class BitfieldsTestCase(TestBase):
 
@@ -49,10 +50,7 @@
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Break inside the main.
-        self.expect("breakpoint set -f main.c -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.c', line = %d, locations = 1" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/lang/c/blocks/TestBlocks.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/c/blocks/TestBlocks.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/c/blocks/TestBlocks.py (original)
+++ lldb/branches/windows/test/lang/c/blocks/TestBlocks.py Fri Sep 28 06:07:34 2012
@@ -4,6 +4,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class AnonymousTestCase(TestBase):
 
@@ -37,8 +38,7 @@
 
         # Break inside the foo function which takes a bar_ptr argument.
 	for line in self.lines:
-            self.expect("breakpoint set -f main.c -l %d" % line, BREAKPOINT_CREATED,
-                startstr = "Breakpoint created")
+            lldbutil.run_break_set_by_file_and_line (self, "main.c", line, num_expected_locations=1, loc_exact=True)
 
     def wait_for_breakpoint(self):
         if self.is_started == False:

Modified: lldb/branches/windows/test/lang/c/enum_types/TestEnumTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/c/enum_types/TestEnumTypes.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/c/enum_types/TestEnumTypes.py (original)
+++ lldb/branches/windows/test/lang/c/enum_types/TestEnumTypes.py Fri Sep 28 06:07:34 2012
@@ -4,6 +4,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class EnumTypesTestCase(TestBase):
 
@@ -36,10 +37,7 @@
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Break inside the main.
-        self.expect("breakpoint set -f main.c -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.c', line = %d, locations = 1" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/lang/c/forward/TestForwardDeclaration.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/c/forward/TestForwardDeclaration.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/c/forward/TestForwardDeclaration.py (original)
+++ lldb/branches/windows/test/lang/c/forward/TestForwardDeclaration.py Fri Sep 28 06:07:34 2012
@@ -4,6 +4,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class ForwardDeclarationTestCase(TestBase):
 
@@ -32,8 +33,7 @@
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Break inside the foo function which takes a bar_ptr argument.
-        self.expect("breakpoint set -n foo", BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: name = 'foo', locations = 1")
+        lldbutil.run_break_set_by_symbol (self, "foo", num_expected_locations=1, sym_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/lang/c/function_types/TestFunctionTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/c/function_types/TestFunctionTypes.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/c/function_types/TestFunctionTypes.py (original)
+++ lldb/branches/windows/test/lang/c/function_types/TestFunctionTypes.py Fri Sep 28 06:07:34 2012
@@ -4,6 +4,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class FunctionTypesTestCase(TestBase):
 
@@ -46,10 +47,7 @@
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
         
         # Break inside the main.
-        self.expect("breakpoint set -f main.c -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-                    startstr = "Breakpoint created: 1: file ='main.c', line = %d, locations = 1" %
-                    self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
         
         self.runCmd("run", RUN_SUCCEEDED)
         
@@ -72,7 +70,7 @@
             startstr = '(int (*)(const char *)) callback =')
 
         # And that we can break on the callback function.
-        self.runCmd("breakpoint set -n string_not_empty", BREAKPOINT_CREATED)
+        lldbutil.run_break_set_by_symbol (self, "string_not_empty", num_expected_locations=1, sym_exact=True)
         self.runCmd("continue")
 
         # Check that we do indeed stop on the string_not_empty function.

Modified: lldb/branches/windows/test/lang/c/global_variables/TestGlobalVariables.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/c/global_variables/TestGlobalVariables.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/c/global_variables/TestGlobalVariables.py (original)
+++ lldb/branches/windows/test/lang/c/global_variables/TestGlobalVariables.py Fri Sep 28 06:07:34 2012
@@ -4,6 +4,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class GlobalVariablesTestCase(TestBase):
 
@@ -34,10 +35,7 @@
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Break inside the main.
-        self.expect("breakpoint set -f main.c -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.c', line = %d, locations = 1" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/lang/c/set_values/TestSetValues.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/c/set_values/TestSetValues.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/c/set_values/TestSetValues.py (original)
+++ lldb/branches/windows/test/lang/c/set_values/TestSetValues.py Fri Sep 28 06:07:34 2012
@@ -4,6 +4,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class SetValuesTestCase(TestBase):
 
@@ -38,30 +39,15 @@
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Set breakpoints on several places to set program variables.
-        self.expect("breakpoint set -f main.c -l %d" % self.line1,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.c', line = %d, locations = 1" %
-                        self.line1)
-
-        self.expect("breakpoint set -f main.c -l %d" % self.line2,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 2: file ='main.c', line = %d, locations = 1" %
-                        self.line2)
-
-        self.expect("breakpoint set -f main.c -l %d" % self.line3,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 3: file ='main.c', line = %d, locations = 1" %
-                        self.line3)
-
-        self.expect("breakpoint set -f main.c -l %d" % self.line4,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 4: file ='main.c', line = %d, locations = 1" %
-                        self.line4)
-
-        self.expect("breakpoint set -f main.c -l %d" % self.line5,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 5: file ='main.c', line = %d, locations = 1" %
-                        self.line5)
+        lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line1, num_expected_locations=1, loc_exact=True)
+
+        lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line2, num_expected_locations=1, loc_exact=True)
+
+        lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line3, num_expected_locations=1, loc_exact=True)
+
+        lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line4, num_expected_locations=1, loc_exact=True)
+
+        lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line5, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/lang/c/shared_lib/TestSharedLib.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/c/shared_lib/TestSharedLib.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/c/shared_lib/TestSharedLib.py (original)
+++ lldb/branches/windows/test/lang/c/shared_lib/TestSharedLib.py Fri Sep 28 06:07:34 2012
@@ -4,6 +4,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class SharedLibTestCase(TestBase):
 
@@ -44,8 +45,7 @@
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Break inside the foo function which takes a bar_ptr argument.
-        self.expect("breakpoint set -f main.c -l %d" % self.line, BREAKPOINT_CREATED,
-            startstr = "Breakpoint created")
+        lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/lang/c/shared_lib/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/c/shared_lib/main.c?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/c/shared_lib/main.c (original)
+++ lldb/branches/windows/test/lang/c/shared_lib/main.c Fri Sep 28 06:07:34 2012
@@ -6,8 +6,8 @@
 {
   struct foo *my_foo_ptr;
   my_foo_ptr = GetMeAFoo();
-  // Set breakpoint 0 here.
-  printf ("My sub foo has: %d.\n", GetMeASubFoo(my_foo_ptr)->sub_1);
+  
+  printf ("My sub foo has: %d.\n", GetMeASubFoo(my_foo_ptr)->sub_1); // Set breakpoint 0 here.
 
   return 0;
 }

Modified: lldb/branches/windows/test/lang/c/stepping/TestThreadStepping.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/c/stepping/TestThreadStepping.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/c/stepping/TestThreadStepping.py (original)
+++ lldb/branches/windows/test/lang/c/stepping/TestThreadStepping.py Fri Sep 28 06:07:34 2012
@@ -7,6 +7,7 @@
 import unittest2
 import lldb, lldbutil
 from lldbtest import *
+import lldbutil
 
 class ThreadSteppingTestCase(TestBase):
 
@@ -40,9 +41,7 @@
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Create a breakpoint inside function 'c'.
-        self.expect("breakpoint set -f main.c -l %d" % self.line1, BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.c', line = %d, locations = 1" %
-                        self.line1)
+        lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line1, num_expected_locations=1, loc_exact=True)
 
         # Now run the program.
         self.runCmd("run", RUN_SUCCEEDED)

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=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/c/strings/TestCStrings.py (original)
+++ lldb/branches/windows/test/lang/c/strings/TestCStrings.py Fri Sep 28 06:07:34 2012
@@ -1,8 +1,9 @@
 """
 Tests that C strings work as expected in expressions
 """
-
+import lldb
 from lldbtest import *
+import lldbutil
 
 class CStringsTestCase(TestBase):
     
@@ -25,9 +26,7 @@
         TestBase.setUp(self)
     
     def set_breakpoint(self, line):
-        self.expect("breakpoint set -f main.c -l %d" % line,
-                    BREAKPOINT_CREATED,
-                    startstr = "Breakpoint created")
+        lldbutil.run_break_set_by_file_and_line (self, "main.c", line, num_expected_locations=1, loc_exact=True)
     
     def static_method_commands(self):
         """Tests that C strings work as expected in expressions"""

Modified: lldb/branches/windows/test/lang/c/struct_types/TestStructTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/c/struct_types/TestStructTypes.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/c/struct_types/TestStructTypes.py (original)
+++ lldb/branches/windows/test/lang/c/struct_types/TestStructTypes.py Fri Sep 28 06:07:34 2012
@@ -8,6 +8,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class StructTypesTestCase(TestBase):
 
@@ -40,10 +41,7 @@
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Break on the struct declration statement in main.c.
-        self.expect("breakpoint set -f main.c -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.c', line = %d, locations = 1" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=False)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/lang/cpp/class_static/TestStaticVariables.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/cpp/class_static/TestStaticVariables.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/cpp/class_static/TestStaticVariables.py (original)
+++ lldb/branches/windows/test/lang/cpp/class_static/TestStaticVariables.py Fri Sep 28 06:07:34 2012
@@ -6,6 +6,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class StaticVariableTestCase(TestBase):
 
@@ -53,10 +54,7 @@
         """Test that that file and class static variables display correctly."""
         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
 
-        self.expect("breakpoint set -f main.cpp -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.cpp', line = %d, locations = 1" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/lang/cpp/class_types/TestClassTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/cpp/class_types/TestClassTypes.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/cpp/class_types/TestClassTypes.py (original)
+++ lldb/branches/windows/test/lang/cpp/class_types/TestClassTypes.py Fri Sep 28 06:07:34 2012
@@ -5,6 +5,7 @@
 import lldb
 import lldbutil
 from lldbtest import *
+import lldbutil
 
 class ClassTypesTestCase(TestBase):
 
@@ -70,10 +71,7 @@
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Break on the ctor function of class C.
-        self.expect("breakpoint set -f main.cpp -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.cpp', line = %d" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=-1)
 
         self.runCmd("run", RUN_SUCCEEDED)
 
@@ -169,8 +167,7 @@
         #    startstr = "Breakpoint created: 1: name = 'C'")
 
         # Make the test case more robust by using line number to break, instead.
-        self.expect("breakpoint set -l %d" % self.line, BREAKPOINT_CREATED,
-            startstr = "Breakpoint created")
+        lldbutil.run_break_set_by_file_and_line (self, None, self.line, num_expected_locations=-1)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/lang/cpp/class_types/TestClassTypesDisassembly.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/cpp/class_types/TestClassTypesDisassembly.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/cpp/class_types/TestClassTypesDisassembly.py (original)
+++ lldb/branches/windows/test/lang/cpp/class_types/TestClassTypesDisassembly.py Fri Sep 28 06:07:34 2012
@@ -6,6 +6,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class IterateFrameAndDisassembleTestCase(TestBase):
 
@@ -51,10 +52,7 @@
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Break on the ctor function of class C.
-        self.expect("breakpoint set -f main.cpp -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.cpp', line = %d" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=-1)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/lang/cpp/namespace/TestNamespace.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/cpp/namespace/TestNamespace.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/cpp/namespace/TestNamespace.py (original)
+++ lldb/branches/windows/test/lang/cpp/namespace/TestNamespace.py Fri Sep 28 06:07:34 2012
@@ -6,6 +6,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class NamespaceTestCase(TestBase):
 
@@ -42,10 +43,7 @@
         """Test that anonymous and named namespace variables display correctly."""
         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
 
-        self.expect("breakpoint set -f main.cpp -l %d" % self.line_break,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.cpp', line = %d, locations = 1" %
-                        self.line_break)
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line_break, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/lang/cpp/rvalue-references/TestRvalueReferences.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/cpp/rvalue-references/TestRvalueReferences.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/cpp/rvalue-references/TestRvalueReferences.py (original)
+++ lldb/branches/windows/test/lang/cpp/rvalue-references/TestRvalueReferences.py Fri Sep 28 06:07:34 2012
@@ -2,7 +2,9 @@
 Tests that rvalue references are supported in C++
 """
 
+import lldb
 from lldbtest import *
+import lldbutil
 
 class CPPThisTestCase(TestBase):
     
@@ -29,10 +31,8 @@
         TestBase.setUp(self)
     
     def set_breakpoint(self, line):
-        self.expect("breakpoint set -f main.cpp -l %d" % line,
-                    BREAKPOINT_CREATED,
-                    startstr = "Breakpoint created")
-    
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", line, num_expected_locations=1, loc_exact=True)
+
     def static_method_commands(self):
         """Test that rvalues are supported in the C++ expression parser"""
         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)

Modified: lldb/branches/windows/test/lang/cpp/signed_types/TestSignedTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/cpp/signed_types/TestSignedTypes.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/cpp/signed_types/TestSignedTypes.py (original)
+++ lldb/branches/windows/test/lang/cpp/signed_types/TestSignedTypes.py Fri Sep 28 06:07:34 2012
@@ -7,6 +7,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class UnsignedTypesTestCase(TestBase):
 
@@ -37,10 +38,7 @@
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Break on line 22 in main() aftre the variables are assigned values.
-        self.expect("breakpoint set -f main.cpp -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.cpp', line = %d, locations = 1" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/lang/cpp/static_methods/TestCPPStaticMethods.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/cpp/static_methods/TestCPPStaticMethods.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/cpp/static_methods/TestCPPStaticMethods.py (original)
+++ lldb/branches/windows/test/lang/cpp/static_methods/TestCPPStaticMethods.py Fri Sep 28 06:07:34 2012
@@ -2,7 +2,9 @@
 Tests expressions that distinguish between static and non-static methods.
 """
 
+import lldb
 from lldbtest import *
+import lldbutil
 
 class CPPStaticMethodsTestCase(TestBase):
     
@@ -29,9 +31,7 @@
         """Test that static methods are properly distinguished from regular methods"""
         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
 
-        self.expect("breakpoint set -f main.cpp -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-                    startstr = "Breakpoint created: 1: file ='main.cpp', line = %d, locations = 1" % self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("process launch", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/lang/cpp/stl/TestSTL.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/cpp/stl/TestSTL.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/cpp/stl/TestSTL.py (original)
+++ lldb/branches/windows/test/lang/cpp/stl/TestSTL.py Fri Sep 28 06:07:34 2012
@@ -63,10 +63,7 @@
         # rdar://problem/8543077
         # test/stl: clang built binaries results in the breakpoint locations = 3,
         # is this a problem with clang generated debug info?
-        self.expect("breakpoint set -f %s -l %d" % (self.source, self.line),
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.cpp', line = %d" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/lang/cpp/stl/TestStdCXXDisassembly.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/cpp/stl/TestStdCXXDisassembly.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/cpp/stl/TestStdCXXDisassembly.py (original)
+++ lldb/branches/windows/test/lang/cpp/stl/TestStdCXXDisassembly.py Fri Sep 28 06:07:34 2012
@@ -6,6 +6,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class StdCXXDisassembleTestCase(TestBase):
 
@@ -31,10 +32,7 @@
         # is this a problem with clang generated debug info?
         #
         # Break on line 13 of main.cpp.
-        self.expect("breakpoint set -f main.cpp -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.cpp', line = %d" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/lang/cpp/this/TestCPPThis.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/cpp/this/TestCPPThis.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/cpp/this/TestCPPThis.py (original)
+++ lldb/branches/windows/test/lang/cpp/this/TestCPPThis.py Fri Sep 28 06:07:34 2012
@@ -1,8 +1,9 @@
 """
 Tests that C++ member and static variables are available where they should be.
 """
-
+import lldb
 from lldbtest import *
+import lldbutil
 
 class CPPThisTestCase(TestBase):
     
@@ -29,10 +30,8 @@
         TestBase.setUp(self)
     
     def set_breakpoint(self, line):
-        self.expect("breakpoint set -f main.cpp -l %d" % line,
-                    BREAKPOINT_CREATED,
-                    startstr = "Breakpoint created")
-    
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", line, num_expected_locations=1, loc_exact=False)
+
     def static_method_commands(self):
         """Test that the appropriate member variables are available when stopped in C++ static, inline, and const methods"""
         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)

Modified: lldb/branches/windows/test/lang/cpp/unique-types/TestUniqueTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/cpp/unique-types/TestUniqueTypes.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/cpp/unique-types/TestUniqueTypes.py (original)
+++ lldb/branches/windows/test/lang/cpp/unique-types/TestUniqueTypes.py Fri Sep 28 06:07:34 2012
@@ -36,10 +36,7 @@
         exe = os.path.join(os.getcwd(), "a.out")
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
-        self.expect("breakpoint set -f main.cpp -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.cpp', line = %d, locations = 1" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/lang/cpp/unsigned_types/TestUnsignedTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/cpp/unsigned_types/TestUnsignedTypes.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/cpp/unsigned_types/TestUnsignedTypes.py (original)
+++ lldb/branches/windows/test/lang/cpp/unsigned_types/TestUnsignedTypes.py Fri Sep 28 06:07:34 2012
@@ -7,6 +7,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class UnsignedTypesTestCase(TestBase):
 
@@ -37,10 +38,7 @@
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Break on line 19 in main() aftre the variables are assigned values.
-        self.expect("breakpoint set -f main.cpp -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.cpp', line = %d, locations = 1" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/lang/cpp/virtual/TestVirtual.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/cpp/virtual/TestVirtual.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/cpp/virtual/TestVirtual.py (original)
+++ lldb/branches/windows/test/lang/cpp/virtual/TestVirtual.py Fri Sep 28 06:07:34 2012
@@ -6,6 +6,7 @@
 import re
 import lldb
 from lldbtest import *
+import lldbutil
 
 def Msg(expr, val):
     return "'expression %s' matches the output (from compiled code): %s" % (expr, val)
@@ -62,7 +63,7 @@
         # Bring the program to the point where we can issue a series of
         # 'expression' command to compare against the golden output.
         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
-        self.runCmd("breakpoint set -f main.cpp -l %d" % self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=False)
         self.runCmd("run", RUN_SUCCEEDED)
 
         # Now iterate through the golden list, comparing against the output from

Modified: lldb/branches/windows/test/lang/objc/forward-decl/TestForwardDecl.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/objc/forward-decl/TestForwardDecl.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/objc/forward-decl/TestForwardDecl.py (original)
+++ lldb/branches/windows/test/lang/objc/forward-decl/TestForwardDecl.py Fri Sep 28 06:07:34 2012
@@ -4,6 +4,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class ForwardDeclTestCase(TestBase):
 
@@ -32,8 +33,7 @@
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Break inside the foo function which takes a bar_ptr argument.
-        self.expect("breakpoint set -f main.m -l %d" % self.line, BREAKPOINT_CREATED,
-            startstr = "Breakpoint created")
+        lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/lang/objc/foundation/TestConstStrings.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/objc/foundation/TestConstStrings.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/objc/foundation/TestConstStrings.py (original)
+++ lldb/branches/windows/test/lang/objc/foundation/TestConstStrings.py Fri Sep 28 06:07:34 2012
@@ -7,6 +7,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
 class ConstStringTestCase(TestBase):
@@ -40,10 +41,7 @@
         exe = os.path.join(os.getcwd(), "a.out")
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
-        self.expect("breakpoint set -f %s -l %d" % (self.main_source, self.line),
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
-                        (self.main_source, self.line))
+        lldbutil.run_break_set_by_file_and_line (self, self.main_source, self.line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
         self.expect("process status", STOPPED_DUE_TO_BREAKPOINT,

Modified: lldb/branches/windows/test/lang/objc/foundation/TestFoundationDisassembly.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/objc/foundation/TestFoundationDisassembly.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/objc/foundation/TestFoundationDisassembly.py (original)
+++ lldb/branches/windows/test/lang/objc/foundation/TestFoundationDisassembly.py Fri Sep 28 06:07:34 2012
@@ -6,6 +6,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
 class FoundationDisassembleTestCase(TestBase):
@@ -72,20 +73,19 @@
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Stop at +[NSString stringWithFormat:].
-        self.expect("_regexp-break +[NSString stringWithFormat:]", BREAKPOINT_CREATED,
-            substrs = ["Breakpoint created: 1: name = '+[NSString stringWithFormat:]', locations = 1"])
+        symbol_name = "+[NSString stringWithFormat:]"
+        break_results = lldbutil.run_break_set_command (self, "_regexp-break %s"%(symbol_name))
+        lldbutil.check_breakpoint_result (self, break_results, symbol_name=symbol_name, num_locations=1)
 
         # Stop at -[MyString initWithNSString:].
-        self.expect("breakpoint set -n '-[MyString initWithNSString:]'", BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 2: name = '-[MyString initWithNSString:]', locations = 1")
+        lldbutil.run_break_set_by_symbol (self, '-[MyString initWithNSString:]', num_expected_locations=1, sym_exact=True)
 
         # Stop at the "description" selector.
-        self.expect("breakpoint set -S description", BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 3: name = 'description', locations = 1")
+        lldbutil.run_break_set_by_selector (self, 'description', num_expected_locations=1)
 
         # Stop at -[NSAutoreleasePool release].
-        self.expect("_regexp-break -[NSAutoreleasePool release]", BREAKPOINT_CREATED,
-            substrs = ["Breakpoint created: 4: name = '-[NSAutoreleasePool release]', locations = 1"])
+        break_results = lldbutil.run_break_set_command (self, "_regexp-break -[NSAutoreleasePool release]")
+        lldbutil.check_breakpoint_result (self, break_results, symbol_name='-[NSAutoreleasePool release]', num_locations=1)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/lang/objc/foundation/TestObjCMethods.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/objc/foundation/TestObjCMethods.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/objc/foundation/TestObjCMethods.py (original)
+++ lldb/branches/windows/test/lang/objc/foundation/TestObjCMethods.py Fri Sep 28 06:07:34 2012
@@ -7,6 +7,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
 class FoundationTestCase(TestBase):
@@ -61,20 +62,18 @@
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Stop at +[NSString stringWithFormat:].
-        self.expect("_regexp-break +[NSString stringWithFormat:]", BREAKPOINT_CREATED,
-            substrs = ["Breakpoint created: 1: name = '+[NSString stringWithFormat:]', locations = 1"])
+        break_results = lldbutil.run_break_set_command(self, "_regexp-break +[NSString stringWithFormat:]")
+        lldbutil.check_breakpoint_result (self, break_results, symbol_name='+[NSString stringWithFormat:]', num_locations=1)
 
         # Stop at -[MyString initWithNSString:].
-        self.expect("breakpoint set -n '-[MyString initWithNSString:]'", BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 2: name = '-[MyString initWithNSString:]', locations = 1")
+        lldbutil.run_break_set_by_symbol (self, '-[MyString initWithNSString:]', num_expected_locations=1, sym_exact=True)
 
         # Stop at the "description" selector.
-        self.expect("breakpoint set -S description", BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 3: name = 'description', locations = 1")
+        lldbutil.run_break_set_by_selector (self, 'description', num_expected_locations=1)
 
         # Stop at -[NSAutoreleasePool release].
-        self.expect("_regexp-break -[NSAutoreleasePool release]", BREAKPOINT_CREATED,
-            substrs = ["Breakpoint created: 4: name = '-[NSAutoreleasePool release]', locations = 1"])
+        break_results = lldbutil.run_break_set_command(self, "_regexp-break -[NSAutoreleasePool release]")
+        lldbutil.check_breakpoint_result (self, break_results, symbol_name='-[NSAutoreleasePool release]', num_locations=1)
 
         self.runCmd("run", RUN_SUCCEEDED)
 
@@ -125,8 +124,9 @@
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Stop at -[MyString description].
-        self.expect("breakpoint set -n '-[MyString description]", BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: name = '-[MyString description]', locations = 1")
+        lldbutil.run_break_set_by_symbol (self, '-[MyString description]', num_expected_locations=1, sym_exact=True)
+#        self.expect("breakpoint set -n '-[MyString description]", BREAKPOINT_CREATED,
+#            startstr = "Breakpoint created: 1: name = '-[MyString description]', locations = 1")
 
         self.runCmd("run", RUN_SUCCEEDED)
 
@@ -195,10 +195,8 @@
         #
 
         self.runCmd("breakpoint delete 1")
-        self.expect("breakpoint set -f main.m -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 2: file ='main.m', line = %d, locations = 1" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
+
         self.runCmd("process continue")
 
         # rdar://problem/8542091

Modified: lldb/branches/windows/test/lang/objc/foundation/TestObjCMethods2.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/objc/foundation/TestObjCMethods2.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/objc/foundation/TestObjCMethods2.py (original)
+++ lldb/branches/windows/test/lang/objc/foundation/TestObjCMethods2.py Fri Sep 28 06:07:34 2012
@@ -6,6 +6,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
 class FoundationTestCase2(TestBase):
@@ -91,10 +92,10 @@
         TestBase.setUp(self)
         # Find the line numbers to break at.
         self.lines = []
-        self.lines.append(line_number('main.m', '// Expressions to test here for selector:'))
-        self.lines.append(line_number('main.m', '// Expressions to test here for NSArray:'))
-        self.lines.append(line_number('main.m', '// Expressions to test here for NSString:'))
-        self.lines.append(line_number('main.m', "// Set a breakpoint on '-[MyString description]' and test expressions:"))
+        self.lines.append(line_number('main.m', '// Break here for selector: tests'))
+        self.lines.append(line_number('main.m', '// Break here for NSArray tests'))
+        self.lines.append(line_number('main.m', '// Break here for NSString tests'))
+        self.lines.append(line_number('main.m', '// Break here for description test'))
         self.lines.append(line_number('main.m', '// Set break point at this line'))
     
     def more_expr_objc(self):
@@ -104,9 +105,7 @@
 
         # Create a bunch of breakpoints.
         for line in self.lines:
-            self.expect("breakpoint set -f main.m -l %d" % line, BREAKPOINT_CREATED,
-                substrs = ["Breakpoint created:",
-                           "file ='main.m', line = %d, locations = 1" % line])
+            lldbutil.run_break_set_by_file_and_line (self, "main.m", line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 
@@ -143,9 +142,7 @@
 
         # Break inside Test_NSArray:
         line = self.lines[1]
-        self.expect("breakpoint set -f main.m -l %d" % line, BREAKPOINT_CREATED,
-            substrs = ["Breakpoint created:",
-                       "file ='main.m', line = %d, locations = 1" % line])
+        lldbutil.run_break_set_by_file_and_line (self, "main.m", line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 
@@ -172,9 +169,7 @@
 
         # Break inside Test_NSString:
         line = self.lines[2]
-        self.expect("breakpoint set -f main.m -l %d" % line, BREAKPOINT_CREATED,
-            substrs = ["Breakpoint created:",
-                       "file ='main.m', line = %d, locations = 1" % line])
+        lldbutil.run_break_set_by_file_and_line (self, "main.m", line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 
@@ -201,10 +196,8 @@
         
         line = self.lines[4]
 
-        self.expect("breakpoint set -f main.m -l %d" % line, BREAKPOINT_CREATED,
-                    substrs = ["Breakpoint created:",
-                               "file ='main.m', line = %d, locations = 1" % line])
-        
+        lldbutil.run_break_set_by_file_and_line (self, "main.m", line, num_expected_locations=1, loc_exact=True)
+
         self.runCmd("run", RUN_SUCCEEDED)
         
         self.expect("expression *my",
@@ -218,9 +211,7 @@
         
         line = self.lines[4]
 
-        self.expect("breakpoint set -f main.m -l %d" % line, BREAKPOINT_CREATED,
-                    substrs = ["Breakpoint created:",
-                               "file ='main.m', line = %d, locations = 1" % line])
+        lldbutil.run_break_set_by_file_and_line (self, "main.m", line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 
@@ -235,9 +226,7 @@
         
         line = self.lines[4]
 
-        self.expect("breakpoint set -f main.m -l %d" % line, BREAKPOINT_CREATED,
-                    substrs = ["Breakpoint created:",
-                               "file ='main.m', line = %d, locations = 1" % line])
+        lldbutil.run_break_set_by_file_and_line (self, "main.m", line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/lang/objc/foundation/main.m
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/objc/foundation/main.m?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/objc/foundation/main.m (original)
+++ lldb/branches/windows/test/lang/objc/foundation/main.m Fri Sep 28 06:07:34 2012
@@ -40,7 +40,7 @@
 {
     // Set a breakpoint on '-[MyString description]' and test expressions:
     // expression (char *)sel_getName(_cmd)
-    if (self.descriptionPauses)
+  if (self.descriptionPauses)  // Break here for description test
     {
         printf ("\nAbout to sleep.\n");
         usleep(100000);
@@ -60,7 +60,7 @@
     //      The expression above should return "sel" as it should be just
     //      a uniqued C string pointer. We were seeing the result pointer being
     //      truncated with recent LLDBs.
-    return 0;
+    return 0; // Break here for selector: tests
 }
 
 int
@@ -82,7 +82,7 @@
     // expression str.description
     // expression str = @"new"
     // expression str = [NSString stringWithFormat: @"%cew", 'N']
-    return 0;
+    return 0; // Break here for NSString tests
 }
 
 NSString *my_global_str = NULL;
@@ -112,7 +112,7 @@
     // expression array2.count
     id obj;
     // After each object at index call, use expression and validate object
-    obj = [array1 objectAtIndex: 0];
+    obj = [array1 objectAtIndex: 0]; // Break here for NSArray tests
     obj = [array1 objectAtIndex: 1];
     obj = [array1 objectAtIndex: 2];
 

Modified: lldb/branches/windows/test/lang/objc/hidden-ivars/InternalDefiner.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/objc/hidden-ivars/InternalDefiner.h?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/objc/hidden-ivars/InternalDefiner.h (original)
+++ lldb/branches/windows/test/lang/objc/hidden-ivars/InternalDefiner.h Fri Sep 28 06:07:34 2012
@@ -1,10 +1,11 @@
 #import <Foundation/Foundation.h>
+#import <stdint.h>
 
 @interface InternalDefiner : NSObject {
 @public
-    int foo;
+    uintptr_t foo;
 }
 
--(int)setBarTo:(int)newBar;
+-(id)initWithFoo:(uintptr_t)f andBar:(uintptr_t)b;
 
 @end

Modified: lldb/branches/windows/test/lang/objc/hidden-ivars/InternalDefiner.m
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/objc/hidden-ivars/InternalDefiner.m?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/objc/hidden-ivars/InternalDefiner.m (original)
+++ lldb/branches/windows/test/lang/objc/hidden-ivars/InternalDefiner.m Fri Sep 28 06:07:34 2012
@@ -1,18 +1,31 @@
 #import "InternalDefiner.h"
 
 @interface InternalDefiner () {
-    int bar;
+    uintptr_t bar;
 }
 
 @end
 
 @implementation InternalDefiner
 
--(int)setBarTo:(int)newBar
+-(id)init
 {
-    int oldBar = bar;
-    bar = newBar;
-    return oldBar;
+    if (self = [super init])
+    {
+        foo = 2;
+        bar = 3;
+    }
+    return self;
+}
+
+-(id)initWithFoo:(uintptr_t)f andBar:(uintptr_t)b
+{
+    if (self = [super init])
+    {
+        foo = f;
+        bar = b;
+    }
+    return self;
 }
 
 @end

Modified: lldb/branches/windows/test/lang/objc/hidden-ivars/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/objc/hidden-ivars/Makefile?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/objc/hidden-ivars/Makefile (original)
+++ lldb/branches/windows/test/lang/objc/hidden-ivars/Makefile Fri Sep 28 06:07:34 2012
@@ -1,6 +1,6 @@
 LEVEL = ../../../make
 
-DYLIB_NAME := libInternalDefiner
+DYLIB_NAME := InternalDefiner
 DYLIB_OBJC_SOURCES := InternalDefiner.m
 OBJC_SOURCES := main.m
 

Modified: lldb/branches/windows/test/lang/objc/hidden-ivars/TestHiddenIvars.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/objc/hidden-ivars/TestHiddenIvars.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/objc/hidden-ivars/TestHiddenIvars.py (original)
+++ lldb/branches/windows/test/lang/objc/hidden-ivars/TestHiddenIvars.py Fri Sep 28 06:07:34 2012
@@ -4,6 +4,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class HiddenIvarsTestCase(TestBase):
 
@@ -25,6 +26,7 @@
         self.buildDwarf()
         self.expr()
 
+    @unittest2.expectedFailure
     @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
     @dsym_test
     def test_frame_variable_with_dsym(self):
@@ -33,6 +35,7 @@
         self.buildDsym()
         self.frame_var()
 
+    @unittest2.expectedFailure
     @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
     @dwarf_test
     def test_frame_variable_with_dwarf(self):
@@ -52,8 +55,7 @@
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Break inside the foo function which takes a bar_ptr argument.
-        self.expect("breakpoint set -f main.m -l %d" % self.line, BREAKPOINT_CREATED,
-            startstr = "Breakpoint created")
+        lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 
@@ -70,21 +72,45 @@
         self.common_setup()
 
         # This should display correctly.
+        self.expect("expression (j->_definer->foo)", VARIABLES_DISPLAYED_CORRECTLY,
+            substrs = ["= 4"])
+
         self.expect("expression (j->_definer->bar)", VARIABLES_DISPLAYED_CORRECTLY,
             substrs = ["= 5"])
             
         self.expect("expression *(j->_definer)", VARIABLES_DISPLAYED_CORRECTLY,
-            substrs = ["foo = 0", "bar = 5"])
+            substrs = ["foo = 4", "bar = 5"])
+
+        self.expect("expression (k->foo)", VARIABLES_DISPLAYED_CORRECTLY,
+            substrs = ["= 2"])
+
+        self.expect("expression (k->bar)", VARIABLES_DISPLAYED_CORRECTLY,
+            substrs = ["= 3"])
+
+        self.expect("expression *(k)", VARIABLES_DISPLAYED_CORRECTLY,
+            substrs = ["foo = 2", "bar = 3"])
 
     def frame_var(self):
         self.common_setup()
 
         # This should display correctly.
+        self.expect("frame variable j->_definer->foo", VARIABLES_DISPLAYED_CORRECTLY,
+            substrs = ["= 4"])
+
         self.expect("frame variable j->_definer->bar", VARIABLES_DISPLAYED_CORRECTLY,
             substrs = ["= 5"])
             
         self.expect("frame variable *j->_definer", VARIABLES_DISPLAYED_CORRECTLY,
-            substrs = ["foo = 0", "bar = 5"])
+            substrs = ["foo = 4", "bar = 5"])
+
+        self.expect("frame variable k->foo", VARIABLES_DISPLAYED_CORRECTLY,
+            substrs = ["= 2"])
+
+        self.expect("frame variable k->bar", VARIABLES_DISPLAYED_CORRECTLY,
+            substrs = ["= 3"])
+
+        self.expect("frame variable *k", VARIABLES_DISPLAYED_CORRECTLY,
+            substrs = ["foo = 2", "bar = 3"])
                        
 if __name__ == '__main__':
     import atexit

Modified: lldb/branches/windows/test/lang/objc/hidden-ivars/main.m
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/objc/hidden-ivars/main.m?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/objc/hidden-ivars/main.m (original)
+++ lldb/branches/windows/test/lang/objc/hidden-ivars/main.m Fri Sep 28 06:07:34 2012
@@ -13,8 +13,29 @@
 
 -(id)init
 {
-    _definer = [InternalDefiner alloc];
-    [_definer setBarTo:5];
+    if (self = [super init])
+    {
+        _definer = [[InternalDefiner alloc] initWithFoo:4 andBar:5];
+    }
+    return self;
+}
+
+ at end
+
+ at interface InheritContainer : InternalDefiner 
+{
+}
+
+-(id)init;
+ at end
+
+ at implementation InheritContainer
+
+-(id)init
+{
+    if (self = [super initWithFoo:2 andBar:3])
+    {
+    }
     return self;
 }
 
@@ -25,8 +46,10 @@
 
     @autoreleasepool {
         Container *j = [[Container alloc] init];
+        InheritContainer *k = [[InheritContainer alloc] init];
 
-        printf("ivar value = %d", j->_definer->foo); // Set breakpoint 0 here.
+        printf("ivar value = %u\n", (unsigned)j->_definer->foo); // Set breakpoint 0 here.
+        printf("ivar value = %u\n", (unsigned)k->foo);           // Set breakpoint 1 here.
     }   
     return 0;
 }

Modified: lldb/branches/windows/test/lang/objc/objc++/TestObjCXX.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/objc/objc%2B%2B/TestObjCXX.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/objc/objc++/TestObjCXX.py (original)
+++ lldb/branches/windows/test/lang/objc/objc++/TestObjCXX.py Fri Sep 28 06:07:34 2012
@@ -6,6 +6,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class ObjCXXTestCase(TestBase):
 
@@ -32,8 +33,7 @@
         exe = os.path.join(os.getcwd(), "a.out")
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
-        self.expect("breakpoint set -p 'breakpoint 1'", BREAKPOINT_CREATED,
-            startstr = "Breakpoint created")
+        lldbutil.run_break_set_by_source_regexp (self, 'breakpoint 1', num_expected_locations=1) 
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/lang/objc/objc-new-syntax/TestObjCNewSyntax.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/objc/objc-new-syntax/TestObjCNewSyntax.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/objc/objc-new-syntax/TestObjCNewSyntax.py (original)
+++ lldb/branches/windows/test/lang/objc/objc-new-syntax/TestObjCNewSyntax.py Fri Sep 28 06:07:34 2012
@@ -4,6 +4,7 @@
 import unittest2
 import lldb
 import platform
+import lldbutil
 
 from distutils.version import StrictVersion
 
@@ -44,8 +45,7 @@
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Break inside the foo function which takes a bar_ptr argument.
-        self.expect("breakpoint set -f main.m -l %d" % self.line, BREAKPOINT_CREATED,
-            startstr = "Breakpoint created")
+        lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/lang/objc/objc-optimized/TestObjcOptimized.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/objc/objc-optimized/TestObjcOptimized.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/objc/objc-optimized/TestObjcOptimized.py (original)
+++ lldb/branches/windows/test/lang/objc/objc-optimized/TestObjcOptimized.py Fri Sep 28 06:07:34 2012
@@ -11,6 +11,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 # rdar://problem/9087739
 # test failure: objc_optimized does not work for "-C clang -A i386"
@@ -39,9 +40,7 @@
         exe = os.path.join(os.getcwd(), "a.out")
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
-        self.expect("breakpoint set -n '%s'" % self.method_spec,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: name = '%s', locations = 1" % self.method_spec)
+        lldbutil.run_break_set_by_symbol (self, self.method_spec, num_expected_locations=1, sym_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
         self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT,

Modified: lldb/branches/windows/test/lang/objc/radar-9691614/TestObjCMethodReturningBOOL.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/objc/radar-9691614/TestObjCMethodReturningBOOL.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/objc/radar-9691614/TestObjCMethodReturningBOOL.py (original)
+++ lldb/branches/windows/test/lang/objc/radar-9691614/TestObjCMethodReturningBOOL.py Fri Sep 28 06:07:34 2012
@@ -6,6 +6,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
 class MethodReturningBOOLTestCase(TestBase):
@@ -42,10 +43,7 @@
         exe = os.path.join(os.getcwd(), exe_name)
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
-        self.expect("breakpoint set -f %s -l %d" % (self.main_source, self.line),
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
-                        (self.main_source, self.line))
+        lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
         self.expect("process status", STOPPED_DUE_TO_BREAKPOINT,

Modified: lldb/branches/windows/test/lang/objc/rdar-10967107/TestRdar10967107.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/objc/rdar-10967107/TestRdar10967107.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/objc/rdar-10967107/TestRdar10967107.py (original)
+++ lldb/branches/windows/test/lang/objc/rdar-10967107/TestRdar10967107.py Fri Sep 28 06:07:34 2012
@@ -6,6 +6,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
 class Rdar10967107TestCase(TestBase):
@@ -42,10 +43,7 @@
         exe = os.path.join(os.getcwd(), exe_name)
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
-        self.expect("breakpoint set -f %s -l %d" % (self.main_source, self.line),
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
-                        (self.main_source, self.line))
+        lldbutil.run_break_set_by_file_and_line (self, self.main_source, self.line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
         # check that each type is correctly bound to its list of children

Modified: lldb/branches/windows/test/lang/objc/rdar-10967107/main.m
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/objc/rdar-10967107/main.m?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/objc/rdar-10967107/main.m (original)
+++ lldb/branches/windows/test/lang/objc/rdar-10967107/main.m Fri Sep 28 06:07:34 2012
@@ -7,7 +7,7 @@
 	NSDate *date1 = [NSDate date];
 	CFGregorianDate cf_greg_date = CFAbsoluteTimeGetGregorianDate(CFDateGetAbsoluteTime((CFDateRef)date1), NULL);
 	CFRange cf_range = {4,4};
-// Set breakpoint here.
-    [pool release];
+
+    [pool release]; // Set breakpoint here.
     return 0;
 }

Modified: lldb/branches/windows/test/lang/objc/rdar-11355592/TestRdar11355592.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/objc/rdar-11355592/TestRdar11355592.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/objc/rdar-11355592/TestRdar11355592.py (original)
+++ lldb/branches/windows/test/lang/objc/rdar-11355592/TestRdar11355592.py Fri Sep 28 06:07:34 2012
@@ -6,6 +6,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
 class Rdar10967107TestCase(TestBase):
@@ -42,10 +43,7 @@
         exe = os.path.join(os.getcwd(), exe_name)
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
-        self.expect("breakpoint set -f %s -l %d" % (self.main_source, self.line),
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
-                        (self.main_source, self.line))
+        lldbutil.run_break_set_by_file_and_line (self, self.main_source, self.line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
         # check that we correctly see the const char*, even with dynamic types on

Modified: lldb/branches/windows/test/lang/objc/rdar-11355592/main.m
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/objc/rdar-11355592/main.m?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/objc/rdar-11355592/main.m (original)
+++ lldb/branches/windows/test/lang/objc/rdar-11355592/main.m Fri Sep 28 06:07:34 2012
@@ -29,8 +29,8 @@
 
     FoolMeOnce *my_foolie = [[FoolMeOnce alloc] initWithFirst: 20 andSecond: 55];
     const char *my_string = (char *) my_foolie;
-// Set breakpoint here.
-    my_string = "Now this is a REAL string...";
+
+    my_string = "Now this is a REAL string..."; // Set breakpoint here.
 
     [pool release];
     return 0;

Modified: lldb/branches/windows/test/lang/objc/real-definition/TestRealDefinition.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/objc/real-definition/TestRealDefinition.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/objc/real-definition/TestRealDefinition.py (original)
+++ lldb/branches/windows/test/lang/objc/real-definition/TestRealDefinition.py Fri Sep 28 06:07:34 2012
@@ -4,6 +4,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class TestRealDefinition(TestBase):
 
@@ -54,13 +55,15 @@
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Break inside the foo function which takes a bar_ptr argument.
-        self.expect("breakpoint set -f main.m -l %d" % line_number('main.m', '// Set breakpoint in main'), BREAKPOINT_CREATED, startstr = "Breakpoint created")
+        line = line_number('main.m', '// Set breakpoint in main')
+        lldbutil.run_break_set_by_file_and_line (self, "main.m", line, num_expected_locations=1, loc_exact=True)
 
     def stop_at_interface(self):
         """Test that we can find the implementation for an objective C type when we stop in the interface"""
         self.common_setup()
 
-        self.expect("breakpoint set -f Foo.m -l %d" % line_number('Foo.m', '// Set breakpoint where Bar is an interface'), BREAKPOINT_CREATED, startstr = "Breakpoint created")
+        line = line_number('Foo.m', '// Set breakpoint where Bar is an interface')
+        lldbutil.run_break_set_by_file_and_line (self, 'Foo.m', line, num_expected_locations=1, loc_exact=True);
 
         self.runCmd("run", RUN_SUCCEEDED)
 
@@ -87,7 +90,8 @@
         """Test that we can find the implementation for an objective C type when we stop in the implementation"""
         self.common_setup()
 
-        self.expect("breakpoint set -f Bar.m -l %d" % line_number('Bar.m', '// Set breakpoint where Bar is an implementation'), BREAKPOINT_CREATED, startstr = "Breakpoint created")
+        line = line_number('Bar.m', '// Set breakpoint where Bar is an implementation')
+        lldbutil.run_break_set_by_file_and_line (self, 'Bar.m', line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/lang/objc/self/TestObjCSelf.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/objc/self/TestObjCSelf.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/objc/self/TestObjCSelf.py (original)
+++ lldb/branches/windows/test/lang/objc/self/TestObjCSelf.py Fri Sep 28 06:07:34 2012
@@ -1,8 +1,9 @@
 """
 Tests that ObjC member variables are available where they should be.
 """
-
+import lldb
 from lldbtest import *
+import lldbutil
 
 class ObjCSelfTestCase(TestBase):
     
@@ -25,9 +26,7 @@
         TestBase.setUp(self)
     
     def set_breakpoint(self, line):
-        self.expect("breakpoint set -f main.m -l %d" % line,
-                    BREAKPOINT_CREATED,
-                    startstr = "Breakpoint created")
+        lldbutil.run_break_set_by_file_and_line (self, "main.m", line, num_expected_locations=1, loc_exact=True)
     
     def self_commands(self):
         """Test that the appropriate member variables are available when stopped in Objective-C class and instance methods"""

Modified: lldb/branches/windows/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lldbtest.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/lldbtest.py (original)
+++ lldb/branches/windows/test/lldbtest.py Fri Sep 28 06:07:34 2012
@@ -946,6 +946,30 @@
                 waitTime = float(os.environ["LLDB_TIME_WAIT_BETWEEN_TEST_CASES"])
             time.sleep(waitTime)
 
+    # Returns the list of categories to which this test case belongs
+    # by default, look for a ".categories" file, and read its contents
+    # if no such file exists, traverse the hierarchy - we guarantee
+    # a .categories to exist at the top level directory so we do not end up
+    # looping endlessly - subclasses are free to define their own categories
+    # in whatever way makes sense to them
+    def getCategories(self):
+        import inspect
+        import os.path
+        folder = inspect.getfile(self.__class__)
+        folder = os.path.dirname(folder)
+        while folder != '/':
+                categories_file_name = os.path.join(folder,".categories")
+                if os.path.exists(categories_file_name):
+                        categories_file = open(categories_file_name,'r')
+                        categories = categories_file.readline()
+                        categories_file.close()
+                        categories = str.replace(categories,'\n','')
+                        categories = str.replace(categories,'\r','')
+                        return categories.split(',')
+                else:
+                        folder = os.path.dirname(folder)
+                        continue
+
     def setUp(self):
         #import traceback
         #traceback.print_stack()
@@ -1077,6 +1101,49 @@
             self.assertTrue(self.res.Succeeded(),
                             msg if msg else CMD_MSG(cmd))
 
+    def match (self, str, patterns, msg=None, trace=False, error=False, matching=True, exe=True):
+        """run command in str, and match the result against regexp in patterns returning the match object for the first matching pattern
+
+        Otherwise, all the arguments have the same meanings as for the expect function"""
+
+        trace = (True if traceAlways else trace)
+
+        if exe:
+            # First run the command.  If we are expecting error, set check=False.
+            # Pass the assert message along since it provides more semantic info.
+            self.runCmd(str, msg=msg, trace = (True if trace else False), check = not error)
+
+            # Then compare the output against expected strings.
+            output = self.res.GetError() if error else self.res.GetOutput()
+
+            # If error is True, the API client expects the command to fail!
+            if error:
+                self.assertFalse(self.res.Succeeded(),
+                                 "Command '" + str + "' is expected to fail!")
+        else:
+            # No execution required, just compare str against the golden input.
+            output = str
+            with recording(self, trace) as sbuf:
+                print >> sbuf, "looking at:", output
+
+        # The heading says either "Expecting" or "Not expecting".
+        heading = "Expecting" if matching else "Not expecting"
+
+        for pattern in patterns:
+            # Match Objects always have a boolean value of True.
+            match_object = re.search(pattern, output)
+            matched = bool(match_object)
+            with recording(self, trace) as sbuf:
+                print >> sbuf, "%s pattern: %s" % (heading, pattern)
+                print >> sbuf, "Matched" if matched else "Not matched"
+            if matched:
+                break
+
+        self.assertTrue(matched if matching else not matched,
+                        msg if msg else EXP_MSG(str, exe))
+
+        return match_object        
+
     def expect(self, str, msg=None, patterns=None, startstr=None, endstr=None, substrs=None, trace=False, error=False, matching=True, exe=True):
         """
         Similar to runCmd; with additional expect style output matching ability.

Modified: lldb/branches/windows/test/lldbutil.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lldbutil.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/lldbutil.py (original)
+++ lldb/branches/windows/test/lldbutil.py Fri Sep 28 06:07:34 2012
@@ -258,6 +258,191 @@
 
 
 # ==================================================
+# Utility functions for setting breakpoints
+# ==================================================
+
+def run_break_set_by_file_and_line (test, file_name, line_number, extra_options = None, num_expected_locations = 1, loc_exact=False, module_name=None):
+    """Set a breakpoint by file and line, returning the breakpoint number. 
+
+    If extra_options is not None, then we append it to the breakpoint set command.
+
+    If num_expected_locations is -1 we check that we got AT LEAST one location, otherwise we check that num_expected_locations equals the number of locations.
+
+    If loc_exact is true, we check that there is one location, and that location must be at the input file and line number."""
+
+    if file_name == None:
+        command = 'breakpoint set -l %d'%(line_number)
+    else:
+        command = 'breakpoint set -f "%s" -l %d'%(file_name, line_number)
+
+    if extra_options:
+        command += " " + extra_options
+
+    break_results = run_break_set_command (test, command)
+
+    if num_expected_locations == 1 and loc_exact:
+        check_breakpoint_result (test, break_results, num_locations=num_expected_locations, file_name = file_name, line_number = line_number, module_name=module_name)
+    else:
+        check_breakpoint_result (test, break_results, num_locations = num_expected_locations)
+
+    return get_bpno_from_match (break_results)
+
+def run_break_set_by_symbol (test, symbol, extra_options = None, num_expected_locations = -1, sym_exact = False, module_name=None):
+    """Set a breakpoint by symbol name.  Common options are the same as run_break_set_by_file_and_line.
+
+    If sym_exact is true, then the output symbol must match the input exactly, otherwise we do a substring match."""
+    command = 'breakpoint set -n "%s"'%(symbol)
+    if extra_options:
+        command += " " + extra_options
+
+    break_results = run_break_set_command (test, command)
+
+    if num_expected_locations == 1 and sym_exact:
+        check_breakpoint_result (test, break_results, num_locations = num_expected_locations, symbol_name = symbol, module_name=module_name)
+    else:
+        check_breakpoint_result (test, break_results, num_locations = num_expected_locations)
+
+    return get_bpno_from_match (break_results)
+
+def run_break_set_by_selector (test, selector, extra_options = None, num_expected_locations = -1, module_name=None):
+    """Set a breakpoint by selector.  Common options are the same as run_break_set_by_file_and_line."""
+
+    command = 'breakpoint set -S "%s"'%(selector)
+    if extra_options:
+        command += " " + extra_options
+
+    break_results = run_break_set_command (test, command)
+
+    if num_expected_locations == 1:
+        check_breakpoint_result (test, break_results, num_locations = num_expected_locations, symbol_name = selector, symbol_match_exact=False, module_name=module_name)
+    else:
+        check_breakpoint_result (test, break_results, num_locations = num_expected_locations)
+
+    return get_bpno_from_match (break_results)
+
+def run_break_set_by_regexp (test, regexp, extra_options=None, num_expected_locations=-1):
+    """Set a breakpoint by regular expression match on symbol name.  Common options are the same as run_break_set_by_file_and_line."""
+
+    command = 'breakpoint set -r "%s"'%(regexp)
+    if extra_options:
+        command += " " + extra_options
+    
+    break_results = run_break_set_command (test, command)
+    
+    check_breakpoint_result (test, break_results, num_locations=num_expected_locations)
+
+    return get_bpno_from_match (break_results)
+
+def run_break_set_by_source_regexp (test, regexp, extra_options=None, num_expected_locations=-1):
+    """Set a breakpoint by source regular expression.  Common options are the same as run_break_set_by_file_and_line."""
+    command = 'breakpoint set -p "%s"'%(regexp)
+    if extra_options:
+        command += " " + extra_options
+    
+    break_results = run_break_set_command (test, command)
+    
+    check_breakpoint_result (test, break_results, num_locations=num_expected_locations)
+
+    return get_bpno_from_match (break_results)
+
+def run_break_set_command (test, command):
+    """Run the command passed in - it must be some break set variant - and analyze the result.  
+    Returns a dictionary of information gleaned from the command-line results.
+    Will assert if the breakpoint setting fails altogether.
+
+    Dictionary will contain:
+        bpno          - breakpoint of the newly created breakpoint, -1 on error.
+        num_locations - number of locations set for the breakpoint.
+
+    If there is only one location, the dictionary MAY contain:
+        file          - source file name
+        line_no       - source line number
+        symbol        - symbol name
+        inline_symbol - inlined symbol name
+        offset        - offset from the original symbol
+        module        - module
+        address       - address at which the breakpoint was set."""
+
+    patterns = [r"^Breakpoint (?P<bpno>[0-9]+): (?P<num_locations>[0-9]+) locations\.$",
+                r"^Breakpoint (?P<bpno>[0-9]+): (?P<num_locations>no) locations \(pending\)\.",
+                r"^Breakpoint (?P<bpno>[0-9]+): where = (?P<module>.*)`(?P<symbol>[+\-]{0,1}[^+]+)( \+ (?P<offset>[0-9]+)){0,1}( \[inlined\] (?P<inline_symbol>.*)){0,1} at (?P<file>[^:]+):(?P<line_no>[0-9]+), address = (?P<address>0x[0-9a-fA-F]+)$",
+                r"^Breakpoint (?P<bpno>[0-9]+): where = (?P<module>.*)`(?P<symbol>.*)( \+ (?P<offset>[0-9]+)){0,1}, address = (?P<address>0x[0-9a-fA-F]+)$"]
+    match_object = test.match (command, patterns)
+    break_results = match_object.groupdict()
+
+    # We always insert the breakpoint number, setting it to -1 if we couldn't find it
+    # Also, make sure it gets stored as an integer.
+    if not 'bpno' in break_results:
+        break_results['bpno'] = -1
+    else:
+        break_results['bpno'] = int(break_results['bpno'])
+        
+    # We always insert the number of locations
+    # If ONE location is set for the breakpoint, then the output doesn't mention locations, but it has to be 1...
+    # We also make sure it is an integer.
+
+    if not 'num_locations' in break_results:
+        num_locations = 1
+    else:
+        num_locations = break_results['num_locations']
+        if num_locations == 'no':
+            num_locations = 0
+        else:
+            num_locations = int(break_results['num_locations'])
+
+    break_results['num_locations'] = num_locations
+    
+    if 'line_no' in break_results:
+        break_results['line_no'] = int(break_results['line_no'])
+
+    return break_results
+
+def get_bpno_from_match (break_results):
+    return int (break_results['bpno'])
+
+def check_breakpoint_result (test, break_results, file_name=None, line_number=-1, symbol_name=None, symbol_match_exact=True, module_name=None, offset=-1, num_locations=-1):
+
+    out_num_locations = break_results['num_locations']
+
+    if num_locations == -1:
+        test.assertTrue (out_num_locations > 0, "Expecting one or more locations, got none.")
+    else:
+        test.assertTrue (num_locations == out_num_locations, "Expecting %d locations, got %d."%(num_locations, out_num_locations))
+
+    if file_name:
+        out_file_name = ""
+        if 'file' in break_results:
+            out_file_name = break_results['file']
+        test.assertTrue (file_name == out_file_name, "Breakpoint file name '%s' doesn't match resultant name '%s'."%(file_name, out_file_name))
+
+    if line_number != -1:
+        out_file_line = -1
+        if 'line_no' in break_results:
+            out_line_number = break_results['line_no']
+
+        test.assertTrue (line_number == out_line_number, "Breakpoint line number %s doesn't match resultant line %s."%(line_number, out_line_number))
+
+    if symbol_name:
+        out_symbol_name = ""
+        # Look first for the inlined symbol name, otherwise use the symbol name:
+        if 'inline_symbol' in break_results and break_results['inline_symbol']:
+            out_symbol_name = break_results['inline_symbol']
+        elif 'symbol' in break_results:
+            out_symbol_name = break_results['symbol']
+
+        if symbol_match_exact:
+            test.assertTrue(symbol_name == out_symbol_name, "Symbol name '%s' doesn't match resultant symbol '%s'."%(symbol_name, out_symbol_name))
+        else:
+            test.assertTrue(out_symbol_name.find(symbol_name) != -1, "Symbol name '%s' isn't in resultant symbol '%s'."%(symbol_name, out_symbol_name))
+
+    if module_name:
+        out_nodule_name = None
+        if 'module' in break_results:
+            out_module_name = break_results['module']
+        
+        test.assertTrue (module_name.find(out_module_name) != -1, "Symbol module name '%s' isn't in expected module name '%s'."%(out_module_name, module_name))
+
+# ==================================================
 # Utility functions related to Threads and Processes
 # ==================================================
 

Modified: lldb/branches/windows/test/macosx/universal/TestUniversal.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/macosx/universal/TestUniversal.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/macosx/universal/TestUniversal.py (original)
+++ lldb/branches/windows/test/macosx/universal/TestUniversal.py Fri Sep 28 06:07:34 2012
@@ -4,6 +4,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class UniversalTestCase(TestBase):
 
@@ -53,10 +54,7 @@
             substrs = ["testit' (x86_64)."])
 
         # Break inside the main.
-        self.expect("breakpoint set -f main.c -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.c', line = %d, locations = 1" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
 
         # We should be able to launch the x86_64 executable.
         self.runCmd("run", RUN_SUCCEEDED)
@@ -81,10 +79,7 @@
             substrs = ["testit' (i386)."])
 
         # Break inside the main.
-        self.expect("breakpoint set -f main.c -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.c', line = %d, locations = 1" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
 
         # We should be able to launch the i386 executable as well.
         self.runCmd("run", RUN_SUCCEEDED)

Modified: lldb/branches/windows/test/make/Makefile.rules
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/make/Makefile.rules?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/make/Makefile.rules (original)
+++ lldb/branches/windows/test/make/Makefile.rules Fri Sep 28 06:07:34 2012
@@ -230,6 +230,11 @@
 $(DYLIB_FILENAME) : $(DYLIB_OBJECTS)
 ifeq "$(OS)" "Darwin"
 	$(LD) $(LDFLAGS) $(DYLIB_OBJECTS) -install_name "@executable_path/$(DYLIB_FILENAME)" -dynamiclib -o "$(DYLIB_FILENAME)"
+ifneq "$(MAKE_DSYM)" "NO"
+ifneq "$(DS)" ""
+	$(DS) $(DSFLAGS) "$(DYLIB_FILENAME)"
+endif
+endif
 else
 	$(LD) $(LDFLAGS) $(DYLIB_OBJECTS) -shared -o "$(DYLIB_FILENAME)"
 endif

Modified: lldb/branches/windows/test/python_api/formatters/TestFormattersSBAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/python_api/formatters/TestFormattersSBAPI.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/python_api/formatters/TestFormattersSBAPI.py (original)
+++ lldb/branches/windows/test/python_api/formatters/TestFormattersSBAPI.py Fri Sep 28 06:07:34 2012
@@ -4,6 +4,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class SBFormattersAPITestCase(TestBase):
 
@@ -42,10 +43,7 @@
         """Test Python APIs for working with formatters"""
         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
 
-        self.expect("breakpoint set -f main.cpp -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.cpp', line = %d, locations = 1" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 
@@ -304,10 +302,7 @@
         """Test that one can have the public API return non-synthetic SBValues if desired"""
         self.runCmd("file no_synth", CURRENT_EXECUTABLE_SET)
 
-        self.expect("breakpoint set -f main.cpp -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.cpp', line = %d, locations = 1" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/python_api/sbdata/TestSBData.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/python_api/sbdata/TestSBData.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/python_api/sbdata/TestSBData.py (original)
+++ lldb/branches/windows/test/python_api/sbdata/TestSBData.py Fri Sep 28 06:07:34 2012
@@ -6,6 +6,7 @@
 import pexpect
 from lldbtest import *
 from math import fabs
+import lldbutil
 
 class SBDataAPICase(TestBase):
 
@@ -36,10 +37,7 @@
         """Test the SBData APIs."""
         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
         
-        self.expect("breakpoint set -f main.cpp -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-                    startstr = "Breakpoint created: 1: file ='main.cpp', line = %d, locations = 1" %
-                    self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
         
         self.runCmd("run", RUN_SUCCEEDED)
         

Modified: lldb/branches/windows/test/source-manager/TestSourceManager.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/source-manager/TestSourceManager.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/source-manager/TestSourceManager.py (original)
+++ lldb/branches/windows/test/source-manager/TestSourceManager.py Fri Sep 28 06:07:34 2012
@@ -12,6 +12,7 @@
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class SourceManagerTestCase(TestBase):
 
@@ -112,10 +113,7 @@
         exe = os.path.join(os.getcwd(), "a.out")
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
-        self.expect("breakpoint set -f main.c -l %d" % self.line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.c', line = %d, locations = 1" %
-                        self.line)
+        lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/types/AbstractBase.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/types/AbstractBase.py?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/test/types/AbstractBase.py (original)
+++ lldb/branches/windows/test/types/AbstractBase.py Fri Sep 28 06:07:34 2012
@@ -6,6 +6,7 @@
 import re
 import lldb
 from lldbtest import *
+import lldbutil
 
 def Msg(var, val, using_frame_variable):
     return "'%s %s' matches the output (from compiled code): %s" % (
@@ -120,10 +121,7 @@
             break_line = line_number ("basic_type.cpp", "// Break here to test block captured variables.")
         else:
             break_line = line_number ("basic_type.cpp", "// Here is the line we will break on to check variables.")
-        self.expect("breakpoint set -f basic_type.cpp -l %d" % break_line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='basic_type.cpp', line = %d, locations = 1" %
-                        break_line)
+        lldbutil.run_break_set_by_file_and_line (self, "basic_type.cpp", break_line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
         self.expect("process status", STOPPED_DUE_TO_BREAKPOINT,
@@ -204,10 +202,8 @@
             break_line = line_number ("basic_type.cpp", "// Break here to test block captured variables.")
         else:
             break_line = line_number ("basic_type.cpp", "// Here is the line we will break on to check variables.")
-        self.expect("breakpoint set -f basic_type.cpp -l %d" % break_line,
-                    BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='basic_type.cpp', line = %d, locations = 1" %
-                        break_line)
+        lldbutil.run_break_set_by_file_and_line (self, "basic_type.cpp", break_line, num_expected_locations=1, loc_exact=True)
+
         self.runCmd("run", RUN_SUCCEEDED)
         self.expect("process status", STOPPED_DUE_TO_BREAKPOINT,
             substrs = [" at basic_type.cpp:%d" % break_line,

Modified: lldb/branches/windows/tools/debugserver/debugserver.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/tools/debugserver/debugserver.xcodeproj/project.pbxproj?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/tools/debugserver/debugserver.xcodeproj/project.pbxproj (original)
+++ lldb/branches/windows/tools/debugserver/debugserver.xcodeproj/project.pbxproj Fri Sep 28 06:07:34 2012
@@ -480,7 +480,7 @@
 					i386,
 				);
 				COPY_PHASE_STRIP = NO;
-				CURRENT_PROJECT_VERSION = 192;
+				CURRENT_PROJECT_VERSION = 193;
 				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
@@ -501,7 +501,7 @@
 					armv7s,
 				);
 				"ARCHS[sdk=macosx*]" = "$(ARCHS_STANDARD_64_BIT)";
-				CURRENT_PROJECT_VERSION = 192;
+				CURRENT_PROJECT_VERSION = 193;
 				DEAD_CODE_STRIPPING = YES;
 				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
@@ -527,7 +527,7 @@
 					x86_64,
 					i386,
 				);
-				CURRENT_PROJECT_VERSION = 192;
+				CURRENT_PROJECT_VERSION = 193;
 				DEAD_CODE_STRIPPING = YES;
 				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
@@ -546,7 +546,7 @@
 			buildSettings = {
 				"CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*]" = "source/debugserver-entitlements.plist";
 				COPY_PHASE_STRIP = YES;
-				CURRENT_PROJECT_VERSION = 192;
+				CURRENT_PROJECT_VERSION = 193;
 				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
 				FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks;
 				"FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = (
@@ -599,7 +599,7 @@
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "-";
 				"CODE_SIGN_IDENTITY[sdk=macosx*]" = lldb_codesign;
 				COPY_PHASE_STRIP = YES;
-				CURRENT_PROJECT_VERSION = 192;
+				CURRENT_PROJECT_VERSION = 193;
 				FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks;
 				"FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = (
 					"$(SDKROOT)/System/Library/PrivateFrameworks",
@@ -651,7 +651,7 @@
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "-";
 				"CODE_SIGN_IDENTITY[sdk=macosx*]" = lldb_codesign;
 				COPY_PHASE_STRIP = YES;
-				CURRENT_PROJECT_VERSION = 192;
+				CURRENT_PROJECT_VERSION = 193;
 				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
 				FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks;
 				"FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = (

Modified: lldb/branches/windows/www/lldb-gdb.html
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/www/lldb-gdb.html?rev=164820&r1=164819&r2=164820&view=diff
==============================================================================
--- lldb/branches/windows/www/lldb-gdb.html (original)
+++ lldb/branches/windows/www/lldb-gdb.html Fri Sep 28 06:07:34 2012
@@ -129,6 +129,36 @@
                         </td>
                     </tr>
 
+                    <tr><td class="header" colspan="2">Attach to a remote gdb protocol server running on system "eorgadd", port 8000.</td></tr>
+                    <tr>
+                        <td class="content">
+                            <b>(lldb)</b> gdb-remote eorgadd:8000
+                        </td>
+                        <td class="content">
+                            <b>(gdb)</b> target remote eorgadd:8000
+                        </td>
+                    </tr>
+
+                    <tr><td class="header" colspan="2">Attach to a remote gdb protocol server running on the local system, port 8000.</td></tr>
+                    <tr>
+                        <td class="content">
+                            <b>(lldb)</b> gdb-remote 8000
+                        </td>
+                        <td class="content">
+                            <b>(gdb)</b> target remote localhost:8000
+                        </td>
+                    </tr>
+
+                    <tr><td class="header" colspan="2">Attach to a Darwin kernel in kdp mode on system "eorgadd".</td></tr>
+                    <tr>
+                        <td class="content">
+                            <b>(lldb)</b> kdp-remote eorgadd
+                        </td>
+                        <td class="content">
+                            <b>(gdb)</b> kdp-reattach eorgadd
+                        </td>
+                    </tr>
+
                     <tr><td class="header" colspan="2">Do a source level single step in the currently selected thread.</td></tr>
                     <tr>
                         <td class="content">





More information about the lldb-commits mailing list