diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2019-10-23 17:53:01 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2019-10-23 17:53:01 +0000 |
commit | ead246455adf1a215ec2715dad6533073a6beb4e (patch) | |
tree | f3f97a47d77053bf96fe74cdbd6fae74380e8a92 /include/lldb/Target | |
parent | fdb00c4408990a0a63ef7f496d809ce59f263bc5 (diff) | |
download | src-ead246455adf1a215ec2715dad6533073a6beb4e.tar.gz src-ead246455adf1a215ec2715dad6533073a6beb4e.zip |
Vendor import of stripped lldb trunk r375505, the last commit before thevendor/lldb/lldb-trunk-r375505vendor/lldb
upstream Subversion repository was made read-only, and the LLVM project
migrated to GitHub:
https://llvm.org/svn/llvm-project/lldb/trunk@375505
Notes
Notes:
svn path=/vendor/lldb/dist/; revision=353952
svn path=/vendor/lldb/lldb-r375505/; revision=353953; tag=vendor/lldb/lldb-trunk-r375505
Diffstat (limited to 'include/lldb/Target')
-rw-r--r-- | include/lldb/Target/ABI.h | 18 | ||||
-rw-r--r-- | include/lldb/Target/DynamicLoader.h | 10 | ||||
-rw-r--r-- | include/lldb/Target/Language.h | 10 | ||||
-rw-r--r-- | include/lldb/Target/Platform.h | 19 | ||||
-rw-r--r-- | include/lldb/Target/Process.h | 28 | ||||
-rw-r--r-- | include/lldb/Target/RemoteAwarePlatform.h | 2 | ||||
-rw-r--r-- | include/lldb/Target/StackFrame.h | 15 | ||||
-rw-r--r-- | include/lldb/Target/StopInfo.h | 11 | ||||
-rw-r--r-- | include/lldb/Target/Target.h | 129 | ||||
-rw-r--r-- | include/lldb/Target/Thread.h | 12 | ||||
-rw-r--r-- | include/lldb/Target/ThreadPlanPython.h | 10 | ||||
-rw-r--r-- | include/lldb/Target/Unwind.h | 10 |
12 files changed, 172 insertions, 102 deletions
diff --git a/include/lldb/Target/ABI.h b/include/lldb/Target/ABI.h index f254839fc975..93378abc2ac2 100644 --- a/include/lldb/Target/ABI.h +++ b/include/lldb/Target/ABI.h @@ -15,8 +15,8 @@ #include "lldb/lldb-private.h" #include "llvm/ADT/ArrayRef.h" +#include "llvm/MC/MCRegisterInfo.h" -// forward define the llvm::Type class namespace llvm { class Type; } @@ -124,6 +124,8 @@ public: return pc; } + llvm::MCRegisterInfo &GetMCRegisterInfo() { return *m_mc_register_info_up; } + virtual const RegisterInfo *GetRegisterInfoArray(uint32_t &count) = 0; bool GetRegisterInfoByName(ConstString name, RegisterInfo &info); @@ -136,13 +138,19 @@ public: static lldb::ABISP FindPlugin(lldb::ProcessSP process_sp, const ArchSpec &arch); protected: - // Classes that inherit from ABI can see and modify these - ABI(lldb::ProcessSP process_sp) { - if (process_sp.get()) - m_process_wp = process_sp; + ABI(lldb::ProcessSP process_sp, std::unique_ptr<llvm::MCRegisterInfo> info_up) + : m_process_wp(process_sp), m_mc_register_info_up(std::move(info_up)) { + assert(m_mc_register_info_up && "ABI must have MCRegisterInfo"); } + /// Utility function to construct a MCRegisterInfo using the ArchSpec triple. + /// Plugins wishing to customize the construction can construct the + /// MCRegisterInfo themselves. + static std::unique_ptr<llvm::MCRegisterInfo> + MakeMCRegisterInfo(const ArchSpec &arch); + lldb::ProcessWP m_process_wp; + std::unique_ptr<llvm::MCRegisterInfo> m_mc_register_info_up; private: DISALLOW_COPY_AND_ASSIGN(ABI); diff --git a/include/lldb/Target/DynamicLoader.h b/include/lldb/Target/DynamicLoader.h index 2bf3f32b5eef..ac72b98e5e1a 100644 --- a/include/lldb/Target/DynamicLoader.h +++ b/include/lldb/Target/DynamicLoader.h @@ -148,13 +148,9 @@ public: /// The equivalent symbol list - any equivalent symbols found are appended /// to this list. /// - /// \return - /// Number of equivalent symbols found. - virtual size_t FindEquivalentSymbols(Symbol *original_symbol, - ModuleList &module_list, - SymbolContextList &equivalent_symbols) { - return 0; - } + virtual void FindEquivalentSymbols(Symbol *original_symbol, + ModuleList &module_list, + SymbolContextList &equivalent_symbols) {} /// Ask if it is ok to try and load or unload an shared library (image). /// diff --git a/include/lldb/Target/Language.h b/include/lldb/Target/Language.h index 6ea6029bdace..b49e96eeac17 100644 --- a/include/lldb/Target/Language.h +++ b/include/lldb/Target/Language.h @@ -20,6 +20,7 @@ #include "lldb/DataFormatters/DumpValueObjectOptions.h" #include "lldb/DataFormatters/FormatClasses.h" #include "lldb/DataFormatters/StringPrinter.h" +#include "lldb/Symbol/TypeSystem.h" #include "lldb/lldb-private.h" #include "lldb/lldb-public.h" @@ -266,12 +267,9 @@ public: static std::set<lldb::LanguageType> GetSupportedLanguages(); - static void GetLanguagesSupportingTypeSystems( - std::set<lldb::LanguageType> &languages, - std::set<lldb::LanguageType> &languages_for_expressions); - - static void - GetLanguagesSupportingREPLs(std::set<lldb::LanguageType> &languages); + static LanguageSet GetLanguagesSupportingTypeSystems(); + static LanguageSet GetLanguagesSupportingTypeSystemsForExpressions(); + static LanguageSet GetLanguagesSupportingREPLs(); protected: // Classes that inherit from Language can see and modify these diff --git a/include/lldb/Target/Platform.h b/include/lldb/Target/Platform.h index 3ba58c0ec741..6f643df53d1e 100644 --- a/include/lldb/Target/Platform.h +++ b/include/lldb/Target/Platform.h @@ -18,6 +18,7 @@ #include "lldb/Core/PluginInterface.h" #include "lldb/Core/UserSettingsController.h" +#include "lldb/Host/File.h" #include "lldb/Interpreter/Options.h" #include "lldb/Utility/ArchSpec.h" #include "lldb/Utility/ConstString.h" @@ -257,19 +258,6 @@ public: virtual bool SetRemoteWorkingDirectory(const FileSpec &working_dir); - /// Retrieve the system include directories on this platform for the - /// given language. - /// - /// \param[in] lang - /// The language for which the include directories should be queried. - /// - /// \param[out] directories - /// The include directories for this system. - virtual std::vector<std::string> - GetSystemIncludeDirectories(lldb::LanguageType lang) { - return {}; - } - virtual UserIDResolver &GetUserIDResolver() = 0; /// Locate a file for a platform. @@ -518,8 +506,9 @@ public: virtual Status SetFilePermissions(const FileSpec &file_spec, uint32_t file_permissions); - virtual lldb::user_id_t OpenFile(const FileSpec &file_spec, uint32_t flags, - uint32_t mode, Status &error) { + virtual lldb::user_id_t OpenFile(const FileSpec &file_spec, + File::OpenOptions flags, uint32_t mode, + Status &error) { return UINT64_MAX; } diff --git a/include/lldb/Target/Process.h b/include/lldb/Target/Process.h index f85069ea0906..a4ef1cc40414 100644 --- a/include/lldb/Target/Process.h +++ b/include/lldb/Target/Process.h @@ -50,6 +50,7 @@ #include "lldb/lldb-private.h" #include "llvm/ADT/ArrayRef.h" +#include "llvm/Support/Threading.h" #include "llvm/Support/VersionTuple.h" namespace lldb_private { @@ -680,10 +681,19 @@ public: /// shared library load state. /// /// \return - /// The number of shared libraries that were loaded - virtual size_t LoadModules() { return 0; } + /// A status object indicating if the operation was sucessful or not. + virtual llvm::Error LoadModules() { + return llvm::make_error<llvm::StringError>("Not implemented.", + llvm::inconvertibleErrorCode()); + } - virtual size_t LoadModules(LoadedModuleInfoList &) { return 0; } + /// Query remote GDBServer for a detailed loaded library list + /// \return + /// The list of modules currently loaded by the process, or an error. + virtual llvm::Expected<LoadedModuleInfoList> GetLoadedModuleList() { + return llvm::createStringError(llvm::inconvertibleErrorCode(), + "Not implemented"); + } protected: virtual JITLoaderList &GetJITLoaders(); @@ -1186,6 +1196,9 @@ public: /// VersionTuple is returner. virtual llvm::VersionTuple GetHostOSVersion() { return llvm::VersionTuple(); } + /// \return the macCatalyst version of the host OS. + virtual llvm::VersionTuple GetHostMacCatalystVersion() { return {}; } + /// Get the target object pointer for this module. /// /// \return @@ -2259,6 +2272,8 @@ public: void ClearPreResumeAction(PreResumeActionCallback callback, void *baton); ProcessRunLock &GetRunLock(); + + bool CurrentThreadIsPrivateStateThread(); virtual Status SendEventData(const char *data) { Status return_error("Sending an event is not supported for this process."); @@ -2453,6 +2468,11 @@ public: return Status("Not implemented"); } + // This calls a function of the form "void * (*)(void)". + bool CallVoidArgVoidPtrReturn(const Address *address, + lldb::addr_t &returned_func, + bool trap_exceptions = false); + protected: void SetState(lldb::EventSP &event_sp); @@ -2732,7 +2752,7 @@ protected: enum { eCanJITDontKnow = 0, eCanJITYes, eCanJITNo } m_can_jit; std::unique_ptr<UtilityFunction> m_dlopen_utility_func_up; - std::once_flag m_dlopen_utility_func_flag_once; + llvm::once_flag m_dlopen_utility_func_flag_once; size_t RemoveBreakpointOpcodesFromBuffer(lldb::addr_t addr, size_t size, uint8_t *buf) const; diff --git a/include/lldb/Target/RemoteAwarePlatform.h b/include/lldb/Target/RemoteAwarePlatform.h index 524332f948a5..55d5ff673f1d 100644 --- a/include/lldb/Target/RemoteAwarePlatform.h +++ b/include/lldb/Target/RemoteAwarePlatform.h @@ -22,7 +22,7 @@ public: bool GetModuleSpec(const FileSpec &module_file_spec, const ArchSpec &arch, ModuleSpec &module_spec) override; - lldb::user_id_t OpenFile(const FileSpec &file_spec, uint32_t flags, + lldb::user_id_t OpenFile(const FileSpec &file_spec, File::OpenOptions flags, uint32_t mode, Status &error) override; bool CloseFile(lldb::user_id_t fd, Status &error) override; diff --git a/include/lldb/Target/StackFrame.h b/include/lldb/Target/StackFrame.h index 4e6e79befc6a..d2e5795162cf 100644 --- a/include/lldb/Target/StackFrame.h +++ b/include/lldb/Target/StackFrame.h @@ -108,17 +108,19 @@ public: StackFrame(const lldb::ThreadSP &thread_sp, lldb::user_id_t frame_idx, lldb::user_id_t concrete_frame_idx, lldb::addr_t cfa, bool cfa_is_valid, lldb::addr_t pc, Kind frame_kind, - const SymbolContext *sc_ptr); + bool behaves_like_zeroth_frame, const SymbolContext *sc_ptr); StackFrame(const lldb::ThreadSP &thread_sp, lldb::user_id_t frame_idx, lldb::user_id_t concrete_frame_idx, const lldb::RegisterContextSP ®_context_sp, lldb::addr_t cfa, - lldb::addr_t pc, const SymbolContext *sc_ptr); + lldb::addr_t pc, bool behaves_like_zeroth_frame, + const SymbolContext *sc_ptr); StackFrame(const lldb::ThreadSP &thread_sp, lldb::user_id_t frame_idx, lldb::user_id_t concrete_frame_idx, const lldb::RegisterContextSP ®_context_sp, lldb::addr_t cfa, - const Address &pc, const SymbolContext *sc_ptr); + const Address &pc, bool behaves_like_zeroth_frame, + const SymbolContext *sc_ptr); ~StackFrame() override; @@ -367,6 +369,12 @@ public: /// may have limited support for inspecting variables. bool IsArtificial() const; + /// Query whether this frame behaves like the zeroth frame, in the sense + /// that its pc value might not immediately follow a call (and thus might + /// be the first address of its function). True for actual frame zero as + /// well as any other frame with the same trait. + bool BehavesLikeZerothFrame() const; + /// Query this frame to find what frame it is in this Thread's /// StackFrameList. /// @@ -511,6 +519,7 @@ private: bool m_cfa_is_valid; // Does this frame have a CFA? Different from CFA == // LLDB_INVALID_ADDRESS Kind m_stack_frame_kind; + bool m_behaves_like_zeroth_frame; lldb::VariableListSP m_variable_list_sp; ValueObjectList m_variable_list_value_objects; // Value objects for each // variable in diff --git a/include/lldb/Target/StopInfo.h b/include/lldb/Target/StopInfo.h index 59033b1b6441..61e1fbd4bd46 100644 --- a/include/lldb/Target/StopInfo.h +++ b/include/lldb/Target/StopInfo.h @@ -33,10 +33,13 @@ public: lldb::ThreadSP GetThread() const { return m_thread_wp.lock(); } - // The value of the StopInfo depends on the StopReason. StopReason - // Meaning ---------------------------------------------- - // eStopReasonBreakpoint BreakpointSiteID eStopReasonSignal - // Signal number eStopReasonWatchpoint WatchpointLocationID + // The value of the StopInfo depends on the StopReason. + // + // StopReason Meaning + // ------------------------------------------------ + // eStopReasonBreakpoint BreakpointSiteID + // eStopReasonSignal Signal number + // eStopReasonWatchpoint WatchpointLocationID // eStopReasonPlanComplete No significance uint64_t GetValue() const { return m_value; } diff --git a/include/lldb/Target/Target.h b/include/lldb/Target/Target.h index 4ed11afc31ba..e465046959f2 100644 --- a/include/lldb/Target/Target.h +++ b/include/lldb/Target/Target.h @@ -121,7 +121,7 @@ public: FileSpecList GetExecutableSearchPaths(); - void AppendExecutableSearchPaths(const FileSpec&); + void AppendExecutableSearchPaths(const FileSpec &); FileSpecList GetDebugFileSearchPaths(); @@ -139,6 +139,8 @@ public: bool GetEnableSyntheticValue() const; + uint32_t GetMaxZeroPaddingInFloatFormat() const; + uint32_t GetMaximumNumberOfChildrenToDisplay() const; uint32_t GetMaximumSizeOfStringSummary() const; @@ -495,7 +497,7 @@ public: static void SetDefaultArchitecture(const ArchSpec &arch); - /// Find a binary on the system and return its Module, + /// Find a binary on the system and return its Module, /// or return an existing Module that is already in the Target. /// /// Given a ModuleSpec, find a binary satisifying that specification, @@ -507,34 +509,33 @@ public: /// e.g. UUID, architecture, file path. /// /// \param[in] notify - /// If notify is true, and the Module is new to this Target, - /// Target::ModulesDidLoad will be called. - /// If notify is false, it is assumed that the caller is adding - /// multiple Modules and will call ModulesDidLoad with the + /// If notify is true, and the Module is new to this Target, + /// Target::ModulesDidLoad will be called. + /// If notify is false, it is assumed that the caller is adding + /// multiple Modules and will call ModulesDidLoad with the /// full list at the end. /// ModulesDidLoad must be called when a Module/Modules have /// been added to the target, one way or the other. /// /// \param[out] error_ptr - /// Optional argument, pointing to a Status object to fill in + /// Optional argument, pointing to a Status object to fill in /// with any results / messages while attempting to find/load /// this binary. Many callers will be internal functions that /// will handle / summarize the failures in a custom way and /// don't use these messages. /// - /// \return + /// \return /// An empty ModuleSP will be returned if no matching file /// was found. If error_ptr was non-nullptr, an error message /// will likely be provided. - lldb::ModuleSP GetOrCreateModule(const ModuleSpec &module_spec, - bool notify, + lldb::ModuleSP GetOrCreateModule(const ModuleSpec &module_spec, bool notify, Status *error_ptr = nullptr); // Settings accessors static const lldb::TargetPropertiesSP &GetGlobalProperties(); - std::recursive_mutex &GetAPIMutex() { return m_mutex; } + std::recursive_mutex &GetAPIMutex(); void DeleteCurrentProcess(); @@ -599,7 +600,7 @@ public: const FileSpecList *containingModules, const FileSpecList *source_file_list, const std::unordered_set<std::string> &function_names, - RegularExpression &source_regex, bool internal, bool request_hardware, + RegularExpression source_regex, bool internal, bool request_hardware, LazyBool move_to_nearest_code); // Use this to create a breakpoint from a load address @@ -622,7 +623,7 @@ public: // target setting, else we use the values passed in lldb::BreakpointSP CreateFuncRegexBreakpoint( const FileSpecList *containingModules, - const FileSpecList *containingSourceFiles, RegularExpression &func_regexp, + const FileSpecList *containingSourceFiles, RegularExpression func_regexp, lldb::LanguageType requested_language, LazyBool skip_prologue, bool internal, bool request_hardware); @@ -644,14 +645,11 @@ public: Args *additional_args = nullptr, Status *additional_args_error = nullptr); - lldb::BreakpointSP - CreateScriptedBreakpoint(const llvm::StringRef class_name, - const FileSpecList *containingModules, - const FileSpecList *containingSourceFiles, - bool internal, - bool request_hardware, - StructuredData::ObjectSP extra_args_sp, - Status *creation_error = nullptr); + lldb::BreakpointSP CreateScriptedBreakpoint( + const llvm::StringRef class_name, const FileSpecList *containingModules, + const FileSpecList *containingSourceFiles, bool internal, + bool request_hardware, StructuredData::ObjectSP extra_args_sp, + Status *creation_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 @@ -690,43 +688,42 @@ public: } WatchpointList &GetWatchpointList() { return m_watchpoint_list; } - + // Manages breakpoint names: void AddNameToBreakpoint(BreakpointID &id, const char *name, Status &error); - - void AddNameToBreakpoint(lldb::BreakpointSP &bp_sp, const char *name, + + void AddNameToBreakpoint(lldb::BreakpointSP &bp_sp, const char *name, Status &error); - - void RemoveNameFromBreakpoint(lldb::BreakpointSP &bp_sp, - ConstString name); - - BreakpointName *FindBreakpointName(ConstString name, bool can_create, + + void RemoveNameFromBreakpoint(lldb::BreakpointSP &bp_sp, ConstString name); + + BreakpointName *FindBreakpointName(ConstString name, bool can_create, Status &error); - + void DeleteBreakpointName(ConstString name); - + void ConfigureBreakpointName(BreakpointName &bp_name, const BreakpointOptions &options, const BreakpointName::Permissions &permissions); - void ApplyNameToBreakpoints(BreakpointName &bp_name); - + void ApplyNameToBreakpoints(BreakpointName &bp_name); + // This takes ownership of the name obj passed in. void AddBreakpointName(BreakpointName *bp_name); - + void GetBreakpointNames(std::vector<std::string> &names); - - //This call removes ALL breakpoints regardless of permission. + + // This call removes ALL breakpoints regardless of permission. void RemoveAllBreakpoints(bool internal_also = false); - + // This removes all the breakpoints, but obeys the ePermDelete on them. void RemoveAllowedBreakpoints(); void DisableAllBreakpoints(bool internal_also = false); - + void DisableAllowedBreakpoints(); void EnableAllBreakpoints(bool internal_also = false); - + void EnableAllowedBreakpoints(); bool DisableBreakpointByID(lldb::break_id_t break_id); @@ -1027,9 +1024,11 @@ public: PathMappingList &GetImageSearchPathList(); - TypeSystem *GetScratchTypeSystemForLanguage(Status *error, - lldb::LanguageType language, - bool create_on_demand = true); + llvm::Expected<TypeSystem &> + GetScratchTypeSystemForLanguage(lldb::LanguageType language, + bool create_on_demand = true); + + std::vector<TypeSystem *> GetScratchTypeSystems(bool create_on_demand = true); PersistentExpressionState * GetPersistentExpressionStateForLanguage(lldb::LanguageType language); @@ -1038,11 +1037,12 @@ public: // parameters have the same meaning as for the UserExpression constructor. // Returns a new-ed object which the caller owns. - UserExpression *GetUserExpressionForLanguage( - llvm::StringRef expr, llvm::StringRef prefix, lldb::LanguageType language, - Expression::ResultType desired_type, - const EvaluateExpressionOptions &options, - ValueObject *ctx_obj, Status &error); + UserExpression * + GetUserExpressionForLanguage(llvm::StringRef expr, llvm::StringRef prefix, + lldb::LanguageType language, + Expression::ResultType desired_type, + const EvaluateExpressionOptions &options, + ValueObject *ctx_obj, Status &error); // Creates a FunctionCaller for the given language, the rest of the // parameters have the same meaning as for the FunctionCaller constructor. @@ -1104,8 +1104,7 @@ public: llvm::StringRef expression, ExecutionContextScope *exe_scope, lldb::ValueObjectSP &result_valobj_sp, const EvaluateExpressionOptions &options = EvaluateExpressionOptions(), - std::string *fixed_expression = nullptr, - ValueObject *ctx_obj = nullptr); + std::string *fixed_expression = nullptr, ValueObject *ctx_obj = nullptr); lldb::ExpressionVariableSP GetPersistentVariable(ConstString name); @@ -1116,6 +1115,24 @@ public: lldb::addr_t GetPersistentSymbol(ConstString name); + /// This method will return the address of the starting function for + /// this binary, e.g. main() or its equivalent. This can be used as + /// an address of a function that is not called once a binary has + /// started running - e.g. as a return address for inferior function + /// calls that are unambiguous completion of the function call, not + /// called during the course of the inferior function code running. + /// + /// If no entry point can be found, an invalid address is returned. + /// + /// \param [out] err + /// This object will be set to failure if no entry address could + /// be found, and may contain a helpful error message. + // + /// \return + /// Returns the entry address for this program, or an error + /// if none can be found. + llvm::Expected<lldb_private::Address> GetEntryPointAddress(); + // Target Stop Hooks class StopHook : public UserID { public: @@ -1147,7 +1164,9 @@ public: void SetIsActive(bool is_active) { m_active = is_active; } - void SetAutoContinue(bool auto_continue) {m_auto_continue = auto_continue;} + void SetAutoContinue(bool auto_continue) { + m_auto_continue = auto_continue; + } bool GetAutoContinue() const { return m_auto_continue; } @@ -1242,7 +1261,7 @@ protected: const lldb::ModuleSP &module_sp) override; void NotifyModuleRemoved(const ModuleList &module_list, - const lldb::ModuleSP &module_sp) override; + const lldb::ModuleSP &module_sp) override; void NotifyModuleUpdated(const ModuleList &module_list, const lldb::ModuleSP &old_module_sp, @@ -1269,6 +1288,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 + /// 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 + /// detect that code is running on the private state thread. + 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). @@ -1277,7 +1302,7 @@ protected: BreakpointList m_internal_breakpoint_list; using BreakpointNameList = std::map<ConstString, BreakpointName *>; BreakpointNameList m_breakpoint_names; - + lldb::BreakpointSP m_last_created_breakpoint; WatchpointList m_watchpoint_list; lldb::WatchpointSP m_last_created_watchpoint; diff --git a/include/lldb/Target/Thread.h b/include/lldb/Target/Thread.h index 7aeaece5b5d5..7c5ff6093baf 100644 --- a/include/lldb/Target/Thread.h +++ b/include/lldb/Target/Thread.h @@ -899,6 +899,7 @@ public: virtual lldb::ThreadPlanSP QueueThreadPlanForStepScripted(bool abort_other_plans, const char *class_name, + StructuredData::ObjectSP extra_args_sp, bool stop_other_threads, Status &status); // Thread Plan accessors: @@ -1101,6 +1102,17 @@ public: // right even if you have not calculated this yourself, or if it disagrees // with what you might have calculated. virtual lldb::StopInfoSP GetPrivateStopInfo(); + + // Calculate the stop info that will be shown to lldb clients. For instance, + // a "step out" is implemented by running to a breakpoint on the function + // return PC, so the process plugin initially sets the stop info to a + // StopInfoBreakpoint. But once we've run the ShouldStop machinery, we + // discover that there's a completed ThreadPlanStepOut, and that's really + // the StopInfo we want to show. That will happen naturally the next + // time GetStopInfo is called, but if you want to force the replacement, + // you can call this. + + void CalculatePublicStopInfo(); // Ask the thread subclass to set its stop info. // diff --git a/include/lldb/Target/ThreadPlanPython.h b/include/lldb/Target/ThreadPlanPython.h index 3825bf6ee4f3..0ee559b12960 100644 --- a/include/lldb/Target/ThreadPlanPython.h +++ b/include/lldb/Target/ThreadPlanPython.h @@ -12,6 +12,8 @@ #include <string> +#include "lldb/lldb-forward.h" + #include "lldb/Target/Process.h" #include "lldb/Target/StopInfo.h" #include "lldb/Target/Target.h" @@ -29,7 +31,8 @@ namespace lldb_private { class ThreadPlanPython : public ThreadPlan { public: - ThreadPlanPython(Thread &thread, const char *class_name); + ThreadPlanPython(Thread &thread, const char *class_name, + StructuredDataImpl *args_data); ~ThreadPlanPython() override; void GetDescription(Stream *s, lldb::DescriptionLevel level) override; @@ -55,6 +58,11 @@ protected: private: std::string m_class_name; + StructuredDataImpl *m_args_data; // We own this, but the implementation + // has to manage the UP (since that is + // how it gets stored in the + // SBStructuredData). + std::string m_error_str; StructuredData::ObjectSP m_implementation_sp; bool m_did_push; diff --git a/include/lldb/Target/Unwind.h b/include/lldb/Target/Unwind.h index a648e063e34b..652918ddad43 100644 --- a/include/lldb/Target/Unwind.h +++ b/include/lldb/Target/Unwind.h @@ -37,9 +37,10 @@ public: lldb::addr_t cfa; lldb::addr_t pc; uint32_t idx; + bool behaves_like_zeroth_frame = (end_idx == 0); for (idx = 0; idx < end_idx; idx++) { - if (!DoGetFrameInfoAtIndex(idx, cfa, pc)) { + if (!DoGetFrameInfoAtIndex(idx, cfa, pc, behaves_like_zeroth_frame)) { break; } } @@ -47,9 +48,9 @@ public: } bool GetFrameInfoAtIndex(uint32_t frame_idx, lldb::addr_t &cfa, - lldb::addr_t &pc) { + lldb::addr_t &pc, bool &behaves_like_zeroth_frame) { std::lock_guard<std::recursive_mutex> guard(m_unwind_mutex); - return DoGetFrameInfoAtIndex(frame_idx, cfa, pc); + return DoGetFrameInfoAtIndex(frame_idx, cfa, pc, behaves_like_zeroth_frame); } lldb::RegisterContextSP CreateRegisterContextForFrame(StackFrame *frame) { @@ -66,7 +67,8 @@ protected: virtual uint32_t DoGetFrameCount() = 0; virtual bool DoGetFrameInfoAtIndex(uint32_t frame_idx, lldb::addr_t &cfa, - lldb::addr_t &pc) = 0; + lldb::addr_t &pc, + bool &behaves_like_zeroth_frame) = 0; virtual lldb::RegisterContextSP DoCreateRegisterContextForFrame(StackFrame *frame) = 0; |