[Lldb-commits] [lldb] r157563 - in /lldb/branches/apple/python-GIL: ./ include/lldb/Core/ lldb.xcodeproj/ resources/ scripts/Python/ source/Commands/ source/Core/ source/Host/macosx/launcherXPCService/ source/Interpreter/ source/Plugins/ObjectFile/Mach-O/ source/Plugins/Process/gdb-remote/ source/Plugins/UnwindAssembly/x86/ source/Symbol/ source/Target/ test/functionalities/breakpoint/breakpoint_command/ test/functionalities/breakpoint/breakpoint_conditions/ test/help/

Filipe Cabecinhas me at filcab.net
Sun May 27 21:22:48 PDT 2012


Author: filcab
Date: Sun May 27 23:22:48 2012
New Revision: 157563

URL: http://llvm.org/viewvc/llvm-project?rev=157563&view=rev
Log:
Merge changes from ToT trunk.

Modified:
    lldb/branches/apple/python-GIL/   (props changed)
    lldb/branches/apple/python-GIL/include/lldb/Core/Disassembler.h
    lldb/branches/apple/python-GIL/include/lldb/Core/StringList.h
    lldb/branches/apple/python-GIL/lldb.xcodeproj/project.pbxproj
    lldb/branches/apple/python-GIL/resources/LLDB-Info.plist
    lldb/branches/apple/python-GIL/scripts/Python/build-swig-Python.sh
    lldb/branches/apple/python-GIL/scripts/Python/finish-swig-Python-LLDB.sh
    lldb/branches/apple/python-GIL/source/Commands/CommandObjectBreakpoint.cpp
    lldb/branches/apple/python-GIL/source/Commands/CommandObjectBreakpoint.h
    lldb/branches/apple/python-GIL/source/Commands/CommandObjectMemory.cpp
    lldb/branches/apple/python-GIL/source/Core/Disassembler.cpp
    lldb/branches/apple/python-GIL/source/Core/StringList.cpp
    lldb/branches/apple/python-GIL/source/Host/macosx/launcherXPCService/LauncherRootXPCService-Info.plist
    lldb/branches/apple/python-GIL/source/Host/macosx/launcherXPCService/LauncherXPCService-Info.plist
    lldb/branches/apple/python-GIL/source/Interpreter/CommandObject.cpp
    lldb/branches/apple/python-GIL/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
    lldb/branches/apple/python-GIL/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
    lldb/branches/apple/python-GIL/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp
    lldb/branches/apple/python-GIL/source/Symbol/ClangASTImporter.cpp
    lldb/branches/apple/python-GIL/source/Target/Target.cpp
    lldb/branches/apple/python-GIL/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py
    lldb/branches/apple/python-GIL/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py
    lldb/branches/apple/python-GIL/test/help/TestHelp.py

Propchange: lldb/branches/apple/python-GIL/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun May 27 23:22:48 2012
@@ -1 +1 @@
-/lldb/trunk:156467-157363
+/lldb/trunk:156467-157562

