[Lldb-commits] [lldb] r133231 - in /lldb/trunk: include/lldb/API/SBDebugger.h include/lldb/Interpreter/OptionGroupPlatform.h include/lldb/Target/Platform.h lldb.xcodeproj/project.pbxproj resources/LLDB-Info.plist source/API/SBDebugger.cpp source/Interpreter/OptionGroupPlatform.cpp source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp source/Target/Platform.cpp

Greg Clayton gclayton at apple.com
Thu Jun 16 20:31:01 PDT 2011


Author: gclayton
Date: Thu Jun 16 22:31:01 2011
New Revision: 133231

URL: http://llvm.org/viewvc/llvm-project?rev=133231&view=rev
Log:
Added the notion of an system root for SDKs. This is a directory where all
libraries and headers exist. This can be specified using the platform select
function:

platform select --sysroot /Volumes/remote-root remote-macosx

Each platform subclass is free to interpret the sysroot as needed.

Expose the new SDK root directory through the SBDebugger class. 

Fixed an issue with the GDB remote protocol where unimplemented packets were
not being handled correctly.


Modified:
    lldb/trunk/include/lldb/API/SBDebugger.h
    lldb/trunk/include/lldb/Interpreter/OptionGroupPlatform.h
    lldb/trunk/include/lldb/Target/Platform.h
    lldb/trunk/lldb.xcodeproj/project.pbxproj
    lldb/trunk/resources/LLDB-Info.plist
    lldb/trunk/source/API/SBDebugger.cpp
    lldb/trunk/source/Interpreter/OptionGroupPlatform.cpp
    lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
    lldb/trunk/source/Target/Platform.cpp

Modified: lldb/trunk/include/lldb/API/SBDebugger.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBDebugger.h?rev=133231&r1=133230&r2=133231&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBDebugger.h (original)
+++ lldb/trunk/include/lldb/API/SBDebugger.h Thu Jun 16 22:31:01 2011
@@ -126,6 +126,9 @@
     lldb::SBError
     SetCurrentPlatform (const char *platform_name);
     
+    bool
+    SetCurrentPlatformSDKRoot (const char *sysroot);
+
     // FIXME: Once we get the set show stuff in place, the driver won't need
     // an interface to the Set/Get UseExternalEditor.
     bool

Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupPlatform.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupPlatform.h?rev=133231&r1=133230&r2=133231&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionGroupPlatform.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionGroupPlatform.h Thu Jun 16 22:31:01 2011
@@ -14,6 +14,7 @@
 // C++ Includes
 // Other libraries and framework includes
 // Project includes
+#include "lldb/Core/ConstString.h"
 #include "lldb/Interpreter/Options.h"
 
 namespace lldb_private {
@@ -30,6 +31,7 @@
     OptionGroupPlatform (bool include_platform_option) :
         OptionGroup(),
         m_platform_name (),
+        m_sdk_sysroot (),
         m_os_version_major (UINT32_MAX),
         m_os_version_minor (UINT32_MAX),
         m_os_version_update (UINT32_MAX),
@@ -75,9 +77,36 @@
         else
             m_platform_name.clear();
     }
+    
+    const ConstString &
+    GetSDKRootDirectory () const
+    {
+        return m_sdk_sysroot;
+    }
+    
+    void
+    SetSDKRootDirectory (const ConstString &sdk_root_directory)
+    {
+        m_sdk_sysroot = sdk_root_directory;
+    }    
+
+    const ConstString &
+    GetSDKBuild () const
+    {
+        return m_sdk_build;
+    }
+    
+    void
+    SetSDKBuild (const ConstString &sdk_build)
+    {
+        m_sdk_build = sdk_build;
+    }    
+    
 
 protected:
     std::string m_platform_name;
+    ConstString m_sdk_sysroot;
+    ConstString m_sdk_build;
     uint32_t m_os_version_major;
     uint32_t m_os_version_minor;
     uint32_t m_os_version_update;

Modified: lldb/trunk/include/lldb/Target/Platform.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Platform.h?rev=133231&r1=133230&r2=133231&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Platform.h (original)
+++ lldb/trunk/include/lldb/Target/Platform.h Thu Jun 16 22:31:01 2011
@@ -383,6 +383,32 @@
         {
             return m_max_gid_name_len;
         }
