1 //===-- PlatformAndroidRemoteGDBServer.h ------------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef LLDB_SOURCE_PLUGINS_PLATFORM_ANDROID_PLATFORMANDROIDREMOTEGDBSERVER_H
10 #define LLDB_SOURCE_PLUGINS_PLATFORM_ANDROID_PLATFORMANDROIDREMOTEGDBSERVER_H
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
{
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
;
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
);
58 PlatformAndroidRemoteGDBServer(const PlatformAndroidRemoteGDBServer
&) =
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