diff options
author | Greg Clayton <gclayton@apple.com> | 2011-06-17 03:31:01 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2011-06-17 03:31:01 +0000 |
commit | f3dd93c888afa9dcdbd7da6d6e09c879ce6b2cb2 (patch) | |
tree | f76a511e402175dfec524f1f6bacd9daccb64f25 /lldb/source | |
parent | b0f5372bb33dac2aa487e9f4041e32910550344e (diff) | |
download | bcm5719-llvm-f3dd93c888afa9dcdbd7da6d6e09c879ce6b2cb2.tar.gz bcm5719-llvm-f3dd93c888afa9dcdbd7da6d6e09c879ce6b2cb2.zip |
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.
llvm-svn: 133231
Diffstat (limited to 'lldb/source')
-rw-r--r-- | lldb/source/API/SBDebugger.cpp | 16 | ||||
-rw-r--r-- | lldb/source/Interpreter/OptionGroupPlatform.cpp | 22 | ||||
-rw-r--r-- | lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp | 13 | ||||
-rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp | 17 | ||||
-rw-r--r-- | lldb/source/Target/Platform.cpp | 2 |
5 files changed, 59 insertions, 11 deletions
diff --git a/lldb/source/API/SBDebugger.cpp b/lldb/source/API/SBDebugger.cpp index 04d8f72ee83..35a66ae55d0 100644 --- a/lldb/source/API/SBDebugger.cpp +++ b/lldb/source/API/SBDebugger.cpp @@ -880,6 +880,22 @@ SBDebugger::SetCurrentPlatform (const char *platform_name) } 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) diff --git a/lldb/source/Interpreter/OptionGroupPlatform.cpp b/lldb/source/Interpreter/OptionGroupPlatform.cpp index d94c41ab8b5..1734a792d60 100644 --- a/lldb/source/Interpreter/OptionGroupPlatform.cpp +++ b/lldb/source/Interpreter/OptionGroupPlatform.cpp @@ -36,6 +36,12 @@ OptionGroupPlatform::CreatePlatformWithOptions (CommandInterpreter &interpreter, 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 @@ void 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 @@ OptionGroupPlatform::OptionParsingStarting (CommandInterpreter &interpreter) 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 @@ OptionGroupPlatform::SetOptionValue (CommandInterpreter &interpreter, 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; diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp index 881b15bc451..1bcbbddb9f4 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp @@ -270,6 +270,9 @@ PlatformRemoteiOS::GetDeviceSupportDirectory() 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 @@ PlatformRemoteiOS::GetFile (const FileSpec &platform_file, { ::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); diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp index c2c9ddf3bfb..12c912da02f 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp @@ -38,7 +38,7 @@ GDBRemoteCommunication::GDBRemoteCommunication(const char *comm_name, 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 @@ GDBRemoteCommunication::CheckForPacket (const uint8_t *src, size_t src_len, Stri 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 @@ GDBRemoteCommunication::CheckForPacket (const uint8_t *src, size_t src_len, Stri 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 @@ GDBRemoteCommunication::CheckForPacket (const uint8_t *src, size_t src_len, Stri 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; diff --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp index 5c38ab33928..e3a4e817beb 100644 --- a/lldb/source/Target/Platform.cpp +++ b/lldb/source/Target/Platform.cpp @@ -161,6 +161,8 @@ Platform::Platform (bool is_host) : 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), |