Modified: lldb/branches/apple/python-GIL/include/lldb/Core/Disassembler.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/include/lldb/Core/Disassembler.h?rev=157563&r1=157562&r2=157563&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/include/lldb/Core/Disassembler.h (original)
+++ lldb/branches/apple/python-GIL/include/lldb/Core/Disassembler.h Sun May 27 23:22:48 2012
@@ -338,7 +338,8 @@
     
     size_t
     ParseInstructions (const ExecutionContext *exe_ctx,
-                       const AddressRange &range);
+                       const AddressRange &range,
+                       Stream *error_strm_ptr);
 
     size_t
     ParseInstructions (const ExecutionContext *exe_ctx,

Modified: lldb/branches/apple/python-GIL/include/lldb/Core/StringList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/include/lldb/Core/StringList.h?rev=157563&r1=157562&r2=157563&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/include/lldb/Core/StringList.h (original)
+++ lldb/branches/apple/python-GIL/include/lldb/Core/StringList.h Sun May 27 23:22:48 2012
@@ -52,6 +52,9 @@
     GetStringAtIndex (size_t idx) const;
 
     void
+    Join (const char *separator, Stream &strm);
+
+    void
     Clear ();
 
     void

Modified: lldb/branches/apple/python-GIL/lldb.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/lldb.xcodeproj/project.pbxproj?rev=157563&r1=157562&r2=157563&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/branches/apple/python-GIL/lldb.xcodeproj/project.pbxproj Sun May 27 23:22:48 2012
@@ -4178,9 +4178,9 @@
 				ALWAYS_SEARCH_USER_PATHS = NO;
 				CLANG_LINK_OBJC_RUNTIME = NO;
 				CLANG_OBJC_RUNTIME = NO;
-				CURRENT_PROJECT_VERSION = 150;
+				CURRENT_PROJECT_VERSION = 152;
 				DYLIB_COMPATIBILITY_VERSION = 1;
-				DYLIB_CURRENT_VERSION = 150;
+				DYLIB_CURRENT_VERSION = 152;
 				EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports";
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
@@ -4240,10 +4240,10 @@
 				ALWAYS_SEARCH_USER_PATHS = NO;
 				CLANG_LINK_OBJC_RUNTIME = NO;
 				CLANG_OBJC_RUNTIME = NO;
-				CURRENT_PROJECT_VERSION = 150;
+				CURRENT_PROJECT_VERSION = 152;
 				DEAD_CODE_STRIPPING = YES;
 				DYLIB_COMPATIBILITY_VERSION = 1;
-				DYLIB_CURRENT_VERSION = 150;
+				DYLIB_CURRENT_VERSION = 152;
 				EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports";
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
@@ -4301,7 +4301,7 @@
 			buildSettings = {
 				ARCHS = "$(ARCHS_STANDARD_64_BIT)";
 				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
-				CURRENT_PROJECT_VERSION = 150;
+				CURRENT_PROJECT_VERSION = 152;
 				DEBUGGING_SYMBOLS = YES;
 				GCC_DYNAMIC_NO_PIC = NO;
 				GCC_ENABLE_OBJC_EXCEPTIONS = YES;
@@ -4327,7 +4327,7 @@
 				ARCHS = "$(ARCHS_STANDARD_64_BIT)";
 				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
 				COPY_PHASE_STRIP = YES;
-				CURRENT_PROJECT_VERSION = 150;
+				CURRENT_PROJECT_VERSION = 152;
 				GCC_ENABLE_OBJC_EXCEPTIONS = YES;
 				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
 				MACOSX_DEPLOYMENT_TARGET = 10.7;
@@ -4344,7 +4344,7 @@
 				ARCHS = "$(ARCHS_STANDARD_64_BIT)";
 				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
 				COPY_PHASE_STRIP = YES;
-				CURRENT_PROJECT_VERSION = 150;
+				CURRENT_PROJECT_VERSION = 152;
 				GCC_ENABLE_OBJC_EXCEPTIONS = YES;
 				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
 				MACOSX_DEPLOYMENT_TARGET = 10.7;
@@ -4358,8 +4358,8 @@
 		2689FFD513353D7A00698AC0 /* Debug */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
-				CURRENT_PROJECT_VERSION = 150;
-				DYLIB_CURRENT_VERSION = 150;
+				CURRENT_PROJECT_VERSION = 152;
+				DYLIB_CURRENT_VERSION = 152;
 				EXECUTABLE_EXTENSION = a;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
@@ -4387,8 +4387,8 @@
 		2689FFD613353D7A00698AC0 /* Release */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
-				CURRENT_PROJECT_VERSION = 150;
-				DYLIB_CURRENT_VERSION = 150;
+				CURRENT_PROJECT_VERSION = 152;
+				DYLIB_CURRENT_VERSION = 152;
 				EXECUTABLE_EXTENSION = a;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
@@ -4416,8 +4416,8 @@
 		2689FFD713353D7A00698AC0 /* BuildAndIntegration */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
-				CURRENT_PROJECT_VERSION = 150;
-				DYLIB_CURRENT_VERSION = 150;
+				CURRENT_PROJECT_VERSION = 152;
+				DYLIB_CURRENT_VERSION = 152;
 				EXECUTABLE_EXTENSION = a;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
@@ -4505,7 +4505,7 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				COPY_PHASE_STRIP = YES;
-				CURRENT_PROJECT_VERSION = 150;
+				CURRENT_PROJECT_VERSION = 152;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
 					"\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"",
@@ -4545,10 +4545,10 @@
 				CLANG_LINK_OBJC_RUNTIME = NO;
 				CLANG_OBJC_RUNTIME = NO;
 				COPY_PHASE_STRIP = YES;
-				CURRENT_PROJECT_VERSION = 150;
+				CURRENT_PROJECT_VERSION = 152;
 				DEAD_CODE_STRIPPING = YES;
 				DYLIB_COMPATIBILITY_VERSION = 1;
-				DYLIB_CURRENT_VERSION = 150;
+				DYLIB_CURRENT_VERSION = 152;
 				EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports";
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
@@ -4849,7 +4849,7 @@
 		26F5C26C10F3D9A5009D5894 /* Debug */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
-				CURRENT_PROJECT_VERSION = 150;
+				CURRENT_PROJECT_VERSION = 152;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
 					"\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"",
@@ -4879,7 +4879,7 @@
 		26F5C26D10F3D9A5009D5894 /* Release */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
-				CURRENT_PROJECT_VERSION = 150;
+				CURRENT_PROJECT_VERSION = 152;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
 					"\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"",

Modified: lldb/branches/apple/python-GIL/resources/LLDB-Info.plist
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/resources/LLDB-Info.plist?rev=157563&r1=157562&r2=157563&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/resources/LLDB-Info.plist (original)
+++ lldb/branches/apple/python-GIL/resources/LLDB-Info.plist Sun May 27 23:22:48 2012
@@ -17,7 +17,7 @@
 	<key>CFBundleSignature</key>
 	<string>????</string>
 	<key>CFBundleVersion</key>
-	<string>150</string>
+	<string>152</string>
 	<key>CFBundleName</key>
 	<string>${EXECUTABLE_NAME}</string>
 </dict>

Modified: lldb/branches/apple/python-GIL/scripts/Python/build-swig-Python.sh
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/scripts/Python/build-swig-Python.sh?rev=157563&r1=157562&r2=157563&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/scripts/Python/build-swig-Python.sh (original)
+++ lldb/branches/apple/python-GIL/scripts/Python/build-swig-Python.sh Sun May 27 23:22:48 2012
@@ -25,7 +25,10 @@
 swig_python_typemaps=${SRC_ROOT}/scripts/Python/python-typemaps.swig
 
 if [ $LLDB_DISABLE_PYTHON = "1" ] ; then
-    # SDKROOT was not empty, which currently means iOS cross build where python is disabled
+    # We don't want Python for this build, but touch the output file so we don't have to
+    # conditionalize the build on this as well.
+    # Note, at present iOS doesn't have Python, so if you're building for iOS be sure to
+    # set LLDB_DISABLE_PYTHON to 1.
     rm -rf ${swig_output_file}
     touch ${swig_output_file}
 

Modified: lldb/branches/apple/python-GIL/scripts/Python/finish-swig-Python-LLDB.sh
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/scripts/Python/finish-swig-Python-LLDB.sh?rev=157563&r1=157562&r2=157563&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/scripts/Python/finish-swig-Python-LLDB.sh (original)
+++ lldb/branches/apple/python-GIL/scripts/Python/finish-swig-Python-LLDB.sh Sun May 27 23:22:48 2012
@@ -33,9 +33,11 @@
 PYTHON_INSTALL_DIR=$4
 debug_flag=$5
 
-# Make sure SDKROOT is not set, since if it is this is an iOS build where python
-# is disabled
-if [ "x$SDKROOT" = "x" ] ; then
+# If we don't want Python, then just do nothing here.
+# Note, at present iOS doesn't have Python, so if you're building for iOS be sure to
+# set LLDB_DISABLE_PYTHON to 1.
+
+if [ ! $LLDB_DISABLE_PYTHON = "1" ] ; then
 
 if [ -n "$debug_flag" -a "$debug_flag" == "-debug" ]
 then

Modified: lldb/branches/apple/python-GIL/source/Commands/CommandObjectBreakpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/source/Commands/CommandObjectBreakpoint.cpp?rev=157563&r1=157562&r2=157563&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/source/Commands/CommandObjectBreakpoint.cpp (original)
+++ lldb/branches/apple/python-GIL/source/Commands/CommandObjectBreakpoint.cpp Sun May 27 23:22:48 2012
@@ -49,6 +49,7 @@
 
 CommandObjectBreakpointSet::CommandOptions::CommandOptions(CommandInterpreter &interpreter) :
     Options (interpreter),
+    m_condition (),
     m_filenames (),
     m_line_num (0),
     m_column (0),
@@ -91,6 +92,9 @@
     { LLDB_OPT_SET_ALL, false, "ignore-count", 'i', required_argument,   NULL, 0, eArgTypeCount,
         "Set the number of times this breakpoint is skipped before stopping." },
 
+    { LLDB_OPT_SET_ALL, false, "condition",    'c', required_argument, NULL, 0, eArgTypeExpression,
+        "The breakpoint stops only if this condition expression evaluates to true."},
+
     { LLDB_OPT_SET_ALL, false, "thread-index", 'x', required_argument, NULL, 0, eArgTypeThreadIndex,
         "The breakpoint stops only for the thread whose index matches this argument."},
 
@@ -111,7 +115,7 @@
 
     // Comment out this option for the moment, as we don't actually use it, but will in the future.
     // This way users won't see it, but the infrastructure is left in place.
-    //    { 0, false, "column",     'c', required_argument, NULL, "<column>",
+    //    { 0, false, "column",     'C', required_argument, NULL, "<column>",
     //    "Set the breakpoint by source location at this particular column."},
 
     { LLDB_OPT_SET_2, true, "address", 'a', required_argument, NULL, 0, eArgTypeAddress,
@@ -179,10 +183,14 @@
                 error.SetErrorStringWithFormat ("invalid address string '%s'", option_arg);
             break;
 
-        case 'c':
+        case 'C':
             m_column = Args::StringToUInt32 (option_arg, 0);
             break;
 
+        case 'c':
+            m_condition.assign(option_arg);
+            break;
+
         case 'f':
             m_filenames.AppendIfUnique (FileSpec(option_arg, false));
             break;
@@ -325,6 +333,7 @@
 void
 CommandObjectBreakpointSet::CommandOptions::OptionParsingStarting ()
 {
+    m_condition.clear();
     m_filenames.Clear();
     m_line_num = 0;
     m_column = 0;
@@ -586,6 +595,9 @@
             
         if (m_options.m_ignore_count != 0)
             bp->GetOptions()->SetIgnoreCount(m_options.m_ignore_count);
+
+        if (!m_options.m_condition.empty())
+            bp->GetOptions()->SetCondition(m_options.m_condition.c_str());
     }
     
     if (bp)

Modified: lldb/branches/apple/python-GIL/source/Commands/CommandObjectBreakpoint.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/source/Commands/CommandObjectBreakpoint.h?rev=157563&r1=157562&r2=157563&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/source/Commands/CommandObjectBreakpoint.h (original)
+++ lldb/branches/apple/python-GIL/source/Commands/CommandObjectBreakpoint.h Sun May 27 23:22:48 2012
@@ -98,6 +98,7 @@
 
         // Instance variables to hold the values for command options.
 
+        std::string m_condition;
         FileSpecList m_filenames;
         uint32_t m_line_num;
         uint32_t m_column;

Modified: lldb/branches/apple/python-GIL/source/Commands/CommandObjectMemory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/source/Commands/CommandObjectMemory.cpp?rev=157563&r1=157562&r2=157563&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/source/Commands/CommandObjectMemory.cpp (original)
+++ lldb/branches/apple/python-GIL/source/Commands/CommandObjectMemory.cpp Sun May 27 23:22:48 2012
@@ -613,8 +613,15 @@
             bytes_read = target->ReadMemory(address, false, data_sp->GetBytes (), data_sp->GetByteSize(), error);
             if (bytes_read == 0)
             {
-                result.AppendWarningWithFormat("Read from 0x%llx failed.\n", addr);
-                result.AppendError(error.AsCString());
+                const char *error_cstr = error.AsCString();
+                if (error_cstr && error_cstr[0])
+                {
+                    result.AppendError(error_cstr);
+                }
+                else
+                {
+                    result.AppendErrorWithFormat("failed to read memory from 0x%llx.\n", addr);
+                }
                 result.SetStatus(eReturnStatusFailed);
                 return false;
             }

Modified: lldb/branches/apple/python-GIL/source/Core/Disassembler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/source/Core/Disassembler.cpp?rev=157563&r1=157562&r2=157563&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/source/Core/Disassembler.cpp (original)
+++ lldb/branches/apple/python-GIL/source/Core/Disassembler.cpp Sun May 27 23:22:48 2012
@@ -225,7 +225,7 @@
 
         if (disasm_sp)
         {
-            size_t bytes_disassembled = disasm_sp->ParseInstructions (&exe_ctx, range);
+            size_t bytes_disassembled = disasm_sp->ParseInstructions (&exe_ctx, range, NULL);
             if (bytes_disassembled == 0)
                 disasm_sp.reset();
         }
@@ -290,7 +290,7 @@
             ResolveAddress (exe_ctx, disasm_range.GetBaseAddress(), range.GetBaseAddress());
             range.SetByteSize (disasm_range.GetByteSize());
             
-            size_t bytes_disassembled = disasm_ap->ParseInstructions (&exe_ctx, range);
+            size_t bytes_disassembled = disasm_ap->ParseInstructions (&exe_ctx, range, &strm);
             if (bytes_disassembled == 0)
                 return false;
 
@@ -1010,7 +1010,8 @@
 Disassembler::ParseInstructions
 (
     const ExecutionContext *exe_ctx,
-    const AddressRange &range
+    const AddressRange &range,
+    Stream *error_strm_ptr
 )
 {
     if (exe_ctx)
@@ -1040,6 +1041,18 @@
                                 m_arch.GetAddressByteSize());
             return DecodeInstructions (range.GetBaseAddress(), data, 0, UINT32_MAX, false);
         }
+        else if (error_strm_ptr)
+        {
+            const char *error_cstr = error.AsCString();
+            if (error_cstr)
+            {
+                error_strm_ptr->Printf("error: %s\n", error_cstr);
+            }
+        }
+    }
+    else if (error_strm_ptr)
+    {
+        error_strm_ptr->PutCString("error: invalid execution context\n");
     }
     return 0;
 }

