summaryrefslogtreecommitdiff
path: root/include/lldb/Target/Platform.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/lldb/Target/Platform.h')
-rw-r--r--include/lldb/Target/Platform.h150
1 files changed, 124 insertions, 26 deletions
diff --git a/include/lldb/Target/Platform.h b/include/lldb/Target/Platform.h
index f4596bd00f0b..8f89e9b3cf5f 100644
--- a/include/lldb/Target/Platform.h
+++ b/include/lldb/Target/Platform.h
@@ -12,7 +12,9 @@
// C Includes
// C++ Includes
+#include <functional>
#include <map>
+#include <memory>
#include <string>
#include <vector>
@@ -23,7 +25,9 @@
#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/ConstString.h"
#include "lldb/Core/PluginInterface.h"
+#include "lldb/Core/UserSettingsController.h"
#include "lldb/Interpreter/Options.h"
+#include "lldb/Host/FileSpec.h"
#include "lldb/Host/Mutex.h"
// TODO pull NativeDelegate class out of NativeProcessProtocol so we
@@ -32,6 +36,34 @@
namespace lldb_private {
+class ModuleCache;
+
+ enum MmapFlags {
+ eMmapFlagsPrivate = 1,
+ eMmapFlagsAnon = 2
+ };
+
+ class PlatformProperties : public Properties
+ {
+ public:
+ static ConstString
+ GetSettingName ();
+
+ PlatformProperties();
+
+ bool
+ GetUseModuleCache () const;
+ bool
+ SetUseModuleCache (bool use_module_cache);
+
+ FileSpec
+ GetModuleCacheDirectory () const;
+ bool
+ SetModuleCacheDirectory (const FileSpec& dir_spec);
+ };
+
+ typedef std::shared_ptr<PlatformProperties> PlatformPropertiesSP;
+
//----------------------------------------------------------------------
/// @class Platform Platform.h "lldb/Target/Platform.h"
/// @brief A plug-in interface definition class for debug platform that
@@ -49,9 +81,17 @@ namespace lldb_private {
public PluginInterface
{
public:
+ static void
+ Initialize ();
+
+ static void
+ Terminate ();
+
+ static const PlatformPropertiesSP &
+ GetGlobalPlatformProperties ();
//------------------------------------------------------------------
- /// Get the native host platform plug-in.
+ /// Get the native host platform plug-in.
///
/// There should only be one of these for each host that LLDB runs
/// upon that should be statically compiled in and registered using
@@ -277,15 +317,15 @@ namespace lldb_private {
{
return ArchSpec(); // Return an invalid architecture
}
-
- virtual ConstString
+
+ virtual FileSpec
GetRemoteWorkingDirectory()
{
return m_working_dir;
}
virtual bool
- SetRemoteWorkingDirectory(const ConstString &path);
+ SetRemoteWorkingDirectory(const FileSpec &working_dir);
virtual const char *
GetUserName (uint32_t uid);
@@ -336,14 +376,20 @@ namespace lldb_private {
LocateExecutableScriptingResources (Target *target,
Module &module,
Stream* feedback_stream);
-
+
virtual Error
- GetSharedModule (const ModuleSpec &module_spec,
+ GetSharedModule (const ModuleSpec &module_spec,
+ Process* process,
lldb::ModuleSP &module_sp,
const FileSpecList *module_search_paths_ptr,
lldb::ModuleSP *old_module_sp_ptr,
bool *did_create_ptr);
+ virtual bool
+ GetModuleSpec (const FileSpec& module_file_spec,
+ const ArchSpec& arch,
+ ModuleSpec &module_spec);
+
virtual Error
ConnectRemote (Args& args);
@@ -380,6 +426,16 @@ namespace lldb_private {
LaunchProcess (ProcessLaunchInfo &launch_info);
//------------------------------------------------------------------
+ /// Perform expansion of the command-line for this launch info
+ /// This can potentially involve wildcard expansion
+ // environment variable replacement, and whatever other
+ // argument magic the platform defines as part of its typical
+ // user experience
+ //------------------------------------------------------------------
+ virtual Error
+ ShellExpandArguments (ProcessLaunchInfo &launch_info);
+
+ //------------------------------------------------------------------
/// Kill process on a platform.
//------------------------------------------------------------------
virtual Error
@@ -577,12 +633,12 @@ namespace lldb_private {
virtual void
AddClangModuleCompilationOptions (Target *target, std::vector<std::string> &options);
- ConstString
- GetWorkingDirectory ();
-
+ FileSpec
+ GetWorkingDirectory();
+
bool
- SetWorkingDirectory (const ConstString &path);
-
+ SetWorkingDirectory(const FileSpec &working_dir);
+
// There may be modules that we don't want to find by default for operations like "setting breakpoint by name".
// The platform will return "true" from this call if the passed in module happens to be one of these.
@@ -593,13 +649,13 @@ namespace lldb_private {
}
virtual Error
- MakeDirectory (const char *path, uint32_t permissions);
-
+ MakeDirectory(const FileSpec &file_spec, uint32_t permissions);
+
virtual Error
- GetFilePermissions (const char *path, uint32_t &file_permissions);
+ GetFilePermissions(const FileSpec &file_spec, uint32_t &file_permissions);
virtual Error
- SetFilePermissions (const char *path, uint32_t file_permissions);
+ SetFilePermissions(const FileSpec &file_spec, uint32_t file_permissions);
virtual lldb::user_id_t
OpenFile (const FileSpec& file_spec,
@@ -656,8 +712,8 @@ namespace lldb_private {
uint32_t gid = UINT32_MAX);
virtual Error
- CreateSymlink (const char *src, // The name of the link is in src
- const char *dst);// The symlink points to dst
+ CreateSymlink(const FileSpec &src, // The name of the link is in src
+ const FileSpec &dst); // The symlink points to dst
//----------------------------------------------------------------------
/// Install a file or directory to the remote system.
@@ -693,7 +749,10 @@ namespace lldb_private {
GetFileExists (const lldb_private::FileSpec& file_spec);
virtual Error
- Unlink (const char *path);
+ Unlink(const FileSpec &file_spec);
+
+ virtual uint64_t
+ ConvertMmapFlagsToPlatform(const ArchSpec &arch, unsigned flags);
virtual bool
GetSupportsRSync ()
@@ -774,13 +833,13 @@ namespace lldb_private {
}
virtual lldb_private::Error
- RunShellCommand (const char *command, // Shouldn't be NULL
- const char *working_dir, // Pass NULL to use the current working directory
- int *status_ptr, // Pass NULL if you don't want the process exit status
- int *signo_ptr, // Pass NULL if you don't want the signal that caused the process to exit
- std::string *command_output, // Pass NULL if you don't want the command output
- uint32_t timeout_sec); // Timeout in seconds to wait for shell program to finish
-
+ RunShellCommand(const char *command, // Shouldn't be NULL
+ const FileSpec &working_dir, // Pass empty FileSpec to use the current working directory
+ int *status_ptr, // Pass NULL if you don't want the process exit status
+ int *signo_ptr, // Pass NULL if you don't want the signal that caused the process to exit
+ std::string *command_output, // Pass NULL if you don't want the command output
+ uint32_t timeout_sec); // Timeout in seconds to wait for shell program to finish
+
virtual void
SetLocalCacheDirectory (const char* local);
@@ -950,7 +1009,7 @@ namespace lldb_private {
bool m_system_arch_set_while_connected;
ConstString m_sdk_sysroot; // the root location of where the SDK files are all located
ConstString m_sdk_build;
- ConstString m_working_dir; // The working directory which is used when installing modules that have no install path set
+ FileSpec m_working_dir; // The working directory which is used when installing modules that have no install path set
std::string m_remote_url;
std::string m_name;
uint32_t m_major_os_version;
@@ -972,6 +1031,7 @@ namespace lldb_private {
std::string m_local_cache_directory;
std::vector<ConstString> m_trap_handlers;
bool m_calculated_trap_handlers;
+ const std::unique_ptr<ModuleCache> m_module_cache;
//------------------------------------------------------------------
/// Ask the Platform subclass to fill in the list of trap handler names
@@ -1074,7 +1134,45 @@ namespace lldb_private {
m_gid_map.clear();
}
+ Error
+ GetCachedExecutable (ModuleSpec &module_spec,
+ lldb::ModuleSP &module_sp,
+ const FileSpecList *module_search_paths_ptr,
+ Platform &remote_platform);
+
+ virtual Error
+ DownloadModuleSlice (const FileSpec& src_file_spec,
+ const uint64_t src_offset,
+ const uint64_t src_size,
+ const FileSpec& dst_file_spec);
+
+ virtual const char *
+ GetCacheHostname ();
+
private:
+ typedef std::function<Error (const ModuleSpec &)> ModuleResolver;
+
+ Error
+ GetRemoteSharedModule (const ModuleSpec &module_spec,
+ Process* process,
+ lldb::ModuleSP &module_sp,
+ const ModuleResolver &module_resolver,
+ bool *did_create_ptr);
+
+ bool
+ GetCachedSharedModule (const ModuleSpec& module_spec,
+ lldb::ModuleSP &module_sp,
+ bool *did_create_ptr);
+
+ Error
+ LoadCachedExecutable (const ModuleSpec &module_spec,
+ lldb::ModuleSP &module_sp,
+ const FileSpecList *module_search_paths_ptr,
+ Platform &remote_platform);
+
+ FileSpec
+ GetModuleCacheRoot ();
+
DISALLOW_COPY_AND_ASSIGN (Platform);
};