[llvm-branch-commits] [lldb] r183468 - Update platform branch with top of tree.

Greg Clayton gclayton at apple.com
Thu Jun 6 17:08:22 PDT 2013


Modified: lldb/branches/lldb-platform-work/test/functionalities/watchpoint/multiple_threads/TestWatchpointMultipleThreads.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/functionalities/watchpoint/multiple_threads/TestWatchpointMultipleThreads.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/functionalities/watchpoint/multiple_threads/TestWatchpointMultipleThreads.py (original)
+++ lldb/branches/lldb-platform-work/test/functionalities/watchpoint/multiple_threads/TestWatchpointMultipleThreads.py Thu Jun  6 19:06:43 2013
@@ -7,6 +7,7 @@ import unittest2
 import re
 import lldb
 from lldbtest import *
+import lldbutil
 
 class WatchpointForMultipleThreadsTestCase(TestBase):
 
@@ -20,6 +21,7 @@ class WatchpointForMultipleThreadsTestCa
         self.setTearDownCleanup(dictionary=self.d)
         self.hello_multiple_threads()
 
+    @skipIfGcc # causes intermittent gcc debian buildbot failures, skip until we can investigate
     @dwarf_test
     def test_watchpoint_multiple_threads_with_dwarf(self):
         """Test that lldb watchpoint works for multiple threads."""
@@ -35,6 +37,7 @@ class WatchpointForMultipleThreadsTestCa
         self.setTearDownCleanup(dictionary=self.d)
         self.hello_multiple_threads_wp_set_and_then_delete()
 
+    @skipIfGcc # causes intermittent gcc debian buildbot failures, skip until we can investigate 
     @dwarf_test
     def test_watchpoint_multiple_threads_wp_set_and_then_delete_with_dwarf(self):
         """Test that lldb watchpoint works for multiple threads, and after the watchpoint is deleted, the watchpoint event should no longer fires."""
@@ -60,14 +63,10 @@ class WatchpointForMultipleThreadsTestCa
         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 +118,10 @@ class WatchpointForMultipleThreadsTestCa
         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/lldb-platform-work/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py (original)
+++ lldb/branches/lldb-platform-work/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py Thu Jun  6 19:06:43 2013
@@ -6,6 +6,7 @@ import os, time
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class WatchpointCommandsTestCase(TestBase):
 
@@ -106,9 +107,7 @@ class WatchpointCommandsTestCase(TestBas
         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 @@ class WatchpointCommandsTestCase(TestBas
         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)
@@ -187,7 +184,7 @@ class WatchpointCommandsTestCase(TestBas
         self.expect("watchpoint delete",
             substrs = ['All watchpoints removed.'])
         # Restore the original setting of auto-confirm.
-        self.runCmd("settings set -r auto-confirm")
+        self.runCmd("settings clear auto-confirm")
 
         # Use the '-v' option to do verbose listing of the watchpoint.
         self.runCmd("watchpoint list -v")
@@ -205,9 +202,7 @@ class WatchpointCommandsTestCase(TestBas
         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 @@ class WatchpointCommandsTestCase(TestBas
         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 @@ class WatchpointCommandsTestCase(TestBas
         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/lldb-platform-work/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandLLDB.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandLLDB.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandLLDB.py (original)
+++ lldb/branches/lldb-platform-work/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandLLDB.py Thu Jun  6 19:06:43 2013
@@ -6,6 +6,7 @@ import os, time
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class WatchpointLLDBCommandTestCase(TestBase):
 
@@ -39,15 +40,28 @@ class WatchpointLLDBCommandTestCase(Test
         self.setTearDownCleanup(dictionary=self.d)
         self.watchpoint_command()
 
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+    @dsym_test
+    def test_watchpoint_command_can_disable_a_watchpoint_with_dsym(self):
+        """Test that 'watchpoint command' action can disable a watchpoint after it is triggered."""
+        self.buildDsym(dictionary=self.d)
+        self.setTearDownCleanup(dictionary=self.d)
+        self.watchpoint_command_can_disable_a_watchpoint()
+
+    @dwarf_test
+    def test_watchpoint_command_can_disable_a_watchpoint_with_dwarf(self):
+        """Test that 'watchpoint command' action can disable a watchpoint after it is triggered."""
+        self.buildDwarf(dictionary=self.d)
+        self.setTearDownCleanup(dictionary=self.d)
+        self.watchpoint_command_can_disable_a_watchpoint()
+
     def watchpoint_command(self):
         """Do 'watchpoint command add'."""
         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.
-        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)
@@ -83,13 +97,64 @@ class WatchpointLLDBCommandTestCase(Test
 
         # Check that the watchpoint snapshoting mechanism is working.
         self.expect("watchpoint list -v",
-            substrs = ['watchpoint old value:', 'global = 0',
-                       'watchpoint new value:', 'global = 1'])
+            substrs = ['old value:', ' = 0',
+                       'new value:', ' = 1'])
 
         # The watchpoint command "forced" our global variable 'cookie' to become 777.
-        self.expect("frame variable -g cookie",
+        self.expect("frame variable --show-globals cookie",
             substrs = ['(int32_t)', 'cookie = 777'])
 
+    def watchpoint_command_can_disable_a_watchpoint(self):
+        """Test that 'watchpoint command' action can disable a watchpoint after it is triggered."""
+        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 write-type watchpoint for 'global'.
+        self.expect("watchpoint set variable -w write global", WATCHPOINT_CREATED,
+            substrs = ['Watchpoint created', 'size = 4', 'type = w',
+                       '%s:%d' % (self.source, self.decl)])
+
+        self.runCmd('watchpoint command add 1 -o "watchpoint disable 1"')
+
+        # List the watchpoint command we just added.
+        self.expect("watchpoint command list 1",
+            substrs = ['watchpoint disable 1'])
+
+        # Use the '-v' option to do verbose listing of the watchpoint.
+        # The hit count should be 0 initially.
+        self.expect("watchpoint list -v",
+            substrs = ['hit_count = 0'])
+
+        self.runCmd("process continue")
+
+        # We should be stopped again due to the watchpoint (write type).
+        # The stop reason of the thread should be watchpoint.
+        self.expect("thread backtrace", STOPPED_DUE_TO_WATCHPOINT,
+            substrs = ['stop reason = watchpoint'])
+
+        # Check that the watchpoint has been disabled.
+        self.expect("watchpoint list -v",
+            substrs = ['disabled'])
+
+        self.runCmd("process continue")
+
+        # There should be no more watchpoint hit and the process status should
+        # be 'exited'.
+        self.expect("process status",
+            substrs = ['exited'])
+
 
 if __name__ == '__main__':
     import atexit

Modified: lldb/branches/lldb-platform-work/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py (original)
+++ lldb/branches/lldb-platform-work/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py Thu Jun  6 19:06:43 2013
@@ -6,6 +6,7 @@ import os, time
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class WatchpointPythonCommandTestCase(TestBase):
 
@@ -45,9 +46,10 @@ class WatchpointPythonCommandTestCase(Te
         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)
@@ -83,11 +85,11 @@ class WatchpointPythonCommandTestCase(Te
 
         # Check that the watchpoint snapshoting mechanism is working.
         self.expect("watchpoint list -v",
-            substrs = ['watchpoint old value:', 'global = 0',
-                       'watchpoint new value:', 'global = 1'])
+            substrs = ['old value:', ' = 0',
+                       'new value:', ' = 1'])
 
         # The watchpoint command "forced" our global variable 'cookie' to become 777.
-        self.expect("frame variable -g cookie",
+        self.expect("frame variable --show-globals cookie",
             substrs = ['(int32_t)', 'cookie = 777'])
 
 

Modified: lldb/branches/lldb-platform-work/test/functionalities/watchpoint/watchpoint_commands/condition/TestWatchpointConditionCmd.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/functionalities/watchpoint/watchpoint_commands/condition/TestWatchpointConditionCmd.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/functionalities/watchpoint/watchpoint_commands/condition/TestWatchpointConditionCmd.py (original)
+++ lldb/branches/lldb-platform-work/test/functionalities/watchpoint/watchpoint_commands/condition/TestWatchpointConditionCmd.py Thu Jun  6 19:06:43 2013
@@ -6,6 +6,7 @@ import os, time
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class WatchpointConditionCmdTestCase(TestBase):
 
@@ -45,9 +46,7 @@ class WatchpointConditionCmdTestCase(Tes
         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)
@@ -77,7 +76,7 @@ class WatchpointConditionCmdTestCase(Tes
         # The stop reason of the thread should be watchpoint.
         self.expect("thread backtrace", STOPPED_DUE_TO_WATCHPOINT,
             substrs = ['stop reason = watchpoint'])
-        self.expect("frame variable -g global",
+        self.expect("frame variable --show-globals global",
             substrs = ['(int32_t)', 'global = 5'])
 
         # Use the '-v' option to do verbose listing of the watchpoint.

Modified: lldb/branches/lldb-platform-work/test/functionalities/watchpoint/watchpoint_set_command/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/functionalities/watchpoint/watchpoint_set_command/Makefile?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/functionalities/watchpoint/watchpoint_set_command/Makefile (original)
+++ lldb/branches/lldb-platform-work/test/functionalities/watchpoint/watchpoint_set_command/Makefile Thu Jun  6 19:06:43 2013
@@ -1,5 +1,6 @@
 LEVEL = ../../../make
 
+LD_EXTRAS := -lpthread
 CXX_SOURCES := main.cpp
 
 include $(LEVEL)/Makefile.rules

Modified: lldb/branches/lldb-platform-work/test/functionalities/watchpoint/watchpoint_set_command/TestWatchLocationWithWatchSet.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/functionalities/watchpoint/watchpoint_set_command/TestWatchLocationWithWatchSet.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/functionalities/watchpoint/watchpoint_set_command/TestWatchLocationWithWatchSet.py (original)
+++ lldb/branches/lldb-platform-work/test/functionalities/watchpoint/watchpoint_set_command/TestWatchLocationWithWatchSet.py Thu Jun  6 19:06:43 2013
@@ -6,6 +6,7 @@ import os, time
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class WatchLocationUsingWatchpointSetTestCase(TestBase):
 
@@ -45,9 +46,7 @@ class WatchLocationUsingWatchpointSetTes
         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/lldb-platform-work/test/functionalities/watchpoint/watchpoint_set_command/TestWatchpointSetErrorCases.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/functionalities/watchpoint/watchpoint_set_command/TestWatchpointSetErrorCases.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/functionalities/watchpoint/watchpoint_set_command/TestWatchpointSetErrorCases.py (original)
+++ lldb/branches/lldb-platform-work/test/functionalities/watchpoint/watchpoint_set_command/TestWatchpointSetErrorCases.py Thu Jun  6 19:06:43 2013
@@ -6,6 +6,7 @@ import os, time
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class WatchpointSetErrorTestCase(TestBase):
 
@@ -34,9 +35,7 @@ class WatchpointSetErrorTestCase(TestBas
         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)
@@ -59,16 +58,12 @@ class WatchpointSetErrorTestCase(TestBas
         # 'watchpoint set expression' with '-w' or '-x' specified now needs
         # an option terminator and a raw expression after that.
         self.expect("watchpoint set expression -w write --", error=True,
-            startstr = 'error: required argument missing; specify an expression to evaulate into the addres to watch for')
+            startstr = 'error: ')
 
         # It's an error if the expression did not evaluate to an address.
         self.expect("watchpoint set expression MyAggregateDataType", error=True,
             startstr = 'error: expression did not evaluate to an address')
 
-        # Check for missing option terminator '--'.
-        self.expect("watchpoint set expression -w write -x 1 g_char_ptr", error=True,
-            startstr = 'error: did you forget to enter the option terminator string "--"?')
-
         # Wrong size parameter is an error.
         self.expect("watchpoint set variable -x -128", error=True,
             substrs = ['invalid enumeration value'])

Modified: lldb/branches/lldb-platform-work/test/help/TestHelp.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/help/TestHelp.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/help/TestHelp.py (original)
+++ lldb/branches/lldb-platform-work/test/help/TestHelp.py Thu Jun  6 19:06:43 2013
@@ -77,8 +77,13 @@ class HelpCommandTestCase(TestBase):
         version_str = self.version_number_string()
         import re
         match = re.match('[0-9]+', version_str)
+        if sys.platform.startswith("darwin"):
+            search_regexp = ['lldb-' + (version_str if match else '[0-9]+')]
+        else:
+            search_regexp = ['lldb version (\d|\.)+.*$']
+
         self.expect("version",
-            patterns = ['LLDB-' + (version_str if match else '[0-9]+')])
+            patterns = search_regexp)
 
     def test_help_should_not_crash_lldb(self):
         """Command 'help disasm' should not crash lldb."""
@@ -87,7 +92,10 @@ class HelpCommandTestCase(TestBase):
 
     def test_help_should_not_hang_emacsshell(self):
         """Command 'settings set term-width 0' should not hang the help command."""
-        self.runCmd("settings set term-width 0")
+        self.expect("settings set term-width 0",
+                    COMMAND_FAILED_AS_EXPECTED, error=True,
+            substrs = ['error: 0 is out of range, valid values must be between'])
+        # self.runCmd("settings set term-width 0")
         self.expect("help",
             startstr = 'The following is a list of built-in, permanent debugger commands')
 

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

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

Modified: lldb/branches/lldb-platform-work/test/lang/c/array_types/TestArrayTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/c/array_types/TestArrayTypes.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/c/array_types/TestArrayTypes.py (original)
+++ lldb/branches/lldb-platform-work/test/lang/c/array_types/TestArrayTypes.py Thu Jun  6 19:06:43 2013
@@ -4,6 +4,7 @@ import os, time
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class ArrayTypesTestCase(TestBase):
 
@@ -48,10 +49,7 @@ class ArrayTypesTestCase(TestBase):
         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)
 
@@ -73,7 +71,7 @@ class ArrayTypesTestCase(TestBase):
 
         # Issue 'variable list' command on several array-type variables.
 
-        self.expect("frame variable -T strings", VARIABLES_DISPLAYED_CORRECTLY,
+        self.expect("frame variable --show-types strings", VARIABLES_DISPLAYED_CORRECTLY,
             startstr = '(char *[4])',
             substrs = ['(char *) [0]',
                        '(char *) [1]',
@@ -84,14 +82,14 @@ class ArrayTypesTestCase(TestBase):
                        'Bonjour',
                        'Guten Tag'])
 
-        self.expect("frame variable -T char_16", VARIABLES_DISPLAYED_CORRECTLY,
+        self.expect("frame variable --show-types --raw -- char_16", VARIABLES_DISPLAYED_CORRECTLY,
             substrs = ['(char) [0]',
                        '(char) [15]'])
 
-        self.expect("frame variable -T ushort_matrix", VARIABLES_DISPLAYED_CORRECTLY,
+        self.expect("frame variable --show-types ushort_matrix", VARIABLES_DISPLAYED_CORRECTLY,
             startstr = '(unsigned short [2][3])')
 
-        self.expect("frame variable -T long_6", VARIABLES_DISPLAYED_CORRECTLY,
+        self.expect("frame variable --show-types long_6", VARIABLES_DISPLAYED_CORRECTLY,
             startstr = '(long [6])')
 
     def array_types_python(self):

Modified: lldb/branches/lldb-platform-work/test/lang/c/bitfields/TestBitfields.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/c/bitfields/TestBitfields.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/c/bitfields/TestBitfields.py (original)
+++ lldb/branches/lldb-platform-work/test/lang/c/bitfields/TestBitfields.py Thu Jun  6 19:06:43 2013
@@ -4,6 +4,7 @@ import os, time
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class BitfieldsTestCase(TestBase):
 
@@ -32,6 +33,7 @@ class BitfieldsTestCase(TestBase):
 
     @python_api_test
     @dwarf_test
+    @expectedFailureGcc # GCC (4.6/4.7) generates incorrect code with unnamed bitfields.
     def test_with_dwarf_and_python_api(self):
         """Use Python APIs to inspect a bitfields variable."""
         self.buildDwarf()
@@ -49,10 +51,7 @@ class BitfieldsTestCase(TestBase):
         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)
 
@@ -66,7 +65,7 @@ class BitfieldsTestCase(TestBase):
             substrs = [' resolved, hit count = 1'])
 
         # This should display correctly.
-        self.expect("frame variable -T bits", VARIABLES_DISPLAYED_CORRECTLY,
+        self.expect("frame variable --show-types bits", VARIABLES_DISPLAYED_CORRECTLY,
             substrs = ['(uint32_t:1) b1 = 1',
                        '(uint32_t:2) b2 = 3',
                        '(uint32_t:3) b3 = 7',
@@ -78,7 +77,7 @@ class BitfieldsTestCase(TestBase):
 
         # And so should this.
         # rdar://problem/8348251
-        self.expect("frame variable -T", VARIABLES_DISPLAYED_CORRECTLY,
+        self.expect("frame variable --show-types", VARIABLES_DISPLAYED_CORRECTLY,
             substrs = ['(uint32_t:1) b1 = 1',
                        '(uint32_t:2) b2 = 3',
                        '(uint32_t:3) b3 = 7',
@@ -88,6 +87,38 @@ class BitfieldsTestCase(TestBase):
                        '(uint32_t:7) b7 = 127',
                        '(uint32_t:4) four = 15'])
 
+        self.expect("expr (bits.b1)", VARIABLES_DISPLAYED_CORRECTLY,
+            substrs = ['uint32_t', '1'])
+        self.expect("expr (bits.b2)", VARIABLES_DISPLAYED_CORRECTLY,
+            substrs = ['uint32_t', '3'])
+        self.expect("expr (bits.b3)", VARIABLES_DISPLAYED_CORRECTLY,
+            substrs = ['uint32_t', '7'])
+        self.expect("expr (bits.b4)", VARIABLES_DISPLAYED_CORRECTLY,
+            substrs = ['uint32_t', '15'])
+        self.expect("expr (bits.b5)", VARIABLES_DISPLAYED_CORRECTLY,
+            substrs = ['uint32_t', '31'])
+        self.expect("expr (bits.b6)", VARIABLES_DISPLAYED_CORRECTLY,
+            substrs = ['uint32_t', '63'])
+        self.expect("expr (bits.b7)", VARIABLES_DISPLAYED_CORRECTLY,
+            substrs = ['uint32_t', '127'])
+        self.expect("expr (bits.four)", VARIABLES_DISPLAYED_CORRECTLY,
+            substrs = ['uint32_t', '15'])
+
+        self.expect("frame variable --show-types more_bits", VARIABLES_DISPLAYED_CORRECTLY,
+            substrs = ['(uint32_t:3) a = 3',
+                       '(uint8_t:1) b = \'\\0\'',
+                       '(uint8_t:1) c = \'\\x01\'',
+                       '(uint8_t:1) d = \'\\0\''])
+
+        self.expect("expr (more_bits.a)", VARIABLES_DISPLAYED_CORRECTLY,
+            substrs = ['uint32_t', '3'])
+        self.expect("expr (more_bits.b)", VARIABLES_DISPLAYED_CORRECTLY,
+            substrs = ['uint8_t', '\\0'])
+        self.expect("expr (more_bits.c)", VARIABLES_DISPLAYED_CORRECTLY,
+            substrs = ['uint8_t', '\\x01'])
+        self.expect("expr (more_bits.d)", VARIABLES_DISPLAYED_CORRECTLY,
+            substrs = ['uint8_t', '\\0'])
+
     def bitfields_variable_python(self):
         """Use Python APIs to inspect a bitfields variable."""
         exe = os.path.join(os.getcwd(), "a.out")
@@ -115,15 +146,14 @@ class BitfieldsTestCase(TestBase):
         frame = thread.GetFrameAtIndex(0)
         bits = frame.FindVariable("bits")
         self.DebugSBValue(bits)
-        self.assertTrue(bits.GetTypeName() == "Bits" and
-                        bits.GetNumChildren() == 8 and
-                        bits.GetByteSize() == 32,
-                        "(Bits)bits with byte size of 32 and 8 children")
+        self.assertTrue(bits.GetTypeName() == 'Bits', "bits.GetTypeName() == 'Bits'");
+        self.assertTrue(bits.GetNumChildren() == 10, "bits.GetNumChildren() == 10");
+        self.assertTrue(bits.GetByteSize() == 32, "bits.GetByteSize() == 32");
 
         # Notice the pattern of int(b1.GetValue(), 0).  We pass a base of 0
         # so that the proper radix is determined based on the contents of the
         # string.
-        b1 = bits.GetChildAtIndex(0)
+        b1 = bits.GetChildMemberWithName("b1")
         self.DebugSBValue(b1)
         self.assertTrue(b1.GetName() == "b1" and
                         b1.GetTypeName() == "uint32_t:1" and
@@ -131,7 +161,7 @@ class BitfieldsTestCase(TestBase):
                         int(b1.GetValue(), 0) == 1,
                         'bits.b1 has type uint32_t:1, is in scope, and == 1')
 
-        b7 = bits.GetChildAtIndex(6)
+        b7 = bits.GetChildMemberWithName("b7")
         self.DebugSBValue(b7)
         self.assertTrue(b7.GetName() == "b7" and
                         b7.GetTypeName() == "uint32_t:7" and
@@ -139,7 +169,7 @@ class BitfieldsTestCase(TestBase):
                         int(b7.GetValue(), 0) == 127,
                         'bits.b7 has type uint32_t:7, is in scope, and == 127')
 
-        four = bits.GetChildAtIndex(7)
+        four = bits.GetChildMemberWithName("four")
         self.DebugSBValue(four)
         self.assertTrue(four.GetName() == "four" and
                         four.GetTypeName() == "uint32_t:4" and

Modified: lldb/branches/lldb-platform-work/test/lang/c/bitfields/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/c/bitfields/main.c?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/c/bitfields/main.c (original)
+++ lldb/branches/lldb-platform-work/test/lang/c/bitfields/main.c Thu Jun  6 19:06:43 2013
@@ -12,9 +12,12 @@ int main (int argc, char const *argv[])
 {
     struct Bits
     {
-        uint32_t    b1 : 1,
+        uint32_t    : 1, // Unnamed bitfield
+                    b1 : 1,
                     b2 : 2,
+                    : 2, // Unnamed bitfield
                     b3 : 3,
+                    : 2, // Unnamed bitfield (this will get removed)
                     b4 __attribute__ ((align(16))),
                     b5 : 5,
                     b6 : 6,
@@ -42,6 +45,23 @@ int main (int argc, char const *argv[])
         bits.b7 = i;        //// break $source:$line
     for (i=0; i<(1<<4); i++)
         bits.four = i;      //// break $source:$line
+
+    struct MoreBits
+    {
+        uint32_t    a : 3;
+        uint8_t       : 1;
+        uint8_t     b : 1;
+        uint8_t     c : 1;
+        uint8_t     d : 1;
+    };
+
+    struct MoreBits more_bits;
+
+    more_bits.a = 3;
+    more_bits.b = 0;
+    more_bits.c = 1;
+    more_bits.d = 0;
+
     return 0;               //// Set break point at this line.
 
 }

Modified: lldb/branches/lldb-platform-work/test/lang/c/blocks/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/c/blocks/Makefile?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/c/blocks/Makefile (original)
+++ lldb/branches/lldb-platform-work/test/lang/c/blocks/Makefile Thu Jun  6 19:06:43 2013
@@ -1,5 +1,6 @@
 LEVEL = ../../../make
 
 C_SOURCES := main.c
+CFLAGS_EXTRAS += -fblocks
 
 include $(LEVEL)/Makefile.rules

Modified: lldb/branches/lldb-platform-work/test/lang/c/blocks/TestBlocks.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/c/blocks/TestBlocks.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/c/blocks/TestBlocks.py (original)
+++ lldb/branches/lldb-platform-work/test/lang/c/blocks/TestBlocks.py Thu Jun  6 19:06:43 2013
@@ -4,6 +4,7 @@ import os, time
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class BlocksTestCase(TestBase):
 
@@ -37,8 +38,7 @@ class BlocksTestCase(TestBase):
 
         # 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/lldb-platform-work/test/lang/c/enum_types/TestEnumTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/c/enum_types/TestEnumTypes.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/c/enum_types/TestEnumTypes.py (original)
+++ lldb/branches/lldb-platform-work/test/lang/c/enum_types/TestEnumTypes.py Thu Jun  6 19:06:43 2013
@@ -4,6 +4,7 @@ import os, time
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class EnumTypesTestCase(TestBase):
 
@@ -12,7 +13,7 @@ class EnumTypesTestCase(TestBase):
     @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
     @dsym_test
     def test_with_dsym(self):
-        """Test 'image lookup -t days' and check for correct display."""
+        """Test 'image lookup -t days' and check for correct display and enum value printing."""
         self.buildDsym()
         self.image_lookup_for_enum_type()
 
@@ -20,7 +21,7 @@ class EnumTypesTestCase(TestBase):
     # 'image lookup -t days' returns nothing with dwarf debug format.
     @dwarf_test
     def test_with_dwarf(self):
-        """Test 'image lookup -t days' and check for correct display."""
+        """Test 'image lookup -t days' and check for correct display and enum value printing."""
         self.buildDwarf()
         self.image_lookup_for_enum_type()
 
@@ -36,10 +37,7 @@ class EnumTypesTestCase(TestBase):
         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)
+        bkpt_id = 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)
 
@@ -56,17 +54,32 @@ class EnumTypesTestCase(TestBase):
         # Check for correct display.
         self.expect("image lookup -t days", DATA_TYPES_DISPLAYED_CORRECTLY,
             substrs = ['enum days {',
-                       'Monday,',
+                       'Monday',
                        'Tuesday',
                        'Wednesday',
                        'Thursday',
                        'Friday',
                        'Saturday',
-                       'Sunday,',
+                       'Sunday',
                        'kNumDays',
                        '}'])
 
-
+        enum_values = [ '-4', 
+                        'Monday', 
+                        'Tuesday', 
+                        'Wednesday', 
+                        'Thursday',
+                        'Friday',
+                        'Saturday',
+                        'Sunday',
+                        'kNumDays',
+                        '5'];
+
+        bkpt = self.target().FindBreakpointByID(bkpt_id)
+        for enum_value in enum_values:
+            self.expect("frame variable day", 'check for valid enumeration value',
+                substrs = [enum_value])
+            lldbutil.continue_to_breakpoint (self.process(), bkpt)
 if __name__ == '__main__':
     import atexit
     lldb.SBDebugger.Initialize()

Modified: lldb/branches/lldb-platform-work/test/lang/c/enum_types/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/c/enum_types/main.c?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/c/enum_types/main.c (original)
+++ lldb/branches/lldb-platform-work/test/lang/c/enum_types/main.c Thu Jun  6 19:06:43 2013
@@ -11,7 +11,7 @@
 int main (int argc, char const *argv[])
 {
     enum days {
-        Monday = 10,
+        Monday = -3,
         Tuesday,
         Wednesday,
         Thursday,

Modified: lldb/branches/lldb-platform-work/test/lang/c/forward/TestForwardDeclaration.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/c/forward/TestForwardDeclaration.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/c/forward/TestForwardDeclaration.py (original)
+++ lldb/branches/lldb-platform-work/test/lang/c/forward/TestForwardDeclaration.py Thu Jun  6 19:06:43 2013
@@ -4,6 +4,7 @@ import os, time
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class ForwardDeclarationTestCase(TestBase):
 
@@ -32,8 +33,7 @@ class ForwardDeclarationTestCase(TestBas
         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)
 
@@ -48,13 +48,13 @@ class ForwardDeclarationTestCase(TestBas
 
         # This should display correctly.
         # Note that the member fields of a = 1 and b = 2 is by design.
-        self.expect("frame variable -T *bar_ptr", VARIABLES_DISPLAYED_CORRECTLY,
+        self.expect("frame variable --show-types *bar_ptr", VARIABLES_DISPLAYED_CORRECTLY,
             substrs = ['(bar) *bar_ptr = ',
                        '(int) a = 1',
                        '(int) b = 2'])
 
         # And so should this.
-        self.expect("expression *bar_ptr", VARIABLES_DISPLAYED_CORRECTLY,
+        self.expect("expression --show-types -- *bar_ptr", VARIABLES_DISPLAYED_CORRECTLY,
             substrs = ['(bar)',
                        '(int) a = 1',
                        '(int) b = 2'])

Modified: lldb/branches/lldb-platform-work/test/lang/c/function_types/TestFunctionTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/c/function_types/TestFunctionTypes.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/c/function_types/TestFunctionTypes.py (original)
+++ lldb/branches/lldb-platform-work/test/lang/c/function_types/TestFunctionTypes.py Thu Jun  6 19:06:43 2013
@@ -4,6 +4,7 @@ import os, time
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class FunctionTypesTestCase(TestBase):
 
@@ -46,10 +47,7 @@ class FunctionTypesTestCase(TestBase):
         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)
         
@@ -68,11 +66,11 @@ class FunctionTypesTestCase(TestBase):
         self.runToBreakpoint()
 
         # Check that the 'callback' variable display properly.
-        self.expect("frame variable -T callback", VARIABLES_DISPLAYED_CORRECTLY,
+        self.expect("frame variable --show-types callback", VARIABLES_DISPLAYED_CORRECTLY,
             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/lldb-platform-work/test/lang/c/global_variables/TestGlobalVariables.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/c/global_variables/TestGlobalVariables.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/c/global_variables/TestGlobalVariables.py (original)
+++ lldb/branches/lldb-platform-work/test/lang/c/global_variables/TestGlobalVariables.py Thu Jun  6 19:06:43 2013
@@ -4,6 +4,7 @@ import os, time
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class GlobalVariablesTestCase(TestBase):
 
@@ -12,13 +13,13 @@ class GlobalVariablesTestCase(TestBase):
     @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
     @dsym_test
     def test_with_dsym(self):
-        """Test 'frame variable -s -a' which omits args and shows scopes."""
+        """Test 'frame variable --scope --no-args' which omits args and shows scopes."""
         self.buildDsym()
         self.global_variables()
 
     @dwarf_test
     def test_with_dwarf(self):
-        """Test 'frame variable -s -a' which omits args and shows scopes."""
+        """Test 'frame variable --scope --no-args' which omits args and shows scopes."""
         self.buildDwarf()
         self.global_variables()
 
@@ -27,17 +28,18 @@ class GlobalVariablesTestCase(TestBase):
         TestBase.setUp(self)
         # Find the line number to break inside main().
         self.line = line_number('main.c', '// Set break point at this line.')
+        if sys.platform.startswith("linux"):
+            # On Linux, LD_LIBRARY_PATH must be set so the shared libraries are found on startup
+            self.runCmd("settings set target.env-vars " + self.dylibPath + "=" + os.getcwd())
+            self.addTearDownHook(lambda: self.runCmd("settings remove target.env-vars " + self.dylibPath))
 
     def global_variables(self):
-        """Test 'frame variable -s -a' which omits args and shows scopes."""
+        """Test 'frame variable --scope --no-args' which omits args and shows scopes."""
         exe = os.path.join(os.getcwd(), "a.out")
         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)
 
@@ -51,7 +53,7 @@ class GlobalVariablesTestCase(TestBase):
             substrs = [' resolved, hit count = 1'])
 
         # Check that GLOBAL scopes are indicated for the variables.
-        self.expect("frame variable -T -s -g -a", VARIABLES_DISPLAYED_CORRECTLY,
+        self.expect("frame variable --show-types --scope --show-globals --no-args", VARIABLES_DISPLAYED_CORRECTLY,
             substrs = ['GLOBAL: (int) g_file_global_int = 42',
                        'GLOBAL: (const char *) g_file_global_cstr',
                        '"g_file_global_cstr"',

Modified: lldb/branches/lldb-platform-work/test/lang/c/set_values/TestSetValues.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/c/set_values/TestSetValues.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/c/set_values/TestSetValues.py (original)
+++ lldb/branches/lldb-platform-work/test/lang/c/set_values/TestSetValues.py Thu Jun  6 19:06:43 2013
@@ -4,6 +4,7 @@ import os, time
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class SetValuesTestCase(TestBase):
 
@@ -38,30 +39,15 @@ class SetValuesTestCase(TestBase):
         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)
 
@@ -75,63 +61,63 @@ class SetValuesTestCase(TestBase):
             substrs = [' resolved, hit count = 1'])
 
         # main.c:15
-        # Check that 'frame variable -T' displays the correct data type and value.
-        self.expect("frame variable -T", VARIABLES_DISPLAYED_CORRECTLY,
+        # Check that 'frame variable --show-types' displays the correct data type and value.
+        self.expect("frame variable --show-types", VARIABLES_DISPLAYED_CORRECTLY,
             startstr = "(char) i = 'a'")
 
         # Now set variable 'i' and check that it is correctly displayed.
         self.runCmd("expression i = 'b'")
-        self.expect("frame variable -T", VARIABLES_DISPLAYED_CORRECTLY,
+        self.expect("frame variable --show-types", VARIABLES_DISPLAYED_CORRECTLY,
             startstr = "(char) i = 'b'")
 
         self.runCmd("continue")
 
         # main.c:36
-        # Check that 'frame variable -T' displays the correct data type and value.
-        self.expect("frame variable -T", VARIABLES_DISPLAYED_CORRECTLY,
+        # Check that 'frame variable --show-types' displays the correct data type and value.
+        self.expect("frame variable --show-types", VARIABLES_DISPLAYED_CORRECTLY,
             patterns = ["\((short unsigned int|unsigned short)\) i = 33"])
 
         # Now set variable 'i' and check that it is correctly displayed.
         self.runCmd("expression i = 333")
-        self.expect("frame variable -T", VARIABLES_DISPLAYED_CORRECTLY,
+        self.expect("frame variable --show-types", VARIABLES_DISPLAYED_CORRECTLY,
             patterns = ["\((short unsigned int|unsigned short)\) i = 333"])
 
         self.runCmd("continue")
 
         # main.c:57
-        # Check that 'frame variable -T' displays the correct data type and value.
-        self.expect("frame variable -T", VARIABLES_DISPLAYED_CORRECTLY,
+        # Check that 'frame variable --show-types' displays the correct data type and value.
+        self.expect("frame variable --show-types", VARIABLES_DISPLAYED_CORRECTLY,
             startstr = "(long) i = 33")
 
         # Now set variable 'i' and check that it is correctly displayed.
         self.runCmd("expression i = 33333")
-        self.expect("frame variable -T", VARIABLES_DISPLAYED_CORRECTLY,
+        self.expect("frame variable --show-types", VARIABLES_DISPLAYED_CORRECTLY,
             startstr = "(long) i = 33333")
 
         self.runCmd("continue")
 
         # main.c:78
-        # Check that 'frame variable -T' displays the correct data type and value.
-        self.expect("frame variable -T", VARIABLES_DISPLAYED_CORRECTLY,
+        # Check that 'frame variable --show-types' displays the correct data type and value.
+        self.expect("frame variable --show-types", VARIABLES_DISPLAYED_CORRECTLY,
             startstr = "(double) i = 3.14159")
 
         # Now set variable 'i' and check that it is correctly displayed.
         self.runCmd("expression i = 3.14")
-        self.expect("frame variable -T", VARIABLES_DISPLAYED_CORRECTLY,
+        self.expect("frame variable --show-types", VARIABLES_DISPLAYED_CORRECTLY,
             startstr = "(double) i = 3.14")
 
         self.runCmd("continue")
 
         # main.c:85
-        # Check that 'frame variable -T' displays the correct data type and value.
+        # Check that 'frame variable --show-types' displays the correct data type and value.
         # rdar://problem/8422727
         # set_values test directory: 'frame variable' shows only (long double) i =
-        self.expect("frame variable -T", VARIABLES_DISPLAYED_CORRECTLY,
+        self.expect("frame variable --show-types", VARIABLES_DISPLAYED_CORRECTLY,
             startstr = "(long double) i = 3.14159")
 
         # Now set variable 'i' and check that it is correctly displayed.
         self.runCmd("expression i = 3.1")
-        self.expect("frame variable -T", VARIABLES_DISPLAYED_CORRECTLY,
+        self.expect("frame variable --show-types", VARIABLES_DISPLAYED_CORRECTLY,
             startstr = "(long double) i = 3.1")
 
 

Modified: lldb/branches/lldb-platform-work/test/lang/c/shared_lib/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/c/shared_lib/Makefile?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/c/shared_lib/Makefile (original)
+++ lldb/branches/lldb-platform-work/test/lang/c/shared_lib/Makefile Thu Jun  6 19:06:43 2013
@@ -3,5 +3,6 @@ LEVEL = ../../../make
 DYLIB_NAME := libfoo
 DYLIB_C_SOURCES := foo.c
 C_SOURCES := main.c
+CFLAGS_EXTRAS += -fPIC
 
 include $(LEVEL)/Makefile.rules

Modified: lldb/branches/lldb-platform-work/test/lang/c/shared_lib/TestSharedLib.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/c/shared_lib/TestSharedLib.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/c/shared_lib/TestSharedLib.py (original)
+++ lldb/branches/lldb-platform-work/test/lang/c/shared_lib/TestSharedLib.py Thu Jun  6 19:06:43 2013
@@ -4,6 +4,7 @@ import os, time
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class SharedLibTestCase(TestBase):
 
@@ -38,14 +39,16 @@ class SharedLibTestCase(TestBase):
         TestBase.setUp(self)
         # Find the line number to break inside main().
         self.line = line_number('main.c', '// Set breakpoint 0 here.')
+        if sys.platform.startswith("linux"):
+            self.runCmd("settings set target.env-vars " + self.dylibPath + "=" + os.getcwd())
+            self.addTearDownHook(lambda: self.runCmd("settings remove target.env-vars " + self.dylibPath))
 
     def common_setup(self):
         exe = os.path.join(os.getcwd(), "a.out")
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Break inside the foo function which takes a bar_ptr argument.
-        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)
 
@@ -63,7 +66,7 @@ class SharedLibTestCase(TestBase):
 	self.common_setup()
 
         # This should display correctly.
-        self.expect("expression *my_foo_ptr", VARIABLES_DISPLAYED_CORRECTLY,
+        self.expect("expression --show-types -- *my_foo_ptr", VARIABLES_DISPLAYED_CORRECTLY,
             substrs = ["(foo)", "(sub_foo)", "other_element = 3"])
 
     @unittest2.expectedFailure
@@ -73,7 +76,7 @@ class SharedLibTestCase(TestBase):
 	self.common_setup()
 
         # This should display correctly.
-        self.expect("frame variable *my_foo_ptr", VARIABLES_DISPLAYED_CORRECTLY,
+        self.expect("frame variable --show-types -- *my_foo_ptr", VARIABLES_DISPLAYED_CORRECTLY,
             substrs = ["(foo)", "(sub_foo)", "other_element = 3"])
                        
 if __name__ == '__main__':

Modified: lldb/branches/lldb-platform-work/test/lang/c/shared_lib/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/c/shared_lib/main.c?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/c/shared_lib/main.c (original)
+++ lldb/branches/lldb-platform-work/test/lang/c/shared_lib/main.c Thu Jun  6 19:06:43 2013
@@ -6,8 +6,8 @@ main ()
 {
   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/lldb-platform-work/test/lang/c/stepping/TestStepAndBreakpoints.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/c/stepping/TestStepAndBreakpoints.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/c/stepping/TestStepAndBreakpoints.py (original)
+++ lldb/branches/lldb-platform-work/test/lang/c/stepping/TestStepAndBreakpoints.py Thu Jun  6 19:06:43 2013
@@ -10,6 +10,9 @@ class TestObjCStepping(TestBase):
 
     mydir = os.path.join("lang", "c", "stepping")
 
+    def getCategories(self):
+        return ['basic_process']
+
     @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
     @python_api_test
     @dsym_test
@@ -18,6 +21,7 @@ class TestObjCStepping(TestBase):
         self.buildDsym()
         self.step_over_stepping()
 
+    @expectedFailureLinux # llvm.org/pr14437
     @python_api_test
     @dwarf_test
     def test_with_dwarf_and_python_api(self):
@@ -71,6 +75,9 @@ class TestObjCStepping(TestBase):
 
         thread = threads[0]
 
+        # Get the stop id and for fun make sure it increases:
+        old_stop_id = process.GetStopID()
+
         # Now step over, which should cause us to hit the breakpoint in "a"
         thread.StepOver()
 
@@ -79,6 +86,10 @@ class TestObjCStepping(TestBase):
         if len(threads) != 1:
             self.fail ("Failed to stop at breakpoint in a.")
 
+        # Check that the stop ID increases:
+        new_stop_id = process.GetStopID()
+        self.assertTrue(new_stop_id > old_stop_id, "Stop ID increases monotonically.")
+
         thread = threads[0]
 
         # Step over, and we should hit the breakpoint in b:
@@ -98,13 +109,25 @@ class TestObjCStepping(TestBase):
         current_bp.append(thread.GetStopReasonDataAtIndex(0))
         current_bp.append(thread.GetStopReasonDataAtIndex(1))
 
-        frame.EvaluateExpression ('(int) printf ("aaaaaaaaaa\n")')
+        stop_id_before_expression = process.GetStopID()
+        stop_id_before_including_expressions = process.GetStopID(True)
+
+        frame.EvaluateExpression ("(int) printf (print_string)")
 
         frame = thread.GetFrameAtIndex(0)
         self.assertTrue (current_line == frame.GetLineEntry().GetLine(), "The line stayed the same after expression.")
         self.assertTrue (current_file == frame.GetLineEntry().GetFileSpec(), "The file stayed the same after expression.")
         self.assertTrue (thread.GetStopReason() == lldb.eStopReasonBreakpoint, "We still say we stopped for a breakpoint.")
         self.assertTrue (thread.GetStopReasonDataAtIndex(0) == current_bp[0] and thread.GetStopReasonDataAtIndex(1) == current_bp[1], "And it is the same breakpoint.")
+        
+        # Also make sure running the expression didn't change the public stop id
+        # but did change if we are asking for expression stops as well.
+        stop_id_after_expression = process.GetStopID()
+        stop_id_after_including_expressions = process.GetStopID(True)
+
+        self.assertTrue (stop_id_before_expression == stop_id_after_expression, "Expression calling doesn't change stop ID")
+
+        self.assertTrue (stop_id_after_including_expressions > stop_id_before_including_expressions, "Stop ID including expressions increments over expression call.")
 
         # Do the same thing with an expression that's going to crash, and make sure we are still unchanged.
 
@@ -160,6 +183,71 @@ class TestObjCStepping(TestBase):
         self.assertTrue (thread.GetFrameAtIndex(0).GetLineEntry().GetLine() == current_line)
         self.assertTrue (thread.GetFrameAtIndex(0).GetLineEntry().GetFileSpec() == current_file)
 
+        # Now we are going to test step in targetting a function:
+
+        break_in_b.SetEnabled (False)
+
+        break_before_complex_1 = target.BreakpointCreateBySourceRegex ('// Stop here to try step in targetting b.', self.main_source_spec)
+        self.assertTrue(break_before_complex_1, VALID_BREAKPOINT)
+
+        break_before_complex_2 = target.BreakpointCreateBySourceRegex ('// Stop here to try step in targetting complex.', self.main_source_spec)
+        self.assertTrue(break_before_complex_2, VALID_BREAKPOINT)
+
+        break_before_complex_3 = target.BreakpointCreateBySourceRegex ('// Stop here to step targetting b and hitting breakpoint.', self.main_source_spec)
+        self.assertTrue(break_before_complex_3, VALID_BREAKPOINT)
+
+        break_before_complex_4 = target.BreakpointCreateBySourceRegex ('// Stop here to make sure bogus target steps over.', self.main_source_spec)
+        self.assertTrue(break_before_complex_4, VALID_BREAKPOINT)
+
+        threads = lldbutil.continue_to_breakpoint(process, break_before_complex_1)
+        self.assertTrue (len(threads) == 1)
+        thread = threads[0]
+        break_before_complex_1.SetEnabled(False)
+
+        thread.StepInto ("b")
+        self.assertTrue (thread.GetFrameAtIndex(0).GetFunctionName() == "b")
+
+        # Now continue out and stop at the next call to complex.  This time step all the way into complex:
+        threads = lldbutil.continue_to_breakpoint (process, break_before_complex_2)
+        self.assertTrue (len(threads) == 1)
+        thread = threads[0]
+        break_before_complex_2.SetEnabled(False)
+
+        thread.StepInto ("complex")
+        self.assertTrue (thread.GetFrameAtIndex(0).GetFunctionName() == "complex")
+        
+        # Now continue out and stop at the next call to complex.  This time enable breakpoints in a and c and then step targetting b:
+        threads = lldbutil.continue_to_breakpoint (process, break_before_complex_3)
+        self.assertTrue (len(threads) == 1)
+        thread = threads[0]
+        break_before_complex_3.SetEnabled(False)
+
+        break_at_start_of_a = target.BreakpointCreateByName ('a')
+        break_at_start_of_c = target.BreakpointCreateByName ('c')
+
+        thread.StepInto ("b")
+        threads = lldbutil.get_stopped_threads(process, lldb.eStopReasonBreakpoint);
+
+        self.assertTrue (len(threads) == 1)
+        thread = threads[0]
+        stop_break_id = thread.GetStopReasonDataAtIndex(0)
+        self.assertTrue(stop_break_id == break_at_start_of_a.GetID() or stop_break_id == break_at_start_of_c.GetID())
+
+        break_at_start_of_a.SetEnabled(False)
+        break_at_start_of_c.SetEnabled(False)
+
+        process.Continue()
+        self.assertTrue (thread.GetFrameAtIndex(0).GetFunctionName() == "b")
+        
+        # Now continue out and stop at the next call to complex.  This time enable breakpoints in a and c and then step targetting b:
+        threads = lldbutil.continue_to_breakpoint (process, break_before_complex_4)
+        self.assertTrue (len(threads) == 1)
+        thread = threads[0]
+        break_before_complex_4.SetEnabled(False)
+
+        thread.StepInto("NoSuchFunction")
+        self.assertTrue (thread.GetFrameAtIndex(0).GetFunctionName() == "main")
+        
 if __name__ == '__main__':
     import atexit
     lldb.SBDebugger.Initialize()

Modified: lldb/branches/lldb-platform-work/test/lang/c/stepping/TestThreadStepping.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/c/stepping/TestThreadStepping.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/c/stepping/TestThreadStepping.py (original)
+++ lldb/branches/lldb-platform-work/test/lang/c/stepping/TestThreadStepping.py Thu Jun  6 19:06:43 2013
@@ -7,6 +7,7 @@ import re
 import unittest2
 import lldb, lldbutil
 from lldbtest import *
+import lldbutil
 
 class ThreadSteppingTestCase(TestBase):
 
@@ -40,9 +41,7 @@ class ThreadSteppingTestCase(TestBase):
         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/lldb-platform-work/test/lang/c/stepping/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/c/stepping/main.c?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/c/stepping/main.c (original)
+++ lldb/branches/lldb-platform-work/test/lang/c/stepping/main.c Thu Jun  6 19:06:43 2013
@@ -11,10 +11,11 @@
 int a(int);
 int b(int);
 int c(int);
+const char *print_string = "aaaaaaaaaa\n";
 
 int a(int val)
 {
-    int return_value = val;
+    int return_value = val;  // basic break at the start of b
 
     if (val <= 1)
     {
@@ -39,6 +40,11 @@ int c(int val)
     return val + 3; // Find the line number of function "c" here.
 }
 
+int complex (int first, int second, int third)
+{
+    return first + second + third;  // Step in targetting complex should stop here
+}
+
 int main (int argc, char const *argv[])
 {
     int A1 = a(1); // frame select 2, thread step-out while stopped at "c(1)"
@@ -50,5 +56,14 @@ int main (int argc, char const *argv[])
     int A3 = a(3); // frame select 1, thread step-out while stopped at "c(3)"
     printf("a(3) returns %d\n", A3);
     
+    int A4 = complex (a(1), b(2), c(3)); // Stop here to try step in targetting b.
+
+    int A5 = complex (a(2), b(3), c(4)); // Stop here to try step in targetting complex.
+
+    int A6 = complex (a(4), b(5), c(6)); // Stop here to step targetting b and hitting breakpoint.
+
+    int A7 = complex (a(5), b(6), c(7)); // Stop here to make sure bogus target steps over.
+
+    printf ("I am using print_string: %s.\n", print_string);
     return 0;
 }

Modified: lldb/branches/lldb-platform-work/test/lang/c/strings/TestCStrings.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/c/strings/TestCStrings.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/c/strings/TestCStrings.py (original)
+++ lldb/branches/lldb-platform-work/test/lang/c/strings/TestCStrings.py Thu Jun  6 19:06:43 2013
@@ -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 @@ class CStringsTestCase(TestBase):
         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"""
@@ -43,6 +42,7 @@ class CStringsTestCase(TestBase):
         self.expect("expression -- z[2]",
                     startstr = "(const char) $1 = 'x'")
 
+        # On Linux, the expression below will test GNU indirect function calls.
         self.expect("expression -- (int)strlen(\"hello\")",
                     startstr = "(int) $2 = 5")
 
@@ -52,15 +52,23 @@ class CStringsTestCase(TestBase):
         self.expect("expression -- \"\"[0]",
                     startstr = "(const char) $4 = '\\0'")
 
+        self.expect("expr --raw -- \"hello\"",
+            substrs = ['[0] = \'h\'',
+                       '[5] = \'\\0\''])
+
         self.expect("p \"hello\"",
-            substrs = ['(const char [6]) $', 'hello',
-                       '(const char) [0] = \'h\'',
-                       '(const char) [5] = \'\\0\''])
+            substrs = ['[6]) $', 'hello'])
 
         self.expect("p (char*)\"hello\"",
                     substrs = ['(char *) $', ' = 0x',
                                'hello'])
 
+        self.expect("p (int)strlen(\"\")",
+                    substrs = ['(int) $', ' = 0'])
+
+        self.expect("expression !z",
+                    substrs = ['false'])
+
 if __name__ == '__main__':
     import atexit
     lldb.SBDebugger.Initialize()

Modified: lldb/branches/lldb-platform-work/test/lang/c/struct_types/TestStructTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/c/struct_types/TestStructTypes.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/c/struct_types/TestStructTypes.py (original)
+++ lldb/branches/lldb-platform-work/test/lang/c/struct_types/TestStructTypes.py Thu Jun  6 19:06:43 2013
@@ -8,11 +8,13 @@ import os, time
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class StructTypesTestCase(TestBase):
 
     mydir = os.path.join("lang", "c", "struct_types")
 
+    # rdar://problem/12566646
     @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
     @dsym_test
     def test_with_dsym(self):
@@ -20,6 +22,7 @@ class StructTypesTestCase(TestBase):
         self.buildDsym()
         self.struct_types()
 
+    # rdar://problem/12566646
     @dwarf_test
     def test_with_dwarf(self):
         """Test that break on a struct declaration has no effect."""
@@ -30,22 +33,31 @@ class StructTypesTestCase(TestBase):
         # Call super's setUp().
         TestBase.setUp(self)
         # Find the line number to break for main.c.
-        self.line = line_number('main.c', '// Set break point at this line.')
-        self.first_executable_line = line_number('main.c',
+        self.source = 'main.c'
+        self.line = line_number(self.source, '// Set break point at this line.')
+        self.first_executable_line = line_number(self.source,
                                                  '// This is the first executable statement.')
+        self.return_line = line_number(self.source, '// This is the return statement.')
 
     def struct_types(self):
-        """Test that break on a struct declaration has no effect."""
+        """Test that break on a struct declaration has no effect and test structure access for zero sized arrays."""
         exe = os.path.join(os.getcwd(), "a.out")
-        self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+
+        # Create a target by the debugger.
+        target = self.dbg.CreateTarget(exe)
+        self.assertTrue(target, VALID_TARGET)
 
         # 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)
+        lldbutil.run_break_set_by_file_and_line (self, "main.c", self.return_line, num_expected_locations=1, loc_exact=True)
+
+        # Now launch the process, and do not stop at entry point.
+        process = target.LaunchSimple(None, None, os.getcwd())
 
-        self.runCmd("run", RUN_SUCCEEDED)
+        if not process:
+            self.fail("SBTarget.Launch() failed")
+
+        thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
 
         # We should be stopped on the first executable statement within the
         # function where the original breakpoint was attempted.
@@ -57,6 +69,28 @@ class StructTypesTestCase(TestBase):
         self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
             substrs = [' resolved, hit count = 1'])
 
+        process.Continue()
+        thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+
+        # Test zero length array access and make sure it succeeds with "frame variable"
+        self.expect("frame variable pt.padding[0]",
+            DATA_TYPES_DISPLAYED_CORRECTLY,
+            substrs = ["pt.padding[0] = '"])
+        self.expect("frame variable pt.padding[1]",
+            DATA_TYPES_DISPLAYED_CORRECTLY,
+            substrs = ["pt.padding[1] = '"])
+        # Test zero length array access and make sure it succeeds with "expression"
+        self.expect("expression -- (pt.padding[0])",
+            DATA_TYPES_DISPLAYED_CORRECTLY,
+            substrs = ["(char)", " = '"])
+
+        # The padding should be an array of size 0
+        self.expect("image lookup -t point_tag",
+            DATA_TYPES_DISPLAYED_CORRECTLY,
+            substrs = ['padding[]']) # Once rdar://problem/12566646 is fixed, this should display correctly
+
+        self.expect("expression -- &pt == (struct point_tag*)0",
+                    substrs = ['false'])
 
 if __name__ == '__main__':
     import atexit

Modified: lldb/branches/lldb-platform-work/test/lang/c/struct_types/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/c/struct_types/main.c?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/c/struct_types/main.c (original)
+++ lldb/branches/lldb-platform-work/test/lang/c/struct_types/main.c Thu Jun  6 19:06:43 2013
@@ -10,15 +10,15 @@ int main (int argc, char const *argv[])
 {
     struct point_tag {
         int x;
-        char padding[0];
         int y;
+        char padding[0];
     }; // Set break point at this line.
 
     struct rect_tag {
         struct point_tag bottom_left;
         struct point_tag top_right;
     };
-    struct point_tag pt = { 2, {}, 3 }; // This is the first executable statement.
-    struct rect_tag rect = {{1, {}, 2}, {3, {}, 4}};
-    return 0;
+    struct point_tag pt = { 2, 3, {} }; // This is the first executable statement.
+    struct rect_tag rect = {{1, 2, {}}, {3, 4, {}}};
+    return 0; // This is the return statement.
 }

Modified: lldb/branches/lldb-platform-work/test/lang/cpp/class_static/TestStaticVariables.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/cpp/class_static/TestStaticVariables.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/cpp/class_static/TestStaticVariables.py (original)
+++ lldb/branches/lldb-platform-work/test/lang/cpp/class_static/TestStaticVariables.py Thu Jun  6 19:06:43 2013
@@ -6,6 +6,7 @@ import os, time
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class StaticVariableTestCase(TestBase):
 
@@ -18,6 +19,7 @@ class StaticVariableTestCase(TestBase):
         self.buildDsym()
         self.static_variable_commands()
 
+    @expectedFailureLinux # llvm.org/pr15261: lldb on Linux does not display the size of (class or file)static arrays
     @dwarf_test
     def test_with_dwarf_and_run_command(self):
         """Test that file and class static variables display correctly."""
@@ -25,8 +27,8 @@ class StaticVariableTestCase(TestBase):
         self.static_variable_commands()
 
     @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
-    #rdar://problem/9980907
-    @expectedFailureClang
+    @expectedFailureClang(9980907)
+    @expectedFailureGcc(9980907)
     @python_api_test
     @dsym_test
     def test_with_dsym_and_python_api(self):
@@ -34,8 +36,7 @@ class StaticVariableTestCase(TestBase):
         self.buildDsym()
         self.static_variable_python()
 
-    #rdar://problem/9980907
-    @expectedFailureClang
+    @expectedFailureClang(9980907)
     @python_api_test
     @dwarf_test
     def test_with_dwarf_and_python_api(self):
@@ -53,10 +54,7 @@ class StaticVariableTestCase(TestBase):
         """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)
 
@@ -109,13 +107,14 @@ class StaticVariableTestCase(TestBase):
 
         for val in valList:
             self.DebugSBValue(val)
-            self.assertTrue(val.GetValueType() == lldb.eValueTypeVariableGlobal)
             name = val.GetName()
             self.assertTrue(name in ['g_points', 'A::g_points'])
             if name == 'g_points':
+                self.assertTrue(val.GetValueType() == lldb.eValueTypeVariableStatic)
                 self.assertTrue(val.GetNumChildren() == 2)
             elif name == 'A::g_points' and self.getCompiler() in ['clang', 'llvm-gcc']:
                 # On Mac OS X, gcc 4.2 emits the wrong debug info for A::g_points.        
+                self.assertTrue(val.GetValueType() == lldb.eValueTypeVariableGlobal)
                 self.assertTrue(val.GetNumChildren() == 2)
                 child1 = val.GetChildAtIndex(1)
                 self.DebugSBValue(child1)

Modified: lldb/branches/lldb-platform-work/test/lang/cpp/class_types/TestClassTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/cpp/class_types/TestClassTypes.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/cpp/class_types/TestClassTypes.py (original)
+++ lldb/branches/lldb-platform-work/test/lang/cpp/class_types/TestClassTypes.py Thu Jun  6 19:06:43 2013
@@ -5,6 +5,7 @@ import unittest2
 import lldb
 import lldbutil
 from lldbtest import *
+import lldbutil
 
 class ClassTypesTestCase(TestBase):
 
@@ -70,10 +71,7 @@ class ClassTypesTestCase(TestBase):
         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)
 
@@ -94,7 +92,7 @@ class ClassTypesTestCase(TestBase):
             substrs = [' resolved, hit count = 1'])
 
         # We should be stopped on the ctor function of class C.
-        self.expect("frame variable -T this", VARIABLES_DISPLAYED_CORRECTLY,
+        self.expect("frame variable --show-types this", VARIABLES_DISPLAYED_CORRECTLY,
             substrs = ['C *',
                        ' this = '])
 
@@ -169,8 +167,7 @@ class ClassTypesTestCase(TestBase):
         #    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)
 
@@ -191,10 +188,10 @@ class ClassTypesTestCase(TestBase):
         self.expect("frame variable this",VARIABLES_DISPLAYED_CORRECTLY,
             substrs = ['C *'])
 
-        # Verify that frame variable -T this->m_c_int behaves correctly.
+        # Verify that frame variable --show-types this->m_c_int behaves correctly.
         self.runCmd("register read pc")
         self.runCmd("expr m_c_int")
-        self.expect("frame variable -T this->m_c_int", VARIABLES_DISPLAYED_CORRECTLY,
+        self.expect("frame variable --show-types this->m_c_int", VARIABLES_DISPLAYED_CORRECTLY,
             startstr = '(int) this->m_c_int = 66')
 
         # Verify that 'expression this' gets the data type correct.

Modified: lldb/branches/lldb-platform-work/test/lang/cpp/class_types/TestClassTypesDisassembly.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/cpp/class_types/TestClassTypesDisassembly.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/cpp/class_types/TestClassTypesDisassembly.py (original)
+++ lldb/branches/lldb-platform-work/test/lang/cpp/class_types/TestClassTypesDisassembly.py Thu Jun  6 19:06:43 2013
@@ -6,6 +6,7 @@ import os, time
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class IterateFrameAndDisassembleTestCase(TestBase):
 
@@ -19,6 +20,7 @@ class IterateFrameAndDisassembleTestCase
         self.disassemble_call_stack()
 
     @dwarf_test
+    @expectedFailureLinux # due to llvm.org/pr14540
     def test_with_dwarf_and_run_command(self):
         """Disassemble each call frame when stopped on C's constructor."""
         self.buildDwarf()
@@ -34,6 +36,7 @@ class IterateFrameAndDisassembleTestCase
 
     @python_api_test
     @dwarf_test
+    @expectedFailureLinux # due to llvm.org/pr14540
     def test_with_dwarf_and_python_api(self):
         """Disassemble each call frame when stopped on C's constructor."""
         self.buildDwarf()
@@ -51,10 +54,7 @@ class IterateFrameAndDisassembleTestCase
         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/lldb-platform-work/test/lang/cpp/dynamic-value/TestDynamicValue.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/cpp/dynamic-value/TestDynamicValue.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/cpp/dynamic-value/TestDynamicValue.py (original)
+++ lldb/branches/lldb-platform-work/test/lang/cpp/dynamic-value/TestDynamicValue.py Thu Jun  6 19:06:43 2013
@@ -82,9 +82,13 @@ class DynamicValueTestCase(TestBase):
         contained_auto_ptr = this_dynamic.GetChildMemberWithName ('m_client_A', use_dynamic)
         self.assertTrue (contained_auto_ptr)
         contained_b = contained_auto_ptr.GetChildMemberWithName ('_M_ptr', use_dynamic)
+        if not contained_b:
+                contained_b = contained_auto_ptr.GetChildMemberWithName ('__ptr_', use_dynamic)
         self.assertTrue (contained_b)
         
         contained_b_static = contained_auto_ptr.GetChildMemberWithName ('_M_ptr', no_dynamic)
+        if not contained_b_static:
+                contained_b_static = contained_auto_ptr.GetChildMemberWithName ('__ptr_', no_dynamic)
         self.assertTrue (contained_b_static)
         
         contained_b_addr = int (contained_b.GetValue(), 16)
@@ -177,7 +181,7 @@ class DynamicValueTestCase(TestBase):
         # The "frame var" code uses another path to get into children, so let's
         # make sure that works as well:
 
-        self.expect('frame var -d run-target anotherA.m_client_A._M_ptr', 'frame var finds its way into a child member',
+        self.expect('frame var -d run-target --ptr-depth=2 --show-types anotherA.m_client_A', 'frame var finds its way into a child member',
             patterns = ['\(B \*\)'])
 
         # Now make sure we also get it right for a reference as well:

Modified: lldb/branches/lldb-platform-work/test/lang/cpp/dynamic-value/pass-to-base.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/cpp/dynamic-value/pass-to-base.cpp?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/cpp/dynamic-value/pass-to-base.cpp (original)
+++ lldb/branches/lldb-platform-work/test/lang/cpp/dynamic-value/pass-to-base.cpp Thu Jun  6 19:06:43 2013
@@ -23,7 +23,8 @@ public:
   doSomething (A &anotherA)
   {
     printf ("In A %p doing something with %d.\n", this, m_a_value);
-    printf ("Also have another A at %p: %d.\n", &anotherA, anotherA.Value()); // Break here in doSomething.
+    int tmp_value = anotherA.Value();
+    printf ("Also have another A at %p: %d.\n", &anotherA, tmp_value); // Break here in doSomething.
   }
 
   int 

Modified: lldb/branches/lldb-platform-work/test/lang/cpp/namespace/TestNamespace.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/cpp/namespace/TestNamespace.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/cpp/namespace/TestNamespace.py (original)
+++ lldb/branches/lldb-platform-work/test/lang/cpp/namespace/TestNamespace.py Thu Jun  6 19:06:43 2013
@@ -6,6 +6,7 @@ import os, time
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class NamespaceTestCase(TestBase):
 
@@ -20,6 +21,7 @@ class NamespaceTestCase(TestBase):
         self.namespace_variable_commands()
 
     # rdar://problem/8668674
+    @expectedFailureGcc # llvm.org/pr15302: lldb does not print 'anonymous namespace' when the inferior is built with GCC (4.7)
     @dwarf_test
     def test_with_dwarf_and_run_command(self):
         """Test that anonymous and named namespace variables display correctly."""
@@ -42,10 +44,7 @@ class NamespaceTestCase(TestBase):
         """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)
 
@@ -68,12 +67,12 @@ class NamespaceTestCase(TestBase):
             substrs = slist)
 
         # 'frame variable' with basename 'i' should work.
-        self.expect("frame variable -c -g i",
+        self.expect("frame variable --show-declaration --show-globals i",
             startstr = "main.cpp:%d: (int) (anonymous namespace)::i = 3" % self.line_var_i)
         # main.cpp:12: (int) (anonymous namespace)::i = 3
 
         # 'frame variable' with basename 'j' should work, too.
-        self.expect("frame variable -c -g j",
+        self.expect("frame variable --show-declaration --show-globals j",
             startstr = "main.cpp:%d: (int) A::B::j = 4" % self.line_var_j)
         # main.cpp:19: (int) A::B::j = 4
 
@@ -107,6 +106,16 @@ class NamespaceTestCase(TestBase):
         self.expect("expression -- A::B::j", VARIABLES_DISPLAYED_CORRECTLY,
             patterns = [' = 4$'])
 
+        # expression command with function in anonymous namespace
+        self.expect("expression -- myanonfunc(3)",
+            patterns = [' = 6'])
+
+        # global namespace qualification with function in anonymous namespace
+        self.expect("expression -- ::myanonfunc(4)",
+            patterns = [' = 8'])
+
+        self.expect("p myanonfunc",
+            patterns = ['\(anonymous namespace\)::myanonfunc\(int\)'])
 
 if __name__ == '__main__':
     import atexit

Modified: lldb/branches/lldb-platform-work/test/lang/cpp/namespace/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/cpp/namespace/main.cpp?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/cpp/namespace/main.cpp (original)
+++ lldb/branches/lldb-platform-work/test/lang/cpp/namespace/main.cpp Thu Jun  6 19:06:43 2013
@@ -10,6 +10,11 @@
 namespace {
     typedef unsigned int my_uint_t;
     int i; // Find the line number for anonymous namespace variable i.
+
+    int myanonfunc (int a)
+    {
+        return a + a;
+    }
 }
 
 namespace A {
@@ -62,6 +67,7 @@ int Foo::myfunc(int a)
     j = 4;
     printf("::i=%d\n", ::i);
     printf("A::B::j=%d\n", A::B::j);
+    myanonfunc(3);
     return myfunc2(3) + j + i + a + 2 + anon_uint + a_uint + b_uint + y_uint; // Set break point at this line.
 }
 

Modified: lldb/branches/lldb-platform-work/test/lang/cpp/rvalue-references/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/cpp/rvalue-references/Makefile?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/cpp/rvalue-references/Makefile (original)
+++ lldb/branches/lldb-platform-work/test/lang/cpp/rvalue-references/Makefile Thu Jun  6 19:06:43 2013
@@ -2,6 +2,6 @@ LEVEL = ../../../make
 
 CXX_SOURCES := main.cpp
 
-CXXFLAGS = -std=c++11
-
 include $(LEVEL)/Makefile.rules
+
+CXXFLAGS += -std=c++11

Modified: lldb/branches/lldb-platform-work/test/lang/cpp/rvalue-references/TestRvalueReferences.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/cpp/rvalue-references/TestRvalueReferences.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/cpp/rvalue-references/TestRvalueReferences.py (original)
+++ lldb/branches/lldb-platform-work/test/lang/cpp/rvalue-references/TestRvalueReferences.py Thu Jun  6 19:06:43 2013
@@ -2,7 +2,9 @@
 Tests that rvalue references are supported in C++
 """
 
+import lldb
 from lldbtest import *
+import lldbutil
 
 class CPPThisTestCase(TestBase):
     
@@ -19,6 +21,7 @@ class CPPThisTestCase(TestBase):
 
     #rdar://problem/11479676
     @expectedFailureClang
+    @expectedFailureGcc # GCC (4.7) does not emit correct DWARF tags for rvalue-references
     @dwarf_test
     def test_with_dwarf_and_run_command(self):
         """Test that rvalues are supported in the C++ expression parser"""
@@ -29,10 +32,8 @@ class CPPThisTestCase(TestBase):
         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/lldb-platform-work/test/lang/cpp/signed_types/TestSignedTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/cpp/signed_types/TestSignedTypes.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/cpp/signed_types/TestSignedTypes.py (original)
+++ lldb/branches/lldb-platform-work/test/lang/cpp/signed_types/TestSignedTypes.py Thu Jun  6 19:06:43 2013
@@ -7,6 +7,7 @@ import re
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class UnsignedTypesTestCase(TestBase):
 
@@ -37,10 +38,7 @@ class UnsignedTypesTestCase(TestBase):
         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)
 
@@ -56,7 +54,7 @@ class UnsignedTypesTestCase(TestBase):
         self.runCmd("thread step-over")
 
         # Test that signed types display correctly.
-        self.expect("frame variable -T -a", VARIABLES_DISPLAYED_CORRECTLY,
+        self.expect("frame variable --show-types --no-args", VARIABLES_DISPLAYED_CORRECTLY,
             patterns = ["\((short int|short)\) the_signed_short = 99"],
             substrs = ["(signed char) the_signed_char = 'c'",
                        "(int) the_signed_int = 99",

Modified: lldb/branches/lldb-platform-work/test/lang/cpp/static_methods/TestCPPStaticMethods.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/cpp/static_methods/TestCPPStaticMethods.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/cpp/static_methods/TestCPPStaticMethods.py (original)
+++ lldb/branches/lldb-platform-work/test/lang/cpp/static_methods/TestCPPStaticMethods.py Thu Jun  6 19:06:43 2013
@@ -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 @@ class CPPStaticMethodsTestCase(TestBase)
         """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/lldb-platform-work/test/lang/cpp/stl/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/cpp/stl/Makefile?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/cpp/stl/Makefile (original)
+++ lldb/branches/lldb-platform-work/test/lang/cpp/stl/Makefile Thu Jun  6 19:06:43 2013
@@ -1,7 +1,7 @@
 LEVEL = ../../../make
 
 CXX_SOURCES := main.cpp
-CFLAGS :=-arch x86_64 -gdwarf-2 -O0
+CFLAGS := -g -O0
 
 clean: OBJECTS+=$(wildcard main.d.*)
 

Modified: lldb/branches/lldb-platform-work/test/lang/cpp/stl/TestSTL.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/cpp/stl/TestSTL.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/cpp/stl/TestSTL.py (original)
+++ lldb/branches/lldb-platform-work/test/lang/cpp/stl/TestSTL.py Thu Jun  6 19:06:43 2013
@@ -36,6 +36,7 @@ class STLTestCase(TestBase):
         self.buildDsym()
         self.sbtype_template_apis()
 
+    @skipIfGcc # llvm.org/pr15036: crashes during DWARF parsing when built with GCC
     @python_api_test
     @dwarf_test
     def test_SBType_template_aspects_with_dwarf(self):
@@ -63,10 +64,7 @@ class STLTestCase(TestBase):
         # 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)
 
@@ -113,7 +111,7 @@ class STLTestCase(TestBase):
         # Get Frame #0.
         self.assertTrue(process.GetState() == lldb.eStateStopped)
         thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
-        self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint condition")
+        self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
         frame0 = thread.GetFrameAtIndex(0)
 
         # Get the type for variable 'associative_array'.

Modified: lldb/branches/lldb-platform-work/test/lang/cpp/stl/TestStdCXXDisassembly.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/cpp/stl/TestStdCXXDisassembly.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/cpp/stl/TestStdCXXDisassembly.py (original)
+++ lldb/branches/lldb-platform-work/test/lang/cpp/stl/TestStdCXXDisassembly.py Thu Jun  6 19:06:43 2013
@@ -6,6 +6,7 @@ import os, time
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class StdCXXDisassembleTestCase(TestBase):
 
@@ -31,10 +32,7 @@ class StdCXXDisassembleTestCase(TestBase
         # 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/lldb-platform-work/test/lang/cpp/stl/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/cpp/stl/main.cpp?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/cpp/stl/main.cpp (original)
+++ lldb/branches/lldb-platform-work/test/lang/cpp/stl/main.cpp Thu Jun  6 19:06:43 2013
@@ -6,6 +6,7 @@
 // License. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+#include <cstdio>
 #include <iostream>
 #include <string>
 #include <map>

Modified: lldb/branches/lldb-platform-work/test/lang/cpp/this/TestCPPThis.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/cpp/this/TestCPPThis.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/cpp/this/TestCPPThis.py (original)
+++ lldb/branches/lldb-platform-work/test/lang/cpp/this/TestCPPThis.py Thu Jun  6 19:06:43 2013
@@ -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):
     
@@ -18,7 +19,7 @@ class CPPThisTestCase(TestBase):
         self.static_method_commands()
 
     #rdar://problem/9962849
-    #@expectedFailureClang
+    @expectedFailureGcc # llvm.org/pr15439 The 'this' pointer isn't available during expression evaluation when stopped in an inlined member function.
     @dwarf_test
     def test_with_dwarf_and_run_command(self):
         """Test that the appropriate member variables are available when stopped in C++ static, inline, and const methods"""
@@ -29,10 +30,8 @@ class CPPThisTestCase(TestBase):
         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/lldb-platform-work/test/lang/cpp/this/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/cpp/this/main.cpp?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/cpp/this/main.cpp (original)
+++ lldb/branches/lldb-platform-work/test/lang/cpp/this/main.cpp Thu Jun  6 19:06:43 2013
@@ -9,45 +9,45 @@
 
 #include <stdio.h>
 
-class A
+template <class T> class A
 {
 public:
-  void accessMember(int a);
-  int accessMemberConst() const;
+  void accessMember(T a);
+  T accessMemberConst() const;
   static int accessStaticMember();
 
-  void accessMemberInline(int a) __attribute__ ((always_inline))
+  void accessMemberInline(T a) __attribute__ ((always_inline))
   {
     m_a = a; // breakpoint 4
   }
 
-  int m_a;
+  T m_a;
   static int s_a;
 };
 
-int A::s_a = 5;
+template <class T> int A<T>::s_a = 5;
 
-void A::accessMember(int a)
+template <class T> void A<T>::accessMember(T a)
 {
   m_a = a; // breakpoint 1
 }
 
-int A::accessMemberConst() const
+template <class T> T A<T>::accessMemberConst() const
 {
   return m_a; // breakpoint 2
 }
 
-int A::accessStaticMember()
+template <class T> int A<T>::accessStaticMember()
 {
   return s_a; // breakpoint 3
 } 
 
 int main()
 {
-  A my_a;
+  A<int> my_a;
 
   my_a.accessMember(3);
   my_a.accessMemberConst();
-  A::accessStaticMember();
+  A<int>::accessStaticMember();
   my_a.accessMemberInline(5);
 }

Modified: lldb/branches/lldb-platform-work/test/lang/cpp/unique-types/TestUniqueTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/cpp/unique-types/TestUniqueTypes.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/cpp/unique-types/TestUniqueTypes.py (original)
+++ lldb/branches/lldb-platform-work/test/lang/cpp/unique-types/TestUniqueTypes.py Thu Jun  6 19:06:43 2013
@@ -33,13 +33,18 @@ class UniqueTypesTestCase(TestBase):
 
     def unique_types(self):
         """Test for unique types of std::vector<long> and std::vector<short>."""
+
+        compiler = self.getCompiler()
+        compiler_basename = os.path.basename(compiler)
+        if "clang" in compiler_basename and int(self.getCompilerVersion().split('.')[0]) < 3:
+            self.skipTest("rdar://problem/9173060 lldb hangs while running unique-types for clang version < 3")
+
         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)
+        # GCC 4.6.3 (but not 4.4, 4.6.5 or 4.7) encodes two locations for the 'return 0' statement in main.cpp
+        locs = 2 if "gcc" in compiler_basename and "4.6.3" in self.getCompilerVersion() else 1
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=locs, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 
@@ -48,35 +53,22 @@ class UniqueTypesTestCase(TestBase):
             substrs = ['stopped',
                        'stop reason = breakpoint'])
 
-        if self.getCompiler().endswith('clang'):
-            import re
-            clang_version_output = system([lldbutil.which(self.getCompiler()), "-v"])[1]
-            #print "my output:", clang_version_output
-            for line in clang_version_output.split(os.linesep):
-                m = re.search('clang version ([0-9]+)\.', line)
-                #print "line:", line
-                if m:
-                    clang_version = int(m.group(1))
-                    #print "clang version:", clang_version
-                    if clang_version < 3:
-                        self.skipTest("rdar://problem/9173060 lldb hangs while running unique-types for clang version < 3")
-
-        # Do a "frame variable -T longs" and verify "long" is in each line of output.
-        self.runCmd("frame variable -T longs")
+        # Do a "frame variable --show-types longs" and verify "long" is in each line of output.
+        self.runCmd("frame variable --show-types longs")
         output = self.res.GetOutput()
         for x in [line.strip() for line in output.split(os.linesep)]:
-            # Skip empty line or closing brace.
-            if not x or x == '}':
+            # Skip empty line, closing brace, and messages about more variables than can be displayed.
+            if not x or x == '}' or x == '...' or "Some of your variables have more members than the debugger will show by default" in x:
                 continue
             self.expect(x, "Expect type 'long'", exe=False,
                 substrs = ['long'])
 
-        # Do a "frame variable -T shorts" and verify "short" is in each line of output.
-        self.runCmd("frame variable -T shorts")
+        # Do a "frame variable --show-types shorts" and verify "short" is in each line of output.
+        self.runCmd("frame variable --show-types shorts")
         output = self.res.GetOutput()
         for x in [line.strip() for line in output.split(os.linesep)]:
-            # Skip empty line or closing brace.
-            if not x or x == '}':
+            # Skip empty line, closing brace, and messages about more variables than can be displayed.
+            if not x or x == '}' or x == '...' or "Some of your variables have more members than the debugger will show by default" in x:
                 continue
             self.expect(x, "Expect type 'short'", exe=False,
                 substrs = ['short'])

Modified: lldb/branches/lldb-platform-work/test/lang/cpp/unsigned_types/TestUnsignedTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/cpp/unsigned_types/TestUnsignedTypes.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/cpp/unsigned_types/TestUnsignedTypes.py (original)
+++ lldb/branches/lldb-platform-work/test/lang/cpp/unsigned_types/TestUnsignedTypes.py Thu Jun  6 19:06:43 2013
@@ -7,6 +7,7 @@ import re
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class UnsignedTypesTestCase(TestBase):
 
@@ -36,11 +37,11 @@ class UnsignedTypesTestCase(TestBase):
         exe = os.path.join(os.getcwd(), "a.out")
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
+        # GCC puts a breakpoint on the last line of a multi-line expression, so
+        # if GCC is the target compiler, we cannot rely on an exact line match.
+        need_exact = "gcc" not in self.getCompiler()
         # 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=need_exact)
 
         self.runCmd("run", RUN_SUCCEEDED)
 
@@ -53,7 +54,7 @@ class UnsignedTypesTestCase(TestBase):
             substrs = [' resolved, hit count = 1'])
 
         # Test that unsigned types display correctly.
-        self.expect("frame variable -T -a", VARIABLES_DISPLAYED_CORRECTLY,
+        self.expect("frame variable --show-types --no-args", VARIABLES_DISPLAYED_CORRECTLY,
             startstr = "(unsigned char) the_unsigned_char = 'c'",
             patterns = ["\((short unsigned int|unsigned short)\) the_unsigned_short = 99"],
             substrs = ["(unsigned int) the_unsigned_int = 99",

Modified: lldb/branches/lldb-platform-work/test/lang/cpp/virtual/TestVirtual.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/cpp/virtual/TestVirtual.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/cpp/virtual/TestVirtual.py (original)
+++ lldb/branches/lldb-platform-work/test/lang/cpp/virtual/TestVirtual.py Thu Jun  6 19:06:43 2013
@@ -6,6 +6,7 @@ import os, time
 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 @@ class CppVirtualMadness(TestBase):
         # 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/lldb-platform-work/test/lang/objc/forward-decl/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/objc/forward-decl/Makefile?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/objc/forward-decl/Makefile (original)
+++ lldb/branches/lldb-platform-work/test/lang/objc/forward-decl/Makefile Thu Jun  6 19:06:43 2013
@@ -4,6 +4,6 @@ DYLIB_NAME := libContainer
 DYLIB_OBJC_SOURCES := Container.m
 OBJC_SOURCES := main.m
 
-LDFLAGS = -framework Foundation
-
 include $(LEVEL)/Makefile.rules
+
+LDFLAGS += -framework Foundation

Modified: lldb/branches/lldb-platform-work/test/lang/objc/forward-decl/TestForwardDecl.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/objc/forward-decl/TestForwardDecl.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/objc/forward-decl/TestForwardDecl.py (original)
+++ lldb/branches/lldb-platform-work/test/lang/objc/forward-decl/TestForwardDecl.py Thu Jun  6 19:06:43 2013
@@ -4,6 +4,7 @@ import os, time
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class ForwardDeclTestCase(TestBase):
 
@@ -32,8 +33,7 @@ class ForwardDeclTestCase(TestBase):
         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/lldb-platform-work/test/lang/objc/foundation/TestConstStrings.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/objc/foundation/TestConstStrings.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/objc/foundation/TestConstStrings.py (original)
+++ lldb/branches/lldb-platform-work/test/lang/objc/foundation/TestConstStrings.py Thu Jun  6 19:06:43 2013
@@ -7,6 +7,7 @@ import os, time
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
 class ConstStringTestCase(TestBase):
@@ -40,10 +41,7 @@ class ConstStringTestCase(TestBase):
         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/lldb-platform-work/test/lang/objc/foundation/TestFoundationDisassembly.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/objc/foundation/TestFoundationDisassembly.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/objc/foundation/TestFoundationDisassembly.py (original)
+++ lldb/branches/lldb-platform-work/test/lang/objc/foundation/TestFoundationDisassembly.py Thu Jun  6 19:06:43 2013
@@ -6,6 +6,7 @@ import os, time
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
 class FoundationDisassembleTestCase(TestBase):
@@ -72,20 +73,19 @@ class FoundationDisassembleTestCase(Test
         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, module_name='a.out')
 
         # 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/lldb-platform-work/test/lang/objc/foundation/TestObjCMethods.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/objc/foundation/TestObjCMethods.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/objc/foundation/TestObjCMethods.py (original)
+++ lldb/branches/lldb-platform-work/test/lang/objc/foundation/TestObjCMethods.py Thu Jun  6 19:06:43 2013
@@ -7,6 +7,7 @@ import os, time
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
 class FoundationTestCase(TestBase):
@@ -61,20 +62,18 @@ class FoundationTestCase(TestBase):
         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, module_name='a.out')
 
         # 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 @@ class FoundationTestCase(TestBase):
         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)
 
@@ -146,7 +146,7 @@ class FoundationTestCase(TestBase):
                        'NSString * str;',
                        'NSDate * date;'])
 
-        self.expect("frame variable -T -s", VARIABLES_DISPLAYED_CORRECTLY,
+        self.expect("frame variable --show-types --scope", VARIABLES_DISPLAYED_CORRECTLY,
             substrs = ["ARG: (MyString *) self"],
             patterns = ["ARG: \(.*\) _cmd",
                         "(objc_selector *)|(SEL)"])
@@ -158,16 +158,16 @@ class FoundationTestCase(TestBase):
         # rdar://problem/8492646
         # test/foundation fails after updating to tot r115023
         # self->str displays nothing as output
-        self.expect("frame variable -T self->str", VARIABLES_DISPLAYED_CORRECTLY,
+        self.expect("frame variable --show-types self->str", VARIABLES_DISPLAYED_CORRECTLY,
             startstr = "(NSString *) self->str")
 
         # rdar://problem/8447030
         # 'frame variable self->date' displays the wrong data member
-        self.expect("frame variable -T self->date", VARIABLES_DISPLAYED_CORRECTLY,
+        self.expect("frame variable --show-types self->date", VARIABLES_DISPLAYED_CORRECTLY,
             startstr = "(NSDate *) self->date")
 
         # This should display the str and date member fields as well.
-        self.expect("frame variable -T *self", VARIABLES_DISPLAYED_CORRECTLY,
+        self.expect("frame variable --show-types *self", VARIABLES_DISPLAYED_CORRECTLY,
             substrs = ["(MyString) *self",
                        "(NSString *) str",
                        "(NSDate *) date"])
@@ -195,10 +195,8 @@ class FoundationTestCase(TestBase):
         #
 
         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
@@ -206,7 +204,7 @@ class FoundationTestCase(TestBase):
         #
         # Test new feature with r115115:
         # Add "-o" option to "expression" which prints the object description if available.
-        self.expect("expression -o -- my", "Object description displayed correctly",
+        self.expect("expression --object-description -- my", "Object description displayed correctly",
             patterns = ["Hello from.*a.out.*with timestamp: "])
 
     # See: <rdar://problem/8717050> lldb needs to use the ObjC runtime symbols for ivar offsets

Modified: lldb/branches/lldb-platform-work/test/lang/objc/foundation/TestObjCMethods2.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/objc/foundation/TestObjCMethods2.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/objc/foundation/TestObjCMethods2.py (original)
+++ lldb/branches/lldb-platform-work/test/lang/objc/foundation/TestObjCMethods2.py Thu Jun  6 19:06:43 2013
@@ -6,6 +6,7 @@ import os, time
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
 class FoundationTestCase2(TestBase):
@@ -91,10 +92,10 @@ class FoundationTestCase2(TestBase):
         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 @@ class FoundationTestCase2(TestBase):
 
         # 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)
 
@@ -134,8 +133,7 @@ class FoundationTestCase2(TestBase):
 
         self.runCmd("process continue")
 
-    @unittest2.expectedFailure
-    # <rdar://problem/8741897> Expressions should support properties
+    @unittest2.expectedFailure(8741897)
     def NSArray_expr(self):
         """Test expression commands for NSArray."""
         exe = os.path.join(os.getcwd(), "a.out")
@@ -143,9 +141,7 @@ class FoundationTestCase2(TestBase):
 
         # 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)
 
@@ -163,8 +159,7 @@ class FoundationTestCase2(TestBase):
             patterns = ["\(int\) \$.* = 3"])
         self.runCmd("process continue")
 
-    @unittest2.expectedFailure
-    # <rdar://problem/8741897> Expressions should support properties
+    @unittest2.expectedFailure(8741897)
     def NSString_expr(self):
         """Test expression commands for NSString."""
         exe = os.path.join(os.getcwd(), "a.out")
@@ -172,9 +167,7 @@ class FoundationTestCase2(TestBase):
 
         # 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,13 +194,11 @@ class FoundationTestCase2(TestBase):
         
         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",
+        self.expect("expression --show-types -- *my",
             patterns = ["\(MyString\) \$.* = ", "\(MyBase\)", "\(NSObject\)", "\(Class\)"])
         self.runCmd("process continue")
 
@@ -218,14 +209,12 @@ class FoundationTestCase2(TestBase):
         
         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("po [NSError errorWithDomain:@\"Hello\" code:35 userInfo:nil]",
-            substrs = ["$", "= 0x", "Error Domain=Hello", "Code=35", "be completed."])
+            substrs = ["Error Domain=Hello", "Code=35", "be completed."])
         self.runCmd("process continue")
 
     def NSError_p(self):
@@ -235,13 +224,11 @@ class FoundationTestCase2(TestBase):
         
         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("p [NSError errorWithDomain:@\"Hello\" code:35 userInfo:nil]",
+        self.expect("p [NSError thisMethodIsntImplemented:0]",
                     error = True, 
                     patterns = ["no known method", "cast the message send to the method's return type"])
         self.runCmd("process continue")

Modified: lldb/branches/lldb-platform-work/test/lang/objc/foundation/TestObjectDescriptionAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/objc/foundation/TestObjectDescriptionAPI.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/objc/foundation/TestObjectDescriptionAPI.py (original)
+++ lldb/branches/lldb-platform-work/test/lang/objc/foundation/TestObjectDescriptionAPI.py Thu Jun  6 19:06:43 2013
@@ -24,6 +24,7 @@ class ObjectDescriptionAPITestCase(TestB
         self.find_global_variables_then_object_description('a.out')
 
     # rdar://problem/10857337
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
     @python_api_test
     @dwarf_test
     def test_find_global_variables_then_object_description_with_dwarf(self):

Modified: lldb/branches/lldb-platform-work/test/lang/objc/foundation/main.m
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/objc/foundation/main.m?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/objc/foundation/main.m (original)
+++ lldb/branches/lldb-platform-work/test/lang/objc/foundation/main.m Thu Jun  6 19:06:43 2013
@@ -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 @@ Test_Selector ()
     //      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 @@ Test_NSString (const char *program)
     // 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 @@ Test_NSArray ()
     // 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/lldb-platform-work/test/lang/objc/hidden-ivars/InternalDefiner.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/objc/hidden-ivars/InternalDefiner.h?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/objc/hidden-ivars/InternalDefiner.h (original)
+++ lldb/branches/lldb-platform-work/test/lang/objc/hidden-ivars/InternalDefiner.h Thu Jun  6 19:06:43 2013
@@ -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/lldb-platform-work/test/lang/objc/hidden-ivars/InternalDefiner.m
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/objc/hidden-ivars/InternalDefiner.m?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/objc/hidden-ivars/InternalDefiner.m (original)
+++ lldb/branches/lldb-platform-work/test/lang/objc/hidden-ivars/InternalDefiner.m Thu Jun  6 19:06:43 2013
@@ -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/lldb-platform-work/test/lang/objc/hidden-ivars/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/objc/hidden-ivars/Makefile?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/objc/hidden-ivars/Makefile (original)
+++ lldb/branches/lldb-platform-work/test/lang/objc/hidden-ivars/Makefile Thu Jun  6 19:06:43 2013
@@ -1,6 +1,6 @@
 LEVEL = ../../../make
 
-DYLIB_NAME := libInternalDefiner
+DYLIB_NAME := InternalDefiner
 DYLIB_OBJC_SOURCES := InternalDefiner.m
 OBJC_SOURCES := main.m
 

Modified: lldb/branches/lldb-platform-work/test/lang/objc/hidden-ivars/TestHiddenIvars.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/objc/hidden-ivars/TestHiddenIvars.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/objc/hidden-ivars/TestHiddenIvars.py (original)
+++ lldb/branches/lldb-platform-work/test/lang/objc/hidden-ivars/TestHiddenIvars.py Thu Jun  6 19:06:43 2013
@@ -4,6 +4,7 @@ import os, time
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class HiddenIvarsTestCase(TestBase):
 
@@ -25,6 +26,7 @@ class HiddenIvarsTestCase(TestBase):
         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 @@ class HiddenIvarsTestCase(TestBase):
         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 @@ class HiddenIvarsTestCase(TestBase):
         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 @@ class HiddenIvarsTestCase(TestBase):
         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/lldb-platform-work/test/lang/objc/hidden-ivars/main.m
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/objc/hidden-ivars/main.m?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/objc/hidden-ivars/main.m (original)
+++ lldb/branches/lldb-platform-work/test/lang/objc/hidden-ivars/main.m Thu Jun  6 19:06:43 2013
@@ -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 @@ int main(int argc, const char * argv[])
 
     @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/lldb-platform-work/test/lang/objc/objc++/TestObjCXX.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/objc/objc%2B%2B/TestObjCXX.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/objc/objc++/TestObjCXX.py (original)
+++ lldb/branches/lldb-platform-work/test/lang/objc/objc++/TestObjCXX.py Thu Jun  6 19:06:43 2013
@@ -6,6 +6,7 @@ import os, time
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class ObjCXXTestCase(TestBase):
 
@@ -19,6 +20,7 @@ class ObjCXXTestCase(TestBase):
         self.buildDsym()
         self.do_testObjCXXClasses()
 
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
     @dwarf_test
     def test_break_with_dwarf(self):
         """Test ivars of Objective-C++ classes"""
@@ -32,8 +34,7 @@ class ObjCXXTestCase(TestBase):
         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/lldb-platform-work/test/lang/objc/objc-builtin-types/TestObjCBuiltinTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/objc/objc-builtin-types/TestObjCBuiltinTypes.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/objc/objc-builtin-types/TestObjCBuiltinTypes.py (original)
+++ lldb/branches/lldb-platform-work/test/lang/objc/objc-builtin-types/TestObjCBuiltinTypes.py Thu Jun  6 19:06:43 2013
@@ -62,7 +62,7 @@ class TestObjCBuiltinTypes(TestBase):
 
         self.expect("expr (foo)", patterns = ["\(ns::id\) \$.* = 0"])
 
-        self.expect("expr id my_id = 0; my_id", patterns = ["\(id\) \$.* = 0x0"])
+        self.expect("expr id my_id = 0; my_id", patterns = ["\(id\) \$.* = nil"])
 
 if __name__ == '__main__':
     import atexit

Modified: lldb/branches/lldb-platform-work/test/lang/objc/objc-checker/TestObjCCheckers.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/objc/objc-checker/TestObjCCheckers.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/objc/objc-checker/TestObjCCheckers.py (original)
+++ lldb/branches/lldb-platform-work/test/lang/objc/objc-checker/TestObjCCheckers.py Thu Jun  6 19:06:43 2013
@@ -22,6 +22,7 @@ class ObjCCheckerTestCase(TestBase):
         self.buildDsym()
         self.do_test_checkers()
 
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
     @python_api_test
     @dwarf_test
     def test_objc_checker_with_dwarf(self):

Modified: lldb/branches/lldb-platform-work/test/lang/objc/objc-class-method/TestObjCClassMethod.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/objc/objc-class-method/TestObjCClassMethod.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/objc/objc-class-method/TestObjCClassMethod.py (original)
+++ lldb/branches/lldb-platform-work/test/lang/objc/objc-class-method/TestObjCClassMethod.py Thu Jun  6 19:06:43 2013
@@ -20,6 +20,7 @@ class TestObjCClassMethod(TestBase):
         self.buildDsym()
         self.objc_class_method()
 
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
     @expectedFailurei386
     @python_api_test
     @dwarf_test

Modified: lldb/branches/lldb-platform-work/test/lang/objc/objc-dynamic-value/TestObjCDynamicValue.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/objc/objc-dynamic-value/TestObjCDynamicValue.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/objc/objc-dynamic-value/TestObjCDynamicValue.py (original)
+++ lldb/branches/lldb-platform-work/test/lang/objc/objc-dynamic-value/TestObjCDynamicValue.py Thu Jun  6 19:06:43 2013
@@ -23,6 +23,7 @@ class ObjCDynamicValueTestCase(TestBase)
         self.buildDsym()
         self.do_get_dynamic_vals()
 
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
     @python_api_test
     @dwarf_test
     def test_get_objc_dynamic_vals_with_dwarf(self):
@@ -115,10 +116,10 @@ class ObjCDynamicValueTestCase(TestBase)
         # check that our ObjC GetISA() does a good job at hiding KVO swizzled classes
         
         self.expect('frame var -d run-target myObserver->_source -T', 'the KVO-ed class is hidden',
-                    substrs = ['dynamic type: SourceDerived'])
+                    substrs = ['SourceDerived'])
 
         self.expect('frame var -d run-target myObserver->_source -T', 'the KVO-ed class is hidden', matching = False,
-                    substrs = ['dynamic type: NSKVONotify'])
+                    substrs = ['NSKVONotify'])
 
         # This test is not entirely related to the main thrust of this test case, but since we're here,
         # try stepping into setProperty, and make sure we get into the version in Source:
@@ -128,6 +129,7 @@ class ObjCDynamicValueTestCase(TestBase)
         threads = lldbutil.get_stopped_threads (process, lldb.eStopReasonPlanComplete)
         self.assertTrue (len(threads) == 1)
         line_entry = threads[0].GetFrameAtIndex(0).GetLineEntry()
+
         self.assertTrue (line_entry.GetLine() == self.set_property_line)
         self.assertTrue (line_entry.GetFileSpec().GetFilename() == self.source_name) 
 

Modified: lldb/branches/lldb-platform-work/test/lang/objc/objc-ivar-offsets/TestObjCIvarOffsets.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/objc/objc-ivar-offsets/TestObjCIvarOffsets.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/objc/objc-ivar-offsets/TestObjCIvarOffsets.py (original)
+++ lldb/branches/lldb-platform-work/test/lang/objc/objc-ivar-offsets/TestObjCIvarOffsets.py Thu Jun  6 19:06:43 2013
@@ -18,6 +18,7 @@ class TestObjCIvarOffsets(TestBase):
         self.buildDsym()
         self.objc_ivar_offsets()
 
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
     @python_api_test
     @dwarf_test
     def test_with_dwarf_and_python_api(self):

Modified: lldb/branches/lldb-platform-work/test/lang/objc/objc-new-syntax/TestObjCNewSyntax.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/objc/objc-new-syntax/TestObjCNewSyntax.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/objc/objc-new-syntax/TestObjCNewSyntax.py (original)
+++ lldb/branches/lldb-platform-work/test/lang/objc/objc-new-syntax/TestObjCNewSyntax.py Thu Jun  6 19:06:43 2013
@@ -4,6 +4,7 @@ import os, time
 import unittest2
 import lldb
 import platform
+import lldbutil
 
 from distutils.version import StrictVersion
 
@@ -44,8 +45,7 @@ class ObjCNewSyntaxTestCase(TestBase):
         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)
 
@@ -64,62 +64,62 @@ class ObjCNewSyntaxTestCase(TestBase):
 
         self.common_setup()
 
-        self.expect("expr -o -- immutable_array[0]", VARIABLES_DISPLAYED_CORRECTLY,
+        self.expect("expr --object-description -- immutable_array[0]", VARIABLES_DISPLAYED_CORRECTLY,
             substrs = ["foo"])
 
-        self.expect("expr -o -- mutable_array[0]", VARIABLES_DISPLAYED_CORRECTLY,
+        self.expect("expr --object-description -- mutable_array[0]", VARIABLES_DISPLAYED_CORRECTLY,
             substrs = ["foo"])
 
-        self.expect("expr -o -- mutable_array[0] = @\"bar\"", VARIABLES_DISPLAYED_CORRECTLY,
+        self.expect("expr --object-description -- mutable_array[0] = @\"bar\"", VARIABLES_DISPLAYED_CORRECTLY,
             substrs = ["bar"])
 
-        self.expect("expr -o -- mutable_array[0]", VARIABLES_DISPLAYED_CORRECTLY,
+        self.expect("expr --object-description -- mutable_array[0]", VARIABLES_DISPLAYED_CORRECTLY,
             substrs = ["bar"])
 
-        self.expect("expr -o -- immutable_dictionary[@\"key\"]", VARIABLES_DISPLAYED_CORRECTLY,
+        self.expect("expr --object-description -- immutable_dictionary[@\"key\"]", VARIABLES_DISPLAYED_CORRECTLY,
             substrs = ["value"])
 
-        self.expect("expr -o -- mutable_dictionary[@\"key\"]", VARIABLES_DISPLAYED_CORRECTLY,
+        self.expect("expr --object-description -- mutable_dictionary[@\"key\"]", VARIABLES_DISPLAYED_CORRECTLY,
             substrs = ["value"])
 
-        self.expect("expr -o -- mutable_dictionary[@\"key\"] = @\"object\"", VARIABLES_DISPLAYED_CORRECTLY,
+        self.expect("expr --object-description -- mutable_dictionary[@\"key\"] = @\"object\"", VARIABLES_DISPLAYED_CORRECTLY,
             substrs = ["object"])
 
-        self.expect("expr -o -- mutable_dictionary[@\"key\"]", VARIABLES_DISPLAYED_CORRECTLY,
+        self.expect("expr --object-description -- mutable_dictionary[@\"key\"]", VARIABLES_DISPLAYED_CORRECTLY,
             substrs = ["object"])
 
-        self.expect("expr -o -- @[ @\"foo\", @\"bar\" ]", VARIABLES_DISPLAYED_CORRECTLY,
+        self.expect("expr --object-description -- @[ @\"foo\", @\"bar\" ]", VARIABLES_DISPLAYED_CORRECTLY,
             substrs = ["NSArray", "foo", "bar"])
 
-        self.expect("expr -o -- @{ @\"key\" : @\"object\" }", VARIABLES_DISPLAYED_CORRECTLY,
+        self.expect("expr --object-description -- @{ @\"key\" : @\"object\" }", VARIABLES_DISPLAYED_CORRECTLY,
             substrs = ["NSDictionary", "key", "object"])
 
-        self.expect("expr -o -- @'a'", VARIABLES_DISPLAYED_CORRECTLY,
+        self.expect("expr --object-description -- @'a'", VARIABLES_DISPLAYED_CORRECTLY,
             substrs = ["NSNumber", str(ord('a'))])
 
-        self.expect("expr -o -- @1", VARIABLES_DISPLAYED_CORRECTLY,
+        self.expect("expr --object-description -- @1", VARIABLES_DISPLAYED_CORRECTLY,
             substrs = ["NSNumber", "1"])
 
-        self.expect("expr -o -- @1l", VARIABLES_DISPLAYED_CORRECTLY,
+        self.expect("expr --object-description -- @1l", VARIABLES_DISPLAYED_CORRECTLY,
             substrs = ["NSNumber", "1"])
 
-        self.expect("expr -o -- @1ul", VARIABLES_DISPLAYED_CORRECTLY,
+        self.expect("expr --object-description -- @1ul", VARIABLES_DISPLAYED_CORRECTLY,
             substrs = ["NSNumber", "1"])
 
-        self.expect("expr -o -- @1ll", VARIABLES_DISPLAYED_CORRECTLY,
+        self.expect("expr --object-description -- @1ll", VARIABLES_DISPLAYED_CORRECTLY,
             substrs = ["NSNumber", "1"])
 
-        self.expect("expr -o -- @1ull", VARIABLES_DISPLAYED_CORRECTLY,
+        self.expect("expr --object-description -- @1ull", VARIABLES_DISPLAYED_CORRECTLY,
             substrs = ["NSNumber", "1"])
 
-        self.expect("expr -o -- @123.45", VARIABLES_DISPLAYED_CORRECTLY,
+        self.expect("expr --object-description -- @123.45", VARIABLES_DISPLAYED_CORRECTLY,
             substrs = ["NSNumber", "123.45"])
-        self.expect("expr -o -- @123.45f", VARIABLES_DISPLAYED_CORRECTLY,
+        self.expect("expr --object-description -- @123.45f", VARIABLES_DISPLAYED_CORRECTLY,
             substrs = ["NSNumber", "123.45"])
 
-        self.expect("expr -o -- @( 1 + 3 )", VARIABLES_DISPLAYED_CORRECTLY,
+        self.expect("expr --object-description -- @( 1 + 3 )", VARIABLES_DISPLAYED_CORRECTLY,
             substrs = ["NSNumber", "4"])
-        self.expect("expr -o -- @(\"Hello world\" + 6)", VARIABLES_DISPLAYED_CORRECTLY,
+        self.expect("expr --object-description -- @(\"Hello world\" + 6)", VARIABLES_DISPLAYED_CORRECTLY,
             substrs = ["NSString", "world"])
 
             

Modified: lldb/branches/lldb-platform-work/test/lang/objc/objc-optimized/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/objc/objc-optimized/Makefile?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/objc/objc-optimized/Makefile (original)
+++ lldb/branches/lldb-platform-work/test/lang/objc/objc-optimized/Makefile Thu Jun  6 19:06:43 2013
@@ -2,7 +2,7 @@ LEVEL = ../../../make
 
 OBJC_SOURCES := main.m
 
-CFLAGS ?= -arch $(ARCH) -gdwarf-2 -O2
+CFLAGS ?= -arch $(ARCH) -g -O2
 LDFLAGS = $(CFLAGS) -lobjc -framework Foundation
 
 include $(LEVEL)/Makefile.rules

Modified: lldb/branches/lldb-platform-work/test/lang/objc/objc-optimized/TestObjcOptimized.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/objc/objc-optimized/TestObjcOptimized.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/objc/objc-optimized/TestObjcOptimized.py (original)
+++ lldb/branches/lldb-platform-work/test/lang/objc/objc-optimized/TestObjcOptimized.py Thu Jun  6 19:06:43 2013
@@ -11,6 +11,8 @@ import os, time
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
+import re
 
 # rdar://problem/9087739
 # test failure: objc_optimized does not work for "-C clang -A i386"
@@ -39,9 +41,7 @@ class ObjcOptimizedTestCase(TestBase):
         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,
@@ -51,8 +51,21 @@ class ObjcOptimizedTestCase(TestBase):
         self.expect('expression member',
             startstr = "(int) $0 = 5")
 
-        self.expect('expression self',
-            startstr = "(%s *) $1 = " % self.myclass)
+        # <rdar://problem/12693963>
+        interp = self.dbg.GetCommandInterpreter()
+        result = lldb.SBCommandReturnObject()
+        interp.HandleCommand('frame variable self', result)
+        output = result.GetOutput()
+
+        desired_pointer = "0x0"
+
+        mo = re.search("0x[0-9a-f]+", output)
+
+        if mo:
+            desired_pointer = mo.group(0)
+
+        self.expect('expression (self)',
+            substrs = [("(%s *) $1 = " % self.myclass), desired_pointer])
 
         self.expect('expression self->non_member', error=True,
             substrs = ["does not have a member named 'non_member'"])

Modified: lldb/branches/lldb-platform-work/test/lang/objc/objc-property/TestObjCProperty.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/objc/objc-property/TestObjCProperty.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/objc/objc-property/TestObjCProperty.py (original)
+++ lldb/branches/lldb-platform-work/test/lang/objc/objc-property/TestObjCProperty.py Thu Jun  6 19:06:43 2013
@@ -22,6 +22,7 @@ class ObjCPropertyTestCase(TestBase):
         self.buildDsym()
         self.do_test_properties()
 
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
     @python_api_test
     @dwarf_test
     def test_objc_properties_with_dwarf(self):
@@ -123,6 +124,11 @@ class ObjCPropertyTestCase(TestBase):
         unbacked_value = frame.EvaluateExpression("mine.unbackedInt", False)
         unbacked_error = unbacked_value.GetError()
         self.assertTrue (unbacked_error.Success())
+
+        idWithProtocol_value = frame.EvaluateExpression("mine.idWithProtocol", False)
+        idWithProtocol_error = idWithProtocol_value.GetError()
+        self.assertTrue (idWithProtocol_error.Success())
+        self.assertTrue (idWithProtocol_value.GetTypeName() == "id")
         
 if __name__ == '__main__':
     import atexit

Modified: lldb/branches/lldb-platform-work/test/lang/objc/objc-property/main.m
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/objc/objc-property/main.m?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/objc/objc-property/main.m (original)
+++ lldb/branches/lldb-platform-work/test/lang/objc/objc-property/main.m Thu Jun  6 19:06:43 2013
@@ -1,5 +1,11 @@
 #import <Foundation/Foundation.h>
 
+ at protocol MyProtocol
+
+-(const char *)hello;
+
+ at end
+
 @interface BaseClass : NSObject
 {
   int _backedInt;
@@ -18,6 +24,7 @@
 
 @property(getter=myGetUnbackedInt,setter=mySetUnbackedInt:) int unbackedInt;
 @property int backedInt;
+ at property (nonatomic, assign) id <MyProtocol> idWithProtocol;
 @end
 
 @implementation BaseClass
@@ -79,6 +86,8 @@ main ()
 
   int unbackedInt = mine.unbackedInt;
 
+  id idWithProtocol = mine.idWithProtocol;
+
   NSLog (@"Results for %p: nonexistant: %d backed: %d unbacked: %d accessCount: %d.",
          mine,
          nonexistant,

Modified: lldb/branches/lldb-platform-work/test/lang/objc/objc-static-method/TestObjCStaticMethod.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/objc/objc-static-method/TestObjCStaticMethod.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/objc/objc-static-method/TestObjCStaticMethod.py (original)
+++ lldb/branches/lldb-platform-work/test/lang/objc/objc-static-method/TestObjCStaticMethod.py Thu Jun  6 19:06:43 2013
@@ -19,6 +19,7 @@ class TestObjCStaticMethod(TestBase):
         self.buildDsym()
         self.objc_static_method()
 
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
     @python_api_test
     #<rdar://problem/9745789> "expression" can't call functions in class methods
     @dwarf_test

Modified: lldb/branches/lldb-platform-work/test/lang/objc/objc-stepping/TestObjCStepping.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/objc/objc-stepping/TestObjCStepping.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/objc/objc-stepping/TestObjCStepping.py (original)
+++ lldb/branches/lldb-platform-work/test/lang/objc/objc-stepping/TestObjCStepping.py Thu Jun  6 19:06:43 2013
@@ -8,6 +8,9 @@ from lldbtest import *
 
 class TestObjCStepping(TestBase):
 
+    def getCategories (self):
+        return ['basic_process']
+
     mydir = os.path.join("lang", "objc", "objc-stepping")
 
     @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
@@ -18,6 +21,7 @@ class TestObjCStepping(TestBase):
         self.buildDsym()
         self.objc_stepping()
 
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
     @python_api_test
     @dwarf_test
     def test_with_dwarf_and_python_api(self):
@@ -90,7 +94,7 @@ class TestObjCStepping(TestBase):
         self.assertTrue(mySource, "Found mySource local variable.")
         mySource_isa = mySource.GetChildMemberWithName ("isa")
         self.assertTrue(mySource_isa, "Found mySource->isa local variable.")
-        mySource_isa.GetValue ()
+        className = mySource_isa.GetSummary ()
 
         if self.TraceOn():
              print mySource_isa
@@ -131,14 +135,13 @@ class TestObjCStepping(TestBase):
 
         threads = lldbutil.continue_to_breakpoint (process, break3)
         self.assertTrue (len(threads) == 1, "Continued to third breakpoint in main, our object should now be swizzled.")
-        
-        mySource_isa.GetValue ()
-        did_change = mySource_isa.GetValueDidChange ()
+
+        newClassName = mySource_isa.GetSummary ()
 
         if self.TraceOn():
              print mySource_isa
 
-        self.assertTrue (did_change, "The isa did indeed change, swizzled!")
+        self.assertTrue (newClassName != className, "The isa did indeed change, swizzled!")
 
         # Now step in, that should leave us in the Source randomMethod:
         thread = threads[0]

Modified: lldb/branches/lldb-platform-work/test/lang/objc/radar-9691614/TestObjCMethodReturningBOOL.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/objc/radar-9691614/TestObjCMethodReturningBOOL.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/objc/radar-9691614/TestObjCMethodReturningBOOL.py (original)
+++ lldb/branches/lldb-platform-work/test/lang/objc/radar-9691614/TestObjCMethodReturningBOOL.py Thu Jun  6 19:06:43 2013
@@ -6,6 +6,7 @@ import os, time
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
 class MethodReturningBOOLTestCase(TestBase):
@@ -42,10 +43,7 @@ class MethodReturningBOOLTestCase(TestBa
         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/lldb-platform-work/test/lang/objc/rdar-10967107/TestRdar10967107.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/objc/rdar-10967107/TestRdar10967107.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/objc/rdar-10967107/TestRdar10967107.py (original)
+++ lldb/branches/lldb-platform-work/test/lang/objc/rdar-10967107/TestRdar10967107.py Thu Jun  6 19:06:43 2013
@@ -6,6 +6,7 @@ import os, time
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
 class Rdar10967107TestCase(TestBase):
@@ -42,10 +43,7 @@ class Rdar10967107TestCase(TestBase):
         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/lldb-platform-work/test/lang/objc/rdar-10967107/main.m
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/objc/rdar-10967107/main.m?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/objc/rdar-10967107/main.m (original)
+++ lldb/branches/lldb-platform-work/test/lang/objc/rdar-10967107/main.m Thu Jun  6 19:06:43 2013
@@ -7,7 +7,7 @@ int main (int argc, char const *argv[])
 	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/lldb-platform-work/test/lang/objc/rdar-11355592/TestRdar11355592.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/objc/rdar-11355592/TestRdar11355592.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/objc/rdar-11355592/TestRdar11355592.py (original)
+++ lldb/branches/lldb-platform-work/test/lang/objc/rdar-11355592/TestRdar11355592.py Thu Jun  6 19:06:43 2013
@@ -6,6 +6,7 @@ import os, time
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
 class Rdar10967107TestCase(TestBase):
@@ -42,38 +43,35 @@ class Rdar10967107TestCase(TestBase):
         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
         self.expect("frame variable my_string", substrs = ['const char *'])
-        self.expect("frame variable my_string -d run-target", substrs = ['const char *'])
+        self.expect("frame variable my_string --dynamic-type run-target", substrs = ['const char *'])
         # check that expr also gets it right
         self.expect("expr my_string", substrs = ['const char *'])
-        self.expect("expr -d true -- my_string", substrs = ['const char *'])
+        self.expect("expr -d run -- my_string", substrs = ['const char *'])
         # but check that we get the real Foolie as such
         self.expect("frame variable my_foolie", substrs = ['FoolMeOnce *'])
-        self.expect("frame variable my_foolie -d run-target", substrs = ['FoolMeOnce *'])
+        self.expect("frame variable my_foolie --dynamic-type run-target", substrs = ['FoolMeOnce *'])
         # check that expr also gets it right
         self.expect("expr my_foolie", substrs = ['FoolMeOnce *'])
-        self.expect("expr -d true -- my_foolie", substrs = ['FoolMeOnce *'])
+        self.expect("expr -d run -- my_foolie", substrs = ['FoolMeOnce *'])
         # now check that assigning a true string does not break anything
         self.runCmd("next")
         # check that we correctly see the const char*, even with dynamic types on
         self.expect("frame variable my_string", substrs = ['const char *'])
-        self.expect("frame variable my_string -d run-target", substrs = ['const char *'])
+        self.expect("frame variable my_string --dynamic-type run-target", substrs = ['const char *'])
         # check that expr also gets it right
         self.expect("expr my_string", substrs = ['const char *'])
-        self.expect("expr -d true -- my_string", substrs = ['const char *'])
+        self.expect("expr -d run -- my_string", substrs = ['const char *'])
         # but check that we get the real Foolie as such
         self.expect("frame variable my_foolie", substrs = ['FoolMeOnce *'])
-        self.expect("frame variable my_foolie -d run-target", substrs = ['FoolMeOnce *'])
+        self.expect("frame variable my_foolie --dynamic-type run-target", substrs = ['FoolMeOnce *'])
         # check that expr also gets it right
         self.expect("expr my_foolie", substrs = ['FoolMeOnce *'])
-        self.expect("expr -d true -- my_foolie", substrs = ['FoolMeOnce *'])
+        self.expect("expr -d run -- my_foolie", substrs = ['FoolMeOnce *'])
 
 if __name__ == '__main__':
     import atexit

Modified: lldb/branches/lldb-platform-work/test/lang/objc/rdar-11355592/main.m
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/objc/rdar-11355592/main.m?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/objc/rdar-11355592/main.m (original)
+++ lldb/branches/lldb-platform-work/test/lang/objc/rdar-11355592/main.m Thu Jun  6 19:06:43 2013
@@ -29,8 +29,8 @@ int main (int argc, char const *argv[])
 
     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/lldb-platform-work/test/lang/objc/real-definition/TestRealDefinition.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/objc/real-definition/TestRealDefinition.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/objc/real-definition/TestRealDefinition.py (original)
+++ lldb/branches/lldb-platform-work/test/lang/objc/real-definition/TestRealDefinition.py Thu Jun  6 19:06:43 2013
@@ -4,6 +4,7 @@ import os, time
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class TestRealDefinition(TestBase):
 
@@ -54,13 +55,15 @@ class TestRealDefinition(TestBase):
         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 @@ class TestRealDefinition(TestBase):
         """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/lldb-platform-work/test/lang/objc/self/TestObjCSelf.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/objc/self/TestObjCSelf.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/objc/self/TestObjCSelf.py (original)
+++ lldb/branches/lldb-platform-work/test/lang/objc/self/TestObjCSelf.py Thu Jun  6 19:06:43 2013
@@ -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):
     
@@ -15,6 +16,7 @@ class ObjCSelfTestCase(TestBase):
         self.buildDsym()
         self.self_commands()
 
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
     @dwarf_test
     def test_with_dwarf_and_run_command(self):
         """Test that the appropriate member variables are available when stopped in Objective-C class and instance methods"""
@@ -25,9 +27,7 @@ class ObjCSelfTestCase(TestBase):
         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/lldb-platform-work/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lldbtest.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lldbtest.py (original)
+++ lldb/branches/lldb-platform-work/test/lldbtest.py Thu Jun  6 19:06:43 2013
@@ -32,7 +32,9 @@ $
 """
 
 import os, sys, traceback
+import os.path
 import re
+import signal
 from subprocess import *
 import StringIO
 import time
@@ -90,6 +92,8 @@ BREAKPOINT_HIT_TWICE = "Breakpoint resol
 
 BREAKPOINT_HIT_THRICE = "Breakpoint resolved with hit cout = 3"
 
+MISSING_EXPECTED_REGISTERS = "At least one expected register is unavailable."
+
 OBJECT_PRINTED_CORRECTLY = "Object printed correctly"
 
 SOURCE_DISPLAYED_CORRECTLY = "Source code displayed correctly"
@@ -98,6 +102,8 @@ STEP_OUT_SUCCEEDED = "Thread step-out su
 
 STOPPED_DUE_TO_EXC_BAD_ACCESS = "Process should be stopped due to bad access exception"
 
+STOPPED_DUE_TO_ASSERT = "Process should be stopped due to an assertion"
+
 STOPPED_DUE_TO_BREAKPOINT = "Process should be stopped due to breakpoint"
 
 STOPPED_DUE_TO_BREAKPOINT_WITH_STOP_REASON_AS = "%s, %s" % (
@@ -382,48 +388,301 @@ def not_remote_testsuite_ready(func):
     wrapper.__not_ready_for_remote_testsuite_test__ = True
     return wrapper
 
-def expectedFailureClang(func):
-    """Decorate the item as a Clang only expectedFailure."""
+def expectedFailureGcc(bugnumber=None, compiler_version=["=", None]):
+     if callable(bugnumber):
+        @wraps(bugnumber)
+        def expectedFailureGcc_easy_wrapper(*args, **kwargs):
+            from unittest2 import case
+            self = args[0]
+            test_compiler = self.getCompiler()
+            try:
+                bugnumber(*args, **kwargs)
+            except Exception:
+                if "gcc" in test_compiler and self.expectedCompilerVersion(compiler_version):
+                    raise case._ExpectedFailure(sys.exc_info(),None)
+                else:
+                    raise
+            if "gcc" in test_compiler:
+                raise case._UnexpectedSuccess(sys.exc_info(),None)
+        return expectedFailureGcc_easy_wrapper
+     else:
+        def expectedFailureGcc_impl(func):
+              @wraps(func)
+              def wrapper(*args, **kwargs):
+                from unittest2 import case
+                self = args[0]
+                test_compiler = self.getCompiler()
+                try:
+                    func(*args, **kwargs)
+                except Exception:
+                    if "gcc" in test_compiler and self.expectedCompilerVersion(compiler_version):
+                        raise case._ExpectedFailure(sys.exc_info(),bugnumber)
+                    else:
+                        raise
+                if "gcc" in test_compiler:
+                    raise case._UnexpectedSuccess(sys.exc_info(),bugnumber)
+              return wrapper
+        return expectedFailureGcc_impl
+
+def expectedFailureClang(bugnumber=None):
+     if callable(bugnumber):
+        @wraps(bugnumber)
+        def expectedFailureClang_easy_wrapper(*args, **kwargs):
+            from unittest2 import case
+            self = args[0]
+            test_compiler = self.getCompiler()
+            try:
+                bugnumber(*args, **kwargs)
+            except Exception:
+                if "clang" in test_compiler:
+                    raise case._ExpectedFailure(sys.exc_info(),None)
+                else:
+                    raise
+            if "clang" in test_compiler:
+                raise case._UnexpectedSuccess(sys.exc_info(),None)
+        return expectedFailureClang_easy_wrapper
+     else:
+        def expectedFailureClang_impl(func):
+              @wraps(func)
+              def wrapper(*args, **kwargs):
+                from unittest2 import case
+                self = args[0]
+                test_compiler = self.getCompiler()
+                try:
+                    func(*args, **kwargs)
+                except Exception:
+                    if "clang" in test_compiler:
+                        raise case._ExpectedFailure(sys.exc_info(),bugnumber)
+                    else:
+                        raise
+                if "clang" in test_compiler:
+                    raise case._UnexpectedSuccess(sys.exc_info(),bugnumber)
+              return wrapper
+        return expectedFailureClang_impl
+
+def expectedFailureIcc(bugnumber=None):
+     if callable(bugnumber):
+        @wraps(bugnumber)
+        def expectedFailureIcc_easy_wrapper(*args, **kwargs):
+            from unittest2 import case
+            self = args[0]
+            test_compiler = self.getCompiler()
+            try:
+                bugnumber(*args, **kwargs)
+            except Exception:
+                if "icc" in test_compiler:
+                    raise case._ExpectedFailure(sys.exc_info(),None)
+                else:
+                    raise
+            if "icc" in test_compiler:
+                raise case._UnexpectedSuccess(sys.exc_info(),None)
+        return expectedFailureIcc_easy_wrapper
+     else:
+        def expectedFailureIcc_impl(func):
+              @wraps(func)
+              def wrapper(*args, **kwargs):
+                from unittest2 import case
+                self = args[0]
+                test_compiler = self.getCompiler()
+                try:
+                    func(*args, **kwargs)
+                except Exception:
+                    if "icc" in test_compiler:
+                        raise case._ExpectedFailure(sys.exc_info(),bugnumber)
+                    else:
+                        raise
+                if "icc" in test_compiler:
+                    raise case._UnexpectedSuccess(sys.exc_info(),bugnumber)
+              return wrapper
+        return expectedFailureIcc_impl
+
+
+def expectedFailurei386(bugnumber=None):
+     if callable(bugnumber):
+        @wraps(bugnumber)
+        def expectedFailurei386_easy_wrapper(*args, **kwargs):
+            from unittest2 import case
+            self = args[0]
+            arch = self.getArchitecture()
+            try:
+                bugnumber(*args, **kwargs)
+            except Exception:
+                if "i386" in arch:
+                    raise case._ExpectedFailure(sys.exc_info(),None)
+                else:
+                    raise
+            if "i386" in arch:
+                raise case._UnexpectedSuccess(sys.exc_info(),None)
+        return expectedFailurei386_easy_wrapper
+     else:
+        def expectedFailurei386_impl(func):
+              @wraps(func)
+              def wrapper(*args, **kwargs):
+                from unittest2 import case
+                self = args[0]
+                arch = self.getArchitecture()
+                try:
+                    func(*args, **kwargs)
+                except Exception:
+                    if "i386" in arch:
+                        raise case._ExpectedFailure(sys.exc_info(),bugnumber)
+                    else:
+                        raise
+                if "i386" in arch:
+                    raise case._UnexpectedSuccess(sys.exc_info(),bugnumber)
+              return wrapper
+        return expectedFailurei386_impl
+
+def expectedFailureLinux(bugnumber=None, compilers=None):
+     if callable(bugnumber):
+        @wraps(bugnumber)
+        def expectedFailureLinux_easy_wrapper(*args, **kwargs):
+            from unittest2 import case
+            self = args[0]
+            platform = sys.platform
+            try:
+                bugnumber(*args, **kwargs)
+            except Exception:
+                if "linux" in platform and self.expectedCompiler(compilers):
+                    raise case._ExpectedFailure(sys.exc_info(),None)
+                else:
+                    raise
+            if "linux" in platform and self.expectedCompiler(compilers):
+                raise case._UnexpectedSuccess(sys.exc_info(),None)
+        return expectedFailureLinux_easy_wrapper
+     else:
+        def expectedFailureLinux_impl(func):
+              @wraps(func)
+              def wrapper(*args, **kwargs):
+                from unittest2 import case
+                self = args[0]
+                platform = sys.platform
+                try:
+                    func(*args, **kwargs)
+                except Exception:
+                    if "linux" in platform and self.expectedCompiler(compilers):
+                        raise case._ExpectedFailure(sys.exc_info(),bugnumber)
+                    else:
+                        raise
+                if "linux" in platform and self.expectedCompiler(compilers):
+                    raise case._UnexpectedSuccess(sys.exc_info(),bugnumber)
+              return wrapper
+        return expectedFailureLinux_impl
+
+def expectedFailureDarwin(bugnumber=None):
+     if callable(bugnumber):
+        @wraps(bugnumber)
+        def expectedFailureDarwin_easy_wrapper(*args, **kwargs):
+            from unittest2 import case
+            self = args[0]
+            platform = sys.platform
+            try:
+                bugnumber(*args, **kwargs)
+            except Exception:
+                if "darwin" in platform:
+                    raise case._ExpectedFailure(sys.exc_info(),None)
+                else:
+                    raise
+            if "darwin" in platform:
+                raise case._UnexpectedSuccess(sys.exc_info(),None)
+        return expectedFailureDarwin_easy_wrapper
+     else:
+        def expectedFailureDarwin_impl(func):
+              @wraps(func)
+              def wrapper(*args, **kwargs):
+                from unittest2 import case
+                self = args[0]
+                platform = sys.platform
+                try:
+                    func(*args, **kwargs)
+                except Exception:
+                    if "darwin" in platform:
+                        raise case._ExpectedFailure(sys.exc_info(),bugnumber)
+                    else:
+                        raise
+                if "darwin" in platform:
+                    raise case._UnexpectedSuccess(sys.exc_info(),bugnumber)
+              return wrapper
+        return expectedFailureDarwin_impl
+
+def skipIfLinux(func):
+    """Decorate the item to skip tests that should be skipped on Linux."""
+    if isinstance(func, type) and issubclass(func, unittest2.TestCase):
+        raise Exception("@skipIfLinux can only be used to decorate a test method")
+    @wraps(func)
+    def wrapper(*args, **kwargs):
+        from unittest2 import case
+        self = args[0]
+        platform = sys.platform
+        if "linux" in platform:
+            self.skipTest("skip on linux")
+        else:
+            func(*args, **kwargs)
+    return wrapper
+
+def skipIfLinuxClang(func):
+    """Decorate the item to skip tests that should be skipped if building on 
+       Linux with clang.
+    """
     if isinstance(func, type) and issubclass(func, unittest2.TestCase):
-        raise Exception("@expectedFailureClang can only be used to decorate a test method")
+        raise Exception("@skipIfLinuxClang can only be used to decorate a test method")
     @wraps(func)
     def wrapper(*args, **kwargs):
         from unittest2 import case
         self = args[0]
         compiler = self.getCompiler()
-        try:
+        platform = sys.platform
+        if "clang" in compiler and "linux" in platform:
+            self.skipTest("skipping because Clang is used on Linux")
+        else:
             func(*args, **kwargs)
-        except Exception:
-            if "clang" in compiler:
-                raise case._ExpectedFailure(sys.exc_info())
-            else:
-                raise
+    return wrapper
 
-        if "clang" in compiler:
-            raise case._UnexpectedSuccess
+def skipIfGcc(func):
+    """Decorate the item to skip tests that should be skipped if building with gcc ."""
+    if isinstance(func, type) and issubclass(func, unittest2.TestCase):
+        raise Exception("@skipIfGcc can only be used to decorate a test method")
+    @wraps(func)
+    def wrapper(*args, **kwargs):
+        from unittest2 import case
+        self = args[0]
+        compiler = self.getCompiler()
+        if "gcc" in compiler:
+            self.skipTest("skipping because gcc is the test compiler")
+        else:
+            func(*args, **kwargs)
     return wrapper
 
-def expectedFailurei386(func):
-    """Decorate the item as an i386 only expectedFailure."""
+def skipIfIcc(func):
+    """Decorate the item to skip tests that should be skipped if building with icc ."""
     if isinstance(func, type) and issubclass(func, unittest2.TestCase):
-        raise Exception("@expectedFailurei386 can only be used to decorate a test method")
+        raise Exception("@skipIfIcc can only be used to decorate a test method")
     @wraps(func)
     def wrapper(*args, **kwargs):
         from unittest2 import case
         self = args[0]
-        arch = self.getArchitecture()
-        try:
+        compiler = self.getCompiler()
+        if "icc" in compiler:
+            self.skipTest("skipping because icc is the test compiler")
+        else:
             func(*args, **kwargs)
-        except Exception:
-            if "i386" in arch:
-                raise case._ExpectedFailure(sys.exc_info())
-            else:
-                raise
+    return wrapper
 
-        if "i386" in arch:
-            raise case._UnexpectedSuccess
+def skipIfi386(func):
+    """Decorate the item to skip tests that should be skipped if building 32-bit."""
+    if isinstance(func, type) and issubclass(func, unittest2.TestCase):
+        raise Exception("@skipIfi386 can only be used to decorate a test method")
+    @wraps(func)
+    def wrapper(*args, **kwargs):
+        from unittest2 import case
+        self = args[0]
+        if "i386" == self.getArchitecture():
+            self.skipTest("skipping because i386 is not a supported architecture")
+        else:
+            func(*args, **kwargs)
     return wrapper
 
+
 class Base(unittest2.TestCase):
     """
     Abstract base for performing lldb (see TestBase) or other generic tests (see
@@ -431,6 +690,7 @@ class Base(unittest2.TestCase):
     accomplish things.
     
     """
+
     # The concrete subclass should override this attribute.
     mydir = None
 
@@ -451,6 +711,7 @@ class Base(unittest2.TestCase):
         # Fail fast if 'mydir' attribute is not overridden.
         if not cls.mydir or len(cls.mydir) == 0:
             raise Exception("Subclasses must override the 'mydir' attribute.")
+
         # Save old working directory.
         cls.oldcwd = os.getcwd()
 
@@ -574,6 +835,12 @@ class Base(unittest2.TestCase):
         self.dicts = []
         self.doTearDownCleanups = False
 
+        # List of spawned subproces.Popen objects
+        self.subprocesses = []
+
+        # List of forked process PIDs
+        self.forkedProcessPids = []
+
         # Create a string buffer to record the session info, to be dumped into a
         # test case specific file if test failure is encountered.
         self.session = StringIO.StringIO()
@@ -597,6 +864,12 @@ class Base(unittest2.TestCase):
         # See HideStdout(self).
         self.sys_stdout_hidden = False
 
+        # set environment variable names for finding shared libraries
+        if sys.platform.startswith("darwin"):
+            self.dylibPath = 'DYLD_LIBRARY_PATH'
+        elif sys.platform.startswith("linux") or sys.platform.startswith("freebsd"):
+            self.dylibPath = 'LD_LIBRARY_PATH'
+
     def runHooks(self, child=None, child_prompt=None, use_cmd_api=False):
         """Perform the run hooks to bring lldb debugger to the desired state.
 
@@ -621,6 +894,64 @@ class Base(unittest2.TestCase):
                 child.sendline(hook)
                 child.expect_exact(child_prompt)
 
+    def setAsync(self, value):
+        """ Sets async mode to True/False and ensures it is reset after the testcase completes."""
+        old_async = self.dbg.GetAsync()
+        self.dbg.SetAsync(value)
+        self.addTearDownHook(lambda: self.dbg.SetAsync(old_async))
+
+    def cleanupSubprocesses(self):
+        # Ensure any subprocesses are cleaned up
+        for p in self.subprocesses:
+            if p.poll() == None:
+                p.terminate()
+            del p
+        del self.subprocesses[:]
+        # Ensure any forked processes are cleaned up
+        for pid in self.forkedProcessPids:
+            if os.path.exists("/proc/" + str(pid)):
+                os.kill(pid, signal.SIGTERM)
+
+    def spawnSubprocess(self, executable, args=[]):
+        """ Creates a subprocess.Popen object with the specified executable and arguments,
+            saves it in self.subprocesses, and returns the object.
+            NOTE: if using this function, ensure you also call:
+
+              self.addTearDownHook(self.cleanupSubprocesses)
+
+            otherwise the test suite will leak processes.
+        """
+
+        # Don't display the stdout if not in TraceOn() mode.
+        proc = Popen([executable] + args,
+                     stdout = open(os.devnull) if not self.TraceOn() else None,
+                     stdin = PIPE)
+        self.subprocesses.append(proc)
+        return proc
+
+    def forkSubprocess(self, executable, args=[]):
+        """ Fork a subprocess with its own group ID.
+            NOTE: if using this function, ensure you also call:
+
+              self.addTearDownHook(self.cleanupSubprocesses)
+
+            otherwise the test suite will leak processes.
+        """
+        child_pid = os.fork()
+        if child_pid == 0:
+            # If more I/O support is required, this can be beefed up.
+            fd = os.open(os.devnull, os.O_RDWR)
+            os.dup2(fd, 0)
+            os.dup2(fd, 1)
+            os.dup2(fd, 2)
+            # This call causes the child to have its of group ID
+            os.setpgid(0,0)
+            os.execvp(executable, [executable] + args)
+        # Give the child time to get through the execvp() call
+        time.sleep(0.1)
+        self.forkedProcessPids.append(child_pid)
+        return child_pid
+
     def HideStdout(self):
         """Hide output to stdout from the user.
 
@@ -684,14 +1015,17 @@ class Base(unittest2.TestCase):
         if self.child and self.child.isalive():
             with recording(self, traceAlways) as sbuf:
                 print >> sbuf, "tearing down the child process...."
-            if self.child_in_script_interpreter:
-                self.child.sendline('quit()')
-                self.child.expect_exact(self.child_prompt)
-            self.child.sendline('quit')
             try:
+                if self.child_in_script_interpreter:
+                    self.child.sendline('quit()')
+                    self.child.expect_exact(self.child_prompt)
+                self.child.sendline('settings set interpreter.prompt-on-quit false')
+                self.child.sendline('quit')
                 self.child.expect(pexpect.EOF)
-            except:
+            except ValueError, ExceptionPexpect:
+                # child is already terminated
                 pass
+
             # Give it one final blow to make sure the child is terminated.
             self.child.close()
 
@@ -736,14 +1070,17 @@ class Base(unittest2.TestCase):
             # Once by the Python unittest framework, and a second time by us.
             print >> sbuf, "FAIL"
 
-    def markExpectedFailure(self):
+    def markExpectedFailure(self,err,bugnumber):
         """Callback invoked when an expected failure/error occurred."""
         self.__expected__ = True
         with recording(self, False) as sbuf:
             # False because there's no need to write "expected failure" to the
             # stderr twice.
             # Once by the Python unittest framework, and a second time by us.
-            print >> sbuf, "expected failure"
+            if bugnumber == None:
+                print >> sbuf, "expected failure"
+            else:
+                print >> sbuf, "expected failure (problem id:" + str(bugnumber) + ")"	
 
     def markSkippedTest(self):
         """Callback invoked when a test is skipped."""
@@ -754,14 +1091,17 @@ class Base(unittest2.TestCase):
             # Once by the Python unittest framework, and a second time by us.
             print >> sbuf, "skipped test"
 
-    def markUnexpectedSuccess(self):
+    def markUnexpectedSuccess(self, bugnumber):
         """Callback invoked when an unexpected success occurred."""
         self.__unexpected__ = True
         with recording(self, False) as sbuf:
             # False because there's no need to write "unexpected success" to the
             # stderr twice.
             # Once by the Python unittest framework, and a second time by us.
-            print >> sbuf, "unexpected success"
+            if bugnumber == None:
+                print >> sbuf, "unexpected success"
+            else:
+                print >> sbuf, "unexpected success (problem id:" + str(bugnumber) + ")"	
 
     def dumpSessionInfo(self):
         """
@@ -818,7 +1158,7 @@ class Base(unittest2.TestCase):
                              os.environ["LLDB_SESSION_DIRNAME"])
         if not os.path.isdir(dname):
             os.mkdir(dname)
-        fname = os.path.join(dname, "%s-%s-%s-%s.log" % (prefix, self.getArchitecture(), self.getCompiler(), self.id()))
+        fname = os.path.join(dname, "%s-%s-%s-%s.log" % (prefix, self.getArchitecture(), "_".join(self.getCompiler().split('/')), self.id()))
         with open(fname, "w") as f:
             import datetime
             print >> f, "Session info generated @", datetime.datetime.now().ctime()
@@ -844,6 +1184,57 @@ class Base(unittest2.TestCase):
         module = builder_module()
         return module.getCompiler()
 
+    def getCompilerVersion(self):
+        """ Returns a string that represents the compiler version.
+            Supports: llvm, clang.
+        """
+        from lldbutil import which
+        version = 'unknown'
+
+        compiler = self.getCompiler()
+        version_output = system([which(compiler), "-v"])[1]
+        for line in version_output.split(os.linesep):
+            m = re.search('version ([0-9\.]+)', line)
+            if m:
+                version = m.group(1)
+        return version
+
+    def expectedCompilerVersion(self, compiler_version):
+        """Returns True iff compiler_version[1] matches the current compiler version.
+           Use compiler_version[0] to specify the operator used to determine if a match has occurred.
+           Any operator other than the following defaults to an equality test:
+             '>', '>=', "=>", '<', '<=', '=<', '!=', "!" or 'not'
+        """
+        if (compiler_version == None):
+            return True
+        operator = str(compiler_version[0])
+        version = compiler_version[1]
+
+        if (version == None):
+            return True
+        if (operator == '>'):
+            return self.getCompilerVersion() > version
+        if (operator == '>=' or operator == '=>'): 
+            return self.getCompilerVersion() >= version
+        if (operator == '<'):
+            return self.getCompilerVersion() < version
+        if (operator == '<=' or operator == '=<'):
+            return self.getCompilerVersion() <= version
+        if (operator == '!=' or operator == '!' or operator == 'not'):
+            return str(version) not in str(self.getCompilerVersion())
+        return str(version) in str(self.getCompilerVersion())
+
+    def expectedCompiler(self, compilers):
+        """Returns True iff any element of compilers is a sub-string of the current compiler."""
+        if (compilers == None):
+            return True
+
+        for compiler in compilers:
+            if compiler in self.getCompiler():
+                return True
+
+        return False
+
     def getRunOptions(self):
         """Command line option for -A and -C to run this test again, called from
         self.dumpSessionInfo()."""
@@ -861,6 +1252,39 @@ class Base(unittest2.TestCase):
     # Build methods supported through a plugin interface
     # ==================================================
 
+    def buildDriver(self, sources, exe_name):
+        """ Platform-specific way to build a program that links with LLDB (via the liblldb.so
+            or LLDB.framework).
+        """
+        if "gcc" in self.getCompiler() and "4.6" in self.getCompilerVersion():
+          stdflag = "-std=c++0x"
+        else:
+          stdflag = "-std=c++11"
+
+        if sys.platform.startswith("darwin"):
+            dsym = os.path.join(self.lib_dir, 'LLDB.framework', 'LLDB')
+            d = {'CXX_SOURCES' : sources,
+                 'EXE' : exe_name,
+                 'CFLAGS_EXTRAS' : "%s -stdlib=libc++" % stdflag,
+                 'FRAMEWORK_INCLUDES' : "-F%s" % self.lib_dir,
+                 'LD_EXTRAS' : "%s -rpath %s" % (dsym, self.lib_dir),
+                }
+        elif sys.platform.startswith("linux") or os.environ.get('LLDB_BUILD_TYPE') == 'Makefile':
+            d = {'CXX_SOURCES' : sources, 
+                 'EXE' : exe_name,
+                 'CFLAGS_EXTRAS' : "%s -I%s" % (stdflag, os.path.join(os.environ["LLDB_SRC"], "include")),
+                 'LD_EXTRAS' : "-L%s -llldb" % self.lib_dir}
+        if self.TraceOn():
+            print "Building LLDB Driver (%s) from sources %s" % (exe_name, sources)
+
+        self.buildDefault(dictionary=d)
+
+    def buildProgram(self, sources, exe_name):
+        """ Platform specific way to build an executable from C/C++ sources. """
+        d = {'CXX_SOURCES' : sources,
+             'EXE' : exe_name}
+        self.buildDefault(dictionary=d)
+
     def buildDefault(self, architecture=None, compiler=None, dictionary=None, clean=True):
         """Platform specific way to build the default binaries."""
         if lldb.skip_build_and_cleanup:
@@ -885,6 +1309,29 @@ class Base(unittest2.TestCase):
         if not module.buildDwarf(self, architecture, compiler, dictionary, clean):
             raise Exception("Don't know how to build binary with dwarf")
 
+    def getBuildFlags(self, use_cpp11=True, use_pthreads=True):
+        """ Returns a dictionary (which can be provided to build* functions above) which
+            contains OS-specific build flags.
+        """
+        cflags = ""
+        if use_cpp11:
+            cflags += "-std="
+            if "gcc" in self.getCompiler() and "4.6" in self.getCompilerVersion():
+                cflags += "c++0x"
+            else:
+                cflags += "c++11"
+        if sys.platform.startswith("darwin"):
+            cflags += " -stdlib=libc++"
+        elif "clang" in self.getCompiler():
+            cflags += " -stdlib=libstdc++"
+
+        if use_pthreads:
+            ldflags = "-lpthread"
+
+        return {'CFLAGS_EXTRAS' : cflags,
+                'LD_EXTRAS' : ldflags,
+               }
+
     def cleanup(self, dictionary=None):
         """Platform specific way to do cleanup after build."""
         if lldb.skip_build_and_cleanup:
@@ -893,6 +1340,19 @@ class Base(unittest2.TestCase):
         if not module.cleanup(self, dictionary):
             raise Exception("Don't know how to do cleanup with dictionary: "+dictionary)
 
+    def getLLDBLibraryEnvVal(self):
+        """ Returns the path that the OS-specific library search environment variable
+            (self.dylibPath) should be set to in order for a program to find the LLDB
+            library. If an environment variable named self.dylibPath is already set,
+            the new path is appended to it and returned.
+        """
+        existing_library_path = os.environ[self.dylibPath] if self.dylibPath in os.environ else None
+        if existing_library_path:
+            return "%s:%s" % (existing_library_path, self.lib_dir)
+        elif sys.platform.startswith("darwin"):
+            return os.path.join(self.lib_dir, 'LLDB.framework')
+        else:
+            return self.lib_dir
 
 class TestBase(Base):
     """
@@ -963,6 +1423,30 @@ class TestBase(Base):
                 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()
@@ -1039,6 +1523,27 @@ class TestBase(Base):
         if lldb.pre_flight:
             lldb.pre_flight(self)
 
+    # utility methods that tests can use to access the current objects
+    def target(self):
+        if not self.dbg:
+            raise Exception('Invalid debugger instance')
+        return self.dbg.GetSelectedTarget()
+
+    def process(self):
+        if not self.dbg:
+            raise Exception('Invalid debugger instance')
+        return self.dbg.GetSelectedTarget().GetProcess()
+
+    def thread(self):
+        if not self.dbg:
+            raise Exception('Invalid debugger instance')
+        return self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread()
+
+    def frame(self):
+        if not self.dbg:
+            raise Exception('Invalid debugger instance')
+        return self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame()
+
     def tearDown(self):
         #import traceback
         #traceback.print_stack()
@@ -1151,6 +1656,49 @@ class TestBase(Base):
             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.
@@ -1191,7 +1739,10 @@ class TestBase(Base):
                                  "Command '" + str + "' is expected to fail!")
         else:
             # No execution required, just compare str against the golden input.
-            output = str
+            if isinstance(str,lldb.SBCommandReturnObject):
+                output = str.GetOutput()
+            else:
+                output = str
             with recording(self, trace) as sbuf:
                 print >> sbuf, "looking at:", output
 

Modified: lldb/branches/lldb-platform-work/test/lldbutil.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lldbutil.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lldbutil.py (original)
+++ lldb/branches/lldb-platform-work/test/lldbutil.py Thu Jun  6 19:06:43 2013
@@ -258,6 +258,202 @@ def value_type_to_str(enum):
 
 
 # ==================================================
+# 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 module_name:
+        command += " --shlib '%s'" % (module_name)
+
+    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 module_name:
+        command += " --shlib '%s'" % (module_name)
+
+    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 module_name:
+        command += ' --shlib "%s"' % (module_name)
+
+    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
 # ==================================================
 
@@ -283,7 +479,7 @@ def get_stopped_thread(process, reason):
     ...
         from lldbutil import get_stopped_thread
         thread = get_stopped_thread(process, lldb.eStopReasonPlanComplete)
-        self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint condition")
+        self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
     ...
 
     2. Get the thread stopped due to a breakpoint
@@ -291,7 +487,7 @@ def get_stopped_thread(process, reason):
     ...
         from lldbutil import get_stopped_thread
         thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
-        self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint")
+        self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint")
     ...
 
     """

Modified: lldb/branches/lldb-platform-work/test/logging/TestLogging.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/logging/TestLogging.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/logging/TestLogging.py (original)
+++ lldb/branches/lldb-platform-work/test/logging/TestLogging.py Thu Jun  6 19:06:43 2013
@@ -28,13 +28,13 @@ class LogTestCase(TestBase):
                     patterns = [ "Current executable set to .*a.out" ])
 
         log_file = os.path.join (os.getcwd(), "lldb-commands-log-%s-%s-%s.txt" % (type,
-                                                                                  self.getCompiler(),
+                                                                                  os.path.basename(self.getCompiler()),
                                                                                   self.getArchitecture()))
 
         if (os.path.exists (log_file)):
             os.remove (log_file)
 
-        self.runCmd ("log enable lldb commands -f " + log_file)
+        self.runCmd ("log enable -f '%s' lldb commands" % (log_file))
         
         self.runCmd ("command alias bp breakpoint")
                      
@@ -43,24 +43,24 @@ class LogTestCase(TestBase):
         self.runCmd ("bp l")
 
         expected_log_lines = [
-            "com.apple.main-thread Processing command: command alias bp breakpoint\n",
-            "com.apple.main-thread HandleCommand, cmd_obj : 'command alias'\n",
-            "com.apple.main-thread HandleCommand, revised_command_line: 'command alias bp breakpoint'\n",
-            "com.apple.main-thread HandleCommand, wants_raw_input:'True'\n",
-            "com.apple.main-thread HandleCommand, command line after removing command name(s): 'bp breakpoint'\n",
-            "com.apple.main-thread HandleCommand, command succeeded\n",
-            "com.apple.main-thread Processing command: bp set -n main\n",
-            "com.apple.main-thread HandleCommand, cmd_obj : 'breakpoint set'\n",
-            "com.apple.main-thread HandleCommand, revised_command_line: 'breakpoint set -n main'\n",
-            "com.apple.main-thread HandleCommand, wants_raw_input:'False'\n",
-            "com.apple.main-thread HandleCommand, command line after removing command name(s): '-n main'\n",
-            "com.apple.main-thread HandleCommand, command succeeded\n",
-            "com.apple.main-thread Processing command: bp l\n",
-            "com.apple.main-thread HandleCommand, cmd_obj : 'breakpoint list'\n",
-            "com.apple.main-thread HandleCommand, revised_command_line: 'breakpoint l'\n",
-            "com.apple.main-thread HandleCommand, wants_raw_input:'False'\n",
-            "com.apple.main-thread HandleCommand, command line after removing command name(s): ''\n",
-            "com.apple.main-thread HandleCommand, command succeeded\n",
+            "Processing command: command alias bp breakpoint\n",
+            "HandleCommand, cmd_obj : 'command alias'\n",
+            "HandleCommand, revised_command_line: 'command alias bp breakpoint'\n",
+            "HandleCommand, wants_raw_input:'True'\n",
+            "HandleCommand, command line after removing command name(s): 'bp breakpoint'\n",
+            "HandleCommand, command succeeded\n",
+            "Processing command: bp set -n main\n",
+            "HandleCommand, cmd_obj : 'breakpoint set'\n",
+            "HandleCommand, revised_command_line: 'breakpoint set -n main'\n",
+            "HandleCommand, wants_raw_input:'False'\n",
+            "HandleCommand, command line after removing command name(s): '-n main'\n",
+            "HandleCommand, command succeeded\n",
+            "Processing command: bp l\n",
+            "HandleCommand, cmd_obj : 'breakpoint list'\n",
+            "HandleCommand, revised_command_line: 'breakpoint l'\n",
+            "HandleCommand, wants_raw_input:'False'\n",
+            "HandleCommand, command line after removing command name(s): ''\n",
+            "HandleCommand, command succeeded\n",
             ]
 
         self.assertTrue (os.path.isfile (log_file))

Modified: lldb/branches/lldb-platform-work/test/macosx/universal/TestUniversal.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/macosx/universal/TestUniversal.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/macosx/universal/TestUniversal.py (original)
+++ lldb/branches/lldb-platform-work/test/macosx/universal/TestUniversal.py Thu Jun  6 19:06:43 2013
@@ -4,6 +4,7 @@ import os, time
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class UniversalTestCase(TestBase):
 
@@ -52,10 +53,7 @@ class UniversalTestCase(TestBase):
             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)
@@ -80,10 +78,7 @@ class UniversalTestCase(TestBase):
             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/lldb-platform-work/test/make/Makefile.rules
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/make/Makefile.rules?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/make/Makefile.rules (original)
+++ lldb/branches/lldb-platform-work/test/make/Makefile.rules Thu Jun  6 19:06:43 2013
@@ -54,26 +54,49 @@ ifeq "$(CC)" "cc"
 endif
 
 #----------------------------------------------------------------------
+# ARCHFLAG is the flag used to tell the compiler which architecture
+# to compile for. The default is the flag that clang accepts.
+#----------------------------------------------------------------------
+ARCHFLAG ?= -arch 
+
+#----------------------------------------------------------------------
 # Change any build/tool options needed
 #----------------------------------------------------------------------
-CFLAGS ?= -gdwarf-2 -O0
-CFLAGS += $(FRAMEWORK_INCLUDES) $(CFLAGS_EXTRAS)
 ifeq "$(OS)" "Darwin"
-	CFLAGS += -arch $(ARCH)
 	DS := dsymutil
 	DSFLAGS =
 	DSYM = $(EXE).dSYM
 	AR := libtool
 	ARFLAGS := -static -o
+else
+	# On non-Apple platforms, -arch becomes -m
+	ARCHFLAG := -m
+
+	# i386 becomes 32, and x86_64 becomes 64
+	ifeq "$(ARCH)" "x86_64"
+	    override ARCH := $(subst x86_64,64,$(ARCH))
+	endif
+	ifeq "$(ARCH)" "i386"
+	    override ARCH := $(subst i386,32,$(ARCH))
+	endif
 endif
 
+CFLAGS ?= -g -O0
+CFLAGS += $(ARCHFLAG)$(ARCH) $(FRAMEWORK_INCLUDES) $(CFLAGS_EXTRAS)
+
 CXXFLAGS +=$(CFLAGS)
 LD = $(CC)
 LDFLAGS ?= $(CFLAGS)
-LDFLAGS += $(LD_EXTRAS) -arch $(ARCH)
+LDFLAGS += $(LD_EXTRAS)
 OBJECTS =
 EXE ?= a.out
 
+ifneq (,$(findstring g++,$(CXX)))
+	# GCC 4.6 cannot handle -std=c++11, so replace it with -std=c++0x
+	# instead. FIXME: remove once GCC version is upgraded.
+	override CXXFLAGS := $(subst -std=c++11,-std=c++0x,$(CXXFLAGS))
+endif
+
 ifneq "$(DYLIB_NAME)" ""
 	ifeq "$(OS)" "Darwin"
 		DYLIB_FILENAME = lib$(DYLIB_NAME).dylib
@@ -83,10 +106,21 @@ ifneq "$(DYLIB_NAME)" ""
 endif
 
 # Function that returns the counterpart C++ compiler, given $(CC) as arg.
-cxx_compiler = $(if $(findstring clang,$(1)), $(subst clang,clang++,$(1)), $(if $(findstring llvm-gcc,$(1)), $(subst llvm-gcc,llvm-g++,$(1)), $(subst gcc,g++,$(1))))
+cxx_compiler = $(if $(findstring clang,$(1)), $(subst clang,clang++,$(1)), $(if $(findstring icc,$(1)), $(subst icc,icpc,$(1)), $(if $(findstring llvm-gcc,$(1)), $(subst llvm-gcc,llvm-g++,$(1)), $(subst gcc,g++,$(1)))))
 
 # Function that returns the C++ linker, given $(CC) as arg.
-cxx_linker = $(if $(findstring clang,$(1)), $(subst clang,clang++,$(1)), $(if $(findstring llvm-gcc,$(1)), $(subst llvm-gcc,llvm-g++,$(1)), $(subst gcc,g++,$(1))))
+cxx_linker = $(if $(findstring clang,$(1)), $(subst clang,clang++,$(1)), $(if $(findstring icc,$(1)), $(subst icc,icpc,$(1)), $(if $(findstring llvm-gcc,$(1)), $(subst llvm-gcc,llvm-g++,$(1)), $(subst gcc,g++,$(1)))))
+
+#----------------------------------------------------------------------
+# C++ standard library options
+#----------------------------------------------------------------------
+ifeq (1,$(USE_LIBSTDCPP))
+	# Clang requires an extra flag: -stdlib=libstdc++
+	ifneq (,$(findstring clang,$(CC)))
+		CFLAGS += -stdlib=libstdc++
+		LDFLAGS += -stdlib=libstdc++
+	endif
+endif
 
 #----------------------------------------------------------------------
 # dylib settings
@@ -208,7 +242,7 @@ EXE = $(DYLIB_FILENAME)
 endif
 else
 $(EXE) : $(OBJECTS) $(ARCHIVE_NAME)
-	$(LD) $(LDFLAGS) $(OBJECTS) $(ARCHIVE_NAME) -o "$(EXE)"
+	$(LD) $(OBJECTS) $(LDFLAGS) $(ARCHIVE_NAME) -o "$(EXE)"
 endif
 
 #----------------------------------------------------------------------
@@ -230,6 +264,11 @@ endif
 $(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/lldb-platform-work/test/plugins/builder_base.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/plugins/builder_base.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/plugins/builder_base.py (original)
+++ lldb/branches/lldb-platform-work/test/plugins/builder_base.py Thu Jun  6 19:06:43 2013
@@ -23,6 +23,20 @@ def getCompiler():
     """Returns the compiler in effect the test suite is running with."""
     return os.environ["CC"] if "CC" in os.environ else "clang"
 
+def getArchFlag():
+    """Returns the flag required to specify the arch"""
+    compiler = getCompiler()
+    if compiler is None:
+      return ""
+    elif "gcc" in compiler:
+      archflag = "-m"
+    elif "clang" in compiler:
+      archflag = "-arch "
+    else:
+      archflag = None
+
+    return (" ARCHFLAG=" + archflag) if archflag else ""
+
 def getArchSpec(architecture):
     """
     Helper function to return the key-value string to specify the architecture
@@ -101,6 +115,8 @@ def buildDwarf(sender=None, architecture
 
 def cleanup(sender=None, dictionary=None):
     """Perform a platform-specific cleanup after the test."""
+    #import traceback
+    #traceback.print_stack()
     if os.path.isfile("Makefile"):
         lldbtest.system(["/bin/sh", "-c", "make clean"+getCmdLine(dictionary)],
                         sender=sender)

Modified: lldb/branches/lldb-platform-work/test/python_api/debugger/TestDebuggerAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/python_api/debugger/TestDebuggerAPI.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/python_api/debugger/TestDebuggerAPI.py (original)
+++ lldb/branches/lldb-platform-work/test/python_api/debugger/TestDebuggerAPI.py Thu Jun  6 19:06:43 2013
@@ -2,11 +2,10 @@
 Test Debugger APIs.
 """
 
-import os, time
-import re
-import unittest2
-import lldb, lldbutil
-from lldbtest import *
+import os
+import lldb
+from lldbtest import TestBase, python_api_test
+
 
 class DebuggerAPITestCase(TestBase):
 
@@ -25,6 +24,9 @@ class DebuggerAPITestCase(TestBase):
         self.dbg.FindTargetWithFileAndArch(None, None)
         self.dbg.SetInternalVariable(None, None, None)
         self.dbg.GetInternalVariableValue(None, None)
+        # FIXME (filcab): We must first allow for the swig bindings to know if
+        # a Python callback is set. (Check python-typemaps.swig)
+        #self.dbg.SetLoggingCallback(None)
         self.dbg.SetPrompt(None)
         self.dbg.SetCurrentPlatform(None)
         self.dbg.SetCurrentPlatformSDKRoot(None)
@@ -35,4 +37,3 @@ class DebuggerAPITestCase(TestBase):
         target = lldb.SBTarget()
         self.assertFalse(target.IsValid())
         self.dbg.DeleteTarget(target)
-        

Modified: lldb/branches/lldb-platform-work/test/python_api/default-constructor/sb_debugger.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/python_api/default-constructor/sb_debugger.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/python_api/default-constructor/sb_debugger.py (original)
+++ lldb/branches/lldb-platform-work/test/python_api/default-constructor/sb_debugger.py Thu Jun  6 19:06:43 2013
@@ -32,7 +32,10 @@ def fuzz_obj(obj):
     obj.GetSourceManager()
     obj.SetSelectedTarget(lldb.SBTarget())
     obj.SetCurrentPlatformSDKRoot("tmp/sdk-root")
-    obj.DispatchInput(None, None, 0)
+    try:
+        obj.DispatchInput(None)
+    except Exception:
+        pass
     obj.DispatchInputInterrupt()
     obj.DispatchInputEndOfFile()
     obj.PushInputReader(lldb.SBInputReader())

Modified: lldb/branches/lldb-platform-work/test/python_api/default-constructor/sb_inputreader.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/python_api/default-constructor/sb_inputreader.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/python_api/default-constructor/sb_inputreader.py (original)
+++ lldb/branches/lldb-platform-work/test/python_api/default-constructor/sb_inputreader.py Thu Jun  6 19:06:43 2013
@@ -6,7 +6,10 @@ import sys
 import lldb
 
 def fuzz_obj(obj):
-    obj.Initialize(lldb.SBDebugger.Create(), None, None, 0, "$", "^", True)
+    try:
+        obj.Initialize(lldb.SBDebugger.Create(), None, 0, "$", "^", True)
+    except Exception:
+        pass
     obj.IsActive()
     obj.IsDone()
     obj.SetIsDone(True)

Modified: lldb/branches/lldb-platform-work/test/python_api/formatters/TestFormattersSBAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/python_api/formatters/TestFormattersSBAPI.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/python_api/formatters/TestFormattersSBAPI.py (original)
+++ lldb/branches/lldb-platform-work/test/python_api/formatters/TestFormattersSBAPI.py Thu Jun  6 19:06:43 2013
@@ -4,6 +4,7 @@ import os, sys, time
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class SBFormattersAPITestCase(TestBase):
 
@@ -42,10 +43,7 @@ class SBFormattersAPITestCase(TestBase):
         """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 @@ class SBFormattersAPITestCase(TestBase):
         """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/lldb-platform-work/test/python_api/function_symbol/TestDisasmAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/python_api/function_symbol/TestDisasmAPI.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/python_api/function_symbol/TestDisasmAPI.py (original)
+++ lldb/branches/lldb-platform-work/test/python_api/function_symbol/TestDisasmAPI.py Thu Jun  6 19:06:43 2013
@@ -61,7 +61,7 @@ class DisasmAPITestCase(TestBase):
         # Frame #0 should be on self.line1.
         self.assertTrue(process.GetState() == lldb.eStateStopped)
         thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
-        self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint condition")
+        self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
         frame0 = thread.GetFrameAtIndex(0)
         lineEntry = frame0.GetLineEntry()
         self.assertTrue(lineEntry.GetLine() == self.line1)
@@ -80,7 +80,7 @@ class DisasmAPITestCase(TestBase):
         process.Continue()
         self.assertTrue(process.GetState() == lldb.eStateStopped)
         thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
-        self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint condition")
+        self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
         frame0 = thread.GetFrameAtIndex(0)
         lineEntry = frame0.GetLineEntry()
         self.assertTrue(lineEntry.GetLine() == self.line2)

Modified: lldb/branches/lldb-platform-work/test/python_api/function_symbol/TestSymbolAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/python_api/function_symbol/TestSymbolAPI.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/python_api/function_symbol/TestSymbolAPI.py (original)
+++ lldb/branches/lldb-platform-work/test/python_api/function_symbol/TestSymbolAPI.py Thu Jun  6 19:06:43 2013
@@ -61,7 +61,7 @@ class SymbolAPITestCase(TestBase):
         # Frame #0 should be on self.line1.
         self.assertTrue(process.GetState() == lldb.eStateStopped)
         thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
-        self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint condition")
+        self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
         frame0 = thread.GetFrameAtIndex(0)
         symbol_line1 = frame0.GetSymbol()
         # We should have a symbol type of code.
@@ -74,7 +74,7 @@ class SymbolAPITestCase(TestBase):
         process.Continue()
         self.assertTrue(process.GetState() == lldb.eStateStopped)
         thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
-        self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint condition")
+        self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
         frame0 = thread.GetFrameAtIndex(0)
         symbol_line2 = frame0.GetSymbol()
         # We should have a symbol type of code.

Modified: lldb/branches/lldb-platform-work/test/python_api/hello_world/TestHelloWorld.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/python_api/hello_world/TestHelloWorld.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/python_api/hello_world/TestHelloWorld.py (original)
+++ lldb/branches/lldb-platform-work/test/python_api/hello_world/TestHelloWorld.py Thu Jun  6 19:06:43 2013
@@ -138,11 +138,9 @@ class HelloWorldTestCase(TestBase):
 
         target = self.dbg.CreateTarget(self.exe)
 
-        # Spawn a new process and don't display the stdout if not in TraceOn() mode.
-        import subprocess
-        popen = subprocess.Popen([self.exe, "abc", "xyz"],
-                                 stdout = open(os.devnull, 'w') if not self.TraceOn() else None)
-        #print "pid of spawned process: %d" % popen.pid
+        # Spawn a new process
+        popen = self.spawnSubprocess(self.exe, ["abc", "xyz"])
+        self.addTearDownHook(self.cleanupSubprocesses)
 
         listener = lldb.SBListener("my.attach.listener")
         error = lldb.SBError()
@@ -162,11 +160,9 @@ class HelloWorldTestCase(TestBase):
 
         target = self.dbg.CreateTarget(self.exe)
 
-        # Spawn a new process and don't display the stdout if not in TraceOn() mode.
-        import subprocess
-        popen = subprocess.Popen([self.exe, "abc", "xyz"],
-                                 stdout = open(os.devnull, 'w') if not self.TraceOn() else None)
-        #print "pid of spawned process: %d" % popen.pid
+        # Spawn a new process
+        popen = self.spawnSubprocess(self.exe, ["abc", "xyz"])
+        self.addTearDownHook(self.cleanupSubprocesses)
 
         listener = lldb.SBListener("my.attach.listener")
         error = lldb.SBError()

Modified: lldb/branches/lldb-platform-work/test/python_api/lldbutil/iter/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/python_api/lldbutil/iter/Makefile?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/python_api/lldbutil/iter/Makefile (original)
+++ lldb/branches/lldb-platform-work/test/python_api/lldbutil/iter/Makefile Thu Jun  6 19:06:43 2013
@@ -1,5 +1,7 @@
 LEVEL = ../../../make
 
+CFLAGS_EXTRAS := -D__STDC_LIMIT_MACROS
+LD_EXTRAS := -lpthread
 CXX_SOURCES := main.cpp
 MAKE_DSYM :=NO
 

Modified: lldb/branches/lldb-platform-work/test/python_api/lldbutil/iter/TestRegistersIterator.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/python_api/lldbutil/iter/TestRegistersIterator.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/python_api/lldbutil/iter/TestRegistersIterator.py (original)
+++ lldb/branches/lldb-platform-work/test/python_api/lldbutil/iter/TestRegistersIterator.py Thu Jun  6 19:06:43 2013
@@ -18,6 +18,7 @@ class RegistersIteratorTestCase(TestBase
         # Find the line number to break inside main().
         self.line1 = line_number('main.cpp', '// Set break point at this line.')
 
+    @expectedFailureLinux # llvm.org/pr14600 - Exception state registers not supported on Linux
     @python_api_test
     def test_iter_registers(self):
         """Test iterator works correctly for lldbutil.iter_registers()."""

Modified: lldb/branches/lldb-platform-work/test/python_api/lldbutil/process/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/python_api/lldbutil/process/Makefile?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/python_api/lldbutil/process/Makefile (original)
+++ lldb/branches/lldb-platform-work/test/python_api/lldbutil/process/Makefile Thu Jun  6 19:06:43 2013
@@ -1,5 +1,7 @@
 LEVEL = ../../../make
 
+CFLAGS_EXTRAS := -D__STDC_LIMIT_MACROS
+LD_EXTRAS := -lpthread
 CXX_SOURCES := main.cpp
 MAKE_DSYM :=NO
 

Modified: lldb/branches/lldb-platform-work/test/python_api/lldbutil/process/TestPrintStackTraces.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/python_api/lldbutil/process/TestPrintStackTraces.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/python_api/lldbutil/process/TestPrintStackTraces.py (original)
+++ lldb/branches/lldb-platform-work/test/python_api/lldbutil/process/TestPrintStackTraces.py Thu Jun  6 19:06:43 2013
@@ -18,6 +18,7 @@ class ThreadsStackTracesTestCase(TestBas
         # Find the line number to break inside main().
         self.line = line_number('main.cpp', '// Set break point at this line.')
 
+    @expectedFailureLinux # llvm.org/pr14323
     @python_api_test
     def test_stack_traces(self):
         """Test SBprocess and SBThread APIs with printing of the stack traces."""

Modified: lldb/branches/lldb-platform-work/test/python_api/module_section/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/python_api/module_section/Makefile?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/python_api/module_section/Makefile (original)
+++ lldb/branches/lldb-platform-work/test/python_api/module_section/Makefile Thu Jun  6 19:06:43 2013
@@ -1,5 +1,7 @@
 LEVEL = ../../make
 
+CFLAGS_EXTRAS := -D__STDC_LIMIT_MACROS
+LD_EXTRAS := -lpthread
 CXX_SOURCES := main.cpp b.cpp c.cpp
 MAKE_DSYM :=NO
 

Modified: lldb/branches/lldb-platform-work/test/python_api/process/TestProcessAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/python_api/process/TestProcessAPI.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/python_api/process/TestProcessAPI.py (original)
+++ lldb/branches/lldb-platform-work/test/python_api/process/TestProcessAPI.py Thu Jun  6 19:06:43 2013
@@ -89,7 +89,7 @@ class ProcessAPITestCase(TestBase):
         process = target.LaunchSimple(None, None, os.getcwd())
 
         thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
-        self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint")
+        self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint")
         frame = thread.GetFrameAtIndex(0)
 
         # Get the SBValue for the global variable 'my_char'.
@@ -170,7 +170,7 @@ class ProcessAPITestCase(TestBase):
         process = target.LaunchSimple(None, None, os.getcwd())
 
         thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
-        self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint")
+        self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint")
         frame = thread.GetFrameAtIndex(0)
 
         # Get the SBValue for the global variable 'my_char'.
@@ -220,7 +220,7 @@ class ProcessAPITestCase(TestBase):
         process = target.LaunchSimple(None, None, os.getcwd())
 
         thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
-        self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint")
+        self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint")
         frame = thread.GetFrameAtIndex(0)
 
         # Get the SBValue for the global variable 'my_int'.

Modified: lldb/branches/lldb-platform-work/test/python_api/process/io/TestProcessIO.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/python_api/process/io/TestProcessIO.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/python_api/process/io/TestProcessIO.py (original)
+++ lldb/branches/lldb-platform-work/test/python_api/process/io/TestProcessIO.py Thu Jun  6 19:06:43 2013
@@ -35,7 +35,9 @@ class ProcessIOTestCase(TestBase):
 
         target = self.dbg.CreateTarget(self.exe)
 
-        self.dbg.SetAsync(True)
+        # Perform synchronous interaction with the debugger.
+        self.setAsync(True)
+
         process = target.LaunchSimple(None, None, os.getcwd())
         if self.TraceOn():
             print "process launched."

Modified: lldb/branches/lldb-platform-work/test/python_api/sbdata/TestSBData.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/python_api/sbdata/TestSBData.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/python_api/sbdata/TestSBData.py (original)
+++ lldb/branches/lldb-platform-work/test/python_api/sbdata/TestSBData.py Thu Jun  6 19:06:43 2013
@@ -6,6 +6,7 @@ import lldb
 import pexpect
 from lldbtest import *
 from math import fabs
+import lldbutil
 
 class SBDataAPICase(TestBase):
 
@@ -32,14 +33,24 @@ class SBDataAPICase(TestBase):
         # Find the line number to break on inside main.cpp.
         self.line = line_number('main.cpp', '// set breakpoint here')
 
+    def assert_data(self, func, arg, expected):
+        """ Asserts func(SBError error, arg) == expected. """
+        error = lldb.SBError()
+        result = func(error, arg)
+        if not error.Success():
+            stream = lldb.SBStream()
+            error.GetDescription(stream)
+            self.assertTrue(error.Success(),
+                            "%s(error, %s) did not succeed: %s" % (func.__name__,
+                                                                   arg,
+                                                                   stream.GetData()))
+        self.assertTrue(expected == result, "%s(error, %s) == %s != %s" % (func.__name__, arg, result, expected))
+          
     def data_api(self):
         """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)
         
@@ -70,35 +81,40 @@ class SBDataAPICase(TestBase):
         offset = 0
         error = lldb.SBError()
 
-        self.assertTrue(data.GetUnsignedInt32(error, offset) == 1, 'foo[0].a == 1')
+        self.assert_data(data.GetUnsignedInt32, offset, 1)
         offset += 4
         low = data.GetSignedInt16(error, offset)
+        self.assertTrue(error.Success())
         offset += 2
         high = data.GetSignedInt16(error, offset)
+        self.assertTrue(error.Success())
         offset += 2
         self.assertTrue ((low == 9 and high == 0) or (low == 0 and high == 9), 'foo[0].b == 9')
         self.assertTrue( fabs(data.GetFloat(error, offset) - 3.14) < 1, 'foo[0].c == 3.14')
+        self.assertTrue(error.Success())
         offset += 4
-        self.assertTrue(data.GetUnsignedInt32(error, offset) == 8, 'foo[1].a == 8')
+        self.assert_data(data.GetUnsignedInt32, offset, 8)
         offset += 4
-        self.assertTrue(data.GetUnsignedInt32(error, offset) == 5, 'foo[1].b == 5')
+        self.assert_data(data.GetUnsignedInt32, offset, 5)
         offset += 4
 
         self.runCmd("n")
 
         offset = 16
 
-        self.assertTrue(data.GetUnsignedInt32(error, offset) == 5, 'saved foo[1].b == 5')
+        self.assert_data(data.GetUnsignedInt32, offset, 5)
 
         data = foobar.GetPointeeData(1, 1)
 
         offset = 0
 
-        self.assertTrue(data.GetSignedInt32(error, offset) == 8, 'new foo[1].a == 8')
+        self.assert_data(data.GetSignedInt32, offset, 8)
         offset += 4
-        self.assertTrue(data.GetSignedInt32(error, offset) == 7, 'new foo[1].a == 7')
+        self.assert_data(data.GetSignedInt32, offset, 7)
         offset += 8
         self.assertTrue(data.GetUnsignedInt32(error, offset) == 0, 'do not read beyond end')
+        self.assertTrue(not error.Success())
+        error.Clear() # clear the error for the next test
 
         star_foobar = foobar.Dereference()
         self.assertTrue(star_foobar.IsValid())
@@ -109,9 +125,9 @@ class SBDataAPICase(TestBase):
             print data
         
         offset = 0
-        self.assertTrue(data.GetUnsignedInt32(error, offset) == 1, 'foo[0].a == 1')
+        self.assert_data(data.GetUnsignedInt32, offset, 1)
         offset += 4
-        self.assertTrue(data.GetUnsignedInt32(error, offset) == 9, 'foo[0].b == 9')
+        self.assert_data(data.GetUnsignedInt32, offset, 9)
 
         foobar_addr = star_foobar.GetLoadAddress()
         foobar_addr += 12
@@ -138,11 +154,12 @@ class SBDataAPICase(TestBase):
         self.runCmd("n")
 
         offset = 0
-        self.assertTrue(data.GetUnsignedInt32(error, offset) == 8, 'then foo[1].a == 8')
+        self.assert_data(data.GetUnsignedInt32, offset, 8)
         offset += 4
-        self.assertTrue(data.GetUnsignedInt32(error, offset) == 7, 'then foo[1].b == 7')
+        self.assert_data(data.GetUnsignedInt32, offset, 7)
         offset += 4
         self.assertTrue(fabs(data.GetFloat(error, offset) - 3.14) < 1, 'foo[1].c == 3.14')
+        self.assertTrue(error.Success())
 
         data = new_foobar.GetData()
 
@@ -150,11 +167,12 @@ class SBDataAPICase(TestBase):
             print data
 
         offset = 0
-        self.assertTrue(data.GetUnsignedInt32(error, offset) == 8, 'finally foo[1].a == 8')
+        self.assert_data(data.GetUnsignedInt32, offset, 8)
         offset += 4
-        self.assertTrue(data.GetUnsignedInt32(error, offset) == 7, 'finally foo[1].b == 7')
+        self.assert_data(data.GetUnsignedInt32, offset, 7)
         offset += 4
         self.assertTrue(fabs(data.GetFloat(error, offset) - 6.28) < 1, 'foo[1].c == 6.28')
+        self.assertTrue(error.Success())
 
         self.runCmd("n")
 
@@ -169,17 +187,19 @@ class SBDataAPICase(TestBase):
             print data
 
         offset = 0
-        self.assertTrue(data.GetUnsignedInt32(error, offset) == 1, 'barfoo[0].a = 1')
+        self.assert_data(data.GetUnsignedInt32, offset, 1)
         offset += 4
-        self.assertTrue(data.GetUnsignedInt32(error, offset) == 2, 'barfoo[0].b == 2')
+        self.assert_data(data.GetUnsignedInt32, offset, 2)
         offset += 4
         self.assertTrue(fabs(data.GetFloat(error, offset) - 3) < 1, 'barfoo[0].c == 3')
+        self.assertTrue(error.Success())
         offset += 4
-        self.assertTrue(data.GetUnsignedInt32(error, offset) == 4, 'barfoo[1].a = 4')
+        self.assert_data(data.GetUnsignedInt32, offset, 4)
         offset += 4
-        self.assertTrue(data.GetUnsignedInt32(error, offset) == 5, 'barfoo[1].b == 5')
+        self.assert_data(data.GetUnsignedInt32, offset, 5)
         offset += 4
         self.assertTrue(fabs(data.GetFloat(error, offset) - 6) < 1, 'barfoo[1].c == 6')
+        self.assertTrue(error.Success())
 
         new_object = barfoo.CreateValueFromData("new_object",data,barfoo.GetType().GetBasicType(lldb.eBasicTypeInt))
 
@@ -193,9 +213,11 @@ class SBDataAPICase(TestBase):
         self.assertTrue(new_object.GetValue() == "1", 'new_object == 1')
 
         data.SetData(error, 'A\0\0\0', data.GetByteOrder(), data.GetAddressByteSize())
+        self.assertTrue(error.Success())
         
         data2 = lldb.SBData()
         data2.SetData(error, 'BCD', data.GetByteOrder(), data.GetAddressByteSize())
+        self.assertTrue(error.Success())
 
         data.Append(data2)
         
@@ -204,33 +226,34 @@ class SBDataAPICase(TestBase):
 
         # this breaks on EBCDIC
         offset = 0
-        self.assertTrue(data.GetUnsignedInt32(error, offset) == 65, 'made-up data == 65')
+        self.assert_data(data.GetUnsignedInt32, offset, 65)
         offset += 4
-        self.assertTrue(data.GetUnsignedInt8(error, offset) == 66, 'made-up data == 66')
+        self.assert_data(data.GetUnsignedInt8, offset, 66)
         offset += 1
-        self.assertTrue(data.GetUnsignedInt8(error, offset) == 67, 'made-up data == 67')
+        self.assert_data(data.GetUnsignedInt8, offset, 67)
         offset += 1
-        self.assertTrue(data.GetUnsignedInt8(error, offset) == 68, 'made-up data == 68')
+        self.assert_data(data.GetUnsignedInt8, offset, 68)
         offset += 1
 
-        # check the new API calls introduced per LLVM bugzilla enhancement request
+        # check the new API calls introduced per LLVM llvm.org/prenhancement request
         # 11619 (Allow creating SBData values from arrays or primitives in Python)
 
-        data2 = lldb.SBData.CreateDataFromCString(process.GetByteOrder(),process.GetAddressByteSize(),'hello!')
+        hello_str = "hello!"
+        data2 = lldb.SBData.CreateDataFromCString(process.GetByteOrder(),process.GetAddressByteSize(),hello_str)
+        self.assertTrue(len(data2.uint8) == len(hello_str))
         self.assertTrue(data2.uint8[0] == 104, 'h == 104')
         self.assertTrue(data2.uint8[1] == 101, 'e == 101')
         self.assertTrue(data2.uint8[2] == 108, 'l == 108')
-        self.assertTrue(data2.GetUnsignedInt8(error,3) == 108, 'l == 108')
+        self.assert_data(data2.GetUnsignedInt8, 3, 108) # l
         self.assertTrue(data2.uint8[4] == 111, 'o == 111')
-        self.assertTrue(data2.GetUnsignedInt8(error,5) == 33, '! == 33')
-        self.assertTrue(data2.uint8[6] == 0, 'binary 0 terminator')
+        self.assert_data(data2.GetUnsignedInt8, 5, 33) # !
         
         data2 = lldb.SBData.CreateDataFromUInt64Array(process.GetByteOrder(),process.GetAddressByteSize(),[1,2,3,4,5])
-        self.assertTrue(data2.GetUnsignedInt64(error,0) == 1, 'data2[0] = 1')
-        self.assertTrue(data2.GetUnsignedInt64(error,8) == 2, 'data2[1] = 2')
-        self.assertTrue(data2.GetUnsignedInt64(error,16) == 3, 'data2[2] = 3')
-        self.assertTrue(data2.GetUnsignedInt64(error,24) == 4, 'data2[3] = 4')
-        self.assertTrue(data2.GetUnsignedInt64(error,32) == 5, 'data2[4] = 5')
+        self.assert_data(data2.GetUnsignedInt64, 0, 1)
+        self.assert_data(data2.GetUnsignedInt64, 8, 2)
+        self.assert_data(data2.GetUnsignedInt64, 16, 3)
+        self.assert_data(data2.GetUnsignedInt64, 24, 4)
+        self.assert_data(data2.GetUnsignedInt64, 32, 5)
         
         self.assertTrue(data2.uint64s == [1,2,3,4,5], 'read_data_helper failure: data2 == [1,2,3,4,5]')
 
@@ -238,39 +261,42 @@ class SBDataAPICase(TestBase):
         self.assertTrue(data2.sint32[0:2] == [2,-2], 'signed32 data2 = [2,-2]')
         
         data2.Append(lldb.SBData.CreateDataFromSInt64Array(process.GetByteOrder(),process.GetAddressByteSize(),[2, -2]))
-        self.assertTrue(data2.GetSignedInt32(error,0) == 2, 'signed32 data2[0] = 2')
-        self.assertTrue(data2.GetSignedInt32(error,4) == -2, 'signed32 data2[1] = -2')
+        self.assert_data(data2.GetSignedInt32, 0, 2)
+        self.assert_data(data2.GetSignedInt32, 4, -2)
         self.assertTrue(data2.sint64[1:3] == [2,-2], 'signed64 data2 = [2,-2]')
         
         data2 = lldb.SBData.CreateDataFromUInt32Array(process.GetByteOrder(),process.GetAddressByteSize(),[1,2,3,4,5])
-        self.assertTrue(data2.GetUnsignedInt32(error,0) == 1, '32-bit data2[0] = 1')
-        self.assertTrue(data2.GetUnsignedInt32(error,4) == 2, '32-bit data2[1] = 2')
-        self.assertTrue(data2.GetUnsignedInt32(error,8) == 3, '32-bit data2[2] = 3')
-        self.assertTrue(data2.GetUnsignedInt32(error,12) == 4, '32-bit data2[3] = 4')
-        self.assertTrue(data2.GetUnsignedInt32(error,16) == 5, '32-bit data2[4] = 5')
+        self.assert_data(data2.GetUnsignedInt32,0, 1)
+        self.assert_data(data2.GetUnsignedInt32,4, 2)
+        self.assert_data(data2.GetUnsignedInt32,8, 3)
+        self.assert_data(data2.GetUnsignedInt32,12, 4)
+        self.assert_data(data2.GetUnsignedInt32,16, 5)
         
         data2 = lldb.SBData.CreateDataFromDoubleArray(process.GetByteOrder(),process.GetAddressByteSize(),[3.14,6.28,2.71])
         self.assertTrue( fabs(data2.GetDouble(error,0) - 3.14) < 0.5, 'double data2[0] = 3.14')
+        self.assertTrue(error.Success())
         self.assertTrue( fabs(data2.GetDouble(error,8) - 6.28) < 0.5, 'double data2[1] = 6.28')
+        self.assertTrue(error.Success())
         self.assertTrue( fabs(data2.GetDouble(error,16) - 2.71) < 0.5, 'double data2[2] = 2.71')
+        self.assertTrue(error.Success())
 
         data2 = lldb.SBData()
 
-        data2.SetDataFromCString('hello!')
-        self.assertTrue(data2.GetUnsignedInt8(error,0) == 104, 'set h == 104')
-        self.assertTrue(data2.GetUnsignedInt8(error,1) == 101, 'set e == 101')
-        self.assertTrue(data2.GetUnsignedInt8(error,2) == 108, 'set l == 108')
-        self.assertTrue(data2.GetUnsignedInt8(error,3) == 108, 'set l == 108')
-        self.assertTrue(data2.GetUnsignedInt8(error,4) == 111, 'set o == 111')
-        self.assertTrue(data2.GetUnsignedInt8(error,5) == 33, 'set ! == 33')
-        self.assertTrue(data2.GetUnsignedInt8(error,6) == 0, 'set binary 0 terminator')
+        data2.SetDataFromCString(hello_str)
+        self.assertTrue(len(data2.uint8) == len(hello_str))
+        self.assert_data(data2.GetUnsignedInt8, 0, 104)
+        self.assert_data(data2.GetUnsignedInt8, 1, 101)
+        self.assert_data(data2.GetUnsignedInt8, 2, 108)
+        self.assert_data(data2.GetUnsignedInt8, 3, 108)
+        self.assert_data(data2.GetUnsignedInt8, 4, 111)
+        self.assert_data(data2.GetUnsignedInt8, 5, 33)
 
         data2.SetDataFromUInt64Array([1,2,3,4,5])
-        self.assertTrue(data2.GetUnsignedInt64(error,0) == 1, 'set data2[0] = 1')
-        self.assertTrue(data2.GetUnsignedInt64(error,8) == 2, 'set data2[1] = 2')
-        self.assertTrue(data2.GetUnsignedInt64(error,16) == 3, 'set data2[2] = 3')
-        self.assertTrue(data2.GetUnsignedInt64(error,24) == 4, 'set data2[3] = 4')
-        self.assertTrue(data2.GetUnsignedInt64(error,32) == 5, 'set data2[4] = 5')
+        self.assert_data(data2.GetUnsignedInt64, 0, 1)
+        self.assert_data(data2.GetUnsignedInt64, 8,  2)
+        self.assert_data(data2.GetUnsignedInt64, 16, 3)
+        self.assert_data(data2.GetUnsignedInt64, 24, 4)
+        self.assert_data(data2.GetUnsignedInt64, 32, 5)
 
         self.assertTrue(data2.uint64[0] == 1, 'read_data_helper failure: set data2[0] = 1')
         self.assertTrue(data2.uint64[1] == 2, 'read_data_helper failure: set data2[1] = 2')
@@ -281,19 +307,19 @@ class SBDataAPICase(TestBase):
         self.assertTrue(data2.uint64[0:2] == [1,2], 'read_data_helper failure: set data2[0:2] = [1,2]')
 
         data2.SetDataFromSInt32Array([2, -2])
-        self.assertTrue(data2.GetSignedInt32(error,0) == 2, 'set signed32 data2[0] = 2')
-        self.assertTrue(data2.GetSignedInt32(error,4) == -2, 'set signed32 data2[1] = -2')
+        self.assert_data(data2.GetSignedInt32, 0, 2)
+        self.assert_data(data2.GetSignedInt32, 4, -2)
         
         data2.SetDataFromSInt64Array([2, -2])
-        self.assertTrue(data2.GetSignedInt32(error,0) == 2, 'set signed64 data2[0] = 2')
-        self.assertTrue(data2.GetSignedInt32(error,8) == -2, 'set signed64 data2[1] = -2')
+        self.assert_data(data2.GetSignedInt32, 0, 2)
+        self.assert_data(data2.GetSignedInt32, 8, -2)
         
         data2.SetDataFromUInt32Array([1,2,3,4,5])
-        self.assertTrue(data2.GetUnsignedInt32(error,0) == 1, 'set 32-bit data2[0] = 1')
-        self.assertTrue(data2.GetUnsignedInt32(error,4) == 2, 'set 32-bit data2[1] = 2')
-        self.assertTrue(data2.GetUnsignedInt32(error,8) == 3, 'set 32-bit data2[2] = 3')
-        self.assertTrue(data2.GetUnsignedInt32(error,12) == 4, 'set 32-bit data2[3] = 4')
-        self.assertTrue(data2.GetUnsignedInt32(error,16) == 5, 'set 32-bit data2[4] = 5')
+        self.assert_data(data2.GetUnsignedInt32, 0, 1)
+        self.assert_data(data2.GetUnsignedInt32, 4, 2)
+        self.assert_data(data2.GetUnsignedInt32, 8, 3)
+        self.assert_data(data2.GetUnsignedInt32, 12, 4)
+        self.assert_data(data2.GetUnsignedInt32, 16, 5)
         
         self.assertTrue(data2.uint32[0] == 1, 'read_data_helper failure: set 32-bit data2[0] = 1')
         self.assertTrue(data2.uint32[1] == 2, 'read_data_helper failure: set 32-bit data2[1] = 2')

Modified: lldb/branches/lldb-platform-work/test/python_api/symbol-context/TestSymbolContext.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/python_api/symbol-context/TestSymbolContext.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/python_api/symbol-context/TestSymbolContext.py (original)
+++ lldb/branches/lldb-platform-work/test/python_api/symbol-context/TestSymbolContext.py Thu Jun  6 19:06:43 2013
@@ -55,7 +55,7 @@ class SymbolContextAPITestCase(TestBase)
         # Frame #0 should be on self.line.
         from lldbutil import get_stopped_thread
         thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
-        self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint")
+        self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint")
         frame0 = thread.GetFrameAtIndex(0)
         self.assertTrue(frame0.GetLineEntry().GetLine() == self.line)
 

Modified: lldb/branches/lldb-platform-work/test/python_api/target/TestTargetAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/python_api/target/TestTargetAPI.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/python_api/target/TestTargetAPI.py (original)
+++ lldb/branches/lldb-platform-work/test/python_api/target/TestTargetAPI.py Thu Jun  6 19:06:43 2013
@@ -262,7 +262,7 @@ class TargetAPITestCase(TestBase):
         # Frame #0 should be on self.line1.
         self.assertTrue(process.GetState() == lldb.eStateStopped)
         thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
-        self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint condition")
+        self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
         #self.runCmd("process status")
         frame0 = thread.GetFrameAtIndex(0)
         lineEntry = frame0.GetLineEntry()
@@ -274,7 +274,7 @@ class TargetAPITestCase(TestBase):
         process.Continue()
         self.assertTrue(process.GetState() == lldb.eStateStopped)
         thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
-        self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint condition")
+        self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
         #self.runCmd("process status")
         frame0 = thread.GetFrameAtIndex(0)
         lineEntry = frame0.GetLineEntry()

Modified: lldb/branches/lldb-platform-work/test/python_api/thread/TestThreadAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/python_api/thread/TestThreadAPI.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/python_api/thread/TestThreadAPI.py (original)
+++ lldb/branches/lldb-platform-work/test/python_api/thread/TestThreadAPI.py Thu Jun  6 19:06:43 2013
@@ -74,6 +74,7 @@ class ThreadAPITestCase(TestBase):
         self.setTearDownCleanup(dictionary=d)
         self.step_out_of_malloc_into_function_b(self.exe_name)
 
+    @expectedFailureLinux # llvm.org/pr14416
     @python_api_test
     @dwarf_test
     def test_step_out_of_malloc_into_function_b_with_dwarf(self):
@@ -132,7 +133,7 @@ class ThreadAPITestCase(TestBase):
         process = target.LaunchSimple(None, None, os.getcwd())
 
         thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
-        self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint")
+        self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint")
         self.runCmd("process status")
 
         proc_of_thread = thread.GetProcess()
@@ -154,7 +155,7 @@ class ThreadAPITestCase(TestBase):
         process = target.LaunchSimple(None, None, os.getcwd())
 
         thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
-        self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint")
+        self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint")
         #self.runCmd("process status")
 
         # Due to the typemap magic (see lldb.swig), we pass in an (int)length to GetStopDescription
@@ -180,7 +181,7 @@ class ThreadAPITestCase(TestBase):
 
         while True:
             thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
-            self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint")
+            self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint")
             caller_symbol = get_caller_symbol(thread)
             #print "caller symbol of malloc:", caller_symbol
             if not caller_symbol:
@@ -216,7 +217,7 @@ class ThreadAPITestCase(TestBase):
         # Frame #0 should be on self.step_out_of_malloc.
         self.assertTrue(process.GetState() == lldb.eStateStopped)
         thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
-        self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint condition")
+        self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
         self.runCmd("thread backtrace")
         frame0 = thread.GetFrameAtIndex(0)
         lineEntry = frame0.GetLineEntry()
@@ -257,7 +258,7 @@ class ThreadAPITestCase(TestBase):
         # Frame #0 should be on self.step_out_of_malloc.
         self.assertTrue(process.GetState() == lldb.eStateStopped)
         thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
-        self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint condition")
+        self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
         self.runCmd("thread backtrace")
         frame0 = thread.GetFrameAtIndex(0)
         lineEntry = frame0.GetLineEntry()

Modified: lldb/branches/lldb-platform-work/test/python_api/type/TestTypeList.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/python_api/type/TestTypeList.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/python_api/type/TestTypeList.py (original)
+++ lldb/branches/lldb-platform-work/test/python_api/type/TestTypeList.py Thu Jun  6 19:06:43 2013
@@ -59,14 +59,14 @@ class TypeAndTypeListTestCase(TestBase):
         # Get Frame #0.
         self.assertTrue(process.GetState() == lldb.eStateStopped)
         thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
-        self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint condition")
+        self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
         frame0 = thread.GetFrameAtIndex(0)
 
         # Get the type 'Task'.
         type_list = target.FindTypes('Task')
         if self.TraceOn():
             print "Size of type_list from target.FindTypes('Task') query: %d" % type_list.GetSize()
-        self.assertTrue(len(type_list) == 1)
+        self.assertTrue(len(type_list) >= 1) # a second Task make be scared up by the Objective-C runtime
         for type in type_list:
             self.assertTrue(type)
             self.DebugSBType(type)

Modified: lldb/branches/lldb-platform-work/test/python_api/value/TestValueAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/python_api/value/TestValueAPI.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/python_api/value/TestValueAPI.py (original)
+++ lldb/branches/lldb-platform-work/test/python_api/value/TestValueAPI.py Thu Jun  6 19:06:43 2013
@@ -58,7 +58,7 @@ class ValueAPITestCase(TestBase):
         # Get Frame #0.
         self.assertTrue(process.GetState() == lldb.eStateStopped)
         thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
-        self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint condition")
+        self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
         frame0 = thread.GetFrameAtIndex(0)
 
         # Get global variable 'days_of_week'.

Modified: lldb/branches/lldb-platform-work/test/python_api/value/change_values/TestChangeValueAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/python_api/value/change_values/TestChangeValueAPI.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/python_api/value/change_values/TestChangeValueAPI.py (original)
+++ lldb/branches/lldb-platform-work/test/python_api/value/change_values/TestChangeValueAPI.py Thu Jun  6 19:06:43 2013
@@ -38,8 +38,10 @@ class ChangeValueAPITestCase(TestBase):
         self.exe_name = self.testMethodName
         # Find the line number to of function 'c'.
         self.line = line_number('main.c', '// Stop here and set values')
+        self.check_line = line_number('main.c', '// Stop here and check values')
         self.end_line = line_number ('main.c', '// Set a breakpoint here at the end')
 
+    @skipIfGcc # llvm.org/pr15039: If GCC is the test compiler, stdout is not available via lldb.SBProcess.GetSTDOUT()
     def change_value_api(self, exe_name):
         """Exercise some SBValue APIs."""
         exe = os.path.join(os.getcwd(), exe_name)
@@ -52,6 +54,10 @@ class ChangeValueAPITestCase(TestBase):
         breakpoint = target.BreakpointCreateByLocation('main.c', self.line)
         self.assertTrue(breakpoint, VALID_BREAKPOINT)
 
+        # Create the breakpoint inside the function 'main'
+        check_breakpoint = target.BreakpointCreateByLocation('main.c', self.check_line)
+        self.assertTrue(check_breakpoint, VALID_BREAKPOINT)
+
         # Create the breakpoint inside function 'main'.
         end_breakpoint = target.BreakpointCreateByLocation('main.c', self.end_line)
         self.assertTrue(end_breakpoint, VALID_BREAKPOINT)
@@ -63,7 +69,7 @@ class ChangeValueAPITestCase(TestBase):
         # Get Frame #0.
         self.assertTrue(process.GetState() == lldb.eStateStopped)
         thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
-        self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint condition")
+        self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
         frame0 = thread.GetFrameAtIndex(0)
         self.assertTrue (frame0.IsValid(), "Got a valid frame.")
 
@@ -115,8 +121,16 @@ class ChangeValueAPITestCase(TestBase):
         self.assertTrue (error.Success(), "Got a changed value from ptr->second_val")
         self.assertTrue (actual_value == 98765, "Got the right changed value from ptr->second_val")
         
-        # Now step, grab the stdout and make sure we changed the real values as well...
-        thread.StepOver()
+        # gcc may set multiple locations for breakpoint
+        breakpoint.SetEnabled(False)
+
+        # Now continue, grab the stdout and make sure we changed the real values as well...
+        process.Continue();
+
+        self.assertTrue(process.GetState() == lldb.eStateStopped)
+        thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+        self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
+
         expected_value = "Val - 12345 Mine - 55, 98765, 55555555. Ptr - 66, 98765, 66666666"
         stdout = process.GetSTDOUT(1000)
         self.assertTrue (expected_value in stdout, "STDOUT showed changed values.")

Modified: lldb/branches/lldb-platform-work/test/python_api/value/change_values/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/python_api/value/change_values/main.c?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/python_api/value/change_values/main.c (original)
+++ lldb/branches/lldb-platform-work/test/python_api/value/change_values/main.c Thu Jun  6 19:06:43 2013
@@ -24,6 +24,7 @@ int main ()
           mine.first_val, mine.second_val, mine.third_val,
           ptr->first_val, ptr->second_val, ptr->third_val); 
 
+  // Stop here and check values
   printf ("This is just another call which we won't make it over %d.", val);
   return 0; // Set a breakpoint here at the end
 }

Modified: lldb/branches/lldb-platform-work/test/python_api/value/linked_list/TestValueAPILinkedList.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/python_api/value/linked_list/TestValueAPILinkedList.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/python_api/value/linked_list/TestValueAPILinkedList.py (original)
+++ lldb/branches/lldb-platform-work/test/python_api/value/linked_list/TestValueAPILinkedList.py Thu Jun  6 19:06:43 2013
@@ -59,7 +59,7 @@ class ValueAsLinkedListTestCase(TestBase
         # Get Frame #0.
         self.assertTrue(process.GetState() == lldb.eStateStopped)
         thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
-        self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint condition")
+        self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
         frame0 = thread.GetFrameAtIndex(0)
 
         # Get variable 'task_head'.

Modified: lldb/branches/lldb-platform-work/test/python_api/watchpoint/watchlocation/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/python_api/watchpoint/watchlocation/Makefile?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/python_api/watchpoint/watchlocation/Makefile (original)
+++ lldb/branches/lldb-platform-work/test/python_api/watchpoint/watchlocation/Makefile Thu Jun  6 19:06:43 2013
@@ -1,5 +1,6 @@
 LEVEL = ../../../make
 
+LD_EXTRAS := -lpthread
 CXX_SOURCES := main.cpp
 
 include $(LEVEL)/Makefile.rules

Modified: lldb/branches/lldb-platform-work/test/python_api/watchpoint/watchlocation/TestSetWatchlocation.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/python_api/watchpoint/watchlocation/TestSetWatchlocation.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/python_api/watchpoint/watchlocation/TestSetWatchlocation.py (original)
+++ lldb/branches/lldb-platform-work/test/python_api/watchpoint/watchlocation/TestSetWatchlocation.py Thu Jun  6 19:06:43 2013
@@ -30,6 +30,7 @@ class SetWatchlocationAPITestCase(TestBa
         self.buildDsym()
         self.do_set_watchlocation()
 
+    @skipIfLinux # Sometimes passes, sometimes not.
     @python_api_test
     @dwarf_test
     def test_watch_location_with_dwarf(self):

Modified: lldb/branches/lldb-platform-work/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py (original)
+++ lldb/branches/lldb-platform-work/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py Thu Jun  6 19:06:43 2013
@@ -30,6 +30,7 @@ class TargetWatchAddressAPITestCase(Test
         self.buildDsym()
         self.do_set_watchaddress()
 
+    @skipIfLinux # llvm.org/pr14323 - skip due to incomplete multi-threaded debug support
     @python_api_test
     @dwarf_test
     def test_watch_address_with_dwarf(self):

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

Modified: lldb/branches/lldb-platform-work/test/settings/TestSettings.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/settings/TestSettings.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/settings/TestSettings.py (original)
+++ lldb/branches/lldb-platform-work/test/settings/TestSettings.py Thu Jun  6 19:06:43 2013
@@ -28,12 +28,12 @@ class SettingsCommandTestCase(TestBase):
                        "executable's environment"])
 
     def test_append_target_env_vars(self):
-        """Test that 'replace target.run-args' works."""
+        """Test that 'append target.run-args' works."""
         # Append the env-vars.
         self.runCmd('settings append target.env-vars MY_ENV_VAR=YES')
         # And add hooks to restore the settings during tearDown().
         self.addTearDownHook(
-            lambda: self.runCmd("settings set -r target.env-vars"))
+            lambda: self.runCmd("settings clear target.env-vars"))
 
         # Check it immediately!
         self.expect('settings show target.env-vars',
@@ -45,7 +45,7 @@ class SettingsCommandTestCase(TestBase):
         self.runCmd('settings set target.run-args a b c')
         # And add hooks to restore the settings during tearDown().
         self.addTearDownHook(
-            lambda: self.runCmd("settings set -r target.run-args"))
+            lambda: self.runCmd("settings clear target.run-args"))
 
         # Now insert-before the index-0 element with '__a__'.
         self.runCmd('settings insert-before target.run-args 0 __a__')
@@ -53,7 +53,7 @@ class SettingsCommandTestCase(TestBase):
         self.runCmd('settings insert-after target.run-args 1 __A__')
         # Check it immediately!
         self.expect('settings show target.run-args',
-            substrs = ['target.run-args (array) = ',
+            substrs = ['target.run-args',
                        '[0]: "__a__"',
                        '[1]: "a"',
                        '[2]: "__A__"',
@@ -66,13 +66,13 @@ class SettingsCommandTestCase(TestBase):
         self.runCmd('settings set target.run-args a b c')
         # And add hooks to restore the settings during tearDown().
         self.addTearDownHook(
-            lambda: self.runCmd("settings set -r target.run-args"))
+            lambda: self.runCmd("settings clear target.run-args"))
 
         # Now replace the index-0 element with 'A', instead.
         self.runCmd('settings replace target.run-args 0 A')
         # Check it immediately!
         self.expect('settings show target.run-args',
-            substrs = ['target.run-args (array) = ',
+            substrs = ['target.run-args (arguments) =',
                        '[0]: "A"',
                        '[1]: "b"',
                        '[2]: "c"'])
@@ -81,18 +81,18 @@ class SettingsCommandTestCase(TestBase):
         """Test that 'set prompt' actually changes the prompt."""
 
         # Set prompt to 'lldb2'.
-        self.runCmd("settings set prompt lldb2")
+        self.runCmd("settings set prompt 'lldb2 '")
 
         # Immediately test the setting.
         self.expect("settings show prompt", SETTING_MSG("prompt"),
-            startstr = 'prompt (string) = "lldb2"')
+            startstr = 'prompt (string) = "lldb2 "')
 
         # The overall display should also reflect the new setting.
         self.expect("settings show", SETTING_MSG("prompt"),
-            substrs = ['prompt (string) = "lldb2"'])
+            substrs = ['prompt (string) = "lldb2 "'])
 
         # Use '-r' option to reset to the original default prompt.
-        self.runCmd("settings set -r prompt")
+        self.runCmd("settings clear prompt")
 
     def test_set_term_width(self):
         """Test that 'set term-width' actually changes the term-width."""
@@ -118,7 +118,6 @@ class SettingsCommandTestCase(TestBase):
         def cleanup():
             format_string = "frame #${frame.index}: ${frame.pc}{ ${module.file.basename}{`${function.name}${function.pc-offset}}}{ at ${line.file.basename}:${line.number}}\n"
             self.runCmd("settings set frame-format %s" % format_string, check=False)
-            self.runCmd('command unalias hello', check=False)
 
         # Execute the cleanup function during test case tear down.
         self.addTearDownHook(cleanup)
@@ -155,7 +154,7 @@ class SettingsCommandTestCase(TestBase):
             startstr = "All breakpoints removed")
 
         # Restore the original setting of auto-confirm.
-        self.runCmd("settings set -r auto-confirm")
+        self.runCmd("settings clear auto-confirm")
         self.expect("settings show auto-confirm", SETTING_MSG("auto-confirm"),
             startstr = "auto-confirm (boolean) = false")
 
@@ -182,10 +181,10 @@ class SettingsCommandTestCase(TestBase):
         # And add hooks to restore the settings during tearDown().
         self.runCmd('settings set target.run-args A B C')
         self.addTearDownHook(
-            lambda: self.runCmd("settings set -r target.run-args"))
+            lambda: self.runCmd("settings clear target.run-args"))
         self.runCmd('settings set target.env-vars ["MY_ENV_VAR"]=YES')
         self.addTearDownHook(
-            lambda: self.runCmd("settings set -r target.env-vars"))
+            lambda: self.runCmd("settings clear target.env-vars"))
 
         self.runCmd("run", RUN_SUCCEEDED)
 
@@ -244,17 +243,17 @@ class SettingsCommandTestCase(TestBase):
         self.runCmd("settings set target.output-path stdout.txt")
         # And add hooks to restore the original settings during tearDown().
         self.addTearDownHook(
-            lambda: self.runCmd("settings set -r target.output-path"))
+            lambda: self.runCmd("settings clear target.output-path"))
         self.addTearDownHook(
-            lambda: self.runCmd("settings set -r target.error-path"))
+            lambda: self.runCmd("settings clear target.error-path"))
 
         self.expect("settings show target.error-path",
                     SETTING_MSG("target.error-path"),
-            startstr = 'target.error-path (string) = "stderr.txt"')
+            startstr = 'target.error-path (file) = "stderr.txt"')
 
         self.expect("settings show target.output-path",
                     SETTING_MSG("target.output-path"),
-            startstr = 'target.output-path (string) = "stdout.txt"')
+            startstr = 'target.output-path (file) = "stdout.txt"')
 
         self.runCmd("run", RUN_SUCCEEDED)
 
@@ -281,21 +280,21 @@ class SettingsCommandTestCase(TestBase):
             startstr = "This message should go to standard out.")
 
     def test_print_dictionary_setting(self):
-        self.runCmd ("settings set -r target.env-vars")
+        self.runCmd ("settings clear target.env-vars")
         self.runCmd ("settings set target.env-vars [\"MY_VAR\"]=some-value")
         self.expect ("settings show target.env-vars",
                      substrs = [ "MY_VAR=some-value" ])
-        self.runCmd ("settings set -r target.env-vars")
+        self.runCmd ("settings clear target.env-vars")
 
     def test_print_array_setting(self):
-        self.runCmd ("settings set -r target.run-args")
+        self.runCmd ("settings clear target.run-args")
         self.runCmd ("settings set target.run-args gobbledy-gook")
         self.expect ("settings show target.run-args",
                      substrs = [ '[0]: "gobbledy-gook"' ])
-        self.runCmd ("settings set -r target.run-args")
+        self.runCmd ("settings clear target.run-args")
 
     def test_settings_with_quotes (self):
-        self.runCmd ("settings set -r target.run-args")
+        self.runCmd ("settings clear target.run-args")
         self.runCmd ("settings set target.run-args a b c")
         self.expect ("settings show target.run-args",
                      substrs = [ '[0]: "a"',
@@ -304,35 +303,101 @@ class SettingsCommandTestCase(TestBase):
         self.runCmd ("settings set target.run-args 'a b c'")
         self.expect ("settings show target.run-args",
                      substrs = [ '[0]: "a b c"' ])
-        self.runCmd ("settings set -r target.run-args")
-        self.runCmd ("settings set -r target.env-vars")
+        self.runCmd ("settings clear target.run-args")
+        self.runCmd ("settings clear target.env-vars")
         self.runCmd ('settings set target.env-vars ["MY_FILE"]="this is a file name with spaces.txt"')
         self.expect ("settings show target.env-vars",
                      substrs = [ 'MY_FILE=this is a file name with spaces.txt' ])
-        self.runCmd ("settings set -r target.env-vars")
-
+        self.runCmd ("settings clear target.env-vars")
 
+    def test_settings_with_trailing_whitespace (self):
+        
+        # boolean
+        self.runCmd ("settings set target.skip-prologue true")      # Set to known value
+        self.runCmd ("settings set target.skip-prologue false ")    # Set to new value with trailing whitespace
+        # Make sure the setting was correctly set to "false"
+        self.expect ("settings show target.skip-prologue", SETTING_MSG("target.skip-prologue"),
+            startstr = "target.skip-prologue (boolean) = false")
+        self.runCmd("settings clear target.skip-prologue", check=False)
+        # integer
+        self.runCmd ("settings set term-width 70")      # Set to known value
+        self.runCmd ("settings set term-width 60 \t")   # Set to new value with trailing whitespaces
+        self.expect ("settings show term-width", SETTING_MSG("term-width"),
+            startstr = "term-width (int) = 60")
+        self.runCmd("settings clear term-width", check=False)
+        # string
+        self.runCmd ("settings set target.arg0 abc")    # Set to known value
+        self.runCmd ("settings set target.arg0 cde\t ") # Set to new value with trailing whitespaces
+        self.expect ("settings show target.arg0", SETTING_MSG("target.arg0"),
+            startstr = 'target.arg0 (string) = "cde"')
+        self.runCmd("settings clear target.arg0", check=False)
+        # file
+        self.runCmd ("settings set target.output-path /bin/ls")   # Set to known value
+        self.runCmd ("settings set target.output-path /bin/cat ") # Set to new value with trailing whitespaces
+        self.expect ("settings show target.output-path", SETTING_MSG("target.output-path"),
+            startstr = 'target.output-path (file) = "/bin/cat"')
+        self.runCmd("settings clear target.output-path", check=False)
+        # enum
+        self.runCmd ("settings set stop-disassembly-display never")   # Set to known value
+        self.runCmd ("settings set stop-disassembly-display always ") # Set to new value with trailing whitespaces
+        self.expect ("settings show stop-disassembly-display", SETTING_MSG("stop-disassembly-display"),
+            startstr = 'stop-disassembly-display (enum) = always')
+        self.runCmd("settings clear stop-disassembly-display", check=False)        
+        # arguments
+        self.runCmd ("settings set target.run-args 1 2 3")  # Set to known value
+        self.runCmd ("settings set target.run-args 3 4 5 ") # Set to new value with trailing whitespaces
+        self.expect ("settings show target.run-args", SETTING_MSG("target.run-args"),
+            substrs = [ 'target.run-args (arguments) =', 
+                        '[0]: "3"', 
+                        '[1]: "4"',
+                        '[2]: "5"' ])
+        self.runCmd("settings clear target.run-args", check=False)        
+        # dictionaries
+        self.runCmd ("settings clear target.env-vars")  # Set to known value
+        self.runCmd ("settings set target.env-vars A=B C=D\t ") # Set to new value with trailing whitespaces
+        self.expect ("settings show target.env-vars", SETTING_MSG("target.env-vars"),
+            substrs = [ 'target.env-vars (dictionary of strings) =', 
+                        'A=B', 
+                        'C=D'])
+        self.runCmd("settings clear target.env-vars", check=False)        
+        
     def test_all_settings_exist (self):
         self.expect ("settings show",
-                     substrs = [ "frame-format (string) = ",
-                                 "prompt (string) = ",
-                                 "script-lang (string) = ",
-                                 "term-width (int) = ",
-                                 "thread-format (string) = ",
-                                 "use-external-editor (boolean) = ",
-                                 "auto-confirm (boolean) = ",
-                                 "target.default-arch (string) =",
-                                 "target.expr-prefix (string) = ",
-                                 "target.run-args (array) =",
-                                 "target.env-vars (dictionary) =",
-                                 "target.inherit-env (boolean) = ",
-                                 "target.input-path (string) = ",
-                                 "target.output-path (string) = ",
-                                 "target.error-path (string) = ",
-                                 "target.disable-aslr (boolean) = ",
-                                 "target.disable-stdio (boolean) = ",
-                                 "target.process.thread.step-avoid-regexp (string) =",
-                                 "target.process.thread.trace-thread (boolean) =" ])
+                     substrs = [ "auto-confirm",
+                                 "frame-format",
+                                 "notify-void",
+                                 "prompt",
+                                 "script-lang",
+                                 "stop-disassembly-count",
+                                 "stop-disassembly-display",
+                                 "stop-line-count-after",
+                                 "stop-line-count-before",
+                                 "term-width",
+                                 "thread-format",
+                                 "use-external-editor",
+                                 "target.default-arch",
+                                 "target.expr-prefix",
+                                 "target.prefer-dynamic-value",
+                                 "target.enable-synthetic-value",
+                                 "target.skip-prologue",
+                                 "target.source-map",
+                                 "target.exec-search-paths",
+                                 "target.max-children-count",
+                                 "target.max-string-summary-length",
+                                 "target.breakpoints-use-platform-avoid-list",
+                                 "target.run-args",
+                                 "target.env-vars",
+                                 "target.inherit-env",
+                                 "target.input-path",
+                                 "target.output-path",
+                                 "target.error-path",
+                                 "target.disable-aslr",
+                                 "target.disable-stdio",
+                                 "target.process.disable-memory-cache",
+                                 "target.process.extra-startup-command",
+                                 "target.process.thread.step-avoid-regexp",
+                                 "target.process.thread.trace-thread"])
+                                 
         
 
 if __name__ == '__main__':

Modified: lldb/branches/lldb-platform-work/test/source-manager/TestSourceManager.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/source-manager/TestSourceManager.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/source-manager/TestSourceManager.py (original)
+++ lldb/branches/lldb-platform-work/test/source-manager/TestSourceManager.py Thu Jun  6 19:06:43 2013
@@ -12,6 +12,7 @@ o test_modify_source_file_while_debuggin
 import unittest2
 import lldb
 from lldbtest import *
+import lldbutil
 
 class SourceManagerTestCase(TestBase):
 
@@ -77,7 +78,7 @@ class SourceManagerTestCase(TestBase):
             patterns = ['=> %d.*Hello world' % self.line])
 
         # Boundary condition testings for SBStream().  LLDB should not crash!
-        stream.Printf(None)
+        stream.Print(None)
         stream.RedirectToFile(None, True)
 
     def move_and_then_display_source(self):
@@ -104,7 +105,7 @@ class SourceManagerTestCase(TestBase):
             substrs = [os.getcwd(), os.path.join(os.getcwd(), "hidden")])
 
         # Display main() and verify that the source mapping has been kicked in.
-        self.expect("list -n main", SOURCE_DISPLAYED_CORRECTLY,
+        self.expect("source list -n main", SOURCE_DISPLAYED_CORRECTLY,
             substrs = ['Hello world'])
 
     def modify_source_file_while_debugging(self):
@@ -112,10 +113,7 @@ class SourceManagerTestCase(TestBase):
         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)
 
@@ -126,14 +124,14 @@ class SourceManagerTestCase(TestBase):
                        'stop reason = breakpoint'])
 
         # Display some source code.
-        self.expect("list -f main.c -l %d" % self.line, SOURCE_DISPLAYED_CORRECTLY,
+        self.expect("source list -f main.c -l %d" % self.line, SOURCE_DISPLAYED_CORRECTLY,
             substrs = ['Hello world'])
 
         # The '-b' option shows the line table locations from the debug information
         # that indicates valid places to set source level breakpoints.
 
         # The file to display is implicit in this case.
-        self.runCmd("list -l %d -c 3 -b" % self.line)
+        self.runCmd("source list -l %d -c 3 -b" % self.line)
         output = self.res.GetOutput().splitlines()[0]
 
         # If the breakpoint set command succeeded, we should expect a positive number
@@ -180,7 +178,7 @@ class SourceManagerTestCase(TestBase):
             self.addTearDownHook(restore_file)
 
         # Display the source code again.  We should see the updated line.
-        self.expect("list -f main.c -l %d" % self.line, SOURCE_DISPLAYED_CORRECTLY,
+        self.expect("source list -f main.c -l %d" % self.line, SOURCE_DISPLAYED_CORRECTLY,
             substrs = ['Hello lldb'])
 
 

Modified: lldb/branches/lldb-platform-work/test/types/AbstractBase.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/types/AbstractBase.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/types/AbstractBase.py (original)
+++ lldb/branches/lldb-platform-work/test/types/AbstractBase.py Thu Jun  6 19:06:43 2013
@@ -6,10 +6,11 @@ import os, time
 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" % (
-        'frame variable -T' if using_frame_variable else 'expression' ,var, val)
+        'frame variable --show-types' if using_frame_variable else 'expression' ,var, val)
 
 class GenericTester(TestBase):
 
@@ -108,39 +109,39 @@ class GenericTester(TestBase):
         #print "golden list:", gl
         return gl
 
-    def generic_type_tester(self, exe_name, atoms, quotedDisplay=False, blockCaptured=False):
-        """Test that variables with basic types are displayed correctly."""
-        gl = self.run_inferior_to_capture_golden_list(exe_name, blockCaptured)
+        # This test uses a #include of a the "basic_type.cpp" so we need to enable
+        # always setting inlined breakpoints.
+        self.runCmd('settings set target.inline-breakpoint-strategy always')
+        # And add hooks to restore the settings during tearDown().
+        self.addTearDownHook(
+            lambda: self.runCmd("settings set target.inline-breakpoint-strategy headers"))
 
         # Bring the program to the point where we can issue a series of
-        # 'frame variable -T' command.
+        # 'frame variable --show-types' command.
         if blockCaptured:
             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,
                        "stop reason = breakpoint"])
 
-        #self.runCmd("frame variable -T")
+        #self.runCmd("frame variable --show-types")
 
         # Now iterate through the golden list, comparing against the output from
-        # 'frame variable -T var'.
+        # 'frame variable --show-types var'.
         for var, val in gl:
-            self.runCmd("frame variable -T %s" % var)
+            self.runCmd("frame variable --show-types %s" % var)
             output = self.res.GetOutput()
 
             # The input type is in a canonical form as a set of named atoms.
             # The display type string must conatin each and every element.
             #
             # Example:
-            #     runCmd: frame variable -T a_array_bounded[0]
+            #     runCmd: frame variable --show-types a_array_bounded[0]
             #     output: (char) a_array_bounded[0] = 'a'
             #
             try:
@@ -164,22 +165,27 @@ class GenericTester(TestBase):
         """Test that variable expressions with basic types are evaluated correctly."""
         gl = self.run_inferior_to_capture_golden_list(exe_name, blockCaptured)
 
+        # This test uses a #include of a the "basic_type.cpp" so we need to enable
+        # always setting inlined breakpoints.
+        self.runCmd('settings set target.inline-breakpoint-strategy always')
+        # And add hooks to restore the settings during tearDown().
+        self.addTearDownHook(
+            lambda: self.runCmd("settings set target.inline-breakpoint-strategy headers"))
+
         # Bring the program to the point where we can issue a series of
         # 'expr' command.
         if blockCaptured:
             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,
                        "stop reason = breakpoint"])
 
-        #self.runCmd("frame variable -T")
+        #self.runCmd("frame variable --show-types")
 
         # Now iterate through the golden list, comparing against the output from
         # 'expr var'.

Modified: lldb/branches/lldb-platform-work/test/types/TestFloatTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/types/TestFloatTypes.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/types/TestFloatTypes.py (original)
+++ lldb/branches/lldb-platform-work/test/types/TestFloatTypes.py Thu Jun  6 19:06:43 2013
@@ -12,6 +12,13 @@ class FloatTypesTestCase(AbstractBase.Ge
 
     mydir = "types"
 
+    def setUp(self):
+        # Call super's setUp().
+        AbstractBase.GenericTester.setUp(self)
+        # disable "There is a running process, kill it and restart?" prompt
+        self.runCmd("settings set auto-confirm true")
+        self.addTearDownHook(lambda: self.runCmd("settings clear auto-confirm"))
+
     @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
     @dsym_test
     def test_float_type_with_dsym(self):

Modified: lldb/branches/lldb-platform-work/test/types/TestFloatTypesExpr.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/types/TestFloatTypesExpr.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/types/TestFloatTypesExpr.py (original)
+++ lldb/branches/lldb-platform-work/test/types/TestFloatTypesExpr.py Thu Jun  6 19:06:43 2013
@@ -15,6 +15,13 @@ class FloatTypesExprTestCase(AbstractBas
     # rdar://problem/8493023
     # test/types failures for Test*TypesExpr.py: element offset computed wrong and sign error?
 
+    def setUp(self):
+        # Call super's setUp().
+        AbstractBase.GenericTester.setUp(self)
+        # disable "There is a running process, kill it and restart?" prompt
+        self.runCmd("settings set auto-confirm true")
+        self.addTearDownHook(lambda: self.runCmd("settings clear auto-confirm"))
+
     @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
     @dsym_test
     def test_float_type_with_dsym(self):

Modified: lldb/branches/lldb-platform-work/test/types/TestIntegerTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/types/TestIntegerTypes.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/types/TestIntegerTypes.py (original)
+++ lldb/branches/lldb-platform-work/test/types/TestIntegerTypes.py Thu Jun  6 19:06:43 2013
@@ -12,6 +12,13 @@ class IntegerTypesTestCase(AbstractBase.
 
     mydir = "types"
 
+    def setUp(self):
+        # Call super's setUp().
+        AbstractBase.GenericTester.setUp(self)
+        # disable "There is a running process, kill it and restart?" prompt
+        self.runCmd("settings set auto-confirm true")
+        self.addTearDownHook(lambda: self.runCmd("settings clear auto-confirm"))
+
     @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
     @dsym_test
     def test_char_type_with_dsym(self):

Modified: lldb/branches/lldb-platform-work/test/types/TestIntegerTypesExpr.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/types/TestIntegerTypesExpr.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/types/TestIntegerTypesExpr.py (original)
+++ lldb/branches/lldb-platform-work/test/types/TestIntegerTypesExpr.py Thu Jun  6 19:06:43 2013
@@ -12,6 +12,13 @@ class IntegerTypesExprTestCase(AbstractB
 
     mydir = "types"
 
+    def setUp(self):
+        # Call super's setUp().
+        AbstractBase.GenericTester.setUp(self)
+        # disable "There is a running process, kill it and restart?" prompt
+        self.runCmd("settings set auto-confirm true")
+        self.addTearDownHook(lambda: self.runCmd("settings clear auto-confirm"))
+
     @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
     @dsym_test
     def test_char_type_with_dsym(self):

Modified: lldb/branches/lldb-platform-work/test/unittest2/case.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/unittest2/case.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/unittest2/case.py (original)
+++ lldb/branches/lldb-platform-work/test/unittest2/case.py Thu Jun  6 19:06:43 2013
@@ -36,16 +36,23 @@ class _ExpectedFailure(Exception):
     This is an implementation detail.
     """
 
-    def __init__(self, exc_info):
+    def __init__(self, exc_info, bugnumber=None):
         # can't use super because Python 2.4 exceptions are old style
         Exception.__init__(self)
         self.exc_info = exc_info
+        self.bugnumber = bugnumber
 
 class _UnexpectedSuccess(Exception):
     """
     The test was supposed to fail, but it didn't!
     """
 
+    def __init__(self, exc_info, bugnumber=None):
+        # can't use super because Python 2.4 exceptions are old style
+        Exception.__init__(self)
+        self.exc_info = exc_info
+        self.bugnumber = bugnumber
+
 def _id(obj):
     return obj
 
@@ -81,17 +88,27 @@ def skipUnless(condition, reason):
         return skip(reason)
     return _id
 
-
-def expectedFailure(func):
-    @wraps(func)
-    def wrapper(*args, **kwargs):
-        try:
-            func(*args, **kwargs)
-        except Exception:
-            raise _ExpectedFailure(sys.exc_info())
-        raise _UnexpectedSuccess
-    return wrapper
-
+def expectedFailure(bugnumber=None):
+     if callable(bugnumber):
+        @wraps(bugnumber)
+        def expectedFailure_easy_wrapper(*args, **kwargs):
+             try:
+                bugnumber(*args, **kwargs)
+             except Exception:
+                raise _ExpectedFailure(sys.exc_info(),None)
+             raise _UnexpectedSuccess(sys.exc_info(),None)
+        return expectedFailure_easy_wrapper
+     else:
+        def expectedFailure_impl(func):
+              @wraps(func)
+              def wrapper(*args, **kwargs):
+                   try:
+                      func(*args, **kwargs)
+                   except Exception:
+                      raise _ExpectedFailure(sys.exc_info(),bugnumber)
+                   raise _UnexpectedSuccess(sys.exc_info(),bugnumber)
+              return wrapper
+        return expectedFailure_impl
 
 class _AssertRaisesContext(object):
     """A context manager used to implement TestCase.assertRaises* methods."""
@@ -343,15 +360,15 @@ class TestCase(unittest.TestCase):
                 except _ExpectedFailure, e:
                     addExpectedFailure = getattr(result, 'addExpectedFailure', None)
                     if addExpectedFailure is not None:
-                        addExpectedFailure(self, e.exc_info)
+                        addExpectedFailure(self, e.exc_info, e.bugnumber)
                     else: 
                         warnings.warn("Use of a TestResult without an addExpectedFailure method is deprecated", 
                                       DeprecationWarning)
                         result.addSuccess(self)
-                except _UnexpectedSuccess:
+                except _UnexpectedSuccess, x:
                     addUnexpectedSuccess = getattr(result, 'addUnexpectedSuccess', None)
                     if addUnexpectedSuccess is not None:
-                        addUnexpectedSuccess(self)
+                        addUnexpectedSuccess(self, x.bugnumber)
                     else:
                         warnings.warn("Use of a TestResult without an addUnexpectedSuccess method is deprecated", 
                                       DeprecationWarning)

Modified: lldb/branches/lldb-platform-work/test/unittest2/result.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/unittest2/result.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/unittest2/result.py (original)
+++ lldb/branches/lldb-platform-work/test/unittest2/result.py Thu Jun  6 19:06:43 2013
@@ -123,13 +123,13 @@ class TestResult(unittest.TestResult):
         """Called when a test is skipped."""
         self.skipped.append((test, reason))
 
-    def addExpectedFailure(self, test, err):
+    def addExpectedFailure(self, test, err, bugnumber):
         """Called when an expected failure/error occured."""
         self.expectedFailures.append(
             (test, self._exc_info_to_string(err, test)))
 
     @failfast
-    def addUnexpectedSuccess(self, test):
+    def addUnexpectedSuccess(self, test, bugnumber):
         """Called when a test was expected to fail, but succeed."""
         self.unexpectedSuccesses.append(test)
 

Modified: lldb/branches/lldb-platform-work/test/unittest2/runner.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/unittest2/runner.py?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/unittest2/runner.py (original)
+++ lldb/branches/lldb-platform-work/test/unittest2/runner.py Thu Jun  6 19:06:43 2013
@@ -3,6 +3,7 @@
 import sys
 import time
 import unittest
+import progress
 
 from unittest2 import result
 
@@ -45,6 +46,7 @@ class TextTestResult(result.TestResult):
         self.showAll = verbosity > 1
         self.dots = verbosity == 1
         self.descriptions = descriptions
+        self.progressbar = None
 
     def getDescription(self, test):
         doc_first_line = test.shortDescription()
@@ -60,55 +62,48 @@ class TextTestResult(result.TestResult):
             self.stream.write(" ... ")
             self.stream.flush()
 
-    def addSuccess(self, test):
-        super(TextTestResult, self).addSuccess(test)
+    def newTestResult(self,test,result_short,result_long):
         if self.showAll:
-            self.stream.writeln("ok")
+            self.stream.writeln(result_long)
+        elif self.progressbar:
+            self.progressbar.__add__(1)
+            self.progressbar.add_event(result_short)
+            self.progressbar.show_progress()
         elif self.dots:
-            self.stream.write('.')
+            self.stream.write(result_short)
             self.stream.flush()
 
+    def addSuccess(self, test):
+        super(TextTestResult, self).addSuccess(test)
+        if self.progressbar:
+            self.newTestResult(test,"ok","ok")
+        else:
+            self.newTestResult(test,".","ok")
+
     def addError(self, test, err):
         super(TextTestResult, self).addError(test, err)
-        if self.showAll:
-            self.stream.writeln("ERROR")
-        elif self.dots:
-            self.stream.write('E')
-            self.stream.flush()
+        self.newTestResult(test,"E","ERROR")
 
     def addFailure(self, test, err):
         super(TextTestResult, self).addFailure(test, err)
-        if self.showAll:
-            self.stream.writeln("FAIL")
-        elif self.dots:
-            self.stream.write('F')
-            self.stream.flush()
+        self.newTestResult(test,"F","FAILURE")
 
     def addSkip(self, test, reason):
         super(TextTestResult, self).addSkip(test, reason)
-        if self.showAll:
-            self.stream.writeln("skipped %r" % (reason,))
-        elif self.dots:
-            self.stream.write("s")
-            self.stream.flush()
+        self.newTestResult(test,"s","skipped %r" % (reason,))
 
-    def addExpectedFailure(self, test, err):
-        super(TextTestResult, self).addExpectedFailure(test, err)
-        if self.showAll:
-            self.stream.writeln("expected failure")
-        elif self.dots:
-            self.stream.write("x")
-            self.stream.flush()
-
-    def addUnexpectedSuccess(self, test):
-        super(TextTestResult, self).addUnexpectedSuccess(test)
-        if self.showAll:
-            self.stream.writeln("unexpected success")
-        elif self.dots:
-            self.stream.write("u")
-            self.stream.flush()
+    def addExpectedFailure(self, test, err, bugnumber):
+        super(TextTestResult, self).addExpectedFailure(test, err, bugnumber)
+        self.newTestResult(test,"x","expected failure")
+
+    def addUnexpectedSuccess(self, test, bugnumber):
+        super(TextTestResult, self).addUnexpectedSuccess(test, bugnumber)
+        self.newTestResult(test,"u","unexpected success")
 
     def printErrors(self):
+        if self.progressbar:
+            self.progressbar.complete()
+            self.progressbar.show_progress()
         if self.dots or self.showAll:
             self.stream.writeln()
         self.printErrorList('ERROR', self.errors)

Removed: lldb/branches/lldb-platform-work/test/warnings/uuid/TestUUIDMismatchWanring.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/warnings/uuid/TestUUIDMismatchWanring.py?rev=183467&view=auto
==============================================================================
--- lldb/branches/lldb-platform-work/test/warnings/uuid/TestUUIDMismatchWanring.py (original)
+++ lldb/branches/lldb-platform-work/test/warnings/uuid/TestUUIDMismatchWanring.py (removed)
@@ -1,113 +0,0 @@
-"""Test that the 'warning: UUID mismatch detected ...' message is emitted."""
-
-import os, time
-import unittest2
-import lldb
-import pexpect
-from lldbtest import *
-
- at unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
-class UUIDMismatchWarningCase(TestBase):
-
-    mydir = os.path.join("warnings", "uuid")
-
-    @classmethod
-    def classCleanup(cls):
-        """Cleanup the test byproducts."""
-        cls.RemoveTempFile("child_send.txt")
-        cls.RemoveTempFile("child_read.txt")
-
-    def setUp(self):
-        TestBase.setUp(self)
-        self.template = 'main.cpp.template'
-        self.source = 'main.cpp'
-        self.teardown_hook_added = False
-
-    def test_uuid_mismatch_warning(self):
-        """Test that the 'warning: UUID mismatch detected ...' message is emitted."""
-
-        # Call the program generator to produce main.cpp, version 1.
-        self.generate_main_cpp(version=1)
-        self.line_to_break = line_number(self.source, '// Set breakpoint here.')
-        self.buildDsym(clean=True)
-
-        # Insert some delay and then call the program generator to produce main.cpp, version 2.
-        time.sleep(5)
-        self.generate_main_cpp(version=101)
-        # Now call make again, but this time don't generate the dSYM.
-        self.buildDwarf(clean=False)
-
-        self.exe_name = 'a.out'
-        self.check_executable_and_dsym(self.exe_name)
-
-    def generate_main_cpp(self, version=0):
-        """Generate main.cpp from main.cpp.template."""
-        temp = os.path.join(os.getcwd(), self.template)
-        with open(temp, 'r') as f:
-            content = f.read()
-
-        new_content = content.replace('%ADD_EXTRA_CODE%',
-                                      'printf("This is version %d\\n");' % version)
-        src = os.path.join(os.getcwd(), self.source)
-        with open(src, 'w') as f:
-            f.write(new_content)
-
-        # The main.cpp has been generated, add a teardown hook to remove it.
-        if not self.teardown_hook_added:
-            self.addTearDownHook(lambda: os.remove(src))
-            self.teardown_hook_added = True
-
-    def check_executable_and_dsym(self, exe_name):
-        """Sanity check executable compiled from the auto-generated program."""
-
-        # The default lldb prompt.
-        prompt = "(lldb) "
-
-        # So that the child gets torn down after the test.
-        self.child = pexpect.spawn('%s %s' % (self.lldbHere, self.lldbOption))
-        child = self.child
-        # Turn on logging for input/output to/from the child.
-        with open('child_send.txt', 'w') as f_send:
-            with open('child_read.txt', 'w') as f_read:
-                child.logfile_send = f_send
-                child.logfile_read = f_read
-
-                child.expect_exact(prompt)
-                child.setecho(True)
-
-                # Execute the file command, followed by a breakpoint set, the
-                # UUID mismatch warning should be generated by then.
-
-                child.sendline("file %s" % exe_name)
-                child.expect_exact(prompt)
-                child.sendline("breakpoint set -f %s -l %d" % (self.source, self.line_to_break))
-                child.expect_exact(prompt)
-                child.sendline("run")
-                child.expect_exact(prompt)
-
-        # Now that the necessary logging is done, restore logfile to None to
-        # stop further logging.
-        child.logfile_send = None
-        child.logfile_read = None
-        
-        with open('child_send.txt', 'r') as fs:
-            if self.TraceOn():
-                print "\n\nContents of child_send.txt:"
-                print fs.read()
-        with open('child_read.txt', 'r') as fr:
-            from_child = fr.read()
-            if self.TraceOn():
-                print "\n\nContents of child_read.txt:"
-                print from_child
-
-            # Test that str_input completes to our patterns.
-            # If each pattern matches from_child, the completion mechanism works!
-            self.expect(from_child, msg="UUID mismatch expected!", exe=False,
-                substrs = ['warning: UUID mismatch detected'])
-
-
-if __name__ == '__main__':
-    import atexit
-    lldb.SBDebugger.Initialize()
-    atexit.register(lambda: lldb.SBDebugger.Terminate())
-    unittest2.main()

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

Modified: lldb/branches/lldb-platform-work/tools/darwin-threads/examine-threads.c
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/darwin-threads/examine-threads.c?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/darwin-threads/examine-threads.c (original)
+++ lldb/branches/lldb-platform-work/tools/darwin-threads/examine-threads.c Thu Jun  6 19:06:43 2013
@@ -152,6 +152,53 @@ get_thread_identifier_info (thread_t thr
   return tident;
 }
 
+
+/* Given a mach port # (in the examine-threads mach port namespace) for a thread,
+   find the mach port # in the inferior program's port namespace.  
+   Sets inferior_port if successful.
+   Returns true if successful, false if unable to find the port number.  */
+
+bool
+inferior_namespace_mach_port_num (task_t task, thread_t examine_threads_port, thread_t *inferior_port)
+{
+    kern_return_t retval;
+    mach_port_name_array_t names;
+    mach_msg_type_number_t nameslen;
+    mach_port_type_array_t types;
+    mach_msg_type_number_t typeslen;
+
+    if (inferior_port == NULL)
+        return false;
+
+    retval = mach_port_names (task, &names, &nameslen, &types, &typeslen);
+    if (retval != KERN_SUCCESS)
+    {
+        printf ("Error - unable to get mach port names for inferior.\n");
+        return false;
+    }
+    int i = 0;
+    for (i = 0; i < nameslen; i++)
+    {
+        mach_port_t local_name;
+        mach_msg_type_name_t local_type;
+        retval = mach_port_extract_right (task, names[i], MACH_MSG_TYPE_COPY_SEND, &local_name, &local_type);
+        if (retval == KERN_SUCCESS)
+        {
+            mach_port_deallocate (mach_task_self(), local_name);
+            if (local_name == examine_threads_port)
+            {
+                *inferior_port = names[i];
+                vm_deallocate (mach_task_self (), (vm_address_t) names, nameslen * sizeof (mach_port_t));
+                vm_deallocate (mach_task_self (), (vm_address_t) types, typeslen * sizeof (mach_port_t));
+                return true;
+            }
+        }
+    }
+    vm_deallocate (mach_task_self (), (vm_address_t) names, nameslen * sizeof (mach_port_t));
+    vm_deallocate (mach_task_self (), (vm_address_t) types, typeslen * sizeof (mach_port_t));
+    return false;
+}
+
 /* Get the current pc value for a given thread.  */
 
 uint64_t
@@ -227,11 +274,12 @@ main (int argc, char **argv)
   int arg_is_procname = 0;
   int do_loop = 0;
   int verbose = 0;
+  int resume_when_done = 0;
   mach_port_t mytask = mach_task_self ();
 
-  if (argc != 2 && argc != 3 && argc != 4)
+  if (argc != 2 && argc != 3 && argc != 4 && argc != 5)
     {
-      printf ("Usage: tdump [-l] [-v] pid/procname\n");
+      printf ("Usage: tdump [-l] [-v] [-r] pid/procname\n");
       exit (1);
     }
   
@@ -244,6 +292,8 @@ main (int argc, char **argv)
             do_loop = 1;
           if (strcmp (argv[i], "-v") == 0)
             verbose = 1;
+          if (strcmp (argv[i], "-r") == 0)
+            resume_when_done = 1;
           i++;
         }
     }
@@ -353,7 +403,7 @@ main (int argc, char **argv)
           int wordsize;
           uint64_t pc = get_current_pc (thread_list[i], &wordsize);
 
-          printf ("thread #%d, unique tid %lld, suspend count is %d, ", i,
+          printf ("thread #%d, system-wide-unique-tid %lld, suspend count is %d, ", i,
                   identifier_info.thread_id,
                   basic_info->suspend_count);
           if (wordsize == 8)
@@ -371,18 +421,19 @@ main (int argc, char **argv)
           }
           if (verbose)
             {
-              printf ("           ");
-              printf ("mach thread #0x%4.4x ", (int) thread_list[i]);
-              printf ("pthread handle id 0x%llx ", (uint64_t) identifier_info.thread_handle);
+              printf ("           (examine-threads port namespace) mach port # 0x%4.4x\n", (int) thread_list[i]);
+              thread_t mach_port_inferior_namespace;
+              if (inferior_namespace_mach_port_num (task, thread_list[i], &mach_port_inferior_namespace))
+                  printf ("           (inferior port namepsace) mach port # 0x%4.4x\n", (int) mach_port_inferior_namespace);
+              printf ("           pthread handle id 0x%llx\n", (uint64_t) identifier_info.thread_handle);
 
               struct proc_threadinfo pth;
               int proc_threadinfo_succeeded = get_proc_threadinfo (pid, identifier_info.thread_handle, &pth);
 
               if (proc_threadinfo_succeeded && pth.pth_name[0] != '\0')
-                printf ("thread name '%s' ", pth.pth_name);
+                printf ("           thread name '%s' ", pth.pth_name);
 
-              printf ("\n           ");
-              printf ("user %d.%06ds, system %d.%06ds", 
+              printf ("           user %d.%06ds, system %d.%06ds", 
                               basic_info->user_time.seconds, basic_info->user_time.microseconds, 
                               basic_info->system_time.seconds, basic_info->system_time.microseconds);
               if (basic_info->cpu_usage > 0)
@@ -419,6 +470,10 @@ main (int argc, char **argv)
       nanosleep (rqtp, NULL);
     } while (do_loop);
   
+  kern_return_t err = task_resume (task);
+  if (err != KERN_SUCCESS)
+    printf ("Error resuming task: %d.", err);
+
   vm_deallocate (mytask, (vm_address_t) task, sizeof (task_t));
   free ((void *) process_name);
 

Modified: lldb/branches/lldb-platform-work/tools/debugserver/debugserver.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/debugserver.xcodeproj/project.pbxproj?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/debugserver.xcodeproj/project.pbxproj (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/debugserver.xcodeproj/project.pbxproj Thu Jun  6 19:06:43 2013
@@ -49,6 +49,8 @@
 		260E7331114BFFE600D1DFB3 /* DNBThreadResumeActions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DNBThreadResumeActions.cpp; sourceTree = "<group>"; };
 		260E7332114BFFE600D1DFB3 /* DNBThreadResumeActions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DNBThreadResumeActions.h; sourceTree = "<group>"; };
 		260FC7320E5B290400043FC9 /* debugnub-exports */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "debugnub-exports"; sourceTree = SOURCE_ROOT; };
+		26203D1C1641EFB200A662F7 /* com.apple.debugserver.applist.internal.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = com.apple.debugserver.applist.internal.plist; sourceTree = "<group>"; };
+		26203D1D1641EFB200A662F7 /* com.apple.debugserver.internal.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = com.apple.debugserver.internal.plist; sourceTree = "<group>"; };
 		26242C390DDBD33C0054A4CC /* debugserver-entitlements.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "debugserver-entitlements.plist"; sourceTree = "<group>"; };
 		264D5D571293835600ED4C01 /* DNBArch.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DNBArch.cpp; sourceTree = "<group>"; };
 		26593A060D4931CC001C9FE3 /* ChangeLog */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ChangeLog; sourceTree = "<group>"; };
@@ -63,8 +65,7 @@
 		2695DD9B0D3EC160007E4CA2 /* CFString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CFString.cpp; sourceTree = "<group>"; };
 		2695DE2D0D3EE55B007E4CA2 /* CFData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CFData.h; sourceTree = "<group>"; };
 		2695DE2E0D3EE55B007E4CA2 /* CFData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CFData.cpp; sourceTree = "<group>"; };
-		269DE5C50CB5B723008989F0 /* ProfileObjectiveC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProfileObjectiveC.h; sourceTree = "<group>"; };
-		269DE5C60CB5B723008989F0 /* ProfileObjectiveC.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ProfileObjectiveC.cpp; sourceTree = "<group>"; };
+		269E8DF8164B2ED200AD65F6 /* com.apple.debugserver.posix.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = com.apple.debugserver.posix.plist; sourceTree = "<group>"; };
 		26A02918114AB9240029C479 /* debugserver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = debugserver.cpp; sourceTree = "<group>"; };
 		26A4BAED0D498B7D00A9BEAB /* com.apple.debugserver.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = com.apple.debugserver.plist; sourceTree = "<group>"; };
 		26A68F7D0D104EC800665A9E /* RNBContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNBContext.h; sourceTree = "<group>"; };
@@ -74,8 +75,6 @@
 		26A68FD50D10574500665A9E /* RNBRemote.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNBRemote.h; sourceTree = "<group>"; };
 		26A68FD60D10574500665A9E /* RNBRemote.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RNBRemote.cpp; sourceTree = "<group>"; };
 		26A8FE1E0D11A77B00203048 /* DNBTimer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DNBTimer.h; sourceTree = "<group>"; };
-		26A901EA0EA3F46B00F7C71E /* FunctionProfiler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FunctionProfiler.cpp; sourceTree = "<group>"; };
-		26A901EB0EA3F46B00F7C71E /* FunctionProfiler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FunctionProfiler.h; sourceTree = "<group>"; };
 		26ACA3340D3E956300A2120B /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; };
 		26B67DE00EE9BC30006C8BC0 /* MachTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MachTask.h; sourceTree = "<group>"; };
 		26B67DE10EE9BC30006C8BC0 /* MachTask.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MachTask.cpp; sourceTree = "<group>"; };
@@ -98,8 +97,6 @@
 		26C637E80C71334A0024798E /* dbgnub-mig.defs */ = {isa = PBXFileReference; explicitFileType = sourcecode.mig; fileEncoding = 30; path = "dbgnub-mig.defs"; sourceTree = "<group>"; };
 		26C637EA0C71334A0024798E /* DNBArchImplI386.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = DNBArchImplI386.cpp; sourceTree = "<group>"; };
 		26C637EB0C71334A0024798E /* DNBArchImplI386.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DNBArchImplI386.h; sourceTree = "<group>"; };
-		26C637EC0C71334A0024798E /* MachDYLD.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = MachDYLD.cpp; sourceTree = "<group>"; };
-		26C637ED0C71334A0024798E /* MachDYLD.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MachDYLD.h; sourceTree = "<group>"; };
 		26C637EE0C71334A0024798E /* MachException.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = MachException.cpp; sourceTree = "<group>"; };
 		26C637EF0C71334A0024798E /* MachException.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MachException.h; sourceTree = "<group>"; };
 		26C637F00C71334A0024798E /* MachProcess.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = MachProcess.cpp; sourceTree = "<group>"; };
@@ -182,6 +179,9 @@
 		26A028FE114AB6A60029C479 /* Resources */ = {
 			isa = PBXGroup;
 			children = (
+				269E8DF8164B2ED200AD65F6 /* com.apple.debugserver.posix.plist */,
+				26203D1C1641EFB200A662F7 /* com.apple.debugserver.applist.internal.plist */,
+				26203D1D1641EFB200A662F7 /* com.apple.debugserver.internal.plist */,
 				260FC7320E5B290400043FC9 /* debugnub-exports */,
 				26242C390DDBD33C0054A4CC /* debugserver-entitlements.plist */,
 				26A4BAED0D498B7D00A9BEAB /* com.apple.debugserver.plist */,
@@ -229,17 +229,6 @@
 			name = libdebugnub;
 			sourceTree = "<group>";
 		};
-		26A02900114AB6DB0029C479 /* Utility */ = {
-			isa = PBXGroup;
-			children = (
-				26A901EB0EA3F46B00F7C71E /* FunctionProfiler.h */,
-				26A901EA0EA3F46B00F7C71E /* FunctionProfiler.cpp */,
-				269DE5C50CB5B723008989F0 /* ProfileObjectiveC.h */,
-				269DE5C60CB5B723008989F0 /* ProfileObjectiveC.cpp */,
-			);
-			name = Utility;
-			sourceTree = "<group>";
-		};
 		26ACA3330D3E94F200A2120B /* Framework */ = {
 			isa = PBXGroup;
 			children = (
@@ -262,7 +251,6 @@
 				26593A060D4931CC001C9FE3 /* ChangeLog */,
 				26DEFD6C0D104C23008A5A07 /* debugserver */,
 				26A028FF114AB6BB0029C479 /* libdebugnub */,
-				26A02900114AB6DB0029C479 /* Utility */,
 			);
 			indentWidth = 4;
 			path = source;
@@ -287,8 +275,6 @@
 				4971AE7013D10F4F00649E37 /* HasAVX.h */,
 				4971AE7113D10F4F00649E37 /* HasAVX.s */,
 				26C637E80C71334A0024798E /* dbgnub-mig.defs */,
-				26C637ED0C71334A0024798E /* MachDYLD.h */,
-				26C637EC0C71334A0024798E /* MachDYLD.cpp */,
 				26C637EF0C71334A0024798E /* MachException.h */,
 				26C637EE0C71334A0024798E /* MachException.cpp */,
 				26C637F10C71334A0024798E /* MachProcess.h */,
@@ -384,7 +370,7 @@
 		08FB7793FE84155DC02AAC07 /* Project object */ = {
 			isa = PBXProject;
 			attributes = {
-				LastUpgradeCheck = 0430;
+				LastUpgradeCheck = 0500;
 			};
 			buildConfigurationList = 1DEB914E08733D8E0010E9CD /* Build configuration list for PBXProject "debugserver" */;
 			compatibilityVersion = "Xcode 3.2";
@@ -479,15 +465,22 @@
 					x86_64,
 					i386,
 				);
+				CLANG_WARN_BOOL_CONVERSION = YES;
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
+				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES;
+				CLANG_WARN_EMPTY_BODY = YES;
+				CLANG_WARN_ENUM_CONVERSION = YES;
+				CLANG_WARN_INT_CONVERSION = YES;
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
 				COPY_PHASE_STRIP = NO;
-				CURRENT_PROJECT_VERSION = 192;
+				CURRENT_PROJECT_VERSION = 300.99.0;
 				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
+				GCC_WARN_UNDECLARED_SELECTOR = YES;
+				GCC_WARN_UNINITIALIZED_AUTOS = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
 				ONLY_ACTIVE_ARCH = YES;
-				SDKROOT = "";
 				STRIP_INSTALLED_PRODUCT = NO;
-				VALID_ARCHS = "armv4t armv5 armv6 armv7 armv7s i386 ppc ppc64 ppc7400 ppc970 x86_64";
 				VERSIONING_SYSTEM = "apple-generic";
 				VERSION_INFO_BUILDER = "$(USER)";
 			};
@@ -501,16 +494,23 @@
 					armv7s,
 				);
 				"ARCHS[sdk=macosx*]" = "$(ARCHS_STANDARD_64_BIT)";
-				CURRENT_PROJECT_VERSION = 192;
+				CLANG_WARN_BOOL_CONVERSION = YES;
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
+				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES;
+				CLANG_WARN_EMPTY_BODY = YES;
+				CLANG_WARN_ENUM_CONVERSION = YES;
+				CLANG_WARN_INT_CONVERSION = YES;
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+				CURRENT_PROJECT_VERSION = 300.99.0;
 				DEAD_CODE_STRIPPING = YES;
 				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
+				GCC_WARN_UNDECLARED_SELECTOR = YES;
+				GCC_WARN_UNINITIALIZED_AUTOS = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
 				ONLY_ACTIVE_ARCH = YES;
-				SDKROOT = "";
 				STRIPFLAGS = "-x";
 				STRIP_STYLE = debugging;
-				VALID_ARCHS = "armv4t armv5 armv6 armv7 armv7s i386 ppc ppc64 ppc7400 ppc970 x86_64";
 				VERSIONING_SYSTEM = "apple-generic";
 				VERSION_INFO_BUILDER = "$(USER)";
 			};
@@ -527,15 +527,22 @@
 					x86_64,
 					i386,
 				);
-				CURRENT_PROJECT_VERSION = 192;
+				CLANG_WARN_BOOL_CONVERSION = YES;
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
+				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES;
+				CLANG_WARN_EMPTY_BODY = YES;
+				CLANG_WARN_ENUM_CONVERSION = YES;
+				CLANG_WARN_INT_CONVERSION = YES;
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+				CURRENT_PROJECT_VERSION = 300.99.0;
 				DEAD_CODE_STRIPPING = YES;
 				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
+				GCC_WARN_UNDECLARED_SELECTOR = YES;
+				GCC_WARN_UNINITIALIZED_AUTOS = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
-				SDKROOT = "";
 				STRIPFLAGS = "-x";
 				STRIP_STYLE = debugging;
-				VALID_ARCHS = "armv4t armv5 armv6 armv7 armv7s i386 ppc ppc64 ppc7400 ppc970 x86_64";
 				VERSIONING_SYSTEM = "apple-generic";
 				VERSION_INFO_BUILDER = "$(USER)";
 			};
@@ -544,9 +551,11 @@
 		262419A21198A93E00067686 /* BuildAndIntegration */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
+				CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
+				CLANG_CXX_LIBRARY = "libc++";
 				"CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*]" = "source/debugserver-entitlements.plist";
 				COPY_PHASE_STRIP = YES;
-				CURRENT_PROJECT_VERSION = 192;
+				CURRENT_PROJECT_VERSION = 300.99.0;
 				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
 				FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks;
 				"FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = (
@@ -554,6 +563,7 @@
 					"$(SDKROOT)/Developer/Library/PrivateFrameworks",
 				);
 				"FRAMEWORK_SEARCH_PATHS[sdk=macosx*][arch=*]" = "$(SDKROOT)/System/Library/PrivateFrameworks";
+				GCC_C_LANGUAGE_STANDARD = c99;
 				GCC_PREPROCESSOR_DEFINITIONS = LLDB_DEBUGSERVER_BUILDANDINTEGRATION;
 				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
 				HEADER_SEARCH_PATHS = /System/Library/Frameworks/System.framework/PrivateHeaders;
@@ -565,7 +575,6 @@
 					"-Wparentheses",
 					"-DWITH_LOCKDOWN",
 					"-DWITH_SPRINGBOARD",
-					"-DUSE_ARM_DISASSEMBLER_FRAMEWORK",
 					"-DOS_OBJECT_USE_OBJC=0",
 				);
 				"OTHER_CPLUSPLUSFLAGS[sdk=iphoneos*][arch=*]" = "$(OTHER_CFLAGS)";
@@ -578,8 +587,6 @@
 				"OTHER_LDFLAGS[sdk=iphoneos*][arch=*]" = (
 					"-framework",
 					SpringBoardServices,
-					"-framework",
-					ARMDisassembler,
 					"-llockdown",
 				);
 				OTHER_MIGFLAGS = "-I$(DERIVED_FILE_DIR)";
@@ -595,17 +602,20 @@
 		26CE0596115C31C30022F371 /* Debug */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
+				CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
+				CLANG_CXX_LIBRARY = "libc++";
 				"CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*]" = "source/debugserver-entitlements.plist";
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "-";
 				"CODE_SIGN_IDENTITY[sdk=macosx*]" = lldb_codesign;
 				COPY_PHASE_STRIP = YES;
-				CURRENT_PROJECT_VERSION = 192;
+				CURRENT_PROJECT_VERSION = 300.99.0;
 				FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks;
 				"FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = (
 					"$(SDKROOT)/System/Library/PrivateFrameworks",
 					"$(SDKROOT)/Developer/Library/PrivateFrameworks",
 				);
 				"FRAMEWORK_SEARCH_PATHS[sdk=macosx*][arch=*]" = "$(SDKROOT)/System/Library/PrivateFrameworks";
+				GCC_C_LANGUAGE_STANDARD = c99;
 				GCC_DYNAMIC_NO_PIC = NO;
 				GCC_OPTIMIZATION_LEVEL = 0;
 				GCC_PREPROCESSOR_DEFINITIONS = LLDB_DEBUGSERVER_DEBUG;
@@ -617,7 +627,6 @@
 					"-Wparentheses",
 					"-DWITH_LOCKDOWN",
 					"-DWITH_SPRINGBOARD",
-					"-DUSE_ARM_DISASSEMBLER_FRAMEWORK",
 					"-DOS_OBJECT_USE_OBJC=0",
 				);
 				"OTHER_CPLUSPLUSFLAGS[sdk=iphoneos*][arch=*]" = "$(OTHER_CFLAGS)";
@@ -630,8 +639,6 @@
 				"OTHER_LDFLAGS[sdk=iphoneos*][arch=*]" = (
 					"-framework",
 					SpringBoardServices,
-					"-framework",
-					ARMDisassembler,
 					"-llockdown",
 				);
 				OTHER_MIGFLAGS = "-I$(DERIVED_FILE_DIR)";
@@ -647,11 +654,13 @@
 		26CE0597115C31C30022F371 /* Release */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
+				CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
+				CLANG_CXX_LIBRARY = "libc++";
 				"CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*]" = "source/debugserver-entitlements.plist";
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "-";
 				"CODE_SIGN_IDENTITY[sdk=macosx*]" = lldb_codesign;
 				COPY_PHASE_STRIP = YES;
-				CURRENT_PROJECT_VERSION = 192;
+				CURRENT_PROJECT_VERSION = 300.99.0;
 				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
 				FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks;
 				"FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = (
@@ -659,6 +668,7 @@
 					"$(SDKROOT)/Developer/Library/PrivateFrameworks",
 				);
 				"FRAMEWORK_SEARCH_PATHS[sdk=macosx*][arch=*]" = "$(SDKROOT)/System/Library/PrivateFrameworks";
+				GCC_C_LANGUAGE_STANDARD = c99;
 				GCC_PREPROCESSOR_DEFINITIONS = LLDB_DEBUGSERVER_RELEASE;
 				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
 				HEADER_SEARCH_PATHS = /System/Library/Frameworks/System.framework/PrivateHeaders;
@@ -669,7 +679,6 @@
 					"-Wparentheses",
 					"-DWITH_LOCKDOWN",
 					"-DWITH_SPRINGBOARD",
-					"-DUSE_ARM_DISASSEMBLER_FRAMEWORK",
 					"-DOS_OBJECT_USE_OBJC=0",
 				);
 				"OTHER_CPLUSPLUSFLAGS[sdk=iphoneos*][arch=*]" = "$(OTHER_CFLAGS)";
@@ -682,8 +691,6 @@
 				"OTHER_LDFLAGS[sdk=iphoneos*][arch=*]" = (
 					"-framework",
 					SpringBoardServices,
-					"-framework",
-					ARMDisassembler,
 					"-llockdown",
 				);
 				OTHER_MIGFLAGS = "-I$(DERIVED_FILE_DIR)";
@@ -696,6 +703,90 @@
 			};
 			name = Release;
 		};
+		4968B7A916657FAE00741ABB /* DebugClang */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				"ARCHS[sdk=iphoneos*]" = (
+					armv7,
+					armv7s,
+				);
+				"ARCHS[sdk=macosx*]" = (
+					x86_64,
+					i386,
+				);
+				CLANG_WARN_BOOL_CONVERSION = YES;
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
+				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES;
+				CLANG_WARN_EMPTY_BODY = YES;
+				CLANG_WARN_ENUM_CONVERSION = YES;
+				CLANG_WARN_INT_CONVERSION = YES;
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+				COPY_PHASE_STRIP = NO;
+				CURRENT_PROJECT_VERSION = 300.99.0;
+				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+				GCC_WARN_ABOUT_RETURN_TYPE = YES;
+				GCC_WARN_UNDECLARED_SELECTOR = YES;
+				GCC_WARN_UNINITIALIZED_AUTOS = YES;
+				GCC_WARN_UNUSED_VARIABLE = YES;
+				ONLY_ACTIVE_ARCH = YES;
+				STRIP_INSTALLED_PRODUCT = NO;
+				VERSIONING_SYSTEM = "apple-generic";
+				VERSION_INFO_BUILDER = "$(USER)";
+			};
+			name = DebugClang;
+		};
+		4968B7AA16657FAE00741ABB /* DebugClang */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
+				CLANG_CXX_LIBRARY = "libc++";
+				"CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*]" = "source/debugserver-entitlements.plist";
+				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "-";
+				"CODE_SIGN_IDENTITY[sdk=macosx*]" = lldb_codesign;
+				COPY_PHASE_STRIP = YES;
+				CURRENT_PROJECT_VERSION = 300.99.0;
+				FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks;
+				"FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = (
+					"$(SDKROOT)/System/Library/PrivateFrameworks",
+					"$(SDKROOT)/Developer/Library/PrivateFrameworks",
+				);
+				"FRAMEWORK_SEARCH_PATHS[sdk=macosx*][arch=*]" = "$(SDKROOT)/System/Library/PrivateFrameworks";
+				GCC_C_LANGUAGE_STANDARD = c99;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = LLDB_DEBUGSERVER_DEBUG;
+				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+				INSTALL_PATH = /usr/bin;
+				LLDB_DEBUGSERVER = 1;
+				OTHER_CFLAGS = "-Wparentheses";
+				"OTHER_CFLAGS[sdk=iphoneos*][arch=*]" = (
+					"-Wparentheses",
+					"-DWITH_LOCKDOWN",
+					"-DWITH_SPRINGBOARD",
+					"-DOS_OBJECT_USE_OBJC=0",
+				);
+				"OTHER_CPLUSPLUSFLAGS[sdk=iphoneos*][arch=*]" = "$(OTHER_CFLAGS)";
+				OTHER_LDFLAGS = (
+					"-sectcreate",
+					__TEXT,
+					__info_plist,
+					"$(PROJECT_DIR)/resources/lldb-debugserver-Info.plist",
+				);
+				"OTHER_LDFLAGS[sdk=iphoneos*][arch=*]" = (
+					"-framework",
+					SpringBoardServices,
+					"-llockdown",
+				);
+				OTHER_MIGFLAGS = "-I$(DERIVED_FILE_DIR)";
+				PRODUCT_NAME = debugserver;
+				"PROVISIONING_PROFILE[sdk=iphoneos*]" = "";
+				"PROVISIONING_PROFILE[sdk=macosx*]" = "";
+				SKIP_INSTALL = YES;
+				USER_HEADER_SEARCH_PATHS = "./source ../../source $(DERIVED_SOURCES_DIR)";
+				ZERO_LINK = NO;
+			};
+			name = DebugClang;
+		};
 /* End XCBuildConfiguration section */
 
 /* Begin XCConfigurationList section */
@@ -703,6 +794,7 @@
 			isa = XCConfigurationList;
 			buildConfigurations = (
 				1DEB914F08733D8E0010E9CD /* Debug */,
+				4968B7A916657FAE00741ABB /* DebugClang */,
 				1DEB915008733D8E0010E9CD /* Release */,
 				262419A11198A93E00067686 /* BuildAndIntegration */,
 			);
@@ -713,6 +805,7 @@
 			isa = XCConfigurationList;
 			buildConfigurations = (
 				26CE0596115C31C30022F371 /* Debug */,
+				4968B7AA16657FAE00741ABB /* DebugClang */,
 				26CE0597115C31C30022F371 /* Release */,
 				262419A21198A93E00067686 /* BuildAndIntegration */,
 			);

Modified: lldb/branches/lldb-platform-work/tools/debugserver/debugserver.xcodeproj/xcshareddata/xcschemes/debugserver.xcscheme
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/debugserver.xcodeproj/xcshareddata/xcschemes/debugserver.xcscheme?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/debugserver.xcodeproj/xcshareddata/xcschemes/debugserver.xcscheme (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/debugserver.xcodeproj/xcshareddata/xcschemes/debugserver.xcscheme Thu Jun  6 19:06:43 2013
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <Scheme
-   LastUpgradeVersion = "0450"
+   LastUpgradeVersion = "0500"
    version = "1.8">
    <BuildAction
       parallelizeBuildables = "NO"
@@ -56,7 +56,6 @@
       buildConfiguration = "Debug"
       ignoresPersistentStateOnLaunch = "NO"
       debugDocumentVersioning = "YES"
-      enableOpenGLFrameCaptureMode = "0"
       allowLocationSimulation = "YES">
       <BuildableProductRunnable>
          <BuildableReference

Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/ARM_DWARF_Registers.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/ARM_DWARF_Registers.h?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/ARM_DWARF_Registers.h (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/ARM_DWARF_Registers.h Thu Jun  6 19:06:43 2013
@@ -7,8 +7,9 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef utility_ARM_DWARF_Registers_h_
-#define utility_ARM_DWARF_Registers_h_
+#ifndef ARM_DWARF_Registers_h_
+#define ARM_DWARF_Registers_h_
+
 
 enum
 {
@@ -73,7 +74,7 @@ enum
     dwarf_f6,
     dwarf_f7,
 
-    // Intel wireless MMX general purpose registers 0–7
+    // Intel wireless MMX general purpose registers 0 - 7
     dwarf_wCGR0 = 104,
     dwarf_wCGR1,
     dwarf_wCGR2,
@@ -93,7 +94,7 @@ enum
     dwarf_ACC6,
     dwarf_ACC7,
 
-    // Intel wireless MMX data registers 0–15
+    // Intel wireless MMX data registers 0 - 15
     dwarf_wR0 = 112,
     dwarf_wR1,
     dwarf_wR2,
@@ -141,7 +142,7 @@ enum
     dwarf_r13_svc,
     dwarf_r14_svc,
 
-    // Intel wireless MMX control register in co-processor 0–7
+    // Intel wireless MMX control register in co-processor 0 - 7
     dwarf_wC0 = 192,
     dwarf_wC1,
     dwarf_wC2,
@@ -183,8 +184,26 @@ enum
     dwarf_d28,
     dwarf_d29,
     dwarf_d30,
-    dwarf_d31
+    dwarf_d31,
+
+    // Neon quadword registers
+    dwarf_q0 = 288,
+    dwarf_q1,
+    dwarf_q2,
+    dwarf_q3,
+    dwarf_q4,
+    dwarf_q5,
+    dwarf_q6,
+    dwarf_q7,
+    dwarf_q8,
+    dwarf_q9,
+    dwarf_q10,
+    dwarf_q11,
+    dwarf_q12,
+    dwarf_q13,
+    dwarf_q14,
+    dwarf_q15
 };
 
-#endif // utility_ARM_DWARF_Registers_h_
+#endif // ARM_DWARF_Registers_h_
 

Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/ARM_GCC_Registers.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/ARM_GCC_Registers.h?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/ARM_GCC_Registers.h (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/ARM_GCC_Registers.h Thu Jun  6 19:06:43 2013
@@ -31,5 +31,116 @@ enum
     gcc_cpsr
 };
 
+enum
+{
+//  Name                    Nr   Rel Offset    Size  Type            Raw value
+    gdb_arm_r0          =   0, //  0      0       4 int32_t
+    gdb_arm_r1          =   1, //  1      4       4 int32_t
+    gdb_arm_r2          =   2, //  2      8       4 int32_t
+    gdb_arm_r3          =   3, //  3     12       4 int32_t
+    gdb_arm_r4          =   4, //  4     16       4 int32_t
+    gdb_arm_r5          =   5, //  5     20       4 int32_t
+    gdb_arm_r6          =   6, //  6     24       4 int32_t
+    gdb_arm_r7          =   7, //  7     28       4 int32_t
+    gdb_arm_r8          =   8, //  8     32       4 int32_t
+    gdb_arm_r9          =   9, //  9     36       4 int32_t
+    gdb_arm_r10         =  10, // 10     40       4 int32_t
+    gdb_arm_r11         =  11, // 11     44       4 int32_t
+    gdb_arm_r12         =  12, // 12     48       4 int32_t
+    gdb_arm_sp          =  13, // 13     52       4 int32_t
+    gdb_arm_lr          =  14, // 14     56       4 int32_t
+    gdb_arm_pc          =  15, // 15     60       4 int32_t
+    gdb_arm_f0          =  16, // 16     64      12 _arm_ext_littlebyte_bigword
+    gdb_arm_f1          =  17, // 17     76      12 _arm_ext_littlebyte_bigword
+    gdb_arm_f2          =  18, // 18     88      12 _arm_ext_littlebyte_bigword
+    gdb_arm_f3          =  19, // 19    100      12 _arm_ext_littlebyte_bigword
+    gdb_arm_f4          =  20, // 20    112      12 _arm_ext_littlebyte_bigword
+    gdb_arm_f5          =  21, // 21    124      12 _arm_ext_littlebyte_bigword
+    gdb_arm_f6          =  22, // 22    136      12 _arm_ext_littlebyte_bigword
+    gdb_arm_f7          =  23, // 23    148      12 _arm_ext_littlebyte_bigword
+    gdb_arm_f8          =  24, // 24    160      12 _arm_ext_littlebyte_bigword
+    gdb_arm_cpsr        =  25, // 25    172       4 int32_t
+    gdb_arm_s0          =  26, // 26    176       4 _ieee_single_little
+    gdb_arm_s1          =  27, // 27    180       4 _ieee_single_little
+    gdb_arm_s2          =  28, // 28    184       4 _ieee_single_little
+    gdb_arm_s3          =  29, // 29    188       4 _ieee_single_little
+    gdb_arm_s4          =  30, // 30    192       4 _ieee_single_little
+    gdb_arm_s5          =  31, // 31    196       4 _ieee_single_little
+    gdb_arm_s6          =  32, // 32    200       4 _ieee_single_little
+    gdb_arm_s7          =  33, // 33    204       4 _ieee_single_little
+    gdb_arm_s8          =  34, // 34    208       4 _ieee_single_little
+    gdb_arm_s9          =  35, // 35    212       4 _ieee_single_little
+    gdb_arm_s10         =  36, // 36    216       4 _ieee_single_little
+    gdb_arm_s11         =  37, // 37    220       4 _ieee_single_little
+    gdb_arm_s12         =  38, // 38    224       4 _ieee_single_little
+    gdb_arm_s13         =  39, // 39    228       4 _ieee_single_little
+    gdb_arm_s14         =  40, // 40    232       4 _ieee_single_little
+    gdb_arm_s15         =  41, // 41    236       4 _ieee_single_little
+    gdb_arm_s16         =  42, // 42    240       4 _ieee_single_little
+    gdb_arm_s17         =  43, // 43    244       4 _ieee_single_little
+    gdb_arm_s18         =  44, // 44    248       4 _ieee_single_little
+    gdb_arm_s19         =  45, // 45    252       4 _ieee_single_little
+    gdb_arm_s20         =  46, // 46    256       4 _ieee_single_little
+    gdb_arm_s21         =  47, // 47    260       4 _ieee_single_little
+    gdb_arm_s22         =  48, // 48    264       4 _ieee_single_little
+    gdb_arm_s23         =  49, // 49    268       4 _ieee_single_little
+    gdb_arm_s24         =  50, // 50    272       4 _ieee_single_little
+    gdb_arm_s25         =  51, // 51    276       4 _ieee_single_little
+    gdb_arm_s26         =  52, // 52    280       4 _ieee_single_little
+    gdb_arm_s27         =  53, // 53    284       4 _ieee_single_little
+    gdb_arm_s28         =  54, // 54    288       4 _ieee_single_little
+    gdb_arm_s29         =  55, // 55    292       4 _ieee_single_little
+    gdb_arm_s30         =  56, // 56    296       4 _ieee_single_little
+    gdb_arm_s31         =  57, // 57    300       4 _ieee_single_little
+    gdb_arm_fpscr       =  58, // 58    304       4 int32_t
+    gdb_arm_d16         =  59, // 59    308       8 _ieee_double_little
+    gdb_arm_d17         =  60, // 60    316       8 _ieee_double_little
+    gdb_arm_d18         =  61, // 61    324       8 _ieee_double_little
+    gdb_arm_d19         =  62, // 62    332       8 _ieee_double_little
+    gdb_arm_d20         =  63, // 63    340       8 _ieee_double_little
+    gdb_arm_d21         =  64, // 64    348       8 _ieee_double_little
+    gdb_arm_d22         =  65, // 65    356       8 _ieee_double_little
+    gdb_arm_d23         =  66, // 66    364       8 _ieee_double_little
+    gdb_arm_d24         =  67, // 67    372       8 _ieee_double_little
+    gdb_arm_d25         =  68, // 68    380       8 _ieee_double_little
+    gdb_arm_d26         =  69, // 69    388       8 _ieee_double_little
+    gdb_arm_d27         =  70, // 70    396       8 _ieee_double_little
+    gdb_arm_d28         =  71, // 71    404       8 _ieee_double_little
+    gdb_arm_d29         =  72, // 72    412       8 _ieee_double_little
+    gdb_arm_d30         =  73, // 73    420       8 _ieee_double_little
+    gdb_arm_d31         =  74, // 74    428       8 _ieee_double_little
+    gdb_arm_d0          =  75, //  0    436       8 _ieee_double_little
+    gdb_arm_d1          =  76, //  1    444       8 _ieee_double_little
+    gdb_arm_d2          =  77, //  2    452       8 _ieee_double_little
+    gdb_arm_d3          =  78, //  3    460       8 _ieee_double_little
+    gdb_arm_d4          =  79, //  4    468       8 _ieee_double_little
+    gdb_arm_d5          =  80, //  5    476       8 _ieee_double_little
+    gdb_arm_d6          =  81, //  6    484       8 _ieee_double_little
+    gdb_arm_d7          =  82, //  7    492       8 _ieee_double_little
+    gdb_arm_d8          =  83, //  8    500       8 _ieee_double_little
+    gdb_arm_d9          =  84, //  9    508       8 _ieee_double_little
+    gdb_arm_d10         =  85, // 10    516       8 _ieee_double_little
+    gdb_arm_d11         =  86, // 11    524       8 _ieee_double_little
+    gdb_arm_d12         =  87, // 12    532       8 _ieee_double_little
+    gdb_arm_d13         =  88, // 13    540       8 _ieee_double_little
+    gdb_arm_d14         =  89, // 14    548       8 _ieee_double_little
+    gdb_arm_d15         =  90, // 15    556       8 _ieee_double_little
+    gdb_arm_q0          =  91, // 16    564      16 _vec128
+    gdb_arm_q1          =  92, // 17    580      16 _vec128
+    gdb_arm_q2          =  93, // 18    596      16 _vec128
+    gdb_arm_q3          =  94, // 19    612      16 _vec128
+    gdb_arm_q4          =  95, // 20    628      16 _vec128
+    gdb_arm_q5          =  96, // 21    644      16 _vec128
+    gdb_arm_q6          =  97, // 22    660      16 _vec128
+    gdb_arm_q7          =  98, // 23    676      16 _vec128
+    gdb_arm_q8          =  99, // 24    692      16 _vec128
+    gdb_arm_q9          = 100, // 25    708      16 _vec128
+    gdb_arm_q10         = 101, // 26    724      16 _vec128
+    gdb_arm_q11         = 102, // 27    740      16 _vec128
+    gdb_arm_q12         = 103, // 28    756      16 _vec128
+    gdb_arm_q13         = 104, // 29    772      16 _vec128
+    gdb_arm_q14         = 105, // 30    788      16 _vec128
+    gdb_arm_q15         = 106  // 31    804      16 _vec128
+};
 #endif // utility_ARM_GCC_Registers_h_
 

Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/DNB.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/DNB.cpp?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/DNB.cpp (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/DNB.cpp Thu Jun  6 19:06:43 2013
@@ -12,6 +12,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "DNB.h"
+#include <inttypes.h>
 #include <signal.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -23,6 +24,7 @@
 #include <sys/sysctl.h>
 #include <map>
 #include <vector>
+#include <libproc.h>
 
 #include "MacOSX/MachProcess.h"
 #include "MacOSX/MachTask.h"
@@ -31,14 +33,16 @@
 #include "DNBDataRef.h"
 #include "DNBThreadResumeActions.h"
 #include "DNBTimer.h"
+#include "CFBundle.h"
 
-typedef STD_SHARED_PTR(MachProcess) MachProcessSP;
+
+typedef std::shared_ptr<MachProcess> MachProcessSP;
 typedef std::map<nub_process_t, MachProcessSP> ProcessMap;
 typedef ProcessMap::iterator ProcessMapIter;
 typedef ProcessMap::const_iterator ProcessMapConstIter;
 
-static size_t          GetAllInfos                  (std::vector<struct kinfo_proc>& proc_infos);
-static size_t          GetAllInfosMatchingName      (const char *process_name, std::vector<struct kinfo_proc>& matching_proc_infos);
+size_t GetAllInfos (std::vector<struct kinfo_proc>& proc_infos);
+static size_t GetAllInfosMatchingName (const char *process_name, std::vector<struct kinfo_proc>& matching_proc_infos);
 
 //----------------------------------------------------------------------
 // A Thread safe singleton to get a process map pointer.
@@ -185,7 +189,7 @@ DNBProcessLaunch (const char *path,
                   char *err_str,
                   size_t err_len)
 {
-    DNBLogThreadedIf(LOG_PROCESS, "%s ( path='%s', argv = %p, envp = %p, working_dir=%s, stdin=%s, stdout=%s, stderr=%s, no-stdio=%i, launch_flavor = %u, disable_aslr = %d, err = %p, err_len = %zu) called...", 
+    DNBLogThreadedIf(LOG_PROCESS, "%s ( path='%s', argv = %p, envp = %p, working_dir=%s, stdin=%s, stdout=%s, stderr=%s, no-stdio=%i, launch_flavor = %u, disable_aslr = %d, err = %p, err_len = %llu) called...",
                      __FUNCTION__, 
                      path, 
                      argv, 
@@ -198,7 +202,7 @@ DNBProcessLaunch (const char *path,
                      launch_flavor, 
                      disable_aslr, 
                      err_str, 
-                     err_len);
+                     (uint64_t)err_len);
     
     if (err_str && err_len > 0)
         err_str[0] = '\0';
@@ -252,6 +256,7 @@ DNBProcessLaunch (const char *path,
                 // We failed to get the task for our process ID which is bad.
                 // Kill our process otherwise it will be stopped at the entry
                 // point and get reparented to someone else and never go away.
+                DNBLog ("Could not get task port for process, sending SIGKILL and exiting.");
                 kill (SIGKILL, pid);
 
                 if (err_str && err_len > 0)
@@ -291,7 +296,7 @@ DNBProcessAttachByName (const char *name
     }
     else if (num_matching_proc_infos > 1)
     {
-        DNBLogError ("error: %zu processes match '%s':\n", num_matching_proc_infos, name);
+        DNBLogError ("error: %llu processes match '%s':\n", (uint64_t)num_matching_proc_infos, name);
         size_t i;
         for (i=0; i<num_matching_proc_infos; ++i)
             DNBLogError ("%6u - %s\n", matching_proc_infos[i].kp_proc.p_pid, matching_proc_infos[i].kp_proc.p_comm);
@@ -388,10 +393,10 @@ DNBProcessAttach (nub_process_t attach_p
     return INVALID_NUB_PROCESS;
 }
 
-static size_t
+size_t
 GetAllInfos (std::vector<struct kinfo_proc>& proc_infos)
 {
-    size_t size;
+    size_t size = 0;
     int name[] = { CTL_KERN, KERN_PROC, KERN_PROC_ALL };
     u_int namelen = sizeof(name)/sizeof(int);
     int err;
@@ -427,7 +432,6 @@ GetAllInfos (std::vector<struct kinfo_pr
     return proc_infos.size();
 }
 
-
 static size_t
 GetAllInfosMatchingName(const char *full_process_name, std::vector<struct kinfo_proc>& matching_proc_infos)
 {
@@ -458,24 +462,27 @@ GetAllInfosMatchingName(const char *full
 
                 // Check for process by name. We only check the first MAXCOMLEN
                 // chars as that is all that kp_proc.p_comm holds.
+                
                 if (::strncasecmp(process_name, proc_infos[i].kp_proc.p_comm, MAXCOMLEN) == 0)
                 {
                     if (process_name_len > MAXCOMLEN)
                     {
                         // We found a matching process name whose first MAXCOMLEN
                         // characters match, but there is more to the name than
-                        // this. We need to get the full process name. 
+                        // this. We need to get the full process name.  Use proc_pidpath, which will get
+                        // us the full path to the executed process.
 
-                        int proc_args_mib[3] = { CTL_KERN, KERN_PROCARGS2, proc_infos[i].kp_proc.p_pid };
+                        char proc_path_buf[PATH_MAX];
                         
-                        // Get PATH_MAX for argv[0] plus 4 bytes for the argc
-                        char arg_data[PATH_MAX+4];
-                        size_t arg_data_size = sizeof(arg_data);
-                         // Skip the 4 byte argc integer value to get to argv[0]
-                        const char *argv0 = arg_data + 4;
-                        if (::sysctl (proc_args_mib, 3, arg_data, &arg_data_size , NULL, 0) == 0)
+                        int return_val = proc_pidpath (proc_infos[i].kp_proc.p_pid, proc_path_buf, PATH_MAX);
+                        if (return_val > 0)
                         {
-                            const char *argv_basename = strrchr(argv0, '/');
+                            // Okay, now search backwards from that to see if there is a
+                            // slash in the name.  Note, even though we got all the args we don't care
+                            // because the list data is just a bunch of concatenated null terminated strings
+                            // so strrchr will start from the end of argv0.
+                            
+                            const char *argv_basename = strrchr(proc_path_buf, '/');
                             if (argv_basename)
                             {
                                 // Skip the '/'
@@ -484,7 +491,7 @@ GetAllInfosMatchingName(const char *full
                             else
                             {
                                 // We didn't find a directory delimiter in the process argv[0], just use what was in there
-                                argv_basename = argv0;
+                                argv_basename = proc_path_buf;
                             }
 
                             if (argv_basename)
@@ -893,15 +900,6 @@ DNBProcessResetEvents (nub_process_t pid
         procSP->Events().ResetEvents(event_mask);
 }
 
-void
-DNBProcessInterruptEvents (nub_process_t pid)
-{
-    MachProcessSP procSP;
-    if (GetProcessSP (pid, procSP))
-        procSP->Events().SetEvents(eEventProcessAsyncInterrupt);
-}
-
-
 // Breakpoints
 nub_break_t
 DNBBreakpointSet (nub_process_t pid, nub_addr_t addr, nub_size_t size, nub_bool_t hardware)
@@ -1212,6 +1210,28 @@ DNBProcessMemoryRegionInfo (nub_process_
     return -1;
 }
 
+std::string
+DNBProcessGetProfileData (nub_process_t pid, DNBProfileDataScanType scanType)
+{
+    MachProcessSP procSP;
+    if (GetProcessSP (pid, procSP))
+        return procSP->Task().GetProfileData(scanType);
+    
+    return std::string("");
+}
+
+nub_bool_t
+DNBProcessSetEnableAsyncProfiling (nub_process_t pid, nub_bool_t enable, uint64_t interval_usec, DNBProfileDataScanType scan_type)
+{
+    MachProcessSP procSP;
+    if (GetProcessSP (pid, procSP))
+    {
+        procSP->SetEnableAsyncProfiling(enable, interval_usec, scan_type);
+        return true;
+    }
+    
+    return false;    
+}
 
 //----------------------------------------------------------------------
 // Formatted output that uses memory and registers from process and
@@ -1357,7 +1377,7 @@ DNBPrintf (nub_process_t pid, nub_thread
                                         }
                                         else
                                         {
-                                            fprintf(file, "error: unable to read register '%s' for process %#.4x and thread %#.4x\n", register_name.c_str(), pid, tid);
+                                            fprintf(file, "error: unable to read register '%s' for process %#.4x and thread %#.8" PRIx64 "\n", register_name.c_str(), pid, tid);
                                             return total_bytes_read;
                                         }
                                     }
@@ -1744,6 +1764,18 @@ DNBProcessGetCurrentThread (nub_process_
 }
 
 //----------------------------------------------------------------------
+// Get the mach port number of the current thread.
+//----------------------------------------------------------------------
+nub_thread_t
+DNBProcessGetCurrentThreadMachPort (nub_process_t pid)
+{
+    MachProcessSP procSP;
+    if (GetProcessSP (pid, procSP))
+        return procSP->GetCurrentThreadMachPort();
+    return 0;
+}
+
+//----------------------------------------------------------------------
 // Change the current thread.
 //----------------------------------------------------------------------
 nub_thread_t
@@ -2067,6 +2099,15 @@ DNBProcessGetAvailableSTDERR (nub_proces
 }
 
 nub_size_t
+DNBProcessGetAvailableProfileData (nub_process_t pid, char *buf, nub_size_t buf_size)
+{
+    MachProcessSP procSP;
+    if (GetProcessSP (pid, procSP))
+        return procSP->GetAsyncProfileData (buf, buf_size);
+    return 0;
+}
+
+nub_size_t
 DNBProcessGetStopCount (nub_process_t pid)
 {
     MachProcessSP procSP;
@@ -2097,6 +2138,21 @@ DNBResolveExecutablePath (const char *pa
 
     if (result.empty())
         result = path;
+    
+    struct stat path_stat;
+    if (::stat(path, &path_stat) == 0)
+    {
+        if ((path_stat.st_mode & S_IFMT) == S_IFDIR)
+        {
+            CFBundle bundle (path);
+            CFReleaser<CFURLRef> url(bundle.CopyExecutableURL ());
+            if (url.get())
+            {
+                if (::CFURLGetFileSystemRepresentation (url.get(), true, (UInt8*)resolved_path, resolved_path_size))
+                    return true;
+            }
+        }
+    }
 
     if (realpath(path, max_path))
     {

Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/DNB.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/DNB.h?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/DNB.h (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/DNB.h Thu Jun  6 19:06:43 2013
@@ -16,10 +16,7 @@
 
 #include "DNBDefs.h"
 #include <mach/thread_info.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
+#include <string>
 
 #define DNB_EXPORT __attribute__((visibility("default")))
 
@@ -67,6 +64,8 @@ nub_size_t      DNBProcessMemoryWrite
 nub_addr_t      DNBProcessMemoryAllocate    (nub_process_t pid, nub_size_t size, uint32_t permissions) DNB_EXPORT;
 nub_bool_t      DNBProcessMemoryDeallocate  (nub_process_t pid, nub_addr_t addr) DNB_EXPORT;
 int             DNBProcessMemoryRegionInfo  (nub_process_t pid, nub_addr_t addr, DNBRegionInfo *region_info) DNB_EXPORT;
+std::string     DNBProcessGetProfileData (nub_process_t pid, DNBProfileDataScanType scanType) DNB_EXPORT;
+nub_bool_t      DNBProcessSetEnableAsyncProfiling   (nub_process_t pid, nub_bool_t enable, uint64_t interval_usec, DNBProfileDataScanType scan_type) DNB_EXPORT;
 
 //----------------------------------------------------------------------
 // Process status
@@ -77,6 +76,7 @@ nub_bool_t      DNBProcessGetExitStatus
 nub_bool_t      DNBProcessSetExitStatus                 (nub_process_t pid, int status) DNB_EXPORT;
 nub_size_t      DNBProcessGetNumThreads                 (nub_process_t pid) DNB_EXPORT;
 nub_thread_t    DNBProcessGetCurrentThread              (nub_process_t pid) DNB_EXPORT;
+nub_thread_t    DNBProcessGetCurrentThreadMachPort      (nub_process_t pid) DNB_EXPORT;
 nub_thread_t    DNBProcessSetCurrentThread              (nub_process_t pid, nub_thread_t tid) DNB_EXPORT;
 nub_thread_t    DNBProcessGetThreadAtIndex              (nub_process_t pid, nub_size_t thread_idx) DNB_EXPORT;
 nub_bool_t      DNBProcessSyncThreadState               (nub_process_t pid, nub_thread_t tid) DNB_EXPORT;
@@ -88,6 +88,7 @@ nub_bool_t      DNBProcessSetSharedLibra
 nub_addr_t      DNBProcessLookupAddress                 (nub_process_t pid, const char *name, const char *shlib) DNB_EXPORT;
 nub_size_t      DNBProcessGetAvailableSTDOUT            (nub_process_t pid, char *buf, nub_size_t buf_size) DNB_EXPORT;
 nub_size_t      DNBProcessGetAvailableSTDERR            (nub_process_t pid, char *buf, nub_size_t buf_size) DNB_EXPORT;
+nub_size_t      DNBProcessGetAvailableProfileData       (nub_process_t pid, char *buf, nub_size_t buf_size) DNB_EXPORT;
 nub_size_t      DNBProcessGetStopCount                  (nub_process_t pid) DNB_EXPORT;
 uint32_t        DNBProcessGetCPUType                    (nub_process_t pid) DNB_EXPORT; 
 
@@ -103,7 +104,6 @@ nub_size_t      DNBProcessGetArgumentCou
 //----------------------------------------------------------------------
 nub_event_t     DNBProcessWaitForEvents         (nub_process_t pid, nub_event_t event_mask, bool wait_for_set, struct timespec* timeout) DNB_EXPORT;
 void            DNBProcessResetEvents           (nub_process_t pid, nub_event_t event_mask) DNB_EXPORT;
-void            DNBProcessInterruptEvents       (nub_process_t pid) DNB_EXPORT;
 
 //----------------------------------------------------------------------
 // Thread functions
@@ -157,8 +157,4 @@ nub_size_t      DNBPrintf (nub_process_t
 const char *    DNBStateAsString (nub_state_t state) DNB_EXPORT;
 nub_bool_t      DNBResolveExecutablePath (const char *path, char *resolved_path, size_t resolved_path_size) DNB_EXPORT;
 
-#ifdef __cplusplus
-}
-#endif
-
 #endif

Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/DNBBreakpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/DNBBreakpoint.cpp?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/DNBBreakpoint.cpp (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/DNBBreakpoint.cpp Thu Jun  6 19:06:43 2013
@@ -13,6 +13,7 @@
 
 #include "DNBBreakpoint.h"
 #include <algorithm>
+#include <inttypes.h>
 #include "DNBLog.h"
 
 
@@ -77,7 +78,7 @@ DNBBreakpoint::Dump() const
 {
     if (IsBreakpoint())
     {
-        DNBLog ("DNBBreakpoint %u: tid = %4.4x  addr = 0x%llx  state = %s  type = %s breakpoint  hw_index = %i  hit_count = %-4u  ignore_count = %-4u  callback = %p baton = %p",
+        DNBLog ("DNBBreakpoint %u: tid = %8.8" PRIx64 "  addr = 0x%llx  state = %s  type = %s breakpoint  hw_index = %i  hit_count = %-4u  ignore_count = %-4u  callback = %p baton = %p",
                 m_breakID,
                 m_tid,
                 (uint64_t)m_addr,
@@ -91,11 +92,11 @@ DNBBreakpoint::Dump() const
     }
     else
     {
-        DNBLog ("DNBBreakpoint %u: tid = %4.4x  addr = 0x%llx  size = %zu  state = %s  type = %s watchpoint (%s%s)  hw_index = %i  hit_count = %-4u  ignore_count = %-4u  callback = %p baton = %p",
+        DNBLog ("DNBBreakpoint %u: tid = %8.8" PRIx64 "  addr = 0x%llx  size = %llu  state = %s  type = %s watchpoint (%s%s)  hw_index = %i  hit_count = %-4u  ignore_count = %-4u  callback = %p baton = %p",
                 m_breakID,
                 m_tid,
                 (uint64_t)m_addr,
-                m_byte_size,
+                (uint64_t)m_byte_size,
                 m_enabled ? "enabled " : "disabled",
                 IsHardware() ? "hardware" : "software",
                 m_watch_read ? "r" : "",
@@ -287,6 +288,15 @@ DNBBreakpointList::GetByIndex (uint32_t
     return NULL;
 }
 
+void
+DNBBreakpointList::DisableAll ()
+{
+    iterator pos, end = m_breakpoints.end();
+    for (pos = m_breakpoints.begin(); pos != end; ++pos)
+        (*pos).SetEnabled(false);
+}
+
+
 const DNBBreakpoint *
 DNBBreakpointList::GetByIndex (uint32_t i) const
 {

Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/DNBBreakpoint.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/DNBBreakpoint.h?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/DNBBreakpoint.h (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/DNBBreakpoint.h Thu Jun  6 19:06:43 2013
@@ -145,6 +145,7 @@ public:
             size_t              Size() const { return m_breakpoints.size(); }
             DNBBreakpoint *     GetByIndex (uint32_t i);
     const   DNBBreakpoint *     GetByIndex (uint32_t i) const;
+            void                DisableAll ();
 
 protected:
     typedef std::list<DNBBreakpoint>    collection;

Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/DNBDataRef.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/DNBDataRef.cpp?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/DNBDataRef.cpp (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/DNBDataRef.cpp Thu Jun  6 19:06:43 2013
@@ -195,105 +195,6 @@ DNBDataRef::GetPointer(offset_t *offset_
     assert(m_ptrSize != 0);
     return GetMax64(offset_ptr, m_ptrSize);
 }
-
-//----------------------------------------------------------------------
-// GetDwarfEHPtr
-//
-// Used for calls when the value type is specified by a DWARF EH Frame
-// pointer encoding.
-//----------------------------------------------------------------------
-/*
-uint64_t
-DNBDataRef::GetDwarfEHPtr(offset_t *offset_ptr, uint32_t encoding) const
-{
-    if (encoding == DW_EH_PE_omit)
-        return ULLONG_MAX;    // Value isn't in the buffer...
-
-    uint64_t baseAddress = 0;
-    uint64_t addressValue = 0;
-
-    BOOL signExtendValue = NO;
-    // Decode the base part or adjust our offset
-    switch (encoding & 0x70)
-    {
-        case DW_EH_PE_pcrel:
-            // SetEHPtrBaseAddresses should be called prior to extracting these
-            // so the base addresses are cached.
-            assert(m_addrPCRelative != INVALID_NUB_ADDRESS);
-            signExtendValue = YES;
-            baseAddress = *offset_ptr + m_addrPCRelative;
-            break;
-
-        case DW_EH_PE_textrel:
-            // SetEHPtrBaseAddresses should be called prior to extracting these
-            // so the base addresses are cached.
-            assert(m_addrTEXT != INVALID_NUB_ADDRESS);
-            signExtendValue = YES;
-            baseAddress = m_addrTEXT;
-            break;
-
-        case DW_EH_PE_datarel:
-            // SetEHPtrBaseAddresses should be called prior to extracting these
-            // so the base addresses are cached.
-            assert(m_addrDATA != INVALID_NUB_ADDRESS);
-            signExtendValue = YES;
-            baseAddress = m_addrDATA;
-            break;
-
-        case DW_EH_PE_funcrel:
-            signExtendValue = YES;
-            break;
-
-        case DW_EH_PE_aligned:
-            // SetPointerSize should be called prior to extracting these so the
-            // pointer size is cached
-            assert(m_ptrSize != 0);
-            if (m_ptrSize)
-            {
-                // Align to a address size boundary first
-                uint32_t alignOffset = *offset_ptr % m_ptrSize;
-                if (alignOffset)
-                    offset_ptr += m_ptrSize - alignOffset;
-            }
-                break;
-
-        default:
-            break;
-    }
-
-    // Decode the value part
-    switch (encoding & DW_EH_PE_MASK_ENCODING)
-    {
-        case DW_EH_PE_absptr    : addressValue = GetPointer(offset_ptr);         break;
-        case DW_EH_PE_uleb128   : addressValue = Get_ULEB128(offset_ptr);         break;
-        case DW_EH_PE_udata2    : addressValue = Get16(offset_ptr);                 break;
-        case DW_EH_PE_udata4    : addressValue = Get32(offset_ptr);                 break;
-        case DW_EH_PE_udata8    : addressValue = Get64(offset_ptr);                 break;
-        case DW_EH_PE_sleb128   : addressValue = Get_SLEB128(offset_ptr);         break;
-        case DW_EH_PE_sdata2    : addressValue = (int16_t)Get16(offset_ptr);     break;
-        case DW_EH_PE_sdata4    : addressValue = (int32_t)Get32(offset_ptr);     break;
-        case DW_EH_PE_sdata8    : addressValue = (int64_t)Get64(offset_ptr);     break;
-        default:
-            // Unhandled encoding type
-            assert(encoding);
-            break;
-    }
-
-    // Since we promote everything to 64 bit, we may need to sign extend
-    if (signExtendValue && m_ptrSize < sizeof(baseAddress))
-    {
-        uint64_t sign_bit = 1ull << ((m_ptrSize * 8ull) - 1ull);
-        if (sign_bit & addressValue)
-        {
-            uint64_t mask = ~sign_bit + 1;
-            addressValue |= mask;
-        }
-    }
-    return baseAddress + addressValue;
-}
-*/
-
-
 //----------------------------------------------------------------------
 // GetCStr
 //----------------------------------------------------------------------

Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/DNBDataRef.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/DNBDataRef.h?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/DNBDataRef.h (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/DNBDataRef.h Thu Jun  6 19:06:43 2013
@@ -56,8 +56,22 @@ public:
                         m_swap = false;
                     }
 
-    bool            ValidOffset(offset_t offset) const { return (m_start < m_end) && ((uint32_t)(m_end - m_start) > offset); }
-    bool            ValidOffsetForDataOfSize(offset_t offset, uint32_t num_bytes) const { return (m_start < m_end) && ((uint32_t)(m_end - m_start) > (offset + ((num_bytes > 0) ? (num_bytes - 1) : 0))); }
+    offset_t        BytesLeft (offset_t offset) const
+                    {
+                        const offset_t size = GetSize();
+                        if (size > offset)
+                            return size - offset;
+                        return 0;
+                    }
+
+    bool            ValidOffset(offset_t offset) const
+                    {
+                        return BytesLeft(offset) > 0;
+                    }
+    bool            ValidOffsetForDataOfSize(offset_t offset, uint32_t num_bytes) const
+                    {
+                        return num_bytes <= BytesLeft (offset);
+                    }
     size_t          GetSize() const { return m_end - m_start; }
     const uint8_t * GetDataStart() const { return m_start; }
     const uint8_t * GetDataEnd() const { return m_end; }

Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/DNBDefs.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/DNBDefs.h?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/DNBDefs.h (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/DNBDefs.h Thu Jun  6 19:06:43 2013
@@ -20,20 +20,6 @@
 #include <sys/syslimits.h>
 #include <unistd.h>
 
-#include <ciso646>  // detect C++ lib
-
-#ifdef _LIBCPP_VERSION
-#include <memory>
-#define STD_SHARED_PTR(T) std::shared_ptr<T>
-#define STD_WEAK_PTR(T) std::weak_ptr<T>
-#define STD_ENABLE_SHARED_FROM_THIS(T) std::enable_shared_from_this<T>
-#else
-#include <tr1/memory>
-#define STD_SHARED_PTR(T) std::tr1::shared_ptr<T>
-#define STD_WEAK_PTR(T) std::tr1::weak_ptr<T>
-#define STD_ENABLE_SHARED_FROM_THIS(T) std::tr1::enable_shared_from_this<T>
-#endif
-
 //----------------------------------------------------------------------
 // Define nub_addr_t and the invalid address value from the architecture
 //----------------------------------------------------------------------
@@ -73,7 +59,7 @@ typedef uint32_t        nub_break_t;
 typedef uint32_t        nub_watch_t;
 typedef uint32_t        nub_index_t;
 typedef pid_t           nub_process_t;
-typedef unsigned int    nub_thread_t;
+typedef uint64_t        nub_thread_t;
 typedef uint32_t        nub_event_t;
 typedef uint32_t        nub_bool_t;
 
@@ -134,12 +120,12 @@ enum
     eEventProcessStoppedStateChanged = 1 << 1,  // The process has changed state to stopped
     eEventSharedLibsStateChange = 1 << 2,       // Shared libraries loaded/unloaded state has changed
     eEventStdioAvailable = 1 << 3,              // Something is available on stdout/stderr
-    eEventProcessAsyncInterrupt = 1 << 4,               // Gives the ability for any infinite wait calls to be interrupted
+    eEventProfileDataAvailable = 1 << 4,        // Profile data ready for retrieval
     kAllEventsMask = eEventProcessRunningStateChanged |
                      eEventProcessStoppedStateChanged |
                      eEventSharedLibsStateChange |
                      eEventStdioAvailable |
-                     eEventProcessAsyncInterrupt
+                     eEventProfileDataAvailable
 };
 
 #define LOG_VERBOSE             (1u << 0)
@@ -228,6 +214,8 @@ struct DNBRegisterInfo
     uint32_t    reg_dwarf;      // DWARF register number (INVALID_NUB_REGNUM when none)
     uint32_t    reg_generic;    // Generic register number (INVALID_NUB_REGNUM when none)
     uint32_t    reg_gdb;        // The GDB register number (INVALID_NUB_REGNUM when none)
+    uint32_t    *pseudo_regs;   // If this register is a part of another register, list the one or more registers
+    uint32_t    *update_regs;   // If modifying this register will invalidate other registers, list them here
 };
 
 struct DNBRegisterSetInfo
@@ -249,7 +237,8 @@ enum DNBThreadStopType
 {
     eStopTypeInvalid = 0,
     eStopTypeSignal,
-    eStopTypeException
+    eStopTypeException,
+    eStopTypeExec
 };
 
 enum DNBMemoryPermissions
@@ -354,6 +343,24 @@ struct DNBRegionInfo
     uint32_t permissions;
 };
 
+enum DNBProfileDataScanType
+{
+    eProfileHostCPU             = (1 << 0),
+    eProfileCPU                 = (1 << 1),
+    
+    eProfileThreadsCPU          = (1 << 2), // By default excludes eProfileThreadName and eProfileQueueName.
+    eProfileThreadName          = (1 << 3), // Assume eProfileThreadsCPU, get thread name as well.
+    eProfileQueueName           = (1 << 4), // Assume eProfileThreadsCPU, get queue name as well.
+    
+    eProfileHostMemory          = (1 << 5),
+    
+    eProfileMemory              = (1 << 6), // By default, excludes eProfileMemoryDirtyPage.
+    eProfileMemoryDirtyPage     = (1 << 7), // Assume eProfileMemory, get Dirty Page size as well.
+    eProfileMemoryAnonymous     = (1 << 8), // Assume eProfileMemory, get Anonymous memory as well.
+    
+    eProfileAll                 = 0xffffffff
+};
+
 typedef nub_bool_t (*DNBCallbackBreakpointHit)(nub_process_t pid, nub_thread_t tid, nub_break_t breakID, void *baton);
 typedef nub_addr_t (*DNBCallbackNameToAddress)(nub_process_t pid, const char *name, const char *shlib_regex, void *baton);
 typedef nub_size_t (*DNBCallbackCopyExecutableImageInfos)(nub_process_t pid, struct DNBExecutableImageInfo **image_infos, nub_bool_t only_changed, void *baton);

Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/DNBLog.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/DNBLog.cpp?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/DNBLog.cpp (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/DNBLog.cpp Thu Jun  6 19:06:43 2013
@@ -84,6 +84,12 @@ DNBLogSetLogCallback (DNBCallbackLog cal
     g_log_baton = baton;
 }
 
+DNBCallbackLog
+DNBLogGetLogCallback ()
+{
+    return g_log_callback;
+}
+
 bool
 DNBLogEnabled ()
 {
@@ -185,13 +191,21 @@ _DNBLogThreaded (const char *format, ...
                 timersub (&tv, &g_timeval, &delta);
             }
             g_timeval = tv;
+            
+            // Calling "mach_port_deallocate()" bumps the reference count on the thread
+            // port, so we need to deallocate it. mach_task_self() doesn't bump the ref
+            // count.
+            thread_port_t thread_self = mach_thread_self();
+
             _DNBLog (DNBLOG_FLAG_THREADED, "%u +%lu.%06u sec [%4.4x/%4.4x]: %s", 
                      ++g_message_id, 
                      delta.tv_sec, 
                      delta.tv_usec,             
                      getpid(), 
-                     mach_thread_self(), 
+                     thread_self, 
                      arg_msg);
+
+            mach_port_deallocate(mach_task_self(), thread_self);
             free (arg_msg);
         }
     }
@@ -230,13 +244,22 @@ _DNBLogThreadedIf (uint32_t log_bit, con
                 timersub (&tv, &g_timeval, &delta);
             }
             g_timeval = tv;
-            _DNBLog (DNBLOG_FLAG_THREADED, "%u +%lu.%06u sec [%4.4x/%4.4x]: %s", 
+
+            // Calling "mach_port_deallocate()" bumps the reference count on the thread
+            // port, so we need to deallocate it. mach_task_self() doesn't bump the ref
+            // count.
+            thread_port_t thread_self = mach_thread_self();
+
+            _DNBLog (DNBLOG_FLAG_THREADED, "%u +%lu.%06u sec [%4.4x/%4.4x]: %s",
                      ++g_message_id, 
                      delta.tv_sec, 
                      delta.tv_usec, 
                      getpid(), 
-                     mach_thread_self(), 
+                     thread_self, 
                      arg_msg);
+
+            mach_port_deallocate(mach_task_self(), thread_self);
+
             free (arg_msg);
         }
     }

Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/DNBLog.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/DNBLog.h?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/DNBLog.h (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/DNBLog.h Thu Jun  6 19:06:43 2013
@@ -50,6 +50,7 @@ bool        DNBLogCheckLogBit (uint32_t
 uint32_t    DNBLogSetLogMask (uint32_t mask) DNB_EXPORT;
 uint32_t    DNBLogGetLogMask () DNB_EXPORT;
 void        DNBLogSetLogCallback (DNBCallbackLog callback, void *baton) DNB_EXPORT;
+DNBCallbackLog DNBLogGetLogCallback () DNB_EXPORT;
 bool        DNBLogEnabled () DNB_EXPORT;
 bool        DNBLogEnabledForAny (uint32_t mask) DNB_EXPORT;
 int         DNBLogGetDebug () DNB_EXPORT;

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

Removed: lldb/branches/lldb-platform-work/tools/debugserver/source/FunctionProfiler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/FunctionProfiler.cpp?rev=183467&view=auto
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/FunctionProfiler.cpp (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/FunctionProfiler.cpp (removed)
@@ -1,288 +0,0 @@
-//===-- FunctionProfiler.cpp ------------------------------------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-//  Created by Greg Clayton on 10/8/08.
-//
-//===----------------------------------------------------------------------===//
-
-#include "FunctionProfiler.h"
-
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-#include "DNB.h"
-
-// Project includes
-
-//----------------------------------------------------------------------
-// FunctionProfiler constructor
-//----------------------------------------------------------------------
-FunctionProfiler::FunctionProfiler(nub_addr_t start_addr, nub_addr_t stop_addr) :
-    m_pid(INVALID_NUB_PROCESS),
-    m_start_addr(start_addr),
-    m_stop_addr(stop_addr),
-    m_start_break_id(INVALID_NUB_BREAK_ID),
-    m_stop_break_id(INVALID_NUB_BREAK_ID),
-    m_func_entered_count(0),
-    m_last_pc(0),
-    m_last_flags(0),
-    m_consecutive_opcode_count(0),
-    m_total_opcode_count(0)
-{
-}
-
-
-FunctionProfiler::~FunctionProfiler()
-{
-    Clear();
-}
-
-
-void
-FunctionProfiler::Clear()
-{
-    if (m_pid != INVALID_NUB_PROCESS)
-    {
-        if (m_start_break_id != INVALID_NUB_BREAK_ID)
-            DNBBreakpointClear(m_pid, m_start_break_id);
-        if (m_stop_break_id != INVALID_NUB_BREAK_ID)
-            DNBBreakpointClear(m_pid, m_stop_break_id);
-    }
-    m_start_break_id = INVALID_NUB_BREAK_ID;
-    m_stop_break_id = INVALID_NUB_BREAK_ID;
-    m_func_entered_count = 0;
-    m_last_pc = 0;
-    m_last_flags = 0;
-    m_consecutive_opcode_count = 0;
-}
-
-void
-FunctionProfiler::Initialize(nub_process_t pid)
-{
-    //printf("FunctionProfiler::%s(0x%4.4x)\n", __FUNCTION__, pid);
-    Clear();
-    m_pid = pid;
-}
-
-#include "DNBDataRef.h"
-
-void
-FunctionProfiler::SetBreakpoints()
-{
-#if defined (__i386__)
-    nub_size_t bp_opcode_size = 1;
-#elif defined (__powerpc__) || defined (__ppc__)
-    nub_size_t bp_opcode_size = 4;
-#endif
-    if (m_start_addr != INVALID_NUB_ADDRESS && !NUB_BREAK_ID_IS_VALID(m_start_break_id))
-    {
-#if defined (__arm__)
-        m_start_break_id = DNBBreakpointSet(m_pid, m_start_addr & 0xFFFFFFFEu, m_start_addr & 1 ? 2 : 4, false);
-#else
-        m_start_break_id = DNBBreakpointSet(m_pid, m_start_addr, bp_opcode_size, false);
-#endif
-        if (NUB_BREAK_ID_IS_VALID(m_start_break_id))
-            DNBBreakpointSetCallback(m_pid, m_start_break_id, FunctionProfiler::BreakpointHitCallback, this);
-    }
-    if (m_stop_addr != INVALID_NUB_ADDRESS && !NUB_BREAK_ID_IS_VALID(m_stop_break_id))
-    {
-#if defined (__arm__)
-        m_stop_break_id = DNBBreakpointSet(m_pid, m_stop_addr & 0xFFFFFFFEu, m_stop_addr & 1 ? 2 : 4, false);
-#else
-        m_stop_break_id = DNBBreakpointSet(m_pid, m_stop_addr, bp_opcode_size, false);
-#endif
-        if (NUB_BREAK_ID_IS_VALID(m_stop_break_id))
-            DNBBreakpointSetCallback(m_pid, m_stop_break_id, FunctionProfiler::BreakpointHitCallback, this);
-    }
-}
-
-nub_bool_t
-FunctionProfiler::BreakpointHitCallback(nub_process_t pid, nub_thread_t tid, nub_break_t breakID, void *baton)
-{
-    printf("FunctionProfiler::%s(pid = %4.4x, tid = %4.4x, breakID = %u, baton = %p)\n", __FUNCTION__, pid, tid, breakID, baton);
-    return ((FunctionProfiler*) baton)->BreakpointHit(pid, tid, breakID);
-}
-
-nub_bool_t
-FunctionProfiler::BreakpointHit(nub_process_t pid, nub_thread_t tid, nub_break_t breakID)
-{
-    printf("FunctionProfiler::%s(pid = %4.4x, tid = %4.4x, breakID = %u)\n", __FUNCTION__, pid, tid, breakID);
-    if (breakID == m_start_break_id)
-    {
-        m_func_entered_count++;
-        printf("FunctionProfiler::%s(pid = %4.4x, tid = %4.4x, breakID = %u) START breakpoint hit (%u)\n", __FUNCTION__, pid, tid, breakID, m_func_entered_count);
-    }
-    else if (breakID == m_stop_break_id)
-    {
-        if (m_func_entered_count > 0)
-            m_func_entered_count--;
-        printf("FunctionProfiler::%s(pid = %4.4x, tid = %4.4x, breakID = %u) STOP breakpoint hit (%u)\n", __FUNCTION__, pid, tid, breakID, m_func_entered_count);
-    }
-    return true;
-}
-
-void
-FunctionProfiler::ProcessStateChanged(nub_state_t state)
-{
-//    printf("FunctionProfiler::%s(%s)\n", __FUNCTION__, DNBStateAsString(state));
-
-    switch (state)
-    {
-    case eStateInvalid:
-    case eStateUnloaded:
-    case eStateAttaching:
-    case eStateLaunching:
-        break;
-
-    case eStateDetached:
-    case eStateExited:
-        // No sense is clearing out breakpoints if our process has exited...
-        m_start_break_id = INVALID_NUB_BREAK_ID;
-        m_stop_break_id = INVALID_NUB_BREAK_ID;
-        printf("[0x%8.8x - 0x%8.8x) executed %u total opcodes.\n", m_total_opcode_count);
-        break;
-
-    case eStateStopped:
-        // Keep trying find dyld each time we stop until we do
-        if (!NUB_BREAK_ID_IS_VALID(m_start_break_id))
-            SetBreakpoints();
-
-        if (ShouldStepProcess())
-        {
-
-            // TODO: do logging/tracing here
-            nub_thread_t tid = DNBProcessGetCurrentThread(m_pid);
-            DNBRegisterValue reg;
-            m_total_opcode_count++;
-
-            if (DNBThreadGetRegisterValueByID(m_pid, tid, REGISTER_SET_GENERIC, GENERIC_REGNUM_PC, &reg))
-            {
-                const nub_addr_t pc = reg.value.uint32;
-
-#if defined (__i386__)
-                uint8_t buf[16];
-                uint32_t bytes_read = DNBProcessMemoryRead(m_pid, pc, 1, buf);
-                if (bytes_read == 1)
-                    printf("0x%8.8x: %2.2x\n", pc, buf[0]);
-                else
-                    printf("0x%8.8x: error: can't read opcode byte.\n", pc);
-
-//              if (bytes_read > 0)
-//              {
-//                  for (uint32_t i=0; i<bytes_read; ++i)
-//                  {
-//                      printf(" %2.2x", buf[i]);
-//                  }
-//              }
-//              printf("\n");
-
-#elif defined (__powerpc__) || defined (__ppc__)
-
-                uint32_t opcode = 0;
-                if (DNBProcessMemoryRead(m_pid, pc, 4, &opcode) == 4)
-                {
-                    printf("0x%8.8x: 0x%8.8x\n", pc, opcode);
-                }
-
-#elif defined (__arm__)
-                #define CPSR_T (1u << 5)
-                // Read the CPSR into flags
-                if (DNBThreadGetRegisterValueByID(m_pid, tid, REGISTER_SET_GENERIC, GENERIC_REGNUM_FLAGS, &reg))
-                {
-                    const uint32_t flags = reg.value.uint32;
-
-                    const bool curr_pc_is_thumb = (flags & CPSR_T) != 0; // check the CPSR T bit
-                    const bool last_pc_was_thumb = (m_last_flags & CPSR_T) != 0; // check the CPSR T bit
-                    bool opcode_is_sequential = false;
-
-                    uint32_t opcode;
-                    // Always read four bytes for the opcode
-                    if (DNBProcessMemoryRead(m_pid, pc, 4, &opcode) == 4)
-                    {
-                        if (curr_pc_is_thumb)
-                        {
-                            // Trim off the high 16 bits if this is a 16 bit thumb instruction
-                            if ((opcode & 0xe000) != 0xe000 || (opcode & 0x1800) == 0)
-                            {
-                                opcode &= 0xFFFFu;
-                                printf("0x%8.8x: %4.4x     Thumb\n", pc, opcode);
-                            }
-                            else
-                                printf("0x%8.8x: %8.8x Thumb\n", pc, opcode);
-                        }
-                        else
-                            printf("0x%8.8x: %8.8x ARM\n", pc, opcode);
-                    }
-
-                    if (m_last_flags != 0 && curr_pc_is_thumb == last_pc_was_thumb)
-                    {
-                        if (curr_pc_is_thumb)
-                        {
-                            if (pc == m_last_pc + 2)
-                            {
-                                opcode_is_sequential = true;
-                            }
-                            else if (pc == m_last_pc + 4)
-                            {
-                                // Check for 32 bit thumb instruction...
-                                uint16_t opcode16;
-                                if (DNBProcessMemoryRead(m_pid, m_last_pc, 2, &opcode16) == 2)
-                                {
-                                    if ((opcode16 & 0xe000) == 0xe000 && (opcode16 & 0x1800) != 0)
-                                    {
-                                        // Last opcode was a 32 bit thumb instruction...
-                                        opcode_is_sequential = true;
-                                    }
-                                }
-                            }
-                        }
-                        else
-                        {
-                            if (pc == m_last_pc + 4)
-                            {
-                                opcode_is_sequential = true;
-                            }
-                        }
-                    }
-
-
-                    if (opcode_is_sequential)
-                    {
-                        m_consecutive_opcode_count++;
-                    }
-                    else
-                    {
-                        if (m_consecutive_opcode_count > 0)
-                        {
-                        //  printf(" x %u\n", m_consecutive_opcode_count);
-                        }
-                        m_consecutive_opcode_count = 1;
-                        //printf("0x%8.8x: %-5s", pc, curr_pc_is_thumb ? "Thumb" : "ARM");
-                        //fflush(stdout);
-                    }
-                    m_last_flags = flags;
-                }
-#else
-#error undefined architecture
-#endif
-                m_last_pc = pc;
-            }
-        }
-        break;
-
-    case eStateRunning:
-    case eStateStepping:
-    case eStateCrashed:
-    case eStateSuspended:
-        break;
-
-    default:
-        break;
-    }
-}

Removed: lldb/branches/lldb-platform-work/tools/debugserver/source/FunctionProfiler.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/FunctionProfiler.h?rev=183467&view=auto
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/FunctionProfiler.h (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/FunctionProfiler.h (removed)
@@ -1,70 +0,0 @@
-//===-- FunctionProfiler.h --------------------------------------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-//  Created by Greg Clayton on 10/8/08.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef __FunctionProfiler_h__
-#define __FunctionProfiler_h__
-
-// C Includes
-
-// C++ Includes
-#include <map>
-#include <vector>
-#include <string>
-
-// Other libraries and framework includes
-
-// Project includes
-#include "DNBDefs.h"
-#include "DNBRuntimeAction.h"
-#include "PThreadMutex.h"
-
-class DNBBreakpoint;
-class MachProcess;
-
-class FunctionProfiler : public DNBRuntimeAction
-{
-public:
-    FunctionProfiler (nub_addr_t start_addr, nub_addr_t stop_addr);
-    virtual ~FunctionProfiler ();
-
-    //------------------------------------------------------------------
-    // DNBRuntimeAction required functions
-    //------------------------------------------------------------------
-    virtual void        Initialize(nub_process_t pid);
-    virtual void        ProcessStateChanged(nub_state_t state);
-    virtual void        SharedLibraryStateChanged(DNBExecutableImageInfo *image_infos, nub_size_t num_image_infos) {}
-
-    nub_bool_t          BreakpointHit(nub_process_t pid, nub_thread_t tid, nub_break_t breakID);
-    bool                ShouldStepProcess() const
-                        {
-                            return m_func_entered_count > 0;
-                        }
-protected:
-    static  nub_bool_t  BreakpointHitCallback (nub_process_t pid, nub_thread_t tid, nub_break_t breakID, void *baton);
-    void                Clear();
-    void                SetBreakpoints();
-
-    nub_process_t       m_pid;
-    nub_addr_t          m_start_addr;
-    nub_addr_t          m_stop_addr;
-    nub_break_t         m_start_break_id;
-    nub_break_t         m_stop_break_id;
-    uint32_t            m_func_entered_count;
-    nub_addr_t          m_last_pc;
-    uint32_t            m_last_flags;
-    uint32_t            m_consecutive_opcode_count;
-    uint32_t            m_total_opcode_count;
-};
-
-
-#endif  // __FunctionProfiler_h__

Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/CFBundle.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/CFBundle.cpp?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/CFBundle.cpp (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/CFBundle.cpp Thu Jun  6 19:06:43 2013
@@ -85,3 +85,13 @@ CFBundle::GetIdentifier () const
         return ::CFBundleGetIdentifier (bundle);
     return NULL;
 }
+
+
+CFURLRef
+CFBundle::CopyExecutableURL () const
+{
+    CFBundleRef bundle = get();
+    if (bundle != NULL)
+        return CFBundleCopyExecutableURL(bundle);
+    return NULL;
+}

Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/CFBundle.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/CFBundle.h?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/CFBundle.h (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/CFBundle.h Thu Jun  6 19:06:43 2013
@@ -25,11 +25,17 @@ public:
     CFBundle(const char *path = NULL);
     CFBundle(const CFBundle& rhs);
     CFBundle& operator=(const CFBundle& rhs);
-    virtual ~CFBundle();
+    virtual
+    ~CFBundle();
+    bool
+    SetPath (const char *path);
 
-        bool SetPath (const char *path);
-        CFStringRef GetIdentifier () const;
+    CFStringRef
+    GetIdentifier () const;
 
+    CFURLRef
+    CopyExecutableURL () const;
+    
 protected:
         CFReleaser<CFURLRef> m_bundle_url;
 };

Removed: lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachDYLD.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachDYLD.cpp?rev=183467&view=auto
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachDYLD.cpp (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachDYLD.cpp (removed)
@@ -1,679 +0,0 @@
-//===-- MachDYLD.cpp --------------------------------------------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-//  Created by Greg Clayton on 6/29/07.
-//
-//===----------------------------------------------------------------------===//
-
-#include "MachDYLD.h"
-#include "DNB.h"
-#include "DNBDataRef.h"
-#include <mach-o/loader.h>
-#include "DNBLog.h"
-
-MachDYLD::MachDYLD() :
-    m_pid(INVALID_NUB_PROCESS),
-    m_addr_size(4),
-    m_dyld_addr(INVALID_NUB_ADDRESS),
-    m_dyld_all_image_infos_addr(INVALID_NUB_ADDRESS),
-    m_dylib_info_header(),
-    m_current_dylibs(),
-    m_changed_dylibs(),
-    m_notify_break_id(INVALID_NUB_BREAK_ID),
-    m_dyld_info_mutex(PTHREAD_MUTEX_RECURSIVE)
-{
-}
-
-MachDYLD::~MachDYLD()
-{
-    Clear();
-}
-
-
-void
-MachDYLD::Clear()
-{
-    PThreadMutex::Locker locker(m_dyld_info_mutex);
-
-    nub_process_t pid = m_pid;
-    if (pid != INVALID_NUB_PROCESS)
-    {
-        DNBProcessSetSharedLibraryInfoCallback ( pid, NULL, NULL);
-        DNBBreakpointClear(pid, m_notify_break_id);
-    }
-
-    m_addr_size = 4;
-    m_dyld_addr = INVALID_NUB_ADDRESS;
-    m_dyld_all_image_infos_addr = INVALID_NUB_ADDRESS;
-    m_dylib_info_header.Clear();
-    m_current_dylibs.clear();
-    m_changed_dylibs.clear();
-    m_notify_break_id = INVALID_NUB_BREAK_ID;
-}
-
-
-void
-MachDYLD::Initialize(nub_process_t pid)
-{
-    //printf("MachDYLD::%s(0x%4.4x)\n", __FUNCTION__, pid);
-    Clear();
-    m_pid = pid;
-}
-
-
-void
-MachDYLD::ProcessStateChanged(nub_state_t state)
-{
-    //printf("MachDYLD::%s(%s)\n", __FUNCTION__, DNBStateAsString(state));
-
-    switch (state)
-    {
-    case eStateInvalid:
-    case eStateUnloaded:
-    case eStateExited:
-    case eStateDetached:
-    case eStateAttaching:
-    case eStateLaunching:
-        Clear();
-        break;
-
-    case eStateStopped:
-        // Keep trying find dyld each time we stop until we do
-        if (!FoundDYLD())
-        {
-            assert(m_pid != INVALID_NUB_PROCESS);
-            DNBProcessSetSharedLibraryInfoCallback ( m_pid, CopySharedInfoCallback, this);
-            CheckForDYLDInMemory();
-        }
-        break;
-
-    case eStateRunning:
-    case eStateStepping:
-    case eStateCrashed:
-    case eStateSuspended:
-        break;
-
-    default:
-        break;
-    }
-}
-
-void
-MachDYLD::SharedLibraryStateChanged(DNBExecutableImageInfo *image_infos, nub_size_t num_image_infos)
-{
-    //printf("MachDYLD::%s(%p, %u)\n", __FUNCTION__, image_infos, image_infos);
-
-}
-
-bool
-MachDYLD::FoundDYLD() const
-{
-    return m_dyld_addr != INVALID_NUB_ADDRESS;
-}
-
-bool
-MachDYLD::CheckForDYLDInMemory()
-{
-#if defined (__arm__)
-    return CheckForDYLDInMemory(0x2fe00000);
-#else
-    return CheckForDYLDInMemory(0x8fe00000);
-#endif
-}
-
-bool
-MachDYLD::CheckForDYLDInMemory(nub_addr_t addr)
-{
-    std::vector<uint8_t> dyld_header;
-    nub_size_t page_size = 0x1000;
-    dyld_header.resize(page_size);
-    nub_size_t bytes_read = DNBProcessMemoryRead(m_pid, addr, dyld_header.size(), &dyld_header[0]);
-    if (bytes_read > 0)
-    {
-        DNBDataRef::offset_t offset = 0;
-        DNBDataRef data(&dyld_header[0], bytes_read, false);
-        struct mach_header *header = (struct mach_header*)data.GetData(&offset, sizeof(struct mach_header));
-        if (header)
-        {
-            switch (header->magic)
-            {
-            case MH_MAGIC:
-            case MH_CIGAM:
-                data.SetPointerSize(4);
-                m_addr_size = 4;
-                break;
-
-            case MH_MAGIC_64:
-            case MH_CIGAM_64:
-                data.SetPointerSize(8);
-                m_addr_size = 8;
-                break;
-
-            default:
-                return false;
-            }
-
-            if (header->filetype == MH_DYLINKER)
-            {
-            //    printf( "Found DYLD mach image at %8.8p", addr);
-
-                m_dyld_all_image_infos_addr = DNBProcessLookupAddress(m_pid, "dyld_all_image_infos", "/usr/lib/dyld");
-
-#if defined (__arm__)
-                m_dyld_all_image_infos_addr = 0x2fe3a004;
-#endif
-
-                if (m_dyld_all_image_infos_addr != INVALID_NUB_ADDRESS)
-                {
-                //    printf( "Found DYLD data symbol 'dyld_all_image_infos' is %8.8p", m_dyld_all_image_infos_addr);
-
-                    if (ReadDYLIBInfo())
-                    {
-                        if (m_dylib_info_header.notification != INVALID_NUB_ADDRESS)
-                        {
-                            m_notify_break_id = DNBBreakpointSet(m_pid, m_dylib_info_header.notification, 4, true);
-                            if (NUB_BREAK_ID_IS_VALID(m_notify_break_id))
-                            {
-                                DNBBreakpointSetCallback(m_pid, m_notify_break_id, MachDYLD::BreakpointHit, this);
-                                m_dyld_addr = addr;
-                            }
-                        }
-                    }
-                //    if (DNBLogCheckLogBit(LOG_SHLIB))
-                //        Dump(DNBLogGetLogFile());
-                }
-                return true;
-            }
-        }
-    }
-    return false;
-}
-
-nub_bool_t
-MachDYLD::BreakpointHit(nub_process_t pid, nub_thread_t tid, nub_break_t breakID, void *baton)
-{
-    MachDYLD *dyld = (MachDYLD*) baton;
-    //printf("MachDYLD::BreakpointHit called");
-    dyld->ReadDYLIBInfo();
-    DNBProcessSharedLibrariesUpdated(pid);
-    return false;    // Don't stop the process, let it continue
-}
-
-bool
-MachDYLD::ReadDYLIBInfo()
-{
-    nub_addr_t addr = m_dyld_all_image_infos_addr;
-    if (addr != INVALID_NUB_ADDRESS)
-    {
-        PThreadMutex::Locker locker(m_dyld_info_mutex);
-        //printf("MachDYLD::ReadDYLIBInfo(addr =%8.8p)", addr);
-        bool swap = false;
-        uint32_t i = 0;
-        DYLIBInfo::collection previous_dylibs;
-        previous_dylibs.swap(m_current_dylibs);
-        uint8_t all_dylib_info_data[32];
-        nub_size_t count = 8 + m_addr_size * 2;
-        nub_size_t bytes_read = DNBProcessMemoryRead(m_pid, addr, count, &all_dylib_info_data[0]);
-        if (bytes_read != count)
-        {
-            m_dylib_info_header.Clear();
-            return false;
-        }
-
-        DNBDataRef data(all_dylib_info_data, sizeof(all_dylib_info_data), swap);
-        data.SetPointerSize(m_addr_size);
-        DNBDataRef::offset_t offset = 0;
-        m_dylib_info_header.version = data.Get32(&offset);
-        m_dylib_info_header.dylib_info_count = data.Get32(&offset);
-        m_dylib_info_header.dylib_info_addr = data.GetPointer(&offset);
-        m_dylib_info_header.notification = data.GetPointer(&offset);
-        //printf( "%s: version=%d, count=%d, addr=%8.8p, notify=%8.8p",
-        //            __PRETTY_FUNCTION__,
-        //            m_dylib_info_header.version,
-        //            m_dylib_info_header.dylib_info_count,
-        //            m_dylib_info_header.dylib_info_addr,
-        //            m_dylib_info_header.notification);
-
-        switch (m_dylib_info_header.version)
-        {
-        case 1:    // 10.4.x and prior
-            {
-            }
-            break;
-
-        case 2: // 10.5 and later
-            {
-            }
-            break;
-
-        default:
-            //printf( "Invalid dyld all_dylib_infos version number: %d", m_dylib_info_header.version);
-            return false;
-            break;
-        }
-
-        // If we made it here, we are assuming that the all dylib info data should
-        // be valid, lets read the info array.
-        if (m_dylib_info_header.dylib_info_count > 0)
-        {
-            if (m_dylib_info_header.dylib_info_addr == 0)
-            {
-                //printf( "dyld is currently updating all_dylib_infos.");
-            }
-            else
-            {
-                m_current_dylibs.resize(m_dylib_info_header.dylib_info_count);
-                count = m_current_dylibs.size() * 3 * m_addr_size;
-                std::vector<uint8_t> info_data(count, 0);
-                bytes_read = DNBProcessMemoryRead(m_pid, m_dylib_info_header.dylib_info_addr, count, &info_data[0]);
-                if (bytes_read == count)
-                {
-                    DNBDataRef::offset_t info_data_offset = 0;
-                    DNBDataRef info_data_ref(&info_data[0], info_data.size(), swap);
-                    info_data_ref.SetPointerSize(m_addr_size);
-                    for (i = 0; info_data_ref.ValidOffset(info_data_offset); i++)
-                    {
-                        assert (i < m_current_dylibs.size());
-                        m_current_dylibs[i].address = info_data_ref.GetPointer(&info_data_offset);
-                        nub_addr_t path_addr = info_data_ref.GetPointer(&info_data_offset);
-                        m_current_dylibs[i].mod_date = info_data_ref.GetPointer(&info_data_offset);
-
-                        char raw_path[PATH_MAX];
-                        char resolved_path[PATH_MAX];
-                        bytes_read = DNBProcessMemoryRead(m_pid, path_addr, sizeof(raw_path), (char*)&raw_path[0]);
-                        if (::realpath(raw_path, resolved_path))
-                            m_current_dylibs[i].path = resolved_path;
-                        else
-                            m_current_dylibs[i].path = raw_path;
-                    }
-                    assert(i == m_dylib_info_header.dylib_info_count);
-
-                    UpdateUUIDs();
-                }
-                else
-                {
-                    //printf( "unable to read all data for all_dylib_infos.");
-                    m_current_dylibs.clear();
-                    return false;
-                }
-            }
-        }
-        // Read any UUID values that we can get
-        if (m_current_dylibs.empty())
-        {
-            m_changed_dylibs = previous_dylibs;
-            const size_t num_changed_dylibs = m_changed_dylibs.size();
-            for (i = 0; i < num_changed_dylibs; i++)
-            {
-                // Indicate the shared library was unloaded by giving it an invalid
-                // address...
-                m_changed_dylibs[i].address = INVALID_NUB_ADDRESS;
-            }
-        }
-        else
-        {
-            m_changed_dylibs.clear();
-
-            // Most of the time when we get shared library changes, they just
-            // get appended to the end of the list, so find out the min number
-            // of entries in the current and previous list that match and see
-            // how many are equal.
-            uint32_t curr_dylib_count = m_current_dylibs.size();
-            uint32_t prev_dylib_count = previous_dylibs.size();
-            uint32_t common_count = std::min<uint32_t>(prev_dylib_count, curr_dylib_count);
-            MachDYLD::DYLIBInfo::const_iterator curr_pos = m_current_dylibs.begin();
-            MachDYLD::DYLIBInfo::const_iterator curr_end = m_current_dylibs.end();
-            MachDYLD::DYLIBInfo::iterator prev_pos = previous_dylibs.begin();
-            uint32_t idx;
-            for (idx = 0; idx < common_count; idx++)
-            {
-                if (*curr_pos == *prev_pos)
-                {
-                    ++curr_pos;
-                    ++prev_pos;
-                }
-                else
-                    break;
-            }
-
-            // Remove all the entries that were at the exact same index and that
-            // matched between the previous_dylibs and m_current_dylibs arrays. This will cover
-            // most of the cases as when shared libraries get loaded they get
-            // appended to the end of the list.
-            if (prev_pos != previous_dylibs.begin())
-            {
-                previous_dylibs.erase(previous_dylibs.begin(), prev_pos);
-            }
-
-            if (previous_dylibs.empty())
-            {
-                // We only have new libraries to add, they are the only ones that
-                // have changed.
-                if (curr_pos != curr_end)
-                {
-                    m_changed_dylibs.assign(curr_pos, curr_end);
-                }
-            }
-            else
-            {
-                // We still have items in our previous dylib list which means either
-                // one or more shared libraries got unloaded somewhere in the middle
-                // of the list, so we will manually search for each remaining item
-                // in our current list in the previous list
-                for (; curr_pos != curr_end; ++curr_pos)
-                {
-                    MachDYLD::DYLIBInfo::iterator pos = std::find(previous_dylibs.begin(), previous_dylibs.end(), *curr_pos);
-                    if (pos == previous_dylibs.end())
-                    {
-                        // This dylib wasn't here before, add it to our change list
-                        m_changed_dylibs.push_back(*curr_pos);
-                    }
-                    else
-                    {
-                        // This dylib was in our previous dylib list, it didn't
-                        // change, so lets remove it from the previous list so we
-                        // don't see it again.
-                        previous_dylibs.erase(pos);
-                    }
-                }
-
-                // The only items left if our previous_dylibs array will be shared
-                // libraries that got unloaded (still in previous list, and not
-                // mentioned in the current list).
-                if (!previous_dylibs.empty())
-                {
-                    const size_t num_previous_dylibs = previous_dylibs.size();
-                    for (i = 0; i < num_previous_dylibs; i++)
-                    {
-                        // Indicate the shared library was unloaded by giving it
-                        // an invalid address...
-                        previous_dylibs[i].address = INVALID_NUB_ADDRESS;
-                    }
-                    // Add all remaining previous_dylibs to the changed list with
-                    // invalidated addresses so we know they got unloaded.
-                    m_changed_dylibs.insert(m_changed_dylibs.end(), previous_dylibs.begin(), previous_dylibs.end());
-                }
-            }
-        }
-        return true;
-    }
-    return false;
-}
-
-
-void
-MachDYLD::UpdateUUIDs()
-{
-    bool swap = false;
-    nub_size_t page_size = 0x1000;
-    uint32_t i;
-    // Read any UUID values that we can get
-    for (i = 0; i < m_dylib_info_header.dylib_info_count; i++)
-    {
-        if (!m_current_dylibs[i].UUIDValid())
-        {
-            std::vector<uint8_t> bytes(page_size, 0);
-            nub_size_t bytes_read = DNBProcessMemoryRead(m_pid, m_current_dylibs[i].address, page_size, &bytes[0]);
-            if (bytes_read > 0)
-            {
-                DNBDataRef::offset_t offset = 0;
-                DNBDataRef data(&bytes[0], bytes_read, swap);
-                struct mach_header *header = (struct mach_header*)data.GetData(&offset, sizeof(struct mach_header));
-                if (header)
-                {
-                    switch (header->magic)
-                    {
-                    case MH_MAGIC:
-                    case MH_CIGAM:
-                        data.SetPointerSize(4);
-                        m_addr_size = 4;
-                        break;
-
-                    case MH_MAGIC_64:
-                    case MH_CIGAM_64:
-                        data.SetPointerSize(8);
-                        m_addr_size = 8;
-                        offset += 4;    // Skip the extra reserved field in the 64 bit mach header
-                        break;
-
-                    default:
-                        continue;
-                    }
-
-                    if (header->sizeofcmds > bytes_read)
-                    {
-                        bytes.resize(header->sizeofcmds);
-                        nub_addr_t addr = m_current_dylibs[i].address + bytes_read;
-                        bytes_read += DNBProcessMemoryRead(m_pid, addr , header->sizeofcmds - bytes_read, &bytes[bytes_read]);
-                    }
-                    assert(bytes_read >= header->sizeofcmds);
-                    uint32_t cmd_idx;
-                    DNBSegment segment;
-
-                    for (cmd_idx = 0; cmd_idx < header->ncmds; cmd_idx++)
-                    {
-                        if (data.ValidOffsetForDataOfSize(offset, sizeof(struct load_command)))
-                        {
-                            struct load_command load_cmd;
-                            DNBDataRef::offset_t load_cmd_offset = offset;
-                            load_cmd.cmd = data.Get32(&offset);
-                            load_cmd.cmdsize = data.Get32(&offset);
-                            switch (load_cmd.cmd)
-                            {
-                            case LC_SEGMENT:
-                                {
-                                    strncpy(segment.name, data.GetCStr(&offset, 16), 16);
-                                    memset(&segment.name[16], 0, DNB_MAX_SEGMENT_NAME_LENGTH - 16);
-                                    segment.addr = data.Get32(&offset);
-                                    segment.size = data.Get32(&offset);
-                                    m_current_dylibs[i].segments.push_back(segment);
-                                }
-                                break;
-
-                            case LC_SEGMENT_64:
-                                {
-                                    strncpy(segment.name, data.GetCStr(&offset, 16), 16);
-                                    memset(&segment.name[16], 0, DNB_MAX_SEGMENT_NAME_LENGTH - 16);
-                                    segment.addr = data.Get64(&offset);
-                                    segment.size = data.Get64(&offset);
-                                    m_current_dylibs[i].segments.push_back(segment);
-                                }
-                                break;
-
-                            case LC_UUID:
-                                // We found our UUID, we can stop now...
-                                memcpy(m_current_dylibs[i].uuid, data.GetData(&offset, 16), 16);
-                            //    if (DNBLogCheckLogBit(LOG_SHLIB))
-                            //    {
-                            //        DNBLogThreaded("UUID found for aii[%d]:", i);
-                            //        m_current_dylibs[i].Dump(DNBLogGetLogFile());
-                            //    }
-                                break;
-
-                            default:
-                                break;
-                            }
-                            // Set offset to be the beginning of the next load command.
-                            offset = load_cmd_offset + load_cmd.cmdsize;
-                        }
-                    }
-                }
-            }
-        }
-    }
-}
-
-
-nub_addr_t
-MachDYLD::GetSharedLibraryHeaderAddress(const char *shlib_path) const
-{
-    if (!m_current_dylibs.empty() && shlib_path && shlib_path[0])
-    {
-        uint32_t i;
-        for (i = 0; i<m_current_dylibs.size(); i++)
-        {
-            if (m_current_dylibs[i].path == shlib_path)
-                return m_current_dylibs[i].address;
-        }
-    }
-    return INVALID_NUB_ADDRESS;
-}
-
-
-nub_size_t
-MachDYLD::CopySharedLibraryInfo(DYLIBInfo::collection& dylib_coll, DNBExecutableImageInfo **image_infos)
-{
-    if (!dylib_coll.empty())
-    {
-        size_t i;
-        size_t total_num_segments = 0;
-        size_t segment_index = 0;
-        for (i = 0; i<dylib_coll.size(); i++)
-        {
-            total_num_segments += dylib_coll[i].segments.size();
-        }
-        size_t image_infos_byte_size = sizeof(DNBExecutableImageInfo) * dylib_coll.size();
-        size_t all_segments_byte_size = sizeof(DNBSegment) * total_num_segments;
-        size_t total_byte_size = image_infos_byte_size + all_segments_byte_size;
-
-        // Allocate enough space to fit all of the shared library information in
-        // a single buffer so consumers can free a single chunk of data when done
-        uint8_t *buf = (uint8_t*)malloc (total_byte_size);
-
-        DNBExecutableImageInfo *info = (DNBExecutableImageInfo*)buf;
-        DNBSegment *all_segments = (DNBSegment*)(buf + image_infos_byte_size);
-        if (info)
-        {
-            for (i = 0; i<dylib_coll.size(); i++)
-            {
-                strncpy(info[i].name, dylib_coll[i].path.c_str(), PATH_MAX);
-                // NULL terminate paths that are too long (redundant for path
-                // that fit, but harmless
-                info[i].name[PATH_MAX-1] = '\0';
-                info[i].header_addr = dylib_coll[i].address;
-                info[i].state = (dylib_coll[i].address == INVALID_NUB_ADDRESS ? eShlibStateUnloaded : eShlibStateLoaded);
-                memcpy(info[i].uuid, dylib_coll[i].uuid, sizeof(uuid_t));
-                info[i].num_segments = dylib_coll[i].segments.size();
-                if (info[i].num_segments == 0)
-                {
-                    info[i].segments = NULL;
-                }
-                else
-                {
-                    info[i].segments = &all_segments[segment_index];
-                    memcpy(info[i].segments, &(dylib_coll[i].segments[0]), sizeof(DNBSegment) * info[i].num_segments);
-                    segment_index += info[i].num_segments;
-                }
-
-            }
-            // Release ownership of the shared library array to the caller
-            *image_infos = info;
-            return dylib_coll.size();
-        }
-    }
-    *image_infos = NULL;
-    return 0;
-}
-
-
-
-nub_size_t
-MachDYLD::CopySharedInfoCallback(nub_process_t pid, struct DNBExecutableImageInfo **image_infos, nub_bool_t only_changed, void *baton)
-{
-    MachDYLD *dyld = (MachDYLD*) baton;
-
-    if (only_changed)
-        return dyld->CopyChangedShlibInfo(image_infos);
-    else
-        return dyld->CopyCurrentShlibInfo(image_infos);
-
-    *image_infos = NULL;
-    return 0;
-}
-
-nub_size_t
-MachDYLD::CopyCurrentShlibInfo(DNBExecutableImageInfo **image_infos)
-{
-    PThreadMutex::Locker locker(m_dyld_info_mutex);
-    return CopySharedLibraryInfo(m_current_dylibs, image_infos);
-}
-
-
-nub_size_t
-MachDYLD::CopyChangedShlibInfo(DNBExecutableImageInfo **image_infos)
-{
-    PThreadMutex::Locker locker(m_dyld_info_mutex);
-    return CopySharedLibraryInfo(m_changed_dylibs, image_infos);
-}
-
-
-
-void
-MachDYLD::DYLIBInfo::Dump(FILE *f) const
-{
-    if (f == NULL)
-        return;
-    if (address == INVALID_NUB_ADDRESS)
-    {
-        if (UUIDValid())
-        {
-            fprintf(f, "UNLOADED %8.8llx %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 %s",
-                        (uint64_t)mod_date,
-                        uuid[ 0], uuid[ 1], uuid[ 2], uuid[ 3],
-                        uuid[ 4], uuid[ 5], uuid[ 6], uuid[ 7],
-                        uuid[ 8], uuid[ 9], uuid[10], uuid[11],
-                        uuid[12], uuid[13], uuid[14], uuid[15],
-                        path.c_str());
-        }
-        else
-        {
-            fprintf(f, "UNLOADED %8.8llx %s", (uint64_t)mod_date, path.c_str());
-        }
-    }
-    else
-    {
-        if (UUIDValid())
-        {
-            fprintf(f, "%8.8llx %8.8llx %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 %s",
-                        (uint64_t)address,
-                        (uint64_t)mod_date,
-                        uuid[ 0], uuid[ 1],    uuid[ 2], uuid[ 3],
-                        uuid[ 4], uuid[ 5], uuid[ 6], uuid[ 7],
-                        uuid[ 8], uuid[ 9], uuid[10], uuid[11],
-                        uuid[12], uuid[13], uuid[14], uuid[15],
-                        path.c_str());
-        }
-        else
-        {
-            fprintf(f, "%8.8llx %8.8llx %s", (uint64_t)address, (uint64_t)mod_date, path.c_str());
-        }
-    }
-}
-
-void
-MachDYLD::Dump(FILE *f) const
-{
-    if (f == NULL)
-        return;
-
-    PThreadMutex::Locker locker(m_dyld_info_mutex);
-    fprintf(f, "\n\tMachDYLD.m_dylib_info_header: version=%d, count=%d, addr=0x%llx, notify=0x%llx",
-                    m_dylib_info_header.version,
-                    m_dylib_info_header.dylib_info_count,
-                    (uint64_t)m_dylib_info_header.dylib_info_addr,
-                    (uint64_t)m_dylib_info_header.notification);
-    uint32_t i;
-    fprintf(f, "\n\tMachDYLD.m_current_dylibs");
-    for (i = 0; i<m_current_dylibs.size(); i++)
-        m_current_dylibs[i].Dump(f);
-    fprintf(f, "\n\tMachDYLD.m_changed_dylibs");
-    for (i = 0; i<m_changed_dylibs.size(); i++)
-        m_changed_dylibs[i].Dump(f);
-}
-

Removed: lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachDYLD.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachDYLD.h?rev=183467&view=auto
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachDYLD.h (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachDYLD.h (removed)
@@ -1,145 +0,0 @@
-//===-- MachDYLD.h ----------------------------------------------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-//  Created by Greg Clayton on 6/29/07.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef __MachDYLD_h__
-#define __MachDYLD_h__
-
-#include "DNBDefs.h"
-#include "DNBRuntimeAction.h"
-#include "PThreadMutex.h"
-#include <map>
-#include <vector>
-#include <string>
-
-class DNBBreakpoint;
-class MachProcess;
-
-class MachDYLD : public DNBRuntimeAction
-{
-public:
-    MachDYLD ();
-    virtual ~MachDYLD ();
-
-    //------------------------------------------------------------------
-    // DNBRuntimeAction required functions
-    //------------------------------------------------------------------
-    virtual void Initialize(nub_process_t pid);
-    virtual void ProcessStateChanged(nub_state_t state);
-    virtual void SharedLibraryStateChanged(DNBExecutableImageInfo *image_infos, nub_size_t num_image_infos);
-
-protected:
-    bool                CheckForDYLDInMemory();
-    bool                FoundDYLD() const;
-    void                Clear();
-    void                Dump(FILE *f) const;
-    nub_process_t       ProcessID() const { return m_pid; }
-    uint32_t            AddrByteSize() const { return m_addr_size; }
-    nub_size_t          CopyCurrentShlibInfo(DNBExecutableImageInfo **image_infos);
-    nub_size_t          CopyChangedShlibInfo(DNBExecutableImageInfo **image_infos);
-    nub_addr_t          GetSharedLibraryHeaderAddress(const char *shlib_path) const;
-    bool                CheckForDYLDInMemory(nub_addr_t addr);
-    bool                ReadDYLIBInfo ();
-    static nub_bool_t   BreakpointHit (nub_process_t pid, nub_thread_t tid, nub_break_t breakID, void *baton);
-    void                UpdateUUIDs();
-
-    struct DYLIBInfo
-    {
-        nub_addr_t      address;    // Address of mach header for this dylib
-        nub_addr_t      mod_date;    // Modification date for this dylib
-        std::string     path;        // Resolved path for this dylib
-        uint8_t         uuid[16];    // UUID for this dylib if it has one, else all zeros
-        std::vector<DNBSegment> segments;    // All segment vmaddr and vmsize pairs for this executable (from memory of inferior)
-
-        DYLIBInfo() :
-            address(INVALID_NUB_ADDRESS),
-            mod_date(0),
-            path(),
-            segments()
-        {
-            memset(uuid, 0, 16);
-        }
-
-        void Clear()
-        {
-            address = INVALID_NUB_ADDRESS;
-            mod_date = 0;
-            path.clear();
-            segments.clear();
-            memset(uuid, 0, 16);
-        }
-
-        bool operator == (const DYLIBInfo& rhs) const
-        {
-            return    address        == rhs.address
-                 && mod_date    == rhs.mod_date
-                 && path        == rhs.path
-                 && memcmp(uuid, rhs.uuid, 16) == 0;
-        }
-        bool UUIDValid() const
-        {
-            return  uuid[ 0] || uuid[ 1] || uuid[ 2] || uuid[ 3] ||
-                    uuid[ 4] || uuid[ 5] || uuid[ 6] || uuid[ 7] ||
-                    uuid[ 8] || uuid[ 9] || uuid[10] || uuid[11] ||
-                    uuid[12] || uuid[13] || uuid[14] || uuid[15];
-        }
-
-        void Dump(FILE *f) const;
-        typedef std::vector<DYLIBInfo> collection;
-        typedef collection::iterator iterator;
-        typedef collection::const_iterator const_iterator;
-    };
-    struct InfoHeader
-    {
-        uint32_t    version;        /* == 1 in Mac OS X 10.4, == 2 in Mac OS 10.5 */
-        uint32_t    dylib_info_count;
-        nub_addr_t  dylib_info_addr;
-        nub_addr_t  notification;
-        bool        processDetachedFromSharedRegion;
-
-        InfoHeader() :
-            version(0),
-            dylib_info_count(0),
-            dylib_info_addr(INVALID_NUB_ADDRESS),
-            notification(INVALID_NUB_ADDRESS),
-            processDetachedFromSharedRegion(false)
-        {
-        }
-
-        void Clear()
-        {
-            version = 0;
-            dylib_info_count = 0;
-            dylib_info_addr = INVALID_NUB_ADDRESS;
-            notification = INVALID_NUB_ADDRESS;
-            processDetachedFromSharedRegion = false;
-        }
-
-        bool IsValid() const
-        {
-            return version == 1 || version == 2;
-        }
-    };
-    static nub_size_t   CopySharedLibraryInfo(DYLIBInfo::collection& dylib_coll, DNBExecutableImageInfo **image_infos);
-    static nub_size_t   CopySharedInfoCallback(nub_process_t pid, struct DNBExecutableImageInfo **image_infos, nub_bool_t only_changed, void *baton);
-    nub_process_t       m_pid;
-    uint32_t            m_addr_size;
-    nub_addr_t              m_dyld_addr;
-    nub_addr_t              m_dyld_all_image_infos_addr;
-    InfoHeader              m_dylib_info_header;
-    DYLIBInfo::collection   m_current_dylibs;    // Current shared libraries information
-    DYLIBInfo::collection   m_changed_dylibs;    // Shared libraries that changed since last shared library update
-    nub_break_t             m_notify_break_id;
-    mutable PThreadMutex    m_dyld_info_mutex;
-};
-
-#endif // #ifndef __MachDYLD_h__

Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachException.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachException.cpp?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachException.cpp (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachException.cpp Thu Jun  6 19:06:43 2013
@@ -237,7 +237,7 @@ MachException::Data::GetStopInfo(struct
         size_t idx;
         if (desc < end_desc)
         {
-            desc += snprintf(desc, end_desc - desc, " data[%zu] = {", stop_info->details.exception.data_count);
+            desc += snprintf(desc, end_desc - desc, " data[%llu] = {", (uint64_t)stop_info->details.exception.data_count);
 
             for (idx = 0; desc < end_desc && idx < stop_info->details.exception.data_count; ++idx)
                 desc += snprintf(desc, end_desc - desc, "0x%llx%c", (uint64_t)exc_data[idx], ((idx + 1 == stop_info->details.exception.data_count) ? '}' : ','));
@@ -278,7 +278,7 @@ MachException::Message::Receive(mach_por
     if (log_exceptions && ((options & MACH_RCV_TIMEOUT) == 0))
     {
         // Dump this log message if we have no timeout in case it never returns
-        DNBLogThreaded ("::mach_msg ( msg->{bits = %#x, size = %u remote_port = %#x, local_port = %#x, reserved = 0x%x, id = 0x%x}, option = %#x, send_size = 0, rcv_size = %zu, rcv_name = %#x, timeout = %u, notify = %#x)",
+        DNBLogThreaded ("::mach_msg ( msg->{bits = %#x, size = %u remote_port = %#x, local_port = %#x, reserved = 0x%x, id = 0x%x}, option = %#x, send_size = 0, rcv_size = %llu, rcv_name = %#x, timeout = %u, notify = %#x)",
                         exc_msg.hdr.msgh_bits,
                         exc_msg.hdr.msgh_size,
                         exc_msg.hdr.msgh_remote_port,
@@ -286,7 +286,7 @@ MachException::Message::Receive(mach_por
                         exc_msg.hdr.msgh_reserved,
                         exc_msg.hdr.msgh_id,
                         options,
-                        sizeof (exc_msg.data),
+                        (uint64_t)sizeof (exc_msg.data),
                         port,
                         mach_msg_timeout,
                         notify_port);
@@ -384,7 +384,7 @@ MachException::Message::Reply(MachProces
         if (state_pid != -1)
         {
             errno = 0;
-            if (::ptrace (PT_THUPDATE, state_pid, (caddr_t)state.thread_port, soft_signal) != 0)
+            if (::ptrace (PT_THUPDATE, state_pid, (caddr_t)((uintptr_t)state.thread_port), soft_signal) != 0)
                 err.SetError(errno, DNBError::POSIX);
             else
                 err.Clear();
@@ -464,7 +464,7 @@ MachException::Data::Dump() const
         size_t idx;
         for (idx = 0; idx < exc_data_count; ++idx)
         {
-            DNBLogThreadedIf(LOG_EXCEPTIONS, "            exc_data[%zu]: 0x%llx", idx, (uint64_t)exc_data[idx]);
+            DNBLogThreadedIf(LOG_EXCEPTIONS, "            exc_data[%llu]: 0x%llx", (uint64_t)idx, (uint64_t)exc_data[idx]);
         }
     }
 }
@@ -480,6 +480,17 @@ MachException::Data::Dump() const
                            EXC_MASK_RPC_ALERT       | \
                            EXC_MASK_MACHINE)
 
+// Don't listen for EXC_RESOURCE, it should really get handled by the system handler.
+
+#ifndef EXC_RESOURCE
+#define EXC_RESOURCE 11
+#endif
+
+#ifndef EXC_MASK_RESOURCE
+#define EXC_MASK_RESOURCE (1 << EXC_RESOURCE)
+#endif
+
+#define LLDB_EXC_MASK (EXC_MASK_ALL & ~EXC_MASK_RESOURCE)
 
 kern_return_t
 MachException::PortInfo::Save (task_t task)
@@ -490,7 +501,7 @@ MachException::PortInfo::Save (task_t ta
     // and back off to just what is supported on the current system
     DNBError err;
 
-    mask = EXC_MASK_ALL;
+    mask = LLDB_EXC_MASK;
 
     count = (sizeof (ports) / sizeof (ports[0]));
     err = ::task_get_exception_ports (task, mask, masks, &count, ports, behaviors, flavors);

Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachProcess.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachProcess.cpp?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachProcess.cpp (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachProcess.cpp Thu Jun  6 19:06:43 2013
@@ -12,6 +12,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "DNB.h"
+#include <inttypes.h>
 #include <mach/mach.h>
 #include <signal.h>
 #include <spawn.h>
@@ -83,18 +84,25 @@ MachProcess::MachProcess() :
     m_stdio_mutex       (PTHREAD_MUTEX_RECURSIVE),
     m_stdout_data       (),
     m_thread_actions    (),
+    m_profile_enabled   (false),
+    m_profile_interval_usec (0),
+    m_profile_thread    (0),
+    m_profile_data_mutex(PTHREAD_MUTEX_RECURSIVE),
+    m_profile_data      (),
     m_thread_list        (),
     m_exception_messages (),
     m_exception_messages_mutex (PTHREAD_MUTEX_RECURSIVE),
     m_state             (eStateUnloaded),
     m_state_mutex       (PTHREAD_MUTEX_RECURSIVE),
     m_events            (0, kAllEventsMask),
+    m_private_events    (0, kAllEventsMask),
     m_breakpoints       (),
     m_watchpoints       (),
     m_name_to_addr_callback(NULL),
     m_name_to_addr_baton(NULL),
     m_image_infos_callback(NULL),
-    m_image_infos_baton(NULL)
+    m_image_infos_baton(NULL),
+    m_did_exec (false)
 {
     DNBLogThreadedIf(LOG_PROCESS | LOG_VERBOSE, "%s", __PRETTY_FUNCTION__);
 }
@@ -151,14 +159,20 @@ MachProcess::GetThreadAtIndex (nub_size_
     return m_thread_list.ThreadIDAtIndex(thread_idx);
 }
 
+nub_thread_t
+MachProcess::GetThreadIDForMachPortNumber (thread_t mach_port_number) const
+{
+    return m_thread_list.GetThreadIDByMachPortNumber (mach_port_number);
+}
+
 nub_bool_t
 MachProcess::SyncThreadState (nub_thread_t tid)
 {
     MachThreadSP thread_sp(m_thread_list.GetThreadByID(tid));
     if (!thread_sp)
         return false;
-    kern_return_t kret = ::thread_abort_safely(thread_sp->ThreadID());
-    DNBLogThreadedIf (LOG_THREAD, "thread = 0x%4.4x calling thread_abort_safely (tid) => %u (GetGPRState() for stop_count = %u)", thread_sp->ThreadID(), kret, thread_sp->Process()->StopCount());
+    kern_return_t kret = ::thread_abort_safely(thread_sp->MachPortNumber());
+    DNBLogThreadedIf (LOG_THREAD, "thread = 0x%8.8" PRIx32 " calling thread_abort_safely (tid) => %u (GetGPRState() for stop_count = %u)", thread_sp->MachPortNumber(), kret, thread_sp->Process()->StopCount());
 
     if (kret == KERN_SUCCESS)
         return true;
@@ -174,15 +188,27 @@ MachProcess::GetCurrentThread ()
 }
 
 nub_thread_t
+MachProcess::GetCurrentThreadMachPort ()
+{
+    return m_thread_list.GetMachPortNumberByThreadID(m_thread_list.CurrentThreadID());
+}
+
+nub_thread_t
 MachProcess::SetCurrentThread(nub_thread_t tid)
 {
     return m_thread_list.SetCurrentThread(tid);
 }
 
 bool
-MachProcess::GetThreadStoppedReason(nub_thread_t tid, struct DNBThreadStopInfo *stop_info) const
+MachProcess::GetThreadStoppedReason(nub_thread_t tid, struct DNBThreadStopInfo *stop_info)
 {
-    return m_thread_list.GetThreadStoppedReason(tid, stop_info);
+    if (m_thread_list.GetThreadStoppedReason(tid, stop_info))
+    {
+        if (m_did_exec)
+            stop_info->reason = eStopTypeExec;
+        return true;
+    }
+    return false;
 }
 
 void
@@ -240,8 +266,6 @@ MachProcess::SetState(nub_state_t new_st
     // Scope for mutex locker
     {
         PTHREAD_MUTEX_LOCKER(locker, m_state_mutex);
-        DNBLogThreadedIf(LOG_PROCESS, "MachProcess::SetState ( %s )", DNBStateAsString(new_state));
-
         const nub_state_t old_state = m_state;
 
         if (old_state != new_state)
@@ -251,15 +275,26 @@ MachProcess::SetState(nub_state_t new_st
             else
                 event_mask = eEventProcessRunningStateChanged;
 
+            DNBLogThreadedIf(LOG_PROCESS, "MachProcess::SetState ( old = %s, new = %s ) updating state, event_mask = 0x%8.8x", DNBStateAsString(old_state), DNBStateAsString(new_state), event_mask);
+
             m_state = new_state;
             if (new_state == eStateStopped)
                 m_stop_count++;
         }
+        else
+        {
+            DNBLogThreadedIf(LOG_PROCESS, "MachProcess::SetState ( old = %s, new = %s ) ignoring state...", DNBStateAsString(old_state), DNBStateAsString(new_state));
+        }
     }
 
     if (event_mask != 0)
     {
         m_events.SetEvents (event_mask);
+        m_private_events.SetEvents (event_mask);
+        if (event_mask == eEventProcessStoppedStateChanged)
+            m_private_events.ResetEvents (eEventProcessRunningStateChanged);
+        else
+            m_private_events.ResetEvents (eEventProcessStoppedStateChanged);
 
         // Wait for the event bit to reset if a reset ACK is requested
         m_events.WaitForResetAck(event_mask);
@@ -286,6 +321,11 @@ MachProcess::Clear()
         PTHREAD_MUTEX_LOCKER(locker, m_exception_messages_mutex);
         m_exception_messages.clear();
     }
+    if (m_profile_thread)
+    {
+        pthread_join(m_profile_thread, NULL);
+        m_profile_thread = NULL;
+    }
 }
 
 
@@ -297,6 +337,32 @@ MachProcess::StartSTDIOThread()
     return ::pthread_create (&m_stdio_thread, NULL, MachProcess::STDIOThread, this) == 0;
 }
 
+void
+MachProcess::SetEnableAsyncProfiling(bool enable, uint64_t interval_usec, DNBProfileDataScanType scan_type)
+{
+    m_profile_enabled = enable;
+    m_profile_interval_usec = interval_usec;
+    m_profile_scan_type = scan_type;
+    
+    if (m_profile_enabled && (m_profile_thread == NULL))
+    {
+        StartProfileThread();
+    }
+    else if (!m_profile_enabled && m_profile_thread)
+    {
+        pthread_join(m_profile_thread, NULL);
+        m_profile_thread = NULL;
+    }
+}
+
+bool
+MachProcess::StartProfileThread()
+{
+    DNBLogThreadedIf(LOG_PROCESS, "MachProcess::%s ( )", __FUNCTION__);
+    // Create the thread that profiles the inferior and reports back if enabled
+    return ::pthread_create (&m_profile_thread, NULL, MachProcess::ProfileThread, this) == 0;
+}
+
 
 nub_addr_t
 MachProcess::LookupSymbol(const char *name, const char *shlib)
@@ -320,10 +386,10 @@ MachProcess::Resume (const DNBThreadResu
     }
     else if (state == eStateRunning)
     {
-        DNBLogThreadedIf(LOG_PROCESS, "Resume() - task 0x%x is running, ignoring...", m_task.TaskPort());
+        DNBLog("Resume() - task 0x%x is already running, ignoring...", m_task.TaskPort());
         return true;
     }
-    DNBLogThreadedIf(LOG_PROCESS, "Resume() - task 0x%x can't continue, ignoring...", m_task.TaskPort());
+    DNBLog("Resume() - task 0x%x has state %s, can't continue...", m_task.TaskPort(), DNBStateAsString(state));
     return false;
 }
 
@@ -334,12 +400,28 @@ MachProcess::Kill (const struct timespec
     nub_state_t state = DoSIGSTOP(true, false, NULL);
     DNBLogThreadedIf(LOG_PROCESS, "MachProcess::Kill() DoSIGSTOP() state = %s", DNBStateAsString(state));
     errno = 0;
+    DNBLog ("Sending ptrace PT_KILL to terminate inferior process.");
     ::ptrace (PT_KILL, m_pid, 0, 0);
     DNBError err;
     err.SetErrorToErrno();
     DNBLogThreadedIf(LOG_PROCESS, "MachProcess::Kill() DoSIGSTOP() ::ptrace (PT_KILL, pid=%u, 0, 0) => 0x%8.8x (%s)", m_pid, err.Error(), err.AsString());
     m_thread_actions = DNBThreadResumeActions (eStateRunning, 0);
     PrivateResume ();
+    
+    // Try and reap the process without touching our m_events since
+    // we want the code above this to still get the eStateExited event
+    const uint32_t reap_timeout_usec = 1000000;    // Wait 1 second and try to reap the process
+    const uint32_t reap_interval_usec = 10000;  //
+    uint32_t reap_time_elapsed;
+    for (reap_time_elapsed = 0;
+         reap_time_elapsed < reap_timeout_usec;
+         reap_time_elapsed += reap_interval_usec)
+    {
+        if (GetState() == eStateExited)
+            break;
+        usleep(reap_interval_usec);
+    }
+    DNBLog ("Waited %u ms for process to be reaped (state = %s)", reap_time_elapsed/1000, DNBStateAsString(GetState()));
     return true;
 }
 
@@ -354,7 +436,7 @@ MachProcess::Signal (int signal, const s
         if (IsRunning(state) && timeout_abstime)
         {
             DNBLogThreadedIf(LOG_PROCESS, "MachProcess::Signal (signal = %d, timeout = %p) waiting for signal to stop process...", signal, timeout_abstime);
-            m_events.WaitForSetEvents(eEventProcessStoppedStateChanged, timeout_abstime);
+            m_private_events.WaitForSetEvents(eEventProcessStoppedStateChanged, timeout_abstime);
             state = GetState();
             DNBLogThreadedIf(LOG_PROCESS, "MachProcess::Signal (signal = %d, timeout = %p) state = %s", signal, timeout_abstime, DNBStateAsString(state));
             return !IsRunning (state);
@@ -614,13 +696,18 @@ MachProcess::ReplyToAllExceptions ()
             DNBLogThreadedIf(LOG_EXCEPTIONS, "Replying to exception %u...", (uint32_t)std::distance(begin, pos));
             int thread_reply_signal = 0;
 
-            const DNBThreadResumeAction *action = m_thread_actions.GetActionForThread (pos->state.thread_port, false);
+            nub_thread_t tid = m_thread_list.GetThreadIDByMachPortNumber (pos->state.thread_port);
+            const DNBThreadResumeAction *action = NULL;
+            if (tid != INVALID_NUB_THREAD)
+            {
+                action = m_thread_actions.GetActionForThread (tid, false);
+            }
 
             if (action)
             {
                 thread_reply_signal = action->signal;
                 if (thread_reply_signal)
-                    m_thread_actions.SetSignalHandledForThread (pos->state.thread_port);
+                    m_thread_actions.SetSignalHandledForThread (tid);
             }
 
             DNBError err (pos->Reply(this, thread_reply_signal));
@@ -659,7 +746,7 @@ MachProcess::PrivateResume ()
 nub_break_t
 MachProcess::CreateBreakpoint(nub_addr_t addr, nub_size_t length, bool hardware, thread_t tid)
 {
-    DNBLogThreadedIf(LOG_BREAKPOINTS, "MachProcess::CreateBreakpoint ( addr = 0x%8.8llx, length = %zu, hardware = %i, tid = 0x%4.4x )", (uint64_t)addr, length, hardware, tid);
+    DNBLogThreadedIf(LOG_BREAKPOINTS, "MachProcess::CreateBreakpoint ( addr = 0x%8.8llx, length = %llu, hardware = %i, tid = 0x%4.4x )", (uint64_t)addr, (uint64_t)length, hardware, tid);
     if (hardware && tid == INVALID_NUB_THREAD)
         tid = GetCurrentThread();
 
@@ -667,7 +754,7 @@ MachProcess::CreateBreakpoint(nub_addr_t
     nub_break_t breakID = m_breakpoints.Add(bp);
     if (EnableBreakpoint(breakID))
     {
-        DNBLogThreadedIf(LOG_BREAKPOINTS, "MachProcess::CreateBreakpoint ( addr = 0x%8.8llx, length = %zu, tid = 0x%4.4x ) => %u", (uint64_t)addr, length, tid, breakID);
+        DNBLogThreadedIf(LOG_BREAKPOINTS, "MachProcess::CreateBreakpoint ( addr = 0x%8.8llx, length = %llu, tid = 0x%4.4x ) => %u", (uint64_t)addr, (uint64_t)length, tid, breakID);
         return breakID;
     }
     else
@@ -681,7 +768,7 @@ MachProcess::CreateBreakpoint(nub_addr_t
 nub_watch_t
 MachProcess::CreateWatchpoint(nub_addr_t addr, nub_size_t length, uint32_t watch_flags, bool hardware, thread_t tid)
 {
-    DNBLogThreadedIf(LOG_WATCHPOINTS, "MachProcess::CreateWatchpoint ( addr = 0x%8.8llx, length = %zu, flags = 0x%8.8x, hardware = %i, tid = 0x%4.4x )", (uint64_t)addr, length, watch_flags, hardware, tid);
+    DNBLogThreadedIf(LOG_WATCHPOINTS, "MachProcess::CreateWatchpoint ( addr = 0x%8.8llx, length = %llu, flags = 0x%8.8x, hardware = %i, tid = 0x%4.4x )", (uint64_t)addr, (uint64_t)length, watch_flags, hardware, tid);
     if (hardware && tid == INVALID_NUB_THREAD)
         tid = GetCurrentThread();
 
@@ -691,12 +778,12 @@ MachProcess::CreateWatchpoint(nub_addr_t
     nub_watch_t watchID = m_watchpoints.Add(watch);
     if (EnableWatchpoint(watchID))
     {
-        DNBLogThreadedIf(LOG_WATCHPOINTS, "MachProcess::CreateWatchpoint ( addr = 0x%8.8llx, length = %zu, tid = 0x%x) => %u", (uint64_t)addr, length, tid, watchID);
+        DNBLogThreadedIf(LOG_WATCHPOINTS, "MachProcess::CreateWatchpoint ( addr = 0x%8.8llx, length = %llu, tid = 0x%x) => %u", (uint64_t)addr, (uint64_t)length, tid, watchID);
         return watchID;
     }
     else
     {
-        DNBLogThreadedIf(LOG_WATCHPOINTS, "MachProcess::CreateWatchpoint ( addr = 0x%8.8llx, length = %zu, tid = 0x%x) => FAILED (%u)", (uint64_t)addr, length, tid, watchID);
+        DNBLogThreadedIf(LOG_WATCHPOINTS, "MachProcess::CreateWatchpoint ( addr = 0x%8.8llx, length = %llu, tid = 0x%x) => FAILED (%u)", (uint64_t)addr, (uint64_t)length, tid, watchID);
         m_watchpoints.Remove(watchID);
     }
     // We failed to enable the watchpoint
@@ -753,6 +840,11 @@ MachProcess::DisableBreakpoint(nub_break
     DNBBreakpoint *bp = m_breakpoints.FindByID (breakID);
     if (bp)
     {
+        // After "exec" we might end up with a bunch of breakpoints that were disabled
+        // manually, just ignore them
+        if (!bp->IsEnabled())
+            return true;
+
         nub_addr_t addr = bp->Address();
         DNBLogThreadedIf(LOG_BREAKPOINTS | LOG_VERBOSE, "MachProcess::DisableBreakpoint ( breakID = %d, remove = %d ) addr = 0x%8.8llx", breakID, remove, (uint64_t)addr);
 
@@ -1072,16 +1164,65 @@ MachProcess::ExceptionMessageBundleCompl
 {
     // We have a complete bundle of exceptions for our child process.
     PTHREAD_MUTEX_LOCKER (locker, m_exception_messages_mutex);
-    DNBLogThreadedIf(LOG_EXCEPTIONS, "%s: %zu exception messages.", __PRETTY_FUNCTION__, m_exception_messages.size());
+    DNBLogThreadedIf(LOG_EXCEPTIONS, "%s: %llu exception messages.", __PRETTY_FUNCTION__, (uint64_t)m_exception_messages.size());
     if (!m_exception_messages.empty())
     {
+        m_did_exec = false;
+        // First check for any SIGTRAP and make sure we didn't exec
+        const task_t task = m_task.TaskPort();
+        size_t i;
+        if (m_pid != 0)
+        {
+            for (i=0; i<m_exception_messages.size(); ++i)
+            {
+                if (m_exception_messages[i].state.task_port == task)
+                {
+                    const int signo = m_exception_messages[i].state.SoftSignal();
+                    if (signo == SIGTRAP)
+                    {
+                        // SIGTRAP could mean that we exec'ed. We need to check the
+                        // dyld all_image_infos.infoArray to see if it is NULL and if
+                        // so, say that we exec'ed.
+                        const nub_addr_t aii_addr = GetDYLDAllImageInfosAddress();
+                        if (aii_addr != INVALID_NUB_ADDRESS)
+                        {
+                            const nub_addr_t info_array_count_addr = aii_addr + 4;
+                            uint32_t info_array_count = 0;
+                            if (m_task.ReadMemory(info_array_count_addr, 4, &info_array_count) == 4)
+                            {
+                                DNBLog ("info_array_count is 0x%x", info_array_count);
+                                if (info_array_count == 0)
+                                    m_did_exec = true;
+                            }
+                            else
+                            {
+                                DNBLog ("error: failed to read all_image_infos.infoArrayCount from 0x%8.8llx", info_array_count_addr);
+                            }
+                        }
+                        break;
+                    }
+                }
+            }
+            
+            if (m_did_exec)
+            {
+                cpu_type_t process_cpu_type = MachProcess::GetCPUTypeForLocalProcess (m_pid);
+                if (m_cpu_type != process_cpu_type)
+                {
+                    DNBLog ("arch changed from 0x%8.8x to 0x%8.8x", m_cpu_type, process_cpu_type);
+                    m_cpu_type = process_cpu_type;
+                    DNBArchProtocol::SetArchitecture (process_cpu_type);
+                }
+                m_thread_list.Clear();
+                m_breakpoints.DisableAll();
+            }
+        }
+
         // Let all threads recover from stopping and do any clean up based
         // on the previous thread state (if any).
         m_thread_list.ProcessDidStop(this);
 
         // Let each thread know of any exceptions
-        task_t task = m_task.TaskPort();
-        size_t i;
         for (i=0; i<m_exception_messages.size(); ++i)
         {
             // Let the thread list figure use the MachProcess to forward all exceptions
@@ -1115,7 +1256,7 @@ MachProcess::ExceptionMessageBundleCompl
     }
     else
     {
-        DNBLogThreadedIf(LOG_EXCEPTIONS, "%s empty exception messages bundle (%zu exceptions).", __PRETTY_FUNCTION__, m_exception_messages.size());
+        DNBLogThreadedIf(LOG_EXCEPTIONS, "%s empty exception messages bundle (%llu exceptions).", __PRETTY_FUNCTION__, (uint64_t)m_exception_messages.size());
     }
 }
 
@@ -1141,7 +1282,7 @@ MachProcess::SharedLibrariesUpdated ( )
 void
 MachProcess::AppendSTDOUT (char* s, size_t len)
 {
-    DNBLogThreadedIf(LOG_PROCESS, "MachProcess::%s (<%zu> %s) ...", __FUNCTION__, len, s);
+    DNBLogThreadedIf(LOG_PROCESS, "MachProcess::%s (<%llu> %s) ...", __FUNCTION__, (uint64_t)len, s);
     PTHREAD_MUTEX_LOCKER (locker, m_stdio_mutex);
     m_stdout_data.append(s, len);
     m_events.SetEvents(eEventStdioAvailable);
@@ -1153,7 +1294,7 @@ MachProcess::AppendSTDOUT (char* s, size
 size_t
 MachProcess::GetAvailableSTDOUT (char *buf, size_t buf_size)
 {
-    DNBLogThreadedIf(LOG_PROCESS, "MachProcess::%s (&%p[%zu]) ...", __FUNCTION__, buf, buf_size);
+    DNBLogThreadedIf(LOG_PROCESS, "MachProcess::%s (&%p[%llu]) ...", __FUNCTION__, buf, (uint64_t)buf_size);
     PTHREAD_MUTEX_LOCKER (locker, m_stdio_mutex);
     size_t bytes_available = m_stdout_data.size();
     if (bytes_available > 0)
@@ -1311,6 +1452,77 @@ MachProcess::STDIOThread(void *arg)
     return NULL;
 }
 
+
+void
+MachProcess::SignalAsyncProfileData (const char *info)
+{
+    DNBLogThreadedIf(LOG_PROCESS, "MachProcess::%s (%s) ...", __FUNCTION__, info);
+    PTHREAD_MUTEX_LOCKER (locker, m_profile_data_mutex);
+    m_profile_data.push_back(info);
+    m_events.SetEvents(eEventProfileDataAvailable);
+    
+    // Wait for the event bit to reset if a reset ACK is requested
+    m_events.WaitForResetAck(eEventProfileDataAvailable);
+}
+
+
+size_t
+MachProcess::GetAsyncProfileData (char *buf, size_t buf_size)
+{
+    DNBLogThreadedIf(LOG_PROCESS, "MachProcess::%s (&%p[%llu]) ...", __FUNCTION__, buf, (uint64_t)buf_size);
+    PTHREAD_MUTEX_LOCKER (locker, m_profile_data_mutex);
+    if (m_profile_data.empty())
+        return 0;
+    
+    size_t bytes_available = m_profile_data.front().size();
+    if (bytes_available > 0)
+    {
+        if (bytes_available > buf_size)
+        {
+            memcpy(buf, m_profile_data.front().data(), buf_size);
+            m_profile_data.front().erase(0, buf_size);
+            bytes_available = buf_size;
+        }
+        else
+        {
+            memcpy(buf, m_profile_data.front().data(), bytes_available);
+            m_profile_data.erase(m_profile_data.begin());
+        }
+    }
+    return bytes_available;
+}
+
+
+void *
+MachProcess::ProfileThread(void *arg)
+{
+    MachProcess *proc = (MachProcess*) arg;
+    DNBLogThreadedIf(LOG_PROCESS, "MachProcess::%s ( arg = %p ) thread starting...", __FUNCTION__, arg);
+
+    while (proc->IsProfilingEnabled())
+    {
+        nub_state_t state = proc->GetState();
+        if (state == eStateRunning)
+        {
+            std::string data = proc->Task().GetProfileData(proc->GetProfileScanType());
+            if (!data.empty())
+            {
+                proc->SignalAsyncProfileData(data.c_str());
+            }
+        }
+        else if ((state == eStateUnloaded) || (state == eStateDetached) || (state == eStateUnloaded))
+        {
+            // Done. Get out of this thread.
+            break;
+        }
+        
+        // A simple way to set up the profile interval. We can also use select() or dispatch timer source if necessary.
+        usleep(proc->ProfileInterval());
+    }
+    return NULL;
+}
+
+
 pid_t
 MachProcess::AttachForDebug (pid_t pid, char *err_str, size_t err_len)
 {
@@ -1387,7 +1599,8 @@ MachProcess::PrepareForAttach (const cha
         return NULL;
 
     const char *app_ext = strstr(path, ".app");
-    if (app_ext == NULL)
+    const bool is_app = app_ext != NULL && (app_ext[4] == '\0' || app_ext[4] == '/');
+    if (!is_app)
     {
         DNBLogThreadedIf(LOG_PROCESS, "MachProcess::PrepareForAttach(): path '%s' doesn't contain .app, we can't tell springboard to wait for launch...", path);
         return NULL;
@@ -1532,12 +1745,28 @@ MachProcess::LaunchForDebug
 
     case eLaunchFlavorSpringBoard:
         {
-            const char *app_ext = strstr(path, ".app");
-            if (app_ext != NULL)
+            //  .../whatever.app/whatever ?  
+            //  Or .../com.apple.whatever.app/whatever -- be careful of ".app" in "com.apple.whatever" here
+            const char *app_ext = strstr (path, ".app/");
+            if (app_ext == NULL)
+            {
+                // .../whatever.app ?
+                int len = strlen (path);
+                if (len > 5)
+                {
+                    if (strcmp (path + len - 4, ".app") == 0)
+                    {
+                        app_ext = path + len - 4;
+                    }
+                }
+            }
+            if (app_ext)
             {
                 std::string app_bundle_path(path, app_ext + strlen(".app"));
                 if (SBLaunchForDebug (app_bundle_path.c_str(), argv, envp, no_stdio, launch_err) != 0)
                     return m_pid; // A successful SBLaunchForDebug() returns and assigns a non-zero m_pid.
+                else
+                    break; // We tried a springboard launch, but didn't succeed lets get out
             }
         }
         // In case the executable name has a ".app" fragment which confuses our debugserver,
@@ -1587,6 +1816,7 @@ MachProcess::LaunchForDebug
         {
             if (launch_err.AsString() == NULL)
                 launch_err.SetErrorString("unable to start the exception thread");
+            DNBLog ("Could not get inferior's Mach exception port, sending ptrace PT_KILL and exiting.");
             ::ptrace (PT_KILL, m_pid, 0, 0);
             m_pid = INVALID_NUB_PROCESS;
             return INVALID_NUB_PROCESS;
@@ -1690,7 +1920,7 @@ MachProcess::PosixSpawnChildForPTraceDeb
         size_t ocount = 0;
         err.SetError( ::posix_spawnattr_setbinpref_np (&attr, 1, &cpu_type, &ocount), DNBError::POSIX);
         if (err.Fail() || DNBLogCheckLogBit(LOG_PROCESS))
-            err.LogThreaded("::posix_spawnattr_setbinpref_np ( &attr, 1, cpu_type = 0x%8.8x, count => %zu )", cpu_type, ocount);
+            err.LogThreaded("::posix_spawnattr_setbinpref_np ( &attr, 1, cpu_type = 0x%8.8x, count => %llu )", cpu_type, (uint64_t)ocount);
 
         if (err.Fail() != 0 || ocount != 1)
             return INVALID_NUB_PROCESS;
@@ -1717,7 +1947,7 @@ MachProcess::PosixSpawnChildForPTraceDeb
             }
         }
 
-		// if no_stdio or std paths not supplied, then route to "/dev/null".
+        // if no_stdio or std paths not supplied, then route to "/dev/null".
         if (no_stdio || stdin_path == NULL || stdin_path[0] == '\0')
             stdin_path = "/dev/null";
         if (no_stdio || stdout_path == NULL || stdout_path[0] == '\0')
@@ -1927,6 +2157,7 @@ MachProcess::SBLaunchForDebug (const cha
         {
             if (launch_err.AsString() == NULL)
                 launch_err.SetErrorString("unable to start the exception thread");
+            DNBLog ("Could not get inferior's Mach exception port, sending ptrace PT_KILL and exiting.");
             ::ptrace (PT_KILL, m_pid, 0, 0);
             m_pid = INVALID_NUB_PROCESS;
             return INVALID_NUB_PROCESS;
@@ -2084,19 +2315,6 @@ MachProcess::SBForkChildForPTraceDebuggi
     std::string bundleID;
     CFString::UTF8(bundleIDCFStr, bundleID);
 
-    CFData argv_data(NULL);
-
-    if (launch_argv.get())
-    {
-        if (argv_data.Serialize(launch_argv.get(), kCFPropertyListBinaryFormat_v1_0) == NULL)
-        {
-            DNBLogThreadedIf(LOG_PROCESS, "%s() error: failed to serialize launch arg array...", __FUNCTION__);
-            return INVALID_NUB_PROCESS;
-        }
-    }
-
-    DNBLogThreadedIf(LOG_PROCESS, "%s() serialized launch arg array", __FUNCTION__);
-
     // Find SpringBoard
     SBSApplicationLaunchError sbs_error = 0;
     sbs_error = SBSLaunchApplicationForDebugging (bundleIDCFStr,

Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachProcess.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachProcess.h?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachProcess.h (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachProcess.h Thu Jun  6 19:06:43 2013
@@ -18,7 +18,6 @@
 #include "DNBBreakpoint.h"
 #include "DNBError.h"
 #include "DNBThreadResumeActions.h"
-//#include "MachDYLD.h"
 #include "MachException.h"
 #include "MachVMMemory.h"
 #include "MachTask.h"
@@ -144,6 +143,17 @@ public:
     void                    ExceptionMessageBundleComplete ();
     void                    SharedLibrariesUpdated ();
     nub_size_t              CopyImageInfos (struct DNBExecutableImageInfo **image_infos, bool only_changed);
+    
+    //----------------------------------------------------------------------
+    // Profile functions
+    //----------------------------------------------------------------------
+    void                    SetEnableAsyncProfiling (bool enable, uint64_t internal_usec, DNBProfileDataScanType scan_type);
+    bool                    IsProfilingEnabled () { return m_profile_enabled; }
+    uint64_t                ProfileInterval () { return m_profile_interval_usec; }
+    bool                    StartProfileThread ();
+    static void *           ProfileThread (void *arg);
+    void                    SignalAsyncProfileData (const char *info);
+    size_t                  GetAsyncProfileData (char *buf, size_t buf_size);
 
     //----------------------------------------------------------------------
     // Accessors
@@ -165,12 +175,15 @@ public:
     nub_size_t              GetNumThreads () const;
     nub_thread_t            GetThreadAtIndex (nub_size_t thread_idx) const;
     nub_thread_t            GetCurrentThread ();
+    nub_thread_t            GetCurrentThreadMachPort ();
     nub_thread_t            SetCurrentThread (nub_thread_t tid);
     MachThreadList &        GetThreadList() { return m_thread_list; }
-    bool                    GetThreadStoppedReason(nub_thread_t tid, struct DNBThreadStopInfo *stop_info) const;
+    bool                    GetThreadStoppedReason(nub_thread_t tid, struct DNBThreadStopInfo *stop_info);
     void                    DumpThreadStoppedReason(nub_thread_t tid) const;
     const char *            GetThreadInfo (nub_thread_t tid) const;
 
+    nub_thread_t            GetThreadIDForMachPortNumber (thread_t mach_port_number) const;
+
     uint32_t                GetCPUType ();
     nub_state_t             GetState ();
     void                    SetState (nub_state_t state);
@@ -237,6 +250,9 @@ public:
                             }
 
     bool                    ProcessUsingSpringBoard() const { return (m_flags & eMachProcessFlagsUsingSBS) != 0; }
+    
+    DNBProfileDataScanType  GetProfileScanType () { return m_profile_scan_type; }
+    
 private:
     enum
     {
@@ -266,6 +282,14 @@ private:
     pthread_t                   m_stdio_thread;             // Thread ID for the thread that watches for child process stdio
     PThreadMutex                m_stdio_mutex;              // Multithreaded protection for stdio
     std::string                 m_stdout_data;
+    
+    bool                        m_profile_enabled;          // A flag to indicate if profiling is enabled
+    uint64_t                    m_profile_interval_usec;    // If enable, the profiling interval in microseconds
+    DNBProfileDataScanType      m_profile_scan_type;        // Indicates what needs to be profiled
+    pthread_t                   m_profile_thread;           // Thread ID for the thread that profiles the inferior
+    PThreadMutex                m_profile_data_mutex;       // Multithreaded protection for profile info data
+    std::vector<std::string>    m_profile_data;             // Profile data, must be protected by m_profile_data_mutex
+    
     DNBThreadResumeActions      m_thread_actions;           // The thread actions for the current MachProcess::Resume() call
     MachException::Message::collection
                                 m_exception_messages;       // A collection of exception messages caught when listening to the exception port
@@ -275,6 +299,7 @@ private:
     nub_state_t                 m_state;                    // The state of our process
     PThreadMutex                m_state_mutex;              // Multithreaded protection for m_state
     PThreadEvent                m_events;                   // Process related events in the child processes lifetime can be waited upon
+    PThreadEvent                m_private_events;           // Used to coordinate running and stopping the process without affecting m_events
     DNBBreakpointList           m_breakpoints;              // Breakpoint list for this process
     DNBBreakpointList           m_watchpoints;              // Watchpoint list for this process
     DNBCallbackNameToAddress    m_name_to_addr_callback;
@@ -282,6 +307,7 @@ private:
     DNBCallbackCopyExecutableImageInfos
                                 m_image_infos_callback;
     void *                      m_image_infos_baton;
+    bool                        m_did_exec;
 };
 
 

Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachTask.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachTask.cpp?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachTask.cpp (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachTask.cpp Thu Jun  6 19:06:43 2013
@@ -21,8 +21,12 @@
 
 #include <mach-o/dyld_images.h>
 #include <mach/mach_vm.h>
+#import <sys/sysctl.h>
 
 // C++ Includes
+#include <iomanip>
+#include <sstream>
+
 // Other libraries and framework includes
 // Project includes
 #include "CFUtils.h"
@@ -52,7 +56,6 @@ MachTask::MachTask(MachProcess *process)
     m_exception_port (MACH_PORT_NULL)
 {
     memset(&m_exc_port_info, 0, sizeof(m_exc_port_info));
-
 }
 
 //----------------------------------------------------------------------
@@ -87,18 +90,18 @@ MachTask::Resume()
 {
     struct task_basic_info task_info;
     task_t task = TaskPort();
-	if (task == TASK_NULL)
-		return KERN_INVALID_ARGUMENT;
+    if (task == TASK_NULL)
+        return KERN_INVALID_ARGUMENT;
 
     DNBError err;
     err = BasicInfo(task, &task_info);
 
     if (err.Success())
     {
-		// task_resume isn't counted like task_suspend calls are, are, so if the 
-		// task is not suspended, don't try and resume it since it is already 
-		// running
-		if (task_info.suspend_count > 0)
+        // task_resume isn't counted like task_suspend calls are, are, so if the 
+        // task is not suspended, don't try and resume it since it is already 
+        // running
+        if (task_info.suspend_count > 0)
         {
             err = ::task_resume (task);
             if (DNBLogCheckLogBit(LOG_TASK) || err.Fail())
@@ -172,7 +175,7 @@ MachTask::ReadMemory (nub_addr_t addr, n
     {
         n = m_vm_memory.Read(task, addr, buf, size);
 
-        DNBLogThreadedIf(LOG_MEMORY, "MachTask::ReadMemory ( addr = 0x%8.8llx, size = %zu, buf = %p) => %zu bytes read", (uint64_t)addr, size, buf, n);
+        DNBLogThreadedIf(LOG_MEMORY, "MachTask::ReadMemory ( addr = 0x%8.8llx, size = %llu, buf = %p) => %llu bytes read", (uint64_t)addr, (uint64_t)size, buf, (uint64_t)n);
         if (DNBLogCheckLogBit(LOG_MEMORY_DATA_LONG) || (DNBLogCheckLogBit(LOG_MEMORY_DATA_SHORT) && size <= 8))
         {
             DNBDataRef data((uint8_t*)buf, n, false);
@@ -194,7 +197,7 @@ MachTask::WriteMemory (nub_addr_t addr,
     if (task != TASK_NULL)
     {
         n = m_vm_memory.Write(task, addr, buf, size);
-        DNBLogThreadedIf(LOG_MEMORY, "MachTask::WriteMemory ( addr = 0x%8.8llx, size = %zu, buf = %p) => %zu bytes written", (uint64_t)addr, size, buf, n);
+        DNBLogThreadedIf(LOG_MEMORY, "MachTask::WriteMemory ( addr = 0x%8.8llx, size = %llu, buf = %p) => %llu bytes written", (uint64_t)addr, (uint64_t)size, buf, (uint64_t)n);
         if (DNBLogCheckLogBit(LOG_MEMORY_DATA_LONG) || (DNBLogCheckLogBit(LOG_MEMORY_DATA_SHORT) && size <= 8))
         {
             DNBDataRef data((uint8_t*)buf, n, false);
@@ -224,6 +227,236 @@ MachTask::GetMemoryRegionInfo (nub_addr_
     return ret;
 }
 
+#define TIME_VALUE_TO_TIMEVAL(a, r) do {        \
+(r)->tv_sec = (a)->seconds;                     \
+(r)->tv_usec = (a)->microseconds;               \
+} while (0)
+
+// We should consider moving this into each MacThread.
+static void get_threads_profile_data(DNBProfileDataScanType scanType, task_t task, nub_process_t pid, std::vector<uint64_t> &threads_id, std::vector<std::string> &threads_name, std::vector<uint64_t> &threads_used_usec)
+{
+    kern_return_t kr;
+    thread_act_array_t threads;
+    mach_msg_type_number_t tcnt;
+    
+    kr = task_threads(task, &threads, &tcnt);
+    if (kr != KERN_SUCCESS)
+        return;
+    
+    for (int i = 0; i < tcnt; i++)
+    {
+        thread_identifier_info_data_t identifier_info;
+        mach_msg_type_number_t count = THREAD_IDENTIFIER_INFO_COUNT;
+        kr = ::thread_info(threads[i], THREAD_IDENTIFIER_INFO, (thread_info_t)&identifier_info, &count);
+        if (kr != KERN_SUCCESS) continue;
+        
+        thread_basic_info_data_t basic_info;
+        count = THREAD_BASIC_INFO_COUNT;
+        kr = ::thread_info(threads[i], THREAD_BASIC_INFO, (thread_info_t)&basic_info, &count);
+        if (kr != KERN_SUCCESS) continue;
+
+        if ((basic_info.flags & TH_FLAGS_IDLE) == 0)
+        {
+            nub_thread_t tid = MachThread::GetGloballyUniqueThreadIDForMachPortID (threads[i]);
+            threads_id.push_back(tid);
+            
+            if ((scanType & eProfileThreadName) && (identifier_info.thread_handle != 0))
+            {
+                struct proc_threadinfo proc_threadinfo;
+                int len = ::proc_pidinfo(pid, PROC_PIDTHREADINFO, identifier_info.thread_handle, &proc_threadinfo, PROC_PIDTHREADINFO_SIZE);
+                if (len && proc_threadinfo.pth_name[0])
+                {
+                    threads_name.push_back(proc_threadinfo.pth_name);
+                }
+                else
+                {
+                    threads_name.push_back("");
+                }
+            }
+            else
+            {
+                threads_name.push_back("");
+            }
+            struct timeval tv;
+            struct timeval thread_tv;
+            TIME_VALUE_TO_TIMEVAL(&basic_info.user_time, &thread_tv);
+            TIME_VALUE_TO_TIMEVAL(&basic_info.system_time, &tv);
+            timeradd(&thread_tv, &tv, &thread_tv);
+            uint64_t used_usec = thread_tv.tv_sec * 1000000ULL + thread_tv.tv_usec;
+            threads_used_usec.push_back(used_usec);
+        }
+        
+        kr = mach_port_deallocate(mach_task_self(), threads[i]);
+    }
+    kr = mach_vm_deallocate(mach_task_self(), (mach_vm_address_t)(uintptr_t)threads, tcnt * sizeof(*threads));
+}
+
+#define RAW_HEXBASE     std::setfill('0') << std::hex << std::right
+#define DECIMAL         std::dec << std::setfill(' ')
+std::string
+MachTask::GetProfileData (DNBProfileDataScanType scanType)
+{
+    std::string result;
+    
+    static int32_t numCPU = -1;
+    struct host_cpu_load_info host_info;
+    if (scanType & eProfileHostCPU)
+    {
+        int32_t mib[] = {CTL_HW, HW_AVAILCPU};
+        size_t len = sizeof(numCPU);
+        if (numCPU == -1)
+        {
+            if (sysctl(mib, sizeof(mib) / sizeof(int32_t), &numCPU, &len, NULL, 0) != 0)
+                return result;
+        }
+        
+        mach_port_t localHost = mach_host_self();
+        mach_msg_type_number_t count = HOST_CPU_LOAD_INFO_COUNT;
+        kern_return_t kr = host_statistics(localHost, HOST_CPU_LOAD_INFO, (host_info_t)&host_info, &count);
+        if (kr != KERN_SUCCESS)
+            return result;
+    }
+    
+    task_t task = TaskPort();
+    if (task == TASK_NULL)
+        return result;
+    
+    struct task_basic_info task_info;
+    DNBError err;
+    err = BasicInfo(task, &task_info);
+    
+    if (!err.Success())
+        return result;
+    
+    uint64_t elapsed_usec = 0;
+    uint64_t task_used_usec = 0;
+    if (scanType & eProfileCPU)
+    {
+        // Get current used time.
+        struct timeval current_used_time;
+        struct timeval tv;
+        TIME_VALUE_TO_TIMEVAL(&task_info.user_time, &current_used_time);
+        TIME_VALUE_TO_TIMEVAL(&task_info.system_time, &tv);
+        timeradd(&current_used_time, &tv, &current_used_time);
+        task_used_usec = current_used_time.tv_sec * 1000000ULL + current_used_time.tv_usec;
+        
+        struct timeval current_elapsed_time;
+        int res = gettimeofday(&current_elapsed_time, NULL);
+        if (res == 0)
+        {
+            elapsed_usec = current_elapsed_time.tv_sec * 1000000ULL + current_elapsed_time.tv_usec;
+        }
+    }
+    
+    std::vector<uint64_t> threads_id;
+    std::vector<std::string> threads_name;
+    std::vector<uint64_t> threads_used_usec;
+
+    if (scanType & eProfileThreadsCPU)
+    {
+        get_threads_profile_data(scanType, task, m_process->ProcessID(), threads_id, threads_name, threads_used_usec);
+    }
+    
+    struct vm_statistics vm_stats;
+    uint64_t physical_memory;
+    mach_vm_size_t rprvt = 0;
+    mach_vm_size_t rsize = 0;
+    mach_vm_size_t vprvt = 0;
+    mach_vm_size_t vsize = 0;
+    mach_vm_size_t dirty_size = 0;
+    mach_vm_size_t purgeable = 0;
+    mach_vm_size_t anonymous = 0;
+    if (m_vm_memory.GetMemoryProfile(scanType, task, task_info, m_process->GetCPUType(), m_process->ProcessID(), vm_stats, physical_memory, rprvt, rsize, vprvt, vsize, dirty_size, purgeable, anonymous))
+    {
+        std::ostringstream profile_data_stream;
+        
+        if (scanType & eProfileHostCPU)
+        {
+            profile_data_stream << "num_cpu:" << numCPU << ';';
+            profile_data_stream << "host_user_ticks:" << host_info.cpu_ticks[CPU_STATE_USER] << ';';
+            profile_data_stream << "host_sys_ticks:" << host_info.cpu_ticks[CPU_STATE_SYSTEM] << ';';
+            profile_data_stream << "host_idle_ticks:" << host_info.cpu_ticks[CPU_STATE_IDLE] << ';';
+        }
+        
+        if (scanType & eProfileCPU)
+        {
+            profile_data_stream << "elapsed_usec:" << elapsed_usec << ';';
+            profile_data_stream << "task_used_usec:" << task_used_usec << ';';
+        }
+        
+        if (scanType & eProfileThreadsCPU)
+        {
+            int num_threads = threads_id.size();
+            for (int i=0; i<num_threads; i++)
+            {
+                profile_data_stream << "thread_used_id:" << std::hex << threads_id[i] << std::dec << ';';
+                profile_data_stream << "thread_used_usec:" << threads_used_usec[i] << ';';
+                
+                if (scanType & eProfileThreadName)
+                {
+                    profile_data_stream << "thread_used_name:";
+                    int len = threads_name[i].size();
+                    if (len)
+                    {
+                        const char *thread_name = threads_name[i].c_str();
+                        // Make sure that thread name doesn't interfere with our delimiter.
+                        profile_data_stream << RAW_HEXBASE << std::setw(2);
+                        const uint8_t *ubuf8 = (const uint8_t *)(thread_name);
+                        for (int j=0; j<len; j++)
+                        {
+                            profile_data_stream << (uint32_t)(ubuf8[j]);
+                        }
+                        // Reset back to DECIMAL.
+                        profile_data_stream << DECIMAL;
+                    }
+                    profile_data_stream << ';';
+                }
+            }
+        }
+        
+        if (scanType & eProfileHostMemory)
+            profile_data_stream << "total:" << physical_memory << ';';
+        
+        if (scanType & eProfileMemory)
+        {
+            static vm_size_t pagesize;
+            static bool calculated = false;
+            if (!calculated)
+            {
+                calculated = true;
+                pagesize = PageSize();
+            }
+            
+            profile_data_stream << "wired:" << vm_stats.wire_count * pagesize << ';';
+            profile_data_stream << "active:" << vm_stats.active_count * pagesize << ';';
+            profile_data_stream << "inactive:" << vm_stats.inactive_count * pagesize << ';';
+            uint64_t total_used_count = vm_stats.wire_count + vm_stats.inactive_count + vm_stats.active_count;
+            profile_data_stream << "used:" << total_used_count * pagesize << ';';
+            profile_data_stream << "free:" << vm_stats.free_count * pagesize << ';';
+            
+            profile_data_stream << "rprvt:" << rprvt << ';';
+            profile_data_stream << "rsize:" << rsize << ';';
+            profile_data_stream << "vprvt:" << vprvt << ';';
+            profile_data_stream << "vsize:" << vsize << ';';
+            
+            if (scanType & eProfileMemoryDirtyPage)
+                profile_data_stream << "dirty:" << dirty_size << ';';
+
+            if (scanType & eProfileMemoryAnonymous)
+            {
+                profile_data_stream << "purgeable:" << purgeable << ';';
+                profile_data_stream << "anonymous:" << anonymous << ';';
+            }
+        }
+        
+        profile_data_stream << "--end--;";
+        
+        result = profile_data_stream.str();
+    }
+    
+    return result;
+}
+
 
 //----------------------------------------------------------------------
 // MachTask::TaskPortForProcessID
@@ -242,14 +475,14 @@ MachTask::TaskPortForProcessID (DNBError
 task_t
 MachTask::TaskPortForProcessID (pid_t pid, DNBError &err, uint32_t num_retries, uint32_t usec_interval)
 {
-	if (pid != INVALID_NUB_PROCESS)
-	{
-		DNBError err;
-		mach_port_t task_self = mach_task_self ();	
-		task_t task = TASK_NULL;
-		for (uint32_t i=0; i<num_retries; i++)
-		{	
-			err = ::task_for_pid ( task_self, pid, &task);
+    if (pid != INVALID_NUB_PROCESS)
+    {
+        DNBError err;
+        mach_port_t task_self = mach_task_self ();  
+        task_t task = TASK_NULL;
+        for (uint32_t i=0; i<num_retries; i++)
+        {   
+            err = ::task_for_pid ( task_self, pid, &task);
 
             if (DNBLogCheckLogBit(LOG_TASK) || err.Fail())
             {
@@ -266,14 +499,14 @@ MachTask::TaskPortForProcessID (pid_t pi
                 err.LogThreaded(str);
             }
 
-			if (err.Success())
-				return task;
+            if (err.Success())
+                return task;
 
-			// Sleep a bit and try again
-			::usleep (usec_interval);
-		}
-	}
-	return TASK_NULL;
+            // Sleep a bit and try again
+            ::usleep (usec_interval);
+        }
+    }
+    return TASK_NULL;
 }
 
 
@@ -798,7 +1031,13 @@ MachTask::EnumerateMallocFrames (MachMal
     
     __mach_stack_logging_frames_for_uniqued_stack(m_task, event_id, &function_addresses_buffer[0], buffer_size, count);
     *count -= 1;
-    if (function_addresses_buffer[*count-1] < vm_page_size)
+    if (function_addresses_buffer[*count-1] < PageSize())
         *count -= 1;
     return (*count > 0);
 }
+
+nub_size_t
+MachTask::PageSize ()
+{
+    return m_vm_memory.PageSize (m_task);
+}

Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachTask.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachTask.h?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachTask.h (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachTask.h Thu Jun  6 19:06:43 2013
@@ -23,8 +23,10 @@
 #include <sys/socket.h>
 // C++ Includes
 #include <map>
+#include <string>
 // Other libraries and framework includes
 // Project includes
+#include "DNBDefs.h"
 #include "MachException.h"
 #include "MachVMMemory.h"
 #include "PThreadMutex.h"
@@ -65,6 +67,7 @@ public:
             nub_size_t      ReadMemory (nub_addr_t addr, nub_size_t size, void *buf);
             nub_size_t      WriteMemory (nub_addr_t addr, nub_size_t size, const void *buf);
             int             GetMemoryRegionInfo (nub_addr_t addr, DNBRegionInfo *region_info);
+            std::string     GetProfileData (DNBProfileDataScanType scanType);
 
             nub_addr_t      AllocateMemory (nub_size_t size, uint32_t permissions);
             nub_bool_t      DeallocateMemory (nub_addr_t addr);
@@ -89,6 +92,7 @@ public:
             MachProcess *   Process () { return m_process; }
     const   MachProcess *   Process () const { return m_process; }
     
+            nub_size_t      PageSize ();
     
             bool            HasMallocLoggingEnabled ();
 

Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThread.cpp?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThread.cpp (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThread.cpp Thu Jun  6 19:06:43 2013
@@ -11,6 +11,7 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include <inttypes.h>
 #include "MachThread.h"
 #include "MachProcess.h"
 #include "DNBLog.h"
@@ -23,9 +24,10 @@ GetSequenceID()
     return ++g_nextID;
 }
 
-MachThread::MachThread (MachProcess *process, thread_t tid) :
+MachThread::MachThread (MachProcess *process, uint64_t unique_thread_id, thread_t mach_port_num) :
     m_process (process),
-    m_tid (tid),
+    m_unique_id (unique_thread_id),
+    m_mach_port_number (mach_port_num),
     m_seq_id (GetSequenceID()),
     m_state (eStateUnloaded),
     m_state_mutex (PTHREAD_MUTEX_RECURSIVE),
@@ -34,12 +36,10 @@ MachThread::MachThread (MachProcess *pro
     m_stop_exception (),
     m_arch_ap (DNBArchProtocol::Create (this)),
     m_reg_sets (NULL),
-    m_num_reg_sets (0)
-#ifdef THREAD_IDENTIFIER_INFO_COUNT
-    , m_ident_info(),
+    m_num_reg_sets (0), 
+    m_ident_info(),
     m_proc_threadinfo(),
     m_dispatch_queue_name()
-#endif
 {
     nub_size_t num_reg_sets = 0;
     m_reg_sets = m_arch_ap->GetRegisterSetInfo (&num_reg_sets);
@@ -49,12 +49,12 @@ MachThread::MachThread (MachProcess *pro
     // muck with it and also so we get the suspend count correct in case it was
     // already suspended
     GetBasicInfo();
-    DNBLogThreadedIf(LOG_THREAD | LOG_VERBOSE, "MachThread::MachThread ( process = %p, tid = 0x%4.4x, seq_id = %u )", &m_process, m_tid, m_seq_id);
+    DNBLogThreadedIf(LOG_THREAD | LOG_VERBOSE, "MachThread::MachThread ( process = %p, tid = 0x%8.8" PRIx64 ", seq_id = %u )", &m_process, m_unique_id, m_seq_id);
 }
 
 MachThread::~MachThread()
 {
-    DNBLogThreadedIf(LOG_THREAD | LOG_VERBOSE, "MachThread::~MachThread() for tid = 0x%4.4x (%u)", m_tid, m_seq_id);
+    DNBLogThreadedIf(LOG_THREAD | LOG_VERBOSE, "MachThread::~MachThread() for tid = 0x%8.8" PRIx64 " (%u)", m_unique_id, m_seq_id);
 }
 
 
@@ -63,13 +63,13 @@ void
 MachThread::Suspend()
 {
     DNBLogThreadedIf(LOG_THREAD | LOG_VERBOSE, "MachThread::%s ( )", __FUNCTION__);
-    if (ThreadIDIsValid(m_tid))
+    if (MachPortNumberIsValid(m_mach_port_number))
     {
-        DNBError err(::thread_suspend (m_tid), DNBError::MachKernel);
+        DNBError err(::thread_suspend (m_mach_port_number), DNBError::MachKernel);
         if (err.Success())
             m_suspend_count++;
         if (DNBLogCheckLogBit(LOG_THREAD) || err.Fail())
-            err.LogThreaded("::thread_suspend (%4.4x)", m_tid);
+            err.LogThreaded("::thread_suspend (%4.4" PRIx32 ")", m_mach_port_number);
     }
 }
 
@@ -77,7 +77,7 @@ void
 MachThread::Resume(bool others_stopped)
 {
     DNBLogThreadedIf(LOG_THREAD | LOG_VERBOSE, "MachThread::%s ( )", __FUNCTION__);
-    if (ThreadIDIsValid(m_tid))
+    if (MachPortNumberIsValid(m_mach_port_number))
     {
         SetSuspendCountBeforeResume(others_stopped);
     }
@@ -88,7 +88,7 @@ MachThread::SetSuspendCountBeforeResume(
 {
     DNBLogThreadedIf(LOG_THREAD | LOG_VERBOSE, "MachThread::%s ( )", __FUNCTION__);
     DNBError err;
-    if (ThreadIDIsValid(m_tid) == false)
+    if (MachPortNumberIsValid(m_mach_port_number) == false)
         return false;
         
     size_t times_to_resume;
@@ -113,9 +113,9 @@ MachThread::SetSuspendCountBeforeResume(
     {
         while (times_to_resume > 0)
         {
-            err = ::thread_resume (m_tid);
+            err = ::thread_resume (m_mach_port_number);
             if (DNBLogCheckLogBit(LOG_THREAD) || err.Fail())
-                err.LogThreaded("::thread_resume (%4.4x)", m_tid);
+                err.LogThreaded("::thread_resume (%4.4" PRIx32 ")", m_mach_port_number);
             if (err.Success())
                 --times_to_resume;
             else
@@ -135,16 +135,16 @@ MachThread::RestoreSuspendCountAfterStop
 {
     DNBLogThreadedIf(LOG_THREAD | LOG_VERBOSE, "MachThread::%s ( )", __FUNCTION__);
     DNBError err;
-    if (ThreadIDIsValid(m_tid) == false)
+    if (MachPortNumberIsValid(m_mach_port_number) == false)
         return false;
         
     if (m_suspend_count > 0)
     {
         while (m_suspend_count > 0)
         {
-            err = ::thread_resume (m_tid);
+            err = ::thread_resume (m_mach_port_number);
             if (DNBLogCheckLogBit(LOG_THREAD) || err.Fail())
-                err.LogThreaded("::thread_resume (%4.4x)", m_tid);
+                err.LogThreaded("::thread_resume (%4.4" PRIx32 ")", m_mach_port_number);
             if (err.Success())
                 --m_suspend_count;
             else
@@ -161,12 +161,12 @@ MachThread::RestoreSuspendCountAfterStop
     {
         while (m_suspend_count < 0)
         {
-            err = ::thread_suspend (m_tid);
+            err = ::thread_suspend (m_mach_port_number);
             if (err.Success())
                 ++m_suspend_count;
             if (DNBLogCheckLogBit(LOG_THREAD) || err.Fail())
             {
-                err.LogThreaded("::thread_suspend (%4.4x)", m_tid);
+                err.LogThreaded("::thread_suspend (%4.4" PRIx32 ")", m_mach_port_number);
                 return false;
             }
         }
@@ -181,7 +181,7 @@ MachThread::GetBasicInfoAsString () cons
     static char g_basic_info_string[1024];
     struct thread_basic_info basicInfo;
 
-    if (GetBasicInfo(m_tid, &basicInfo))
+    if (GetBasicInfo(m_mach_port_number, &basicInfo))
     {
 
 //        char run_state_str[32];
@@ -197,8 +197,8 @@ MachThread::GetBasicInfoAsString () cons
 //        }
         float user = (float)basicInfo.user_time.seconds + (float)basicInfo.user_time.microseconds / 1000000.0f;
         float system = (float)basicInfo.user_time.seconds + (float)basicInfo.user_time.microseconds / 1000000.0f;
-        snprintf(g_basic_info_string, sizeof(g_basic_info_string), "Thread 0x%4.4x: user=%f system=%f cpu=%d sleep_time=%d",
-            InferiorThreadID(),
+        snprintf(g_basic_info_string, sizeof(g_basic_info_string), "Thread 0x%8.8" PRIx64 ": user=%f system=%f cpu=%d sleep_time=%d",
+            m_unique_id,
             user,
             system,
             basicInfo.cpu_usage,
@@ -209,6 +209,7 @@ MachThread::GetBasicInfoAsString () cons
     return NULL;
 }
 
+// Finds the Mach port number for a given thread in the inferior process' port namespace.
 thread_t
 MachThread::InferiorThreadID() const
 {
@@ -233,7 +234,7 @@ MachThread::InferiorThreadID() const
             if (kret == KERN_SUCCESS)
             {
                 ::mach_port_deallocate (my_task, my_name);
-                if (my_name == m_tid)
+                if (my_name == m_mach_port_number)
                 {
                     inferior_tid = names[i];
                     break;
@@ -271,7 +272,7 @@ MachThread::IsUserReady()
 struct thread_basic_info *
 MachThread::GetBasicInfo ()
 {
-    if (MachThread::GetBasicInfo(m_tid, &m_basic_info))
+    if (MachThread::GetBasicInfo(m_mach_port_number, &m_basic_info))
         return &m_basic_info;
     return NULL;
 }
@@ -280,7 +281,7 @@ MachThread::GetBasicInfo ()
 bool
 MachThread::GetBasicInfo(thread_t thread, struct thread_basic_info *basicInfoPtr)
 {
-    if (ThreadIDIsValid(thread))
+    if (MachPortNumberIsValid(thread))
     {
         unsigned int info_count = THREAD_BASIC_INFO_COUNT;
         kern_return_t err = ::thread_info (thread, THREAD_BASIC_INFO, (thread_info_t) basicInfoPtr, &info_count);
@@ -293,7 +294,13 @@ MachThread::GetBasicInfo(thread_t thread
 
 
 bool
-MachThread::ThreadIDIsValid(thread_t thread)
+MachThread::ThreadIDIsValid(uint64_t thread)
+{
+    return thread != 0;
+}
+
+bool
+MachThread::MachPortNumberIsValid(thread_t thread)
 {
     return thread != THREAD_NULL;
 }
@@ -354,10 +361,10 @@ MachThread::Dump(uint32_t index)
     default:                        thread_run_state = "???"; break;
     }
 
-    DNBLogThreaded("[%3u] #%3u tid: 0x%4.4x, pc: 0x%16.16llx, sp: 0x%16.16llx, breakID: %3d, user: %d.%6.6d, system: %d.%6.6d, cpu: %2d, policy: %2d, run_state: %2d (%s), flags: %2d, suspend_count: %2d (current %2d), sleep_time: %d",
+    DNBLogThreaded("[%3u] #%3u tid: 0x%8.8" PRIx64 ", pc: 0x%16.16" PRIx64 ", sp: 0x%16.16" PRIx64 ", breakID: %3d, user: %d.%6.6d, system: %d.%6.6d, cpu: %2d, policy: %2d, run_state: %2d (%s), flags: %2d, suspend_count: %2d (current %2d), sleep_time: %d",
         index,
         m_seq_id,
-        m_tid,
+        m_unique_id,
         GetPC(INVALID_NUB_ADDRESS),
         GetSP(INVALID_NUB_ADDRESS),
         m_break_id,
@@ -498,7 +505,7 @@ MachThread::ThreadDidStop()
     RestoreSuspendCountAfterStop();
 
     // Update the basic information for a thread
-    MachThread::GetBasicInfo(m_tid, &m_basic_info);
+    MachThread::GetBasicInfo(m_mach_port_number, &m_basic_info);
 
 #if ENABLE_AUTO_STEPPING_OVER_BP
     // See if we were at a breakpoint when we last resumed that we disabled,
@@ -588,7 +595,7 @@ MachThread::SetState(nub_state_t state)
 {
     PTHREAD_MUTEX_LOCKER (locker, m_state_mutex);
     m_state = state;
-    DNBLogThreadedIf(LOG_THREAD, "MachThread::SetState ( %s ) for tid = 0x%4.4x", DNBStateAsString(state), m_tid);
+    DNBLogThreadedIf(LOG_THREAD, "MachThread::SetState ( %s ) for tid = 0x%8.8" PRIx64 "", DNBStateAsString(state), m_unique_id);
 }
 
 uint32_t
@@ -736,13 +743,11 @@ MachThread::NumSupportedHardwareWatchpoi
 bool
 MachThread::GetIdentifierInfo ()
 {
-#ifdef THREAD_IDENTIFIER_INFO_COUNT
         // Don't try to get the thread info once and cache it for the life of the thread.  It changes over time, for instance
         // if the thread name changes, then the thread_handle also changes...  So you have to refetch it every time.
         mach_msg_type_number_t count = THREAD_IDENTIFIER_INFO_COUNT;
-        kern_return_t kret = ::thread_info (ThreadID(), THREAD_IDENTIFIER_INFO, (thread_info_t) &m_ident_info, &count);
+        kern_return_t kret = ::thread_info (m_mach_port_number, THREAD_IDENTIFIER_INFO, (thread_info_t) &m_ident_info, &count);
         return kret == KERN_SUCCESS;
-#endif
 
     return false;
 }
@@ -761,3 +766,18 @@ MachThread::GetName ()
     return NULL;
 }
 
+
+uint64_t 
+MachThread::GetGloballyUniqueThreadIDForMachPortID (thread_t mach_port_id)
+{
+    kern_return_t kr;
+    thread_identifier_info_data_t tident;
+    mach_msg_type_number_t tident_count = THREAD_IDENTIFIER_INFO_COUNT;
+    kr = thread_info (mach_port_id, THREAD_IDENTIFIER_INFO,
+                      (thread_info_t) &tident, &tident_count);
+    if (kr != KERN_SUCCESS)
+    {
+        return mach_port_id;
+    }
+    return tident.thread_id;
+}

Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThread.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThread.h?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThread.h (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThread.h Thu Jun  6 19:06:43 2013
@@ -36,7 +36,7 @@ class MachThread
 {
 public:
 
-                    MachThread (MachProcess *process, thread_t thread = 0);
+                    MachThread (MachProcess *process, uint64_t unique_thread_id = 0, thread_t mach_port_number = 0);
                     ~MachThread ();
 
     MachProcess *   Process() { return m_process; }
@@ -44,11 +44,13 @@ public:
                     Process() const { return m_process; }
     nub_process_t   ProcessID() const;
     void            Dump(uint32_t index);
-    thread_t        ThreadID() const { return m_tid; }
+    uint64_t        ThreadID() const { return m_unique_id; }
+    thread_t        MachPortNumber() const { return m_mach_port_number; }
     thread_t        InferiorThreadID() const;
 
     uint32_t        SequenceID() const { return m_seq_id; }
-    static bool     ThreadIDIsValid(thread_t thread);
+    static bool     ThreadIDIsValid(uint64_t thread);       // The 64-bit system-wide unique thread identifier
+    static bool     MachPortNumberIsValid(thread_t thread); // The mach port # for this thread in debugserver namespace
     void            Resume(bool others_stopped);
     void            Suspend();
     bool            SetSuspendCountBeforeResume(bool others_stopped);
@@ -106,6 +108,8 @@ public:
         return m_arch_ap.get();
     }
 
+    static uint64_t GetGloballyUniqueThreadIDForMachPortID (thread_t mach_port_id);
+
 protected:
     static bool     GetBasicInfo(thread_t threadID, struct thread_basic_info *basic_info);
 
@@ -116,7 +120,8 @@ protected:
 //    GetDispatchQueueName();
 //
     MachProcess *                   m_process;      // The process that owns this thread
-    thread_t                        m_tid;          // The thread port for this thread
+    uint64_t                        m_unique_id;    // The globally unique ID for this thread (nub_thread_t)
+    thread_t                        m_mach_port_number;  // The mach port # for this thread in debugserver namesp.
     uint32_t                        m_seq_id;       // A Sequential ID that increments with each new thread
     nub_state_t                     m_state;        // The state of our process
     PThreadMutex                    m_state_mutex;  // Multithreaded protection for m_state
@@ -125,20 +130,18 @@ protected:
     int32_t                         m_suspend_count; // The current suspend count > 0 means we have suspended m_suspendCount times,
                                                     //                           < 0 means we have resumed it m_suspendCount times.
     MachException::Data             m_stop_exception; // The best exception that describes why this thread is stopped
-    std::auto_ptr<DNBArchProtocol>  m_arch_ap;      // Arch specific information for register state and more
+    std::unique_ptr<DNBArchProtocol> m_arch_ap;      // Arch specific information for register state and more
     const DNBRegisterSetInfo *      m_reg_sets;      // Register set information for this thread
     nub_size_t                      m_num_reg_sets;
-#ifdef THREAD_IDENTIFIER_INFO_COUNT
     thread_identifier_info_data_t   m_ident_info;
     struct proc_threadinfo          m_proc_threadinfo;
     std::string                     m_dispatch_queue_name;
-#endif
 
 private:
     friend class MachThreadList;
     void HardwareWatchpointStateChanged(); // Provide a chance to update the global view of the hardware watchpoint state
 };
 
-typedef STD_SHARED_PTR(MachThread) MachThreadSP;
+typedef std::shared_ptr<MachThread> MachThreadSP;
 
 #endif

Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThreadList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThreadList.cpp?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThreadList.cpp (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThreadList.cpp Thu Jun  6 19:06:43 2013
@@ -13,6 +13,7 @@
 
 #include "MachThreadList.h"
 
+#include <inttypes.h>
 #include <sys/sysctl.h>
 
 #include "DNBLog.h"
@@ -30,7 +31,7 @@ MachThreadList::~MachThreadList()
 }
 
 nub_state_t
-MachThreadList::GetState(thread_t tid)
+MachThreadList::GetState(nub_thread_t tid)
 {
     MachThreadSP thread_sp (GetThreadByID (tid));
     if (thread_sp)
@@ -39,7 +40,7 @@ MachThreadList::GetState(thread_t tid)
 }
 
 const char *
-MachThreadList::GetName (thread_t tid)
+MachThreadList::GetName (nub_thread_t tid)
 {
     MachThreadSP thread_sp (GetThreadByID (tid));
     if (thread_sp)
@@ -48,7 +49,7 @@ MachThreadList::GetName (thread_t tid)
 }
 
 nub_thread_t
-MachThreadList::SetCurrentThread(thread_t tid)
+MachThreadList::SetCurrentThread(nub_thread_t tid)
 {
     MachThreadSP thread_sp (GetThreadByID (tid));
     if (thread_sp)
@@ -72,8 +73,10 @@ MachThreadList::GetThreadStoppedReason(n
 bool
 MachThreadList::GetIdentifierInfo (nub_thread_t tid, thread_identifier_info_data_t *ident_info)
 {
+    thread_t mach_port_number = GetMachPortNumberByThreadID (tid);
+
     mach_msg_type_number_t count = THREAD_IDENTIFIER_INFO_COUNT;
-    return ::thread_info (tid, THREAD_IDENTIFIER_INFO, (thread_info_t)ident_info, &count) == KERN_SUCCESS;
+    return ::thread_info (mach_port_number, THREAD_IDENTIFIER_INFO, (thread_info_t)ident_info, &count) == KERN_SUCCESS;
 }
 
 void
@@ -110,8 +113,57 @@ MachThreadList::GetThreadByID (nub_threa
     return thread_sp;
 }
 
+MachThreadSP
+MachThreadList::GetThreadByMachPortNumber (thread_t mach_port_number) const
+{
+    PTHREAD_MUTEX_LOCKER (locker, m_threads_mutex);
+    MachThreadSP thread_sp;
+    const size_t num_threads = m_threads.size();
+    for (size_t idx = 0; idx < num_threads; ++idx)
+    {
+        if (m_threads[idx]->MachPortNumber() == mach_port_number)
+        {
+            thread_sp = m_threads[idx];
+            break;
+        }
+    }
+    return thread_sp;
+}
+
+nub_thread_t
+MachThreadList::GetThreadIDByMachPortNumber (thread_t mach_port_number) const
+{
+    PTHREAD_MUTEX_LOCKER (locker, m_threads_mutex);
+    MachThreadSP thread_sp;
+    const size_t num_threads = m_threads.size();
+    for (size_t idx = 0; idx < num_threads; ++idx)
+    {
+        if (m_threads[idx]->MachPortNumber() == mach_port_number)
+        {
+            return m_threads[idx]->ThreadID();
+        }
+    }
+    return INVALID_NUB_THREAD;
+}
+
+thread_t
+MachThreadList::GetMachPortNumberByThreadID (nub_thread_t globally_unique_id) const
+{
+    PTHREAD_MUTEX_LOCKER (locker, m_threads_mutex);
+    MachThreadSP thread_sp;
+    const size_t num_threads = m_threads.size();
+    for (size_t idx = 0; idx < num_threads; ++idx)
+    {
+        if (m_threads[idx]->ThreadID() == globally_unique_id)
+        {
+            return m_threads[idx]->MachPortNumber();
+        }
+    }
+    return 0;
+}
+
 bool
-MachThreadList::GetRegisterValue ( nub_thread_t tid, uint32_t reg_set_idx, uint32_t reg_idx, DNBRegisterValue *reg_value ) const
+MachThreadList::GetRegisterValue (nub_thread_t tid, uint32_t reg_set_idx, uint32_t reg_idx, DNBRegisterValue *reg_value ) const
 {
     MachThreadSP thread_sp (GetThreadByID (tid));
     if (thread_sp)
@@ -121,7 +173,7 @@ MachThreadList::GetRegisterValue ( nub_t
 }
 
 bool
-MachThreadList::SetRegisterValue ( nub_thread_t tid, uint32_t reg_set_idx, uint32_t reg_idx, const DNBRegisterValue *reg_value ) const
+MachThreadList::SetRegisterValue (nub_thread_t tid, uint32_t reg_set_idx, uint32_t reg_idx, const DNBRegisterValue *reg_value ) const
 {
     MachThreadSP thread_sp (GetThreadByID (tid));
     if (thread_sp)
@@ -177,7 +229,7 @@ MachThreadList::CurrentThreadID ( )
 bool
 MachThreadList::NotifyException(MachException::Data& exc)
 {
-    MachThreadSP thread_sp (GetThreadByID (exc.thread_port));
+    MachThreadSP thread_sp (GetThreadByMachPortNumber (exc.thread_port));
     if (thread_sp)
     {
         thread_sp->NotifyException(exc);
@@ -238,9 +290,10 @@ MachThreadList::UpdateThreadList(MachPro
             // (add them), and which ones are not around anymore (remove them).
             for (idx = 0; idx < thread_list_count; ++idx)
             {
-                const thread_t tid = thread_list[idx];
+                const thread_t mach_port_num = thread_list[idx];
                 
-                MachThreadSP thread_sp (GetThreadByID (tid));
+                uint64_t unique_thread_id = MachThread::GetGloballyUniqueThreadIDForMachPortID (mach_port_num);
+                MachThreadSP thread_sp (GetThreadByID (unique_thread_id));
                 if (thread_sp)
                 {
                     // Keep the existing thread class
@@ -249,7 +302,7 @@ MachThreadList::UpdateThreadList(MachPro
                 else
                 {
                     // We don't have this thread, lets add it.
-                    thread_sp.reset(new MachThread(process, tid));
+                    thread_sp.reset(new MachThread(process, unique_thread_id, mach_port_num));
 
                     // Add the new thread regardless of its is user ready state...
                     // Make sure the thread is ready to be displayed and shown to users
@@ -382,7 +435,7 @@ MachThreadList::ProcessWillResume(MachPr
     {
         for (uint32_t idx = 0; idx < num_new_threads; ++idx)
         {
-            DNBLogThreadedIf (LOG_THREAD, "MachThreadList::ProcessWillResume (pid = %4.4x) stop-id=%u, resuming newly discovered thread: 0x%4.4x, thread-is-user-ready=%i)", 
+            DNBLogThreadedIf (LOG_THREAD, "MachThreadList::ProcessWillResume (pid = %4.4x) stop-id=%u, resuming newly discovered thread: 0x%8.8" PRIx64 ", thread-is-user-ready=%i)",
                               process->ProcessID(), 
                               process->StopCount(), 
                               new_threads[idx]->ThreadID(),

Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThreadList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThreadList.h?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThreadList.h (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThreadList.h Thu Jun  6 19:06:43 2013
@@ -35,9 +35,9 @@ public:
     uint32_t        ProcessDidStop (MachProcess *process);
     bool            NotifyException (MachException::Data& exc);
     bool            ShouldStop (bool &step_more);
-    const char *    GetName (thread_t tid);
-    nub_state_t     GetState (thread_t tid);
-    nub_thread_t    SetCurrentThread (thread_t tid);
+    const char *    GetName (nub_thread_t tid);
+    nub_state_t     GetState (nub_thread_t tid);
+    nub_thread_t    SetCurrentThread (nub_thread_t tid);
     bool            GetThreadStoppedReason (nub_thread_t tid, struct DNBThreadStopInfo *stop_info) const;
     void            DumpThreadStoppedReason (nub_thread_t tid) const;
     bool            GetIdentifierInfo (nub_thread_t tid, thread_identifier_info_data_t *ident_info);
@@ -56,6 +56,10 @@ public:
 
     MachThreadSP    GetThreadByID (nub_thread_t tid) const;
 
+    MachThreadSP    GetThreadByMachPortNumber (thread_t mach_port_number) const;
+    nub_thread_t    GetThreadIDByMachPortNumber (thread_t mach_port_number) const;
+    thread_t        GetMachPortNumberByThreadID (nub_thread_t globally_unique_id) const;
+
 protected:
     typedef std::vector<MachThreadSP>   collection;
     typedef collection::iterator        iterator;

Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachVMMemory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachVMMemory.cpp?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachVMMemory.cpp (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachVMMemory.cpp Thu Jun  6 19:06:43 2013
@@ -15,6 +15,9 @@
 #include "MachVMRegion.h"
 #include "DNBLog.h"
 #include <mach/mach_vm.h>
+#include <mach/shared_region.h>
+#include <sys/sysctl.h>
+#include <dlfcn.h>
 
 MachVMMemory::MachVMMemory() :
     m_page_size    (kInvalidPageSize),
@@ -27,10 +30,29 @@ MachVMMemory::~MachVMMemory()
 }
 
 nub_size_t
-MachVMMemory::PageSize()
+MachVMMemory::PageSize(task_t task)
 {
     if (m_page_size == kInvalidPageSize)
     {
+#if defined (TASK_VM_INFO) && TASK_VM_INFO >= 22
+        if (task != TASK_NULL)
+        {
+            kern_return_t kr;
+            mach_msg_type_number_t info_count = TASK_VM_INFO_COUNT;
+            task_vm_info_data_t vm_info;
+            kr = task_info (task, TASK_VM_INFO, (task_info_t) &vm_info, &info_count);
+            if (kr == KERN_SUCCESS)
+            {
+                DNBLogThreadedIf(LOG_TASK, "MachVMMemory::PageSize task_info returned page size of 0x%x", (int) vm_info.page_size);
+                m_page_size = vm_info.page_size;
+                return m_page_size;
+            }
+            else
+            {
+                DNBLogThreadedIf(LOG_TASK, "MachVMMemory::PageSize task_info call failed to get page size, TASK_VM_INFO %d, TASK_VM_INFO_COUNT %d, kern return %d", TASK_VM_INFO, TASK_VM_INFO_COUNT, kr);
+            }
+        }
+#endif
         m_err = ::host_page_size( ::mach_host_self(), &m_page_size);
         if (m_err.Fail())
             m_page_size = 0;
@@ -39,9 +61,9 @@ MachVMMemory::PageSize()
 }
 
 nub_size_t
-MachVMMemory::MaxBytesLeftInPage(nub_addr_t addr, nub_size_t count)
+MachVMMemory::MaxBytesLeftInPage(task_t task, nub_addr_t addr, nub_size_t count)
 {
-    const nub_size_t page_size = PageSize();
+    const nub_size_t page_size = PageSize(task);
     if (page_size > 0)
     {
         nub_size_t page_offset = (addr % page_size);
@@ -88,6 +110,410 @@ MachVMMemory::GetMemoryRegionInfo(task_t
     return true;
 }
 
+// For integrated graphics chip, this makes the accounting info for 'wired' memory more like top.
+uint64_t 
+MachVMMemory::GetStolenPages(task_t task)
+{
+    static uint64_t stolenPages = 0;
+    static bool calculated = false;
+    if (calculated) return stolenPages;
+
+	static int mib_reserved[CTL_MAXNAME];
+	static int mib_unusable[CTL_MAXNAME];
+	static int mib_other[CTL_MAXNAME];
+	static size_t mib_reserved_len = 0;
+	static size_t mib_unusable_len = 0;
+	static size_t mib_other_len = 0;
+	int r;	
+    
+	/* This can be used for testing: */
+	//tsamp->pages_stolen = (256 * 1024 * 1024ULL) / tsamp->pagesize;
+    
+	if(0 == mib_reserved_len)
+    {
+		mib_reserved_len = CTL_MAXNAME;
+		
+		r = sysctlnametomib("machdep.memmap.Reserved", mib_reserved,
+                            &mib_reserved_len);
+        
+		if(-1 == r)
+        {
+			mib_reserved_len = 0;
+			return 0;
+		}
+        
+		mib_unusable_len = CTL_MAXNAME;
+        
+		r = sysctlnametomib("machdep.memmap.Unusable", mib_unusable,
+                            &mib_unusable_len);
+        
+		if(-1 == r)
+        {
+			mib_reserved_len = 0;
+			return 0;
+		}
+        
+        
+		mib_other_len = CTL_MAXNAME;
+		
+		r = sysctlnametomib("machdep.memmap.Other", mib_other,
+                            &mib_other_len);
+        
+		if(-1 == r)
+        {
+			mib_reserved_len = 0;
+			return 0;
+		}
+	}
+    
+	if(mib_reserved_len > 0 && mib_unusable_len > 0 && mib_other_len > 0)
+    {
+		uint64_t reserved = 0, unusable = 0, other = 0;
+		size_t reserved_len;
+		size_t unusable_len;
+		size_t other_len;
+		
+		reserved_len = sizeof(reserved);
+		unusable_len = sizeof(unusable);
+		other_len = sizeof(other);
+        
+		/* These are all declared as QUAD/uint64_t sysctls in the kernel. */
+        
+		if(-1 == sysctl(mib_reserved, mib_reserved_len, &reserved,
+                        &reserved_len, NULL, 0))
+        {
+			return 0;
+		}
+        
+		if(-1 == sysctl(mib_unusable, mib_unusable_len, &unusable,
+                        &unusable_len, NULL, 0))
+        {
+			return 0;
+		}
+        
+		if(-1 == sysctl(mib_other, mib_other_len, &other,
+                        &other_len, NULL, 0))
+        {
+			return 0;
+		}
+        
+		if(reserved_len == sizeof(reserved)
+		   && unusable_len == sizeof(unusable)
+		   && other_len == sizeof(other))
+        {
+			uint64_t stolen = reserved + unusable + other;	
+			uint64_t mb128 = 128 * 1024 * 1024ULL;
+            
+			if(stolen >= mb128)
+            {
+                stolen = (stolen & ~((128 * 1024 * 1024ULL) - 1)); // rounding down
+                stolenPages = stolen / PageSize (task);
+			}
+		}
+	}
+    
+    calculated = true;
+    return stolenPages;
+}
+
+static uint64_t GetPhysicalMemory()
+{
+    // This doesn't change often at all. No need to poll each time.
+    static uint64_t physical_memory = 0;
+    static bool calculated = false;
+    if (calculated) return physical_memory;
+    
+    int mib[2];
+    mib[0] = CTL_HW;
+    mib[1] = HW_MEMSIZE;
+    size_t len = sizeof(physical_memory);
+    sysctl(mib, 2, &physical_memory, &len, NULL, 0);
+    return physical_memory;
+}
+
+// rsize and dirty_size is not adjusted for dyld shared cache and multiple __LINKEDIT segment, as in vmmap. In practice, dirty_size doesn't differ much but rsize may. There is performance penalty for the adjustment. Right now, only use the dirty_size.
+void 
+MachVMMemory::GetRegionSizes(task_t task, mach_vm_size_t &rsize, mach_vm_size_t &dirty_size)
+{
+    mach_vm_address_t address = 0;
+    mach_vm_size_t size;
+    kern_return_t err = 0;
+    unsigned nestingDepth = 0;
+    mach_vm_size_t pages_resident = 0;
+    mach_vm_size_t pages_dirtied = 0;
+    
+    while (1)
+    {
+        mach_msg_type_number_t count;
+        struct vm_region_submap_info_64 info;
+        
+        count = VM_REGION_SUBMAP_INFO_COUNT_64;
+        err = mach_vm_region_recurse(task, &address, &size, &nestingDepth, (vm_region_info_t)&info, &count);
+        if (err == KERN_INVALID_ADDRESS)
+        {
+            // It seems like this is a good break too.
+            break;
+        }
+        else if (err)
+        {
+            mach_error("vm_region",err);
+            break; // reached last region
+        }
+        
+        bool should_count = true;
+        if (info.is_submap)
+        { // is it a submap?
+            nestingDepth++;
+            should_count = false;
+        }
+        else
+        {
+            // Don't count malloc stack logging data in the TOTAL VM usage lines.
+            if (info.user_tag == VM_MEMORY_ANALYSIS_TOOL)
+                should_count = false;
+            
+            address = address+size;
+        }
+        
+        if (should_count)
+        {
+            pages_resident += info.pages_resident;
+            pages_dirtied += info.pages_dirtied;
+        }
+    }
+    
+    vm_size_t pagesize = PageSize (task);
+    rsize = pages_resident * pagesize;
+    dirty_size = pages_dirtied * pagesize;
+}
+
+// Test whether the virtual address is within the architecture's shared region.
+static bool InSharedRegion(mach_vm_address_t addr, cpu_type_t type)
+{
+    mach_vm_address_t base = 0, size = 0;
+    
+    switch(type) {
+        case CPU_TYPE_ARM:
+            base = SHARED_REGION_BASE_ARM;
+            size = SHARED_REGION_SIZE_ARM;
+            break;
+            
+        case CPU_TYPE_X86_64:
+            base = SHARED_REGION_BASE_X86_64;
+            size = SHARED_REGION_SIZE_X86_64;
+            break;
+            
+        case CPU_TYPE_I386:
+            base = SHARED_REGION_BASE_I386;
+            size = SHARED_REGION_SIZE_I386;
+            break;
+            
+        default: {
+            // Log error abut unknown CPU type
+            break;
+        }
+    }
+    
+    
+    return(addr >= base && addr < (base + size));
+}
+
+void 
+MachVMMemory::GetMemorySizes(task_t task, cpu_type_t cputype, nub_process_t pid, mach_vm_size_t &rprvt, mach_vm_size_t &vprvt)
+{
+    // Collecting some other info cheaply but not reporting for now.
+    mach_vm_size_t empty = 0;
+    mach_vm_size_t fw_private = 0;
+    
+    mach_vm_size_t aliased = 0;
+    bool global_shared_text_data_mapped = false;
+    vm_size_t pagesize = PageSize (task);
+    
+    for (mach_vm_address_t addr=0, size=0; ; addr += size)
+    {
+        vm_region_top_info_data_t info;
+        mach_msg_type_number_t count = VM_REGION_TOP_INFO_COUNT;
+        mach_port_t object_name;
+        
+        kern_return_t kr = mach_vm_region(task, &addr, &size, VM_REGION_TOP_INFO, (vm_region_info_t)&info, &count, &object_name);
+        if (kr != KERN_SUCCESS) break;
+        
+        if (InSharedRegion(addr, cputype))
+        {
+            // Private Shared
+            fw_private += info.private_pages_resident * pagesize;
+            
+            // Check if this process has the globally shared text and data regions mapped in.  If so, set global_shared_text_data_mapped to TRUE and avoid checking again.
+            if (global_shared_text_data_mapped == FALSE && info.share_mode == SM_EMPTY) {
+                vm_region_basic_info_data_64_t b_info;
+                mach_vm_address_t b_addr = addr;
+                mach_vm_size_t b_size = size;
+                count = VM_REGION_BASIC_INFO_COUNT_64;
+                
+                kr = mach_vm_region(task, &b_addr, &b_size, VM_REGION_BASIC_INFO, (vm_region_info_t)&b_info, &count, &object_name);
+                if (kr != KERN_SUCCESS) break;
+                
+                if (b_info.reserved) {
+                    global_shared_text_data_mapped = TRUE;
+                }
+            }
+            
+            // Short circuit the loop if this isn't a shared private region, since that's the only region type we care about within the current address range.
+            if (info.share_mode != SM_PRIVATE)
+            {
+                continue;
+            }
+        }
+        
+        // Update counters according to the region type.
+        if (info.share_mode == SM_COW && info.ref_count == 1)
+        {
+            // Treat single reference SM_COW as SM_PRIVATE
+            info.share_mode = SM_PRIVATE;
+        }
+        
+        switch (info.share_mode)
+        {
+            case SM_LARGE_PAGE:
+                // Treat SM_LARGE_PAGE the same as SM_PRIVATE
+                // since they are not shareable and are wired.
+            case SM_PRIVATE:
+                rprvt += info.private_pages_resident * pagesize;
+                rprvt += info.shared_pages_resident * pagesize;
+                vprvt += size;
+                break;
+                
+            case SM_EMPTY:
+                empty += size;
+                break;
+                
+            case SM_COW:
+            case SM_SHARED:
+            {
+                if (pid == 0)
+                {
+                    // Treat kernel_task specially
+                    if (info.share_mode == SM_COW)
+                    {
+                        rprvt += info.private_pages_resident * pagesize;
+                        vprvt += size;
+                    }
+                    break;
+                }
+                
+                if (info.share_mode == SM_COW)
+                {
+                    rprvt += info.private_pages_resident * pagesize;
+                    vprvt += info.private_pages_resident * pagesize;
+                }
+                break;
+            }
+            default:
+                // log that something is really bad.
+                break;
+        }
+    }
+    
+    rprvt += aliased;
+}
+
+#if defined (TASK_VM_INFO) && TASK_VM_INFO >= 22
+
+// cribbed from sysmond
+static uint64_t
+SumVMPurgeableInfo(const vm_purgeable_info_t info)
+{
+    uint64_t sum = 0;
+    int i;
+    
+    for (i = 0; i < 8; i++)
+    {
+        sum += info->fifo_data[i].size;
+    }
+    sum += info->obsolete_data.size;
+    for (i = 0; i < 8; i++)
+    {
+        sum += info->lifo_data[i].size;
+    }
+    
+    return sum;
+}
+
+#endif
+
+static void
+GetPurgeableAndAnonymous(task_t task, uint64_t &purgeable, uint64_t &anonymous)
+{
+#if defined (TASK_VM_INFO) && TASK_VM_INFO >= 22
+
+    kern_return_t kr;
+    task_purgable_info_t purgeable_info;
+    uint64_t purgeable_sum = 0;
+    mach_msg_type_number_t info_count;
+    task_vm_info_data_t vm_info;
+    
+    typedef kern_return_t (*task_purgable_info_type) (task_t, task_purgable_info_t *);
+    task_purgable_info_type task_purgable_info_ptr = NULL;
+    task_purgable_info_ptr = (task_purgable_info_type)dlsym(RTLD_NEXT, "task_purgable_info");
+    if (task_purgable_info_ptr != NULL)
+    {
+        kr = (*task_purgable_info_ptr)(task, &purgeable_info);
+        if (kr == KERN_SUCCESS) {
+            purgeable_sum = SumVMPurgeableInfo(&purgeable_info);
+            purgeable = purgeable_sum;
+        }
+    }
+
+    info_count = TASK_VM_INFO_COUNT;
+    kr = task_info(task, TASK_VM_INFO, (task_info_t)&vm_info, &info_count);
+    if (kr == KERN_SUCCESS)
+    {
+        if (purgeable_sum < vm_info.internal)
+        {
+            anonymous = vm_info.internal - purgeable_sum;
+        }
+        else
+        {
+            anonymous = 0;
+        }
+    }
+    
+#endif
+}
+
+nub_bool_t
+MachVMMemory::GetMemoryProfile(DNBProfileDataScanType scanType, task_t task, struct task_basic_info ti, cpu_type_t cputype, nub_process_t pid, vm_statistics_data_t &vm_stats, uint64_t &physical_memory, mach_vm_size_t &rprvt, mach_vm_size_t &rsize, mach_vm_size_t &vprvt, mach_vm_size_t &vsize, mach_vm_size_t &dirty_size, mach_vm_size_t &purgeable, mach_vm_size_t &anonymous)
+{
+    if (scanType & eProfileHostMemory)
+        physical_memory = GetPhysicalMemory();
+    
+    if (scanType & eProfileMemory)
+    {
+        static mach_port_t localHost = mach_host_self();
+        mach_msg_type_number_t count = HOST_VM_INFO_COUNT;
+        host_statistics(localHost, HOST_VM_INFO, (host_info_t)&vm_stats, &count);
+        vm_stats.wire_count += GetStolenPages(task);
+    
+        GetMemorySizes(task, cputype, pid, rprvt, vprvt);
+    
+        rsize = ti.resident_size;
+        vsize = ti.virtual_size;
+        
+        if (scanType & eProfileMemoryDirtyPage)
+        {
+            // This uses vmmap strategy. We don't use the returned rsize for now. We prefer to match top's version since that's what we do for the rest of the metrics.
+            GetRegionSizes(task, rsize, dirty_size);
+        }
+        
+        if (scanType & eProfileMemoryAnonymous)
+        {
+            GetPurgeableAndAnonymous(task, purgeable, anonymous);
+        }
+    }
+    
+    return true;
+}
+
 nub_size_t
 MachVMMemory::Read(task_t task, nub_addr_t address, void *data, nub_size_t data_count)
 {
@@ -99,7 +525,7 @@ MachVMMemory::Read(task_t task, nub_addr
     uint8_t *curr_data = (uint8_t*)data;
     while (total_bytes_read < data_count)
     {
-        mach_vm_size_t curr_size = MaxBytesLeftInPage(curr_addr, data_count - total_bytes_read);
+        mach_vm_size_t curr_size = MaxBytesLeftInPage(task, curr_addr, data_count - total_bytes_read);
         mach_msg_type_number_t curr_bytes_read = 0;
         vm_offset_t vm_memory = NULL;
         m_err = ::mach_vm_read (task, curr_addr, curr_size, &vm_memory, &curr_bytes_read);
@@ -195,7 +621,7 @@ MachVMMemory::WriteRegion(task_t task, c
     const uint8_t *curr_data = (const uint8_t*)data;
     while (total_bytes_written < data_count)
     {
-        mach_msg_type_number_t curr_data_count = MaxBytesLeftInPage(curr_addr, data_count - total_bytes_written);
+        mach_msg_type_number_t curr_data_count = MaxBytesLeftInPage(task, curr_addr, data_count - total_bytes_written);
         m_err = ::mach_vm_write (task, curr_addr, (pointer_t) curr_data, curr_data_count);
         if (DNBLogCheckLogBit(LOG_MEMORY) || m_err.Fail())
             m_err.LogThreaded("::mach_vm_write ( task = 0x%4.4x, addr = 0x%8.8llx, data = %8.8p, dataCnt = %u )", task, (uint64_t)curr_addr, curr_data, curr_data_count);

Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachVMMemory.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachVMMemory.h?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachVMMemory.h (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachVMMemory.h Thu Jun  6 19:06:43 2013
@@ -26,14 +26,21 @@ public:
     ~MachVMMemory();
     nub_size_t Read(task_t task, nub_addr_t address, void *data, nub_size_t data_count);
     nub_size_t Write(task_t task, nub_addr_t address, const void *data, nub_size_t data_count);
-    nub_size_t PageSize();
+    nub_size_t PageSize(task_t task);
     nub_bool_t GetMemoryRegionInfo(task_t task, nub_addr_t address, DNBRegionInfo *region_info);
+    nub_bool_t GetMemoryProfile(DNBProfileDataScanType scanType, task_t task, struct task_basic_info ti, cpu_type_t cputype, nub_process_t pid, vm_statistics_data_t &vm_stats, uint64_t &physical_memory, mach_vm_size_t &rprvt, mach_vm_size_t &rsize, mach_vm_size_t &vprvt, mach_vm_size_t &vsize, mach_vm_size_t &dirty_size, mach_vm_size_t &purgable, mach_vm_size_t &anonymous);
 
 protected:
-    nub_size_t MaxBytesLeftInPage(nub_addr_t addr, nub_size_t count);
+    nub_size_t  MaxBytesLeftInPage(task_t task, nub_addr_t addr, nub_size_t count);
 
-    nub_size_t WriteRegion(task_t task, const nub_addr_t address, const void *data, const nub_size_t data_count);
-    vm_size_t        m_page_size;
+    uint64_t    GetStolenPages(task_t task);
+    void        GetRegionSizes(task_t task, mach_vm_size_t &rsize, mach_vm_size_t &dirty_size);
+    void        GetMemorySizes(task_t task, cpu_type_t cputype, nub_process_t pid, mach_vm_size_t &rprvt, mach_vm_size_t &vprvt);
+
+
+    nub_size_t  WriteRegion(task_t task, const nub_addr_t address, const void *data, const nub_size_t data_count);
+
+    vm_size_t   m_page_size;
     DNBError    m_err;
 };
 

Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp Thu Jun  6 19:06:43 2013
@@ -188,10 +188,10 @@ DNBArchMachARM::GetGPRState(bool force)
 
     // Read the registers from our thread
     mach_msg_type_number_t count = ARM_THREAD_STATE_COUNT;
-    kern_return_t kret = ::thread_get_state(m_thread->ThreadID(), ARM_THREAD_STATE, (thread_state_t)&m_state.context.gpr, &count);
+    kern_return_t kret = ::thread_get_state(m_thread->MachPortNumber(), ARM_THREAD_STATE, (thread_state_t)&m_state.context.gpr, &count);
     uint32_t *r = &m_state.context.gpr.__r[0];
     DNBLogThreadedIf(LOG_THREAD, "thread_get_state(0x%4.4x, %u, &gpr, %u) => 0x%8.8x (count = %u) regs r0=%8.8x r1=%8.8x r2=%8.8x r3=%8.8x r4=%8.8x r5=%8.8x r6=%8.8x r7=%8.8x r8=%8.8x r9=%8.8x r10=%8.8x r11=%8.8x s12=%8.8x sp=%8.8x lr=%8.8x pc=%8.8x cpsr=%8.8x", 
-                     m_thread->ThreadID(), 
+                     m_thread->MachPortNumber(), 
                      ARM_THREAD_STATE, 
                      ARM_THREAD_STATE_COUNT, 
                      kret,
@@ -227,12 +227,12 @@ DNBArchMachARM::GetVFPState(bool force)
 
     // Read the registers from our thread
     mach_msg_type_number_t count = ARM_VFP_STATE_COUNT;
-    kern_return_t kret = ::thread_get_state(m_thread->ThreadID(), ARM_VFP_STATE, (thread_state_t)&m_state.context.vfp, &count);
+    kern_return_t kret = ::thread_get_state(m_thread->MachPortNumber(), ARM_VFP_STATE, (thread_state_t)&m_state.context.vfp, &count);
     if (DNBLogEnabledForAny (LOG_THREAD))
     {
         uint32_t *r = &m_state.context.vfp.__r[0];
         DNBLogThreaded ("thread_get_state(0x%4.4x, %u, &gpr, %u) => 0x%8.8x (count => %u)",
-                        m_thread->ThreadID(), 
+                        m_thread->MachPortNumber(), 
                         ARM_THREAD_STATE, 
                         ARM_THREAD_STATE_COUNT, 
                         kret,
@@ -260,7 +260,7 @@ DNBArchMachARM::GetEXCState(bool force)
 
     // Read the registers from our thread
     mach_msg_type_number_t count = ARM_EXCEPTION_STATE_COUNT;
-    kern_return_t kret = ::thread_get_state(m_thread->ThreadID(), ARM_EXCEPTION_STATE, (thread_state_t)&m_state.context.exc, &count);
+    kern_return_t kret = ::thread_get_state(m_thread->MachPortNumber(), ARM_EXCEPTION_STATE, (thread_state_t)&m_state.context.exc, &count);
     m_state.SetError(set, Read, kret);
     return kret;
 }
@@ -287,7 +287,7 @@ DNBArchMachARM::GetDBGState(bool force)
 
     // Read the registers from our thread
     mach_msg_type_number_t count = ARM_DEBUG_STATE_COUNT;
-    kern_return_t kret = ::thread_get_state(m_thread->ThreadID(), ARM_DEBUG_STATE, (thread_state_t)&m_state.dbg, &count);
+    kern_return_t kret = ::thread_get_state(m_thread->MachPortNumber(), ARM_DEBUG_STATE, (thread_state_t)&m_state.dbg, &count);
     m_state.SetError(set, Read, kret);
     return kret;
 }
@@ -296,7 +296,7 @@ kern_return_t
 DNBArchMachARM::SetGPRState()
 {
     int set = e_regSetGPR;
-    kern_return_t kret = ::thread_set_state(m_thread->ThreadID(), ARM_THREAD_STATE, (thread_state_t)&m_state.context.gpr, ARM_THREAD_STATE_COUNT);
+    kern_return_t kret = ::thread_set_state(m_thread->MachPortNumber(), ARM_THREAD_STATE, (thread_state_t)&m_state.context.gpr, ARM_THREAD_STATE_COUNT);
     m_state.SetError(set, Write, kret);         // Set the current write error for this register set
     m_state.InvalidateRegisterSetState(set);    // Invalidate the current register state in case registers are read back differently
     return kret;                                // Return the error code
@@ -306,7 +306,7 @@ kern_return_t
 DNBArchMachARM::SetVFPState()
 {
     int set = e_regSetVFP;
-    kern_return_t kret = ::thread_set_state (m_thread->ThreadID(), ARM_VFP_STATE, (thread_state_t)&m_state.context.vfp, ARM_VFP_STATE_COUNT);
+    kern_return_t kret = ::thread_set_state (m_thread->MachPortNumber(), ARM_VFP_STATE, (thread_state_t)&m_state.context.vfp, ARM_VFP_STATE_COUNT);
     m_state.SetError(set, Write, kret);         // Set the current write error for this register set
     m_state.InvalidateRegisterSetState(set);    // Invalidate the current register state in case registers are read back differently
     return kret;                                // Return the error code
@@ -316,7 +316,7 @@ kern_return_t
 DNBArchMachARM::SetEXCState()
 {
     int set = e_regSetEXC;
-    kern_return_t kret = ::thread_set_state (m_thread->ThreadID(), ARM_EXCEPTION_STATE, (thread_state_t)&m_state.context.exc, ARM_EXCEPTION_STATE_COUNT);
+    kern_return_t kret = ::thread_set_state (m_thread->MachPortNumber(), ARM_EXCEPTION_STATE, (thread_state_t)&m_state.context.exc, ARM_EXCEPTION_STATE_COUNT);
     m_state.SetError(set, Write, kret);         // Set the current write error for this register set
     m_state.InvalidateRegisterSetState(set);    // Invalidate the current register state in case registers are read back differently
     return kret;                                // Return the error code
@@ -326,7 +326,7 @@ kern_return_t
 DNBArchMachARM::SetDBGState()
 {
     int set = e_regSetDBG;
-    kern_return_t kret = ::thread_set_state (m_thread->ThreadID(), ARM_DEBUG_STATE, (thread_state_t)&m_state.dbg, ARM_DEBUG_STATE_COUNT);
+    kern_return_t kret = ::thread_set_state (m_thread->MachPortNumber(), ARM_DEBUG_STATE, (thread_state_t)&m_state.dbg, ARM_DEBUG_STATE_COUNT);
     m_state.SetError(set, Write, kret);         // Set the current write error for this register set
     m_state.InvalidateRegisterSetState(set);    // Invalidate the current register state in case registers are read back differently
     return kret;                                // Return the error code
@@ -346,13 +346,6 @@ DNBArchMachARM::ThreadWillResume()
                 DNBLogThreaded("DNBArchMachARM::ThreadWillResume() failed to enable hardware single step");
             }
         }
-        else
-        {
-            if (SetSingleStepSoftwareBreakpoints() != KERN_SUCCESS)
-            {
-                DNBLogThreaded("DNBArchMachARM::ThreadWillResume() failed to enable software single step");
-            }
-        }
     }
 
     // Disable the triggered watchpoint temporarily before we resume.
@@ -469,13 +462,6 @@ DNBArchMachARM::ThreadDidStop()
                     }
                     m_sw_single_step_itblock_break_count = 0;
 
-#if defined (USE_ARM_DISASSEMBLER_FRAMEWORK)
-
-                    // Decode instructions up to the current PC to ensure the internal decoder state is valid for the IT block
-                    // The decoder has to decode each instruction in the IT block even if it is not executed so that
-                    // the fields are correctly updated
-                    DecodeITBlockInstructions(m_state.context.gpr.__pc);
-#endif
                 }
 
             }
@@ -520,1427 +506,45 @@ DNBArchMachARM::NotifyException(MachExce
                     m_watchpoint_hw_index = hw_index;
                     exc.exc_data[1] = addr;
                     // Piggyback the hw_index in the exc.data.
-                    exc.exc_data.push_back(hw_index);
-                }
-
-                return true;
-            }
-            break;
-    }
-    return false;
-}
-
-bool
-DNBArchMachARM::StepNotComplete ()
-{
-    if (m_hw_single_chained_step_addr != INVALID_NUB_ADDRESS)
-    {
-        kern_return_t kret = KERN_INVALID_ARGUMENT;
-        kret = GetGPRState(false);
-        if (kret == KERN_SUCCESS)
-        {
-            if (m_state.context.gpr.__pc == m_hw_single_chained_step_addr)
-            {
-                DNBLogThreadedIf(LOG_STEP, "Need to step some more at 0x%8.8x", m_hw_single_chained_step_addr);
-                return true;
-            }
-        }
-    }
-
-    m_hw_single_chained_step_addr = INVALID_NUB_ADDRESS;
-    return false;
-}
-
-
-#if defined (USE_ARM_DISASSEMBLER_FRAMEWORK)
-
-void
-DNBArchMachARM::DecodeITBlockInstructions(nub_addr_t curr_pc)
-
-{
-    uint16_t opcode16;
-    uint32_t opcode32;
-    nub_addr_t next_pc_in_itblock;
-    nub_addr_t pc_in_itblock = m_last_decode_pc;
-
-    DNBLogThreadedIf(LOG_STEP | LOG_VERBOSE, "%s: last_decode_pc=0x%8.8x", __FUNCTION__, m_last_decode_pc);
-
-    // Decode IT block instruction from the instruction following the m_last_decoded_instruction at
-    // PC m_last_decode_pc upto and including the instruction at curr_pc
-    if (m_thread->Process()->Task().ReadMemory(pc_in_itblock, 2, &opcode16) == 2)
-    {
-        opcode32 = opcode16;
-        pc_in_itblock += 2;
-        // Check for 32 bit thumb opcode and read the upper 16 bits if needed
-        if (((opcode32 & 0xE000) == 0xE000) && opcode32 & 0x1800)
-        {
-            // Adjust 'next_pc_in_itblock' to point to the default next Thumb instruction for
-            // a 32 bit Thumb opcode
-            // Read bits 31:16 of a 32 bit Thumb opcode
-            if (m_thread->Process()->Task().ReadMemory(pc_in_itblock, 2, &opcode16) == 2)
-            {
-                pc_in_itblock += 2;
-                // 32 bit thumb opcode
-                opcode32 = (opcode32 << 16) | opcode16;
-            }
-            else
-            {
-                DNBLogError("%s: Unable to read opcode bits 31:16 for a 32 bit thumb opcode at pc=0x%8.8llx", __FUNCTION__, (uint64_t)pc_in_itblock);
-            }
-        }
-    }
-    else
-    {
-        DNBLogError("%s: Error reading 16-bit Thumb instruction at pc=0x%8.8x", __FUNCTION__, pc_in_itblock);
-    }
-
-    DNBLogThreadedIf(LOG_STEP | LOG_VERBOSE, "%s: pc_in_itblock=0x%8.8x, curr_pc=0x%8.8x", __FUNCTION__, pc_in_itblock, curr_pc);
-
-    next_pc_in_itblock = pc_in_itblock;
-    while (next_pc_in_itblock <= curr_pc)
-    {
-        arm_error_t decodeError;
-
-        m_last_decode_pc = pc_in_itblock;
-        decodeError = DecodeInstructionUsingDisassembler(pc_in_itblock, m_state.context.gpr.__cpsr, &m_last_decode_arm, &m_last_decode_thumb, &next_pc_in_itblock);
-
-        pc_in_itblock = next_pc_in_itblock;
-        DNBLogThreadedIf(LOG_STEP | LOG_VERBOSE, "%s: next_pc_in_itblock=0x%8.8x", __FUNCTION__, next_pc_in_itblock);
-    }
-}
-#endif
-
-// Set the single step bit in the processor status register.
-kern_return_t
-DNBArchMachARM::EnableHardwareSingleStep (bool enable)
-{
-    DNBError err;
-    DNBLogThreadedIf(LOG_STEP, "%s( enable = %d )", __FUNCTION__, enable);
-
-    err = GetGPRState(false);
-
-    if (err.Fail())
-    {
-        err.LogThreaded("%s: failed to read the GPR registers", __FUNCTION__);
-        return err.Error();
-    }
-
-    err = GetDBGState(false);
-
-    if (err.Fail())
-    {
-        err.LogThreaded("%s: failed to read the DBG registers", __FUNCTION__);
-        return err.Error();
-    }
-
-    const uint32_t i = 0;
-    if (enable)
-    {
-        m_hw_single_chained_step_addr = INVALID_NUB_ADDRESS;
-
-        // Save our previous state
-        m_dbg_save = m_state.dbg;
-        // Set a breakpoint that will stop when the PC doesn't match the current one!
-        m_state.dbg.__bvr[i] = m_state.context.gpr.__pc & 0xFFFFFFFCu;      // Set the current PC as the breakpoint address
-        m_state.dbg.__bcr[i] = BCR_M_IMVA_MISMATCH |    // Stop on address mismatch
-                               S_USER |                 // Stop only in user mode
-                               BCR_ENABLE;              // Enable this breakpoint
-        if (m_state.context.gpr.__cpsr & 0x20)
-        {
-            // Thumb breakpoint
-            if (m_state.context.gpr.__pc & 2)
-                m_state.dbg.__bcr[i] |= BAS_IMVA_2_3;
-            else
-                m_state.dbg.__bcr[i] |= BAS_IMVA_0_1;
-
-            uint16_t opcode;
-            if (sizeof(opcode) == m_thread->Process()->Task().ReadMemory(m_state.context.gpr.__pc, sizeof(opcode), &opcode))
-            {
-                if (((opcode & 0xE000) == 0xE000) && opcode & 0x1800)
-                {
-                    // 32 bit thumb opcode...
-                    if (m_state.context.gpr.__pc & 2)
-                    {
-                        // We can't take care of a 32 bit thumb instruction single step
-                        // with just IVA mismatching. We will need to chain an extra
-                        // hardware single step in order to complete this single step...
-                        m_hw_single_chained_step_addr = m_state.context.gpr.__pc + 2;
-                    }
-                    else
-                    {
-                        // Extend the number of bits to ignore for the mismatch
-                        m_state.dbg.__bcr[i] |= BAS_IMVA_ALL;
-                    }
-                }
-            }
-        }
-        else
-        {
-            // ARM breakpoint
-            m_state.dbg.__bcr[i] |= BAS_IMVA_ALL; // Stop when any address bits change
-        }
-
-        DNBLogThreadedIf(LOG_STEP, "%s: BVR%u=0x%8.8x  BCR%u=0x%8.8x", __FUNCTION__, i, m_state.dbg.__bvr[i], i, m_state.dbg.__bcr[i]);
-
-        for (uint32_t j=i+1; j<16; ++j)
-        {
-            // Disable all others
-            m_state.dbg.__bvr[j] = 0;
-            m_state.dbg.__bcr[j] = 0;
-        }
-    }
-    else
-    {
-        // Just restore the state we had before we did single stepping
-        m_state.dbg = m_dbg_save;
-    }
-
-    return SetDBGState();
-}
-
-// return 1 if bit "BIT" is set in "value"
-static inline uint32_t bit(uint32_t value, uint32_t bit)
-{
-    return (value >> bit) & 1u;
-}
-
-// return the bitfield "value[msbit:lsbit]".
-static inline uint32_t bits(uint32_t value, uint32_t msbit, uint32_t lsbit)
-{
-    assert(msbit >= lsbit);
-    uint32_t shift_left = sizeof(value) * 8 - 1 - msbit;
-    value <<= shift_left;           // shift anything above the msbit off of the unsigned edge
-    value >>= (shift_left + lsbit); // shift it back again down to the lsbit (including undoing any shift from above)
-    return value;                   // return our result
-}
-
-bool
-DNBArchMachARM::ConditionPassed(uint8_t condition, uint32_t cpsr)
-{
-    uint32_t cpsr_n = bit(cpsr, 31); // Negative condition code flag
-    uint32_t cpsr_z = bit(cpsr, 30); // Zero condition code flag
-    uint32_t cpsr_c = bit(cpsr, 29); // Carry condition code flag
-    uint32_t cpsr_v = bit(cpsr, 28); // Overflow condition code flag
-
-    switch (condition) {
-        case COND_EQ: // (0x0)
-            if (cpsr_z == 1) return true;
-            break;
-        case COND_NE: // (0x1)
-            if (cpsr_z == 0) return true;
-            break;
-        case COND_CS: // (0x2)
-            if (cpsr_c == 1) return true;
-            break;
-        case COND_CC: // (0x3)
-            if (cpsr_c == 0) return true;
-            break;
-        case COND_MI: // (0x4)
-            if (cpsr_n == 1) return true;
-            break;
-        case COND_PL: // (0x5)
-            if (cpsr_n == 0) return true;
-            break;
-        case COND_VS: // (0x6)
-            if (cpsr_v == 1) return true;
-            break;
-        case COND_VC: // (0x7)
-            if (cpsr_v == 0) return true;
-            break;
-        case COND_HI: // (0x8)
-            if ((cpsr_c == 1) && (cpsr_z == 0)) return true;
-            break;
-        case COND_LS: // (0x9)
-            if ((cpsr_c == 0) || (cpsr_z == 1)) return true;
-            break;
-        case COND_GE: // (0xA)
-            if (cpsr_n == cpsr_v) return true;
-            break;
-        case COND_LT: // (0xB)
-            if (cpsr_n != cpsr_v) return true;
-            break;
-        case COND_GT: // (0xC)
-            if ((cpsr_z == 0) && (cpsr_n == cpsr_v)) return true;
-            break;
-        case COND_LE: // (0xD)
-            if ((cpsr_z == 1) || (cpsr_n != cpsr_v)) return true;
-            break;
-        default:
-            return true;
-            break;
-    }
-
-    return false;
-}
-
-#if defined (USE_ARM_DISASSEMBLER_FRAMEWORK)
-
-bool
-DNBArchMachARM::ComputeNextPC(nub_addr_t currentPC, arm_decoded_instruction_t decodedInstruction, bool currentPCIsThumb, nub_addr_t *targetPC)
-{
-    nub_addr_t myTargetPC, addressWherePCLives;
-    pid_t mypid;
-
-    uint32_t cpsr_c = bit(m_state.context.gpr.__cpsr, 29); // Carry condition code flag
-
-    uint32_t firstOperand=0, secondOperand=0, shiftAmount=0, secondOperandAfterShift=0, immediateValue=0;
-    uint32_t halfwords=0, baseAddress=0, immediateOffset=0, addressOffsetFromRegister=0, addressOffsetFromRegisterAfterShift;
-    uint32_t baseAddressIndex=INVALID_NUB_HW_INDEX;
-    uint32_t firstOperandIndex=INVALID_NUB_HW_INDEX;
-    uint32_t secondOperandIndex=INVALID_NUB_HW_INDEX;
-    uint32_t addressOffsetFromRegisterIndex=INVALID_NUB_HW_INDEX;
-    uint32_t shiftRegisterIndex=INVALID_NUB_HW_INDEX;
-    uint16_t registerList16, registerList16NoPC;
-    uint8_t registerList8;
-    uint32_t numRegistersToLoad=0;
-
-    DNBLogThreadedIf(LOG_STEP | LOG_VERBOSE, "%s: instruction->code=%d", __FUNCTION__, decodedInstruction.instruction->code);
-
-    // Get the following in this switch statement:
-    //   - firstOperand, secondOperand, immediateValue, shiftAmount: For arithmetic, logical and move instructions
-    //   - baseAddress, immediateOffset, shiftAmount: For LDR
-    //   - numRegistersToLoad: For LDM and POP instructions
-    switch (decodedInstruction.instruction->code)
-    {
-            // Arithmetic operations that can change the PC
-        case ARM_INST_ADC:
-        case ARM_INST_ADCS:
-        case ARM_INST_ADD:
-        case ARM_INST_ADDS:
-        case ARM_INST_AND:
-        case ARM_INST_ANDS:
-        case ARM_INST_ASR:
-        case ARM_INST_ASRS:
-        case ARM_INST_BIC:
-        case ARM_INST_BICS:
-        case ARM_INST_EOR:
-        case ARM_INST_EORS:
-        case ARM_INST_ORR:
-        case ARM_INST_ORRS:
-        case ARM_INST_RSB:
-        case ARM_INST_RSBS:
-        case ARM_INST_RSC:
-        case ARM_INST_RSCS:
-        case ARM_INST_SBC:
-        case ARM_INST_SBCS:
-        case ARM_INST_SUB:
-        case ARM_INST_SUBS:
-            switch (decodedInstruction.addressMode)
-            {
-                case ARM_ADDR_DATA_IMM:
-                    if (decodedInstruction.numOperands != 3)
-                    {
-                        DNBLogError("Expected 3 operands in decoded instruction structure. numOperands is %d!", decodedInstruction.numOperands);
-                        return false;
-                    }
-
-                    if (decodedInstruction.op[0].value != PC_REG)
-                    {
-                        DNBLogError("Destination register is not a PC! %s routine should be called on on instructions that modify the PC. Destination register is R%d!", __FUNCTION__, decodedInstruction.op[0].value);
-                        return false;
-                    }
-
-                    // Get firstOperand register value (at index=1)
-                    firstOperandIndex = decodedInstruction.op[1].value; // first operand register index
-                    firstOperand = m_state.context.gpr.__r[firstOperandIndex];
-
-                    // Get immediateValue (at index=2)
-                    immediateValue = decodedInstruction.op[2].value;
-
-                    break;
-
-                case ARM_ADDR_DATA_REG:
-                    if (decodedInstruction.numOperands != 3)
-                    {
-                        DNBLogError("Expected 3 operands in decoded instruction structure. numOperands is %d!", decodedInstruction.numOperands);
-                        return false;
-                    }
-
-                    if (decodedInstruction.op[0].value != PC_REG)
-                    {
-                        DNBLogError("Destination register is not a PC! %s routine should be called on on instructions that modify the PC. Destination register is R%d!", __FUNCTION__, decodedInstruction.op[0].value);
-                        return false;
-                    }
-
-                    // Get firstOperand register value (at index=1)
-                    firstOperandIndex = decodedInstruction.op[1].value; // first operand register index
-                    firstOperand = m_state.context.gpr.__r[firstOperandIndex];
-
-                    // Get secondOperand register value (at index=2)
-                    secondOperandIndex = decodedInstruction.op[2].value; // second operand register index
-                    secondOperand = m_state.context.gpr.__r[secondOperandIndex];
-
-                    break;
-
-                case ARM_ADDR_DATA_SCALED_IMM:
-                    if (decodedInstruction.numOperands != 4)
-                    {
-                        DNBLogError("Expected 4 operands in decoded instruction structure. numOperands is %d!", decodedInstruction.numOperands);
-                        return false;
-                    }
-
-                    if (decodedInstruction.op[0].value != PC_REG)
-                    {
-                        DNBLogError("Destination register is not a PC! %s routine should be called on on instructions that modify the PC. Destination register is R%d!", __FUNCTION__, decodedInstruction.op[0].value);
-                        return false;
-                    }
-
-                    // Get firstOperand register value (at index=1)
-                    firstOperandIndex = decodedInstruction.op[1].value; // first operand register index
-                    firstOperand = m_state.context.gpr.__r[firstOperandIndex];
-
-                    // Get secondOperand register value (at index=2)
-                    secondOperandIndex = decodedInstruction.op[2].value; // second operand register index
-                    secondOperand = m_state.context.gpr.__r[secondOperandIndex];
-
-                    // Get shiftAmount as immediate value (at index=3)
-                    shiftAmount = decodedInstruction.op[3].value;
-
-                    break;
-
-
-                case ARM_ADDR_DATA_SCALED_REG:
-                    if (decodedInstruction.numOperands != 4)
-                    {
-                        DNBLogError("Expected 4 operands in decoded instruction structure. numOperands is %d!", decodedInstruction.numOperands);
-                        return false;
-                    }
-
-                    if (decodedInstruction.op[0].value != PC_REG)
-                    {
-                        DNBLogError("Destination register is not a PC! %s routine should be called on on instructions that modify the PC. Destination register is R%d!", __FUNCTION__, decodedInstruction.op[0].value);
-                        return false;
-                    }
-
-                    // Get firstOperand register value (at index=1)
-                    firstOperandIndex = decodedInstruction.op[1].value; // first operand register index
-                    firstOperand = m_state.context.gpr.__r[firstOperandIndex];
-
-                    // Get secondOperand register value (at index=2)
-                    secondOperandIndex = decodedInstruction.op[2].value; // second operand register index
-                    secondOperand = m_state.context.gpr.__r[secondOperandIndex];
-
-                    // Get shiftAmount from register (at index=3)
-                    shiftRegisterIndex = decodedInstruction.op[3].value; // second operand register index
-                    shiftAmount = m_state.context.gpr.__r[shiftRegisterIndex];
-
-                    break;
-
-                case THUMB_ADDR_HR_HR:
-                    if (decodedInstruction.numOperands != 2)
-                    {
-                        DNBLogError("Expected 2 operands in decoded instruction structure. numOperands is %d!", decodedInstruction.numOperands);
-                        return false;
-                    }
-
-                    if (decodedInstruction.op[0].value != PC_REG)
-                    {
-                        DNBLogError("Destination register is not a PC! %s routine should be called on on instructions that modify the PC. Destination register is R%d!", __FUNCTION__, decodedInstruction.op[0].value);
-                        return false;
-                    }
-
-                    // Get firstOperand register value (at index=0)
-                    firstOperandIndex = decodedInstruction.op[0].value; // first operand register index
-                    firstOperand = m_state.context.gpr.__r[firstOperandIndex];
-
-                    // Get secondOperand register value (at index=1)
-                    secondOperandIndex = decodedInstruction.op[1].value; // second operand register index
-                    secondOperand = m_state.context.gpr.__r[secondOperandIndex];
-
-                    break;
-
-                default:
-                    break;
-            }
-            break;
-
-            // Logical shifts and move operations that can change the PC
-        case ARM_INST_LSL:
-        case ARM_INST_LSLS:
-        case ARM_INST_LSR:
-        case ARM_INST_LSRS:
-        case ARM_INST_MOV:
-        case ARM_INST_MOVS:
-        case ARM_INST_MVN:
-        case ARM_INST_MVNS:
-        case ARM_INST_ROR:
-        case ARM_INST_RORS:
-        case ARM_INST_RRX:
-        case ARM_INST_RRXS:
-            // In these cases, the firstOperand is always 0, as if it does not exist
-            switch (decodedInstruction.addressMode)
-            {
-                case ARM_ADDR_DATA_IMM:
-                    if (decodedInstruction.numOperands != 2)
-                    {
-                        DNBLogError("Expected 2 operands in decoded instruction structure. numOperands is %d!", decodedInstruction.numOperands);
-                        return false;
-                    }
-
-                    if (decodedInstruction.op[0].value != PC_REG)
-                    {
-                        DNBLogError("Destination register is not a PC! %s routine should be called on on instructions that modify the PC. Destination register is R%d!", __FUNCTION__, decodedInstruction.op[0].value);
-                        return false;
-                    }
-
-                    // Get immediateValue (at index=1)
-                    immediateValue = decodedInstruction.op[1].value;
-
-                    break;
-
-                case ARM_ADDR_DATA_REG:
-                    if (decodedInstruction.numOperands != 2)
-                    {
-                        DNBLogError("Expected 2 operands in decoded instruction structure. numOperands is %d!", decodedInstruction.numOperands);
-                        return false;
-                    }
-
-                    if (decodedInstruction.op[0].value != PC_REG)
-                    {
-                        DNBLogError("Destination register is not a PC! %s routine should be called on on instructions that modify the PC. Destination register is R%d!", __FUNCTION__, decodedInstruction.op[0].value);
-                        return false;
-                    }
-
-                    // Get secondOperand register value (at index=1)
-                    secondOperandIndex = decodedInstruction.op[1].value; // second operand register index
-                    secondOperand = m_state.context.gpr.__r[secondOperandIndex];
-
-                    break;
-
-                case ARM_ADDR_DATA_SCALED_IMM:
-                    if (decodedInstruction.numOperands != 3)
-                    {
-                        DNBLogError("Expected 4 operands in decoded instruction structure. numOperands is %d!", decodedInstruction.numOperands);
-                        return false;
-                    }
-
-                    if (decodedInstruction.op[0].value != PC_REG)
-                    {
-                        DNBLogError("Destination register is not a PC! %s routine should be called on on instructions that modify the PC. Destination register is R%d!", __FUNCTION__, decodedInstruction.op[0].value);
-                        return false;
-                    }
-
-                    // Get secondOperand register value (at index=1)
-                    secondOperandIndex = decodedInstruction.op[2].value; // second operand register index
-                    secondOperand = m_state.context.gpr.__r[secondOperandIndex];
-
-                    // Get shiftAmount as immediate value (at index=2)
-                    shiftAmount = decodedInstruction.op[2].value;
-
-                    break;
-
-
-                case ARM_ADDR_DATA_SCALED_REG:
-                    if (decodedInstruction.numOperands != 3)
-                    {
-                        DNBLogError("Expected 3 operands in decoded instruction structure. numOperands is %d!", decodedInstruction.numOperands);
-                        return false;
-                    }
-
-                    if (decodedInstruction.op[0].value != PC_REG)
-                    {
-                        DNBLogError("Destination register is not a PC! %s routine should be called on on instructions that modify the PC. Destination register is R%d!", __FUNCTION__, decodedInstruction.op[0].value);
-                        return false;
-                    }
-
-                    // Get secondOperand register value (at index=1)
-                    secondOperandIndex = decodedInstruction.op[1].value; // second operand register index
-                    secondOperand = m_state.context.gpr.__r[secondOperandIndex];
-
-                    // Get shiftAmount from register (at index=2)
-                    shiftRegisterIndex = decodedInstruction.op[2].value; // second operand register index
-                    shiftAmount = m_state.context.gpr.__r[shiftRegisterIndex];
-
-                    break;
-
-                case THUMB_ADDR_HR_HR:
-                    if (decodedInstruction.numOperands != 2)
-                    {
-                        DNBLogError("Expected 2 operands in decoded instruction structure. numOperands is %d!", decodedInstruction.numOperands);
-                        return false;
-                    }
-
-                    if (decodedInstruction.op[0].value != PC_REG)
-                    {
-                        DNBLogError("Destination register is not a PC! %s routine should be called on on instructions that modify the PC. Destination register is R%d!", __FUNCTION__, decodedInstruction.op[0].value);
-                        return false;
-                    }
-
-                    // Get secondOperand register value (at index=1)
-                    secondOperandIndex = decodedInstruction.op[1].value; // second operand register index
-                    secondOperand = m_state.context.gpr.__r[secondOperandIndex];
-
-                    break;
-
-                default:
-                    break;
-            }
-
-            break;
-
-            // Simple branches, used to hop around within a routine
-        case ARM_INST_B:
-            *targetPC = decodedInstruction.targetPC; // Known targetPC
-            return true;
-            break;
-
-            // Branch-and-link, used to call ARM subroutines
-        case ARM_INST_BL:
-            *targetPC = decodedInstruction.targetPC; // Known targetPC
-            return true;
-            break;
-
-            // Branch-and-link with exchange, used to call opposite-mode subroutines
-        case ARM_INST_BLX:
-            if ((decodedInstruction.addressMode == ARM_ADDR_BRANCH_IMM) ||
-                (decodedInstruction.addressMode == THUMB_ADDR_UNCOND))
-            {
-                *targetPC = decodedInstruction.targetPC; // Known targetPC
-                return true;
-            }
-            else    // addressMode == ARM_ADDR_BRANCH_REG
-            {
-                // Unknown target unless we're branching to the PC itself,
-                //  although this may not work properly with BLX
-                if (decodedInstruction.op[REG_RD].value == PC_REG)
-                {
-                    // this should (almost) never happen
-                    *targetPC = decodedInstruction.targetPC; // Known targetPC
-                    return true;
-                }
-
-                // Get the branch address and return
-                if (decodedInstruction.numOperands != 1)
-                {
-                    DNBLogError("Expected 1 operands in decoded instruction structure. numOperands is %d!", decodedInstruction.numOperands);
-                    return false;
-                }
-
-                // Get branch address in register (at index=0)
-                *targetPC = m_state.context.gpr.__r[decodedInstruction.op[0].value];
-                return true;
-            }
-            break;
-
-            // Branch with exchange, used to hop to opposite-mode code
-            // Branch to Jazelle code, used to execute Java; included here since it
-            //  acts just like BX unless the Jazelle unit is active and JPC is
-            //  already loaded into it.
-        case ARM_INST_BX:
-        case ARM_INST_BXJ:
-            // Unknown target unless we're branching to the PC itself,
-            //  although this can never switch to Thumb mode and is
-            //  therefore pretty much useless
-            if (decodedInstruction.op[REG_RD].value == PC_REG)
-            {
-                // this should (almost) never happen
-                *targetPC = decodedInstruction.targetPC; // Known targetPC
-                return true;
-            }
-
-            // Get the branch address and return
-            if (decodedInstruction.numOperands != 1)
-            {
-                DNBLogError("Expected 1 operands in decoded instruction structure. numOperands is %d!", decodedInstruction.numOperands);
-                return false;
-            }
-
-            // Get branch address in register (at index=0)
-            *targetPC = m_state.context.gpr.__r[decodedInstruction.op[0].value];
-            return true;
-            break;
-
-            // Compare and branch on zero/non-zero (Thumb-16 only)
-            // Unusual condition check built into the instruction
-        case ARM_INST_CBZ:
-        case ARM_INST_CBNZ:
-            // Branch address is known at compile time
-            // Get the branch address and return
-            if (decodedInstruction.numOperands != 2)
-            {
-                DNBLogError("Expected 2 operands in decoded instruction structure. numOperands is %d!", decodedInstruction.numOperands);
-                return false;
-            }
-
-            // Get branch address as an immediate value (at index=1)
-            *targetPC = decodedInstruction.op[1].value;
-            return true;
-            break;
-
-            // Load register can be used to load PC, usually with a function pointer
-        case ARM_INST_LDR:
-            if (decodedInstruction.op[REG_RD].value != PC_REG)
-            {
-                DNBLogError("Destination register is not a PC! %s routine should be called on on instructions that modify the PC. Destination register is R%d!", __FUNCTION__, decodedInstruction.op[0].value);
-                return false;
-            }
-            switch (decodedInstruction.addressMode)
-            {
-                case ARM_ADDR_LSWUB_IMM:
-                case ARM_ADDR_LSWUB_IMM_PRE:
-                case ARM_ADDR_LSWUB_IMM_POST:
-                    if (decodedInstruction.numOperands != 3)
-                    {
-                        DNBLogError("Expected 3 operands in decoded instruction structure. numOperands is %d!", decodedInstruction.numOperands);
-                        return false;
-                    }
-
-                    // Get baseAddress from register (at index=1)
-                    baseAddressIndex = decodedInstruction.op[1].value;
-                    baseAddress = m_state.context.gpr.__r[baseAddressIndex];
-
-                    // Get immediateOffset (at index=2)
-                    immediateOffset = decodedInstruction.op[2].value;
-                    break;
-
-                case ARM_ADDR_LSWUB_REG:
-                case ARM_ADDR_LSWUB_REG_PRE:
-                case ARM_ADDR_LSWUB_REG_POST:
-                    if (decodedInstruction.numOperands != 3)
-                    {
-                        DNBLogError("Expected 3 operands in decoded instruction structure. numOperands is %d!", decodedInstruction.numOperands);
-                        return false;
-                    }
-
-                    // Get baseAddress from register (at index=1)
-                    baseAddressIndex = decodedInstruction.op[1].value;
-                    baseAddress = m_state.context.gpr.__r[baseAddressIndex];
-
-                    // Get immediateOffset from register (at index=2)
-                    addressOffsetFromRegisterIndex = decodedInstruction.op[2].value;
-                    addressOffsetFromRegister = m_state.context.gpr.__r[addressOffsetFromRegisterIndex];
-
-                    break;
-
-                case ARM_ADDR_LSWUB_SCALED:
-                case ARM_ADDR_LSWUB_SCALED_PRE:
-                case ARM_ADDR_LSWUB_SCALED_POST:
-                    if (decodedInstruction.numOperands != 4)
-                    {
-                        DNBLogError("Expected 4 operands in decoded instruction structure. numOperands is %d!", decodedInstruction.numOperands);
-                        return false;
-                    }
-
-                    // Get baseAddress from register (at index=1)
-                    baseAddressIndex = decodedInstruction.op[1].value;
-                    baseAddress = m_state.context.gpr.__r[baseAddressIndex];
-
-                    // Get immediateOffset from register (at index=2)
-                    addressOffsetFromRegisterIndex = decodedInstruction.op[2].value;
-                    addressOffsetFromRegister = m_state.context.gpr.__r[addressOffsetFromRegisterIndex];
-
-                    // Get shiftAmount (at index=3)
-                    shiftAmount = decodedInstruction.op[3].value;
-
-                    break;
-
-                default:
-                    break;
-            }
-            break;
-
-            // 32b load multiple operations can load the PC along with everything else,
-            //  usually to return from a function call
-        case ARM_INST_LDMDA:
-        case ARM_INST_LDMDB:
-        case ARM_INST_LDMIA:
-        case ARM_INST_LDMIB:
-            if (decodedInstruction.op[LDM_REGLIST].value & PC_REGLIST_BIT)
-            {
-                if (decodedInstruction.numOperands != 2)
-                {
-                    DNBLogError("Expected 2 operands in decoded instruction structure. numOperands is %d!", decodedInstruction.numOperands);
-                    return false;
-                }
-
-                // Get baseAddress from register (at index=0)
-                baseAddressIndex = decodedInstruction.op[0].value;
-                baseAddress = m_state.context.gpr.__r[baseAddressIndex];
-
-                // Get registerList from register (at index=1)
-                registerList16 = (uint16_t)decodedInstruction.op[1].value;
-
-                // Count number of registers to load in the multiple register list excluding the PC
-                registerList16NoPC = registerList16&0x3FFF; // exclude the PC
-                numRegistersToLoad=0;
-                for (int i = 0; i < 16; i++)
-                {
-                    if (registerList16NoPC & 0x1) numRegistersToLoad++;
-                    registerList16NoPC = registerList16NoPC >> 1;
-                }
-            }
-            else
-            {
-                DNBLogError("Destination register is not a PC! %s routine should be called on on instructions that modify the PC. Destination register is R%d!", __FUNCTION__, decodedInstruction.op[0].value);
-                return false;
-            }
-            break;
-
-            // Normal 16-bit LD multiple can't touch R15, but POP can
-        case ARM_INST_POP:  // Can also get the PC & updates SP
-            // Get baseAddress from SP (at index=0)
-            baseAddress = m_state.context.gpr.__sp;
-
-            if (decodedInstruction.thumb16b)
-            {
-                // Get registerList from register (at index=0)
-                registerList8 = (uint8_t)decodedInstruction.op[0].value;
-
-                // Count number of registers to load in the multiple register list
-                numRegistersToLoad=0;
-                for (int i = 0; i < 8; i++)
-                {
-                    if (registerList8 & 0x1) numRegistersToLoad++;
-                    registerList8 = registerList8 >> 1;
-                }
-            }
-            else
-            {
-                // Get registerList from register (at index=0)
-                registerList16 = (uint16_t)decodedInstruction.op[0].value;
-
-                // Count number of registers to load in the multiple register list excluding the PC
-                registerList16NoPC = registerList16&0x3FFF; // exclude the PC
-                numRegistersToLoad=0;
-                for (int i = 0; i < 16; i++)
-                {
-                    if (registerList16NoPC & 0x1) numRegistersToLoad++;
-                    registerList16NoPC = registerList16NoPC >> 1;
-                }
-            }
-            break;
-
-            // 16b TBB and TBH instructions load a jump address from a table
-        case ARM_INST_TBB:
-        case ARM_INST_TBH:
-            // Get baseAddress from register (at index=0)
-            baseAddressIndex = decodedInstruction.op[0].value;
-            baseAddress = m_state.context.gpr.__r[baseAddressIndex];
-
-            // Get immediateOffset from register (at index=1)
-            addressOffsetFromRegisterIndex = decodedInstruction.op[1].value;
-            addressOffsetFromRegister = m_state.context.gpr.__r[addressOffsetFromRegisterIndex];
-            break;
-
-            // ThumbEE branch-to-handler instructions: Jump to handlers at some offset
-            //  from a special base pointer register (which is unknown at disassembly time)
-        case ARM_INST_HB:
-        case ARM_INST_HBP:
-//          TODO: ARM_INST_HB, ARM_INST_HBP
-            break;
-
-        case ARM_INST_HBL:
-        case ARM_INST_HBLP:
-//          TODO: ARM_INST_HBL, ARM_INST_HBLP
-            break;
-
-            // Breakpoint and software interrupt jump to interrupt handler (always ARM)
-        case ARM_INST_BKPT:
-        case ARM_INST_SMC:
-        case ARM_INST_SVC:
-
-            // Return from exception, obviously modifies PC [interrupt only!]
-        case ARM_INST_RFEDA:
-        case ARM_INST_RFEDB:
-        case ARM_INST_RFEIA:
-        case ARM_INST_RFEIB:
-
-            // Other instructions either can't change R15 or are "undefined" if you do,
-            //  so no sane compiler should ever generate them & we don't care here.
-            //  Also, R15 can only legally be used in a read-only manner for the
-            //  various ARM addressing mode (to get PC-relative addressing of constants),
-            //  but can NOT be used with any of the update modes.
-        default:
-            DNBLogError("%s should not be called for instruction code %d!", __FUNCTION__, decodedInstruction.instruction->code);
-            return false;
-            break;
-    }
-
-    // Adjust PC if PC is one of the input operands
-    if (baseAddressIndex == PC_REG)
-    {
-        if (currentPCIsThumb)
-            baseAddress += 4;
-        else
-            baseAddress += 8;
-    }
-
-    if (firstOperandIndex == PC_REG)
-    {
-        if (currentPCIsThumb)
-            firstOperand += 4;
-        else
-            firstOperand += 8;
-    }
-
-    if (secondOperandIndex == PC_REG)
-    {
-        if (currentPCIsThumb)
-            secondOperand += 4;
-        else
-            secondOperand += 8;
-    }
-
-    if (addressOffsetFromRegisterIndex == PC_REG)
-    {
-        if (currentPCIsThumb)
-            addressOffsetFromRegister += 4;
-        else
-            addressOffsetFromRegister += 8;
-    }
-
-    DNBLogThreadedIf(LOG_STEP | LOG_VERBOSE,
-        "%s: firstOperand=%8.8x, secondOperand=%8.8x, immediateValue = %d, shiftAmount = %d, baseAddress = %8.8x, addressOffsetFromRegister = %8.8x, immediateOffset = %d, numRegistersToLoad = %d",
-        __FUNCTION__,
-        firstOperand,
-        secondOperand,
-        immediateValue,
-        shiftAmount,
-        baseAddress,
-        addressOffsetFromRegister,
-        immediateOffset,
-        numRegistersToLoad);
-
-
-    // Calculate following values after applying shiftAmount:
-    //   - immediateOffsetAfterShift, secondOperandAfterShift
-
-    switch (decodedInstruction.scaleMode)
-    {
-        case ARM_SCALE_NONE:
-            addressOffsetFromRegisterAfterShift = addressOffsetFromRegister;
-            secondOperandAfterShift = secondOperand;
-            break;
-
-        case ARM_SCALE_LSL:             // Logical shift left
-            addressOffsetFromRegisterAfterShift = addressOffsetFromRegister << shiftAmount;
-            secondOperandAfterShift = secondOperand << shiftAmount;
-            break;
-
-        case ARM_SCALE_LSR:             // Logical shift right
-            addressOffsetFromRegisterAfterShift = addressOffsetFromRegister >> shiftAmount;
-            secondOperandAfterShift = secondOperand >> shiftAmount;
-            break;
-
-        case ARM_SCALE_ASR:             // Arithmetic shift right
-            asm("mov %0, %1, asr %2" : "=r" (addressOffsetFromRegisterAfterShift) : "r" (addressOffsetFromRegister), "r" (shiftAmount));
-            asm("mov %0, %1, asr %2" : "=r" (secondOperandAfterShift) : "r" (secondOperand), "r" (shiftAmount));
-            break;
-
-        case ARM_SCALE_ROR:             // Rotate right
-            asm("mov %0, %1, ror %2" : "=r" (addressOffsetFromRegisterAfterShift) : "r" (addressOffsetFromRegister), "r" (shiftAmount));
-            asm("mov %0, %1, ror %2" : "=r" (secondOperandAfterShift) : "r" (secondOperand), "r" (shiftAmount));
-            break;
-
-        case ARM_SCALE_RRX:             // Rotate right, pulling in carry (1-bit shift only)
-            asm("mov %0, %1, rrx" : "=r" (addressOffsetFromRegisterAfterShift) : "r" (addressOffsetFromRegister));
-            asm("mov %0, %1, rrx" : "=r" (secondOperandAfterShift) : "r" (secondOperand));
-            break;
-    }
-
-    // Emulate instruction to calculate targetPC
-    // All branches are already handled in the first switch statement. A branch should not reach this switch
-    switch (decodedInstruction.instruction->code)
-    {
-            // Arithmetic operations that can change the PC
-        case ARM_INST_ADC:
-        case ARM_INST_ADCS:
-            // Add with Carry
-            *targetPC = firstOperand + (secondOperandAfterShift + immediateValue) + cpsr_c;
-            break;
-
-        case ARM_INST_ADD:
-        case ARM_INST_ADDS:
-            *targetPC = firstOperand + (secondOperandAfterShift + immediateValue);
-            break;
-
-        case ARM_INST_AND:
-        case ARM_INST_ANDS:
-            *targetPC = firstOperand & (secondOperandAfterShift + immediateValue);
-            break;
-
-        case ARM_INST_ASR:
-        case ARM_INST_ASRS:
-            asm("mov %0, %1, asr %2" : "=r" (myTargetPC) : "r" (firstOperand), "r" (secondOperandAfterShift + immediateValue));
-            *targetPC = myTargetPC;
-            break;
-
-        case ARM_INST_BIC:
-        case ARM_INST_BICS:
-            asm("bic %0, %1, %2" : "=r" (myTargetPC) : "r" (firstOperand), "r" (secondOperandAfterShift + immediateValue));
-            *targetPC = myTargetPC;
-            break;
-
-        case ARM_INST_EOR:
-        case ARM_INST_EORS:
-            asm("eor %0, %1, %2" : "=r" (myTargetPC) : "r" (firstOperand), "r" (secondOperandAfterShift + immediateValue));
-            *targetPC = myTargetPC;
-            break;
-
-        case ARM_INST_ORR:
-        case ARM_INST_ORRS:
-            asm("orr %0, %1, %2" : "=r" (myTargetPC) : "r" (firstOperand), "r" (secondOperandAfterShift + immediateValue));
-            *targetPC = myTargetPC;
-            break;
-
-        case ARM_INST_RSB:
-        case ARM_INST_RSBS:
-            asm("rsb %0, %1, %2" : "=r" (myTargetPC) : "r" (firstOperand), "r" (secondOperandAfterShift + immediateValue));
-            *targetPC = myTargetPC;
-            break;
-
-        case ARM_INST_RSC:
-        case ARM_INST_RSCS:
-            myTargetPC = secondOperandAfterShift - (firstOperand + !cpsr_c);
-            *targetPC = myTargetPC;
-            break;
-
-        case ARM_INST_SBC:
-        case ARM_INST_SBCS:
-            asm("sbc %0, %1, %2" : "=r" (myTargetPC) : "r" (firstOperand), "r" (secondOperandAfterShift + immediateValue  + !cpsr_c));
-            *targetPC = myTargetPC;
-            break;
-
-        case ARM_INST_SUB:
-        case ARM_INST_SUBS:
-            asm("sub %0, %1, %2" : "=r" (myTargetPC) : "r" (firstOperand), "r" (secondOperandAfterShift + immediateValue));
-            *targetPC = myTargetPC;
-            break;
-
-            // Logical shifts and move operations that can change the PC
-        case ARM_INST_LSL:
-        case ARM_INST_LSLS:
-        case ARM_INST_LSR:
-        case ARM_INST_LSRS:
-        case ARM_INST_MOV:
-        case ARM_INST_MOVS:
-        case ARM_INST_ROR:
-        case ARM_INST_RORS:
-        case ARM_INST_RRX:
-        case ARM_INST_RRXS:
-            myTargetPC = secondOperandAfterShift + immediateValue;
-            *targetPC = myTargetPC;
-            break;
-
-        case ARM_INST_MVN:
-        case ARM_INST_MVNS:
-            myTargetPC = !(secondOperandAfterShift + immediateValue);
-            *targetPC = myTargetPC;
-            break;
-
-            // Load register can be used to load PC, usually with a function pointer
-        case ARM_INST_LDR:
-            switch (decodedInstruction.addressMode) {
-                case ARM_ADDR_LSWUB_IMM_POST:
-                case ARM_ADDR_LSWUB_REG_POST:
-                case ARM_ADDR_LSWUB_SCALED_POST:
-                    addressWherePCLives = baseAddress;
-                    break;
-
-                case ARM_ADDR_LSWUB_IMM:
-                case ARM_ADDR_LSWUB_REG:
-                case ARM_ADDR_LSWUB_SCALED:
-                case ARM_ADDR_LSWUB_IMM_PRE:
-                case ARM_ADDR_LSWUB_REG_PRE:
-                case ARM_ADDR_LSWUB_SCALED_PRE:
-                    addressWherePCLives = baseAddress + (addressOffsetFromRegisterAfterShift + immediateOffset);
-                    break;
-
-                default:
-                    break;
-            }
-
-            mypid = m_thread->ProcessID();
-            if (DNBProcessMemoryRead(mypid, addressWherePCLives, sizeof(nub_addr_t), &myTargetPC) !=  sizeof(nub_addr_t))
-            {
-                DNBLogError("Could not read memory at %8.8x to get targetPC when processing the pop instruction!", addressWherePCLives);
-                return false;
-            }
-
-            *targetPC = myTargetPC;
-            break;
-
-            // 32b load multiple operations can load the PC along with everything else,
-            //  usually to return from a function call
-        case ARM_INST_LDMDA:
-            mypid = m_thread->ProcessID();
-            addressWherePCLives = baseAddress;
-            if (DNBProcessMemoryRead(mypid, addressWherePCLives, sizeof(nub_addr_t), &myTargetPC) !=  sizeof(nub_addr_t))
-            {
-                DNBLogError("Could not read memory at %8.8x to get targetPC when processing the pop instruction!", addressWherePCLives);
-                return false;
-            }
-
-            *targetPC = myTargetPC;
-            break;
-
-        case ARM_INST_LDMDB:
-            mypid = m_thread->ProcessID();
-            addressWherePCLives = baseAddress - 4;
-            if (DNBProcessMemoryRead(mypid, addressWherePCLives, sizeof(nub_addr_t), &myTargetPC) !=  sizeof(nub_addr_t))
-            {
-                DNBLogError("Could not read memory at %8.8x to get targetPC when processing the pop instruction!", addressWherePCLives);
-                return false;
-            }
-
-            *targetPC = myTargetPC;
-            break;
-
-        case ARM_INST_LDMIB:
-            mypid = m_thread->ProcessID();
-            addressWherePCLives = baseAddress + numRegistersToLoad*4 + 4;
-            if (DNBProcessMemoryRead(mypid, addressWherePCLives, sizeof(nub_addr_t), &myTargetPC) !=  sizeof(nub_addr_t))
-            {
-                DNBLogError("Could not read memory at %8.8x to get targetPC when processing the pop instruction!", addressWherePCLives);
-                return false;
-            }
-
-            *targetPC = myTargetPC;
-            break;
-
-        case ARM_INST_LDMIA: // same as pop
-            // Normal 16-bit LD multiple can't touch R15, but POP can
-        case ARM_INST_POP:  // Can also get the PC & updates SP
-            mypid = m_thread->ProcessID();
-            addressWherePCLives = baseAddress + numRegistersToLoad*4;
-            if (DNBProcessMemoryRead(mypid, addressWherePCLives, sizeof(nub_addr_t), &myTargetPC) !=  sizeof(nub_addr_t))
-            {
-                DNBLogError("Could not read memory at %8.8x to get targetPC when processing the pop instruction!", addressWherePCLives);
-                return false;
-            }
-
-            *targetPC = myTargetPC;
-            break;
-
-            // 16b TBB and TBH instructions load a jump address from a table
-        case ARM_INST_TBB:
-            mypid = m_thread->ProcessID();
-            addressWherePCLives = baseAddress + addressOffsetFromRegisterAfterShift;
-            if (DNBProcessMemoryRead(mypid, addressWherePCLives, 1, &halfwords) !=  1)
-            {
-                DNBLogError("Could not read memory at %8.8x to get targetPC when processing the TBB instruction!", addressWherePCLives);
-                return false;
-            }
-            // add 4 to currentPC since we are in Thumb mode and then add 2*halfwords
-            *targetPC = (currentPC + 4) + 2*halfwords;
-            break;
-
-        case ARM_INST_TBH:
-            mypid = m_thread->ProcessID();
-            addressWherePCLives = ((baseAddress + (addressOffsetFromRegisterAfterShift << 1)) & ~0x1);
-            if (DNBProcessMemoryRead(mypid, addressWherePCLives, 2, &halfwords) !=  2)
-            {
-                DNBLogError("Could not read memory at %8.8x to get targetPC when processing the TBH instruction!", addressWherePCLives);
-                return false;
-            }
-            // add 4 to currentPC since we are in Thumb mode and then add 2*halfwords
-            *targetPC = (currentPC + 4) + 2*halfwords;
-            break;
-
-            // ThumbEE branch-to-handler instructions: Jump to handlers at some offset
-            //  from a special base pointer register (which is unknown at disassembly time)
-        case ARM_INST_HB:
-        case ARM_INST_HBP:
-            //          TODO: ARM_INST_HB, ARM_INST_HBP
-            break;
-
-        case ARM_INST_HBL:
-        case ARM_INST_HBLP:
-            //          TODO: ARM_INST_HBL, ARM_INST_HBLP
-            break;
-
-            // Breakpoint and software interrupt jump to interrupt handler (always ARM)
-        case ARM_INST_BKPT:
-        case ARM_INST_SMC:
-        case ARM_INST_SVC:
-            //          TODO: ARM_INST_BKPT, ARM_INST_SMC, ARM_INST_SVC
-            break;
-
-            // Return from exception, obviously modifies PC [interrupt only!]
-        case ARM_INST_RFEDA:
-        case ARM_INST_RFEDB:
-        case ARM_INST_RFEIA:
-        case ARM_INST_RFEIB:
-            //          TODO: ARM_INST_RFEDA, ARM_INST_RFEDB, ARM_INST_RFEIA, ARM_INST_RFEIB
-            break;
-
-            // Other instructions either can't change R15 or are "undefined" if you do,
-            //  so no sane compiler should ever generate them & we don't care here.
-            //  Also, R15 can only legally be used in a read-only manner for the
-            //  various ARM addressing mode (to get PC-relative addressing of constants),
-            //  but can NOT be used with any of the update modes.
-        default:
-            DNBLogError("%s should not be called for instruction code %d!", __FUNCTION__, decodedInstruction.instruction->code);
-            return false;
-            break;
-    }
-
-    return true;
-}
-
-void
-DNBArchMachARM::EvaluateNextInstructionForSoftwareBreakpointSetup(nub_addr_t currentPC, uint32_t cpsr, bool currentPCIsThumb, nub_addr_t *nextPC, bool *nextPCIsThumb)
-{
-    DNBLogThreadedIf(LOG_STEP | LOG_VERBOSE, "DNBArchMachARM::EvaluateNextInstructionForSoftwareBreakpointSetup() called");
-
-    nub_addr_t targetPC = INVALID_NUB_ADDRESS;
-    uint32_t registerValue;
-    arm_error_t decodeError;
-    nub_addr_t currentPCInITBlock, nextPCInITBlock;
-    int i;
-    bool last_decoded_instruction_executes = true;
-
-    DNBLogThreadedIf(LOG_STEP | LOG_VERBOSE, "%s: default nextPC=0x%8.8x (%s)", __FUNCTION__, *nextPC, *nextPCIsThumb ? "Thumb" : "ARM");
-
-    // Update *nextPC and *nextPCIsThumb for special cases
-    if (m_last_decode_thumb.itBlockRemaining) // we are in an IT block
-    {
-        // Set the nextPC to the PC of the instruction which will execute in the IT block
-        // If none of the instruction execute in the IT block based on the condition flags,
-        // then point to the instruction immediately following the IT block
-        const int itBlockRemaining = m_last_decode_thumb.itBlockRemaining;
-        DNBLogThreadedIf(LOG_STEP | LOG_VERBOSE, "%s: itBlockRemaining=%8.8x", __FUNCTION__, itBlockRemaining);
-
-        // Determine the PC at which the next instruction resides
-        if (m_last_decode_arm.thumb16b)
-            currentPCInITBlock = currentPC + 2;
-        else
-            currentPCInITBlock = currentPC + 4;
-
-        for (i = 0; i < itBlockRemaining; i++)
-        {
-            DNBLogThreadedIf(LOG_STEP | LOG_VERBOSE, "%s: currentPCInITBlock=%8.8x", __FUNCTION__, currentPCInITBlock);
-            decodeError = DecodeInstructionUsingDisassembler(currentPCInITBlock, cpsr, &m_last_decode_arm, &m_last_decode_thumb, &nextPCInITBlock);
-
-            if (decodeError != ARM_SUCCESS)
-                DNBLogError("unable to disassemble instruction at 0x%8.8llx", (uint64_t)currentPCInITBlock);
-
-            DNBLogThreadedIf(LOG_STEP | LOG_VERBOSE, "%s: condition=%d", __FUNCTION__, m_last_decode_arm.condition);
-            if (ConditionPassed(m_last_decode_arm.condition, cpsr))
-            {
-                DNBLogThreadedIf(LOG_STEP | LOG_VERBOSE, "%s: Condition codes matched for instruction %d", __FUNCTION__, i);
-                break; // break from the for loop
-            }
-            else
-            {
-                DNBLogThreadedIf(LOG_STEP | LOG_VERBOSE, "%s: Condition codes DID NOT matched for instruction %d", __FUNCTION__, i);
-            }
-
-            // update currentPC and nextPCInITBlock
-            currentPCInITBlock = nextPCInITBlock;
-        }
-
-        if (i == itBlockRemaining) // We came out of the IT block without executing any instructions
-            last_decoded_instruction_executes = false;
-
-        *nextPC = currentPCInITBlock;
-        DNBLogThreadedIf(LOG_STEP | LOG_VERBOSE, "%s: After IT block step-through: *nextPC=%8.8x", __FUNCTION__, *nextPC);
-    }
-
-    DNBLogThreadedIf(LOG_STEP | LOG_VERBOSE,
-                    "%s: cpsr = %8.8x, thumb16b = %d, thumb = %d, branch = %d, conditional = %d, knownTarget = %d, links = %d, canSwitchMode = %d, doesSwitchMode = %d",
-                    __FUNCTION__,
-                    cpsr,
-                    m_last_decode_arm.thumb16b,
-                    m_last_decode_arm.thumb,
-                    m_last_decode_arm.branch,
-                    m_last_decode_arm.conditional,
-                    m_last_decode_arm.knownTarget,
-                    m_last_decode_arm.links,
-                    m_last_decode_arm.canSwitchMode,
-                    m_last_decode_arm.doesSwitchMode);
-
-
-    if (last_decoded_instruction_executes &&                    // Was this a conditional instruction that did execute?
-        m_last_decode_arm.branch &&                             // Can this instruction change the PC?
-        (m_last_decode_arm.instruction->code != ARM_INST_SVC))  // If this instruction is not an SVC instruction
-    {
-        // Set targetPC. Compute if needed.
-        if (m_last_decode_arm.knownTarget)
-        {
-            // Fixed, known PC-relative
-            targetPC = m_last_decode_arm.targetPC;
-        }
-        else
-        {
-            // if targetPC is not known at compile time (PC-relative target), compute targetPC
-            if (!ComputeNextPC(currentPC, m_last_decode_arm, currentPCIsThumb, &targetPC))
-            {
-                DNBLogError("%s: Unable to compute targetPC for instruction at 0x%8.8llx", __FUNCTION__, (uint64_t)currentPC);
-                targetPC = INVALID_NUB_ADDRESS;
-            }
-        }
-
-        DNBLogThreadedIf(LOG_STEP | LOG_VERBOSE, "%s: targetPC=0x%8.8x, cpsr=0x%8.8x, condition=0x%hhx", __FUNCTION__, targetPC, cpsr, m_last_decode_arm.condition);
-
-        // Refine nextPC computation
-        if ((m_last_decode_arm.instruction->code == ARM_INST_CBZ) ||
-            (m_last_decode_arm.instruction->code == ARM_INST_CBNZ))
-        {
-            // Compare and branch on zero/non-zero (Thumb-16 only)
-            // Unusual condition check built into the instruction
-            registerValue = m_state.context.gpr.__r[m_last_decode_arm.op[REG_RD].value];
-
-            if (m_last_decode_arm.instruction->code == ARM_INST_CBZ)
-            {
-                if (registerValue == 0)
-                    *nextPC = targetPC;
-            }
-            else
-            {
-                if (registerValue != 0)
-                    *nextPC = targetPC;
-            }
-        }
-        else if (m_last_decode_arm.conditional) // Is the change conditional on flag results?
-        {
-            if (ConditionPassed(m_last_decode_arm.condition, cpsr)) // conditions match
-            {
-                DNBLogThreadedIf(LOG_STEP | LOG_VERBOSE, "%s: Condition matched!", __FUNCTION__);
-                *nextPC = targetPC;
-            }
-            else
-            {
-                DNBLogThreadedIf(LOG_STEP | LOG_VERBOSE, "%s: Condition did not match!", __FUNCTION__);
-            }
-        }
-        else
-        {
-            *nextPC = targetPC;
-        }
-
-        // Refine nextPCIsThumb computation
-        if (m_last_decode_arm.doesSwitchMode)
-        {
-            *nextPCIsThumb = !currentPCIsThumb;
-        }
-        else if (m_last_decode_arm.canSwitchMode)
-        {
-            // Legal to switch ARM <--> Thumb mode with this branch
-            // dependent on bit[0] of targetPC
-            *nextPCIsThumb = (*nextPC & 1u) != 0;
-        }
-        else
-        {
-            *nextPCIsThumb = currentPCIsThumb;
-        }
-    }
-
-    DNBLogThreadedIf(LOG_STEP, "%s: calculated nextPC=0x%8.8x (%s)", __FUNCTION__, *nextPC, *nextPCIsThumb ? "Thumb" : "ARM");
-}
-
-
-arm_error_t
-DNBArchMachARM::DecodeInstructionUsingDisassembler(nub_addr_t curr_pc, uint32_t curr_cpsr, arm_decoded_instruction_t *decodedInstruction, thumb_static_data_t *thumbStaticData, nub_addr_t *next_pc)
-{
-
-    DNBLogThreadedIf(LOG_STEP | LOG_VERBOSE, "%s: pc=0x%8.8x, cpsr=0x%8.8x", __FUNCTION__, curr_pc, curr_cpsr);
-
-    const uint32_t isetstate_mask = MASK_CPSR_T | MASK_CPSR_J;
-    const uint32_t curr_isetstate = curr_cpsr & isetstate_mask;
-    uint32_t opcode32;
-    nub_addr_t nextPC = curr_pc;
-    arm_error_t decodeReturnCode = ARM_SUCCESS;
-
-    m_last_decode_pc = curr_pc;
-    DNBLogThreadedIf(LOG_STEP | LOG_VERBOSE, "%s: last_decode_pc=0x%8.8x", __FUNCTION__, m_last_decode_pc);
-
-    switch (curr_isetstate) {
-        case 0x0: // ARM Instruction
-            // Read the ARM opcode
-            if (m_thread->Process()->Task().ReadMemory(curr_pc, 4, &opcode32) != 4)
-            {
-                DNBLogError("unable to read opcode bits 31:0 for an ARM opcode at 0x%8.8llx", (uint64_t)curr_pc);
-                decodeReturnCode = ARM_ERROR;
-            }
-            else
-            {
-                nextPC += 4;
-                decodeReturnCode = ArmDisassembler((uint64_t)curr_pc, opcode32, false, decodedInstruction, NULL, 0, NULL, 0);
-
-                if (decodeReturnCode != ARM_SUCCESS)
-                    DNBLogError("Unable to decode ARM instruction 0x%8.8x at 0x%8.8llx", opcode32, (uint64_t)curr_pc);
-            }
-            break;
-
-        case 0x20: // Thumb Instruction
-            uint16_t opcode16;
-            // Read the a 16 bit Thumb opcode
-            if (m_thread->Process()->Task().ReadMemory(curr_pc, 2, &opcode16) != 2)
-            {
-                DNBLogError("unable to read opcode bits 15:0 for a thumb opcode at 0x%8.8llx", (uint64_t)curr_pc);
-                decodeReturnCode = ARM_ERROR;
-            }
-            else
-            {
-                nextPC += 2;
-                opcode32 = opcode16;
-
-                decodeReturnCode = ThumbDisassembler((uint64_t)curr_pc, opcode16, false, false, thumbStaticData, decodedInstruction, NULL, 0, NULL, 0);
-
-                switch (decodeReturnCode) {
-                    case ARM_SKIP:
-                        // 32 bit thumb opcode
-                        nextPC += 2;
-                        if (m_thread->Process()->Task().ReadMemory(curr_pc+2, 2, &opcode16) != 2)
-                        {
-                            DNBLogError("unable to read opcode bits 15:0 for a thumb opcode at 0x%8.8llx", (uint64_t)curr_pc+2);
-                        }
-                        else
-                        {
-                            opcode32 = (opcode32 << 16) | opcode16;
-
-                            decodeReturnCode = ThumbDisassembler((uint64_t)(curr_pc+2), opcode16, false, false, thumbStaticData, decodedInstruction, NULL, 0, NULL, 0);
-
-                            if (decodeReturnCode != ARM_SUCCESS)
-                                DNBLogError("Unable to decode 2nd half of Thumb instruction 0x%8.4hx at 0x%8.8llx", opcode16, (uint64_t)curr_pc+2);
-                            break;
-                        }
-                        break;
-
-                    case ARM_SUCCESS:
-                        // 16 bit thumb opcode; at this point we are done decoding the opcode
-                        break;
-
-                    default:
-                        DNBLogError("Unable to decode Thumb instruction 0x%8.4hx at 0x%8.8llx", opcode16, (uint64_t)curr_pc);
-                        decodeReturnCode = ARM_ERROR;
-                        break;
+                    exc.exc_data.push_back(hw_index);
                 }
-            }
-            break;
 
-        default:
+                return true;
+            }
             break;
     }
-
-    if (next_pc)
-        *next_pc = nextPC;
-
-    return decodeReturnCode;
+    return false;
 }
 
-#endif
-
-nub_bool_t
-DNBArchMachARM::BreakpointHit (nub_process_t pid, nub_thread_t tid, nub_break_t breakID, void *baton)
+bool
+DNBArchMachARM::StepNotComplete ()
 {
-    nub_addr_t bkpt_pc = (nub_addr_t)baton;
-    DNBLogThreadedIf(LOG_STEP | LOG_VERBOSE, "%s(pid = %i, tid = %4.4x, breakID = %u, baton = %p): Setting PC to 0x%8.8x", __FUNCTION__, pid, tid, breakID, baton, bkpt_pc);
-    
-    DNBRegisterValue pc_value;
-    DNBThreadGetRegisterValueByID (pid, tid, REGISTER_SET_GENERIC, GENERIC_REGNUM_PC, &pc_value);
-    pc_value.value.uint32 = bkpt_pc;
-    return DNBThreadSetRegisterValueByID (pid, tid, REGISTER_SET_GENERIC, GENERIC_REGNUM_PC, &pc_value);
+    if (m_hw_single_chained_step_addr != INVALID_NUB_ADDRESS)
+    {
+        kern_return_t kret = KERN_INVALID_ARGUMENT;
+        kret = GetGPRState(false);
+        if (kret == KERN_SUCCESS)
+        {
+            if (m_state.context.gpr.__pc == m_hw_single_chained_step_addr)
+            {
+                DNBLogThreadedIf(LOG_STEP, "Need to step some more at 0x%8.8x", m_hw_single_chained_step_addr);
+                return true;
+            }
+        }
+    }
+
+    m_hw_single_chained_step_addr = INVALID_NUB_ADDRESS;
+    return false;
 }
 
+
 // Set the single step bit in the processor status register.
 kern_return_t
-DNBArchMachARM::SetSingleStepSoftwareBreakpoints()
+DNBArchMachARM::EnableHardwareSingleStep (bool enable)
 {
     DNBError err;
+    DNBLogThreadedIf(LOG_STEP, "%s( enable = %d )", __FUNCTION__, enable);
 
-#if defined (USE_ARM_DISASSEMBLER_FRAMEWORK)
     err = GetGPRState(false);
 
     if (err.Fail())
@@ -1949,192 +553,164 @@ DNBArchMachARM::SetSingleStepSoftwareBre
         return err.Error();
     }
 
-    nub_addr_t curr_pc = m_state.context.gpr.__pc;
-    uint32_t curr_cpsr = m_state.context.gpr.__cpsr;
-    nub_addr_t next_pc = curr_pc;
-
-    bool curr_pc_is_thumb = (m_state.context.gpr.__cpsr & 0x20) != 0;
-    bool next_pc_is_thumb = curr_pc_is_thumb;
-
-    uint32_t curr_itstate = ((curr_cpsr & 0x6000000) >> 25) | ((curr_cpsr & 0xFC00) >> 8);
-    bool inITBlock = (curr_itstate & 0xF) ? 1 : 0;
-    bool lastInITBlock = ((curr_itstate & 0xF) == 0x8) ? 1 : 0;
-
-    DNBLogThreadedIf(LOG_STEP | LOG_VERBOSE, "%s: curr_pc=0x%8.8x (%s), curr_itstate=0x%x, inITBlock=%d, lastInITBlock=%d", __FUNCTION__, curr_pc, curr_pc_is_thumb ? "Thumb" : "ARM", curr_itstate, inITBlock, lastInITBlock);
-
-    // If the instruction is not in the IT block, then decode using the Disassembler and compute next_pc
-    if (!inITBlock)
-    {
-        DNBLogThreadedIf(LOG_STEP | LOG_VERBOSE, "%s: Decoding an instruction NOT in the IT block", __FUNCTION__);
-
-        arm_error_t decodeReturnCode =  DecodeInstructionUsingDisassembler(curr_pc, curr_cpsr, &m_last_decode_arm, &m_last_decode_thumb, &next_pc);
+    err = GetDBGState(false);
 
-        if (decodeReturnCode != ARM_SUCCESS)
-        {
-            err = KERN_INVALID_ARGUMENT;
-            DNBLogError("DNBArchMachARM::SetSingleStepSoftwareBreakpoints: Unable to disassemble instruction at 0x%8.8llx", (uint64_t)curr_pc);
-        }
-    }
-    else
+    if (err.Fail())
     {
-        next_pc = curr_pc + ((m_last_decode_arm.thumb16b) ? 2 : 4);
+        err.LogThreaded("%s: failed to read the DBG registers", __FUNCTION__);
+        return err.Error();
     }
 
-    // Instruction is NOT in the IT block OR
-    if (!inITBlock)
-    {
-        DNBLogThreadedIf(LOG_STEP | LOG_VERBOSE, "%s: normal instruction", __FUNCTION__);
-        EvaluateNextInstructionForSoftwareBreakpointSetup(curr_pc, m_state.context.gpr.__cpsr, curr_pc_is_thumb, &next_pc, &next_pc_is_thumb);
-    }
-    else if (inITBlock && !m_last_decode_arm.setsFlags)
-    {
-        DNBLogThreadedIf(LOG_STEP | LOG_VERBOSE, "%s: IT instruction that doesn't set flags", __FUNCTION__);
-        EvaluateNextInstructionForSoftwareBreakpointSetup(curr_pc, m_state.context.gpr.__cpsr, curr_pc_is_thumb, &next_pc, &next_pc_is_thumb);
-    }
-    else if (lastInITBlock && m_last_decode_arm.branch)
-    {
-        DNBLogThreadedIf(LOG_STEP | LOG_VERBOSE, "%s: IT instruction which last in the IT block and is a branch", __FUNCTION__);
-        EvaluateNextInstructionForSoftwareBreakpointSetup(curr_pc, m_state.context.gpr.__cpsr, curr_pc_is_thumb, &next_pc, &next_pc_is_thumb);
-    }
-    else
+    const uint32_t i = 0;
+    if (enable)
     {
-        // Instruction is in IT block and can modify the CPSR flags
-        DNBLogThreadedIf(LOG_STEP | LOG_VERBOSE, "%s: IT instruction that sets flags", __FUNCTION__);
-
-        // NOTE: When this point of code is reached, the instruction at curr_pc has already been decoded
-        // inside the function ThreadDidStop(). Therefore m_last_decode_arm, m_last_decode_thumb
-        // reflect the decoded instruction at curr_pc
-
-        // If we find an instruction inside the IT block which will set/modify the condition flags (NZCV bits in CPSR),
-        // we set breakpoints at all remaining instructions inside the IT block starting from the instruction immediately
-        // following this one AND a breakpoint at the instruction immediately following the IT block. We do this because
-        // we cannot determine the next_pc until the instruction at which we are currently stopped executes. Hence we
-        // insert (m_last_decode_thumb.itBlockRemaining+1) 16-bit Thumb breakpoints at consecutive memory locations
-        // starting at addrOfNextInstructionInITBlock. We record these breakpoints in class variable m_sw_single_step_itblock_break_id[],
-        // and also record the total number of IT breakpoints set in the variable 'm_sw_single_step_itblock_break_count'.
-
-        // The instructions inside the IT block, which are replaced by the 16-bit Thumb breakpoints (opcode=0xDEFE)
-        // instructions, can be either Thumb-16 or Thumb-32. When a Thumb-32 instruction (say, inst#1) is replaced  Thumb
-        // by a 16-bit breakpoint (OS only supports 16-bit breakpoints in Thumb mode and 32-bit breakpoints in ARM mode), the
-        // breakpoint for the next instruction (say instr#2) is saved in the upper half of this Thumb-32 (instr#1)
-        // instruction. Hence if the execution stops at Breakpoint2 corresponding to instr#2, the PC is offset by 16-bits.
-        // We therefore have to keep track of PC of each instruction in the IT block that is being replaced with the 16-bit
-        // Thumb breakpoint, to ensure that when the breakpoint is hit, the PC is adjusted to the correct value. We save
-        // the actual PC corresponding to each instruction in the IT block by associating a call back with each breakpoint
-        // we set and passing it as a baton. When the breakpoint hits and the callback routine is called, the routine
-        // adjusts the PC based on the baton that is passed to it.
-
-        nub_addr_t addrOfNextInstructionInITBlock, pcInITBlock, nextPCInITBlock, bpAddressInITBlock;
-        uint16_t opcode16;
-        uint32_t opcode32;
-
-        addrOfNextInstructionInITBlock = (m_last_decode_arm.thumb16b) ? curr_pc + 2 : curr_pc + 4;
-
-        pcInITBlock = addrOfNextInstructionInITBlock;
-
-        DNBLogThreadedIf(LOG_STEP | LOG_VERBOSE, "%s: itBlockRemaining=%d", __FUNCTION__, m_last_decode_thumb.itBlockRemaining);
+        m_hw_single_chained_step_addr = INVALID_NUB_ADDRESS;
 
-        m_sw_single_step_itblock_break_count = 0;
-        for (int i = 0; i <= m_last_decode_thumb.itBlockRemaining; i++)
+        // Save our previous state
+        m_dbg_save = m_state.dbg;
+        // Set a breakpoint that will stop when the PC doesn't match the current one!
+        m_state.dbg.__bvr[i] = m_state.context.gpr.__pc & 0xFFFFFFFCu;      // Set the current PC as the breakpoint address
+        m_state.dbg.__bcr[i] = BCR_M_IMVA_MISMATCH |    // Stop on address mismatch
+                               S_USER |                 // Stop only in user mode
+                               BCR_ENABLE;              // Enable this breakpoint
+        if (m_state.context.gpr.__cpsr & 0x20)
         {
-            if (NUB_BREAK_ID_IS_VALID(m_sw_single_step_itblock_break_id[i]))
-            {
-                DNBLogError("FunctionProfiler::SetSingleStepSoftwareBreakpoints(): Array m_sw_single_step_itblock_break_id should not contain any valid breakpoint IDs at this point. But found a valid breakID=%d at index=%d", m_sw_single_step_itblock_break_id[i], i);
-            }
+            // Thumb breakpoint
+            if (m_state.context.gpr.__pc & 2)
+                m_state.dbg.__bcr[i] |= BAS_IMVA_2_3;
             else
+                m_state.dbg.__bcr[i] |= BAS_IMVA_0_1;
+
+            uint16_t opcode;
+            if (sizeof(opcode) == m_thread->Process()->Task().ReadMemory(m_state.context.gpr.__pc, sizeof(opcode), &opcode))
             {
-                nextPCInITBlock = pcInITBlock;
-                // Compute nextPCInITBlock based on opcode present at pcInITBlock
-                if (m_thread->Process()->Task().ReadMemory(pcInITBlock, 2, &opcode16) == 2)
+                if (((opcode & 0xE000) == 0xE000) && opcode & 0x1800)
                 {
-                    opcode32 = opcode16;
-                    nextPCInITBlock += 2;
-
-                    // Check for 32 bit thumb opcode and read the upper 16 bits if needed
-                    if (((opcode32 & 0xE000) == 0xE000) && (opcode32 & 0x1800))
+                    // 32 bit thumb opcode...
+                    if (m_state.context.gpr.__pc & 2)
                     {
-                        // Adjust 'next_pc_in_itblock' to point to the default next Thumb instruction for
-                        // a 32 bit Thumb opcode
-                        // Read bits 31:16 of a 32 bit Thumb opcode
-                        if (m_thread->Process()->Task().ReadMemory(pcInITBlock+2, 2, &opcode16) == 2)
-                        {
-                            // 32 bit thumb opcode
-                            opcode32 = (opcode32 << 16) | opcode16;
-                            nextPCInITBlock += 2;
-                        }
-                        else
-                        {
-                            DNBLogError("FunctionProfiler::SetSingleStepSoftwareBreakpoints(): Unable to read opcode bits 31:16 for a 32 bit thumb opcode at pc=0x%8.8llx", (uint64_t)nextPCInITBlock);
-                        }
+                        // We can't take care of a 32 bit thumb instruction single step
+                        // with just IVA mismatching. We will need to chain an extra
+                        // hardware single step in order to complete this single step...
+                        m_hw_single_chained_step_addr = m_state.context.gpr.__pc + 2;
+                    }
+                    else
+                    {
+                        // Extend the number of bits to ignore for the mismatch
+                        m_state.dbg.__bcr[i] |= BAS_IMVA_ALL;
                     }
-                }
-                else
-                {
-                    DNBLogError("FunctionProfiler::SetSingleStepSoftwareBreakpoints(): Error reading 16-bit Thumb instruction at pc=0x%8.8x", nextPCInITBlock);
-                }
-
-
-                // Set breakpoint and associate a callback function with it
-                bpAddressInITBlock = addrOfNextInstructionInITBlock + 2*i;
-                DNBLogThreadedIf(LOG_STEP | LOG_VERBOSE, "%s: Setting IT breakpoint[%d] at address: 0x%8.8x", __FUNCTION__, i, bpAddressInITBlock);
-
-                m_sw_single_step_itblock_break_id[i] = m_thread->Process()->CreateBreakpoint(bpAddressInITBlock, 2, false, m_thread->ThreadID());
-                if (!NUB_BREAK_ID_IS_VALID(m_sw_single_step_itblock_break_id[i]))
-                    err = KERN_INVALID_ARGUMENT;
-                else
-                {
-                    DNBLogThreadedIf(LOG_STEP, "%s: Set IT breakpoint[%i]=%d set at 0x%8.8x for instruction at 0x%8.8x", __FUNCTION__, i, m_sw_single_step_itblock_break_id[i], bpAddressInITBlock, pcInITBlock);
-
-                    // Set the breakpoint callback for these special IT breakpoints
-                    // so that if one of these breakpoints gets hit, it knows to
-                    // update the PC to the original address of the conditional
-                    // IT instruction.
-                    DNBBreakpointSetCallback(m_thread->ProcessID(), m_sw_single_step_itblock_break_id[i], DNBArchMachARM::BreakpointHit, (void*)pcInITBlock);
-                    m_sw_single_step_itblock_break_count++;
                 }
             }
-
-            pcInITBlock = nextPCInITBlock;
+        }
+        else
+        {
+            // ARM breakpoint
+            m_state.dbg.__bcr[i] |= BAS_IMVA_ALL; // Stop when any address bits change
         }
 
-        DNBLogThreadedIf(LOG_STEP | LOG_VERBOSE, "%s: Set %u IT software single breakpoints.", __FUNCTION__, m_sw_single_step_itblock_break_count);
-
-    }
-
-    DNBLogThreadedIf(LOG_STEP, "%s: next_pc=0x%8.8x (%s)", __FUNCTION__, next_pc, next_pc_is_thumb ? "Thumb" : "ARM");
-
-    if (next_pc & 0x1)
-    {
-        assert(next_pc_is_thumb);
-    }
+        DNBLogThreadedIf(LOG_STEP, "%s: BVR%u=0x%8.8x  BCR%u=0x%8.8x", __FUNCTION__, i, m_state.dbg.__bvr[i], i, m_state.dbg.__bcr[i]);
 
-    if (next_pc_is_thumb)
-    {
-        next_pc &= ~0x1;
+        for (uint32_t j=i+1; j<16; ++j)
+        {
+            // Disable all others
+            m_state.dbg.__bvr[j] = 0;
+            m_state.dbg.__bcr[j] = 0;
+        }
     }
     else
     {
-        assert((next_pc & 0x3) == 0);
+        // Just restore the state we had before we did single stepping
+        m_state.dbg = m_dbg_save;
     }
 
-    if (!inITBlock || (inITBlock && !m_last_decode_arm.setsFlags) || (lastInITBlock && m_last_decode_arm.branch))
-    {
-        err = KERN_SUCCESS;
+    return SetDBGState();
+}
 
-        const DNBBreakpoint *bp = m_thread->Process()->Breakpoints().FindByAddress(next_pc);
+// return 1 if bit "BIT" is set in "value"
+static inline uint32_t bit(uint32_t value, uint32_t bit)
+{
+    return (value >> bit) & 1u;
+}
 
-        if (bp == NULL)
-        {
-            m_sw_single_step_break_id = m_thread->Process()->CreateBreakpoint(next_pc, next_pc_is_thumb ? 2 : 4, false, m_thread->ThreadID());
-            if (!NUB_BREAK_ID_IS_VALID(m_sw_single_step_break_id))
-                err = KERN_INVALID_ARGUMENT;
-            DNBLogThreadedIf(LOG_STEP, "%s: software single step breakpoint with breakID=%d set at 0x%8.8x", __FUNCTION__, m_sw_single_step_break_id, next_pc);
-        }
+// return the bitfield "value[msbit:lsbit]".
+static inline uint32_t bits(uint32_t value, uint32_t msbit, uint32_t lsbit)
+{
+    assert(msbit >= lsbit);
+    uint32_t shift_left = sizeof(value) * 8 - 1 - msbit;
+    value <<= shift_left;           // shift anything above the msbit off of the unsigned edge
+    value >>= (shift_left + lsbit); // shift it back again down to the lsbit (including undoing any shift from above)
+    return value;                   // return our result
+}
+
+bool
+DNBArchMachARM::ConditionPassed(uint8_t condition, uint32_t cpsr)
+{
+    uint32_t cpsr_n = bit(cpsr, 31); // Negative condition code flag
+    uint32_t cpsr_z = bit(cpsr, 30); // Zero condition code flag
+    uint32_t cpsr_c = bit(cpsr, 29); // Carry condition code flag
+    uint32_t cpsr_v = bit(cpsr, 28); // Overflow condition code flag
+
+    switch (condition) {
+        case COND_EQ: // (0x0)
+            if (cpsr_z == 1) return true;
+            break;
+        case COND_NE: // (0x1)
+            if (cpsr_z == 0) return true;
+            break;
+        case COND_CS: // (0x2)
+            if (cpsr_c == 1) return true;
+            break;
+        case COND_CC: // (0x3)
+            if (cpsr_c == 0) return true;
+            break;
+        case COND_MI: // (0x4)
+            if (cpsr_n == 1) return true;
+            break;
+        case COND_PL: // (0x5)
+            if (cpsr_n == 0) return true;
+            break;
+        case COND_VS: // (0x6)
+            if (cpsr_v == 1) return true;
+            break;
+        case COND_VC: // (0x7)
+            if (cpsr_v == 0) return true;
+            break;
+        case COND_HI: // (0x8)
+            if ((cpsr_c == 1) && (cpsr_z == 0)) return true;
+            break;
+        case COND_LS: // (0x9)
+            if ((cpsr_c == 0) || (cpsr_z == 1)) return true;
+            break;
+        case COND_GE: // (0xA)
+            if (cpsr_n == cpsr_v) return true;
+            break;
+        case COND_LT: // (0xB)
+            if (cpsr_n != cpsr_v) return true;
+            break;
+        case COND_GT: // (0xC)
+            if ((cpsr_z == 0) && (cpsr_n == cpsr_v)) return true;
+            break;
+        case COND_LE: // (0xD)
+            if ((cpsr_z == 1) || (cpsr_n != cpsr_v)) return true;
+            break;
+        default:
+            return true;
+            break;
     }
-#else
-    err.LogThreaded("%s: ARMDisassembler.framework support is disabled", __FUNCTION__);
-#endif
-    return err.Error();
+
+    return false;
+}
+
+nub_bool_t
+DNBArchMachARM::BreakpointHit (nub_process_t pid, nub_thread_t tid, nub_break_t breakID, void *baton)
+{
+    nub_addr_t bkpt_pc = (nub_addr_t)baton;
+    DNBLogThreadedIf(LOG_STEP | LOG_VERBOSE, "%s(pid = %i, tid = %4.4x, breakID = %u, baton = %p): Setting PC to 0x%8.8x", __FUNCTION__, pid, tid, breakID, baton, bkpt_pc);
+    
+    DNBRegisterValue pc_value;
+    DNBThreadGetRegisterValueByID (pid, tid, REGISTER_SET_GENERIC, GENERIC_REGNUM_PC, &pc_value);
+    pc_value.value.uint32 = bkpt_pc;
+    return DNBThreadSetRegisterValueByID (pid, tid, REGISTER_SET_GENERIC, GENERIC_REGNUM_PC, &pc_value);
 }
 
 uint32_t
@@ -2288,9 +864,9 @@ DNBArchMachARM::EnableHardwareBreakpoint
                                         byte_addr_select |  // Set the correct byte address select so we only trigger on the correct opcode
                                         S_USER |            // Which modes should this breakpoint stop in?
                                         BCR_ENABLE;         // Enable this hardware breakpoint
-                DNBLogThreadedIf (LOG_BREAKPOINTS, "DNBArchMachARM::EnableHardwareBreakpoint( addr = 0x%8.8llx, size = %zu ) - BVR%u/BCR%u = 0x%8.8x / 0x%8.8x (Thumb)",
+                DNBLogThreadedIf (LOG_BREAKPOINTS, "DNBArchMachARM::EnableHardwareBreakpoint( addr = 0x%8.8llx, size = %llu ) - BVR%u/BCR%u = 0x%8.8x / 0x%8.8x (Thumb)",
                                   (uint64_t)addr,
-                                  size,
+                                  (uint64_t)size,
                                   i,
                                   i,
                                   m_state.dbg.__bvr[i],
@@ -2303,9 +879,9 @@ DNBArchMachARM::EnableHardwareBreakpoint
                                         BAS_IMVA_ALL |      // Stop on any of the four bytes following the IMVA
                                         S_USER |            // Which modes should this breakpoint stop in?
                                         BCR_ENABLE;         // Enable this hardware breakpoint
-                DNBLogThreadedIf (LOG_BREAKPOINTS, "DNBArchMachARM::EnableHardwareBreakpoint( addr = 0x%8.8llx, size = %zu ) - BVR%u/BCR%u = 0x%8.8x / 0x%8.8x (ARM)",
+                DNBLogThreadedIf (LOG_BREAKPOINTS, "DNBArchMachARM::EnableHardwareBreakpoint( addr = 0x%8.8llx, size = %llu ) - BVR%u/BCR%u = 0x%8.8x / 0x%8.8x (ARM)",
                                   (uint64_t)addr,
-                                  size,
+                                  (uint64_t)size,
                                   i,
                                   i,
                                   m_state.dbg.__bvr[i],
@@ -2320,7 +896,7 @@ DNBArchMachARM::EnableHardwareBreakpoint
         }
         else
         {
-            DNBLogThreadedIf (LOG_BREAKPOINTS, "DNBArchMachARM::EnableHardwareBreakpoint(addr = 0x%8.8llx, size = %zu) => all hardware breakpoint resources are being used.", (uint64_t)addr, size);
+            DNBLogThreadedIf (LOG_BREAKPOINTS, "DNBArchMachARM::EnableHardwareBreakpoint(addr = 0x%8.8llx, size = %llu) => all hardware breakpoint resources are being used.", (uint64_t)addr, (uint64_t)size);
         }
     }
 
@@ -2361,7 +937,7 @@ static uint32_t LoHi[16] = { 0 };
 uint32_t
 DNBArchMachARM::EnableHardwareWatchpoint (nub_addr_t addr, nub_size_t size, bool read, bool write)
 {
-    DNBLogThreadedIf(LOG_WATCHPOINTS, "DNBArchMachARM::EnableHardwareWatchpoint(addr = 0x%8.8llx, size = %zu, read = %u, write = %u)", (uint64_t)addr, size, read, write);
+    DNBLogThreadedIf(LOG_WATCHPOINTS, "DNBArchMachARM::EnableHardwareWatchpoint(addr = 0x%8.8llx, size = %llu, read = %u, write = %u)", (uint64_t)addr, (uint64_t)size, read, write);
 
     const uint32_t num_hw_watchpoints = NumSupportedHardwareWatchpoints();
 
@@ -2450,6 +1026,8 @@ DNBArchMachARM::EnableHardwareWatchpoint
                                     (write ? WCR_STORE : 0) |   // Stop on write access?
                                     WCR_ENABLE;                 // Enable this watchpoint;
 
+            DNBLogThreadedIf(LOG_WATCHPOINTS, "DNBArchMachARM::EnableHardwareWatchpoint() adding watchpoint on address 0x%llx with control register value 0x%x", (uint64_t) m_state.dbg.__wvr[i], (uint32_t) m_state.dbg.__wcr[i]);
+
             kret = SetDBGState();
             //DumpDBGState(m_state.dbg);
 
@@ -2652,7 +1230,7 @@ DNBArchMachARM::GetWatchAddress(const DB
 }
 
 //----------------------------------------------------------------------
-// Register information defintions for 32 bit ARMV6.
+// Register information defintions for 32 bit ARMV7.
 //----------------------------------------------------------------------
 enum gpr_regnums
 {
@@ -2677,7 +1255,7 @@ enum gpr_regnums
 
 enum 
 {
-    vfp_s0 = 0,
+    vfp_s0 = 17, // match the g_gdb_register_map_arm table in RNBRemote.cpp
     vfp_s1,
     vfp_s2,
     vfp_s3,
@@ -2708,8 +1286,12 @@ enum
     vfp_s28,
     vfp_s29,
     vfp_s30,
-    vfp_s31,
-    vfp_d0,
+    vfp_s31
+};
+
+enum
+{
+    vfp_d0 = 49, // match the g_gdb_register_map_arm table in RNBRemote.cpp
     vfp_d1,
     vfp_d2,
     vfp_d3,
@@ -2740,114 +1322,63 @@ enum
     vfp_d28,
     vfp_d29,
     vfp_d30,
-    vfp_d31,
-    vfp_fpscr
+    vfp_d31
 };
 
 enum
 {
-    exc_exception,
-	exc_fsr,
-	exc_far,
+    vfp_q0 = 81, // match the g_gdb_register_map_arm table in RNBRemote.cpp
+    vfp_q1,
+    vfp_q2,
+    vfp_q3,
+    vfp_q4,
+    vfp_q5,
+    vfp_q6,
+    vfp_q7,
+    vfp_q8,
+    vfp_q9,
+    vfp_q10,
+    vfp_q11,
+    vfp_q12,
+    vfp_q13,
+    vfp_q14,
+    vfp_q15,
+    vfp_fpscr
 };
 
 enum
 {
-    gdb_r0 = 0,
-    gdb_r1,
-    gdb_r2,
-    gdb_r3,
-    gdb_r4,
-    gdb_r5,
-    gdb_r6,
-    gdb_r7,
-    gdb_r8,
-    gdb_r9,
-    gdb_r10,
-    gdb_r11,
-    gdb_r12,
-    gdb_sp,
-    gdb_lr,
-    gdb_pc,
-    gdb_f0,
-    gdb_f1,
-    gdb_f2,
-    gdb_f3,
-    gdb_f4,
-    gdb_f5,
-    gdb_f6,
-    gdb_f7,
-    gdb_f8,
-    gdb_cpsr,
-    gdb_s0,
-    gdb_s1,
-    gdb_s2,
-    gdb_s3,
-    gdb_s4,
-    gdb_s5,
-    gdb_s6,
-    gdb_s7,
-    gdb_s8,
-    gdb_s9,
-    gdb_s10,
-    gdb_s11,
-    gdb_s12,
-    gdb_s13,
-    gdb_s14,
-    gdb_s15,
-    gdb_s16,
-    gdb_s17,
-    gdb_s18,
-    gdb_s19,
-    gdb_s20,
-    gdb_s21,
-    gdb_s22,
-    gdb_s23,
-    gdb_s24,
-    gdb_s25,
-    gdb_s26,
-    gdb_s27,
-    gdb_s28,
-    gdb_s29,
-    gdb_s30,
-    gdb_s31,
-    gdb_fpscr,
-    gdb_d0,
-    gdb_d1,
-    gdb_d2,
-    gdb_d3,
-    gdb_d4,
-    gdb_d5,
-    gdb_d6,
-    gdb_d7,
-    gdb_d8,
-    gdb_d9,
-    gdb_d10,
-    gdb_d11,
-    gdb_d12,
-    gdb_d13,
-    gdb_d14,
-    gdb_d15
+    exc_exception,
+    exc_fsr,
+    exc_far,
 };
 
 #define GPR_OFFSET_IDX(idx) (offsetof (DNBArchMachARM::GPR, __r[idx]))
 #define GPR_OFFSET_NAME(reg) (offsetof (DNBArchMachARM::GPR, __##reg))
-#define VFP_S_OFFSET_IDX(idx) (offsetof (DNBArchMachARM::FPU, __r[(idx)]) + offsetof (DNBArchMachARM::Context, vfp))
-#define VFP_D_OFFSET_IDX(idx) (VFP_S_OFFSET_IDX ((idx) * 2))
-#define VFP_OFFSET_NAME(reg) (offsetof (DNBArchMachARM::FPU, __##reg) + offsetof (DNBArchMachARM::Context, vfp))
+
 #define EXC_OFFSET(reg)      (offsetof (DNBArchMachARM::EXC, __##reg)  + offsetof (DNBArchMachARM::Context, exc))
 
 // These macros will auto define the register name, alt name, register size,
 // register offset, encoding, format and native register. This ensures that
 // the register state structures are defined correctly and have the correct
 // sizes and offsets.
-#define DEFINE_GPR_IDX(idx, reg, alt, gen) { e_regSetGPR, gpr_##reg, #reg, alt, Uint, Hex, 4, GPR_OFFSET_IDX(idx), gcc_##reg, dwarf_##reg, gen, gdb_##reg }
-#define DEFINE_GPR_NAME(reg, alt, gen) { e_regSetGPR, gpr_##reg, #reg, alt, Uint, Hex, 4, GPR_OFFSET_NAME(reg), gcc_##reg, dwarf_##reg, gen, gdb_##reg }
-//#define FLOAT_FORMAT Float
-#define FLOAT_FORMAT Hex
-#define DEFINE_VFP_S_IDX(idx) { e_regSetVFP, vfp_s##idx, "s" #idx, NULL, IEEE754, FLOAT_FORMAT, 4, VFP_S_OFFSET_IDX(idx), INVALID_NUB_REGNUM, dwarf_s##idx, INVALID_NUB_REGNUM, gdb_s##idx }
-//#define DEFINE_VFP_D_IDX(idx) { e_regSetVFP, vfp_d##idx, "d" #idx, NULL, IEEE754, Float, 8, VFP_D_OFFSET_IDX(idx), INVALID_NUB_REGNUM, dwarf_d##idx, INVALID_NUB_REGNUM, gdb_d##idx }
-#define DEFINE_VFP_D_IDX(idx) { e_regSetVFP, vfp_d##idx, "d" #idx, NULL, IEEE754, FLOAT_FORMAT, 8, VFP_D_OFFSET_IDX(idx), INVALID_NUB_REGNUM, dwarf_d##idx, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM }
+#define DEFINE_GPR_IDX(idx, reg, alt, gen) { e_regSetGPR, gpr_##reg, #reg, alt, Uint, Hex, 4, GPR_OFFSET_IDX(idx), gcc_##reg, dwarf_##reg, gen, INVALID_NUB_REGNUM, NULL, NULL}
+#define DEFINE_GPR_NAME(reg, alt, gen, inval) { e_regSetGPR, gpr_##reg, #reg, alt, Uint, Hex, 4, GPR_OFFSET_NAME(reg), gcc_##reg, dwarf_##reg, gen, INVALID_NUB_REGNUM, NULL, inval}
+
+// In case we are debugging to a debug target that the ability to
+// change into the protected modes with folded registers (ABT, IRQ,
+// FIQ, SYS, USR, etc..), we should invalidate r8-r14 if the CPSR
+// gets modified.
+
+uint32_t g_invalidate_cpsr[] = {
+    gpr_r8,
+    gpr_r9,
+    gpr_r10,
+    gpr_r11,
+    gpr_r12,
+    gpr_sp,
+    gpr_lr,
+    INVALID_NUB_REGNUM };
 
 // General purpose registers
 const DNBRegisterInfo
@@ -2866,81 +1397,146 @@ DNBArchMachARM::g_gpr_registers[] =
     DEFINE_GPR_IDX (10, r10,  NULL, INVALID_NUB_REGNUM   ),
     DEFINE_GPR_IDX (11, r11,  NULL, INVALID_NUB_REGNUM   ),
     DEFINE_GPR_IDX (12, r12,  NULL, INVALID_NUB_REGNUM   ),
-    DEFINE_GPR_NAME (sp, "r13", GENERIC_REGNUM_SP    ),
-    DEFINE_GPR_NAME (lr, "r14", GENERIC_REGNUM_RA    ),
-    DEFINE_GPR_NAME (pc, "r15", GENERIC_REGNUM_PC    ),
-    DEFINE_GPR_NAME (cpsr, "flags", GENERIC_REGNUM_FLAGS )
+    DEFINE_GPR_NAME (sp, "r13", GENERIC_REGNUM_SP, NULL),
+    DEFINE_GPR_NAME (lr, "r14", GENERIC_REGNUM_RA, NULL),
+    DEFINE_GPR_NAME (pc, "r15", GENERIC_REGNUM_PC, NULL),
+    DEFINE_GPR_NAME (cpsr, "flags", GENERIC_REGNUM_FLAGS, g_invalidate_cpsr)
 };
 
+uint32_t g_contained_q0[] {vfp_q0, INVALID_NUB_REGNUM };
+uint32_t g_contained_q1[] {vfp_q1, INVALID_NUB_REGNUM };
+uint32_t g_contained_q2[] {vfp_q2, INVALID_NUB_REGNUM };
+uint32_t g_contained_q3[] {vfp_q3, INVALID_NUB_REGNUM };
+uint32_t g_contained_q4[] {vfp_q4, INVALID_NUB_REGNUM };
+uint32_t g_contained_q5[] {vfp_q5, INVALID_NUB_REGNUM };
+uint32_t g_contained_q6[] {vfp_q6, INVALID_NUB_REGNUM };
+uint32_t g_contained_q7[] {vfp_q7, INVALID_NUB_REGNUM };
+uint32_t g_contained_q8[] {vfp_q8, INVALID_NUB_REGNUM };
+uint32_t g_contained_q9[] {vfp_q9, INVALID_NUB_REGNUM };
+uint32_t g_contained_q10[] {vfp_q10, INVALID_NUB_REGNUM };
+uint32_t g_contained_q11[] {vfp_q11, INVALID_NUB_REGNUM };
+uint32_t g_contained_q12[] {vfp_q12, INVALID_NUB_REGNUM };
+uint32_t g_contained_q13[] {vfp_q13, INVALID_NUB_REGNUM };
+uint32_t g_contained_q14[] {vfp_q14, INVALID_NUB_REGNUM };
+uint32_t g_contained_q15[] {vfp_q15, INVALID_NUB_REGNUM };
+
+uint32_t g_invalidate_q0[]  {vfp_q0,   vfp_d0, vfp_d1,    vfp_s0, vfp_s1, vfp_s2, vfp_s3,        INVALID_NUB_REGNUM };
+uint32_t g_invalidate_q1[]  {vfp_q1,   vfp_d2, vfp_d3,    vfp_s4, vfp_s5, vfp_s6, vfp_s7,        INVALID_NUB_REGNUM };
+uint32_t g_invalidate_q2[]  {vfp_q2,   vfp_d4, vfp_d5,    vfp_s8, vfp_s9, vfp_s10, vfp_s11,      INVALID_NUB_REGNUM };
+uint32_t g_invalidate_q3[]  {vfp_q3,   vfp_d6, vfp_d7,    vfp_s12, vfp_s13, vfp_s14, vfp_s15,    INVALID_NUB_REGNUM };
+uint32_t g_invalidate_q4[]  {vfp_q4,   vfp_d8, vfp_d9,    vfp_s16, vfp_s17, vfp_s18, vfp_s19,    INVALID_NUB_REGNUM };
+uint32_t g_invalidate_q5[]  {vfp_q5,   vfp_d10, vfp_d11,  vfp_s20, vfp_s21, vfp_s22, vfp_s23,    INVALID_NUB_REGNUM };
+uint32_t g_invalidate_q6[]  {vfp_q6,   vfp_d12, vfp_d13,  vfp_s24, vfp_s25, vfp_s26, vfp_s27,    INVALID_NUB_REGNUM };
+uint32_t g_invalidate_q7[]  {vfp_q7,   vfp_d14, vfp_d15,  vfp_s28, vfp_s29, vfp_s30, vfp_s31,    INVALID_NUB_REGNUM };
+uint32_t g_invalidate_q8[]  {vfp_q8,   vfp_d16, vfp_d17,  INVALID_NUB_REGNUM };
+uint32_t g_invalidate_q9[]  {vfp_q9,   vfp_d18, vfp_d19,  INVALID_NUB_REGNUM };
+uint32_t g_invalidate_q10[] {vfp_q10,  vfp_d20, vfp_d21,  INVALID_NUB_REGNUM };
+uint32_t g_invalidate_q11[] {vfp_q11,  vfp_d22, vfp_d23,  INVALID_NUB_REGNUM };
+uint32_t g_invalidate_q12[] {vfp_q12,  vfp_d24, vfp_d25,  INVALID_NUB_REGNUM };
+uint32_t g_invalidate_q13[] {vfp_q13,  vfp_d26, vfp_d27,  INVALID_NUB_REGNUM };
+uint32_t g_invalidate_q14[] {vfp_q14,  vfp_d28, vfp_d29,  INVALID_NUB_REGNUM };
+uint32_t g_invalidate_q15[] {vfp_q15,  vfp_d30, vfp_d31,  INVALID_NUB_REGNUM };
+
+#define VFP_S_OFFSET_IDX(idx) (offsetof (DNBArchMachARM::FPU, __r[(idx)]) + offsetof (DNBArchMachARM::Context, vfp))
+#define VFP_D_OFFSET_IDX(idx) (VFP_S_OFFSET_IDX ((idx) * 2))
+#define VFP_Q_OFFSET_IDX(idx) (VFP_S_OFFSET_IDX ((idx) * 4))
+
+#define VFP_OFFSET_NAME(reg) (offsetof (DNBArchMachARM::FPU, __##reg) + offsetof (DNBArchMachARM::Context, vfp))
+
+#define FLOAT_FORMAT Float
+
+#define DEFINE_VFP_S_IDX(idx)  e_regSetVFP, vfp_s##idx - vfp_s0, "s" #idx, NULL, IEEE754, FLOAT_FORMAT, 4, VFP_S_OFFSET_IDX(idx), INVALID_NUB_REGNUM, dwarf_s##idx, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM
+#define DEFINE_VFP_D_IDX(idx)  e_regSetVFP, vfp_d##idx - vfp_s0, "d" #idx, NULL, IEEE754, FLOAT_FORMAT, 8, VFP_D_OFFSET_IDX(idx), INVALID_NUB_REGNUM, dwarf_d##idx, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM
+#define DEFINE_VFP_Q_IDX(idx)  e_regSetVFP, vfp_q##idx - vfp_s0, "q" #idx, NULL, Vector, VectorOfUInt8, 16, VFP_Q_OFFSET_IDX(idx), INVALID_NUB_REGNUM, dwarf_q##idx, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM
+
 // Floating point registers
 const DNBRegisterInfo
 DNBArchMachARM::g_vfp_registers[] =
 {
-    DEFINE_VFP_S_IDX ( 0),
-    DEFINE_VFP_S_IDX ( 1),
-    DEFINE_VFP_S_IDX ( 2),
-    DEFINE_VFP_S_IDX ( 3),
-    DEFINE_VFP_S_IDX ( 4),
-    DEFINE_VFP_S_IDX ( 5),
-    DEFINE_VFP_S_IDX ( 6),
-    DEFINE_VFP_S_IDX ( 7),
-    DEFINE_VFP_S_IDX ( 8),
-    DEFINE_VFP_S_IDX ( 9),
-    DEFINE_VFP_S_IDX (10),
-    DEFINE_VFP_S_IDX (11),
-    DEFINE_VFP_S_IDX (12),
-    DEFINE_VFP_S_IDX (13),
-    DEFINE_VFP_S_IDX (14),
-    DEFINE_VFP_S_IDX (15),
-    DEFINE_VFP_S_IDX (16),
-    DEFINE_VFP_S_IDX (17),
-    DEFINE_VFP_S_IDX (18),
-    DEFINE_VFP_S_IDX (19),
-    DEFINE_VFP_S_IDX (20),
-    DEFINE_VFP_S_IDX (21),
-    DEFINE_VFP_S_IDX (22),
-    DEFINE_VFP_S_IDX (23),
-    DEFINE_VFP_S_IDX (24),
-    DEFINE_VFP_S_IDX (25),
-    DEFINE_VFP_S_IDX (26),
-    DEFINE_VFP_S_IDX (27),
-    DEFINE_VFP_S_IDX (28),
-    DEFINE_VFP_S_IDX (29),
-    DEFINE_VFP_S_IDX (30),
-    DEFINE_VFP_S_IDX (31),
-    DEFINE_VFP_D_IDX (0),
-    DEFINE_VFP_D_IDX (1),
-    DEFINE_VFP_D_IDX (2),
-    DEFINE_VFP_D_IDX (3),
-    DEFINE_VFP_D_IDX (4),
-    DEFINE_VFP_D_IDX (5),
-    DEFINE_VFP_D_IDX (6),
-    DEFINE_VFP_D_IDX (7),
-    DEFINE_VFP_D_IDX (8),
-    DEFINE_VFP_D_IDX (9),
-    DEFINE_VFP_D_IDX (10),
-    DEFINE_VFP_D_IDX (11),
-    DEFINE_VFP_D_IDX (12),
-    DEFINE_VFP_D_IDX (13),
-    DEFINE_VFP_D_IDX (14),
-    DEFINE_VFP_D_IDX (15),
-    DEFINE_VFP_D_IDX (16),
-    DEFINE_VFP_D_IDX (17),
-    DEFINE_VFP_D_IDX (18),
-    DEFINE_VFP_D_IDX (19),
-    DEFINE_VFP_D_IDX (20),
-    DEFINE_VFP_D_IDX (21),
-    DEFINE_VFP_D_IDX (22),
-    DEFINE_VFP_D_IDX (23),
-    DEFINE_VFP_D_IDX (24),
-    DEFINE_VFP_D_IDX (25),
-    DEFINE_VFP_D_IDX (26),
-    DEFINE_VFP_D_IDX (27),
-    DEFINE_VFP_D_IDX (28),
-    DEFINE_VFP_D_IDX (29),
-    DEFINE_VFP_D_IDX (30),
-    DEFINE_VFP_D_IDX (31),
-    { e_regSetVFP, vfp_fpscr, "fpscr", NULL, Uint, Hex, 4, VFP_OFFSET_NAME(fpscr), INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, gdb_fpscr }
+    { DEFINE_VFP_S_IDX ( 0), g_contained_q0, g_invalidate_q0 },
+    { DEFINE_VFP_S_IDX ( 1), g_contained_q0, g_invalidate_q0 },
+    { DEFINE_VFP_S_IDX ( 2), g_contained_q0, g_invalidate_q0 },
+    { DEFINE_VFP_S_IDX ( 3), g_contained_q0, g_invalidate_q0 },
+    { DEFINE_VFP_S_IDX ( 4), g_contained_q1, g_invalidate_q1 },
+    { DEFINE_VFP_S_IDX ( 5), g_contained_q1, g_invalidate_q1 },
+    { DEFINE_VFP_S_IDX ( 6), g_contained_q1, g_invalidate_q1 },
+    { DEFINE_VFP_S_IDX ( 7), g_contained_q1, g_invalidate_q1 },
+    { DEFINE_VFP_S_IDX ( 8), g_contained_q2, g_invalidate_q2 },
+    { DEFINE_VFP_S_IDX ( 9), g_contained_q2, g_invalidate_q2 },
+    { DEFINE_VFP_S_IDX (10), g_contained_q2, g_invalidate_q2 },
+    { DEFINE_VFP_S_IDX (11), g_contained_q2, g_invalidate_q2 },
+    { DEFINE_VFP_S_IDX (12), g_contained_q3, g_invalidate_q3 },
+    { DEFINE_VFP_S_IDX (13), g_contained_q3, g_invalidate_q3 },
+    { DEFINE_VFP_S_IDX (14), g_contained_q3, g_invalidate_q3 },
+    { DEFINE_VFP_S_IDX (15), g_contained_q3, g_invalidate_q3 },
+    { DEFINE_VFP_S_IDX (16), g_contained_q4, g_invalidate_q4 },
+    { DEFINE_VFP_S_IDX (17), g_contained_q4, g_invalidate_q4 },
+    { DEFINE_VFP_S_IDX (18), g_contained_q4, g_invalidate_q4 },
+    { DEFINE_VFP_S_IDX (19), g_contained_q4, g_invalidate_q4 },
+    { DEFINE_VFP_S_IDX (20), g_contained_q5, g_invalidate_q5 },
+    { DEFINE_VFP_S_IDX (21), g_contained_q5, g_invalidate_q5 },
+    { DEFINE_VFP_S_IDX (22), g_contained_q5, g_invalidate_q5 },
+    { DEFINE_VFP_S_IDX (23), g_contained_q5, g_invalidate_q5 },
+    { DEFINE_VFP_S_IDX (24), g_contained_q6, g_invalidate_q6 },
+    { DEFINE_VFP_S_IDX (25), g_contained_q6, g_invalidate_q6 },
+    { DEFINE_VFP_S_IDX (26), g_contained_q6, g_invalidate_q6 },
+    { DEFINE_VFP_S_IDX (27), g_contained_q6, g_invalidate_q6 },
+    { DEFINE_VFP_S_IDX (28), g_contained_q7, g_invalidate_q7 },
+    { DEFINE_VFP_S_IDX (29), g_contained_q7, g_invalidate_q7 },
+    { DEFINE_VFP_S_IDX (30), g_contained_q7, g_invalidate_q7 },
+    { DEFINE_VFP_S_IDX (31), g_contained_q7, g_invalidate_q7 },
+
+    { DEFINE_VFP_D_IDX (0),  g_contained_q0, g_invalidate_q0 },
+    { DEFINE_VFP_D_IDX (1),  g_contained_q0, g_invalidate_q0 },
+    { DEFINE_VFP_D_IDX (2),  g_contained_q1, g_invalidate_q1 },
+    { DEFINE_VFP_D_IDX (3),  g_contained_q1, g_invalidate_q1 },
+    { DEFINE_VFP_D_IDX (4),  g_contained_q2, g_invalidate_q2 },
+    { DEFINE_VFP_D_IDX (5),  g_contained_q2, g_invalidate_q2 },
+    { DEFINE_VFP_D_IDX (6),  g_contained_q3, g_invalidate_q3 },
+    { DEFINE_VFP_D_IDX (7),  g_contained_q3, g_invalidate_q3 },
+    { DEFINE_VFP_D_IDX (8),  g_contained_q4, g_invalidate_q4 },
+    { DEFINE_VFP_D_IDX (9),  g_contained_q4, g_invalidate_q4 },
+    { DEFINE_VFP_D_IDX (10), g_contained_q5, g_invalidate_q5 },
+    { DEFINE_VFP_D_IDX (11), g_contained_q5, g_invalidate_q5 },
+    { DEFINE_VFP_D_IDX (12), g_contained_q6, g_invalidate_q6 },
+    { DEFINE_VFP_D_IDX (13), g_contained_q6, g_invalidate_q6 },
+    { DEFINE_VFP_D_IDX (14), g_contained_q7, g_invalidate_q7 },
+    { DEFINE_VFP_D_IDX (15), g_contained_q7, g_invalidate_q7 },
+    { DEFINE_VFP_D_IDX (16), g_contained_q8, g_invalidate_q8 },
+    { DEFINE_VFP_D_IDX (17), g_contained_q8, g_invalidate_q8 },
+    { DEFINE_VFP_D_IDX (18), g_contained_q9, g_invalidate_q9 },
+    { DEFINE_VFP_D_IDX (19), g_contained_q9, g_invalidate_q9 },
+    { DEFINE_VFP_D_IDX (20), g_contained_q10, g_invalidate_q10 },
+    { DEFINE_VFP_D_IDX (21), g_contained_q10, g_invalidate_q10 },
+    { DEFINE_VFP_D_IDX (22), g_contained_q11, g_invalidate_q11 },
+    { DEFINE_VFP_D_IDX (23), g_contained_q11, g_invalidate_q11 },
+    { DEFINE_VFP_D_IDX (24), g_contained_q12, g_invalidate_q12 },
+    { DEFINE_VFP_D_IDX (25), g_contained_q12, g_invalidate_q12 },
+    { DEFINE_VFP_D_IDX (26), g_contained_q13, g_invalidate_q13 },
+    { DEFINE_VFP_D_IDX (27), g_contained_q13, g_invalidate_q13 },
+    { DEFINE_VFP_D_IDX (28), g_contained_q14, g_invalidate_q14 },
+    { DEFINE_VFP_D_IDX (29), g_contained_q14, g_invalidate_q14 },
+    { DEFINE_VFP_D_IDX (30), g_contained_q15, g_invalidate_q15 },
+    { DEFINE_VFP_D_IDX (31), g_contained_q15, g_invalidate_q15 },
+
+    { DEFINE_VFP_Q_IDX (0),  NULL,            g_invalidate_q0 },
+    { DEFINE_VFP_Q_IDX (1),  NULL,            g_invalidate_q1 },
+    { DEFINE_VFP_Q_IDX (2),  NULL,            g_invalidate_q2 },
+    { DEFINE_VFP_Q_IDX (3),  NULL,            g_invalidate_q3 },
+    { DEFINE_VFP_Q_IDX (4),  NULL,            g_invalidate_q4 },
+    { DEFINE_VFP_Q_IDX (5),  NULL,            g_invalidate_q5 },
+    { DEFINE_VFP_Q_IDX (6),  NULL,            g_invalidate_q6 },
+    { DEFINE_VFP_Q_IDX (7),  NULL,            g_invalidate_q7 },
+    { DEFINE_VFP_Q_IDX (8),  NULL,            g_invalidate_q8 },
+    { DEFINE_VFP_Q_IDX (9),  NULL,            g_invalidate_q9 },
+    { DEFINE_VFP_Q_IDX (10),  NULL,           g_invalidate_q10 },
+    { DEFINE_VFP_Q_IDX (11),  NULL,           g_invalidate_q11 },
+    { DEFINE_VFP_Q_IDX (12),  NULL,           g_invalidate_q12 },
+    { DEFINE_VFP_Q_IDX (13),  NULL,           g_invalidate_q13 },
+    { DEFINE_VFP_Q_IDX (14),  NULL,           g_invalidate_q14 },
+    { DEFINE_VFP_Q_IDX (15),  NULL,           g_invalidate_q15 },
+
+    { e_regSetVFP, vfp_fpscr, "fpscr", NULL, Uint, Hex, 4, VFP_OFFSET_NAME(fpscr), INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, NULL, NULL }
 };
 
 // Exception registers
@@ -3038,12 +1634,16 @@ DNBArchMachARM::GetRegisterValue(int set
             break;
 
         case e_regSetVFP:
-            if (reg <= vfp_s31)
+            // "reg" is an index into the floating point register set at this point.
+            // We need to translate it up so entry 0 in the fp reg set is the same as vfp_s0 
+            // in the enumerated values for case statement below.
+            reg += vfp_s0;
+            if (reg >= vfp_s0 && reg <= vfp_s31)
             {
-                value->value.uint32 = m_state.context.vfp.__r[reg];
+                value->value.uint32 = m_state.context.vfp.__r[reg - vfp_s0];
                 return true;
             }
-            else if (reg <= vfp_d31)
+            else if (reg >= vfp_d0 && reg <= vfp_d31)
             {
                 uint32_t d_reg_idx = reg - vfp_d0;
                 uint32_t s_reg_idx = d_reg_idx * 2;
@@ -3051,6 +1651,13 @@ DNBArchMachARM::GetRegisterValue(int set
                 value->value.v_sint32[1] = m_state.context.vfp.__r[s_reg_idx + 1];
                 return true;
             }
+            else if (reg >= vfp_q0 && reg <= vfp_q15)
+            {
+                uint32_t s_reg_idx = (reg - vfp_q0) * 4;
+                memcpy (&value->value.v_uint8, (uint8_t *) &m_state.context.vfp.__r[s_reg_idx], 16);
+                return true;
+            }
+
             else if (reg == vfp_fpscr)
             {
                 value->value.uint32 = m_state.context.vfp.__fpscr;
@@ -3125,12 +1732,17 @@ DNBArchMachARM::SetRegisterValue(int set
             break;
 
         case e_regSetVFP:
-            if (reg <= vfp_s31)
+            // "reg" is an index into the floating point register set at this point.
+            // We need to translate it up so entry 0 in the fp reg set is the same as vfp_s0 
+            // in the enumerated values for case statement below.
+            reg += vfp_s0;
+
+            if (reg >= vfp_s0 && reg <= vfp_s31)
             {
-                m_state.context.vfp.__r[reg] = value->value.uint32;
+                m_state.context.vfp.__r[reg - vfp_s0] = value->value.uint32;
                 success = true;
             }
-            else if (reg <= vfp_d31)
+            else if (reg >= vfp_d0 && reg <= vfp_d31)
             {
                 uint32_t d_reg_idx = reg - vfp_d0;
                 uint32_t s_reg_idx = d_reg_idx * 2;
@@ -3138,6 +1750,12 @@ DNBArchMachARM::SetRegisterValue(int set
                 m_state.context.vfp.__r[s_reg_idx + 1] = value->value.v_sint32[1];
                 success = true;
             }
+            else if (reg >= vfp_q0 && reg <= vfp_q15)
+            {
+                uint32_t s_reg_idx = (reg - vfp_q0) * 4;
+                memcpy ((uint8_t *) &m_state.context.vfp.__r[s_reg_idx], &value->value.v_uint8, 16);
+                return true;
+            }
             else if (reg == vfp_fpscr)
             {
                 m_state.context.vfp.__fpscr = value->value.uint32;
@@ -3223,7 +1841,7 @@ DNBArchMachARM::GetRegisterContext (void
             return 0;
         ::memcpy (buf, &m_state.context, size);
     }
-    DNBLogThreadedIf (LOG_THREAD, "DNBArchMachARM::GetRegisterContext (buf = %p, len = %zu) => %zu", buf, buf_len, size);
+    DNBLogThreadedIf (LOG_THREAD, "DNBArchMachARM::GetRegisterContext (buf = %p, len = %llu) => %llu", buf, (uint64_t)buf_len, (uint64_t)size);
     // Return the size of the register context even if NULL was passed in
     return size;
 }
@@ -3245,7 +1863,7 @@ DNBArchMachARM::SetRegisterContext (cons
         SetVFPState();
         SetEXCState();
     }
-    DNBLogThreadedIf (LOG_THREAD, "DNBArchMachARM::SetRegisterContext (buf = %p, len = %zu) => %zu", buf, buf_len, size);
+    DNBLogThreadedIf (LOG_THREAD, "DNBArchMachARM::SetRegisterContext (buf = %p, len = %llu) => %llu", buf, (uint64_t)buf_len, (uint64_t)size);
     return size;
 }
 

Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/arm/DNBArchImpl.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/arm/DNBArchImpl.h?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/arm/DNBArchImpl.h (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/arm/DNBArchImpl.h Thu Jun  6 19:06:43 2013
@@ -17,9 +17,6 @@
 #if defined (__arm__)
 
 #include "DNBArch.h"
-#if defined (USE_ARM_DISASSEMBLER_FRAMEWORK)
-#include <ARMDisassembler/ARMDisassembler.h>
-#endif
 
 class MachThread;
 

Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp Thu Jun  6 19:06:43 2013
@@ -83,6 +83,26 @@ enum
     gpr_es          = 13,
     gpr_fs          = 14,
     gpr_gs          = 15,
+    gpr_ax ,
+    gpr_bx ,
+    gpr_cx ,
+    gpr_dx ,
+    gpr_di ,
+    gpr_si ,
+    gpr_bp ,
+    gpr_sp ,
+    gpr_ah ,
+    gpr_bh ,
+    gpr_ch ,
+    gpr_dh ,
+    gpr_al ,
+    gpr_bl ,
+    gpr_cl ,
+    gpr_dl ,
+    gpr_dil,
+    gpr_sil,
+    gpr_bpl,
+    gpr_spl,
     k_num_gpr_regs
 };
 
@@ -314,7 +334,7 @@ DNBArchImplI386::GetGPRState(bool force)
         m_state.SetError(e_regSetGPR, Read, 0);
 #else
         mach_msg_type_number_t count = e_regSetWordSizeGPR;
-        m_state.SetError(e_regSetGPR, Read, ::thread_get_state(m_thread->ThreadID(), __i386_THREAD_STATE, (thread_state_t)&m_state.context.gpr, &count));
+        m_state.SetError(e_regSetGPR, Read, ::thread_get_state(m_thread->MachPortNumber(), __i386_THREAD_STATE, (thread_state_t)&m_state.context.gpr, &count));
 #endif
     }
     return m_state.GetError(e_regSetGPR, Read);
@@ -463,17 +483,17 @@ DNBArchImplI386::GetFPUState(bool force)
             if (CPUHasAVX() || FORCE_AVX_REGS)
             {
                 mach_msg_type_number_t count = e_regSetWordSizeAVX;
-                m_state.SetError (e_regSetFPU, Read, ::thread_get_state(m_thread->ThreadID(), __i386_AVX_STATE, (thread_state_t)&m_state.context.fpu.avx, &count));
+                m_state.SetError (e_regSetFPU, Read, ::thread_get_state(m_thread->MachPortNumber(), __i386_AVX_STATE, (thread_state_t)&m_state.context.fpu.avx, &count));
                 DNBLogThreadedIf (LOG_THREAD, "::thread_get_state (0x%4.4x, %u, &avx, %u (%u passed in)) => 0x%8.8x",
-                                  m_thread->ThreadID(), __i386_AVX_STATE, count, e_regSetWordSizeAVX,
+                                  m_thread->MachPortNumber(), __i386_AVX_STATE, count, e_regSetWordSizeAVX,
                                   m_state.GetError(e_regSetFPU, Read));
             }
             else
             {    
                 mach_msg_type_number_t count = e_regSetWordSizeFPU;
-                m_state.SetError(e_regSetFPU, Read, ::thread_get_state(m_thread->ThreadID(), __i386_FLOAT_STATE, (thread_state_t)&m_state.context.fpu.no_avx, &count));
+                m_state.SetError(e_regSetFPU, Read, ::thread_get_state(m_thread->MachPortNumber(), __i386_FLOAT_STATE, (thread_state_t)&m_state.context.fpu.no_avx, &count));
                 DNBLogThreadedIf (LOG_THREAD, "::thread_get_state (0x%4.4x, %u, &fpu, %u (%u passed in) => 0x%8.8x",
-                                  m_thread->ThreadID(), __i386_FLOAT_STATE, count, e_regSetWordSizeFPU,
+                                  m_thread->MachPortNumber(), __i386_FLOAT_STATE, count, e_regSetWordSizeFPU,
                                   m_state.GetError(e_regSetFPU, Read));
             }
         }
@@ -487,7 +507,7 @@ DNBArchImplI386::GetEXCState(bool force)
     if (force || m_state.GetError(e_regSetEXC, Read))
     {
         mach_msg_type_number_t count = e_regSetWordSizeEXC;
-        m_state.SetError(e_regSetEXC, Read, ::thread_get_state(m_thread->ThreadID(), __i386_EXCEPTION_STATE, (thread_state_t)&m_state.context.exc, &count));
+        m_state.SetError(e_regSetEXC, Read, ::thread_get_state(m_thread->MachPortNumber(), __i386_EXCEPTION_STATE, (thread_state_t)&m_state.context.exc, &count));
     }
     return m_state.GetError(e_regSetEXC, Read);
 }
@@ -495,7 +515,7 @@ DNBArchImplI386::GetEXCState(bool force)
 kern_return_t
 DNBArchImplI386::SetGPRState()
 {
-    m_state.SetError(e_regSetGPR, Write, ::thread_set_state(m_thread->ThreadID(), __i386_THREAD_STATE, (thread_state_t)&m_state.context.gpr, e_regSetWordSizeGPR));
+    m_state.SetError(e_regSetGPR, Write, ::thread_set_state(m_thread->MachPortNumber(), __i386_THREAD_STATE, (thread_state_t)&m_state.context.gpr, e_regSetWordSizeGPR));
     return m_state.GetError(e_regSetGPR, Write);
 }
 
@@ -510,9 +530,9 @@ DNBArchImplI386::SetFPUState()
     else
     {
         if (CPUHasAVX() || FORCE_AVX_REGS)
-            m_state.SetError(e_regSetFPU, Write, ::thread_set_state(m_thread->ThreadID(), __i386_AVX_STATE, (thread_state_t)&m_state.context.fpu.avx, e_regSetWordSizeAVX));
+            m_state.SetError(e_regSetFPU, Write, ::thread_set_state(m_thread->MachPortNumber(), __i386_AVX_STATE, (thread_state_t)&m_state.context.fpu.avx, e_regSetWordSizeAVX));
         else
-            m_state.SetError(e_regSetFPU, Write, ::thread_set_state(m_thread->ThreadID(), __i386_FLOAT_STATE, (thread_state_t)&m_state.context.fpu.no_avx, e_regSetWordSizeFPU));
+            m_state.SetError(e_regSetFPU, Write, ::thread_set_state(m_thread->MachPortNumber(), __i386_FLOAT_STATE, (thread_state_t)&m_state.context.fpu.no_avx, e_regSetWordSizeFPU));
         return m_state.GetError(e_regSetFPU, Write);
     }
 }
@@ -520,7 +540,7 @@ DNBArchImplI386::SetFPUState()
 kern_return_t
 DNBArchImplI386::SetEXCState()
 {
-    m_state.SetError(e_regSetEXC, Write, ::thread_set_state(m_thread->ThreadID(), __i386_EXCEPTION_STATE, (thread_state_t)&m_state.context.exc, e_regSetWordSizeEXC));
+    m_state.SetError(e_regSetEXC, Write, ::thread_set_state(m_thread->MachPortNumber(), __i386_EXCEPTION_STATE, (thread_state_t)&m_state.context.exc, e_regSetWordSizeEXC));
     return m_state.GetError(e_regSetEXC, Write);
 }
 
@@ -530,7 +550,7 @@ DNBArchImplI386::GetDBGState(bool force)
     if (force || m_state.GetError(e_regSetDBG, Read))
     {
         mach_msg_type_number_t count = e_regSetWordSizeDBG;
-        m_state.SetError(e_regSetDBG, Read, ::thread_get_state(m_thread->ThreadID(), __i386_DEBUG_STATE, (thread_state_t)&m_state.context.dbg, &count));
+        m_state.SetError(e_regSetDBG, Read, ::thread_get_state(m_thread->MachPortNumber(), __i386_DEBUG_STATE, (thread_state_t)&m_state.context.dbg, &count));
     }
     return m_state.GetError(e_regSetDBG, Read);
 }
@@ -538,7 +558,7 @@ DNBArchImplI386::GetDBGState(bool force)
 kern_return_t
 DNBArchImplI386::SetDBGState()
 {
-    m_state.SetError(e_regSetDBG, Write, ::thread_set_state(m_thread->ThreadID(), __i386_DEBUG_STATE, (thread_state_t)&m_state.context.dbg, e_regSetWordSizeDBG));
+    m_state.SetError(e_regSetDBG, Write, ::thread_set_state(m_thread->MachPortNumber(), __i386_DEBUG_STATE, (thread_state_t)&m_state.context.dbg, e_regSetWordSizeDBG));
     return m_state.GetError(e_regSetDBG, Write);
 }
 
@@ -821,7 +841,7 @@ DNBArchImplI386::GetWatchAddress(const D
 bool
 DNBArchImplI386::StartTransForHWP()
 {
-    if (m_2pc_trans_state != Trans_Done || m_2pc_trans_state != Trans_Rolled_Back)
+    if (m_2pc_trans_state != Trans_Done && m_2pc_trans_state != Trans_Rolled_Back)
         DNBLogError ("%s inconsistent state detected, expected %d or %d, got: %d", __FUNCTION__, Trans_Done, Trans_Rolled_Back, m_2pc_trans_state);
     m_2pc_dbg_checkpoint = m_state.context.dbg;
     m_2pc_trans_state = Trans_Pending;
@@ -857,7 +877,7 @@ DNBArchImplI386::GetDBGCheckpoint()
 uint32_t
 DNBArchImplI386::EnableHardwareWatchpoint (nub_addr_t addr, nub_size_t size, bool read, bool write)
 {
-    DNBLogThreadedIf(LOG_WATCHPOINTS, "DNBArchImplI386::EnableHardwareWatchpoint(addr = 0x%llx, size = %zu, read = %u, write = %u)", (uint64_t)addr, size, read, write);
+    DNBLogThreadedIf(LOG_WATCHPOINTS, "DNBArchImplI386::EnableHardwareWatchpoint(addr = 0x%llx, size = %llu, read = %u, write = %u)", (uint64_t)addr, (uint64_t)size, read, write);
 
     const uint32_t num_hw_watchpoints = NumSupportedHardwareWatchpoints();
 
@@ -997,6 +1017,10 @@ DNBArchImplI386::EnableHardwareSingleSte
 // Register information defintions
 //----------------------------------------------------------------------
 
+#define DEFINE_GPR_PSEUDO_16(reg16,reg32) { e_regSetGPR, gpr_##reg16, #reg16, NULL, Uint, Hex, 2, GPR_OFFSET(reg32)  ,INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, g_contained_##reg32, g_invalidate_##reg32 }
+#define DEFINE_GPR_PSEUDO_8H(reg8,reg32)  { e_regSetGPR, gpr_##reg8 , #reg8 , NULL, Uint, Hex, 1, GPR_OFFSET(reg32)+1,INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, g_contained_##reg32, g_invalidate_##reg32 }
+#define DEFINE_GPR_PSEUDO_8L(reg8,reg32)  { e_regSetGPR, gpr_##reg8 , #reg8 , NULL, Uint, Hex, 1, GPR_OFFSET(reg32)  ,INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, g_contained_##reg32, g_invalidate_##reg32 }
+
 
 #define GPR_OFFSET(reg) (offsetof (DNBArchImplI386::GPR, __##reg))
 #define FPU_OFFSET(reg) (offsetof (DNBArchImplI386::FPU, __fpu_##reg) + offsetof (DNBArchImplI386::Context, fpu.no_avx))
@@ -1022,110 +1046,148 @@ DNBArchImplI386::EnableHardwareSingleSte
 // the register state structures are defined correctly and have the correct
 // sizes and offsets.
 
+uint32_t g_contained_eax[] = { gpr_eax, INVALID_NUB_REGNUM };
+uint32_t g_contained_ebx[] = { gpr_ebx, INVALID_NUB_REGNUM };
+uint32_t g_contained_ecx[] = { gpr_ecx, INVALID_NUB_REGNUM };
+uint32_t g_contained_edx[] = { gpr_edx, INVALID_NUB_REGNUM };
+uint32_t g_contained_edi[] = { gpr_edi, INVALID_NUB_REGNUM };
+uint32_t g_contained_esi[] = { gpr_esi, INVALID_NUB_REGNUM };
+uint32_t g_contained_ebp[] = { gpr_ebp, INVALID_NUB_REGNUM };
+uint32_t g_contained_esp[] = { gpr_esp, INVALID_NUB_REGNUM };
+
+uint32_t g_invalidate_eax[] = { gpr_eax , gpr_ax  , gpr_ah  , gpr_al, INVALID_NUB_REGNUM };
+uint32_t g_invalidate_ebx[] = { gpr_ebx , gpr_bx  , gpr_bh  , gpr_bl, INVALID_NUB_REGNUM };
+uint32_t g_invalidate_ecx[] = { gpr_ecx , gpr_cx  , gpr_ch  , gpr_cl, INVALID_NUB_REGNUM };
+uint32_t g_invalidate_edx[] = { gpr_edx , gpr_dx  , gpr_dh  , gpr_dl, INVALID_NUB_REGNUM };
+uint32_t g_invalidate_edi[] = { gpr_edi , gpr_di  , gpr_dil , INVALID_NUB_REGNUM };
+uint32_t g_invalidate_esi[] = { gpr_esi , gpr_si  , gpr_sil , INVALID_NUB_REGNUM };
+uint32_t g_invalidate_ebp[] = { gpr_ebp , gpr_bp  , gpr_bpl , INVALID_NUB_REGNUM };
+uint32_t g_invalidate_esp[] = { gpr_esp , gpr_sp  , gpr_spl , INVALID_NUB_REGNUM };
+
 // General purpose registers for 64 bit
 const DNBRegisterInfo
 DNBArchImplI386::g_gpr_registers[] =
 {
-{ e_regSetGPR, gpr_eax,     "eax"   , NULL      , Uint, Hex, GPR_SIZE(eax),     GPR_OFFSET(eax)     , gcc_eax   , dwarf_eax     , -1U                   , gdb_eax   },
-{ e_regSetGPR, gpr_ebx,     "ebx"   , NULL      , Uint, Hex, GPR_SIZE(ebx),     GPR_OFFSET(ebx)     , gcc_ebx   , dwarf_ebx     , -1U                   , gdb_ebx   },
-{ e_regSetGPR, gpr_ecx,     "ecx"   , NULL      , Uint, Hex, GPR_SIZE(ecx),     GPR_OFFSET(ecx)     , gcc_ecx   , dwarf_ecx     , -1U                   , gdb_ecx   },
-{ e_regSetGPR, gpr_edx,     "edx"   , NULL      , Uint, Hex, GPR_SIZE(edx),     GPR_OFFSET(edx)     , gcc_edx   , dwarf_edx     , -1U                   , gdb_edx   },
-{ e_regSetGPR, gpr_edi,     "edi"   , NULL      , Uint, Hex, GPR_SIZE(edi),     GPR_OFFSET(edi)     , gcc_edi   , dwarf_edi     , -1U                   , gdb_edi   },
-{ e_regSetGPR, gpr_esi,     "esi"   , NULL      , Uint, Hex, GPR_SIZE(esi),     GPR_OFFSET(esi)     , gcc_esi   , dwarf_esi     , -1U                   , gdb_esi   },
-{ e_regSetGPR, gpr_ebp,     "ebp"   , "fp"      , Uint, Hex, GPR_SIZE(ebp),     GPR_OFFSET(ebp)     , gcc_ebp   , dwarf_ebp     , GENERIC_REGNUM_FP     , gdb_ebp   },
-{ e_regSetGPR, gpr_esp,     "esp"   , "sp"      , Uint, Hex, GPR_SIZE(esp),     GPR_OFFSET(esp)     , gcc_esp   , dwarf_esp     , GENERIC_REGNUM_SP     , gdb_esp   },
-{ e_regSetGPR, gpr_ss,      "ss"    , NULL      , Uint, Hex, GPR_SIZE(ss),      GPR_OFFSET(ss)      , -1U       , -1U          , -1U                 , gdb_ss    },
-{ e_regSetGPR, gpr_eflags,  "eflags", "flags"   , Uint, Hex, GPR_SIZE(eflags),  GPR_OFFSET(eflags)  , gcc_eflags, dwarf_eflags  , GENERIC_REGNUM_FLAGS  , gdb_eflags},
-{ e_regSetGPR, gpr_eip,     "eip"   , "pc"      , Uint, Hex, GPR_SIZE(eip),     GPR_OFFSET(eip)     , gcc_eip   , dwarf_eip     , GENERIC_REGNUM_PC     , gdb_eip   },
-{ e_regSetGPR, gpr_cs,      "cs"    , NULL      , Uint, Hex, GPR_SIZE(cs),      GPR_OFFSET(cs)      , -1U       , -1U           , -1U                   , gdb_cs    },
-{ e_regSetGPR, gpr_ds,      "ds"    , NULL      , Uint, Hex, GPR_SIZE(ds),      GPR_OFFSET(ds)      , -1U       , -1U           , -1U                   , gdb_ds    },
-{ e_regSetGPR, gpr_es,      "es"    , NULL      , Uint, Hex, GPR_SIZE(es),      GPR_OFFSET(es)      , -1U       , -1U           , -1U                   , gdb_es    },
-{ e_regSetGPR, gpr_fs,      "fs"    , NULL      , Uint, Hex, GPR_SIZE(fs),      GPR_OFFSET(fs)      , -1U       , -1U           , -1U                   , gdb_fs    },
-{ e_regSetGPR, gpr_gs,      "gs"    , NULL      , Uint, Hex, GPR_SIZE(gs),      GPR_OFFSET(gs)      , -1U       , -1U           , -1U                   , gdb_gs    }
+{ e_regSetGPR, gpr_eax,     "eax"   , NULL      , Uint, Hex, GPR_SIZE(eax),     GPR_OFFSET(eax)     , gcc_eax           , dwarf_eax         , INVALID_NUB_REGNUM    , gdb_eax   , NULL, g_invalidate_eax },
+{ e_regSetGPR, gpr_ebx,     "ebx"   , NULL      , Uint, Hex, GPR_SIZE(ebx),     GPR_OFFSET(ebx)     , gcc_ebx           , dwarf_ebx         , INVALID_NUB_REGNUM    , gdb_ebx   , NULL, g_invalidate_ebx },
+{ e_regSetGPR, gpr_ecx,     "ecx"   , NULL      , Uint, Hex, GPR_SIZE(ecx),     GPR_OFFSET(ecx)     , gcc_ecx           , dwarf_ecx         , INVALID_NUB_REGNUM    , gdb_ecx   , NULL, g_invalidate_ecx },
+{ e_regSetGPR, gpr_edx,     "edx"   , NULL      , Uint, Hex, GPR_SIZE(edx),     GPR_OFFSET(edx)     , gcc_edx           , dwarf_edx         , INVALID_NUB_REGNUM    , gdb_edx   , NULL, g_invalidate_edx },
+{ e_regSetGPR, gpr_edi,     "edi"   , NULL      , Uint, Hex, GPR_SIZE(edi),     GPR_OFFSET(edi)     , gcc_edi           , dwarf_edi         , INVALID_NUB_REGNUM    , gdb_edi   , NULL, g_invalidate_edi },
+{ e_regSetGPR, gpr_esi,     "esi"   , NULL      , Uint, Hex, GPR_SIZE(esi),     GPR_OFFSET(esi)     , gcc_esi           , dwarf_esi         , INVALID_NUB_REGNUM    , gdb_esi   , NULL, g_invalidate_esi },
+{ e_regSetGPR, gpr_ebp,     "ebp"   , "fp"      , Uint, Hex, GPR_SIZE(ebp),     GPR_OFFSET(ebp)     , gcc_ebp           , dwarf_ebp         , GENERIC_REGNUM_FP     , gdb_ebp   , NULL, g_invalidate_ebp },
+{ e_regSetGPR, gpr_esp,     "esp"   , "sp"      , Uint, Hex, GPR_SIZE(esp),     GPR_OFFSET(esp)     , gcc_esp           , dwarf_esp         , GENERIC_REGNUM_SP     , gdb_esp   , NULL, g_invalidate_esp },
+{ e_regSetGPR, gpr_ss,      "ss"    , NULL      , Uint, Hex, GPR_SIZE(ss),      GPR_OFFSET(ss)      , INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM    , gdb_ss    , NULL, NULL},
+{ e_regSetGPR, gpr_eflags,  "eflags", "flags"   , Uint, Hex, GPR_SIZE(eflags),  GPR_OFFSET(eflags)  , gcc_eflags        , dwarf_eflags      , GENERIC_REGNUM_FLAGS  , gdb_eflags, NULL, NULL},
+{ e_regSetGPR, gpr_eip,     "eip"   , "pc"      , Uint, Hex, GPR_SIZE(eip),     GPR_OFFSET(eip)     , gcc_eip           , dwarf_eip         , GENERIC_REGNUM_PC     , gdb_eip   , NULL, NULL},
+{ e_regSetGPR, gpr_cs,      "cs"    , NULL      , Uint, Hex, GPR_SIZE(cs),      GPR_OFFSET(cs)      , INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM    , gdb_cs    , NULL, NULL},
+{ e_regSetGPR, gpr_ds,      "ds"    , NULL      , Uint, Hex, GPR_SIZE(ds),      GPR_OFFSET(ds)      , INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM    , gdb_ds    , NULL, NULL},
+{ e_regSetGPR, gpr_es,      "es"    , NULL      , Uint, Hex, GPR_SIZE(es),      GPR_OFFSET(es)      , INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM    , gdb_es    , NULL, NULL},
+{ e_regSetGPR, gpr_fs,      "fs"    , NULL      , Uint, Hex, GPR_SIZE(fs),      GPR_OFFSET(fs)      , INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM    , gdb_fs    , NULL, NULL},
+{ e_regSetGPR, gpr_gs,      "gs"    , NULL      , Uint, Hex, GPR_SIZE(gs),      GPR_OFFSET(gs)      , INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM    , gdb_gs    , NULL, NULL},
+DEFINE_GPR_PSEUDO_16 (ax , eax),
+DEFINE_GPR_PSEUDO_16 (bx , ebx),
+DEFINE_GPR_PSEUDO_16 (cx , ecx),
+DEFINE_GPR_PSEUDO_16 (dx , edx),
+DEFINE_GPR_PSEUDO_16 (di , edi),
+DEFINE_GPR_PSEUDO_16 (si , esi),
+DEFINE_GPR_PSEUDO_16 (bp , ebp),
+DEFINE_GPR_PSEUDO_16 (sp , esp),
+DEFINE_GPR_PSEUDO_8H (ah , eax),
+DEFINE_GPR_PSEUDO_8H (bh , ebx),
+DEFINE_GPR_PSEUDO_8H (ch , ecx),
+DEFINE_GPR_PSEUDO_8H (dh , edx),
+DEFINE_GPR_PSEUDO_8L (al , eax),
+DEFINE_GPR_PSEUDO_8L (bl , ebx),
+DEFINE_GPR_PSEUDO_8L (cl , ecx),
+DEFINE_GPR_PSEUDO_8L (dl , edx),
+DEFINE_GPR_PSEUDO_8L (dil, edi),
+DEFINE_GPR_PSEUDO_8L (sil, esi),
+DEFINE_GPR_PSEUDO_8L (bpl, ebp),
+DEFINE_GPR_PSEUDO_8L (spl, esp)
 };
 
 
 const DNBRegisterInfo
 DNBArchImplI386::g_fpu_registers_no_avx[] =
 {
-{ e_regSetFPU, fpu_fcw      , "fctrl"       , NULL, Uint, Hex, FPU_SIZE_UINT(fcw)       , FPU_OFFSET(fcw)       , -1U, -1U, -1U, -1U },
-{ e_regSetFPU, fpu_fsw      , "fstat"       , NULL, Uint, Hex, FPU_SIZE_UINT(fsw)       , FPU_OFFSET(fsw)       , -1U, -1U, -1U, -1U },
-{ e_regSetFPU, fpu_ftw      , "ftag"        , NULL, Uint, Hex, FPU_SIZE_UINT(ftw)       , FPU_OFFSET(ftw)       , -1U, -1U, -1U, -1U },
-{ e_regSetFPU, fpu_fop      , "fop"         , NULL, Uint, Hex, FPU_SIZE_UINT(fop)       , FPU_OFFSET(fop)       , -1U, -1U, -1U, -1U },
-{ e_regSetFPU, fpu_ip       , "fioff"       , NULL, Uint, Hex, FPU_SIZE_UINT(ip)        , FPU_OFFSET(ip)        , -1U, -1U, -1U, -1U },
-{ e_regSetFPU, fpu_cs       , "fiseg"       , NULL, Uint, Hex, FPU_SIZE_UINT(cs)        , FPU_OFFSET(cs)        , -1U, -1U, -1U, -1U },
-{ e_regSetFPU, fpu_dp       , "fooff"       , NULL, Uint, Hex, FPU_SIZE_UINT(dp)        , FPU_OFFSET(dp)        , -1U, -1U, -1U, -1U },
-{ e_regSetFPU, fpu_ds       , "foseg"       , NULL, Uint, Hex, FPU_SIZE_UINT(ds)        , FPU_OFFSET(ds)        , -1U, -1U, -1U, -1U },
-{ e_regSetFPU, fpu_mxcsr    , "mxcsr"       , NULL, Uint, Hex, FPU_SIZE_UINT(mxcsr)     , FPU_OFFSET(mxcsr)     , -1U, -1U, -1U, -1U },
-{ e_regSetFPU, fpu_mxcsrmask, "mxcsrmask"   , NULL, Uint, Hex, FPU_SIZE_UINT(mxcsrmask) , FPU_OFFSET(mxcsrmask) , -1U, -1U, -1U, -1U },
-
-{ e_regSetFPU, fpu_stmm0, "stmm0", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm0), FPU_OFFSET(stmm0), -1U, dwarf_stmm0, -1U, gdb_stmm0 },
-{ e_regSetFPU, fpu_stmm1, "stmm1", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm1), FPU_OFFSET(stmm1), -1U, dwarf_stmm1, -1U, gdb_stmm1 },
-{ e_regSetFPU, fpu_stmm2, "stmm2", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm2), FPU_OFFSET(stmm2), -1U, dwarf_stmm2, -1U, gdb_stmm2 },
-{ e_regSetFPU, fpu_stmm3, "stmm3", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm3), FPU_OFFSET(stmm3), -1U, dwarf_stmm3, -1U, gdb_stmm3 },
-{ e_regSetFPU, fpu_stmm4, "stmm4", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm4), FPU_OFFSET(stmm4), -1U, dwarf_stmm4, -1U, gdb_stmm4 },
-{ e_regSetFPU, fpu_stmm5, "stmm5", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm5), FPU_OFFSET(stmm5), -1U, dwarf_stmm5, -1U, gdb_stmm5 },
-{ e_regSetFPU, fpu_stmm6, "stmm6", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm6), FPU_OFFSET(stmm6), -1U, dwarf_stmm6, -1U, gdb_stmm6 },
-{ e_regSetFPU, fpu_stmm7, "stmm7", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm7), FPU_OFFSET(stmm7), -1U, dwarf_stmm7, -1U, gdb_stmm7 },
-
-{ e_regSetFPU, fpu_xmm0, "xmm0", NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm0), FPU_OFFSET(xmm0), -1U, dwarf_xmm0, -1U, gdb_xmm0 },
-{ e_regSetFPU, fpu_xmm1, "xmm1", NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm1), FPU_OFFSET(xmm1), -1U, dwarf_xmm1, -1U, gdb_xmm1 },
-{ e_regSetFPU, fpu_xmm2, "xmm2", NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm2), FPU_OFFSET(xmm2), -1U, dwarf_xmm2, -1U, gdb_xmm2 },
-{ e_regSetFPU, fpu_xmm3, "xmm3", NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm3), FPU_OFFSET(xmm3), -1U, dwarf_xmm3, -1U, gdb_xmm3 },
-{ e_regSetFPU, fpu_xmm4, "xmm4", NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm4), FPU_OFFSET(xmm4), -1U, dwarf_xmm4, -1U, gdb_xmm4 },
-{ e_regSetFPU, fpu_xmm5, "xmm5", NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm5), FPU_OFFSET(xmm5), -1U, dwarf_xmm5, -1U, gdb_xmm5 },
-{ e_regSetFPU, fpu_xmm6, "xmm6", NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm6), FPU_OFFSET(xmm6), -1U, dwarf_xmm6, -1U, gdb_xmm6 },
-{ e_regSetFPU, fpu_xmm7, "xmm7", NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm7), FPU_OFFSET(xmm7), -1U, dwarf_xmm7, -1U, gdb_xmm7 }
+{ e_regSetFPU, fpu_fcw      , "fctrl"       , NULL, Uint, Hex, FPU_SIZE_UINT(fcw)       , FPU_OFFSET(fcw)       , INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, NULL, NULL },
+{ e_regSetFPU, fpu_fsw      , "fstat"       , NULL, Uint, Hex, FPU_SIZE_UINT(fsw)       , FPU_OFFSET(fsw)       , INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, NULL, NULL },
+{ e_regSetFPU, fpu_ftw      , "ftag"        , NULL, Uint, Hex, FPU_SIZE_UINT(ftw)       , FPU_OFFSET(ftw)       , INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, NULL, NULL },
+{ e_regSetFPU, fpu_fop      , "fop"         , NULL, Uint, Hex, FPU_SIZE_UINT(fop)       , FPU_OFFSET(fop)       , INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, NULL, NULL },
+{ e_regSetFPU, fpu_ip       , "fioff"       , NULL, Uint, Hex, FPU_SIZE_UINT(ip)        , FPU_OFFSET(ip)        , INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, NULL, NULL },
+{ e_regSetFPU, fpu_cs       , "fiseg"       , NULL, Uint, Hex, FPU_SIZE_UINT(cs)        , FPU_OFFSET(cs)        , INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, NULL, NULL },
+{ e_regSetFPU, fpu_dp       , "fooff"       , NULL, Uint, Hex, FPU_SIZE_UINT(dp)        , FPU_OFFSET(dp)        , INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, NULL, NULL },
+{ e_regSetFPU, fpu_ds       , "foseg"       , NULL, Uint, Hex, FPU_SIZE_UINT(ds)        , FPU_OFFSET(ds)        , INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, NULL, NULL },
+{ e_regSetFPU, fpu_mxcsr    , "mxcsr"       , NULL, Uint, Hex, FPU_SIZE_UINT(mxcsr)     , FPU_OFFSET(mxcsr)     , INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, NULL, NULL },
+{ e_regSetFPU, fpu_mxcsrmask, "mxcsrmask"   , NULL, Uint, Hex, FPU_SIZE_UINT(mxcsrmask) , FPU_OFFSET(mxcsrmask) , INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, NULL, NULL },
+
+{ e_regSetFPU, fpu_stmm0, "stmm0", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm0), FPU_OFFSET(stmm0), INVALID_NUB_REGNUM, dwarf_stmm0, INVALID_NUB_REGNUM, gdb_stmm0, NULL, NULL },
+{ e_regSetFPU, fpu_stmm1, "stmm1", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm1), FPU_OFFSET(stmm1), INVALID_NUB_REGNUM, dwarf_stmm1, INVALID_NUB_REGNUM, gdb_stmm1, NULL, NULL },
+{ e_regSetFPU, fpu_stmm2, "stmm2", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm2), FPU_OFFSET(stmm2), INVALID_NUB_REGNUM, dwarf_stmm2, INVALID_NUB_REGNUM, gdb_stmm2, NULL, NULL },
+{ e_regSetFPU, fpu_stmm3, "stmm3", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm3), FPU_OFFSET(stmm3), INVALID_NUB_REGNUM, dwarf_stmm3, INVALID_NUB_REGNUM, gdb_stmm3, NULL, NULL },
+{ e_regSetFPU, fpu_stmm4, "stmm4", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm4), FPU_OFFSET(stmm4), INVALID_NUB_REGNUM, dwarf_stmm4, INVALID_NUB_REGNUM, gdb_stmm4, NULL, NULL },
+{ e_regSetFPU, fpu_stmm5, "stmm5", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm5), FPU_OFFSET(stmm5), INVALID_NUB_REGNUM, dwarf_stmm5, INVALID_NUB_REGNUM, gdb_stmm5, NULL, NULL },
+{ e_regSetFPU, fpu_stmm6, "stmm6", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm6), FPU_OFFSET(stmm6), INVALID_NUB_REGNUM, dwarf_stmm6, INVALID_NUB_REGNUM, gdb_stmm6, NULL, NULL },
+{ e_regSetFPU, fpu_stmm7, "stmm7", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm7), FPU_OFFSET(stmm7), INVALID_NUB_REGNUM, dwarf_stmm7, INVALID_NUB_REGNUM, gdb_stmm7, NULL, NULL },
+
+{ e_regSetFPU, fpu_xmm0, "xmm0", NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm0), FPU_OFFSET(xmm0), INVALID_NUB_REGNUM, dwarf_xmm0, INVALID_NUB_REGNUM, gdb_xmm0, NULL, NULL },
+{ e_regSetFPU, fpu_xmm1, "xmm1", NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm1), FPU_OFFSET(xmm1), INVALID_NUB_REGNUM, dwarf_xmm1, INVALID_NUB_REGNUM, gdb_xmm1, NULL, NULL },
+{ e_regSetFPU, fpu_xmm2, "xmm2", NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm2), FPU_OFFSET(xmm2), INVALID_NUB_REGNUM, dwarf_xmm2, INVALID_NUB_REGNUM, gdb_xmm2, NULL, NULL },
+{ e_regSetFPU, fpu_xmm3, "xmm3", NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm3), FPU_OFFSET(xmm3), INVALID_NUB_REGNUM, dwarf_xmm3, INVALID_NUB_REGNUM, gdb_xmm3, NULL, NULL },
+{ e_regSetFPU, fpu_xmm4, "xmm4", NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm4), FPU_OFFSET(xmm4), INVALID_NUB_REGNUM, dwarf_xmm4, INVALID_NUB_REGNUM, gdb_xmm4, NULL, NULL },
+{ e_regSetFPU, fpu_xmm5, "xmm5", NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm5), FPU_OFFSET(xmm5), INVALID_NUB_REGNUM, dwarf_xmm5, INVALID_NUB_REGNUM, gdb_xmm5, NULL, NULL },
+{ e_regSetFPU, fpu_xmm6, "xmm6", NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm6), FPU_OFFSET(xmm6), INVALID_NUB_REGNUM, dwarf_xmm6, INVALID_NUB_REGNUM, gdb_xmm6, NULL, NULL },
+{ e_regSetFPU, fpu_xmm7, "xmm7", NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm7), FPU_OFFSET(xmm7), INVALID_NUB_REGNUM, dwarf_xmm7, INVALID_NUB_REGNUM, gdb_xmm7, NULL, NULL }
 };
 
 const DNBRegisterInfo
 DNBArchImplI386::g_fpu_registers_avx[] =
 {
-{ e_regSetFPU, fpu_fcw      , "fctrl"       , NULL, Uint, Hex, FPU_SIZE_UINT(fcw)       , AVX_OFFSET(fcw)       , -1U, -1U, -1U, -1U },
-{ e_regSetFPU, fpu_fsw      , "fstat"       , NULL, Uint, Hex, FPU_SIZE_UINT(fsw)       , AVX_OFFSET(fsw)       , -1U, -1U, -1U, -1U },
-{ e_regSetFPU, fpu_ftw      , "ftag"        , NULL, Uint, Hex, FPU_SIZE_UINT(ftw)       , AVX_OFFSET(ftw)       , -1U, -1U, -1U, -1U },
-{ e_regSetFPU, fpu_fop      , "fop"         , NULL, Uint, Hex, FPU_SIZE_UINT(fop)       , AVX_OFFSET(fop)       , -1U, -1U, -1U, -1U },
-{ e_regSetFPU, fpu_ip       , "fioff"       , NULL, Uint, Hex, FPU_SIZE_UINT(ip)        , AVX_OFFSET(ip)        , -1U, -1U, -1U, -1U },
-{ e_regSetFPU, fpu_cs       , "fiseg"       , NULL, Uint, Hex, FPU_SIZE_UINT(cs)        , AVX_OFFSET(cs)        , -1U, -1U, -1U, -1U },
-{ e_regSetFPU, fpu_dp       , "fooff"       , NULL, Uint, Hex, FPU_SIZE_UINT(dp)        , AVX_OFFSET(dp)        , -1U, -1U, -1U, -1U },
-{ e_regSetFPU, fpu_ds       , "foseg"       , NULL, Uint, Hex, FPU_SIZE_UINT(ds)        , AVX_OFFSET(ds)        , -1U, -1U, -1U, -1U },
-{ e_regSetFPU, fpu_mxcsr    , "mxcsr"       , NULL, Uint, Hex, FPU_SIZE_UINT(mxcsr)     , AVX_OFFSET(mxcsr)     , -1U, -1U, -1U, -1U },
-{ e_regSetFPU, fpu_mxcsrmask, "mxcsrmask"   , NULL, Uint, Hex, FPU_SIZE_UINT(mxcsrmask) , AVX_OFFSET(mxcsrmask) , -1U, -1U, -1U, -1U },
-
-{ e_regSetFPU, fpu_stmm0, "stmm0", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm0), AVX_OFFSET(stmm0), -1U, dwarf_stmm0, -1U, gdb_stmm0 },
-{ e_regSetFPU, fpu_stmm1, "stmm1", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm1), AVX_OFFSET(stmm1), -1U, dwarf_stmm1, -1U, gdb_stmm1 },
-{ e_regSetFPU, fpu_stmm2, "stmm2", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm2), AVX_OFFSET(stmm2), -1U, dwarf_stmm2, -1U, gdb_stmm2 },
-{ e_regSetFPU, fpu_stmm3, "stmm3", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm3), AVX_OFFSET(stmm3), -1U, dwarf_stmm3, -1U, gdb_stmm3 },
-{ e_regSetFPU, fpu_stmm4, "stmm4", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm4), AVX_OFFSET(stmm4), -1U, dwarf_stmm4, -1U, gdb_stmm4 },
-{ e_regSetFPU, fpu_stmm5, "stmm5", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm5), AVX_OFFSET(stmm5), -1U, dwarf_stmm5, -1U, gdb_stmm5 },
-{ e_regSetFPU, fpu_stmm6, "stmm6", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm6), AVX_OFFSET(stmm6), -1U, dwarf_stmm6, -1U, gdb_stmm6 },
-{ e_regSetFPU, fpu_stmm7, "stmm7", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm7), AVX_OFFSET(stmm7), -1U, dwarf_stmm7, -1U, gdb_stmm7 },
-
-{ e_regSetFPU, fpu_xmm0, "xmm0", NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm0), AVX_OFFSET(xmm0), -1U, dwarf_xmm0, -1U, gdb_xmm0 },
-{ e_regSetFPU, fpu_xmm1, "xmm1", NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm1), AVX_OFFSET(xmm1), -1U, dwarf_xmm1, -1U, gdb_xmm1 },
-{ e_regSetFPU, fpu_xmm2, "xmm2", NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm2), AVX_OFFSET(xmm2), -1U, dwarf_xmm2, -1U, gdb_xmm2 },
-{ e_regSetFPU, fpu_xmm3, "xmm3", NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm3), AVX_OFFSET(xmm3), -1U, dwarf_xmm3, -1U, gdb_xmm3 },
-{ e_regSetFPU, fpu_xmm4, "xmm4", NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm4), AVX_OFFSET(xmm4), -1U, dwarf_xmm4, -1U, gdb_xmm4 },
-{ e_regSetFPU, fpu_xmm5, "xmm5", NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm5), AVX_OFFSET(xmm5), -1U, dwarf_xmm5, -1U, gdb_xmm5 },
-{ e_regSetFPU, fpu_xmm6, "xmm6", NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm6), AVX_OFFSET(xmm6), -1U, dwarf_xmm6, -1U, gdb_xmm6 },
-{ e_regSetFPU, fpu_xmm7, "xmm7", NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm7), AVX_OFFSET(xmm7), -1U, dwarf_xmm7, -1U, gdb_xmm7 },
-
-{ e_regSetFPU, fpu_ymm0, "ymm0", NULL, Vector, VectorOfUInt8, FPU_SIZE_YMM(ymm0), AVX_OFFSET_YMM(0), -1U, dwarf_ymm0, -1U, gdb_ymm0 },
-{ e_regSetFPU, fpu_ymm1, "ymm1", NULL, Vector, VectorOfUInt8, FPU_SIZE_YMM(ymm1), AVX_OFFSET_YMM(1), -1U, dwarf_ymm1, -1U, gdb_ymm1 },
-{ e_regSetFPU, fpu_ymm2, "ymm2", NULL, Vector, VectorOfUInt8, FPU_SIZE_YMM(ymm2), AVX_OFFSET_YMM(2), -1U, dwarf_ymm2, -1U, gdb_ymm2 },
-{ e_regSetFPU, fpu_ymm3, "ymm3", NULL, Vector, VectorOfUInt8, FPU_SIZE_YMM(ymm3), AVX_OFFSET_YMM(3), -1U, dwarf_ymm3, -1U, gdb_ymm3 },
-{ e_regSetFPU, fpu_ymm4, "ymm4", NULL, Vector, VectorOfUInt8, FPU_SIZE_YMM(ymm4), AVX_OFFSET_YMM(4), -1U, dwarf_ymm4, -1U, gdb_ymm4 },
-{ e_regSetFPU, fpu_ymm5, "ymm5", NULL, Vector, VectorOfUInt8, FPU_SIZE_YMM(ymm5), AVX_OFFSET_YMM(5), -1U, dwarf_ymm5, -1U, gdb_ymm5 },
-{ e_regSetFPU, fpu_ymm6, "ymm6", NULL, Vector, VectorOfUInt8, FPU_SIZE_YMM(ymm6), AVX_OFFSET_YMM(6), -1U, dwarf_ymm6, -1U, gdb_ymm6 },
-{ e_regSetFPU, fpu_ymm7, "ymm7", NULL, Vector, VectorOfUInt8, FPU_SIZE_YMM(ymm7), AVX_OFFSET_YMM(7), -1U, dwarf_ymm7, -1U, gdb_ymm7 },
+{ e_regSetFPU, fpu_fcw      , "fctrl"       , NULL, Uint, Hex, FPU_SIZE_UINT(fcw)       , AVX_OFFSET(fcw)       , INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, NULL, NULL },
+{ e_regSetFPU, fpu_fsw      , "fstat"       , NULL, Uint, Hex, FPU_SIZE_UINT(fsw)       , AVX_OFFSET(fsw)       , INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, NULL, NULL },
+{ e_regSetFPU, fpu_ftw      , "ftag"        , NULL, Uint, Hex, FPU_SIZE_UINT(ftw)       , AVX_OFFSET(ftw)       , INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, NULL, NULL },
+{ e_regSetFPU, fpu_fop      , "fop"         , NULL, Uint, Hex, FPU_SIZE_UINT(fop)       , AVX_OFFSET(fop)       , INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, NULL, NULL },
+{ e_regSetFPU, fpu_ip       , "fioff"       , NULL, Uint, Hex, FPU_SIZE_UINT(ip)        , AVX_OFFSET(ip)        , INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, NULL, NULL },
+{ e_regSetFPU, fpu_cs       , "fiseg"       , NULL, Uint, Hex, FPU_SIZE_UINT(cs)        , AVX_OFFSET(cs)        , INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, NULL, NULL },
+{ e_regSetFPU, fpu_dp       , "fooff"       , NULL, Uint, Hex, FPU_SIZE_UINT(dp)        , AVX_OFFSET(dp)        , INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, NULL, NULL },
+{ e_regSetFPU, fpu_ds       , "foseg"       , NULL, Uint, Hex, FPU_SIZE_UINT(ds)        , AVX_OFFSET(ds)        , INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, NULL, NULL },
+{ e_regSetFPU, fpu_mxcsr    , "mxcsr"       , NULL, Uint, Hex, FPU_SIZE_UINT(mxcsr)     , AVX_OFFSET(mxcsr)     , INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, NULL, NULL },
+{ e_regSetFPU, fpu_mxcsrmask, "mxcsrmask"   , NULL, Uint, Hex, FPU_SIZE_UINT(mxcsrmask) , AVX_OFFSET(mxcsrmask) , INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, NULL, NULL },
+
+{ e_regSetFPU, fpu_stmm0, "stmm0", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm0), AVX_OFFSET(stmm0), INVALID_NUB_REGNUM, dwarf_stmm0, INVALID_NUB_REGNUM, gdb_stmm0, NULL, NULL },
+{ e_regSetFPU, fpu_stmm1, "stmm1", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm1), AVX_OFFSET(stmm1), INVALID_NUB_REGNUM, dwarf_stmm1, INVALID_NUB_REGNUM, gdb_stmm1, NULL, NULL },
+{ e_regSetFPU, fpu_stmm2, "stmm2", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm2), AVX_OFFSET(stmm2), INVALID_NUB_REGNUM, dwarf_stmm2, INVALID_NUB_REGNUM, gdb_stmm2, NULL, NULL },
+{ e_regSetFPU, fpu_stmm3, "stmm3", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm3), AVX_OFFSET(stmm3), INVALID_NUB_REGNUM, dwarf_stmm3, INVALID_NUB_REGNUM, gdb_stmm3, NULL, NULL },
+{ e_regSetFPU, fpu_stmm4, "stmm4", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm4), AVX_OFFSET(stmm4), INVALID_NUB_REGNUM, dwarf_stmm4, INVALID_NUB_REGNUM, gdb_stmm4, NULL, NULL },
+{ e_regSetFPU, fpu_stmm5, "stmm5", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm5), AVX_OFFSET(stmm5), INVALID_NUB_REGNUM, dwarf_stmm5, INVALID_NUB_REGNUM, gdb_stmm5, NULL, NULL },
+{ e_regSetFPU, fpu_stmm6, "stmm6", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm6), AVX_OFFSET(stmm6), INVALID_NUB_REGNUM, dwarf_stmm6, INVALID_NUB_REGNUM, gdb_stmm6, NULL, NULL },
+{ e_regSetFPU, fpu_stmm7, "stmm7", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm7), AVX_OFFSET(stmm7), INVALID_NUB_REGNUM, dwarf_stmm7, INVALID_NUB_REGNUM, gdb_stmm7, NULL, NULL },
+
+{ e_regSetFPU, fpu_xmm0, "xmm0", NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm0), AVX_OFFSET(xmm0), INVALID_NUB_REGNUM, dwarf_xmm0, INVALID_NUB_REGNUM, gdb_xmm0, NULL, NULL },
+{ e_regSetFPU, fpu_xmm1, "xmm1", NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm1), AVX_OFFSET(xmm1), INVALID_NUB_REGNUM, dwarf_xmm1, INVALID_NUB_REGNUM, gdb_xmm1, NULL, NULL },
+{ e_regSetFPU, fpu_xmm2, "xmm2", NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm2), AVX_OFFSET(xmm2), INVALID_NUB_REGNUM, dwarf_xmm2, INVALID_NUB_REGNUM, gdb_xmm2, NULL, NULL },
+{ e_regSetFPU, fpu_xmm3, "xmm3", NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm3), AVX_OFFSET(xmm3), INVALID_NUB_REGNUM, dwarf_xmm3, INVALID_NUB_REGNUM, gdb_xmm3, NULL, NULL },
+{ e_regSetFPU, fpu_xmm4, "xmm4", NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm4), AVX_OFFSET(xmm4), INVALID_NUB_REGNUM, dwarf_xmm4, INVALID_NUB_REGNUM, gdb_xmm4, NULL, NULL },
+{ e_regSetFPU, fpu_xmm5, "xmm5", NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm5), AVX_OFFSET(xmm5), INVALID_NUB_REGNUM, dwarf_xmm5, INVALID_NUB_REGNUM, gdb_xmm5, NULL, NULL },
+{ e_regSetFPU, fpu_xmm6, "xmm6", NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm6), AVX_OFFSET(xmm6), INVALID_NUB_REGNUM, dwarf_xmm6, INVALID_NUB_REGNUM, gdb_xmm6, NULL, NULL },
+{ e_regSetFPU, fpu_xmm7, "xmm7", NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm7), AVX_OFFSET(xmm7), INVALID_NUB_REGNUM, dwarf_xmm7, INVALID_NUB_REGNUM, gdb_xmm7, NULL, NULL },
+
+{ e_regSetFPU, fpu_ymm0, "ymm0", NULL, Vector, VectorOfUInt8, FPU_SIZE_YMM(ymm0), AVX_OFFSET_YMM(0), INVALID_NUB_REGNUM, dwarf_ymm0, INVALID_NUB_REGNUM, gdb_ymm0, NULL, NULL },
+{ e_regSetFPU, fpu_ymm1, "ymm1", NULL, Vector, VectorOfUInt8, FPU_SIZE_YMM(ymm1), AVX_OFFSET_YMM(1), INVALID_NUB_REGNUM, dwarf_ymm1, INVALID_NUB_REGNUM, gdb_ymm1, NULL, NULL },
+{ e_regSetFPU, fpu_ymm2, "ymm2", NULL, Vector, VectorOfUInt8, FPU_SIZE_YMM(ymm2), AVX_OFFSET_YMM(2), INVALID_NUB_REGNUM, dwarf_ymm2, INVALID_NUB_REGNUM, gdb_ymm2, NULL, NULL },
+{ e_regSetFPU, fpu_ymm3, "ymm3", NULL, Vector, VectorOfUInt8, FPU_SIZE_YMM(ymm3), AVX_OFFSET_YMM(3), INVALID_NUB_REGNUM, dwarf_ymm3, INVALID_NUB_REGNUM, gdb_ymm3, NULL, NULL },
+{ e_regSetFPU, fpu_ymm4, "ymm4", NULL, Vector, VectorOfUInt8, FPU_SIZE_YMM(ymm4), AVX_OFFSET_YMM(4), INVALID_NUB_REGNUM, dwarf_ymm4, INVALID_NUB_REGNUM, gdb_ymm4, NULL, NULL },
+{ e_regSetFPU, fpu_ymm5, "ymm5", NULL, Vector, VectorOfUInt8, FPU_SIZE_YMM(ymm5), AVX_OFFSET_YMM(5), INVALID_NUB_REGNUM, dwarf_ymm5, INVALID_NUB_REGNUM, gdb_ymm5, NULL, NULL },
+{ e_regSetFPU, fpu_ymm6, "ymm6", NULL, Vector, VectorOfUInt8, FPU_SIZE_YMM(ymm6), AVX_OFFSET_YMM(6), INVALID_NUB_REGNUM, dwarf_ymm6, INVALID_NUB_REGNUM, gdb_ymm6, NULL, NULL },
+{ e_regSetFPU, fpu_ymm7, "ymm7", NULL, Vector, VectorOfUInt8, FPU_SIZE_YMM(ymm7), AVX_OFFSET_YMM(7), INVALID_NUB_REGNUM, dwarf_ymm7, INVALID_NUB_REGNUM, gdb_ymm7, NULL, NULL }
 };
 
 const DNBRegisterInfo
 DNBArchImplI386::g_exc_registers[] =
 {
-{ e_regSetEXC, exc_trapno,      "trapno"    , NULL, Uint, Hex, EXC_SIZE (trapno)    , EXC_OFFSET (trapno)       , -1U, -1U, -1U, -1U },
-{ e_regSetEXC, exc_err,         "err"       , NULL, Uint, Hex, EXC_SIZE (err)       , EXC_OFFSET (err)          , -1U, -1U, -1U, -1U },
-{ e_regSetEXC, exc_faultvaddr,  "faultvaddr", NULL, Uint, Hex, EXC_SIZE (faultvaddr), EXC_OFFSET (faultvaddr)   , -1U, -1U, -1U, -1U }
+{ e_regSetEXC, exc_trapno,      "trapno"    , NULL, Uint, Hex, EXC_SIZE (trapno)    , EXC_OFFSET (trapno)       , INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, NULL, NULL },
+{ e_regSetEXC, exc_err,         "err"       , NULL, Uint, Hex, EXC_SIZE (err)       , EXC_OFFSET (err)          , INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, NULL, NULL },
+{ e_regSetEXC, exc_faultvaddr,  "faultvaddr", NULL, Uint, Hex, EXC_SIZE (faultvaddr), EXC_OFFSET (faultvaddr)   , INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, NULL, NULL }
 };
 
 // Number of registers in each register set
@@ -1524,17 +1586,17 @@ DNBArchImplI386::GetRegisterContext (voi
         kern_return_t kret;
         if ((kret = GetGPRState(force)) != KERN_SUCCESS)
         {
-            DNBLogThreadedIf (LOG_THREAD, "DNBArchImplI386::GetRegisterContext (buf = %p, len = %zu) error: GPR regs failed to read: %u ", buf, buf_len, kret);
+            DNBLogThreadedIf (LOG_THREAD, "DNBArchImplI386::GetRegisterContext (buf = %p, len = %llu) error: GPR regs failed to read: %u ", buf, (uint64_t)buf_len, kret);
             size = 0;
         }
         else if ((kret = GetFPUState(force)) != KERN_SUCCESS)
         {
-            DNBLogThreadedIf (LOG_THREAD, "DNBArchImplI386::GetRegisterContext (buf = %p, len = %zu) error: %s regs failed to read: %u", buf, buf_len, CPUHasAVX() ? "AVX" : "FPU", kret);
+            DNBLogThreadedIf (LOG_THREAD, "DNBArchImplI386::GetRegisterContext (buf = %p, len = %llu) error: %s regs failed to read: %u", buf, (uint64_t)buf_len, CPUHasAVX() ? "AVX" : "FPU", kret);
             size = 0;
         }
         else if ((kret = GetEXCState(force)) != KERN_SUCCESS)
         {
-            DNBLogThreadedIf (LOG_THREAD, "DNBArchImplI386::GetRegisterContext (buf = %p, len = %zu) error: EXC regs failed to read: %u", buf, buf_len, kret);
+            DNBLogThreadedIf (LOG_THREAD, "DNBArchImplI386::GetRegisterContext (buf = %p, len = %llu) error: EXC regs failed to read: %u", buf, (uint64_t)buf_len, kret);
             size = 0;
         }
         else
@@ -1543,7 +1605,7 @@ DNBArchImplI386::GetRegisterContext (voi
             ::memcpy (buf, &m_state.context, size);
         }
     }
-    DNBLogThreadedIf (LOG_THREAD, "DNBArchImplI386::GetRegisterContext (buf = %p, len = %zu) => %zu", buf, buf_len, size);
+    DNBLogThreadedIf (LOG_THREAD, "DNBArchImplI386::GetRegisterContext (buf = %p, len = %llu) => %llu", buf, (uint64_t)buf_len, (uint64_t)size);
     // Return the size of the register context even if NULL was passed in
     return size;
 }
@@ -1563,13 +1625,13 @@ DNBArchImplI386::SetRegisterContext (con
         ::memcpy (&m_state.context, buf, size);
         kern_return_t kret;
         if ((kret = SetGPRState()) != KERN_SUCCESS)
-            DNBLogThreadedIf (LOG_THREAD, "DNBArchImplI386::SetRegisterContext (buf = %p, len = %zu) error: GPR regs failed to write: %u", buf, buf_len, kret);
+            DNBLogThreadedIf (LOG_THREAD, "DNBArchImplI386::SetRegisterContext (buf = %p, len = %llu) error: GPR regs failed to write: %u", buf, (uint64_t)buf_len, kret);
         if ((kret = SetFPUState()) != KERN_SUCCESS)
-            DNBLogThreadedIf (LOG_THREAD, "DNBArchImplI386::SetRegisterContext (buf = %p, len = %zu) error: %s regs failed to write: %u", buf, buf_len, CPUHasAVX() ? "AVX" : "FPU", kret);
+            DNBLogThreadedIf (LOG_THREAD, "DNBArchImplI386::SetRegisterContext (buf = %p, len = %llu) error: %s regs failed to write: %u", buf, (uint64_t)buf_len, CPUHasAVX() ? "AVX" : "FPU", kret);
         if ((kret = SetEXCState()) != KERN_SUCCESS)
-            DNBLogThreadedIf (LOG_THREAD, "DNBArchImplI386::SetRegisterContext (buf = %p, len = %zu) error: EXP regs failed to write: %u", buf, buf_len, kret);
+            DNBLogThreadedIf (LOG_THREAD, "DNBArchImplI386::SetRegisterContext (buf = %p, len = %llu) error: EXP regs failed to write: %u", buf, (uint64_t)buf_len, kret);
     }
-    DNBLogThreadedIf (LOG_THREAD, "DNBArchImplI386::SetRegisterContext (buf = %p, len = %zu) => %zu", buf, buf_len, size);
+    DNBLogThreadedIf (LOG_THREAD, "DNBArchImplI386::SetRegisterContext (buf = %p, len = %llu) => %llu", buf, (uint64_t)buf_len, (uint64_t)size);
     return size;
 }
 

Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/ppc/DNBArchImpl.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/ppc/DNBArchImpl.cpp?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/ppc/DNBArchImpl.cpp (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/ppc/DNBArchImpl.cpp Thu Jun  6 19:06:43 2013
@@ -78,7 +78,7 @@ DNBArchMachPPC::GetGPRState(bool force)
     if (force || m_state.GetError(e_regSetGPR, Read))
     {
         mach_msg_type_number_t count = e_regSetWordSizeGPR;
-        m_state.SetError(e_regSetGPR, Read, ::thread_get_state(m_thread->ThreadID(), e_regSetGPR, (thread_state_t)&m_state.gpr, &count));
+        m_state.SetError(e_regSetGPR, Read, ::thread_get_state(m_thread->MachPortNumber(), e_regSetGPR, (thread_state_t)&m_state.gpr, &count));
     }
     return m_state.GetError(e_regSetGPR, Read);
 }
@@ -89,7 +89,7 @@ DNBArchMachPPC::GetFPRState(bool force)
     if (force || m_state.GetError(e_regSetFPR, Read))
     {
         mach_msg_type_number_t count = e_regSetWordSizeFPR;
-        m_state.SetError(e_regSetFPR, Read, ::thread_get_state(m_thread->ThreadID(), e_regSetFPR, (thread_state_t)&m_state.fpr, &count));
+        m_state.SetError(e_regSetFPR, Read, ::thread_get_state(m_thread->MachPortNumber(), e_regSetFPR, (thread_state_t)&m_state.fpr, &count));
     }
     return m_state.GetError(e_regSetFPR, Read);
 }
@@ -100,7 +100,7 @@ DNBArchMachPPC::GetEXCState(bool force)
     if (force || m_state.GetError(e_regSetEXC, Read))
     {
         mach_msg_type_number_t count = e_regSetWordSizeEXC;
-        m_state.SetError(e_regSetEXC, Read, ::thread_get_state(m_thread->ThreadID(), e_regSetEXC, (thread_state_t)&m_state.exc, &count));
+        m_state.SetError(e_regSetEXC, Read, ::thread_get_state(m_thread->MachPortNumber(), e_regSetEXC, (thread_state_t)&m_state.exc, &count));
     }
     return m_state.GetError(e_regSetEXC, Read);
 }
@@ -111,7 +111,7 @@ DNBArchMachPPC::GetVECState(bool force)
     if (force || m_state.GetError(e_regSetVEC, Read))
     {
         mach_msg_type_number_t count = e_regSetWordSizeVEC;
-        m_state.SetError(e_regSetVEC, Read, ::thread_get_state(m_thread->ThreadID(), e_regSetVEC, (thread_state_t)&m_state.vec, &count));
+        m_state.SetError(e_regSetVEC, Read, ::thread_get_state(m_thread->MachPortNumber(), e_regSetVEC, (thread_state_t)&m_state.vec, &count));
     }
     return m_state.GetError(e_regSetVEC, Read);
 }
@@ -119,28 +119,28 @@ DNBArchMachPPC::GetVECState(bool force)
 kern_return_t
 DNBArchMachPPC::SetGPRState()
 {
-    m_state.SetError(e_regSetGPR, Write, ::thread_set_state(m_thread->ThreadID(), e_regSetGPR, (thread_state_t)&m_state.gpr, e_regSetWordSizeGPR));
+    m_state.SetError(e_regSetGPR, Write, ::thread_set_state(m_thread->MachPortNumber(), e_regSetGPR, (thread_state_t)&m_state.gpr, e_regSetWordSizeGPR));
     return m_state.GetError(e_regSetGPR, Write);
 }
 
 kern_return_t
 DNBArchMachPPC::SetFPRState()
 {
-    m_state.SetError(e_regSetFPR, Write, ::thread_set_state(m_thread->ThreadID(), e_regSetFPR, (thread_state_t)&m_state.fpr, e_regSetWordSizeFPR));
+    m_state.SetError(e_regSetFPR, Write, ::thread_set_state(m_thread->MachPortNumber(), e_regSetFPR, (thread_state_t)&m_state.fpr, e_regSetWordSizeFPR));
     return m_state.GetError(e_regSetFPR, Write);
 }
 
 kern_return_t
 DNBArchMachPPC::SetEXCState()
 {
-    m_state.SetError(e_regSetEXC, Write, ::thread_set_state(m_thread->ThreadID(), e_regSetEXC, (thread_state_t)&m_state.exc, e_regSetWordSizeEXC));
+    m_state.SetError(e_regSetEXC, Write, ::thread_set_state(m_thread->MachPortNumber(), e_regSetEXC, (thread_state_t)&m_state.exc, e_regSetWordSizeEXC));
     return m_state.GetError(e_regSetEXC, Write);
 }
 
 kern_return_t
 DNBArchMachPPC::SetVECState()
 {
-    m_state.SetError(e_regSetVEC, Write, ::thread_set_state(m_thread->ThreadID(), e_regSetVEC, (thread_state_t)&m_state.vec, e_regSetWordSizeVEC));
+    m_state.SetError(e_regSetVEC, Write, ::thread_set_state(m_thread->MachPortNumber(), e_regSetVEC, (thread_state_t)&m_state.vec, e_regSetWordSizeVEC));
     return m_state.GetError(e_regSetVEC, Write);
 }
 

Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp Thu Jun  6 19:06:43 2013
@@ -180,7 +180,7 @@ DNBArchImplX86_64::GetGPRState(bool forc
         m_state.SetError(e_regSetGPR, Read, 0);
 #else
         mach_msg_type_number_t count = e_regSetWordSizeGPR;
-        m_state.SetError(e_regSetGPR, Read, ::thread_get_state(m_thread->ThreadID(), __x86_64_THREAD_STATE, (thread_state_t)&m_state.context.gpr, &count));
+        m_state.SetError(e_regSetGPR, Read, ::thread_get_state(m_thread->MachPortNumber(), __x86_64_THREAD_STATE, (thread_state_t)&m_state.context.gpr, &count));
         DNBLogThreadedIf (LOG_THREAD, "::thread_get_state (0x%4.4x, %u, &gpr, %u) => 0x%8.8x"
                           "\n\trax = %16.16llx rbx = %16.16llx rcx = %16.16llx rdx = %16.16llx"
                           "\n\trdi = %16.16llx rsi = %16.16llx rbp = %16.16llx rsp = %16.16llx"
@@ -188,7 +188,7 @@ DNBArchImplX86_64::GetGPRState(bool forc
                           "\n\tr12 = %16.16llx r13 = %16.16llx r14 = %16.16llx r15 = %16.16llx"
                           "\n\trip = %16.16llx"
                           "\n\tflg = %16.16llx  cs = %16.16llx  fs = %16.16llx  gs = %16.16llx",
-                          m_thread->ThreadID(), x86_THREAD_STATE64, x86_THREAD_STATE64_COUNT,
+                          m_thread->MachPortNumber(), x86_THREAD_STATE64, x86_THREAD_STATE64_COUNT,
                           m_state.GetError(e_regSetGPR, Read),
                           m_state.context.gpr.__rax,m_state.context.gpr.__rbx,m_state.context.gpr.__rcx,
                           m_state.context.gpr.__rdx,m_state.context.gpr.__rdi,m_state.context.gpr.__rsi,
@@ -220,7 +220,7 @@ DNBArchImplX86_64::GetGPRState(bool forc
         //                        "\n\t cs = %16.16llx"
         //                        "\n\t fs = %16.16llx"
         //                        "\n\t gs = %16.16llx",
-        //                        m_thread->ThreadID(),
+        //                        m_thread->MachPortNumber(),
         //                        x86_THREAD_STATE64,
         //                        x86_THREAD_STATE64_COUNT,
         //                        m_state.GetError(e_regSetGPR, Read),
@@ -414,17 +414,17 @@ DNBArchImplX86_64::GetFPUState(bool forc
             if (CPUHasAVX() || FORCE_AVX_REGS)
             {
                 mach_msg_type_number_t count = e_regSetWordSizeAVX;
-                m_state.SetError(e_regSetFPU, Read, ::thread_get_state(m_thread->ThreadID(), __x86_64_AVX_STATE, (thread_state_t)&m_state.context.fpu.avx, &count));
+                m_state.SetError(e_regSetFPU, Read, ::thread_get_state(m_thread->MachPortNumber(), __x86_64_AVX_STATE, (thread_state_t)&m_state.context.fpu.avx, &count));
                 DNBLogThreadedIf (LOG_THREAD, "::thread_get_state (0x%4.4x, %u, &avx, %u (%u passed in) carp) => 0x%8.8x",
-                                  m_thread->ThreadID(), __x86_64_AVX_STATE, (uint32_t)count, 
+                                  m_thread->MachPortNumber(), __x86_64_AVX_STATE, (uint32_t)count, 
                                   e_regSetWordSizeAVX, m_state.GetError(e_regSetFPU, Read));
             }
             else
             {
                 mach_msg_type_number_t count = e_regSetWordSizeFPU;
-                m_state.SetError(e_regSetFPU, Read, ::thread_get_state(m_thread->ThreadID(), __x86_64_FLOAT_STATE, (thread_state_t)&m_state.context.fpu.no_avx, &count));
+                m_state.SetError(e_regSetFPU, Read, ::thread_get_state(m_thread->MachPortNumber(), __x86_64_FLOAT_STATE, (thread_state_t)&m_state.context.fpu.no_avx, &count));
                 DNBLogThreadedIf (LOG_THREAD, "::thread_get_state (0x%4.4x, %u, &fpu, %u (%u passed in) => 0x%8.8x",
-                                  m_thread->ThreadID(), __x86_64_FLOAT_STATE, (uint32_t)count, 
+                                  m_thread->MachPortNumber(), __x86_64_FLOAT_STATE, (uint32_t)count, 
                                   e_regSetWordSizeFPU, m_state.GetError(e_regSetFPU, Read));
             }
         }        
@@ -438,7 +438,7 @@ DNBArchImplX86_64::GetEXCState(bool forc
     if (force || m_state.GetError(e_regSetEXC, Read))
     {
         mach_msg_type_number_t count = e_regSetWordSizeEXC;
-        m_state.SetError(e_regSetEXC, Read, ::thread_get_state(m_thread->ThreadID(), __x86_64_EXCEPTION_STATE, (thread_state_t)&m_state.context.exc, &count));
+        m_state.SetError(e_regSetEXC, Read, ::thread_get_state(m_thread->MachPortNumber(), __x86_64_EXCEPTION_STATE, (thread_state_t)&m_state.context.exc, &count));
     }
     return m_state.GetError(e_regSetEXC, Read);
 }
@@ -446,10 +446,10 @@ DNBArchImplX86_64::GetEXCState(bool forc
 kern_return_t
 DNBArchImplX86_64::SetGPRState()
 {
-    kern_return_t kret = ::thread_abort_safely(m_thread->ThreadID());
-    DNBLogThreadedIf (LOG_THREAD, "thread = 0x%4.4x calling thread_abort_safely (tid) => %u (SetGPRState() for stop_count = %u)", m_thread->ThreadID(), kret, m_thread->Process()->StopCount());    
+    kern_return_t kret = ::thread_abort_safely(m_thread->MachPortNumber());
+    DNBLogThreadedIf (LOG_THREAD, "thread = 0x%4.4x calling thread_abort_safely (tid) => %u (SetGPRState() for stop_count = %u)", m_thread->MachPortNumber(), kret, m_thread->Process()->StopCount());    
 
-    m_state.SetError(e_regSetGPR, Write, ::thread_set_state(m_thread->ThreadID(), __x86_64_THREAD_STATE, (thread_state_t)&m_state.context.gpr, e_regSetWordSizeGPR));
+    m_state.SetError(e_regSetGPR, Write, ::thread_set_state(m_thread->MachPortNumber(), __x86_64_THREAD_STATE, (thread_state_t)&m_state.context.gpr, e_regSetWordSizeGPR));
     DNBLogThreadedIf (LOG_THREAD, "::thread_set_state (0x%4.4x, %u, &gpr, %u) => 0x%8.8x"
                       "\n\trax = %16.16llx rbx = %16.16llx rcx = %16.16llx rdx = %16.16llx"
                       "\n\trdi = %16.16llx rsi = %16.16llx rbp = %16.16llx rsp = %16.16llx"
@@ -457,7 +457,7 @@ DNBArchImplX86_64::SetGPRState()
                       "\n\tr12 = %16.16llx r13 = %16.16llx r14 = %16.16llx r15 = %16.16llx"
                       "\n\trip = %16.16llx"
                       "\n\tflg = %16.16llx  cs = %16.16llx  fs = %16.16llx  gs = %16.16llx",
-                      m_thread->ThreadID(), __x86_64_THREAD_STATE, e_regSetWordSizeGPR,
+                      m_thread->MachPortNumber(), __x86_64_THREAD_STATE, e_regSetWordSizeGPR,
                       m_state.GetError(e_regSetGPR, Write),
                       m_state.context.gpr.__rax,m_state.context.gpr.__rbx,m_state.context.gpr.__rcx,
                       m_state.context.gpr.__rdx,m_state.context.gpr.__rdi,m_state.context.gpr.__rsi,
@@ -481,12 +481,12 @@ DNBArchImplX86_64::SetFPUState()
     {
         if (CPUHasAVX() || FORCE_AVX_REGS)
         {
-            m_state.SetError(e_regSetFPU, Write, ::thread_set_state(m_thread->ThreadID(), __x86_64_AVX_STATE, (thread_state_t)&m_state.context.fpu.avx, e_regSetWordSizeAVX));
+            m_state.SetError(e_regSetFPU, Write, ::thread_set_state(m_thread->MachPortNumber(), __x86_64_AVX_STATE, (thread_state_t)&m_state.context.fpu.avx, e_regSetWordSizeAVX));
             return m_state.GetError(e_regSetFPU, Write);
         }
         else
         {
-            m_state.SetError(e_regSetFPU, Write, ::thread_set_state(m_thread->ThreadID(), __x86_64_FLOAT_STATE, (thread_state_t)&m_state.context.fpu.no_avx, e_regSetWordSizeFPU));
+            m_state.SetError(e_regSetFPU, Write, ::thread_set_state(m_thread->MachPortNumber(), __x86_64_FLOAT_STATE, (thread_state_t)&m_state.context.fpu.no_avx, e_regSetWordSizeFPU));
             return m_state.GetError(e_regSetFPU, Write);
         }
     }
@@ -495,7 +495,7 @@ DNBArchImplX86_64::SetFPUState()
 kern_return_t
 DNBArchImplX86_64::SetEXCState()
 {
-    m_state.SetError(e_regSetEXC, Write, ::thread_set_state(m_thread->ThreadID(), __x86_64_EXCEPTION_STATE, (thread_state_t)&m_state.context.exc, e_regSetWordSizeEXC));
+    m_state.SetError(e_regSetEXC, Write, ::thread_set_state(m_thread->MachPortNumber(), __x86_64_EXCEPTION_STATE, (thread_state_t)&m_state.context.exc, e_regSetWordSizeEXC));
     return m_state.GetError(e_regSetEXC, Write);
 }
 
@@ -505,7 +505,7 @@ DNBArchImplX86_64::GetDBGState(bool forc
     if (force || m_state.GetError(e_regSetDBG, Read))
     {
         mach_msg_type_number_t count = e_regSetWordSizeDBG;
-        m_state.SetError(e_regSetDBG, Read, ::thread_get_state(m_thread->ThreadID(), __x86_64_DEBUG_STATE, (thread_state_t)&m_state.context.dbg, &count));
+        m_state.SetError(e_regSetDBG, Read, ::thread_get_state(m_thread->MachPortNumber(), __x86_64_DEBUG_STATE, (thread_state_t)&m_state.context.dbg, &count));
     }
     return m_state.GetError(e_regSetDBG, Read);
 }
@@ -513,7 +513,7 @@ DNBArchImplX86_64::GetDBGState(bool forc
 kern_return_t
 DNBArchImplX86_64::SetDBGState()
 {
-    m_state.SetError(e_regSetDBG, Write, ::thread_set_state(m_thread->ThreadID(), __x86_64_DEBUG_STATE, (thread_state_t)&m_state.context.dbg, e_regSetWordSizeDBG));
+    m_state.SetError(e_regSetDBG, Write, ::thread_set_state(m_thread->MachPortNumber(), __x86_64_DEBUG_STATE, (thread_state_t)&m_state.context.dbg, e_regSetWordSizeDBG));
     return m_state.GetError(e_regSetDBG, Write);
 }
 
@@ -795,7 +795,7 @@ DNBArchImplX86_64::GetWatchAddress(const
 bool
 DNBArchImplX86_64::StartTransForHWP()
 {
-    if (m_2pc_trans_state != Trans_Done || m_2pc_trans_state != Trans_Rolled_Back)
+    if (m_2pc_trans_state != Trans_Done && m_2pc_trans_state != Trans_Rolled_Back)
         DNBLogError ("%s inconsistent state detected, expected %d or %d, got: %d", __FUNCTION__, Trans_Done, Trans_Rolled_Back, m_2pc_trans_state);
     m_2pc_dbg_checkpoint = m_state.context.dbg;
     m_2pc_trans_state = Trans_Pending;
@@ -831,7 +831,7 @@ DNBArchImplX86_64::GetDBGCheckpoint()
 uint32_t
 DNBArchImplX86_64::EnableHardwareWatchpoint (nub_addr_t addr, nub_size_t size, bool read, bool write)
 {
-    DNBLogThreadedIf(LOG_WATCHPOINTS, "DNBArchImplX86_64::EnableHardwareWatchpoint(addr = 0x%llx, size = %zu, read = %u, write = %u)", (uint64_t)addr, size, read, write);
+    DNBLogThreadedIf(LOG_WATCHPOINTS, "DNBArchImplX86_64::EnableHardwareWatchpoint(addr = 0x%llx, size = %llu, read = %u, write = %u)", (uint64_t)addr, (uint64_t)size, read, write);
 
     const uint32_t num_hw_watchpoints = NumSupportedHardwareWatchpoints();
 
@@ -995,6 +995,58 @@ enum
     gpr_cs,
     gpr_fs,
     gpr_gs,
+    gpr_eax,
+    gpr_ebx,
+    gpr_ecx,
+    gpr_edx,
+    gpr_edi,
+    gpr_esi,
+    gpr_ebp,
+    gpr_esp,
+    gpr_r8d,    // Low 32 bits or r8
+    gpr_r9d,    // Low 32 bits or r9
+    gpr_r10d,   // Low 32 bits or r10
+    gpr_r11d,   // Low 32 bits or r11
+    gpr_r12d,   // Low 32 bits or r12
+    gpr_r13d,   // Low 32 bits or r13
+    gpr_r14d,   // Low 32 bits or r14
+    gpr_r15d,   // Low 32 bits or r15
+    gpr_ax ,
+    gpr_bx ,
+    gpr_cx ,
+    gpr_dx ,
+    gpr_di ,
+    gpr_si ,
+    gpr_bp ,
+    gpr_sp ,
+    gpr_r8w,    // Low 16 bits or r8
+    gpr_r9w,    // Low 16 bits or r9
+    gpr_r10w,   // Low 16 bits or r10
+    gpr_r11w,   // Low 16 bits or r11
+    gpr_r12w,   // Low 16 bits or r12
+    gpr_r13w,   // Low 16 bits or r13
+    gpr_r14w,   // Low 16 bits or r14
+    gpr_r15w,   // Low 16 bits or r15
+    gpr_ah ,
+    gpr_bh ,
+    gpr_ch ,
+    gpr_dh ,
+    gpr_al ,
+    gpr_bl ,
+    gpr_cl ,
+    gpr_dl ,
+    gpr_dil,
+    gpr_sil,
+    gpr_bpl,
+    gpr_spl,
+    gpr_r8l,    // Low 8 bits or r8
+    gpr_r9l,    // Low 8 bits or r9
+    gpr_r10l,   // Low 8 bits or r10
+    gpr_r11l,   // Low 8 bits or r11
+    gpr_r12l,   // Low 8 bits or r12
+    gpr_r13l,   // Low 8 bits or r13
+    gpr_r14l,   // Low 8 bits or r14
+    gpr_r15l,   // Low 8 bits or r15
     k_num_gpr_regs
 };
 
@@ -1230,12 +1282,53 @@ enum gdb_regnums
 // register offset, encoding, format and native register. This ensures that
 // the register state structures are defined correctly and have the correct
 // sizes and offsets.
-#define DEFINE_GPR(reg) { e_regSetGPR, gpr_##reg, #reg, NULL, Uint, Hex, GPR_SIZE(reg), GPR_OFFSET(reg), gcc_dwarf_##reg, gcc_dwarf_##reg, INVALID_NUB_REGNUM, gdb_##reg }
-#define DEFINE_GPR_ALT(reg, alt, gen) { e_regSetGPR, gpr_##reg, #reg, alt, Uint, Hex, GPR_SIZE(reg), GPR_OFFSET(reg), gcc_dwarf_##reg, gcc_dwarf_##reg, gen, gdb_##reg }
-#define DEFINE_GPR_ALT2(reg, alt) { e_regSetGPR, gpr_##reg, #reg, alt, Uint, Hex, GPR_SIZE(reg), GPR_OFFSET(reg), INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, gdb_##reg }
-#define DEFINE_GPR_ALT3(reg, alt, gen) { e_regSetGPR, gpr_##reg, #reg, alt, Uint, Hex, GPR_SIZE(reg), GPR_OFFSET(reg), INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, gen, gdb_##reg }
+#define DEFINE_GPR(reg)                   { e_regSetGPR, gpr_##reg, #reg, NULL, Uint, Hex, GPR_SIZE(reg), GPR_OFFSET(reg), gcc_dwarf_##reg, gcc_dwarf_##reg, INVALID_NUB_REGNUM, gdb_##reg, NULL, g_invalidate_##reg }
+#define DEFINE_GPR_ALT(reg, alt, gen)     { e_regSetGPR, gpr_##reg, #reg, alt, Uint, Hex, GPR_SIZE(reg), GPR_OFFSET(reg), gcc_dwarf_##reg, gcc_dwarf_##reg, gen, gdb_##reg, NULL, g_invalidate_##reg }
+#define DEFINE_GPR_ALT2(reg, alt)         { e_regSetGPR, gpr_##reg, #reg, alt, Uint, Hex, GPR_SIZE(reg), GPR_OFFSET(reg), INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, gdb_##reg, NULL, NULL }
+#define DEFINE_GPR_ALT3(reg, alt, gen)    { e_regSetGPR, gpr_##reg, #reg, alt, Uint, Hex, GPR_SIZE(reg), GPR_OFFSET(reg), INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, gen, gdb_##reg, NULL, NULL }
+#define DEFINE_GPR_ALT4(reg, alt, gen)     { e_regSetGPR, gpr_##reg, #reg, alt, Uint, Hex, GPR_SIZE(reg), GPR_OFFSET(reg), gcc_dwarf_##reg, gcc_dwarf_##reg, gen, gdb_##reg, NULL, NULL }
+
+#define DEFINE_GPR_PSEUDO_32(reg32,reg64) { e_regSetGPR, gpr_##reg32, #reg32, NULL, Uint, Hex, 4, GPR_OFFSET(reg64)  ,INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, g_contained_##reg64, g_invalidate_##reg64 }
+#define DEFINE_GPR_PSEUDO_16(reg16,reg64) { e_regSetGPR, gpr_##reg16, #reg16, NULL, Uint, Hex, 2, GPR_OFFSET(reg64)  ,INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, g_contained_##reg64, g_invalidate_##reg64 }
+#define DEFINE_GPR_PSEUDO_8H(reg8,reg64)  { e_regSetGPR, gpr_##reg8 , #reg8 , NULL, Uint, Hex, 1, GPR_OFFSET(reg64)+1,INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, g_contained_##reg64, g_invalidate_##reg64 }
+#define DEFINE_GPR_PSEUDO_8L(reg8,reg64)  { e_regSetGPR, gpr_##reg8 , #reg8 , NULL, Uint, Hex, 1, GPR_OFFSET(reg64)  ,INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, g_contained_##reg64, g_invalidate_##reg64 }
 
 // General purpose registers for 64 bit
+
+uint32_t g_contained_rax[] = { gpr_rax, INVALID_NUB_REGNUM };
+uint32_t g_contained_rbx[] = { gpr_rbx, INVALID_NUB_REGNUM };
+uint32_t g_contained_rcx[] = { gpr_rcx, INVALID_NUB_REGNUM };
+uint32_t g_contained_rdx[] = { gpr_rdx, INVALID_NUB_REGNUM };
+uint32_t g_contained_rdi[] = { gpr_rdi, INVALID_NUB_REGNUM };
+uint32_t g_contained_rsi[] = { gpr_rsi, INVALID_NUB_REGNUM };
+uint32_t g_contained_rbp[] = { gpr_rbp, INVALID_NUB_REGNUM };
+uint32_t g_contained_rsp[] = { gpr_rsp, INVALID_NUB_REGNUM };
+uint32_t g_contained_r8[]  = { gpr_r8 , INVALID_NUB_REGNUM };
+uint32_t g_contained_r9[]  = { gpr_r9 , INVALID_NUB_REGNUM };
+uint32_t g_contained_r10[] = { gpr_r10, INVALID_NUB_REGNUM };
+uint32_t g_contained_r11[] = { gpr_r11, INVALID_NUB_REGNUM };
+uint32_t g_contained_r12[] = { gpr_r12, INVALID_NUB_REGNUM };
+uint32_t g_contained_r13[] = { gpr_r13, INVALID_NUB_REGNUM };
+uint32_t g_contained_r14[] = { gpr_r14, INVALID_NUB_REGNUM };
+uint32_t g_contained_r15[] = { gpr_r15, INVALID_NUB_REGNUM };
+
+uint32_t g_invalidate_rax[] = { gpr_rax, gpr_eax , gpr_ax  , gpr_ah  , gpr_al, INVALID_NUB_REGNUM };
+uint32_t g_invalidate_rbx[] = { gpr_rbx, gpr_ebx , gpr_bx  , gpr_bh  , gpr_bl, INVALID_NUB_REGNUM };
+uint32_t g_invalidate_rcx[] = { gpr_rcx, gpr_ecx , gpr_cx  , gpr_ch  , gpr_cl, INVALID_NUB_REGNUM };
+uint32_t g_invalidate_rdx[] = { gpr_rdx, gpr_edx , gpr_dx  , gpr_dh  , gpr_dl, INVALID_NUB_REGNUM };
+uint32_t g_invalidate_rdi[] = { gpr_rdi, gpr_edi , gpr_di  , gpr_dil , INVALID_NUB_REGNUM };
+uint32_t g_invalidate_rsi[] = { gpr_rsi, gpr_esi , gpr_si  , gpr_sil , INVALID_NUB_REGNUM };
+uint32_t g_invalidate_rbp[] = { gpr_rbp, gpr_ebp , gpr_bp  , gpr_bpl , INVALID_NUB_REGNUM };
+uint32_t g_invalidate_rsp[] = { gpr_rsp, gpr_esp , gpr_sp  , gpr_spl , INVALID_NUB_REGNUM };
+uint32_t g_invalidate_r8 [] = { gpr_r8 , gpr_r8d , gpr_r8w , gpr_r8l , INVALID_NUB_REGNUM };
+uint32_t g_invalidate_r9 [] = { gpr_r9 , gpr_r9d , gpr_r9w , gpr_r9l , INVALID_NUB_REGNUM };
+uint32_t g_invalidate_r10[] = { gpr_r10, gpr_r10d, gpr_r10w, gpr_r10l, INVALID_NUB_REGNUM };
+uint32_t g_invalidate_r11[] = { gpr_r11, gpr_r11d, gpr_r11w, gpr_r11l, INVALID_NUB_REGNUM };
+uint32_t g_invalidate_r12[] = { gpr_r12, gpr_r12d, gpr_r12w, gpr_r12l, INVALID_NUB_REGNUM };
+uint32_t g_invalidate_r13[] = { gpr_r13, gpr_r13d, gpr_r13w, gpr_r13l, INVALID_NUB_REGNUM };
+uint32_t g_invalidate_r14[] = { gpr_r14, gpr_r14d, gpr_r14w, gpr_r14l, INVALID_NUB_REGNUM };
+uint32_t g_invalidate_r15[] = { gpr_r15, gpr_r15d, gpr_r15w, gpr_r15l, INVALID_NUB_REGNUM };
+
 const DNBRegisterInfo
 DNBArchImplX86_64::g_gpr_registers[] =
 {
@@ -1255,111 +1348,163 @@ DNBArchImplX86_64::g_gpr_registers[] =
     DEFINE_GPR      (r13),
     DEFINE_GPR      (r14),
     DEFINE_GPR      (r15),
-    DEFINE_GPR_ALT  (rip , "pc", GENERIC_REGNUM_PC),
+    DEFINE_GPR_ALT4 (rip , "pc", GENERIC_REGNUM_PC),
     DEFINE_GPR_ALT3 (rflags, "flags", GENERIC_REGNUM_FLAGS),
     DEFINE_GPR_ALT2 (cs,        NULL),
     DEFINE_GPR_ALT2 (fs,        NULL),
     DEFINE_GPR_ALT2 (gs,        NULL),
+    DEFINE_GPR_PSEUDO_32 (eax, rax),
+    DEFINE_GPR_PSEUDO_32 (ebx, rbx),
+    DEFINE_GPR_PSEUDO_32 (ecx, rcx),
+    DEFINE_GPR_PSEUDO_32 (edx, rdx),
+    DEFINE_GPR_PSEUDO_32 (edi, rdi),
+    DEFINE_GPR_PSEUDO_32 (esi, rsi),
+    DEFINE_GPR_PSEUDO_32 (ebp, rbp),
+    DEFINE_GPR_PSEUDO_32 (esp, rsp),
+    DEFINE_GPR_PSEUDO_32 (r8d, r8),
+    DEFINE_GPR_PSEUDO_32 (r9d, r9),
+    DEFINE_GPR_PSEUDO_32 (r10d, r10),
+    DEFINE_GPR_PSEUDO_32 (r11d, r11),
+    DEFINE_GPR_PSEUDO_32 (r12d, r12),
+    DEFINE_GPR_PSEUDO_32 (r13d, r13),
+    DEFINE_GPR_PSEUDO_32 (r14d, r14),
+    DEFINE_GPR_PSEUDO_32 (r15d, r15),
+    DEFINE_GPR_PSEUDO_16 (ax , rax),
+    DEFINE_GPR_PSEUDO_16 (bx , rbx),
+    DEFINE_GPR_PSEUDO_16 (cx , rcx),
+    DEFINE_GPR_PSEUDO_16 (dx , rdx),
+    DEFINE_GPR_PSEUDO_16 (di , rdi),
+    DEFINE_GPR_PSEUDO_16 (si , rsi),
+    DEFINE_GPR_PSEUDO_16 (bp , rbp),
+    DEFINE_GPR_PSEUDO_16 (sp , rsp),
+    DEFINE_GPR_PSEUDO_16 (r8w, r8),
+    DEFINE_GPR_PSEUDO_16 (r9w, r9),
+    DEFINE_GPR_PSEUDO_16 (r10w, r10),
+    DEFINE_GPR_PSEUDO_16 (r11w, r11),
+    DEFINE_GPR_PSEUDO_16 (r12w, r12),
+    DEFINE_GPR_PSEUDO_16 (r13w, r13),
+    DEFINE_GPR_PSEUDO_16 (r14w, r14),
+    DEFINE_GPR_PSEUDO_16 (r15w, r15),
+    DEFINE_GPR_PSEUDO_8H (ah , rax),
+    DEFINE_GPR_PSEUDO_8H (bh , rbx),
+    DEFINE_GPR_PSEUDO_8H (ch , rcx),
+    DEFINE_GPR_PSEUDO_8H (dh , rdx),
+    DEFINE_GPR_PSEUDO_8L (al , rax),
+    DEFINE_GPR_PSEUDO_8L (bl , rbx),
+    DEFINE_GPR_PSEUDO_8L (cl , rcx),
+    DEFINE_GPR_PSEUDO_8L (dl , rdx),
+    DEFINE_GPR_PSEUDO_8L (dil, rdi),
+    DEFINE_GPR_PSEUDO_8L (sil, rsi),
+    DEFINE_GPR_PSEUDO_8L (bpl, rbp),
+    DEFINE_GPR_PSEUDO_8L (spl, rsp),
+    DEFINE_GPR_PSEUDO_8L (r8l, r8),
+    DEFINE_GPR_PSEUDO_8L (r9l, r9),
+    DEFINE_GPR_PSEUDO_8L (r10l, r10),
+    DEFINE_GPR_PSEUDO_8L (r11l, r11),
+    DEFINE_GPR_PSEUDO_8L (r12l, r12),
+    DEFINE_GPR_PSEUDO_8L (r13l, r13),
+    DEFINE_GPR_PSEUDO_8L (r14l, r14),
+    DEFINE_GPR_PSEUDO_8L (r15l, r15)
 };
 
 // Floating point registers 64 bit
 const DNBRegisterInfo
 DNBArchImplX86_64::g_fpu_registers_no_avx[] =
 {
-    { e_regSetFPU, fpu_fcw      , "fctrl"       , NULL, Uint, Hex, FPU_SIZE_UINT(fcw)       , FPU_OFFSET(fcw)       , -1U, -1U, -1U, -1U },
-    { e_regSetFPU, fpu_fsw      , "fstat"       , NULL, Uint, Hex, FPU_SIZE_UINT(fsw)       , FPU_OFFSET(fsw)       , -1U, -1U, -1U, -1U },
-    { e_regSetFPU, fpu_ftw      , "ftag"        , NULL, Uint, Hex, FPU_SIZE_UINT(ftw)       , FPU_OFFSET(ftw)       , -1U, -1U, -1U, -1U },
-    { e_regSetFPU, fpu_fop      , "fop"         , NULL, Uint, Hex, FPU_SIZE_UINT(fop)       , FPU_OFFSET(fop)       , -1U, -1U, -1U, -1U },
-    { e_regSetFPU, fpu_ip       , "fioff"       , NULL, Uint, Hex, FPU_SIZE_UINT(ip)        , FPU_OFFSET(ip)        , -1U, -1U, -1U, -1U },
-    { e_regSetFPU, fpu_cs       , "fiseg"       , NULL, Uint, Hex, FPU_SIZE_UINT(cs)        , FPU_OFFSET(cs)        , -1U, -1U, -1U, -1U },
-    { e_regSetFPU, fpu_dp       , "fooff"       , NULL, Uint, Hex, FPU_SIZE_UINT(dp)        , FPU_OFFSET(dp)        , -1U, -1U, -1U, -1U },
-    { e_regSetFPU, fpu_ds       , "foseg"       , NULL, Uint, Hex, FPU_SIZE_UINT(ds)        , FPU_OFFSET(ds)        , -1U, -1U, -1U, -1U },
-    { e_regSetFPU, fpu_mxcsr    , "mxcsr"       , NULL, Uint, Hex, FPU_SIZE_UINT(mxcsr)     , FPU_OFFSET(mxcsr)     , -1U, -1U, -1U, -1U },
-    { e_regSetFPU, fpu_mxcsrmask, "mxcsrmask"   , NULL, Uint, Hex, FPU_SIZE_UINT(mxcsrmask) , FPU_OFFSET(mxcsrmask) , -1U, -1U, -1U, -1U },
+    { e_regSetFPU, fpu_fcw      , "fctrl"       , NULL, Uint, Hex, FPU_SIZE_UINT(fcw)       , FPU_OFFSET(fcw)       , -1U, -1U, -1U, -1U, NULL, NULL },
+    { e_regSetFPU, fpu_fsw      , "fstat"       , NULL, Uint, Hex, FPU_SIZE_UINT(fsw)       , FPU_OFFSET(fsw)       , -1U, -1U, -1U, -1U, NULL, NULL },
+    { e_regSetFPU, fpu_ftw      , "ftag"        , NULL, Uint, Hex, FPU_SIZE_UINT(ftw)       , FPU_OFFSET(ftw)       , -1U, -1U, -1U, -1U, NULL, NULL },
+    { e_regSetFPU, fpu_fop      , "fop"         , NULL, Uint, Hex, FPU_SIZE_UINT(fop)       , FPU_OFFSET(fop)       , -1U, -1U, -1U, -1U, NULL, NULL },
+    { e_regSetFPU, fpu_ip       , "fioff"       , NULL, Uint, Hex, FPU_SIZE_UINT(ip)        , FPU_OFFSET(ip)        , -1U, -1U, -1U, -1U, NULL, NULL },
+    { e_regSetFPU, fpu_cs       , "fiseg"       , NULL, Uint, Hex, FPU_SIZE_UINT(cs)        , FPU_OFFSET(cs)        , -1U, -1U, -1U, -1U, NULL, NULL },
+    { e_regSetFPU, fpu_dp       , "fooff"       , NULL, Uint, Hex, FPU_SIZE_UINT(dp)        , FPU_OFFSET(dp)        , -1U, -1U, -1U, -1U, NULL, NULL },
+    { e_regSetFPU, fpu_ds       , "foseg"       , NULL, Uint, Hex, FPU_SIZE_UINT(ds)        , FPU_OFFSET(ds)        , -1U, -1U, -1U, -1U, NULL, NULL },
+    { e_regSetFPU, fpu_mxcsr    , "mxcsr"       , NULL, Uint, Hex, FPU_SIZE_UINT(mxcsr)     , FPU_OFFSET(mxcsr)     , -1U, -1U, -1U, -1U, NULL, NULL },
+    { e_regSetFPU, fpu_mxcsrmask, "mxcsrmask"   , NULL, Uint, Hex, FPU_SIZE_UINT(mxcsrmask) , FPU_OFFSET(mxcsrmask) , -1U, -1U, -1U, -1U, NULL, NULL },
     
-    { e_regSetFPU, fpu_stmm0, "stmm0", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm0), FPU_OFFSET(stmm0), gcc_dwarf_stmm0, gcc_dwarf_stmm0, -1U, gdb_stmm0 },
-    { e_regSetFPU, fpu_stmm1, "stmm1", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm1), FPU_OFFSET(stmm1), gcc_dwarf_stmm1, gcc_dwarf_stmm1, -1U, gdb_stmm1 },
-    { e_regSetFPU, fpu_stmm2, "stmm2", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm2), FPU_OFFSET(stmm2), gcc_dwarf_stmm2, gcc_dwarf_stmm2, -1U, gdb_stmm2 },
-    { e_regSetFPU, fpu_stmm3, "stmm3", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm3), FPU_OFFSET(stmm3), gcc_dwarf_stmm3, gcc_dwarf_stmm3, -1U, gdb_stmm3 },
-    { e_regSetFPU, fpu_stmm4, "stmm4", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm4), FPU_OFFSET(stmm4), gcc_dwarf_stmm4, gcc_dwarf_stmm4, -1U, gdb_stmm4 },
-    { e_regSetFPU, fpu_stmm5, "stmm5", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm5), FPU_OFFSET(stmm5), gcc_dwarf_stmm5, gcc_dwarf_stmm5, -1U, gdb_stmm5 },
-    { e_regSetFPU, fpu_stmm6, "stmm6", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm6), FPU_OFFSET(stmm6), gcc_dwarf_stmm6, gcc_dwarf_stmm6, -1U, gdb_stmm6 },
-    { e_regSetFPU, fpu_stmm7, "stmm7", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm7), FPU_OFFSET(stmm7), gcc_dwarf_stmm7, gcc_dwarf_stmm7, -1U, gdb_stmm7 },
+    { e_regSetFPU, fpu_stmm0, "stmm0", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm0), FPU_OFFSET(stmm0), gcc_dwarf_stmm0, gcc_dwarf_stmm0, -1U, gdb_stmm0, NULL, NULL },
+    { e_regSetFPU, fpu_stmm1, "stmm1", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm1), FPU_OFFSET(stmm1), gcc_dwarf_stmm1, gcc_dwarf_stmm1, -1U, gdb_stmm1, NULL, NULL },
+    { e_regSetFPU, fpu_stmm2, "stmm2", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm2), FPU_OFFSET(stmm2), gcc_dwarf_stmm2, gcc_dwarf_stmm2, -1U, gdb_stmm2, NULL, NULL },
+    { e_regSetFPU, fpu_stmm3, "stmm3", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm3), FPU_OFFSET(stmm3), gcc_dwarf_stmm3, gcc_dwarf_stmm3, -1U, gdb_stmm3, NULL, NULL },
+    { e_regSetFPU, fpu_stmm4, "stmm4", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm4), FPU_OFFSET(stmm4), gcc_dwarf_stmm4, gcc_dwarf_stmm4, -1U, gdb_stmm4, NULL, NULL },
+    { e_regSetFPU, fpu_stmm5, "stmm5", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm5), FPU_OFFSET(stmm5), gcc_dwarf_stmm5, gcc_dwarf_stmm5, -1U, gdb_stmm5, NULL, NULL },
+    { e_regSetFPU, fpu_stmm6, "stmm6", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm6), FPU_OFFSET(stmm6), gcc_dwarf_stmm6, gcc_dwarf_stmm6, -1U, gdb_stmm6, NULL, NULL },
+    { e_regSetFPU, fpu_stmm7, "stmm7", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm7), FPU_OFFSET(stmm7), gcc_dwarf_stmm7, gcc_dwarf_stmm7, -1U, gdb_stmm7, NULL, NULL },
     
-    { e_regSetFPU, fpu_xmm0 , "xmm0"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm0)   , FPU_OFFSET(xmm0) , gcc_dwarf_xmm0 , gcc_dwarf_xmm0 , -1U, gdb_xmm0 },
-    { e_regSetFPU, fpu_xmm1 , "xmm1"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm1)   , FPU_OFFSET(xmm1) , gcc_dwarf_xmm1 , gcc_dwarf_xmm1 , -1U, gdb_xmm1 },
-    { e_regSetFPU, fpu_xmm2 , "xmm2"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm2)   , FPU_OFFSET(xmm2) , gcc_dwarf_xmm2 , gcc_dwarf_xmm2 , -1U, gdb_xmm2 },
-    { e_regSetFPU, fpu_xmm3 , "xmm3"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm3)   , FPU_OFFSET(xmm3) , gcc_dwarf_xmm3 , gcc_dwarf_xmm3 , -1U, gdb_xmm3 },
-    { e_regSetFPU, fpu_xmm4 , "xmm4"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm4)   , FPU_OFFSET(xmm4) , gcc_dwarf_xmm4 , gcc_dwarf_xmm4 , -1U, gdb_xmm4 },
-    { e_regSetFPU, fpu_xmm5 , "xmm5"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm5)   , FPU_OFFSET(xmm5) , gcc_dwarf_xmm5 , gcc_dwarf_xmm5 , -1U, gdb_xmm5 },
-    { e_regSetFPU, fpu_xmm6 , "xmm6"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm6)   , FPU_OFFSET(xmm6) , gcc_dwarf_xmm6 , gcc_dwarf_xmm6 , -1U, gdb_xmm6 },
-    { e_regSetFPU, fpu_xmm7 , "xmm7"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm7)   , FPU_OFFSET(xmm7) , gcc_dwarf_xmm7 , gcc_dwarf_xmm7 , -1U, gdb_xmm7 },
-    { e_regSetFPU, fpu_xmm8 , "xmm8"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm8)   , FPU_OFFSET(xmm8) , gcc_dwarf_xmm8 , gcc_dwarf_xmm8 , -1U, gdb_xmm8  },
-    { e_regSetFPU, fpu_xmm9 , "xmm9"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm9)   , FPU_OFFSET(xmm9) , gcc_dwarf_xmm9 , gcc_dwarf_xmm9 , -1U, gdb_xmm9  },
-    { e_regSetFPU, fpu_xmm10, "xmm10"   , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm10)  , FPU_OFFSET(xmm10), gcc_dwarf_xmm10, gcc_dwarf_xmm10, -1U, gdb_xmm10 },
-    { e_regSetFPU, fpu_xmm11, "xmm11"   , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm11)  , FPU_OFFSET(xmm11), gcc_dwarf_xmm11, gcc_dwarf_xmm11, -1U, gdb_xmm11 },
-    { e_regSetFPU, fpu_xmm12, "xmm12"   , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm12)  , FPU_OFFSET(xmm12), gcc_dwarf_xmm12, gcc_dwarf_xmm12, -1U, gdb_xmm12 },
-    { e_regSetFPU, fpu_xmm13, "xmm13"   , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm13)  , FPU_OFFSET(xmm13), gcc_dwarf_xmm13, gcc_dwarf_xmm13, -1U, gdb_xmm13 },
-    { e_regSetFPU, fpu_xmm14, "xmm14"   , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm14)  , FPU_OFFSET(xmm14), gcc_dwarf_xmm14, gcc_dwarf_xmm14, -1U, gdb_xmm14 },
-    { e_regSetFPU, fpu_xmm15, "xmm15"   , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm15)  , FPU_OFFSET(xmm15), gcc_dwarf_xmm15, gcc_dwarf_xmm15, -1U, gdb_xmm15 },
+    { e_regSetFPU, fpu_xmm0 , "xmm0"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm0)   , FPU_OFFSET(xmm0) , gcc_dwarf_xmm0 , gcc_dwarf_xmm0 , -1U, gdb_xmm0 , NULL, NULL },
+    { e_regSetFPU, fpu_xmm1 , "xmm1"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm1)   , FPU_OFFSET(xmm1) , gcc_dwarf_xmm1 , gcc_dwarf_xmm1 , -1U, gdb_xmm1 , NULL, NULL },
+    { e_regSetFPU, fpu_xmm2 , "xmm2"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm2)   , FPU_OFFSET(xmm2) , gcc_dwarf_xmm2 , gcc_dwarf_xmm2 , -1U, gdb_xmm2 , NULL, NULL },
+    { e_regSetFPU, fpu_xmm3 , "xmm3"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm3)   , FPU_OFFSET(xmm3) , gcc_dwarf_xmm3 , gcc_dwarf_xmm3 , -1U, gdb_xmm3 , NULL, NULL },
+    { e_regSetFPU, fpu_xmm4 , "xmm4"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm4)   , FPU_OFFSET(xmm4) , gcc_dwarf_xmm4 , gcc_dwarf_xmm4 , -1U, gdb_xmm4 , NULL, NULL },
+    { e_regSetFPU, fpu_xmm5 , "xmm5"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm5)   , FPU_OFFSET(xmm5) , gcc_dwarf_xmm5 , gcc_dwarf_xmm5 , -1U, gdb_xmm5 , NULL, NULL },
+    { e_regSetFPU, fpu_xmm6 , "xmm6"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm6)   , FPU_OFFSET(xmm6) , gcc_dwarf_xmm6 , gcc_dwarf_xmm6 , -1U, gdb_xmm6 , NULL, NULL },
+    { e_regSetFPU, fpu_xmm7 , "xmm7"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm7)   , FPU_OFFSET(xmm7) , gcc_dwarf_xmm7 , gcc_dwarf_xmm7 , -1U, gdb_xmm7 , NULL, NULL },
+    { e_regSetFPU, fpu_xmm8 , "xmm8"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm8)   , FPU_OFFSET(xmm8) , gcc_dwarf_xmm8 , gcc_dwarf_xmm8 , -1U, gdb_xmm8 , NULL, NULL },
+    { e_regSetFPU, fpu_xmm9 , "xmm9"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm9)   , FPU_OFFSET(xmm9) , gcc_dwarf_xmm9 , gcc_dwarf_xmm9 , -1U, gdb_xmm9 , NULL, NULL },
+    { e_regSetFPU, fpu_xmm10, "xmm10"   , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm10)  , FPU_OFFSET(xmm10), gcc_dwarf_xmm10, gcc_dwarf_xmm10, -1U, gdb_xmm10, NULL, NULL },
+    { e_regSetFPU, fpu_xmm11, "xmm11"   , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm11)  , FPU_OFFSET(xmm11), gcc_dwarf_xmm11, gcc_dwarf_xmm11, -1U, gdb_xmm11, NULL, NULL },
+    { e_regSetFPU, fpu_xmm12, "xmm12"   , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm12)  , FPU_OFFSET(xmm12), gcc_dwarf_xmm12, gcc_dwarf_xmm12, -1U, gdb_xmm12, NULL, NULL },
+    { e_regSetFPU, fpu_xmm13, "xmm13"   , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm13)  , FPU_OFFSET(xmm13), gcc_dwarf_xmm13, gcc_dwarf_xmm13, -1U, gdb_xmm13, NULL, NULL },
+    { e_regSetFPU, fpu_xmm14, "xmm14"   , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm14)  , FPU_OFFSET(xmm14), gcc_dwarf_xmm14, gcc_dwarf_xmm14, -1U, gdb_xmm14, NULL, NULL },
+    { e_regSetFPU, fpu_xmm15, "xmm15"   , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm15)  , FPU_OFFSET(xmm15), gcc_dwarf_xmm15, gcc_dwarf_xmm15, -1U, gdb_xmm15, NULL, NULL },
 };
 
 const DNBRegisterInfo
 DNBArchImplX86_64::g_fpu_registers_avx[] =
 {
-    { e_regSetFPU, fpu_fcw      , "fctrl"       , NULL, Uint, Hex, FPU_SIZE_UINT(fcw)       , AVX_OFFSET(fcw)       , -1U, -1U, -1U, -1U },
-    { e_regSetFPU, fpu_fsw      , "fstat"       , NULL, Uint, Hex, FPU_SIZE_UINT(fsw)       , AVX_OFFSET(fsw)       , -1U, -1U, -1U, -1U },
-    { e_regSetFPU, fpu_ftw      , "ftag"        , NULL, Uint, Hex, FPU_SIZE_UINT(ftw)       , AVX_OFFSET(ftw)       , -1U, -1U, -1U, -1U },
-    { e_regSetFPU, fpu_fop      , "fop"         , NULL, Uint, Hex, FPU_SIZE_UINT(fop)       , AVX_OFFSET(fop)       , -1U, -1U, -1U, -1U },
-    { e_regSetFPU, fpu_ip       , "fioff"       , NULL, Uint, Hex, FPU_SIZE_UINT(ip)        , AVX_OFFSET(ip)        , -1U, -1U, -1U, -1U },
-    { e_regSetFPU, fpu_cs       , "fiseg"       , NULL, Uint, Hex, FPU_SIZE_UINT(cs)        , AVX_OFFSET(cs)        , -1U, -1U, -1U, -1U },
-    { e_regSetFPU, fpu_dp       , "fooff"       , NULL, Uint, Hex, FPU_SIZE_UINT(dp)        , AVX_OFFSET(dp)        , -1U, -1U, -1U, -1U },
-    { e_regSetFPU, fpu_ds       , "foseg"       , NULL, Uint, Hex, FPU_SIZE_UINT(ds)        , AVX_OFFSET(ds)        , -1U, -1U, -1U, -1U },
-    { e_regSetFPU, fpu_mxcsr    , "mxcsr"       , NULL, Uint, Hex, FPU_SIZE_UINT(mxcsr)     , AVX_OFFSET(mxcsr)     , -1U, -1U, -1U, -1U },
-    { e_regSetFPU, fpu_mxcsrmask, "mxcsrmask"   , NULL, Uint, Hex, FPU_SIZE_UINT(mxcsrmask) , AVX_OFFSET(mxcsrmask) , -1U, -1U, -1U, -1U },
+    { e_regSetFPU, fpu_fcw      , "fctrl"       , NULL, Uint, Hex, FPU_SIZE_UINT(fcw)       , AVX_OFFSET(fcw)       , -1U, -1U, -1U, -1U, NULL, NULL },
+    { e_regSetFPU, fpu_fsw      , "fstat"       , NULL, Uint, Hex, FPU_SIZE_UINT(fsw)       , AVX_OFFSET(fsw)       , -1U, -1U, -1U, -1U, NULL, NULL },
+    { e_regSetFPU, fpu_ftw      , "ftag"        , NULL, Uint, Hex, FPU_SIZE_UINT(ftw)       , AVX_OFFSET(ftw)       , -1U, -1U, -1U, -1U, NULL, NULL },
+    { e_regSetFPU, fpu_fop      , "fop"         , NULL, Uint, Hex, FPU_SIZE_UINT(fop)       , AVX_OFFSET(fop)       , -1U, -1U, -1U, -1U, NULL, NULL },
+    { e_regSetFPU, fpu_ip       , "fioff"       , NULL, Uint, Hex, FPU_SIZE_UINT(ip)        , AVX_OFFSET(ip)        , -1U, -1U, -1U, -1U, NULL, NULL },
+    { e_regSetFPU, fpu_cs       , "fiseg"       , NULL, Uint, Hex, FPU_SIZE_UINT(cs)        , AVX_OFFSET(cs)        , -1U, -1U, -1U, -1U, NULL, NULL },
+    { e_regSetFPU, fpu_dp       , "fooff"       , NULL, Uint, Hex, FPU_SIZE_UINT(dp)        , AVX_OFFSET(dp)        , -1U, -1U, -1U, -1U, NULL, NULL },
+    { e_regSetFPU, fpu_ds       , "foseg"       , NULL, Uint, Hex, FPU_SIZE_UINT(ds)        , AVX_OFFSET(ds)        , -1U, -1U, -1U, -1U, NULL, NULL },
+    { e_regSetFPU, fpu_mxcsr    , "mxcsr"       , NULL, Uint, Hex, FPU_SIZE_UINT(mxcsr)     , AVX_OFFSET(mxcsr)     , -1U, -1U, -1U, -1U, NULL, NULL },
+    { e_regSetFPU, fpu_mxcsrmask, "mxcsrmask"   , NULL, Uint, Hex, FPU_SIZE_UINT(mxcsrmask) , AVX_OFFSET(mxcsrmask) , -1U, -1U, -1U, -1U, NULL, NULL },
     
-    { e_regSetFPU, fpu_stmm0, "stmm0", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm0), AVX_OFFSET(stmm0), gcc_dwarf_stmm0, gcc_dwarf_stmm0, -1U, gdb_stmm0 },
-    { e_regSetFPU, fpu_stmm1, "stmm1", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm1), AVX_OFFSET(stmm1), gcc_dwarf_stmm1, gcc_dwarf_stmm1, -1U, gdb_stmm1 },
-    { e_regSetFPU, fpu_stmm2, "stmm2", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm2), AVX_OFFSET(stmm2), gcc_dwarf_stmm2, gcc_dwarf_stmm2, -1U, gdb_stmm2 },
-    { e_regSetFPU, fpu_stmm3, "stmm3", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm3), AVX_OFFSET(stmm3), gcc_dwarf_stmm3, gcc_dwarf_stmm3, -1U, gdb_stmm3 },
-    { e_regSetFPU, fpu_stmm4, "stmm4", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm4), AVX_OFFSET(stmm4), gcc_dwarf_stmm4, gcc_dwarf_stmm4, -1U, gdb_stmm4 },
-    { e_regSetFPU, fpu_stmm5, "stmm5", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm5), AVX_OFFSET(stmm5), gcc_dwarf_stmm5, gcc_dwarf_stmm5, -1U, gdb_stmm5 },
-    { e_regSetFPU, fpu_stmm6, "stmm6", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm6), AVX_OFFSET(stmm6), gcc_dwarf_stmm6, gcc_dwarf_stmm6, -1U, gdb_stmm6 },
-    { e_regSetFPU, fpu_stmm7, "stmm7", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm7), AVX_OFFSET(stmm7), gcc_dwarf_stmm7, gcc_dwarf_stmm7, -1U, gdb_stmm7 },
+    { e_regSetFPU, fpu_stmm0, "stmm0", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm0), AVX_OFFSET(stmm0), gcc_dwarf_stmm0, gcc_dwarf_stmm0, -1U, gdb_stmm0, NULL, NULL },
+    { e_regSetFPU, fpu_stmm1, "stmm1", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm1), AVX_OFFSET(stmm1), gcc_dwarf_stmm1, gcc_dwarf_stmm1, -1U, gdb_stmm1, NULL, NULL },
+    { e_regSetFPU, fpu_stmm2, "stmm2", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm2), AVX_OFFSET(stmm2), gcc_dwarf_stmm2, gcc_dwarf_stmm2, -1U, gdb_stmm2, NULL, NULL },
+    { e_regSetFPU, fpu_stmm3, "stmm3", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm3), AVX_OFFSET(stmm3), gcc_dwarf_stmm3, gcc_dwarf_stmm3, -1U, gdb_stmm3, NULL, NULL },
+    { e_regSetFPU, fpu_stmm4, "stmm4", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm4), AVX_OFFSET(stmm4), gcc_dwarf_stmm4, gcc_dwarf_stmm4, -1U, gdb_stmm4, NULL, NULL },
+    { e_regSetFPU, fpu_stmm5, "stmm5", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm5), AVX_OFFSET(stmm5), gcc_dwarf_stmm5, gcc_dwarf_stmm5, -1U, gdb_stmm5, NULL, NULL },
+    { e_regSetFPU, fpu_stmm6, "stmm6", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm6), AVX_OFFSET(stmm6), gcc_dwarf_stmm6, gcc_dwarf_stmm6, -1U, gdb_stmm6, NULL, NULL },
+    { e_regSetFPU, fpu_stmm7, "stmm7", NULL, Vector, VectorOfUInt8, FPU_SIZE_MMST(stmm7), AVX_OFFSET(stmm7), gcc_dwarf_stmm7, gcc_dwarf_stmm7, -1U, gdb_stmm7, NULL, NULL },
     
-    { e_regSetFPU, fpu_xmm0 , "xmm0"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm0)   , AVX_OFFSET(xmm0) , gcc_dwarf_xmm0 , gcc_dwarf_xmm0 , -1U, gdb_xmm0 },
-    { e_regSetFPU, fpu_xmm1 , "xmm1"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm1)   , AVX_OFFSET(xmm1) , gcc_dwarf_xmm1 , gcc_dwarf_xmm1 , -1U, gdb_xmm1 },
-    { e_regSetFPU, fpu_xmm2 , "xmm2"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm2)   , AVX_OFFSET(xmm2) , gcc_dwarf_xmm2 , gcc_dwarf_xmm2 , -1U, gdb_xmm2 },
-    { e_regSetFPU, fpu_xmm3 , "xmm3"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm3)   , AVX_OFFSET(xmm3) , gcc_dwarf_xmm3 , gcc_dwarf_xmm3 , -1U, gdb_xmm3 },
-    { e_regSetFPU, fpu_xmm4 , "xmm4"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm4)   , AVX_OFFSET(xmm4) , gcc_dwarf_xmm4 , gcc_dwarf_xmm4 , -1U, gdb_xmm4 },
-    { e_regSetFPU, fpu_xmm5 , "xmm5"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm5)   , AVX_OFFSET(xmm5) , gcc_dwarf_xmm5 , gcc_dwarf_xmm5 , -1U, gdb_xmm5 },
-    { e_regSetFPU, fpu_xmm6 , "xmm6"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm6)   , AVX_OFFSET(xmm6) , gcc_dwarf_xmm6 , gcc_dwarf_xmm6 , -1U, gdb_xmm6 },
-    { e_regSetFPU, fpu_xmm7 , "xmm7"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm7)   , AVX_OFFSET(xmm7) , gcc_dwarf_xmm7 , gcc_dwarf_xmm7 , -1U, gdb_xmm7 },
-    { e_regSetFPU, fpu_xmm8 , "xmm8"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm8)   , AVX_OFFSET(xmm8) , gcc_dwarf_xmm8 , gcc_dwarf_xmm8 , -1U, gdb_xmm8  },
-    { e_regSetFPU, fpu_xmm9 , "xmm9"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm9)   , AVX_OFFSET(xmm9) , gcc_dwarf_xmm9 , gcc_dwarf_xmm9 , -1U, gdb_xmm9  },
-    { e_regSetFPU, fpu_xmm10, "xmm10"   , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm10)  , AVX_OFFSET(xmm10), gcc_dwarf_xmm10, gcc_dwarf_xmm10, -1U, gdb_xmm10 },
-    { e_regSetFPU, fpu_xmm11, "xmm11"   , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm11)  , AVX_OFFSET(xmm11), gcc_dwarf_xmm11, gcc_dwarf_xmm11, -1U, gdb_xmm11 },
-    { e_regSetFPU, fpu_xmm12, "xmm12"   , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm12)  , AVX_OFFSET(xmm12), gcc_dwarf_xmm12, gcc_dwarf_xmm12, -1U, gdb_xmm12 },
-    { e_regSetFPU, fpu_xmm13, "xmm13"   , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm13)  , AVX_OFFSET(xmm13), gcc_dwarf_xmm13, gcc_dwarf_xmm13, -1U, gdb_xmm13 },
-    { e_regSetFPU, fpu_xmm14, "xmm14"   , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm14)  , AVX_OFFSET(xmm14), gcc_dwarf_xmm14, gcc_dwarf_xmm14, -1U, gdb_xmm14 },
-    { e_regSetFPU, fpu_xmm15, "xmm15"   , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm15)  , AVX_OFFSET(xmm15), gcc_dwarf_xmm15, gcc_dwarf_xmm15, -1U, gdb_xmm15 },
-
-    { e_regSetFPU, fpu_ymm0 , "ymm0"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_YMM(ymm0)   , AVX_OFFSET_YMM(0) , gcc_dwarf_ymm0 , gcc_dwarf_ymm0 , -1U, gdb_ymm0 },
-    { e_regSetFPU, fpu_ymm1 , "ymm1"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_YMM(ymm1)   , AVX_OFFSET_YMM(1) , gcc_dwarf_ymm1 , gcc_dwarf_ymm1 , -1U, gdb_ymm1 },
-    { e_regSetFPU, fpu_ymm2 , "ymm2"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_YMM(ymm2)   , AVX_OFFSET_YMM(2) , gcc_dwarf_ymm2 , gcc_dwarf_ymm2 , -1U, gdb_ymm2 },
-    { e_regSetFPU, fpu_ymm3 , "ymm3"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_YMM(ymm3)   , AVX_OFFSET_YMM(3) , gcc_dwarf_ymm3 , gcc_dwarf_ymm3 , -1U, gdb_ymm3 },
-    { e_regSetFPU, fpu_ymm4 , "ymm4"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_YMM(ymm4)   , AVX_OFFSET_YMM(4) , gcc_dwarf_ymm4 , gcc_dwarf_ymm4 , -1U, gdb_ymm4 },
-    { e_regSetFPU, fpu_ymm5 , "ymm5"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_YMM(ymm5)   , AVX_OFFSET_YMM(5) , gcc_dwarf_ymm5 , gcc_dwarf_ymm5 , -1U, gdb_ymm5 },
-    { e_regSetFPU, fpu_ymm6 , "ymm6"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_YMM(ymm6)   , AVX_OFFSET_YMM(6) , gcc_dwarf_ymm6 , gcc_dwarf_ymm6 , -1U, gdb_ymm6 },
-    { e_regSetFPU, fpu_ymm7 , "ymm7"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_YMM(ymm7)   , AVX_OFFSET_YMM(7) , gcc_dwarf_ymm7 , gcc_dwarf_ymm7 , -1U, gdb_ymm7 },
-    { e_regSetFPU, fpu_ymm8 , "ymm8"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_YMM(ymm8)   , AVX_OFFSET_YMM(8) , gcc_dwarf_ymm8 , gcc_dwarf_ymm8 , -1U, gdb_ymm8  },
-    { e_regSetFPU, fpu_ymm9 , "ymm9"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_YMM(ymm9)   , AVX_OFFSET_YMM(9) , gcc_dwarf_ymm9 , gcc_dwarf_ymm9 , -1U, gdb_ymm9  },
-    { e_regSetFPU, fpu_ymm10, "ymm10"   , NULL, Vector, VectorOfUInt8, FPU_SIZE_YMM(ymm10)  , AVX_OFFSET_YMM(10), gcc_dwarf_ymm10, gcc_dwarf_ymm10, -1U, gdb_ymm10 },
-    { e_regSetFPU, fpu_ymm11, "ymm11"   , NULL, Vector, VectorOfUInt8, FPU_SIZE_YMM(ymm11)  , AVX_OFFSET_YMM(11), gcc_dwarf_ymm11, gcc_dwarf_ymm11, -1U, gdb_ymm11 },
-    { e_regSetFPU, fpu_ymm12, "ymm12"   , NULL, Vector, VectorOfUInt8, FPU_SIZE_YMM(ymm12)  , AVX_OFFSET_YMM(12), gcc_dwarf_ymm12, gcc_dwarf_ymm12, -1U, gdb_ymm12 },
-    { e_regSetFPU, fpu_ymm13, "ymm13"   , NULL, Vector, VectorOfUInt8, FPU_SIZE_YMM(ymm13)  , AVX_OFFSET_YMM(13), gcc_dwarf_ymm13, gcc_dwarf_ymm13, -1U, gdb_ymm13 },
-    { e_regSetFPU, fpu_ymm14, "ymm14"   , NULL, Vector, VectorOfUInt8, FPU_SIZE_YMM(ymm14)  , AVX_OFFSET_YMM(14), gcc_dwarf_ymm14, gcc_dwarf_ymm14, -1U, gdb_ymm14 },
-    { e_regSetFPU, fpu_ymm15, "ymm15"   , NULL, Vector, VectorOfUInt8, FPU_SIZE_YMM(ymm15)  , AVX_OFFSET_YMM(15), gcc_dwarf_ymm15, gcc_dwarf_ymm15, -1U, gdb_ymm15 }
+    { e_regSetFPU, fpu_xmm0 , "xmm0"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm0)   , AVX_OFFSET(xmm0) , gcc_dwarf_xmm0 , gcc_dwarf_xmm0 , -1U, gdb_xmm0 , NULL, NULL },
+    { e_regSetFPU, fpu_xmm1 , "xmm1"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm1)   , AVX_OFFSET(xmm1) , gcc_dwarf_xmm1 , gcc_dwarf_xmm1 , -1U, gdb_xmm1 , NULL, NULL },
+    { e_regSetFPU, fpu_xmm2 , "xmm2"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm2)   , AVX_OFFSET(xmm2) , gcc_dwarf_xmm2 , gcc_dwarf_xmm2 , -1U, gdb_xmm2 , NULL, NULL },
+    { e_regSetFPU, fpu_xmm3 , "xmm3"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm3)   , AVX_OFFSET(xmm3) , gcc_dwarf_xmm3 , gcc_dwarf_xmm3 , -1U, gdb_xmm3 , NULL, NULL },
+    { e_regSetFPU, fpu_xmm4 , "xmm4"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm4)   , AVX_OFFSET(xmm4) , gcc_dwarf_xmm4 , gcc_dwarf_xmm4 , -1U, gdb_xmm4 , NULL, NULL },
+    { e_regSetFPU, fpu_xmm5 , "xmm5"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm5)   , AVX_OFFSET(xmm5) , gcc_dwarf_xmm5 , gcc_dwarf_xmm5 , -1U, gdb_xmm5 , NULL, NULL },
+    { e_regSetFPU, fpu_xmm6 , "xmm6"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm6)   , AVX_OFFSET(xmm6) , gcc_dwarf_xmm6 , gcc_dwarf_xmm6 , -1U, gdb_xmm6 , NULL, NULL },
+    { e_regSetFPU, fpu_xmm7 , "xmm7"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm7)   , AVX_OFFSET(xmm7) , gcc_dwarf_xmm7 , gcc_dwarf_xmm7 , -1U, gdb_xmm7 , NULL, NULL },
+    { e_regSetFPU, fpu_xmm8 , "xmm8"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm8)   , AVX_OFFSET(xmm8) , gcc_dwarf_xmm8 , gcc_dwarf_xmm8 , -1U, gdb_xmm8 , NULL, NULL },
+    { e_regSetFPU, fpu_xmm9 , "xmm9"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm9)   , AVX_OFFSET(xmm9) , gcc_dwarf_xmm9 , gcc_dwarf_xmm9 , -1U, gdb_xmm9 , NULL, NULL },
+    { e_regSetFPU, fpu_xmm10, "xmm10"   , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm10)  , AVX_OFFSET(xmm10), gcc_dwarf_xmm10, gcc_dwarf_xmm10, -1U, gdb_xmm10, NULL, NULL },
+    { e_regSetFPU, fpu_xmm11, "xmm11"   , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm11)  , AVX_OFFSET(xmm11), gcc_dwarf_xmm11, gcc_dwarf_xmm11, -1U, gdb_xmm11, NULL, NULL },
+    { e_regSetFPU, fpu_xmm12, "xmm12"   , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm12)  , AVX_OFFSET(xmm12), gcc_dwarf_xmm12, gcc_dwarf_xmm12, -1U, gdb_xmm12, NULL, NULL },
+    { e_regSetFPU, fpu_xmm13, "xmm13"   , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm13)  , AVX_OFFSET(xmm13), gcc_dwarf_xmm13, gcc_dwarf_xmm13, -1U, gdb_xmm13, NULL, NULL },
+    { e_regSetFPU, fpu_xmm14, "xmm14"   , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm14)  , AVX_OFFSET(xmm14), gcc_dwarf_xmm14, gcc_dwarf_xmm14, -1U, gdb_xmm14, NULL, NULL },
+    { e_regSetFPU, fpu_xmm15, "xmm15"   , NULL, Vector, VectorOfUInt8, FPU_SIZE_XMM(xmm15)  , AVX_OFFSET(xmm15), gcc_dwarf_xmm15, gcc_dwarf_xmm15, -1U, gdb_xmm15, NULL, NULL },
+
+    { e_regSetFPU, fpu_ymm0 , "ymm0"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_YMM(ymm0)   , AVX_OFFSET_YMM(0) , gcc_dwarf_ymm0 , gcc_dwarf_ymm0 , -1U, gdb_ymm0, NULL, NULL },
+    { e_regSetFPU, fpu_ymm1 , "ymm1"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_YMM(ymm1)   , AVX_OFFSET_YMM(1) , gcc_dwarf_ymm1 , gcc_dwarf_ymm1 , -1U, gdb_ymm1, NULL, NULL },
+    { e_regSetFPU, fpu_ymm2 , "ymm2"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_YMM(ymm2)   , AVX_OFFSET_YMM(2) , gcc_dwarf_ymm2 , gcc_dwarf_ymm2 , -1U, gdb_ymm2, NULL, NULL },
+    { e_regSetFPU, fpu_ymm3 , "ymm3"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_YMM(ymm3)   , AVX_OFFSET_YMM(3) , gcc_dwarf_ymm3 , gcc_dwarf_ymm3 , -1U, gdb_ymm3, NULL, NULL },
+    { e_regSetFPU, fpu_ymm4 , "ymm4"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_YMM(ymm4)   , AVX_OFFSET_YMM(4) , gcc_dwarf_ymm4 , gcc_dwarf_ymm4 , -1U, gdb_ymm4, NULL, NULL },
+    { e_regSetFPU, fpu_ymm5 , "ymm5"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_YMM(ymm5)   , AVX_OFFSET_YMM(5) , gcc_dwarf_ymm5 , gcc_dwarf_ymm5 , -1U, gdb_ymm5, NULL, NULL },
+    { e_regSetFPU, fpu_ymm6 , "ymm6"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_YMM(ymm6)   , AVX_OFFSET_YMM(6) , gcc_dwarf_ymm6 , gcc_dwarf_ymm6 , -1U, gdb_ymm6, NULL, NULL },
+    { e_regSetFPU, fpu_ymm7 , "ymm7"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_YMM(ymm7)   , AVX_OFFSET_YMM(7) , gcc_dwarf_ymm7 , gcc_dwarf_ymm7 , -1U, gdb_ymm7, NULL, NULL },
+    { e_regSetFPU, fpu_ymm8 , "ymm8"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_YMM(ymm8)   , AVX_OFFSET_YMM(8) , gcc_dwarf_ymm8 , gcc_dwarf_ymm8 , -1U, gdb_ymm8 , NULL, NULL },
+    { e_regSetFPU, fpu_ymm9 , "ymm9"    , NULL, Vector, VectorOfUInt8, FPU_SIZE_YMM(ymm9)   , AVX_OFFSET_YMM(9) , gcc_dwarf_ymm9 , gcc_dwarf_ymm9 , -1U, gdb_ymm9 , NULL, NULL },
+    { e_regSetFPU, fpu_ymm10, "ymm10"   , NULL, Vector, VectorOfUInt8, FPU_SIZE_YMM(ymm10)  , AVX_OFFSET_YMM(10), gcc_dwarf_ymm10, gcc_dwarf_ymm10, -1U, gdb_ymm10, NULL, NULL },
+    { e_regSetFPU, fpu_ymm11, "ymm11"   , NULL, Vector, VectorOfUInt8, FPU_SIZE_YMM(ymm11)  , AVX_OFFSET_YMM(11), gcc_dwarf_ymm11, gcc_dwarf_ymm11, -1U, gdb_ymm11, NULL, NULL },
+    { e_regSetFPU, fpu_ymm12, "ymm12"   , NULL, Vector, VectorOfUInt8, FPU_SIZE_YMM(ymm12)  , AVX_OFFSET_YMM(12), gcc_dwarf_ymm12, gcc_dwarf_ymm12, -1U, gdb_ymm12, NULL, NULL },
+    { e_regSetFPU, fpu_ymm13, "ymm13"   , NULL, Vector, VectorOfUInt8, FPU_SIZE_YMM(ymm13)  , AVX_OFFSET_YMM(13), gcc_dwarf_ymm13, gcc_dwarf_ymm13, -1U, gdb_ymm13, NULL, NULL },
+    { e_regSetFPU, fpu_ymm14, "ymm14"   , NULL, Vector, VectorOfUInt8, FPU_SIZE_YMM(ymm14)  , AVX_OFFSET_YMM(14), gcc_dwarf_ymm14, gcc_dwarf_ymm14, -1U, gdb_ymm14, NULL, NULL },
+    { e_regSetFPU, fpu_ymm15, "ymm15"   , NULL, Vector, VectorOfUInt8, FPU_SIZE_YMM(ymm15)  , AVX_OFFSET_YMM(15), gcc_dwarf_ymm15, gcc_dwarf_ymm15, -1U, gdb_ymm15, NULL, NULL }
 };
 
 // Exception registers
@@ -1367,9 +1512,9 @@ DNBArchImplX86_64::g_fpu_registers_avx[]
 const DNBRegisterInfo
 DNBArchImplX86_64::g_exc_registers[] =
 {
-    { e_regSetEXC, exc_trapno,      "trapno"    , NULL, Uint, Hex, EXC_SIZE (trapno)    , EXC_OFFSET (trapno)       , -1U, -1U, -1U, -1U },
-    { e_regSetEXC, exc_err,         "err"       , NULL, Uint, Hex, EXC_SIZE (err)       , EXC_OFFSET (err)          , -1U, -1U, -1U, -1U },
-    { e_regSetEXC, exc_faultvaddr,  "faultvaddr", NULL, Uint, Hex, EXC_SIZE (faultvaddr), EXC_OFFSET (faultvaddr)   , -1U, -1U, -1U, -1U }
+    { e_regSetEXC, exc_trapno,      "trapno"    , NULL, Uint, Hex, EXC_SIZE (trapno)    , EXC_OFFSET (trapno)       , -1U, -1U, -1U, -1U, NULL, NULL },
+    { e_regSetEXC, exc_err,         "err"       , NULL, Uint, Hex, EXC_SIZE (err)       , EXC_OFFSET (err)          , -1U, -1U, -1U, -1U, NULL, NULL },
+    { e_regSetEXC, exc_faultvaddr,  "faultvaddr", NULL, Uint, Hex, EXC_SIZE (faultvaddr), EXC_OFFSET (faultvaddr)   , -1U, -1U, -1U, -1U, NULL, NULL }
 };
 
 // Number of registers in each register set
@@ -1837,19 +1982,19 @@ DNBArchImplX86_64::GetRegisterContext (v
         kern_return_t kret;
         if ((kret = GetGPRState(force)) != KERN_SUCCESS)
         {
-            DNBLogThreadedIf (LOG_THREAD, "DNBArchImplX86_64::GetRegisterContext (buf = %p, len = %zu) error: GPR regs failed to read: %u ", buf, buf_len, kret);
+            DNBLogThreadedIf (LOG_THREAD, "DNBArchImplX86_64::GetRegisterContext (buf = %p, len = %llu) error: GPR regs failed to read: %u ", buf, (uint64_t)buf_len, kret);
             size = 0;
         }
         else 
         if ((kret = GetFPUState(force)) != KERN_SUCCESS)
         {
-            DNBLogThreadedIf (LOG_THREAD, "DNBArchImplX86_64::GetRegisterContext (buf = %p, len = %zu) error: %s regs failed to read: %u", buf, buf_len, CPUHasAVX() ? "AVX" : "FPU", kret);
+            DNBLogThreadedIf (LOG_THREAD, "DNBArchImplX86_64::GetRegisterContext (buf = %p, len = %llu) error: %s regs failed to read: %u", buf, (uint64_t)buf_len, CPUHasAVX() ? "AVX" : "FPU", kret);
             size = 0;
         }
         else 
         if ((kret = GetEXCState(force)) != KERN_SUCCESS)
         {
-            DNBLogThreadedIf (LOG_THREAD, "DNBArchImplX86_64::GetRegisterContext (buf = %p, len = %zu) error: EXC regs failed to read: %u", buf, buf_len, kret);
+            DNBLogThreadedIf (LOG_THREAD, "DNBArchImplX86_64::GetRegisterContext (buf = %p, len = %llu) error: EXC regs failed to read: %u", buf, (uint64_t)buf_len, kret);
             size = 0;
         }
         else
@@ -1858,7 +2003,7 @@ DNBArchImplX86_64::GetRegisterContext (v
             ::memcpy (buf, &m_state.context, size);
         }
     }
-    DNBLogThreadedIf (LOG_THREAD, "DNBArchImplX86_64::GetRegisterContext (buf = %p, len = %zu) => %zu", buf, buf_len, size);
+    DNBLogThreadedIf (LOG_THREAD, "DNBArchImplX86_64::GetRegisterContext (buf = %p, len = %llu) => %llu", buf, (uint64_t)buf_len, (uint64_t)size);
     // Return the size of the register context even if NULL was passed in
     return size;
 }
@@ -1878,13 +2023,13 @@ DNBArchImplX86_64::SetRegisterContext (c
         ::memcpy (&m_state.context, buf, size);
         kern_return_t kret;
         if ((kret = SetGPRState()) != KERN_SUCCESS)
-            DNBLogThreadedIf (LOG_THREAD, "DNBArchImplX86_64::SetRegisterContext (buf = %p, len = %zu) error: GPR regs failed to write: %u", buf, buf_len, kret);
+            DNBLogThreadedIf (LOG_THREAD, "DNBArchImplX86_64::SetRegisterContext (buf = %p, len = %llu) error: GPR regs failed to write: %u", buf, (uint64_t)buf_len, kret);
         if ((kret = SetFPUState()) != KERN_SUCCESS)
-            DNBLogThreadedIf (LOG_THREAD, "DNBArchImplX86_64::SetRegisterContext (buf = %p, len = %zu) error: %s regs failed to write: %u", buf, buf_len, CPUHasAVX() ? "AVX" : "FPU", kret);
+            DNBLogThreadedIf (LOG_THREAD, "DNBArchImplX86_64::SetRegisterContext (buf = %p, len = %llu) error: %s regs failed to write: %u", buf, (uint64_t)buf_len, CPUHasAVX() ? "AVX" : "FPU", kret);
         if ((kret = SetEXCState()) != KERN_SUCCESS)
-            DNBLogThreadedIf (LOG_THREAD, "DNBArchImplX86_64::SetRegisterContext (buf = %p, len = %zu) error: EXP regs failed to write: %u", buf, buf_len, kret);
+            DNBLogThreadedIf (LOG_THREAD, "DNBArchImplX86_64::SetRegisterContext (buf = %p, len = %llu) error: EXP regs failed to write: %u", buf, (uint64_t)buf_len, kret);
     }
-    DNBLogThreadedIf (LOG_THREAD, "DNBArchImplX86_64::SetRegisterContext (buf = %p, len = %zu) => %zu", buf, buf_len, size);
+    DNBLogThreadedIf (LOG_THREAD, "DNBArchImplX86_64::SetRegisterContext (buf = %p, len = %llu) => %llu", buf, (uint64_t)buf_len, (uint64_t)size);
     return size;
 }
 

Removed: lldb/branches/lldb-platform-work/tools/debugserver/source/ProfileObjectiveC.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/ProfileObjectiveC.cpp?rev=183467&view=auto
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/ProfileObjectiveC.cpp (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/ProfileObjectiveC.cpp (removed)
@@ -1,393 +0,0 @@
-//===-- ProfileObjectiveC.cpp -----------------------------------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-//  Created by Greg Clayton on 10/4/07.
-//
-//===----------------------------------------------------------------------===//
-
-#include "ProfileObjectiveC.h"
-#include "DNB.h"
-#include <objc/objc-runtime.h>
-#include <map>
-
-#if defined (__powerpc__) || defined (__ppc__)
-#define OBJC_MSG_SEND_PPC32_COMM_PAGE_ADDR ((nub_addr_t)0xfffeff00)
-#endif
-
-//----------------------------------------------------------------------
-// Constructor
-//----------------------------------------------------------------------
-ProfileObjectiveC::ProfileObjectiveC() :
-    m_pid(INVALID_NUB_PROCESS),
-    m_objcStats(),
-    m_hit_count(0),
-    m_dump_count(0xffff)
-{
-    memset(&m_begin_time, 0, sizeof(m_begin_time));
-}
-
-//----------------------------------------------------------------------
-// Destructor
-//----------------------------------------------------------------------
-ProfileObjectiveC::~ProfileObjectiveC()
-{
-}
-
-//----------------------------------------------------------------------
-// Clear any counts that we may have had
-//----------------------------------------------------------------------
-void
-ProfileObjectiveC::Clear()
-{
-    if (m_pid != INVALID_NUB_PROCESS)
-    {
-        DNBBreakpointClear(m_pid, m_objc_msgSend.breakID);
-        DNBBreakpointClear(m_pid, m_objc_msgSendSuper.breakID);
-#if defined (__powerpc__) || defined (__ppc__)
-        DNBBreakpointClear(m_pid, m_objc_msgSend_rtp.breakID);
-#endif
-    }
-    m_objc_msgSend.Clear();
-    m_objc_msgSendSuper.Clear();
-#if defined (__powerpc__) || defined (__ppc__)
-    memset(m_objc_msgSend_opcode, 0, k_opcode_size);
-    m_objc_msgSend_rtp.Clear();
-#endif
-    memset(&m_begin_time, 0, sizeof(m_begin_time));
-    m_objcStats.clear();
-}
-
-void
-ProfileObjectiveC::Initialize(nub_process_t pid)
-{
-    Clear();
-    m_pid = pid;
-}
-
-
-void
-ProfileObjectiveC::ProcessStateChanged(nub_state_t state)
-{
-    //printf("ProfileObjectiveC::%s(%s)\n", __FUNCTION__, DNBStateAsString(state));
-    switch (state)
-    {
-    case eStateInvalid:
-    case eStateUnloaded:
-    case eStateExited:
-    case eStateDetached:
-        Clear();
-        break;
-
-    case eStateStopped:
-#if defined (__powerpc__) || defined (__ppc__)
-        if (NUB_BREAK_ID_IS_VALID(m_objc_msgSend.breakID) && !NUB_BREAK_ID_IS_VALID(m_objc_msgSend_rtp.breakID))
-        {
-            nub_thread_t tid = DNBProcessGetCurrentThread(m_pid);
-            DNBRegisterValue pc_value;
-            if (DNBThreadGetRegisterValueByName(m_pid, tid, REGISTER_SET_ALL, "srr0" , &pc_value))
-            {
-                nub_addr_t pc = pc_value.value.uint32;
-                if (pc == OBJC_MSG_SEND_PPC32_COMM_PAGE_ADDR)
-                {
-                    // Restore previous first instruction to 0xfffeff00 in comm page
-                    DNBProcessMemoryWrite(m_pid, OBJC_MSG_SEND_PPC32_COMM_PAGE_ADDR, k_opcode_size, m_objc_msgSend_opcode);
-                    //printf("Setting breakpoint on _objc_msgSend_rtp...\n");
-                    m_objc_msgSend_rtp.breakID = DNBBreakpointSet(m_pid, OBJC_MSG_SEND_PPC32_COMM_PAGE_ADDR);
-                    if (NUB_BREAK_ID_IS_VALID(m_objc_msgSend_rtp.breakID))
-                    {
-                        DNBBreakpointSetCallback(m_pid, m_objc_msgSend_rtp.breakID, ProfileObjectiveC::MessageSendBreakpointCallback, this);
-                    }
-                }
-            }
-        }
-#endif
-        DumpStats(m_pid, stdout);
-        break;
-
-    case eStateAttaching:
-    case eStateLaunching:
-    case eStateRunning:
-    case eStateStepping:
-    case eStateCrashed:
-    case eStateSuspended:
-        break;
-
-    default:
-        break;
-    }
-}
-
-void
-ProfileObjectiveC::SharedLibraryStateChanged(DNBExecutableImageInfo *image_infos, nub_size_t num_image_infos)
-{
-    //printf("ProfileObjectiveC::%s(%p, %u)\n", __FUNCTION__, image_infos, num_image_infos);
-    if (m_objc_msgSend.IsValid() && m_objc_msgSendSuper.IsValid())
-        return;
-
-    if (image_infos)
-    {
-        nub_process_t pid = m_pid;
-        nub_size_t i;
-        for (i = 0; i < num_image_infos; i++)
-        {
-            if (strcmp(image_infos[i].name, "/usr/lib/libobjc.A.dylib") == 0)
-            {
-                if (!NUB_BREAK_ID_IS_VALID(m_objc_msgSend.breakID))
-                {
-                    m_objc_msgSend.addr = DNBProcessLookupAddress(pid, "_objc_msgSend", image_infos[i].name);
-
-                    if (m_objc_msgSend.addr != INVALID_NUB_ADDRESS)
-                    {
-#if defined (__powerpc__) || defined (__ppc__)
-                        if (DNBProcessMemoryRead(pid, m_objc_msgSend.addr, k_opcode_size, m_objc_msgSend_opcode) != k_opcode_size)
-                            memset(m_objc_msgSend_opcode, 0, sizeof(m_objc_msgSend_opcode));
-#endif
-                        m_objc_msgSend.breakID = DNBBreakpointSet(pid, m_objc_msgSend.addr, 4, false);
-                        if (NUB_BREAK_ID_IS_VALID(m_objc_msgSend.breakID))
-                            DNBBreakpointSetCallback(pid, m_objc_msgSend.breakID, ProfileObjectiveC::MessageSendBreakpointCallback, this);
-                    }
-                }
-
-                if (!NUB_BREAK_ID_IS_VALID(m_objc_msgSendSuper.breakID))
-                {
-                    m_objc_msgSendSuper.addr = DNBProcessLookupAddress(pid, "_objc_msgSendSuper", image_infos[i].name);
-
-                    if (m_objc_msgSendSuper.addr != INVALID_NUB_ADDRESS)
-                    {
-                        m_objc_msgSendSuper.breakID = DNBBreakpointSet(pid, m_objc_msgSendSuper.addr, 4, false);
-                        if (NUB_BREAK_ID_IS_VALID(m_objc_msgSendSuper.breakID))
-                            DNBBreakpointSetCallback(pid, m_objc_msgSendSuper.breakID, ProfileObjectiveC::MessageSendSuperBreakpointCallback, this);
-                    }
-                }
-                break;
-            }
-        }
-    }
-}
-
-
-void
-ProfileObjectiveC::SetStartTime()
-{
-    gettimeofday(&m_begin_time, NULL);
-}
-
-void
-ProfileObjectiveC::SelectorHit(objc_class_ptr_t isa, objc_selector_t sel)
-{
-    m_objcStats[isa][sel]++;
-}
-
-nub_bool_t
-ProfileObjectiveC::MessageSendBreakpointCallback(nub_process_t pid, nub_thread_t tid, nub_break_t breakID, void *userData)
-{
-    ProfileObjectiveC *profile_objc = (ProfileObjectiveC*)userData;
-    uint32_t hit_count = profile_objc->IncrementHitCount();
-    if (hit_count == 1)
-        profile_objc->SetStartTime();
-
-    objc_class_ptr_t objc_self = 0;
-    objc_selector_t objc_selector = 0;
-#if defined (__i386__)
-    DNBRegisterValue esp;
-    if (DNBThreadGetRegisterValueByName(pid, tid, REGISTER_SET_ALL, "esp", &esp))
-    {
-        uint32_t uval32[2];
-        if (DNBProcessMemoryRead(pid, esp.value.uint32 + 4, 8, &uval32) == 8)
-        {
-            objc_self = uval32[0];
-            objc_selector = uval32[1];
-        }
-    }
-#elif defined (__powerpc__) || defined (__ppc__)
-    DNBRegisterValue r3;
-    DNBRegisterValue r4;
-    if (DNBThreadGetRegisterValueByName(pid, tid, REGISTER_SET_ALL, "r3", &r3) &&
-        DNBThreadGetRegisterValueByName(pid, tid, REGISTER_SET_ALL, "r4", &r4))
-    {
-        objc_self = r3.value.uint32;
-        objc_selector = r4.value.uint32;
-    }
-#elif defined (__arm__)
-    DNBRegisterValue r0;
-    DNBRegisterValue r1;
-    if (DNBThreadGetRegisterValueByName(pid, tid, REGISTER_SET_ALL, "r0", &r0) &&
-        DNBThreadGetRegisterValueByName(pid, tid, REGISTER_SET_ALL, "r1", &r1))
-    {
-        objc_self = r0.value.uint32;
-        objc_selector = r1.value.uint32;
-    }
-#else
-#error undefined architecture
-#endif
-    if (objc_selector != 0)
-    {
-        uint32_t isa = 0;
-        if (objc_self == 0)
-        {
-            profile_objc->SelectorHit(0, objc_selector);
-        }
-        else
-        if (DNBProcessMemoryRead(pid, (nub_addr_t)objc_self, sizeof(isa), &isa) == sizeof(isa))
-        {
-            if (isa)
-            {
-                profile_objc->SelectorHit(isa, objc_selector);
-            }
-            else
-            {
-                profile_objc->SelectorHit(0, objc_selector);
-            }
-        }
-    }
-
-
-    // Dump stats if we are supposed to
-    if (profile_objc->ShouldDumpStats())
-    {
-        profile_objc->DumpStats(pid, stdout);
-        return true;
-    }
-
-    // Just let the target run again by returning false;
-    return false;
-}
-
-nub_bool_t
-ProfileObjectiveC::MessageSendSuperBreakpointCallback(nub_process_t pid, nub_thread_t tid, nub_break_t breakID, void *userData)
-{
-    ProfileObjectiveC *profile_objc = (ProfileObjectiveC*)userData;
-
-    uint32_t hit_count = profile_objc->IncrementHitCount();
-    if (hit_count == 1)
-        profile_objc->SetStartTime();
-
-//    printf("BreakID %u hit count is = %u\n", breakID, hc);
-    objc_class_ptr_t objc_super = 0;
-    objc_selector_t objc_selector = 0;
-#if defined (__i386__)
-    DNBRegisterValue esp;
-    if (DNBThreadGetRegisterValueByName(pid, tid, REGISTER_SET_ALL, "esp", &esp))
-    {
-        uint32_t uval32[2];
-        if (DNBProcessMemoryRead(pid, esp.value.uint32 + 4, 8, &uval32) == 8)
-        {
-            objc_super = uval32[0];
-            objc_selector = uval32[1];
-        }
-    }
-#elif defined (__powerpc__) || defined (__ppc__)
-    DNBRegisterValue r3;
-    DNBRegisterValue r4;
-    if (DNBThreadGetRegisterValueByName(pid, tid, REGISTER_SET_ALL, "r3", &r3) &&
-        DNBThreadGetRegisterValueByName(pid, tid, REGISTER_SET_ALL, "r4", &r4))
-    {
-        objc_super = r3.value.uint32;
-        objc_selector = r4.value.uint32;
-    }
-#elif defined (__arm__)
-    DNBRegisterValue r0;
-    DNBRegisterValue r1;
-    if (DNBThreadGetRegisterValueByName(pid, tid, REGISTER_SET_ALL, "r0", &r0) &&
-        DNBThreadGetRegisterValueByName(pid, tid, REGISTER_SET_ALL, "r1", &r1))
-    {
-        objc_super = r0.value.uint32;
-        objc_selector = r1.value.uint32;
-    }
-#else
-#error undefined architecture
-#endif
-    if (objc_selector != 0)
-    {
-        uint32_t isa = 0;
-        if (objc_super == 0)
-        {
-            profile_objc->SelectorHit(0, objc_selector);
-        }
-        else
-        if (DNBProcessMemoryRead(pid, (nub_addr_t)objc_super + 4, sizeof(isa), &isa) == sizeof(isa))
-        {
-            if (isa)
-            {
-                profile_objc->SelectorHit(isa, objc_selector);
-            }
-            else
-            {
-                profile_objc->SelectorHit(0, objc_selector);
-            }
-        }
-    }
-
-    // Dump stats if we are supposed to
-    if (profile_objc->ShouldDumpStats())
-    {
-        profile_objc->DumpStats(pid, stdout);
-        return true;
-    }
-
-    // Just let the target run again by returning false;
-    return false;
-}
-
-void
-ProfileObjectiveC::DumpStats(nub_process_t pid, FILE *f)
-{
-    if (f == NULL)
-        return;
-
-    if (m_hit_count == 0)
-        return;
-
-    ClassStatsMap::iterator class_pos;
-    ClassStatsMap::iterator class_end = m_objcStats.end();
-
-    struct timeval end_time;
-    gettimeofday(&end_time, NULL);
-    int64_t elapsed_usec = ((int64_t)(1000*1000))*((int64_t)end_time.tv_sec - (int64_t)m_begin_time.tv_sec) + ((int64_t)end_time.tv_usec - (int64_t)m_begin_time.tv_usec);
-    fprintf(f, "%u probe hits for %.2f hits/sec)\n", m_hit_count, (double)m_hit_count / (((double)elapsed_usec)/(1000000.0)));
-
-    for (class_pos = m_objcStats.begin(); class_pos != class_end; ++class_pos)
-    {
-        SelectorHitCount::iterator sel_pos;
-        SelectorHitCount::iterator sel_end = class_pos->second.end();
-        for (sel_pos = class_pos->second.begin(); sel_pos != sel_end; ++sel_pos)
-        {
-            struct objc_class objc_class;
-            uint32_t isa = class_pos->first;
-            uint32_t sel = sel_pos->first;
-            uint32_t sel_hit_count = sel_pos->second;
-
-            if (isa != 0 && DNBProcessMemoryRead(pid, isa, sizeof(objc_class), &objc_class) == sizeof(objc_class))
-            {
-            /*    fprintf(f, "%#.8x\n          isa = %p\n  super_class = %p\n         name = %p\n      version = %lx\n         info = %lx\ninstance_size = %lx\n        ivars = %p\n  methodLists = %p\n        cache = %p\n    protocols = %p\n",
-                        arg1.value.pointer,
-                        objc_class.isa,
-                        objc_class.super_class,
-                        objc_class.name,
-                        objc_class.version,
-                        objc_class.info,
-                        objc_class.instance_size,
-                        objc_class.ivars,
-                        objc_class.methodLists,
-                        objc_class.cache,
-                        objc_class.protocols); */
-
-                // Print the class name
-                fprintf(f, "%6u hits for %c[", sel_hit_count, (objc_class.super_class == objc_class.isa ? '+' : '-'));
-                DNBPrintf(pid, INVALID_NUB_THREAD, (nub_addr_t)objc_class.name, f, "%s ");
-            }
-            else
-            {
-                fprintf(f, "%6u hits for  [<nil> ", sel_hit_count);
-            }
-            DNBPrintf(pid, INVALID_NUB_THREAD, sel, f, "%s]\n");
-        }
-    }
-}
-

Removed: lldb/branches/lldb-platform-work/tools/debugserver/source/ProfileObjectiveC.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/ProfileObjectiveC.h?rev=183467&view=auto
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/ProfileObjectiveC.h (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/ProfileObjectiveC.h (removed)
@@ -1,82 +0,0 @@
-//===-- ProfileObjectiveC.h -------------------------------------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-//  Created by Greg Clayton on 10/4/07.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef __ProfileObjectiveC_h__
-#define __ProfileObjectiveC_h__
-
-#include "DNB.h"
-#include "DNBRuntimeAction.h"
-#include <map>
-#include <sys/time.h>
-
-class ProfileObjectiveC : public DNBRuntimeAction
-{
-public:
-    ProfileObjectiveC();
-    virtual ~ProfileObjectiveC();
-    //------------------------------------------------------------------
-    // DNBRuntimeAction required functions
-    //------------------------------------------------------------------
-    virtual void Initialize(nub_process_t pid);
-    virtual void ProcessStateChanged(nub_state_t state);
-    virtual void SharedLibraryStateChanged(DNBExecutableImageInfo *image_infos, nub_size_t num_image_infos);
-
-protected:
-    typedef uint32_t objc_selector_t;
-    typedef uint32_t objc_class_ptr_t;
-    void Clear();
-    static nub_bool_t MessageSendBreakpointCallback(nub_process_t pid, nub_thread_t tid, nub_break_t breakID, void *userData);
-    static nub_bool_t MessageSendSuperBreakpointCallback(nub_process_t pid, nub_thread_t tid, nub_break_t breakID, void *userData);
-    void DumpStats(nub_process_t pid, FILE *f);
-    void SetStartTime();
-    void SelectorHit(objc_class_ptr_t isa, objc_selector_t sel);
-    typedef std::map<objc_selector_t, uint32_t> SelectorHitCount;
-    typedef std::map<objc_class_ptr_t, SelectorHitCount> ClassStatsMap;
-    typedef struct Probe
-    {
-        nub_addr_t        addr;
-        nub_break_t        breakID;
-        Probe() : addr(INVALID_NUB_ADDRESS), breakID(INVALID_NUB_BREAK_ID) {}
-        void Clear()
-        {
-            addr = INVALID_NUB_ADDRESS;
-            breakID = INVALID_NUB_BREAK_ID;
-        }
-        bool IsValid() const
-        {
-            return (addr != INVALID_NUB_ADDRESS) && (NUB_BREAK_ID_IS_VALID(breakID));
-        }
-    };
-
-    uint32_t IncrementHitCount() { return ++m_hit_count; }
-    bool ShouldDumpStats() const {     return m_dump_count && (m_hit_count % m_dump_count) == 0; }
-
-    nub_process_t m_pid;
-    Probe m_objc_msgSend;
-    Probe m_objc_msgSendSuper;
-    uint32_t m_hit_count;    // Number of times we have gotten one of our breakpoints hit
-    uint32_t m_dump_count;    // Dump stats every time the hit count reaches a multiple of this value
-#if defined (__powerpc__) || defined (__ppc__)
-    enum
-    {
-        k_opcode_size = 4
-    };
-    uint8_t            m_objc_msgSend_opcode[k_opcode_size];        // Saved copy of first opcode in objc_msgSend
-    Probe            m_objc_msgSend_rtp;                            // COMM page probe info for objc_msgSend
-#endif
-    struct timeval    m_begin_time;
-    ClassStatsMap    m_objcStats;
-};
-
-
-#endif    // #ifndef __ProfileObjectiveC_h__

Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/RNBContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/RNBContext.cpp?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/RNBContext.cpp (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/RNBContext.cpp Thu Jun  6 19:06:43 2013
@@ -148,9 +148,9 @@ RNBContext::ThreadFunctionProcessStatus(
     bool done = false;
     while (!done)
     {
-        DNBLogThreadedIf(LOG_RNB_PROC, "RNBContext::%s calling DNBProcessWaitForEvent(pid, eEventProcessRunningStateChanged | eEventProcessStoppedStateChanged | eEventStdioAvailable, true)...", __FUNCTION__);
-        nub_event_t pid_status_event = DNBProcessWaitForEvents (pid, eEventProcessRunningStateChanged | eEventProcessStoppedStateChanged | eEventStdioAvailable, true, NULL);
-        DNBLogThreadedIf(LOG_RNB_PROC, "RNBContext::%s calling DNBProcessWaitForEvent(pid, eEventProcessRunningStateChanged | eEventProcessStoppedStateChanged | eEventStdioAvailable, true) => 0x%8.8x", __FUNCTION__, pid_status_event);
+        DNBLogThreadedIf(LOG_RNB_PROC, "RNBContext::%s calling DNBProcessWaitForEvent(pid, eEventProcessRunningStateChanged | eEventProcessStoppedStateChanged | eEventStdioAvailable | eEventProfileDataAvailable, true)...", __FUNCTION__);
+        nub_event_t pid_status_event = DNBProcessWaitForEvents (pid, eEventProcessRunningStateChanged | eEventProcessStoppedStateChanged | eEventStdioAvailable | eEventProfileDataAvailable, true, NULL);
+        DNBLogThreadedIf(LOG_RNB_PROC, "RNBContext::%s calling DNBProcessWaitForEvent(pid, eEventProcessRunningStateChanged | eEventProcessStoppedStateChanged | eEventStdioAvailable | eEventProfileDataAvailable, true) => 0x%8.8x", __FUNCTION__, pid_status_event);
 
         if (pid_status_event == 0)
         {
@@ -167,6 +167,13 @@ RNBContext::ThreadFunctionProcessStatus(
                 ctx.Events().WaitForResetAck(RNBContext::event_proc_stdio_available);
             }
 
+            if (pid_status_event & eEventProfileDataAvailable)
+            {
+                DNBLogThreadedIf(LOG_RNB_PROC, "RNBContext::%s (pid=%4.4x) got profile data event....", __FUNCTION__, pid);
+                ctx.Events().SetEvents (RNBContext::event_proc_profile_data);
+                // Wait for the main thread to consume this notification if it requested we wait for it
+                ctx.Events().WaitForResetAck(RNBContext::event_proc_profile_data);
+            }
 
             if (pid_status_event & (eEventProcessRunningStateChanged | eEventProcessStoppedStateChanged))
             {
@@ -217,6 +224,8 @@ RNBContext::EventsAsString (nub_event_t
         s += "proc_thread_exiting ";
     if (events & event_proc_stdio_available)
         s += "proc_stdio_available ";
+    if (events & event_proc_profile_data)
+        s += "proc_profile_data ";
     if (events & event_read_packet_available)
         s += "read_packet_available ";
     if (events & event_read_thread_running)

Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/RNBContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/RNBContext.h?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/RNBContext.h (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/RNBContext.h Thu Jun  6 19:06:43 2013
@@ -29,13 +29,15 @@ public:
         event_proc_thread_running       = 0x02, // Sticky
         event_proc_thread_exiting       = 0x04,
         event_proc_stdio_available      = 0x08,
-        event_read_packet_available     = 0x10,
-        event_read_thread_running       = 0x20, // Sticky
-        event_read_thread_exiting       = 0x40,
+        event_proc_profile_data         = 0x10,
+        event_read_packet_available     = 0x20,
+        event_read_thread_running       = 0x40, // Sticky
+        event_read_thread_exiting       = 0x80,
 
         normal_event_bits   = event_proc_state_changed |
                               event_proc_thread_exiting |
                               event_proc_stdio_available |
+                              event_proc_profile_data | 
                               event_read_packet_available |
                               event_read_thread_exiting,
 

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

Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/RNBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/RNBRemote.cpp?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/RNBRemote.cpp (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/RNBRemote.cpp Thu Jun  6 19:06:43 2013
@@ -30,7 +30,6 @@
 
 #include <iomanip>
 #include <sstream>
-
 #include <TargetConditionals.h> // for endianness predefines
 
 //----------------------------------------------------------------------
@@ -155,9 +154,9 @@ RNBRemote::CreatePacketTable  ()
     t.push_back (Packet (remove_read_watch_bp,          &RNBRemote::HandlePacket_z,             NULL, "z3", "Remove read watchpoint"));
     t.push_back (Packet (insert_access_watch_bp,        &RNBRemote::HandlePacket_z,             NULL, "Z4", "Insert access watchpoint"));
     t.push_back (Packet (remove_access_watch_bp,        &RNBRemote::HandlePacket_z,             NULL, "z4", "Remove access watchpoint"));
+    t.push_back (Packet (query_monitor,                 &RNBRemote::HandlePacket_qRcmd,          NULL, "qRcmd", "Monitor command"));
     t.push_back (Packet (query_current_thread_id,       &RNBRemote::HandlePacket_qC,            NULL, "qC", "Query current thread ID"));
     t.push_back (Packet (query_get_pid,                 &RNBRemote::HandlePacket_qGetPid,       NULL, "qGetPid", "Query process id"));
-//  t.push_back (Packet (query_memory_crc,              &RNBRemote::HandlePacket_UNIMPLEMENTED, NULL, "qCRC:", "Compute CRC of memory region"));
     t.push_back (Packet (query_thread_ids_first,        &RNBRemote::HandlePacket_qThreadInfo,   NULL, "qfThreadInfo", "Get list of active threads (first req)"));
     t.push_back (Packet (query_thread_ids_subsequent,   &RNBRemote::HandlePacket_qThreadInfo,   NULL, "qsThreadInfo", "Get list of active threads (subsequent req)"));
     // APPLE LOCAL: qThreadStopInfo
@@ -173,6 +172,7 @@ RNBRemote::CreatePacketTable  ()
     t.push_back (Packet (query_vattachorwait_supported, &RNBRemote::HandlePacket_qVAttachOrWaitSupported,NULL, "qVAttachOrWaitSupported", "Replys with OK if the 'vAttachOrWait' packet is supported."));
     t.push_back (Packet (query_sync_thread_state_supported, &RNBRemote::HandlePacket_qSyncThreadStateSupported,NULL, "qSyncThreadStateSupported", "Replys with OK if the 'QSyncThreadState:' packet is supported."));
     t.push_back (Packet (query_host_info,               &RNBRemote::HandlePacket_qHostInfo,     NULL, "qHostInfo", "Replies with multiple 'key:value;' tuples appended to each other."));
+    t.push_back (Packet (query_process_info,            &RNBRemote::HandlePacket_qProcessInfo,     NULL, "qProcessInfo", "Replies with multiple 'key:value;' tuples appended to each other."));
 //  t.push_back (Packet (query_symbol_lookup,           &RNBRemote::HandlePacket_UNIMPLEMENTED, NULL, "qSymbol", "Notify that host debugger is ready to do symbol lookups"));
     t.push_back (Packet (start_noack_mode,              &RNBRemote::HandlePacket_QStartNoAckMode        , NULL, "QStartNoAckMode", "Request that " DEBUGSERVER_PROGRAM_NAME " stop acking remote protocol packets"));
     t.push_back (Packet (prefix_reg_packets_with_tid,   &RNBRemote::HandlePacket_QThreadSuffixSupported , NULL, "QThreadSuffixSupported", "Check if thread specifc packets (register packets 'g', 'G', 'p', and 'P') support having the thread ID appended to the end of the command"));
@@ -193,6 +193,8 @@ RNBRemote::CreatePacketTable  ()
     t.push_back (Packet (allocate_memory,               &RNBRemote::HandlePacket_AllocateMemory, NULL, "_M", "Allocate memory in the inferior process."));
     t.push_back (Packet (deallocate_memory,             &RNBRemote::HandlePacket_DeallocateMemory, NULL, "_m", "Deallocate memory in the inferior process."));
     t.push_back (Packet (memory_region_info,            &RNBRemote::HandlePacket_MemoryRegionInfo, NULL, "qMemoryRegionInfo", "Return size and attributes of a memory region that contains the given address"));
+    t.push_back (Packet (get_profile_data,              &RNBRemote::HandlePacket_GetProfileData, NULL, "qGetProfileData", "Return profiling data of the current target."));
+    t.push_back (Packet (set_enable_profiling,          &RNBRemote::HandlePacket_SetEnableAsyncProfiling, NULL, "QSetEnableAsyncProfiling", "Enable or disable the profiling of current target."));
     t.push_back (Packet (watchpoint_support_info,       &RNBRemote::HandlePacket_WatchpointSupportInfo, NULL, "qWatchpointSupportInfo", "Return the number of supported hardware watchpoints"));
 
 }
@@ -226,6 +228,25 @@ RNBRemote::FlushSTDIO ()
     }
 }
 
+void
+RNBRemote::SendAsyncProfileData ()
+{
+    if (m_ctx.HasValidProcessID())
+    {
+        nub_process_t pid = m_ctx.ProcessID();
+        char buf[1024];
+        nub_size_t count;
+        do
+        {
+            count = DNBProcessGetAvailableProfileData(pid, buf, sizeof(buf));
+            if (count > 0)
+            {
+                SendAsyncProfileDataPacket (buf, count);
+            }
+        } while (count > 0);
+    }
+}
+
 rnb_err_t
 RNBRemote::SendHexEncodedBytePacket (const char *header, const void *buf, size_t buf_len, const char *footer)
 {
@@ -262,6 +283,18 @@ RNBRemote::SendSTDERRPacket (char *buf,
     return SendHexEncodedBytePacket("O", buf, buf_size, NULL);
 }
 
+// This makes use of asynchronous bit 'A' in the gdb remote protocol.
+rnb_err_t
+RNBRemote::SendAsyncProfileDataPacket (char *buf, nub_size_t buf_size)
+{
+    if (buf_size == 0)
+        return rnb_success;
+    
+    std::string packet("A");
+    packet.append(buf, buf_size);
+    return SendPacket(packet);
+}
+
 rnb_err_t
 RNBRemote::SendPacket (const std::string &s)
 {
@@ -845,65 +878,88 @@ g_gdb_register_map_arm[] =
     { 13,  4,  "sp",    {0}, NULL, 1},
     { 14,  4,  "lr",    {0}, NULL, 1},
     { 15,  4,  "pc",    {0}, NULL, 1},
-    { 16, 12,  "f0",    {0}, k_zero_bytes, 0},
-    { 17, 12,  "f1",    {0}, k_zero_bytes, 0},
-    { 18, 12,  "f2",    {0}, k_zero_bytes, 0},
-    { 19, 12,  "f3",    {0}, k_zero_bytes, 0},
-    { 20, 12,  "f4",    {0}, k_zero_bytes, 0},
-    { 21, 12,  "f5",    {0}, k_zero_bytes, 0},
-    { 22, 12,  "f6",    {0}, k_zero_bytes, 0},
-    { 23, 12,  "f7",    {0}, k_zero_bytes, 0},
-    { 24,  4, "fps",    {0}, k_zero_bytes, 0},
-    { 25,  4,"cpsr",    {0}, NULL, 1},
-    { 26,  4,  "s0",    {0}, NULL, 0},
-    { 27,  4,  "s1",    {0}, NULL, 0},
-    { 28,  4,  "s2",    {0}, NULL, 0},
-    { 29,  4,  "s3",    {0}, NULL, 0},
-    { 30,  4,  "s4",    {0}, NULL, 0},
-    { 31,  4,  "s5",    {0}, NULL, 0},
-    { 32,  4,  "s6",    {0}, NULL, 0},
-    { 33,  4,  "s7",    {0}, NULL, 0},
-    { 34,  4,  "s8",    {0}, NULL, 0},
-    { 35,  4,  "s9",    {0}, NULL, 0},
-    { 36,  4, "s10",    {0}, NULL, 0},
-    { 37,  4, "s11",    {0}, NULL, 0},
-    { 38,  4, "s12",    {0}, NULL, 0},
-    { 39,  4, "s13",    {0}, NULL, 0},
-    { 40,  4, "s14",    {0}, NULL, 0},
-    { 41,  4, "s15",    {0}, NULL, 0},
-    { 42,  4, "s16",    {0}, NULL, 0},
-    { 43,  4, "s17",    {0}, NULL, 0},
-    { 44,  4, "s18",    {0}, NULL, 0},
-    { 45,  4, "s19",    {0}, NULL, 0},
-    { 46,  4, "s20",    {0}, NULL, 0},
-    { 47,  4, "s21",    {0}, NULL, 0},
-    { 48,  4, "s22",    {0}, NULL, 0},
-    { 49,  4, "s23",    {0}, NULL, 0},
-    { 50,  4, "s24",    {0}, NULL, 0},
-    { 51,  4, "s25",    {0}, NULL, 0},
-    { 52,  4, "s26",    {0}, NULL, 0},
-    { 53,  4, "s27",    {0}, NULL, 0},
-    { 54,  4, "s28",    {0}, NULL, 0},
-    { 55,  4, "s29",    {0}, NULL, 0},
-    { 56,  4, "s30",    {0}, NULL, 0},
-    { 57,  4, "s31",    {0}, NULL, 0},
-    { 58,  4, "fpscr",  {0}, NULL, 0},
-    { 59,  8, "d16",    {0}, NULL, 0},
-    { 60,  8, "d17",    {0}, NULL, 0},
-    { 61,  8, "d18",    {0}, NULL, 0},
-    { 62,  8, "d19",    {0}, NULL, 0},
-    { 63,  8, "d20",    {0}, NULL, 0},
-    { 64,  8, "d21",    {0}, NULL, 0},
-    { 65,  8, "d22",    {0}, NULL, 0},
-    { 66,  8, "d23",    {0}, NULL, 0},
-    { 67,  8, "d24",    {0}, NULL, 0},
-    { 68,  8, "d25",    {0}, NULL, 0},
-    { 69,  8, "d26",    {0}, NULL, 0},
-    { 70,  8, "d27",    {0}, NULL, 0},
-    { 71,  8, "d28",    {0}, NULL, 0},
-    { 72,  8, "d29",    {0}, NULL, 0},
-    { 73,  8, "d30",    {0}, NULL, 0},
-    { 74,  8, "d31",    {0}, NULL, 0}
+    { 16,  4,"cpsr",    {0}, NULL, 1},               // current program status register
+    { 17,  4,  "s0",    {0}, NULL, 0},
+    { 18,  4,  "s1",    {0}, NULL, 0},
+    { 19,  4,  "s2",    {0}, NULL, 0},
+    { 20,  4,  "s3",    {0}, NULL, 0},
+    { 21,  4,  "s4",    {0}, NULL, 0},
+    { 22,  4,  "s5",    {0}, NULL, 0},
+    { 23,  4,  "s6",    {0}, NULL, 0},
+    { 24,  4,  "s7",    {0}, NULL, 0},
+    { 25,  4,  "s8",    {0}, NULL, 0},
+    { 26,  4,  "s9",    {0}, NULL, 0},
+    { 27,  4, "s10",    {0}, NULL, 0},
+    { 28,  4, "s11",    {0}, NULL, 0},
+    { 29,  4, "s12",    {0}, NULL, 0},
+    { 30,  4, "s13",    {0}, NULL, 0},
+    { 31,  4, "s14",    {0}, NULL, 0},
+    { 32,  4, "s15",    {0}, NULL, 0},
+    { 33,  4, "s16",    {0}, NULL, 0},
+    { 34,  4, "s17",    {0}, NULL, 0},
+    { 35,  4, "s18",    {0}, NULL, 0},
+    { 36,  4, "s19",    {0}, NULL, 0},
+    { 37,  4, "s20",    {0}, NULL, 0},
+    { 38,  4, "s21",    {0}, NULL, 0},
+    { 39,  4, "s22",    {0}, NULL, 0},
+    { 40,  4, "s23",    {0}, NULL, 0},
+    { 41,  4, "s24",    {0}, NULL, 0},
+    { 42,  4, "s25",    {0}, NULL, 0},
+    { 43,  4, "s26",    {0}, NULL, 0},
+    { 44,  4, "s27",    {0}, NULL, 0},
+    { 45,  4, "s28",    {0}, NULL, 0},
+    { 46,  4, "s29",    {0}, NULL, 0},
+    { 47,  4, "s30",    {0}, NULL, 0},
+    { 48,  4, "s31",    {0}, NULL, 0},
+    { 49,  8, "d0",     {0}, NULL, 0},
+    { 50,  8, "d1",     {0}, NULL, 0},
+    { 51,  8, "d2",     {0}, NULL, 0},
+    { 52,  8, "d3",     {0}, NULL, 0},
+    { 53,  8, "d4",     {0}, NULL, 0},
+    { 54,  8, "d5",     {0}, NULL, 0},
+    { 55,  8, "d6",     {0}, NULL, 0},
+    { 56,  8, "d7",     {0}, NULL, 0},
+    { 57,  8, "d8",     {0}, NULL, 0},
+    { 58,  8, "d9",     {0}, NULL, 0},
+    { 59,  8, "d10",    {0}, NULL, 0},
+    { 60,  8, "d11",    {0}, NULL, 0},
+    { 61,  8, "d12",    {0}, NULL, 0},
+    { 62,  8, "d13",    {0}, NULL, 0},
+    { 63,  8, "d14",    {0}, NULL, 0},
+    { 64,  8, "d15",    {0}, NULL, 0},
+    { 65,  8, "d16",    {0}, NULL, 0},
+    { 66,  8, "d17",    {0}, NULL, 0},
+    { 67,  8, "d18",    {0}, NULL, 0},
+    { 68,  8, "d19",    {0}, NULL, 0},
+    { 69,  8, "d20",    {0}, NULL, 0},
+    { 70,  8, "d21",    {0}, NULL, 0},
+    { 71,  8, "d22",    {0}, NULL, 0},
+    { 72,  8, "d23",    {0}, NULL, 0},
+    { 73,  8, "d24",    {0}, NULL, 0},
+    { 74,  8, "d25",    {0}, NULL, 0},
+    { 75,  8, "d26",    {0}, NULL, 0},
+    { 76,  8, "d27",    {0}, NULL, 0},
+    { 77,  8, "d28",    {0}, NULL, 0},
+    { 78,  8, "d29",    {0}, NULL, 0},
+    { 79,  8, "d30",    {0}, NULL, 0},
+    { 80,  8, "d31",    {0}, NULL, 0},
+    { 81, 16, "q0",     {0}, NULL, 0},
+    { 82, 16, "q1",     {0}, NULL, 0},
+    { 83, 16, "q2",     {0}, NULL, 0},
+    { 84, 16, "q3",     {0}, NULL, 0},
+    { 85, 16, "q4",     {0}, NULL, 0},
+    { 86, 16, "q5",     {0}, NULL, 0},
+    { 87, 16, "q6",     {0}, NULL, 0},
+    { 88, 16, "q7",     {0}, NULL, 0},
+    { 89, 16, "q8",     {0}, NULL, 0},
+    { 90, 16, "q9",     {0}, NULL, 0},
+    { 91, 16, "q10",    {0}, NULL, 0},
+    { 92, 16, "q11",    {0}, NULL, 0},
+    { 93, 16, "q12",    {0}, NULL, 0},
+    { 94, 16, "q13",    {0}, NULL, 0},
+    { 95, 16, "q14",    {0}, NULL, 0},
+    { 96, 16, "q15",    {0}, NULL, 0},
+    { 97,  4, "fpscr",  {0}, NULL, 0}
 };
 
 register_map_entry_t
@@ -1023,7 +1079,7 @@ RNBRemote::Initialize()
 
 
 bool
-RNBRemote::InitializeRegisters ()
+RNBRemote::InitializeRegisters (bool force)
 {
     pid_t pid = m_ctx.ProcessID();
     if (pid == INVALID_NUB_PROCESS)
@@ -1037,6 +1093,13 @@ RNBRemote::InitializeRegisters ()
         // registers to be discovered using multiple qRegisterInfo calls to get
         // all register information after the architecture for the process is
         // determined.
+        if (force)
+        {
+            g_dynamic_register_map.clear();
+            g_reg_entries = NULL;
+            g_num_reg_entries = 0;
+        }
+
         if (g_dynamic_register_map.empty())
         {
             nub_size_t num_reg_sets = 0;
@@ -1401,6 +1464,135 @@ RNBRemote::HandlePacket_qThreadExtraInfo
     return SendPacket ("");
 }
 
+
+const char *k_space_delimiters = " \t";
+static void
+skip_spaces (std::string &line)
+{
+    if (!line.empty())
+    {
+        size_t space_pos = line.find_first_not_of (k_space_delimiters);
+        if (space_pos > 0)
+            line.erase(0, space_pos);
+    }
+}
+
+static std::string
+get_identifier (std::string &line)
+{
+    std::string word;
+    skip_spaces (line);
+    const size_t line_size = line.size();
+    size_t end_pos;
+    for (end_pos = 0; end_pos < line_size; ++end_pos)
+    {
+        if (end_pos == 0)
+        {
+            if (isalpha(line[end_pos]) || line[end_pos] == '_')
+                continue;
+        }
+        else if (isalnum(line[end_pos]) || line[end_pos] == '_')
+            continue;
+        break;
+    }
+    word.assign (line, 0, end_pos);
+    line.erase(0, end_pos);
+    return word;
+}
+
+static std::string
+get_operator (std::string &line)
+{
+    std::string op;
+    skip_spaces (line);
+    if (!line.empty())
+    {
+        if (line[0] == '=')
+        {
+            op = '=';
+            line.erase(0,1);
+        }
+    }
+    return op;
+}
+
+static std::string
+get_value (std::string &line)
+{
+    std::string value;
+    skip_spaces (line);
+    if (!line.empty())
+    {
+        value.swap(line);
+    }
+    return value;
+}
+
+
+extern void FileLogCallback(void *baton, uint32_t flags, const char *format, va_list args);
+extern void ASLLogCallback(void *baton, uint32_t flags, const char *format, va_list args);
+
+rnb_err_t
+RNBRemote::HandlePacket_qRcmd (const char *p)
+{
+    const char *c = p + strlen("qRcmd,");
+    std::string line;
+    while (c[0] && c[1])
+    {
+        char smallbuf[3] = { c[0], c[1], '\0' };
+        errno = 0;
+        int ch = strtoul (smallbuf, NULL, 16);
+        if (errno != 0 && ch == 0)
+            return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "non-hex char in payload of qRcmd packet");
+        line.push_back(ch);
+        c += 2;
+    }
+    if (*c == '\0')
+    {
+        std::string command = get_identifier(line);
+        if (command.compare("set") == 0)
+        {
+            std::string variable = get_identifier (line);
+            std::string op = get_operator (line);
+            std::string value = get_value (line);
+            if (variable.compare("logfile") == 0)
+            {
+                FILE *log_file = fopen(value.c_str(), "w");
+                if (log_file)
+                {
+                    DNBLogSetLogCallback(FileLogCallback, log_file);
+                    return SendPacket ("OK");
+                }
+                return SendPacket ("E71");
+            }
+            else if (variable.compare("logmask") == 0)
+            {
+                char *end;
+                errno = 0;
+                uint32_t logmask = strtoul (value.c_str(), &end, 0);
+                if (errno == 0 && end && *end == '\0')
+                {
+                    DNBLogSetLogMask (logmask);
+                    if (!DNBLogGetLogCallback())
+                        DNBLogSetLogCallback(ASLLogCallback, NULL);
+                    return SendPacket ("OK");
+                }
+                errno = 0;
+                logmask = strtoul (value.c_str(), &end, 16);
+                if (errno == 0 && end && *end == '\0')
+                {
+                    DNBLogSetLogMask (logmask);
+                    return SendPacket ("OK");
+                }
+                return SendPacket ("E72");
+            }
+            return SendPacket ("E70");
+        }
+        return SendPacket ("E69");
+    }
+    return SendPacket ("E73");
+}
+
 rnb_err_t
 RNBRemote::HandlePacket_qC (const char *p)
 {
@@ -1518,6 +1710,30 @@ RNBRemote::HandlePacket_qRegisterInfo (c
             case GENERIC_REGNUM_ARG8:   ostrm << "generic:arg8;"; break;
             default: break;
         }
+        
+        if (reg_entry->nub_info.pseudo_regs && reg_entry->nub_info.pseudo_regs[0] != INVALID_NUB_REGNUM)
+        {
+            ostrm << "container-regs:";
+            for (unsigned i=0; reg_entry->nub_info.pseudo_regs[i] != INVALID_NUB_REGNUM; ++i)
+            {
+                if (i > 0)
+                    ostrm << ',';
+                ostrm << RAW_HEXBASE << reg_entry->nub_info.pseudo_regs[i];
+            }
+            ostrm << ';';
+        }
+
+        if (reg_entry->nub_info.update_regs && reg_entry->nub_info.update_regs[0] != INVALID_NUB_REGNUM)
+        {
+            ostrm << "invalidate-regs:";
+            for (unsigned i=0; reg_entry->nub_info.update_regs[i] != INVALID_NUB_REGNUM; ++i)
+            {
+                if (i > 0)
+                    ostrm << ',';
+                ostrm << RAW_HEXBASE << reg_entry->nub_info.update_regs[i];
+            }
+            ostrm << ';';
+        }
 
         return SendPacket (ostrm.str ());
     }
@@ -1548,6 +1764,16 @@ set_logging (const char *p)
             {
                 if (*p == '|')
                     p++;
+
+// to regenerate the LOG_ entries (not including the LOG_RNB entries)
+// $ for logname in `grep '^#define LOG_' DNBDefs.h | egrep -v 'LOG_HI|LOG_LO' | awk '{print $2}'` 
+// do 
+//   echo "                else if (strncmp (p, \"$logname\", sizeof (\"$logname\") - 1) == 0)"
+//   echo "                {" 
+//   echo "                    p += sizeof (\"$logname\") - 1;"
+//   echo "                    bitmask |= $logname;"
+//   echo "                }"
+// done
                 if (strncmp (p, "LOG_VERBOSE", sizeof ("LOG_VERBOSE") - 1) == 0)
                 {
                     p += sizeof ("LOG_VERBOSE") - 1;
@@ -1588,26 +1814,48 @@ set_logging (const char *p)
                     p += sizeof ("LOG_MEMORY_DATA_LONG") - 1;
                     bitmask |= LOG_MEMORY_DATA_LONG;
                 }
+                else if (strncmp (p, "LOG_MEMORY_PROTECTIONS", sizeof ("LOG_MEMORY_PROTECTIONS") - 1) == 0)
+                {
+                    p += sizeof ("LOG_MEMORY_PROTECTIONS") - 1;
+                    bitmask |= LOG_MEMORY_PROTECTIONS;
+                }
                 else if (strncmp (p, "LOG_BREAKPOINTS", sizeof ("LOG_BREAKPOINTS") - 1) == 0)
                 {
                     p += sizeof ("LOG_BREAKPOINTS") - 1;
                     bitmask |= LOG_BREAKPOINTS;
                 }
-                else if (strncmp (p, "LOG_ALL", sizeof ("LOG_ALL") - 1) == 0)
-                {
-                    p += sizeof ("LOG_ALL") - 1;
-                    bitmask |= LOG_ALL;
-                }
                 else if (strncmp (p, "LOG_EVENTS", sizeof ("LOG_EVENTS") - 1) == 0)
                 {
                     p += sizeof ("LOG_EVENTS") - 1;
                     bitmask |= LOG_EVENTS;
                 }
+                else if (strncmp (p, "LOG_WATCHPOINTS", sizeof ("LOG_WATCHPOINTS") - 1) == 0)
+                {
+                    p += sizeof ("LOG_WATCHPOINTS") - 1;
+                    bitmask |= LOG_WATCHPOINTS;
+                }
+                else if (strncmp (p, "LOG_STEP", sizeof ("LOG_STEP") - 1) == 0)
+                {
+                    p += sizeof ("LOG_STEP") - 1;
+                    bitmask |= LOG_STEP;
+                }
+                else if (strncmp (p, "LOG_TASK", sizeof ("LOG_TASK") - 1) == 0)
+                {
+                    p += sizeof ("LOG_TASK") - 1;
+                    bitmask |= LOG_TASK;
+                }
+                else if (strncmp (p, "LOG_ALL", sizeof ("LOG_ALL") - 1) == 0)
+                {
+                    p += sizeof ("LOG_ALL") - 1;
+                    bitmask |= LOG_ALL;
+                }
                 else if (strncmp (p, "LOG_DEFAULT", sizeof ("LOG_DEFAULT") - 1) == 0)
                 {
                     p += sizeof ("LOG_DEFAULT") - 1;
                     bitmask |= LOG_DEFAULT;
                 }
+// end of auto-generated entries
+
                 else if (strncmp (p, "LOG_NONE", sizeof ("LOG_NONE") - 1) == 0)
                 {
                     p += sizeof ("LOG_NONE") - 1;
@@ -2140,6 +2388,10 @@ RNBRemote::SendStopReplyPacketForThread
 
     if (DNBThreadGetStopReason (pid, tid, &tid_stop_info))
     {
+        const bool did_exec = tid_stop_info.reason == eStopTypeExec;
+        if (did_exec)
+            RNBRemote::InitializeRegisters(true);
+
         std::ostringstream ostrm;
         // Output the T packet with the thread
         ostrm << 'T';
@@ -2237,8 +2489,12 @@ RNBRemote::SendStopReplyPacketForThread
                 }
             }
         }
-
-        if (tid_stop_info.details.exception.type)
+        
+        if (did_exec)
+        {
+            ostrm << "reason:exec;";
+        }
+        else if (tid_stop_info.details.exception.type)
         {
             ostrm << "metype:" << std::hex << tid_stop_info.details.exception.type << ";";
             ostrm << "mecount:" << std::hex << tid_stop_info.details.exception.data_count << ";";
@@ -2599,7 +2855,7 @@ RNBRemote::HandlePacket_G (const char *p
             }
             else
             {
-                DNBLogError("RNBRemote::HandlePacket_G(%s): extracted %zu of %zu bytes, size mismatch\n", p, bytes_extracted, reg_ctx_size);
+                DNBLogError("RNBRemote::HandlePacket_G(%s): extracted %llu of %llu bytes, size mismatch\n", p, (uint64_t)bytes_extracted, (uint64_t)reg_ctx_size);
                 return SendPacket ("E64");
             }
         }
@@ -3427,6 +3683,86 @@ RNBRemote::HandlePacket_MemoryRegionInfo
     return SendPacket (ostrm.str());
 }
 
+// qGetProfileData;scan_type:0xYYYYYYY
+rnb_err_t
+RNBRemote::HandlePacket_GetProfileData (const char *p)
+{
+    nub_process_t pid = m_ctx.ProcessID();
+    if (pid == INVALID_NUB_PROCESS)
+        return SendPacket ("OK");
+    
+    StringExtractor packet(p += sizeof ("qGetProfileData"));
+    DNBProfileDataScanType scan_type = eProfileAll;
+    std::string name;
+    std::string value;
+    while (packet.GetNameColonValue(name, value))
+    {
+        if (name.compare ("scan_type") == 0)
+        {
+            std::istringstream iss(value);
+            uint32_t int_value = 0;
+            if (iss >> std::hex >> int_value)
+            {
+                scan_type = (DNBProfileDataScanType)int_value;
+            }
+        }
+    }
+    
+    std::string data = DNBProcessGetProfileData(pid, scan_type);
+    if (!data.empty())
+    {
+        return SendPacket (data.c_str());
+    }
+    else
+    {
+        return SendPacket ("OK");
+    }
+}
+
+// QSetEnableAsyncProfiling;enable:[0|1]:interval_usec:XXXXXX;scan_type:0xYYYYYYY
+rnb_err_t
+RNBRemote::HandlePacket_SetEnableAsyncProfiling (const char *p)
+{
+    nub_process_t pid = m_ctx.ProcessID();
+    if (pid == INVALID_NUB_PROCESS)
+        return SendPacket ("OK");
+
+    StringExtractor packet(p += sizeof ("QSetEnableAsyncProfiling"));
+    bool enable = false;
+    uint64_t interval_usec = 0;
+    DNBProfileDataScanType scan_type = eProfileAll;
+    std::string name;
+    std::string value;
+    while (packet.GetNameColonValue(name, value))
+    {
+        if (name.compare ("enable") == 0)
+        {
+            enable  = strtoul(value.c_str(), NULL, 10) > 0;
+        }
+        else if (name.compare ("interval_usec") == 0)
+        {
+            interval_usec  = strtoul(value.c_str(), NULL, 10);
+        }
+        else if (name.compare ("scan_type") == 0)
+        {
+            std::istringstream iss(value);
+            uint32_t int_value = 0;
+            if (iss >> std::hex >> int_value)
+            {
+                scan_type = (DNBProfileDataScanType)int_value;
+            }
+        }
+    }
+    
+    if (interval_usec == 0)
+    {
+        enable = 0;
+    }
+    
+    DNBProcessSetEnableAsyncProfiling(pid, enable, interval_usec, scan_type);
+    return SendPacket ("OK");
+}
+
 rnb_err_t
 RNBRemote::HandlePacket_WatchpointSupportInfo (const char *p)
 {
@@ -3515,6 +3851,7 @@ RNBRemote::HandlePacket_D (const char *p
 rnb_err_t
 RNBRemote::HandlePacket_k (const char *p)
 {
+    DNBLog ("Got a 'k' packet, killing the inferior process.");
     // No response to should be sent to the kill packet
     if (m_ctx.HasValidProcessID())
         DNBProcessKill (m_ctx.ProcessID());
@@ -3525,10 +3862,17 @@ RNBRemote::HandlePacket_k (const char *p
 rnb_err_t
 RNBRemote::HandlePacket_stop_process (const char *p)
 {
+//#define TEST_EXIT_ON_INTERRUPT // This should only be uncommented to test exiting on interrupt
+#if defined(TEST_EXIT_ON_INTERRUPT)
+    rnb_err_t err = HandlePacket_k (p);
+    m_comm.Disconnect(true);
+    return err;
+#else
     DNBProcessSignal (m_ctx.ProcessID(), SIGSTOP);
     //DNBProcessSignal (m_ctx.ProcessID(), SIGINT);
     // Do not send any response packet! Wait for the stop reply packet to naturally happen
     return rnb_success;
+#endif
 }
 
 /* 's'
@@ -3685,3 +4029,100 @@ RNBRemote::HandlePacket_qHostInfo (const
         strm << "ptrsize:" << std::dec << sizeof(void *) << ';';
     return SendPacket (strm.str());
 }
+
+
+// Note that all numeric values returned by qProcessInfo are hex encoded,
+// including the pid and the cpu type.
+
+rnb_err_t
+RNBRemote::HandlePacket_qProcessInfo (const char *p)
+{
+    nub_process_t pid;
+    std::ostringstream rep;
+
+    // If we haven't run the process yet, return an error.
+    if (!m_ctx.HasValidProcessID())
+        return SendPacket ("E68");
+
+    pid = m_ctx.ProcessID();
+
+    rep << "pid:" << std::hex << pid << ";";
+
+    int procpid_mib[4];
+    procpid_mib[0] = CTL_KERN;
+    procpid_mib[1] = KERN_PROC;
+    procpid_mib[2] = KERN_PROC_PID;
+    procpid_mib[3] = pid;
+    struct kinfo_proc proc_kinfo;
+    size_t proc_kinfo_size = sizeof(struct kinfo_proc);
+
+    if (::sysctl (procpid_mib, 4, &proc_kinfo, &proc_kinfo_size, NULL, 0) == 0)
+    {
+        if (proc_kinfo_size > 0)
+        {
+            rep << "parent-pid:" << std::hex << proc_kinfo.kp_eproc.e_ppid << ";";
+            rep << "real-uid:" << std::hex << proc_kinfo.kp_eproc.e_pcred.p_ruid << ";";
+            rep << "real-gid:" << std::hex << proc_kinfo.kp_eproc.e_pcred.p_rgid << ";";
+            rep << "effective-uid:" << std::hex << proc_kinfo.kp_eproc.e_ucred.cr_uid << ";";
+            if (proc_kinfo.kp_eproc.e_ucred.cr_ngroups > 0)
+                rep << "effective-gid:" << std::hex << proc_kinfo.kp_eproc.e_ucred.cr_groups[0] << ";";
+        }
+    }
+    
+    cpu_type_t cputype = DNBProcessGetCPUType (pid);
+    if (cputype != 0)
+    {
+        rep << "cputype:" << std::hex << cputype << ";";
+    }
+
+    uint32_t cpusubtype;
+    size_t cpusubtype_len = sizeof(cpusubtype);
+    if (::sysctlbyname("hw.cpusubtype", &cpusubtype, &cpusubtype_len, NULL, 0) == 0)
+    {
+        if (cputype == CPU_TYPE_X86_64 && cpusubtype == CPU_SUBTYPE_486)
+        {
+            cpusubtype = CPU_SUBTYPE_X86_64_ALL;
+        }
+
+        rep << "cpusubtype:" << std::hex << cpusubtype << ';';
+    }
+
+    // The OS in the triple should be "ios" or "macosx" which doesn't match our
+    // "Darwin" which gets returned from "kern.ostype", so we need to hardcode
+    // this for now.
+    if (cputype == CPU_TYPE_ARM)
+        rep << "ostype:ios;";
+    else
+        rep << "ostype:macosx;";
+
+    rep << "vendor:apple;";
+
+#if defined (__LITTLE_ENDIAN__)
+    rep << "endian:little;";
+#elif defined (__BIG_ENDIAN__)
+    rep << "endian:big;";
+#elif defined (__PDP_ENDIAN__)
+    rep << "endian:pdp;";
+#endif
+
+#if (defined (__x86_64__) || defined (__i386__)) && defined (x86_THREAD_STATE)
+    nub_thread_t thread = DNBProcessGetCurrentThreadMachPort (pid);
+    kern_return_t kr;
+    x86_thread_state_t gp_regs;
+    mach_msg_type_number_t gp_count = x86_THREAD_STATE_COUNT;
+    kr = thread_get_state (thread, x86_THREAD_STATE,
+                           (thread_state_t) &gp_regs, &gp_count);
+    if (kr == KERN_SUCCESS)
+    {
+        if (gp_regs.tsh.flavor == x86_THREAD_STATE64)
+            rep << "ptrsize:8;";
+        else
+            rep << "ptrsize:4;";
+    }
+#elif defined (__arm__)
+    rep << "ptrsize:4;";
+#endif
+
+    return SendPacket (rep.str());
+}
+

Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/RNBRemote.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/RNBRemote.h?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/RNBRemote.h (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/RNBRemote.h Thu Jun  6 19:06:43 2013
@@ -79,9 +79,9 @@ public:
         insert_access_watch_bp,         // 'Z4'
         remove_access_watch_bp,         // 'z4'
 
+        query_monitor,                  // 'qRcmd'
         query_current_thread_id,        // 'qC'
         query_get_pid,                  // 'qGetPid'
-        query_memory_crc,               // 'qCRC:'
         query_thread_ids_first,         // 'qfThreadInfo'
         query_thread_ids_subsequent,    // 'qsThreadInfo'
         query_thread_extra_info,        // 'qThreadExtraInfo'
@@ -95,6 +95,7 @@ public:
         query_vattachorwait_supported,  // 'qVAttachOrWaitSupported'
         query_sync_thread_state_supported,// 'QSyncThreadState'
         query_host_info,                // 'qHostInfo'
+        query_process_info,             // 'qProcessInfo'
         pass_signals_to_inferior,       // 'QPassSignals'
         start_noack_mode,               // 'QStartNoAckMode'
         prefix_reg_packets_with_tid,    // 'QPrefixRegisterPacketsWithThreadID
@@ -112,6 +113,8 @@ public:
         set_list_threads_in_stop_reply, // 'QListThreadsInStopReply:'
         sync_thread_state,              // 'QSyncThreadState:'
         memory_region_info,             // 'qMemoryRegionInfo:'
+        get_profile_data,               // 'qGetProfileData'
+        set_enable_profiling,           // 'QSetEnableAsyncProfiling'
         watchpoint_support_info,        // 'qWatchpointSupportInfo:'
         allocate_memory,                // '_M'
         deallocate_memory,              // '_m'
@@ -126,7 +129,7 @@ public:
 
     void            Initialize();
 
-    bool            InitializeRegisters ();
+    bool            InitializeRegisters (bool force = false);
 
     rnb_err_t       HandleAsyncPacket(PacketEnum *type = NULL);
     rnb_err_t       HandleReceivedPacket(PacketEnum *type = NULL);
@@ -163,6 +166,7 @@ public:
     rnb_err_t HandlePacket_A (const char *p);
     rnb_err_t HandlePacket_H (const char *p);
     rnb_err_t HandlePacket_qC (const char *p);
+    rnb_err_t HandlePacket_qRcmd (const char *p);
     rnb_err_t HandlePacket_qGetPid (const char *p);
     rnb_err_t HandlePacket_qLaunchSuccess (const char *p);
     rnb_err_t HandlePacket_qRegisterInfo (const char *p);
@@ -174,6 +178,7 @@ public:
     rnb_err_t HandlePacket_qThreadExtraInfo (const char *p);
     rnb_err_t HandlePacket_qThreadStopInfo (const char *p);
     rnb_err_t HandlePacket_qHostInfo (const char *p);
+    rnb_err_t HandlePacket_qProcessInfo (const char *p);
     rnb_err_t HandlePacket_QStartNoAckMode (const char *p);
     rnb_err_t HandlePacket_QThreadSuffixSupported (const char *p);
     rnb_err_t HandlePacket_QSetLogging (const char *p);
@@ -210,6 +215,8 @@ public:
     rnb_err_t HandlePacket_AllocateMemory (const char *p);
     rnb_err_t HandlePacket_DeallocateMemory (const char *p);
     rnb_err_t HandlePacket_MemoryRegionInfo (const char *p);
+    rnb_err_t HandlePacket_GetProfileData(const char *p);
+    rnb_err_t HandlePacket_SetEnableAsyncProfiling(const char *p);
     rnb_err_t HandlePacket_WatchpointSupportInfo (const char *p);
 
     rnb_err_t HandlePacket_stop_process (const char *p);
@@ -219,6 +226,8 @@ public:
     rnb_err_t SendSTDOUTPacket (char *buf, nub_size_t buf_size);
     rnb_err_t SendSTDERRPacket (char *buf, nub_size_t buf_size);
     void      FlushSTDIO ();
+    void      SendAsyncProfileData ();
+    rnb_err_t SendAsyncProfileDataPacket (char *buf, nub_size_t buf_size);
 
     RNBContext&     Context() { return m_ctx; }
     RNBSocket&      Comm() { return m_comm; }

Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/RNBServices.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/RNBServices.cpp?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/RNBServices.cpp (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/RNBServices.cpp Thu Jun  6 19:06:43 2013
@@ -14,7 +14,11 @@
 #import "RNBServices.h"
 
 #import <CoreFoundation/CoreFoundation.h>
+#include <libproc.h>
 #import <unistd.h>
+#include <sys/sysctl.h>
+#include "CFString.h"
+#include <vector>
 #import "DNBLog.h"
 #include "MacOSX/CFUtils.h"
 
@@ -22,69 +26,178 @@
 #import <SpringBoardServices/SpringBoardServices.h>
 #endif
 
+// From DNB.cpp
+size_t GetAllInfos (std::vector<struct kinfo_proc>& proc_infos);
+
+int
+GetPrcoesses (CFMutableArrayRef plistMutableArray, bool all_users)
+{
+    if (plistMutableArray == NULL)
+        return -1;
+
+    // Running as root, get all processes
+    std::vector<struct kinfo_proc> proc_infos;
+    const size_t num_proc_infos = GetAllInfos(proc_infos);
+    if (num_proc_infos > 0)
+    {
+        const pid_t our_pid = getpid();
+        const uid_t our_uid = getuid();
+        uint32_t i;
+        CFAllocatorRef alloc = kCFAllocatorDefault;
+
+        for (i=0; i<num_proc_infos; i++)
+        {
+            struct kinfo_proc &proc_info = proc_infos[i];
+            
+            bool kinfo_user_matches;
+            // Special case, if lldb is being run as root we can attach to anything.
+            if (all_users)
+                kinfo_user_matches = true;
+            else
+                kinfo_user_matches = proc_info.kp_eproc.e_pcred.p_ruid == our_uid;
+            
+
+            const pid_t pid = proc_info.kp_proc.p_pid;
+            // Skip zombie processes and processes with unset status
+            if (kinfo_user_matches == false             || // User is acceptable
+                pid == our_pid                          || // Skip this process
+                pid == 0                                || // Skip kernel (kernel pid is zero)
+                proc_info.kp_proc.p_stat == SZOMB       || // Zombies are bad, they like brains...
+                proc_info.kp_proc.p_flag & P_TRACED     || // Being debugged?
+                proc_info.kp_proc.p_flag & P_WEXIT      || // Working on exiting?
+                proc_info.kp_proc.p_flag & P_TRANSLATED)   // Skip translated ppc (Rosetta)
+                continue;
+            
+            // Create a new mutable dictionary for each application
+            CFReleaser<CFMutableDictionaryRef> appInfoDict (::CFDictionaryCreateMutable (alloc, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+            
+            // Get the process id for the app (if there is one)
+            const int32_t pid_int32 = pid;
+            CFReleaser<CFNumberRef> pidCFNumber (::CFNumberCreate (alloc,  kCFNumberSInt32Type, &pid_int32));
+            ::CFDictionarySetValue (appInfoDict.get(), DTSERVICES_APP_PID_KEY, pidCFNumber.get());
+            
+            // Set the a boolean to indicate if this is the front most
+            ::CFDictionarySetValue (appInfoDict.get(), DTSERVICES_APP_FRONTMOST_KEY, kCFBooleanFalse);
+            
+            const char *pid_basename = proc_info.kp_proc.p_comm;
+            char proc_path_buf[PATH_MAX];
+            
+            int return_val = proc_pidpath (pid, proc_path_buf, PATH_MAX);
+            if (return_val > 0)
+            {
+                // Okay, now search backwards from that to see if there is a
+                // slash in the name.  Note, even though we got all the args we don't care
+                // because the list data is just a bunch of concatenated null terminated strings
+                // so strrchr will start from the end of argv0.
+                
+                pid_basename = strrchr(proc_path_buf, '/');
+                if (pid_basename)
+                {
+                    // Skip the '/'
+                    ++pid_basename;
+                }
+                else
+                {
+                    // We didn't find a directory delimiter in the process argv[0], just use what was in there
+                    pid_basename = proc_path_buf;
+                }
+                CFString cf_pid_path (proc_path_buf);
+                if (cf_pid_path.get())
+                    ::CFDictionarySetValue (appInfoDict.get(), DTSERVICES_APP_PATH_KEY, cf_pid_path.get());
+            }
+
+            if (pid_basename && pid_basename[0])
+            {
+                CFString pid_name (pid_basename);
+                ::CFDictionarySetValue (appInfoDict.get(), DTSERVICES_APP_DISPLAY_NAME_KEY, pid_name.get());
+            }
+            
+            // Append the application info to the plist array
+            ::CFArrayAppendValue (plistMutableArray, appInfoDict.get());
+        }
+    }
+    return 0;
+}
 int
 ListApplications(std::string& plist, bool opt_runningApps, bool opt_debuggable)
 {
-#ifdef WITH_SPRINGBOARD
     int result = -1;
-
+    
     CFAllocatorRef alloc = kCFAllocatorDefault;
-
+    
     // Create a mutable array that we can populate. Specify zero so it can be of any size.
     CFReleaser<CFMutableArrayRef> plistMutableArray (::CFArrayCreateMutable (alloc, 0, &kCFTypeArrayCallBacks));
 
-    CFReleaser<CFStringRef> sbsFrontAppID (::SBSCopyFrontmostApplicationDisplayIdentifier ());
-    CFReleaser<CFArrayRef> sbsAppIDs (::SBSCopyApplicationDisplayIdentifiers (opt_runningApps, opt_debuggable));
-
-    // Need to check the return value from SBSCopyApplicationDisplayIdentifiers.
-    CFIndex count = sbsAppIDs.get() ? ::CFArrayGetCount (sbsAppIDs.get()) : 0;
-    CFIndex i = 0;
-    for (i = 0; i < count; i++)
-    {
-        CFStringRef displayIdentifier = (CFStringRef)::CFArrayGetValueAtIndex (sbsAppIDs.get(), i);
-
-        // Create a new mutable dictionary for each application
-        CFReleaser<CFMutableDictionaryRef> appInfoDict (::CFDictionaryCreateMutable (alloc, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
-
-        // Get the process id for the app (if there is one)
-        pid_t pid = INVALID_NUB_PROCESS;
-        if (::SBSProcessIDForDisplayIdentifier ((CFStringRef)displayIdentifier, &pid) == true)
-        {
-            CFReleaser<CFNumberRef> pidCFNumber (::CFNumberCreate (alloc,  kCFNumberSInt32Type, &pid));
-            ::CFDictionarySetValue (appInfoDict.get(), DTSERVICES_APP_PID_KEY, pidCFNumber.get());
-        }
-
-        // Set the a boolean to indicate if this is the front most
-        if (sbsFrontAppID.get() && displayIdentifier && (::CFStringCompare (sbsFrontAppID.get(), displayIdentifier, 0) == kCFCompareEqualTo))
-            ::CFDictionarySetValue (appInfoDict.get(), DTSERVICES_APP_FRONTMOST_KEY, kCFBooleanTrue);
-        else
-            ::CFDictionarySetValue (appInfoDict.get(), DTSERVICES_APP_FRONTMOST_KEY, kCFBooleanFalse);
+    const uid_t our_uid = getuid();
 
+#ifdef WITH_SPRINGBOARD
 
-        CFReleaser<CFStringRef> executablePath (::SBSCopyExecutablePathForDisplayIdentifier (displayIdentifier));
-        if (executablePath.get() != NULL)
-        {
-            ::CFDictionarySetValue (appInfoDict.get(), DTSERVICES_APP_PATH_KEY, executablePath.get());
-        }
+    
+    if (our_uid == 0)
+    {
+        bool all_users = true;
+        result = GetPrcoesses (plistMutableArray.get(), all_users);
+    }
+    else
+    {
+        CFReleaser<CFStringRef> sbsFrontAppID (::SBSCopyFrontmostApplicationDisplayIdentifier ());
+        CFReleaser<CFArrayRef> sbsAppIDs (::SBSCopyApplicationDisplayIdentifiers (opt_runningApps, opt_debuggable));
 
-        CFReleaser<CFStringRef> iconImagePath (::SBSCopyIconImagePathForDisplayIdentifier (displayIdentifier)) ;
-        if (iconImagePath.get() != NULL)
-        {
-            ::CFDictionarySetValue (appInfoDict.get(), DTSERVICES_APP_ICON_PATH_KEY, iconImagePath.get());
-        }
+        // Need to check the return value from SBSCopyApplicationDisplayIdentifiers.
+        CFIndex count = sbsAppIDs.get() ? ::CFArrayGetCount (sbsAppIDs.get()) : 0;
+        CFIndex i = 0;
+        for (i = 0; i < count; i++)
+        {
+            CFStringRef displayIdentifier = (CFStringRef)::CFArrayGetValueAtIndex (sbsAppIDs.get(), i);
+
+            // Create a new mutable dictionary for each application
+            CFReleaser<CFMutableDictionaryRef> appInfoDict (::CFDictionaryCreateMutable (alloc, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+
+            // Get the process id for the app (if there is one)
+            pid_t pid = INVALID_NUB_PROCESS;
+            if (::SBSProcessIDForDisplayIdentifier ((CFStringRef)displayIdentifier, &pid) == true)
+            {
+                CFReleaser<CFNumberRef> pidCFNumber (::CFNumberCreate (alloc,  kCFNumberSInt32Type, &pid));
+                ::CFDictionarySetValue (appInfoDict.get(), DTSERVICES_APP_PID_KEY, pidCFNumber.get());
+            }
+
+            // Set the a boolean to indicate if this is the front most
+            if (sbsFrontAppID.get() && displayIdentifier && (::CFStringCompare (sbsFrontAppID.get(), displayIdentifier, 0) == kCFCompareEqualTo))
+                ::CFDictionarySetValue (appInfoDict.get(), DTSERVICES_APP_FRONTMOST_KEY, kCFBooleanTrue);
+            else
+                ::CFDictionarySetValue (appInfoDict.get(), DTSERVICES_APP_FRONTMOST_KEY, kCFBooleanFalse);
+
+
+            CFReleaser<CFStringRef> executablePath (::SBSCopyExecutablePathForDisplayIdentifier (displayIdentifier));
+            if (executablePath.get() != NULL)
+            {
+                ::CFDictionarySetValue (appInfoDict.get(), DTSERVICES_APP_PATH_KEY, executablePath.get());
+            }
+
+            CFReleaser<CFStringRef> iconImagePath (::SBSCopyIconImagePathForDisplayIdentifier (displayIdentifier)) ;
+            if (iconImagePath.get() != NULL)
+            {
+                ::CFDictionarySetValue (appInfoDict.get(), DTSERVICES_APP_ICON_PATH_KEY, iconImagePath.get());
+            }
+
+            CFReleaser<CFStringRef> localizedDisplayName (::SBSCopyLocalizedApplicationNameForDisplayIdentifier (displayIdentifier));
+            if (localizedDisplayName.get() != NULL)
+            {
+                ::CFDictionarySetValue (appInfoDict.get(), DTSERVICES_APP_DISPLAY_NAME_KEY, localizedDisplayName.get());
+            }
 
-        CFReleaser<CFStringRef> localizedDisplayName (::SBSCopyLocalizedApplicationNameForDisplayIdentifier (displayIdentifier));
-        if (localizedDisplayName.get() != NULL)
-        {
-            ::CFDictionarySetValue (appInfoDict.get(), DTSERVICES_APP_DISPLAY_NAME_KEY, localizedDisplayName.get());
+            // Append the application info to the plist array
+            ::CFArrayAppendValue (plistMutableArray.get(), appInfoDict.get());
         }
-
-        // Append the application info to the plist array
-        ::CFArrayAppendValue (plistMutableArray.get(), appInfoDict.get());
     }
-
+#else
+    // When root, show all processes
+    bool all_users = (our_uid == 0);
+    result = GetPrcoesses (plistMutableArray.get(), all_users);
+#endif
+    
     CFReleaser<CFDataRef> plistData (::CFPropertyListCreateXMLData (alloc, plistMutableArray.get()));
-
+    
     // write plist to service port
     if (plistData.get() != NULL)
     {
@@ -106,13 +219,9 @@ ListApplications(std::string& plist, boo
         DNBLogError("serializing task list.");
         result = -3;
     }
-
+    
     return result;
-#else
-    // TODO: list all current processes
-    DNBLogError("SBS doesn't support getting application list.");
-    return -1;
-#endif
+
 }
 
 

Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/RNBSocket.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/RNBSocket.cpp?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/RNBSocket.cpp (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/RNBSocket.cpp Thu Jun  6 19:06:43 2013
@@ -30,13 +30,63 @@
    this function is called to wait for an incoming connection.
    This function blocks while waiting for that connection.  */
 
+bool
+ResolveIPV4HostName (const char *hostname, in_addr_t &addr)
+{
+    if (hostname == NULL ||
+        hostname[0] == '\0' ||
+        strcmp(hostname, "localhost") == 0 ||
+        strcmp(hostname, "127.0.0.1") == 0)
+    {
+        addr = htonl (INADDR_LOOPBACK);
+        return true;
+    }
+    else if (strcmp(hostname, "*") == 0)
+    {
+        addr = htonl (INADDR_ANY);
+        return true;
+    }
+    else
+    {
+        // See if an IP address was specified as numbers
+        int inet_pton_result = ::inet_pton (AF_INET, hostname, &addr);
+
+        if (inet_pton_result == 1)
+            return true;
+        
+        struct hostent *host_entry = gethostbyname (hostname);
+        if (host_entry)
+        {
+            std::string ip_str (::inet_ntoa (*(struct in_addr *)*host_entry->h_addr_list));
+            inet_pton_result = ::inet_pton (AF_INET, ip_str.c_str(), &addr);
+            if (inet_pton_result == 1)
+                return true;
+        }
+    }
+    return false;
+}
+
 rnb_err_t
-RNBSocket::Listen (in_port_t port, PortBoundCallback callback, const void *callback_baton)
+RNBSocket::Listen (const char *listen_host, in_port_t port, PortBoundCallback callback, const void *callback_baton)
 {
     //DNBLogThreadedIf(LOG_RNB_COMM, "%8u RNBSocket::%s called", (uint32_t)m_timer.ElapsedMicroSeconds(true), __FUNCTION__);
     // Disconnect without saving errno
     Disconnect (false);
 
+    // Now figure out the hostname that will be attaching and palce it into
+    struct sockaddr_in listen_addr;
+    ::memset (&listen_addr, 0, sizeof listen_addr);
+    listen_addr.sin_len = sizeof listen_addr;
+    listen_addr.sin_family = AF_INET;
+    listen_addr.sin_port = htons (port);
+    listen_addr.sin_addr.s_addr = INADDR_ANY;
+    
+    if (!ResolveIPV4HostName(listen_host, listen_addr.sin_addr.s_addr))
+    {
+        DNBLogThreaded("error: failed to resolve connecting host '%s'", listen_host);
+        return rnb_err;
+    }
+    
     DNBError err;
     int listen_fd = ::socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
     if (listen_fd == -1)
@@ -56,8 +106,7 @@ RNBSocket::Listen (in_port_t port, PortB
     sa.sin_len = sizeof sa;
     sa.sin_family = AF_INET;
     sa.sin_port = htons (port);
-    sa.sin_addr.s_addr = htonl (INADDR_ANY);
-
+    sa.sin_addr.s_addr = INADDR_ANY; // Let incoming connections bind to any host network interface (this is NOT who can connect to us)
     int error = ::bind (listen_fd, (struct sockaddr *) &sa, sizeof(sa));
     if (error == -1)
         err.SetError(errno, DNBError::POSIX);
@@ -85,7 +134,7 @@ RNBSocket::Listen (in_port_t port, PortB
         }
     }
 
-    error = ::listen (listen_fd, 1);
+    error = ::listen (listen_fd, 5);
     if (error == -1)
         err.SetError(errno, DNBError::POSIX);
 
@@ -98,12 +147,52 @@ RNBSocket::Listen (in_port_t port, PortB
         return rnb_err;
     }
 
-    m_fd = ::accept (listen_fd, NULL, 0);
-    if (m_fd == -1)
-        err.SetError(errno, DNBError::POSIX);
-
-    if (err.Fail() || DNBLogCheckLogBit(LOG_RNB_COMM))
-        err.LogThreaded("::accept ( socket = %i, address = NULL, address_len = 0 )", listen_fd);
+    struct sockaddr_in accept_addr;
+    ::memset (&accept_addr, 0, sizeof accept_addr);
+    accept_addr.sin_len = sizeof accept_addr;
+
+    bool accept_connection = false;
+
+    // Loop until we are happy with our connection
+    while (!accept_connection)
+    {
+        socklen_t accept_addr_len = sizeof accept_addr;
+        m_fd = ::accept (listen_fd, (struct sockaddr *)&accept_addr, &accept_addr_len);
+
+        if (m_fd == -1)
+            err.SetError(errno, DNBError::POSIX);
+        
+        if (err.Fail() || DNBLogCheckLogBit(LOG_RNB_COMM))
+            err.LogThreaded("::accept ( socket = %i, address = %p, address_len = %u )", listen_fd, &accept_addr, accept_addr_len);
+
+        if (err.Fail())
+            break;
+
+        if (listen_addr.sin_addr.s_addr == INADDR_ANY)
+            accept_connection = true;
+        else
+        {
+            if (accept_addr_len == listen_addr.sin_len &&
+                accept_addr.sin_addr.s_addr == listen_addr.sin_addr.s_addr)
+            {
+                accept_connection = true;
+            }
+            else
+            {
+                ::close (m_fd);
+                m_fd = -1;
+                const uint8_t *accept_ip = (const uint8_t *)&accept_addr.sin_addr.s_addr;
+                const uint8_t *listen_ip = (const uint8_t *)&listen_addr.sin_addr.s_addr;
+                ::fprintf (stderr,
+                           "error: rejecting incoming connection from %u.%u.%u.%u (expecting %u.%u.%u.%u)\n",
+                           accept_ip[0], accept_ip[1], accept_ip[2], accept_ip[3],
+                           listen_ip[0], listen_ip[1], listen_ip[2], listen_ip[3]);
+                DNBLogThreaded ("error: rejecting connection from %u.%u.%u.%u (expecting %u.%u.%u.%u)",
+                                accept_ip[0], accept_ip[1], accept_ip[2], accept_ip[3],
+                                listen_ip[0], listen_ip[1], listen_ip[2], listen_ip[3]);
+            }
+        }
+    }
 
     ClosePort (listen_fd, false);
 
@@ -138,24 +227,11 @@ RNBSocket::Connect (const char *host, ui
     sa.sin_family = AF_INET;
     sa.sin_port = htons (port);
     
-    if (host == NULL)
-        host = "localhost";
-
-    int inet_pton_result = ::inet_pton (AF_INET, host, &sa.sin_addr);
-    
-    if (inet_pton_result <= 0)
+    if (!ResolveIPV4HostName(host, sa.sin_addr.s_addr))
     {
-        struct hostent *host_entry = gethostbyname (host);
-        if (host_entry)
-        {
-            std::string host_str (::inet_ntoa (*(struct in_addr *)*host_entry->h_addr_list));
-            inet_pton_result = ::inet_pton (AF_INET, host_str.c_str(), &sa.sin_addr);
-            if (inet_pton_result <= 0)
-            {
-                Disconnect (false);
-                return rnb_err;
-            }
-        }
+        DNBLogThreaded("error: failed to resolve host '%s'", host);
+        Disconnect (false);
+        return rnb_err;
     }
     
     if (-1 == ::connect (m_fd, (const struct sockaddr *)&sa, sizeof(sa)))
@@ -188,13 +264,18 @@ RNBSocket::ConnectToService()
     DNBLog("Connecting to com.apple.%s service...", DEBUGSERVER_PROGRAM_NAME);
     // Disconnect from any previous connections
     Disconnect(false);
-
-    if (::lockdown_secure_checkin (&m_fd, NULL, NULL, NULL) != kLDESuccess)
+    if (::secure_lockdown_checkin (&m_ld_conn, NULL, NULL) != kLDESuccess)
     {
-        DNBLogThreadedIf(LOG_RNB_COMM, "::lockdown_secure_checkin(&m_fd, NULL, NULL, NULL) failed");
+        DNBLogThreadedIf(LOG_RNB_COMM, "::secure_lockdown_checkin(&m_fd, NULL, NULL) failed");
         m_fd = -1;
         return rnb_not_connected;
     }
+    m_fd = ::lockdown_get_socket (m_ld_conn);
+    if (m_fd == -1)
+    {
+        DNBLogThreadedIf(LOG_RNB_COMM, "::lockdown_get_socket() failed");
+        return rnb_not_connected;
+    }
     m_fd_from_lockdown = true;
     return rnb_success;
 }
@@ -236,7 +317,14 @@ RNBSocket::Disconnect (bool save_errno)
 {
 #ifdef WITH_LOCKDOWN
     if (m_fd_from_lockdown)
+    {
         m_fd_from_lockdown = false;
+        m_fd = -1;
+        if (lockdown_deactivate (m_ld_conn) == 0)
+            return rnb_success;
+        else
+            return rnb_err;
+    }
 #endif
     return ClosePort (m_fd, save_errno);
 }
@@ -263,7 +351,7 @@ RNBSocket::Read (std::string &p)
         p.append(buf, bytesread);
 
     if (err.Fail() || DNBLogCheckLogBit(LOG_RNB_COMM))
-        err.LogThreaded("::read ( %i, %p, %zu ) => %i", m_fd, buf, sizeof (buf), bytesread);
+        err.LogThreaded("::read ( %i, %p, %llu ) => %i", m_fd, buf, sizeof (buf), (uint64_t)bytesread);
 
     // Our port went away - we have to mark this so IsConnected will return the truth.
     if (bytesread == 0)
@@ -297,7 +385,7 @@ RNBSocket::Write (const void *buffer, si
         err.SetError(errno, DNBError::POSIX);
 
     if (err.Fail() || DNBLogCheckLogBit(LOG_RNB_COMM))
-        err.LogThreaded("::write ( socket = %i, buffer = %p, length = %zu) => %i", m_fd, buffer, length, bytessent);
+        err.LogThreaded("::write ( socket = %i, buffer = %p, length = %llu) => %i", m_fd, buffer, length, (uint64_t)bytessent);
 
     if (bytessent < 0)
         return rnb_err;

Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/RNBSocket.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/RNBSocket.h?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/RNBSocket.h (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/RNBSocket.h Thu Jun  6 19:06:43 2013
@@ -20,6 +20,10 @@
 #include <string>
 #include "DNBTimer.h"
 
+#ifdef WITH_LOCKDOWN
+#include "lockdown.h"
+#endif
+
 class RNBSocket
 {
 public:
@@ -29,6 +33,7 @@ public:
         m_fd (-1),
 #ifdef WITH_LOCKDOWN
         m_fd_from_lockdown (false),
+        m_ld_conn (),
 #endif
         m_timer (true)      // Make a thread safe timer
     {
@@ -38,7 +43,10 @@ public:
         Disconnect (false);
     }
 
-    rnb_err_t Listen (in_port_t port, PortBoundCallback callback, const void *callback_baton);
+    rnb_err_t Listen (const char *listen_host,
+                      in_port_t port,
+                      PortBoundCallback callback,
+                      const void *callback_baton);
     rnb_err_t Connect (const char *host, uint16_t port);
 
     rnb_err_t useFD(int fd);
@@ -67,6 +75,7 @@ protected:
 
 #ifdef WITH_LOCKDOWN
     bool m_fd_from_lockdown;
+    lockdown_connection m_ld_conn;
 #endif
 
     DNBTimer m_timer;

Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/debugserver.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/debugserver.cpp?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/debugserver.cpp (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/debugserver.cpp Thu Jun  6 19:06:43 2013
@@ -93,7 +93,7 @@ RNBRunLoopGetStartModeFromRemote (RNBRem
 
             if (set_events & RNBContext::event_read_thread_exiting)
             {
-                RNBLogSTDERR ("error: packet read thread exited.");
+                RNBLogSTDERR ("error: packet read thread exited.\n");
                 return eRNBRunLoopModeExit;
             }
 
@@ -108,10 +108,13 @@ RNBRunLoopGetStartModeFromRemote (RNBRem
                 if (type == RNBRemote::vattach || type == RNBRemote::vattachwait || type == RNBRemote::vattachorwait)
                 {
                     if (err == rnb_success)
+                    {
+                        RNBLogSTDOUT ("Attach succeeded, ready to debug.\n");
                         return eRNBRunLoopModeInferiorExecuting;
+                    }
                     else
                     {
-                        RNBLogSTDERR ("error: attach failed.");
+                        RNBLogSTDERR ("error: attach failed.\n");
                         return eRNBRunLoopModeExit;
                     }
                 }
@@ -127,7 +130,7 @@ RNBRunLoopGetStartModeFromRemote (RNBRem
                 }
                 else if (err == rnb_not_connected)
                 {
-                    RNBLogSTDERR ("error: connection lost.");
+                    RNBLogSTDERR ("error: connection lost.\n");
                     return eRNBRunLoopModeExit;
                 }
                 else
@@ -447,18 +450,18 @@ HandleProcessStateChange (RNBRemote *rem
 
                     if (ctx.GetProcessStopCount() == 1)
                     {
-                        DNBLogThreadedIf (LOG_RNB_MINIMAL, "%s (&remote, initialize=%i)  pid_state = %s pid_stop_count %zu (old %zu)) Notify??? no, first stop...", __FUNCTION__, (int)initialize, DNBStateAsString (pid_state), ctx.GetProcessStopCount(), prev_pid_stop_count);
+                        DNBLogThreadedIf (LOG_RNB_MINIMAL, "%s (&remote, initialize=%i)  pid_state = %s pid_stop_count %llu (old %llu)) Notify??? no, first stop...", __FUNCTION__, (int)initialize, DNBStateAsString (pid_state), (uint64_t)ctx.GetProcessStopCount(), (uint64_t)prev_pid_stop_count);
                     }
                     else
                     {
 
-                        DNBLogThreadedIf (LOG_RNB_MINIMAL, "%s (&remote, initialize=%i)  pid_state = %s pid_stop_count %zu (old %zu)) Notify??? YES!!!", __FUNCTION__, (int)initialize, DNBStateAsString (pid_state), ctx.GetProcessStopCount(), prev_pid_stop_count);
+                        DNBLogThreadedIf (LOG_RNB_MINIMAL, "%s (&remote, initialize=%i)  pid_state = %s pid_stop_count %llu (old %llu)) Notify??? YES!!!", __FUNCTION__, (int)initialize, DNBStateAsString (pid_state), (uint64_t)ctx.GetProcessStopCount(), (uint64_t)prev_pid_stop_count);
                         remote->NotifyThatProcessStopped ();
                     }
                 }
                 else
                 {
-                    DNBLogThreadedIf (LOG_RNB_MINIMAL, "%s (&remote, initialize=%i)  pid_state = %s pid_stop_count %zu (old %zu)) Notify??? skipping...", __FUNCTION__, (int)initialize, DNBStateAsString (pid_state), ctx.GetProcessStopCount(), prev_pid_stop_count);
+                    DNBLogThreadedIf (LOG_RNB_MINIMAL, "%s (&remote, initialize=%i)  pid_state = %s pid_stop_count %llu (old %llu)) Notify??? skipping...", __FUNCTION__, (int)initialize, DNBStateAsString (pid_state), (uint64_t)ctx.GetProcessStopCount(), (uint64_t)prev_pid_stop_count);
                 }
             }
             return eRNBRunLoopModeInferiorExecuting;
@@ -498,8 +501,9 @@ RNBRunLoopInferiorExecuting (RNBRemote *
 
         if (!ctx.ProcessStateRunning())
         {
-            // Clear the stdio bits if we are not running so we don't send any async packets
+            // Clear some bits if we are not running so we don't send any async packets
             event_mask &= ~RNBContext::event_proc_stdio_available;
+            event_mask &= ~RNBContext::event_proc_profile_data;
         }
 
         // We want to make sure we consume all process state changes and have
@@ -519,6 +523,11 @@ RNBRunLoopInferiorExecuting (RNBRemote *
                 remote->FlushSTDIO();
             }
 
+            if (set_events & RNBContext::event_proc_profile_data)
+            {
+                remote->SendAsyncProfileData();
+            }
+
             if (set_events & RNBContext::event_read_packet_available)
             {
                 // handleReceivedPacket will take care of resetting the
@@ -562,6 +571,7 @@ RNBRunLoopInferiorExecuting (RNBRemote *
                     // in its current state and listen for another connection...
                     if (ctx.ProcessStateRunning())
                     {
+                        DNBLog ("debugserver's event read thread is exiting, killing the inferior process.");
                         DNBProcessKill (ctx.ProcessID());
                     }
                 }
@@ -675,13 +685,13 @@ PortWasBoundCallback (const void *baton,
 }
 
 static int
-StartListening (RNBRemote *remote, int listen_port, const char *unix_socket_name)
+StartListening (RNBRemote *remote, const char *listen_host, int listen_port, const char *unix_socket_name)
 {
     if (!remote->Comm().IsConnected())
     {
         if (listen_port != 0)
-            RNBLogSTDOUT ("Listening to port %i...\n", listen_port);
-        if (remote->Comm().Listen(listen_port, PortWasBoundCallback, unix_socket_name) != rnb_success)
+            RNBLogSTDOUT ("Listening to port %i for a connection from %s...\n", listen_port, listen_host ? listen_host : "localhost");
+        if (remote->Comm().Listen(listen_host, listen_port, PortWasBoundCallback, unix_socket_name) != rnb_success)
         {
             RNBLogSTDERR ("Failed to get connection from a remote gdb process.\n");
             return 0;
@@ -750,7 +760,7 @@ show_usage_and_exit (int exit_code)
 
 
 //----------------------------------------------------------------------
-// option descriptors for getopt_long()
+// option descriptors for getopt_long_only()
 //----------------------------------------------------------------------
 static struct option g_long_options[] =
 {
@@ -787,6 +797,8 @@ static struct option g_long_options[] =
 int
 main (int argc, char *argv[])
 {
+    const char *argv_sub_zero = argv[0]; // save a copy of argv[0] for error reporting post-launch
+
     g_isatty = ::isatty (STDIN_FILENO);
 
     //  ::printf ("uid=%u euid=%u gid=%u egid=%u\n",
@@ -866,7 +878,7 @@ main (int argc, char *argv[])
     }
     // NULL terminate the short option string.
     short_options[short_options_idx++] = '\0';
-    while ((ch = getopt_long(argc, argv, short_options, g_long_options, &long_option_index)) != -1)
+    while ((ch = getopt_long_only(argc, argv, short_options, g_long_options, &long_option_index)) != -1)
     {
         DNBLogDebug("option: ch == %c (0x%2.2x) --%s%c%s\n",
                     ch, (uint8_t)ch,
@@ -1069,7 +1081,6 @@ main (int argc, char *argv[])
             case 'u':
                 unix_socket_name.assign (optarg);
                 break;
-                
         }
     }
     
@@ -1089,7 +1100,7 @@ main (int argc, char *argv[])
 //        fprintf(stderr, "error: no architecture was specified\n");
 //        exit (8);
 //    }
-    // Skip any options we consumed with getopt_long
+    // Skip any options we consumed with getopt_long_only
     argc -= optind;
     argv += optind;
 
@@ -1139,6 +1150,7 @@ main (int argc, char *argv[])
                   compile_options.c_str(),
                   RNB_ARCH);
 
+    std::string listen_host;
     int listen_port = INT32_MAX;
     char str[PATH_MAX];
     str[0] = '\0';
@@ -1155,16 +1167,27 @@ main (int argc, char *argv[])
         int items_scanned = ::sscanf (argv[0], "%[^:]:%i", str, &listen_port);
         if (items_scanned == 2)
         {
-            DNBLogDebug("host = '%s'  port = %i", str, listen_port);
-        }
-        else if (argv[0][0] == '/')
-        {
-            listen_port = INT32_MAX;
-            strncpy(str, argv[0], sizeof(str));
+            listen_host = str;
+            DNBLogDebug("host = '%s'  port = %i", listen_host.c_str(), listen_port);
         }
         else
         {
-            show_usage_and_exit (2);
+            // No hostname means "localhost"
+            int items_scanned = ::sscanf (argv[0], "%i", &listen_port);
+            if (items_scanned == 1)
+            {
+                listen_host = "localhost";
+                DNBLogDebug("host = '%s'  port = %i", listen_host.c_str(), listen_port);
+            }
+            else if (argv[0][0] == '/')
+            {
+                listen_port = INT32_MAX;
+                strncpy(str, argv[0], sizeof(str));
+            }
+            else
+            {
+                show_usage_and_exit (2);
+            }
         }
 
         // We just used the 'host:port' or the '/path/file' arg...
@@ -1275,7 +1298,7 @@ main (int argc, char *argv[])
 #endif
                 if (listen_port != INT32_MAX)
                 {
-                    if (!StartListening (remote, listen_port, unix_socket_name.c_str()))
+                    if (!StartListening (remote, listen_host.c_str(), listen_port, unix_socket_name.c_str()))
                         mode = eRNBRunLoopModeExit;
                 }
                 else if (str[0] == '/')
@@ -1320,6 +1343,7 @@ main (int argc, char *argv[])
 
                     ctx.SetLaunchFlavor(launch_flavor);
                     bool ignore_existing = false;
+                    RNBLogSTDOUT ("Waiting to attach to process %s...\n", waitfor_pid_name.c_str());
                     nub_process_t pid = DNBProcessAttachWait (waitfor_pid_name.c_str(), launch_flavor, ignore_existing, timeout_ptr, waitfor_interval, err_str, sizeof(err_str));
                     g_pid = pid;
 
@@ -1328,7 +1352,7 @@ main (int argc, char *argv[])
                         ctx.LaunchStatus().SetError(-1, DNBError::Generic);
                         if (err_str[0])
                             ctx.LaunchStatus().SetErrorString(err_str);
-                        RNBLogSTDERR ("error: failed to attach to process named: \"%s\" %s", waitfor_pid_name.c_str(), err_str);
+                        RNBLogSTDERR ("error: failed to attach to process named: \"%s\" %s\n", waitfor_pid_name.c_str(), err_str);
                         mode = eRNBRunLoopModeExit;
                     }
                     else
@@ -1359,6 +1383,7 @@ main (int argc, char *argv[])
                         timeout_ptr = &attach_timeout_abstime;
                     }
 
+                    RNBLogSTDOUT ("Attaching to process %s...\n", attach_pid_name.c_str());
                     nub_process_t pid = DNBProcessAttachByName (attach_pid_name.c_str(), timeout_ptr, err_str, sizeof(err_str));
                     g_pid = pid;
                     if (pid == INVALID_NUB_PROCESS)
@@ -1366,7 +1391,7 @@ main (int argc, char *argv[])
                         ctx.LaunchStatus().SetError(-1, DNBError::Generic);
                         if (err_str[0])
                             ctx.LaunchStatus().SetErrorString(err_str);
-                        RNBLogSTDERR ("error: failed to attach to process named: \"%s\" %s", waitfor_pid_name.c_str(), err_str);
+                        RNBLogSTDERR ("error: failed to attach to process named: \"%s\" %s\n", waitfor_pid_name.c_str(), err_str);
                         mode = eRNBRunLoopModeExit;
                     }
                     else
@@ -1378,7 +1403,7 @@ main (int argc, char *argv[])
                 }
                 else
                 {
-                    RNBLogSTDERR ("error: asked to attach with empty name and invalid PID.");
+                    RNBLogSTDERR ("error: asked to attach with empty name and invalid PID.\n");
                     mode = eRNBRunLoopModeExit;
                 }
 
@@ -1386,7 +1411,7 @@ main (int argc, char *argv[])
                 {
                     if (listen_port != INT32_MAX)
                     {
-                        if (!StartListening (remote, listen_port, unix_socket_name.c_str()))
+                        if (!StartListening (remote, listen_host.c_str(), listen_port, unix_socket_name.c_str()))
                             mode = eRNBRunLoopModeExit;
                     }
                     else if (str[0] == '/')
@@ -1395,7 +1420,7 @@ main (int argc, char *argv[])
                             mode = eRNBRunLoopModeExit;
                     }
                     if (mode != eRNBRunLoopModeExit)
-                        RNBLogSTDOUT ("Got a connection, waiting for debugger instructions for process %d.\n", attach_pid);
+                        RNBLogSTDOUT ("Waiting for debugger instructions for process %d.\n", attach_pid);
                 }
                 break;
 
@@ -1411,7 +1436,7 @@ main (int argc, char *argv[])
                     {
                         if (listen_port != INT32_MAX)
                         {
-                            if (!StartListening (remote, listen_port, unix_socket_name.c_str()))
+                            if (!StartListening (remote, listen_host.c_str(), listen_port, unix_socket_name.c_str()))
                                 mode = eRNBRunLoopModeExit;
                         }
                         else if (str[0] == '/')
@@ -1421,12 +1446,12 @@ main (int argc, char *argv[])
                         }
 
                         if (mode != eRNBRunLoopModeExit)
-                            RNBLogSTDOUT ("Got a connection, waiting for debugger instructions.\n");
+                            RNBLogSTDOUT ("Got a connection, launched process %s.\n", argv_sub_zero);
                     }
                     else
                     {
                         const char *error_str = remote->Context().LaunchStatus().AsString();
-                        RNBLogSTDERR ("error: failed to launch process %s: %s\n", argv[0], error_str ? error_str : "unknown error.");
+                        RNBLogSTDERR ("error: failed to launch process %s: %s\n", argv_sub_zero, error_str ? error_str : "unknown error.");
                     }
                 }
                 break;
@@ -1438,7 +1463,7 @@ main (int argc, char *argv[])
             case eRNBRunLoopModePlatformMode:
                 if (listen_port != INT32_MAX)
                 {
-                    if (!StartListening (remote, listen_port, unix_socket_name.c_str()))
+                    if (!StartListening (remote, listen_host.c_str(), listen_port, unix_socket_name.c_str()))
                         mode = eRNBRunLoopModeExit;
                 }
                 else if (str[0] == '/')
@@ -1460,6 +1485,7 @@ main (int argc, char *argv[])
 
     remote->StopReadRemoteDataThread ();
     remote->Context().SetProcessID(INVALID_NUB_PROCESS);
+    RNBLogSTDOUT ("Exiting.\n");
 
     return 0;
 }

Modified: lldb/branches/lldb-platform-work/tools/driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/driver/Driver.cpp?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/driver/Driver.cpp (original)
+++ lldb/branches/lldb-platform-work/tools/driver/Driver.cpp Thu Jun  6 19:06:43 2013
@@ -18,6 +18,7 @@
 #include <stdlib.h>
 #include <limits.h>
 #include <fcntl.h>
+#include <inttypes.h>
 
 #include <string>
 
@@ -62,7 +63,7 @@ typedef struct
                                              // then this option belongs to option set n.
     bool required;                           // This option is required (in the current usage level)
     const char * long_option;                // Full name for this option.
-    char short_option;                       // Single character for this option.
+    int short_option;                        // Single character for this option.
     int option_has_arg;                      // no_argument, required_argument or optional_argument
     uint32_t completion_type;                // Cookie the option class can use to do define the argument completion.
     lldb::CommandArgumentType argument_type; // Type of argument this option takes
@@ -75,34 +76,40 @@ typedef struct
 
 static OptionDefinition g_options[] =
 {
-    { LLDB_OPT_SET_1,    true , "help"           , 'h', no_argument      , NULL,  eArgTypeNone,         
+    { LLDB_OPT_SET_1,    true , "help"           , 'h', no_argument      , 0,  eArgTypeNone,
         "Prints out the usage information for the LLDB debugger." },
-    { LLDB_OPT_SET_2,    true , "version"        , 'v', no_argument      , NULL,  eArgTypeNone,         
+    { LLDB_OPT_SET_2,    true , "version"        , 'v', no_argument      , 0,  eArgTypeNone,
         "Prints out the current version number of the LLDB debugger." },
-    { LLDB_OPT_SET_3,    true , "arch"           , 'a', required_argument, NULL,  eArgTypeArchitecture, 
+    { LLDB_OPT_SET_3,    true , "arch"           , 'a', required_argument, 0,  eArgTypeArchitecture,
         "Tells the debugger to use the specified architecture when starting and running the program.  <architecture> must "
         "be one of the architectures for which the program was compiled." },
-    { LLDB_OPT_SET_3,    true , "file"           , 'f', required_argument, NULL,  eArgTypeFilename,     
+    { LLDB_OPT_SET_3,    true , "file"           , 'f', required_argument, 0,  eArgTypeFilename,
         "Tells the debugger to use the file <filename> as the program to be debugged." },
-    { LLDB_OPT_SET_4,    true , "attach-name"    , 'n', required_argument, NULL,  eArgTypeProcessName,  
+    { LLDB_OPT_SET_3,    false, "core"           , 'c', required_argument, 0,  eArgTypeFilename,
+        "Tells the debugger to use the fullpath to <path> as the core file." },
+    { LLDB_OPT_SET_4,    true , "attach-name"    , 'n', required_argument, 0,  eArgTypeProcessName,
         "Tells the debugger to attach to a process with the given name." },
-    { LLDB_OPT_SET_4,    true , "wait-for"       , 'w', no_argument      , NULL,  eArgTypeNone,         
+    { LLDB_OPT_SET_4,    true , "wait-for"       , 'w', no_argument      , 0,  eArgTypeNone,
         "Tells the debugger to wait for a process with the given pid or name to launch before attaching." },
-    { LLDB_OPT_SET_5,    true , "attach-pid"     , 'p', required_argument, NULL,  eArgTypePid,          
+    { LLDB_OPT_SET_5,    true , "attach-pid"     , 'p', required_argument, 0,  eArgTypePid,
         "Tells the debugger to attach to a process with the given pid." },
-    { LLDB_3_TO_5,       false, "script-language", 'l', required_argument, NULL,  eArgTypeScriptLang,   
+    { LLDB_3_TO_5,       false, "script-language", 'l', required_argument, 0,  eArgTypeScriptLang,
         "Tells the debugger to use the specified scripting language for user-defined scripts, rather than the default.  "
         "Valid scripting languages that can be specified include Python, Perl, Ruby and Tcl.  Currently only the Python "
         "extensions have been implemented." },
-    { LLDB_3_TO_5,       false, "debug"          , 'd', no_argument      , NULL,  eArgTypeNone,         
+    { LLDB_3_TO_5,       false, "debug"          , 'd', no_argument      , 0,  eArgTypeNone,
         "Tells the debugger to print out extra information for debugging itself." },
-    { LLDB_3_TO_5,       false, "source"         , 's', required_argument, NULL,  eArgTypeFilename,     
+    { LLDB_3_TO_5,       false, "source"         , 's', required_argument, 0,  eArgTypeFilename,
         "Tells the debugger to read in and execute the file <file>, which should contain lldb commands." },
-    { LLDB_3_TO_5,       false, "editor"         , 'e', no_argument      , NULL,  eArgTypeNone,         
+    { LLDB_3_TO_5,       false, "editor"         , 'e', no_argument      , 0,  eArgTypeNone,
         "Tells the debugger to open source files using the host's \"external editor\" mechanism." },
-    { LLDB_3_TO_5,       false, "no-lldbinit"    , 'x', no_argument      , NULL,  eArgTypeNone,         
+    { LLDB_3_TO_5,       false, "no-lldbinit"    , 'x', no_argument      , 0,  eArgTypeNone,
         "Do not automatically parse any '.lldbinit' files." },
-    { 0,                 false, NULL             , 0  , 0                , NULL,  eArgTypeNone,         NULL }
+    { LLDB_3_TO_5,       false, "no-use-colors"  , 'o', no_argument      , 0,  eArgTypeNone,
+        "Do not use colors." },
+    { LLDB_OPT_SET_6,    true , "python-path"    , 'P', no_argument      , 0,  eArgTypeNone,
+        "Prints out the path to the lldb.py file for this version of lldb." },
+    { 0,                 false, NULL             , 0  , 0                , 0,  eArgTypeNone,         NULL }
 };
 
 static const uint32_t last_option_set_with_args = 2;
@@ -115,7 +122,9 @@ Driver::Driver () :
     m_editline_reader (),
     m_io_channel_ap (),
     m_option_data (),
-    m_waiting_for_command (false)
+    m_executing_user_command (false),
+    m_waiting_for_command (false),
+    m_done(false)
 {
     // We want to be able to handle CTRL+D in the terminal to have it terminate
     // certain input
@@ -379,10 +388,12 @@ BuildGetOptTable (OptionDefinition *expa
 Driver::OptionData::OptionData () :
     m_args(),
     m_script_lang (lldb::eScriptLanguageDefault),
+    m_core_file (),
     m_crash_log (),
     m_source_command_files (),
     m_debug_mode (false),
     m_print_version (false),
+    m_print_python_path (false),
     m_print_help (false),
     m_wait_for(false),
     m_process_name(),
@@ -405,6 +416,7 @@ Driver::OptionData::Clear ()
     m_debug_mode = false;
     m_print_help = false;
     m_print_version = false;
+    m_print_python_path = false;
     m_use_external_editor = false;
     m_wait_for = false;
     m_process_name.erase();
@@ -501,7 +513,7 @@ Driver::ParseArgs (int argc, const char
         return error;
     }
 
-    // Build the option_string argument for call to getopt_long.
+    // Build the option_string argument for call to getopt_long_only.
 
     for (int i = 0; long_options[i].name != NULL; ++i)
     {
@@ -532,7 +544,7 @@ Driver::ParseArgs (int argc, const char
     m_debugger.SkipLLDBInitFiles (false);
     m_debugger.SkipAppInitFiles (false);
 
-    // Prepare for & make calls to getopt_long.
+    // Prepare for & make calls to getopt_long_only.
 #if __GLIBC__
     optind = 0;
 #else
@@ -543,7 +555,7 @@ Driver::ParseArgs (int argc, const char
     while (1)
     {
         int long_options_index = -1;
-        val = ::getopt_long (argc, const_cast<char **>(argv), option_string.c_str(), long_options, &long_options_index);
+        val = ::getopt_long_only (argc, const_cast<char **>(argv), option_string.c_str(), long_options, &long_options_index);
 
         if (val == -1)
             break;
@@ -574,7 +586,7 @@ Driver::ParseArgs (int argc, const char
 
             if (long_options_index >= 0)
             {
-                const char short_option = (char) g_options[long_options_index].short_option;
+                const int short_option = g_options[long_options_index].short_option;
 
                 switch (short_option)
                 {
@@ -586,10 +598,22 @@ Driver::ParseArgs (int argc, const char
                         m_option_data.m_print_version = true;
                         break;
 
-                    case 'c':
-                        m_option_data.m_crash_log = optarg;
+                    case 'P':
+                        m_option_data.m_print_python_path = true;
                         break;
 
+                    case 'c':
+                        {
+                            SBFileSpec file(optarg);
+                            if (file.Exists())
+                            {
+                                m_option_data.m_core_file = optarg;
+                            }
+                            else
+                                error.SetErrorStringWithFormat("file specified in --core (-c) option doesn't exist: '%s'", optarg);
+                        }
+                        break;
+                    
                     case 'e':
                         m_option_data.m_use_external_editor = true;
                         break;
@@ -599,6 +623,10 @@ Driver::ParseArgs (int argc, const char
                         m_debugger.SkipAppInitFiles (true);
                         break;
 
+                    case 'o':
+                        m_debugger.SetUseColor (false);
+                        break;
+
                     case 'f':
                         {
                             SBFileSpec file(optarg);
@@ -691,9 +719,23 @@ Driver::ParseArgs (int argc, const char
         ::fprintf (out_fh, "%s\n", m_debugger.GetVersionString());
         exit = true;
     }
-    else if (! m_option_data.m_crash_log.empty())
+    else if (m_option_data.m_print_python_path)
     {
-        // Handle crash log stuff here.
+        SBFileSpec python_file_spec = SBHostOS::GetLLDBPythonPath();
+        if (python_file_spec.IsValid())
+        {
+            char python_path[PATH_MAX];
+            size_t num_chars = python_file_spec.GetPath(python_path, PATH_MAX);
+            if (num_chars < PATH_MAX)
+            {
+                ::fprintf (out_fh, "%s\n", python_path);
+            }
+            else
+                ::fprintf (out_fh, "<PATH TOO LONG>\n");
+        }
+        else
+            ::fprintf (out_fh, "<COULD NOT FIND PATH>\n");
+        exit = true;
     }
     else if (m_option_data.m_process_name.empty() && m_option_data.m_process_pid == LLDB_INVALID_PROCESS_ID)
     {
@@ -703,7 +745,7 @@ Driver::ParseArgs (int argc, const char
         // are arguments for the inferior program. If no file was specified with
         // -f, then what is left is the program name followed by any arguments.
 
-        // Skip any options we consumed with getopt_long
+        // Skip any options we consumed with getopt_long_only
         argc -= optind;
         argv += optind;
 
@@ -720,7 +762,7 @@ Driver::ParseArgs (int argc, const char
     }
     else
     {
-        // Skip any options we consumed with getopt_long
+        // Skip any options we consumed with getopt_long_only
         argc -= optind;
         //argv += optind; // Commented out to keep static analyzer happy
 
@@ -740,7 +782,7 @@ Driver::GetProcessSTDOUT ()
     size_t total_bytes = 0;
     while ((len = m_debugger.GetSelectedTarget().GetProcess().GetSTDOUT (stdio_buffer, sizeof (stdio_buffer))) > 0)
     {
-        m_io_channel_ap->OutWrite (stdio_buffer, len, ASYNC);
+        m_io_channel_ap->OutWrite (stdio_buffer, len, NO_ASYNC);
         total_bytes += len;
     }
     return total_bytes;
@@ -755,7 +797,7 @@ Driver::GetProcessSTDERR ()
     size_t total_bytes = 0;
     while ((len = m_debugger.GetSelectedTarget().GetProcess().GetSTDERR (stdio_buffer, sizeof (stdio_buffer))) > 0)
     {
-        m_io_channel_ap->ErrWrite (stdio_buffer, len, ASYNC);
+        m_io_channel_ap->ErrWrite (stdio_buffer, len, NO_ASYNC);
         total_bytes += len;
     }
     return total_bytes;
@@ -788,7 +830,6 @@ Driver::UpdateSelectedThread ()
                 StopReason thread_stop_reason = thread.GetStopReason();
                 switch (thread_stop_reason)
                 {
-                default:
                 case eStopReasonInvalid:
                 case eStopReasonNone:
                     break;
@@ -798,6 +839,8 @@ Driver::UpdateSelectedThread ()
                 case eStopReasonWatchpoint:
                 case eStopReasonSignal:
                 case eStopReasonException:
+                case eStopReasonExec:
+                case eStopReasonThreadExiting:
                     if (!other_thread.IsValid())
                         other_thread = thread;
                     break;
@@ -852,7 +895,7 @@ Driver::HandleBreakpointEvent (const SBE
             SBBreakpoint breakpoint = SBBreakpoint::GetBreakpointFromEvent(event);
             int message_len = ::snprintf (message, sizeof(message), "%d location%s added to breakpoint %d\n", 
                                           num_new_locations,
-                                          num_new_locations == 1 ? " " : "s ",
+                                          num_new_locations == 1 ? "" : "s",
                                           breakpoint.GetID());
             m_io_channel_ap->OutWrite(message, message_len, ASYNC);
         }
@@ -912,7 +955,7 @@ Driver::HandleProcessEvent (const SBEven
         case eStateDetached:
             {
                 char message[1024];
-                int message_len = ::snprintf (message, sizeof(message), "Process %llu %s\n", process.GetProcessID(),
+                int message_len = ::snprintf (message, sizeof(message), "Process %" PRIu64 " %s\n", process.GetProcessID(),
                                               m_debugger.StateAsCString (event_state));
                 m_io_channel_ap->OutWrite(message, message_len, ASYNC);
             }
@@ -937,11 +980,32 @@ Driver::HandleProcessEvent (const SBEven
             // Make sure the program hasn't been auto-restarted:
             if (SBProcess::GetRestartedFromEvent (event))
             {
+                size_t num_reasons = SBProcess::GetNumRestartedReasonsFromEvent(event);
+                if (num_reasons > 0)
+                {
                 // FIXME: Do we want to report this, or would that just be annoyingly chatty?
-                char message[1024];
-                int message_len = ::snprintf (message, sizeof(message), "Process %llu stopped and was programmatically restarted.\n",
+                    if (num_reasons == 1)
+                    {
+                        char message[1024];
+                        const char *reason = SBProcess::GetRestartedReasonAtIndexFromEvent (event, 0);
+                        int message_len = ::snprintf (message, sizeof(message), "Process %" PRIu64 " stopped and restarted: %s\n",
+                                              process.GetProcessID(), reason ? reason : "<UNKNOWN REASON>");
+                        m_io_channel_ap->OutWrite(message, message_len, ASYNC);
+                    }
+                    else
+                    {
+                        char message[1024];
+                        int message_len = ::snprintf (message, sizeof(message), "Process %" PRIu64 " stopped and restarted, reasons:\n",
                                               process.GetProcessID());
-                m_io_channel_ap->OutWrite(message, message_len, ASYNC);
+                        m_io_channel_ap->OutWrite(message, message_len, ASYNC);
+                        for (size_t i = 0; i < num_reasons; i++)
+                        {
+                            const char *reason = SBProcess::GetRestartedReasonAtIndexFromEvent (event, i);
+                            int message_len = ::snprintf(message, sizeof(message), "\t%s\n", reason ? reason : "<UNKNOWN REASON>");
+                            m_io_channel_ap->OutWrite(message, message_len, ASYNC);
+                        }
+                    }
+                }
             }
             else
             {
@@ -971,6 +1035,26 @@ Driver::HandleProcessEvent (const SBEven
     }
 }
 
+void
+Driver::HandleThreadEvent (const SBEvent &event)
+{
+    // At present the only thread event we handle is the Frame Changed event, and all we do for that is just
+    // reprint the thread status for that thread.
+    using namespace lldb;
+    const uint32_t event_type = event.GetType();
+    if (event_type == SBThread::eBroadcastBitStackChanged
+        || event_type == SBThread::eBroadcastBitThreadSelected)
+    {
+        SBThread thread = SBThread::GetThreadFromEvent (event);
+        if (thread.IsValid())
+        {
+            SBStream out_stream;
+            thread.GetStatus(out_stream);
+            m_io_channel_ap->OutWrite (out_stream.GetData (), out_stream.GetSize (), ASYNC);
+        }
+    }
+}
+
 //  This function handles events broadcast by the IOChannel (HasInput, UserInterrupt, or ThreadShouldExit).
 
 bool
@@ -992,13 +1076,30 @@ Driver::HandleIOEvent (const SBEvent &ev
         
         // We don't want the result to bypass the OutWrite function in IOChannel, as this can result in odd
         // output orderings and problems with the prompt.
+        
+        // Note that we are in the process of executing a command
+        m_executing_user_command = true;
+
         m_debugger.GetCommandInterpreter().HandleCommand (command_string, result, true);
 
-        if (result.GetOutputSize() > 0)
-            m_io_channel_ap->OutWrite (result.GetOutput(), result.GetOutputSize(), NO_ASYNC);
-            
-        if (result.GetErrorSize() > 0)
-            m_io_channel_ap->OutWrite (result.GetError(), result.GetErrorSize(), NO_ASYNC);
+        // Note that we are back from executing a user command
+        m_executing_user_command = false;
+
+        // Display any STDOUT/STDERR _prior_ to emitting the command result text
+        GetProcessSTDOUT ();
+        GetProcessSTDERR ();
+
+        const bool only_if_no_immediate = true;
+
+        // Now emit the command output text from the command we just executed
+        const size_t output_size = result.GetOutputSize();
+        if (output_size > 0)
+            m_io_channel_ap->OutWrite (result.GetOutput(only_if_no_immediate), output_size, NO_ASYNC);
+
+        // Now emit the command error text from the command we just executed
+        const size_t error_size = result.GetErrorSize();
+        if (error_size > 0)
+            m_io_channel_ap->OutWrite (result.GetError(only_if_no_immediate), error_size, NO_ASYNC);
 
         // We are done getting and running our command, we can now clear the
         // m_waiting_for_command so we can get another one.
@@ -1066,7 +1167,8 @@ Driver::EditLineInputReaderCallback
         break;
 
     case eInputReaderReactivate:
-        driver->ReadyForCommand();
+        if (driver->m_executing_user_command == false)
+            driver->ReadyForCommand();
         break;
 
     case eInputReaderDeactivate:
@@ -1261,12 +1363,16 @@ Driver::MainLoop ()
     m_debugger.PushInputReader (m_editline_reader);
 
     SBListener listener(m_debugger.GetListener());
-    listener.StartListeningForEventClass(m_debugger, 
-                                         SBTarget::GetBroadcasterClassName(), 
-                                         SBTarget::eBroadcastBitBreakpointChanged);
     if (listener.IsValid())
     {
 
+        listener.StartListeningForEventClass(m_debugger, 
+                                         SBTarget::GetBroadcasterClassName(), 
+                                         SBTarget::eBroadcastBitBreakpointChanged);
+        listener.StartListeningForEventClass(m_debugger, 
+                                         SBThread::GetBroadcasterClassName(),
+                                         SBThread::eBroadcastBitStackChanged |
+                                         SBThread::eBroadcastBitThreadSelected);
         listener.StartListeningForEvents (*m_io_channel_ap,
                                           IOChannel::eBroadcastBitHasUserInput |
                                           IOChannel::eBroadcastBitUserInterrupt |
@@ -1296,6 +1402,7 @@ Driver::MainLoop ()
             // Now we handle options we got from the command line
             char command_string[PATH_MAX * 2];
             const size_t num_source_command_files = GetNumSourceCommandFiles();
+            const bool dump_stream_only_if_no_immediate = true;
             if (num_source_command_files > 0)
             {
                 for (size_t i=0; i < num_source_command_files; ++i)
@@ -1308,9 +1415,27 @@ Driver::MainLoop ()
                         result.PutError (m_debugger.GetErrorFileHandle());
                         result.PutOutput (m_debugger.GetOutputFileHandle());
                     }
+                    
+                    // if the command sourcing generated an error - dump the result object
+                    if (result.Succeeded() == false)
+                    {
+                        const size_t output_size = result.GetOutputSize();
+                        if (output_size > 0)
+                            m_io_channel_ap->OutWrite (result.GetOutput(dump_stream_only_if_no_immediate), output_size, NO_ASYNC);
+                        const size_t error_size = result.GetErrorSize();
+                        if (error_size > 0)
+                            m_io_channel_ap->OutWrite (result.GetError(dump_stream_only_if_no_immediate), error_size, NO_ASYNC);
+                    }
+                    
+                    result.Clear();
                 }
             }
 
+            // Was there a core file specified?
+            std::string core_file_spec("");
+            if (!m_option_data.m_core_file.empty())
+                core_file_spec.append("--core ").append(m_option_data.m_core_file);
+
             const size_t num_args = m_option_data.m_args.size();
             if (num_args > 0)
             {
@@ -1318,13 +1443,15 @@ Driver::MainLoop ()
                 if (m_debugger.GetDefaultArchitecture (arch_name, sizeof (arch_name)))
                     ::snprintf (command_string, 
                                 sizeof (command_string), 
-                                "target create --arch=%s \"%s\"", 
+                                "target create --arch=%s %s \"%s\"", 
                                 arch_name,
+                                core_file_spec.c_str(),
                                 m_option_data.m_args[0].c_str());
                 else
                     ::snprintf (command_string, 
                                 sizeof(command_string), 
-                                "target create \"%s\"", 
+                                "target create %s \"%s\"", 
+                                core_file_spec.c_str(),
                                 m_option_data.m_args[0].c_str());
 
                 m_debugger.HandleCommand (command_string);
@@ -1343,6 +1470,14 @@ Driver::MainLoop ()
                     }
                 }
             }
+            else if (!core_file_spec.empty())
+            {
+                ::snprintf (command_string, 
+                            sizeof(command_string), 
+                            "target create %s", 
+                            core_file_spec.c_str());
+                m_debugger.HandleCommand (command_string);;
+            }
 
             // Now that all option parsing is done, we try and parse the .lldbinit
             // file in the current working directory
@@ -1373,7 +1508,7 @@ Driver::MainLoop ()
                 {
                     command_str.append("-p ");
                     char pid_buffer[32];
-                    ::snprintf (pid_buffer, sizeof(pid_buffer), "%llu", m_option_data.m_process_pid);
+                    ::snprintf (pid_buffer, sizeof(pid_buffer), "%" PRIu64, m_option_data.m_process_pid);
                     command_str.append(pid_buffer);
                 }
                 else 
@@ -1430,6 +1565,10 @@ Driver::MainLoop ()
                         {
                             HandleBreakpointEvent (event);
                         }
+                        else if (SBThread::EventIsThreadEvent (event))
+                        {
+                            HandleThreadEvent (event);
+                        }
                         else if (event.BroadcasterMatchesRef (sb_interpreter.GetBroadcaster()))
                         {
                             // TODO: deprecate the eBroadcastBitQuitCommandReceived event
@@ -1454,9 +1593,15 @@ Driver::MainLoop ()
                 }
             }
 
-            editline_output_pty.CloseMasterFileDescriptor();
+            master_out_comm.SetReadThreadBytesReceivedCallback(NULL, NULL);
             master_out_comm.Disconnect();
+            master_out_comm.ReadThreadStop();
+
+            out_comm_2.SetReadThreadBytesReceivedCallback(NULL, NULL);
             out_comm_2.Disconnect();
+            out_comm_2.ReadThreadStop();
+
+            editline_output_pty.CloseMasterFileDescriptor();
             reset_stdin_termios();
             fclose (stdin);
 
@@ -1491,6 +1636,15 @@ Driver::ReadyForCommand ()
     }
 }
 
+void
+Driver::ResizeWindow (unsigned short col)
+{
+    GetDebugger().SetTerminalWidth (col);
+    if (m_io_channel_ap.get() != NULL)
+    {
+        m_io_channel_ap->ElResize();
+    }
+}
 
 void
 sigwinch_handler (int signo)
@@ -1501,7 +1655,7 @@ sigwinch_handler (int signo)
     {
         if ((window_size.ws_col > 0) && g_driver != NULL)
         {
-            g_driver->GetDebugger().SetTerminalWidth (window_size.ws_col);
+            g_driver->ResizeWindow (window_size.ws_col);
         }
     }
 }
@@ -1524,6 +1678,24 @@ sigint_handler (int signo)
 	exit (signo);
 }
 
+void
+sigtstp_handler (int signo)
+{
+    g_driver->GetDebugger().SaveInputTerminalState();
+    signal (signo, SIG_DFL);
+    kill (getpid(), signo);
+    signal (signo, sigtstp_handler);
+}
+
+void
+sigcont_handler (int signo)
+{
+    g_driver->GetDebugger().RestoreInputTerminalState();
+    signal (signo, SIG_DFL);
+    kill (getpid(), signo);
+    signal (signo, sigcont_handler);
+}
+
 int
 main (int argc, char const *argv[], const char *envp[])
 {
@@ -1534,6 +1706,8 @@ main (int argc, char const *argv[], cons
     signal (SIGPIPE, SIG_IGN);
     signal (SIGWINCH, sigwinch_handler);
     signal (SIGINT, sigint_handler);
+    signal (SIGTSTP, sigtstp_handler);
+    signal (SIGCONT, sigcont_handler);
 
     // Create a scope for driver so that the driver object will destroy itself
     // before SBDebugger::Terminate() is called.

Modified: lldb/branches/lldb-platform-work/tools/driver/Driver.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/driver/Driver.h?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/driver/Driver.h (original)
+++ lldb/branches/lldb-platform-work/tools/driver/Driver.h Thu Jun  6 19:06:43 2013
@@ -65,6 +65,9 @@ public:
     void
     HandleBreakpointEvent (const lldb::SBEvent &event);
 
+    void
+    HandleThreadEvent (const lldb::SBEvent &event);
+
     lldb::SBError
     ParseArgs (int argc, const char *argv[], FILE *out_fh, bool &do_exit);
 
@@ -103,10 +106,12 @@ public:
 
         std::vector<std::string> m_args;
         lldb::ScriptLanguage m_script_lang;
+        std::string m_core_file;
         std::string m_crash_log;
         std::vector<std::string> m_source_command_files;
         bool m_debug_mode;
         bool m_print_version;
+        bool m_print_python_path;
         bool m_print_help;
         bool m_wait_for;
         std::string m_process_name;
@@ -146,14 +151,18 @@ public:
     {
         m_done = true;
     }
+    
+    void
+    ResizeWindow (unsigned short col);
 
 private:
     lldb::SBDebugger m_debugger;
     lldb_utility::PseudoTerminal m_editline_pty;
     FILE *m_editline_slave_fh;
     lldb::SBInputReader m_editline_reader;
-    std::auto_ptr<IOChannel> m_io_channel_ap;
+    std::unique_ptr<IOChannel> m_io_channel_ap;
     OptionData m_option_data;
+    bool m_executing_user_command;
     bool m_waiting_for_command;
     bool m_done;
 

Modified: lldb/branches/lldb-platform-work/tools/driver/IOChannel.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/driver/IOChannel.cpp?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/driver/IOChannel.cpp (original)
+++ lldb/branches/lldb-platform-work/tools/driver/IOChannel.cpp Thu Jun  6 19:06:43 2013
@@ -90,6 +90,12 @@ IOChannel::ElCompletionFn (EditLine *e,
     }
 }
 
+void
+IOChannel::ElResize()
+{
+    el_resize(m_edit_line);
+}
+
 unsigned char
 IOChannel::HandleCompletion (EditLine *e, int ch)
 {
@@ -323,9 +329,10 @@ IOChannel::LibeditOutputBytesReceived (v
     }
 }
 
-bool
+IOChannel::LibeditGetInputResult
 IOChannel::LibeditGetInput (std::string &new_line)
 {
+    IOChannel::LibeditGetInputResult retval = IOChannel::eLibeditGetInputResultUnknown;
     if (m_edit_line != NULL)
     {
         int line_len = 0;
@@ -343,6 +350,7 @@ IOChannel::LibeditGetInput (std::string
 
         if (line)
         {
+            retval = IOChannel::eLibeditGetInputValid;
             // strip any newlines off the end of the string...
             while (line_len > 0 && (line[line_len - 1] == '\n' || line[line_len - 1] == '\r'))
                 --line_len;
@@ -353,17 +361,22 @@ IOChannel::LibeditGetInput (std::string
             }
             else
             {
+                retval = IOChannel::eLibeditGetInputEmpty;
                 // Someone just hit ENTER, return the empty string
                 new_line.clear();
             }
             // Return true to indicate success even if a string is empty
-            return true;
+            return retval;
+        }
+        else
+        {
+            retval = (line_len == 0 ? IOChannel::eLibeditGetInputEOF : IOChannel::eLibeditGetInputResultError);
         }
     }
     // Return false to indicate failure. This can happen when the file handle
     // is closed (EOF).
     new_line.clear();
-    return false;
+    return retval;
 }
 
 void *
@@ -416,9 +429,17 @@ IOChannel::Run ()
 
                     if (CommandQueueIsEmpty())
                     {
-                        if (LibeditGetInput(line) == false)
+                        IOChannel::LibeditGetInputResult getline_result = LibeditGetInput(line);
+                        if (getline_result == IOChannel::eLibeditGetInputEOF)
+                        {
+                            // EOF occurred
+                            // pretend that a quit was typed so the user gets a potential
+                            // chance to confirm
+                            line.assign("quit");
+                        }
+                        else if (getline_result == IOChannel::eLibeditGetInputResultError || getline_result == IOChannel::eLibeditGetInputResultUnknown)
                         {
-                            // EOF or some other file error occurred
+                            // some random error occurred, exit and don't ask because the state might be corrupt
                             done = true;
                             continue;
                         }
@@ -472,7 +493,7 @@ IOChannel::Run ()
     }
     BroadcastEventByType (IOChannel::eBroadcastBitThreadDidExit);
     m_driver = NULL;
-    m_read_thread = NULL;
+    m_read_thread = 0;
 }
 
 bool
@@ -528,7 +549,7 @@ IOChannel::RefreshPrompt ()
 void
 IOChannel::OutWrite (const char *buffer, size_t len, bool asynchronous)
 {
-    if (len == 0)
+    if (len == 0 || buffer == NULL)
         return;
 
     // We're in the process of exiting -- IOChannel::Run() has already completed
@@ -552,7 +573,7 @@ IOChannel::OutWrite (const char *buffer,
 void
 IOChannel::ErrWrite (const char *buffer, size_t len, bool asynchronous)
 {
-    if (len == 0)
+    if (len == 0 || buffer == NULL)
         return;
 
     // Use the mutex to make sure OutWrite and ErrWrite do not interfere with each other's output.

Modified: lldb/branches/lldb-platform-work/tools/driver/IOChannel.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/driver/IOChannel.h?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/driver/IOChannel.h (original)
+++ lldb/branches/lldb-platform-work/tools/driver/IOChannel.h Thu Jun  6 19:06:43 2013
@@ -38,6 +38,15 @@ public:
         eBroadcastBitsSTDIN           = (1 << 7),
         eAllEventBits                 = 0xffffffff
     };
+    
+    enum LibeditGetInputResult
+    {
+        eLibeditGetInputEOF = 0,
+        eLibeditGetInputValid = 1,
+        eLibeditGetInputEmpty = 2,
+        eLibeditGetInputResultError = 4,
+        eLibeditGetInputResultUnknown = 0xffffffff
+    };
 
     IOChannel (FILE *editline_in,
                FILE *editline_out,
@@ -66,7 +75,7 @@ public:
     void
     ErrWrite (const char *buffer, size_t len, bool asynchronous);
 
-    bool
+    LibeditGetInputResult
     LibeditGetInput (std::string &);
     
     static void
@@ -104,6 +113,9 @@ public:
 
     static unsigned char 
     ElCompletionFn (EditLine *e, int ch);
+    
+    void
+    ElResize();
 
 protected:
 

Modified: lldb/branches/lldb-platform-work/tools/driver/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/driver/Makefile?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/driver/Makefile (original)
+++ lldb/branches/lldb-platform-work/tools/driver/Makefile Thu Jun  6 19:06:43 2013
@@ -10,6 +10,8 @@ LLDB_LEVEL := ../..
 
 TOOLNAME = lldb
 
+NO_PEDANTIC = 1
+
 LLVMLibsOptions += -ledit -llldb -llldbUtility
 
 include $(LLDB_LEVEL)/Makefile

Modified: lldb/branches/lldb-platform-work/tools/install-headers/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/install-headers/Makefile?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/install-headers/Makefile (original)
+++ lldb/branches/lldb-platform-work/tools/install-headers/Makefile Thu Jun  6 19:06:43 2013
@@ -7,11 +7,17 @@ install:
 clean:
 	echo "clean (doing nothing)"
 
+LLDB_VERSION=`echo ${CURRENT_PROJECT_VERSION} | /usr/bin/sed -E 's/^([0-9]+).([0-9]+).([0-9]+)(.[0-9]+)?$/\1/g'`
+LLDB_REVISION=`echo ${CURRENT_PROJECT_VERSION} | /usr/bin/sed -E 's/^([0-9]+).([0-9]+).([0-9]+)(.[0-9]+)?$/\3/g'`
+LLDB_VERSION_STRING=`echo ${CURRENT_PROJECT_VERSION}`
+
 installhdrs:
 	cd "${TARGET_BUILD_DIR}/${LLDB_FRAMEWORK_INSTALL_DIR}/LLDB.framework/Headers" ;\
 	for file in *.h ;\
 	do \
 		/usr/bin/sed -i '' 's/\(#include\)[ ]*"lldb\/\(API\/\)\{0,1\}\(.*\)"/\1 <LLDB\/\3>/1' "$$file" ;\
 		/usr/bin/sed -i '' 's|<LLDB/Utility|<LLDB|' "$$file" ;\
-		/usr/bin/sed -i '' "s|//#define LLDB_VERSION|#define LLDB_VERSION ${CURRENT_PROJECT_VERSION} |" "$$file" ;\
+		/usr/bin/sed -i '' "s|//#define LLDB_VERSION$|#define LLDB_VERSION $(LLDB_VERSION) |" "$$file" ;\
+		/usr/bin/sed -i '' "s|//#define LLDB_REVISION|#define LLDB_REVISION $(LLDB_REVISION) |" "$$file" ;\
+		/usr/bin/sed -i '' "s|//#define LLDB_VERSION_STRING|#define LLDB_VERSION_STRING \"$(LLDB_VERSION_STRING)\" |" "$$file" ;\
 	done

Modified: lldb/branches/lldb-platform-work/tools/lldb-platform/lldb-platform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/lldb-platform/lldb-platform.cpp?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/lldb-platform/lldb-platform.cpp (original)
+++ lldb/branches/lldb-platform-work/tools/lldb-platform/lldb-platform.cpp Thu Jun  6 19:06:43 2013
@@ -7,6 +7,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "lldb/lldb-python.h"
+
 // C Includes
 #include <errno.h>
 #include <getopt.h>
@@ -30,7 +32,7 @@ using namespace lldb;
 using namespace lldb_private;
 
 //----------------------------------------------------------------------
-// option descriptors for getopt_long()
+// option descriptors for getopt_long_only()
 //----------------------------------------------------------------------
 
 int g_debug = 0;
@@ -133,7 +135,7 @@ main (int argc, char *argv[])
 //        return 3;
 //    }
     
-    while ((ch = getopt_long(argc, argv, "l:f:L:", g_long_options, &long_option_index)) != -1)
+    while ((ch = getopt_long_only(argc, argv, "l:f:L:", g_long_options, &long_option_index)) != -1)
     {
 //        DNBLogDebug("option: ch == %c (0x%2.2x) --%s%c%s\n",
 //                    ch, (uint8_t)ch,
@@ -201,7 +203,7 @@ main (int argc, char *argv[])
         ProcessGDBRemoteLog::EnableLog (log_stream_sp, 0,log_args.GetConstArgumentVector(), log_stream_sp.get());
     }
 
-    // Skip any options we consumed with getopt_long
+    // Skip any options we consumed with getopt_long_only
     argc -= optind;
     argv += optind;
 
@@ -210,49 +212,53 @@ main (int argc, char *argv[])
         GDBRemoteCommunicationServer gdb_server (true);
         if (!listen_host_port.empty())
         {
-            for (int j = 0; j < listen_host_port.size(); j++)
-            {
-                char c = listen_host_port[j];
-                if (c > '9' || c < '0')
-                    printf("WARNING: passing anything but a number as argument to --listen will most probably make connecting impossible.\n");
-            }
-            std::auto_ptr<ConnectionFileDescriptor> conn_ap(new ConnectionFileDescriptor());
+            std::unique_ptr<ConnectionFileDescriptor> conn_ap(new ConnectionFileDescriptor());
             if (conn_ap.get())
             {
-                std::string connect_url ("listen://");
-                connect_url.append(listen_host_port.c_str());
-
-                printf ("Listening for a connection on %s...\n", listen_host_port.c_str());
-                if (conn_ap->Connect(connect_url.c_str(), &error) == eConnectionStatusSuccess)
+                for (int j = 0; j < listen_host_port.size(); j++)
+                {
+                    char c = listen_host_port[j];
+                    if (c > '9' || c < '0')
+                        printf("WARNING: passing anything but a number as argument to --listen will most probably make connecting impossible.\n");
+                }
+                std::auto_ptr<ConnectionFileDescriptor> conn_ap(new ConnectionFileDescriptor());
+                if (conn_ap.get())
                 {
-                    printf ("Connection established.\n");
-                    gdb_server.SetConnection (conn_ap.release());
+                    std::string connect_url ("listen://");
+                    connect_url.append(listen_host_port.c_str());
+
+                    printf ("Listening for a connection on %s...\n", listen_host_port.c_str());
+                    if (conn_ap->Connect(connect_url.c_str(), &error) == eConnectionStatusSuccess)
+                    {
+                        printf ("Connection established.\n");
+                        gdb_server.SetConnection (conn_ap.release());
+                    }
                 }
             }
-        }
 
-        if (gdb_server.IsConnected())
-        {
-            // After we connected, we need to get an initial ack from...
-            if (gdb_server.HandshakeWithClient(&error))
+            if (gdb_server.IsConnected())
             {
-                bool interrupt = false;
-                bool done = false;
-                while (!interrupt && !done)
+                // After we connected, we need to get an initial ack from...
+                if (gdb_server.HandshakeWithClient(&error))
                 {
-                    if (!gdb_server.GetPacketAndSendResponse (UINT32_MAX, error, interrupt, done))
-                        break;
+                    bool interrupt = false;
+                    bool done = false;
+                    while (!interrupt && !done)
+                    {
+                        if (!gdb_server.GetPacketAndSendResponse (UINT32_MAX, error, interrupt, done))
+                            break;
+                    }
+                    
+                    if (error.Fail())
+                    {
+                        fprintf(stderr, "error: %s\n", error.AsCString());
+                    }
                 }
-                
-                if (error.Fail())
+                else
                 {
-                    fprintf(stderr, "error: %s\n", error.AsCString());
+                    fprintf(stderr, "error: handshake with client failed\n");
                 }
             }
-            else
-            {
-                fprintf(stderr, "error: handshake with client failed\n");
-            }
         }
     } while (g_stay_alive);
 

Copied: lldb/branches/lldb-platform-work/utils/vim-lldb/doc/lldb.txt (from r182522, lldb/trunk/utils/vim-lldb/doc/lldb.txt)
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/utils/vim-lldb/doc/lldb.txt?p2=lldb/branches/lldb-platform-work/utils/vim-lldb/doc/lldb.txt&p1=lldb/trunk/utils/vim-lldb/doc/lldb.txt&r1=182522&r2=183468&rev=183468&view=diff
==============================================================================
--- lldb/trunk/utils/vim-lldb/doc/lldb.txt (original)
+++ lldb/branches/lldb-platform-work/utils/vim-lldb/doc/lldb.txt Thu Jun  6 19:06:43 2013
@@ -37,10 +37,10 @@ Possible window name arguments to the Lh
     * locals
     * registers
     * threads
-                                                lldb-:Lattach
+                                                *lldb-:Lattach*
 :Lattach <process-name> Attach to a process by name.
 
-                                                lldb-:Ldetach
+                                                *lldb-:Ldetach*
 :Ldetach                Detach from the current process.
 
                                                 *lldb-:Ltarget*
@@ -90,6 +90,13 @@ Possible window name arguments to the Lh
                         command is invoked. If no arguments are provided,
                         a breakpoint at the location under the cursor.
 
+                                                *lldb-:Lprint*
+                                                *lldb-:Lpo*
+                                                *lldb-:LpO*
+:Lprint <expr>          Aliases to the lldb print and po commands. Cursor
+:Lpo <expr>             word (cursor WORD for LpO) will be used when 
+:LpO <expr>             expression omitted.
+
 MAPPINGS                                        *lldb-mappings*
 
 On Mac OS X (under MacVim) , the following key mappings are available:

Copied: lldb/branches/lldb-platform-work/utils/vim-lldb/plugin/lldb.vim (from r182522, lldb/trunk/utils/vim-lldb/plugin/lldb.vim)
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/utils/vim-lldb/plugin/lldb.vim?p2=lldb/branches/lldb-platform-work/utils/vim-lldb/plugin/lldb.vim&p1=lldb/trunk/utils/vim-lldb/plugin/lldb.vim&r1=182522&r2=183468&rev=183468&view=diff
==============================================================================
--- lldb/trunk/utils/vim-lldb/plugin/lldb.vim (original)
+++ lldb/branches/lldb-platform-work/utils/vim-lldb/plugin/lldb.vim Thu Jun  6 19:06:43 2013
@@ -82,7 +82,9 @@ function! s:InitLldbPlugin()
   command -complete=custom,s:CompleteCommand -nargs=* Lwatchpoint        python ctrl.doCommand('watchpoint', '<args>')
  
   " Convenience (shortcut) LLDB commands
-  command -complete=custom,s:CompleteCommand -nargs=* Lprint             python ctrl.doCommand('print', '<args>')
+  command -complete=custom,s:CompleteCommand -nargs=* Lprint             python ctrl.doCommand('print', vim.eval("s:CursorWord('<args>')"))
+  command -complete=custom,s:CompleteCommand -nargs=* Lpo                python ctrl.doCommand('po', vim.eval("s:CursorWord('<args>')"))
+  command -complete=custom,s:CompleteCommand -nargs=* LpO                python ctrl.doCommand('po', vim.eval("s:CursorWORD('<args>')"))
   command -complete=custom,s:CompleteCommand -nargs=* Lbt                python ctrl.doCommand('bt', '<args>')
 
   " Frame/Thread-Selection (commands that also do an Uupdate but do not
@@ -135,4 +137,15 @@ returnCompleteWindow(a, l, p)
 EOF
 endfunction()
 
+" Returns cword if search term is empty
+function! s:CursorWord(term) 
+  return empty(a:term) ? expand('<cword>') : a:term 
+endfunction()
+
+" Returns cleaned cWORD if search term is empty
+function! s:CursorWORD(term) 
+  " Will strip all non-alphabetic characters from both sides
+  return empty(a:term) ?  substitute(expand('<cWORD>'), '^\A*\(.\{-}\)\A*$', '\1', '') : a:term 
+endfunction()
+
 call s:InitLldbPlugin()

Copied: lldb/branches/lldb-platform-work/utils/vim-lldb/python-vim-lldb/lldb_controller.py (from r182522, lldb/trunk/utils/vim-lldb/python-vim-lldb/lldb_controller.py)
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/utils/vim-lldb/python-vim-lldb/lldb_controller.py?p2=lldb/branches/lldb-platform-work/utils/vim-lldb/python-vim-lldb/lldb_controller.py&p1=lldb/trunk/utils/vim-lldb/python-vim-lldb/lldb_controller.py&r1=182522&r2=183468&rev=183468&view=diff
==============================================================================
--- lldb/trunk/utils/vim-lldb/python-vim-lldb/lldb_controller.py (original)
+++ lldb/branches/lldb-platform-work/utils/vim-lldb/python-vim-lldb/lldb_controller.py Thu Jun  6 19:06:43 2013
@@ -153,11 +153,7 @@ class LLDBController(object):
       return
 
     self.ui.activate()
-
-    # attach succeeded, store pid and add some event listeners
     self.pid = self.process.GetProcessID()
-    self.process.GetBroadcaster().AddListener(self.processListener, lldb.SBProcess.eBroadcastBitStateChanged)
-    self.doContinue()
 
     print "Attached to %s (pid=%d)" % (process_name, self.pid)
 
@@ -352,6 +348,10 @@ class LLDBController(object):
             self.processListener.GetNextEvent(event)
             new_state = lldb.SBProcess.GetStateFromEvent(event)
 
+            # continue if stopped after attaching
+            if old_state == lldb.eStateAttaching and new_state == lldb.eStateStopped:
+              self.process.Continue()
+
             # If needed, perform any event-specific behaviour here
             num_events_handled += 1
 

Modified: lldb/branches/lldb-platform-work/www/architecture.html
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/www/architecture.html?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/www/architecture.html (original)
+++ lldb/branches/lldb-platform-work/www/architecture.html Thu Jun  6 19:06:43 2013
@@ -36,6 +36,7 @@
       					<li><a href="#breakpoint">Breakpoint</a></li>
       					<li><a href="#commands">Commands</a></li>
       					<li><a href="#core">Core</a></li>
+      					<li><a href="#dataformatters">DataFormatters</a></li>
        					<li><a href="#expression">Expression</a></li>
        					<li><a href="#host">Host</a></li>
        					<li><a href="#interpreter">Interpreter</a></li>
@@ -59,7 +60,7 @@
      					<li>Classes can't inherit from any other classes.</li>
       					<li>Classes can't contain virtual methods.</li>
        					<li>Classes should be compatible with script bridging utilities like <a href="http://www.swig.org/">swig</a>.</li>
-       					<li>Classes should be lightweight and be backed by a single object pointer, shared pointer or global variable in the lldb_private.</li>
+       					<li>Classes should be lightweight and be backed by a single member. Pointers (or shared pointers) are the preferred choice since they allow changing the contents of the backend without affecting the public object layout.</li>
        					<li>The interface should be as minimal as possible in order to give a complete API.</li>
    				    </ul>
    				    <p>By adhering to these rules we should be able to continue to 
@@ -143,6 +144,23 @@
 				</div>
 				<div class="postfooter"></div>
 			</div>
+			<a name="dataformatters"></a>
+			<div class="post">
+				<h1 class ="postheader">DataFormatters</h1>
+				<div class="postcontent">
+
+				   <p>A collection of classes that implement the data formatters subsystem.</p>
+				<p>The main entry point for interacting with the LLDB data formatters is the DataVisualization class. It provides
+					a relatively stable front-end interface to ask questions of the data formatters regardless of the internal implementation.</p>
+				<p>For people actively maintaining the data formatters subsystem itself, however, the FormatManager class is the relevant point of entry.
+					This class is subject to more frequent changes as the formatters evolve. Currently, it provides a thin caching layer on top of a list of categories
+					that each export a group of formatters.
+					</p>
+				<p>From an end-user perspective, the "type" LLDB command is the point of access to the data formatters. A large group of generally-useful formatters
+					is provided by default and loaded upon debugger startup.
+				</div>
+				<div class="postfooter"></div>
+			</div>
 			<a name="expression"></a>
 			<div class="post">
 				<h1 class ="postheader">Expression</h1>

Modified: lldb/branches/lldb-platform-work/www/build.html
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/www/build.html?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/www/build.html (original)
+++ lldb/branches/lldb-platform-work/www/build.html Thu Jun  6 19:06:43 2013
@@ -17,10 +17,28 @@
   <!--#include virtual="sidebar.incl"-->
   
 		<div id="middle">
+                <h1 class ="postheader">Continuous Integraton</h1>
+                <div class="postcontent">
+                        <p> The following LLVM buildbots build and test LLDB trunk:
+                        <ul>
+                                <li> <a href="http://lab.llvm.org:8011/builders/lldb-x86_64-debian-clang">LLDB Linux x86_64 build with Clang (automake)</a>
+                                <li> <a href="http://lab.llvm.org:8011/builders/lldb-x86_64-linux">LLDB Linux x86_64 build with GCC 4.6 (automake)</a>
+                                <li> <a href="http://lab.llvm.org:8011/builders/lldb-x86_64-darwin11">LLDB Mac OS X x86_64 build with Clang (XCode)</a>
+                        </ul>
+                </div>
+                <div class="postfooter"></div>
     		<div class="post">
     			<h1 class ="postheader">Building LLDB on Mac OS X</h1>
     			<div class="postcontent">
     			    <p>Building on Mac OS X is as easy as downloading the code and building the Xcode project or workspace:</p>
+                </div>
+                <div class="postcontent">
+                    <h2>Preliminaries</h2>
+                    <ul>
+                        <li>XCode 4.3 or newer requires the "Command Line Tools" component (XCode->Preferences->Downloads->Components).</li>
+                        <li>Mac OS X Lion or newer requires installing <a href="http://swig.org">Swig</a>.</li>
+                    </ul>
+                    <h2>Building LLDB</h2>
     			    <ul>
                         <li><a href="download.html">Download</a> the lldb sources.</li>
                         <li>Follow the code signing instructions in <b>lldb/docs/code-signing.txt</b></li>
@@ -45,6 +63,12 @@
                     <li><a href="http://llvm.org/docs/GettingStarted.html">LLVM</a></li>
                     <li><a href="http://clang.llvm.org/get_started.html">Clang</a></li>
                 </ul>
+                <p>Supported compilers for building LLDB on Linux include:</p>
+                <ul>
+                  <li>Clang 3.2</li>
+                  <li><a href="http://gcc.gnu.org">GCC</a> 4.6.2 (later versions should work as well)</li>
+                </ul>
+                <p>It is recommended to use libstdc++ 4.6 (or higher) to build LLDB on Linux, but using libc++ is also known to work.</p>
                 <p>In addition to any dependencies required by LLVM and Clang, LLDB needs a few
                 development packages that may also need to be installed depending on your
                 system.  The current list of dependencies are:</p>
@@ -53,8 +77,21 @@
                     <li><a href="http://www.thrysoee.dk/editline">libedit</a></li>
                     <li><a href="http://www.python.org">Python</a></li>
                 </ul>
-                <p>So for example, on a Fedora system one might say:</p>
+                <p>So for example, on a Fedora system one might run:</p>
                 <code>> yum install swig python-devel libedit-devel</code>
+                <p>On an Ubuntu system one might run:</p>
+                <code>> sudo apt-get install build-essential subversion swig python-dev libedit-dev </code>
+                <p>If you wish to build the optional reference documentation, additional dependencies are required:</p>
+                <ul>
+                  <li> Graphviz (for the 'dot' tool).
+                  <li> doxygen (only if you wish to build the C++ API reference)
+                  <li> epydoc (only if you wish to build the Python API reference)
+                </ul>
+                <p>To install the prerequisites for building the documentation (on Ubuntu) do:</p>
+                <code>
+                  <br>> sudo apt-get install doxygen graphviz
+                  <br>> sudo pip install epydoc
+                </code>
                 <h2 >Building LLDB</h2>
                 <p>We first need to checkout the source trees into the appropriate locations.  Both
                 Clang and LLDB build as subprojects of LLVM.  This means we will be checking out
@@ -82,46 +119,112 @@
                 <br>> svn co http://llvm.org/svn/llvm-project/lldb/trunk lldb
                 </code>
                 
-                <p>In general, LLDB requires specific revisions of both LLVM and Clang in order to
-                build.  This requirement insulates LLDB a bit from the constant development
-                happening in both of these projects.  The required revision can be discovered by
-                consulting the Perl script <tt>$lldb/scripts/build-llvm.pl</tt> and locating the
-                <tt>$llvm_revision</tt> variable.  At the time of this writing, the required revision
-                is <tt>r127682</tt>, so we might check and revert our LLVM and Clang trees to the
-                required state as follows:</p>
-                <code>> grep -m 1 llvm_revision $lldb/scripts/build-llvm.pl
-                  <br>our $llvm_revision = "127682";
-                  <br>> cd $clang
-                  <br>> svn update -r 127682
-                  <br>> cd $llvm
-                  <br>> svn update -r 127682</code>
-                
+                <p>In general, building the LLDB trunk revision requires trunk revisions of both 
+                LLVM and Clang.
                 <p>It is highly recommended that you build the system out of tree.  Create a second
                 build directory and configure the LLVM project tree to your specifications as
-                outlined in LLVM’s <em>Getting Started Guide</em>.  For Linux development the x86
-                backend and JIT compiler should be enabled.  A typical build procedure might be:</p>
+                outlined in LLVM’s <em>Getting Started Guide</em>.  A typical build procedure
+                might be:</p>
                 <code>> cd $llvm/..
                   <br>> mkdir build
                   <br>> cd build
-                  <br>> $llvm/configure --enable-targets=x86 --enable-jit
-                  <br>> make</code>
-                
+                </code>
+                <h2>To build with CMake</h2>
+                <p>Using CMake is documented on the <a href="http://llvm.org/docs/CMake.html">Building LLVM with CMake</a>
+                   page. Building LLDB is possible using one of the following generators:
+                </p>
+                <ul>
+                  <li> Ninja </li>
+                  <li> Unix Makefiles </li>
+                </ul>
+                <h3>Using CMake + Ninja</h3>
+                <p>Ninja is the fastest way to build LLDB! In order to use ninja, you need to have recent versions of CMake and
+                   ninja on your system. To build using ninja:
+                </p>
+                <code>
+                  > cmake -C .. -G Ninja
+                  <br>> ninja lldb
+                  <br>> ninja check-lldb
+                </code>
+                <h3>Using CMake + Unix Makefiles</h3>
+                <p>If you do not have Ninja, you can still use CMake to generate Unix Makefiles that build LLDB:</p>
+                <code>
+                  > cmake -C ..
+                  <br>> make
+                  <br>> make check-lldb
+                </code>
+                <h2>To build with autoconf</h2>
+                <p>If you do not have CMake, it is still possible to build LLDB using the autoconf build system. If you are using
+                   Clang or GCC 4.7+, run:</p>
+                <code>
+                  > $llvm/configure --enable-cxx11
+                  <br>> make </code>
+                <p>Or, if you are using a version of GCC that does not support the <tt>-std=c++11</tt> option:</p>
+                <code>
+                  > $llvm/configure
+                  <br>> make CXXFLAGS=-std=c++0x</code>
+                <p>If you are building with a GCC that isn't the default gcc/g++, like gcc-4.7/g++-4.7</p>
+                <code>
+                  > $llvm/configure --enable-cxx11 CC=gcc-4.7 CXX=g++-4.7
+                  <br>> make CC=gcc-4.7 CXX=g++-4.7</code>
+                <p>If you are running in a system that doesn't have a lot of RAM (less than 4GB), you might want to disable
+                    debug symbols by specifying DEBUG_SYMBOLS=0 when running make. You will know if you need to enable this
+                    because you will fail to link clang (the linker will get a SIGKILL and exit with status 9).</p>
+                <code>
+                    > make DEBUG_SYMBOLS=0</code>
+                <p> To run the LLDB test suite, run:</p>
+                <code>
+                  <br>> make -C tools/lldb/test</code>
                 <p>Note that once both LLVM and Clang have been configured and built it is not
                 necessary to perform a top-level <tt>make</tt> to rebuild changes made only to LLDB.
-                You can build from the <tt>build/tools/lldb</tt> subdirectory as well.</p>
-                
+                You can run <tt>make</tt> from the <tt>build/tools/lldb</tt> subdirectory as well.</p>
+                <p> If you wish to build with libc++ instead of libstdc++ (the default), run configure with the
+                <tt>--enable-libcpp</tt> flag.</p>
+                <p> If you wish to build a release version of LLDB, run configure with the <tt>--enable-optimized</tt> flag.</p>
+
+                <h2>Testing</h2>
+                <p>By default, the <tt>check-lldb</tt> target builds the 64-bit variants of the test programs with the same
+                compiler that was used to build LLDB. It is possible to customize the architecture and compiler by appending -A and
+                -C options respectively to the CMake variable <tt>LLDB_TEST_ARGS</tt>. For example, to test LLDB against 32-bit binaries
+                built with a custom version of clang, do:</p>
+                <code>
+                  <br>> cmake -DLLDB_TEST_ARGS="-A i386 -C /path/to/custom/clang" -G Ninja
+                  <br>> ninja check-lldb
+                </code>
+                <p>Note that multiple -A and -C flags can be specified to <tt>LLDB_TEST_ARGS</tt>.</p>
+                <p>In addition to running all the LLDB test suites with the "check-lldb" CMake target above, it is possible to
+                run individual LLDB tests. For example, to run the test cases defined in TestInferiorCrashing.py, run:</p>
+                <code>
+                  <br>> cd $lldb/test
+                  <br>> python dotest.py --executable <path-to-lldb>  -p TestInferiorCrashing.py
+                </code>
+                <p>In addition to running a test by name, it is also possible to specify a directory path to <tt>dotest.py</tt>
+                in order to run all the tests under that directory. For example, to run all the tests under the
+                'functionalities/data-formatter' directory, run:</p>
+                <code>
+                  <br>> python dotest.py --executable <path-to-lldb> functionalities/data-formatter
+                </code>
+                <p>To dump additional information to <tt>stdout</tt> about how the test harness is driving LLDB, run
+                <tt>dotest.py</tt> with the <tt>-t</tt> flag. Many more options that are available. To see a list of all of them, run:</p>
+                <code>
+                  <br>> python dotest.py -h
+                </code>
+                <h2>Building API reference documentation</h2>
+                <p>LLDB exposes a C++ as well as a Python API. To build the reference documentation for these two APIs, ensure you have
+                the required dependencies installed, and build the <tt>lldb-python-doc</tt> and <tt>lldb-cpp-doc</tt> CMake targets.</p>
+                <p> The output HTML reference documentation can be found in <tt><build-dir>/tools/lldb/docs/</tt>.<p>
                 <h2>Additional Notes</h2>
-                <p>LLDB has a Python scripting capability and supplies it’s own Python module,
-                <tt>lldb.py</tt>, built alongside the <tt>lldb</tt> binary.  Python needs to know where to
-                look for this module when LLDB starts up.  There are two options available:</p>
-                <ol class="arabic">
-                <li>
-                    <p>Keep a copy of <tt>lldb.py</tt> in the current working directory when starting lldb.</p>
-                </li>
-                <li>
-                    <p>Set <tt>PYTHONPATH</tt> to point to the directory holding <tt>lldb.py</tt>.</p>
-                </li>
-                </ol>
+                <p>LLDB has a Python scripting capability and supplies its own Python module named <tt>lldb</tt>.
+                If a script is run inside the command line <tt>lldb</tt> application, the Python module
+                is made available automatically.  However, if a script is to be run by a Python interpreter
+                outside the command line application, the <tt>PYTHONPATH</tt> environment variable can be used
+                to let the Python interpreter find the <tt>lldb</tt> module. 
+                <p>The correct path can be obtained by invoking the command line <tt>lldb</tt> tool with the -P flag:</p>
+                <code>> export PYTHONPATH=`$llvm/build/Debug+Asserts/bin/lldb -P`</code>
+                <p>If you used a different build directory or made a release build, you may need to adjust the
+                above to suit your needs. To test that the lldb Python module
+                is built correctly and is available to the default Python interpreter, run:</p>
+                <code>> python -c 'import lldb'</code></p>
                 </div>
               	<div class="postfooter"></div>
           	</div>
@@ -129,4 +232,4 @@
 	</div>
 </div>
 </body>
-</html>
\ No newline at end of file
+</html>

Modified: lldb/branches/lldb-platform-work/www/index.html
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/www/index.html?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/www/index.html (original)
+++ lldb/branches/lldb-platform-work/www/index.html Thu Jun  6 19:06:43 2013
@@ -92,6 +92,8 @@
 					   	<li>Mac OS X desktop user space debugging for i386 and x86-64</li>
 					   	<li>iOS simulator debugging on i386</li>
 					   	<li>iOS device debugging on ARM</li>
+					   	<li>Linux local user-space debugging for i386 and x86-64</li>
+					   	<li>FreeBSD local user-space debugging for i386 and x86-64</li>
 				    </ul>
 				</div>
 				<div class="postfooter"></div>
@@ -108,8 +110,8 @@
 				        <li>svn co http://llvm.org/svn/llvm-project/lldb/trunk lldb</li>
 				    </ul>
 
-				    <p>Note that LLDB currently only builds out of the box on Mac OS X with
-				        Xcode, but patches to improve portability are definitely welcome.</p>
+				    <p>Note that LLDB generally builds from top-of-trunk on Mac OS X with
+				        Xcode and on Linux (with clang and libstdc++/libc++). </p>
 
 				    <p>Discussions about LLDB should go to the <a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev">lldb-dev</a> mailing
 				        list.  Commit messages for the lldb SVN module are automatically sent to the
@@ -123,4 +125,4 @@
 	</div>
 </div>
 </body>
-</html>
\ No newline at end of file
+</html>

Modified: lldb/branches/lldb-platform-work/www/lldb-gdb.html
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/www/lldb-gdb.html?rev=183468&r1=183467&r2=183468&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/www/lldb-gdb.html (original)
+++ lldb/branches/lldb-platform-work/www/lldb-gdb.html Thu Jun  6 19:06:43 2013
@@ -17,12 +17,14 @@
         <div id="middle">
             <div class="post">
 
-                <h1 class ="postheader">LLDB to GDB Command Map</h1>
+                <h1 class ="postheader">GDB to LLDB Command Map</h1>
                 <div class="post">
 
-                    <p>Below is a table of LLDB commands with the GDB counterparts.
+                    <p>Below is a table of GDB commands with the LLDB counterparts.
                         The built in GDB-compatibility aliases in LLDB are also
-                        listed.</p>
+                        listed.  The full lldb command names are often long, but any
+                        unique short form can be used.  Instead of "<b>breakpoint set</b>",
+                        "<b>br se</b>" is also acceptable.</p>
                 </div>
                 <div class="postfooter"></div>
 
@@ -33,167 +35,228 @@
 
                     <table class="stats" width="620" cellspacing="0">
                     <tr>
-                        <td class="hed" width="50%">LLDB</td>
                         <td class="hed" width="50%">GDB</td>
+                        <td class="hed" width="50%">LLDB</td>
                     </tr>
 
                     <tr><td class="header" colspan="2">Launch a process no arguments.</td></tr>
                         <td class="content">
+                            <b>(gdb)</b> run<br>
+                            <b>(gdb)</b> r
+                        </td>
+                        <td class="content">
                             <b>(lldb)</b> process launch<br>
                             <b>(lldb)</b> run<br>
                             <b>(lldb)</b> r
                         </td>
-                        <td class="content">
-                            <b>(gdb)</b> run<br>
-                            <b>(gdb)</b> r
-                        </td>
                     </tr>
 
 
                     <tr><td class="header" colspan="2">Launch a process with arguments <code><args></code>.</td></tr>
                         <td class="content">
-                            <b>(lldb)</b> process launch -- <args><br>
-                            <b>(lldb)</b> r <args>
-                        </td>
-                        <td class="content">
                             <b>(gdb)</b> run <args><br>
                             <b>(gdb)</b> r <args>
                         </td>
+                        <td class="content">
+                            <b>(lldb)</b> process launch -- <args><br>
+                            <b>(lldb)</b> r <args>
+                        </td>
                     </tr>
 
                     <tr><td class="header" colspan="2">Launch a process for with arguments <b><code>a.out 1 2 3</code></b> without having to supply the args every time.</td></tr>
                         <td class="content">
-                            <b>%</b> lldb -- a.out 1 2 3<br>
-                            <b>(lldb)</b> run<br>
+                            <b>%</b> gdb --args a.out 1 2 3<br>
+                            <b>(gdb)</b> run<br>
                             ...<br>
-                            <b>(lldb)</b> run<br>
+                            <b>(gdb)</b> run<br>
                             ...<br>
                         </td>
                         <td class="content">
-                            <b>%</b> gdb --args a.out 1 2 3<br>
-                            <b>(gdb)</b> run<br>
+                            <b>%</b> lldb -- a.out 1 2 3<br>
+                            <b>(lldb)</b> run<br>
                             ...<br>
-                            <b>(gdb)</b> run<br>
+                            <b>(lldb)</b> run<br>
                             ...<br>
                         </td>
                     </tr>
 
                     <tr><td class="header" colspan="2">Launch a process with arguments in new terminal window (Mac OS X only).</td></tr>
                         <td class="content">
-                            <b>(lldb)</b> process launch --tty -- <args><br>
-                            <b>(lldb)</b> pro la -t -- <args><br>
                         </td>
                         <td class="content">
+                            <b>(lldb)</b> process launch --tty -- <args><br>
+                            <b>(lldb)</b> pro la -t -- <args><br>
                         </td>
                     </tr>
 
                     <tr><td class="header" colspan="2">Launch a process with arguments in existing terminal <cope>/dev/ttys006</code> (Mac OS X only).</td></tr>
                         <td class="content">
+                        </td>
+                        <td class="content">
                             <b>(lldb)</b> process launch --tty=/dev/ttys006 -- <args><br>
                             <b>(lldb)</b> pro la -t/dev/ttys006 -- <args><br>
                         </td>
+                    </tr>
+
+                    <tr><td class="header" colspan="2">Set environment variables for process before launching.</td></tr>
+                        <td class="content">
+                            <b>(gdb)</b> set env DEBUG 1<br>
+                        </td>
                         <td class="content">
+                            <b>(lldb)</b> settings set target.env-vars DEBUG=1<br>
+                            <b>(lldb)</b> set se target.env-vars DEBUG=1<br>
+                            <b>(lldb)</b> env DEBUG=1<br>
+                        </td>
+                    </tr>
+
+                    <tr><td class="header" colspan="2">Set environment variables for process and launch process in one command.</td></tr>
+                        <td class="content">
+                        </td>
+                        <td class="content">
+                            <b>(lldb)</b> process launch -v DEBUG=1<br>
                         </td>
                     </tr>
 
                     <tr><td class="header" colspan="2">Attach to a process with process ID 123.</td></tr>
                     <tr>
                         <td class="content">
-                            <b>(lldb)</b> process attach --pid 123<br>
-                            <b>(lldb)</b> attach -p 123
+                            <b>(gdb)</b> attach 123
                         </td>
                         <td class="content">
-                            <b>(gdb)</b> attach 123
+                            <b>(lldb)</b> process attach --pid 123<br>
+                            <b>(lldb)</b> attach -p 123
                         </td>
                     </tr>
 
                     <tr><td class="header" colspan="2">Attach to a process named "a.out".</td></tr>
                     <tr>
                         <td class="content">
-                            <b>(lldb)</b> process attach --name a.out<br>
-                            <b>(lldb)</b> pro at -n a.out
+                            <b>(gdb)</b> attach a.out
                         </td>
                         <td class="content">
-                            <b>(gdb)</b> attach a.out
+                            <b>(lldb)</b> process attach --name a.out<br>
+                            <b>(lldb)</b> pro at -n a.out
                         </td>
                     </tr>
 
                     <tr><td class="header" colspan="2">Wait for a process named "a.out" to launch and attach.</td></tr>
                     <tr>
                         <td class="content">
+                            <b>(gdb)</b> attach -waitfor a.out
+                        </td>
+                        <td class="content">
                             <b>(lldb)</b> process attach --name a.out --waitfor<br>
                             <b>(lldb)</b> pro at -n a.out -w
                         </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>(gdb)</b> attach -waitfor a.out
+                            <b>(gdb)</b> target remote eorgadd:8000
+                        </td>
+                        <td class="content">
+                            <b>(lldb)</b> gdb-remote eorgadd:8000
                         </td>
                     </tr>
 
-                    <tr><td class="header" colspan="2">Do a source level single step in the currently selected thread.</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> thread step-in<br>
-                            <b>(lldb)</b> step<br>
-                            <b>(lldb)</b> s
+                            <b>(gdb)</b> target remote localhost:8000
+                        </td>
+                        <td class="content">
+                            <b>(lldb)</b> gdb-remote 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>(gdb)</b> kdp-reattach eorgadd
+                        </td>
+                        <td class="content">
+                            <b>(lldb)</b> kdp-remote 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">
                             <b>(gdb)</b> step<br>
                             <b>(gdb)</b> s
                         </td>
+                        <td class="content">
+                            <b>(lldb)</b> thread step-in<br>
+                            <b>(lldb)</b> step<br>
+                            <b>(lldb)</b> s
+                        </td>
                     </tr>
 
 
                     <tr><td class="header" colspan="2">Do a source level single step over in the currently selected thread.</td></tr>
                     <tr>
                         <td class="content">
+                            <b>(gdb)</b> next<br>
+                            <b>(gdb)</b> n
+                        </td>
+                        <td class="content">
                             <b>(lldb)</b> thread step-over<br>
                             <b>(lldb)</b> next<br>
                             <b>(lldb)</b> n<br>
                         </td>
-                        <td class="content">
-                            <b>(gdb)</b> next<br>
-                            <b>(gdb)</b> n
-                        </td>
                     </tr>
 
                     <tr><td class="header" colspan="2">Do an instruction level single step in the currently selected thread.</td></tr>
                     <tr>
                         <td class="content">
-                            <b>(lldb)</b> thread step-inst<br>
-                            <b>(lldb)</b> si<br>
-                        </td>
-                        <td class="content">
                             <b>(gdb)</b> stepi<br>
                             <b>(gdb)</b> si
                         </td>
+                        <td class="content">
+                            <b>(lldb)</b> thread step-inst<br>
+                            <b>(lldb)</b> si<br>
+                        </td>
                     </tr>
 
                     <tr><td class="header" colspan="2">Do an instruction level single step over in the currently selected thread.</td></tr>
                     <tr>
                         <td class="content">
-                            <b>(lldb)</b> thread step-inst-over<br>
-                            <b>(lldb)</b> ni
-                        </td>
-                        <td class="content">
                             <b>(gdb)</b> nexti<br>
                             <b>(gdb)</b> ni
                         </td>
+                        <td class="content">
+                            <b>(lldb)</b> thread step-inst-over<br>
+                            <b>(lldb)</b> ni
+                        </td>
                     </tr>
 
                     <tr><td class="header" colspan="2">Step out of the currently selected frame.</td></tr>
                     <tr>
                         <td class="content">
+                            <b>(gdb)</b> finish<br>
+                        </td>
+                        <td class="content">
                             <b>(lldb)</b> thread step-out<br>
                             <b>(lldb)</b> finish<br>
                         </td>
+                    </tr>
+
+                    <tr><td class="header" colspan="2">Return immediately from the currently selected frame, with an optional return value.</td></tr>
+                    <tr>
                         <td class="content">
-                            <b>(gdb)</b> finish<br>
+                            <b>(gdb)</b> return <RETURN EXPRESSION><br>
+                        </td>
+                        <td class="content">
+                            <b>(lldb)</b> thread return <RETURN EXPRESSION><br>
                         </td>
                     </tr>
 
                     <tr><td class="header" colspan="2">Backtrace and disassemble every time you stop.</td></tr>
                     <tr>
-                        <td class="content" colspan="2">
+                        <td class="content">
+                        </td>
+                        <td class="content">
                             <b>(lldb)</b> target stop-hook add<br>
                             Enter your stop hook command(s).  Type 'DONE' to end.<br>
                             > bt<br>
@@ -215,88 +278,124 @@
 
                     <table class="stats" width="620" cellspacing="0">
                     <tr>
-                        <td class="hed" width="50%">LLDB</td>
                         <td class="hed" width="50%">GDB</td>
+                        <td class="hed" width="50%">LLDB</td>
                     </tr>
 
                     <tr><td class="header" colspan="2">Set a breakpoint at all functions named <b>main</b>.</td></tr>
                     <tr>
                         <td class="content">
+                            <b>(gdb)</b> break main
+                        </td>
+                        <td class="content">
                             <b>(lldb)</b> breakpoint set --name main<br>
                             <b>(lldb)</b> br s -n main<br>
                             <b>(lldb)</b> b main
                         </td>
-                        <td class="content">
-                            <b>(gdb)</b> break main
-                        </td>
                     </tr>
 
                     <tr><td class="header" colspan="2">Set a breakpoint in file <b>test.c</b> at line <b>12</b>.</td></tr>
                     <tr>
                         <td class="content">
+                            <b>(gdb)</b> break test.c:12
+                        </td>
+                        <td class="content">
                             <b>(lldb)</b> breakpoint set --file test.c --line 12<br>
                             <b>(lldb)</b> br s -f test.c -l 12<br>
                             <b>(lldb)</b> b test.c:12
                         </td>
-                        <td class="content">
-                            <b>(gdb)</b> break test.c:12
-                        </td>
                     </tr>
 
                     <tr><td class="header" colspan="2">Set a breakpoint at all C++ methods whose basename is <b>main</b>.</td></tr>
                     <tr>
                         <td class="content">
-                            <b>(lldb)</b> breakpoint set --method main<br>
-                            <b>(lldb)</b> br s -M main<br>
-                        </td>
-                        <td class="content">
                             <b>(gdb)</b> break main<br>
                             <i>(Hope that there are no C funtions named <b>main</b>)</i>.
                         </td>
+                        <td class="content">
+                            <b>(lldb)</b> breakpoint set --method main<br>
+                            <b>(lldb)</b> br s -M main<br>
+                        </td>
                     </tr>
 
                     <tr><td class="header" colspan="2">Set a breakpoint at and object C function: <b>-[NSString stringWithFormat:]</b>.</td></tr>
                     <tr>
                         <td class="content">
-                            <b>(lldb)</b> breakpoint set --name "-[NSString stringWithFormat:]"<br>
-                            <b>(lldb)</b> b -[NSString stringWithFormat:]<br>
+                            <b>(gdb)</b> break -[NSString stringWithFormat:]<br>
                         </td>
                         <td class="content">
-                            <b>(gdb)</b> break -[NSString stringWithFormat:]<br>
+                            <b>(lldb)</b> breakpoint set --name "-[NSString stringWithFormat:]"<br>
+                            <b>(lldb)</b> b -[NSString stringWithFormat:]<br>
                         </td>
                     </tr>
 
                     <tr><td class="header" colspan="2">Set a breakpoint at all Objective C methods whose selector is <b>count</b>.</td></tr>
                     <tr>
                         <td class="content">
+                            <b>(gdb)</b> break count<br>
+                            <i>(Hope that there are no C or C++ funtions named <b>count</b>)</i>.
+                        </td>
+                        <td class="content">
                             <b>(lldb)</b> breakpoint set --selector count<br>
                             <b>(lldb)</b> br s -S count<br>
                         </td>
+                    </tr>
+                    <tr><td class="header" colspan="2">Set a breakpoint by regular expression on function name.</td></tr>
+
+                    <tr>
                         <td class="content">
-                            <b>(gdb)</b> break count<br>
-                            <i>(Hope that there are no C or C++ funtions named <b>count</b>)</i>.
+                            <b>(gdb)</b> rbreak regular-expression<br>
+                        </td>
+                        <td class="content">
+                            <b>(lldb)</b> breakpoint set --func-regex regular-expression<br>
+                            <b>(lldb)</b> br s -r regular-expression<br>
                         </td>
                     </tr>
 
-                    <tr><td class="header" colspan="2">List all breakpoints.</td></tr>
+                    <tr><td class="header" colspan="2">Ensure that breakpoints by file and line work for #included .c/.cpp/.m files.</td></tr>
+
                     <tr>
                         <td class="content">
-                            <b>(lldb)</b> breakpoint list<br>
-                            <b>(lldb)</b> br l<br>
+                            <b>(gdb)</b> b foo.c:12<br>
+                        </td>
+                        <td class="content">
+                            <b>(lldb)</b> settings set target.inline-breakpoint-strategy always<br>
+                            <b>(lldb)</b> br s -f foo.c -l 12<br>
+                        </td>
+                    </tr>
+
+                    <tr><td class="header" colspan="2">Set a breakpoint by regular expression on source file contents.</td></tr>
+
+                    <tr>
+                        <td class="content">
+                            <b>(gdb)</b> shell grep -e -n pattern source-file<br>
+                            <b>(gdb)</b> break source-file:CopyLineNumbers<br>
+                        </td>
+                        <td class="content">
+                            <b>(lldb)</b> breakpoint set --source-pattern regular-expression --file SourceFile<br>
+                            <b>(lldb)</b> br s -p regular-expression -f file<br>
                         </td>
+                    </tr>
+
+                    <tr><td class="header" colspan="2">List all breakpoints.</td></tr>
+                    <tr>
                         <td class="content">
                             <b>(gdb)</b> info break<br>
                         </td>
+                        <td class="content">
+                            <b>(lldb)</b> breakpoint list<br>
+                            <b>(lldb)</b> br l<br>
+                        </td>
                     </tr>
 
                     <tr><td class="header" colspan="2">Delete a breakpoint.</td></tr>
                     <tr>
                         <td class="content">
-                            <b>(lldb)</b> breakpoint delete 1<br>
-                            <b>(lldb)</b> br del 1<br>
+                            <b>(gdb)</b> delete 1<br>
                         </td>
                         <td class="content">
-                            <b>(gdb)</b> delete 1<br>
+                            <b>(lldb)</b> breakpoint delete 1<br>
+                            <b>(lldb)</b> br del 1<br>
                         </td>
                     </tr>
 
@@ -312,18 +411,18 @@
 
                     <table class="stats" width="620" cellspacing="0">
                     <tr>
-                        <td class="hed" width="50%">LLDB</td>
                         <td class="hed" width="50%">GDB</td>
+                        <td class="hed" width="50%">LLDB</td>
                     </tr>
 
                     <tr><td class="header" colspan="2">Set a watchpoint on a variable when it is written to.</td></tr>
                     <tr>
                         <td class="content">
-                            <b>(lldb)</b> watchpoint set variable -w write global_var<br>
-                            <b>(lldb)</b> watch set var -w write global_var<br>
+                            <b>(gdb)</b> watch global_var
                         </td>
                         <td class="content">
-                            <b>(gdb)</b> watch global_var
+                            <b>(lldb)</b> watchpoint set variable global_var<br>
+                            <b>(lldb)</b> wa s v global_var<br>
                         </td>
                     </tr>
 
@@ -331,18 +430,20 @@
                         This command takes raw input, evaluated as an expression returning an unsigned integer pointing to the start of the region, after the '--' option terminator.</td></tr>
                     <tr>
                         <td class="content">
-                            <b>(lldb)</b> watchpoint set expression -w write -- my_ptr<br>
-                            <b>(lldb)</b> watch set exp -w write -- my_ptr<br>
-                      </td>
-                        <td class="content">
                             <b>(gdb)</b> watch -location g_char_ptr
                         </td>
+                        <td class="content">
+                            <b>(lldb)</b> watchpoint set expression -- my_ptr<br>
+                            <b>(lldb)</b> wa s e -- my_ptr<br>
+                      </td>
                     </tr>
 
                     <tr><td class="header" colspan="2">Set a condition on a watchpoint</b>.</td></tr>
                     <tr>
-                        <td class="content" colspan="2">
-                            <b>(lldb)</b> watch set var -w write global<br>
+                        <td class="content">
+                        </td>
+                        <td class="content">
+                            <b>(lldb)</b> watch set var global<br>
                             <b>(lldb)</b> watchpoint modify -c '(global==5)'<br>
                             <b>(lldb)</b> c<br>
                             ...<br>
@@ -359,22 +460,22 @@
                    <tr><td class="header" colspan="2">List all watchpoints.</td></tr>
                     <tr>
                         <td class="content">
-                            <b>(lldb)</b> watchpoint list<br>
-                            <b>(lldb)</b> watch l<br>
+                            <b>(gdb)</b> info break<br>
                         </td>
                         <td class="content">
-                            <b>(gdb)</b> info break<br>
+                            <b>(lldb)</b> watchpoint list<br>
+                            <b>(lldb)</b> watch l<br>
                         </td>
                     </tr>
 
                     <tr><td class="header" colspan="2">Delete a watchpoint.</td></tr>
                     <tr>
                         <td class="content">
-                            <b>(lldb)</b> watchpoint delete 1<br>
-                            <b>(lldb)</b> watch del 1<br>
+                            <b>(gdb)</b> delete 1<br>
                         </td>
                         <td class="content">
-                            <b>(gdb)</b> delete 1<br>
+                            <b>(lldb)</b> watchpoint delete 1<br>
+                            <b>(lldb)</b> watch del 1<br>
                         </td>
                     </tr>
 
@@ -388,108 +489,212 @@
                     <p>
                     <table class="stats" width="620" cellspacing="0">
                     <tr>
-                        <td class="hed" width="50%">LLDB</td>
                         <td class="hed" width="50%">GDB</td>
+                        <td class="hed" width="50%">LLDB</td>
                     </tr>
 
                     <tr><td class="header" colspan="2">Show the arguments and local variables for the current frame.</td></tr>
                     <tr>
                         <td class="content">
-                            <b>(lldb)</b> frame variable<br>
-                        </td>
-                        <td class="content">
                             <b>(gdb)</b> info args<br>
                             and<br>
                             <b>(gdb)</b> info locals<br>
                         </td>
+                        <td class="content">
+                            <b>(lldb)</b> frame variable<br>
+                            <b>(lldb)</b> fr v<br>
+                        </td>
                     </tr>
 
                     <tr><td class="header" colspan="2">Show the local variables for the current frame.</td></tr>
                     <tr>
                         <td class="content">
-                            <b>(lldb)</b> frame variable --no-args<br>
-                            <b>(lldb)</b> fr v -a<br>
+                            <b>(gdb)</b> info locals<br>
                         </td>
                         <td class="content">
-                            <b>(gdb)</b> info locals<br>
+                            <b>(lldb)</b> frame variable --no-args<br>
+                            <b>(lldb)</b> fr v -a<br>
                         </td>
                     </tr>
 
                     <tr><td class="header" colspan="2">Show the contents of local variable "bar".</td></tr>
                     <tr>
                         <td class="content">
+                            <b>(gdb)</b> p bar<br>
+                        </td>
+                        <td class="content">
                             <b>(lldb)</b> frame variable bar <br>
                             <b>(lldb)</b> fr v bar <br>
                             <b>(lldb)</b> p bar <br>
                         </td>
-                        <td class="content">
-                            <b>(gdb)</b> p bar<br>
-                        </td>
                     </tr>
 
                     <tr><td class="header" colspan="2">Show the contents of local variable "bar" formatted as hex.</td></tr>
                     <tr>
                         <td class="content">
+                            <b>(gdb)</b> p/x bar<br>
+                        </td>
+                        <td class="content">
                             <b>(lldb)</b> frame variable --format x bar <br>
                             <b>(lldb)</b> fr v -f x bar <br>
                         </td>
+                    </tr>
+
+                    <tr><td class="header" colspan="2">Show the contents of global variable "baz".</td></tr>
+                    <tr>
+                        <td class="content">
+                            <b>(gdb)</b> p baz<br>
+                        </td>
                         <td class="content">
-                            <b>(gdb)</b> p/x bar<br>
+                            <b>(lldb)</b> target variable baz <br>
+                            <b>(lldb)</b> ta v baz <br>
+                        </td>
+                    </tr>
+
+                    <tr><td class="header" colspan="2">Show the global/static variables defined in the current source file.</td></tr>
+                    <tr>
+                        <td class="content">
+                            n/a<br>
+                        </td>
+                        <td class="content">
+                            <b>(lldb)</b> target variable <br>
+                            <b>(lldb)</b> ta v <br>
+                        </td>
+                    </tr>
+
+                    <tr><td class="header" colspan="2">Display a the variable "argc" and "argv" every time you stop.</td></tr>
+                    <tr>
+                        <td class="content">
+                            <b>(gdb)</b> display argc<br>
+                            <b>(gdb)</b> display argv<br>
+                        </td>
+                        <td class="content">
+                            <b>(lldb)</b> target stop-hook add --one-liner "frame variable argc argv"<br>
+                            <b>(lldb)</b> ta st a -o "fr v argc argv"<br>
+                            <b>(lldb)</b> display argc<br>
+                            <b>(lldb)</b> display argv<br>
+                        </td>
+                    </tr>
+
+                    <tr><td class="header" colspan="2">Display a the variable "argc" and "argv" only when you stop in the function named <b>main</b>.</td></tr>
+                    <tr>
+                        <td class="content">
+                        </td>
+                        <td class="content">
+                            <b>(lldb)</b> target stop-hook add --name main --one-liner "frame variable argc argv"<br>
+                            <b>(lldb)</b> ta st a -n main -o "fr v argc argv"<br>
+                        </td>
+                    </tr>
+
+                    <tr><td class="header" colspan="2">Display the variable "*this" only when you stop in c class named <b>MyClass</b>.</td></tr>
+                    <tr>
+                        <td class="content">
+                        </td>
+                        <td class="content">
+                            <b>(lldb)</b> target stop-hook add --classname MyClass --one-liner "frame variable *this"<br>
+                            <b>(lldb)</b> ta st a -c MyClass -o "fr v *this"<br>
+                        </td>
+                    </tr>
+
+                    </table>
+                    <p>
+                </div>
+
+
+
+
+            <h1 class ="postheader">Evaluating expressions</h1>
+                <div class="post">
+                    <p>
+                    <table class="stats" width="620" cellspacing="0">
+                    <tr>
+                        <td class="hed" width="50%">GDB</td>
+                        <td class="hed" width="50%">LLDB</td>
+                    </tr>
+
+                    <tr><td class="header" colspan="2">Evaluating a generalized expression in the current frame.</td></tr>
+                    <tr>
+                        <td class="content">
+                            <b>(gdb)</b> print (int) printf ("Print nine: %d.", 4 + 5)<br>
+                              or if you don't want to see void returns: <br>
+                            <b>(gdb)</b> call (int) printf ("Print nine: %d.", 4 + 5)<br>
+                        </td>
+                        <td class="content">
+                            <b>(lldb)</b> expr (int) printf ("Print nine: %d.", 4 + 5)<br>
+                              or using the print alias:<br>
+                            <b>(lldb)</b> print (int) printf ("Print nine: %d.", 4 + 5)<br>
                         </td>
                     </tr>
 
-                    <tr><td class="header" colspan="2">Show the contents of global variable "baz".</td></tr>
+                    <tr><td class="header" colspan="2">Creating and assigning a value to a convenience variable.</td></tr>
                     <tr>
                         <td class="content">
-                            <b>(lldb)</b> target variable baz <br>
-                            <b>(lldb)</b> ta v baz <br>
+                            <b>(gdb)</b> set $foo = 5<br>
+                            <b>(gdb)</b> set variable $foo = 5<br>
+                              or using the print command <br>
+                            <b>(gdb)</b> print $foo = 5<br>
+                              or using the call command <br>
+                            <b>(gdb)</b> call $foo = 5<br>
+                              and if you want to specify the type of the variable:
+                            <b>(gdb)</b> set $foo = (unsigned int) 5<br>
+
                         </td>
                         <td class="content">
-                            <b>(gdb)</b> p baz<br>
+                          In lldb you evaluate a variable declaration expression as you would write it in C:<br>
+                            <b>(lldb)</b> expr unsigned int $foo = 5<br>
                         </td>
                     </tr>
 
-                    <tr><td class="header" colspan="2">Show the global/static variables defined in the current source file.</td></tr>
+                    <tr><td class="header" colspan="2">Printing the ObjC "description" of an object.</td></tr>
                     <tr>
                         <td class="content">
-                            <b>(lldb)</b> target variable <br>
-                            <b>(lldb)</b> ta v <br>
+                            <b>(gdb)</b> po [SomeClass returnAnObject]<br>
                         </td>
                         <td class="content">
-                            n/a<br>
+                            <b>(lldb)</b> expr -o -- [SomeClass returnAnObject]<br>
+                              or using the po alias:<br>
+                            <b>(lldb)</b> po [SomeClass returnAnObject]<br>
                         </td>
                     </tr>
 
-                    <tr><td class="header" colspan="2">Display a the variable "argc" and "argv" every time you stop.</td></tr>
+                    <tr><td class="header" colspan="2">Print the dynamic type of the result of an expression.</td></tr>
                     <tr>
                         <td class="content">
-                            <b>(lldb)</b> target stop-hook add --one-liner "frame variable argc argv"<br>
-                            <b>(lldb)</b> ta st a -o "fr v argc argv"<br>
-                            <b>(lldb)</b> display argc<br>
-                            <b>(lldb)</b> display argv<br>
+                            <b>(gdb)</b> set print object 1<br>
+                            <b>(gdb)</b> p someCPPObjectPtrOrReference<br>
+                              only works for C++ objects.<br>
                         </td>
                         <td class="content">
-                            <b>(gdb)</b> display argc<br>
-                            <b>(gdb)</b> display argv<br>
+                            <b>(lldb)</b> expr -d 1 -- [SomeClass returnAnObject]<br>
+                            <b>(lldb)</b> expr -d 1 -- someCPPObjectPtrOrReference<br>
+                              or set dynamic type printing to be the default:
+                            <b>(lldb)</b> settings set target.prefer-dynamic run-target<br>
                         </td>
                     </tr>
 
-                    <tr><td class="header" colspan="2">Display a the variable "argc" and "argv" only when you stop in the function named <b>main</b>.</td></tr>
+                    <tr><td class="header" colspan="2">Calling a function so you can stop at a breakpoint in the function.</td></tr>
                     <tr>
-                        <td class="content" colspan="2">
-                            <b>(lldb)</b> target stop-hook add --name main --one-liner "frame variable argc argv"<br>
-                            <b>(lldb)</b> ta st a -n main -o "fr v argc argv"<br>
+                        <td class="content">
+                            <b>(gdb)</b> set unwindonsignal 0<br>
+                            <b>(gdb)</b> p function_with_a_breakpoint()<br>
+                        </td>
+                        <td class="content">
+                            <b>(lldb)</b> expr -i 0 -- function_with_a_breakpoint()<br>
                         </td>
                     </tr>
 
-                    <tr><td class="header" colspan="2">Display the variable "*this" only when you stop in c class named <b>MyClass</b>.</td></tr>
+                    <tr><td class="header" colspan="2">Calling a function that crashes, and stopping when the function crashes.</td></tr>
                     <tr>
-                        <td class="content" colspan="2">
-                            <b>(lldb)</b> target stop-hook add --classname MyClass --one-liner "frame variable *this"<br>
-                            <b>(lldb)</b> ta st a -c MyClass -o "fr v *this"<br>
+                        <td class="content">
+                            <b>(gdb)</b> set unwindonsignal 0<br>
+                            <b>(gdb)</b> p function_which_crashes()<br>
+                        </td>
+                        <td class="content">
+                            <b>(lldb)</b> expr -u 0 -- function_which_crashes()<br>
                         </td>
                     </tr>
 
+
                     </table>
                     <p>
                 </div>
@@ -499,97 +704,131 @@
                     <p>
                     <table class="stats" width="620" cellspacing="0">
                     <tr>
-                        <td class="hed" width="50%">LLDB</td>
                         <td class="hed" width="50%">GDB</td>
+                        <td class="hed" width="50%">LLDB</td>
                     </tr>
 
 
                     <tr><td class="header" colspan="2">Show the stack backtrace for the current thread.</td></tr>
                     <tr>
                         <td class="content">
-                            <b>(lldb)</b> thread backtrace<br>
-                            <b>(lldb)</b> bt<br>
+                            <b>(gdb)</b> bt<br>
                         </td>
                         <td class="content">
-                            <b>(gdb)</b> bt<br>
+                            <b>(lldb)</b> thread backtrace<br>
+                            <b>(lldb)</b> bt<br>
                         </td>
                     </tr>
 
                     <tr><td class="header" colspan="2">Show the stack backtraces for all threads.</td></tr>
                     <tr>
                         <td class="content">
+                            <b>(gdb)</b> thread apply all bt
+                        </td>
+                        <td class="content">
                             <b>(lldb)</b> thread backtrace all<br>
                             <b>(lldb)</b> bt all
                         </td>
+                    </tr>
+
+                    <tr><td class="header" colspan="2">Backtrace the first five frames of the current thread.</td></tr>
+                    <tr>
                         <td class="content">
-                            <b>(gdb)</b> thread apply all bt
+                            <b>(gdb)</b> bt 5
+                        </td>
+                        <td class="content">
+                            <b>(lldb)</b> thread backtrace -c 5<br>
+                            <b>(lldb)</b> bt 5 (<i>lldb-169 and later</i>)<br>
+                            <b>(lldb)</b> bt -c 5 (<i>lldb-168 and earlier</i>)
                         </td>
                     </tr>
 
                     <tr><td class="header" colspan="2">Select a different stack frame by index for the current thread.</td></tr>
                     <tr>
                         <td class="content">
-                            <b>(lldb)</b> frame select 12<br>
+                            <b>(gdb)</b> frame 12
                         </td>
                         <td class="content">
-                            <b>(gdb)</b> frame 12
+                            <b>(lldb)</b> frame select 12<br>
+                            <b>(lldb)</b> fr s 12<br>
+                            <b>(lldb)</b> f 12<br>
                         </td>
                     </tr>
 
                     <tr><td class="header" colspan="2">List information about the currently selected frame in the current thread.</td></tr>
                     <tr>
                         <td class="content">
-                            <b>(lldb)</b> frame info<br>
                         </td>
                         <td class="content">
+                            <b>(lldb)</b> frame info<br>
                         </td>
                    </tr>
 
                     <tr><td class="header" colspan="2">Select the stack frame that called the current stack frame.</td></tr>
                     <tr>
                         <td class="content">
-                            <b>(lldb)</b> up<br>
-                            <b>(lldb)</b> frame select --relative=1<br>
+                            <b>(gdb)</b> up
                         </td>
                         <td class="content">
-                            <b>(gdb)</b> up
+                            <b>(lldb)</b> up<br>
+                            <b>(lldb)</b> frame select --relative=1<br>
                         </td>
                     </tr>
 
                     <tr><td class="header" colspan="2">Select the stack frame that is called by the current stack frame.</td></tr>
                     <tr>
                         <td class="content">
+                            <b>(gdb)</b> down
+                        </td>
+                        <td class="content">
                             <b>(lldb)</b> down<br>
                             <b>(lldb)</b> frame select --relative=-1<br>
                             <b>(lldb)</b> fr s -r-1<br>
                         </td>
-                        <td class="content">
-                            <b>(gdb)</b> down
-                        </td>
                     </tr>
 
                     <tr><td class="header" colspan="2">Select a different stack frame using a relative offset.</td></tr>
                     <tr>
                         <td class="content">
+                            <b>(gdb)</b> up 2<br>
+                            <b>(gdb)</b> down 3<br>
+                        </td>
+                        <td class="content">
                             <b>(lldb)</b> frame select --relative 2<br>
                             <b>(lldb)</b> fr s -r2<br>
                             <br>
                             <b>(lldb)</b> frame select --relative -3<br>
                             <b>(lldb)</b> fr s -r-3<br>
                         </td>
-                        <td class="content">
-                            <b>(gdb)</b> up 2<br>
-                            <b>(gdb)</b> down 3<br>
-                        </td>
                     </tr>
 
                     <tr><td class="header" colspan="2">Show the general purpose registers for the current thread.</td></tr>
                     <tr>
                         <td class="content">
+                            <b>(gdb)</b> info registers<br>
+                        </td>
+                        <td class="content">
                             <b>(lldb)</b> register read<br>
                         </td>
+                    </tr>
+
+                    <tr><td class="header" colspan="2">Write a new decimal value '123' to the current thread register 'rax'.</td></tr>
+                    <tr>
                         <td class="content">
-                            <b>(gdb)</b> info registers<br>
+                            <b>(gdb)</b> p $rax = 123<br>
+                        </td>
+                        <td class="content">
+                            <b>(lldb)</b> register write rax 123<br>
+                        </td>
+                    </tr>
+
+                    <tr><td class="header" colspan="2">Skip 8 bytes ahead of the current program counter (instruction pointer). Note that we use backticks to evaluate an expression and insert the scalar result in LLDB.</td></tr>
+                    <tr>
+                        <td class="content">
+                            <b>(gdb)</b> jump *$pc+8<br>
+                        </td>
+                        <td class="content">
+                            <b>(lldb)</b> register write pc `$pc+8`<br>
                         </td>
                     </tr>
 
@@ -597,40 +836,43 @@
                          the same format characters as <b>printf(3)</b> when possible.  Type "help format" to see the full list of format specifiers.</td></tr>
                     <tr>
                         <td class="content">
+                        </td>
+                        <td class="content">
                             <b>(lldb)</b> register read --format i<br>
                             <b>(lldb)</b> re r -f i<br>
 							<br>
 							<i>LLDB now supports the GDB shorthand format syntax but there can't be space after the command:</i><br>
                             <b>(lldb)</b> register read/d<br>
                         </td>
-                        <td class="content">
-                        </td>
                     </tr>
 
                     <tr><td class="header" colspan="2">Show all registers in all register sets for the current thread.</td></tr>
                     <tr>
                         <td class="content">
-                            <b>(lldb)</b> register read --all<br>
-                            <b>(lldb)</b> re r -a<br>
+                            <b>(gdb)</b> info all-registers<br>
                         </td>
                         <td class="content">
-                            <b>(gdb)</b> info all-registers<br>
+                            <b>(lldb)</b> register read --all<br>
+                            <b>(lldb)</b> re r -a<br>
                         </td>
                     </tr>
 
                     <tr><td class="header" colspan="2">Show the values for the registers named "rax", "rsp" and "rbp" in the current thread.</td></tr>
                     <tr>
                         <td class="content">
-                            <b>(lldb)</b> register read rax rsp rbp<br>
+                            <b>(gdb)</b> info all-registers rax rsp rbp<br>
                         </td>
                         <td class="content">
-                            <b>(gdb)</b> info all-registers rax rsp rbp<br>
+                            <b>(lldb)</b> register read rax rsp rbp<br>
                         </td>
                     </tr>
 
                     <tr><td class="header" colspan="2">Show the values for the register named "rax" in the current thread formatted as <b>binary</b>.</td></tr>
                     <tr>
                         <td class="content">
+                            <b>(gdb)</b> p/t $rax<br>
+                        </td>
+                        <td class="content">
                             <b>(lldb)</b> register read --format binary rax<br>
                             <b>(lldb)</b> re r -f b rax<br>
 							<br>
@@ -638,14 +880,14 @@
 							<b>(lldb)</b> register read/t rax<br>
 							<b>(lldb)</b> p/t $rax<br>
                         </td>
-                        <td class="content">
-                            <b>(gdb)</b> p/t $rax<br>
-                        </td>
                     </tr>
 
                     <tr><td class="header" colspan="2">Read memory from address 0xbffff3c0 and show 4 hex uint32_t values.</td></tr>
                     <tr>
                         <td class="content">
+                            <b>(gdb)</b> x/4xw 0xbffff3c0<br>
+                        </td>
+                        <td class="content">
                             <b>(lldb)</b> memory read --size 4 --format x --count 4 0xbffff3c0<br>
                             <b>(lldb)</b> me r -s4 -fx -c4 0xbffff3c0<br>
                             <b>(lldb)</b> x -s4 -fx -c4 0xbffff3c0<br>
@@ -655,124 +897,157 @@
                             <b>(lldb)</b> x/4xw 0xbffff3c0<br>
                             <b>(lldb)</b> memory read --gdb-format 4xw 0xbffff3c0<br>
                         </td>
-                        <td class="content">
-                            <b>(gdb)</b> x/4xw 0xbffff3c0<br>
-                        </td>
                     </tr>
 
                     <tr><td class="header" colspan="2">Read memory starting at the expression "argv[0]".</td></tr>
                     <tr>
                         <td class="content">
+                            <b>(gdb)</b> x argv[0]<br>
+                        </td>
+                        <td class="content">
                             <b>(lldb)</b> memory read `argv[0]`<br>
 							<i><b>NOTE:</b> any command can inline a scalar expression result (as long as the target is stopped) using backticks around any expression:</i><br>
                             <b>(lldb)</b> memory read --size `sizeof(int)` `argv[0]`<br>
                         </td>
-                        <td class="content">
-                            <b>(gdb)</b> x argv[0]<br>
-                        </td>
                     </tr>
 
                     <tr><td class="header" colspan="2">Read 512 bytes of memory from address 0xbffff3c0 and save results to a local file as <b>text</b>.</td></tr>
                     <tr>
                         <td class="content">
-                            <b>(lldb)</b> memory read --outfile /tmp/mem.txt --count 512 0xbffff3c0<br>
-                            <b>(lldb)</b> me r -o/tmp/mem.txt -c512 0xbffff3c0<br>
-                            <b>(lldb)</b> x/512bx -o/tmp/mem.txt 0xbffff3c0<br>
-                        </td>
-                        <td class="content">
                           <b>(gdb)</b> set logging on<br>
                           <b>(gdb)</b> set logging file /tmp/mem.txt<br>
                           <b>(gdb)</b> x/512bx 0xbffff3c0<br>
                           <b>(gdb)</b> set logging off<br>
                         </td>
+                        <td class="content">
+                            <b>(lldb)</b> memory read --outfile /tmp/mem.txt --count 512 0xbffff3c0<br>
+                            <b>(lldb)</b> me r -o/tmp/mem.txt -c512 0xbffff3c0<br>
+                            <b>(lldb)</b> x/512bx -o/tmp/mem.txt 0xbffff3c0<br>
+                        </td>
                     </tr>
 
                     <tr><td class="header" colspan="2">Save binary memory data starting at 0x1000 and ending at 0x2000 to a file.</td></tr>
                     <tr>
-                        <td class="content"colspan=2>
+                        <td class="content">
+                            <b>(gdb)</b> dump memory /tmp/mem.bin 0x1000 0x2000
+                        </td>
+                        <td class="content">
                             <b>(lldb)</b> memory read --outfile /tmp/mem.bin --binary  0x1000 0x1200<br>
                             <b>(lldb)</b> me r -o /tmp/mem.bin -b 0x1000 0x1200<br>
                         </td>
                     </tr>
+                    <tr><td class="header" colspan="2">Get information about a specific heap allocation (available on Mac OS X only).</td></tr>
                     <tr>
-                        <td class="content" colspan="2">
-                            <b>(gdb)</b> dump memory /tmp/mem.bin 0x1000 0x2000
+                        <td class="content">
+                            <b>(gdb)</b> info malloc 0x10010d680
+                        </td>
+                        <td class="content">
+                            <b>(lldb)</b> command script import lldb.macosx.heap<br>
+                            <b>(lldb)</b> process launch --environment MallocStackLogging=1 -- [ARGS]<br>	
+                            <b>(lldb)</b> malloc_info --stack-history 0x10010d680<br>
                         </td>
                     </tr>
-                    <tr><td class="header" colspan="2">Disassemble the current function for the current frame.</td></tr>
+                    <tr><td class="header" colspan="2">Get information about a specific heap allocation and cast the result to any dynamic type that can be deduced (available on Mac OS X only)</td></tr>
                     <tr>
                         <td class="content">
-                            <b>(lldb)</b> disassemble --frame<br>
-                            <b>(lldb)</b> di -f
                         </td>
                         <td class="content">
+                            <b>(lldb)</b> command script import lldb.macosx.heap<br>
+                            <b>(lldb)</b> malloc_info --type 0x10010d680<br>
+                        </td>
+                    </tr>
+                    <tr><td class="header" colspan="2">Find all heap blocks that contain a pointer specified by an expression EXPR (available on Mac OS X only).</td></tr>
+                    <tr>
+                        <td class="content">
+                        </td>
+                        <td class="content">
+                            <b>(lldb)</b> command script import lldb.macosx.heap<br>
+                            <b>(lldb)</b> ptr_refs EXPR <br>
+                        </td>
+                    </tr>
+                    <tr><td class="header" colspan="2">Find all heap blocks that contain a C string anywhere in the block (available on Mac OS X only).</td></tr>
+                    <tr>
+                        <td class="content">
+                        </td>
+                        <td class="content">
+                            <b>(lldb)</b> command script import lldb.macosx.heap<br>
+                            <b>(lldb)</b> cstr_refs CSTRING<br>
+                        </td>
+                    </tr>
+                    <tr><td class="header" colspan="2">Disassemble the current function for the current frame.</td></tr>
+                    <tr>
+                        <td class="content">
                             <b>(gdb)</b> disassemble
                         </td>
+                        <td class="content">
+                            <b>(lldb)</b> disassemble --frame<br>
+                            <b>(lldb)</b> di -f
+                        </td>
                     </tr>
 
                     <tr><td class="header" colspan="2">Disassemble any functions named <b>main</b>.</td></tr>
                     <tr>
                         <td class="content">
-                            <b>(lldb)</b> disassemble --name main<br>
-                            <b>(lldb)</b> di -n main
+                            <b>(gdb)</b> disassemble main
                         </td>
                         <td class="content">
-                            <b>(gdb)</b> disassemble main
+                            <b>(lldb)</b> disassemble --name main<br>
+                            <b>(lldb)</b> di -n main
                         </td>
                     </tr>
 
                     <tr><td class="header" colspan="2">Disassemble an address range.</td></tr>
                     <tr>
                         <td class="content">
-                            <b>(lldb)</b> disassemble --start-address  0x1eb8 --end-address 0x1ec3<br>
-                            <b>(lldb)</b> di -s 0x1eb8 -e 0x1ec3<br>
+                            <b>(gdb)</b> disassemble 0x1eb8 0x1ec3
                         </td>
                         <td class="content">
-                            <b>(gdb)</b> disassemble 0x1eb8 0x1ec3
+                            <b>(lldb)</b> disassemble --start-address  0x1eb8 --end-address 0x1ec3<br>
+                            <b>(lldb)</b> di -s 0x1eb8 -e 0x1ec3<br>
                         </td>
                     </tr>
 
                     <tr><td class="header" colspan="2">Disassemble 20 instructions from a given address.</td></tr>
                     <tr>
                         <td class="content">
-                            <b>(lldb)</b> disassemble --start-address  0x1eb8 --count 20<br>
-                            <b>(lldb)</b> di -s 0x1eb8 -c 20<br>
+                            <b>(gdb)</b> x/20i 0x1eb8
                         </td>
                         <td class="content">
-                            <b>(gdb)</b> x/20i 0x1eb8
+                            <b>(lldb)</b> disassemble --start-address  0x1eb8 --count 20<br>
+                            <b>(lldb)</b> di -s 0x1eb8 -c 20<br>
                         </td>
                     </tr>
 
                     <tr><td class="header" colspan="2">Show mixed source and disassembly for the current function for the current frame.</td></tr>
                     <tr>
                         <td class="content">
-                            <b>(lldb)</b> disassemble --frame --mixed<br>
-                            <b>(lldb)</b> di -f -m
+                            n/a
                         </td>
                         <td class="content">
-                            n/a
+                            <b>(lldb)</b> disassemble --frame --mixed<br>
+                            <b>(lldb)</b> di -f -m
                         </td>
                     </tr>
 
                     <tr><td class="header" colspan="2">Disassemble the current function for the current frame and show the opcode bytes.</td></tr>
                     <tr>
                         <td class="content">
-                            <b>(lldb)</b> disassemble --frame --bytes<br>
-                            <b>(lldb)</b> di -f -b
+                            n/a
                         </td>
                         <td class="content">
-                            n/a
+                            <b>(lldb)</b> disassemble --frame --bytes<br>
+                            <b>(lldb)</b> di -f -b
                         </td>
                     </tr>
 
                     <tr><td class="header" colspan="2">Disassemble the current source line for the current frame.</td></tr>
                     <tr>
                         <td class="content">
-                            <b>(lldb)</b> disassemble --line<br>
-                            <b>(lldb)</b> di -l
+                            n/a
                         </td>
                         <td class="content">
-                            n/a
+                            <b>(lldb)</b> disassemble --line<br>
+                            <b>(lldb)</b> di -l
                         </td>
                     </tr>
 
@@ -788,87 +1063,114 @@
 
                     <table class="stats" width="620" cellspacing="0">
                     <tr>
-                        <td class="hed" width="50%">LLDB</td>
                         <td class="hed" width="50%">GDB</td>
+                        <td class="hed" width="50%">LLDB</td>
                     </tr>
 
 
                     <tr><td class="header" colspan="2">List the main executable and all dependent shared libraries.</td></tr>
                     <tr>
                         <td class="content">
-                            <b>(lldb)</b> image list<br>
+                            <b>(gdb)</b> info shared<br>
                         </td>
                         <td class="content">
-                            <b>(gdb)</b> info shared<br>
+                            <b>(lldb)</b> image list<br>
                         </td>
                     </tr>
 
-                    <tr><td class="header" colspan="2">Lookup information for a raw address in the executable or any shared libraries.</td></tr>
+                    <tr><td class="header" colspan="2">Look up information for a raw address in the executable or any shared libraries.</td></tr>
                     <tr>
                         <td class="content">
+                            <b>(gdb)</b> info symbol 0x1ec4<br>
+                        </td>
+                        <td class="content">
                             <b>(lldb)</b> image lookup --address 0x1ec4<br>
                             <b>(lldb)</b> im loo -a 0x1ec4<br>
                         </td>
+                    </tr>
+
+                    <tr><td class="header" colspan="2">Look up functions matching a regular expression in a binary.</td></tr>
+                    <tr>
+                        <td class="content">
+                            <b>(gdb)</b> info function <FUNC_REGEX><br>
+                        </td>
                         <td class="content">
-                            <b>(gdb)</b> info symbol 0x1ec4<br>
+                            This one finds debug symbols:<br>
+                            <b>(lldb)</b> image lookup -r -n <FUNC_REGEX><br><br>
+                            This one finds non-debug symbols:<br>
+                            <b>(lldb)</b> image lookup -r -s <FUNC_REGEX><br><br>
+                            Provide a list of binaries as arguments to limit the search.
                         </td>
                     </tr>
 
-                    <tr><td class="header" colspan="2">Lookup information for an address in <b>a.out</a> only.</td></tr>
+                    <tr><td class="header" colspan="2">Find full souce line information.</td></tr>
                     <tr>
                         <td class="content">
-                            <b>(lldb)</b> image lookup --address 0x1ec4 a.out<br>
-                            <b>(lldb)</b> im loo -a 0x1ec4 a.out<br>
+                            <b>(gdb)</b> info line 0x1ec4<br>
                         </td>
                         <td class="content">
+                          This one is a bit messy at present.  Do:<br><br>
+                            <b>(lldb)</b> image lookup -v --address 0x1ec4<br><br>
+                          and look for the LineEntry line, which will have the full source path and
+                          line range information.<br>
                         </td>
                     </tr>
 
-                    <tr><td class="header" colspan="2">Lookup information for for a type <code>Point</code> by name.</td></tr>
+                    <tr><td class="header" colspan="2">Look up information for an address in <b>a.out</b> only.</td></tr>
                     <tr>
                         <td class="content">
-                            <b>(lldb)</b> image lookup --type Point<br>
-                            <b>(lldb)</b> im loo -t Point<br>
                         </td>
                         <td class="content">
-                            <b>(lldb)</b> ptype Point<br>
+                            <b>(lldb)</b> image lookup --address 0x1ec4 a.out<br>
+                            <b>(lldb)</b> im loo -a 0x1ec4 a.out<br>
                         </td>
                     </tr>
 
-                    <tr><td class="header" colspan="2">Dump all sections from the main executable and any shared libraries.</td></tr>
+                    <tr><td class="header" colspan="2">Look up information for for a type <code>Point</code> by name.</td></tr>
                     <tr>
                         <td class="content">
-                            <b>(lldb)</b> image dump sections<br>
+                            <b>(gdb)</b> ptype Point<br>
+                        </td>
+                        <td class="content">
+                            <b>(lldb)</b> image lookup --type Point<br>
+                            <b>(lldb)</b> im loo -t Point<br>
                         </td>
+                    </tr>
+
+                    <tr><td class="header" colspan="2">Dump all sections from the main executable and any shared libraries.</td></tr>
+                    <tr>
                         <td class="content">
                             <b>(gdb)</b> maintenance info sections<br>
                         </td>
+                        <td class="content">
+                            <b>(lldb)</b> image dump sections<br>
+                        </td>
                     </tr>
 
                     <tr><td class="header" colspan="2">Dump all sections in the <b>a.out</b> module.</td></tr>
                     <tr>
                         <td class="content">
-                            <b>(lldb)</b> image dump sections a.out<br>
                         </td>
                         <td class="content">
+                            <b>(lldb)</b> image dump sections a.out<br>
                         </td>
                     </tr>
 
                     <tr><td class="header" colspan="2">Dump all symbols from the main executable and any shared libraries.</td></tr>
                     <tr>
                         <td class="content">
-                            <b>(lldb)</b> image dump symtab<br>
                         </td>
                         <td class="content">
+                            <b>(lldb)</b> image dump symtab<br>
                         </td>
                     </tr>
 
                     <tr><td class="header" colspan="2">Dump all symbols in <b>a.out</b> and <b>liba.so</b>.</td></tr>
                     <tr>
                         <td class="content">
-                            <b>(lldb)</b> image dump symtab a.out liba.so<br>
                         </td>
                         <td class="content">
+                            <b>(lldb)</b> image dump symtab a.out liba.so<br>
                         </td>
                     </tr>
 
@@ -881,17 +1183,37 @@
                     <p>
                     <table class="stats" width="620" cellspacing="0">
                     <tr>
-                        <td class="hed" width="50%">LLDB</td>
                         <td class="hed" width="50%">GDB</td>
+                        <td class="hed" width="50%">LLDB</td>
                     </tr>
 
                     <tr><td class="header" colspan="2">Echo text to the screen.</td></tr>
                     <tr>
                         <td class="content">
+                            <b>(gdb)</b> echo Here is some text\n<br>
+                        </td>
+                        <td class="content">
                             <b>(lldb)</b> script print "Here is some text"<br>
                         </td>
+                    </tr>
+
+                    <tr><td class="header" colspan="2">Remap source file pathnames for the debug session.  If your source files are no longer located in the same location as when the program was built --- maybe the program was built on a different computer --- you need to tell the debugger how to find the sources at their local file path instead of the build system's file path.</td></tr>
+                    <tr>
                         <td class="content">
-                            <b>(gdb)</b> echo Here is some text\n<br>
+                            <b>(gdb)</b> set pathname-substitutions /buildbot/path /my/path<br>
+                        </td>
+                        <td class="content">
+                            <b>(lldb)</b> settings set target.source-map /buildbot/path /my/path<br>
+                        </td>
+                    </tr>
+
+                    <tr><td class="header" colspan="2">Supply a catchall directory to search for source files in.</td></tr>
+                    <tr>
+                        <td class="content">
+                            <b>(gdb)</b> directory /my/path<br>
+                        </td>
+                        <td class="content">
+                            (<i>No equivalent command yet.)<br>
                         </td>
                     </tr>
 





More information about the llvm-branch-commits mailing list