1//===-- PlatformRemoteGDBServer.h ----------------------------------------*- C++ -*-===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef liblldb_PlatformRemoteGDBServer_h_
11#define liblldb_PlatformRemoteGDBServer_h_
12
13// C Includes
14// C++ Includes
15#include <string>
16
17// Other libraries and framework includes
18// Project includes
19#include "lldb/Target/Platform.h"
20#include "../../Process/gdb-remote/GDBRemoteCommunicationClient.h"
21
22class PlatformRemoteGDBServer : public lldb_private::Platform
23{
24public:
25
26    static void
27    Initialize ();
28
29    static void
30    Terminate ();
31
32    static lldb_private::Platform*
33    CreateInstance (bool force, const lldb_private::ArchSpec *arch);
34
35    static lldb_private::ConstString
36    GetPluginNameStatic();
37
38    static const char *
39    GetDescriptionStatic();
40
41
42    PlatformRemoteGDBServer ();
43
44    virtual
45    ~PlatformRemoteGDBServer();
46
47    //------------------------------------------------------------
48    // lldb_private::PluginInterface functions
49    //------------------------------------------------------------
50    virtual lldb_private::ConstString
51    GetPluginName()
52    {
53        return GetPluginNameStatic();
54    }
55
56    virtual uint32_t
57    GetPluginVersion()
58    {
59        return 1;
60    }
61
62
63    //------------------------------------------------------------
64    // lldb_private::Platform functions
65    //------------------------------------------------------------
66    virtual lldb_private::Error
67    ResolveExecutable (const lldb_private::FileSpec &exe_file,
68                       const lldb_private::ArchSpec &arch,
69                       lldb::ModuleSP &module_sp,
70                       const lldb_private::FileSpecList *module_search_paths_ptr);
71
72    virtual const char *
73    GetDescription ();
74
75    virtual lldb_private::Error
76    GetFile (const lldb_private::FileSpec &platform_file,
77             const lldb_private::UUID *uuid_ptr,
78             lldb_private::FileSpec &local_file);
79
80    virtual bool
81    GetProcessInfo (lldb::pid_t pid,
82                    lldb_private::ProcessInstanceInfo &proc_info);
83
84    virtual uint32_t
85    FindProcesses (const lldb_private::ProcessInstanceInfoMatch &match_info,
86                   lldb_private::ProcessInstanceInfoList &process_infos);
87
88    virtual lldb_private::Error
89    LaunchProcess (lldb_private::ProcessLaunchInfo &launch_info);
90
91    virtual lldb::ProcessSP
92    Attach (lldb_private::ProcessAttachInfo &attach_info,
93            lldb_private::Debugger &debugger,
94            lldb_private::Target *target,       // Can be NULL, if NULL create a new target, else use existing one
95            lldb_private::Listener &listener,
96            lldb_private::Error &error);
97
98    virtual bool
99    GetSupportedArchitectureAtIndex (uint32_t idx, lldb_private::ArchSpec &arch);
100
101    virtual size_t
102    GetSoftwareBreakpointTrapOpcode (lldb_private::Target &target,
103                                     lldb_private::BreakpointSite *bp_site);
104
105    virtual bool
106    GetRemoteOSVersion ();
107
108    virtual bool
109    GetRemoteOSBuildString (std::string &s);
110
111    virtual bool
112    GetRemoteOSKernelDescription (std::string &s);
113
114    // Remote Platform subclasses need to override this function
115    virtual lldb_private::ArchSpec
116    GetRemoteSystemArchitecture ();
117
118    // Remote subclasses should override this and return a valid instance
119    // name if connected.
120    virtual const char *
121    GetHostname ();
122
123    virtual const char *
124    GetUserName (uint32_t uid);
125
126    virtual const char *
127    GetGroupName (uint32_t gid);
128
129    virtual bool
130    IsConnected () const;
131
132    virtual lldb_private::Error
133    ConnectRemote (lldb_private::Args& args);
134
135    virtual lldb_private::Error
136    DisconnectRemote ();
137
138protected:
139    GDBRemoteCommunicationClient m_gdb_client;
140    std::string m_platform_description; // After we connect we can get a more complete description of what we are connected to
141
142private:
143    DISALLOW_COPY_AND_ASSIGN (PlatformRemoteGDBServer);
144
145};
146
147#endif  // liblldb_PlatformRemoteGDBServer_h_
148