aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/lldb/include/lldb/Target/Target.h
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/lldb/include/lldb/Target/Target.h')
-rw-r--r--contrib/llvm-project/lldb/include/lldb/Target/Target.h161
1 files changed, 131 insertions, 30 deletions
diff --git a/contrib/llvm-project/lldb/include/lldb/Target/Target.h b/contrib/llvm-project/lldb/include/lldb/Target/Target.h
index 280ce6359c72..69baefb964b0 100644
--- a/contrib/llvm-project/lldb/include/lldb/Target/Target.h
+++ b/contrib/llvm-project/lldb/include/lldb/Target/Target.h
@@ -28,6 +28,7 @@
#include "lldb/Target/ExecutionContextScope.h"
#include "lldb/Target/PathMappingList.h"
#include "lldb/Target/SectionLoadHistory.h"
+#include "lldb/Target/ThreadSpec.h"
#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/Broadcaster.h"
#include "lldb/Utility/LLDBAssert.h"
@@ -64,6 +65,12 @@ enum LoadDependentFiles {
eLoadDependentsNo,
};
+enum ImportStdModule {
+ eImportStdModuleFalse,
+ eImportStdModuleFallback,
+ eImportStdModuleTrue,
+};
+
class TargetExperimentalProperties : public Properties {
public:
TargetExperimentalProperties();
@@ -93,6 +100,10 @@ public:
void SetDisableASLR(bool b);
+ bool GetInheritTCC() const;
+
+ void SetInheritTCC(bool b);
+
bool GetDetachOnError() const;
void SetDetachOnError(bool b);
@@ -130,7 +141,7 @@ public:
bool GetEnableAutoImportClangModules() const;
- bool GetEnableImportStdModule() const;
+ ImportStdModule GetImportStdModule() const;
bool GetEnableAutoApplyFixIts() const;
@@ -168,6 +179,8 @@ public:
llvm::StringRef GetExpressionPrefixContents();
+ uint64_t GetExprErrorLimit() const;
+
bool GetUseHexImmediates() const;
bool GetUseFastStepping() const;
@@ -205,7 +218,7 @@ public:
bool GetInjectLocalVariables(ExecutionContext *exe_ctx) const;
void SetInjectLocalVariables(ExecutionContext *exe_ctx, bool b);
-
+
void SetRequireHardwareBreakpoints(bool b);
bool GetRequireHardwareBreakpoints() const;
@@ -214,7 +227,6 @@ public:
void UpdateLaunchInfoFromProperties();
-
private:
// Callbacks for m_launch_info.
void Arg0ValueChangedCallback();
@@ -225,6 +237,7 @@ private:
void ErrorPathValueChangedCallback();
void DetachOnErrorValueChangedCallback();
void DisableASLRValueChangedCallback();
+ void InheritTCCValueChangedCallback();
void DisableSTDIOValueChangedCallback();
Environment ComputeEnvironment() const;
@@ -434,6 +447,7 @@ class Target : public std::enable_shared_from_this<Target>,
public ModuleList::Notifier {
public:
friend class TargetList;
+ friend class Debugger;
/// Broadcaster event bits definitions.
enum {
@@ -503,6 +517,8 @@ public:
static void SetDefaultArchitecture(const ArchSpec &arch);
+ bool IsDummyTarget() const { return m_is_dummy_target; }
+
/// Find a binary on the system and return its Module,
/// or return an existing Module that is already in the Target.
///
@@ -563,7 +579,8 @@ public:
// used.
const lldb::ProcessSP &CreateProcess(lldb::ListenerSP listener_sp,
llvm::StringRef plugin_name,
- const FileSpec *crash_file);
+ const FileSpec *crash_file,
+ bool can_connect);
const lldb::ProcessSP &GetProcessSP() const;
@@ -1064,14 +1081,10 @@ public:
const ValueList &arg_value_list,
const char *name, Status &error);
- // Creates a UtilityFunction for the given language, the rest of the
- // parameters have the same meaning as for the UtilityFunction constructor.
- // Returns a new-ed object which the caller owns.
-
- UtilityFunction *GetUtilityFunctionForLanguage(const char *expr,
- lldb::LanguageType language,
- const char *name,
- Status &error);
+ /// Creates and installs a UtilityFunction for the given language.
+ llvm::Expected<std::unique_ptr<UtilityFunction>>
+ CreateUtilityFunction(std::string expression, std::string name,
+ lldb::LanguageType language, ExecutionContext &exe_ctx);
// Install any files through the platform that need be to installed prior to
// launching or attaching.
@@ -1097,6 +1110,20 @@ public:
void ClearAllLoadedSections();
+ /// Set the \a Trace object containing processor trace information of this
+ /// target.
+ ///
+ /// \param[in] trace_sp
+ /// The trace object.
+ void SetTrace(const lldb::TraceSP &trace_sp);
+
+ /// Get the \a Trace object containing processor trace information of this
+ /// target.
+ ///
+ /// \return
+ /// The trace object. It might be undefined.
+ const lldb::TraceSP &GetTrace();
+
// Since expressions results can persist beyond the lifetime of a process,
// and the const expression results are available after a process is gone, we
// provide a way for expressions to be evaluated from the Target itself. If
@@ -1134,23 +1161,32 @@ public:
class StopHook : public UserID {
public:
StopHook(const StopHook &rhs);
+ virtual ~StopHook() = default;
- ~StopHook();
-
- StringList *GetCommandPointer() { return &m_commands; }
-
- const StringList &GetCommands() { return m_commands; }
+ enum class StopHookKind : uint32_t { CommandBased = 0, ScriptBased };
+ enum class StopHookResult : uint32_t {
+ KeepStopped = 0,
+ RequestContinue,
+ AlreadyContinued
+ };
lldb::TargetSP &GetTarget() { return m_target_sp; }
- void SetCommands(StringList &in_commands) { m_commands = in_commands; }
-
// Set the specifier. The stop hook will own the specifier, and is
// responsible for deleting it when we're done.
void SetSpecifier(SymbolContextSpecifier *specifier);
SymbolContextSpecifier *GetSpecifier() { return m_specifier_sp.get(); }
+ bool ExecutionContextPasses(const ExecutionContext &exe_ctx);
+
+ // Called on stop, this gets passed the ExecutionContext for each "stop
+ // with a reason" thread. It should add to the stream whatever text it
+ // wants to show the user, and return False to indicate it wants the target
+ // not to stop.
+ virtual StopHookResult HandleStop(ExecutionContext &exe_ctx,
+ lldb::StreamSP output) = 0;
+
// Set the Thread Specifier. The stop hook will own the thread specifier,
// and is responsible for deleting it when we're done.
void SetThreadSpecifier(ThreadSpec *specifier);
@@ -1168,28 +1204,84 @@ public:
bool GetAutoContinue() const { return m_auto_continue; }
void GetDescription(Stream *s, lldb::DescriptionLevel level) const;
+ virtual void GetSubclassDescription(Stream *s,
+ lldb::DescriptionLevel level) const = 0;
- private:
+ protected:
lldb::TargetSP m_target_sp;
- StringList m_commands;
lldb::SymbolContextSpecifierSP m_specifier_sp;
std::unique_ptr<ThreadSpec> m_thread_spec_up;
bool m_active = true;
bool m_auto_continue = false;
+ StopHook(lldb::TargetSP target_sp, lldb::user_id_t uid);
+ };
+
+ class StopHookCommandLine : public StopHook {
+ public:
+ virtual ~StopHookCommandLine() = default;
+
+ StringList &GetCommands() { return m_commands; }
+ void SetActionFromString(const std::string &strings);
+ void SetActionFromStrings(const std::vector<std::string> &strings);
+
+ StopHookResult HandleStop(ExecutionContext &exc_ctx,
+ lldb::StreamSP output_sp) override;
+ void GetSubclassDescription(Stream *s,
+ lldb::DescriptionLevel level) const override;
+
+ private:
+ StringList m_commands;
// Use CreateStopHook to make a new empty stop hook. The GetCommandPointer
// and fill it with commands, and SetSpecifier to set the specifier shared
// pointer (can be null, that will match anything.)
- StopHook(lldb::TargetSP target_sp, lldb::user_id_t uid);
+ StopHookCommandLine(lldb::TargetSP target_sp, lldb::user_id_t uid)
+ : StopHook(target_sp, uid) {}
+ friend class Target;
+ };
+
+ class StopHookScripted : public StopHook {
+ public:
+ virtual ~StopHookScripted() = default;
+ StopHookResult HandleStop(ExecutionContext &exc_ctx,
+ lldb::StreamSP output) override;
+
+ Status SetScriptCallback(std::string class_name,
+ StructuredData::ObjectSP extra_args_sp);
+
+ void GetSubclassDescription(Stream *s,
+ lldb::DescriptionLevel level) const override;
+
+ private:
+ std::string m_class_name;
+ /// This holds the dictionary of keys & values that can be used to
+ /// parametrize any given callback's behavior.
+ StructuredDataImpl *m_extra_args; // We own this structured data,
+ // but the SD itself manages the UP.
+ /// This holds the python callback object.
+ StructuredData::GenericSP m_implementation_sp;
+
+ /// Use CreateStopHook to make a new empty stop hook. The GetCommandPointer
+ /// and fill it with commands, and SetSpecifier to set the specifier shared
+ /// pointer (can be null, that will match anything.)
+ StopHookScripted(lldb::TargetSP target_sp, lldb::user_id_t uid)
+ : StopHook(target_sp, uid) {}
friend class Target;
};
+
typedef std::shared_ptr<StopHook> StopHookSP;
- // Add an empty stop hook to the Target's stop hook list, and returns a
- // shared pointer to it in new_hook. Returns the id of the new hook.
- StopHookSP CreateStopHook();
+ /// Add an empty stop hook to the Target's stop hook list, and returns a
+ /// shared pointer to it in new_hook. Returns the id of the new hook.
+ StopHookSP CreateStopHook(StopHook::StopHookKind kind);
+
+ /// If you tried to create a stop hook, and that failed, call this to
+ /// remove the stop hook, as it will also reset the stop hook counter.
+ void UndoCreateStopHook(lldb::user_id_t uid);
- void RunStopHooks();
+ // Runs the stop hooks that have been registered for this target.
+ // Returns true if the stop hooks cause the target to resume.
+ bool RunStopHooks();
size_t GetStopHookSize();
@@ -1251,6 +1343,10 @@ public:
void SetREPL(lldb::LanguageType language, lldb::REPLSP repl_sp);
+ StackFrameRecognizerManager &GetFrameRecognizerManager() {
+ return *m_frame_recognizer_manager_up;
+ }
+
protected:
/// Implementing of ModuleList::Notifier.
@@ -1285,12 +1381,12 @@ protected:
lldb::PlatformSP m_platform_sp; ///< The platform for this target.
std::recursive_mutex m_mutex; ///< An API mutex that is used by the lldb::SB*
/// classes make the SB interface thread safe
- /// When the private state thread calls SB API's - usually because it is
+ /// When the private state thread calls SB API's - usually because it is
/// running OS plugin or Python ThreadPlan code - it should not block on the
/// API mutex that is held by the code that kicked off the sequence of events
- /// that led us to run the code. We hand out this mutex instead when we
+ /// that led us to run the code. We hand out this mutex instead when we
/// detect that code is running on the private state thread.
- std::recursive_mutex m_private_mutex;
+ std::recursive_mutex m_private_mutex;
Arch m_arch;
ModuleList m_images; ///< The list of images for this process (shared
/// libraries and anything dynamically loaded).
@@ -1325,6 +1421,11 @@ protected:
bool m_suppress_stop_hooks;
bool m_is_dummy_target;
unsigned m_next_persistent_variable_index = 0;
+ /// An optional \a lldb_private::Trace object containing processor trace
+ /// information of this target.
+ lldb::TraceSP m_trace_sp;
+ /// Stores the frame recognizers of this target.
+ lldb::StackFrameRecognizerManagerUP m_frame_recognizer_manager_up;
static void ImageSearchPathsChanged(const PathMappingList &path_list,
void *baton);
@@ -1364,7 +1465,7 @@ private:
bool ProcessIsValid();
// Copy breakpoints, stop hooks and so forth from the dummy target:
- void PrimeFromDummyTarget(Target *dummy_target);
+ void PrimeFromDummyTarget(Target &target);
void AddBreakpoint(lldb::BreakpointSP breakpoint_sp, bool internal);