1 //===-- PlatformDarwin.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_PlatformDarwin_h_
11 #define liblldb_PlatformDarwin_h_
12 
13 // C Includes
14 // C++ Includes
15 // Other libraries and framework includes
16 // Project includes
17 #include "lldb/Target/Platform.h"
18 
19 class PlatformDarwin : public lldb_private::Platform
20 {
21 public:
22     PlatformDarwin (bool is_host);
23 
24     virtual
25     ~PlatformDarwin();
26 
27     //------------------------------------------------------------
28     // lldb_private::Platform functions
29     //------------------------------------------------------------
30     virtual lldb_private::Error
31     ResolveExecutable (const lldb_private::FileSpec &exe_file,
32                        const lldb_private::ArchSpec &arch,
33                        lldb::ModuleSP &module_sp,
34                        const lldb_private::FileSpecList *module_search_paths_ptr);
35 
36     virtual lldb_private::Error
37     ResolveSymbolFile (lldb_private::Target &target,
38                        const lldb_private::ModuleSpec &sym_spec,
39                        lldb_private::FileSpec &sym_file);
40 
41     lldb_private::FileSpecList
42     LocateExecutableScriptingResources (lldb_private::Target *target,
43                                         lldb_private::Module &module);
44 
45     virtual lldb_private::Error
46     GetSharedModule (const lldb_private::ModuleSpec &module_spec,
47                      lldb::ModuleSP &module_sp,
48                      const lldb_private::FileSpecList *module_search_paths_ptr,
49                      lldb::ModuleSP *old_module_sp_ptr,
50                      bool *did_create_ptr);
51 
52     virtual size_t
53     GetSoftwareBreakpointTrapOpcode (lldb_private::Target &target,
54                                      lldb_private::BreakpointSite *bp_site);
55 
56     virtual bool
57     GetRemoteOSVersion ();
58 
59     virtual bool
60     GetRemoteOSBuildString (std::string &s);
61 
62     virtual bool
63     GetRemoteOSKernelDescription (std::string &s);
64 
65     // Remote Platform subclasses need to override this function
66     virtual lldb_private::ArchSpec
67     GetRemoteSystemArchitecture ();
68 
69     virtual bool
70     IsConnected () const;
71 
72     virtual lldb_private::Error
73     ConnectRemote (lldb_private::Args& args);
74 
75     virtual lldb_private::Error
76     DisconnectRemote ();
77 
78     virtual const char *
79     GetHostname ();
80 
81     virtual const char *
82     GetUserName (uint32_t uid);
83 
84     virtual const char *
85     GetGroupName (uint32_t gid);
86 
87     virtual bool
88     GetProcessInfo (lldb::pid_t pid,
89                     lldb_private::ProcessInstanceInfo &proc_info);
90 
91     virtual lldb::BreakpointSP
92     SetThreadCreationBreakpoint (lldb_private::Target &target);
93 
94     virtual uint32_t
95     FindProcesses (const lldb_private::ProcessInstanceInfoMatch &match_info,
96                    lldb_private::ProcessInstanceInfoList &process_infos);
97 
98     virtual lldb_private::Error
99     LaunchProcess (lldb_private::ProcessLaunchInfo &launch_info);
100 
101     virtual lldb::ProcessSP
102     Attach (lldb_private::ProcessAttachInfo &attach_info,
103             lldb_private::Debugger &debugger,
104             lldb_private::Target *target,       // Can be NULL, if NULL create a new target, else use existing one
105             lldb_private::Listener &listener,
106             lldb_private::Error &error);
107 
108     virtual bool
109     ModuleIsExcludedForNonModuleSpecificSearches (lldb_private::Target &target, const lldb::ModuleSP &module_sp);
110 
111     virtual size_t
112     GetEnvironment (lldb_private::StringList &environment);
113 
114     bool
115     ARMGetSupportedArchitectureAtIndex (uint32_t idx, lldb_private::ArchSpec &arch);
116 
117     bool
118     x86GetSupportedArchitectureAtIndex (uint32_t idx, lldb_private::ArchSpec &arch);
119 
120 protected:
121     lldb::PlatformSP m_remote_platform_sp; // Allow multiple ways to connect to a remote darwin OS
122     std::string m_developer_directory;
123 
124     const char *
125     GetDeveloperDirectory();
126 
127 private:
128     DISALLOW_COPY_AND_ASSIGN (PlatformDarwin);
129 
130 };
131 
132 #endif  // liblldb_PlatformDarwin_h_
133