Modified: lldb/branches/apple/python-GIL/source/Core/StringList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/source/Core/StringList.cpp?rev=157563&r1=157562&r2=157563&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/source/Core/StringList.cpp (original)
+++ lldb/branches/apple/python-GIL/source/Core/StringList.cpp Sun May 27 23:22:48 2012
@@ -96,6 +96,22 @@
 }
 
 void
+StringList::Join (const char *separator, Stream &strm)
+{
+    uint32_t size = GetSize();
+    
+    if (size == 0)
+        return;
+    
+    for (uint32_t i = 0; i < size; ++i)
+    {
+        if (i > 0)
+            strm.PutCString(separator);
+        strm.PutCString(GetStringAtIndex(i));
+    }
+}
+
+void
 StringList::Clear ()
 {
     m_strings.clear();

Modified: lldb/branches/apple/python-GIL/source/Host/macosx/launcherXPCService/LauncherRootXPCService-Info.plist
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/source/Host/macosx/launcherXPCService/LauncherRootXPCService-Info.plist?rev=157563&r1=157562&r2=157563&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/source/Host/macosx/launcherXPCService/LauncherRootXPCService-Info.plist (original)
+++ lldb/branches/apple/python-GIL/source/Host/macosx/launcherXPCService/LauncherRootXPCService-Info.plist Sun May 27 23:22:48 2012
@@ -25,7 +25,7 @@
 	<key>CFBundleSignature</key>
 	<string>????</string>
 	<key>CFBundleVersion</key>
-	<string>150</string>
+	<string>152</string>
 	<key>NSHumanReadableCopyright</key>
 	<string>Copyright © 2012 Apple Inc. All rights reserved.</string>
 	<key>XPCService</key>

Modified: lldb/branches/apple/python-GIL/source/Host/macosx/launcherXPCService/LauncherXPCService-Info.plist
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/source/Host/macosx/launcherXPCService/LauncherXPCService-Info.plist?rev=157563&r1=157562&r2=157563&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/source/Host/macosx/launcherXPCService/LauncherXPCService-Info.plist (original)
+++ lldb/branches/apple/python-GIL/source/Host/macosx/launcherXPCService/LauncherXPCService-Info.plist Sun May 27 23:22:48 2012
@@ -25,7 +25,7 @@
 	<key>CFBundleSignature</key>
 	<string>????</string>
 	<key>CFBundleVersion</key>
-	<string>150</string>
+	<string>152</string>
 	<key>NSHumanReadableCopyright</key>
 	<string>Copyright © 2012 Apple Inc. All rights reserved.</string>
 	<key>XPCService</key>

Modified: lldb/branches/apple/python-GIL/source/Interpreter/CommandObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/source/Interpreter/CommandObject.cpp?rev=157563&r1=157562&r2=157563&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/source/Interpreter/CommandObject.cpp (original)
+++ lldb/branches/apple/python-GIL/source/Interpreter/CommandObject.cpp Sun May 27 23:22:48 2012
@@ -17,6 +17,7 @@
 #include <ctype.h>
 
 #include "lldb/Core/Address.h"
+#include "lldb/Core/ArchSpec.h"
 #include "lldb/Interpreter/Options.h"
 
 // These are for the Sourcename completers.
@@ -845,13 +846,27 @@
     return NULL;
 }
 
