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

llvm-svn: 232634
This commit is contained in:
Robert Flack 2015-03-18 13:55:48 +00:00
parent 5d8b145d70
commit ebc5609087
2 changed files with 3 additions and 3 deletions

View File

@ -3233,8 +3233,7 @@ GDBRemoteCommunicationClient::OpenFile (const lldb_private::FileSpec& file_spec,
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();

View File

@ -567,7 +567,8 @@ GDBRemoteCommunicationServerCommon::Handle_vFile_Open (StringExtractorGDBRemote
{
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);