diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2019-01-19 10:06:29 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2019-01-19 10:06:29 +0000 |
commit | 94994d372d014ce4c8758b9605d63fae651bd8aa (patch) | |
tree | 51c0b708bd59f205d6b35cb2a8c24d62f0c33d77 /include/lldb/Target | |
parent | 39be7ce23363d12ae3e49aeb1fdb2bfeb892e836 (diff) | |
download | src-94994d372d014ce4c8758b9605d63fae651bd8aa.tar.gz src-94994d372d014ce4c8758b9605d63fae651bd8aa.zip |
Vendor import of lldb trunk r351319 (just before the release_80 branchvendor/lldb/lldb-trunk-r351319
Notes
Notes:
svn path=/vendor/lldb/dist/; revision=343181
svn path=/vendor/lldb/lldb-trunk-r351319/; revision=343182; tag=vendor/lldb/lldb-trunk-r351319
Diffstat (limited to 'include/lldb/Target')
51 files changed, 543 insertions, 340 deletions
diff --git a/include/lldb/Target/ABI.h b/include/lldb/Target/ABI.h index 343b3a749597..24fff1caf6c4 100644 --- a/include/lldb/Target/ABI.h +++ b/include/lldb/Target/ABI.h @@ -10,10 +10,6 @@ #ifndef liblldb_ABI_h_ #define liblldb_ABI_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/Core/PluginInterface.h" #include "lldb/Symbol/UnwindPlan.h" #include "lldb/Utility/Status.h" diff --git a/include/lldb/Target/CPPLanguageRuntime.h b/include/lldb/Target/CPPLanguageRuntime.h index aae85f420ef7..e96ee168389b 100644 --- a/include/lldb/Target/CPPLanguageRuntime.h +++ b/include/lldb/Target/CPPLanguageRuntime.h @@ -11,11 +11,7 @@ #ifndef liblldb_CPPLanguageRuntime_h_ #define liblldb_CPPLanguageRuntime_h_ -// C Includes -// C++ Includes #include <vector> -// Other libraries and framework includes -// Project includes #include "lldb/Core/PluginInterface.h" #include "lldb/Target/LanguageRuntime.h" #include "lldb/lldb-private.h" @@ -24,6 +20,25 @@ namespace lldb_private { class CPPLanguageRuntime : public LanguageRuntime { public: + enum class LibCppStdFunctionCallableCase { + Lambda = 0, + CallableObject, + FreeOrMemberFunction, + Invalid + }; + + struct LibCppStdFunctionCallableInfo { + Symbol callable_symbol; + Address callable_address; + LineEntry callable_line_entry; + lldb::addr_t member__f_pointer_value = 0u; + LibCppStdFunctionCallableCase callable_case = + LibCppStdFunctionCallableCase::Invalid; + }; + + LibCppStdFunctionCallableInfo + FindLibCppStdFunctionCallableInfo(lldb::ValueObjectSP &valobj_sp); + ~CPPLanguageRuntime() override; lldb::LanguageType GetLanguageType() const override { @@ -37,6 +52,19 @@ public: bool GetObjectDescription(Stream &str, Value &value, ExecutionContextScope *exe_scope) override; + /// Obtain a ThreadPlan to get us into C++ constructs such as std::function. + /// + /// @param[in] thread + /// Curent thrad of execution. + /// + /// @param[in] stop_others + /// True if other threads should pause during execution. + /// + /// @return + /// A ThreadPlan Shared pointer + lldb::ThreadPlanSP GetStepThroughTrampolinePlan(Thread &thread, + bool stop_others); + protected: //------------------------------------------------------------------ // Classes that inherit from CPPLanguageRuntime can see and modify these diff --git a/include/lldb/Target/DynamicLoader.h b/include/lldb/Target/DynamicLoader.h index de9c4e233b0c..fe04f94aa31b 100644 --- a/include/lldb/Target/DynamicLoader.h +++ b/include/lldb/Target/DynamicLoader.h @@ -10,18 +10,17 @@ #ifndef liblldb_DynamicLoader_h_ #define liblldb_DynamicLoader_h_ -// Project includes #include "lldb/Core/PluginInterface.h" -#include "lldb/Utility/FileSpec.h" // for FileSpec +#include "lldb/Utility/FileSpec.h" #include "lldb/Utility/Status.h" #include "lldb/Utility/UUID.h" -#include "lldb/lldb-defines.h" // for LLDB_INVALID_ADDRESS -#include "lldb/lldb-forward.h" // for ModuleSP, ThreadPlanSP -#include "lldb/lldb-private-enumerations.h" // for LazyBool, LazyBool::eLaz... -#include "lldb/lldb-types.h" // for addr_t +#include "lldb/lldb-defines.h" +#include "lldb/lldb-forward.h" +#include "lldb/lldb-private-enumerations.h" +#include "lldb/lldb-types.h" -#include <stddef.h> // for size_t -#include <stdint.h> // for int64_t +#include <stddef.h> +#include <stdint.h> namespace lldb_private { class ModuleList; } diff --git a/include/lldb/Target/ExecutionContext.h b/include/lldb/Target/ExecutionContext.h index 70eba3654dec..167189c3a837 100644 --- a/include/lldb/Target/ExecutionContext.h +++ b/include/lldb/Target/ExecutionContext.h @@ -10,12 +10,8 @@ #ifndef liblldb_ExecutionContext_h_ #define liblldb_ExecutionContext_h_ -// C Includes -// C++ Includes #include <mutex> -// Other libraries and framework includes -// Project includes #include "lldb/Target/StackID.h" #include "lldb/lldb-private.h" diff --git a/include/lldb/Target/ExecutionContextScope.h b/include/lldb/Target/ExecutionContextScope.h index b73ca576bd8a..3e787584be0b 100644 --- a/include/lldb/Target/ExecutionContextScope.h +++ b/include/lldb/Target/ExecutionContextScope.h @@ -10,10 +10,6 @@ #ifndef liblldb_ExecutionContextScope_h_ #define liblldb_ExecutionContextScope_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/lldb-private.h" namespace lldb_private { diff --git a/include/lldb/Target/InstrumentationRuntime.h b/include/lldb/Target/InstrumentationRuntime.h index 21d66d5766a9..ba905cb8535d 100644 --- a/include/lldb/Target/InstrumentationRuntime.h +++ b/include/lldb/Target/InstrumentationRuntime.h @@ -10,13 +10,9 @@ #ifndef liblldb_InstrumentationRuntime_h_ #define liblldb_InstrumentationRuntime_h_ -// C Includes -// C++ Includes #include <map> #include <vector> -// Other libraries and framework includes -// Project includes #include "lldb/Core/PluginInterface.h" #include "lldb/Utility/StructuredData.h" #include "lldb/lldb-forward.h" diff --git a/include/lldb/Target/InstrumentationRuntimeStopInfo.h b/include/lldb/Target/InstrumentationRuntimeStopInfo.h index b11231960ac1..7c72c9524eca 100644 --- a/include/lldb/Target/InstrumentationRuntimeStopInfo.h +++ b/include/lldb/Target/InstrumentationRuntimeStopInfo.h @@ -10,12 +10,8 @@ #ifndef liblldb_InstrumentationRuntimeStopInfo_h_ #define liblldb_InstrumentationRuntimeStopInfo_h_ -// C Includes -// C++ Includes #include <string> -// Other libraries and framework includes -// Project includes #include "lldb/Target/StopInfo.h" #include "lldb/Utility/StructuredData.h" diff --git a/include/lldb/Target/Language.h b/include/lldb/Target/Language.h index dd7db26f3ba6..27f40fd1ba83 100644 --- a/include/lldb/Target/Language.h +++ b/include/lldb/Target/Language.h @@ -11,15 +11,12 @@ #ifndef liblldb_Language_h_ #define liblldb_Language_h_ -// C Includes -// C++ Includes #include <functional> #include <memory> #include <set> #include <vector> -// Other libraries and framework includes -// Project includes +#include "lldb/Core/Highlighter.h" #include "lldb/Core/PluginInterface.h" #include "lldb/DataFormatters/DumpValueObjectOptions.h" #include "lldb/DataFormatters/FormatClasses.h" @@ -152,6 +149,13 @@ public: static Language *FindPlugin(lldb::LanguageType language); + /// Returns the Language associated with the given file path or a nullptr + /// if there is no known language. + static Language *FindPlugin(llvm::StringRef file_path); + + static Language *FindPlugin(lldb::LanguageType language, + llvm::StringRef file_path); + // return false from callback to stop iterating static void ForEach(std::function<bool(Language *)> callback); @@ -159,6 +163,10 @@ public: virtual bool IsTopLevelFunction(Function &function); + virtual bool IsSourceFile(llvm::StringRef file_path) const = 0; + + virtual const Highlighter *GetHighlighter() const { return nullptr; } + virtual lldb::TypeCategoryImplSP GetFormatters(); virtual HardcodedFormatters::HardcodedFormatFinder GetHardcodedFormats(); diff --git a/include/lldb/Target/LanguageRuntime.h b/include/lldb/Target/LanguageRuntime.h index 6537a8f6dd55..2a2f47b85359 100644 --- a/include/lldb/Target/LanguageRuntime.h +++ b/include/lldb/Target/LanguageRuntime.h @@ -11,10 +11,6 @@ #ifndef liblldb_LanguageRuntime_h_ #define liblldb_LanguageRuntime_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/Breakpoint/BreakpointResolver.h" #include "lldb/Breakpoint/BreakpointResolverName.h" #include "lldb/Core/PluginInterface.h" @@ -123,6 +119,17 @@ public: static Breakpoint::BreakpointPreconditionSP CreateExceptionPrecondition(lldb::LanguageType language, bool catch_bp, bool throw_bp); + + virtual lldb::ValueObjectSP GetExceptionObjectForThread( + lldb::ThreadSP thread_sp) { + return lldb::ValueObjectSP(); + } + + virtual lldb::ThreadSP GetBacktraceThreadFromException( + lldb::ValueObjectSP thread_sp) { + return lldb::ThreadSP(); + } + Process *GetProcess() { return m_process; } Target &GetTargetRef() { return m_process->GetTarget(); } diff --git a/include/lldb/Target/Memory.h b/include/lldb/Target/Memory.h index 16d7b256a78e..d5e6c105f76d 100644 --- a/include/lldb/Target/Memory.h +++ b/include/lldb/Target/Memory.h @@ -10,15 +10,11 @@ #ifndef liblldb_Memory_h_ #define liblldb_Memory_h_ -// C Includes -// C++ Includes #include <map> #include <mutex> #include <vector> -// Other libraries and framework includes -// Project includes #include "lldb/Core/RangeMap.h" #include "lldb/lldb-private.h" diff --git a/include/lldb/Target/MemoryHistory.h b/include/lldb/Target/MemoryHistory.h index acc36ffe2eb4..cb3e90053357 100644 --- a/include/lldb/Target/MemoryHistory.h +++ b/include/lldb/Target/MemoryHistory.h @@ -11,12 +11,8 @@ #ifndef liblldb_MemoryHistory_h_ #define liblldb_MemoryHistory_h_ -// C Includes -// C++ Includes #include <vector> -// Other libraries and framework includes -// Project includes #include "lldb/Core/PluginInterface.h" #include "lldb/lldb-private.h" #include "lldb/lldb-types.h" diff --git a/include/lldb/Target/MemoryRegionInfo.h b/include/lldb/Target/MemoryRegionInfo.h index 505ecfcfc5ae..a57c4678bb37 100644 --- a/include/lldb/Target/MemoryRegionInfo.h +++ b/include/lldb/Target/MemoryRegionInfo.h @@ -14,7 +14,6 @@ #include "lldb/Core/RangeMap.h" #include "llvm/Support/FormatProviders.h" #include "lldb/Utility/ConstString.h" -#include "lldb/Utility/Range.h" namespace lldb_private { class MemoryRegionInfo { @@ -109,6 +108,26 @@ protected: OptionalBool m_flash; lldb::offset_t m_blocksize; }; + +inline bool operator<(const MemoryRegionInfo &lhs, + const MemoryRegionInfo &rhs) { + return lhs.GetRange() < rhs.GetRange(); +} + +inline bool operator<(const MemoryRegionInfo &lhs, lldb::addr_t rhs) { + return lhs.GetRange().GetRangeBase() < rhs; +} + +inline bool operator<(lldb::addr_t lhs, const MemoryRegionInfo &rhs) { + return lhs < rhs.GetRange().GetRangeBase(); +} + +// Forward-declarable wrapper. +class MemoryRegionInfos : public std::vector<lldb_private::MemoryRegionInfo> { +public: + using std::vector<lldb_private::MemoryRegionInfo>::vector; +}; + } namespace llvm { diff --git a/include/lldb/Target/ObjCLanguageRuntime.h b/include/lldb/Target/ObjCLanguageRuntime.h index 6f8354ea3a27..9eebf9463043 100644 --- a/include/lldb/Target/ObjCLanguageRuntime.h +++ b/include/lldb/Target/ObjCLanguageRuntime.h @@ -10,17 +10,13 @@ #ifndef liblldb_ObjCLanguageRuntime_h_ #define liblldb_ObjCLanguageRuntime_h_ -// C Includes -// C++ Includes #include <functional> #include <map> #include <memory> #include <unordered_set> -// Other libraries and framework includes #include "llvm/Support/Casting.h" -// Project includes #include "lldb/Core/PluginInterface.h" #include "lldb/Core/ThreadSafeDenseMap.h" #include "lldb/Symbol/CompilerType.h" diff --git a/include/lldb/Target/OperatingSystem.h b/include/lldb/Target/OperatingSystem.h index fe4fdee182f4..4d73bb3906ee 100644 --- a/include/lldb/Target/OperatingSystem.h +++ b/include/lldb/Target/OperatingSystem.h @@ -11,9 +11,6 @@ #ifndef liblldb_OperatingSystem_h_ #define liblldb_OperatingSystem_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes #include "lldb/Core/PluginInterface.h" #include "lldb/lldb-private.h" diff --git a/include/lldb/Target/PathMappingList.h b/include/lldb/Target/PathMappingList.h index a5ee3265a223..29e6ef191e27 100644 --- a/include/lldb/Target/PathMappingList.h +++ b/include/lldb/Target/PathMappingList.h @@ -10,14 +10,10 @@ #ifndef liblldb_PathMappingList_h_ #define liblldb_PathMappingList_h_ -// C Includes -// C++ Includes #include <map> #include <vector> -// Other libraries and framework includes #include "lldb/Utility/ConstString.h" #include "lldb/Utility/Status.h" -// Project includes namespace lldb_private { diff --git a/include/lldb/Target/Platform.h b/include/lldb/Target/Platform.h index 217b945d29cd..3dbeef73f0ab 100644 --- a/include/lldb/Target/Platform.h +++ b/include/lldb/Target/Platform.h @@ -10,8 +10,6 @@ #ifndef liblldb_Platform_h_ #define liblldb_Platform_h_ -// C Includes -// C++ Includes #include <functional> #include <map> #include <memory> @@ -19,8 +17,6 @@ #include <string> #include <vector> -// Other libraries and framework includes -// Project includes #include "lldb/Core/PluginInterface.h" #include "lldb/Core/UserSettingsController.h" #include "lldb/Interpreter/Options.h" @@ -1131,10 +1127,6 @@ public: llvm::ArrayRef<OptionDefinition> GetDefinitions() override; - // Options table: Required for subclasses of Options. - - static lldb_private::OptionDefinition g_option_table[]; - // Instance variables to hold the values for command options. bool m_rsync; @@ -1160,10 +1152,6 @@ public: llvm::ArrayRef<OptionDefinition> GetDefinitions() override; - // Options table: Required for subclasses of Options. - - static lldb_private::OptionDefinition g_option_table[]; - // Instance variables to hold the values for command options. bool m_ssh; @@ -1187,10 +1175,6 @@ public: llvm::ArrayRef<OptionDefinition> GetDefinitions() override; - // Options table: Required for subclasses of Options. - - static lldb_private::OptionDefinition g_option_table[]; - // Instance variables to hold the values for command options. std::string m_cache_dir; diff --git a/include/lldb/Target/Process.h b/include/lldb/Target/Process.h index 66ac5a692522..be72b9a9c747 100644 --- a/include/lldb/Target/Process.h +++ b/include/lldb/Target/Process.h @@ -12,10 +12,8 @@ #include "lldb/Host/Config.h" -// C Includes #include <limits.h> -// C++ Includes #include <chrono> #include <list> #include <memory> @@ -24,13 +22,8 @@ #include <unordered_set> #include <vector> -// Other libraries and framework includes -// Project includes #include "lldb/Breakpoint/BreakpointSiteList.h" -#include "lldb/Core/Broadcaster.h" #include "lldb/Core/Communication.h" -#include "lldb/Core/Event.h" -#include "lldb/Core/Listener.h" #include "lldb/Core/LoadedModuleInfoList.h" #include "lldb/Core/PluginInterface.h" #include "lldb/Core/ThreadSafeValue.h" @@ -47,6 +40,9 @@ #include "lldb/Target/QueueList.h" #include "lldb/Target/ThreadList.h" #include "lldb/Utility/ArchSpec.h" +#include "lldb/Utility/Broadcaster.h" +#include "lldb/Utility/Event.h" +#include "lldb/Utility/Listener.h" #include "lldb/Utility/NameMatches.h" #include "lldb/Utility/Status.h" #include "lldb/Utility/StructuredData.h" @@ -319,7 +315,7 @@ public: NameMatch process_name_match_type) : m_match_info(), m_name_match_type(process_name_match_type), m_match_all_users(false) { - m_match_info.GetExecutableFile().SetFile(process_name, false, + m_match_info.GetExecutableFile().SetFile(process_name, FileSpec::Style::native); } @@ -402,7 +398,8 @@ class ProcessModID { public: ProcessModID() : m_stop_id(0), m_last_natural_stop_id(0), m_resume_id(0), m_memory_id(0), - m_last_user_expression_resume(0), m_running_user_expression(false) {} + m_last_user_expression_resume(0), m_running_user_expression(false), + m_running_utility_function(0) {} ProcessModID(const ProcessModID &rhs) : m_stop_id(rhs.m_stop_id), m_memory_id(rhs.m_memory_id) {} @@ -431,6 +428,10 @@ public: m_last_user_expression_resume = m_resume_id; } + bool IsRunningUtilityFunction() const { + return m_running_utility_function > 0; + } + uint32_t GetStopID() const { return m_stop_id; } uint32_t GetLastNaturalStopID() const { return m_last_natural_stop_id; } uint32_t GetMemoryID() const { return m_memory_id; } @@ -467,6 +468,17 @@ public: m_running_user_expression--; } + void SetRunningUtilityFunction(bool on) { + if (on) + m_running_utility_function++; + else { + assert(m_running_utility_function > 0 && + "Called SetRunningUtilityFunction(false) without calling " + "SetRunningUtilityFunction(true) before?"); + m_running_utility_function--; + } + } + void SetStopEventForLastNaturalStopID(lldb::EventSP event_sp) { m_last_natural_stop_event = event_sp; } @@ -484,6 +496,7 @@ private: uint32_t m_memory_id; uint32_t m_last_user_expression_resume; uint32_t m_running_user_expression; + uint32_t m_running_utility_function; lldb::EventSP m_last_natural_stop_event; }; @@ -2068,7 +2081,7 @@ public: /// An error value. //------------------------------------------------------------------ virtual Status - GetMemoryRegions(std::vector<lldb::MemoryRegionInfoSP> ®ion_list); + GetMemoryRegions(lldb_private::MemoryRegionInfos ®ion_list); virtual Status GetWatchpointSupportInfo(uint32_t &num) { Status error; @@ -2554,6 +2567,7 @@ public: virtual bool StopNoticingNewThreads() { return true; } void SetRunningUserExpression(bool on); + void SetRunningUtilityFunction(bool on); //------------------------------------------------------------------ // lldb::ExecutionContextScope pure virtual functions @@ -3225,6 +3239,24 @@ private: DISALLOW_COPY_AND_ASSIGN(Process); }; +//------------------------------------------------------------------ +/// RAII guard that should be aquired when an utility function is called within +/// a given process. +//------------------------------------------------------------------ +class UtilityFunctionScope { + Process *m_process; + +public: + UtilityFunctionScope(Process *p) : m_process(p) { + if (m_process) + m_process->SetRunningUtilityFunction(true); + } + ~UtilityFunctionScope() { + if (m_process) + m_process->SetRunningUtilityFunction(false); + } +}; + } // namespace lldb_private #endif // liblldb_Process_h_ diff --git a/include/lldb/Target/ProcessLaunchInfo.h b/include/lldb/Target/ProcessLaunchInfo.h index 92c517a3e460..ef1d63035b18 100644 --- a/include/lldb/Target/ProcessLaunchInfo.h +++ b/include/lldb/Target/ProcessLaunchInfo.h @@ -52,7 +52,10 @@ public: bool AppendSuppressFileAction(int fd, bool read, bool write); - void FinalizeFileActions(Target *target, bool default_to_use_pty); + // Redirect stdin/stdout/stderr to a pty, if no action for the respective file + // descriptor is specified. (So if stdin and stdout already have file actions, + // but stderr doesn't, then only stderr will be redirected to a pty.) + llvm::Error SetUpPtyRedirection(); size_t GetNumFileActions() const { return m_file_actions.size(); } @@ -131,8 +134,6 @@ public: m_listener_sp = listener_sp; } - lldb::ListenerSP GetListenerForProcess(Debugger &debugger); - lldb::ListenerSP GetHijackListener() const { return m_hijack_listener_sp; } void SetHijackListener(const lldb::ListenerSP &listener_sp) { diff --git a/include/lldb/Target/ProcessStructReader.h b/include/lldb/Target/ProcessStructReader.h index 8f1445ae8c1b..79f0b4cccd45 100644 --- a/include/lldb/Target/ProcessStructReader.h +++ b/include/lldb/Target/ProcessStructReader.h @@ -60,18 +60,20 @@ public: return; auto size = field_type.GetByteSize(nullptr); // no support for things larger than a uint64_t (yet) - if (size > 8) + if (!size || *size > 8) return; ConstString const_name = ConstString(name.c_str()); size_t byte_index = static_cast<size_t>(bit_offset / 8); m_fields[const_name] = - FieldImpl{field_type, byte_index, static_cast<size_t>(size)}; + FieldImpl{field_type, byte_index, static_cast<size_t>(*size)}; } - size_t total_size = struct_type.GetByteSize(nullptr); - lldb::DataBufferSP buffer_sp(new DataBufferHeap(total_size, 0)); + auto total_size = struct_type.GetByteSize(nullptr); + if (!total_size) + return; + lldb::DataBufferSP buffer_sp(new DataBufferHeap(*total_size, 0)); Status error; process->ReadMemoryFromInferior(base_addr, buffer_sp->GetBytes(), - total_size, error); + *total_size, error); if (error.Fail()) return; m_data = DataExtractor(buffer_sp, m_byte_order, m_addr_byte_size); diff --git a/include/lldb/Target/QueueItem.h b/include/lldb/Target/QueueItem.h index 76bcea36a2fa..3fd331ca525a 100644 --- a/include/lldb/Target/QueueItem.h +++ b/include/lldb/Target/QueueItem.h @@ -10,14 +10,10 @@ #ifndef liblldb_QueueItem_h_ #define liblldb_QueueItem_h_ -// C Includes -// C++ Includes #include <memory> #include <string> #include <vector> -// Other libraries and framework includes -// Project includes #include "lldb/lldb-enumerations.h" #include "lldb/lldb-forward.h" #include "lldb/lldb-private.h" diff --git a/include/lldb/Target/RegisterContext.h b/include/lldb/Target/RegisterContext.h index 73a2930fd2b5..a24c270a1e5e 100644 --- a/include/lldb/Target/RegisterContext.h +++ b/include/lldb/Target/RegisterContext.h @@ -10,10 +10,6 @@ #ifndef liblldb_RegisterContext_h_ #define liblldb_RegisterContext_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/Target/ExecutionContextScope.h" #include "lldb/lldb-private.h" diff --git a/include/lldb/Target/SectionLoadHistory.h b/include/lldb/Target/SectionLoadHistory.h index 0ed335a9d040..0a14fc05c458 100644 --- a/include/lldb/Target/SectionLoadHistory.h +++ b/include/lldb/Target/SectionLoadHistory.h @@ -10,12 +10,9 @@ #ifndef liblldb_SectionLoadHistory_h_ #define liblldb_SectionLoadHistory_h_ -// C Includes -// C++ Includes #include <map> #include <mutex> -// Project includes #include "lldb/lldb-public.h" namespace lldb_private { diff --git a/include/lldb/Target/SectionLoadList.h b/include/lldb/Target/SectionLoadList.h index 1156c686df17..2a321e7a2545 100644 --- a/include/lldb/Target/SectionLoadList.h +++ b/include/lldb/Target/SectionLoadList.h @@ -11,14 +11,10 @@ #ifndef liblldb_SectionLoadList_h_ #define liblldb_SectionLoadList_h_ -// C Includes -// C++ Includes #include <map> #include <mutex> -// Other libraries and framework includes #include "llvm/ADT/DenseMap.h" -// Project includes #include "lldb/Core/Section.h" #include "lldb/lldb-public.h" diff --git a/include/lldb/Target/StackFrame.h b/include/lldb/Target/StackFrame.h index ce9b16227672..a4e31a567440 100644 --- a/include/lldb/Target/StackFrame.h +++ b/include/lldb/Target/StackFrame.h @@ -10,20 +10,16 @@ #ifndef liblldb_StackFrame_h_ #define liblldb_StackFrame_h_ -// C Includes -// C++ Includes #include <memory> #include <mutex> -// Other libraries and framework includes -// Project includes #include "lldb/Utility/Flags.h" -#include "lldb/Core/Scalar.h" #include "lldb/Core/ValueObjectList.h" #include "lldb/Symbol/SymbolContext.h" #include "lldb/Target/ExecutionContextScope.h" #include "lldb/Target/StackID.h" +#include "lldb/Utility/Scalar.h" #include "lldb/Utility/Status.h" #include "lldb/Utility/StreamString.h" #include "lldb/Utility/UserID.h" @@ -35,9 +31,9 @@ namespace lldb_private { /// This base class provides an interface to stack frames. /// /// StackFrames may have a Canonical Frame Address (CFA) or not. -/// A frame may have a plain pc value or it may have a pc value + stop_id -/// to indicate a specific point in the debug session so the correct section -/// load list is used for symbolication. +/// A frame may have a plain pc value or it may indicate a specific point in +/// the debug session so the correct section load list is used for +/// symbolication. /// /// Local variables may be available, or not. A register context may be /// available, or not. @@ -54,14 +50,27 @@ public: eExpressionPathOptionsInspectAnonymousUnions = (1u << 5) }; + enum class Kind { + /// A regular stack frame with access to registers and local variables. + Regular, + + /// A historical stack frame -- possibly without CFA or registers or + /// local variables. + History, + + /// An artificial stack frame (e.g. a synthesized result of inferring + /// missing tail call frames from a backtrace) with limited support for + /// local variables. + Artificial + }; + //------------------------------------------------------------------ /// Construct a StackFrame object without supplying a RegisterContextSP. /// /// This is the one constructor that doesn't take a RegisterContext /// parameter. This ctor may be called when creating a history StackFrame; /// these are used if we've collected a stack trace of pc addresses at some - /// point in the past. We may only have pc values. We may have pc values - /// and the stop_id when the stack trace was recorded. We may have a CFA, + /// point in the past. We may only have pc values. We may have a CFA, /// or more likely, we won't. /// /// @param [in] thread_sp @@ -92,23 +101,7 @@ public: /// @param [in] pc /// The current pc value of this stack frame. /// - /// @param [in] stop_id - /// The stop_id which should be used when looking up symbols for the pc - /// value, - /// if appropriate. This argument is ignored if stop_id_is_valid is false. - /// - /// @param [in] stop_id_is_valid - /// If the stop_id argument provided is not needed for this StackFrame, this - /// should be false. If this is a history stack frame and we know the - /// stop_id - /// when the pc value was collected, that stop_id should be provided and - /// this - /// will be true. - /// - /// @param [in] is_history_frame - /// If this is a historical stack frame -- possibly without CFA or registers - /// or - /// local variables -- then this should be set to true. + /// @param [in] frame_kind /// /// @param [in] sc_ptr /// Optionally seed the StackFrame with the SymbolContext information that @@ -117,8 +110,7 @@ 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, uint32_t stop_id, - bool stop_id_is_valid, bool is_history_frame, + bool cfa_is_valid, lldb::addr_t pc, Kind frame_kind, const SymbolContext *sc_ptr); StackFrame(const lldb::ThreadSP &thread_sp, lldb::user_id_t frame_idx, @@ -177,7 +169,7 @@ public: /// A SymbolContext reference which includes the types of information /// requested by resolve_scope, if they are available. //------------------------------------------------------------------ - const SymbolContext &GetSymbolContext(uint32_t resolve_scope); + const SymbolContext &GetSymbolContext(lldb::SymbolContextItem resolve_scope); //------------------------------------------------------------------ /// Return the Canonical Frame Address (DWARF term) for this frame. @@ -403,6 +395,18 @@ public: bool IsInlined(); //------------------------------------------------------------------ + /// Query whether this frame is part of a historical backtrace. + //------------------------------------------------------------------ + bool IsHistorical() const; + + //------------------------------------------------------------------ + /// Query whether this frame is artificial (e.g a synthesized result of + /// inferring missing tail call frames from a backtrace). Artificial frames + /// may have limited support for inspecting variables. + //------------------------------------------------------------------ + bool IsArtificial() const; + + //------------------------------------------------------------------ /// Query this frame to find what frame it is in this Thread's /// StackFrameList. /// @@ -413,6 +417,11 @@ public: uint32_t GetFrameIndex() const; //------------------------------------------------------------------ + /// Set this frame's synthetic frame index. + //------------------------------------------------------------------ + void SetFrameIndex(uint32_t index) { m_frame_index = index; } + + //------------------------------------------------------------------ /// Query this frame to find what frame it is in this Thread's /// StackFrameList, not counting inlined frames. /// @@ -504,6 +513,21 @@ public: int64_t offset); //------------------------------------------------------------------ + /// Attempt to reconstruct the ValueObject for a variable with a given \a name + /// from within the current StackFrame, within the current block. The search + /// for the variable starts in the deepest block corresponding to the current + /// PC in the stack frame and traverse through all parent blocks stopping at + /// inlined function boundaries. + /// + /// @params [in] name + /// The name of the variable. + /// + /// @return + /// The ValueObject if found. + //------------------------------------------------------------------ + lldb::ValueObjectSP FindVariable(ConstString name); + + //------------------------------------------------------------------ // lldb::ExecutionContextScope pure virtual functions //------------------------------------------------------------------ lldb::TargetSP CalculateTarget() override; @@ -516,6 +540,8 @@ public: void CalculateExecutionContext(ExecutionContext &exe_ctx) override; + lldb::RecognizedStackFrameSP GetRecognizedFrame(); + protected: friend class StackFrameList; @@ -545,14 +571,12 @@ private: Status m_frame_base_error; bool m_cfa_is_valid; // Does this frame have a CFA? Different from CFA == // LLDB_INVALID_ADDRESS - uint32_t m_stop_id; - bool m_stop_id_is_valid; // Does this frame have a stop_id? Use it when - // referring to the m_frame_code_addr. - bool m_is_history_frame; + Kind m_stack_frame_kind; lldb::VariableListSP m_variable_list_sp; ValueObjectList m_variable_list_value_objects; // Value objects for each // variable in // m_variable_list_sp + lldb::RecognizedStackFrameSP m_recognized_frame_sp; StreamString m_disassembly; std::recursive_mutex m_mutex; diff --git a/include/lldb/Target/StackFrameList.h b/include/lldb/Target/StackFrameList.h index cb9fb136fb4e..0de90b3ba4ac 100644 --- a/include/lldb/Target/StackFrameList.h +++ b/include/lldb/Target/StackFrameList.h @@ -10,14 +10,10 @@ #ifndef liblldb_StackFrameList_h_ #define liblldb_StackFrameList_h_ -// C Includes -// C++ Includes #include <memory> #include <mutex> #include <vector> -// Other libraries and framework includes -// Project includes #include "lldb/Target/StackFrame.h" namespace lldb_private { @@ -32,22 +28,33 @@ public: ~StackFrameList(); + /// Get the number of visible frames. Frames may be created if \p can_create + /// is true. Synthetic (inline) frames expanded from the concrete frame #0 + /// (aka invisible frames) are not included in this count. uint32_t GetNumFrames(bool can_create = true); + /// Get the frame at index \p idx. Invisible frames cannot be indexed. lldb::StackFrameSP GetFrameAtIndex(uint32_t idx); + /// Get the first concrete frame with index greater than or equal to \p idx. + /// Unlike \ref GetFrameAtIndex, this cannot return a synthetic frame. lldb::StackFrameSP GetFrameWithConcreteFrameIndex(uint32_t unwind_idx); + /// Retrieve the stack frame with the given ID \p stack_id. lldb::StackFrameSP GetFrameWithStackID(const StackID &stack_id); - // Mark a stack frame as the current frame + /// Mark a stack frame as the currently selected frame and return its index. uint32_t SetSelectedFrame(lldb_private::StackFrame *frame); + /// Get the currently selected frame index. uint32_t GetSelectedFrameIndex() const; - // Mark a stack frame as the current frame using the frame index + /// Mark a stack frame as the currently selected frame using the frame index + /// \p idx. Like \ref GetFrameAtIndex, invisible frames cannot be selected. bool SetSelectedFrameByIndex(uint32_t idx); + /// If the current inline depth (i.e the number of invisible frames) is valid, + /// subtract it from \p idx. Otherwise simply return \p idx. uint32_t GetVisibleStackFrameIndex(uint32_t idx) { if (m_current_inlined_depth < UINT32_MAX) return idx - m_current_inlined_depth; @@ -55,16 +62,23 @@ public: return idx; } + /// Calculate and set the current inline depth. This may be used to update + /// the StackFrameList's set of inline frames when execution stops, e.g when + /// a breakpoint is hit. void CalculateCurrentInlinedDepth(); + /// If the currently selected frame comes from the currently selected thread, + /// point the default file and line of the thread's target to the location + /// specified by the frame. void SetDefaultFileAndLineToSelectedFrame(); + /// Clear the cache of frames. void Clear(); - void InvalidateFrames(uint32_t start_idx); - void Dump(Stream *s); + /// If \p stack_frame_ptr is contained in this StackFrameList, return its + /// wrapping shared pointer. lldb::StackFrameSP GetStackFrameSPForStackFramePtr(StackFrame *stack_frame_ptr); @@ -83,6 +97,10 @@ protected: void GetFramesUpTo(uint32_t end_idx); + void GetOnlyConcreteFramesUpTo(uint32_t end_idx, Unwind *unwinder); + + void SynthesizeTailCallFrames(StackFrame &next_frame); + bool GetAllFramesFetched() { return m_concrete_frames_fetched == UINT32_MAX; } void SetAllFramesFetched() { m_concrete_frames_fetched = UINT32_MAX; } @@ -99,15 +117,45 @@ protected: typedef collection::iterator iterator; typedef collection::const_iterator const_iterator; + /// The thread this frame list describes. Thread &m_thread; + + /// The old stack frame list. + // TODO: The old stack frame list is used to fill in missing frame info + // heuristically when it's otherwise unavailable (say, because the unwinder + // fails). We should have stronger checks to make sure that this is a valid + // source of information. lldb::StackFrameListSP m_prev_frames_sp; + + /// A mutex for this frame list. + // TODO: This mutex may not always be held when required. In particular, uses + // of the StackFrameList APIs in lldb_private::Thread look suspect. Consider + // passing around a lock_guard reference to enforce proper locking. mutable std::recursive_mutex m_mutex; + + /// A cache of frames. This may need to be updated when the program counter + /// changes. collection m_frames; + + /// The currently selected frame. uint32_t m_selected_frame_idx; + + /// The number of concrete frames fetched while filling the frame list. This + /// is only used when synthetic frames are enabled. uint32_t m_concrete_frames_fetched; + + /// The number of synthetic function activations (invisible frames) expanded + /// from the concrete frame #0 activation. + // TODO: Use an optional instead of UINT32_MAX to denote invalid values. uint32_t m_current_inlined_depth; + + /// The program counter value at the currently selected synthetic activation. + /// This is only valid if m_current_inlined_depth is valid. + // TODO: Use an optional instead of UINT32_MAX to denote invalid values. lldb::addr_t m_current_inlined_pc; - bool m_show_inlined_frames; + + /// Whether or not to show synthetic (inline) frames. Immutable. + const bool m_show_inlined_frames; private: DISALLOW_COPY_AND_ASSIGN(StackFrameList); diff --git a/include/lldb/Target/StackFrameRecognizer.h b/include/lldb/Target/StackFrameRecognizer.h new file mode 100644 index 000000000000..35ec23b754f3 --- /dev/null +++ b/include/lldb/Target/StackFrameRecognizer.h @@ -0,0 +1,129 @@ +//===-- StackFrameRecognizer.h ----------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef liblldb_StackFrameRecognizer_h_ +#define liblldb_StackFrameRecognizer_h_ + +#include "lldb/Core/ValueObjectList.h" +#include "lldb/Symbol/VariableList.h" +#include "lldb/Utility/StructuredData.h" +#include "lldb/lldb-private-forward.h" +#include "lldb/lldb-public.h" + +namespace lldb_private { + +/// @class RecognizedStackFrame +/// +/// This class provides extra information about a stack frame that was +/// provided by a specific stack frame recognizer. Right now, this class only +/// holds recognized arguments (via GetRecognizedArguments). + +class RecognizedStackFrame + : public std::enable_shared_from_this<RecognizedStackFrame> { +public: + virtual lldb::ValueObjectListSP GetRecognizedArguments() { + return m_arguments; + } + virtual lldb::ValueObjectSP GetExceptionObject() { + return lldb::ValueObjectSP(); + } + virtual ~RecognizedStackFrame(){}; + +protected: + lldb::ValueObjectListSP m_arguments; +}; + +/// @class StackFrameRecognizer +/// +/// A base class for frame recognizers. Subclasses (actual frame recognizers) +/// should implement RecognizeFrame to provide a RecognizedStackFrame for a +/// given stack frame. + +class StackFrameRecognizer + : public std::enable_shared_from_this<StackFrameRecognizer> { +public: + virtual lldb::RecognizedStackFrameSP RecognizeFrame( + lldb::StackFrameSP frame) { + return lldb::RecognizedStackFrameSP(); + }; + virtual std::string GetName() { + return ""; + } + + virtual ~StackFrameRecognizer(){}; +}; + +#ifndef LLDB_DISABLE_PYTHON + +/// @class ScriptedStackFrameRecognizer +/// +/// Python implementation for frame recognizers. An instance of this class +/// tracks a particular Python classobject, which will be asked to recognize +/// stack frames. + +class ScriptedStackFrameRecognizer : public StackFrameRecognizer { + lldb_private::ScriptInterpreter *m_interpreter; + lldb_private::StructuredData::ObjectSP m_python_object_sp; + std::string m_python_class; + +public: + ScriptedStackFrameRecognizer(lldb_private::ScriptInterpreter *interpreter, + const char *pclass); + ~ScriptedStackFrameRecognizer() {} + + std::string GetName() override { + return GetPythonClassName(); + } + + const char *GetPythonClassName() { return m_python_class.c_str(); } + + lldb::RecognizedStackFrameSP RecognizeFrame( + lldb::StackFrameSP frame) override; + +private: + DISALLOW_COPY_AND_ASSIGN(ScriptedStackFrameRecognizer); +}; + +#endif + +/// @class StackFrameRecognizerManager +/// +/// Static class that provides a registry of known stack frame recognizers. +/// Has static methods to add, enumerate, remove, query and invoke recognizers. + +class StackFrameRecognizerManager { +public: + static void AddRecognizer(lldb::StackFrameRecognizerSP recognizer, + const ConstString &module, + const ConstString &symbol, + bool first_instruction_only = true); + + static void AddRecognizer(lldb::StackFrameRecognizerSP recognizer, + lldb::RegularExpressionSP module, + lldb::RegularExpressionSP symbol, + bool first_instruction_only = true); + + static void ForEach( + std::function<void(uint32_t recognizer_id, std::string recognizer_name, + std::string module, std::string symbol, + bool regexp)> const &callback); + + static bool RemoveRecognizerWithID(uint32_t recognizer_id); + + static void RemoveAllRecognizers(); + + static lldb::StackFrameRecognizerSP GetRecognizerForFrame( + lldb::StackFrameSP frame); + + static lldb::RecognizedStackFrameSP RecognizeFrame(lldb::StackFrameSP frame); +}; + +} // namespace lldb_private + +#endif // liblldb_StackFrameRecognizer_h_ diff --git a/include/lldb/Target/StackID.h b/include/lldb/Target/StackID.h index 51e51a6c0741..871f39c463a9 100644 --- a/include/lldb/Target/StackID.h +++ b/include/lldb/Target/StackID.h @@ -10,10 +10,6 @@ #ifndef liblldb_StackID_h_ #define liblldb_StackID_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/Core/AddressRange.h" #include "lldb/lldb-private.h" diff --git a/include/lldb/Target/StopInfo.h b/include/lldb/Target/StopInfo.h index b25bf7dd3d5d..1a9f5b8480db 100644 --- a/include/lldb/Target/StopInfo.h +++ b/include/lldb/Target/StopInfo.h @@ -10,12 +10,8 @@ #ifndef liblldb_StopInfo_h_ #define liblldb_StopInfo_h_ -// C Includes -// C++ Includes #include <string> -// Other libraries and framework includes -// Project includes #include "lldb/Target/Process.h" #include "lldb/Utility/StructuredData.h" #include "lldb/lldb-public.h" diff --git a/include/lldb/Target/SystemRuntime.h b/include/lldb/Target/SystemRuntime.h index 06cc3ec2d012..328dbe231078 100644 --- a/include/lldb/Target/SystemRuntime.h +++ b/include/lldb/Target/SystemRuntime.h @@ -10,10 +10,6 @@ #ifndef liblldb_SystemRuntime_h_ #define liblldb_SystemRuntime_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include <vector> #include "lldb/Core/ModuleList.h" diff --git a/include/lldb/Target/Target.h b/include/lldb/Target/Target.h index 75af8e80d2e5..90df1f4929b7 100644 --- a/include/lldb/Target/Target.h +++ b/include/lldb/Target/Target.h @@ -10,21 +10,16 @@ #ifndef liblldb_Target_h_ #define liblldb_Target_h_ -// C Includes -// C++ Includes #include <list> #include <map> #include <memory> #include <string> #include <vector> -// Other libraries and framework includes -// Project includes #include "lldb/Breakpoint/BreakpointList.h" #include "lldb/Breakpoint/BreakpointName.h" #include "lldb/Breakpoint/WatchpointList.h" #include "lldb/Core/Architecture.h" -#include "lldb/Core/Broadcaster.h" #include "lldb/Core/Disassembler.h" #include "lldb/Core/ModuleList.h" #include "lldb/Core/UserSettingsController.h" @@ -35,13 +30,14 @@ #include "lldb/Target/ProcessLaunchInfo.h" #include "lldb/Target/SectionLoadHistory.h" #include "lldb/Utility/ArchSpec.h" +#include "lldb/Utility/Broadcaster.h" #include "lldb/Utility/LLDBAssert.h" #include "lldb/Utility/Timeout.h" #include "lldb/lldb-public.h" namespace lldb_private { -extern OptionEnumValueElement g_dynamic_value_types[]; +OptionEnumValues GetDynamicValueTypes(); typedef enum InlineStrategy { eInlineBreakpointsNever = 0, @@ -61,6 +57,12 @@ typedef enum LoadCWDlldbinitFile { eLoadCWDlldbinitWarn } LoadCWDlldbinitFile; +typedef enum LoadDependentFiles { + eLoadDependentsDefault, + eLoadDependentsYes, + eLoadDependentsNo, +} LoadDependentFiles; + //---------------------------------------------------------------------- // TargetProperties //---------------------------------------------------------------------- @@ -186,6 +188,10 @@ public: void SetDisplayRuntimeSupportValues(bool b); + bool GetDisplayRecognizedArguments() const; + + void SetDisplayRecognizedArguments(bool b); + const ProcessLaunchInfo &GetProcessLaunchInfo(); void SetProcessLaunchInfo(const ProcessLaunchInfo &launch_info); @@ -196,6 +202,10 @@ public: bool GetUseModernTypeLookup() const; + void SetRequireHardwareBreakpoints(bool b); + + bool GetRequireHardwareBreakpoints() const; + private: //------------------------------------------------------------------ // Callbacks for m_launch_info. @@ -375,6 +385,10 @@ public: bool GetAutoApplyFixIts() const { return m_auto_apply_fixits; } + bool IsForUtilityExpr() const { return m_running_utility_expression; } + + void SetIsForUtilityExpr(bool b) { m_running_utility_expression = b; } + private: ExecutionPolicy m_execution_policy = default_execution_policy; lldb::LanguageType m_language = lldb::eLanguageTypeUnknown; @@ -392,6 +406,10 @@ private: bool m_ansi_color_errors = false; bool m_result_is_internal = false; bool m_auto_apply_fixits = true; + /// True if the executed code should be treated as utility code that is only + /// used by LLDB internally. + bool m_running_utility_expression = false; + lldb::DynamicValueType m_use_dynamic = lldb::eNoDynamicValues; Timeout<std::micro> m_timeout = default_timeout; Timeout<std::micro> m_one_thread_timeout = llvm::None; @@ -515,7 +533,9 @@ public: //------------------------------------------------------------------ void Dump(Stream *s, lldb::DescriptionLevel description_level); - const lldb::ProcessSP &CreateProcess(lldb::ListenerSP listener, + // If listener_sp is null, the listener of the owning Debugger object will be + // used. + const lldb::ProcessSP &CreateProcess(lldb::ListenerSP listener_sp, llvm::StringRef plugin_name, const FileSpec *crash_file); @@ -549,7 +569,7 @@ public: // module it is nullptr lldb::BreakpointSP CreateBreakpoint(const FileSpecList *containingModules, const FileSpec &file, uint32_t line_no, - lldb::addr_t offset, + uint32_t column, lldb::addr_t offset, LazyBool check_inlines, LazyBool skip_prologue, bool internal, bool request_hardware, @@ -594,14 +614,12 @@ public: // eLazyBoolCalculate, we use the current target 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, - const char *func_name, - uint32_t func_name_type_mask, - lldb::LanguageType language, - lldb::addr_t offset, - LazyBool skip_prologue, bool internal, - bool request_hardware); + lldb::BreakpointSP CreateBreakpoint( + const FileSpecList *containingModules, + const FileSpecList *containingSourceFiles, const char *func_name, + lldb::FunctionNameType func_name_type_mask, lldb::LanguageType language, + lldb::addr_t offset, LazyBool skip_prologue, bool internal, + bool request_hardware); lldb::BreakpointSP CreateExceptionBreakpoint(enum lldb::LanguageType language, bool catch_bp, @@ -609,25 +627,34 @@ 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); + // 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, - const char *func_names[], size_t num_names, - uint32_t func_name_type_mask, lldb::LanguageType language, - lldb::addr_t offset, LazyBool skip_prologue, bool internal, - bool request_hardware); + lldb::BreakpointSP CreateBreakpoint( + const FileSpecList *containingModules, + const FileSpecList *containingSourceFiles, const char *func_names[], + size_t num_names, lldb::FunctionNameType func_name_type_mask, + lldb::LanguageType language, lldb::addr_t offset, LazyBool skip_prologue, + bool internal, bool request_hardware); lldb::BreakpointSP CreateBreakpoint(const FileSpecList *containingModules, const FileSpecList *containingSourceFiles, const std::vector<std::string> &func_names, - uint32_t func_name_type_mask, lldb::LanguageType language, - lldb::addr_t m_offset, LazyBool skip_prologue, bool internal, + lldb::FunctionNameType func_name_type_mask, + lldb::LanguageType language, lldb::addr_t m_offset, + LazyBool skip_prologue, bool internal, bool request_hardware); // Use this to create a general breakpoint: @@ -665,7 +692,6 @@ public: const BreakpointOptions &options, const BreakpointName::Permissions &permissions); void ApplyNameToBreakpoints(BreakpointName &bp_name); - // This takes ownership of the name obj passed in. void AddBreakpointName(BreakpointName *bp_name); @@ -753,9 +779,9 @@ public: /// that doesn't have code in it, LLDB_INVALID_ADDRESS will be /// returned. //------------------------------------------------------------------ - lldb::addr_t GetOpcodeLoadAddress( - lldb::addr_t load_addr, - AddressClass addr_class = AddressClass::eInvalid) const; + lldb::addr_t + GetOpcodeLoadAddress(lldb::addr_t load_addr, + AddressClass addr_class = AddressClass::eInvalid) const; // Get load_addr as breakable load address for this target. Take a addr and // check if for any reason there is a better address than this to put a @@ -826,14 +852,16 @@ public: /// A shared pointer reference to the module that will become /// the main executable for this process. /// - /// @param[in] get_dependent_files + /// @param[in] load_dependent_files /// If \b true then ask the object files to track down any /// known dependent files. /// /// @see ObjectFile::GetDependentModules (FileSpecList&) /// @see Process::GetImages() //------------------------------------------------------------------ - void SetExecutableModule(lldb::ModuleSP &module_sp, bool get_dependent_files); + void SetExecutableModule( + lldb::ModuleSP &module_sp, + LoadDependentFiles load_dependent_files = eLoadDependentsDefault); bool LoadScriptingResources(std::list<Status> &errors, Stream *feedback_stream = nullptr, @@ -913,28 +941,30 @@ public: /// Set the architecture for this target. /// /// If the current target has no Images read in, then this just sets the - /// architecture, which will - /// be used to select the architecture of the ExecutableModule when that is - /// set. - /// If the current target has an ExecutableModule, then calling - /// SetArchitecture with a different + /// architecture, which will be used to select the architecture of the + /// ExecutableModule when that is set. If the current target has an + /// ExecutableModule, then calling SetArchitecture with a different /// architecture from the currently selected one will reset the - /// ExecutableModule to that slice - /// of the file backing the ExecutableModule. If the file backing the - /// ExecutableModule does not - /// contain a fork of this architecture, then this code will return false, and - /// the architecture - /// won't be changed. - /// If the input arch_spec is the same as the already set architecture, this - /// is a no-op. + /// ExecutableModule to that slice of the file backing the ExecutableModule. + /// If the file backing the ExecutableModule does not contain a fork of this + /// architecture, then this code will return false, and the architecture + /// won't be changed. If the input arch_spec is the same as the already set + /// architecture, this is a no-op. /// /// @param[in] arch_spec /// The new architecture. /// + /// @param[in] set_platform + /// If \b true, then the platform will be adjusted if the currently + /// selected platform is not compatible with the archicture being set. + /// If \b false, then just the architecture will be set even if the + /// currently selected platform isn't compatible (in case it might be + /// manually set following this function call). + /// /// @return /// \b true if the architecture was successfully set, \bfalse otherwise. //------------------------------------------------------------------ - bool SetArchitecture(const ArchSpec &arch_spec); + bool SetArchitecture(const ArchSpec &arch_spec, bool set_platform = false); bool MergeArchitecture(const ArchSpec &arch_spec); @@ -1324,6 +1354,8 @@ private: void AddBreakpoint(lldb::BreakpointSP breakpoint_sp, bool internal); + void FinalizeFileActions(ProcessLaunchInfo &info); + DISALLOW_COPY_AND_ASSIGN(Target); }; diff --git a/include/lldb/Target/TargetList.h b/include/lldb/Target/TargetList.h index 43f4520369b6..90c480745a0c 100644 --- a/include/lldb/Target/TargetList.h +++ b/include/lldb/Target/TargetList.h @@ -10,15 +10,11 @@ #ifndef liblldb_TargetList_h_ #define liblldb_TargetList_h_ -// C Includes -// C++ Includes #include <mutex> #include <vector> -// Other libraries and framework includes -// Project includes -#include "lldb/Core/Broadcaster.h" #include "lldb/Target/Target.h" +#include "lldb/Utility/Broadcaster.h" namespace lldb_private { @@ -92,7 +88,8 @@ public: /// An error object that indicates success or failure //------------------------------------------------------------------ Status CreateTarget(Debugger &debugger, llvm::StringRef user_exe_path, - llvm::StringRef triple_str, bool get_dependent_modules, + llvm::StringRef triple_str, + LoadDependentFiles get_dependent_modules, const OptionGroupPlatform *platform_options, lldb::TargetSP &target_sp); @@ -103,7 +100,8 @@ public: /// platform you will be using //------------------------------------------------------------------ Status CreateTarget(Debugger &debugger, llvm::StringRef user_exe_path, - const ArchSpec &arch, bool get_dependent_modules, + const ArchSpec &arch, + LoadDependentFiles get_dependent_modules, lldb::PlatformSP &platform_sp, lldb::TargetSP &target_sp); //------------------------------------------------------------------ @@ -217,12 +215,13 @@ private: Status CreateTargetInternal(Debugger &debugger, llvm::StringRef user_exe_path, llvm::StringRef triple_str, - bool get_dependent_files, + LoadDependentFiles load_dependent_files, const OptionGroupPlatform *platform_options, lldb::TargetSP &target_sp, bool is_dummy_target); Status CreateTargetInternal(Debugger &debugger, llvm::StringRef user_exe_path, - const ArchSpec &arch, bool get_dependent_modules, + const ArchSpec &arch, + LoadDependentFiles get_dependent_modules, lldb::PlatformSP &platform_sp, lldb::TargetSP &target_sp, bool is_dummy_target); diff --git a/include/lldb/Target/Thread.h b/include/lldb/Target/Thread.h index 9ce73e0cbeff..0d14b10c651f 100644 --- a/include/lldb/Target/Thread.h +++ b/include/lldb/Target/Thread.h @@ -10,21 +10,17 @@ #ifndef liblldb_Thread_h_ #define liblldb_Thread_h_ -// C Includes -// C++ Includes #include <memory> #include <mutex> #include <string> #include <vector> -// Other libraries and framework includes -// Project includes -#include "lldb/Core/Broadcaster.h" -#include "lldb/Core/Event.h" #include "lldb/Core/UserSettingsController.h" #include "lldb/Target/ExecutionContextScope.h" #include "lldb/Target/RegisterCheckpoint.h" #include "lldb/Target/StackFrameList.h" +#include "lldb/Utility/Broadcaster.h" +#include "lldb/Utility/Event.h" #include "lldb/Utility/StructuredData.h" #include "lldb/Utility/UserID.h" #include "lldb/lldb-private.h" @@ -57,6 +53,8 @@ public: bool GetStepInAvoidsNoDebug() const; bool GetStepOutAvoidsNoDebug() const; + + uint64_t GetMaxBacktraceDepth() const; }; typedef std::shared_ptr<ThreadProperties> ThreadPropertiesSP; @@ -282,7 +280,7 @@ public: /// message). //------------------------------------------------------------------ StructuredData::ObjectSP GetExtendedInfo() { - if (m_extended_info_fetched == false) { + if (!m_extended_info_fetched) { m_extended_info = FetchThreadExtendedInfo(); m_extended_info_fetched = true; } @@ -496,9 +494,9 @@ public: // If stop_format is true, this will be the form used when we print stop // info. If false, it will be the form we use for thread list and co. - void DumpUsingSettingsFormat(Stream &strm, uint32_t frame_idx, + void DumpUsingSettingsFormat(Stream &strm, uint32_t frame_idx, bool stop_format); - + bool GetDescription(Stream &s, lldb::DescriptionLevel level, bool print_json_thread, bool print_json_stopinfo); @@ -655,12 +653,16 @@ public: /// @param[in] stop_other_threads /// \b true if we will stop other threads while we single step this one. /// + /// @param[out] status + /// A status with an error if queuing failed. + /// /// @return /// A shared pointer to the newly queued thread plan, or nullptr if the /// plan could not be queued. //------------------------------------------------------------------ virtual lldb::ThreadPlanSP QueueThreadPlanForStepSingleInstruction( - bool step_over, bool abort_other_plans, bool stop_other_threads); + bool step_over, bool abort_other_plans, bool stop_other_threads, + Status &status); //------------------------------------------------------------------ /// Queues the plan used to step through an address range, stepping over @@ -690,6 +692,9 @@ public: /// @param[in] stop_other_threads /// \b true if we will stop other threads while we single step this one. /// + /// @param[out] status + /// A status with an error if queuing failed. + /// /// @param[in] step_out_avoids_code_without_debug_info /// If eLazyBoolYes, if the step over steps out it will continue to step /// out till it comes to a frame with debug info. @@ -702,6 +707,7 @@ public: virtual lldb::ThreadPlanSP QueueThreadPlanForStepOverRange( bool abort_other_plans, const AddressRange &range, const SymbolContext &addr_context, lldb::RunMode stop_other_threads, + Status &status, LazyBool step_out_avoids_code_without_debug_info = eLazyBoolCalculate); // Helper function that takes a LineEntry to step, insted of an AddressRange. @@ -710,6 +716,7 @@ public: virtual lldb::ThreadPlanSP QueueThreadPlanForStepOverRange( bool abort_other_plans, const LineEntry &line_entry, const SymbolContext &addr_context, lldb::RunMode stop_other_threads, + Status &status, LazyBool step_out_avoids_code_without_debug_info = eLazyBoolCalculate); //------------------------------------------------------------------ @@ -744,6 +751,9 @@ public: /// @param[in] stop_other_threads /// \b true if we will stop other threads while we single step this one. /// + /// @param[out] status + /// A status with an error if queuing failed. + /// /// @param[in] step_in_avoids_code_without_debug_info /// If eLazyBoolYes we will step out if we step into code with no debug /// info. @@ -761,7 +771,7 @@ public: virtual lldb::ThreadPlanSP QueueThreadPlanForStepInRange( bool abort_other_plans, const AddressRange &range, const SymbolContext &addr_context, const char *step_in_target, - lldb::RunMode stop_other_threads, + lldb::RunMode stop_other_threads, Status &status, LazyBool step_in_avoids_code_without_debug_info = eLazyBoolCalculate, LazyBool step_out_avoids_code_without_debug_info = eLazyBoolCalculate); @@ -771,7 +781,7 @@ public: virtual lldb::ThreadPlanSP QueueThreadPlanForStepInRange( bool abort_other_plans, const LineEntry &line_entry, const SymbolContext &addr_context, const char *step_in_target, - lldb::RunMode stop_other_threads, + lldb::RunMode stop_other_threads, Status &status, LazyBool step_in_avoids_code_without_debug_info = eLazyBoolCalculate, LazyBool step_out_avoids_code_without_debug_info = eLazyBoolCalculate); @@ -803,6 +813,9 @@ public: /// @param[in] run_vote /// See standard meanings for the stop & run votes in ThreadPlan.h. /// + /// @param[out] status + /// A status with an error if queuing failed. + /// /// @param[in] step_out_avoids_code_without_debug_info /// If eLazyBoolYes, if the step over steps out it will continue to step /// out till it comes to a frame with debug info. @@ -814,10 +827,8 @@ public: //------------------------------------------------------------------ virtual lldb::ThreadPlanSP QueueThreadPlanForStepOut( bool abort_other_plans, SymbolContext *addr_context, bool first_insn, - bool stop_other_threads, - Vote stop_vote, // = eVoteYes, - Vote run_vote, // = eVoteNoOpinion); - uint32_t frame_idx, + bool stop_other_threads, Vote stop_vote, Vote run_vote, + uint32_t frame_idx, Status &status, LazyBool step_out_avoids_code_without_debug_info = eLazyBoolCalculate); //------------------------------------------------------------------ @@ -848,9 +859,15 @@ public: /// \b true if we will stop other threads while we single step this one. /// /// @param[in] stop_vote + /// /// @param[in] run_vote /// See standard meanings for the stop & run votes in ThreadPlan.h. /// + /// @param[in] frame_idx + /// + /// @param[out] status + /// A status with an error if queuing failed. + /// /// @param[in] continue_to_next_branch /// Normally this will enqueue a plan that will put a breakpoint on the /// return address and continue @@ -874,16 +891,13 @@ public: //------------------------------------------------------------------ virtual lldb::ThreadPlanSP QueueThreadPlanForStepOutNoShouldStop( bool abort_other_plans, SymbolContext *addr_context, bool first_insn, - bool stop_other_threads, - Vote stop_vote, // = eVoteYes, - Vote run_vote, // = eVoteNoOpinion); - uint32_t frame_idx, bool continue_to_next_branch = false); + bool stop_other_threads, Vote stop_vote, Vote run_vote, + uint32_t frame_idx, Status &status, bool continue_to_next_branch = false); //------------------------------------------------------------------ /// Gets the plan used to step through the code that steps from a function /// call site at the current PC into the actual function call. /// - /// /// @param[in] return_stack_id /// The stack id that we will return to (by setting backstop breakpoints on /// the return @@ -897,14 +911,17 @@ public: /// @param[in] stop_other_threads /// \b true if we will stop other threads while we single step this one. /// + /// @param[out] status + /// A status with an error if queuing failed. + /// /// @return /// A shared pointer to the newly queued thread plan, or nullptr if the /// plan could not be queued. //------------------------------------------------------------------ virtual lldb::ThreadPlanSP QueueThreadPlanForStepThrough(StackID &return_stack_id, - bool abort_other_plans, - bool stop_other_threads); + bool abort_other_plans, bool stop_other_threads, + Status &status); //------------------------------------------------------------------ /// Gets the plan used to continue from the current PC. @@ -922,22 +939,24 @@ public: /// @param[in] stop_other_threads /// \b true if we will stop other threads while we single step this one. /// + /// @param[out] status + /// A status with an error if queuing failed. + /// /// @return /// A shared pointer to the newly queued thread plan, or nullptr if the /// plan could not be queued. //------------------------------------------------------------------ virtual lldb::ThreadPlanSP QueueThreadPlanForRunToAddress(bool abort_other_plans, Address &target_addr, - bool stop_other_threads); + bool stop_other_threads, Status &status); - virtual lldb::ThreadPlanSP - QueueThreadPlanForStepUntil(bool abort_other_plans, - lldb::addr_t *address_list, size_t num_addresses, - bool stop_others, uint32_t frame_idx); + virtual lldb::ThreadPlanSP QueueThreadPlanForStepUntil( + bool abort_other_plans, lldb::addr_t *address_list, size_t num_addresses, + bool stop_others, uint32_t frame_idx, Status &status); virtual lldb::ThreadPlanSP QueueThreadPlanForStepScripted(bool abort_other_plans, const char *class_name, - bool stop_other_threads); + bool stop_other_threads, Status &status); //------------------------------------------------------------------ // Thread Plan accessors: @@ -1023,7 +1042,7 @@ public: /// false otherwise. //------------------------------------------------------------------ bool CompletedPlanOverridesBreakpoint(); - + //------------------------------------------------------------------ /// Queues a generic thread plan. /// @@ -1038,7 +1057,7 @@ public: /// @return /// A pointer to the last completed plan. //------------------------------------------------------------------ - void QueueThreadPlan(lldb::ThreadPlanSP &plan_sp, bool abort_other_plans); + Status QueueThreadPlan(lldb::ThreadPlanSP &plan_sp, bool abort_other_plans); //------------------------------------------------------------------ /// Discards the plans queued on the plan stack of the current thread. This @@ -1234,6 +1253,10 @@ public: //---------------------------------------------------------------------- virtual uint64_t GetExtendedBacktraceToken() { return LLDB_INVALID_ADDRESS; } + lldb::ValueObjectSP GetCurrentException(); + + lldb::ThreadSP GetCurrentExceptionBacktrace(); + protected: friend class ThreadPlan; friend class ThreadList; diff --git a/include/lldb/Target/ThreadPlan.h b/include/lldb/Target/ThreadPlan.h index 7591fa9c9d07..15bc4c7656c3 100644 --- a/include/lldb/Target/ThreadPlan.h +++ b/include/lldb/Target/ThreadPlan.h @@ -10,13 +10,9 @@ #ifndef liblldb_ThreadPlan_h_ #define liblldb_ThreadPlan_h_ -// C Includes -// C++ Includes #include <mutex> #include <string> -// Other libraries and framework includes -// Project includes #include "lldb/Target/Process.h" #include "lldb/Target/StopInfo.h" #include "lldb/Target/Target.h" @@ -600,10 +596,12 @@ protected: bool IsUsuallyUnexplainedStopReason(lldb::StopReason); + Status m_status; Thread &m_thread; Vote m_stop_vote; Vote m_run_vote; - bool m_takes_iteration_count = false; + bool m_takes_iteration_count; + bool m_could_not_resolve_hw_bp; int32_t m_iteration_count = 1; private: @@ -655,6 +653,8 @@ public: bool OkayToDiscard() override { return false; } + const Status &GetStatus() { return m_status; } + protected: bool DoPlanExplainsStop(Event *event_ptr) override; diff --git a/include/lldb/Target/ThreadPlanBase.h b/include/lldb/Target/ThreadPlanBase.h index 7a8b7eb20bb2..bcf20c5544bc 100644 --- a/include/lldb/Target/ThreadPlanBase.h +++ b/include/lldb/Target/ThreadPlanBase.h @@ -10,10 +10,6 @@ #ifndef liblldb_ThreadPlanFundamental_h_ #define liblldb_ThreadPlanFundamental_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/Target/Process.h" #include "lldb/Target/Thread.h" #include "lldb/Target/ThreadPlan.h" diff --git a/include/lldb/Target/ThreadPlanCallFunction.h b/include/lldb/Target/ThreadPlanCallFunction.h index 56bfc819320c..3bec86e370d1 100644 --- a/include/lldb/Target/ThreadPlanCallFunction.h +++ b/include/lldb/Target/ThreadPlanCallFunction.h @@ -10,10 +10,6 @@ #ifndef liblldb_ThreadPlanCallFunction_h_ #define liblldb_ThreadPlanCallFunction_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/Target/Thread.h" #include "lldb/Target/ThreadPlan.h" #include "lldb/lldb-private.h" diff --git a/include/lldb/Target/ThreadPlanCallFunctionUsingABI.h b/include/lldb/Target/ThreadPlanCallFunctionUsingABI.h index d58f7f050dbe..9b75da5fd2f8 100644 --- a/include/lldb/Target/ThreadPlanCallFunctionUsingABI.h +++ b/include/lldb/Target/ThreadPlanCallFunctionUsingABI.h @@ -11,10 +11,6 @@ #ifndef liblldb_ThreadPlanCallFunctionUsingABI_h_ #define liblldb_ThreadPlanCallFunctionUsingABI_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/Target/ABI.h" #include "lldb/Target/Thread.h" #include "lldb/Target/ThreadPlanCallFunction.h" diff --git a/include/lldb/Target/ThreadPlanCallUserExpression.h b/include/lldb/Target/ThreadPlanCallUserExpression.h index 5fe80927ca21..ba1001ce5e91 100644 --- a/include/lldb/Target/ThreadPlanCallUserExpression.h +++ b/include/lldb/Target/ThreadPlanCallUserExpression.h @@ -11,10 +11,6 @@ #ifndef liblldb_ThreadPlanCallUserExpression_h_ #define liblldb_ThreadPlanCallUserExpression_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/Target/Thread.h" #include "lldb/Target/ThreadPlan.h" #include "lldb/Target/ThreadPlanCallFunction.h" diff --git a/include/lldb/Target/ThreadPlanPython.h b/include/lldb/Target/ThreadPlanPython.h index 973c935b7c79..fc4cfb3bf0b4 100644 --- a/include/lldb/Target/ThreadPlanPython.h +++ b/include/lldb/Target/ThreadPlanPython.h @@ -11,12 +11,8 @@ #ifndef liblldb_ThreadPlan_Python_h_ #define liblldb_ThreadPlan_Python_h_ -// C Includes -// C++ Includes #include <string> -// Other libraries and framework includes -// Project includes #include "lldb/Target/Process.h" #include "lldb/Target/StopInfo.h" #include "lldb/Target/Target.h" @@ -63,6 +59,7 @@ protected: private: std::string m_class_name; StructuredData::ObjectSP m_implementation_sp; + bool m_did_push; DISALLOW_COPY_AND_ASSIGN(ThreadPlanPython); }; diff --git a/include/lldb/Target/ThreadPlanRunToAddress.h b/include/lldb/Target/ThreadPlanRunToAddress.h index 8e91fb9472a7..58608864d463 100644 --- a/include/lldb/Target/ThreadPlanRunToAddress.h +++ b/include/lldb/Target/ThreadPlanRunToAddress.h @@ -10,12 +10,8 @@ #ifndef liblldb_ThreadPlanRunToAddress_h_ #define liblldb_ThreadPlanRunToAddress_h_ -// C Includes -// C++ Includes #include <vector> -// Other libraries and framework includes -// Project includes #include "lldb/Target/ThreadPlan.h" #include "lldb/lldb-private.h" diff --git a/include/lldb/Target/ThreadPlanShouldStopHere.h b/include/lldb/Target/ThreadPlanShouldStopHere.h index 030d5e434bd9..d3aca3e6f5c0 100644 --- a/include/lldb/Target/ThreadPlanShouldStopHere.h +++ b/include/lldb/Target/ThreadPlanShouldStopHere.h @@ -10,10 +10,6 @@ #ifndef liblldb_ThreadPlanShouldStopHere_h_ #define liblldb_ThreadPlanShouldStopHere_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/Target/ThreadPlan.h" namespace lldb_private { @@ -101,10 +97,12 @@ public: void ClearShouldStopHereCallbacks() { m_callbacks.Clear(); } - bool InvokeShouldStopHereCallback(lldb::FrameComparison operation); + bool InvokeShouldStopHereCallback(lldb::FrameComparison operation, + Status &status); lldb::ThreadPlanSP - CheckShouldStopHereAndQueueStepOut(lldb::FrameComparison operation); + CheckShouldStopHereAndQueueStepOut(lldb::FrameComparison operation, + Status &status); lldb_private::Flags &GetFlags() { return m_flags; } @@ -114,14 +112,16 @@ protected: static bool DefaultShouldStopHereCallback(ThreadPlan *current_plan, Flags &flags, lldb::FrameComparison operation, - void *baton); + Status &status, void *baton); static lldb::ThreadPlanSP DefaultStepFromHereCallback(ThreadPlan *current_plan, Flags &flags, - lldb::FrameComparison operation, void *baton); + lldb::FrameComparison operation, Status &status, + void *baton); virtual lldb::ThreadPlanSP - QueueStepOutFromHerePlan(Flags &flags, lldb::FrameComparison operation); + QueueStepOutFromHerePlan(Flags &flags, lldb::FrameComparison operation, + Status &status); // Implement this, and call it in the plan's constructor to set the default // flags. diff --git a/include/lldb/Target/ThreadPlanStepInRange.h b/include/lldb/Target/ThreadPlanStepInRange.h index c3116eac81b5..c13b3533af1c 100644 --- a/include/lldb/Target/ThreadPlanStepInRange.h +++ b/include/lldb/Target/ThreadPlanStepInRange.h @@ -10,10 +10,6 @@ #ifndef liblldb_ThreadPlanStepInRange_h_ #define liblldb_ThreadPlanStepInRange_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/Core/AddressRange.h" #include "lldb/Target/StackID.h" #include "lldb/Target/Thread.h" @@ -58,7 +54,7 @@ protected: static bool DefaultShouldStopHereCallback(ThreadPlan *current_plan, Flags &flags, lldb::FrameComparison operation, - void *baton); + Status &status, void *baton); bool DoWillResume(lldb::StateType resume_state, bool current_plan) override; @@ -80,11 +76,11 @@ private: friend lldb::ThreadPlanSP Thread::QueueThreadPlanForStepOverRange( bool abort_other_plans, const AddressRange &range, const SymbolContext &addr_context, lldb::RunMode stop_others, - LazyBool avoid_code_without_debug_info); + Status &status, LazyBool avoid_code_without_debug_info); friend lldb::ThreadPlanSP Thread::QueueThreadPlanForStepInRange( bool abort_other_plans, const AddressRange &range, const SymbolContext &addr_context, const char *step_in_target, - lldb::RunMode stop_others, + lldb::RunMode stop_others, Status &status, LazyBool step_in_avoids_code_without_debug_info, LazyBool step_out_avoids_code_without_debug_info); diff --git a/include/lldb/Target/ThreadPlanStepInstruction.h b/include/lldb/Target/ThreadPlanStepInstruction.h index 8b56e41ad64f..ea5d93fa4944 100644 --- a/include/lldb/Target/ThreadPlanStepInstruction.h +++ b/include/lldb/Target/ThreadPlanStepInstruction.h @@ -10,10 +10,6 @@ #ifndef liblldb_ThreadPlanStepInstruction_h_ #define liblldb_ThreadPlanStepInstruction_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/Target/Thread.h" #include "lldb/Target/ThreadPlan.h" #include "lldb/lldb-private.h" @@ -43,7 +39,8 @@ protected: private: friend lldb::ThreadPlanSP Thread::QueueThreadPlanForStepSingleInstruction( - bool step_over, bool abort_other_plans, bool stop_other_threads); + bool step_over, bool abort_other_plans, bool stop_other_threads, + Status &status); lldb::addr_t m_instruction_addr; bool m_stop_other_threads; diff --git a/include/lldb/Target/ThreadPlanStepOut.h b/include/lldb/Target/ThreadPlanStepOut.h index 285f4cab13a2..8ef9f95d4f96 100644 --- a/include/lldb/Target/ThreadPlanStepOut.h +++ b/include/lldb/Target/ThreadPlanStepOut.h @@ -10,10 +10,6 @@ #ifndef liblldb_ThreadPlanStepOut_h_ #define liblldb_ThreadPlanStepOut_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/Target/Thread.h" #include "lldb/Target/ThreadPlan.h" #include "lldb/Target/ThreadPlanShouldStopHere.h" @@ -74,13 +70,14 @@ private: // if ShouldStopHere told us // to. Function *m_immediate_step_from_function; + std::vector<lldb::StackFrameSP> m_stepped_past_frames; lldb::ValueObjectSP m_return_valobj_sp; bool m_calculate_return_value; friend lldb::ThreadPlanSP Thread::QueueThreadPlanForStepOut( bool abort_other_plans, SymbolContext *addr_context, bool first_insn, bool stop_others, Vote stop_vote, Vote run_vote, uint32_t frame_idx, - LazyBool step_out_avoids_code_without_debug_info); + Status &status, LazyBool step_out_avoids_code_without_debug_info); void SetupAvoidNoDebug(LazyBool step_out_avoids_code_without_debug_info); // Need an appropriate marker for the current stack so we can tell step out diff --git a/include/lldb/Target/ThreadPlanStepOverBreakpoint.h b/include/lldb/Target/ThreadPlanStepOverBreakpoint.h index e799ec5a44ff..7aaf56ed7c0b 100644 --- a/include/lldb/Target/ThreadPlanStepOverBreakpoint.h +++ b/include/lldb/Target/ThreadPlanStepOverBreakpoint.h @@ -10,10 +10,6 @@ #ifndef liblldb_ThreadPlanStepOverBreakpoint_h_ #define liblldb_ThreadPlanStepOverBreakpoint_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/Target/Thread.h" #include "lldb/Target/ThreadPlan.h" diff --git a/include/lldb/Target/ThreadPlanStepOverRange.h b/include/lldb/Target/ThreadPlanStepOverRange.h index 84fdb0ddcf99..2eeb2bb96022 100644 --- a/include/lldb/Target/ThreadPlanStepOverRange.h +++ b/include/lldb/Target/ThreadPlanStepOverRange.h @@ -10,10 +10,6 @@ #ifndef liblldb_ThreadPlanStepOverRange_h_ #define liblldb_ThreadPlanStepOverRange_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/Core/AddressRange.h" #include "lldb/Target/StackID.h" #include "lldb/Target/Thread.h" diff --git a/include/lldb/Target/ThreadPlanStepRange.h b/include/lldb/Target/ThreadPlanStepRange.h index 65bc1671cb1e..b3e267a0827b 100644 --- a/include/lldb/Target/ThreadPlanStepRange.h +++ b/include/lldb/Target/ThreadPlanStepRange.h @@ -10,10 +10,6 @@ #ifndef liblldb_ThreadPlanStepRange_h_ #define liblldb_ThreadPlanStepRange_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/Core/AddressRange.h" #include "lldb/Target/StackID.h" #include "lldb/Target/Thread.h" diff --git a/include/lldb/Target/ThreadPlanStepThrough.h b/include/lldb/Target/ThreadPlanStepThrough.h index 41aa7b21abe0..1bff541e7df6 100644 --- a/include/lldb/Target/ThreadPlanStepThrough.h +++ b/include/lldb/Target/ThreadPlanStepThrough.h @@ -10,10 +10,6 @@ #ifndef liblldb_ThreadPlanStepThrough_h_ #define liblldb_ThreadPlanStepThrough_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/Target/Thread.h" #include "lldb/Target/ThreadPlan.h" @@ -45,10 +41,9 @@ protected: private: friend lldb::ThreadPlanSP - Thread::QueueThreadPlanForStepThrough(StackID &return_stack_id, bool abort_other_plans, - bool stop_others); + bool stop_others, Status &status); void ClearBackstopBreakpoint(); diff --git a/include/lldb/Target/ThreadPlanStepUntil.h b/include/lldb/Target/ThreadPlanStepUntil.h index bdc630bcf8de..33ccc0fa0d54 100644 --- a/include/lldb/Target/ThreadPlanStepUntil.h +++ b/include/lldb/Target/ThreadPlanStepUntil.h @@ -10,10 +10,6 @@ #ifndef liblldb_ThreadPlanStepUntil_h_ #define liblldb_ThreadPlanStepUntil_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/Target/Thread.h" #include "lldb/Target/ThreadPlan.h" @@ -59,7 +55,7 @@ private: friend lldb::ThreadPlanSP Thread::QueueThreadPlanForStepUntil( bool abort_other_plans, lldb::addr_t *address_list, size_t num_addresses, - bool stop_others, uint32_t frame_idx); + bool stop_others, uint32_t frame_idx, Status &status); // Need an appropriate marker for the current stack so we can tell step out // from step in. diff --git a/include/lldb/Target/ThreadPlanTracer.h b/include/lldb/Target/ThreadPlanTracer.h index 65115383efaa..21f9023f8d57 100644 --- a/include/lldb/Target/ThreadPlanTracer.h +++ b/include/lldb/Target/ThreadPlanTracer.h @@ -11,13 +11,9 @@ #ifndef liblldb_ThreadPlanTracer_h_ #define liblldb_ThreadPlanTracer_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes -#include "lldb/Core/RegisterValue.h" #include "lldb/Symbol/TaggedASTType.h" #include "lldb/Target/Thread.h" +#include "lldb/Utility/RegisterValue.h" #include "lldb/lldb-private.h" namespace lldb_private { diff --git a/include/lldb/Target/UnixSignals.h b/include/lldb/Target/UnixSignals.h index 7ec683585f8e..8774139371f0 100644 --- a/include/lldb/Target/UnixSignals.h +++ b/include/lldb/Target/UnixSignals.h @@ -10,14 +10,10 @@ #ifndef lldb_UnixSignals_h_ #define lldb_UnixSignals_h_ -// C Includes -// C++ Includes #include <map> #include <string> #include <vector> -// Other libraries and framework includes -// Project includes #include "lldb/Utility/ConstString.h" #include "lldb/lldb-private.h" #include "llvm/ADT/Optional.h" diff --git a/include/lldb/Target/Unwind.h b/include/lldb/Target/Unwind.h index a50e8d4a7bdd..9e0da9ed553b 100644 --- a/include/lldb/Target/Unwind.h +++ b/include/lldb/Target/Unwind.h @@ -10,12 +10,8 @@ #ifndef liblldb_Unwind_h_ #define liblldb_Unwind_h_ -// C Includes -// C++ Includes #include <mutex> -// Other libraries and framework includes -// Project includes #include "lldb/lldb-private.h" namespace lldb_private { |