+        
+        const ConstString &
+        GetSDKRootDirectory () const
+        {
+            return m_sdk_sysroot;
+        }
+
+        void
+        SetSDKRootDirectory (const ConstString &dir)
+        {
+            m_sdk_sysroot = dir;
+        }
+
+        const ConstString &
+        GetSDKBuild () const
+        {
+            return m_sdk_build;
+        }
+        
+        void
+        SetSDKBuild (const ConstString &sdk_build)
+        {
+            m_sdk_build = sdk_build;
+        }    
+        
+
     protected:
         bool m_is_host;
         // Set to true when we are able to actually set the OS version while 
@@ -392,6 +418,8 @@
         // will be set to the once we call Host::GetOSVersion().
         bool m_os_version_set_while_connected;
         bool m_system_arch_set_while_connected;
+        ConstString m_sdk_sysroot; // the root location of where the SDK files are all located
+        ConstString m_sdk_build;
         std::string m_remote_url;
         std::string m_name;
         uint32_t m_major_os_version;

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=133231&r1=133230&r2=133231&view=diff
==============================================================================
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Thu Jun 16 22:31:01 2011
@@ -3394,10 +3394,10 @@
 			buildSettings = {
 				ALWAYS_SEARCH_USER_PATHS = NO;
 				COPY_PHASE_STRIP = NO;
-				CURRENT_PROJECT_VERSION = 60;
+				CURRENT_PROJECT_VERSION = 62;
 				DEBUG_INFORMATION_FORMAT = dwarf;
 				DYLIB_COMPATIBILITY_VERSION = 1;
-				DYLIB_CURRENT_VERSION = 60;
+				DYLIB_CURRENT_VERSION = 62;
 				EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports";
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
@@ -3446,11 +3446,11 @@
 			buildSettings = {
 				ALWAYS_SEARCH_USER_PATHS = NO;
 				COPY_PHASE_STRIP = NO;
-				CURRENT_PROJECT_VERSION = 60;
+				CURRENT_PROJECT_VERSION = 62;
 				DEAD_CODE_STRIPPING = YES;
 				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
 				DYLIB_COMPATIBILITY_VERSION = 1;
-				DYLIB_CURRENT_VERSION = 60;
+				DYLIB_CURRENT_VERSION = 62;
 				EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports";
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
@@ -3497,8 +3497,8 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				COPY_PHASE_STRIP = NO;
-				CURRENT_PROJECT_VERSION = 60;
-				DYLIB_CURRENT_VERSION = 60;
+				CURRENT_PROJECT_VERSION = 62;
+				DYLIB_CURRENT_VERSION = 62;
 				EXECUTABLE_EXTENSION = a;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
@@ -3536,9 +3536,9 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				COPY_PHASE_STRIP = NO;
-				CURRENT_PROJECT_VERSION = 60;
+				CURRENT_PROJECT_VERSION = 62;
 				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
-				DYLIB_CURRENT_VERSION = 60;
+				DYLIB_CURRENT_VERSION = 62;
 				EXECUTABLE_EXTENSION = a;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
@@ -3576,9 +3576,9 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				COPY_PHASE_STRIP = NO;
-				CURRENT_PROJECT_VERSION = 60;
+				CURRENT_PROJECT_VERSION = 62;
 				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
-				DYLIB_CURRENT_VERSION = 60;
+				DYLIB_CURRENT_VERSION = 62;
 				EXECUTABLE_EXTENSION = a;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
@@ -3646,7 +3646,7 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				COPY_PHASE_STRIP = YES;
-				CURRENT_PROJECT_VERSION = 60;
+				CURRENT_PROJECT_VERSION = 62;
 				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
@@ -3677,11 +3677,11 @@
 			buildSettings = {
 				ALWAYS_SEARCH_USER_PATHS = NO;
 				COPY_PHASE_STRIP = YES;
-				CURRENT_PROJECT_VERSION = 60;
+				CURRENT_PROJECT_VERSION = 62;
 				DEAD_CODE_STRIPPING = YES;
 				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
 				DYLIB_COMPATIBILITY_VERSION = 1;
-				DYLIB_CURRENT_VERSION = 60;
+				DYLIB_CURRENT_VERSION = 62;
 				EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports";
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
@@ -3806,7 +3806,7 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				COPY_PHASE_STRIP = NO;
-				CURRENT_PROJECT_VERSION = 60;
+				CURRENT_PROJECT_VERSION = 62;
 				DEBUG_INFORMATION_FORMAT = dwarf;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
@@ -3838,7 +3838,7 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				COPY_PHASE_STRIP = YES;
-				CURRENT_PROJECT_VERSION = 60;
+				CURRENT_PROJECT_VERSION = 62;
 				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",

Modified: lldb/trunk/resources/LLDB-Info.plist
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/resources/LLDB-Info.plist?rev=133231&r1=133230&r2=133231&view=diff
==============================================================================
--- lldb/trunk/resources/LLDB-Info.plist (original)
+++ lldb/trunk/resources/LLDB-Info.plist Thu Jun 16 22:31:01 2011
@@ -17,7 +17,7 @@
 	<key>CFBundleSignature</key>
 	<string>????</string>
 	<key>CFBundleVersion</key>
-	<string>60</string>
+	<string>62</string>
 	<key>CFBundleName</key>
 	<string>${EXECUTABLE_NAME}</string>
 </dict>

Modified: lldb/trunk/source/API/SBDebugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBDebugger.cpp?rev=133231&r1=133230&r2=133231&view=diff
==============================================================================
--- lldb/trunk/source/API/SBDebugger.cpp (original)
+++ lldb/trunk/source/API/SBDebugger.cpp Thu Jun 16 22:31:01 2011
@@ -880,6 +880,22 @@
 }
 
 bool
+SBDebugger::SetCurrentPlatformSDKRoot (const char *sysroot)
+{
+    if (m_opaque_sp)
+    {
+        PlatformSP platform_sp (m_opaque_sp->GetPlatformList().GetSelectedPlatform());
+        
+        if (platform_sp)
+        {
+            platform_sp->SetSDKRootDirectory (ConstString (sysroot));
+            return true;
+        }
+    }
+    return false;
+}
+
+bool
 SBDebugger::GetCloseInputOnEOF () const
 {
     if (m_opaque_sp)

Modified: lldb/trunk/source/Interpreter/OptionGroupPlatform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionGroupPlatform.cpp?rev=133231&r1=133230&r2=133231&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionGroupPlatform.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionGroupPlatform.cpp Thu Jun 16 22:31:01 2011
@@ -36,6 +36,12 @@
                                            m_os_version_minor,
                                            m_os_version_update);
             }
+            
+            if (m_sdk_sysroot)
+                platform_sp->SetSDKRootDirectory (m_sdk_sysroot);
+
+            if (m_sdk_build)
+                platform_sp->SetSDKBuild (m_sdk_build);
         }
     }
     return platform_sp;
