diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2020-01-23 21:36:25 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2020-01-23 21:36:25 +0000 |
commit | 9dba64be9536c28e4800e06512b7f29b43ade345 (patch) | |
tree | 7f0f30947225ecb30ab0fdae8059a936537b0dfe /contrib/llvm-project/lldb/include/lldb/Core | |
parent | 85868e8a1daeaae7a0e48effb2ea2310ae3b02c6 (diff) | |
parent | ead246455adf1a215ec2715dad6533073a6beb4e (diff) | |
download | src-9dba64be9536c28e4800e06512b7f29b43ade345.tar.gz src-9dba64be9536c28e4800e06512b7f29b43ade345.zip |
Merge ^/vendor/lldb/dist up to its last change, and resolve conflicts.
Notes
Notes:
svn path=/projects/clang1000-import/; revision=357058
Diffstat (limited to 'contrib/llvm-project/lldb/include/lldb/Core')
21 files changed, 258 insertions, 258 deletions
diff --git a/contrib/llvm-project/lldb/include/lldb/Core/Address.h b/contrib/llvm-project/lldb/include/lldb/Core/Address.h index 080c00e76328..07bb450d6092 100644 --- a/contrib/llvm-project/lldb/include/lldb/Core/Address.h +++ b/contrib/llvm-project/lldb/include/lldb/Core/Address.h @@ -338,6 +338,23 @@ public: bool ResolveAddressUsingFileSections(lldb::addr_t addr, const SectionList *sections); + /// Resolve this address to its containing function and optionally get + /// that function's address range. + /// + /// \param[out] sym_ctx + /// The symbol context describing the function in which this address lies + /// + /// \parm[out] addr_range_ptr + /// Pointer to the AddressRange to fill in with the function's address + /// range. Caller may pass null if they don't need the address range. + /// + /// \return + /// Returns \b false if the function/symbol could not be resolved + /// or if the address range was requested and could not be resolved; + /// returns \b true otherwise. + bool ResolveFunctionScope(lldb_private::SymbolContext &sym_ctx, + lldb_private::AddressRange *addr_range_ptr = nullptr); + /// Set the address to represent \a load_addr. /// /// The address will attempt to find a loaded section within \a target that diff --git a/contrib/llvm-project/lldb/include/lldb/Core/AddressResolverFileLine.h b/contrib/llvm-project/lldb/include/lldb/Core/AddressResolverFileLine.h index b98e7d4c6338..efbe3de1f294 100644 --- a/contrib/llvm-project/lldb/include/lldb/Core/AddressResolverFileLine.h +++ b/contrib/llvm-project/lldb/include/lldb/Core/AddressResolverFileLine.h @@ -34,8 +34,8 @@ public: ~AddressResolverFileLine() override; Searcher::CallbackReturn SearchCallback(SearchFilter &filter, - SymbolContext &context, Address *addr, - bool containing) override; + SymbolContext &context, + Address *addr) override; lldb::SearchDepth GetDepth() override; diff --git a/contrib/llvm-project/lldb/include/lldb/Core/AddressResolverName.h b/contrib/llvm-project/lldb/include/lldb/Core/AddressResolverName.h index ad14ef6daeb1..8a039f9e1d92 100644 --- a/contrib/llvm-project/lldb/include/lldb/Core/AddressResolverName.h +++ b/contrib/llvm-project/lldb/include/lldb/Core/AddressResolverName.h @@ -31,7 +31,7 @@ public: // Creates a function breakpoint by regular expression. Takes over control // of the lifespan of func_regex. - AddressResolverName(RegularExpression &func_regex); + AddressResolverName(RegularExpression func_regex); AddressResolverName(const char *class_name, const char *method, AddressResolver::MatchType type); @@ -39,8 +39,8 @@ public: ~AddressResolverName() override; Searcher::CallbackReturn SearchCallback(SearchFilter &filter, - SymbolContext &context, Address *addr, - bool containing) override; + SymbolContext &context, + Address *addr) override; lldb::SearchDepth GetDepth() override; diff --git a/contrib/llvm-project/lldb/include/lldb/Core/Debugger.h b/contrib/llvm-project/lldb/include/lldb/Core/Debugger.h index 8e608717a801..b2f696c22834 100644 --- a/contrib/llvm-project/lldb/include/lldb/Core/Debugger.h +++ b/contrib/llvm-project/lldb/include/lldb/Core/Debugger.h @@ -17,6 +17,7 @@ #include "lldb/Core/FormatEntity.h" #include "lldb/Core/IOHandler.h" #include "lldb/Core/SourceManager.h" +#include "lldb/Core/StreamFile.h" #include "lldb/Core/UserSettingsController.h" #include "lldb/Host/HostThread.h" #include "lldb/Host/Terminal.h" @@ -113,20 +114,29 @@ public: void SetAsyncExecution(bool async); - lldb::StreamFileSP GetInputFile() { return m_input_file_sp; } + lldb::FileSP GetInputFileSP() { return m_input_file_sp; } - lldb::StreamFileSP GetOutputFile() { return m_output_file_sp; } + lldb::StreamFileSP GetOutputStreamSP() { return m_output_stream_sp; } - lldb::StreamFileSP GetErrorFile() { return m_error_file_sp; } + lldb::StreamFileSP GetErrorStreamSP() { return m_error_stream_sp; } + + File &GetInputFile() { return *m_input_file_sp; } + + File &GetOutputFile() { return m_output_stream_sp->GetFile(); } + + File &GetErrorFile() { return m_error_stream_sp->GetFile(); } + + StreamFile &GetOutputStream() { return *m_output_stream_sp; } + + StreamFile &GetErrorStream() { return *m_error_stream_sp; } repro::DataRecorder *GetInputRecorder(); - void SetInputFileHandle(FILE *fh, bool tranfer_ownership, - repro::DataRecorder *recorder = nullptr); + void SetInputFile(lldb::FileSP file, repro::DataRecorder *recorder = nullptr); - void SetOutputFileHandle(FILE *fh, bool tranfer_ownership); + void SetOutputFile(lldb::FileSP file); - void SetErrorFileHandle(FILE *fh, bool tranfer_ownership); + void SetErrorFile(lldb::FileSP file); void SaveInputTerminalState(); @@ -174,7 +184,7 @@ public: // If any of the streams are not set, set them to the in/out/err stream of // the top most input reader to ensure they at least have something - void AdoptTopIOHandlerFilesIfInvalid(lldb::StreamFileSP &in, + void AdoptTopIOHandlerFilesIfInvalid(lldb::FileSP &in, lldb::StreamFileSP &out, lldb::StreamFileSP &err); @@ -311,7 +321,7 @@ public: // selected target, or if no target is present you want to prime the dummy // target with entities that will be copied over to new targets. Target *GetSelectedOrDummyTarget(bool prefer_dummy = false); - Target *GetDummyTarget(); + Target *GetDummyTarget() { return m_dummy_target_sp.get(); } lldb::BroadcasterManagerSP GetBroadcasterManager() { return m_broadcaster_manager_sp; @@ -345,9 +355,10 @@ protected: void HandleThreadEvent(const lldb::EventSP &event_sp); - size_t GetProcessSTDOUT(Process *process, Stream *stream); - - size_t GetProcessSTDERR(Process *process, Stream *stream); + // Ensures two threads don't attempt to flush process output in parallel. + std::mutex m_output_flush_mutex; + void FlushProcessOutput(Process &process, bool flush_stdout, + bool flush_stderr); SourceManager::SourceFileCache &GetSourceFileCache() { return m_source_file_cache; @@ -355,9 +366,10 @@ protected: void InstanceInitialize(); - lldb::StreamFileSP m_input_file_sp; - lldb::StreamFileSP m_output_file_sp; - lldb::StreamFileSP m_error_file_sp; + // these should never be NULL + lldb::FileSP m_input_file_sp; + lldb::StreamFileSP m_output_stream_sp; + lldb::StreamFileSP m_error_stream_sp; /// Used for shadowing the input file when capturing a reproducer. repro::DataRecorder *m_input_recorder; @@ -399,6 +411,7 @@ protected: Broadcaster m_sync_broadcaster; lldb::ListenerSP m_forward_listener_sp; llvm::once_flag m_clear_once; + lldb::TargetSP m_dummy_target_sp; // Events for m_sync_broadcaster enum { diff --git a/contrib/llvm-project/lldb/include/lldb/Core/FileLineResolver.h b/contrib/llvm-project/lldb/include/lldb/Core/FileLineResolver.h index 1967ed58cd3b..d6525b71bfdf 100644 --- a/contrib/llvm-project/lldb/include/lldb/Core/FileLineResolver.h +++ b/contrib/llvm-project/lldb/include/lldb/Core/FileLineResolver.h @@ -37,8 +37,8 @@ public: ~FileLineResolver() override; Searcher::CallbackReturn SearchCallback(SearchFilter &filter, - SymbolContext &context, Address *addr, - bool containing) override; + SymbolContext &context, + Address *addr) override; lldb::SearchDepth GetDepth() override; diff --git a/contrib/llvm-project/lldb/include/lldb/Core/FileSpecList.h b/contrib/llvm-project/lldb/include/lldb/Core/FileSpecList.h index 79623ef1fdca..8edc3280b01b 100644 --- a/contrib/llvm-project/lldb/include/lldb/Core/FileSpecList.h +++ b/contrib/llvm-project/lldb/include/lldb/Core/FileSpecList.h @@ -25,6 +25,9 @@ class Stream; /// A class that contains a mutable list of FileSpec objects. class FileSpecList { public: + typedef std::vector<FileSpec> collection; + typedef collection::const_iterator const_iterator; + /// Default constructor. /// /// Initialize this object with an empty file list. @@ -76,6 +79,15 @@ public: /// \b true if the file was appended, \b false otherwise. bool AppendIfUnique(const FileSpec &file); + /// Inserts a new FileSpec into the FileSpecList constructed in-place with + /// the given arguments. + /// + /// \param[in] args + /// Arguments to create the FileSpec + template <class... Args> void EmplaceBack(Args &&... args) { + m_files.emplace_back(std::forward<Args>(args)...); + } + /// Clears the file list. void Clear(); @@ -182,9 +194,10 @@ public: static size_t GetFilesMatchingPartialPath(const char *path, bool dir_okay, FileSpecList &matches); + const_iterator begin() const { return m_files.begin(); } + const_iterator end() const { return m_files.end(); } + protected: - typedef std::vector<FileSpec> - collection; ///< The collection type for the file list. collection m_files; ///< A collection of FileSpec objects. }; diff --git a/contrib/llvm-project/lldb/include/lldb/Core/FormatEntity.h b/contrib/llvm-project/lldb/include/lldb/Core/FormatEntity.h index 634d9df2ad83..ae6c402a45be 100644 --- a/contrib/llvm-project/lldb/include/lldb/Core/FormatEntity.h +++ b/contrib/llvm-project/lldb/include/lldb/Core/FormatEntity.h @@ -199,7 +199,7 @@ public: llvm::StringRef &variable_name, llvm::StringRef &variable_format); - static size_t AutoComplete(lldb_private::CompletionRequest &request); + static void AutoComplete(lldb_private::CompletionRequest &request); // Format the current elements into the stream \a s. // diff --git a/contrib/llvm-project/lldb/include/lldb/Core/IOHandler.h b/contrib/llvm-project/lldb/include/lldb/Core/IOHandler.h index b7180675cf4e..37142a5a8396 100644 --- a/contrib/llvm-project/lldb/include/lldb/Core/IOHandler.h +++ b/contrib/llvm-project/lldb/include/lldb/Core/IOHandler.h @@ -10,6 +10,7 @@ #define liblldb_IOHandler_h_ #include "lldb/Core/ValueObjectList.h" +#include "lldb/Utility/CompletionRequest.h" #include "lldb/Utility/ConstString.h" #include "lldb/Utility/Flags.h" #include "lldb/Utility/Predicate.h" @@ -57,8 +58,7 @@ public: IOHandler(Debugger &debugger, IOHandler::Type type); IOHandler(Debugger &debugger, IOHandler::Type type, - const lldb::StreamFileSP &input_sp, - const lldb::StreamFileSP &output_sp, + const lldb::FileSP &input_sp, const lldb::StreamFileSP &output_sp, const lldb::StreamFileSP &error_sp, uint32_t flags, repro::DataRecorder *data_recorder); @@ -122,11 +122,11 @@ public: FILE *GetErrorFILE(); - lldb::StreamFileSP &GetInputStreamFile(); + lldb::FileSP &GetInputFileSP(); - lldb::StreamFileSP &GetOutputStreamFile(); + lldb::StreamFileSP &GetOutputStreamFileSP(); - lldb::StreamFileSP &GetErrorStreamFile(); + lldb::StreamFileSP &GetErrorStreamFileSP(); Debugger &GetDebugger() { return m_debugger; } @@ -164,7 +164,7 @@ public: protected: Debugger &m_debugger; - lldb::StreamFileSP m_input_sp; + lldb::FileSP m_input_sp; lldb::StreamFileSP m_output_sp; lldb::StreamFileSP m_error_sp; repro::DataRecorder *m_data_recorder; @@ -198,10 +198,8 @@ public: virtual void IOHandlerDeactivated(IOHandler &io_handler) {} - virtual int IOHandlerComplete(IOHandler &io_handler, const char *current_line, - const char *cursor, const char *last_char, - int skip_first_n_matches, int max_matches, - StringList &matches, StringList &descriptions); + virtual void IOHandlerComplete(IOHandler &io_handler, + CompletionRequest &request); virtual const char *IOHandlerGetFixIndentationCharacters() { return nullptr; } @@ -334,7 +332,7 @@ public: repro::DataRecorder *data_recorder); IOHandlerEditline(Debugger &debugger, IOHandler::Type type, - const lldb::StreamFileSP &input_sp, + const lldb::FileSP &input_sp, const lldb::StreamFileSP &output_sp, const lldb::StreamFileSP &error_sp, uint32_t flags, const char *editline_name, // Used for saving history files @@ -350,7 +348,7 @@ public: const char *, bool, bool, uint32_t, IOHandlerDelegate &) = delete; - IOHandlerEditline(Debugger &, IOHandler::Type, const lldb::StreamFileSP &, + IOHandlerEditline(Debugger &, IOHandler::Type, const lldb::FileSP &, const lldb::StreamFileSP &, const lldb::StreamFileSP &, uint32_t, const char *, const char *, const char *, bool, bool, uint32_t, IOHandlerDelegate &) = delete; @@ -415,11 +413,7 @@ private: static int FixIndentationCallback(Editline *editline, const StringList &lines, int cursor_position, void *baton); - static int AutoCompleteCallback(const char *current_line, const char *cursor, - const char *last_char, - int skip_first_n_matches, int max_matches, - StringList &matches, StringList &descriptions, - void *baton); + static void AutoCompleteCallback(CompletionRequest &request, void *baton); #endif protected: @@ -437,6 +431,7 @@ protected: bool m_interrupt_exits; bool m_editing; // Set to true when fetching a line manually (not using // libedit) + std::string m_line_buffer; }; // The order of base classes is important. Look at the constructor of @@ -450,10 +445,8 @@ public: bool GetResponse() const { return m_user_response; } - int IOHandlerComplete(IOHandler &io_handler, const char *current_line, - const char *cursor, const char *last_char, - int skip_first_n_matches, int max_matches, - StringList &matches, StringList &descriptions) override; + void IOHandlerComplete(IOHandler &io_handler, + CompletionRequest &request) override; void IOHandlerInputComplete(IOHandler &io_handler, std::string &data) override; diff --git a/contrib/llvm-project/lldb/include/lldb/Core/LoadedModuleInfoList.h b/contrib/llvm-project/lldb/include/lldb/Core/LoadedModuleInfoList.h index f7f83604fc1a..04e58fcdf313 100644 --- a/contrib/llvm-project/lldb/include/lldb/Core/LoadedModuleInfoList.h +++ b/contrib/llvm-project/lldb/include/lldb/Core/LoadedModuleInfoList.h @@ -84,9 +84,6 @@ public: } bool operator==(LoadedModuleInfo const &rhs) const { - if (e_num != rhs.e_num) - return false; - for (size_t i = 0; i < e_num; ++i) { if (m_has[i] != rhs.m_has[i]) return false; diff --git a/contrib/llvm-project/lldb/include/lldb/Core/Mangled.h b/contrib/llvm-project/lldb/include/lldb/Core/Mangled.h index fb52afd6ed34..63fa0f618dae 100644 --- a/contrib/llvm-project/lldb/include/lldb/Core/Mangled.h +++ b/contrib/llvm-project/lldb/include/lldb/Core/Mangled.h @@ -49,21 +49,7 @@ public: /// Default constructor. /// /// Initialize with both mangled and demangled names empty. - Mangled(); - - /// Construct with name. - /// - /// Constructor with an optional string and a boolean indicating if it is - /// the mangled version. - /// - /// \param[in] name - /// The already const name to copy into this object. - /// - /// \param[in] is_mangled - /// If \b true then \a name is a mangled name, if \b false then - /// \a name is demangled. - Mangled(ConstString name, bool is_mangled); - Mangled(llvm::StringRef name, bool is_mangled); + Mangled() = default; /// Construct with name. /// @@ -76,12 +62,6 @@ public: explicit Mangled(llvm::StringRef name); - /// Destructor - /// - /// Releases its ref counts on the mangled and demangled strings that live - /// in the global string pool. - ~Mangled(); - /// Convert to pointer operator. /// /// This allows code to check a Mangled object to see if it contains a valid diff --git a/contrib/llvm-project/lldb/include/lldb/Core/Module.h b/contrib/llvm-project/lldb/include/lldb/Core/Module.h index 544895ea89e9..89b731427e3f 100644 --- a/contrib/llvm-project/lldb/include/lldb/Core/Module.h +++ b/contrib/llvm-project/lldb/include/lldb/Core/Module.h @@ -49,7 +49,6 @@ class Symbol; class SymbolContext; class SymbolContextList; class SymbolFile; -class SymbolVendor; class Symtab; class Target; class TypeList; @@ -67,8 +66,8 @@ class VariableList; /// accessors are called. For example the object file (ObjectFile) /// representation will only be parsed if the object file is requested using /// the Module::GetObjectFile() is called. The debug symbols will only be -/// parsed if the symbol vendor (SymbolVendor) is requested using the -/// Module::GetSymbolVendor() is called. +/// parsed if the symbol file (SymbolFile) is requested using the +/// Module::GetSymbolFile() method. /// /// The module will parse more detailed information as more queries are made. class Module : public std::enable_shared_from_this<Module>, @@ -247,13 +246,13 @@ public: ConstString name, lldb::SymbolType symbol_type = lldb::eSymbolTypeAny); - size_t FindSymbolsWithNameAndType(ConstString name, - lldb::SymbolType symbol_type, - SymbolContextList &sc_list); + void FindSymbolsWithNameAndType(ConstString name, + lldb::SymbolType symbol_type, + SymbolContextList &sc_list); - size_t FindSymbolsMatchingRegExAndType(const RegularExpression ®ex, - lldb::SymbolType symbol_type, - SymbolContextList &sc_list); + void FindSymbolsMatchingRegExAndType(const RegularExpression ®ex, + lldb::SymbolType symbol_type, + SymbolContextList &sc_list); /// Find a function symbols in the object file's symbol table. /// @@ -267,11 +266,8 @@ public: /// /// \param[out] sc_list /// A list to append any matching symbol contexts to. - /// - /// \return - /// The number of symbol contexts that were added to \a sc_list - size_t FindFunctionSymbols(ConstString name, uint32_t name_type_mask, - SymbolContextList &sc_list); + void FindFunctionSymbols(ConstString name, uint32_t name_type_mask, + SymbolContextList &sc_list); /// Find compile units by partial or full path. /// @@ -281,19 +277,10 @@ public: /// \param[in] path /// The name of the function we are looking for. /// - /// \param[in] append - /// If \b true, then append any compile units that were found - /// to \a sc_list. If \b false, then the \a sc_list is cleared - /// and the contents of \a sc_list are replaced. - /// /// \param[out] sc_list /// A symbol context list that gets filled in with all of the /// matches. - /// - /// \return - /// The number of matches added to \a sc_list. - size_t FindCompileUnits(const FileSpec &path, bool append, - SymbolContextList &sc_list); + void FindCompileUnits(const FileSpec &path, SymbolContextList &sc_list); /// Find functions by name. /// @@ -313,21 +300,13 @@ public: /// names, base names, C++ methods, or ObjC selectors. /// See FunctionNameType for more details. /// - /// \param[in] append - /// If \b true, any matches will be appended to \a sc_list, else - /// matches replace the contents of \a sc_list. - /// /// \param[out] sc_list /// A symbol context list that gets filled in with all of the /// matches. - /// - /// \return - /// The number of matches added to \a sc_list. - size_t FindFunctions(ConstString name, - const CompilerDeclContext *parent_decl_ctx, - lldb::FunctionNameType name_type_mask, bool symbols_ok, - bool inlines_ok, bool append, - SymbolContextList &sc_list); + void FindFunctions(ConstString name, + const CompilerDeclContext *parent_decl_ctx, + lldb::FunctionNameType name_type_mask, bool symbols_ok, + bool inlines_ok, SymbolContextList &sc_list); /// Find functions by name. /// @@ -345,12 +324,8 @@ public: /// \param[out] sc_list /// A symbol context list that gets filled in with all of the /// matches. - /// - /// \return - /// The number of matches added to \a sc_list. - size_t FindFunctions(const RegularExpression ®ex, bool symbols_ok, - bool inlines_ok, bool append, - SymbolContextList &sc_list); + void FindFunctions(const RegularExpression ®ex, bool symbols_ok, + bool inlines_ok, SymbolContextList &sc_list); /// Find addresses by file/line /// @@ -395,11 +370,9 @@ public: /// \param[in] variable_list /// A list of variables that gets the matches appended to. /// - /// \return - /// The number of matches added to \a variable_list. - size_t FindGlobalVariables(ConstString name, - const CompilerDeclContext *parent_decl_ctx, - size_t max_matches, VariableList &variable_list); + void FindGlobalVariables(ConstString name, + const CompilerDeclContext *parent_decl_ctx, + size_t max_matches, VariableList &variable_list); /// Find global and static variables by regular expression. /// @@ -413,17 +386,14 @@ public: /// \param[in] variable_list /// A list of variables that gets the matches appended to. /// - /// \return - /// The number of matches added to \a variable_list. - size_t FindGlobalVariables(const RegularExpression ®ex, size_t max_matches, - VariableList &variable_list); + void FindGlobalVariables(const RegularExpression ®ex, size_t max_matches, + VariableList &variable_list); /// Find types by name. /// - /// Type lookups in modules go through the SymbolVendor (which will use one - /// or more SymbolFile subclasses). The SymbolFile needs to be able to - /// lookup types by basename and not the fully qualified typename. This - /// allows the type accelerator tables to stay small, even with heavily + /// Type lookups in modules go through the SymbolFile. The SymbolFile needs to + /// be able to lookup types by basename and not the fully qualified typename. + /// This allows the type accelerator tables to stay small, even with heavily /// templatized C++. The type search will then narrow down the search /// results. If "exact_match" is true, then the type search will only match /// exact type name matches. If "exact_match" is false, the type will match @@ -449,13 +419,19 @@ public: /// \param[out] type_list /// A type list gets populated with any matches. /// - /// \return - /// The number of matches added to \a type_list. - size_t + void FindTypes(ConstString type_name, bool exact_match, size_t max_matches, llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files, TypeList &types); + /// Find types by name. + /// + /// This behaves like the other FindTypes method but allows to + /// specify a DeclContext and a language for the type being searched + /// for. + void FindTypes(llvm::ArrayRef<CompilerContext> pattern, LanguageSet languages, + TypeMap &types); + lldb::TypeSP FindFirstType(const SymbolContext &sc, ConstString type_name, bool exact_match); @@ -473,11 +449,9 @@ public: /// \param[out] type_list /// A type list gets populated with any matches. /// - /// \return - /// The number of matches added to \a type_list. - size_t FindTypesInNamespace(ConstString type_name, - const CompilerDeclContext *parent_decl_ctx, - size_t max_matches, TypeList &type_list); + void FindTypesInNamespace(ConstString type_name, + const CompilerDeclContext *parent_decl_ctx, + size_t max_matches, TypeList &type_list); /// Get const accessor for the module architecture. /// @@ -638,27 +612,19 @@ public: ObjectFile *GetMemoryObjectFile(const lldb::ProcessSP &process_sp, lldb::addr_t header_addr, Status &error, size_t size_to_read = 512); - /// Get the symbol vendor interface for the current architecture. - /// - /// If the symbol vendor file has not been located yet, this function will - /// find the best SymbolVendor plug-in that can use the current object file. - /// - /// \return - /// If this module does not have a valid object file, or no - /// plug-in can be found that can use the object file, nullptr will - /// be returned, else a valid symbol vendor plug-in interface - /// will be returned. The returned pointer is owned by this - /// object and remains valid as long as the object is around. - virtual SymbolVendor * - GetSymbolVendor(bool can_create = true, - lldb_private::Stream *feedback_strm = nullptr); - /// Get accessor the type list for this module. + /// Get the module's symbol file /// - /// \return - /// A valid type list pointer, or nullptr if there is no valid - /// symbol vendor for this module. - TypeList *GetTypeList(); + /// If the symbol file has already been loaded, this function returns it. All + /// arguments are ignored. If the symbol file has not been located yet, and + /// the can_create argument is false, the function returns nullptr. If + /// can_create is true, this function will find the best SymbolFile plug-in + /// that can use the current object file. feedback_strm, if not null, is used + /// to report the details of the search process. + virtual SymbolFile *GetSymbolFile(bool can_create = true, + Stream *feedback_strm = nullptr); + + Symtab *GetSymtab(); /// Get a reference to the UUID value contained in this object. /// @@ -819,7 +785,8 @@ public: bool GetIsDynamicLinkEditor(); - TypeSystem *GetTypeSystemForLanguage(lldb::LanguageType language); + llvm::Expected<TypeSystem &> + GetTypeSystemForLanguage(lldb::LanguageType language); // Special error functions that can do printf style formatting that will // prepend the message with something appropriate for this module (like the @@ -848,7 +815,7 @@ public: // when the module first gets created. bool FileHasChanged() const; - // SymbolVendor, SymbolFile and ObjectFile member objects should lock the + // SymbolFile and ObjectFile member objects should lock the // module mutex to avoid deadlocks. std::recursive_mutex &GetMutex() const { return m_mutex; } @@ -896,16 +863,19 @@ public: bool RemapSourceFile(llvm::StringRef path, std::string &new_path) const; bool RemapSourceFile(const char *, std::string &) const = delete; + /// Update the ArchSpec to a more specific variant. + bool MergeArchitecture(const ArchSpec &arch_spec); + /// \class LookupInfo Module.h "lldb/Core/Module.h" /// A class that encapsulates name lookup information. /// /// Users can type a wide variety of partial names when setting breakpoints - /// by name or when looking for functions by name. SymbolVendor and - /// SymbolFile objects are only required to implement name lookup for - /// function basenames and for fully mangled names. This means if the user - /// types in a partial name, we must reduce this to a name lookup that will - /// work with all SymbolFile objects. So we might reduce a name lookup to - /// look for a basename, and then prune out any results that don't match. + /// by name or when looking for functions by name. The SymbolFile object is + /// only required to implement name lookup for function basenames and for + /// fully mangled names. This means if the user types in a partial name, we + /// must reduce this to a name lookup that will work with all SymbolFile + /// objects. So we might reduce a name lookup to look for a basename, and then + /// prune out any results that don't match. /// /// The "m_name" member variable represents the name as it was typed by the /// user. "m_lookup_name" will be the name we actually search for through @@ -1012,7 +982,7 @@ protected: /// ObjectFile instances for the debug info std::atomic<bool> m_did_load_objfile{false}; - std::atomic<bool> m_did_load_symbol_vendor{false}; + std::atomic<bool> m_did_load_symfile{false}; std::atomic<bool> m_did_set_uuid{false}; mutable bool m_file_has_changed : 1, m_first_file_changed_log : 1; /// See if the module was modified after it @@ -1072,9 +1042,9 @@ protected: private: Module(); // Only used internally by CreateJITModule () - size_t FindTypes_Impl( + void FindTypes_Impl( ConstString name, const CompilerDeclContext *parent_decl_ctx, - bool append, size_t max_matches, + size_t max_matches, llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files, TypeMap &types); diff --git a/contrib/llvm-project/lldb/include/lldb/Core/ModuleList.h b/contrib/llvm-project/lldb/include/lldb/Core/ModuleList.h index 1e26c35e4c15..e21655551b61 100644 --- a/contrib/llvm-project/lldb/include/lldb/Core/ModuleList.h +++ b/contrib/llvm-project/lldb/include/lldb/Core/ModuleList.h @@ -247,35 +247,24 @@ public: /// \param[in] path /// The name of the compile unit we are looking for. /// - /// \param[in] append - /// If \b true, then append any compile units that were found - /// to \a sc_list. If \b false, then the \a sc_list is cleared - /// and the contents of \a sc_list are replaced. - /// /// \param[out] sc_list /// A symbol context list that gets filled in with all of the /// matches. - /// - /// \return - /// The number of matches added to \a sc_list. - size_t FindCompileUnits(const FileSpec &path, bool append, - SymbolContextList &sc_list) const; + void FindCompileUnits(const FileSpec &path, SymbolContextList &sc_list) const; /// \see Module::FindFunctions () - size_t FindFunctions(ConstString name, - lldb::FunctionNameType name_type_mask, - bool include_symbols, bool include_inlines, bool append, - SymbolContextList &sc_list) const; + void FindFunctions(ConstString name, lldb::FunctionNameType name_type_mask, + bool include_symbols, bool include_inlines, + SymbolContextList &sc_list) const; /// \see Module::FindFunctionSymbols () - size_t FindFunctionSymbols(ConstString name, - lldb::FunctionNameType name_type_mask, - SymbolContextList &sc_list); + void FindFunctionSymbols(ConstString name, + lldb::FunctionNameType name_type_mask, + SymbolContextList &sc_list); /// \see Module::FindFunctions () - size_t FindFunctions(const RegularExpression &name, bool include_symbols, - bool include_inlines, bool append, - SymbolContextList &sc_list); + void FindFunctions(const RegularExpression &name, bool include_symbols, + bool include_inlines, SymbolContextList &sc_list); /// Find global and static variables by name. /// @@ -289,11 +278,8 @@ public: /// /// \param[in] variable_list /// A list of variables that gets the matches appended to. - /// - /// \return - /// The number of matches added to \a variable_list. - size_t FindGlobalVariables(ConstString name, size_t max_matches, - VariableList &variable_list) const; + void FindGlobalVariables(ConstString name, size_t max_matches, + VariableList &variable_list) const; /// Find global and static variables by regular expression. /// @@ -306,11 +292,8 @@ public: /// /// \param[in] variable_list /// A list of variables that gets the matches appended to. - /// - /// \return - /// The number of matches added to \a variable_list. - size_t FindGlobalVariables(const RegularExpression ®ex, size_t max_matches, - VariableList &variable_list) const; + void FindGlobalVariables(const RegularExpression ®ex, size_t max_matches, + VariableList &variable_list) const; /// Finds the first module whose file specification matches \a file_spec. /// @@ -337,11 +320,8 @@ public: /// \param[out] matching_module_list /// A module list that gets filled in with any modules that /// match the search criteria. - /// - /// \return - /// The number of matching modules found by the search. - size_t FindModules(const ModuleSpec &module_spec, - ModuleList &matching_module_list) const; + void FindModules(const ModuleSpec &module_spec, + ModuleList &matching_module_list) const; lldb::ModuleSP FindModule(const Module *module_ptr) const; @@ -354,15 +334,13 @@ public: lldb::ModuleSP FindFirstModule(const ModuleSpec &module_spec) const; - size_t FindSymbolsWithNameAndType(ConstString name, - lldb::SymbolType symbol_type, - SymbolContextList &sc_list, - bool append = false) const; + void FindSymbolsWithNameAndType(ConstString name, + lldb::SymbolType symbol_type, + SymbolContextList &sc_list) const; - size_t FindSymbolsMatchingRegExAndType(const RegularExpression ®ex, - lldb::SymbolType symbol_type, - SymbolContextList &sc_list, - bool append = false) const; + void FindSymbolsMatchingRegExAndType(const RegularExpression ®ex, + lldb::SymbolType symbol_type, + SymbolContextList &sc_list) const; /// Find types by name. /// @@ -393,12 +371,10 @@ public: /// \param[out] type_list /// A type list gets populated with any matches. /// - /// \return - /// The number of matches added to \a type_list. - size_t FindTypes(Module *search_first, ConstString name, - bool name_is_fully_qualified, size_t max_matches, - llvm::DenseSet<SymbolFile *> &searched_symbol_files, - TypeList &types) const; + void FindTypes(Module *search_first, ConstString name, + bool name_is_fully_qualified, size_t max_matches, + llvm::DenseSet<SymbolFile *> &searched_symbol_files, + TypeList &types) const; bool FindSourceFile(const FileSpec &orig_spec, FileSpec &new_spec) const; @@ -476,6 +452,7 @@ public: /// \return /// The number of modules in the module list. size_t GetSize() const; + bool IsEmpty() const { return !GetSize(); } bool LoadScriptingResourcesInTarget(Target *target, std::list<Status> &errors, Stream *feedback_stream = nullptr, @@ -494,8 +471,8 @@ public: static bool RemoveSharedModule(lldb::ModuleSP &module_sp); - static size_t FindSharedModules(const ModuleSpec &module_spec, - ModuleList &matching_module_list); + static void FindSharedModules(const ModuleSpec &module_spec, + ModuleList &matching_module_list); static size_t RemoveOrphanSharedModules(bool mandatory); diff --git a/contrib/llvm-project/lldb/include/lldb/Core/ModuleSpec.h b/contrib/llvm-project/lldb/include/lldb/Core/ModuleSpec.h index ab0f4e9912a8..651d0dc869bc 100644 --- a/contrib/llvm-project/lldb/include/lldb/Core/ModuleSpec.h +++ b/contrib/llvm-project/lldb/include/lldb/Core/ModuleSpec.h @@ -380,8 +380,8 @@ public: return false; } - size_t FindMatchingModuleSpecs(const ModuleSpec &module_spec, - ModuleSpecList &matching_list) const { + void FindMatchingModuleSpecs(const ModuleSpec &module_spec, + ModuleSpecList &matching_list) const { std::lock_guard<std::recursive_mutex> guard(m_mutex); bool exact_arch_match = true; const size_t initial_match_count = matching_list.GetSize(); @@ -400,7 +400,6 @@ public: matching_list.Append(spec); } } - return matching_list.GetSize() - initial_match_count; } void Dump(Stream &strm) { diff --git a/contrib/llvm-project/lldb/include/lldb/Core/PluginManager.h b/contrib/llvm-project/lldb/include/lldb/Core/PluginManager.h index 1bac1e5df694..5b859752b3c7 100644 --- a/contrib/llvm-project/lldb/include/lldb/Core/PluginManager.h +++ b/contrib/llvm-project/lldb/include/lldb/Core/PluginManager.h @@ -10,6 +10,8 @@ #define liblldb_PluginManager_h_ #include "lldb/Core/Architecture.h" +#include "lldb/Symbol/TypeSystem.h" +#include "lldb/Utility/CompletionRequest.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/Status.h" #include "lldb/lldb-enumerations.h" @@ -228,8 +230,8 @@ public: static const char *GetPlatformPluginDescriptionAtIndex(uint32_t idx); - static size_t AutoCompletePlatformName(llvm::StringRef partial_name, - StringList &matches); + static void AutoCompletePlatformName(llvm::StringRef partial_name, + CompletionRequest &request); // Process static bool RegisterPlugin(ConstString name, const char *description, @@ -383,10 +385,10 @@ public: GetInstrumentationRuntimeCreateCallbackForPluginName(ConstString name); // TypeSystem - static bool RegisterPlugin( - ConstString name, const char *description, - TypeSystemCreateInstance create_callback, - TypeSystemEnumerateSupportedLanguages enumerate_languages_callback); + static bool RegisterPlugin(ConstString name, const char *description, + TypeSystemCreateInstance create_callback, + LanguageSet supported_languages_for_types, + LanguageSet supported_languages_for_expressions); static bool UnregisterPlugin(TypeSystemCreateInstance create_callback); @@ -396,18 +398,14 @@ public: static TypeSystemCreateInstance GetTypeSystemCreateCallbackForPluginName(ConstString name); - static TypeSystemEnumerateSupportedLanguages - GetTypeSystemEnumerateSupportedLanguagesCallbackAtIndex(uint32_t idx); + static LanguageSet GetAllTypeSystemSupportedLanguagesForTypes(); - static TypeSystemEnumerateSupportedLanguages - GetTypeSystemEnumerateSupportedLanguagesCallbackForPluginName( - ConstString name); + static LanguageSet GetAllTypeSystemSupportedLanguagesForExpressions(); // REPL - static bool - RegisterPlugin(ConstString name, const char *description, - REPLCreateInstance create_callback, - REPLEnumerateSupportedLanguages enumerate_languages_callback); + static bool RegisterPlugin(ConstString name, const char *description, + REPLCreateInstance create_callback, + LanguageSet supported_languages); static bool UnregisterPlugin(REPLCreateInstance create_callback); @@ -416,12 +414,7 @@ public: static REPLCreateInstance GetREPLCreateCallbackForPluginName(ConstString name); - static REPLEnumerateSupportedLanguages - GetREPLEnumerateSupportedLanguagesCallbackAtIndex(uint32_t idx); - - static REPLEnumerateSupportedLanguages - GetREPLSystemEnumerateSupportedLanguagesCallbackForPluginName( - ConstString name); + static LanguageSet GetREPLAllTypeSystemSupportedLanguages(); // Some plug-ins might register a DebuggerInitializeCallback callback when // registering the plug-in. After a new Debugger instance is created, this @@ -439,32 +432,28 @@ public: ConstString description, bool is_global_property); static lldb::OptionValuePropertiesSP - GetSettingForPlatformPlugin(Debugger &debugger, - ConstString setting_name); + GetSettingForPlatformPlugin(Debugger &debugger, ConstString setting_name); static bool CreateSettingForPlatformPlugin( Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, ConstString description, bool is_global_property); static lldb::OptionValuePropertiesSP - GetSettingForProcessPlugin(Debugger &debugger, - ConstString setting_name); + GetSettingForProcessPlugin(Debugger &debugger, ConstString setting_name); static bool CreateSettingForProcessPlugin( Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, ConstString description, bool is_global_property); static lldb::OptionValuePropertiesSP - GetSettingForSymbolFilePlugin(Debugger &debugger, - ConstString setting_name); + GetSettingForSymbolFilePlugin(Debugger &debugger, ConstString setting_name); static bool CreateSettingForSymbolFilePlugin( Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, ConstString description, bool is_global_property); static lldb::OptionValuePropertiesSP - GetSettingForJITLoaderPlugin(Debugger &debugger, - ConstString setting_name); + GetSettingForJITLoaderPlugin(Debugger &debugger, ConstString setting_name); static bool CreateSettingForJITLoaderPlugin( Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, diff --git a/contrib/llvm-project/lldb/include/lldb/Core/PropertiesBase.td b/contrib/llvm-project/lldb/include/lldb/Core/PropertiesBase.td new file mode 100644 index 000000000000..be97d44ae8e4 --- /dev/null +++ b/contrib/llvm-project/lldb/include/lldb/Core/PropertiesBase.td @@ -0,0 +1,49 @@ +// Base class for all options. +class Property<string name, string type> { + string Name = name; + string Type = type; + string Definition; +} + +// Sets the description for the property that should be displayed to the user. +class Desc<string description> { + string Description = description; +} + +// Marks the property as global. +class Global { + bit Global = 1; +} + +class DefaultTrue { + int DefaultUnsignedValue = 1; + bit HasDefaultUnsignedValue = 1; +} + +class DefaultFalse { + int DefaultUnsignedValue = 0; + bit HasDefaultUnsignedValue = 1; +} + +// Gives the property a default string value. +class DefaultStringValue<string value> { + string DefaultStringValue = value; + bit HasDefaultStringValue = 1; +} + +// Gives the property a default enum value. +class DefaultEnumValue<string value> { + string DefaultEnumValue = value; + bit HasDefaultEnumValue = 1; +} + +// Gives the property a default string value. +class DefaultUnsignedValue<int value> { + int DefaultUnsignedValue = value; + bit HasDefaultUnsignedValue = 1; +} + +// Gives the property enum values. +class EnumValues<string enum> { + string EnumValues = enum; +} diff --git a/contrib/llvm-project/lldb/include/lldb/Core/SearchFilter.h b/contrib/llvm-project/lldb/include/lldb/Core/SearchFilter.h index f38690c95f52..6823daf9e3ed 100644 --- a/contrib/llvm-project/lldb/include/lldb/Core/SearchFilter.h +++ b/contrib/llvm-project/lldb/include/lldb/Core/SearchFilter.h @@ -52,8 +52,8 @@ public: virtual ~Searcher(); virtual CallbackReturn SearchCallback(SearchFilter &filter, - SymbolContext &context, Address *addr, - bool complete) = 0; + SymbolContext &context, + Address *addr) = 0; virtual lldb::SearchDepth GetDepth() = 0; diff --git a/contrib/llvm-project/lldb/include/lldb/Core/Section.h b/contrib/llvm-project/lldb/include/lldb/Core/Section.h index 881d43702cee..509a0767be1d 100644 --- a/contrib/llvm-project/lldb/include/lldb/Core/Section.h +++ b/contrib/llvm-project/lldb/include/lldb/Core/Section.h @@ -43,9 +43,8 @@ public: const_iterator begin() { return m_sections.begin(); } const_iterator end() { return m_sections.end(); } - SectionList(); - - ~SectionList(); + /// Create an empty list. + SectionList() = default; SectionList &operator=(const SectionList &rhs); diff --git a/contrib/llvm-project/lldb/include/lldb/Core/StreamFile.h b/contrib/llvm-project/lldb/include/lldb/Core/StreamFile.h index 54aeab16b3f1..712b289aa8d9 100644 --- a/contrib/llvm-project/lldb/include/lldb/Core/StreamFile.h +++ b/contrib/llvm-project/lldb/include/lldb/Core/StreamFile.h @@ -30,23 +30,27 @@ public: StreamFile(const char *path); - StreamFile(const char *path, uint32_t options, + StreamFile(const char *path, File::OpenOptions options, uint32_t permissions = lldb::eFilePermissionsFileDefault); StreamFile(FILE *fh, bool transfer_ownership); + StreamFile(std::shared_ptr<File> file) : m_file_sp(file) { assert(file); }; + ~StreamFile() override; - File &GetFile() { return m_file; } + File &GetFile() { return *m_file_sp; } + + const File &GetFile() const { return *m_file_sp; } - const File &GetFile() const { return m_file; } + std::shared_ptr<File> GetFileSP() { return m_file_sp; } void Flush() override; protected: // Classes that inherit from StreamFile can see and modify these - File m_file; + std::shared_ptr<File> m_file_sp; // never NULL size_t WriteImpl(const void *s, size_t length) override; private: diff --git a/contrib/llvm-project/lldb/include/lldb/Core/StructuredDataImpl.h b/contrib/llvm-project/lldb/include/lldb/Core/StructuredDataImpl.h index 79a709af7ca3..c66e4736dc26 100644 --- a/contrib/llvm-project/lldb/include/lldb/Core/StructuredDataImpl.h +++ b/contrib/llvm-project/lldb/include/lldb/Core/StructuredDataImpl.h @@ -54,7 +54,8 @@ public: return error; } - m_data_sp->Dump(stream); + llvm::json::OStream s(stream.AsRawOstream()); + m_data_sp->Serialize(s); return error; } diff --git a/contrib/llvm-project/lldb/include/lldb/Core/Value.h b/contrib/llvm-project/lldb/include/lldb/Core/Value.h index b786e4866f6c..7b4cc3b71c28 100644 --- a/contrib/llvm-project/lldb/include/lldb/Core/Value.h +++ b/contrib/llvm-project/lldb/include/lldb/Core/Value.h @@ -210,7 +210,6 @@ public: uint64_t GetValueByteSize(Status *error_ptr, ExecutionContext *exe_ctx); Status GetValueAsData(ExecutionContext *exe_ctx, DataExtractor &data, - uint32_t data_offset, Module *module); // Can be nullptr static const char *GetValueTypeAsCString(ValueType context_type); diff --git a/contrib/llvm-project/lldb/include/lldb/Core/dwarf.h b/contrib/llvm-project/lldb/include/lldb/Core/dwarf.h index afe62e09fe16..832109e55c70 100644 --- a/contrib/llvm-project/lldb/include/lldb/Core/dwarf.h +++ b/contrib/llvm-project/lldb/include/lldb/Core/dwarf.h @@ -22,7 +22,7 @@ typedef uint32_t dw_uleb128_t; typedef int32_t dw_sleb128_t; typedef uint16_t dw_attr_t; typedef uint16_t dw_form_t; -typedef uint16_t dw_tag_t; +typedef llvm::dwarf::Tag dw_tag_t; typedef uint64_t dw_addr_t; // Dwarf address define that must be big enough for // any addresses in the compile units that get // parsed |