summaryrefslogtreecommitdiff
path: root/include/lldb/Target
diff options
context:
space:
mode:
Diffstat (limited to 'include/lldb/Target')
-rw-r--r--include/lldb/Target/CPPLanguageRuntime.h3
-rw-r--r--include/lldb/Target/FileAction.h17
-rw-r--r--include/lldb/Target/LanguageRuntime.h30
-rw-r--r--include/lldb/Target/Memory.h17
-rw-r--r--include/lldb/Target/ObjCLanguageRuntime.h62
-rw-r--r--include/lldb/Target/Platform.h150
-rw-r--r--include/lldb/Target/Process.h262
-rw-r--r--include/lldb/Target/ProcessInfo.h2
-rw-r--r--include/lldb/Target/ProcessLaunchInfo.h36
-rw-r--r--include/lldb/Target/SectionLoadHistory.h2
-rw-r--r--include/lldb/Target/StopInfo.h8
-rw-r--r--include/lldb/Target/Target.h223
-rw-r--r--include/lldb/Target/Thread.h50
-rw-r--r--include/lldb/Target/ThreadPlanCallUserExpression.h13
-rw-r--r--include/lldb/Target/ThreadPlanPython.h5
15 files changed, 615 insertions, 265 deletions
diff --git a/include/lldb/Target/CPPLanguageRuntime.h b/include/lldb/Target/CPPLanguageRuntime.h
index 43df9e67add0..3e51453566b3 100644
--- a/include/lldb/Target/CPPLanguageRuntime.h
+++ b/include/lldb/Target/CPPLanguageRuntime.h
@@ -153,6 +153,9 @@ public:
static uint32_t
FindEquivalentNames(ConstString type_name, std::vector<ConstString>& equivalents);
+ virtual size_t
+ GetAlternateManglings(const ConstString &mangled, std::vector<ConstString> &alternates) = 0;
+
protected:
//------------------------------------------------------------------
// Classes that inherit from CPPLanguageRuntime can see and modify these
diff --git a/include/lldb/Target/FileAction.h b/include/lldb/Target/FileAction.h
index 4015cbb5ea89..907c4d937beb 100644
--- a/include/lldb/Target/FileAction.h
+++ b/include/lldb/Target/FileAction.h
@@ -11,6 +11,7 @@
#define liblldb_Target_FileAction_h
#include <string>
+#include "lldb/Host/FileSpec.h"
namespace lldb_private
{
@@ -34,7 +35,7 @@ class FileAction
bool Duplicate(int fd, int dup_fd);
- bool Open(int fd, const char *path, bool read, bool write);
+ bool Open(int fd, const FileSpec &file_spec, bool read, bool write);
int
GetFD() const
@@ -54,16 +55,20 @@ class FileAction
return m_arg;
}
- const char *GetPath() const;
+ const char *
+ GetPath() const;
+
+ const FileSpec &
+ GetFileSpec() const;
void
Dump (Stream &stream) const;
protected:
- Action m_action; // The action for this file
- int m_fd; // An existing file descriptor
- int m_arg; // oflag for eFileActionOpen*, dup_fd for eFileActionDuplicate
- std::string m_path; // A file path to use for opening after fork or posix_spawn
+ Action m_action; // The action for this file
+ int m_fd; // An existing file descriptor
+ int m_arg; // oflag for eFileActionOpen*, dup_fd for eFileActionDuplicate
+ FileSpec m_file_spec; // A file spec to use for opening after fork or posix_spawn
};
} // namespace lldb_private
diff --git a/include/lldb/Target/LanguageRuntime.h b/include/lldb/Target/LanguageRuntime.h
index d5ed81956475..d8e5ada6c96f 100644
--- a/include/lldb/Target/LanguageRuntime.h
+++ b/include/lldb/Target/LanguageRuntime.h
@@ -34,6 +34,9 @@ public:
static LanguageRuntime*
FindPlugin (Process *process, lldb::LanguageType language);
+
+ static void
+ InitializeCommands (CommandObject* parent);
virtual lldb::LanguageType
GetLanguageType () const = 0;
@@ -80,16 +83,27 @@ public:
static lldb::BreakpointSP
CreateExceptionBreakpoint (Target &target,
- lldb::LanguageType language,
+ lldb::LanguageType language,
bool catch_bp,
bool throw_bp,
bool is_internal = false);
-
+
+ static Breakpoint::BreakpointPreconditionSP
+ CreateExceptionPrecondition (lldb::LanguageType language,
+ bool catch_bp,
+ bool throw_bp);
+
static lldb::LanguageType
GetLanguageTypeFromString (const char *string);
static const char *
GetNameForLanguageType (lldb::LanguageType language);
+
+ static void
+ PrintAllLanguages (Stream &s, const char *prefix, const char *suffix);
+
+ static bool
+ LanguageIsCPlusPlus (lldb::LanguageType language);
Process *
GetProcess()
@@ -109,6 +123,18 @@ public:
{
return false;
}
+
+ virtual bool
+ IsRuntimeSupportValue (ValueObject& valobj)
+ {
+ return false;
+ }
+
+ virtual void
+ ModulesDidLoad (const ModuleList &module_list)
+ {
+ return;
+ }
protected:
//------------------------------------------------------------------
diff --git a/include/lldb/Target/Memory.h b/include/lldb/Target/Memory.h
index 568bbcdf2f7c..bf1cc1878784 100644
--- a/include/lldb/Target/Memory.h
+++ b/include/lldb/Target/Memory.h
@@ -52,7 +52,7 @@ namespace lldb_private {
uint32_t
GetMemoryCacheLineSize() const
{
- return m_cache_line_byte_size ;
+ return m_L2_cache_line_byte_size ;
}
void
@@ -61,17 +61,26 @@ namespace lldb_private {
bool
RemoveInvalidRange (lldb::addr_t base_addr, lldb::addr_t byte_size);
+ // Allow external sources to populate data into the L1 memory cache
+ void
+ AddL1CacheData(lldb::addr_t addr, const void *src, size_t src_len);
+
+ void
+ AddL1CacheData(lldb::addr_t addr, const lldb::DataBufferSP &data_buffer_sp);
+
protected:
typedef std::map<lldb::addr_t, lldb::DataBufferSP> BlockMap;
typedef RangeArray<lldb::addr_t, lldb::addr_t, 4> InvalidRanges;
+ typedef Range<lldb::addr_t, lldb::addr_t> AddrRange;
//------------------------------------------------------------------
// Classes that inherit from MemoryCache can see and modify these
//------------------------------------------------------------------
- Process &m_process;
- uint32_t m_cache_line_byte_size;
Mutex m_mutex;
- BlockMap m_cache;
+ BlockMap m_L1_cache; // A first level memory cache whose chunk sizes vary that will be used only if the memory read fits entirely in a chunk
+ BlockMap m_L2_cache; // A memory cache of fixed size chinks (m_L2_cache_line_byte_size bytes in size each)
InvalidRanges m_invalid_ranges;
+ Process &m_process;
+ uint32_t m_L2_cache_line_byte_size;
private:
DISALLOW_COPY_AND_ASSIGN (MemoryCache);
};
diff --git a/include/lldb/Target/ObjCLanguageRuntime.h b/include/lldb/Target/ObjCLanguageRuntime.h
index 42a391478e3e..88874c767a1b 100644
--- a/include/lldb/Target/ObjCLanguageRuntime.h
+++ b/include/lldb/Target/ObjCLanguageRuntime.h
@@ -26,6 +26,8 @@
#include "lldb/Symbol/Type.h"
#include "lldb/Target/LanguageRuntime.h"
+class CommandObjectObjC_ClassTable_Dump;
+
namespace lldb_private {
class ClangUtilityFunction;
@@ -289,6 +291,48 @@ public:
protected:
std::unique_ptr<ClangASTContext> m_scratch_ast_ctx_ap;
};
+
+ class ObjCExceptionPrecondition : public Breakpoint::BreakpointPrecondition
+ {
+ public:
+ ObjCExceptionPrecondition();
+
+ virtual ~ObjCExceptionPrecondition() {}
+
+ bool EvaluatePrecondition(StoppointCallbackContext &context) override;
+ void DescribePrecondition(Stream &stream, lldb::DescriptionLevel level) override;
+ Error ConfigurePrecondition(Args &args) override;
+
+ protected:
+ void AddClassName(const char *class_name);
+
+ private:
+ std::unordered_set<std::string> m_class_names;
+ };
+
+ class TaggedPointerVendor
+ {
+ public:
+ virtual bool
+ IsPossibleTaggedPointer (lldb::addr_t ptr) = 0;
+
+ virtual ObjCLanguageRuntime::ClassDescriptorSP
+ GetClassDescriptor (lldb::addr_t ptr) = 0;
+
+ virtual
+ ~TaggedPointerVendor () { }
+ protected:
+ TaggedPointerVendor () = default;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(TaggedPointerVendor);
+ };
+
+ virtual TaggedPointerVendor*
+ GetTaggedPointerVendor ()
+ {
+ return nullptr;
+ }
typedef std::shared_ptr<EncodingToType> EncodingToTypeSP;
@@ -313,8 +357,8 @@ public:
virtual
~ObjCLanguageRuntime();
- virtual lldb::LanguageType
- GetLanguageType () const
+ lldb::LanguageType
+ GetLanguageType () const override
{
return lldb::eLanguageTypeObjC;
}
@@ -515,10 +559,10 @@ public:
m_negative_complete_class_cache.clear();
}
- virtual bool
+ bool
GetTypeBitSize (const ClangASTType& clang_type,
- uint64_t &size);
-
+ uint64_t &size) override;
+
protected:
//------------------------------------------------------------------
// Classes that inherit from ObjCLanguageRuntime can see and modify these
@@ -645,6 +689,14 @@ protected:
ISAToDescriptorIterator
GetDescriptorIterator (const ConstString &name);
+ friend class ::CommandObjectObjC_ClassTable_Dump;
+
+ std::pair<ISAToDescriptorIterator,ISAToDescriptorIterator>
+ GetDescriptorIteratorPair (bool update_if_needed = true);
+
+ void
+ ReadObjCLibraryIfNeeded (const ModuleList &module_list);
+
DISALLOW_COPY_AND_ASSIGN (ObjCLanguageRuntime);
};
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);
};
diff --git a/include/lldb/Target/Process.h b/include/lldb/Target/Process.h
index 6608391b94fd..db0f0cfa028b 100644
--- a/include/lldb/Target/Process.h
+++ b/include/lldb/Target/Process.h
@@ -28,34 +28,26 @@
#include "lldb/Core/Communication.h"
#include "lldb/Core/Error.h"
#include "lldb/Core/Event.h"
-#include "lldb/Core/RangeMap.h"
-#include "lldb/Core/StringList.h"
#include "lldb/Core/ThreadSafeValue.h"
#include "lldb/Core/PluginInterface.h"
#include "lldb/Core/UserSettingsController.h"
#include "lldb/Breakpoint/BreakpointSiteList.h"
-#include "lldb/Expression/ClangPersistentVariables.h"
-#include "lldb/Expression/IRDynamicChecks.h"
-#include "lldb/Host/FileSpec.h"
-#include "lldb/Host/Host.h"
#include "lldb/Host/HostThread.h"
#include "lldb/Host/ProcessRunLock.h"
-#include "lldb/Interpreter/Args.h"
#include "lldb/Interpreter/Options.h"
#include "lldb/Target/ExecutionContextScope.h"
-#include "lldb/Target/JITLoaderList.h"
#include "lldb/Target/Memory.h"
-#include "lldb/Target/MemoryRegionInfo.h"
#include "lldb/Target/ProcessInfo.h"
#include "lldb/Target/ProcessLaunchInfo.h"
#include "lldb/Target/QueueList.h"
#include "lldb/Target/ThreadList.h"
-#include "lldb/Target/UnixSignals.h"
-#include "lldb/Utility/PseudoTerminal.h"
#include "lldb/Target/InstrumentationRuntime.h"
namespace lldb_private {
+template <typename B, typename S>
+struct Range;
+
//----------------------------------------------------------------------
// ProcessProperties
//----------------------------------------------------------------------
@@ -693,7 +685,20 @@ public:
else
m_running_user_expression--;
}
-
+
+ void
+ SetStopEventForLastNaturalStopID (lldb::EventSP event_sp)
+ {
+ m_last_natural_stop_event = event_sp;
+ }
+
+ lldb::EventSP GetStopEventForStopID (uint32_t stop_id) const
+ {
+ if (stop_id == m_last_natural_stop_id)
+ return m_last_natural_stop_event;
+ return lldb::EventSP();
+ }
+
private:
uint32_t m_stop_id;
uint32_t m_last_natural_stop_id;
@@ -701,6 +706,7 @@ private:
uint32_t m_memory_id;
uint32_t m_last_user_expression_resume;
uint32_t m_running_user_expression;
+ lldb::EventSP m_last_natural_stop_event;
};
inline bool operator== (const ProcessModID &lhs, const ProcessModID &rhs)
{
@@ -812,11 +818,12 @@ public:
virtual const ConstString &
GetFlavor () const;
- const lldb::ProcessSP &
+ lldb::ProcessSP
GetProcessSP() const
{
- return m_process_sp;
+ return m_process_wp.lock();
}
+
lldb::StateType
GetState() const
{
@@ -911,7 +918,7 @@ public:
m_restarted_reasons.push_back(reason);
}
- lldb::ProcessSP m_process_sp;
+ lldb::ProcessWP m_process_wp;
lldb::StateType m_state;
std::vector<std::string> m_restarted_reasons;
bool m_restarted; // For "eStateStopped" events, this is true if the target was automatically restarted.
@@ -1129,6 +1136,22 @@ public:
virtual const lldb::DataBufferSP
GetAuxvData();
+ //------------------------------------------------------------------
+ /// Sometimes processes know how to retrieve and load shared libraries.
+ /// This is normally done by DynamicLoader plug-ins, but sometimes the
+ /// connection to the process allows retrieving this information. The
+ /// dynamic loader plug-ins can use this function if they can't
+ /// determine the current shared library load state.
+ ///
+ /// @return
+ /// The number of shared libraries that were loaded
+ //------------------------------------------------------------------
+ virtual size_t
+ LoadModules ()
+ {
+ return 0;
+ }
+
protected:
virtual JITLoaderList &
GetJITLoaders ();
@@ -1351,11 +1374,19 @@ public:
/// This function is not meant to be overridden by Process
/// subclasses.
///
+ /// @param[in] force_kill
+ /// Whether lldb should force a kill (instead of a detach) from
+ /// the inferior process. Normally if lldb launched a binary and
+ /// Destory is called, lldb kills it. If lldb attached to a
+ /// running process and Destory is called, lldb detaches. If
+ /// this behavior needs to be over-ridden, this is the bool that
+ /// can be used.
+ ///
/// @return
/// Returns an error object.
//------------------------------------------------------------------
Error
- Destroy();
+ Destroy(bool force_kill);
//------------------------------------------------------------------
/// Sends a process a UNIX signal \a signal.
@@ -1370,18 +1401,10 @@ public:
Signal (int signal);
void
- SetUnixSignals (const UnixSignalsSP &signals_sp)
- {
- assert (signals_sp && "null signals_sp");
- m_unix_signals_sp = signals_sp;
- }
+ SetUnixSignals (const UnixSignalsSP &signals_sp);
UnixSignals &
- GetUnixSignals ()
- {
- assert (m_unix_signals_sp && "null m_unix_signals_sp");
- return *m_unix_signals_sp;
- }
+ GetUnixSignals ();
//==================================================================
// Plug-in Process Control Overrides
@@ -1445,31 +1468,14 @@ public:
/// @param[in] pid
/// The process ID that we should attempt to attach to.
///
- /// @return
- /// Returns \a pid if attaching was successful, or
- /// LLDB_INVALID_PROCESS_ID if attaching fails.
- //------------------------------------------------------------------
- virtual Error
- DoAttachToProcessWithID (lldb::pid_t pid)
- {
- Error error;
- error.SetErrorStringWithFormat("error: %s does not support attaching to a process by pid", GetPluginName().GetCString());
- return error;
- }
-
- //------------------------------------------------------------------
- /// Attach to an existing process using a process ID.
- ///
- /// @param[in] pid
- /// The process ID that we should attempt to attach to.
- ///
/// @param[in] attach_info
/// Information on how to do the attach. For example, GetUserID()
/// will return the uid to attach as.
///
/// @return
- /// Returns \a pid if attaching was successful, or
- /// LLDB_INVALID_PROCESS_ID if attaching fails.
+ /// Returns a successful Error attaching was successful, or
+ /// an appropriate (possibly platform-specific) error code if
+ /// attaching fails.
/// hanming : need flag
//------------------------------------------------------------------
virtual Error
@@ -1491,7 +1497,9 @@ public:
/// will return the uid to attach as.
///
/// @return
- /// Returns an error object.
+ /// Returns a successful Error attaching was successful, or
+ /// an appropriate (possibly platform-specific) error code if
+ /// attaching fails.
//------------------------------------------------------------------
virtual Error
DoAttachToProcessWithName (const char *process_name, const ProcessAttachInfo &attach_info)
@@ -1870,7 +1878,13 @@ public:
void
SendAsyncInterrupt ();
- void
+ //------------------------------------------------------------------
+ // Notify this process class that modules got loaded.
+ //
+ // If subclasses override this method, they must call this version
+ // before doing anything in the subclass version of the function.
+ //------------------------------------------------------------------
+ virtual void
ModulesDidLoad (ModuleList &module_list);
protected:
@@ -1961,11 +1975,17 @@ public:
}
uint32_t
- GetLastNaturalStopID()
+ GetLastNaturalStopID() const
{
return m_mod_id.GetLastNaturalStopID();
}
-
+
+ lldb::EventSP
+ GetStopEventForStopID (uint32_t stop_id) const
+ {
+ return m_mod_id.GetStopEventForStopID(stop_id);
+ }
+
//------------------------------------------------------------------
/// Set accessor for the process exit status (return code).
///
@@ -2399,33 +2419,8 @@ public:
/// Returns true if it was able to determine the attributes of the
/// memory region. False if not.
//------------------------------------------------------------------
-
virtual bool
- GetLoadAddressPermissions (lldb::addr_t load_addr, uint32_t &permissions)
- {
- MemoryRegionInfo range_info;
- permissions = 0;
- Error error (GetMemoryRegionInfo (load_addr, range_info));
- if (!error.Success())
- return false;
- if (range_info.GetReadable() == MemoryRegionInfo::eDontKnow
- || range_info.GetWritable() == MemoryRegionInfo::eDontKnow
- || range_info.GetExecutable() == MemoryRegionInfo::eDontKnow)
- {
- return false;
- }
-
- if (range_info.GetReadable() == MemoryRegionInfo::eYes)
- permissions |= lldb::ePermissionsReadable;
-
- if (range_info.GetWritable() == MemoryRegionInfo::eYes)
- permissions |= lldb::ePermissionsWritable;
-
- if (range_info.GetExecutable() == MemoryRegionInfo::eYes)
- permissions |= lldb::ePermissionsExecutable;
-
- return true;
- }
+ GetLoadAddressPermissions (lldb::addr_t load_addr, uint32_t &permissions);
//------------------------------------------------------------------
/// Determines whether executing JIT-compiled code in this process
@@ -2758,6 +2753,11 @@ public:
Listener *hijack_listener = NULL,
Stream *stream = NULL);
+ uint32_t
+ GetIOHandlerID () const
+ {
+ return m_iohandler_sync.GetValue();
+ }
//--------------------------------------------------------------------------------------
/// Waits for the process state to be running within a given msec timeout.
@@ -2768,14 +2768,9 @@ public:
/// @param[in] timeout_msec
/// The maximum time length to wait for the process to transition to the
/// eStateRunning state, specified in milliseconds.
- ///
- /// @return
- /// true if successfully signalled that process started and IOHandler pushes, false
- /// if it timed out.
//--------------------------------------------------------------------------------------
- bool
- SyncIOHandler (uint64_t timeout_msec);
-
+ void
+ SyncIOHandler (uint32_t iohandler_id, uint64_t timeout_msec);
lldb::StateType
WaitForStateChangedEvents (const TimeValue *timeout,
@@ -2906,10 +2901,7 @@ public:
return m_dynamic_checkers_ap.get();
}
- void SetDynamicCheckers(DynamicCheckerFunctions *dynamic_checkers)
- {
- m_dynamic_checkers_ap.reset(dynamic_checkers);
- }
+ void SetDynamicCheckers(DynamicCheckerFunctions *dynamic_checkers);
//------------------------------------------------------------------
/// Call this to set the lldb in the mode where it breaks on new thread
@@ -3010,17 +3002,10 @@ public:
void
ClearPreResumeActions ();
-
+
ProcessRunLock &
- GetRunLock ()
- {
- if (m_private_state_thread.EqualsThread(Host::GetCurrentThread()))
- return m_private_run_lock;
- else
- return m_public_run_lock;
- }
+ GetRunLock ();
-public:
virtual Error
SendEventData(const char *data)
{
@@ -3034,6 +3019,51 @@ public:
lldb::InstrumentationRuntimeSP
GetInstrumentationRuntime(lldb::InstrumentationRuntimeType type);
+ //------------------------------------------------------------------
+ /// Try to fetch the module specification for a module with the
+ /// given file name and architecture. Process sub-classes have to
+ /// override this method if they support platforms where the
+ /// Platform object can't get the module spec for all module.
+ ///
+ /// @param[in] module_file_spec
+ /// The file name of the module to get specification for.
+ ///
+ /// @param[in] arch
+ /// The architecture of the module to get specification for.
+ ///
+ /// @param[out] module_spec
+ /// The fetched module specification if the return value is
+ /// \b true, unchanged otherwise.
+ ///
+ /// @return
+ /// Returns \b true if the module spec fetched successfully,
+ /// \b false otherwise.
+ //------------------------------------------------------------------
+ virtual bool
+ GetModuleSpec(const FileSpec& module_file_spec, const ArchSpec& arch, ModuleSpec &module_spec);
+
+ //------------------------------------------------------------------
+ /// Try to find the load address of a file.
+ /// The load address is defined as the address of the first memory
+ /// region what contains data mapped from the specified file.
+ ///
+ /// @param[in] file
+ /// The name of the file whose load address we are looking for
+ ///
+ /// @param[out] is_loaded
+ /// \b True if the file is loaded into the memory and false
+ /// otherwise.
+ ///
+ /// @param[out] load_addr
+ /// The load address of the file if it is loaded into the
+ /// processes address space, LLDB_INVALID_ADDRESS otherwise.
+ //------------------------------------------------------------------
+ virtual Error
+ GetFileLoadAddress(const FileSpec& file, bool& is_loaded, lldb::addr_t& load_addr)
+ {
+ return Error("Not supported");
+ }
+
protected:
//------------------------------------------------------------------
@@ -3150,7 +3180,7 @@ protected:
Broadcaster m_private_state_control_broadcaster; // This is the control broadcaster, used to pause, resume & stop the private state thread.
Listener m_private_state_listener; // This is the listener for the private state thread.
Predicate<bool> m_private_state_control_wait; /// This Predicate is used to signal that a control operation is complete.
- HostThread m_private_state_thread; // Thread ID for the thread that watches internal state events
+ HostThread m_private_state_thread; ///< Thread ID for the thread that watches internal state events
ProcessModID m_mod_id; ///< Tracks the state of the process over stops and other alterations.
uint32_t m_process_unique_id; ///< Each lldb_private::Process class that is created gets a unique integer ID that increments with each new instance
uint32_t m_thread_index_id; ///< Each thread is created with a 1 based index that won't get re-used.
@@ -3170,22 +3200,22 @@ protected:
std::vector<lldb::addr_t> m_image_tokens;
Listener &m_listener;
BreakpointSiteList m_breakpoint_site_list; ///< This is the list of breakpoint locations we intend to insert in the target.
- std::unique_ptr<DynamicLoader> m_dyld_ap;
- std::unique_ptr<JITLoaderList> m_jit_loaders_ap;
- std::unique_ptr<DynamicCheckerFunctions> m_dynamic_checkers_ap; ///< The functions used by the expression parser to validate data that expressions use.
- std::unique_ptr<OperatingSystem> m_os_ap;
- std::unique_ptr<SystemRuntime> m_system_runtime_ap;
+ lldb::DynamicLoaderUP m_dyld_ap;
+ lldb::JITLoaderListUP m_jit_loaders_ap;
+ lldb::DynamicCheckerFunctionsUP m_dynamic_checkers_ap; ///< The functions used by the expression parser to validate data that expressions use.
+ lldb::OperatingSystemUP m_os_ap;
+ lldb::SystemRuntimeUP m_system_runtime_ap;
UnixSignalsSP m_unix_signals_sp; /// This is the current signal set for this process.
lldb::ABISP m_abi_sp;
lldb::IOHandlerSP m_process_input_reader;
Communication m_stdio_communication;
Mutex m_stdio_communication_mutex;
- bool m_stdio_disable; /// Remember process launch setting
+ bool m_stdin_forward; /// Remember if stdin must be forwarded to remote debug server
std::string m_stdout_data;
std::string m_stderr_data;
Mutex m_profile_data_comm_mutex;
std::vector<std::string> m_profile_data;
- Predicate<bool> m_iohandler_sync;
+ Predicate<uint32_t> m_iohandler_sync;
MemoryCache m_memory_cache;
AllocatedMemoryCache m_allocated_memory_cache;
bool m_should_detach; /// Should we detach if the process object goes away with an explicit call to Kill or Detach?
@@ -3199,7 +3229,8 @@ protected:
ArchSpec::StopInfoOverrideCallbackType m_stop_info_override_callback;
bool m_currently_handling_do_on_removals;
bool m_resume_requested; // If m_currently_handling_event or m_currently_handling_do_on_removals are true, Resume will only request a resume, using this flag to check.
- bool m_finalize_called;
+ bool m_finalizing; // This is set at the beginning of Process::Finalize() to stop functions from looking up or creating things during a finalize call
+ bool m_finalize_called; // This is set at the end of Process::Finalize()
bool m_clear_thread_plans_on_stop;
bool m_force_next_event_delivery;
lldb::StateType m_last_broadcast_state; /// This helps with the Public event coalescing in ShouldBroadcastEvent.
@@ -3225,7 +3256,7 @@ protected:
SetPrivateState (lldb::StateType state);
bool
- StartPrivateStateThread (bool force = false);
+ StartPrivateStateThread (bool is_secondary_thread = false);
void
StopPrivateStateThread ();
@@ -3236,11 +3267,22 @@ protected:
void
ResumePrivateStateThread ();
+ struct PrivateStateThreadArgs
+ {
+ Process *process;
+ bool is_secondary_thread;
+ };
+
static lldb::thread_result_t
PrivateStateThread (void *arg);
+ // The starts up the private state thread that will watch for events from the debugee.
+ // Pass true for is_secondary_thread in the case where you have to temporarily spin up a
+ // secondary state thread to handle events from a hand-called function on the primary
+ // private state thread.
+
lldb::thread_result_t
- RunPrivateStateThread ();
+ RunPrivateStateThread (bool is_secondary_thread);
void
HandlePrivateEvent (lldb::EventSP &event_sp);
@@ -3285,6 +3327,12 @@ protected:
bool
ProcessIOHandlerIsActive ();
+
+ bool
+ ProcessIOHandlerExists () const
+ {
+ return static_cast<bool>(m_process_input_reader);
+ }
Error
HaltForDestroyOrDetach(lldb::EventSP &exit_event_sp);
diff --git a/include/lldb/Target/ProcessInfo.h b/include/lldb/Target/ProcessInfo.h
index 0570cfc98651..1539e043d6fc 100644
--- a/include/lldb/Target/ProcessInfo.h
+++ b/include/lldb/Target/ProcessInfo.h
@@ -107,7 +107,7 @@ namespace lldb_private
}
void
- SetArchitecture (ArchSpec arch)
+ SetArchitecture (const ArchSpec& arch)
{
m_arch = arch;
}
diff --git a/include/lldb/Target/ProcessLaunchInfo.h b/include/lldb/Target/ProcessLaunchInfo.h
index 897704488e5f..92a3ed40736d 100644
--- a/include/lldb/Target/ProcessLaunchInfo.h
+++ b/include/lldb/Target/ProcessLaunchInfo.h
@@ -36,11 +36,11 @@ namespace lldb_private
ProcessLaunchInfo ();
- ProcessLaunchInfo (const char *stdin_path,
- const char *stdout_path,
- const char *stderr_path,
- const char *working_directory,
- uint32_t launch_flags);
+ ProcessLaunchInfo(const FileSpec &stdin_file_spec,
+ const FileSpec &stdout_file_spec,
+ const FileSpec &stderr_file_spec,
+ const FileSpec &working_dir,
+ uint32_t launch_flags);
void
AppendFileAction (const FileAction &info)
@@ -55,7 +55,8 @@ namespace lldb_private
AppendDuplicateFileAction (int fd, int dup_fd);
bool
- AppendOpenFileAction (int fd, const char *path, bool read, bool write);
+ AppendOpenFileAction(int fd, const FileSpec &file_spec,
+ bool read, bool write);
bool
AppendSuppressFileAction (int fd, bool read, bool write);
@@ -88,17 +89,11 @@ namespace lldb_private
return m_flags;
}
- const char *
- GetWorkingDirectory () const;
-
- void
- SetWorkingDirectory (const char *working_dir);
+ const FileSpec &
+ GetWorkingDirectory() const;
void
- SwapWorkingDirectory (std::string &working_dir)
- {
- m_working_dir.swap (working_dir);
- }
+ SetWorkingDirectory(const FileSpec &working_dir);
const char *
GetProcessPluginName () const;
@@ -132,6 +127,15 @@ namespace lldb_private
void
SetLaunchInSeparateProcessGroup (bool separate);
+
+ bool
+ GetShellExpandArguments () const
+ {
+ return m_flags.Test(lldb::eLaunchFlagShellExpandArguments);
+ }
+
+ void
+ SetShellExpandArguments (bool expand);
void
Clear ();
@@ -229,7 +233,7 @@ namespace lldb_private
}
protected:
- std::string m_working_dir;
+ FileSpec m_working_dir;
std::string m_plugin_name;
FileSpec m_shell;
Flags m_flags; // Bitwise OR of bits from lldb::LaunchFlags
diff --git a/include/lldb/Target/SectionLoadHistory.h b/include/lldb/Target/SectionLoadHistory.h
index 50dcfd3cc870..ddf46a1861ca 100644
--- a/include/lldb/Target/SectionLoadHistory.h
+++ b/include/lldb/Target/SectionLoadHistory.h
@@ -23,7 +23,7 @@ namespace lldb_private {
class SectionLoadHistory
{
public:
- enum {
+ enum : unsigned {
// Pass eStopIDNow to any function that takes a stop ID to get
// the current value.
eStopIDNow = UINT32_MAX
diff --git a/include/lldb/Target/StopInfo.h b/include/lldb/Target/StopInfo.h
index e0d029bcc956..d09900f7637d 100644
--- a/include/lldb/Target/StopInfo.h
+++ b/include/lldb/Target/StopInfo.h
@@ -116,6 +116,12 @@ public:
else
m_description.clear();
}
+
+ virtual bool
+ IsValidForOperatingSystemThread (Thread &thread)
+ {
+ return true;
+ }
// Sometimes the thread plan logic will know that it wants a given stop to stop or not,
// regardless of what the ordinary logic for that StopInfo would dictate. The main example
@@ -158,7 +164,7 @@ public:
CreateStopReasonWithWatchpointID (Thread &thread, lldb::break_id_t watch_id);
static lldb::StopInfoSP
- CreateStopReasonWithSignal (Thread &thread, int signo);
+ CreateStopReasonWithSignal (Thread &thread, int signo, const char *description = nullptr);
static lldb::StopInfoSP
CreateStopReasonToTrace (Thread &thread);
diff --git a/include/lldb/Target/Target.h b/include/lldb/Target/Target.h
index a33734fd5b63..427f68e4c5d4 100644
--- a/include/lldb/Target/Target.h
+++ b/include/lldb/Target/Target.h
@@ -18,24 +18,15 @@
// Project includes
#include "lldb/lldb-public.h"
#include "lldb/Breakpoint/BreakpointList.h"
-#include "lldb/Breakpoint/BreakpointLocationCollection.h"
#include "lldb/Breakpoint/WatchpointList.h"
#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/Broadcaster.h"
#include "lldb/Core/Disassembler.h"
-#include "lldb/Core/Event.h"
#include "lldb/Core/ModuleList.h"
#include "lldb/Core/UserSettingsController.h"
-#include "lldb/Expression/ClangModulesDeclVendor.h"
-#include "lldb/Expression/ClangPersistentVariables.h"
-#include "lldb/Interpreter/Args.h"
-#include "lldb/Interpreter/OptionValueBoolean.h"
-#include "lldb/Interpreter/OptionValueEnumeration.h"
-#include "lldb/Interpreter/OptionValueFileSpec.h"
-#include "lldb/Symbol/SymbolContext.h"
-#include "lldb/Target/ABI.h"
#include "lldb/Target/ExecutionContextScope.h"
#include "lldb/Target/PathMappingList.h"
+#include "lldb/Target/ProcessLaunchInfo.h"
#include "lldb/Target/SectionLoadHistory.h"
namespace lldb_private {
@@ -73,9 +64,15 @@ public:
void
SetDefaultArchitecture (const ArchSpec& arch);
+ bool
+ GetMoveToNearestCode () const;
+
lldb::DynamicValueType
GetPreferDynamicValue() const;
-
+
+ bool
+ SetPreferDynamicValue (lldb::DynamicValueType d);
+
bool
GetDisableASLR () const;
@@ -117,7 +114,10 @@ public:
size_t
GetEnvironmentAsArgs (Args &env) const;
-
+
+ void
+ SetEnvironmentFromArgs (const Args &env);
+
bool
GetSkipPrologue() const;
@@ -130,6 +130,12 @@ public:
FileSpecList &
GetDebugFileSearchPaths ();
+ FileSpecList &
+ GetClangModuleSearchPaths ();
+
+ bool
+ GetEnableAutoImportClangModules () const;
+
bool
GetEnableSyntheticValue () const;
@@ -189,9 +195,46 @@ public:
void
SetUserSpecifiedTrapHandlerNames (const Args &args);
-};
-typedef std::shared_ptr<TargetProperties> TargetPropertiesSP;
+ bool
+ GetNonStopModeEnabled () const;
+
+ void
+ SetNonStopModeEnabled (bool b);
+
+ bool
+ GetDisplayRuntimeSupportValues () const;
+
+ void
+ SetDisplayRuntimeSupportValues (bool b);
+
+ const ProcessLaunchInfo &
+ GetProcessLaunchInfo();
+
+ void
+ SetProcessLaunchInfo(const ProcessLaunchInfo &launch_info);
+
+private:
+ //------------------------------------------------------------------
+ // Callbacks for m_launch_info.
+ //------------------------------------------------------------------
+ static void Arg0ValueChangedCallback(void *target_property_ptr, OptionValue *);
+ static void RunArgsValueChangedCallback(void *target_property_ptr, OptionValue *);
+ static void EnvVarsValueChangedCallback(void *target_property_ptr, OptionValue *);
+ static void InheritEnvValueChangedCallback(void *target_property_ptr, OptionValue *);
+ static void InputPathValueChangedCallback(void *target_property_ptr, OptionValue *);
+ static void OutputPathValueChangedCallback(void *target_property_ptr, OptionValue *);
+ static void ErrorPathValueChangedCallback(void *target_property_ptr, OptionValue *);
+ static void DetachOnErrorValueChangedCallback(void *target_property_ptr, OptionValue *);
+ static void DisableASLRValueChangedCallback(void *target_property_ptr, OptionValue *);
+ static void DisableSTDIOValueChangedCallback(void *target_property_ptr, OptionValue *);
+
+private:
+ //------------------------------------------------------------------
+ // Member variables.
+ //------------------------------------------------------------------
+ ProcessLaunchInfo m_launch_info;
+};
class EvaluateExpressionOptions
{
@@ -200,19 +243,20 @@ public:
EvaluateExpressionOptions() :
m_execution_policy(eExecutionPolicyOnlyWhenNeeded),
m_language (lldb::eLanguageTypeUnknown),
- m_coerce_to_id(false),
- m_unwind_on_error(true),
+ m_prefix (), // A prefix specific to this expression that is added after the prefix from the settings (if any)
+ m_coerce_to_id (false),
+ m_unwind_on_error (true),
m_ignore_breakpoints (false),
- m_keep_in_memory(false),
- m_try_others(true),
- m_stop_others(true),
- m_debug(false),
- m_trap_exceptions(true),
- m_generate_debug_info(false),
- m_result_is_internal(false),
- m_use_dynamic(lldb::eNoDynamicValues),
- m_timeout_usec(default_timeout),
- m_one_thread_timeout_usec(0),
+ m_keep_in_memory (false),
+ m_try_others (true),
+ m_stop_others (true),
+ m_debug (false),
+ m_trap_exceptions (true),
+ m_generate_debug_info (false),
+ m_result_is_internal (false),
+ m_use_dynamic (lldb::eNoDynamicValues),
+ m_timeout_usec (default_timeout),
+ m_one_thread_timeout_usec (0),
m_cancel_callback (nullptr),
m_cancel_callback_baton (nullptr)
{
@@ -247,7 +291,24 @@ public:
{
return m_coerce_to_id;
}
-
+
+ const char *
+ GetPrefix () const
+ {
+ if (m_prefix.empty())
+ return NULL;
+ return m_prefix.c_str();
+ }
+
+ void
+ SetPrefix (const char *prefix)
+ {
+ if (prefix && prefix[0])
+ m_prefix = prefix;
+ else
+ m_prefix.clear();
+ }
+
void
SetCoerceToId (bool coerce = true)
{
@@ -419,6 +480,7 @@ public:
private:
ExecutionPolicy m_execution_policy;
lldb::LanguageType m_language;
+ std::string m_prefix;
bool m_coerce_to_id;
bool m_unwind_on_error;
bool m_ignore_breakpoints;
@@ -474,35 +536,49 @@ public:
class TargetEventData : public EventData
{
public:
+ TargetEventData (const lldb::TargetSP &target_sp);
+
+ TargetEventData (const lldb::TargetSP &target_sp, const ModuleList &module_list);
+
+ virtual
+ ~TargetEventData();
static const ConstString &
GetFlavorString ();
virtual const ConstString &
- GetFlavor () const;
-
- TargetEventData (const lldb::TargetSP &new_target_sp);
-
- lldb::TargetSP &
- GetTarget()
+ GetFlavor () const
{
- return m_target_sp;
+ return TargetEventData::GetFlavorString ();
}
- virtual
- ~TargetEventData();
-
virtual void
Dump (Stream *s) const;
- static const lldb::TargetSP
- GetTargetFromEvent (const lldb::EventSP &event_sp);
-
static const TargetEventData *
- GetEventDataFromEvent (const Event *event_sp);
+ GetEventDataFromEvent (const Event *event_ptr);
+
+ static lldb::TargetSP
+ GetTargetFromEvent (const Event *event_ptr);
+
+ static ModuleList
+ GetModuleListFromEvent (const Event *event_ptr);
+
+ const lldb::TargetSP &
+ GetTarget() const
+ {
+ return m_target_sp;
+ }
+
+ const ModuleList &
+ GetModuleList() const
+ {
+ return m_module_list;
+ }
private:
lldb::TargetSP m_target_sp;
+ ModuleList m_module_list;
DISALLOW_COPY_AND_ASSIGN (TargetEventData);
};
@@ -513,14 +589,14 @@ public:
static void
SettingsTerminate ();
-// static lldb::UserSettingsControllerSP &
-// GetSettingsController ();
-
static FileSpecList
GetDefaultExecutableSearchPaths ();
static FileSpecList
GetDefaultDebugFileSearchPaths ();
+
+ static FileSpecList
+ GetDefaultClangModuleSearchPaths ();
static ArchSpec
GetDefaultArchitecture ();
@@ -539,7 +615,7 @@ public:
// Settings accessors
//----------------------------------------------------------------------
- static const TargetPropertiesSP &
+ static const lldb::TargetPropertiesSP &
GetGlobalProperties();
@@ -617,7 +693,11 @@ public:
Error
Launch (ProcessLaunchInfo &launch_info,
- Stream *stream); // Optional stream to receive first stop info
+ Stream *stream); // Optional stream to receive first stop info
+
+ Error
+ Attach (ProcessAttachInfo &attach_info,
+ Stream *stream); // Optional stream to receive first stop info
//------------------------------------------------------------------
// This part handles the breakpoints.
@@ -646,7 +726,8 @@ public:
LazyBool check_inlines,
LazyBool skip_prologue,
bool internal,
- bool request_hardware);
+ bool request_hardware,
+ LazyBool move_to_nearest_code);
// Use this to create breakpoint that matches regex against the source lines in files given in source_file_list:
lldb::BreakpointSP
@@ -654,7 +735,8 @@ public:
const FileSpecList *source_file_list,
RegularExpression &source_regex,
bool internal,
- bool request_hardware);
+ bool request_hardware,
+ LazyBool move_to_nearest_code);
// Use this to create a breakpoint from a load address
lldb::BreakpointSP
@@ -681,7 +763,8 @@ public:
// Use this to create a function breakpoint by name in containingModule, or all modules if it is NULL
// When "skip_prologue is set to eLazyBoolCalculate, we use the current target
- // setting, else we use the values passed in
+ // setting, else we use the values passed in.
+ // func_name_type_mask is or'ed values from the FunctionNameType enum.
lldb::BreakpointSP
CreateBreakpoint (const FileSpecList *containingModules,
const FileSpecList *containingSourceFiles,
@@ -692,11 +775,17 @@ public:
bool request_hardware);
lldb::BreakpointSP
- CreateExceptionBreakpoint (enum lldb::LanguageType language, bool catch_bp, bool throw_bp, bool internal);
+ CreateExceptionBreakpoint (enum lldb::LanguageType language,
+ bool catch_bp,
+ bool throw_bp,
+ bool internal,
+ Args *additional_args = nullptr,
+ Error *additional_args_error = nullptr);
// This is the same as the func_name breakpoint except that you can specify a vector of names. This is cheaper
// than a regular expression breakpoint in the case where you just want to set a breakpoint on a set of names
// you already know.
+ // func_name_type_mask is or'ed values from the FunctionNameType enum.
lldb::BreakpointSP
CreateBreakpoint (const FileSpecList *containingModules,
const FileSpecList *containingSourceFiles,
@@ -779,6 +868,9 @@ public:
ClearAllWatchpointHitCounts ();
bool
+ ClearAllWatchpointHistoricValues ();
+
+ bool
IgnoreAllWatchpoints (uint32_t ignore_count);
bool
@@ -1001,12 +1093,6 @@ public:
bool
ModuleIsExcludedForUnconstrainedSearches (const lldb::ModuleSP &module_sp);
- ArchSpec &
- GetArchitecture ()
- {
- return m_arch;
- }
-
const ArchSpec &
GetArchitecture () const
{
@@ -1034,6 +1120,9 @@ public:
bool
SetArchitecture (const ArchSpec &arch_spec);
+ bool
+ MergeArchitecture (const ArchSpec &arch_spec);
+
Debugger &
GetDebugger ()
{
@@ -1182,10 +1271,7 @@ public:
const EvaluateExpressionOptions& options = EvaluateExpressionOptions());
ClangPersistentVariables &
- GetPersistentVariables()
- {
- return m_persistent_variables;
- }
+ GetPersistentVariables();
//------------------------------------------------------------------
// Target Stop Hooks
@@ -1223,10 +1309,7 @@ public:
// Set the specifier. The stop hook will own the specifier, and is responsible for deleting it when we're done.
void
- SetSpecifier (SymbolContextSpecifier *specifier)
- {
- m_specifier_sp.reset (specifier);
- }
+ SetSpecifier (SymbolContextSpecifier *specifier);
SymbolContextSpecifier *
GetSpecifier ()
@@ -1387,13 +1470,13 @@ protected:
lldb::ProcessSP m_process_sp;
lldb::SearchFilterSP m_search_filter_sp;
PathMappingList m_image_search_paths;
- std::unique_ptr<ClangASTContext> m_scratch_ast_context_ap;
- std::unique_ptr<ClangASTSource> m_scratch_ast_source_ap;
- std::unique_ptr<ClangASTImporter> m_ast_importer_ap;
- std::unique_ptr<ClangModulesDeclVendor> m_clang_modules_decl_vendor_ap;
- ClangPersistentVariables m_persistent_variables; ///< These are the persistent variables associated with this process for the expression parser.
+ lldb::ClangASTContextUP m_scratch_ast_context_ap;
+ lldb::ClangASTSourceUP m_scratch_ast_source_ap;
+ lldb::ClangASTImporterUP m_ast_importer_ap;
+ lldb::ClangModulesDeclVendorUP m_clang_modules_decl_vendor_ap;
+ lldb::ClangPersistentVariablesUP m_persistent_variables; ///< These are the persistent variables associated with this process for the expression parser.
- std::unique_ptr<SourceManager> m_source_manager_ap;
+ lldb::SourceManagerUP m_source_manager_ap;
typedef std::map<lldb::user_id_t, StopHookSP> StopHookCollection;
StopHookCollection m_stop_hooks;
diff --git a/include/lldb/Target/Thread.h b/include/lldb/Target/Thread.h
index 25c0c0e92bec..c6a3c8e9851a 100644
--- a/include/lldb/Target/Thread.h
+++ b/include/lldb/Target/Thread.h
@@ -205,22 +205,23 @@ public:
void
SetState (lldb::StateType state);
- lldb::StateType
- GetResumeState () const
- {
- return m_resume_state;
- }
-
- // This sets the "external resume state" of the thread. If the thread is suspended here, it should never
- // get scheduled. Note that just because a thread is marked as "running" does not mean we will let it run in
- // a given bit of process control. For instance "step" tries to stay on the selected thread it was issued on,
- // which may involve suspending other threads temporarily. This temporary suspension is NOT reflected in the
- // state set here and reported in GetResumeState.
- //
- // If you are just preparing all threads to run, you should not override the threads that are
- // marked as suspended by the debugger. In that case, pass override_suspend = false. If you want
- // to force the thread to run (e.g. the "thread continue" command, or are resetting the state
- // (e.g. in SBThread::Resume()), then pass true to override_suspend.
+ //------------------------------------------------------------------
+ /// Sets the USER resume state for this thread. If you set a thread to suspended with
+ /// this API, it won't take part in any of the arbitration for ShouldResume, and will stay
+ /// suspended even when other threads do get to run.
+ ///
+ /// N.B. This is not the state that is used internally by thread plans to implement
+ /// staying on one thread while stepping over a breakpoint, etc. The is the
+ /// TemporaryResume state, and if you are implementing some bit of strategy in the stepping
+ /// machinery you should be using that state and not the user resume state.
+ ///
+ /// If you are just preparing all threads to run, you should not override the threads that are
+ /// marked as suspended by the debugger. In that case, pass override_suspend = false. If you want
+ /// to force the thread to run (e.g. the "thread continue" command, or are resetting the state
+ /// (e.g. in SBThread::Resume()), then pass true to override_suspend.
+ /// @return
+ /// The User resume state for this thread.
+ //------------------------------------------------------------------
void
SetResumeState (lldb::StateType state, bool override_suspend = false)
{
@@ -229,6 +230,21 @@ public:
m_resume_state = state;
}
+ //------------------------------------------------------------------
+ /// Gets the USER resume state for this thread. This is not the same as what
+ /// this thread is going to do for any particular step, however if this thread
+ /// returns eStateSuspended, then the process control logic will never allow this
+ /// thread to run.
+ ///
+ /// @return
+ /// The User resume state for this thread.
+ //------------------------------------------------------------------
+ lldb::StateType
+ GetResumeState () const
+ {
+ return m_resume_state;
+ }
+
// This function is called on all the threads before "ShouldResume" and
// "WillResume" in case a thread needs to change its state before the
// ThreadList polls all the threads to figure out which ones actually
@@ -1315,8 +1331,8 @@ protected:
lldb::ProcessWP m_process_wp; ///< The process that owns this thread.
lldb::StopInfoSP m_stop_info_sp; ///< The private stop reason for this thread
uint32_t m_stop_info_stop_id; // This is the stop id for which the StopInfo is valid. Can use this so you know that
- uint32_t m_stop_info_override_stop_id; // The stop ID containing the last time the stop info was checked against the stop info override
// the thread's m_stop_info_sp is current and you don't have to fetch it again
+ uint32_t m_stop_info_override_stop_id; // The stop ID containing the last time the stop info was checked against the stop info override
const uint32_t m_index_id; ///< A unique 1 based index assigned to each thread for easy UI/command line access.
lldb::RegisterContextSP m_reg_context_sp; ///< The register context for this thread's current register state.
lldb::StateType m_state; ///< The state of our process.
diff --git a/include/lldb/Target/ThreadPlanCallUserExpression.h b/include/lldb/Target/ThreadPlanCallUserExpression.h
index 67ac642de7bd..e40762c928b5 100644
--- a/include/lldb/Target/ThreadPlanCallUserExpression.h
+++ b/include/lldb/Target/ThreadPlanCallUserExpression.h
@@ -15,7 +15,6 @@
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-private.h"
-#include "lldb/Expression/ClangUserExpression.h"
#include "lldb/Target/Thread.h"
#include "lldb/Target/ThreadPlan.h"
#include "lldb/Target/ThreadPlanCallFunction.h"
@@ -31,7 +30,7 @@ public:
Address &function,
llvm::ArrayRef<lldb::addr_t> args,
const EvaluateExpressionOptions &options,
- ClangUserExpression::ClangUserExpressionSP &user_expression_sp);
+ lldb::ClangUserExpressionSP &user_expression_sp);
virtual
~ThreadPlanCallUserExpression ();
@@ -62,12 +61,12 @@ public:
protected:
private:
- ClangUserExpression::ClangUserExpressionSP m_user_expression_sp; // This is currently just used to ensure the
- // User expression the initiated this ThreadPlan
- // lives as long as the thread plan does.
+ lldb::ClangUserExpressionSP m_user_expression_sp; // This is currently just used to ensure the
+ // User expression the initiated this ThreadPlan
+ // lives as long as the thread plan does.
bool m_manage_materialization = false;
- lldb::ClangExpressionVariableSP m_result_var_sp; // If we are left to manage the materialization,
- // then stuff the result expression variable here.
+ lldb::ClangExpressionVariableSP m_result_var_sp; // If we are left to manage the materialization,
+ // then stuff the result expression variable here.
DISALLOW_COPY_AND_ASSIGN (ThreadPlanCallUserExpression);
};
diff --git a/include/lldb/Target/ThreadPlanPython.h b/include/lldb/Target/ThreadPlanPython.h
index fa41af1915cd..ffcee018a5fb 100644
--- a/include/lldb/Target/ThreadPlanPython.h
+++ b/include/lldb/Target/ThreadPlanPython.h
@@ -16,6 +16,7 @@
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-private.h"
+#include "lldb/Core/StructuredData.h"
#include "lldb/Core/UserID.h"
#include "lldb/Host/Mutex.h"
#include "lldb/Target/Process.h"
@@ -68,8 +69,8 @@ protected:
GetPlanRunState ();
private:
- std::string m_class_name;
- lldb::ScriptInterpreterObjectSP m_implementation_sp;
+ std::string m_class_name;
+ StructuredData::ObjectSP m_implementation_sp;
DISALLOW_COPY_AND_ASSIGN(ThreadPlanPython);
};