diff options
Diffstat (limited to 'include/lldb/Core')
25 files changed, 160 insertions, 153 deletions
diff --git a/include/lldb/Core/Communication.h b/include/lldb/Core/Communication.h index 9459573ca90e..57fa483bd3a3 100644 --- a/include/lldb/Core/Communication.h +++ b/include/lldb/Core/Communication.h @@ -33,7 +33,7 @@ namespace lldb_private { class ConstString; } namespace lldb_private { -class Error; +class Status; } namespace lldb_private { @@ -71,7 +71,7 @@ namespace lldb_private { /// reads data and caches any received bytes. To start the read thread /// clients call: /// -/// bool Communication::StartReadThread (Error *); +/// bool Communication::StartReadThread (Status *); /// /// If true is returned a read thread has been spawned that will /// continually execute a call to the pure virtual DoRead function: @@ -154,10 +154,10 @@ public: /// internal error object should be filled in with an /// appropriate value based on the result of this function. /// - /// @see Error& Communication::GetError (); + /// @see Status& Communication::GetError (); /// @see bool Connection::Connect (const char *url); //------------------------------------------------------------------ - lldb::ConnectionStatus Connect(const char *url, Error *error_ptr); + lldb::ConnectionStatus Connect(const char *url, Status *error_ptr); //------------------------------------------------------------------ /// Disconnect the communications connection if one is currently @@ -168,10 +168,10 @@ public: /// internal error object should be filled in with an /// appropriate value based on the result of this function. /// - /// @see Error& Communication::GetError (); + /// @see Status& Communication::GetError (); /// @see bool Connection::Disconnect (); //------------------------------------------------------------------ - lldb::ConnectionStatus Disconnect(Error *error_ptr = nullptr); + lldb::ConnectionStatus Disconnect(Status *error_ptr = nullptr); //------------------------------------------------------------------ /// Check if the connection is valid. @@ -217,7 +217,7 @@ public: /// @see size_t Connection::Read (void *, size_t); //------------------------------------------------------------------ size_t Read(void *dst, size_t dst_len, const Timeout<std::micro> &timeout, - lldb::ConnectionStatus &status, Error *error_ptr); + lldb::ConnectionStatus &status, Status *error_ptr); //------------------------------------------------------------------ /// The actual write function that attempts to write to the @@ -237,7 +237,7 @@ public: /// The number of bytes actually Written. //------------------------------------------------------------------ size_t Write(const void *src, size_t src_len, lldb::ConnectionStatus &status, - Error *error_ptr); + Status *error_ptr); //------------------------------------------------------------------ /// Sets the connection that it to be used by this class. @@ -280,7 +280,7 @@ public: /// @see void Communication::AppendBytesToCache (const uint8_t * bytes, size_t /// len, bool broadcast); //------------------------------------------------------------------ - virtual bool StartReadThread(Error *error_ptr = nullptr); + virtual bool StartReadThread(Status *error_ptr = nullptr); //------------------------------------------------------------------ /// Stops the read thread by cancelling it. @@ -289,9 +289,9 @@ public: /// \b True if the read thread was successfully canceled, \b /// false otherwise. //------------------------------------------------------------------ - virtual bool StopReadThread(Error *error_ptr = nullptr); + virtual bool StopReadThread(Status *error_ptr = nullptr); - virtual bool JoinReadThread(Error *error_ptr = nullptr); + virtual bool JoinReadThread(Status *error_ptr = nullptr); //------------------------------------------------------------------ /// Checks if there is a currently running read thread. /// @@ -361,7 +361,7 @@ protected: size_t ReadFromConnection(void *dst, size_t dst_len, const Timeout<std::micro> &timeout, - lldb::ConnectionStatus &status, Error *error_ptr); + lldb::ConnectionStatus &status, Status *error_ptr); //------------------------------------------------------------------ /// Append new bytes that get read from the read thread into the diff --git a/include/lldb/Core/Connection.h b/include/lldb/Core/Connection.h index 8d84377e3757..27757b2f77e7 100644 --- a/include/lldb/Core/Connection.h +++ b/include/lldb/Core/Connection.h @@ -22,7 +22,7 @@ #include <stddef.h> // for size_t namespace lldb_private { -class Error; +class Status; } namespace lldb_private { template <typename Ratio> class Timeout; @@ -75,10 +75,10 @@ public: /// internal error object should be filled in with an /// appropriate value based on the result of this function. /// - /// @see Error& Communication::GetError (); + /// @see Status& Communication::GetError (); //------------------------------------------------------------------ virtual lldb::ConnectionStatus Connect(llvm::StringRef url, - Error *error_ptr) = 0; + Status *error_ptr) = 0; //------------------------------------------------------------------ /// Disconnect the communications connection if one is currently @@ -94,9 +94,9 @@ public: /// internal error object should be filled in with an /// appropriate value based on the result of this function. /// - /// @see Error& Communication::GetError (); + /// @see Status& Communication::GetError (); //------------------------------------------------------------------ - virtual lldb::ConnectionStatus Disconnect(Error *error_ptr) = 0; + virtual lldb::ConnectionStatus Disconnect(Status *error_ptr) = 0; //------------------------------------------------------------------ /// Check if the connection is valid. @@ -137,7 +137,7 @@ public: //------------------------------------------------------------------ virtual size_t Read(void *dst, size_t dst_len, const Timeout<std::micro> &timeout, - lldb::ConnectionStatus &status, Error *error_ptr) = 0; + lldb::ConnectionStatus &status, Status *error_ptr) = 0; //------------------------------------------------------------------ /// The actual write function that attempts to write to the @@ -162,7 +162,7 @@ public: /// The number of bytes actually Written. //------------------------------------------------------------------ virtual size_t Write(const void *dst, size_t dst_len, - lldb::ConnectionStatus &status, Error *error_ptr) = 0; + lldb::ConnectionStatus &status, Status *error_ptr) = 0; //------------------------------------------------------------------ /// Returns a URI that describes this connection object diff --git a/include/lldb/Core/Debugger.h b/include/lldb/Core/Debugger.h index 56201273fdd2..cedf9ecdb120 100644 --- a/include/lldb/Core/Debugger.h +++ b/include/lldb/Core/Debugger.h @@ -30,8 +30,8 @@ #include "lldb/Target/Platform.h" #include "lldb/Target/TargetList.h" #include "lldb/Utility/ConstString.h" // for ConstString -#include "lldb/Utility/Error.h" // for Error #include "lldb/Utility/FileSpec.h" // for FileSpec +#include "lldb/Utility/Status.h" // for Status #include "lldb/Utility/UserID.h" #include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN #include "lldb/lldb-enumerations.h" // for ScriptLanguage, Langua... @@ -239,9 +239,9 @@ public: eStopDisassemblyTypeAlways }; - Error SetPropertyValue(const ExecutionContext *exe_ctx, - VarSetOperationType op, llvm::StringRef property_path, - llvm::StringRef value) override; + Status SetPropertyValue(const ExecutionContext *exe_ctx, + VarSetOperationType op, llvm::StringRef property_path, + llvm::StringRef value) override; bool GetAutoConfirm() const; @@ -306,7 +306,7 @@ public: const ConstString &GetInstanceName() { return m_instance_name; } - bool LoadPlugin(const FileSpec &spec, Error &error); + bool LoadPlugin(const FileSpec &spec, Status &error); void ExecuteIOHandlers(); @@ -318,7 +318,7 @@ public: bool IsHandlingEvents() const { return m_event_handler_thread.IsJoinable(); } - Error RunREPL(lldb::LanguageType language, const char *repl_options); + Status RunREPL(lldb::LanguageType language, const char *repl_options); // This is for use in the command interpreter, when you either want the // selected target, or if no target diff --git a/include/lldb/Core/FormatEntity.h b/include/lldb/Core/FormatEntity.h index 6705c155cefc..aa5ccb48e56a 100644 --- a/include/lldb/Core/FormatEntity.h +++ b/include/lldb/Core/FormatEntity.h @@ -10,8 +10,8 @@ #ifndef liblldb_FormatEntity_h_ #define liblldb_FormatEntity_h_ -#include "lldb/Utility/Error.h" -#include "lldb/Utility/FileSpec.h" // for FileSpec +#include "lldb/Utility/FileSpec.h" // for FileSpec +#include "lldb/Utility/Status.h" #include "lldb/lldb-enumerations.h" // for Format::eFormatDefault, Format #include "lldb/lldb-types.h" // for addr_t #include <algorithm> // for min @@ -205,11 +205,11 @@ public: const Address *addr, ValueObject *valobj, bool function_changed, bool initial_function); - static Error Parse(const llvm::StringRef &format, Entry &entry); + static Status Parse(const llvm::StringRef &format, Entry &entry); - static Error ExtractVariableInfo(llvm::StringRef &format_str, - llvm::StringRef &variable_name, - llvm::StringRef &variable_format); + static Status ExtractVariableInfo(llvm::StringRef &format_str, + llvm::StringRef &variable_name, + llvm::StringRef &variable_format); static size_t AutoComplete(llvm::StringRef s, int match_start_point, int max_return_elements, bool &word_complete, @@ -228,8 +228,8 @@ public: llvm::StringRef element_format); protected: - static Error ParseInternal(llvm::StringRef &format, Entry &parent_entry, - uint32_t depth); + static Status ParseInternal(llvm::StringRef &format, Entry &parent_entry, + uint32_t depth); }; } // namespace lldb_private diff --git a/include/lldb/Core/MappedHash.h b/include/lldb/Core/MappedHash.h index cab98ee5b302..18d383ed581c 100644 --- a/include/lldb/Core/MappedHash.h +++ b/include/lldb/Core/MappedHash.h @@ -326,7 +326,7 @@ public: 1u, // Bucket hash data collision, but key didn't match eResultEndOfHashData = 2u, // The chain of items for this hash data in // this bucket is terminated, search no more - eResultError = 3u // Error parsing the hash data, abort + eResultError = 3u // Status parsing the hash data, abort }; struct Pair { @@ -409,7 +409,7 @@ public: // searching return false; case eResultError: - // Error parsing the hash data, abort + // Status parsing the hash data, abort return false; } } diff --git a/include/lldb/Core/Module.h b/include/lldb/Core/Module.h index 33735bc99f60..2ffe57ad8a4d 100644 --- a/include/lldb/Core/Module.h +++ b/include/lldb/Core/Module.h @@ -17,8 +17,8 @@ #include "lldb/Symbol/TypeSystem.h" #include "lldb/Target/PathMappingList.h" #include "lldb/Utility/ConstString.h" // for ConstString -#include "lldb/Utility/Error.h" // for Error #include "lldb/Utility/FileSpec.h" +#include "lldb/Utility/Status.h" // for Status #include "lldb/Utility/UUID.h" #include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN #include "lldb/lldb-enumerations.h" // for LanguageType, SymbolType @@ -652,7 +652,7 @@ public: //------------------------------------------------------------------ bool IsLoadedInTarget(Target *target); - bool LoadScriptingResourceInTarget(Target *target, Error &error, + bool LoadScriptingResourceInTarget(Target *target, Status &error, Stream *feedback_stream = nullptr); //------------------------------------------------------------------ @@ -728,7 +728,7 @@ public: /// failed (see the `error` for more information in that case). //------------------------------------------------------------------ ObjectFile *GetMemoryObjectFile(const lldb::ProcessSP &process_sp, - lldb::addr_t header_addr, Error &error, + lldb::addr_t header_addr, Status &error, size_t size_to_read = 512); //------------------------------------------------------------------ /// Get the symbol vendor interface for the current architecture. @@ -1033,7 +1033,7 @@ public: /// /// @return //------------------------------------------------------------------ - Error LoadInMemory(Target &target, bool set_pc); + Status LoadInMemory(Target &target, bool set_pc); //---------------------------------------------------------------------- /// @class LookupInfo Module.h "lldb/Core/Module.h" diff --git a/include/lldb/Core/ModuleList.h b/include/lldb/Core/ModuleList.h index d82d1c0d48d8..4b637c9b0427 100644 --- a/include/lldb/Core/ModuleList.h +++ b/include/lldb/Core/ModuleList.h @@ -12,9 +12,9 @@ #include "lldb/Core/Address.h" // for Address #include "lldb/Core/ModuleSpec.h" // for ModuleSpec -#include "lldb/Utility/Error.h" // for Error #include "lldb/Utility/FileSpec.h" // for FileSpec #include "lldb/Utility/Iterable.h" +#include "lldb/Utility/Status.h" // for Status #include "lldb/lldb-enumerations.h" #include "lldb/lldb-forward.h" #include "lldb/lldb-types.h" @@ -530,18 +530,18 @@ public: //------------------------------------------------------------------ size_t GetSize() const; - bool LoadScriptingResourcesInTarget(Target *target, std::list<Error> &errors, + bool LoadScriptingResourcesInTarget(Target *target, std::list<Status> &errors, Stream *feedback_stream = nullptr, bool continue_on_error = true); static bool ModuleIsInCache(const Module *module_ptr); - static Error GetSharedModule(const ModuleSpec &module_spec, - lldb::ModuleSP &module_sp, - const FileSpecList *module_search_paths_ptr, - lldb::ModuleSP *old_module_sp_ptr, - bool *did_create_ptr, - bool always_create = false); + static Status GetSharedModule(const ModuleSpec &module_spec, + lldb::ModuleSP &module_sp, + const FileSpecList *module_search_paths_ptr, + lldb::ModuleSP *old_module_sp_ptr, + bool *did_create_ptr, + bool always_create = false); static bool RemoveSharedModule(lldb::ModuleSP &module_sp); diff --git a/include/lldb/Core/PluginManager.h b/include/lldb/Core/PluginManager.h index 645ab85eaa7e..d9851e5ecfc1 100644 --- a/include/lldb/Core/PluginManager.h +++ b/include/lldb/Core/PluginManager.h @@ -10,8 +10,8 @@ #ifndef liblldb_PluginManager_h_ #define liblldb_PluginManager_h_ -#include "lldb/Utility/Error.h" // for Error #include "lldb/Utility/FileSpec.h" +#include "lldb/Utility/Status.h" // for Status #include "lldb/lldb-enumerations.h" // for ScriptLanguage #include "lldb/lldb-forward.h" // for OptionValuePropertiesSP #include "lldb/lldb-private-interfaces.h" // for DebuggerInitializeCallback @@ -202,8 +202,8 @@ public: static ObjectFileCreateMemoryInstance GetObjectFileCreateMemoryCallbackForPluginName(const ConstString &name); - static Error SaveCore(const lldb::ProcessSP &process_sp, - const FileSpec &outfile); + static Status SaveCore(const lldb::ProcessSP &process_sp, + const FileSpec &outfile); //------------------------------------------------------------------ // ObjectContainer diff --git a/include/lldb/Core/RegisterValue.h b/include/lldb/Core/RegisterValue.h index 66c4689d702d..a45db00fb76e 100644 --- a/include/lldb/Core/RegisterValue.h +++ b/include/lldb/Core/RegisterValue.h @@ -12,7 +12,7 @@ #include "lldb/Core/Scalar.h" #include "lldb/Utility/Endian.h" -#include "lldb/Utility/Error.h" // for Error +#include "lldb/Utility/Status.h" // for Status #include "lldb/lldb-enumerations.h" // for ByteOrder, Format #include "lldb/lldb-types.h" // for offset_t @@ -105,11 +105,11 @@ public: // into "dst". uint32_t GetAsMemoryData(const RegisterInfo *reg_info, void *dst, uint32_t dst_len, lldb::ByteOrder dst_byte_order, - Error &error) const; + Status &error) const; uint32_t SetFromMemoryData(const RegisterInfo *reg_info, const void *src, uint32_t src_len, lldb::ByteOrder src_byte_order, - Error &error); + Status &error); bool GetScalarValue(Scalar &scalar) const; @@ -241,13 +241,13 @@ public: bool SignExtend(uint32_t sign_bitpos); - Error SetValueFromString(const RegisterInfo *reg_info, - llvm::StringRef value_str); - Error SetValueFromString(const RegisterInfo *reg_info, - const char *value_str) = delete; + Status SetValueFromString(const RegisterInfo *reg_info, + llvm::StringRef value_str); + Status SetValueFromString(const RegisterInfo *reg_info, + const char *value_str) = delete; - Error SetValueFromData(const RegisterInfo *reg_info, DataExtractor &data, - lldb::offset_t offset, bool partial_data_ok); + Status SetValueFromData(const RegisterInfo *reg_info, DataExtractor &data, + lldb::offset_t offset, bool partial_data_ok); // The default value of 0 for reg_name_right_align_at means no alignment at // all. diff --git a/include/lldb/Core/Scalar.h b/include/lldb/Core/Scalar.h index c534044af753..943398b88020 100644 --- a/include/lldb/Core/Scalar.h +++ b/include/lldb/Core/Scalar.h @@ -10,7 +10,7 @@ #ifndef liblldb_Scalar_h_ #define liblldb_Scalar_h_ -#include "lldb/Utility/Error.h" // for Error +#include "lldb/Utility/Status.h" // for Status #include "lldb/lldb-enumerations.h" // for Encoding, ByteOrder #include "lldb/lldb-private-types.h" // for type128 @@ -146,7 +146,7 @@ public: bool GetData(DataExtractor &data, size_t limit_byte_size = UINT32_MAX) const; size_t GetAsMemoryData(void *dst, size_t dst_len, - lldb::ByteOrder dst_byte_order, Error &error) const; + lldb::ByteOrder dst_byte_order, Status &error) const; bool IsZero() const; @@ -272,11 +272,11 @@ public: long double LongDouble(long double fail_value = 0.0) const; - Error SetValueFromCString(const char *s, lldb::Encoding encoding, - size_t byte_size); + Status SetValueFromCString(const char *s, lldb::Encoding encoding, + size_t byte_size); - Error SetValueFromData(DataExtractor &data, lldb::Encoding encoding, - size_t byte_size); + Status SetValueFromData(DataExtractor &data, lldb::Encoding encoding, + size_t byte_size); static bool UIntValueIsValidForSize(uint64_t uval64, size_t total_byte_size) { if (total_byte_size > 8) diff --git a/include/lldb/Core/SearchFilter.h b/include/lldb/Core/SearchFilter.h index 829305ff5dee..06fb94d8fbdf 100644 --- a/include/lldb/Core/SearchFilter.h +++ b/include/lldb/Core/SearchFilter.h @@ -28,7 +28,7 @@ namespace lldb_private { class CompileUnit; } namespace lldb_private { -class Error; +class Status; } namespace lldb_private { class Function; @@ -250,7 +250,7 @@ public: static lldb::SearchFilterSP CreateFromStructuredData(Target &target, const StructuredData::Dictionary &data_dict, - Error &error); + Status &error); virtual StructuredData::ObjectSP SerializeToStructuredData() { return StructuredData::ObjectSP(); @@ -285,7 +285,7 @@ public: static const char *FilterTyToName(enum FilterTy); - static FilterTy NameToFilterTy(const char *name); + static FilterTy NameToFilterTy(llvm::StringRef name); protected: // Serialization of SearchFilter options: @@ -351,7 +351,7 @@ public: static lldb::SearchFilterSP CreateFromStructuredData(Target &target, const StructuredData::Dictionary &data_dict, - Error &error); + Status &error); StructuredData::ObjectSP SerializeToStructuredData() override; @@ -405,7 +405,7 @@ public: static lldb::SearchFilterSP CreateFromStructuredData(Target &target, const StructuredData::Dictionary &data_dict, - Error &error); + Status &error); StructuredData::ObjectSP SerializeToStructuredData() override; @@ -462,7 +462,7 @@ public: static lldb::SearchFilterSP CreateFromStructuredData(Target &target, const StructuredData::Dictionary &data_dict, - Error &error); + Status &error); StructuredData::ObjectSP SerializeToStructuredData() override; @@ -515,7 +515,7 @@ public: static lldb::SearchFilterSP CreateFromStructuredData(Target &target, const StructuredData::Dictionary &data_dict, - Error &error); + Status &error); StructuredData::ObjectSP SerializeToStructuredData() override; diff --git a/include/lldb/Core/StructuredData.h b/include/lldb/Core/StructuredData.h index eecfd86f7988..6cb78dc48ab5 100644 --- a/include/lldb/Core/StructuredData.h +++ b/include/lldb/Core/StructuredData.h @@ -28,7 +28,7 @@ #include <stdint.h> // for uint64_t namespace lldb_private { -class Error; +class Status; } namespace lldb_private { class Stream; @@ -143,15 +143,12 @@ public: : nullptr); } - std::string GetStringValue(const char *fail_value = nullptr) { + llvm::StringRef GetStringValue(const char *fail_value = nullptr) { String *s = GetAsString(); if (s) return s->GetValue(); - if (fail_value && fail_value[0]) - return std::string(fail_value); - - return std::string(); + return fail_value; } Generic *GetAsGeneric() { @@ -220,7 +217,7 @@ public: return success; } - bool GetItemAtIndexAsString(size_t idx, std::string &result) const { + bool GetItemAtIndexAsString(size_t idx, llvm::StringRef &result) const { ObjectSP value_sp = GetItemAtIndex(idx); if (value_sp.get()) { if (auto string_value = value_sp->GetAsString()) { @@ -231,8 +228,8 @@ public: return false; } - bool GetItemAtIndexAsString(size_t idx, std::string &result, - const std::string &default_val) const { + bool GetItemAtIndexAsString(size_t idx, llvm::StringRef &result, + llvm::StringRef default_val) const { bool success = GetItemAtIndexAsString(idx, result); if (!success) result = default_val; @@ -339,18 +336,13 @@ public: class String : public Object { public: - String(const char *cstr = nullptr) : Object(Type::eTypeString), m_value() { - if (cstr) - m_value = cstr; - } - - String(const std::string &s) : Object(Type::eTypeString), m_value(s) {} - - String(const std::string &&s) : Object(Type::eTypeString), m_value(s) {} + String() : Object(Type::eTypeString) {} + explicit String(llvm::StringRef S) + : Object(Type::eTypeString), m_value(S) {} - void SetValue(const std::string &string) { m_value = string; } + void SetValue(llvm::StringRef S) { m_value = S; } - const std::string &GetValue() { return m_value; } + llvm::StringRef GetValue() { return m_value; } void Dump(Stream &s, bool pretty_print = true) const override; @@ -430,7 +422,7 @@ public: } bool GetValueForKeyAsString(llvm::StringRef key, - std::string &result) const { + llvm::StringRef &result) const { ObjectSP value_sp = GetValueForKey(key); if (value_sp.get()) { if (auto string_value = value_sp->GetAsString()) { @@ -441,14 +433,14 @@ public: return false; } - bool GetValueForKeyAsString(llvm::StringRef key, std::string &result, + bool GetValueForKeyAsString(llvm::StringRef key, llvm::StringRef &result, const char *default_val) const { bool success = GetValueForKeyAsString(key, result); if (!success) { if (default_val) result = default_val; else - result.clear(); + result = llvm::StringRef(); } return success; } @@ -513,7 +505,7 @@ public: AddItem(key, std::make_shared<Float>(value)); } - void AddStringItem(llvm::StringRef key, std::string value) { + void AddStringItem(llvm::StringRef key, llvm::StringRef value) { AddItem(key, std::make_shared<String>(std::move(value))); } @@ -558,7 +550,7 @@ public: static ObjectSP ParseJSON(std::string json_text); - static ObjectSP ParseJSONFromFile(const FileSpec &file, Error &error); + static ObjectSP ParseJSONFromFile(const FileSpec &file, Status &error); }; } // namespace lldb_private diff --git a/include/lldb/Core/StructuredDataImpl.h b/include/lldb/Core/StructuredDataImpl.h index 94f9cce52548..81d59f83ac3d 100644 --- a/include/lldb/Core/StructuredDataImpl.h +++ b/include/lldb/Core/StructuredDataImpl.h @@ -12,9 +12,9 @@ #include "lldb/Core/Event.h" #include "lldb/Core/StructuredData.h" -#include "lldb/Utility/Error.h" -#include "lldb/Utility/Stream.h" #include "lldb/Target/StructuredDataPlugin.h" +#include "lldb/Utility/Status.h" +#include "lldb/Utility/Stream.h" #include "lldb/lldb-forward.h" #pragma mark-- @@ -45,8 +45,8 @@ public: m_data_sp.reset(); } - Error GetAsJSON(Stream &stream) const { - Error error; + Status GetAsJSON(Stream &stream) const { + Status error; if (!m_data_sp) { error.SetErrorString("No structured data."); @@ -57,8 +57,8 @@ public: return error; } - Error GetDescription(Stream &stream) const { - Error error; + Status GetDescription(Stream &stream) const { + Status error; if (!m_data_sp) { error.SetErrorString("Cannot pretty print structured data: " diff --git a/include/lldb/Core/Timer.h b/include/lldb/Core/Timer.h index 6da00b0e27a4..55aab193032e 100644 --- a/include/lldb/Core/Timer.h +++ b/include/lldb/Core/Timer.h @@ -37,10 +37,23 @@ namespace lldb_private { class Timer { public: + class Category { + public: + explicit Category(const char *category_name); + + private: + friend class Timer; + const char *m_name; + std::atomic<uint64_t> m_nanos; + std::atomic<Category *> m_next; + + DISALLOW_COPY_AND_ASSIGN(Category); + }; + //-------------------------------------------------------------- /// Default constructor. //-------------------------------------------------------------- - Timer(const char *category, const char *format, ...) + Timer(Category &category, const char *format, ...) __attribute__((format(printf, 3, 4))); //-------------------------------------------------------------- @@ -62,7 +75,7 @@ protected: using TimePoint = std::chrono::steady_clock::time_point; void ChildDuration(TimePoint::duration dur) { m_child_duration += dur; } - const char *m_category; + Category &m_category; TimePoint m_total_start; TimePoint::duration m_child_duration{0}; diff --git a/include/lldb/Core/UserSettingsController.h b/include/lldb/Core/UserSettingsController.h index 0207187f0718..67bc9b2c0713 100644 --- a/include/lldb/Core/UserSettingsController.h +++ b/include/lldb/Core/UserSettingsController.h @@ -10,7 +10,7 @@ #ifndef liblldb_UserSettingsController_h_ #define liblldb_UserSettingsController_h_ -#include "lldb/Utility/Error.h" // for Error +#include "lldb/Utility/Status.h" // for Status #include "lldb/lldb-forward.h" // for OptionValuePropertiesSP #include "lldb/lldb-private-enumerations.h" // for VarSetOperationType @@ -57,15 +57,16 @@ public: virtual lldb::OptionValueSP GetPropertyValue(const ExecutionContext *exe_ctx, llvm::StringRef property_path, bool will_modify, - Error &error) const; + Status &error) const; - virtual Error SetPropertyValue(const ExecutionContext *exe_ctx, - VarSetOperationType op, - llvm::StringRef property_path, llvm::StringRef value); + virtual Status SetPropertyValue(const ExecutionContext *exe_ctx, + VarSetOperationType op, + llvm::StringRef property_path, + llvm::StringRef value); - virtual Error DumpPropertyValue(const ExecutionContext *exe_ctx, Stream &strm, - llvm::StringRef property_path, - uint32_t dump_mask); + virtual Status DumpPropertyValue(const ExecutionContext *exe_ctx, + Stream &strm, llvm::StringRef property_path, + uint32_t dump_mask); virtual void DumpAllPropertyValues(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask); diff --git a/include/lldb/Core/Value.h b/include/lldb/Core/Value.h index 9a667cf65752..678b56fc49f5 100644 --- a/include/lldb/Core/Value.h +++ b/include/lldb/Core/Value.h @@ -13,7 +13,7 @@ #include "lldb/Core/Scalar.h" #include "lldb/Symbol/CompilerType.h" #include "lldb/Utility/DataBufferHeap.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/lldb-enumerations.h" // for ByteOrder, ByteOrder::eB... #include "lldb/lldb-private-enumerations.h" // for AddressType #include "lldb/lldb-private-types.h" // for type128, RegisterInfo @@ -219,11 +219,11 @@ public: lldb::Format GetValueDefaultFormat(); - uint64_t GetValueByteSize(Error *error_ptr, ExecutionContext *exe_ctx); + uint64_t GetValueByteSize(Status *error_ptr, ExecutionContext *exe_ctx); - Error GetValueAsData(ExecutionContext *exe_ctx, DataExtractor &data, - uint32_t data_offset, - Module *module); // Can be nullptr + 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/include/lldb/Core/ValueObject.h b/include/lldb/Core/ValueObject.h index 0898754b211a..fa1d14870b05 100644 --- a/include/lldb/Core/ValueObject.h +++ b/include/lldb/Core/ValueObject.h @@ -18,8 +18,8 @@ #include "lldb/Target/Process.h" #include "lldb/Utility/ConstString.h" #include "lldb/Utility/DataExtractor.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/SharedCluster.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/UserID.h" #include "lldb/lldb-defines.h" // for LLDB_INVALID... #include "lldb/lldb-enumerations.h" // for DynamicValue... @@ -462,7 +462,7 @@ public: virtual int64_t GetValueAsSigned(int64_t fail_value, bool *success = nullptr); - virtual bool SetValueFromCString(const char *value_str, Error &error); + virtual bool SetValueFromCString(const char *value_str, Status &error); // Return the module associated with this value object in case the // value is from an executable file and might have its data in @@ -482,7 +482,7 @@ public: //------------------------------------------------------------------ // The functions below should NOT be modified by subclasses //------------------------------------------------------------------ - const Error &GetError(); + const Status &GetError(); const ConstString &GetName() const; @@ -520,7 +520,7 @@ public: // return 'false' whenever you set the error, otherwise // callers may assume true means everything is OK - this will // break breakpoint conditions among potentially a few others - virtual bool IsLogicalTrue(Error &error); + virtual bool IsLogicalTrue(Status &error); virtual const char *GetLocationAsCString(); @@ -620,7 +620,7 @@ public: virtual lldb::ValueObjectSP CreateConstantValue(const ConstString &name); - virtual lldb::ValueObjectSP Dereference(Error &error); + virtual lldb::ValueObjectSP Dereference(Status &error); // Creates a copy of the ValueObject with a new name and setting the current // ValueObject as its parent. It should be used when we want to change the @@ -628,7 +628,7 @@ public: // (e.g. sythetic child provider). virtual lldb::ValueObjectSP Clone(const ConstString &new_name); - virtual lldb::ValueObjectSP AddressOf(Error &error); + virtual lldb::ValueObjectSP AddressOf(Status &error); virtual lldb::addr_t GetLiveAddress() { return LLDB_INVALID_ADDRESS; } @@ -700,16 +700,16 @@ public: bool IsCStringContainer(bool check_pointer = false); std::pair<size_t, bool> - ReadPointedString(lldb::DataBufferSP &buffer_sp, Error &error, + ReadPointedString(lldb::DataBufferSP &buffer_sp, Status &error, uint32_t max_length = 0, bool honor_array = true, lldb::Format item_format = lldb::eFormatCharArray); virtual size_t GetPointeeData(DataExtractor &data, uint32_t item_idx = 0, uint32_t item_count = 1); - virtual uint64_t GetData(DataExtractor &data, Error &error); + virtual uint64_t GetData(DataExtractor &data, Status &error); - virtual bool SetData(DataExtractor &data, Error &error); + virtual bool SetData(DataExtractor &data, Status &error); virtual bool GetIsConstant() const { return m_update_point.IsConstant(); } @@ -880,8 +880,9 @@ protected: DataExtractor m_data; // A data extractor that can be used to extract the value. Value m_value; - Error m_error; // An error object that can describe any errors that occur when - // updating values. + Status + m_error; // An error object that can describe any errors that occur when + // updating values. std::string m_value_str; // Cached value string that will get cleared if/when // the value is updated. std::string m_old_value_str; // Cached old value string from the last time the diff --git a/include/lldb/Core/ValueObjectConstResult.h b/include/lldb/Core/ValueObjectConstResult.h index 403d19324c46..1f56129df24a 100644 --- a/include/lldb/Core/ValueObjectConstResult.h +++ b/include/lldb/Core/ValueObjectConstResult.h @@ -15,7 +15,7 @@ #include "lldb/Core/ValueObjectConstResultImpl.h" #include "lldb/Symbol/CompilerType.h" // for CompilerType #include "lldb/Utility/ConstString.h" // for ConstString -#include "lldb/Utility/Error.h" // for Error +#include "lldb/Utility/Status.h" // for Status #include "lldb/lldb-defines.h" // for LLDB_INVALID_ADDRESS #include "lldb/lldb-enumerations.h" // for ByteOrder, Dynamic... #include "lldb/lldb-forward.h" // for ValueObjectSP, Dat... @@ -69,7 +69,7 @@ public: // When an expression fails to evaluate, we return an error static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope, - const Error &error); + const Status &error); uint64_t GetByteSize() override; @@ -85,7 +85,7 @@ public: void SetByteSize(size_t size); - lldb::ValueObjectSP Dereference(Error &error) override; + lldb::ValueObjectSP Dereference(Status &error) override; ValueObject *CreateChildAtIndex(size_t idx, bool synthetic_array_member, int32_t synthetic_index) override; @@ -94,7 +94,7 @@ public: uint32_t offset, const CompilerType &type, bool can_create, ConstString name_const_str = ConstString()) override; - lldb::ValueObjectSP AddressOf(Error &error) override; + lldb::ValueObjectSP AddressOf(Status &error) override; lldb::addr_t GetAddressOf(bool scalar_is_load_address = true, AddressType *address_type = nullptr) override; @@ -153,7 +153,7 @@ private: ValueObjectConstResult(ExecutionContextScope *exe_scope, const Value &value, const ConstString &name, Module *module = nullptr); - ValueObjectConstResult(ExecutionContextScope *exe_scope, const Error &error); + ValueObjectConstResult(ExecutionContextScope *exe_scope, const Status &error); DISALLOW_COPY_AND_ASSIGN(ValueObjectConstResult); }; diff --git a/include/lldb/Core/ValueObjectConstResultCast.h b/include/lldb/Core/ValueObjectConstResultCast.h index 3443bfb4885b..442cce420855 100644 --- a/include/lldb/Core/ValueObjectConstResultCast.h +++ b/include/lldb/Core/ValueObjectConstResultCast.h @@ -25,7 +25,7 @@ namespace lldb_private { class DataExtractor; } namespace lldb_private { -class Error; +class Status; } namespace lldb_private { class ValueObject; @@ -41,7 +41,7 @@ public: ~ValueObjectConstResultCast() override; - lldb::ValueObjectSP Dereference(Error &error) override; + lldb::ValueObjectSP Dereference(Status &error) override; ValueObject *CreateChildAtIndex(size_t idx, bool synthetic_array_member, int32_t synthetic_index) override; @@ -54,7 +54,7 @@ public: uint32_t offset, const CompilerType &type, bool can_create, ConstString name_const_str = ConstString()) override; - lldb::ValueObjectSP AddressOf(Error &error) override; + lldb::ValueObjectSP AddressOf(Status &error) override; size_t GetPointeeData(DataExtractor &data, uint32_t item_idx = 0, uint32_t item_count = 1) override; diff --git a/include/lldb/Core/ValueObjectConstResultChild.h b/include/lldb/Core/ValueObjectConstResultChild.h index 3da59dc2eb56..a74da0013aba 100644 --- a/include/lldb/Core/ValueObjectConstResultChild.h +++ b/include/lldb/Core/ValueObjectConstResultChild.h @@ -24,7 +24,7 @@ namespace lldb_private { class DataExtractor; } namespace lldb_private { -class Error; +class Status; } namespace lldb_private { class ValueObject; @@ -48,7 +48,7 @@ public: ~ValueObjectConstResultChild() override; - lldb::ValueObjectSP Dereference(Error &error) override; + lldb::ValueObjectSP Dereference(Status &error) override; ValueObject *CreateChildAtIndex(size_t idx, bool synthetic_array_member, int32_t synthetic_index) override; @@ -61,7 +61,7 @@ public: uint32_t offset, const CompilerType &type, bool can_create, ConstString name_const_str = ConstString()) override; - lldb::ValueObjectSP AddressOf(Error &error) override; + lldb::ValueObjectSP AddressOf(Status &error) override; size_t GetPointeeData(DataExtractor &data, uint32_t item_idx = 0, uint32_t item_count = 1) override; diff --git a/include/lldb/Core/ValueObjectConstResultImpl.h b/include/lldb/Core/ValueObjectConstResultImpl.h index 2586aab4c781..d86f25e30579 100644 --- a/include/lldb/Core/ValueObjectConstResultImpl.h +++ b/include/lldb/Core/ValueObjectConstResultImpl.h @@ -25,7 +25,7 @@ namespace lldb_private { class DataExtractor; } namespace lldb_private { -class Error; +class Status; } namespace lldb_private { class ValueObject; @@ -45,7 +45,7 @@ public: virtual ~ValueObjectConstResultImpl() = default; - lldb::ValueObjectSP Dereference(Error &error); + lldb::ValueObjectSP Dereference(Status &error); ValueObject *CreateChildAtIndex(size_t idx, bool synthetic_array_member, int32_t synthetic_index); @@ -55,7 +55,7 @@ public: bool can_create, ConstString name_const_str = ConstString()); - lldb::ValueObjectSP AddressOf(Error &error); + lldb::ValueObjectSP AddressOf(Status &error); lldb::addr_t GetLiveAddress() { return m_live_address; } diff --git a/include/lldb/Core/ValueObjectDynamicValue.h b/include/lldb/Core/ValueObjectDynamicValue.h index 99eb1ebcf977..018ee2c764bf 100644 --- a/include/lldb/Core/ValueObjectDynamicValue.h +++ b/include/lldb/Core/ValueObjectDynamicValue.h @@ -32,7 +32,7 @@ namespace lldb_private { class Declaration; } namespace lldb_private { -class Error; +class Status; } namespace lldb_private { @@ -86,9 +86,9 @@ public: m_owning_valobj_sp = owning_sp; } - bool SetValueFromCString(const char *value_str, Error &error) override; + bool SetValueFromCString(const char *value_str, Status &error) override; - bool SetData(DataExtractor &data, Error &error) override; + bool SetData(DataExtractor &data, Status &error) override; TypeImpl GetTypeImpl() override; diff --git a/include/lldb/Core/ValueObjectRegister.h b/include/lldb/Core/ValueObjectRegister.h index 50d0e12bb3f4..2aaef9bee99e 100644 --- a/include/lldb/Core/ValueObjectRegister.h +++ b/include/lldb/Core/ValueObjectRegister.h @@ -26,7 +26,7 @@ namespace lldb_private { class DataExtractor; } namespace lldb_private { -class Error; +class Status; } namespace lldb_private { class ExecutionContextScope; @@ -148,9 +148,9 @@ public: size_t CalculateNumChildren(uint32_t max) override; - bool SetValueFromCString(const char *value_str, Error &error) override; + bool SetValueFromCString(const char *value_str, Status &error) override; - bool SetData(DataExtractor &data, Error &error) override; + bool SetData(DataExtractor &data, Status &error) override; bool ResolveValue(Scalar &scalar) override; diff --git a/include/lldb/Core/ValueObjectSyntheticFilter.h b/include/lldb/Core/ValueObjectSyntheticFilter.h index d83f038744e5..e32e14030418 100644 --- a/include/lldb/Core/ValueObjectSyntheticFilter.h +++ b/include/lldb/Core/ValueObjectSyntheticFilter.h @@ -29,7 +29,7 @@ namespace lldb_private { class Declaration; } namespace lldb_private { -class Error; +class Status; } namespace lldb_private { class SyntheticChildrenFrontEnd; @@ -110,7 +110,7 @@ public: bool GetIsConstant() const override { return false; } - bool SetValueFromCString(const char *value_str, Error &error) override; + bool SetValueFromCString(const char *value_str, Status &error) override; void SetFormat(lldb::Format format) override; diff --git a/include/lldb/Core/ValueObjectVariable.h b/include/lldb/Core/ValueObjectVariable.h index dbb7c2b9483e..9dd140a84f45 100644 --- a/include/lldb/Core/ValueObjectVariable.h +++ b/include/lldb/Core/ValueObjectVariable.h @@ -29,7 +29,7 @@ namespace lldb_private { class Declaration; } namespace lldb_private { -class Error; +class Status; } namespace lldb_private { class ExecutionContextScope; @@ -73,9 +73,9 @@ public: const char *GetLocationAsCString() override; - bool SetValueFromCString(const char *value_str, Error &error) override; + bool SetValueFromCString(const char *value_str, Status &error) override; - bool SetData(DataExtractor &data, Error &error) override; + bool SetData(DataExtractor &data, Status &error) override; virtual lldb::VariableSP GetVariable() override { return m_variable_sp; } |