[Lldb-commits] [lldb] r232634 - Convert open options for POSIX open on target platform.

Robert Flack flackr at gmail.com
Wed Mar 18 06:55:49 PDT 2015


Author: flackr
Date: Wed Mar 18 08:55:48 2015
New Revision: 232634

URL: http://llvm.org/viewvc/llvm-project?rev=232634&view=rev
Log:
Convert open options for POSIX open on target platform.

This moves the conversion of the open options to the target platform. On mac fcntl.h has different values for O_CREAT and O_TRUNC than on linux so by transmitting the standardized lldb open options we can correctly convert them on the target platform.

Test Plan:
On linux:
  lldb-server p --listen *:1234
On mac:
  lldb
  platform select remote-linux
  platform connect connect://ip-of-linux-box:1234
  target create ~/path/to/linux/binary
  b main
  process launch
Binary is successfully pushed to linux remote, process successfully launches and break in the main method.

Differential Revision: http://reviews.llvm.org/D8395

Modified:
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp?rev=232634&r1=232633&r2=232634&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp Wed Mar 18 08:55:48 2015
@@ -3233,8 +3233,7 @@ GDBRemoteCommunicationClient::OpenFile (
         return UINT64_MAX;
     stream.PutCStringAsRawHex8(path.c_str());
     stream.PutChar(',');
-    const uint32_t posix_open_flags = File::ConvertOpenOptionsForPOSIXOpen(flags);
-    stream.PutHex32(posix_open_flags);
+    stream.PutHex32(flags);
     stream.PutChar(',');
     stream.PutHex32(mode);
     const char* packet = stream.GetData();

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp?rev=232634&r1=232633&r2=232634&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp Wed Mar 18 08:55:48 2015
@@ -567,7 +567,8 @@ GDBRemoteCommunicationServerCommon::Hand
     {
         if (packet.GetChar() == ',')
         {
-            uint32_t flags = packet.GetHexMaxU32(false, 0);
+            uint32_t flags = File::ConvertOpenOptionsForPOSIXOpen(
+                packet.GetHexMaxU32(false, 0));
             if (packet.GetChar() == ',')
             {
                 mode_t mode = packet.GetHexMaxU32(false, 0600);





More information about the lldb-commits mailing list