Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lldb / source / Plugins / Platform / Android / PlatformAndroidRemoteGDBServer.h
blobe68f0a4bc8bdf54a7bc47bfb8dec08732b3e814e
1 //===-- PlatformAndroidRemoteGDBServer.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-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #ifndef LLDB_SOURCE_PLUGINS_PLATFORM_ANDROID_PLATFORMANDROIDREMOTEGDBSERVER_H
10 #define LLDB_SOURCE_PLUGINS_PLATFORM_ANDROID_PLATFORMANDROIDREMOTEGDBSERVER_H
12 #include <map>
13 #include <optional>
14 #include <utility>
16 #include "Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h"
19 #include "AdbClient.h"
21 namespace lldb_private {
22 namespace platform_android {
24 class PlatformAndroidRemoteGDBServer
25 : public platform_gdb_server::PlatformRemoteGDBServer {
26 public:
27 PlatformAndroidRemoteGDBServer() = default;
29 ~PlatformAndroidRemoteGDBServer() override;
31 Status ConnectRemote(Args &args) override;
33 Status DisconnectRemote() override;
35 lldb::ProcessSP ConnectProcess(llvm::StringRef connect_url,
36 llvm::StringRef plugin_name,
37 lldb_private::Debugger &debugger,
38 lldb_private::Target *target,
39 lldb_private::Status &error) override;
41 protected:
42 std::string m_device_id;
43 std::map<lldb::pid_t, uint16_t> m_port_forwards;
44 std::optional<AdbClient::UnixSocketNamespace> m_socket_namespace;
46 bool LaunchGDBServer(lldb::pid_t &pid, std::string &connect_url) override;
48 bool KillSpawnedProcess(lldb::pid_t pid) override;
50 void DeleteForwardPort(lldb::pid_t pid);
52 Status MakeConnectURL(const lldb::pid_t pid, const uint16_t local_port,
53 const uint16_t remote_port,
54 llvm::StringRef remote_socket_name,
55 std::string &connect_url);
57 private:
58 PlatformAndroidRemoteGDBServer(const PlatformAndroidRemoteGDBServer &) =
59 delete;
60 const PlatformAndroidRemoteGDBServer &
61 operator=(const PlatformAndroidRemoteGDBServer &) = delete;
64 } // namespace platform_android
65 } // namespace lldb_private
67 #endif // LLDB_SOURCE_PLUGINS_PLATFORM_ANDROID_PLATFORMANDROIDREMOTEGDBSERVER_H