<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><blockquote type="cite">Author: enrico<br>Date: Mon Apr 9 16:43:43 2012<br>New Revision: 154345<br><br>URL: <a href="http://llvm.org/viewvc/llvm-project?rev=154345&view=rev">http://llvm.org/viewvc/llvm-project?rev=154345&view=rev</a><br>Log:<br>Patch by Viktor Kutuzov <<a href="mailto:vkutuzov@accesssoftek.com">vkutuzov@accesssoftek.com</a>> to replace an #import directive with a FreeBSD-friendly #include one<br><div apple-content-edited="true">
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="orphans: 2; text-align: -webkit-auto; text-indent: 0px; widows: 2; -webkit-text-decorations-in-effect: none; "></span></div></span></div></span></div></span></div></span></span></div></blockquote><div><br></div><div>Here it goes. Thanks :-)</div><br><div apple-content-edited="true"><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="orphans: 2; text-align: -webkit-auto; text-indent: 0px; widows: 2; -webkit-text-decorations-in-effect: none; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; color: rgb(0, 0, 0); "><i>Enrico Granata</i></div><div style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; ">✉ egranata@<font class="Apple-style-span" color="#ff230e"></font>.com</div><div>✆ (four oh eight) 862-7683</div></div></span></div></span></div></span></div></span></div></span></span>
</div>
<br><div><div>On Apr 9, 2012, at 2:34 PM, Viktor Kutuzov wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div> Hello Enrico,<br><br>would you replace an import statement with #include in GDBRemoteCommunicationServer.cpp like in the attached patch? The current #import statement causes a heap of the errors on the FreeBSD systems.<br><br>Thanks.<br>Viktor.<br><br>-----Original Message-----<br>From: <a href="mailto:lldb-commits-bounces@cs.uiuc.edu">lldb-commits-bounces@cs.uiuc.edu</a> [mailto:lldb-commits-bounces@cs.uiuc.edu] On Behalf Of Enrico Granata<br>Sent: Friday, April 06, 2012 5:04 PM<br>To: <a href="mailto:lldb-commits@cs.uiuc.edu">lldb-commits@cs.uiuc.edu</a><br>Subject: [Lldb-commits] [lldb] r154233 - in /lldb/branches/lldb-platform-work: include/lldb/Core/ include/lldb/Host/ include/lldb/Target/ lldb.xcodeproj/ source/Commands/ source/Core/ source/Host/common/ source/Host/macosx/ source/Plugins/Platform/MacOSX/ sourc...<br><br>Author: enrico<br>Date: Fri Apr 6 19:03:47 2012<br>New Revision: 154233<br><br>URL: <a href="http://llvm.org/viewvc/llvm-project?rev=154233&view=rev">http://llvm.org/viewvc/llvm-project?rev=154233&view=rev</a><br>Log:<br>Initial checkin of new platform functionality<br>The local and remote mac platforms now have capabilities to:<br> - spawn a process, wait for it to exit, and return its exit code<br> - create a new directory given its path<br> - open, read, write and close a file given its path<br>This allow some basic remote process running and I/O through lldb-platform<br>This is an initial checkin, the design and implementation of the features are not final and expected to evolve over time<br>Where possible and reasonable, I have used the standard commands from the GDB remote protocol. In some cases, there are new commands defined that extend the protocol.<br>If any of these really do exist in GDB remote itself, feel free to point me at them.<br><br>Added:<br> lldb/branches/lldb-platform-work/include/lldb/Core/StreamGDBRemote.h<br> lldb/branches/lldb-platform-work/source/Core/StreamGDBRemote.cpp<br>Modified:<br> lldb/branches/lldb-platform-work/include/lldb/Core/Stream.h<br> lldb/branches/lldb-platform-work/include/lldb/Host/Host.h<br> lldb/branches/lldb-platform-work/include/lldb/Target/Platform.h<br> lldb/branches/lldb-platform-work/lldb.xcodeproj/project.pbxproj<br> lldb/branches/lldb-platform-work/source/Commands/CommandObjectPlatform.cpp<br> lldb/branches/lldb-platform-work/source/Host/common/Host.cpp<br> lldb/branches/lldb-platform-work/source/Host/macosx/Host.mm<br> lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp<br> lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformMacOSX.h<br> lldb/branches/lldb-platform-work/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp<br> lldb/branches/lldb-platform-work/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h<br> lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp<br> lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h<br> lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp<br> lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.h<br> lldb/branches/lldb-platform-work/source/Target/Platform.cpp<br> lldb/branches/lldb-platform-work/source/Utility/StringExtractorGDBRemote.cpp<br> lldb/branches/lldb-platform-work/source/Utility/StringExtractorGDBRemote.h<br> lldb/branches/lldb-platform-work/tools/lldb-platform/lldb-platform.cpp<br><br>Modified: lldb/branches/lldb-platform-work/include/lldb/Core/Stream.h<br>URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Core/Stream.h?rev=154233&r1=154232&r2=154233&view=diff">http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Core/Stream.h?rev=154233&r1=154232&r2=154233&view=diff</a><br>==============================================================================<br>--- lldb/branches/lldb-platform-work/include/lldb/Core/Stream.h (original)<br>+++ lldb/branches/lldb-platform-work/include/lldb/Core/Stream.h Fri Apr 6 19:03:47 2012<br>@@ -590,7 +590,7 @@<br> static void<br> UnitTest(Stream *s);<br><br>-private:<br>+protected:<br> //------------------------------------------------------------------<br> // Member variables<br> //------------------------------------------------------------------<br><br>Added: lldb/branches/lldb-platform-work/include/lldb/Core/StreamGDBRemote.h<br>URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Core/StreamGDBRemote.h?rev=154233&view=auto">http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Core/StreamGDBRemote.h?rev=154233&view=auto</a><br>==============================================================================<br>--- lldb/branches/lldb-platform-work/include/lldb/Core/StreamGDBRemote.h (added)<br>+++ lldb/branches/lldb-platform-work/include/lldb/Core/StreamGDBRemote.h Fri Apr 6 19:03:47 2012<br>@@ -0,0 +1,54 @@<br>+//===-- StreamGDBRemote.h ----------------------------------------*- C++ -*-===//<br>+//<br>+// The LLVM Compiler Infrastructure<br>+//<br>+// This file is distributed under the University of Illinois Open Source<br>+// License. See LICENSE.TXT for details.<br>+//<br>+//===----------------------------------------------------------------------===//<br>+<br>+#ifndef liblldb_StreamGDBRemote_h_<br>+#define liblldb_StreamGDBRemote_h_<br>+<br>+// C Includes<br>+// C++ Includes<br>+<br>+// Other libraries and framework includes<br>+// Project includes<br>+<br>+#include "lldb/Core/StreamString.h"<br>+<br>+namespace lldb_private {<br>+<br>+ class StreamGDBRemote : public StreamString<br>+ {<br>+ public:<br>+ StreamGDBRemote ();<br>+<br>+ StreamGDBRemote (uint32_t flags,<br>+ uint32_t addr_size,<br>+ lldb::ByteOrder byte_order);<br>+<br>+ virtual<br>+ ~StreamGDBRemote ();<br>+<br>+ //------------------------------------------------------------------<br>+ /// Output a block of data to the stream performing GDB-remote escaping.<br>+ ///<br>+ /// @param[in] s<br>+ /// A block of data.<br>+ ///<br>+ /// @param[in] src_len<br>+ /// The amount of data to write.<br>+ ///<br>+ /// @return<br>+ /// Number of bytes written.<br>+ //------------------------------------------------------------------<br>+ int<br>+ PutEscapedBytes (const void* s,<br>+ size_t src_len);<br>+ };<br>+<br>+} // namespace lldb_private<br>+<br>+#endif // liblldb_StreamGDBRemote_h_<br><br>Modified: lldb/branches/lldb-platform-work/include/lldb/Host/Host.h<br>URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Host/Host.h?rev=154233&r1=154232&r2=154233&view=diff">http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Host/Host.h?rev=154233&r1=154232&r2=154233&view=diff</a><br>==============================================================================<br>--- lldb/branches/lldb-platform-work/include/lldb/Host/Host.h (original)<br>+++ lldb/branches/lldb-platform-work/include/lldb/Host/Host.h Fri Apr 6 19:03:47 2012<br>@@ -438,6 +438,26 @@<br> DynamicLibraryGetSymbol (void *dynamic_library_handle,<br> const char *symbol_name,<br> Error &error);<br>+<br>+ static uint32_t<br>+ RunProgramAndGetExitCode (const FileSpec& file_spec);<br>+<br>+ static uint32_t<br>+ MakeDirectory (const char* path, mode_t mode);<br>+<br>+ static uint32_t<br>+ OpenFile (const FileSpec& file_spec,<br>+ uint32_t flags,<br>+ mode_t mode);<br>+<br>+ static bool<br>+ CloseFile (uint32_t fd);<br>+<br>+ static uint32_t<br>+ WriteFile (uint32_t fd, uint64_t offset, void* data, size_t data_len);<br>+<br>+ static uint32_t<br>+ ReadFile (uint32_t fd, uint64_t offset, void* data_ptr, size_t len_wanted);<br> };<br><br> } // namespace lldb_private<br><br>Modified: lldb/branches/lldb-platform-work/include/lldb/Target/Platform.h<br>URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Target/Platform.h?rev=154233&r1=154232&r2=154233&view=diff">http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Target/Platform.h?rev=154233&r1=154232&r2=154233&view=diff</a><br>==============================================================================<br>--- lldb/branches/lldb-platform-work/include/lldb/Target/Platform.h (original)<br>+++ lldb/branches/lldb-platform-work/include/lldb/Target/Platform.h Fri Apr 6 19:03:47 2012<br>@@ -449,6 +449,53 @@<br> {<br> return false;<br> }<br>+<br>+ virtual uint32_t<br>+ RunShellCommand (const std::string &command_line)<br>+ {<br>+ return UINT32_MAX;<br>+ }<br>+<br>+ virtual uint32_t<br>+ MakeDirectory (const std::string &path,<br>+ mode_t mode)<br>+ {<br>+ return UINT32_MAX;<br>+ }<br>+<br>+ virtual uint32_t<br>+ OpenFile (const FileSpec& file_spec,<br>+ uint32_t flags,<br>+ mode_t mode)<br>+ {<br>+ return UINT32_MAX;<br>+ }<br>+<br>+ virtual bool<br>+ CloseFile (uint32_t fd)<br>+ {<br>+ return false;<br>+ }<br>+<br>+ virtual uint32_t<br>+ ReadFile (uint32_t fd, uint64_t offset,<br>+ void *data_ptr, size_t len)<br>+ {<br>+ return UINT32_MAX;<br>+ }<br>+<br>+ virtual uint32_t<br>+ WriteFile (uint32_t fd, uint64_t offset,<br>+ void* data, size_t len)<br>+ {<br>+ return UINT32_MAX;<br>+ }<br>+<br>+ virtual Error<br>+ PutFile (const FileSpec& source,<br>+ const FileSpec& destination,<br>+ uint32_t uid = UINT32_MAX,<br>+ uint32_t gid = UINT32_MAX);<br><br> protected:<br> bool m_is_host;<br><br>Modified: lldb/branches/lldb-platform-work/lldb.xcodeproj/project.pbxproj<br>URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/lldb.xcodeproj/project.pbxproj?rev=154233&r1=154232&r2=154233&view=diff">http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/lldb.xcodeproj/project.pbxproj?rev=154233&r1=154232&r2=154233&view=diff</a><br>==============================================================================<br>--- lldb/branches/lldb-platform-work/lldb.xcodeproj/project.pbxproj (original)<br>+++ lldb/branches/lldb-platform-work/lldb.xcodeproj/project.pbxproj Fri Apr 6 19:03:47 2012<br>@@ -469,6 +469,8 @@<br> 941BCC8214E48C4000BB969C /* SBTypeSynthetic.h in Headers */ = {isa = PBXBuildFile; fileRef = 9461568914E355F2003A195C /* SBTypeSynthetic.h */; settings = {ATTRIBUTES = (Public, ); }; };<br> 9443B122140C18C40013457C /* SBData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9443B121140C18C10013457C /* SBData.cpp */; };<br> 9443B123140C26AB0013457C /* SBData.h in Headers */ = {isa = PBXBuildFile; fileRef = 9443B120140C18A90013457C /* SBData.h */; settings = {ATTRIBUTES = (Public, ); }; };<br>+ 945E8D7E152F6AA80019BCCD /* StreamGDBRemote.h in Headers */ = {isa = PBXBuildFile; fileRef = 945E8D7D152F6AA80019BCCD /* StreamGDBRemote.h */; };<br>+ 945E8D80152F6AB40019BCCD /* StreamGDBRemote.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 945E8D7F152F6AB40019BCCD /* StreamGDBRemote.cpp */; };<br> 94611EB213CCA4A4003A22AF /* RefCounter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 94611EB113CCA4A4003A22AF /* RefCounter.cpp */; };<br> 9461569A14E358A6003A195C /* SBTypeFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9461568A14E35621003A195C /* SBTypeFilter.cpp */; };<br> 9461569B14E358A6003A195C /* SBTypeFormat.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9461568B14E35621003A195C /* SBTypeFormat.cpp */; };<br>@@ -483,6 +485,7 @@<br> 9475C18F14E5F858001BFC6D /* SBTypeNameSpecifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 9475C18C14E5F826001BFC6D /* SBTypeNameSpecifier.h */; settings = {ATTRIBUTES = (Public, ); }; };<br> 949ADF031406F648004833E1 /* ValueObjectConstResultImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 949ADF021406F648004833E1 /* ValueObjectConstResultImpl.cpp */; };<br> 94B6E76213D88365005F417F /* ValueObjectSyntheticFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 94B6E76113D88362005F417F /* ValueObjectSyntheticFilter.cpp */; };<br>+ 94E829CA152D33C1006F96A3 /* lldb-platform in Resources */ = {isa = PBXBuildFile; fileRef = 26DC6A101337FE6900FF7998 /* lldb-platform */; };<br> 94FA3DE01405D50400833217 /* ValueObjectConstResultChild.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 94FA3DDF1405D50300833217 /* ValueObjectConstResultChild.cpp */; };<br> 9A19A6AF1163BBB200E0D453 /* SBValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A19A6A51163BB7E00E0D453 /* SBValue.h */; settings = {ATTRIBUTES = (Public, ); }; };<br> 9A19A6B01163BBB300E0D453 /* SBValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A19A6AD1163BB9800E0D453 /* SBValue.cpp */; };<br>@@ -630,6 +633,13 @@<br> remoteGlobalIDString = 26DC6A0F1337FE6900FF7998;<br> remoteInfo = "lldb-platform";<br> };<br>+ 94E829C8152D33B4006F96A3 /* PBXContainerItemProxy */ = {<br>+ isa = PBXContainerItemProxy;<br>+ containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;<br>+ proxyType = 1;<br>+ remoteGlobalIDString = 26DC6A0F1337FE6900FF7998;<br>+ remoteInfo = "lldb-platform";<br>+ };<br> /* End PBXContainerItemProxy section */<br><br> /* Begin PBXCopyFilesBuildPhase section */<br>@@ -1409,6 +1419,8 @@<br> 9415F61713B2C0EF00A52B36 /* FormatManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; name = FormatManager.cpp; path = source/Core/FormatManager.cpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };<br> 9443B120140C18A90013457C /* SBData.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SBData.h; path = include/lldb/API/SBData.h; sourceTree = "<group>"; };<br> 9443B121140C18C10013457C /* SBData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBData.cpp; path = source/API/SBData.cpp; sourceTree = "<group>"; };<br>+ 945E8D7D152F6AA80019BCCD /* StreamGDBRemote.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StreamGDBRemote.h; path = include/lldb/Core/StreamGDBRemote.h; sourceTree = "<group>"; };<br>+ 945E8D7F152F6AB40019BCCD /* StreamGDBRemote.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StreamGDBRemote.cpp; path = source/Core/StreamGDBRemote.cpp; sourceTree = "<group>"; };<br> 94611EAF13CCA363003A22AF /* RefCounter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = RefCounter.h; path = include/lldb/Utility/RefCounter.h; sourceTree = "<group>"; };<br> 94611EB113CCA4A4003A22AF /* RefCounter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RefCounter.cpp; path = source/Utility/RefCounter.cpp; sourceTree = "<group>"; };<br> 9461568614E355F2003A195C /* SBTypeFilter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SBTypeFilter.h; path = include/lldb/API/SBTypeFilter.h; sourceTree = "<group>"; };<br>@@ -2419,6 +2431,8 @@<br> 4C6649A214EEE81000B0316F /* StreamCallback.cpp */,<br> 26BC7D7A10F1B77400F91463 /* StreamFile.h */,<br> 26BC7E9210F1B85900F91463 /* StreamFile.cpp */,<br>+ 945E8D7D152F6AA80019BCCD /* StreamGDBRemote.h */,<br>+ 945E8D7F152F6AB40019BCCD /* StreamGDBRemote.cpp */,<br> 26BC7D7B10F1B77400F91463 /* StreamString.h */,<br> 26BC7E9310F1B85900F91463 /* StreamString.cpp */,<br> 4C626533130F1B0A00C889F6 /* StreamTee.h */,<br>@@ -3257,7 +3271,7 @@<br> buildRules = (<br> );<br> dependencies = (<br>- B2FA4F83152FBAF2005535AB /* PBXTargetDependency */,<br>+ 94E829C9152D33B4006F96A3 /* PBXTargetDependency */,<br> 2689011513353E9B00698AC0 /* PBXTargetDependency */,<br> 262CFC7211A450CB00946C6C /* PBXTargetDependency */,<br> 26368AF6126B95FA00E8659F /* PBXTargetDependency */,<br>@@ -3409,7 +3423,7 @@<br> isa = PBXResourcesBuildPhase;<br> buildActionMask = 2147483647;<br> files = (<br>- B2FA4F84152FBB0F005535AB /* lldb-platform in Resources */,<br>+ 94E829CA152D33C1006F96A3 /* lldb-platform in Resources */,<br> 262CFC7711A4510000946C6C /* debugserver in Resources */,<br> 26368AF7126B960500E8659F /* darwin-debug in Resources */,<br> );<br>@@ -3917,6 +3931,7 @@<br> 26FFC19D14FC072100087D58 /* DynamicLoaderPOSIXDYLD.cpp in Sources */,<br> 2694E99D14FC0BB30076DE67 /* PlatformFreeBSD.cpp in Sources */,<br> 2694E9A414FC0BBD0076DE67 /* PlatformLinux.cpp in Sources */,<br>+ 945E8D80152F6AB40019BCCD /* StreamGDBRemote.cpp in Sources */,<br> );<br> runOnlyForDeploymentPostprocessing = 0;<br> };<br>@@ -4029,6 +4044,11 @@<br> target = 26DC6A0F1337FE6900FF7998 /* lldb-platform */;<br> targetProxy = B2FA4F82152FBAF2005535AB /* PBXContainerItemProxy */;<br> };<br>+ 94E829C9152D33B4006F96A3 /* PBXTargetDependency */ = {<br>+ isa = PBXTargetDependency;<br>+ target = 26DC6A0F1337FE6900FF7998 /* lldb-platform */;<br>+ targetProxy = 94E829C8152D33B4006F96A3 /* PBXContainerItemProxy */;<br>+ };<br> /* End PBXTargetDependency section */<br><br> /* Begin XCBuildConfiguration section */<br><br>Modified: lldb/branches/lldb-platform-work/source/Commands/CommandObjectPlatform.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Commands/CommandObjectPlatform.cpp?rev=154233&r1=154232&r2=154233&view=diff">http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Commands/CommandObjectPlatform.cpp?rev=154233&r1=154232&r2=154233&view=diff</a><br>==============================================================================<br>--- lldb/branches/lldb-platform-work/source/Commands/CommandObjectPlatform.cpp (original)<br>+++ lldb/branches/lldb-platform-work/source/Commands/CommandObjectPlatform.cpp Fri Apr 6 19:03:47 2012<br>@@ -218,6 +218,416 @@<br> };<br><br> //----------------------------------------------------------------------<br>+// "platform shell"<br>+//----------------------------------------------------------------------<br>+class CommandObjectPlatformShell : public CommandObject<br>+{<br>+public:<br>+ CommandObjectPlatformShell (CommandInterpreter &interpreter) :<br>+ CommandObject (interpreter,<br>+ "platform shell",<br>+ "Run a shell command on the currently selected platform.",<br>+ NULL,<br>+ 0)<br>+ {<br>+ }<br>+<br>+ virtual<br>+ ~CommandObjectPlatformShell ()<br>+ {<br>+ }<br>+<br>+ virtual bool<br>+ Execute (Args& args, CommandReturnObject &result)<br>+ {<br>+ PlatformSP platform_sp (m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform());<br>+ if (platform_sp)<br>+ {<br>+ std::string cmd_line;<br>+ args.GetCommandString(cmd_line);<br>+ uint32_t retcode = platform_sp->RunShellCommand(cmd_line);<br>+ result.AppendMessageWithFormat("Status = %d\n",retcode);<br>+ result.SetStatus (eReturnStatusSuccessFinishResult);<br>+ }<br>+ else<br>+ {<br>+ result.AppendError ("no platform currently selected\n");<br>+ result.SetStatus (eReturnStatusFailed);<br>+ }<br>+ return result.Succeeded();<br>+ }<br>+};<br>+<br>+//----------------------------------------------------------------------<br>+// "platform mkdir"<br>+//----------------------------------------------------------------------<br>+class CommandObjectPlatformMkDir : public CommandObject<br>+{<br>+public:<br>+ CommandObjectPlatformMkDir (CommandInterpreter &interpreter) :<br>+ CommandObject (interpreter,<br>+ "platform shell",<br>+ "Make a new directory on the remote end.",<br>+ NULL,<br>+ 0)<br>+ {<br>+ }<br>+<br>+ virtual<br>+ ~CommandObjectPlatformMkDir ()<br>+ {<br>+ }<br>+<br>+ virtual bool<br>+ Execute (Args& args, CommandReturnObject &result)<br>+ {<br>+ PlatformSP platform_sp (m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform());<br>+ if (platform_sp)<br>+ {<br>+ std::string cmd_line;<br>+ args.GetCommandString(cmd_line);<br>+ uint32_t retcode = platform_sp->MakeDirectory(cmd_line,0000700 | 0000070 | 0000007);<br>+ result.AppendMessageWithFormat("Status = %d\n",retcode);<br>+ result.SetStatus (eReturnStatusSuccessFinishResult);<br>+ }<br>+ else<br>+ {<br>+ result.AppendError ("no platform currently selected\n");<br>+ result.SetStatus (eReturnStatusFailed);<br>+ }<br>+ return result.Succeeded();<br>+ }<br>+};<br>+<br>+//----------------------------------------------------------------------<br>+// "platform fopen"<br>+//----------------------------------------------------------------------<br>+class CommandObjectPlatformFOpen : public CommandObject<br>+{<br>+public:<br>+ CommandObjectPlatformFOpen (CommandInterpreter &interpreter) :<br>+ CommandObject (interpreter,<br>+ "platform fopen",<br>+ "Open a file on the remote end.",<br>+ NULL,<br>+ 0)<br>+ {<br>+ }<br>+<br>+ virtual<br>+ ~CommandObjectPlatformFOpen ()<br>+ {<br>+ }<br>+<br>+ virtual bool<br>+ Execute (Args& args, CommandReturnObject &result)<br>+ {<br>+ PlatformSP platform_sp (m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform());<br>+ if (platform_sp)<br>+ {<br>+ std::string cmd_line;<br>+ args.GetCommandString(cmd_line);<br>+ uint32_t retcode = platform_sp->OpenFile(FileSpec(cmd_line.c_str(),false),0x0200 | 0x0002, 0000700 | 0000070 | 0000007);<br>+ result.AppendMessageWithFormat("Status = %d\n",retcode);<br>+ result.SetStatus (eReturnStatusSuccessFinishResult);<br>+ }<br>+ else<br>+ {<br>+ result.AppendError ("no platform currently selected\n");<br>+ result.SetStatus (eReturnStatusFailed);<br>+ }<br>+ return result.Succeeded();<br>+ }<br>+};<br>+<br>+//----------------------------------------------------------------------<br>+// "platform fclose"<br>+//----------------------------------------------------------------------<br>+class CommandObjectPlatformFClose : public CommandObject<br>+{<br>+public:<br>+ CommandObjectPlatformFClose (CommandInterpreter &interpreter) :<br>+ CommandObject (interpreter,<br>+ "platform fclose",<br>+ "Close a file on the remote end.",<br>+ NULL,<br>+ 0)<br>+ {<br>+ }<br>+<br>+ virtual<br>+ ~CommandObjectPlatformFClose ()<br>+ {<br>+ }<br>+<br>+ virtual bool<br>+ Execute (Args& args, CommandReturnObject &result)<br>+ {<br>+ PlatformSP platform_sp (m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform());<br>+ if (platform_sp)<br>+ {<br>+ std::string cmd_line;<br>+ args.GetCommandString(cmd_line);<br>+ uint32_t fd = ::atoi(cmd_line.c_str());<br>+ uint32_t retcode = platform_sp->CloseFile(fd);<br>+ result.AppendMessageWithFormat("Status = %d\n",retcode);<br>+ result.SetStatus (eReturnStatusSuccessFinishResult);<br>+ }<br>+ else<br>+ {<br>+ result.AppendError ("no platform currently selected\n");<br>+ result.SetStatus (eReturnStatusFailed);<br>+ }<br>+ return result.Succeeded();<br>+ }<br>+};<br>+<br>+//----------------------------------------------------------------------<br>+// "platform fread"<br>+//----------------------------------------------------------------------<br>+class CommandObjectPlatformFRead : public CommandObject<br>+{<br>+public:<br>+ CommandObjectPlatformFRead (CommandInterpreter &interpreter) :<br>+ CommandObject (interpreter,<br>+ "platform fread",<br>+ "Read data from a file on the remote end.",<br>+ NULL,<br>+ 0),<br>+ m_options (interpreter)<br>+ {<br>+ }<br>+<br>+ virtual<br>+ ~CommandObjectPlatformFRead ()<br>+ {<br>+ }<br>+<br>+ virtual bool<br>+ Execute (Args& args, CommandReturnObject &result)<br>+ {<br>+ PlatformSP platform_sp (m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform());<br>+ if (platform_sp)<br>+ {<br>+ std::string cmd_line;<br>+ args.GetCommandString(cmd_line);<br>+ uint32_t fd = ::atoi(cmd_line.c_str());<br>+ std::string buffer(m_options.m_count,' ');<br>+ uint32_t retcode = platform_sp->ReadFile(fd, m_options.m_offset, &buffer[0], m_options.m_count);<br>+ result.AppendMessageWithFormat("Return = %d\n",retcode);<br>+ result.AppendMessageWithFormat("Data = %s\n",buffer.c_str());<br>+ result.SetStatus (eReturnStatusSuccessFinishResult);<br>+ }<br>+ else<br>+ {<br>+ result.AppendError ("no platform currently selected\n");<br>+ result.SetStatus (eReturnStatusFailed);<br>+ }<br>+ return result.Succeeded();<br>+ }<br>+ virtual Options *<br>+ GetOptions ()<br>+ {<br>+ return &m_options;<br>+ }<br>+<br>+protected:<br>+ class CommandOptions : public Options<br>+ {<br>+ public:<br>+<br>+ CommandOptions (CommandInterpreter &interpreter) :<br>+ Options (interpreter)<br>+ {<br>+ }<br>+<br>+ virtual<br>+ ~CommandOptions ()<br>+ {<br>+ }<br>+<br>+ virtual Error<br>+ SetOptionValue (uint32_t option_idx, const char *option_arg)<br>+ {<br>+ Error error;<br>+ char short_option = (char) m_getopt_table[option_idx].val;<br>+ bool success = false;<br>+<br>+ switch (short_option)<br>+ {<br>+ case 'o':<br>+ m_offset = Args::StringToUInt32(option_arg, 0, 0, &success);<br>+ if (!success)<br>+ error.SetErrorStringWithFormat("invalid offset: '%s'", option_arg);<br>+ break;<br>+ case 'c':<br>+ m_count = Args::StringToUInt32(option_arg, 0, 0, &success);<br>+ if (!success)<br>+ error.SetErrorStringWithFormat("invalid offset: '%s'", option_arg);<br>+ break;<br>+<br>+ default:<br>+ error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option);<br>+ break;<br>+ }<br>+<br>+ return error;<br>+ }<br>+<br>+ void<br>+ OptionParsingStarting ()<br>+ {<br>+ m_offset = 0;<br>+ m_count = 1;<br>+ }<br>+<br>+ const OptionDefinition*<br>+ GetDefinitions ()<br>+ {<br>+ return g_option_table;<br>+ }<br>+<br>+ // Options table: Required for subclasses of Options.<br>+<br>+ static OptionDefinition g_option_table[];<br>+<br>+ // Instance variables to hold the values for command options.<br>+<br>+ uint32_t m_offset;<br>+ uint32_t m_count;<br>+ };<br>+ CommandOptions m_options;<br>+};<br>+OptionDefinition<br>+CommandObjectPlatformFRead::CommandOptions::g_option_table[] =<br>+{<br>+ { LLDB_OPT_SET_1, false, "offset" , 'o', required_argument, NULL, 0, eArgTypeIndex , "Offset into the file at which to start reading." },<br>+ { LLDB_OPT_SET_1, false, "count" , 'c', required_argument, NULL, 0, eArgTypeCount , "Number of bytes to read from the file." },<br>+ { 0 , false, NULL , 0 , 0 , NULL, 0, eArgTypeNone , NULL }<br>+};<br>+<br>+<br>+//----------------------------------------------------------------------<br>+// "platform fread"<br>+//----------------------------------------------------------------------<br>+class CommandObjectPlatformFWrite : public CommandObject<br>+{<br>+public:<br>+ CommandObjectPlatformFWrite (CommandInterpreter &interpreter) :<br>+ CommandObject (interpreter,<br>+ "platform fwrite",<br>+ "Write data to a file on the remote end.",<br>+ NULL,<br>+ 0),<br>+ m_options (interpreter)<br>+ {<br>+ }<br>+<br>+ virtual<br>+ ~CommandObjectPlatformFWrite ()<br>+ {<br>+ }<br>+<br>+ virtual bool<br>+ Execute (Args& args, CommandReturnObject &result)<br>+ {<br>+ PlatformSP platform_sp (m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform());<br>+ if (platform_sp)<br>+ {<br>+ std::string cmd_line;<br>+ args.GetCommandString(cmd_line);<br>+ uint32_t fd = ::atoi(cmd_line.c_str());<br>+ uint32_t retcode = platform_sp->WriteFile(fd, m_options.m_offset, &m_options.m_data[0], m_options.m_data.size());<br>+ result.AppendMessageWithFormat("Return = %d\n",retcode);<br>+ result.SetStatus (eReturnStatusSuccessFinishResult);<br>+ }<br>+ else<br>+ {<br>+ result.AppendError ("no platform currently selected\n");<br>+ result.SetStatus (eReturnStatusFailed);<br>+ }<br>+ return result.Succeeded();<br>+ }<br>+ virtual Options *<br>+ GetOptions ()<br>+ {<br>+ return &m_options;<br>+ }<br>+<br>+protected:<br>+ class CommandOptions : public Options<br>+ {<br>+ public:<br>+<br>+ CommandOptions (CommandInterpreter &interpreter) :<br>+ Options (interpreter)<br>+ {<br>+ }<br>+<br>+ virtual<br>+ ~CommandOptions ()<br>+ {<br>+ }<br>+<br>+ virtual Error<br>+ SetOptionValue (uint32_t option_idx, const char *option_arg)<br>+ {<br>+ Error error;<br>+ char short_option = (char) m_getopt_table[option_idx].val;<br>+ bool success = false;<br>+<br>+ switch (short_option)<br>+ {<br>+ case 'o':<br>+ m_offset = Args::StringToUInt32(option_arg, 0, 0, &success);<br>+ if (!success)<br>+ error.SetErrorStringWithFormat("invalid offset: '%s'", option_arg);<br>+ break;<br>+ case 's':<br>+ m_data.assign(option_arg);<br>+ break;<br>+<br>+ default:<br>+ error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option);<br>+ break;<br>+ }<br>+<br>+ return error;<br>+ }<br>+<br>+ void<br>+ OptionParsingStarting ()<br>+ {<br>+ m_offset = 0;<br>+ m_data.clear();<br>+ }<br>+<br>+ const OptionDefinition*<br>+ GetDefinitions ()<br>+ {<br>+ return g_option_table;<br>+ }<br>+<br>+ // Options table: Required for subclasses of Options.<br>+<br>+ static OptionDefinition g_option_table[];<br>+<br>+ // Instance variables to hold the values for command options.<br>+<br>+ uint32_t m_offset;<br>+ std::string m_data;<br>+ };<br>+ CommandOptions m_options;<br>+};<br>+OptionDefinition<br>+CommandObjectPlatformFWrite::CommandOptions::g_option_table[] =<br>+{<br>+ { LLDB_OPT_SET_1, false, "offset" , 'o', required_argument, NULL, 0, eArgTypeIndex , "Offset into the file at which to start reading." },<br>+ { LLDB_OPT_SET_1, false, "data" , 'd', required_argument, NULL, 0, eArgTypeValue , "Text to write to the file." },<br>+ { 0 , false, NULL , 0 , 0 , NULL, 0, eArgTypeNone , NULL }<br>+};<br>+<br>+//----------------------------------------------------------------------<br> // "platform connect <connect-url>"<br> //----------------------------------------------------------------------<br> class CommandObjectPlatformConnect : public CommandObject<br>@@ -885,6 +1295,14 @@<br> LoadSubCommand ("connect", CommandObjectSP (new CommandObjectPlatformConnect (interpreter)));<br> LoadSubCommand ("disconnect", CommandObjectSP (new CommandObjectPlatformDisconnect (interpreter)));<br> LoadSubCommand ("process", CommandObjectSP (new CommandObjectPlatformProcess (interpreter)));<br>+#ifdef LLDB_CONFIGURATION_DEBUG<br>+ LoadSubCommand ("shell", CommandObjectSP (new CommandObjectPlatformShell (interpreter)));<br>+ LoadSubCommand ("mkdir", CommandObjectSP (new CommandObjectPlatformMkDir (interpreter)));<br>+ LoadSubCommand ("fopen", CommandObjectSP (new CommandObjectPlatformFOpen (interpreter)));<br>+ LoadSubCommand ("fclose", CommandObjectSP (new CommandObjectPlatformFClose (interpreter)));<br>+ LoadSubCommand ("fread", CommandObjectSP (new CommandObjectPlatformFRead (interpreter)));<br>+ LoadSubCommand ("fwrite", CommandObjectSP (new CommandObjectPlatformFWrite (interpreter)));<br>+#endif<br> }<br><br><br><br>Added: lldb/branches/lldb-platform-work/source/Core/StreamGDBRemote.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Core/StreamGDBRemote.cpp?rev=154233&view=auto">http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Core/StreamGDBRemote.cpp?rev=154233&view=auto</a><br>==============================================================================<br>--- lldb/branches/lldb-platform-work/source/Core/StreamGDBRemote.cpp (added)<br>+++ lldb/branches/lldb-platform-work/source/Core/StreamGDBRemote.cpp Fri Apr 6 19:03:47 2012<br>@@ -0,0 +1,54 @@<br>+//===-- StreamGDBRemote.cpp -------------------------------------*- C++ -*-===//<br>+//<br>+// The LLVM Compiler Infrastructure<br>+//<br>+// This file is distributed under the University of Illinois Open Source<br>+// License. See LICENSE.TXT for details.<br>+//<br>+//===----------------------------------------------------------------------===//<br>+<br>+#include "lldb/Core/StreamGDBRemote.h"<br>+#include <stdio.h><br>+<br>+using namespace lldb;<br>+using namespace lldb_private;<br>+<br>+StreamGDBRemote::StreamGDBRemote () :<br>+StreamString ()<br>+{<br>+}<br>+<br>+StreamGDBRemote::StreamGDBRemote(uint32_t flags, uint32_t addr_size, ByteOrder byte_order) :<br>+StreamString (flags, addr_size, byte_order)<br>+{<br>+}<br>+<br>+StreamGDBRemote::~StreamGDBRemote()<br>+{<br>+}<br>+<br>+<br>+int<br>+StreamGDBRemote::PutEscapedBytes (const void* s,<br>+ size_t src_len)<br>+{<br>+ int bytes_written = 0;<br>+ const uint8_t *src = (const uint8_t *)s;<br>+ bool binary_is_set = m_flags.Test(eBinary);<br>+ m_flags.Clear(eBinary);<br>+ while (src_len)<br>+ {<br>+ uint8_t byte = *src;<br>+ src++; src_len--;<br>+ if (byte == 0x23 || byte == 0x24 || byte == 0x7d || byte == 0x2a)<br>+ {<br>+ bytes_written += PutChar(0x7d);<br>+ byte ^= 0x20;<br>+ }<br>+ bytes_written += PutChar(byte);<br>+ };<br>+ if (binary_is_set)<br>+ m_flags.Set(eBinary);<br>+ return bytes_written;<br>+}<br>+<br><br>Modified: lldb/branches/lldb-platform-work/source/Host/common/Host.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Host/common/Host.cpp?rev=154233&r1=154232&r2=154233&view=diff">http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Host/common/Host.cpp?rev=154233&r1=154232&r2=154233&view=diff</a><br>==============================================================================<br>--- lldb/branches/lldb-platform-work/source/Host/common/Host.cpp (original)<br>+++ lldb/branches/lldb-platform-work/source/Host/common/Host.cpp Fri Apr 6 19:03:47 2012<br>@@ -1256,4 +1256,42 @@<br> return LLDB_INVALID_PROCESS_ID;<br> }<br><br>+uint32_t<br>+Host::RunProgramAndGetExitCode (const FileSpec& file_spec)<br>+{<br>+ return UINT32_MAX;<br>+}<br>+<br>+uint32_t<br>+Host::MakeDirectory (const char* path, mode_t mode)<br>+{<br>+ return UINT32_MAX;<br>+}<br>+<br>+uint32_t<br>+Host::OpenFile (const FileSpec& file_spec,<br>+ uint32_t flags,<br>+ mode_t mode)<br>+{<br>+ return UINT32_MAX;<br>+}<br>+<br>+bool<br>+Host::CloseFile (uint32_t fd)<br>+{<br>+ return false;<br>+}<br>+<br>+uint32_t<br>+Host::WriteFile (uint32_t fd, uint64_t offset, void* data, size_t data_len)<br>+{<br>+ return UINT32_MAX;<br>+}<br>+<br>+uint32_t<br>+Host::ReadFile (uint32_t fd, uint64_t offset, uint8_t* data_ptr, size_t len_wanted)<br>+{<br>+ return UINT32_MAX;<br>+}<br>+<br> #endif<br><br>Modified: lldb/branches/lldb-platform-work/source/Host/macosx/Host.mm<br>URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Host/macosx/Host.mm?rev=154233&r1=154232&r2=154233&view=diff">http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Host/macosx/Host.mm?rev=154233&r1=154232&r2=154233&view=diff</a><br>==============================================================================<br>--- lldb/branches/lldb-platform-work/source/Host/macosx/Host.mm (original)<br>+++ lldb/branches/lldb-platform-work/source/Host/macosx/Host.mm Fri Apr 6 19:03:47 2012<br>@@ -1843,3 +1843,55 @@<br> {<br> return lldb::DataBufferSP();<br> }<br>+<br>+uint32_t<br>+Host::RunProgramAndGetExitCode (const FileSpec& file_spec)<br>+{<br>+ std::string path(512, ' ');<br>+ uint32_t len = file_spec.GetPath(&path[0], 512);<br>+ if (len >= 512)<br>+ {<br>+ path = std::string(len+1,' ');<br>+ len = file_spec.GetPath(&path[0], len);<br>+ }<br>+ return ::system(path.c_str());<br>+}<br>+<br>+uint32_t<br>+Host::MakeDirectory (const char* path, mode_t mode)<br>+{<br>+ return ::mkdir(path,mode);<br>+}<br>+<br>+uint32_t<br>+Host::OpenFile (const FileSpec& file_spec,<br>+ uint32_t flags,<br>+ mode_t mode)<br>+{<br>+ std::string path(512, ' ');<br>+ uint32_t len = file_spec.GetPath(&path[0], 512);<br>+ if (len >= 512)<br>+ {<br>+ path = std::string(len+1,' ');<br>+ len = file_spec.GetPath(&path[0], len);<br>+ }<br>+ return ::open(path.c_str(),flags,mode);<br>+}<br>+<br>+bool<br>+Host::CloseFile (uint32_t fd)<br>+{<br>+ return (::close(fd) == 0);<br>+}<br>+<br>+uint32_t<br>+Host::WriteFile (uint32_t fd, uint64_t offset, void* data, size_t data_len)<br>+{<br>+ return ::pwrite(fd, data, data_len, offset);<br>+}<br>+<br>+uint32_t<br>+Host::ReadFile (uint32_t fd, uint64_t offset, void* data_ptr, size_t len_wanted)<br>+{<br>+ return ::pread(fd, data_ptr, len_wanted, offset);<br>+}<br><br>Modified: lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp?rev=154233&r1=154232&r2=154233&view=diff">http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp?rev=154233&r1=154232&r2=154233&view=diff</a><br>==============================================================================<br>--- lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp (original)<br>+++ lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp Fri Apr 6 19:03:47 2012<br>@@ -10,6 +10,7 @@<br> #include "PlatformMacOSX.h"<br><br> // C Includes<br>+#include <sys/stat.h><br> #include <sys/sysctl.h><br><br> // C++ Includes<br>@@ -150,3 +151,88 @@<br> #endif<br> }<br><br>+uint32_t<br>+PlatformMacOSX::RunShellCommand (const std::string &command_line)<br>+{<br>+ if (IsHost())<br>+ {<br>+ return Host::RunProgramAndGetExitCode(FileSpec(command_line.c_str(),false));<br>+ }<br>+ if (IsRemote() && m_remote_platform_sp)<br>+ return m_remote_platform_sp->RunShellCommand(command_line);<br>+ return Platform::RunShellCommand(command_line);<br>+}<br>+<br>+uint32_t<br>+PlatformMacOSX::MakeDirectory (const std::string &path,<br>+ mode_t mode)<br>+{<br>+ if (IsHost())<br>+ {<br>+ return Host::MakeDirectory (path.c_str(), mode);<br>+ }<br>+ if (IsRemote() && m_remote_platform_sp)<br>+ return m_remote_platform_sp->MakeDirectory(path, mode);<br>+ return Platform::MakeDirectory(path,mode);<br>+}<br>+<br>+uint32_t<br>+PlatformMacOSX::OpenFile (const FileSpec& file_spec,<br>+ uint32_t flags,<br>+ mode_t mode)<br>+{<br>+ if (IsHost())<br>+ {<br>+ return Host::OpenFile(file_spec, flags, mode);<br>+ }<br>+ if (IsRemote() && m_remote_platform_sp)<br>+ return m_remote_platform_sp->OpenFile(file_spec, flags, mode);<br>+ return Platform::OpenFile(file_spec, flags, mode);<br>+}<br>+<br>+bool<br>+PlatformMacOSX::CloseFile (uint32_t fd)<br>+{<br>+ if (IsHost())<br>+ {<br>+ return Host::CloseFile(fd);<br>+ }<br>+ if (IsRemote() && m_remote_platform_sp)<br>+ return m_remote_platform_sp->CloseFile(fd);<br>+ return Platform::CloseFile(fd);<br>+}<br>+<br>+uint32_t<br>+PlatformMacOSX::ReadFile (uint32_t fd, uint64_t offset,<br>+ void *data_ptr, size_t len)<br>+{<br>+ if (IsHost())<br>+ {<br>+ return Host::ReadFile(fd, offset, data_ptr, len);<br>+ }<br>+ if (IsRemote() && m_remote_platform_sp)<br>+ return m_remote_platform_sp->ReadFile(fd, offset, data_ptr, len);<br>+ return Platform::ReadFile(fd, offset, data_ptr, len);<br>+}<br>+<br>+uint32_t<br>+PlatformMacOSX::WriteFile (uint32_t fd, uint64_t offset,<br>+ void* data, size_t len)<br>+{<br>+ if (IsHost())<br>+ {<br>+ return Host::WriteFile(fd, offset, data, len);<br>+ }<br>+ if (IsRemote() && m_remote_platform_sp)<br>+ return m_remote_platform_sp->WriteFile(fd, offset, data, len);<br>+ return Platform::WriteFile(fd, offset, data, len);<br>+}<br>+<br>+lldb_private::Error<br>+PlatformMacOSX::PutFile (const lldb_private::FileSpec& source,<br>+ const lldb_private::FileSpec& destination,<br>+ uint32_t uid,<br>+ uint32_t gid)<br>+{<br>+ return Platform::PutFile(source,destination,uid,gid);<br>+}<br><br>Modified: lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformMacOSX.h<br>URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformMacOSX.h?rev=154233&r1=154232&r2=154233&view=diff">http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformMacOSX.h?rev=154233&r1=154232&r2=154233&view=diff</a><br>==============================================================================<br>--- lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformMacOSX.h (original)<br>+++ lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformMacOSX.h Fri Apr 6 19:03:47 2012<br>@@ -80,6 +80,35 @@<br> GetFile (const lldb_private::FileSpec &platform_file,<br> const lldb_private::UUID *uuid_ptr,<br> lldb_private::FileSpec &local_file);<br>+<br>+ virtual uint32_t<br>+ RunShellCommand (const std::string &command_line);<br>+<br>+ virtual uint32_t<br>+ MakeDirectory (const std::string &path,<br>+ mode_t mode);<br>+<br>+ virtual lldb_private::Error<br>+ PutFile (const lldb_private::FileSpec& source,<br>+ const lldb_private::FileSpec& destination,<br>+ uint32_t uid = UINT32_MAX,<br>+ uint32_t gid = UINT32_MAX);<br>+<br>+ virtual uint32_t<br>+ OpenFile (const lldb_private::FileSpec& file_spec,<br>+ uint32_t flags,<br>+ mode_t mode);<br>+<br>+ virtual bool<br>+ CloseFile (uint32_t fd);<br>+<br>+ virtual uint32_t<br>+ ReadFile (uint32_t fd, uint64_t offset,<br>+ void *data_ptr, size_t len);<br>+<br>+ virtual uint32_t<br>+ WriteFile (uint32_t fd, uint64_t offset,<br>+ void* data, size_t len);<br><br> virtual bool<br> GetSupportedArchitectureAtIndex (uint32_t idx,<br><br>Modified: lldb/branches/lldb-platform-work/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp?rev=154233&r1=154232&r2=154233&view=diff">http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp?rev=154233&r1=154232&r2=154233&view=diff</a><br>==============================================================================<br>--- lldb/branches/lldb-platform-work/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp (original)<br>+++ lldb/branches/lldb-platform-work/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp Fri Apr 6 19:03:47 2012<br>@@ -405,4 +405,52 @@<br> return process_sp;<br> }<br><br>+uint32_t<br>+PlatformRemoteGDBServer::RunShellCommand (const std::string &command_line)<br>+{<br>+ return m_gdb_client.RunShellCommand(command_line);<br>+}<br>+<br>+uint32_t<br>+PlatformRemoteGDBServer::MakeDirectory (const std::string &path,<br>+ mode_t mode)<br>+{<br>+ return m_gdb_client.MakeDirectory(path,mode);<br>+}<br>+<br>+uint32_t<br>+PlatformRemoteGDBServer::OpenFile (const lldb_private::FileSpec& file_spec,<br>+ uint32_t flags,<br>+ mode_t mode)<br>+{<br>+ return m_gdb_client.OpenFile (file_spec, flags, mode);<br>+}<br>+<br>+bool<br>+PlatformRemoteGDBServer::CloseFile (uint32_t fd)<br>+{<br>+ return m_gdb_client.CloseFile (fd);<br>+}<br>+<br>+uint32_t<br>+PlatformRemoteGDBServer::ReadFile (uint32_t fd, uint64_t offset,<br>+ void *data_ptr, size_t len)<br>+{<br>+ return m_gdb_client.ReadFile (fd, offset, data_ptr, len);<br>+}<br><br>+uint32_t<br>+PlatformRemoteGDBServer::WriteFile (uint32_t fd, uint64_t offset,<br>+ void* data, size_t len)<br>+{<br>+ return m_gdb_client.WriteFile (fd, offset, data, len);<br>+}<br>+<br>+lldb_private::Error<br>+PlatformRemoteGDBServer::PutFile (const lldb_private::FileSpec& source,<br>+ const lldb_private::FileSpec& destination,<br>+ uint32_t uid,<br>+ uint32_t gid)<br>+{<br>+ return Platform::PutFile(source,destination,uid,gid);<br>+}<br><br>Modified: lldb/branches/lldb-platform-work/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h<br>URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h?rev=154233&r1=154232&r2=154233&view=diff">http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h?rev=154233&r1=154232&r2=154233&view=diff</a><br>==============================================================================<br>--- lldb/branches/lldb-platform-work/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h (original)<br>+++ lldb/branches/lldb-platform-work/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h Fri Apr 6 19:03:47 2012<br>@@ -140,6 +140,35 @@<br><br> virtual lldb_private::Error<br> DisconnectRemote ();<br>+<br>+ virtual uint32_t<br>+ RunShellCommand (const std::string &command_line);<br>+<br>+ virtual uint32_t<br>+ MakeDirectory (const std::string &path,<br>+ mode_t mode);<br>+<br>+ virtual uint32_t<br>+ OpenFile (const lldb_private::FileSpec& file_spec,<br>+ uint32_t flags,<br>+ mode_t mode);<br>+<br>+ virtual bool<br>+ CloseFile (uint32_t fd);<br>+<br>+ virtual uint32_t<br>+ ReadFile (uint32_t fd, uint64_t offset,<br>+ void *data_ptr, size_t len);<br>+<br>+ virtual uint32_t<br>+ WriteFile (uint32_t fd, uint64_t offset,<br>+ void* data, size_t len);<br>+<br>+ virtual lldb_private::Error<br>+ PutFile (const lldb_private::FileSpec& source,<br>+ const lldb_private::FileSpec& destination,<br>+ uint32_t uid = UINT32_MAX,<br>+ uint32_t gid = UINT32_MAX);<br><br> protected:<br> GDBRemoteCommunicationClient m_gdb_client;<br><br>Modified: lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp?rev=154233&r1=154232&r2=154233&view=diff">http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp?rev=154233&r1=154232&r2=154233&view=diff</a><br>==============================================================================<br>--- lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp (original)<br>+++ lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp Fri Apr 6 19:03:47 2012<br>@@ -18,6 +18,7 @@<br> #include "lldb/Core/ConnectionFileDescriptor.h"<br> #include "lldb/Core/Log.h"<br> #include "lldb/Core/State.h"<br>+#include "lldb/Core/StreamGDBRemote.h"<br> #include "lldb/Core/StreamString.h"<br> #include "lldb/Host/Endian.h"<br> #include "lldb/Host/Host.h"<br>@@ -1875,3 +1876,152 @@<br> }<br> return thread_ids.size();<br> }<br>+<br>+uint32_t<br>+GDBRemoteCommunicationClient::RunShellCommand (const std::string &command_line)<br>+{<br>+ lldb_private::StreamString stream;<br>+ stream.PutCString("qPlatform_Syscall_System:");<br>+ stream.PutBytesAsRawHex8(command_line.c_str(), command_line.size());<br>+ const char *packet = stream.GetData();<br>+ int packet_len = stream.GetSize();<br>+ StringExtractorGDBRemote response;<br>+ if (SendPacketAndWaitForResponse(packet, packet_len, response, false))<br>+ {<br>+ return response.GetHexMaxU32(false, UINT32_MAX);<br>+ }<br>+ return UINT32_MAX;<br>+}<br>+<br>+uint32_t<br>+GDBRemoteCommunicationClient::MakeDirectory (const std::string &path,<br>+ mode_t mode)<br>+{<br>+ lldb_private::StreamString stream;<br>+ stream.PutCString("qPlatform_IO_MkDir:");<br>+ stream.PutHex32(mode);<br>+ stream.PutChar(',');<br>+ stream.PutBytesAsRawHex8(path.c_str(), path.size());<br>+ const char *packet = stream.GetData();<br>+ int packet_len = stream.GetSize();<br>+ StringExtractorGDBRemote response;<br>+ if (SendPacketAndWaitForResponse(packet, packet_len, response, false))<br>+ {<br>+ return response.GetHexMaxU32(false, UINT32_MAX);<br>+ }<br>+ return UINT32_MAX;<br>+<br>+}<br>+<br>+uint32_t<br>+GDBRemoteCommunicationClient::OpenFile (const lldb_private::FileSpec& file_spec,<br>+ uint32_t flags,<br>+ mode_t mode)<br>+{<br>+ lldb_private::StreamString stream;<br>+ stream.PutCString("vFile:open:");<br>+ std::string path(512, ' ');<br>+ uint32_t len = file_spec.GetPath(&path[0], 512);<br>+ if (len >= 512)<br>+ {<br>+ path = std::string(len+1,' ');<br>+ len = file_spec.GetPath(&path[0], len);<br>+ }<br>+ stream.PutCStringAsRawHex8(path.c_str());<br>+ stream.PutChar(',');<br>+ stream.PutHex32(flags);<br>+ stream.PutChar(',');<br>+ stream.PutHex32(mode);<br>+ const char* packet = stream.GetData();<br>+ int packet_len = stream.GetSize();<br>+ StringExtractorGDBRemote response;<br>+ if (SendPacketAndWaitForResponse(packet, packet_len, response, false))<br>+ {<br>+ if (response.GetChar() != 'F')<br>+ return UINT32_MAX;<br>+ uint32_t retcode = response.GetHexMaxU32(false, UINT32_MAX);<br>+ return retcode;<br>+ }<br>+ return UINT32_MAX;<br>+}<br>+<br>+bool<br>+GDBRemoteCommunicationClient::CloseFile (uint32_t fd)<br>+{<br>+ lldb_private::StreamString stream;<br>+ stream.PutCString("vFile:close:");<br>+ stream.PutHex32(fd);<br>+ const char* packet = stream.GetData();<br>+ int packet_len = stream.GetSize();<br>+ StringExtractorGDBRemote response;<br>+ if (SendPacketAndWaitForResponse(packet, packet_len, response, false))<br>+ {<br>+ if (response.GetChar() != 'F')<br>+ return UINT32_MAX;<br>+ uint32_t retcode = response.GetHexMaxU32(false, UINT32_MAX);<br>+ return retcode;<br>+ }<br>+ return UINT32_MAX;<br>+}<br>+<br>+uint32_t<br>+GDBRemoteCommunicationClient::ReadFile (uint32_t fd, uint64_t offset,<br>+ void *data_ptr, size_t len)<br>+{<br>+ lldb_private::StreamString stream;<br>+ stream.PutCString("vFile:read:");<br>+ stream.PutHex32(fd);<br>+ stream.PutChar(',');<br>+ stream.PutHex32(len);<br>+ stream.PutChar(',');<br>+ stream.PutHex32(offset);<br>+ const char* packet = stream.GetData();<br>+ int packet_len = stream.GetSize();<br>+ StringExtractorGDBRemote response;<br>+ if (SendPacketAndWaitForResponse(packet, packet_len, response, false))<br>+ {<br>+ if (response.GetChar() != 'F')<br>+ return UINT32_MAX;<br>+ uint32_t retcode = response.GetHexMaxU32(false, UINT32_MAX);<br>+ if (retcode == UINT32_MAX)<br>+ return retcode;<br>+ if (response.GetChar() == ',')<br>+ return UINT32_MAX;<br>+ if (response.GetChar() == ';')<br>+ {<br>+ std::string buffer;<br>+ response.GetEscapedBinaryData(buffer);<br>+ size_t data_to_write = len;<br>+ if (buffer.size() < len)<br>+ data_to_write = buffer.size();<br>+ memcpy(data_ptr, &buffer[0], data_to_write);<br>+ }<br>+ return retcode;<br>+ }<br>+ return UINT32_MAX;<br>+}<br>+<br>+uint32_t<br>+GDBRemoteCommunicationClient::WriteFile (uint32_t fd, uint64_t offset,<br>+ void* data, size_t len)<br>+{<br>+ lldb_private::StreamGDBRemote stream;<br>+ stream.PutCString("vFile:write:");<br>+ stream.PutHex32(fd);<br>+ stream.PutChar(',');<br>+ stream.PutHex32(offset);<br>+ stream.PutChar(',');<br>+ stream.PutEscapedBytes(data, len);<br>+ const char* packet = stream.GetData();<br>+ int packet_len = stream.GetSize();<br>+ StringExtractorGDBRemote response;<br>+ if (SendPacketAndWaitForResponse(packet, packet_len, response, false))<br>+ {<br>+ if (response.GetChar() != 'F')<br>+ return UINT32_MAX;<br>+ uint32_t retcode = response.GetHexMaxU32(false, UINT32_MAX);<br>+ return retcode;<br>+ }<br>+ return UINT32_MAX;<br>+}<br>+<br><br>Modified: lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h<br>URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h?rev=154233&r1=154232&r2=154233&view=diff">http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h?rev=154233&r1=154232&r2=154233&view=diff</a><br>==============================================================================<br>--- lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h (original)<br>+++ lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h Fri Apr 6 19:03:47 2012<br>@@ -326,6 +326,30 @@<br> {<br> return m_interrupt_sent;<br> }<br>+<br>+ virtual uint32_t<br>+ RunShellCommand (const std::string &command_line);<br>+<br>+ virtual uint32_t<br>+ OpenFile (const lldb_private::FileSpec& file_spec,<br>+ uint32_t flags,<br>+ mode_t mode);<br>+<br>+ virtual bool<br>+ CloseFile (uint32_t fd);<br>+<br>+ virtual uint32_t<br>+ ReadFile (uint32_t fd, uint64_t offset,<br>+ void *data_ptr, size_t len);<br>+<br>+ virtual uint32_t<br>+ WriteFile (uint32_t fd, uint64_t offset,<br>+ void* data, size_t len);<br>+<br>+ virtual uint32_t<br>+ MakeDirectory (const std::string &path,<br>+ mode_t mode);<br>+<br> protected:<br><br> //------------------------------------------------------------------<br><br>Modified: lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp?rev=154233&r1=154232&r2=154233&view=diff">http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp?rev=154233&r1=154232&r2=154233&view=diff</a><br>==============================================================================<br>--- lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp (original)<br>+++ lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp Fri Apr 6 19:03:47 2012<br>@@ -9,6 +9,7 @@<br><br><br> #include "GDBRemoteCommunicationServer.h"<br>+#import "StreamGDBRemote.h"<br><br> // C Includes<br> // C++ Includes<br>@@ -160,6 +161,24 @@<br><br> case StringExtractorGDBRemote::eServerPacketType_QStartNoAckMode:<br> return Handle_QStartNoAckMode (packet);<br>+<br>+ case StringExtractorGDBRemote::eServerPacketType_qPlatform_Syscall_System:<br>+ return Handle_qPlatform_Syscall_System (packet);<br>+<br>+ case StringExtractorGDBRemote::eServerPacketType_qPlatform_IO_MkDir:<br>+ return Handle_qPlatform_IO_MkDir (packet);<br>+<br>+ case StringExtractorGDBRemote::eServerPacketType_vFile_Open:<br>+ return Handle_vFile_Open (packet);<br>+<br>+ case StringExtractorGDBRemote::eServerPacketType_vFile_Close:<br>+ return Handle_vFile_Close (packet);<br>+<br>+ case StringExtractorGDBRemote::eServerPacketType_vFile_pRead:<br>+ return Handle_vFile_pRead (packet);<br>+<br>+ case StringExtractorGDBRemote::eServerPacketType_vFile_pWrite:<br>+ return Handle_vFile_pWrite (packet);<br> }<br> return true;<br> }<br>@@ -832,3 +851,137 @@<br> m_send_acks = false;<br> return true;<br> }<br>+<br>+bool<br>+GDBRemoteCommunicationServer::Handle_qPlatform_Syscall_System (StringExtractorGDBRemote &packet)<br>+{<br>+ packet.SetFilePos(::strlen("qPlatform_Syscall_System:"));<br>+ std::string path;<br>+ packet.GetHexByteString(path);<br>+ uint32_t retcode = Host::RunProgramAndGetExitCode(FileSpec(path.c_str(),false));<br>+ StreamString response;<br>+ response.PutHex32(retcode);<br>+ SendPacket(response);<br>+ return true;<br>+}<br>+<br>+bool<br>+GDBRemoteCommunicationServer::Handle_qPlatform_IO_MkDir (StringExtractorGDBRemote &packet)<br>+{<br>+ packet.SetFilePos(::strlen("qPlatform_IO_MkDir:"));<br>+ mode_t mode = packet.GetHexMaxU32(false, UINT32_MAX);<br>+ if (packet.GetChar() != ',')<br>+ return false;<br>+ std::string path;<br>+ packet.GetHexByteString(path);<br>+ uint32_t retcode = Host::MakeDirectory(path.c_str(),mode);<br>+ StreamString response;<br>+ response.PutHex32(retcode);<br>+ SendPacket(response);<br>+ return true;<br>+}<br>+<br>+bool<br>+GDBRemoteCommunicationServer::Handle_vFile_Open (StringExtractorGDBRemote &packet)<br>+{<br>+ packet.SetFilePos(::strlen("vFile:open:"));<br>+ std::string path;<br>+ packet.GetHexByteString(path);<br>+ if (packet.GetChar() != ',')<br>+ return false;<br>+ uint32_t flags = packet.GetHexMaxU32(false, UINT32_MAX);<br>+ if (packet.GetChar() != ',')<br>+ return false;<br>+ mode_t mode = packet.GetHexMaxU32(false, UINT32_MAX);<br>+ uint32_t retcode = Host::OpenFile(FileSpec(path.c_str(), false), flags, mode);<br>+ StreamString response;<br>+ response.PutChar('F');<br>+ response.PutHex32(retcode);<br>+ if (retcode == UINT32_MAX)<br>+ {<br>+ response.PutChar(',');<br>+ response.PutHex32(retcode); // TODO: replace with Host::GetSyswideErrorCode()<br>+ }<br>+ SendPacket(response);<br>+ return true;<br>+}<br>+<br>+bool<br>+GDBRemoteCommunicationServer::Handle_vFile_Close (StringExtractorGDBRemote &packet)<br>+{<br>+ packet.SetFilePos(::strlen("vFile:close:"));<br>+ uint32_t fd = packet.GetHexMaxU32(false, UINT32_MAX);<br>+ uint32_t retcode = Host::CloseFile(fd);<br>+ StreamString response;<br>+ response.PutChar('F');<br>+ response.PutHex32(retcode);<br>+ if (retcode == UINT32_MAX)<br>+ {<br>+ response.PutChar(',');<br>+ response.PutHex32(retcode); // TODO: replace with Host::GetSyswideErrorCode()<br>+ }<br>+ SendPacket(response);<br>+ return true;<br>+}<br>+<br>+bool<br>+GDBRemoteCommunicationServer::Handle_vFile_pRead (StringExtractorGDBRemote &packet)<br>+{<br>+ StreamGDBRemote response;<br>+ packet.SetFilePos(::strlen("vFile:pread:"));<br>+ uint32_t fd = packet.GetHexMaxU32(false, UINT32_MAX);<br>+ if (packet.GetChar() != ',')<br>+ return false;<br>+ uint32_t count = packet.GetHexMaxU32(false, UINT32_MAX);<br>+ if (packet.GetChar() != ',')<br>+ return false;<br>+ uint32_t offset = packet.GetHexMaxU32(false, UINT32_MAX);<br>+ if (count == UINT32_MAX) // protect yourself against allocating a 4GB buffer<br>+ {<br>+ response.PutChar('F');<br>+ response.PutHex32(UINT32_MAX);<br>+ response.PutChar(',');<br>+ response.PutHex32(UINT32_MAX); // TODO: replace with Host::GetSyswideErrorCode()<br>+ SendPacket(response);<br>+ return true;<br>+ }<br>+ std::string buffer(' ',count);<br>+ uint32_t retcode = Host::ReadFile(fd, offset, &buffer[0], count);<br>+ response.PutChar('F');<br>+ response.PutHex32(retcode);<br>+ if (retcode == UINT32_MAX)<br>+ {<br>+ response.PutChar(',');<br>+ response.PutHex32(retcode); // TODO: replace with Host::GetSyswideErrorCode()<br>+ }<br>+ else<br>+ {<br>+ response.PutChar(';');<br>+ response.PutEscapedBytes(&buffer[0], retcode);<br>+ }<br>+ SendPacket(response);<br>+ return true;<br>+}<br>+<br>+bool<br>+GDBRemoteCommunicationServer::Handle_vFile_pWrite (StringExtractorGDBRemote &packet)<br>+{<br>+ packet.SetFilePos(::strlen("vFile:pwrite:"));<br>+ uint32_t fd = packet.GetHexMaxU32(false, UINT32_MAX);<br>+ if (packet.GetChar() != ',')<br>+ return false;<br>+ uint32_t offset = packet.GetHexMaxU32(false, UINT32_MAX);<br>+ std::string buffer;<br>+ packet.GetEscapedBinaryData(buffer);<br>+ uint32_t retcode = Host::WriteFile(fd, offset, &buffer[0], buffer.size());<br>+ StreamString response;<br>+ response.PutChar('F');<br>+ response.PutHex32(retcode);<br>+ if (retcode == UINT32_MAX)<br>+ {<br>+ response.PutChar(',');<br>+ response.PutHex32(retcode); // TODO: replace with Host::GetSyswideErrorCode()<br>+ }<br>+ SendPacket(response);<br>+ return true;<br>+}<br><br>Modified: lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.h<br>URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.h?rev=154233&r1=154232&r2=154233&view=diff">http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.h?rev=154233&r1=154232&r2=154233&view=diff</a><br>==============================================================================<br>--- lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.h (original)<br>+++ lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.h Fri Apr 6 19:03:47 2012<br>@@ -85,7 +85,7 @@<br><br> bool<br> Handle_A (StringExtractorGDBRemote &packet);<br>-<br>+<br> bool<br> Handle_qLaunchSuccess (StringExtractorGDBRemote &packet);<br><br>@@ -96,6 +96,12 @@<br> Handle_qLaunchGDBServer (StringExtractorGDBRemote &packet);<br><br> bool<br>+ Handle_qPlatform_IO_MkDir (StringExtractorGDBRemote &packet);<br>+<br>+ bool<br>+ Handle_qPlatform_Syscall_System (StringExtractorGDBRemote &packet);<br>+<br>+ bool<br> Handle_qProcessInfoPID (StringExtractorGDBRemote &packet);<br><br> bool<br>@@ -137,6 +143,17 @@<br> bool<br> Handle_QSetSTDERR (StringExtractorGDBRemote &packet);<br><br>+ bool<br>+ Handle_vFile_Open (StringExtractorGDBRemote &packet);<br>+<br>+ bool<br>+ Handle_vFile_Close (StringExtractorGDBRemote &packet);<br>+<br>+ bool<br>+ Handle_vFile_pRead (StringExtractorGDBRemote &packet);<br>+<br>+ bool<br>+ Handle_vFile_pWrite (StringExtractorGDBRemote &packet);<br> private:<br> //------------------------------------------------------------------<br> // For GDBRemoteCommunicationServer only<br><br>Modified: lldb/branches/lldb-platform-work/source/Target/Platform.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Target/Platform.cpp?rev=154233&r1=154232&r2=154233&view=diff">http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Target/Platform.cpp?rev=154233&r1=154232&r2=154233&view=diff</a><br>==============================================================================<br>--- lldb/branches/lldb-platform-work/source/Target/Platform.cpp (original)<br>+++ lldb/branches/lldb-platform-work/source/Target/Platform.cpp Fri Apr 6 19:03:47 2012<br>@@ -658,4 +658,14 @@<br><br> }<br><br>+Error<br>+Platform::PutFile (const FileSpec& source,<br>+ const FileSpec& destination,<br>+ uint32_t uid,<br>+ uint32_t gid)<br>+{<br>+ Error error("unimplemented");<br>+ return error;<br>+}<br>+<br><br><br>Modified: lldb/branches/lldb-platform-work/source/Utility/StringExtractorGDBRemote.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Utility/StringExtractorGDBRemote.cpp?rev=154233&r1=154232&r2=154233&view=diff">http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Utility/StringExtractorGDBRemote.cpp?rev=154233&r1=154232&r2=154233&view=diff</a><br>==============================================================================<br>--- lldb/branches/lldb-platform-work/source/Utility/StringExtractorGDBRemote.cpp (original)<br>+++ lldb/branches/lldb-platform-work/source/Utility/StringExtractorGDBRemote.cpp Fri Apr 6 19:03:47 2012<br>@@ -126,8 +126,11 @@<br> break;<br><br> case 'P':<br>- if (PACKET_STARTS_WITH ("qProcessInfoPID:")) return eServerPacketType_qProcessInfoPID;<br>+ if (PACKET_STARTS_WITH ("qProcessInfoPID:")) return eServerPacketType_qProcessInfoPID;<br>+ if (PACKET_STARTS_WITH ("qPlatform_Syscall_System:")) return eServerPacketType_qPlatform_Syscall_System;<br>+ if (PACKET_STARTS_WITH ("qPlatform_IO_MkDir:")) return eServerPacketType_qPlatform_IO_MkDir;<br> break;<br>+<br><br> case 'S':<br> if (PACKET_STARTS_WITH ("qSpeedTest:")) return eServerPacketType_qSpeedTest;<br>@@ -138,6 +141,15 @@<br> break;<br> }<br> break;<br>+ case 'v':<br>+ if (PACKET_STARTS_WITH("vFile:"))<br>+ {<br>+ if (PACKET_STARTS_WITH("vFile:open:")) return eServerPacketType_vFile_Open;<br>+ else if (PACKET_STARTS_WITH("vFile:close:")) return eServerPacketType_vFile_Close;<br>+ else if (PACKET_STARTS_WITH("vFile:pread")) return eServerPacketType_vFile_pRead;<br>+ else if (PACKET_STARTS_WITH("vFile:pwrite")) return eServerPacketType_vFile_pWrite;<br>+ }<br>+ break;<br> }<br> return eServerPacketType_unimplemented;<br> }<br>@@ -180,3 +192,19 @@<br> }<br> return 0;<br> }<br>+<br>+size_t<br>+StringExtractorGDBRemote::GetEscapedBinaryData (std::string &str)<br>+{<br>+ str.clear();<br>+ char ch;<br>+ while (GetBytesLeft())<br>+ {<br>+ ch = GetChar();<br>+ if (ch == 0x7d)<br>+ ch = (GetChar() ^ 0x20);<br>+ str.append(1,ch);<br>+ }<br>+ return str.size();<br>+}<br>+<br><br>Modified: lldb/branches/lldb-platform-work/source/Utility/StringExtractorGDBRemote.h<br>URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Utility/StringExtractorGDBRemote.h?rev=154233&r1=154232&r2=154233&view=diff">http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Utility/StringExtractorGDBRemote.h?rev=154233&r1=154232&r2=154233&view=diff</a><br>==============================================================================<br>--- lldb/branches/lldb-platform-work/source/Utility/StringExtractorGDBRemote.h (original)<br>+++ lldb/branches/lldb-platform-work/source/Utility/StringExtractorGDBRemote.h Fri Apr 6 19:03:47 2012<br>@@ -63,7 +63,13 @@<br> eServerPacketType_QSetSTDOUT,<br> eServerPacketType_QSetSTDERR,<br> eServerPacketType_QSetWorkingDir,<br>- eServerPacketType_QStartNoAckMode<br>+ eServerPacketType_QStartNoAckMode,<br>+ eServerPacketType_qPlatform_Syscall_System,<br>+ eServerPacketType_qPlatform_IO_MkDir,<br>+ eServerPacketType_vFile_Open,<br>+ eServerPacketType_vFile_Close,<br>+ eServerPacketType_vFile_pRead,<br>+ eServerPacketType_vFile_pWrite<br> };<br><br> ServerPacketType<br>@@ -98,6 +104,10 @@<br> // digits. Otherwise the error encoded in XX is returned.<br> uint8_t<br> GetError();<br>+<br>+ size_t<br>+ GetEscapedBinaryData (std::string &str);<br>+<br> };<br><br> #endif // utility_StringExtractorGDBRemote_h_<br><br>Modified: lldb/branches/lldb-platform-work/tools/lldb-platform/lldb-platform.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/lldb-platform/lldb-platform.cpp?rev=154233&r1=154232&r2=154233&view=diff">http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/lldb-platform/lldb-platform.cpp?rev=154233&r1=154232&r2=154233&view=diff</a><br>==============================================================================<br>--- lldb/branches/lldb-platform-work/tools/lldb-platform/lldb-platform.cpp (original)<br>+++ lldb/branches/lldb-platform-work/tools/lldb-platform/lldb-platform.cpp Fri Apr 6 19:03:47 2012<br>@@ -183,6 +183,12 @@<br> GDBRemoteCommunicationServer gdb_server (true);<br> if (!listen_host_port.empty())<br> {<br>+ for (int j = 0; j < listen_host_port.size(); j++)<br>+ {<br>+ char c = listen_host_port[j];<br>+ if (c > '9' || c < '0')<br>+ printf("WARNING: passing anything but a number as argument to --listen will most probably make connecting impossible.\n");<br>+ }<br> std::auto_ptr<ConnectionFileDescriptor> conn_ap(new ConnectionFileDescriptor());<br> if (conn_ap.get())<br> {<br><br><br>_______________________________________________<br>lldb-commits mailing list<br><a href="mailto:lldb-commits@cs.uiuc.edu">lldb-commits@cs.uiuc.edu</a><br>http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits<br><span><lldb-platform-gdbremotecommunicationserver-include-fix.patch></span></div></blockquote></div><br></body></html>