+static
+const char *arch_helper()
+{
+    static StreamString g_archs_help;
+    if (g_archs_help.GetData() == NULL)
+    {
+        StringList archs;
+        ArchSpec::AutoComplete(NULL, archs);
+        g_archs_help.Printf("These are the supported architecture names:\n");
+        archs.Join("%s\n", g_archs_help);
+    }
+    return g_archs_help.GetData();
+}
+
 CommandObject::ArgumentTableEntry
 CommandObject::g_arguments_data[] =
 {
     { eArgTypeAddress, "address", CommandCompletions::eNoCompletion, { NULL, false }, "A valid address in the target program's execution space." },
     { eArgTypeAliasName, "alias-name", CommandCompletions::eNoCompletion, { NULL, false }, "The name of an abbreviation (alias) for a debugger command." },
     { eArgTypeAliasOptions, "options-for-aliased-command", CommandCompletions::eNoCompletion, { NULL, false }, "Command options to be used as part of an alias (abbreviation) definition.  (See 'help commands alias' for more information.)" },
-    { eArgTypeArchitecture, "arch", CommandCompletions::eArchitectureCompletion, { NULL, false }, "The architecture name, e.g. i386 or x86_64." },
+    { eArgTypeArchitecture, "arch", CommandCompletions::eArchitectureCompletion, { arch_helper, true }, "The architecture name, e.g. i386 or x86_64." },
     { eArgTypeBoolean, "boolean", CommandCompletions::eNoCompletion, { NULL, false }, "A Boolean value: 'true' or 'false'" },
     { eArgTypeBreakpointID, "breakpt-id", CommandCompletions::eNoCompletion, { BreakpointIDHelpTextCallback, false }, NULL },
     { eArgTypeBreakpointIDRange, "breakpt-id-list", CommandCompletions::eNoCompletion, { BreakpointIDRangeHelpTextCallback, false }, NULL },

Modified: lldb/branches/apple/python-GIL/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp?rev=157563&r1=157562&r2=157563&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original)
+++ lldb/branches/apple/python-GIL/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Sun May 27 23:22:48 2012
@@ -751,7 +751,6 @@
 {
     lldb::user_id_t segID = 0;
     lldb::user_id_t sectID = 0;
-    struct segment_command_64 load_cmd;
     uint32_t offset = MachHeaderSizeFromMagic(m_header.magic);
     uint32_t i;
     const bool is_core = GetType() == eTypeCoreFile;
@@ -760,24 +759,32 @@
     // First look up any LC_ENCRYPTION_INFO load commands
     typedef RangeArray<uint32_t, uint32_t, 8> EncryptedFileRanges;
     EncryptedFileRanges encrypted_file_ranges;
+    encryption_info_command encryption_cmd;
     for (i=0; i<m_header.ncmds; ++i)
     {
         const uint32_t load_cmd_offset = offset;
-        if (m_data.GetU32(&offset, &load_cmd, 2) == NULL)
+        if (m_data.GetU32(&offset, &encryption_cmd, 2) == NULL)
             break;
         
-        if (load_cmd.cmd == LoadCommandEncryptionInfo)
+        if (encryption_cmd.cmd == LoadCommandEncryptionInfo)
         {
-            EncryptedFileRanges::Entry entry;
-            entry.SetRangeBase(m_data.GetU32(&offset));
-            entry.SetByteSize(m_data.GetU32(&offset));
-            encrypted_file_ranges.Append(entry);
+            if (m_data.GetU32(&offset, &encryption_cmd.cryptoff, 3))
+            {
+                if (encryption_cmd.cryptid != 0)
+                {
+                    EncryptedFileRanges::Entry entry;
+                    entry.SetRangeBase(encryption_cmd.cryptoff);
+                    entry.SetByteSize(encryption_cmd.cryptsize);
+                    encrypted_file_ranges.Append(entry);
+                }
+            }
         }
-        offset = load_cmd_offset + load_cmd.cmdsize;
+        offset = load_cmd_offset + encryption_cmd.cmdsize;
     }
 
     offset = MachHeaderSizeFromMagic(m_header.magic);
 
+    struct segment_command_64 load_cmd;
     for (i=0; i<m_header.ncmds; ++i)
     {
         const uint32_t load_cmd_offset = offset;
@@ -1359,21 +1366,25 @@
         }
 
 
-        if (process)
+        const bool have_strtab_data = strtab_data.GetByteSize() > 0;
+        if (!have_strtab_data)
         {
-            if (strtab_addr == LLDB_INVALID_ADDRESS)
+            if (process)
+            {
+                if (strtab_addr == LLDB_INVALID_ADDRESS)
+                {
+                    if (log)
+                        module_sp->LogMessage(log.get(), "failed to locate the strtab in memory");
+                    return 0;
+                }
+            }
+            else
             {
                 if (log)
-                    module_sp->LogMessage(log.get(), "failed to locate the strtab in memory");
+                    module_sp->LogMessage(log.get(), "failed to read strtab data");
                 return 0;
             }
         }
-        else if (strtab_data.GetByteSize() == 0)
-        {
-            if (log)
-                module_sp->LogMessage(log.get(), "failed to read strtab data");
-            return 0;
-        }
 
         const ConstString &g_segment_name_TEXT = GetSegmentNameTEXT();
         const ConstString &g_segment_name_DATA = GetSegmentNameDATA();
@@ -1449,14 +1460,7 @@
             SymbolType type = eSymbolTypeInvalid;
             const char *symbol_name = NULL;
             
-            if (process)
-            {
-                const addr_t str_addr = strtab_addr + nlist.n_strx;
-                Error str_error;
-                if (process->ReadCStringFromMemory(str_addr, memory_symbol_name, str_error))
-                    symbol_name = memory_symbol_name.c_str();
-            }
-            else
+            if (have_strtab_data)
             {
                 symbol_name = strtab_data.PeekCStr(nlist.n_strx);
                 
@@ -1476,6 +1480,13 @@
                 if (symbol_name[0] == '\0')
                     symbol_name = NULL;
             }
+            else
+            {
+                const addr_t str_addr = strtab_addr + nlist.n_strx;
+                Error str_error;
+                if (process->ReadCStringFromMemory(str_addr, memory_symbol_name, str_error))
+                    symbol_name = memory_symbol_name.c_str();
+            }
             const char *symbol_name_non_abi_mangled = NULL;
 
             SectionSP symbol_section;

Modified: lldb/branches/apple/python-GIL/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp?rev=157563&r1=157562&r2=157563&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp (original)
+++ lldb/branches/apple/python-GIL/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp Sun May 27 23:22:48 2012
@@ -556,7 +556,16 @@
                             // for the async packet did cause the stop
                             if (continue_after_async)
                             {
-                                //continue_packet.assign (1, 'c');
+                                // Reverting this for now as it is causing deadlocks
+                                // in programs (<rdar://problem/11529853>). In the future
+                                // we should check our thread list and "do the right thing"
+                                // for new threads that show up while we stop and run async
+                                // packets. Setting the packet to 'c' to continue all threads
+                                // is the right thing to do 99.99% of the time because if a
+                                // thread was single stepping, and we sent an interrupt, we
+                                // will notice above that we didn't stop due to an interrupt
+                                // but stopped due to stepping and we would _not_ continue.
+                                continue_packet.assign (1, 'c');
                                 continue;
                             }
                         }

