brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.9 KiB · bcfb6d3 Raw
91 lines · c
1//===-- GDBRemoteCommunicationServerPlatform.h ------------------*- C++ -*-===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9#ifndef LLDB_SOURCE_PLUGINS_PROCESS_GDB_REMOTE_GDBREMOTECOMMUNICATIONSERVERPLATFORM_H10#define LLDB_SOURCE_PLUGINS_PROCESS_GDB_REMOTE_GDBREMOTECOMMUNICATIONSERVERPLATFORM_H11 12#include <map>13#include <mutex>14#include <optional>15#include <set>16 17#include "GDBRemoteCommunicationServerCommon.h"18#include "lldb/Host/Socket.h"19 20#include "llvm/Support/Error.h"21 22namespace lldb_private {23namespace process_gdb_remote {24 25class GDBRemoteCommunicationServerPlatform26    : public GDBRemoteCommunicationServerCommon {27public:28  GDBRemoteCommunicationServerPlatform(29      FileSpec debugserver_path, const Socket::SocketProtocol socket_protocol,30      uint16_t gdbserver_port);31 32  ~GDBRemoteCommunicationServerPlatform() override;33 34  Status LaunchProcess() override;35 36  void SetInferiorArguments(const lldb_private::Args &args);37 38  Status LaunchGDBServer(const lldb_private::Args &args, lldb::pid_t &pid,39                         std::string &socket_name, shared_fd_t fd);40 41  void SetPendingGdbServer(const std::string &socket_name);42 43protected:44  const FileSpec m_debugserver_path;45  const Socket::SocketProtocol m_socket_protocol;46  std::recursive_mutex m_spawned_pids_mutex;47  std::set<lldb::pid_t> m_spawned_pids;48 49  uint16_t m_gdbserver_port;50  std::optional<std::string> m_pending_gdb_server_socket_name;51 52  PacketResult Handle_qLaunchGDBServer(StringExtractorGDBRemote &packet);53 54  PacketResult Handle_qQueryGDBServer(StringExtractorGDBRemote &packet);55 56  PacketResult Handle_qKillSpawnedProcess(StringExtractorGDBRemote &packet);57 58  PacketResult Handle_qPathComplete(StringExtractorGDBRemote &packet);59 60  PacketResult Handle_qProcessInfo(StringExtractorGDBRemote &packet);61 62  PacketResult Handle_qGetWorkingDir(StringExtractorGDBRemote &packet);63 64  PacketResult Handle_QSetWorkingDir(StringExtractorGDBRemote &packet);65 66  PacketResult Handle_qC(StringExtractorGDBRemote &packet);67 68  PacketResult Handle_jSignalsInfo(StringExtractorGDBRemote &packet);69 70private:71  bool KillSpawnedProcess(lldb::pid_t pid);72  bool SpawnedProcessIsRunning(lldb::pid_t pid);73  void AddSpawnedProcess(lldb::pid_t pid);74 75  void DebugserverProcessReaped(lldb::pid_t pid);76 77  static const FileSpec &GetDomainSocketDir();78 79  static FileSpec GetDomainSocketPath(const char *prefix);80 81  GDBRemoteCommunicationServerPlatform(82      const GDBRemoteCommunicationServerPlatform &) = delete;83  const GDBRemoteCommunicationServerPlatform &84  operator=(const GDBRemoteCommunicationServerPlatform &) = delete;85};86 87} // namespace process_gdb_remote88} // namespace lldb_private89 90#endif // LLDB_SOURCE_PLUGINS_PROCESS_GDB_REMOTE_GDBREMOTECOMMUNICATIONSERVERPLATFORM_H91