当前位置: 首页>>代码示例>>C++>>正文


C++ StringExtractorGDBRemote::GetU64方法代码示例

本文整理汇总了C++中StringExtractorGDBRemote::GetU64方法的典型用法代码示例。如果您正苦于以下问题:C++ StringExtractorGDBRemote::GetU64方法的具体用法?C++ StringExtractorGDBRemote::GetU64怎么用?C++ StringExtractorGDBRemote::GetU64使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在StringExtractorGDBRemote的用法示例。


在下文中一共展示了StringExtractorGDBRemote::GetU64方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SendUnimplementedResponse

GDBRemoteCommunication::PacketResult
GDBRemoteCommunicationServerCommon::Handle_vFile_pWrite(
    StringExtractorGDBRemote &packet) {
#ifdef _WIN32
  return SendUnimplementedResponse("GDBRemoteCommunicationServerCommon::Handle_"
                                   "vFile_pWrite() unimplemented");
#else
  packet.SetFilePos(::strlen("vFile:pwrite:"));

  StreamGDBRemote response;
  response.PutChar('F');

  int fd = packet.GetU32(UINT32_MAX);
  if (packet.GetChar() == ',') {
    off_t offset = packet.GetU64(UINT32_MAX);
    if (packet.GetChar() == ',') {
      std::string buffer;
      if (packet.GetEscapedBinaryData(buffer)) {
        const ssize_t bytes_written =
            ::pwrite(fd, buffer.data(), buffer.size(), offset);
        const int save_errno = bytes_written == -1 ? errno : 0;
        response.Printf("%zi", bytes_written);
        if (save_errno)
          response.Printf(",%i", save_errno);
      } else {
        response.Printf("-1,%i", EINVAL);
      }
      return SendPacketNoLock(response.GetString());
    }
  }
  return SendErrorResponse(27);
#endif
}
开发者ID:CodaFi,项目名称:swift-lldb,代码行数:33,代码来源:GDBRemoteCommunicationServerCommon.cpp

示例2: SendUnimplementedResponse

GDBRemoteCommunication::PacketResult
GDBRemoteCommunicationServer::Handle_vFile_pRead (StringExtractorGDBRemote &packet)
{
#ifdef _WIN32
    // Not implemented on Windows
    return SendUnimplementedResponse("GDBRemoteCommunicationServer::Handle_vFile_pRead() unimplemented");
#else
    StreamGDBRemote response;
    packet.SetFilePos(::strlen("vFile:pread:"));
    int fd = packet.GetS32(-1);
    if (packet.GetChar() == ',')
    {
        uint64_t count = packet.GetU64(UINT64_MAX);
        if (packet.GetChar() == ',')
        {
            uint64_t offset = packet.GetU64(UINT32_MAX);
            if (count == UINT64_MAX)
            {
                response.Printf("F-1:%i", EINVAL);
                return SendPacketNoLock(response.GetData(), response.GetSize());
            }
            
            std::string buffer(count, 0);
            const ssize_t bytes_read = ::pread (fd, &buffer[0], buffer.size(), offset);
            const int save_errno = bytes_read == -1 ? errno : 0;
            response.PutChar('F');
            response.Printf("%zi", bytes_read);
            if (save_errno)
                response.Printf(",%i", save_errno);
            else
            {
                response.PutChar(';');
                response.PutEscapedBytes(&buffer[0], bytes_read);
            }
            return SendPacketNoLock(response.GetData(), response.GetSize());
        }
    }
    return SendErrorResponse(21);

#endif
}
开发者ID:Keno,项目名称:lldb,代码行数:41,代码来源:GDBRemoteCommunicationServer.cpp

示例3: locker

GDBRemoteCommunication::PacketResult
GDBRemoteCommunicationServer::Handle_qKillSpawnedProcess (StringExtractorGDBRemote &packet)
{
    // Spawn a local debugserver as a platform so we can then attach or launch
    // a process...

    if (m_is_platform)
    {
        packet.SetFilePos(::strlen ("qKillSpawnedProcess:"));

        lldb::pid_t pid = packet.GetU64(LLDB_INVALID_PROCESS_ID);

        // Scope for locker
        {
            Mutex::Locker locker (m_spawned_pids_mutex);
            if (m_spawned_pids.find(pid) == m_spawned_pids.end())
                return SendErrorResponse (10);
        }
        Host::Kill (pid, SIGTERM);

        for (size_t i=0; i<10; ++i)
        {
            // Scope for locker
            {
                Mutex::Locker locker (m_spawned_pids_mutex);
                if (m_spawned_pids.find(pid) == m_spawned_pids.end())
                    return SendOKResponse();
            }
            usleep (10000);
        }

        // Scope for locker
        {
            Mutex::Locker locker (m_spawned_pids_mutex);
            if (m_spawned_pids.find(pid) == m_spawned_pids.end())
                return SendOKResponse();
        }
        Host::Kill (pid, SIGKILL);

        for (size_t i=0; i<10; ++i)
        {
            // Scope for locker
            {
                Mutex::Locker locker (m_spawned_pids_mutex);
                if (m_spawned_pids.find(pid) == m_spawned_pids.end())
                    return SendOKResponse();
            }
            usleep (10000);
        }
    }
    return SendErrorResponse (11);
}
开发者ID:Keno,项目名称:lldb,代码行数:52,代码来源:GDBRemoteCommunicationServer.cpp

示例4: SendErrorResponse

GDBRemoteCommunication::PacketResult
GDBRemoteCommunicationServerPlatform::Handle_qKillSpawnedProcess(
    StringExtractorGDBRemote &packet) {
  packet.SetFilePos(::strlen("qKillSpawnedProcess:"));

  lldb::pid_t pid = packet.GetU64(LLDB_INVALID_PROCESS_ID);

  // verify that we know anything about this pid.
  // Scope for locker
  {
    std::lock_guard<std::recursive_mutex> guard(m_spawned_pids_mutex);
    if (m_spawned_pids.find(pid) == m_spawned_pids.end()) {
      // not a pid we know about
      return SendErrorResponse(10);
    }
  }

  // go ahead and attempt to kill the spawned process
  if (KillSpawnedProcess(pid))
    return SendOKResponse();
  else
    return SendErrorResponse(11);
}
开发者ID:2trill2spill,项目名称:freebsd,代码行数:23,代码来源:GDBRemoteCommunicationServerPlatform.cpp


注:本文中的StringExtractorGDBRemote::GetU64方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。