Modified: lldb/branches/apple/python-GIL/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp?rev=157563&r1=157562&r2=157563&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp (original)
+++ lldb/branches/apple/python-GIL/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp Sun May 27 23:22:48 2012
@@ -676,40 +676,69 @@
     }
     
     // Now look at the byte at the end of the AddressRange for a limited attempt at describing the
-    // epilogue.  If this function is built -fomit-frame-pointer (so the CFA is defined in terms of the
-    // stack pointer) we'd need to profile every instruction which causes rsp to change to backtrace
-    // all the time.  But assuming the CFA is in terms of rbp most of the time, this one additional Row
-    // will be sufficient.
+    // epilogue.  We're looking for the sequence
 
-    if (m_func_bounds.GetByteSize() > 2)
+    //  [ 0x5d ] mov %rbp, %rsp
+    //  [ 0xc3 ] ret
+    //  [ 0xe8 xx xx xx xx ] call __stack_chk_fail  (this is sometimes the final insn in the function)
+
+    // We want to add a Row describing how to unwind when we're stopped on the 'ret' instruction where the
+    // CFA is no longer defined in terms of rbp, but is now defined in terms of rsp like on function entry.
+
+    uint64_t ret_insn_offset = LLDB_INVALID_ADDRESS;
+    Address end_of_fun(m_func_bounds.GetBaseAddress());
+    end_of_fun.SetOffset (end_of_fun.GetOffset() + m_func_bounds.GetByteSize());
+    
+    if (m_func_bounds.GetByteSize() > 7)
     {
-        Address last_insn (m_func_bounds.GetBaseAddress());
-        last_insn.SetOffset (last_insn.GetOffset() + m_func_bounds.GetByteSize() - 1);
-        uint8_t bytebuf[1];
-        if (target->ReadMemory (last_insn, prefer_file_cache, bytebuf, 1, error) != -1)
+        uint8_t bytebuf[7];
+        Address last_seven_bytes(end_of_fun);
+        last_seven_bytes.SetOffset (last_seven_bytes.GetOffset() - 7);
+        if (target->ReadMemory (last_seven_bytes, prefer_file_cache, bytebuf, 7, error) != -1)
         {
-            if (bytebuf[0] == 0xc3)   // ret aka retq
+            if (bytebuf[5] == 0x5d && bytebuf[6] == 0xc3)  // mov, ret
             {
-                // Create a fresh, empty Row and RegisterLocation - don't mention any other registers
-                UnwindPlan::Row epi_row;
-                UnwindPlan::Row::RegisterLocation epi_regloc;
-
-                // When the ret instruction is about to be executed, here's our state
-                epi_row.SetOffset (m_func_bounds.GetByteSize() - 1);
-                epi_row.SetCFARegister (m_lldb_sp_regnum);
-                epi_row.SetCFAOffset (m_wordsize);
-               
-                // caller's stack pointer value before the call insn is the CFA address
-                epi_regloc.SetIsCFAPlusOffset (0);
-                epi_row.SetRegisterInfo (m_lldb_sp_regnum, epi_regloc);
-
-                // saved instruction pointer can be found at CFA - wordsize
-                epi_regloc.SetAtCFAPlusOffset (-m_wordsize);
-                epi_row.SetRegisterInfo (m_lldb_ip_regnum, epi_regloc);
-
-                unwind_plan.AppendRow (epi_row);
+                ret_insn_offset = m_func_bounds.GetByteSize() - 1;
+            }
+            else if (bytebuf[0] == 0x5d && bytebuf[1] == 0xc3 && bytebuf[2] == 0xe8) // mov, ret, call
+            {
+                ret_insn_offset = m_func_bounds.GetByteSize() - 6;
             }
         }
+    } else if (m_func_bounds.GetByteSize() > 2)
+    {
+        uint8_t bytebuf[2];
+        Address last_two_bytes(end_of_fun);
+        last_two_bytes.SetOffset (last_two_bytes.GetOffset() - 2);
+        if (target->ReadMemory (last_two_bytes, prefer_file_cache, bytebuf, 2, error) != -1)
+        {
+            if (bytebuf[0] == 0x5d && bytebuf[1] == 0xc3) // mov, ret
+            {
+                ret_insn_offset = m_func_bounds.GetByteSize() - 1;
+            }
+        }
+    }
+
+    if (ret_insn_offset != LLDB_INVALID_ADDRESS)
+    {
+        // Create a fresh, empty Row and RegisterLocation - don't mention any other registers
+        UnwindPlan::Row epi_row;
+        UnwindPlan::Row::RegisterLocation epi_regloc;
+
+        // When the ret instruction is about to be executed, here's our state
+        epi_row.SetOffset (ret_insn_offset);
+        epi_row.SetCFARegister (m_lldb_sp_regnum);
+        epi_row.SetCFAOffset (m_wordsize);
+       
+        // caller's stack pointer value before the call insn is the CFA address
+        epi_regloc.SetIsCFAPlusOffset (0);
+        epi_row.SetRegisterInfo (m_lldb_sp_regnum, epi_regloc);
+
+        // saved instruction pointer can be found at CFA - wordsize
+        epi_regloc.SetAtCFAPlusOffset (-m_wordsize);
+        epi_row.SetRegisterInfo (m_lldb_ip_regnum, epi_regloc);
+
+        unwind_plan.AppendRow (epi_row);
     }
     
     unwind_plan.SetSourceName ("assembly insn profiling");