@@ -45,6 +51,8 @@
 OptionGroupPlatform::OptionParsingStarting (CommandInterpreter &interpreter)
 {
     m_platform_name.clear();
+    m_sdk_sysroot.Clear();
+    m_sdk_build.Clear();
     m_os_version_major = UINT32_MAX;
     m_os_version_minor = UINT32_MAX;
     m_os_version_update = UINT32_MAX;
@@ -53,8 +61,10 @@
 static OptionDefinition
 g_option_table[] =
 {
-    { LLDB_OPT_SET_ALL, false, "platform"   , 'p', required_argument, NULL, 0, eArgTypePlatform, "Specify name of the platform to use for this target, creating the platform if necessary."},
-    { LLDB_OPT_SET_ALL, false, "sdk-version", 'v', required_argument, NULL, 0, eArgTypeNone, "Specify the initial SDK version to use prior to connecting." }
+    { LLDB_OPT_SET_ALL, false, "platform", 'p', required_argument, NULL, 0, eArgTypePlatform, "Specify name of the platform to use for this target, creating the platform if necessary."},
+    { LLDB_OPT_SET_ALL, false, "version" , 'v', required_argument, NULL, 0, eArgTypeNone, "Specify the initial SDK version to use prior to connecting." },
+    { LLDB_OPT_SET_ALL, false, "build"   , 'b', required_argument, NULL, 0, eArgTypeNone, "Specify the initial SDK build number." },
+    { LLDB_OPT_SET_ALL, false, "sysroot" , 's', required_argument, NULL, 0, eArgTypeFilename, "Specify the SDK root directory that contains a root of all remote system files." }
 };
 
 static const uint32_t k_option_table_size = sizeof(g_option_table)/sizeof (OptionDefinition);
@@ -101,6 +111,14 @@
                 error.SetErrorStringWithFormat ("invalid version string '%s'", option_arg);
             break;
             
+        case 'b':
+            m_sdk_build.SetCString (option_arg);
+            break;
+            
+        case 's':
+            m_sdk_sysroot.SetCString (option_arg);
+            break;
+
         default:
             error.SetErrorStringWithFormat ("Unrecognized option '%c'.\n", short_option);
             break;

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp?rev=133231&r1=133230&r2=133231&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp Thu Jun 16 22:31:01 2011
@@ -270,6 +270,9 @@
 const char *
 PlatformRemoteiOS::GetDeviceSupportDirectoryForOSVersion()
 {
+    if (m_sdk_sysroot)
+        return m_sdk_sysroot.GetCString();
+
     if (m_device_support_directory_for_os_version.empty())
     {
         const char *device_support_dir = GetDeviceSupportDirectory();
@@ -376,6 +379,16 @@
         {
             ::snprintf (resolved_path, 
                         sizeof(resolved_path), 
+                        "%s/%s", 
+                        os_version_dir, 
+                        platform_file_path);
+            
+            local_file.SetFile(resolved_path, true);
+            if (local_file.Exists())
+                return error;
+
+            ::snprintf (resolved_path, 
+                        sizeof(resolved_path), 
                         "%s/Symbols.Internal/%s", 
                         os_version_dir, 
                         platform_file_path);

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp?rev=133231&r1=133230&r2=133231&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp Thu Jun 16 22:31:01 2011
@@ -38,7 +38,7 @@
                                                const char *listener_name, 
                                                bool is_platform) :
     Communication(comm_name),
-    m_packet_timeout (60),
+    m_packet_timeout (1),
     m_sequence_mutex (Mutex::eMutexTypeRecursive),
     m_public_is_running (false),
     m_private_is_running (false),
@@ -246,6 +246,7 @@
         size_t content_length = 0;
         size_t total_length = 0;
         size_t checksum_idx = std::string::npos;
+        LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PACKETS));
 
         switch (m_bytes[0])
         {
@@ -281,16 +282,20 @@
                 break;
 
             default:
+                {
+                    if (log)
+                        log->Printf ("GDBRemoteCommunication::%s tossing junk byte at %c",__FUNCTION__, m_bytes[0]);
+                    m_bytes.erase(0, 1);
+                }
                 break;
         }
 
-        LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PACKETS));
         if (content_length == std::string::npos)
         {
             packet.Clear();
             return false;
         }
-        else if (content_length > 0)
+        else if (total_length > 0)
         {
 
             // We have a valid packet...
@@ -345,12 +350,6 @@
             packet.SetFilePos(0);
             return success;
         }
-        else
-        {
-            if (log)
-                log->Printf ("GDBRemoteCommunication::%s tossing junk byte at %c",__FUNCTION__, m_bytes[0]);
-            m_bytes.erase(0, 1);
-        }
     }
     packet.Clear();
     return false;

Modified: lldb/trunk/source/Target/Platform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Platform.cpp?rev=133231&r1=133230&r2=133231&view=diff
==============================================================================
--- lldb/trunk/source/Target/Platform.cpp (original)
+++ lldb/trunk/source/Target/Platform.cpp Thu Jun 16 22:31:01 2011
@@ -161,6 +161,8 @@
     m_is_host (is_host),
     m_os_version_set_while_connected (false),
     m_system_arch_set_while_connected (false),
+    m_sdk_sysroot (),
+    m_sdk_build (),
     m_remote_url (),
     m_name (),
     m_major_os_version (UINT32_MAX),





More information about the lldb-commits mailing list