Modified: lldb/branches/apple/python-GIL/source/Symbol/ClangASTImporter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/source/Symbol/ClangASTImporter.cpp?rev=157563&r1=157562&r2=157563&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/source/Symbol/ClangASTImporter.cpp (original)
+++ lldb/branches/apple/python-GIL/source/Symbol/ClangASTImporter.cpp Sun May 27 23:22:48 2012
@@ -431,10 +431,15 @@
     {
         if (NamedDecl *from_named_decl = dyn_cast<clang::NamedDecl>(from))
         {
+            std::string name_string;
+            llvm::raw_string_ostream name_stream(name_string);
+            from_named_decl->printName(name_stream);
+            name_stream.flush();
+            
             log->Printf("    [ClangASTImporter] Imported (%sDecl*)%p, named %s (from (Decl*)%p), metadata 0x%llx",
                         from->getDeclKindName(),
                         to,
-                        from_named_decl->getName().str().c_str(),
+                        name_string.c_str(),
                         from,
                         m_master.GetDeclMetadata(from));
         }

Modified: lldb/branches/apple/python-GIL/source/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/source/Target/Target.cpp?rev=157563&r1=157562&r2=157563&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/source/Target/Target.cpp (original)
+++ lldb/branches/apple/python-GIL/source/Target/Target.cpp Sun May 27 23:22:48 2012
@@ -1062,6 +1062,7 @@
         // If the contents of this section are encrypted, the on-disk file is unusuable.  Read only from live memory.
         if (section_sp->IsEncrypted())
         {
+            error.SetErrorString("section is encrypted");
             return 0;
         }
         ModuleSP module_sp (section_sp->GetModule());

Modified: lldb/branches/apple/python-GIL/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py?rev=157563&r1=157562&r2=157563&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py (original)
+++ lldb/branches/apple/python-GIL/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py Sun May 27 23:22:48 2012
@@ -14,7 +14,7 @@
     @classmethod
     def classCleanup(cls):
         """Cleanup the test byproduct of breakpoint_command_sequence(self)."""
-        system(["/bin/sh", "-c", "rm -f output.txt"])
+        system(["/bin/sh", "-c", "rm -f output.txt output2.txt"])
 
     @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
     @dsym_test

Modified: lldb/branches/apple/python-GIL/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py?rev=157563&r1=157562&r2=157563&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py (original)
+++ lldb/branches/apple/python-GIL/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py Sun May 27 23:22:48 2012
@@ -14,28 +14,41 @@
 
     @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
     @dsym_test
-    def test_with_dsym_and_run_command(self):
+    def test_breakpoint_condition_with_dsym_and_run_command(self):
         """Exercise breakpoint condition with 'breakpoint modify -c <expr> id'."""
         self.buildDsym()
         self.breakpoint_conditions()
 
     @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+    @dsym_test
+    def test_breakpoint_condition_inline_with_dsym_and_run_command(self):
+        """Exercise breakpoint condition inline with 'breakpoint set'."""
+        self.buildDsym()
+        self.breakpoint_conditions(inline=True)
+
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
     @python_api_test
     @dsym_test
-    def test_with_dsym_and_python_api(self):
+    def test_breakpoint_condition_with_dsym_and_python_api(self):
         """Use Python APIs to set breakpoint conditions."""
         self.buildDsym()
         self.breakpoint_conditions_python()
 
     @dwarf_test
-    def test_with_dwarf_and_run_command(self):
+    def test_breakpoint_condition_with_dwarf_and_run_command(self):
         """Exercise breakpoint condition with 'breakpoint modify -c <expr> id'."""
         self.buildDwarf()
         self.breakpoint_conditions()
 
+    @dwarf_test
+    def test_breakpoint_condition_inline_with_dwarf_and_run_command(self):
+        """Exercise breakpoint condition inline with 'breakpoint set'."""
+        self.buildDwarf()
+        self.breakpoint_conditions(inline=True)
+
     @python_api_test
     @dwarf_test
-    def test_with_dwarf_and_python_api(self):
+    def test_breakpoint_condition_with_dwarf_and_python_api(self):
         """Use Python APIs to set breakpoint conditions."""
         self.buildDwarf()
         self.breakpoint_conditions_python()
@@ -47,17 +60,22 @@
         self.line1 = line_number('main.c', '// Find the line number of function "c" here.')
         self.line2 = line_number('main.c', "// Find the line number of c's parent call here.")
 
-    def breakpoint_conditions(self):
+    def breakpoint_conditions(self, inline=False):
         """Exercise breakpoint condition with 'breakpoint modify -c <expr> id'."""
         exe = os.path.join(os.getcwd(), "a.out")
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
-        # Create a breakpoint by function name 'c'.
-        self.expect("breakpoint set -n c", BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: name = 'c', locations = 1")
+        if inline:
+            # Create a breakpoint by function name 'c' and set the condition.
+            self.expect("breakpoint set -n c -c 'val == 3'", BREAKPOINT_CREATED,
+                startstr = "Breakpoint created: 1: name = 'c', locations = 1")
+        else:
+            # Create a breakpoint by function name 'c'.
+            self.expect("breakpoint set -n c", BREAKPOINT_CREATED,
+                startstr = "Breakpoint created: 1: name = 'c', locations = 1")
 
-        # And set a condition on the breakpoint to stop on when 'val == 3'.
-        self.runCmd("breakpoint modify -c 'val == 3' 1")
+            # And set a condition on the breakpoint to stop on when 'val == 3'.
+            self.runCmd("breakpoint modify -c 'val == 3' 1")
 
         # Now run the program.
         self.runCmd("run", RUN_SUCCEEDED)

Modified: lldb/branches/apple/python-GIL/test/help/TestHelp.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/test/help/TestHelp.py?rev=157563&r1=157562&r2=157563&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/test/help/TestHelp.py (original)
+++ lldb/branches/apple/python-GIL/test/help/TestHelp.py Sun May 27 23:22:48 2012
@@ -65,6 +65,11 @@
         return None
 
 
+    def test_help_arch(self):
+        """Test 'help arch' which should list of supported architectures."""
+        self.expect("help arch",
+            substrs = ['arm', 'x86_64', 'i386'])
+
     def test_help_version(self):
         """Test 'help version' and 'version' commands."""
         self.expect("help version",





More information about the lldb-commits mailing list