diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-05-16 19:47:58 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-05-16 19:47:58 +0000 |
commit | b76161e41bc2c07cd47f9c61f875d1be95e26d10 (patch) | |
tree | d03c19ce10dec6419f97df1d4dac9d47eb88982f | |
parent | 8b4000f13b303cc154136abc74c55670673e2a96 (diff) | |
download | src-b76161e41bc2c07cd47f9c61f875d1be95e26d10.tar.gz src-b76161e41bc2c07cd47f9c61f875d1be95e26d10.zip |
Vendor import of lldb trunk r303197:vendor/lldb/lldb-trunk-r303197
Notes
Notes:
svn path=/vendor/lldb/dist/; revision=318378
svn path=/vendor/lldb/lldb-trunk-r303197/; revision=318379; tag=vendor/lldb/lldb-trunk-r303197
693 files changed, 6528 insertions, 6085 deletions
diff --git a/include/lldb/API/SBError.h b/include/lldb/API/SBError.h index a3b1f87053ad..a099a9be271a 100644 --- a/include/lldb/API/SBError.h +++ b/include/lldb/API/SBError.h @@ -68,18 +68,18 @@ protected: friend class SBBreakpoint; friend class SBBreakpointLocation; - lldb_private::Error *get(); + lldb_private::Status *get(); - lldb_private::Error *operator->(); + lldb_private::Status *operator->(); - const lldb_private::Error &operator*() const; + const lldb_private::Status &operator*() const; - lldb_private::Error &ref(); + lldb_private::Status &ref(); - void SetError(const lldb_private::Error &lldb_error); + void SetError(const lldb_private::Status &lldb_error); private: - std::unique_ptr<lldb_private::Error> m_opaque_ap; + std::unique_ptr<lldb_private::Status> m_opaque_ap; void CreateIfNeeded(); }; diff --git a/include/lldb/API/SBPlatform.h b/include/lldb/API/SBPlatform.h index 3f7e1acb74b5..952e31066319 100644 --- a/include/lldb/API/SBPlatform.h +++ b/include/lldb/API/SBPlatform.h @@ -156,7 +156,8 @@ protected: void SetSP(const lldb::PlatformSP &platform_sp); SBError ExecuteConnected( - const std::function<lldb_private::Error(const lldb::PlatformSP &)> &func); + const std::function<lldb_private::Status(const lldb::PlatformSP &)> + &func); lldb::PlatformSP m_opaque_sp; }; diff --git a/include/lldb/API/SBTarget.h b/include/lldb/API/SBTarget.h index 21341fbc27fa..62398fcd4b94 100644 --- a/include/lldb/API/SBTarget.h +++ b/include/lldb/API/SBTarget.h @@ -544,7 +544,7 @@ public: /// into this call /// /// @param[out] error - /// Error information is written here if the memory read fails. + /// Status information is written here if the memory read fails. /// /// @return /// The amount of data read in host bytes. diff --git a/include/lldb/Breakpoint/Breakpoint.h b/include/lldb/Breakpoint/Breakpoint.h index 4a16df047ee3..408647c3b5da 100644 --- a/include/lldb/Breakpoint/Breakpoint.h +++ b/include/lldb/Breakpoint/Breakpoint.h @@ -169,7 +169,7 @@ public: virtual bool EvaluatePrecondition(StoppointCallbackContext &context); - virtual Error ConfigurePrecondition(Args &options); + virtual Status ConfigurePrecondition(Args &options); virtual void GetDescription(Stream &stream, lldb::DescriptionLevel level); }; @@ -178,7 +178,7 @@ public: // Saving & restoring breakpoints: static lldb::BreakpointSP CreateFromStructuredData( - Target &target, StructuredData::ObjectSP &data_object_sp, Error &error); + Target &target, StructuredData::ObjectSP &data_object_sp, Status &error); static bool SerializedBreakpointMatchesNames(StructuredData::ObjectSP &bkpt_object_sp, @@ -613,7 +613,7 @@ public: lldb::SearchFilterSP GetSearchFilter() { return m_filter_sp; } - bool AddName(const char *new_name, Error &error); + bool AddName(llvm::StringRef new_name, Status &error); void RemoveName(const char *name_to_remove) { if (name_to_remove) diff --git a/include/lldb/Breakpoint/BreakpointID.h b/include/lldb/Breakpoint/BreakpointID.h index aa4add4cd665..57411b316317 100644 --- a/include/lldb/Breakpoint/BreakpointID.h +++ b/include/lldb/Breakpoint/BreakpointID.h @@ -84,7 +84,7 @@ public: /// \b true if the name is a breakpoint name (as opposed to an ID or /// range) false otherwise. //------------------------------------------------------------------ - static bool StringIsBreakpointName(llvm::StringRef str, Error &error); + static bool StringIsBreakpointName(llvm::StringRef str, Status &error); //------------------------------------------------------------------ /// Takes a breakpoint ID and the breakpoint location id and returns diff --git a/include/lldb/Breakpoint/BreakpointLocation.h b/include/lldb/Breakpoint/BreakpointLocation.h index d0567ccf2e04..a1086aa3fe5f 100644 --- a/include/lldb/Breakpoint/BreakpointLocation.h +++ b/include/lldb/Breakpoint/BreakpointLocation.h @@ -161,7 +161,7 @@ public: //------------------------------------------------------------------ const char *GetConditionText(size_t *hash = nullptr) const; - bool ConditionSaysStop(ExecutionContext &exe_ctx, Error &error); + bool ConditionSaysStop(ExecutionContext &exe_ctx, Status &error); //------------------------------------------------------------------ /// Set the valid thread to be checked when the breakpoint is hit. diff --git a/include/lldb/Breakpoint/BreakpointOptions.h b/include/lldb/Breakpoint/BreakpointOptions.h index 024e915908c0..4ed8469eba3d 100644 --- a/include/lldb/Breakpoint/BreakpointOptions.h +++ b/include/lldb/Breakpoint/BreakpointOptions.h @@ -50,7 +50,7 @@ public: static std::unique_ptr<CommandData> CreateFromStructuredData(const StructuredData::Dictionary &options_dict, - Error &error); + Status &error); StringList user_source; std::string script_source; @@ -119,7 +119,7 @@ public: static std::unique_ptr<BreakpointOptions> CreateFromStructuredData(Target &target, const StructuredData::Dictionary &data_dict, - Error &error); + Status &error); virtual StructuredData::ObjectSP SerializeToStructuredData(); diff --git a/include/lldb/Breakpoint/BreakpointResolver.h b/include/lldb/Breakpoint/BreakpointResolver.h index 7a57250d632b..7bcd889ce78b 100644 --- a/include/lldb/Breakpoint/BreakpointResolver.h +++ b/include/lldb/Breakpoint/BreakpointResolver.h @@ -140,7 +140,7 @@ public: static lldb::BreakpointResolverSP CreateFromStructuredData(const StructuredData::Dictionary &resolver_dict, - Error &error); + Status &error); virtual StructuredData::ObjectSP SerializeToStructuredData() { return StructuredData::ObjectSP(); @@ -192,7 +192,7 @@ public: static const char *ResolverTyToName(enum ResolverTy); - static ResolverTy NameToResolverTy(const char *name); + static ResolverTy NameToResolverTy(llvm::StringRef name); virtual lldb::BreakpointResolverSP CopyForBreakpoint(Breakpoint &breakpoint) = 0; diff --git a/include/lldb/Breakpoint/BreakpointResolverAddress.h b/include/lldb/Breakpoint/BreakpointResolverAddress.h index 6d2d505811f9..9d757c8853b9 100644 --- a/include/lldb/Breakpoint/BreakpointResolverAddress.h +++ b/include/lldb/Breakpoint/BreakpointResolverAddress.h @@ -39,7 +39,7 @@ public: static BreakpointResolver * CreateFromStructuredData(Breakpoint *bkpt, const StructuredData::Dictionary &options_dict, - Error &error); + Status &error); StructuredData::ObjectSP SerializeToStructuredData() override; diff --git a/include/lldb/Breakpoint/BreakpointResolverFileLine.h b/include/lldb/Breakpoint/BreakpointResolverFileLine.h index 50750b1fbdf5..f7bba3d4ccb4 100644 --- a/include/lldb/Breakpoint/BreakpointResolverFileLine.h +++ b/include/lldb/Breakpoint/BreakpointResolverFileLine.h @@ -36,7 +36,7 @@ public: static BreakpointResolver * CreateFromStructuredData(Breakpoint *bkpt, const StructuredData::Dictionary &data_dict, - Error &error); + Status &error); StructuredData::ObjectSP SerializeToStructuredData() override; diff --git a/include/lldb/Breakpoint/BreakpointResolverFileRegex.h b/include/lldb/Breakpoint/BreakpointResolverFileRegex.h index 6f00dac3f0a7..d620e99ffc60 100644 --- a/include/lldb/Breakpoint/BreakpointResolverFileRegex.h +++ b/include/lldb/Breakpoint/BreakpointResolverFileRegex.h @@ -38,7 +38,7 @@ public: static BreakpointResolver * CreateFromStructuredData(Breakpoint *bkpt, const StructuredData::Dictionary &options_dict, - Error &error); + Status &error); StructuredData::ObjectSP SerializeToStructuredData() override; diff --git a/include/lldb/Breakpoint/BreakpointResolverName.h b/include/lldb/Breakpoint/BreakpointResolverName.h index 4223125d9268..c7716d5146ef 100644 --- a/include/lldb/Breakpoint/BreakpointResolverName.h +++ b/include/lldb/Breakpoint/BreakpointResolverName.h @@ -57,7 +57,7 @@ public: static BreakpointResolver * CreateFromStructuredData(Breakpoint *bkpt, const StructuredData::Dictionary &data_dict, - Error &error); + Status &error); StructuredData::ObjectSP SerializeToStructuredData() override; diff --git a/include/lldb/Breakpoint/Watchpoint.h b/include/lldb/Breakpoint/Watchpoint.h index beb7bad1ee9d..69067a567621 100644 --- a/include/lldb/Breakpoint/Watchpoint.h +++ b/include/lldb/Breakpoint/Watchpoint.h @@ -100,7 +100,7 @@ public: void DumpSnapshots(Stream *s, const char *prefix = nullptr) const; void DumpWithLevel(Stream *s, lldb::DescriptionLevel description_level) const; Target &GetTarget() { return m_target; } - const Error &GetError() { return m_error; } + const Status &GetError() { return m_error; } //------------------------------------------------------------------ /// Returns the WatchpointOptions structure set for this watchpoint. @@ -213,8 +213,8 @@ private: lldb::ValueObjectSP m_old_value_sp; lldb::ValueObjectSP m_new_value_sp; CompilerType m_type; - Error m_error; // An error object describing errors associated with this - // watchpoint. + Status m_error; // An error object describing errors associated with this + // watchpoint. WatchpointOptions m_options; // Settable watchpoint options, which is a delegate to handle // the callback machinery. 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; } diff --git a/include/lldb/DataFormatters/TypeSummary.h b/include/lldb/DataFormatters/TypeSummary.h index fbfc25dd9c9f..a4d51b065480 100644 --- a/include/lldb/DataFormatters/TypeSummary.h +++ b/include/lldb/DataFormatters/TypeSummary.h @@ -25,7 +25,7 @@ #include "lldb/Core/FormatEntity.h" #include "lldb/Core/StructuredData.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" namespace lldb_private { class TypeSummaryOptions { @@ -286,7 +286,7 @@ private: struct StringSummaryFormat : public TypeSummaryImpl { std::string m_format_str; FormatEntity::Entry m_format; - Error m_error; + Status m_error; StringSummaryFormat(const TypeSummaryImpl::Flags &flags, const char *f); diff --git a/include/lldb/Expression/DWARFExpression.h b/include/lldb/Expression/DWARFExpression.h index ae9eb3fb2d16..1816c3b7a00f 100644 --- a/include/lldb/Expression/DWARFExpression.h +++ b/include/lldb/Expression/DWARFExpression.h @@ -14,7 +14,7 @@ #include "lldb/Core/Disassembler.h" #include "lldb/Core/Scalar.h" #include "lldb/Utility/DataExtractor.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/lldb-private.h" #include <functional> @@ -266,7 +266,7 @@ public: ClangExpressionDeclMap *decl_map, lldb::addr_t loclist_base_load_addr, const Value *initial_value_ptr, const Value *object_address_ptr, - Value &result, Error *error_ptr) const; + Value &result, Status *error_ptr) const; //------------------------------------------------------------------ /// Wrapper for the static evaluate function that uses member @@ -277,7 +277,7 @@ public: ClangExpressionDeclMap *decl_map, RegisterContext *reg_ctx, lldb::addr_t loclist_base_load_addr, const Value *initial_value_ptr, const Value *object_address_ptr, - Value &result, Error *error_ptr) const; + Value &result, Status *error_ptr) const; //------------------------------------------------------------------ /// Evaluate a DWARF location expression in a particular context @@ -345,7 +345,7 @@ public: DWARFCompileUnit *dwarf_cu, const lldb::offset_t offset, const lldb::offset_t length, const lldb::RegisterKind reg_set, const Value *initial_value_ptr, const Value *object_address_ptr, - Value &result, Error *error_ptr); + Value &result, Status *error_ptr); //------------------------------------------------------------------ /// Loads a ClangExpressionVariableList into the object diff --git a/include/lldb/Expression/ExpressionParser.h b/include/lldb/Expression/ExpressionParser.h index 9f33908b8f1b..19526d28b9b3 100644 --- a/include/lldb/Expression/ExpressionParser.h +++ b/include/lldb/Expression/ExpressionParser.h @@ -10,7 +10,7 @@ #ifndef liblldb_ExpressionParser_h_ #define liblldb_ExpressionParser_h_ -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/lldb-public.h" namespace lldb_private { @@ -108,7 +108,7 @@ public: /// An error code indicating the success or failure of the operation. /// Test with Success(). //------------------------------------------------------------------ - virtual Error + virtual Status PrepareForExecution(lldb::addr_t &func_addr, lldb::addr_t &func_end, std::shared_ptr<IRExecutionUnit> &execution_unit_sp, ExecutionContext &exe_ctx, bool &can_interpret, diff --git a/include/lldb/Expression/IRExecutionUnit.h b/include/lldb/Expression/IRExecutionUnit.h index 635e0b727d5c..b0b4d7a5c586 100644 --- a/include/lldb/Expression/IRExecutionUnit.h +++ b/include/lldb/Expression/IRExecutionUnit.h @@ -39,7 +39,7 @@ class ObjectCache; namespace lldb_private { -class Error; +class Status; //---------------------------------------------------------------------- /// @class IRExecutionUnit IRExecutionUnit.h "lldb/Expression/IRExecutionUnit.h" @@ -86,7 +86,7 @@ public: : nullptr); } - void GetRunnableInfo(Error &error, lldb::addr_t &func_addr, + void GetRunnableInfo(Status &error, lldb::addr_t &func_addr, lldb::addr_t &func_end); //------------------------------------------------------------------ @@ -95,7 +95,7 @@ public: /// IRExecutionUnit unless the client explicitly chooses to free it. //------------------------------------------------------------------ - lldb::addr_t WriteNow(const uint8_t *bytes, size_t size, Error &error); + lldb::addr_t WriteNow(const uint8_t *bytes, size_t size, Status &error); void FreeNow(lldb::addr_t allocation); @@ -240,7 +240,7 @@ private: //------------------------------------------------------------------ bool WriteData(lldb::ProcessSP &process_sp); - Error DisassembleFunction(Stream &stream, lldb::ProcessSP &process_sp); + Status DisassembleFunction(Stream &stream, lldb::ProcessSP &process_sp); struct SearchSpec; @@ -391,7 +391,7 @@ private: void dump(Log *log); }; - bool CommitOneAllocation(lldb::ProcessSP &process_sp, Error &error, + bool CommitOneAllocation(lldb::ProcessSP &process_sp, Status &error, AllocationRecord &record); typedef std::vector<AllocationRecord> RecordVector; diff --git a/include/lldb/Expression/IRInterpreter.h b/include/lldb/Expression/IRInterpreter.h index f9392c18c25c..36e03c6fc4f6 100644 --- a/include/lldb/Expression/IRInterpreter.h +++ b/include/lldb/Expression/IRInterpreter.h @@ -39,20 +39,20 @@ class IRMemoryMap; class IRInterpreter { public: static bool CanInterpret(llvm::Module &module, llvm::Function &function, - lldb_private::Error &error, + lldb_private::Status &error, const bool support_function_calls); static bool Interpret(llvm::Module &module, llvm::Function &function, llvm::ArrayRef<lldb::addr_t> args, lldb_private::IRExecutionUnit &execution_unit, - lldb_private::Error &error, + lldb_private::Status &error, lldb::addr_t stack_frame_bottom, lldb::addr_t stack_frame_top, lldb_private::ExecutionContext &exe_ctx); private: static bool supportsFunction(llvm::Function &llvm_function, - lldb_private::Error &err); + lldb_private::Status &err); }; #endif diff --git a/include/lldb/Expression/IRMemoryMap.h b/include/lldb/Expression/IRMemoryMap.h index c1a194d1afad..abb5cd745053 100644 --- a/include/lldb/Expression/IRMemoryMap.h +++ b/include/lldb/Expression/IRMemoryMap.h @@ -54,25 +54,25 @@ public: }; lldb::addr_t Malloc(size_t size, uint8_t alignment, uint32_t permissions, - AllocationPolicy policy, bool zero_memory, Error &error); - void Leak(lldb::addr_t process_address, Error &error); - void Free(lldb::addr_t process_address, Error &error); + AllocationPolicy policy, bool zero_memory, Status &error); + void Leak(lldb::addr_t process_address, Status &error); + void Free(lldb::addr_t process_address, Status &error); void WriteMemory(lldb::addr_t process_address, const uint8_t *bytes, - size_t size, Error &error); + size_t size, Status &error); void WriteScalarToMemory(lldb::addr_t process_address, Scalar &scalar, - size_t size, Error &error); + size_t size, Status &error); void WritePointerToMemory(lldb::addr_t process_address, lldb::addr_t address, - Error &error); + Status &error); void ReadMemory(uint8_t *bytes, lldb::addr_t process_address, size_t size, - Error &error); + Status &error); void ReadScalarFromMemory(Scalar &scalar, lldb::addr_t process_address, - size_t size, Error &error); + size_t size, Status &error); void ReadPointerFromMemory(lldb::addr_t *address, - lldb::addr_t process_address, Error &error); + lldb::addr_t process_address, Status &error); bool GetAllocSize(lldb::addr_t address, size_t &size); void GetMemoryData(DataExtractor &extractor, lldb::addr_t process_address, - size_t size, Error &error); + size_t size, Status &error); lldb::ByteOrder GetByteOrder(); uint32_t GetAddressByteSize(); diff --git a/include/lldb/Expression/LLVMUserExpression.h b/include/lldb/Expression/LLVMUserExpression.h index 48d0161991d7..745d413e077b 100644 --- a/include/lldb/Expression/LLVMUserExpression.h +++ b/include/lldb/Expression/LLVMUserExpression.h @@ -81,7 +81,7 @@ protected: lldb::ExpressionVariableSP &result) override; virtual void ScanContext(ExecutionContext &exe_ctx, - lldb_private::Error &err) = 0; + lldb_private::Status &err) = 0; bool PrepareToExecuteJITExpression(DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx, diff --git a/include/lldb/Expression/Materializer.h b/include/lldb/Expression/Materializer.h index ed3f91cc67ec..b86bc656d6b5 100644 --- a/include/lldb/Expression/Materializer.h +++ b/include/lldb/Expression/Materializer.h @@ -20,7 +20,7 @@ #include "lldb/Expression/IRMemoryMap.h" #include "lldb/Symbol/TaggedASTType.h" #include "lldb/Target/StackFrame.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/lldb-private-types.h" namespace lldb_private { @@ -38,7 +38,7 @@ public: ~Dematerializer() { Wipe(); } - void Dematerialize(Error &err, lldb::addr_t frame_top, + void Dematerialize(Status &err, lldb::addr_t frame_top, lldb::addr_t frame_bottom); void Wipe(); @@ -72,7 +72,7 @@ public: typedef std::weak_ptr<Dematerializer> DematerializerWP; DematerializerSP Materialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map, - lldb::addr_t process_address, Error &err); + lldb::addr_t process_address, Status &err); class PersistentVariableDelegate { public: @@ -83,13 +83,13 @@ public: uint32_t AddPersistentVariable(lldb::ExpressionVariableSP &persistent_variable_sp, - PersistentVariableDelegate *delegate, Error &err); - uint32_t AddVariable(lldb::VariableSP &variable_sp, Error &err); + PersistentVariableDelegate *delegate, Status &err); + uint32_t AddVariable(lldb::VariableSP &variable_sp, Status &err); uint32_t AddResultVariable(const CompilerType &type, bool is_lvalue, bool keep_in_memory, - PersistentVariableDelegate *delegate, Error &err); - uint32_t AddSymbol(const Symbol &symbol_sp, Error &err); - uint32_t AddRegister(const RegisterInfo ®ister_info, Error &err); + PersistentVariableDelegate *delegate, Status &err); + uint32_t AddSymbol(const Symbol &symbol_sp, Status &err); + uint32_t AddRegister(const RegisterInfo ®ister_info, Status &err); uint32_t GetStructAlignment() { return m_struct_alignment; } @@ -102,11 +102,11 @@ public: virtual ~Entity() = default; virtual void Materialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map, - lldb::addr_t process_address, Error &err) = 0; + lldb::addr_t process_address, Status &err) = 0; virtual void Dematerialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address, lldb::addr_t frame_top, - lldb::addr_t frame_bottom, Error &err) = 0; + lldb::addr_t frame_bottom, Status &err) = 0; virtual void DumpToLog(IRMemoryMap &map, lldb::addr_t process_address, Log *log) = 0; virtual void Wipe(IRMemoryMap &map, lldb::addr_t process_address) = 0; diff --git a/include/lldb/Expression/REPL.h b/include/lldb/Expression/REPL.h index 56d31cfd3b15..0c1e97fec259 100644 --- a/include/lldb/Expression/REPL.h +++ b/include/lldb/Expression/REPL.h @@ -60,7 +60,7 @@ public: /// @return /// The range of the containing object in the target process. //------------------------------------------------------------------ - static lldb::REPLSP Create(Error &Error, lldb::LanguageType language, + static lldb::REPLSP Create(Status &Status, lldb::LanguageType language, Debugger *debugger, Target *target, const char *repl_options); @@ -85,7 +85,7 @@ public: lldb::IOHandlerSP GetIOHandler(); - Error RunLoop(); + Status RunLoop(); //------------------------------------------------------------------ // IOHandler::Delegate functions @@ -126,7 +126,7 @@ protected: // Subclasses should override these functions to implement a functional REPL. //---------------------------------------------------------------------- - virtual Error DoInitialization() = 0; + virtual Status DoInitialization() = 0; virtual ConstString GetSourceFileBasename() = 0; diff --git a/include/lldb/Expression/UserExpression.h b/include/lldb/Expression/UserExpression.h index fca667e8ee96..ced5cb2bf2b7 100644 --- a/include/lldb/Expression/UserExpression.h +++ b/include/lldb/Expression/UserExpression.h @@ -259,13 +259,13 @@ public: static lldb::ExpressionResults Evaluate(ExecutionContext &exe_ctx, const EvaluateExpressionOptions &options, llvm::StringRef expr_cstr, llvm::StringRef expr_prefix, - lldb::ValueObjectSP &result_valobj_sp, Error &error, + lldb::ValueObjectSP &result_valobj_sp, Status &error, uint32_t line_offset = 0, std::string *fixed_expression = nullptr, lldb::ModuleSP *jit_module_sp_ptr = nullptr); - static const Error::ValueType kNoResult = + static const Status::ValueType kNoResult = 0x1001; ///< ValueObject::GetError() returns this if there is no result - ///from the expression. + /// from the expression. const char *GetFixedText() { if (m_fixed_text.empty()) @@ -281,7 +281,7 @@ protected: lldb::ExpressionVariableSP &result) = 0; static lldb::addr_t GetObjectPointer(lldb::StackFrameSP frame_sp, - ConstString &object_name, Error &err); + ConstString &object_name, Status &err); //------------------------------------------------------------------ /// Populate m_in_cplusplus_method and m_in_objectivec_method based on the diff --git a/include/lldb/Expression/UtilityFunction.h b/include/lldb/Expression/UtilityFunction.h index 0e2b87da20ad..9c54db35fa37 100644 --- a/include/lldb/Expression/UtilityFunction.h +++ b/include/lldb/Expression/UtilityFunction.h @@ -123,7 +123,7 @@ public: FunctionCaller *MakeFunctionCaller(const CompilerType &return_type, const ValueList &arg_value_list, lldb::ThreadSP compilation_thread, - Error &error); + Status &error); // This one retrieves the function caller that is already made. If you // haven't made it yet, this returns nullptr diff --git a/include/lldb/Host/File.h b/include/lldb/Host/File.h index 35317780f1ce..560a655237f3 100644 --- a/include/lldb/Host/File.h +++ b/include/lldb/Host/File.h @@ -12,7 +12,7 @@ #include "lldb/Host/IOObject.h" #include "lldb/Host/PosixApi.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/lldb-private.h" #include <stdarg.h> @@ -164,7 +164,7 @@ public: /// @return /// A reference to the file specification object. //------------------------------------------------------------------ - Error GetFileSpec(FileSpec &file_spec) const; + Status GetFileSpec(FileSpec &file_spec) const; //------------------------------------------------------------------ /// Open a file for read/writing with the specified options. @@ -181,10 +181,10 @@ public: /// @param[in] permissions /// Options to use when opening (see File::Permissions) //------------------------------------------------------------------ - Error Open(const char *path, uint32_t options, - uint32_t permissions = lldb::eFilePermissionsFileDefault); + Status Open(const char *path, uint32_t options, + uint32_t permissions = lldb::eFilePermissionsFileDefault); - Error Close() override; + Status Close() override; void Clear(); @@ -216,7 +216,7 @@ public: /// An error object that indicates success or the reason for /// failure. //------------------------------------------------------------------ - Error Read(void *buf, size_t &num_bytes) override; + Status Read(void *buf, size_t &num_bytes) override; //------------------------------------------------------------------ /// Write bytes to a file at the current file position. @@ -237,7 +237,7 @@ public: /// An error object that indicates success or the reason for /// failure. //------------------------------------------------------------------ - Error Write(const void *buf, size_t &num_bytes) override; + Status Write(const void *buf, size_t &num_bytes) override; //------------------------------------------------------------------ /// Seek to an offset relative to the beginning of the file. @@ -253,13 +253,13 @@ public: /// beginning of the file. /// /// @param[in] error_ptr - /// A pointer to a lldb_private::Error object that will be + /// A pointer to a lldb_private::Status object that will be /// filled in if non-nullptr. /// /// @return /// The resulting seek offset, or -1 on error. //------------------------------------------------------------------ - off_t SeekFromStart(off_t offset, Error *error_ptr = nullptr); + off_t SeekFromStart(off_t offset, Status *error_ptr = nullptr); //------------------------------------------------------------------ /// Seek to an offset relative to the current file position. @@ -275,13 +275,13 @@ public: /// current file position. /// /// @param[in] error_ptr - /// A pointer to a lldb_private::Error object that will be + /// A pointer to a lldb_private::Status object that will be /// filled in if non-nullptr. /// /// @return /// The resulting seek offset, or -1 on error. //------------------------------------------------------------------ - off_t SeekFromCurrent(off_t offset, Error *error_ptr = nullptr); + off_t SeekFromCurrent(off_t offset, Status *error_ptr = nullptr); //------------------------------------------------------------------ /// Seek to an offset relative to the end of the file. @@ -298,13 +298,13 @@ public: /// absolute file offset. /// /// @param[in] error_ptr - /// A pointer to a lldb_private::Error object that will be + /// A pointer to a lldb_private::Status object that will be /// filled in if non-nullptr. /// /// @return /// The resulting seek offset, or -1 on error. //------------------------------------------------------------------ - off_t SeekFromEnd(off_t offset, Error *error_ptr = nullptr); + off_t SeekFromEnd(off_t offset, Status *error_ptr = nullptr); //------------------------------------------------------------------ /// Read bytes from a file from the specified file offset. @@ -329,7 +329,7 @@ public: /// An error object that indicates success or the reason for /// failure. //------------------------------------------------------------------ - Error Read(void *dst, size_t &num_bytes, off_t &offset); + Status Read(void *dst, size_t &num_bytes, off_t &offset); //------------------------------------------------------------------ /// Read bytes from a file from the specified file offset. @@ -360,8 +360,8 @@ public: /// An error object that indicates success or the reason for /// failure. //------------------------------------------------------------------ - Error Read(size_t &num_bytes, off_t &offset, bool null_terminate, - lldb::DataBufferSP &data_buffer_sp); + Status Read(size_t &num_bytes, off_t &offset, bool null_terminate, + lldb::DataBufferSP &data_buffer_sp); //------------------------------------------------------------------ /// Write bytes to a file at the specified file offset. @@ -388,7 +388,7 @@ public: /// An error object that indicates success or the reason for /// failure. //------------------------------------------------------------------ - Error Write(const void *src, size_t &num_bytes, off_t &offset); + Status Write(const void *src, size_t &num_bytes, off_t &offset); //------------------------------------------------------------------ /// Flush the current stream @@ -397,7 +397,7 @@ public: /// An error object that indicates success or the reason for /// failure. //------------------------------------------------------------------ - Error Flush(); + Status Flush(); //------------------------------------------------------------------ /// Sync to disk. @@ -406,7 +406,7 @@ public: /// An error object that indicates success or the reason for /// failure. //------------------------------------------------------------------ - Error Sync(); + Status Sync(); //------------------------------------------------------------------ /// Get the permissions for a this file. @@ -415,9 +415,9 @@ public: /// Bits logical OR'ed together from the permission bits defined /// in lldb_private::File::Permissions. //------------------------------------------------------------------ - uint32_t GetPermissions(Error &error) const; + uint32_t GetPermissions(Status &error) const; - static uint32_t GetPermissions(const FileSpec &file_spec, Error &error); + static uint32_t GetPermissions(const FileSpec &file_spec, Status &error); //------------------------------------------------------------------ /// Return true if this file is interactive. diff --git a/include/lldb/Host/FileCache.h b/include/lldb/Host/FileCache.h index 094ee695ce32..1c03540c1eb3 100644 --- a/include/lldb/Host/FileCache.h +++ b/include/lldb/Host/FileCache.h @@ -15,8 +15,8 @@ #include "lldb/lldb-forward.h" #include "lldb/lldb-types.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/FileSpec.h" +#include "lldb/Utility/Status.h" namespace lldb_private { class FileCache { @@ -29,13 +29,13 @@ public: static FileCache &GetInstance(); lldb::user_id_t OpenFile(const FileSpec &file_spec, uint32_t flags, - uint32_t mode, Error &error); - bool CloseFile(lldb::user_id_t fd, Error &error); + uint32_t mode, Status &error); + bool CloseFile(lldb::user_id_t fd, Status &error); uint64_t WriteFile(lldb::user_id_t fd, uint64_t offset, const void *src, - uint64_t src_len, Error &error); + uint64_t src_len, Status &error); uint64_t ReadFile(lldb::user_id_t fd, uint64_t offset, void *dst, - uint64_t dst_len, Error &error); + uint64_t dst_len, Status &error); private: static FileCache *m_instance; diff --git a/include/lldb/Host/FileSystem.h b/include/lldb/Host/FileSystem.h index 794308ff4244..c13d5c84c631 100644 --- a/include/lldb/Host/FileSystem.h +++ b/include/lldb/Host/FileSystem.h @@ -10,8 +10,8 @@ #ifndef liblldb_Host_FileSystem_h #define liblldb_Host_FileSystem_h -#include "lldb/Utility/Error.h" #include "lldb/Utility/FileSpec.h" +#include "lldb/Utility/Status.h" #include "llvm/Support/Chrono.h" #include "lldb/lldb-types.h" @@ -26,10 +26,10 @@ public: static const char *DEV_NULL; static const char *PATH_CONVERSION_ERROR; - static Error Symlink(const FileSpec &src, const FileSpec &dst); - static Error Readlink(const FileSpec &src, FileSpec &dst); + static Status Symlink(const FileSpec &src, const FileSpec &dst); + static Status Readlink(const FileSpec &src, FileSpec &dst); - static Error ResolveSymbolicLink(const FileSpec &src, FileSpec &dst); + static Status ResolveSymbolicLink(const FileSpec &src, FileSpec &dst); /// Wraps ::fopen in a platform-independent way. Once opened, FILEs can be /// manipulated and closed with the normal ::fread, ::fclose, etc. functions. diff --git a/include/lldb/Host/Host.h b/include/lldb/Host/Host.h index 8415d429d5e2..c474dccab5db 100644 --- a/include/lldb/Host/Host.h +++ b/include/lldb/Host/Host.h @@ -190,19 +190,19 @@ public: static short GetPosixspawnFlags(const ProcessLaunchInfo &launch_info); - static Error LaunchProcessPosixSpawn(const char *exe_path, - const ProcessLaunchInfo &launch_info, - lldb::pid_t &pid); + static Status LaunchProcessPosixSpawn(const char *exe_path, + const ProcessLaunchInfo &launch_info, + lldb::pid_t &pid); static bool AddPosixSpawnFileAction(void *file_actions, const FileAction *info, Log *log, - Error &error); + Status &error); #endif static const lldb::UnixSignalsSP &GetUnixSignals(); - static Error LaunchProcess(ProcessLaunchInfo &launch_info); + static Status LaunchProcess(ProcessLaunchInfo &launch_info); //------------------------------------------------------------------ /// Perform expansion of the command-line for this launch info @@ -211,10 +211,10 @@ public: // argument magic the platform defines as part of its typical // user experience //------------------------------------------------------------------ - static Error ShellExpandArguments(ProcessLaunchInfo &launch_info); + static Status ShellExpandArguments(ProcessLaunchInfo &launch_info); // TODO: Convert this function to take a StringRef. - static Error RunShellCommand( + static Status RunShellCommand( const char *command, // Shouldn't be NULL const FileSpec &working_dir, // Pass empty FileSpec to use the current // working directory @@ -226,7 +226,7 @@ public: uint32_t timeout_sec, bool run_in_default_shell = true); - static Error RunShellCommand( + static Status RunShellCommand( const Args &args, const FileSpec &working_dir, // Pass empty FileSpec to use the current // working directory diff --git a/include/lldb/Host/HostNativeProcessBase.h b/include/lldb/Host/HostNativeProcessBase.h index 0befe867c296..07f98c24776c 100644 --- a/include/lldb/Host/HostNativeProcessBase.h +++ b/include/lldb/Host/HostNativeProcessBase.h @@ -11,7 +11,7 @@ #define lldb_Host_HostNativeProcessBase_h_ #include "lldb/Host/HostProcess.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/lldb-defines.h" #include "lldb/lldb-types.h" @@ -28,8 +28,8 @@ public: : m_process(process) {} virtual ~HostNativeProcessBase() {} - virtual Error Terminate() = 0; - virtual Error GetMainModule(FileSpec &file_spec) const = 0; + virtual Status Terminate() = 0; + virtual Status GetMainModule(FileSpec &file_spec) const = 0; virtual lldb::pid_t GetProcessId() const = 0; virtual bool IsRunning() const = 0; diff --git a/include/lldb/Host/HostNativeThreadBase.h b/include/lldb/Host/HostNativeThreadBase.h index 9bf86e0759f5..f1f89f3b75fe 100644 --- a/include/lldb/Host/HostNativeThreadBase.h +++ b/include/lldb/Host/HostNativeThreadBase.h @@ -10,7 +10,7 @@ #ifndef lldb_Host_HostNativeThreadBase_h_ #define lldb_Host_HostNativeThreadBase_h_ -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/lldb-defines.h" #include "lldb/lldb-types.h" @@ -31,8 +31,8 @@ public: explicit HostNativeThreadBase(lldb::thread_t thread); virtual ~HostNativeThreadBase() {} - virtual Error Join(lldb::thread_result_t *result) = 0; - virtual Error Cancel() = 0; + virtual Status Join(lldb::thread_result_t *result) = 0; + virtual Status Cancel() = 0; virtual bool IsJoinable() const; virtual void Reset(); lldb::thread_t Release(); diff --git a/include/lldb/Host/HostProcess.h b/include/lldb/Host/HostProcess.h index 56c3ddd9a1c2..dfc997bd81f7 100644 --- a/include/lldb/Host/HostProcess.h +++ b/include/lldb/Host/HostProcess.h @@ -40,8 +40,8 @@ public: HostProcess(lldb::process_t process); ~HostProcess(); - Error Terminate(); - Error GetMainModule(FileSpec &file_spec) const; + Status Terminate(); + Status GetMainModule(FileSpec &file_spec) const; lldb::pid_t GetProcessId() const; bool IsRunning() const; diff --git a/include/lldb/Host/HostThread.h b/include/lldb/Host/HostThread.h index 96314813cf7c..0d2fbe6045af 100644 --- a/include/lldb/Host/HostThread.h +++ b/include/lldb/Host/HostThread.h @@ -11,7 +11,7 @@ #define lldb_Host_HostThread_h_ #include "lldb/Host/HostNativeThreadForward.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/lldb-types.h" #include <memory> @@ -34,8 +34,8 @@ public: HostThread(); HostThread(lldb::thread_t thread); - Error Join(lldb::thread_result_t *result); - Error Cancel(); + Status Join(lldb::thread_result_t *result); + Status Cancel(); void Reset(); lldb::thread_t Release(); diff --git a/include/lldb/Host/IOObject.h b/include/lldb/Host/IOObject.h index 90e0bcdcd9df..98ad5056de74 100644 --- a/include/lldb/Host/IOObject.h +++ b/include/lldb/Host/IOObject.h @@ -34,10 +34,10 @@ public: : m_fd_type(type), m_should_close_fd(should_close) {} virtual ~IOObject() {} - virtual Error Read(void *buf, size_t &num_bytes) = 0; - virtual Error Write(const void *buf, size_t &num_bytes) = 0; + virtual Status Read(void *buf, size_t &num_bytes) = 0; + virtual Status Write(const void *buf, size_t &num_bytes) = 0; virtual bool IsValid() const = 0; - virtual Error Close() = 0; + virtual Status Close() = 0; FDType GetFdType() const { return m_fd_type; } diff --git a/include/lldb/Host/LockFileBase.h b/include/lldb/Host/LockFileBase.h index 74eafb279324..4eda1916c72e 100644 --- a/include/lldb/Host/LockFileBase.h +++ b/include/lldb/Host/LockFileBase.h @@ -10,7 +10,7 @@ #ifndef liblldb_Host_LockFileBase_h_ #define liblldb_Host_LockFileBase_h_ -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include <functional> @@ -22,30 +22,30 @@ public: bool IsLocked() const; - Error WriteLock(const uint64_t start, const uint64_t len); - Error TryWriteLock(const uint64_t start, const uint64_t len); + Status WriteLock(const uint64_t start, const uint64_t len); + Status TryWriteLock(const uint64_t start, const uint64_t len); - Error ReadLock(const uint64_t start, const uint64_t len); - Error TryReadLock(const uint64_t start, const uint64_t len); + Status ReadLock(const uint64_t start, const uint64_t len); + Status TryReadLock(const uint64_t start, const uint64_t len); - Error Unlock(); + Status Unlock(); protected: - using Locker = std::function<Error(const uint64_t, const uint64_t)>; + using Locker = std::function<Status(const uint64_t, const uint64_t)>; LockFileBase(int fd); virtual bool IsValidFile() const; - virtual Error DoWriteLock(const uint64_t start, const uint64_t len) = 0; - virtual Error DoTryWriteLock(const uint64_t start, const uint64_t len) = 0; + virtual Status DoWriteLock(const uint64_t start, const uint64_t len) = 0; + virtual Status DoTryWriteLock(const uint64_t start, const uint64_t len) = 0; - virtual Error DoReadLock(const uint64_t start, const uint64_t len) = 0; - virtual Error DoTryReadLock(const uint64_t start, const uint64_t len) = 0; + virtual Status DoReadLock(const uint64_t start, const uint64_t len) = 0; + virtual Status DoTryReadLock(const uint64_t start, const uint64_t len) = 0; - virtual Error DoUnlock() = 0; + virtual Status DoUnlock() = 0; - Error DoLock(const Locker &locker, const uint64_t start, const uint64_t len); + Status DoLock(const Locker &locker, const uint64_t start, const uint64_t len); int m_fd; // not owned. bool m_locked; diff --git a/include/lldb/Host/MainLoop.h b/include/lldb/Host/MainLoop.h index f5d906e98a7b..a722348b8843 100644 --- a/include/lldb/Host/MainLoop.h +++ b/include/lldb/Host/MainLoop.h @@ -47,7 +47,7 @@ public: ReadHandleUP RegisterReadObject(const lldb::IOObjectSP &object_sp, const Callback &callback, - Error &error) override; + Status &error) override; // Listening for signals from multiple MainLoop instances is perfectly safe as // long as they don't try to listen for the same signal. The callback function @@ -57,9 +57,9 @@ public: // However, since the callback is not invoked synchronously, you cannot use // this mechanism to handle SIGSEGV and the like. SignalHandleUP RegisterSignal(int signo, const Callback &callback, - Error &error); + Status &error); - Error Run() override; + Status Run() override; // This should only be performed from a callback. Do not attempt to terminate // the processing from another thread. diff --git a/include/lldb/Host/MainLoopBase.h b/include/lldb/Host/MainLoopBase.h index b746a9cb208c..39ca9a0f0c9e 100644 --- a/include/lldb/Host/MainLoopBase.h +++ b/include/lldb/Host/MainLoopBase.h @@ -15,7 +15,7 @@ #include "llvm/Support/ErrorHandling.h" #include "lldb/Host/IOObject.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" namespace lldb_private { @@ -49,14 +49,14 @@ public: virtual ReadHandleUP RegisterReadObject(const lldb::IOObjectSP &object_sp, const Callback &callback, - Error &error) { + Status &error) { llvm_unreachable("Not implemented"); } // Waits for registered events and invoke the proper callbacks. Returns when // all callbacks // deregister themselves or when someone requests termination. - virtual Error Run() { llvm_unreachable("Not implemented"); } + virtual Status Run() { llvm_unreachable("Not implemented"); } // Requests the exit of the Run() function. virtual void RequestTermination() { llvm_unreachable("Not implemented"); } diff --git a/include/lldb/Host/MonitoringProcessLauncher.h b/include/lldb/Host/MonitoringProcessLauncher.h index 7aa819a16c7c..9ad36e90a779 100644 --- a/include/lldb/Host/MonitoringProcessLauncher.h +++ b/include/lldb/Host/MonitoringProcessLauncher.h @@ -25,7 +25,7 @@ public: std::unique_ptr<ProcessLauncher> delegate_launcher); HostProcess LaunchProcess(const ProcessLaunchInfo &launch_info, - Error &error) override; + Status &error) override; private: std::unique_ptr<ProcessLauncher> m_delegate_launcher; diff --git a/include/lldb/Host/PipeBase.h b/include/lldb/Host/PipeBase.h index f141b5d413a0..ad62072c7ba5 100644 --- a/include/lldb/Host/PipeBase.h +++ b/include/lldb/Host/PipeBase.h @@ -14,7 +14,7 @@ #include <chrono> #include <string> -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" @@ -23,17 +23,18 @@ class PipeBase { public: virtual ~PipeBase(); - virtual Error CreateNew(bool child_process_inherit) = 0; - virtual Error CreateNew(llvm::StringRef name, bool child_process_inherit) = 0; - virtual Error CreateWithUniqueName(llvm::StringRef prefix, - bool child_process_inherit, - llvm::SmallVectorImpl<char> &name) = 0; + virtual Status CreateNew(bool child_process_inherit) = 0; + virtual Status CreateNew(llvm::StringRef name, + bool child_process_inherit) = 0; + virtual Status CreateWithUniqueName(llvm::StringRef prefix, + bool child_process_inherit, + llvm::SmallVectorImpl<char> &name) = 0; - virtual Error OpenAsReader(llvm::StringRef name, - bool child_process_inherit) = 0; + virtual Status OpenAsReader(llvm::StringRef name, + bool child_process_inherit) = 0; - Error OpenAsWriter(llvm::StringRef name, bool child_process_inherit); - virtual Error + Status OpenAsWriter(llvm::StringRef name, bool child_process_inherit); + virtual Status OpenAsWriterWithTimeout(llvm::StringRef name, bool child_process_inherit, const std::chrono::microseconds &timeout) = 0; @@ -51,13 +52,13 @@ public: virtual void Close() = 0; // Delete named pipe. - virtual Error Delete(llvm::StringRef name) = 0; + virtual Status Delete(llvm::StringRef name) = 0; - virtual Error Write(const void *buf, size_t size, size_t &bytes_written) = 0; - virtual Error ReadWithTimeout(void *buf, size_t size, - const std::chrono::microseconds &timeout, - size_t &bytes_read) = 0; - Error Read(void *buf, size_t size, size_t &bytes_read); + virtual Status Write(const void *buf, size_t size, size_t &bytes_written) = 0; + virtual Status ReadWithTimeout(void *buf, size_t size, + const std::chrono::microseconds &timeout, + size_t &bytes_read) = 0; + Status Read(void *buf, size_t size, size_t &bytes_read); }; } diff --git a/include/lldb/Host/ProcessLauncher.h b/include/lldb/Host/ProcessLauncher.h index 12049a69b3da..49fa84113f6c 100644 --- a/include/lldb/Host/ProcessLauncher.h +++ b/include/lldb/Host/ProcessLauncher.h @@ -13,14 +13,14 @@ namespace lldb_private { class ProcessLaunchInfo; -class Error; +class Status; class HostProcess; class ProcessLauncher { public: virtual ~ProcessLauncher() {} virtual HostProcess LaunchProcess(const ProcessLaunchInfo &launch_info, - Error &error) = 0; + Status &error) = 0; }; } diff --git a/include/lldb/Host/Socket.h b/include/lldb/Host/Socket.h index 36d506281cf8..c4233a233a89 100644 --- a/include/lldb/Host/Socket.h +++ b/include/lldb/Host/Socket.h @@ -18,7 +18,7 @@ #include "lldb/Host/IOObject.h" #include "lldb/Host/Predicate.h" #include "lldb/Host/SocketAddress.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #ifdef _WIN32 #include "lldb/Host/windows/windows.h" @@ -53,34 +53,35 @@ public: static std::unique_ptr<Socket> Create(const SocketProtocol protocol, bool child_processes_inherit, - Error &error); + Status &error); - virtual Error Connect(llvm::StringRef name) = 0; - virtual Error Listen(llvm::StringRef name, int backlog) = 0; - virtual Error Accept(Socket *&socket) = 0; + virtual Status Connect(llvm::StringRef name) = 0; + virtual Status Listen(llvm::StringRef name, int backlog) = 0; + virtual Status Accept(Socket *&socket) = 0; // Initialize a Tcp Socket object in listening mode. listen and accept are // implemented // separately because the caller may wish to manipulate or query the socket // after it is // initialized, but before entering a blocking accept. - static Error TcpListen(llvm::StringRef host_and_port, - bool child_processes_inherit, Socket *&socket, - Predicate<uint16_t> *predicate, int backlog = 5); - static Error TcpConnect(llvm::StringRef host_and_port, - bool child_processes_inherit, Socket *&socket); - static Error UdpConnect(llvm::StringRef host_and_port, - bool child_processes_inherit, Socket *&socket); - static Error UnixDomainConnect(llvm::StringRef host_and_port, + static Status TcpListen(llvm::StringRef host_and_port, + bool child_processes_inherit, Socket *&socket, + Predicate<uint16_t> *predicate, int backlog = 5); + static Status TcpConnect(llvm::StringRef host_and_port, + bool child_processes_inherit, Socket *&socket); + static Status UdpConnect(llvm::StringRef host_and_port, + bool child_processes_inherit, Socket *&socket); + static Status UnixDomainConnect(llvm::StringRef host_and_port, + bool child_processes_inherit, + Socket *&socket); + static Status UnixDomainAccept(llvm::StringRef host_and_port, bool child_processes_inherit, Socket *&socket); - static Error UnixDomainAccept(llvm::StringRef host_and_port, - bool child_processes_inherit, Socket *&socket); - static Error UnixAbstractConnect(llvm::StringRef host_and_port, + static Status UnixAbstractConnect(llvm::StringRef host_and_port, + bool child_processes_inherit, + Socket *&socket); + static Status UnixAbstractAccept(llvm::StringRef host_and_port, bool child_processes_inherit, Socket *&socket); - static Error UnixAbstractAccept(llvm::StringRef host_and_port, - bool child_processes_inherit, - Socket *&socket); int GetOption(int level, int option_name, int &option_value); int SetOption(int level, int option_name, int option_value); @@ -88,18 +89,18 @@ public: NativeSocket GetNativeSocket() const { return m_socket; } SocketProtocol GetSocketProtocol() const { return m_protocol; } - Error Read(void *buf, size_t &num_bytes) override; - Error Write(const void *buf, size_t &num_bytes) override; + Status Read(void *buf, size_t &num_bytes) override; + Status Write(const void *buf, size_t &num_bytes) override; - virtual Error PreDisconnect(); - Error Close() override; + virtual Status PreDisconnect(); + Status Close() override; bool IsValid() const override { return m_socket != kInvalidSocketValue; } WaitableHandle GetWaitableHandle() override; static bool DecodeHostAndPort(llvm::StringRef host_and_port, std::string &host_str, std::string &port_str, - int32_t &port, Error *error_ptr); + int32_t &port, Status *error_ptr); protected: Socket(SocketProtocol protocol, bool should_close, @@ -107,13 +108,13 @@ protected: virtual size_t Send(const void *buf, const size_t num_bytes); - static void SetLastError(Error &error); + static void SetLastError(Status &error); static NativeSocket CreateSocket(const int domain, const int type, const int protocol, - bool child_processes_inherit, Error &error); + bool child_processes_inherit, Status &error); static NativeSocket AcceptSocket(NativeSocket sockfd, struct sockaddr *addr, socklen_t *addrlen, - bool child_processes_inherit, Error &error); + bool child_processes_inherit, Status &error); SocketProtocol m_protocol; NativeSocket m_socket; diff --git a/include/lldb/Host/ThreadLauncher.h b/include/lldb/Host/ThreadLauncher.h index 4e388ca6bb9c..b50f0e2c2c43 100644 --- a/include/lldb/Host/ThreadLauncher.h +++ b/include/lldb/Host/ThreadLauncher.h @@ -12,7 +12,7 @@ #define lldb_Host_ThreadLauncher_h_ #include "lldb/Host/HostThread.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/lldb-types.h" #include "llvm/ADT/StringRef.h" @@ -23,7 +23,7 @@ class ThreadLauncher { public: static HostThread LaunchThread(llvm::StringRef name, lldb::thread_func_t thread_function, - lldb::thread_arg_t thread_arg, Error *error_ptr, + lldb::thread_arg_t thread_arg, Status *error_ptr, size_t min_stack_byte_size = 0); // Minimum stack size in bytes, // set stack size to zero for // default platform thread stack diff --git a/include/lldb/Host/common/NativeBreakpoint.h b/include/lldb/Host/common/NativeBreakpoint.h index 2f872e1d5a52..73639d64c9e8 100644 --- a/include/lldb/Host/common/NativeBreakpoint.h +++ b/include/lldb/Host/common/NativeBreakpoint.h @@ -24,9 +24,9 @@ public: virtual ~NativeBreakpoint(); - Error Enable(); + Status Enable(); - Error Disable(); + Status Disable(); lldb::addr_t GetAddress() const { return m_addr; } @@ -38,9 +38,9 @@ protected: const lldb::addr_t m_addr; int32_t m_ref_count; - virtual Error DoEnable() = 0; + virtual Status DoEnable() = 0; - virtual Error DoDisable() = 0; + virtual Status DoDisable() = 0; private: bool m_enabled; diff --git a/include/lldb/Host/common/NativeBreakpointList.h b/include/lldb/Host/common/NativeBreakpointList.h index 1d314e02b1d5..ffa659fdd869 100644 --- a/include/lldb/Host/common/NativeBreakpointList.h +++ b/include/lldb/Host/common/NativeBreakpointList.h @@ -10,7 +10,7 @@ #ifndef liblldb_NativeBreakpointList_h_ #define liblldb_NativeBreakpointList_h_ -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/lldb-private-forward.h" // #include "lldb/Host/NativeBreakpoint.h" @@ -29,24 +29,25 @@ using HardwareBreakpointMap = std::map<lldb::addr_t, HardwareBreakpoint>; class NativeBreakpointList { public: - typedef std::function<Error(lldb::addr_t addr, size_t size_hint, - bool hardware, NativeBreakpointSP &breakpoint_sp)> + typedef std::function<Status(lldb::addr_t addr, size_t size_hint, + bool hardware, + NativeBreakpointSP &breakpoint_sp)> CreateBreakpointFunc; NativeBreakpointList(); - Error AddRef(lldb::addr_t addr, size_t size_hint, bool hardware, - CreateBreakpointFunc create_func); + Status AddRef(lldb::addr_t addr, size_t size_hint, bool hardware, + CreateBreakpointFunc create_func); - Error DecRef(lldb::addr_t addr); + Status DecRef(lldb::addr_t addr); - Error EnableBreakpoint(lldb::addr_t addr); + Status EnableBreakpoint(lldb::addr_t addr); - Error DisableBreakpoint(lldb::addr_t addr); + Status DisableBreakpoint(lldb::addr_t addr); - Error GetBreakpoint(lldb::addr_t addr, NativeBreakpointSP &breakpoint_sp); + Status GetBreakpoint(lldb::addr_t addr, NativeBreakpointSP &breakpoint_sp); - Error RemoveTrapsFromBuffer(lldb::addr_t addr, void *buf, size_t size) const; + Status RemoveTrapsFromBuffer(lldb::addr_t addr, void *buf, size_t size) const; private: typedef std::map<lldb::addr_t, NativeBreakpointSP> BreakpointMap; diff --git a/include/lldb/Host/common/NativeProcessProtocol.h b/include/lldb/Host/common/NativeProcessProtocol.h index 7ad09d41eacf..388edef0578d 100644 --- a/include/lldb/Host/common/NativeProcessProtocol.h +++ b/include/lldb/Host/common/NativeProcessProtocol.h @@ -11,7 +11,7 @@ #define liblldb_NativeProcessProtocol_h_ #include "lldb/Host/MainLoop.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/lldb-private-forward.h" #include "lldb/lldb-types.h" #include "llvm/ADT/ArrayRef.h" @@ -37,11 +37,11 @@ class NativeProcessProtocol public: virtual ~NativeProcessProtocol() {} - virtual Error Resume(const ResumeActionList &resume_actions) = 0; + virtual Status Resume(const ResumeActionList &resume_actions) = 0; - virtual Error Halt() = 0; + virtual Status Halt() = 0; - virtual Error Detach() = 0; + virtual Status Detach() = 0; //------------------------------------------------------------------ /// Sends a process a UNIX signal \a signal. @@ -49,7 +49,7 @@ public: /// @return /// Returns an error object. //------------------------------------------------------------------ - virtual Error Signal(int signo) = 0; + virtual Status Signal(int signo) = 0; //------------------------------------------------------------------ /// Tells a process to interrupt all operations as if by a Ctrl-C. @@ -61,36 +61,36 @@ public: /// @return /// Returns an error object. //------------------------------------------------------------------ - virtual Error Interrupt(); + virtual Status Interrupt(); - virtual Error Kill() = 0; + virtual Status Kill() = 0; //------------------------------------------------------------------ // Tells a process not to stop the inferior on given signals // and just reinject them back. //------------------------------------------------------------------ - virtual Error IgnoreSignals(llvm::ArrayRef<int> signals); + virtual Status IgnoreSignals(llvm::ArrayRef<int> signals); //---------------------------------------------------------------------- // Memory and memory region functions //---------------------------------------------------------------------- - virtual Error GetMemoryRegionInfo(lldb::addr_t load_addr, - MemoryRegionInfo &range_info); + virtual Status GetMemoryRegionInfo(lldb::addr_t load_addr, + MemoryRegionInfo &range_info); - virtual Error ReadMemory(lldb::addr_t addr, void *buf, size_t size, - size_t &bytes_read) = 0; + virtual Status ReadMemory(lldb::addr_t addr, void *buf, size_t size, + size_t &bytes_read) = 0; - virtual Error ReadMemoryWithoutTrap(lldb::addr_t addr, void *buf, size_t size, - size_t &bytes_read) = 0; + virtual Status ReadMemoryWithoutTrap(lldb::addr_t addr, void *buf, + size_t size, size_t &bytes_read) = 0; - virtual Error WriteMemory(lldb::addr_t addr, const void *buf, size_t size, - size_t &bytes_written) = 0; + virtual Status WriteMemory(lldb::addr_t addr, const void *buf, size_t size, + size_t &bytes_written) = 0; - virtual Error AllocateMemory(size_t size, uint32_t permissions, - lldb::addr_t &addr) = 0; + virtual Status AllocateMemory(size_t size, uint32_t permissions, + lldb::addr_t &addr) = 0; - virtual Error DeallocateMemory(lldb::addr_t addr) = 0; + virtual Status DeallocateMemory(lldb::addr_t addr) = 0; virtual lldb::addr_t GetSharedLibraryInfoAddress() = 0; @@ -103,23 +103,23 @@ public: //---------------------------------------------------------------------- // Breakpoint functions //---------------------------------------------------------------------- - virtual Error SetBreakpoint(lldb::addr_t addr, uint32_t size, - bool hardware) = 0; + virtual Status SetBreakpoint(lldb::addr_t addr, uint32_t size, + bool hardware) = 0; - virtual Error RemoveBreakpoint(lldb::addr_t addr, bool hardware = false); + virtual Status RemoveBreakpoint(lldb::addr_t addr, bool hardware = false); - virtual Error EnableBreakpoint(lldb::addr_t addr); + virtual Status EnableBreakpoint(lldb::addr_t addr); - virtual Error DisableBreakpoint(lldb::addr_t addr); + virtual Status DisableBreakpoint(lldb::addr_t addr); //---------------------------------------------------------------------- // Hardware Breakpoint functions //---------------------------------------------------------------------- virtual const HardwareBreakpointMap &GetHardwareBreakpointMap() const; - virtual Error SetHardwareBreakpoint(lldb::addr_t addr, size_t size); + virtual Status SetHardwareBreakpoint(lldb::addr_t addr, size_t size); - virtual Error RemoveHardwareBreakpoint(lldb::addr_t addr); + virtual Status RemoveHardwareBreakpoint(lldb::addr_t addr); //---------------------------------------------------------------------- // Watchpoint functions @@ -129,10 +129,10 @@ public: virtual llvm::Optional<std::pair<uint32_t, uint32_t>> GetHardwareDebugSupportInfo() const; - virtual Error SetWatchpoint(lldb::addr_t addr, size_t size, - uint32_t watch_flags, bool hardware); + virtual Status SetWatchpoint(lldb::addr_t addr, size_t size, + uint32_t watch_flags, bool hardware); - virtual Error RemoveWatchpoint(lldb::addr_t addr); + virtual Status RemoveWatchpoint(lldb::addr_t addr); //---------------------------------------------------------------------- // Accessors @@ -239,11 +239,11 @@ public: //------------------------------------------------------------------ bool UnregisterNativeDelegate(NativeDelegate &native_delegate); - virtual Error GetLoadedModuleFileSpec(const char *module_path, - FileSpec &file_spec) = 0; + virtual Status GetLoadedModuleFileSpec(const char *module_path, + FileSpec &file_spec) = 0; - virtual Error GetFileLoadAddress(const llvm::StringRef &file_name, - lldb::addr_t &load_addr) = 0; + virtual Status GetFileLoadAddress(const llvm::StringRef &file_name, + lldb::addr_t &load_addr) = 0; //------------------------------------------------------------------ /// Launch a process for debugging. This method will create an concrete @@ -273,9 +273,9 @@ public: /// An error object indicating if the operation succeeded, /// and if not, what error occurred. //------------------------------------------------------------------ - static Error Launch(ProcessLaunchInfo &launch_info, - NativeDelegate &native_delegate, MainLoop &mainloop, - NativeProcessProtocolSP &process_sp); + static Status Launch(ProcessLaunchInfo &launch_info, + NativeDelegate &native_delegate, MainLoop &mainloop, + NativeProcessProtocolSP &process_sp); //------------------------------------------------------------------ /// Attach to an existing process. This method will create an concrete @@ -305,8 +305,8 @@ public: /// An error object indicating if the operation succeeded, /// and if not, what error occurred. //------------------------------------------------------------------ - static Error Attach(lldb::pid_t pid, NativeDelegate &native_delegate, - MainLoop &mainloop, NativeProcessProtocolSP &process_sp); + static Status Attach(lldb::pid_t pid, NativeDelegate &native_delegate, + MainLoop &mainloop, NativeProcessProtocolSP &process_sp); protected: lldb::pid_t m_pid; @@ -356,9 +356,9 @@ protected: // ----------------------------------------------------------- // Internal interface for software breakpoints // ----------------------------------------------------------- - Error SetSoftwareBreakpoint(lldb::addr_t addr, uint32_t size_hint); + Status SetSoftwareBreakpoint(lldb::addr_t addr, uint32_t size_hint); - virtual Error + virtual Status GetSoftwareBreakpointTrapOpcode(size_t trap_opcode_size_hint, size_t &actual_opcode_size, const uint8_t *&trap_opcode_bytes) = 0; @@ -376,7 +376,7 @@ protected: // ----------------------------------------------------------- // Static helper methods for derived classes. // ----------------------------------------------------------- - static Error ResolveProcessArchitecture(lldb::pid_t pid, ArchSpec &arch); + static Status ResolveProcessArchitecture(lldb::pid_t pid, ArchSpec &arch); private: void SynchronouslyNotifyProcessStateChanged(lldb::StateType state); diff --git a/include/lldb/Host/common/NativeRegisterContext.h b/include/lldb/Host/common/NativeRegisterContext.h index 1d8b51c60cc4..982d81b9ac4c 100644 --- a/include/lldb/Host/common/NativeRegisterContext.h +++ b/include/lldb/Host/common/NativeRegisterContext.h @@ -53,15 +53,15 @@ public: virtual const RegisterSet *GetRegisterSet(uint32_t set_index) const = 0; - virtual Error ReadRegister(const RegisterInfo *reg_info, - RegisterValue ®_value) = 0; + virtual Status ReadRegister(const RegisterInfo *reg_info, + RegisterValue ®_value) = 0; - virtual Error WriteRegister(const RegisterInfo *reg_info, - const RegisterValue ®_value) = 0; + virtual Status WriteRegister(const RegisterInfo *reg_info, + const RegisterValue ®_value) = 0; - virtual Error ReadAllRegisterValues(lldb::DataBufferSP &data_sp) = 0; + virtual Status ReadAllRegisterValues(lldb::DataBufferSP &data_sp) = 0; - virtual Error WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) = 0; + virtual Status WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) = 0; uint32_t ConvertRegisterKindToRegisterNumber(uint32_t kind, uint32_t num) const; @@ -75,10 +75,10 @@ public: virtual bool ClearHardwareBreakpoint(uint32_t hw_idx); - virtual Error ClearAllHardwareBreakpoints(); + virtual Status ClearAllHardwareBreakpoints(); - virtual Error GetHardwareBreakHitIndex(uint32_t &bp_index, - lldb::addr_t trap_addr); + virtual Status GetHardwareBreakHitIndex(uint32_t &bp_index, + lldb::addr_t trap_addr); virtual uint32_t NumSupportedHardwareWatchpoints(); @@ -87,14 +87,14 @@ public: virtual bool ClearHardwareWatchpoint(uint32_t hw_index); - virtual Error ClearAllHardwareWatchpoints(); + virtual Status ClearAllHardwareWatchpoints(); - virtual Error IsWatchpointHit(uint32_t wp_index, bool &is_hit); + virtual Status IsWatchpointHit(uint32_t wp_index, bool &is_hit); - virtual Error GetWatchpointHitIndex(uint32_t &wp_index, - lldb::addr_t trap_addr); + virtual Status GetWatchpointHitIndex(uint32_t &wp_index, + lldb::addr_t trap_addr); - virtual Error IsWatchpointVacant(uint32_t wp_index, bool &is_vacant); + virtual Status IsWatchpointVacant(uint32_t wp_index, bool &is_vacant); virtual lldb::addr_t GetWatchpointAddress(uint32_t wp_index); @@ -114,12 +114,12 @@ public: virtual bool HardwareSingleStep(bool enable); - virtual Error + virtual Status ReadRegisterValueFromMemory(const lldb_private::RegisterInfo *reg_info, lldb::addr_t src_addr, size_t src_len, RegisterValue ®_value); - virtual Error + virtual Status WriteRegisterValueToMemory(const lldb_private::RegisterInfo *reg_info, lldb::addr_t dst_addr, size_t dst_len, const RegisterValue ®_value); @@ -141,15 +141,15 @@ public: virtual lldb::addr_t GetPCfromBreakpointLocation(lldb::addr_t fail_value = LLDB_INVALID_ADDRESS); - Error SetPC(lldb::addr_t pc); + Status SetPC(lldb::addr_t pc); lldb::addr_t GetSP(lldb::addr_t fail_value = LLDB_INVALID_ADDRESS); - Error SetSP(lldb::addr_t sp); + Status SetSP(lldb::addr_t sp); lldb::addr_t GetFP(lldb::addr_t fail_value = LLDB_INVALID_ADDRESS); - Error SetFP(lldb::addr_t fp); + Status SetFP(lldb::addr_t fp); const char *GetRegisterName(uint32_t reg); @@ -162,9 +162,9 @@ public: lldb::addr_t ReadRegisterAsUnsigned(const RegisterInfo *reg_info, lldb::addr_t fail_value); - Error WriteRegisterFromUnsigned(uint32_t reg, uint64_t uval); + Status WriteRegisterFromUnsigned(uint32_t reg, uint64_t uval); - Error WriteRegisterFromUnsigned(const RegisterInfo *reg_info, uint64_t uval); + Status WriteRegisterFromUnsigned(const RegisterInfo *reg_info, uint64_t uval); // uint32_t // GetStopID () const diff --git a/include/lldb/Host/common/NativeThreadProtocol.h b/include/lldb/Host/common/NativeThreadProtocol.h index 8f26616a2b4a..2e6c96a34cf5 100644 --- a/include/lldb/Host/common/NativeThreadProtocol.h +++ b/include/lldb/Host/common/NativeThreadProtocol.h @@ -33,13 +33,13 @@ public: virtual NativeRegisterContextSP GetRegisterContext() = 0; - virtual Error ReadRegister(uint32_t reg, RegisterValue ®_value); + virtual Status ReadRegister(uint32_t reg, RegisterValue ®_value); - virtual Error WriteRegister(uint32_t reg, const RegisterValue ®_value); + virtual Status WriteRegister(uint32_t reg, const RegisterValue ®_value); - virtual Error SaveAllRegisters(lldb::DataBufferSP &data_sp); + virtual Status SaveAllRegisters(lldb::DataBufferSP &data_sp); - virtual Error RestoreAllRegisters(lldb::DataBufferSP &data_sp); + virtual Status RestoreAllRegisters(lldb::DataBufferSP &data_sp); virtual bool GetStopReason(ThreadStopInfo &stop_info, std::string &description) = 0; @@ -51,17 +51,17 @@ public: // --------------------------------------------------------------------- // Thread-specific watchpoints // --------------------------------------------------------------------- - virtual Error SetWatchpoint(lldb::addr_t addr, size_t size, - uint32_t watch_flags, bool hardware) = 0; + virtual Status SetWatchpoint(lldb::addr_t addr, size_t size, + uint32_t watch_flags, bool hardware) = 0; - virtual Error RemoveWatchpoint(lldb::addr_t addr) = 0; + virtual Status RemoveWatchpoint(lldb::addr_t addr) = 0; // --------------------------------------------------------------------- // Thread-specific Hardware Breakpoint routines // --------------------------------------------------------------------- - virtual Error SetHardwareBreakpoint(lldb::addr_t addr, size_t size) = 0; + virtual Status SetHardwareBreakpoint(lldb::addr_t addr, size_t size) = 0; - virtual Error RemoveHardwareBreakpoint(lldb::addr_t addr) = 0; + virtual Status RemoveHardwareBreakpoint(lldb::addr_t addr) = 0; protected: NativeProcessProtocolWP m_process_wp; diff --git a/include/lldb/Host/common/NativeWatchpointList.h b/include/lldb/Host/common/NativeWatchpointList.h index ae3476f5f07e..02920e6faacb 100644 --- a/include/lldb/Host/common/NativeWatchpointList.h +++ b/include/lldb/Host/common/NativeWatchpointList.h @@ -10,7 +10,7 @@ #ifndef liblldb_NativeWatchpointList_h_ #define liblldb_NativeWatchpointList_h_ -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/lldb-private-forward.h" #include <map> @@ -25,10 +25,10 @@ struct NativeWatchpoint { class NativeWatchpointList { public: - Error Add(lldb::addr_t addr, size_t size, uint32_t watch_flags, - bool hardware); + Status Add(lldb::addr_t addr, size_t size, uint32_t watch_flags, + bool hardware); - Error Remove(lldb::addr_t addr); + Status Remove(lldb::addr_t addr); using WatchpointMap = std::map<lldb::addr_t, NativeWatchpoint>; diff --git a/include/lldb/Host/common/SoftwareBreakpoint.h b/include/lldb/Host/common/SoftwareBreakpoint.h index 703f6bb95d48..e0f235fecd93 100644 --- a/include/lldb/Host/common/SoftwareBreakpoint.h +++ b/include/lldb/Host/common/SoftwareBreakpoint.h @@ -18,18 +18,18 @@ class SoftwareBreakpoint : public NativeBreakpoint { friend class NativeBreakpointList; public: - static Error CreateSoftwareBreakpoint(NativeProcessProtocol &process, - lldb::addr_t addr, size_t size_hint, - NativeBreakpointSP &breakpoint_spn); + static Status CreateSoftwareBreakpoint(NativeProcessProtocol &process, + lldb::addr_t addr, size_t size_hint, + NativeBreakpointSP &breakpoint_spn); SoftwareBreakpoint(NativeProcessProtocol &process, lldb::addr_t addr, const uint8_t *saved_opcodes, const uint8_t *trap_opcodes, size_t opcode_size); protected: - Error DoEnable() override; + Status DoEnable() override; - Error DoDisable() override; + Status DoDisable() override; bool IsSoftwareBreakpoint() const override; @@ -42,11 +42,11 @@ private: uint8_t m_trap_opcodes[MAX_TRAP_OPCODE_SIZE]; const size_t m_opcode_size; - static Error EnableSoftwareBreakpoint(NativeProcessProtocol &process, - lldb::addr_t addr, - size_t bp_opcode_size, - const uint8_t *bp_opcode_bytes, - uint8_t *saved_opcode_bytes); + static Status EnableSoftwareBreakpoint(NativeProcessProtocol &process, + lldb::addr_t addr, + size_t bp_opcode_size, + const uint8_t *bp_opcode_bytes, + uint8_t *saved_opcode_bytes); }; } diff --git a/include/lldb/Host/common/TCPSocket.h b/include/lldb/Host/common/TCPSocket.h index 5b72f344019f..0d32a70fd381 100644 --- a/include/lldb/Host/common/TCPSocket.h +++ b/include/lldb/Host/common/TCPSocket.h @@ -39,11 +39,11 @@ public: int SetOptionNoDelay(); int SetOptionReuseAddress(); - Error Connect(llvm::StringRef name) override; - Error Listen(llvm::StringRef name, int backlog) override; - Error Accept(Socket *&conn_socket) override; + Status Connect(llvm::StringRef name) override; + Status Listen(llvm::StringRef name, int backlog) override; + Status Accept(Socket *&conn_socket) override; - Error CreateSocket(int domain); + Status CreateSocket(int domain); bool IsValid() const override; diff --git a/include/lldb/Host/common/UDPSocket.h b/include/lldb/Host/common/UDPSocket.h index 977ce151e4ff..27b2d1dc9834 100644 --- a/include/lldb/Host/common/UDPSocket.h +++ b/include/lldb/Host/common/UDPSocket.h @@ -17,16 +17,16 @@ class UDPSocket : public Socket { public: UDPSocket(bool should_close, bool child_processes_inherit); - static Error Connect(llvm::StringRef name, bool child_processes_inherit, - Socket *&socket); + static Status Connect(llvm::StringRef name, bool child_processes_inherit, + Socket *&socket); private: UDPSocket(NativeSocket socket); size_t Send(const void *buf, const size_t num_bytes) override; - Error Connect(llvm::StringRef name) override; - Error Listen(llvm::StringRef name, int backlog) override; - Error Accept(Socket *&socket) override; + Status Connect(llvm::StringRef name) override; + Status Listen(llvm::StringRef name, int backlog) override; + Status Accept(Socket *&socket) override; SocketAddress m_sockaddr; }; diff --git a/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h b/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h index f002dd167ce2..f57c93684002 100644 --- a/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h +++ b/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h @@ -26,7 +26,7 @@ namespace lldb_private { -class Error; +class Status; class Socket; class SocketAddress; @@ -53,20 +53,20 @@ public: bool IsConnected() const override; - lldb::ConnectionStatus Connect(llvm::StringRef s, Error *error_ptr) override; + lldb::ConnectionStatus Connect(llvm::StringRef s, Status *error_ptr) override; - lldb::ConnectionStatus Disconnect(Error *error_ptr) override; + lldb::ConnectionStatus Disconnect(Status *error_ptr) override; size_t Read(void *dst, size_t dst_len, const Timeout<std::micro> &timeout, - lldb::ConnectionStatus &status, Error *error_ptr) override; + lldb::ConnectionStatus &status, Status *error_ptr) override; size_t Write(const void *src, size_t src_len, lldb::ConnectionStatus &status, - Error *error_ptr) override; + Status *error_ptr) override; std::string GetURI() override; lldb::ConnectionStatus BytesAvailable(const Timeout<std::micro> &timeout, - Error *error_ptr); + Status *error_ptr); bool InterruptRead() override; @@ -83,21 +83,21 @@ protected: void CloseCommandPipe(); lldb::ConnectionStatus SocketListenAndAccept(llvm::StringRef host_and_port, - Error *error_ptr); + Status *error_ptr); lldb::ConnectionStatus ConnectTCP(llvm::StringRef host_and_port, - Error *error_ptr); + Status *error_ptr); - lldb::ConnectionStatus ConnectUDP(llvm::StringRef args, Error *error_ptr); + lldb::ConnectionStatus ConnectUDP(llvm::StringRef args, Status *error_ptr); lldb::ConnectionStatus NamedSocketConnect(llvm::StringRef socket_name, - Error *error_ptr); + Status *error_ptr); lldb::ConnectionStatus NamedSocketAccept(llvm::StringRef socket_name, - Error *error_ptr); + Status *error_ptr); lldb::ConnectionStatus UnixAbstractSocketConnect(llvm::StringRef socket_name, - Error *error_ptr); + Status *error_ptr); lldb::IOObjectSP m_read_sp; lldb::IOObjectSP m_write_sp; diff --git a/include/lldb/Host/posix/DomainSocket.h b/include/lldb/Host/posix/DomainSocket.h index 78a3dc89828a..e66b3f971faf 100644 --- a/include/lldb/Host/posix/DomainSocket.h +++ b/include/lldb/Host/posix/DomainSocket.h @@ -17,9 +17,9 @@ class DomainSocket : public Socket { public: DomainSocket(bool should_close, bool child_processes_inherit); - Error Connect(llvm::StringRef name) override; - Error Listen(llvm::StringRef name, int backlog) override; - Error Accept(Socket *&socket) override; + Status Connect(llvm::StringRef name) override; + Status Listen(llvm::StringRef name, int backlog) override; + Status Accept(Socket *&socket) override; protected: DomainSocket(SocketProtocol protocol, bool child_processes_inherit); diff --git a/include/lldb/Host/posix/HostProcessPosix.h b/include/lldb/Host/posix/HostProcessPosix.h index aed3cccef2e2..0a6d8822d44f 100644 --- a/include/lldb/Host/posix/HostProcessPosix.h +++ b/include/lldb/Host/posix/HostProcessPosix.h @@ -15,7 +15,7 @@ // Other libraries and framework includes // Project includes #include "lldb/Host/HostNativeProcessBase.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/lldb-types.h" namespace lldb_private { @@ -28,11 +28,11 @@ public: HostProcessPosix(lldb::process_t process); ~HostProcessPosix() override; - virtual Error Signal(int signo) const; - static Error Signal(lldb::process_t process, int signo); + virtual Status Signal(int signo) const; + static Status Signal(lldb::process_t process, int signo); - Error Terminate() override; - Error GetMainModule(FileSpec &file_spec) const override; + Status Terminate() override; + Status GetMainModule(FileSpec &file_spec) const override; lldb::pid_t GetProcessId() const override; bool IsRunning() const override; diff --git a/include/lldb/Host/posix/HostThreadPosix.h b/include/lldb/Host/posix/HostThreadPosix.h index 99b99d767b18..c230a61bc575 100644 --- a/include/lldb/Host/posix/HostThreadPosix.h +++ b/include/lldb/Host/posix/HostThreadPosix.h @@ -22,10 +22,10 @@ public: HostThreadPosix(lldb::thread_t thread); ~HostThreadPosix() override; - Error Join(lldb::thread_result_t *result) override; - Error Cancel() override; + Status Join(lldb::thread_result_t *result) override; + Status Cancel() override; - Error Detach(); + Status Detach(); }; } // namespace lldb_private diff --git a/include/lldb/Host/posix/LockFilePosix.h b/include/lldb/Host/posix/LockFilePosix.h index dde9bd0eefe6..a59a7fe3e729 100644 --- a/include/lldb/Host/posix/LockFilePosix.h +++ b/include/lldb/Host/posix/LockFilePosix.h @@ -20,15 +20,15 @@ public: ~LockFilePosix() override; protected: - Error DoWriteLock(const uint64_t start, const uint64_t len) override; + Status DoWriteLock(const uint64_t start, const uint64_t len) override; - Error DoTryWriteLock(const uint64_t start, const uint64_t len) override; + Status DoTryWriteLock(const uint64_t start, const uint64_t len) override; - Error DoReadLock(const uint64_t start, const uint64_t len) override; + Status DoReadLock(const uint64_t start, const uint64_t len) override; - Error DoTryReadLock(const uint64_t start, const uint64_t len) override; + Status DoTryReadLock(const uint64_t start, const uint64_t len) override; - Error DoUnlock() override; + Status DoUnlock() override; }; } // namespace lldb_private diff --git a/include/lldb/Host/posix/PipePosix.h b/include/lldb/Host/posix/PipePosix.h index 738f95ed0db8..8208b1b8bd6b 100644 --- a/include/lldb/Host/posix/PipePosix.h +++ b/include/lldb/Host/posix/PipePosix.h @@ -35,12 +35,14 @@ public: ~PipePosix() override; - Error CreateNew(bool child_process_inherit) override; - Error CreateNew(llvm::StringRef name, bool child_process_inherit) override; - Error CreateWithUniqueName(llvm::StringRef prefix, bool child_process_inherit, - llvm::SmallVectorImpl<char> &name) override; - Error OpenAsReader(llvm::StringRef name, bool child_process_inherit) override; - Error + Status CreateNew(bool child_process_inherit) override; + Status CreateNew(llvm::StringRef name, bool child_process_inherit) override; + Status CreateWithUniqueName(llvm::StringRef prefix, + bool child_process_inherit, + llvm::SmallVectorImpl<char> &name) override; + Status OpenAsReader(llvm::StringRef name, + bool child_process_inherit) override; + Status OpenAsWriterWithTimeout(llvm::StringRef name, bool child_process_inherit, const std::chrono::microseconds &timeout) override; @@ -57,12 +59,12 @@ public: // Close both descriptors void Close() override; - Error Delete(llvm::StringRef name) override; + Status Delete(llvm::StringRef name) override; - Error Write(const void *buf, size_t size, size_t &bytes_written) override; - Error ReadWithTimeout(void *buf, size_t size, - const std::chrono::microseconds &timeout, - size_t &bytes_read) override; + Status Write(const void *buf, size_t size, size_t &bytes_written) override; + Status ReadWithTimeout(void *buf, size_t size, + const std::chrono::microseconds &timeout, + size_t &bytes_read) override; private: int m_fds[2]; diff --git a/include/lldb/Host/posix/ProcessLauncherPosix.h b/include/lldb/Host/posix/ProcessLauncherPosix.h index e481e3dc7ea9..4800c4066049 100644 --- a/include/lldb/Host/posix/ProcessLauncherPosix.h +++ b/include/lldb/Host/posix/ProcessLauncherPosix.h @@ -17,7 +17,7 @@ namespace lldb_private { class ProcessLauncherPosix : public ProcessLauncher { public: HostProcess LaunchProcess(const ProcessLaunchInfo &launch_info, - Error &error) override; + Status &error) override; }; } diff --git a/include/lldb/Host/posix/ProcessLauncherPosixFork.h b/include/lldb/Host/posix/ProcessLauncherPosixFork.h index 77bdab535c1b..1193a20b4d36 100644 --- a/include/lldb/Host/posix/ProcessLauncherPosixFork.h +++ b/include/lldb/Host/posix/ProcessLauncherPosixFork.h @@ -17,7 +17,7 @@ namespace lldb_private { class ProcessLauncherPosixFork : public ProcessLauncher { public: HostProcess LaunchProcess(const ProcessLaunchInfo &launch_info, - Error &error) override; + Status &error) override; }; } // end of namespace lldb_private diff --git a/include/lldb/Host/windows/ConnectionGenericFileWindows.h b/include/lldb/Host/windows/ConnectionGenericFileWindows.h index 4a5a3858a826..9309288b8c0a 100644 --- a/include/lldb/Host/windows/ConnectionGenericFileWindows.h +++ b/include/lldb/Host/windows/ConnectionGenericFileWindows.h @@ -16,7 +16,7 @@ namespace lldb_private { -class Error; +class Status; class ConnectionGenericFile : public lldb_private::Connection { public: @@ -28,15 +28,15 @@ public: bool IsConnected() const override; - lldb::ConnectionStatus Connect(llvm::StringRef s, Error *error_ptr) override; + lldb::ConnectionStatus Connect(llvm::StringRef s, Status *error_ptr) override; - lldb::ConnectionStatus Disconnect(Error *error_ptr) override; + lldb::ConnectionStatus Disconnect(Status *error_ptr) override; size_t Read(void *dst, size_t dst_len, const Timeout<std::micro> &timeout, - lldb::ConnectionStatus &status, Error *error_ptr) override; + lldb::ConnectionStatus &status, Status *error_ptr) override; size_t Write(const void *src, size_t src_len, lldb::ConnectionStatus &status, - Error *error_ptr) override; + Status *error_ptr) override; std::string GetURI() override; diff --git a/include/lldb/Host/windows/HostProcessWindows.h b/include/lldb/Host/windows/HostProcessWindows.h index 2896c7be793f..4ef35337d70f 100644 --- a/include/lldb/Host/windows/HostProcessWindows.h +++ b/include/lldb/Host/windows/HostProcessWindows.h @@ -25,8 +25,8 @@ public: void SetOwnsHandle(bool owns); - Error Terminate() override; - Error GetMainModule(FileSpec &file_spec) const override; + Status Terminate() override; + Status GetMainModule(FileSpec &file_spec) const override; lldb::pid_t GetProcessId() const override; bool IsRunning() const override; diff --git a/include/lldb/Host/windows/HostThreadWindows.h b/include/lldb/Host/windows/HostThreadWindows.h index 2acc28e29b5c..35d83c0ba2b2 100644 --- a/include/lldb/Host/windows/HostThreadWindows.h +++ b/include/lldb/Host/windows/HostThreadWindows.h @@ -26,8 +26,8 @@ public: void SetOwnsHandle(bool owns); - virtual Error Join(lldb::thread_result_t *result); - virtual Error Cancel(); + virtual Status Join(lldb::thread_result_t *result); + virtual Status Cancel(); virtual void Reset(); lldb::tid_t GetThreadId() const; diff --git a/include/lldb/Host/windows/LockFileWindows.h b/include/lldb/Host/windows/LockFileWindows.h index 9cd1faedc262..10456a1b8b25 100644 --- a/include/lldb/Host/windows/LockFileWindows.h +++ b/include/lldb/Host/windows/LockFileWindows.h @@ -21,15 +21,15 @@ public: ~LockFileWindows(); protected: - Error DoWriteLock(const uint64_t start, const uint64_t len) override; + Status DoWriteLock(const uint64_t start, const uint64_t len) override; - Error DoTryWriteLock(const uint64_t start, const uint64_t len) override; + Status DoTryWriteLock(const uint64_t start, const uint64_t len) override; - Error DoReadLock(const uint64_t start, const uint64_t len) override; + Status DoReadLock(const uint64_t start, const uint64_t len) override; - Error DoTryReadLock(const uint64_t start, const uint64_t len) override; + Status DoTryReadLock(const uint64_t start, const uint64_t len) override; - Error DoUnlock() override; + Status DoUnlock() override; bool IsValidFile() const override; diff --git a/include/lldb/Host/windows/PipeWindows.h b/include/lldb/Host/windows/PipeWindows.h index e9468ffc4153..86dec5a79d8e 100644 --- a/include/lldb/Host/windows/PipeWindows.h +++ b/include/lldb/Host/windows/PipeWindows.h @@ -27,12 +27,14 @@ public: PipeWindows(); ~PipeWindows() override; - Error CreateNew(bool child_process_inherit) override; - Error CreateNew(llvm::StringRef name, bool child_process_inherit) override; - Error CreateWithUniqueName(llvm::StringRef prefix, bool child_process_inherit, - llvm::SmallVectorImpl<char> &name) override; - Error OpenAsReader(llvm::StringRef name, bool child_process_inherit) override; - Error + Status CreateNew(bool child_process_inherit) override; + Status CreateNew(llvm::StringRef name, bool child_process_inherit) override; + Status CreateWithUniqueName(llvm::StringRef prefix, + bool child_process_inherit, + llvm::SmallVectorImpl<char> &name) override; + Status OpenAsReader(llvm::StringRef name, + bool child_process_inherit) override; + Status OpenAsWriterWithTimeout(llvm::StringRef name, bool child_process_inherit, const std::chrono::microseconds &timeout) override; @@ -48,12 +50,12 @@ public: void Close() override; - Error Delete(llvm::StringRef name) override; + Status Delete(llvm::StringRef name) override; - Error Write(const void *buf, size_t size, size_t &bytes_written) override; - Error ReadWithTimeout(void *buf, size_t size, - const std::chrono::microseconds &timeout, - size_t &bytes_read) override; + Status Write(const void *buf, size_t size, size_t &bytes_written) override; + Status ReadWithTimeout(void *buf, size_t size, + const std::chrono::microseconds &timeout, + size_t &bytes_read) override; // PipeWindows specific methods. These allow access to the underlying OS // handle. @@ -61,8 +63,8 @@ public: HANDLE GetWriteNativeHandle(); private: - Error OpenNamedPipe(llvm::StringRef name, bool child_process_inherit, - bool is_read); + Status OpenNamedPipe(llvm::StringRef name, bool child_process_inherit, + bool is_read); HANDLE m_read; HANDLE m_write; diff --git a/include/lldb/Host/windows/ProcessLauncherWindows.h b/include/lldb/Host/windows/ProcessLauncherWindows.h index 9f9e39709375..1df377d5eb88 100644 --- a/include/lldb/Host/windows/ProcessLauncherWindows.h +++ b/include/lldb/Host/windows/ProcessLauncherWindows.h @@ -20,7 +20,7 @@ class ProcessLaunchInfo; class ProcessLauncherWindows : public ProcessLauncher { public: virtual HostProcess LaunchProcess(const ProcessLaunchInfo &launch_info, - Error &error); + Status &error); protected: HANDLE GetStdioHandle(const ProcessLaunchInfo &launch_info, int fd); diff --git a/include/lldb/Interpreter/Args.h b/include/lldb/Interpreter/Args.h index bdbf81e02d9d..98046cd59545 100644 --- a/include/lldb/Interpreter/Args.h +++ b/include/lldb/Interpreter/Args.h @@ -21,7 +21,7 @@ #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/StringRef.h" // Project includes -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/lldb-private-types.h" #include "lldb/lldb-types.h" @@ -322,8 +322,8 @@ public: /// /// @see class Options //------------------------------------------------------------------ - Error ParseOptions(Options &options, ExecutionContext *execution_context, - lldb::PlatformSP platform_sp, bool require_validation); + Status ParseOptions(Options &options, ExecutionContext *execution_context, + lldb::PlatformSP platform_sp, bool require_validation); bool IsPositionalArgument(const char *arg); @@ -377,7 +377,7 @@ public: static lldb::addr_t StringToAddress(const ExecutionContext *exe_ctx, llvm::StringRef s, - lldb::addr_t fail_value, Error *error); + lldb::addr_t fail_value, Status *error); static bool StringToBoolean(llvm::StringRef s, bool fail_value, bool *success_ptr); @@ -387,17 +387,17 @@ public: static int64_t StringToOptionEnum(llvm::StringRef s, OptionEnumValueElement *enum_values, - int32_t fail_value, Error &error); + int32_t fail_value, Status &error); static lldb::ScriptLanguage StringToScriptLanguage(llvm::StringRef s, lldb::ScriptLanguage fail_value, bool *success_ptr); // TODO: Use StringRef - static Error StringToFormat(const char *s, lldb::Format &format, - size_t *byte_size_ptr); // If non-NULL, then a - // byte size can precede - // the format character + static Status StringToFormat(const char *s, lldb::Format &format, + size_t *byte_size_ptr); // If non-NULL, then a + // byte size can precede + // the format character static lldb::Encoding StringToEncoding(llvm::StringRef s, diff --git a/include/lldb/Interpreter/CommandInterpreter.h b/include/lldb/Interpreter/CommandInterpreter.h index 031ea10d6ad4..f47411079a3a 100644 --- a/include/lldb/Interpreter/CommandInterpreter.h +++ b/include/lldb/Interpreter/CommandInterpreter.h @@ -510,7 +510,7 @@ protected: StringList *matches = nullptr) const; private: - Error PreprocessCommand(std::string &command); + Status PreprocessCommand(std::string &command); // Completely resolves aliases and abbreviations, returning a pointer to the // final command object and updating command_line to the fully substituted diff --git a/include/lldb/Interpreter/CommandReturnObject.h b/include/lldb/Interpreter/CommandReturnObject.h index 8e467e118477..7b04c391bc76 100644 --- a/include/lldb/Interpreter/CommandReturnObject.h +++ b/include/lldb/Interpreter/CommandReturnObject.h @@ -129,7 +129,7 @@ public: AppendError(llvm::formatv(format, std::forward<Args>(args)...).str()); } - void SetError(const Error &error, const char *fallback_error_cstr = nullptr); + void SetError(const Status &error, const char *fallback_error_cstr = nullptr); void SetError(llvm::StringRef error_cstr); diff --git a/include/lldb/Interpreter/OptionGroupArchitecture.h b/include/lldb/Interpreter/OptionGroupArchitecture.h index 742cd6d1321d..e73a53421f28 100644 --- a/include/lldb/Interpreter/OptionGroupArchitecture.h +++ b/include/lldb/Interpreter/OptionGroupArchitecture.h @@ -31,8 +31,8 @@ public: llvm::ArrayRef<OptionDefinition> GetDefinitions() override; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, - ExecutionContext *execution_context) override; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, + ExecutionContext *execution_context) override; void OptionParsingStarting(ExecutionContext *execution_context) override; diff --git a/include/lldb/Interpreter/OptionGroupBoolean.h b/include/lldb/Interpreter/OptionGroupBoolean.h index 931a6d73e728..53d08d79d67a 100644 --- a/include/lldb/Interpreter/OptionGroupBoolean.h +++ b/include/lldb/Interpreter/OptionGroupBoolean.h @@ -38,9 +38,9 @@ public: return llvm::ArrayRef<OptionDefinition>(&m_option_definition, 1); } - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, - ExecutionContext *execution_context) override; - Error SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, + ExecutionContext *execution_context) override; + Status SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete; void OptionParsingStarting(ExecutionContext *execution_context) override; diff --git a/include/lldb/Interpreter/OptionGroupFile.h b/include/lldb/Interpreter/OptionGroupFile.h index 93e3ed75d342..d0c25b8bf8e6 100644 --- a/include/lldb/Interpreter/OptionGroupFile.h +++ b/include/lldb/Interpreter/OptionGroupFile.h @@ -37,9 +37,9 @@ public: return llvm::ArrayRef<OptionDefinition>(&m_option_definition, 1); } - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, - ExecutionContext *execution_context) override; - Error SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, + ExecutionContext *execution_context) override; + Status SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete; void OptionParsingStarting(ExecutionContext *execution_context) override; @@ -70,9 +70,9 @@ public: return llvm::ArrayRef<OptionDefinition>(&m_option_definition, 1); } - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, - ExecutionContext *execution_context) override; - Error SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, + ExecutionContext *execution_context) override; + Status SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete; void OptionParsingStarting(ExecutionContext *execution_context) override; diff --git a/include/lldb/Interpreter/OptionGroupFormat.h b/include/lldb/Interpreter/OptionGroupFormat.h index f3a42037afc5..ddf2ccece3bd 100644 --- a/include/lldb/Interpreter/OptionGroupFormat.h +++ b/include/lldb/Interpreter/OptionGroupFormat.h @@ -43,9 +43,9 @@ public: llvm::ArrayRef<OptionDefinition> GetDefinitions() override; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, - ExecutionContext *execution_context) override; - Error SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, + ExecutionContext *execution_context) override; + Status SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete; void OptionParsingStarting(ExecutionContext *execution_context) override; diff --git a/include/lldb/Interpreter/OptionGroupOutputFile.h b/include/lldb/Interpreter/OptionGroupOutputFile.h index cb891f0f7ecb..19453c6215ef 100644 --- a/include/lldb/Interpreter/OptionGroupOutputFile.h +++ b/include/lldb/Interpreter/OptionGroupOutputFile.h @@ -31,9 +31,9 @@ public: llvm::ArrayRef<OptionDefinition> GetDefinitions() override; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, - ExecutionContext *execution_context) override; - Error SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, + ExecutionContext *execution_context) override; + Status SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete; void OptionParsingStarting(ExecutionContext *execution_context) override; diff --git a/include/lldb/Interpreter/OptionGroupPlatform.h b/include/lldb/Interpreter/OptionGroupPlatform.h index 8cee9a671869..e79662400279 100644 --- a/include/lldb/Interpreter/OptionGroupPlatform.h +++ b/include/lldb/Interpreter/OptionGroupPlatform.h @@ -36,15 +36,15 @@ public: llvm::ArrayRef<OptionDefinition> GetDefinitions() override; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, - ExecutionContext *execution_context) override; - Error SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, + ExecutionContext *execution_context) override; + Status SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete; void OptionParsingStarting(ExecutionContext *execution_context) override; lldb::PlatformSP CreatePlatformWithOptions(CommandInterpreter &interpreter, const ArchSpec &arch, - bool make_selected, Error &error, + bool make_selected, Status &error, ArchSpec &platform_arch) const; bool PlatformWasSpecified() const { return !m_platform_name.empty(); } diff --git a/include/lldb/Interpreter/OptionGroupString.h b/include/lldb/Interpreter/OptionGroupString.h index 21bfc08d130f..01e8aa9dc3b6 100644 --- a/include/lldb/Interpreter/OptionGroupString.h +++ b/include/lldb/Interpreter/OptionGroupString.h @@ -35,9 +35,9 @@ public: return llvm::ArrayRef<OptionDefinition>(&m_option_definition, 1); } - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, - ExecutionContext *execution_context) override; - Error SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, + ExecutionContext *execution_context) override; + Status SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete; void OptionParsingStarting(ExecutionContext *execution_context) override; diff --git a/include/lldb/Interpreter/OptionGroupUInt64.h b/include/lldb/Interpreter/OptionGroupUInt64.h index 3f04eac72888..82eb0e26af9b 100644 --- a/include/lldb/Interpreter/OptionGroupUInt64.h +++ b/include/lldb/Interpreter/OptionGroupUInt64.h @@ -36,9 +36,9 @@ public: return llvm::ArrayRef<OptionDefinition>(&m_option_definition, 1); } - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, - ExecutionContext *execution_context) override; - Error SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, + ExecutionContext *execution_context) override; + Status SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete; void OptionParsingStarting(ExecutionContext *execution_context) override; diff --git a/include/lldb/Interpreter/OptionGroupUUID.h b/include/lldb/Interpreter/OptionGroupUUID.h index 9a7c6cf9cffe..def97d5f2551 100644 --- a/include/lldb/Interpreter/OptionGroupUUID.h +++ b/include/lldb/Interpreter/OptionGroupUUID.h @@ -31,9 +31,9 @@ public: llvm::ArrayRef<OptionDefinition> GetDefinitions() override; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, - ExecutionContext *execution_context) override; - Error SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, + ExecutionContext *execution_context) override; + Status SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete; void OptionParsingStarting(ExecutionContext *execution_context) override; diff --git a/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h b/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h index 694464b8b917..0e075773b3f7 100644 --- a/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h +++ b/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h @@ -31,9 +31,9 @@ public: llvm::ArrayRef<OptionDefinition> GetDefinitions() override; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, - ExecutionContext *execution_context) override; - Error SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, + ExecutionContext *execution_context) override; + Status SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete; void OptionParsingStarting(ExecutionContext *execution_context) override; diff --git a/include/lldb/Interpreter/OptionGroupVariable.h b/include/lldb/Interpreter/OptionGroupVariable.h index 0735de45d1a6..c9e90320e141 100644 --- a/include/lldb/Interpreter/OptionGroupVariable.h +++ b/include/lldb/Interpreter/OptionGroupVariable.h @@ -31,9 +31,9 @@ public: llvm::ArrayRef<OptionDefinition> GetDefinitions() override; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, - ExecutionContext *execution_context) override; - Error SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, + ExecutionContext *execution_context) override; + Status SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete; void OptionParsingStarting(ExecutionContext *execution_context) override; diff --git a/include/lldb/Interpreter/OptionGroupWatchpoint.h b/include/lldb/Interpreter/OptionGroupWatchpoint.h index c67c8f071b54..f2665638ba85 100644 --- a/include/lldb/Interpreter/OptionGroupWatchpoint.h +++ b/include/lldb/Interpreter/OptionGroupWatchpoint.h @@ -32,9 +32,9 @@ public: llvm::ArrayRef<OptionDefinition> GetDefinitions() override; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, - ExecutionContext *execution_context) override; - Error SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, + ExecutionContext *execution_context) override; + Status SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete; void OptionParsingStarting(ExecutionContext *execution_context) override; diff --git a/include/lldb/Interpreter/OptionValue.h b/include/lldb/Interpreter/OptionValue.h index 648ad33e2fc8..6008e1ea4411 100644 --- a/include/lldb/Interpreter/OptionValue.h +++ b/include/lldb/Interpreter/OptionValue.h @@ -16,7 +16,7 @@ // Project includes #include "lldb/Core/FormatEntity.h" #include "lldb/Utility/ConstString.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/lldb-defines.h" #include "lldb/lldb-private-enumerations.h" #include "lldb/lldb-private-interfaces.h" @@ -91,7 +91,7 @@ public: virtual void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) = 0; - virtual Error + virtual Status SetValueFromString(llvm::StringRef value, VarSetOperationType op = eVarSetOperationAssign); @@ -108,15 +108,16 @@ public: // Subclasses can override these functions //----------------------------------------------------------------- virtual lldb::OptionValueSP GetSubValue(const ExecutionContext *exe_ctx, - llvm::StringRef name, bool will_modify, - Error &error) const { + llvm::StringRef name, + bool will_modify, + Status &error) const { error.SetErrorStringWithFormat("'%s' is not a value subvalue", name.str().c_str()); return lldb::OptionValueSP(); } - virtual Error SetSubValue(const ExecutionContext *exe_ctx, - VarSetOperationType op, llvm::StringRef name, - llvm::StringRef value); + virtual Status SetSubValue(const ExecutionContext *exe_ctx, + VarSetOperationType op, llvm::StringRef name, + llvm::StringRef value); virtual bool IsAggregateValue() const { return false; } @@ -180,7 +181,7 @@ public: static lldb::OptionValueSP CreateValueFromCStringForTypeMask(const char *value_cstr, uint32_t type_mask, - Error &error); + Status &error); // Get this value as a uint64_t value if it is encoded as a boolean, // uint64_t or int64_t. Other types will cause "fail_value" to be diff --git a/include/lldb/Interpreter/OptionValueArch.h b/include/lldb/Interpreter/OptionValueArch.h index aa548124e2d6..e1a354d4ae21 100644 --- a/include/lldb/Interpreter/OptionValueArch.h +++ b/include/lldb/Interpreter/OptionValueArch.h @@ -46,10 +46,10 @@ public: void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - Error + Status SetValueFromString(llvm::StringRef value, VarSetOperationType op = eVarSetOperationAssign) override; - Error + Status SetValueFromString(const char *, VarSetOperationType = eVarSetOperationAssign) = delete; diff --git a/include/lldb/Interpreter/OptionValueArray.h b/include/lldb/Interpreter/OptionValueArray.h index 1e568cac402d..bbf4e371a893 100644 --- a/include/lldb/Interpreter/OptionValueArray.h +++ b/include/lldb/Interpreter/OptionValueArray.h @@ -36,10 +36,10 @@ public: void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - Error + Status SetValueFromString(llvm::StringRef value, VarSetOperationType op = eVarSetOperationAssign) override; - Error + Status SetValueFromString(const char *, VarSetOperationType = eVarSetOperationAssign) = delete; @@ -55,7 +55,7 @@ public: lldb::OptionValueSP GetSubValue(const ExecutionContext *exe_ctx, llvm::StringRef name, bool will_modify, - Error &error) const override; + Status &error) const override; //--------------------------------------------------------------------- // Subclass specific functions @@ -122,7 +122,7 @@ public: size_t GetArgs(Args &args) const; - Error SetArgs(const Args &args, VarSetOperationType op); + Status SetArgs(const Args &args, VarSetOperationType op); protected: typedef std::vector<lldb::OptionValueSP> collection; diff --git a/include/lldb/Interpreter/OptionValueBoolean.h b/include/lldb/Interpreter/OptionValueBoolean.h index d429c0577ecb..1ff84dd3367d 100644 --- a/include/lldb/Interpreter/OptionValueBoolean.h +++ b/include/lldb/Interpreter/OptionValueBoolean.h @@ -37,10 +37,10 @@ public: void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - Error + Status SetValueFromString(llvm::StringRef value, VarSetOperationType op = eVarSetOperationAssign) override; - Error + Status SetValueFromString(const char *, VarSetOperationType = eVarSetOperationAssign) = delete; diff --git a/include/lldb/Interpreter/OptionValueChar.h b/include/lldb/Interpreter/OptionValueChar.h index d18644700573..0c5f602efe9b 100644 --- a/include/lldb/Interpreter/OptionValueChar.h +++ b/include/lldb/Interpreter/OptionValueChar.h @@ -38,10 +38,10 @@ public: void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - Error + Status SetValueFromString(llvm::StringRef value, VarSetOperationType op = eVarSetOperationAssign) override; - Error + Status SetValueFromString(const char *, VarSetOperationType = eVarSetOperationAssign) = delete; diff --git a/include/lldb/Interpreter/OptionValueDictionary.h b/include/lldb/Interpreter/OptionValueDictionary.h index 5d015a55a8f9..4e8c86008ea4 100644 --- a/include/lldb/Interpreter/OptionValueDictionary.h +++ b/include/lldb/Interpreter/OptionValueDictionary.h @@ -38,7 +38,7 @@ public: void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - Error + Status SetValueFromString(llvm::StringRef value, VarSetOperationType op = eVarSetOperationAssign) override; @@ -66,10 +66,10 @@ public: lldb::OptionValueSP GetSubValue(const ExecutionContext *exe_ctx, llvm::StringRef name, bool will_modify, - Error &error) const override; + Status &error) const override; - Error SetSubValue(const ExecutionContext *exe_ctx, VarSetOperationType op, - llvm::StringRef name, llvm::StringRef value) override; + Status SetSubValue(const ExecutionContext *exe_ctx, VarSetOperationType op, + llvm::StringRef name, llvm::StringRef value) override; bool SetValueForKey(const ConstString &key, const lldb::OptionValueSP &value_sp, @@ -79,7 +79,7 @@ public: size_t GetArgs(Args &args) const; - Error SetArgs(const Args &args, VarSetOperationType op); + Status SetArgs(const Args &args, VarSetOperationType op); protected: typedef std::map<ConstString, lldb::OptionValueSP> collection; diff --git a/include/lldb/Interpreter/OptionValueEnumeration.h b/include/lldb/Interpreter/OptionValueEnumeration.h index d47248b72c67..4aa8823e620f 100644 --- a/include/lldb/Interpreter/OptionValueEnumeration.h +++ b/include/lldb/Interpreter/OptionValueEnumeration.h @@ -13,7 +13,7 @@ #include "lldb/Core/UniqueCStringMap.h" #include "lldb/Interpreter/OptionValue.h" #include "lldb/Utility/ConstString.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/Stream.h" #include "lldb/Utility/StreamString.h" #include "lldb/lldb-private-types.h" @@ -44,10 +44,10 @@ public: void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - Error + Status SetValueFromString(llvm::StringRef value, VarSetOperationType op = eVarSetOperationAssign) override; - Error + Status SetValueFromString(const char *, VarSetOperationType = eVarSetOperationAssign) = delete; diff --git a/include/lldb/Interpreter/OptionValueFileSpec.h b/include/lldb/Interpreter/OptionValueFileSpec.h index 654c04d4d274..b53c03471e2b 100644 --- a/include/lldb/Interpreter/OptionValueFileSpec.h +++ b/include/lldb/Interpreter/OptionValueFileSpec.h @@ -37,10 +37,10 @@ public: void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - Error + Status SetValueFromString(llvm::StringRef value, VarSetOperationType op = eVarSetOperationAssign) override; - Error + Status SetValueFromString(const char *, VarSetOperationType = eVarSetOperationAssign) = delete; diff --git a/include/lldb/Interpreter/OptionValueFileSpecList.h b/include/lldb/Interpreter/OptionValueFileSpecList.h index 1e42362c9163..9529fbcf38bc 100644 --- a/include/lldb/Interpreter/OptionValueFileSpecList.h +++ b/include/lldb/Interpreter/OptionValueFileSpecList.h @@ -37,10 +37,10 @@ public: void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - Error + Status SetValueFromString(llvm::StringRef value, VarSetOperationType op = eVarSetOperationAssign) override; - Error + Status SetValueFromString(const char *, VarSetOperationType = eVarSetOperationAssign) = delete; diff --git a/include/lldb/Interpreter/OptionValueFormat.h b/include/lldb/Interpreter/OptionValueFormat.h index 5351aeca0627..ce7997024b09 100644 --- a/include/lldb/Interpreter/OptionValueFormat.h +++ b/include/lldb/Interpreter/OptionValueFormat.h @@ -38,10 +38,10 @@ public: void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - Error + Status SetValueFromString(llvm::StringRef value, VarSetOperationType op = eVarSetOperationAssign) override; - Error + Status SetValueFromString(const char *, VarSetOperationType = eVarSetOperationAssign) = delete; diff --git a/include/lldb/Interpreter/OptionValueFormatEntity.h b/include/lldb/Interpreter/OptionValueFormatEntity.h index 472cd9ee4f92..e5a65b7e7eb6 100644 --- a/include/lldb/Interpreter/OptionValueFormatEntity.h +++ b/include/lldb/Interpreter/OptionValueFormatEntity.h @@ -34,10 +34,10 @@ public: void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - Error + Status SetValueFromString(llvm::StringRef value, VarSetOperationType op = eVarSetOperationAssign) override; - Error + Status SetValueFromString(const char *, VarSetOperationType = eVarSetOperationAssign) = delete; diff --git a/include/lldb/Interpreter/OptionValueLanguage.h b/include/lldb/Interpreter/OptionValueLanguage.h index a388a6a92eaf..8f81c5df0739 100644 --- a/include/lldb/Interpreter/OptionValueLanguage.h +++ b/include/lldb/Interpreter/OptionValueLanguage.h @@ -41,10 +41,10 @@ public: void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - Error + Status SetValueFromString(llvm::StringRef value, VarSetOperationType op = eVarSetOperationAssign) override; - Error + Status SetValueFromString(const char *, VarSetOperationType = eVarSetOperationAssign) = delete; diff --git a/include/lldb/Interpreter/OptionValuePathMappings.h b/include/lldb/Interpreter/OptionValuePathMappings.h index d5336aafc993..0e2e98d74b74 100644 --- a/include/lldb/Interpreter/OptionValuePathMappings.h +++ b/include/lldb/Interpreter/OptionValuePathMappings.h @@ -35,10 +35,10 @@ public: void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - Error + Status SetValueFromString(llvm::StringRef value, VarSetOperationType op = eVarSetOperationAssign) override; - Error + Status SetValueFromString(const char *, VarSetOperationType = eVarSetOperationAssign) = delete; diff --git a/include/lldb/Interpreter/OptionValueProperties.h b/include/lldb/Interpreter/OptionValueProperties.h index 0b49e0b00672..16d31aa4ea90 100644 --- a/include/lldb/Interpreter/OptionValueProperties.h +++ b/include/lldb/Interpreter/OptionValueProperties.h @@ -43,7 +43,7 @@ public: lldb::OptionValueSP DeepCopy() const override; - Error + Status SetValueFromString(llvm::StringRef value, VarSetOperationType op = eVarSetOperationAssign) override; @@ -52,9 +52,9 @@ public: ConstString GetName() const override { return m_name; } - 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 DumpAllDescriptions(CommandInterpreter &interpreter, Stream &strm) const; @@ -110,11 +110,12 @@ public: bool value_will_be_modified) const; lldb::OptionValueSP GetSubValue(const ExecutionContext *exe_ctx, - llvm::StringRef name, bool value_will_be_modified, - Error &error) const override; + llvm::StringRef name, + bool value_will_be_modified, + Status &error) const override; - Error SetSubValue(const ExecutionContext *exe_ctx, VarSetOperationType op, - llvm::StringRef path, llvm::StringRef value) override; + Status SetSubValue(const ExecutionContext *exe_ctx, VarSetOperationType op, + llvm::StringRef path, llvm::StringRef value) override; virtual bool PredicateMatches(const ExecutionContext *exe_ctx, llvm::StringRef predicate) const { diff --git a/include/lldb/Interpreter/OptionValueRegex.h b/include/lldb/Interpreter/OptionValueRegex.h index 7bb8d419bde0..afe9318ae014 100644 --- a/include/lldb/Interpreter/OptionValueRegex.h +++ b/include/lldb/Interpreter/OptionValueRegex.h @@ -35,10 +35,10 @@ public: void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - Error + Status SetValueFromString(llvm::StringRef value, VarSetOperationType op = eVarSetOperationAssign) override; - Error + Status SetValueFromString(const char *, VarSetOperationType = eVarSetOperationAssign) = delete; diff --git a/include/lldb/Interpreter/OptionValueSInt64.h b/include/lldb/Interpreter/OptionValueSInt64.h index 1e1647866873..a6893d23e692 100644 --- a/include/lldb/Interpreter/OptionValueSInt64.h +++ b/include/lldb/Interpreter/OptionValueSInt64.h @@ -50,10 +50,10 @@ public: void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - Error + Status SetValueFromString(llvm::StringRef value, VarSetOperationType op = eVarSetOperationAssign) override; - Error + Status SetValueFromString(const char *, VarSetOperationType = eVarSetOperationAssign) = delete; diff --git a/include/lldb/Interpreter/OptionValueString.h b/include/lldb/Interpreter/OptionValueString.h index 18b8215fe3c7..4a9f2227680e 100644 --- a/include/lldb/Interpreter/OptionValueString.h +++ b/include/lldb/Interpreter/OptionValueString.h @@ -24,7 +24,7 @@ namespace lldb_private { class OptionValueString : public OptionValue { public: - typedef Error (*ValidatorCallback)(const char *string, void *baton); + typedef Status (*ValidatorCallback)(const char *string, void *baton); enum Options { eOptionEncodeCharacterEscapeSequences = (1u << 0) }; @@ -85,10 +85,10 @@ public: void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - Error + Status SetValueFromString(llvm::StringRef value, VarSetOperationType op = eVarSetOperationAssign) override; - Error + Status SetValueFromString(const char *, VarSetOperationType = eVarSetOperationAssign) = delete; @@ -119,10 +119,10 @@ public: const char *GetDefaultValue() const { return m_default_value.c_str(); } llvm::StringRef GetDefaultValueAsRef() const { return m_default_value; } - Error SetCurrentValue(const char *) = delete; - Error SetCurrentValue(llvm::StringRef value); + Status SetCurrentValue(const char *) = delete; + Status SetCurrentValue(llvm::StringRef value); - Error AppendToCurrentValue(const char *value); + Status AppendToCurrentValue(const char *value); void SetDefaultValue(const char *value) { if (value && value[0]) diff --git a/include/lldb/Interpreter/OptionValueUInt64.h b/include/lldb/Interpreter/OptionValueUInt64.h index cbf932b1bda4..be13ff073721 100644 --- a/include/lldb/Interpreter/OptionValueUInt64.h +++ b/include/lldb/Interpreter/OptionValueUInt64.h @@ -38,8 +38,8 @@ public: // string isn't a uint64_t value or any other error occurs, return an // empty lldb::OptionValueSP and fill error in with the correct stuff. //--------------------------------------------------------------------- - static lldb::OptionValueSP Create(const char *, Error &) = delete; - static lldb::OptionValueSP Create(llvm::StringRef value_str, Error &error); + static lldb::OptionValueSP Create(const char *, Status &) = delete; + static lldb::OptionValueSP Create(llvm::StringRef value_str, Status &error); //--------------------------------------------------------------------- // Virtual subclass pure virtual overrides //--------------------------------------------------------------------- @@ -49,10 +49,10 @@ public: void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - Error + Status SetValueFromString(llvm::StringRef value, VarSetOperationType op = eVarSetOperationAssign) override; - Error + Status SetValueFromString(const char *, VarSetOperationType = eVarSetOperationAssign) = delete; diff --git a/include/lldb/Interpreter/OptionValueUUID.h b/include/lldb/Interpreter/OptionValueUUID.h index 62c25859580c..6e0aeebb0e99 100644 --- a/include/lldb/Interpreter/OptionValueUUID.h +++ b/include/lldb/Interpreter/OptionValueUUID.h @@ -36,10 +36,10 @@ public: void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - Error + Status SetValueFromString(llvm::StringRef value, VarSetOperationType op = eVarSetOperationAssign) override; - Error + Status SetValueFromString(const char *, VarSetOperationType = eVarSetOperationAssign) = delete; diff --git a/include/lldb/Interpreter/Options.h b/include/lldb/Interpreter/Options.h index fc5ff972da46..87121005575a 100644 --- a/include/lldb/Interpreter/Options.h +++ b/include/lldb/Interpreter/Options.h @@ -38,7 +38,7 @@ static inline bool isprint8(int ch) { /// Options is designed to be subclassed to contain all needed /// options for a given command. The options can be parsed by calling: /// \code -/// Error Args::ParseOptions (Options &); +/// Status Args::ParseOptions (Options &); /// \endcode /// /// The options are specified using the format defined for the libc @@ -62,11 +62,11 @@ static inline bool isprint8(int ch) { /// return g_options; /// } /// -/// virtual Error +/// virtual Status /// SetOptionValue (uint32_t option_idx, int option_val, const char /// *option_arg) /// { -/// Error error; +/// Status error; /// switch (option_val) /// { /// case 'g': debug = true; break; @@ -171,7 +171,7 @@ public: // prone and subclasses shouldn't have to do it. void NotifyOptionParsingStarting(ExecutionContext *execution_context); - Error NotifyOptionParsingFinished(ExecutionContext *execution_context); + Status NotifyOptionParsingFinished(ExecutionContext *execution_context); //------------------------------------------------------------------ /// Set the value of an option. @@ -192,8 +192,8 @@ public: /// @see Args::ParseOptions (Options&) /// @see man getopt_long_only //------------------------------------------------------------------ - virtual Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) = 0; + virtual Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) = 0; //------------------------------------------------------------------ /// Handles the generic bits of figuring out whether we are in an @@ -324,10 +324,10 @@ protected: // all option settings to default values. virtual void OptionParsingStarting(ExecutionContext *execution_context) = 0; - virtual Error OptionParsingFinished(ExecutionContext *execution_context) { + virtual Status OptionParsingFinished(ExecutionContext *execution_context) { // If subclasses need to know when the options are done being parsed // they can implement this function to do extra checking - Error error; + Status error; return error; } }; @@ -340,16 +340,16 @@ public: virtual llvm::ArrayRef<OptionDefinition> GetDefinitions() = 0; - virtual Error SetOptionValue(uint32_t option_idx, - llvm::StringRef option_value, - ExecutionContext *execution_context) = 0; + virtual Status SetOptionValue(uint32_t option_idx, + llvm::StringRef option_value, + ExecutionContext *execution_context) = 0; virtual void OptionParsingStarting(ExecutionContext *execution_context) = 0; - virtual Error OptionParsingFinished(ExecutionContext *execution_context) { + virtual Status OptionParsingFinished(ExecutionContext *execution_context) { // If subclasses need to know when the options are done being parsed // they can implement this function to do extra checking - Error error; + Status error; return error; } }; @@ -401,12 +401,12 @@ public: bool DidFinalize() { return m_did_finalize; } - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override; void OptionParsingStarting(ExecutionContext *execution_context) override; - Error OptionParsingFinished(ExecutionContext *execution_context) override; + Status OptionParsingFinished(ExecutionContext *execution_context) override; llvm::ArrayRef<OptionDefinition> GetDefinitions() override { assert(m_did_finalize); diff --git a/include/lldb/Interpreter/ScriptInterpreter.h b/include/lldb/Interpreter/ScriptInterpreter.h index 271a5bba761e..01b342ae41ca 100644 --- a/include/lldb/Interpreter/ScriptInterpreter.h +++ b/include/lldb/Interpreter/ScriptInterpreter.h @@ -20,7 +20,7 @@ #include "lldb/Core/Broadcaster.h" #include "lldb/Core/PluginInterface.h" #include "lldb/Core/StructuredData.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/Host/PseudoTerminal.h" @@ -107,24 +107,24 @@ public: return true; } - virtual Error ExecuteMultipleLines( + virtual Status ExecuteMultipleLines( const char *in_string, const ExecuteScriptOptions &options = ExecuteScriptOptions()) { - Error error; + Status error; error.SetErrorString("not implemented"); return error; } - virtual Error + virtual Status ExportFunctionDefinitionToInterpreter(StringList &function_def) { - Error error; + Status error; error.SetErrorString("not implemented"); return error; } - virtual Error GenerateBreakpointCommandCallbackData(StringList &input, - std::string &output) { - Error error; + virtual Status GenerateBreakpointCommandCallbackData(StringList &input, + std::string &output) { + Status error; error.SetErrorString("not implemented"); return error; } @@ -235,19 +235,19 @@ public: } virtual StructuredData::ObjectSP - LoadPluginModule(const FileSpec &file_spec, lldb_private::Error &error) { + LoadPluginModule(const FileSpec &file_spec, lldb_private::Status &error) { return StructuredData::ObjectSP(); } virtual StructuredData::DictionarySP GetDynamicSettings(StructuredData::ObjectSP plugin_module_sp, Target *target, - const char *setting_name, lldb_private::Error &error) { + const char *setting_name, lldb_private::Status &error) { return StructuredData::DictionarySP(); } - virtual Error GenerateFunction(const char *signature, - const StringList &input) { - Error error; + virtual Status GenerateFunction(const char *signature, + const StringList &input) { + Status error; error.SetErrorString("unimplemented"); return error; } @@ -260,22 +260,22 @@ public: CommandReturnObject &result); /// Set the specified text as the callback for the breakpoint. - Error + Status SetBreakpointCommandCallback(std::vector<BreakpointOptions *> &bp_options_vec, const char *callback_text); - virtual Error SetBreakpointCommandCallback(BreakpointOptions *bp_options, - const char *callback_text) { - Error error; + virtual Status SetBreakpointCommandCallback(BreakpointOptions *bp_options, + const char *callback_text) { + Status error; error.SetErrorString("unimplemented"); return error; } /// This one is for deserialization: - virtual Error SetBreakpointCommandCallback( + virtual Status SetBreakpointCommandCallback( BreakpointOptions *bp_options, std::unique_ptr<BreakpointOptions::CommandData> &data_up) { - Error error; + Status error; error.SetErrorString("unimplemented"); return error; } @@ -346,7 +346,7 @@ public: RunScriptBasedCommand(const char *impl_function, const char *args, ScriptedCommandSynchronicity synchronicity, lldb_private::CommandReturnObject &cmd_retobj, - Error &error, + Status &error, const lldb_private::ExecutionContext &exe_ctx) { return false; } @@ -355,40 +355,40 @@ public: RunScriptBasedCommand(StructuredData::GenericSP impl_obj_sp, const char *args, ScriptedCommandSynchronicity synchronicity, lldb_private::CommandReturnObject &cmd_retobj, - Error &error, + Status &error, const lldb_private::ExecutionContext &exe_ctx) { return false; } virtual bool RunScriptFormatKeyword(const char *impl_function, Process *process, std::string &output, - Error &error) { + Status &error) { error.SetErrorString("unimplemented"); return false; } virtual bool RunScriptFormatKeyword(const char *impl_function, Thread *thread, - std::string &output, Error &error) { + std::string &output, Status &error) { error.SetErrorString("unimplemented"); return false; } virtual bool RunScriptFormatKeyword(const char *impl_function, Target *target, - std::string &output, Error &error) { + std::string &output, Status &error) { error.SetErrorString("unimplemented"); return false; } virtual bool RunScriptFormatKeyword(const char *impl_function, StackFrame *frame, std::string &output, - Error &error) { + Status &error) { error.SetErrorString("unimplemented"); return false; } virtual bool RunScriptFormatKeyword(const char *impl_function, ValueObject *value, std::string &output, - Error &error) { + Status &error) { error.SetErrorString("unimplemented"); return false; } @@ -420,7 +420,7 @@ public: virtual bool LoadScriptingModule(const char *filename, bool can_reload, bool init_session, - lldb_private::Error &error, + lldb_private::Status &error, StructuredData::ObjectSP *module_sp = nullptr) { error.SetErrorString("loading unimplemented"); return false; diff --git a/include/lldb/Symbol/ClangASTContext.h b/include/lldb/Symbol/ClangASTContext.h index ef1659159697..9d0a08414e93 100644 --- a/include/lldb/Symbol/ClangASTContext.h +++ b/include/lldb/Symbol/ClangASTContext.h @@ -275,17 +275,16 @@ public: bool IsValid() const { if (args.empty()) return false; - return args.size() == names.size(); - } - - size_t GetSize() const { - if (IsValid()) - return args.size(); - return 0; + return args.size() == names.size() && + ((bool)pack_name == (bool)packed_args) && + (!packed_args || !packed_args->packed_args); } llvm::SmallVector<const char *, 2> names; llvm::SmallVector<clang::TemplateArgument, 2> args; + + const char * pack_name = nullptr; + std::unique_ptr<TemplateParameterInfos> packed_args; }; clang::FunctionTemplateDecl * diff --git a/include/lldb/Symbol/ObjectFile.h b/include/lldb/Symbol/ObjectFile.h index 296c9ff2129f..a4c7b01ece17 100644 --- a/include/lldb/Symbol/ObjectFile.h +++ b/include/lldb/Symbol/ObjectFile.h @@ -826,7 +826,7 @@ public: /// /// @return //------------------------------------------------------------------ - virtual Error LoadInMemory(Target &target, bool set_pc); + virtual Status LoadInMemory(Target &target, bool set_pc); protected: //------------------------------------------------------------------ diff --git a/include/lldb/Symbol/SymbolContext.h b/include/lldb/Symbol/SymbolContext.h index 2ca3fdb71286..e4dcc73bb52b 100644 --- a/include/lldb/Symbol/SymbolContext.h +++ b/include/lldb/Symbol/SymbolContext.h @@ -234,7 +234,7 @@ public: bool use_inline_block_range, AddressRange &range) const; bool GetAddressRangeFromHereToEndLine(uint32_t end_line, AddressRange &range, - Error &error); + Status &error); void GetDescription(Stream *s, lldb::DescriptionLevel level, Target *target) const; diff --git a/include/lldb/Symbol/Variable.h b/include/lldb/Symbol/Variable.h index f076a04434e1..507b41309042 100644 --- a/include/lldb/Symbol/Variable.h +++ b/include/lldb/Symbol/Variable.h @@ -97,7 +97,7 @@ public: typedef size_t (*GetVariableCallback)(void *baton, const char *name, VariableList &var_list); - static Error GetValuesForVariableExpressionPath( + static Status GetValuesForVariableExpressionPath( llvm::StringRef variable_expr_path, ExecutionContextScope *scope, GetVariableCallback callback, void *baton, VariableList &variable_list, ValueObjectList &valobj_list); diff --git a/include/lldb/Target/ABI.h b/include/lldb/Target/ABI.h index 4b611d244e21..a8e08e1a800a 100644 --- a/include/lldb/Target/ABI.h +++ b/include/lldb/Target/ABI.h @@ -16,7 +16,7 @@ // Project includes #include "lldb/Core/PluginInterface.h" #include "lldb/Symbol/UnwindPlan.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/lldb-private.h" #include "llvm/ADT/ArrayRef.h" @@ -77,8 +77,8 @@ public: bool persistent = true) const; // Set the Return value object in the current frame as though a function with - virtual Error SetReturnValueObject(lldb::StackFrameSP &frame_sp, - lldb::ValueObjectSP &new_value) = 0; + virtual Status SetReturnValueObject(lldb::StackFrameSP &frame_sp, + lldb::ValueObjectSP &new_value) = 0; protected: // This is the method the ABI will call to actually calculate the return diff --git a/include/lldb/Target/DynamicLoader.h b/include/lldb/Target/DynamicLoader.h index ced6ef44000a..b5890662d4e5 100644 --- a/include/lldb/Target/DynamicLoader.h +++ b/include/lldb/Target/DynamicLoader.h @@ -12,8 +12,8 @@ // Project includes #include "lldb/Core/PluginInterface.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/FileSpec.h" // for FileSpec +#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 @@ -213,7 +213,7 @@ public: /// \b true if it is currently ok to try and load a shared /// library into the process, \b false otherwise. //------------------------------------------------------------------ - virtual Error CanLoadImage() = 0; + virtual Status CanLoadImage() = 0; //------------------------------------------------------------------ /// Ask if the eh_frame information for the given SymbolContext should diff --git a/include/lldb/Target/Language.h b/include/lldb/Target/Language.h index bcf840f93edd..f81679f78129 100644 --- a/include/lldb/Target/Language.h +++ b/include/lldb/Target/Language.h @@ -199,7 +199,7 @@ public: // it should return an appropriate closure here virtual DumpValueObjectOptions::DeclPrintingHelper GetDeclPrintingHelper(); - virtual LazyBool IsLogicalTrue(ValueObject &valobj, Error &error); + virtual LazyBool IsLogicalTrue(ValueObject &valobj, Status &error); // for a ValueObject of some "reference type", if the value points to the // nil/null object, this method returns true diff --git a/include/lldb/Target/LanguageRuntime.h b/include/lldb/Target/LanguageRuntime.h index a57216e84794..98db941669c7 100644 --- a/include/lldb/Target/LanguageRuntime.h +++ b/include/lldb/Target/LanguageRuntime.h @@ -48,7 +48,7 @@ public: static SearchFilter * CreateFromStructuredData(Target &target, const StructuredData::Dictionary &data_dict, - Error &error); + Status &error); StructuredData::ObjectSP SerializeToStructuredData() override; diff --git a/include/lldb/Target/Memory.h b/include/lldb/Target/Memory.h index f0a4bc5881f0..af6be15df9fb 100644 --- a/include/lldb/Target/Memory.h +++ b/include/lldb/Target/Memory.h @@ -40,7 +40,7 @@ public: void Flush(lldb::addr_t addr, size_t size); - size_t Read(lldb::addr_t addr, void *dst, size_t dst_len, Error &error); + size_t Read(lldb::addr_t addr, void *dst, size_t dst_len, Status &error); uint32_t GetMemoryCacheLineSize() const { return m_L2_cache_line_byte_size; } @@ -135,7 +135,7 @@ public: void Clear(); lldb::addr_t AllocateMemory(size_t byte_size, uint32_t permissions, - Error &error); + Status &error); bool DeallocateMemory(lldb::addr_t ptr); @@ -143,7 +143,7 @@ protected: typedef std::shared_ptr<AllocatedBlock> AllocatedBlockSP; AllocatedBlockSP AllocatePage(uint32_t byte_size, uint32_t permissions, - uint32_t chunk_size, Error &error); + uint32_t chunk_size, Status &error); //------------------------------------------------------------------ // Classes that inherit from MemoryCache can see and modify these diff --git a/include/lldb/Target/ModuleCache.h b/include/lldb/Target/ModuleCache.h index 49a7c97c60c3..4959ee8ea0a3 100644 --- a/include/lldb/Target/ModuleCache.h +++ b/include/lldb/Target/ModuleCache.h @@ -14,8 +14,8 @@ #include "lldb/lldb-types.h" #include "lldb/Host/File.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/FileSpec.h" +#include "lldb/Utility/Status.h" #include <functional> #include <string> @@ -49,24 +49,24 @@ class UUID; class ModuleCache { public: using ModuleDownloader = - std::function<Error(const ModuleSpec &, const FileSpec &)>; + std::function<Status(const ModuleSpec &, const FileSpec &)>; using SymfileDownloader = - std::function<Error(const lldb::ModuleSP &, const FileSpec &)>; + std::function<Status(const lldb::ModuleSP &, const FileSpec &)>; - Error GetAndPut(const FileSpec &root_dir_spec, const char *hostname, - const ModuleSpec &module_spec, - const ModuleDownloader &module_downloader, - const SymfileDownloader &symfile_downloader, - lldb::ModuleSP &cached_module_sp, bool *did_create_ptr); + Status GetAndPut(const FileSpec &root_dir_spec, const char *hostname, + const ModuleSpec &module_spec, + const ModuleDownloader &module_downloader, + const SymfileDownloader &symfile_downloader, + lldb::ModuleSP &cached_module_sp, bool *did_create_ptr); private: - Error Put(const FileSpec &root_dir_spec, const char *hostname, - const ModuleSpec &module_spec, const FileSpec &tmp_file, - const FileSpec &target_file); + Status Put(const FileSpec &root_dir_spec, const char *hostname, + const ModuleSpec &module_spec, const FileSpec &tmp_file, + const FileSpec &target_file); - Error Get(const FileSpec &root_dir_spec, const char *hostname, - const ModuleSpec &module_spec, lldb::ModuleSP &cached_module_sp, - bool *did_create_ptr); + Status Get(const FileSpec &root_dir_spec, const char *hostname, + const ModuleSpec &module_spec, lldb::ModuleSP &cached_module_sp, + bool *did_create_ptr); std::unordered_map<std::string, lldb::ModuleWP> m_loaded_modules; }; diff --git a/include/lldb/Target/ObjCLanguageRuntime.h b/include/lldb/Target/ObjCLanguageRuntime.h index 0a9ffa933bd1..97a2a731581a 100644 --- a/include/lldb/Target/ObjCLanguageRuntime.h +++ b/include/lldb/Target/ObjCLanguageRuntime.h @@ -168,7 +168,7 @@ public: bool EvaluatePrecondition(StoppointCallbackContext &context) override; void GetDescription(Stream &stream, lldb::DescriptionLevel level) override; - Error ConfigurePrecondition(Args &args) override; + Status ConfigurePrecondition(Args &args) override; protected: void AddClassName(const char *class_name); diff --git a/include/lldb/Target/PathMappingList.h b/include/lldb/Target/PathMappingList.h index 2b844882e4ad..b1b551f2d24d 100644 --- a/include/lldb/Target/PathMappingList.h +++ b/include/lldb/Target/PathMappingList.h @@ -16,7 +16,7 @@ #include <vector> // Other libraries and framework includes #include "lldb/Utility/ConstString.h" -#include "lldb/Utility/Error.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 fb05d3e06dd5..cc007d959c65 100644 --- a/include/lldb/Target/Platform.h +++ b/include/lldb/Target/Platform.h @@ -111,10 +111,10 @@ public: // Find an existing platform plug-in by name static lldb::PlatformSP Find(const ConstString &name); - static lldb::PlatformSP Create(const ConstString &name, Error &error); + static lldb::PlatformSP Create(const ConstString &name, Status &error); static lldb::PlatformSP Create(const ArchSpec &arch, - ArchSpec *platform_arch_ptr, Error &error); + ArchSpec *platform_arch_ptr, Status &error); static uint32_t GetNumConnectedRemotePlatforms(); @@ -156,9 +156,9 @@ public: /// Returns \b true if this Platform plug-in was able to find /// a suitable executable, \b false otherwise. //------------------------------------------------------------------ - virtual Error ResolveExecutable(const ModuleSpec &module_spec, - lldb::ModuleSP &module_sp, - const FileSpecList *module_search_paths_ptr); + virtual Status ResolveExecutable(const ModuleSpec &module_spec, + lldb::ModuleSP &module_sp, + const FileSpecList *module_search_paths_ptr); //------------------------------------------------------------------ /// Find a symbol file given a symbol file module specification. @@ -207,8 +207,8 @@ public: /// @return /// Returns an error that describes success or failure. //------------------------------------------------------------------ - virtual Error ResolveSymbolFile(Target &target, const ModuleSpec &sym_spec, - FileSpec &sym_file); + virtual Status ResolveSymbolFile(Target &target, const ModuleSpec &sym_spec, + FileSpec &sym_file); //------------------------------------------------------------------ /// Resolves the FileSpec to a (possibly) remote path. Remote @@ -316,8 +316,8 @@ public: /// @return /// An error object. //------------------------------------------------------------------ - virtual Error GetFileWithUUID(const FileSpec &platform_file, - const UUID *uuid_ptr, FileSpec &local_file); + virtual Status GetFileWithUUID(const FileSpec &platform_file, + const UUID *uuid_ptr, FileSpec &local_file); //---------------------------------------------------------------------- // Locate the scripting resource given a module specification. @@ -329,18 +329,18 @@ public: LocateExecutableScriptingResources(Target *target, Module &module, Stream *feedback_stream); - virtual Error GetSharedModule(const ModuleSpec &module_spec, Process *process, - lldb::ModuleSP &module_sp, - const FileSpecList *module_search_paths_ptr, - lldb::ModuleSP *old_module_sp_ptr, - bool *did_create_ptr); + virtual Status GetSharedModule(const ModuleSpec &module_spec, + Process *process, lldb::ModuleSP &module_sp, + const FileSpecList *module_search_paths_ptr, + lldb::ModuleSP *old_module_sp_ptr, + bool *did_create_ptr); virtual bool GetModuleSpec(const FileSpec &module_file_spec, const ArchSpec &arch, ModuleSpec &module_spec); - virtual Error ConnectRemote(Args &args); + virtual Status ConnectRemote(Args &args); - virtual Error DisconnectRemote(); + virtual Status DisconnectRemote(); //------------------------------------------------------------------ /// Get the platform's supported architectures in the order in which @@ -367,7 +367,7 @@ public: /// Launch a new process on a platform, not necessarily for /// debugging, it could be just for running the process. //------------------------------------------------------------------ - virtual Error LaunchProcess(ProcessLaunchInfo &launch_info); + virtual Status LaunchProcess(ProcessLaunchInfo &launch_info); //------------------------------------------------------------------ /// Perform expansion of the command-line for this launch info @@ -376,12 +376,12 @@ public: // argument magic the platform defines as part of its typical // user experience //------------------------------------------------------------------ - virtual Error ShellExpandArguments(ProcessLaunchInfo &launch_info); + virtual Status ShellExpandArguments(ProcessLaunchInfo &launch_info); //------------------------------------------------------------------ /// Kill process on a platform. //------------------------------------------------------------------ - virtual Error KillProcess(const lldb::pid_t pid); + virtual Status KillProcess(const lldb::pid_t pid); //------------------------------------------------------------------ /// Lets a platform answer if it is compatible with a given @@ -411,13 +411,13 @@ public: DebugProcess(ProcessLaunchInfo &launch_info, Debugger &debugger, Target *target, // Can be nullptr, if nullptr create a new // target, else use existing one - Error &error); + Status &error); virtual lldb::ProcessSP ConnectProcess(llvm::StringRef connect_url, llvm::StringRef plugin_name, lldb_private::Debugger &debugger, lldb_private::Target *target, - lldb_private::Error &error); + lldb_private::Status &error); //------------------------------------------------------------------ /// Attach to an existing process using a process ID. @@ -442,7 +442,7 @@ public: Target *target, // Can be nullptr, if nullptr // create a new target, else // use existing one - Error &error) = 0; + Status &error) = 0; //------------------------------------------------------------------ /// Attach to an existing process by process name. @@ -464,7 +464,7 @@ public: // virtual lldb::ProcessSP // Attach (const char *process_name, // bool wait_for_launch, - // Error &error) = 0; + // Status &error) = 0; //------------------------------------------------------------------ // The base class Platform will take care of the host platform. @@ -552,27 +552,27 @@ public: return false; } - virtual Error MakeDirectory(const FileSpec &file_spec, uint32_t permissions); + virtual Status MakeDirectory(const FileSpec &file_spec, uint32_t permissions); - virtual Error GetFilePermissions(const FileSpec &file_spec, - uint32_t &file_permissions); + virtual Status GetFilePermissions(const FileSpec &file_spec, + uint32_t &file_permissions); - virtual Error SetFilePermissions(const FileSpec &file_spec, - uint32_t file_permissions); + virtual Status SetFilePermissions(const FileSpec &file_spec, + uint32_t file_permissions); virtual lldb::user_id_t OpenFile(const FileSpec &file_spec, uint32_t flags, - uint32_t mode, Error &error) { + uint32_t mode, Status &error) { return UINT64_MAX; } - virtual bool CloseFile(lldb::user_id_t fd, Error &error) { return false; } + virtual bool CloseFile(lldb::user_id_t fd, Status &error) { return false; } virtual lldb::user_id_t GetFileSize(const FileSpec &file_spec) { return UINT64_MAX; } virtual uint64_t ReadFile(lldb::user_id_t fd, uint64_t offset, void *dst, - uint64_t dst_len, Error &error) { + uint64_t dst_len, Status &error) { error.SetErrorStringWithFormat( "Platform::ReadFile() is not supported in the %s platform", GetName().GetCString()); @@ -580,19 +580,19 @@ public: } virtual uint64_t WriteFile(lldb::user_id_t fd, uint64_t offset, - const void *src, uint64_t src_len, Error &error) { + const void *src, uint64_t src_len, Status &error) { error.SetErrorStringWithFormat( "Platform::ReadFile() is not supported in the %s platform", GetName().GetCString()); return -1; } - virtual Error GetFile(const FileSpec &source, const FileSpec &destination); + virtual Status GetFile(const FileSpec &source, const FileSpec &destination); - virtual Error PutFile(const FileSpec &source, const FileSpec &destination, - uint32_t uid = UINT32_MAX, uint32_t gid = UINT32_MAX); + virtual Status PutFile(const FileSpec &source, const FileSpec &destination, + uint32_t uid = UINT32_MAX, uint32_t gid = UINT32_MAX); - virtual Error + virtual Status CreateSymlink(const FileSpec &src, // The name of the link is in src const FileSpec &dst); // The symlink points to dst @@ -620,13 +620,13 @@ public: /// @return /// An error object that describes anything that went wrong. //---------------------------------------------------------------------- - virtual Error Install(const FileSpec &src, const FileSpec &dst); + virtual Status Install(const FileSpec &src, const FileSpec &dst); virtual size_t GetEnvironment(StringList &environment); virtual bool GetFileExists(const lldb_private::FileSpec &file_spec); - virtual Error Unlink(const FileSpec &file_spec); + virtual Status Unlink(const FileSpec &file_spec); virtual uint64_t ConvertMmapFlagsToPlatform(const ArchSpec &arch, unsigned flags); @@ -664,7 +664,7 @@ public: return nullptr; } - virtual lldb_private::Error RunShellCommand( + virtual lldb_private::Status RunShellCommand( const char *command, // Shouldn't be nullptr const FileSpec &working_dir, // Pass empty FileSpec to use the current // working directory @@ -830,14 +830,14 @@ public: uint32_t LoadImage(lldb_private::Process *process, const lldb_private::FileSpec &local_file, const lldb_private::FileSpec &remote_file, - lldb_private::Error &error); + lldb_private::Status &error); virtual uint32_t DoLoadImage(lldb_private::Process *process, const lldb_private::FileSpec &remote_file, - lldb_private::Error &error); + lldb_private::Status &error); - virtual Error UnloadImage(lldb_private::Process *process, - uint32_t image_token); + virtual Status UnloadImage(lldb_private::Process *process, + uint32_t image_token); //------------------------------------------------------------------ /// Connect to all processes waiting for a debugger to attach @@ -856,7 +856,7 @@ public: /// The number of processes we are successfully connected to. //------------------------------------------------------------------ virtual size_t ConnectToWaitingProcesses(lldb_private::Debugger &debugger, - lldb_private::Error &error); + lldb_private::Status &error); protected: bool m_is_host; @@ -977,35 +977,35 @@ protected: m_gid_map.clear(); } - Error GetCachedExecutable(ModuleSpec &module_spec, lldb::ModuleSP &module_sp, - const FileSpecList *module_search_paths_ptr, - Platform &remote_platform); + Status GetCachedExecutable(ModuleSpec &module_spec, lldb::ModuleSP &module_sp, + const FileSpecList *module_search_paths_ptr, + Platform &remote_platform); - virtual Error DownloadModuleSlice(const FileSpec &src_file_spec, - const uint64_t src_offset, - const uint64_t src_size, - const FileSpec &dst_file_spec); + virtual Status DownloadModuleSlice(const FileSpec &src_file_spec, + const uint64_t src_offset, + const uint64_t src_size, + const FileSpec &dst_file_spec); - virtual Error DownloadSymbolFile(const lldb::ModuleSP &module_sp, - const FileSpec &dst_file_spec); + virtual Status DownloadSymbolFile(const lldb::ModuleSP &module_sp, + const FileSpec &dst_file_spec); virtual const char *GetCacheHostname(); private: - typedef std::function<Error(const ModuleSpec &)> ModuleResolver; + typedef std::function<Status(const ModuleSpec &)> ModuleResolver; - Error GetRemoteSharedModule(const ModuleSpec &module_spec, Process *process, - lldb::ModuleSP &module_sp, - const ModuleResolver &module_resolver, - bool *did_create_ptr); + Status GetRemoteSharedModule(const ModuleSpec &module_spec, Process *process, + lldb::ModuleSP &module_sp, + const ModuleResolver &module_resolver, + bool *did_create_ptr); bool GetCachedSharedModule(const ModuleSpec &module_spec, lldb::ModuleSP &module_sp, bool *did_create_ptr); - Error LoadCachedExecutable(const ModuleSpec &module_spec, - lldb::ModuleSP &module_sp, - const FileSpecList *module_search_paths_ptr, - Platform &remote_platform); + Status LoadCachedExecutable(const ModuleSpec &module_spec, + lldb::ModuleSP &module_sp, + const FileSpecList *module_search_paths_ptr, + Platform &remote_platform); FileSpec GetModuleCacheRoot(); @@ -1088,7 +1088,7 @@ public: ~OptionGroupPlatformRSync() override = default; - lldb_private::Error + lldb_private::Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, ExecutionContext *execution_context) override; @@ -1117,7 +1117,7 @@ public: ~OptionGroupPlatformSSH() override = default; - lldb_private::Error + lldb_private::Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, ExecutionContext *execution_context) override; @@ -1144,7 +1144,7 @@ public: ~OptionGroupPlatformCaching() override = default; - lldb_private::Error + lldb_private::Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, ExecutionContext *execution_context) override; diff --git a/include/lldb/Target/Process.h b/include/lldb/Target/Process.h index 9a749efa7ae1..d2ab85d1652a 100644 --- a/include/lldb/Target/Process.h +++ b/include/lldb/Target/Process.h @@ -48,8 +48,8 @@ #include "lldb/Target/ProcessLaunchInfo.h" #include "lldb/Target/QueueList.h" #include "lldb/Target/ThreadList.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/NameMatches.h" +#include "lldb/Utility/Status.h" #include "lldb/lldb-private.h" #include "llvm/ADT/ArrayRef.h" @@ -282,8 +282,8 @@ public: ~ProcessLaunchCommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override; void OptionParsingStarting(ExecutionContext *execution_context) override { launch_info.Clear(); @@ -792,12 +792,12 @@ public: /// An error object. Call GetID() to get the process ID if /// the error object is success. //------------------------------------------------------------------ - virtual Error Launch(ProcessLaunchInfo &launch_info); + virtual Status Launch(ProcessLaunchInfo &launch_info); - virtual Error LoadCore(); + virtual Status LoadCore(); - virtual Error DoLoadCore() { - Error error; + virtual Status DoLoadCore() { + Status error; error.SetErrorStringWithFormat( "error: %s does not support loading core files.", GetPluginName().GetCString()); @@ -869,7 +869,7 @@ public: /// Returns \a pid if attaching was successful, or /// LLDB_INVALID_PROCESS_ID if attaching fails. //------------------------------------------------------------------ - virtual Error Attach(ProcessAttachInfo &attach_info); + virtual Status Attach(ProcessAttachInfo &attach_info); //------------------------------------------------------------------ /// Attach to a remote system via a URL @@ -885,7 +885,7 @@ public: /// @return /// Returns an error object. //------------------------------------------------------------------ - virtual Error ConnectRemote(Stream *strm, llvm::StringRef remote_url); + virtual Status ConnectRemote(Stream *strm, llvm::StringRef remote_url); bool GetShouldDetach() const { return m_should_detach; } @@ -992,9 +992,9 @@ public: /// @see Thread:Step() /// @see Thread:Suspend() //------------------------------------------------------------------ - Error Resume(); + Status Resume(); - Error ResumeSynchronous(Stream *stream); + Status ResumeSynchronous(Stream *stream); //------------------------------------------------------------------ /// Halts a running process. @@ -1016,7 +1016,7 @@ public: /// halted. /// otherwise the halt has failed. //------------------------------------------------------------------ - Error Halt(bool clear_thread_plans = false, bool use_run_lock = true); + Status Halt(bool clear_thread_plans = false, bool use_run_lock = true); //------------------------------------------------------------------ /// Detaches from a running or stopped process. @@ -1030,7 +1030,7 @@ public: /// @return /// Returns an error object. //------------------------------------------------------------------ - Error Detach(bool keep_stopped); + Status Detach(bool keep_stopped); //------------------------------------------------------------------ /// Kills the process and shuts down all threads that were spawned @@ -1050,7 +1050,7 @@ public: /// @return /// Returns an error object. //------------------------------------------------------------------ - Error Destroy(bool force_kill); + Status Destroy(bool force_kill); //------------------------------------------------------------------ /// Sends a process a UNIX signal \a signal. @@ -1061,7 +1061,7 @@ public: /// @return /// Returns an error object. //------------------------------------------------------------------ - Error Signal(int signal); + Status Signal(int signal); void SetUnixSignals(lldb::UnixSignalsSP &&signals_sp); @@ -1080,7 +1080,7 @@ public: /// @return /// Returns an error object. //------------------------------------------------------------------ - virtual Error WillAttachToProcessWithID(lldb::pid_t pid) { return Error(); } + virtual Status WillAttachToProcessWithID(lldb::pid_t pid) { return Status(); } //------------------------------------------------------------------ /// Called before attaching to a process. @@ -1091,9 +1091,9 @@ public: /// @return /// Returns an error object. //------------------------------------------------------------------ - virtual Error WillAttachToProcessWithName(const char *process_name, - bool wait_for_launch) { - return Error(); + virtual Status WillAttachToProcessWithName(const char *process_name, + bool wait_for_launch) { + return Status(); } //------------------------------------------------------------------ @@ -1110,8 +1110,8 @@ public: /// @return /// Returns an error object. //------------------------------------------------------------------ - virtual Error DoConnectRemote(Stream *strm, llvm::StringRef remote_url) { - Error error; + virtual Status DoConnectRemote(Stream *strm, llvm::StringRef remote_url) { + Status error; error.SetErrorString("remote connections are not supported"); return error; } @@ -1127,14 +1127,14 @@ public: /// will return the uid to attach as. /// /// @return - /// Returns a successful Error attaching was successful, or + /// Returns a successful Status attaching was successful, or /// an appropriate (possibly platform-specific) error code if /// attaching fails. /// hanming : need flag //------------------------------------------------------------------ - virtual Error DoAttachToProcessWithID(lldb::pid_t pid, - const ProcessAttachInfo &attach_info) { - Error error; + virtual Status DoAttachToProcessWithID(lldb::pid_t pid, + const ProcessAttachInfo &attach_info) { + Status error; error.SetErrorStringWithFormat( "error: %s does not support attaching to a process by pid", GetPluginName().GetCString()); @@ -1152,14 +1152,14 @@ public: /// will return the uid to attach as. /// /// @return - /// Returns a successful Error attaching was successful, or + /// Returns a successful Status attaching was successful, or /// an appropriate (possibly platform-specific) error code if /// attaching fails. //------------------------------------------------------------------ - virtual Error + virtual Status DoAttachToProcessWithName(const char *process_name, const ProcessAttachInfo &attach_info) { - Error error; + Status error; error.SetErrorString("attach by name is not supported"); return error; } @@ -1202,7 +1202,7 @@ public: /// @return /// Returns an error object. //------------------------------------------------------------------ - virtual Error WillLaunch(Module *module) { return Error(); } + virtual Status WillLaunch(Module *module) { return Status(); } //------------------------------------------------------------------ /// Launch a new process. @@ -1220,11 +1220,11 @@ public: /// requested launch. /// /// @return - /// An Error instance indicating success or failure of the + /// An Status instance indicating success or failure of the /// operation. //------------------------------------------------------------------ - virtual Error DoLaunch(Module *exe_module, ProcessLaunchInfo &launch_info) { - Error error; + virtual Status DoLaunch(Module *exe_module, ProcessLaunchInfo &launch_info) { + Status error; error.SetErrorStringWithFormat( "error: %s does not support launching processes", GetPluginName().GetCString()); @@ -1248,7 +1248,7 @@ public: /// @return /// Returns an error object. //------------------------------------------------------------------ - virtual Error WillResume() { return Error(); } + virtual Status WillResume() { return Status(); } //------------------------------------------------------------------ /// Resumes all of a process's threads as configured using the @@ -1267,8 +1267,8 @@ public: /// @see Thread:Step() /// @see Thread:Suspend() //------------------------------------------------------------------ - virtual Error DoResume() { - Error error; + virtual Status DoResume() { + Status error; error.SetErrorStringWithFormat( "error: %s does not support resuming processes", GetPluginName().GetCString()); @@ -1292,7 +1292,7 @@ public: /// @return /// Returns an error object. //------------------------------------------------------------------ - virtual Error WillHalt() { return Error(); } + virtual Status WillHalt() { return Status(); } //------------------------------------------------------------------ /// Halts a running process. @@ -1314,8 +1314,8 @@ public: /// Returns \b true if the process successfully halts, \b false /// otherwise. //------------------------------------------------------------------ - virtual Error DoHalt(bool &caused_stop) { - Error error; + virtual Status DoHalt(bool &caused_stop) { + Status error; error.SetErrorStringWithFormat( "error: %s does not support halting processes", GetPluginName().GetCString()); @@ -1339,7 +1339,7 @@ public: /// @return /// Returns an error object. //------------------------------------------------------------------ - virtual Error WillDetach() { return Error(); } + virtual Status WillDetach() { return Status(); } //------------------------------------------------------------------ /// Detaches from a running or stopped process. @@ -1348,8 +1348,8 @@ public: /// Returns \b true if the process successfully detaches, \b /// false otherwise. //------------------------------------------------------------------ - virtual Error DoDetach(bool keep_stopped) { - Error error; + virtual Status DoDetach(bool keep_stopped) { + Status error; error.SetErrorStringWithFormat( "error: %s does not support detaching from processes", GetPluginName().GetCString()); @@ -1377,7 +1377,7 @@ public: /// Process::DoSignal(int), otherwise an error describing what /// prevents the signal from being sent. //------------------------------------------------------------------ - virtual Error WillSignal() { return Error(); } + virtual Status WillSignal() { return Status(); } //------------------------------------------------------------------ /// Sends a process a UNIX signal \a signal. @@ -1385,17 +1385,17 @@ public: /// @return /// Returns an error object. //------------------------------------------------------------------ - virtual Error DoSignal(int signal) { - Error error; + virtual Status DoSignal(int signal) { + Status error; error.SetErrorStringWithFormat( "error: %s does not support sending signals to processes", GetPluginName().GetCString()); return error; } - virtual Error WillDestroy() { return Error(); } + virtual Status WillDestroy() { return Status(); } - virtual Error DoDestroy() = 0; + virtual Status DoDestroy() = 0; virtual void DidDestroy() {} @@ -1706,7 +1706,7 @@ public: /// The number of bytes that were actually read into \a buf. //------------------------------------------------------------------ virtual size_t DoReadMemory(lldb::addr_t vm_addr, void *buf, size_t size, - Error &error) = 0; + Status &error) = 0; //------------------------------------------------------------------ /// Read of memory from a process. @@ -1738,7 +1738,7 @@ public: /// returned to indicate an error. //------------------------------------------------------------------ virtual size_t ReadMemory(lldb::addr_t vm_addr, void *buf, size_t size, - Error &error); + Status &error); //------------------------------------------------------------------ /// Read a NULL terminated string from memory @@ -1770,7 +1770,7 @@ public: /// The error status or the number of bytes prior to the null terminator. //------------------------------------------------------------------ size_t ReadStringFromMemory(lldb::addr_t vm_addr, char *str, size_t max_bytes, - Error &error, size_t type_width = 1); + Status &error, size_t type_width = 1); //------------------------------------------------------------------ /// Read a NULL terminated C string from memory @@ -1782,13 +1782,13 @@ public: /// terminated (at most cstr_max_len - 1 bytes will be read). //------------------------------------------------------------------ size_t ReadCStringFromMemory(lldb::addr_t vm_addr, char *cstr, - size_t cstr_max_len, Error &error); + size_t cstr_max_len, Status &error); size_t ReadCStringFromMemory(lldb::addr_t vm_addr, std::string &out_str, - Error &error); + Status &error); size_t ReadMemoryFromInferior(lldb::addr_t vm_addr, void *buf, size_t size, - Error &error); + Status &error); //------------------------------------------------------------------ /// Reads an unsigned integer of the specified byte size from @@ -1819,15 +1819,15 @@ public: //------------------------------------------------------------------ uint64_t ReadUnsignedIntegerFromMemory(lldb::addr_t load_addr, size_t byte_size, uint64_t fail_value, - Error &error); + Status &error); int64_t ReadSignedIntegerFromMemory(lldb::addr_t load_addr, size_t byte_size, - int64_t fail_value, Error &error); + int64_t fail_value, Status &error); - lldb::addr_t ReadPointerFromMemory(lldb::addr_t vm_addr, Error &error); + lldb::addr_t ReadPointerFromMemory(lldb::addr_t vm_addr, Status &error); bool WritePointerToMemory(lldb::addr_t vm_addr, lldb::addr_t ptr_value, - Error &error); + Status &error); //------------------------------------------------------------------ /// Actually do the writing of memory to a process. @@ -1850,7 +1850,7 @@ public: /// The number of bytes that were actually written. //------------------------------------------------------------------ virtual size_t DoWriteMemory(lldb::addr_t vm_addr, const void *buf, - size_t size, Error &error) { + size_t size, Status &error) { error.SetErrorStringWithFormat( "error: %s does not support writing to processes", GetPluginName().GetCString()); @@ -1890,11 +1890,11 @@ public: /// The number of bytes that were actually written. //------------------------------------------------------------------ size_t WriteScalarToMemory(lldb::addr_t vm_addr, const Scalar &scalar, - size_t size, Error &error); + size_t size, Status &error); size_t ReadScalarIntegerFromMemory(lldb::addr_t addr, uint32_t byte_size, bool is_signed, Scalar &scalar, - Error &error); + Status &error); //------------------------------------------------------------------ /// Write memory to a process. @@ -1923,7 +1923,7 @@ public: //------------------------------------------------------------------ // TODO: change this to take an ArrayRef<uint8_t> size_t WriteMemory(lldb::addr_t vm_addr, const void *buf, size_t size, - Error &error); + Status &error); //------------------------------------------------------------------ /// Actually allocate memory in the process. @@ -1941,7 +1941,7 @@ public: //------------------------------------------------------------------ virtual lldb::addr_t DoAllocateMemory(size_t size, uint32_t permissions, - Error &error) { + Status &error) { error.SetErrorStringWithFormat( "error: %s does not support allocating in the debug process", GetPluginName().GetCString()); @@ -1971,7 +1971,7 @@ public: /// The address of the allocated buffer in the process, or /// LLDB_INVALID_ADDRESS if the allocation failed. //------------------------------------------------------------------ - lldb::addr_t AllocateMemory(size_t size, uint32_t permissions, Error &error); + lldb::addr_t AllocateMemory(size_t size, uint32_t permissions, Status &error); //------------------------------------------------------------------ /// The public interface to allocating memory in the process, this also @@ -1998,7 +1998,8 @@ public: /// LLDB_INVALID_ADDRESS if the allocation failed. //------------------------------------------------------------------ - lldb::addr_t CallocateMemory(size_t size, uint32_t permissions, Error &error); + lldb::addr_t CallocateMemory(size_t size, uint32_t permissions, + Status &error); //------------------------------------------------------------------ /// Resolve dynamically loaded indirect functions. @@ -2014,7 +2015,7 @@ public: /// LLDB_INVALID_ADDRESS if the resolution failed. //------------------------------------------------------------------ virtual lldb::addr_t ResolveIndirectFunction(const Address *address, - Error &error); + Status &error); //------------------------------------------------------------------ /// Locate the memory region that contains load_addr. @@ -2042,9 +2043,9 @@ public: /// @return /// An error value. //------------------------------------------------------------------ - virtual Error GetMemoryRegionInfo(lldb::addr_t load_addr, - MemoryRegionInfo &range_info) { - Error error; + virtual Status GetMemoryRegionInfo(lldb::addr_t load_addr, + MemoryRegionInfo &range_info) { + Status error; error.SetErrorString("Process::GetMemoryRegionInfo() not supported"); return error; } @@ -2059,18 +2060,18 @@ public: /// @return /// An error value. //------------------------------------------------------------------ - virtual Error + virtual Status GetMemoryRegions(std::vector<lldb::MemoryRegionInfoSP> ®ion_list); - virtual Error GetWatchpointSupportInfo(uint32_t &num) { - Error error; + virtual Status GetWatchpointSupportInfo(uint32_t &num) { + Status error; num = 0; error.SetErrorString("Process::GetWatchpointSupportInfo() not supported"); return error; } - virtual Error GetWatchpointSupportInfo(uint32_t &num, bool &after) { - Error error; + virtual Status GetWatchpointSupportInfo(uint32_t &num, bool &after) { + Status error; num = 0; after = true; error.SetErrorString("Process::GetWatchpointSupportInfo() not supported"); @@ -2165,8 +2166,8 @@ public: /// @return /// \btrue if the memory was deallocated, \bfalse otherwise. //------------------------------------------------------------------ - virtual Error DoDeallocateMemory(lldb::addr_t ptr) { - Error error; + virtual Status DoDeallocateMemory(lldb::addr_t ptr) { + Status error; error.SetErrorStringWithFormat( "error: %s does not support deallocating in the debug process", GetPluginName().GetCString()); @@ -2186,7 +2187,7 @@ public: /// @return /// \btrue if the memory was deallocated, \bfalse otherwise. //------------------------------------------------------------------ - Error DeallocateMemory(lldb::addr_t ptr); + Status DeallocateMemory(lldb::addr_t ptr); //------------------------------------------------------------------ /// Get any available STDOUT. @@ -2218,7 +2219,7 @@ public: /// equal to \a buf_size, another call to this function should /// be made to retrieve more STDOUT data. //------------------------------------------------------------------ - virtual size_t GetSTDOUT(char *buf, size_t buf_size, Error &error); + virtual size_t GetSTDOUT(char *buf, size_t buf_size, Status &error); //------------------------------------------------------------------ /// Get any available STDERR. @@ -2250,7 +2251,7 @@ public: /// equal to \a buf_size, another call to this function should /// be made to retrieve more STDERR data. //------------------------------------------------------------------ - virtual size_t GetSTDERR(char *buf, size_t buf_size, Error &error); + virtual size_t GetSTDERR(char *buf, size_t buf_size, Status &error); //------------------------------------------------------------------ /// Puts data into this process's STDIN. @@ -2273,7 +2274,7 @@ public: /// less than \a buf_size, another call to this function should /// be made to write the rest of the data. //------------------------------------------------------------------ - virtual size_t PutSTDIN(const char *buf, size_t buf_size, Error &error) { + virtual size_t PutSTDIN(const char *buf, size_t buf_size, Status &error) { error.SetErrorString("stdin unsupported"); return 0; } @@ -2293,23 +2294,23 @@ public: /// equal to \a buf_size, another call to this function should /// be made to retrieve more profile data. //------------------------------------------------------------------ - virtual size_t GetAsyncProfileData(char *buf, size_t buf_size, Error &error); + virtual size_t GetAsyncProfileData(char *buf, size_t buf_size, Status &error); //---------------------------------------------------------------------- // Process Breakpoints //---------------------------------------------------------------------- size_t GetSoftwareBreakpointTrapOpcode(BreakpointSite *bp_site); - virtual Error EnableBreakpointSite(BreakpointSite *bp_site) { - Error error; + virtual Status EnableBreakpointSite(BreakpointSite *bp_site) { + Status error; error.SetErrorStringWithFormat( "error: %s does not support enabling breakpoints", GetPluginName().GetCString()); return error; } - virtual Error DisableBreakpointSite(BreakpointSite *bp_site) { - Error error; + virtual Status DisableBreakpointSite(BreakpointSite *bp_site) { + Status error; error.SetErrorStringWithFormat( "error: %s does not support disabling breakpoints", GetPluginName().GetCString()); @@ -2320,13 +2321,13 @@ public: // don't need to implement this function unless the standard flow of // read existing opcode, write breakpoint opcode, verify breakpoint opcode // doesn't work for a specific process plug-in. - virtual Error EnableSoftwareBreakpoint(BreakpointSite *bp_site); + virtual Status EnableSoftwareBreakpoint(BreakpointSite *bp_site); // This is implemented completely using the lldb::Process API. Subclasses // don't need to implement this function unless the standard flow of // restoring original opcode in memory and verifying the restored opcode // doesn't work for a specific process plug-in. - virtual Error DisableSoftwareBreakpoint(BreakpointSite *bp_site); + virtual Status DisableSoftwareBreakpoint(BreakpointSite *bp_site); BreakpointSiteList &GetBreakpointSiteList(); @@ -2334,14 +2335,14 @@ public: void DisableAllBreakpointSites(); - Error ClearBreakpointSiteByID(lldb::user_id_t break_id); + Status ClearBreakpointSiteByID(lldb::user_id_t break_id); lldb::break_id_t CreateBreakpointSite(const lldb::BreakpointLocationSP &owner, bool use_hardware); - Error DisableBreakpointSiteByID(lldb::user_id_t break_id); + Status DisableBreakpointSiteByID(lldb::user_id_t break_id); - Error EnableBreakpointSiteByID(lldb::user_id_t break_id); + Status EnableBreakpointSiteByID(lldb::user_id_t break_id); // BreakpointLocations use RemoveOwnerFromBreakpointSite to remove // themselves from the owner's list of this breakpoint sites. @@ -2352,9 +2353,9 @@ public: //---------------------------------------------------------------------- // Process Watchpoints (optional) //---------------------------------------------------------------------- - virtual Error EnableWatchpoint(Watchpoint *wp, bool notify = true); + virtual Status EnableWatchpoint(Watchpoint *wp, bool notify = true); - virtual Error DisableWatchpoint(Watchpoint *wp, bool notify = true); + virtual Status DisableWatchpoint(Watchpoint *wp, bool notify = true); //------------------------------------------------------------------ // Thread Queries @@ -2613,8 +2614,8 @@ public: ProcessRunLock &GetRunLock(); - virtual Error SendEventData(const char *data) { - Error return_error("Sending an event is not supported for this process."); + virtual Status SendEventData(const char *data) { + Status return_error("Sending an event is not supported for this process."); return return_error; } @@ -2665,9 +2666,9 @@ public: /// The load address of the file if it is loaded into the /// processes address space, LLDB_INVALID_ADDRESS otherwise. //------------------------------------------------------------------ - virtual Error GetFileLoadAddress(const FileSpec &file, bool &is_loaded, - lldb::addr_t &load_addr) { - return Error("Not supported"); + virtual Status GetFileLoadAddress(const FileSpec &file, bool &is_loaded, + lldb::addr_t &load_addr) { + return Status("Not supported"); } size_t AddImageToken(lldb::addr_t image_ptr); @@ -2729,7 +2730,7 @@ public: /// @return /// Returns the result of attempting to configure the feature. //------------------------------------------------------------------ - virtual Error + virtual Status ConfigureStructuredData(const ConstString &type_name, const StructuredData::ObjectSP &config_sp); @@ -2781,7 +2782,7 @@ public: /// configuration. //------------------------------------------------------------------ virtual lldb::user_id_t StartTrace(lldb::TraceOptionsSP &options, - Error &error) { + Status &error) { error.SetErrorString("Not implemented"); return LLDB_INVALID_UID; } @@ -2796,7 +2797,7 @@ public: /// to be stopped a thread_id can be supplied. //------------------------------------------------------------------ virtual void StopTrace(lldb::user_id_t uid, lldb::tid_t thread_id, - Error &error) { + Status &error) { error.SetErrorString("Not implemented"); } @@ -2809,7 +2810,7 @@ public: /// thread for trace extraction. //------------------------------------------------------------------ virtual size_t GetData(lldb::user_id_t uid, lldb::tid_t thread_id, - Error &error, void *buf, size_t size, + Status &error, void *buf, size_t size, size_t offset = 0) { error.SetErrorString("Not implemented"); return 0; @@ -2819,7 +2820,7 @@ public: /// Similar API as above except for obtaining meta data //------------------------------------------------------------------ virtual size_t GetMetaData(lldb::user_id_t uid, lldb::tid_t thread_id, - Error &error, void *buf, size_t size, + Status &error, void *buf, size_t size, size_t offset = 0) { error.SetErrorString("Not implemented"); return 0; @@ -2834,7 +2835,7 @@ public: /// configuration used by a specific thread. The thread_id specified /// should also match the uid otherwise an error will be returned. //------------------------------------------------------------------ - virtual void GetTraceConfig(lldb::user_id_t uid, Error &error, + virtual void GetTraceConfig(lldb::user_id_t uid, Status &error, lldb::TraceOptionsSP &options) { error.SetErrorString("Not implemented"); return; @@ -2850,9 +2851,9 @@ protected: /// state of m_run_lock, but just causes the process to resume. /// /// @return - /// An Error object describing the success or failure of the resume. + /// An Status object describing the success or failure of the resume. //------------------------------------------------------------------ - Error PrivateResume(); + Status PrivateResume(); //------------------------------------------------------------------ // Called internally @@ -3179,7 +3180,7 @@ private: protected: void HandlePrivateEvent(lldb::EventSP &event_sp); - Error HaltPrivate(); + Status HaltPrivate(); lldb::StateType WaitForProcessStopPrivate(lldb::EventSP &event_sp, const Timeout<std::micro> &timeout); @@ -3196,7 +3197,7 @@ protected: const Timeout<std::micro> &timeout); size_t WriteMemoryPrivate(lldb::addr_t addr, const void *buf, size_t size, - Error &error); + Status &error); void AppendSTDOUT(const char *s, size_t len); @@ -3217,9 +3218,9 @@ protected: return static_cast<bool>(m_process_input_reader); } - Error StopForDestroyOrDetach(lldb::EventSP &exit_event_sp); + Status StopForDestroyOrDetach(lldb::EventSP &exit_event_sp); - virtual Error UpdateAutomaticSignalFiltering(); + virtual Status UpdateAutomaticSignalFiltering(); bool StateChangedIsExternallyHijacked(); diff --git a/include/lldb/Target/ProcessLaunchInfo.h b/include/lldb/Target/ProcessLaunchInfo.h index 083e0bbed8bd..93a1a9ebd239 100644 --- a/include/lldb/Target/ProcessLaunchInfo.h +++ b/include/lldb/Target/ProcessLaunchInfo.h @@ -94,7 +94,7 @@ public: void Clear(); - bool ConvertArgumentsForLaunchingInShell(Error &error, bool localhost, + bool ConvertArgumentsForLaunchingInShell(Status &error, bool localhost, bool will_debug, bool first_arg_is_full_shell_command, int32_t num_resumes); diff --git a/include/lldb/Target/ProcessStructReader.h b/include/lldb/Target/ProcessStructReader.h index acc5c1f32686..cfc8fe11a39a 100644 --- a/include/lldb/Target/ProcessStructReader.h +++ b/include/lldb/Target/ProcessStructReader.h @@ -17,7 +17,7 @@ #include "lldb/Target/Process.h" #include "lldb/Utility/ConstString.h" #include "lldb/Utility/DataExtractor.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include <initializer_list> #include <map> @@ -68,7 +68,7 @@ public: } size_t total_size = struct_type.GetByteSize(nullptr); lldb::DataBufferSP buffer_sp(new DataBufferHeap(total_size, 0)); - Error error; + Status error; process->ReadMemoryFromInferior(base_addr, buffer_sp->GetBytes(), total_size, error); if (error.Fail()) diff --git a/include/lldb/Target/RegisterContext.h b/include/lldb/Target/RegisterContext.h index 485645b2dc14..c438a0cd12cf 100644 --- a/include/lldb/Target/RegisterContext.h +++ b/include/lldb/Target/RegisterContext.h @@ -138,12 +138,12 @@ public: virtual bool HardwareSingleStep(bool enable); - virtual Error + virtual Status ReadRegisterValueFromMemory(const lldb_private::RegisterInfo *reg_info, lldb::addr_t src_addr, uint32_t src_len, RegisterValue ®_value); - virtual Error + virtual Status WriteRegisterValueToMemory(const lldb_private::RegisterInfo *reg_info, lldb::addr_t dst_addr, uint32_t dst_len, const RegisterValue ®_value); diff --git a/include/lldb/Target/StackFrame.h b/include/lldb/Target/StackFrame.h index 1f25575e236a..cb503875a5c0 100644 --- a/include/lldb/Target/StackFrame.h +++ b/include/lldb/Target/StackFrame.h @@ -24,7 +24,7 @@ #include "lldb/Symbol/SymbolContext.h" #include "lldb/Target/ExecutionContextScope.h" #include "lldb/Target/StackID.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/StreamString.h" #include "lldb/Utility/UserID.h" @@ -201,7 +201,7 @@ public: /// Returns true if the CFA value was successfully set in value. Some /// frames may be unable to provide this value; they will return false. //------------------------------------------------------------------ - bool GetFrameBaseValue(Scalar &value, Error *error_ptr); + bool GetFrameBaseValue(Scalar &value, Status *error_ptr); //------------------------------------------------------------------ /// Get the DWARFExpression corresponding to the Canonical Frame Address. @@ -215,7 +215,7 @@ public: /// @return /// Returns the corresponding DWARF expression, or NULL. //------------------------------------------------------------------ - DWARFExpression *GetFrameBaseExpression(Error *error_ptr); + DWARFExpression *GetFrameBaseExpression(Status *error_ptr); //------------------------------------------------------------------ /// Get the current lexical scope block for this StackFrame, if possible. @@ -315,7 +315,7 @@ public: //------------------------------------------------------------------ lldb::ValueObjectSP GetValueForVariableExpressionPath( llvm::StringRef var_expr, lldb::DynamicValueType use_dynamic, - uint32_t options, lldb::VariableSP &var_sp, Error &error); + uint32_t options, lldb::VariableSP &var_sp, Status &error); //------------------------------------------------------------------ /// Determine whether this StackFrame has debug information available or not @@ -535,7 +535,7 @@ private: SymbolContext m_sc; Flags m_flags; Scalar m_frame_base; - Error m_frame_base_error; + 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; diff --git a/include/lldb/Target/StructuredDataPlugin.h b/include/lldb/Target/StructuredDataPlugin.h index aa4452a9c3f2..a4d2c0382628 100644 --- a/include/lldb/Target/StructuredDataPlugin.h +++ b/include/lldb/Target/StructuredDataPlugin.h @@ -123,8 +123,8 @@ public: /// The error if formatting the object contents failed; otherwise, /// success. // ------------------------------------------------------------------------- - virtual Error GetDescription(const StructuredData::ObjectSP &object_sp, - lldb_private::Stream &stream) = 0; + virtual Status GetDescription(const StructuredData::ObjectSP &object_sp, + lldb_private::Stream &stream) = 0; // ------------------------------------------------------------------------- /// Returns whether the plugin's features are enabled. diff --git a/include/lldb/Target/Target.h b/include/lldb/Target/Target.h index 8aa263f59254..ff9451939909 100644 --- a/include/lldb/Target/Target.h +++ b/include/lldb/Target/Target.h @@ -490,7 +490,7 @@ public: // UpdateInstanceName (); lldb::ModuleSP GetSharedModule(const ModuleSpec &module_spec, - Error *error_ptr = nullptr); + Status *error_ptr = nullptr); //---------------------------------------------------------------------- // Settings accessors @@ -528,11 +528,11 @@ public: void Destroy(); - Error Launch(ProcessLaunchInfo &launch_info, - Stream *stream); // Optional stream to receive first stop info + Status Launch(ProcessLaunchInfo &launch_info, + Stream *stream); // Optional stream to receive first stop info - Error Attach(ProcessAttachInfo &attach_info, - Stream *stream); // Optional stream to receive first stop info + Status Attach(ProcessAttachInfo &attach_info, + Stream *stream); // Optional stream to receive first stop info //------------------------------------------------------------------ // This part handles the breakpoints. @@ -611,7 +611,7 @@ public: CreateExceptionBreakpoint(enum lldb::LanguageType language, bool catch_bp, bool throw_bp, bool internal, Args *additional_args = nullptr, - Error *additional_args_error = nullptr); + Status *additional_args_error = nullptr); // This is the same as the func_name breakpoint except that you can specify a // vector of names. This is cheaper @@ -644,7 +644,7 @@ public: // Use this to create a watchpoint: lldb::WatchpointSP CreateWatchpoint(lldb::addr_t addr, size_t size, const CompilerType *type, uint32_t kind, - Error &error); + Status &error); lldb::WatchpointSP GetLastCreatedWatchpoint() { return m_last_created_watchpoint; @@ -687,15 +687,16 @@ public: bool IgnoreWatchpointByID(lldb::watch_id_t watch_id, uint32_t ignore_count); - Error SerializeBreakpointsToFile(const FileSpec &file, - const BreakpointIDList &bp_ids, bool append); + Status SerializeBreakpointsToFile(const FileSpec &file, + const BreakpointIDList &bp_ids, + bool append); - Error CreateBreakpointsFromFile(const FileSpec &file, - BreakpointIDList &new_bps); + Status CreateBreakpointsFromFile(const FileSpec &file, + BreakpointIDList &new_bps); - Error CreateBreakpointsFromFile(const FileSpec &file, - std::vector<std::string> &names, - BreakpointIDList &new_bps); + Status CreateBreakpointsFromFile(const FileSpec &file, + std::vector<std::string> &names, + BreakpointIDList &new_bps); //------------------------------------------------------------------ /// Get \a load_addr as a callable code load address for this target @@ -808,7 +809,7 @@ public: //------------------------------------------------------------------ void SetExecutableModule(lldb::ModuleSP &module_sp, bool get_dependent_files); - bool LoadScriptingResources(std::list<Error> &errors, + bool LoadScriptingResources(std::list<Status> &errors, Stream *feedback_stream = nullptr, bool continue_on_error = true) { return m_images.LoadScriptingResourcesInTarget( @@ -914,7 +915,7 @@ public: Debugger &GetDebugger() { return m_debugger; } size_t ReadMemoryFromFileCache(const Address &addr, void *dst, size_t dst_len, - Error &error); + Status &error); // Reading memory through the target allows us to skip going to the process // for reading memory if possible and it allows us to try and read from @@ -927,27 +928,27 @@ public: // 2 - if there is a valid process, try and read from its memory // 3 - if (prefer_file_cache == false) then read from object file cache size_t ReadMemory(const Address &addr, bool prefer_file_cache, void *dst, - size_t dst_len, Error &error, + size_t dst_len, Status &error, lldb::addr_t *load_addr_ptr = nullptr); size_t ReadCStringFromMemory(const Address &addr, std::string &out_str, - Error &error); + Status &error); size_t ReadCStringFromMemory(const Address &addr, char *dst, - size_t dst_max_len, Error &result_error); + size_t dst_max_len, Status &result_error); size_t ReadScalarIntegerFromMemory(const Address &addr, bool prefer_file_cache, uint32_t byte_size, bool is_signed, Scalar &scalar, - Error &error); + Status &error); uint64_t ReadUnsignedIntegerFromMemory(const Address &addr, bool prefer_file_cache, size_t integer_byte_size, - uint64_t fail_value, Error &error); + uint64_t fail_value, Status &error); bool ReadPointerFromMemory(const Address &addr, bool prefer_file_cache, - Error &error, Address &pointer_addr); + Status &error, Address &pointer_addr); SectionLoadList &GetSectionLoadList() { return m_section_load_history.GetCurrentSectionLoadList(); @@ -978,7 +979,7 @@ public: PathMappingList &GetImageSearchPathList(); - TypeSystem *GetScratchTypeSystemForLanguage(Error *error, + TypeSystem *GetScratchTypeSystemForLanguage(Status *error, lldb::LanguageType language, bool create_on_demand = true); @@ -993,7 +994,7 @@ public: UserExpression *GetUserExpressionForLanguage( llvm::StringRef expr, llvm::StringRef prefix, lldb::LanguageType language, Expression::ResultType desired_type, - const EvaluateExpressionOptions &options, Error &error); + const EvaluateExpressionOptions &options, Status &error); // Creates a FunctionCaller for the given language, the rest of the parameters // have the @@ -1008,7 +1009,7 @@ public: const CompilerType &return_type, const Address &function_address, const ValueList &arg_value_list, - const char *name, Error &error); + const char *name, Status &error); // Creates a UtilityFunction for the given language, the rest of the // parameters have the @@ -1018,7 +1019,7 @@ public: UtilityFunction *GetUtilityFunctionForLanguage(const char *expr, lldb::LanguageType language, const char *name, - Error &error); + Status &error); ClangASTContext *GetScratchClangASTContext(bool create_on_demand = true); @@ -1028,7 +1029,7 @@ public: // Install any files through the platform that need be to installed // prior to launching or attaching. //---------------------------------------------------------------------- - Error Install(ProcessLaunchInfo *launch_info); + Status Install(ProcessLaunchInfo *launch_info); bool ResolveFileAddress(lldb::addr_t load_addr, Address &so_addr); @@ -1183,7 +1184,7 @@ public: GetSearchFilterForModuleAndCUList(const FileSpecList *containingModules, const FileSpecList *containingSourceFiles); - lldb::REPLSP GetREPL(Error &err, lldb::LanguageType language, + lldb::REPLSP GetREPL(Status &err, lldb::LanguageType language, const char *repl_options, bool can_create); void SetREPL(lldb::LanguageType language, lldb::REPLSP repl_sp); diff --git a/include/lldb/Target/TargetList.h b/include/lldb/Target/TargetList.h index 81b81dba7757..43f4520369b6 100644 --- a/include/lldb/Target/TargetList.h +++ b/include/lldb/Target/TargetList.h @@ -91,10 +91,10 @@ public: /// @return /// An error object that indicates success or failure //------------------------------------------------------------------ - Error CreateTarget(Debugger &debugger, llvm::StringRef user_exe_path, - llvm::StringRef triple_str, bool get_dependent_modules, - const OptionGroupPlatform *platform_options, - lldb::TargetSP &target_sp); + Status CreateTarget(Debugger &debugger, llvm::StringRef user_exe_path, + llvm::StringRef triple_str, bool get_dependent_modules, + const OptionGroupPlatform *platform_options, + lldb::TargetSP &target_sp); //------------------------------------------------------------------ /// Create a new Target. @@ -102,9 +102,9 @@ public: /// Same as the function above, but used when you already know the /// platform you will be using //------------------------------------------------------------------ - Error CreateTarget(Debugger &debugger, llvm::StringRef user_exe_path, - const ArchSpec &arch, bool get_dependent_modules, - lldb::PlatformSP &platform_sp, lldb::TargetSP &target_sp); + Status CreateTarget(Debugger &debugger, llvm::StringRef user_exe_path, + const ArchSpec &arch, bool get_dependent_modules, + lldb::PlatformSP &platform_sp, lldb::TargetSP &target_sp); //------------------------------------------------------------------ /// Delete a Target object from the list. @@ -211,20 +211,20 @@ protected: private: lldb::TargetSP GetDummyTarget(lldb_private::Debugger &debugger); - Error CreateDummyTarget(Debugger &debugger, - llvm::StringRef specified_arch_name, - lldb::TargetSP &target_sp); + Status CreateDummyTarget(Debugger &debugger, + llvm::StringRef specified_arch_name, + lldb::TargetSP &target_sp); - Error CreateTargetInternal(Debugger &debugger, llvm::StringRef user_exe_path, - llvm::StringRef triple_str, - bool get_dependent_files, - const OptionGroupPlatform *platform_options, - lldb::TargetSP &target_sp, bool is_dummy_target); + Status CreateTargetInternal(Debugger &debugger, llvm::StringRef user_exe_path, + llvm::StringRef triple_str, + bool get_dependent_files, + const OptionGroupPlatform *platform_options, + lldb::TargetSP &target_sp, bool is_dummy_target); - Error CreateTargetInternal(Debugger &debugger, llvm::StringRef user_exe_path, - const ArchSpec &arch, bool get_dependent_modules, - lldb::PlatformSP &platform_sp, - lldb::TargetSP &target_sp, bool is_dummy_target); + Status CreateTargetInternal(Debugger &debugger, llvm::StringRef user_exe_path, + const ArchSpec &arch, bool get_dependent_modules, + lldb::PlatformSP &platform_sp, + lldb::TargetSP &target_sp, bool is_dummy_target); DISALLOW_COPY_AND_ASSIGN(TargetList); }; diff --git a/include/lldb/Target/Thread.h b/include/lldb/Target/Thread.h index 47d0b7d767d6..cfab13069278 100644 --- a/include/lldb/Target/Thread.h +++ b/include/lldb/Target/Thread.h @@ -441,16 +441,16 @@ public: return GetStackFrameList()->GetCurrentInlinedDepth(); } - Error ReturnFromFrameWithIndex(uint32_t frame_idx, - lldb::ValueObjectSP return_value_sp, - bool broadcast = false); + Status ReturnFromFrameWithIndex(uint32_t frame_idx, + lldb::ValueObjectSP return_value_sp, + bool broadcast = false); - Error ReturnFromFrame(lldb::StackFrameSP frame_sp, - lldb::ValueObjectSP return_value_sp, - bool broadcast = false); + Status ReturnFromFrame(lldb::StackFrameSP frame_sp, + lldb::ValueObjectSP return_value_sp, + bool broadcast = false); - Error JumpToLine(const FileSpec &file, uint32_t line, bool can_leave_function, - std::string *warnings = nullptr); + Status JumpToLine(const FileSpec &file, uint32_t line, + bool can_leave_function, std::string *warnings = nullptr); virtual lldb::StackFrameSP GetFrameWithStackID(const StackID &stack_id) { if (stack_id.IsValid()) @@ -530,7 +530,7 @@ public: /// @return /// An error that describes anything that went wrong //------------------------------------------------------------------ - virtual Error + virtual Status StepIn(bool source_step, LazyBool step_in_avoids_code_without_debug_info = eLazyBoolCalculate, LazyBool step_out_avoids_code_without_debug_info = eLazyBoolCalculate); @@ -548,7 +548,7 @@ public: /// @return /// An error that describes anything that went wrong //------------------------------------------------------------------ - virtual Error StepOver( + virtual Status StepOver( bool source_step, LazyBool step_out_avoids_code_without_debug_info = eLazyBoolCalculate); @@ -561,7 +561,7 @@ public: /// @return /// An error that describes anything that went wrong //------------------------------------------------------------------ - virtual Error StepOut(); + virtual Status StepOut(); //------------------------------------------------------------------ /// Retrieves the per-thread data area. @@ -973,7 +973,7 @@ public: /// An error if the thread plan could not be unwound. //------------------------------------------------------------------ - Error UnwindInnermostExpression(); + Status UnwindInnermostExpression(); //------------------------------------------------------------------ /// Gets the outer-most plan that was popped off the plan stack in the diff --git a/include/lldb/Target/ThreadSpec.h b/include/lldb/Target/ThreadSpec.h index 204f1f9fbd70..d00172d1763b 100644 --- a/include/lldb/Target/ThreadSpec.h +++ b/include/lldb/Target/ThreadSpec.h @@ -45,7 +45,7 @@ public: static std::unique_ptr<ThreadSpec> CreateFromStructuredData(const StructuredData::Dictionary &data_dict, - Error &error); + Status &error); StructuredData::ObjectSP SerializeToStructuredData(); @@ -55,9 +55,9 @@ public: void SetTID(lldb::tid_t tid) { m_tid = tid; } - void SetName(const char *name) { m_name = name; } + void SetName(llvm::StringRef name) { m_name = name; } - void SetQueueName(const char *queue_name) { m_queue_name = queue_name; } + void SetQueueName(llvm::StringRef queue_name) { m_queue_name = queue_name; } uint32_t GetIndex() const { return m_index; } diff --git a/include/lldb/Utility/JSON.h b/include/lldb/Utility/JSON.h index 5c5d382048c1..bf8ed9afc008 100644 --- a/include/lldb/Utility/JSON.h +++ b/include/lldb/Utility/JSON.h @@ -253,7 +253,7 @@ class JSONParser : public StringExtractor { public: enum Token { Invalid, - Error, + Status, ObjectStart, ObjectEnd, ArrayStart, diff --git a/include/lldb/Utility/RegularExpression.h b/include/lldb/Utility/RegularExpression.h index d97e35647583..dba7001ce0fa 100644 --- a/include/lldb/Utility/RegularExpression.h +++ b/include/lldb/Utility/RegularExpression.h @@ -210,7 +210,7 @@ private: // Member variables //------------------------------------------------------------------ std::string m_re; ///< A copy of the original regular expression text - int m_comp_err; ///< Error code for the regular expression compilation + int m_comp_err; ///< Status code for the regular expression compilation regex_t m_preg; ///< The compiled regular expression }; diff --git a/include/lldb/Utility/SelectHelper.h b/include/lldb/Utility/SelectHelper.h index 5fa856b15d9f..12950d032fb6 100644 --- a/include/lldb/Utility/SelectHelper.h +++ b/include/lldb/Utility/SelectHelper.h @@ -10,7 +10,7 @@ #ifndef liblldb_SelectHelper_h_ #define liblldb_SelectHelper_h_ -#include "lldb/Utility/Error.h" // for Error +#include "lldb/Utility/Status.h" // for Status #include "lldb/lldb-types.h" // for socket_t #include "llvm/ADT/DenseMap.h" @@ -49,7 +49,7 @@ public: // Call the system's select() to wait for descriptors using // timeout provided in a call the SelectHelper::SetTimeout(), // or infinite wait if no timeout was set. - lldb_private::Error Select(); + lldb_private::Status Select(); protected: struct FDInfo { diff --git a/include/lldb/Utility/Error.h b/include/lldb/Utility/Status.h index a236ab45a0bb..4ac191b1f613 100644 --- a/include/lldb/Utility/Error.h +++ b/include/lldb/Utility/Status.h @@ -1,4 +1,5 @@ -//===-- Error.h -------------------------------------------------*- C++ -*-===// +//===-- Status.h -------------------------------------------------*- C++ +//-*-===// // // The LLVM Compiler Infrastructure // @@ -30,12 +31,12 @@ class raw_ostream; namespace lldb_private { //---------------------------------------------------------------------- -/// @class Error Error.h "lldb/Utility/Error.h" +/// @class Status Status.h "lldb/Utility/Status.h" /// @brief An error handling class. /// /// This class is designed to be able to hold any error code that can be /// encountered on a given platform. The errors are stored as a value -/// of type Error::ValueType. This value should be large enough to hold +/// of type Status::ValueType. This value should be large enough to hold /// any and all errors that the class supports. Each error has an /// associated type that is of type lldb::ErrorType. New types /// can be added to support new error types, and architecture specific @@ -49,7 +50,7 @@ namespace lldb_private { /// be cached until the error is cleared of the value of the error /// changes. //---------------------------------------------------------------------- -class Error { +class Status { public: //------------------------------------------------------------------ /// Every error value that this object can contain needs to be able @@ -68,15 +69,17 @@ public: /// @param[in] type /// The type for \a err. //------------------------------------------------------------------ - Error(); + Status(); - explicit Error(ValueType err, lldb::ErrorType type = lldb::eErrorTypeGeneric); + explicit Status(ValueType err, + lldb::ErrorType type = lldb::eErrorTypeGeneric); - /* implicit */ Error(std::error_code EC); + /* implicit */ Status(std::error_code EC); - explicit Error(const char *format, ...) __attribute__((format(printf, 2, 3))); + explicit Status(const char *format, ...) + __attribute__((format(printf, 2, 3))); - Error(const Error &rhs); + Status(const Status &rhs); //------------------------------------------------------------------ /// Assignment operator. /// @@ -86,7 +89,7 @@ public: /// @return /// A const reference to this object. //------------------------------------------------------------------ - const Error &operator=(const Error &rhs); + const Status &operator=(const Status &rhs); //------------------------------------------------------------------ /// Assignment operator from a kern_return_t. @@ -99,9 +102,9 @@ public: /// @return /// A const reference to this object. //------------------------------------------------------------------ - const Error &operator=(uint32_t err); + const Status &operator=(uint32_t err); - ~Error(); + ~Status(); //------------------------------------------------------------------ /// Get the error string associated with the current error. @@ -186,7 +189,7 @@ public: /// Set the current error to errno. /// /// Update the error value to be \c errno and update the type to - /// be \c Error::POSIX. + /// be \c Status::POSIX. //------------------------------------------------------------------ void SetErrorToErrno(); @@ -194,7 +197,7 @@ public: /// Set the current error to a generic error. /// /// Update the error value to be \c LLDB_GENERIC_ERROR and update the - /// type to be \c Error::Generic. + /// type to be \c Status::Generic. //------------------------------------------------------------------ void SetErrorToGenericError(); @@ -257,7 +260,7 @@ protected: //------------------------------------------------------------------ /// Member variables //------------------------------------------------------------------ - ValueType m_code; ///< Error code as an integer value. + ValueType m_code; ///< Status code as an integer value. lldb::ErrorType m_type; ///< The type of the above error code. mutable std::string m_string; ///< A string representation of the error code. }; @@ -265,8 +268,8 @@ protected: } // namespace lldb_private namespace llvm { -template <> struct format_provider<lldb_private::Error> { - static void format(const lldb_private::Error &error, llvm::raw_ostream &OS, +template <> struct format_provider<lldb_private::Status> { + static void format(const lldb_private::Status &error, llvm::raw_ostream &OS, llvm::StringRef Options); }; } diff --git a/include/lldb/Utility/UUID.h b/include/lldb/Utility/UUID.h index 28069bbe4c73..6313025dec15 100644 --- a/include/lldb/Utility/UUID.h +++ b/include/lldb/Utility/UUID.h @@ -54,6 +54,7 @@ public: std::string GetAsString(const char *separator = nullptr) const; + size_t SetFromStringRef(llvm::StringRef str, uint32_t num_uuid_bytes = 16); size_t SetFromCString(const char *c_str, uint32_t num_uuid_bytes = 16); // Decode as many UUID bytes (up to 16) as possible from the C string "cstr" diff --git a/include/lldb/lldb-forward.h b/include/lldb/lldb-forward.h index 2180b31527e0..392dc641558d 100644 --- a/include/lldb/lldb-forward.h +++ b/include/lldb/lldb-forward.h @@ -87,7 +87,7 @@ class DynamicCheckerFunctions; class DynamicLoader; class Editline; class EmulateInstruction; -class Error; +class Status; class EvaluateExpressionOptions; class Event; class EventData; diff --git a/include/lldb/lldb-private-enumerations.h b/include/lldb/lldb-private-enumerations.h index 9572bee81177..332265665237 100644 --- a/include/lldb/lldb-private-enumerations.h +++ b/include/lldb/lldb-private-enumerations.h @@ -205,9 +205,10 @@ typedef enum MemoryModuleLoadLevel { enum class LineStatus { Success, // The line that was just edited if good and should be added to the // lines - Error, // There is an error with the current line and it needs to be re-edited - // before it can be accepted - Done // Lines are complete + Status, // There is an error with the current line and it needs to be + // re-edited + // before it can be accepted + Done // Lines are complete }; //---------------------------------------------------------------------- diff --git a/include/lldb/lldb-private-interfaces.h b/include/lldb/lldb-private-interfaces.h index d3e80075625e..9f25eb1f9a29 100644 --- a/include/lldb/lldb-private-interfaces.h +++ b/include/lldb/lldb-private-interfaces.h @@ -46,7 +46,7 @@ typedef ObjectFile *(*ObjectFileCreateMemoryInstance)( const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp, const lldb::ProcessSP &process_sp, lldb::addr_t offset); typedef bool (*ObjectFileSaveCore)(const lldb::ProcessSP &process_sp, - const FileSpec &outfile, Error &error); + const FileSpec &outfile, Status &error); typedef EmulateInstruction *(*EmulateInstructionCreateInstance)( const ArchSpec &arch, InstructionType inst_type); typedef OperatingSystem *(*OperatingSystemCreateInstance)(Process *process, @@ -58,8 +58,8 @@ typedef lldb::CommandObjectSP (*LanguageRuntimeGetCommandObject)( CommandInterpreter &interpreter); typedef lldb::StructuredDataPluginSP (*StructuredDataPluginCreateInstance)( Process &process); -typedef Error (*StructuredDataFilterLaunchInfo)(ProcessLaunchInfo &launch_info, - Target *target); +typedef Status (*StructuredDataFilterLaunchInfo)(ProcessLaunchInfo &launch_info, + Target *target); typedef SystemRuntime *(*SystemRuntimeCreateInstance)(Process *process); typedef lldb::PlatformSP (*PlatformCreateInstance)(bool force, const ArchSpec *arch); @@ -96,7 +96,7 @@ typedef lldb::InstrumentationRuntimeSP (*InstrumentationRuntimeCreateInstance)( const lldb::ProcessSP &process_sp); typedef lldb::TypeSystemSP (*TypeSystemCreateInstance)( lldb::LanguageType language, Module *module, Target *target); -typedef lldb::REPLSP (*REPLCreateInstance)(Error &error, +typedef lldb::REPLSP (*REPLCreateInstance)(Status &error, lldb::LanguageType language, Debugger *debugger, Target *target, const char *repl_options); diff --git a/include/lldb/lldb-private-types.h b/include/lldb/lldb-private-types.h index 4f192b66369f..fd21641218fb 100644 --- a/include/lldb/lldb-private-types.h +++ b/include/lldb/lldb-private-types.h @@ -27,7 +27,7 @@ class Platform; class ExecutionContext; typedef llvm::sys::DynamicLibrary (*LoadPluginCallbackType)( - const lldb::DebuggerSP &debugger_sp, const FileSpec &spec, Error &error); + const lldb::DebuggerSP &debugger_sp, const FileSpec &spec, Status &error); //---------------------------------------------------------------------- // Every register is described in detail including its name, alternate diff --git a/lldb.xcodeproj/project.pbxproj b/lldb.xcodeproj/project.pbxproj index e988dba59992..a01a1798ce9a 100644 --- a/lldb.xcodeproj/project.pbxproj +++ b/lldb.xcodeproj/project.pbxproj @@ -333,7 +333,6 @@ 26744EF11338317700EF765A /* GDBRemoteCommunicationClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26744EED1338317700EF765A /* GDBRemoteCommunicationClient.cpp */; }; 26744EF31338317700EF765A /* GDBRemoteCommunicationServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26744EEF1338317700EF765A /* GDBRemoteCommunicationServer.cpp */; }; 26764C971E48F482008D3573 /* ConstString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26764C961E48F482008D3573 /* ConstString.cpp */; }; - 26764C991E48F4D2008D3573 /* Error.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26764C981E48F4D2008D3573 /* Error.cpp */; }; 26764C9E1E48F51E008D3573 /* Stream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26764C9D1E48F51E008D3573 /* Stream.cpp */; }; 26764CA01E48F528008D3573 /* RegularExpression.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26764C9F1E48F528008D3573 /* RegularExpression.cpp */; }; 26764CA21E48F547008D3573 /* StreamString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26764CA11E48F547008D3573 /* StreamString.cpp */; }; @@ -691,6 +690,8 @@ 3FDFED2D19C257A0009756A7 /* HostProcess.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3FDFED2C19C257A0009756A7 /* HostProcess.cpp */; }; 490A36C0180F0E6F00BA31F8 /* PlatformWindows.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 490A36BD180F0E6F00BA31F8 /* PlatformWindows.cpp */; }; 490A966B1628C3BF00F0002E /* SBDeclaration.h in Headers */ = {isa = PBXBuildFile; fileRef = 9452573816262CEF00325455 /* SBDeclaration.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 492DB7E71EC662B100B9E9AF /* Status.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 492DB7E61EC662B100B9E9AF /* Status.h */; }; + 492DB7EB1EC662E200B9E9AF /* Status.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 492DB7E81EC662D100B9E9AF /* Status.cpp */; }; 4939EA8D1BD56B6D00084382 /* REPL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4939EA8C1BD56B6D00084382 /* REPL.cpp */; }; 494260DA14579144003C1C78 /* VerifyDecl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 494260D914579144003C1C78 /* VerifyDecl.cpp */; }; 4959511F1A1BC4BC00F6F8FC /* ClangModulesDeclVendor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4959511E1A1BC4BC00F6F8FC /* ClangModulesDeclVendor.cpp */; }; @@ -1193,6 +1194,7 @@ dstPath = "$(DEVELOPER_INSTALL_DIR)/usr/share/man/man1"; dstSubfolderSpec = 0; files = ( + 492DB7E71EC662B100B9E9AF /* Status.h in CopyFiles */, AF90106515AB7D3600FF120D /* lldb.1 in CopyFiles */, ); runOnlyForDeploymentPostprocessing = 1; @@ -1853,8 +1855,6 @@ 2675F6FF1332BE690067997B /* PlatformRemoteiOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformRemoteiOS.h; sourceTree = "<group>"; }; 26764C951E48F46F008D3573 /* ConstString.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ConstString.h; path = include/lldb/Utility/ConstString.h; sourceTree = "<group>"; }; 26764C961E48F482008D3573 /* ConstString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ConstString.cpp; path = source/Utility/ConstString.cpp; sourceTree = "<group>"; }; - 26764C981E48F4D2008D3573 /* Error.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Error.cpp; path = source/Utility/Error.cpp; sourceTree = "<group>"; }; - 26764C9A1E48F4DD008D3573 /* Error.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = Error.h; path = include/lldb/Utility/Error.h; sourceTree = "<group>"; }; 26764C9B1E48F50C008D3573 /* Stream.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = Stream.h; path = include/lldb/Utility/Stream.h; sourceTree = "<group>"; }; 26764C9C1E48F516008D3573 /* RegularExpression.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = RegularExpression.h; path = include/lldb/Utility/RegularExpression.h; sourceTree = "<group>"; }; 26764C9D1E48F51E008D3573 /* Stream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Stream.cpp; path = source/Utility/Stream.cpp; sourceTree = "<group>"; }; @@ -2412,6 +2412,8 @@ 490A36BE180F0E6F00BA31F8 /* PlatformWindows.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformWindows.h; sourceTree = "<group>"; }; 4911934B1226383D00578B7F /* ASTStructExtractor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASTStructExtractor.h; path = ExpressionParser/Clang/ASTStructExtractor.h; sourceTree = "<group>"; }; 491193501226386000578B7F /* ASTStructExtractor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ASTStructExtractor.cpp; path = ExpressionParser/Clang/ASTStructExtractor.cpp; sourceTree = "<group>"; }; + 492DB7E61EC662B100B9E9AF /* Status.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Status.h; path = include/lldb/Utility/Status.h; sourceTree = "<group>"; }; + 492DB7E81EC662D100B9E9AF /* Status.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Status.cpp; path = source/Utility/Status.cpp; sourceTree = "<group>"; }; 49307AAD11DEA4D90081F992 /* IRForTarget.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = IRForTarget.cpp; path = ExpressionParser/Clang/IRForTarget.cpp; sourceTree = "<group>"; }; 49307AB111DEA4F20081F992 /* IRForTarget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IRForTarget.h; path = ExpressionParser/Clang/IRForTarget.h; sourceTree = "<group>"; }; 4939EA8B1BD56B3700084382 /* REPL.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = REPL.h; path = include/lldb/Expression/REPL.h; sourceTree = "<group>"; }; @@ -4240,8 +4242,6 @@ 49CA96F41E6AAC8E00C03FEE /* DataExtractor.h */, 49CA96E91E6AAC6600C03FEE /* DataExtractor.cpp */, 9481FE6B1B5F2D9200DED357 /* Either.h */, - 26764C9A1E48F4DD008D3573 /* Error.h */, - 26764C981E48F4D2008D3573 /* Error.cpp */, AFC2DCE61E6E2ED000283714 /* FastDemangle.cpp */, AFC2DCED1E6E2F9800283714 /* FastDemangle.h */, AFC2DCF21E6E30CF00283714 /* History.cpp */, @@ -4261,6 +4261,8 @@ 261B5A5211C3F2AD00AABD0A /* SharingPtr.cpp */, 4C2FAE2E135E3A70001EDE44 /* SharedCluster.h */, 261B5A5311C3F2AD00AABD0A /* SharingPtr.h */, + 492DB7E61EC662B100B9E9AF /* Status.h */, + 492DB7E81EC662D100B9E9AF /* Status.cpp */, 26764C9B1E48F50C008D3573 /* Stream.h */, 26764C9D1E48F51E008D3573 /* Stream.cpp */, AFC2DCF51E6E316A00283714 /* StreamCallback.cpp */, @@ -7249,6 +7251,7 @@ 6D0F61591C80AB3500A4ECEE /* JavaFormatterFunctions.cpp in Sources */, 2689005913353E0400698AC0 /* ValueObjectConstResult.cpp in Sources */, 2689005A13353E0400698AC0 /* ValueObjectList.cpp in Sources */, + 492DB7EB1EC662E200B9E9AF /* Status.cpp in Sources */, 2689005B13353E0400698AC0 /* ValueObjectRegister.cpp in Sources */, 2689005C13353E0400698AC0 /* ValueObjectVariable.cpp in Sources */, 264A58EE1A7DBCAD00A6B1B0 /* OptionValueFormatEntity.cpp in Sources */, @@ -7360,7 +7363,6 @@ 268900B413353E5000698AC0 /* RegisterContextMacOSXFrameBackchain.cpp in Sources */, AE44FB321BB07EBC0033EB62 /* GoParser.cpp in Sources */, 3F8169311ABB7A6D001DA9DF /* SystemInitializer.cpp in Sources */, - 26764C991E48F4D2008D3573 /* Error.cpp in Sources */, 949EEDB21BA76731008C63CF /* NSIndexPath.cpp in Sources */, 3FDFED2D19C257A0009756A7 /* HostProcess.cpp in Sources */, 268900B513353E5000698AC0 /* StopInfoMachException.cpp in Sources */, diff --git a/packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py b/packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py index 90562f52a4b2..e476c48d1844 100644 --- a/packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py +++ b/packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py @@ -18,6 +18,10 @@ class ReturnValueTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) + def affected_by_pr33042(self): + return ("clang" in self.getCompiler() and self.getArchitecture() == + "aarch64" and self.getPlatform() == "linux") + @expectedFailureAll(oslist=["freebsd"], archs=["i386"]) @expectedFailureAll(oslist=["macosx"], archs=["i386"], bugnumber="<rdar://problem/28719652>") @expectedFailureAll( @@ -148,7 +152,8 @@ class ReturnValueTestCase(TestBase): self.return_and_test_struct_value("return_two_int") self.return_and_test_struct_value("return_three_int") self.return_and_test_struct_value("return_four_int") - self.return_and_test_struct_value("return_five_int") + if not self.affected_by_pr33042(): + self.return_and_test_struct_value("return_five_int") self.return_and_test_struct_value("return_two_double") self.return_and_test_struct_value("return_one_double_two_float") diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/variable_out_of_scope/TestWatchedVarHitWhenInScope.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/variable_out_of_scope/TestWatchedVarHitWhenInScope.py index d30741497635..47454498e70e 100644 --- a/packages/Python/lldbsuite/test/functionalities/watchpoint/variable_out_of_scope/TestWatchedVarHitWhenInScope.py +++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/variable_out_of_scope/TestWatchedVarHitWhenInScope.py @@ -11,6 +11,7 @@ import time import lldb from lldbsuite.test.lldbtest import * import lldbsuite.test.lldbutil as lldbutil +from lldbsuite.test.decorators import * class WatchedVariableHitWhenInScopeTestCase(TestBase): @@ -33,6 +34,8 @@ class WatchedVariableHitWhenInScopeTestCase(TestBase): self.exe_name = self.testMethodName self.d = {'C_SOURCES': self.source, 'EXE': self.exe_name} + # Test hangs due to a kernel bug, see fdfeff0f in the linux kernel for details + @skipIfTargetAndroid(api_levels=list(range(25+1)), archs=["aarch64", "arm"]) @unittest2.expectedFailure("rdar://problem/18685649") def test_watched_var_should_only_hit_when_in_scope(self): """Test that a variable watchpoint should only hit when in scope.""" diff --git a/packages/Python/lldbsuite/test/lang/cpp/class-template-parameter-pack/Makefile b/packages/Python/lldbsuite/test/lang/cpp/class-template-parameter-pack/Makefile new file mode 100644 index 000000000000..99bfa7e03b47 --- /dev/null +++ b/packages/Python/lldbsuite/test/lang/cpp/class-template-parameter-pack/Makefile @@ -0,0 +1,3 @@ +LEVEL = ../../../make +CXX_SOURCES := main.cpp +include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/lang/cpp/class-template-parameter-pack/TestClassTemplateParameterPack.py b/packages/Python/lldbsuite/test/lang/cpp/class-template-parameter-pack/TestClassTemplateParameterPack.py new file mode 100644 index 000000000000..aad2ea20c133 --- /dev/null +++ b/packages/Python/lldbsuite/test/lang/cpp/class-template-parameter-pack/TestClassTemplateParameterPack.py @@ -0,0 +1,9 @@ +from lldbsuite.test import lldbinline +from lldbsuite.test import decorators + +lldbinline.MakeInlineTest( + __file__, globals(), [ + decorators.expectedFailureAll( + oslist=["windows"], bugnumber="llvm.org/pr24764"), + decorators.expectedFailureAll( + compiler="gcc")]) diff --git a/packages/Python/lldbsuite/test/lang/cpp/class-template-parameter-pack/main.cpp b/packages/Python/lldbsuite/test/lang/cpp/class-template-parameter-pack/main.cpp new file mode 100644 index 000000000000..90e63b40f417 --- /dev/null +++ b/packages/Python/lldbsuite/test/lang/cpp/class-template-parameter-pack/main.cpp @@ -0,0 +1,61 @@ +//===-- main.cpp ------------------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LIDENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +template <class T, int... Args> struct C { + T member; + bool isSixteenThirtyTwo() { return false; } +}; + +template <> struct C<int, 16> { + int member; + bool isSixteenThirtyTwo() { return false; } +}; + +template <> struct C<int, 16, 32> : C<int, 16> { + bool isSixteenThirtyTwo() { return true; } +}; + +template <class T, typename... Args> struct D { + T member; + bool isIntBool() { return false; } +}; + +template <> struct D<int, int> { + int member; + bool isIntBool() { return false; } +}; + +template <> struct D<int, int, bool> : D<int, int> { + bool isIntBool() { return true; } +}; + +int main (int argc, char const *argv[]) +{ + C<int,16,32> myC; + C<int,16> myLesserC; + myC.member = 64; + (void)C<int,16,32>().isSixteenThirtyTwo(); + (void)C<int,16>().isSixteenThirtyTwo(); + (void)(myC.member != 64); //% self.expect("expression -- myC", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["64"]) + //% self.expect("expression -- C<int, 16>().isSixteenThirtyTwo()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["false"]) + //% self.expect("expression -- C<int, 16, 32>().isSixteenThirtyTwo()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["true"]) + //% self.expect("expression -- myLesserC.isSixteenThirtyTwo()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["false"]) + //% self.expect("expression -- myC.isSixteenThirtyTwo()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["true"]) + + D<int,int,bool> myD; + D<int,int> myLesserD; + myD.member = 64; + (void)D<int,int,bool>().isIntBool(); + (void)D<int,int>().isIntBool(); + return myD.member != 64; //% self.expect("expression -- myD", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["64"]) + //% self.expect("expression -- D<int, int>().isIntBool()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["false"]) + //% self.expect("expression -- D<int, int, bool>().isIntBool()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["true"]) + //% self.expect("expression -- myLesserD.isIntBool()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["false"]) + //% self.expect("expression -- myD.isIntBool()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["true"]) +} diff --git a/packages/Python/lldbsuite/test/lang/cpp/function-template-parameter-pack/Makefile b/packages/Python/lldbsuite/test/lang/cpp/function-template-parameter-pack/Makefile new file mode 100644 index 000000000000..99bfa7e03b47 --- /dev/null +++ b/packages/Python/lldbsuite/test/lang/cpp/function-template-parameter-pack/Makefile @@ -0,0 +1,3 @@ +LEVEL = ../../../make +CXX_SOURCES := main.cpp +include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/lang/cpp/function-template-parameter-pack/TestFunctionTemplateParameterPack.py b/packages/Python/lldbsuite/test/lang/cpp/function-template-parameter-pack/TestFunctionTemplateParameterPack.py new file mode 100644 index 000000000000..810aefee0f07 --- /dev/null +++ b/packages/Python/lldbsuite/test/lang/cpp/function-template-parameter-pack/TestFunctionTemplateParameterPack.py @@ -0,0 +1,6 @@ +from lldbsuite.test import lldbinline +from lldbsuite.test import decorators + +lldbinline.MakeInlineTest( + __file__, globals(), [ + decorators.expectedFailureAll(bugnumber="rdar://problem/32096064")]) diff --git a/packages/Python/lldbsuite/test/lang/cpp/function-template-parameter-pack/main.cpp b/packages/Python/lldbsuite/test/lang/cpp/function-template-parameter-pack/main.cpp new file mode 100644 index 000000000000..e802d40e5f8b --- /dev/null +++ b/packages/Python/lldbsuite/test/lang/cpp/function-template-parameter-pack/main.cpp @@ -0,0 +1,24 @@ +//===-- main.cpp ------------------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LIDENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +template <class T> int staticSizeof() { + return sizeof(T); +} + +template <class T1, class T2, class... Ts> int staticSizeof() { + return staticSizeof<T2, Ts...>() + sizeof(T1); +} + +int main (int argc, char const *argv[]) +{ + int sz = staticSizeof<long, int, char>(); + return staticSizeof<long, int, char>() != sz; //% self.expect("expression -- sz == staticSizeof<long, int, char>()", "staticSizeof<long, int, char> worked", substrs = ["true"]) + //% self.expect("expression -- sz == staticSizeof<long, int>() + sizeof(char)", "staticSizeof<long, int> worked", substrs = ["true"]) + //% self.expect("expression -- sz == staticSizeof<long>() + sizeof(int) + sizeof(char)", "staticSizeof<long> worked", substrs = ["true"]) +} diff --git a/packages/Python/lldbsuite/test/lang/objc/ptr_refs/Makefile b/packages/Python/lldbsuite/test/lang/objc/ptr_refs/Makefile new file mode 100644 index 000000000000..b05ff34b739b --- /dev/null +++ b/packages/Python/lldbsuite/test/lang/objc/ptr_refs/Makefile @@ -0,0 +1,5 @@ +LEVEL = ../../../make + +OBJC_SOURCES := main.m + +include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/lang/objc/ptr_refs/TestPtrRefsObjC.py b/packages/Python/lldbsuite/test/lang/objc/ptr_refs/TestPtrRefsObjC.py new file mode 100644 index 000000000000..e5633156cd18 --- /dev/null +++ b/packages/Python/lldbsuite/test/lang/objc/ptr_refs/TestPtrRefsObjC.py @@ -0,0 +1,50 @@ +""" +Test the ptr_refs tool on Darwin with Objective-C +""" + +from __future__ import print_function + +import os +import lldb +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + + +class TestPtrRefsObjC(TestBase): + + mydir = TestBase.compute_mydir(__file__) + + @skipUnlessDarwin + def test_ptr_refs(self): + """Test the ptr_refs tool on Darwin with Objective-C""" + self.build() + exe_name = 'a.out' + exe = os.path.join(os.getcwd(), exe_name) + + target = self.dbg.CreateTarget(exe) + self.assertTrue(target, VALID_TARGET) + + main_file_spec = lldb.SBFileSpec('main.m') + breakpoint = target.BreakpointCreateBySourceRegex( + 'break', main_file_spec) + self.assertTrue(breakpoint and + breakpoint.GetNumLocations() == 1, + VALID_BREAKPOINT) + + process = target.LaunchSimple( + None, None, self.get_process_working_directory()) + self.assertTrue(process, PROCESS_IS_VALID) + + # Frame #0 should be on self.line1 and the break condition should hold. + thread = lldbutil.get_stopped_thread( + process, lldb.eStopReasonBreakpoint) + self.assertTrue( + thread.IsValid(), + "There should be a thread stopped due to breakpoint condition") + + frame = thread.GetFrameAtIndex(0) + + self.dbg.HandleCommand("script import lldb.macosx.heap") + self.expect("ptr_refs self", substrs=["malloc", "stack"]) + diff --git a/packages/Python/lldbsuite/test/lang/objc/ptr_refs/main.m b/packages/Python/lldbsuite/test/lang/objc/ptr_refs/main.m new file mode 100644 index 000000000000..8203165e4971 --- /dev/null +++ b/packages/Python/lldbsuite/test/lang/objc/ptr_refs/main.m @@ -0,0 +1,39 @@ +//===-- main.c --------------------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#import <Foundation/Foundation.h> + +@interface MyClass : NSObject { +}; +-(void)test; +@end + +@implementation MyClass +-(void)test { + printf("%p\n", self); // break here +} +@end + +@interface MyOwner : NSObject { + @public id ownedThing; // should be id, to test <rdar://problem/31363513> +}; +@end + +@implementation MyOwner +@end + +int main (int argc, char const *argv[]) { + @autoreleasepool { + MyOwner *owner = [[MyOwner alloc] init]; + owner->ownedThing = [[MyClass alloc] init]; + [(MyClass*)owner->ownedThing test]; + } + return 0; +} + diff --git a/scripts/Xcode/repo.py b/scripts/Xcode/repo.py index c1e5fe339d26..7623c503ba9f 100644 --- a/scripts/Xcode/repo.py +++ b/scripts/Xcode/repo.py @@ -3,6 +3,7 @@ import os import re import shutil import subprocess +import sys def identifier(): try: diff --git a/source/API/SBBreakpoint.cpp b/source/API/SBBreakpoint.cpp index 0b661a646f31..bf9603248d71 100644 --- a/source/API/SBBreakpoint.cpp +++ b/source/API/SBBreakpoint.cpp @@ -557,7 +557,7 @@ SBError SBBreakpoint::SetScriptCallbackBody(const char *callback_body_text) { std::lock_guard<std::recursive_mutex> guard( bkpt_sp->GetTarget().GetAPIMutex()); BreakpointOptions *bp_options = bkpt_sp->GetOptions(); - Error error = + Status error = bkpt_sp->GetTarget() .GetDebugger() .GetCommandInterpreter() @@ -578,8 +578,8 @@ bool SBBreakpoint::AddName(const char *new_name) { if (bkpt_sp) { std::lock_guard<std::recursive_mutex> guard( bkpt_sp->GetTarget().GetAPIMutex()); - Error error; // Think I'm just going to swallow the error here, it's - // probably more annoying to have to provide it. + Status error; // Think I'm just going to swallow the error here, it's + // probably more annoying to have to provide it. return bkpt_sp->AddName(new_name, error); } diff --git a/source/API/SBBreakpointLocation.cpp b/source/API/SBBreakpointLocation.cpp index d8779ffe2ba8..dc9c00d8dd57 100644 --- a/source/API/SBBreakpointLocation.cpp +++ b/source/API/SBBreakpointLocation.cpp @@ -171,7 +171,7 @@ SBBreakpointLocation::SetScriptCallbackBody(const char *callback_body_text) { std::lock_guard<std::recursive_mutex> guard( loc_sp->GetTarget().GetAPIMutex()); BreakpointOptions *bp_options = loc_sp->GetLocationOptions(); - Error error = + Status error = loc_sp->GetBreakpoint() .GetTarget() .GetDebugger() diff --git a/source/API/SBCommandReturnObject.cpp b/source/API/SBCommandReturnObject.cpp index 7eed94e05b10..5a8909b98e53 100644 --- a/source/API/SBCommandReturnObject.cpp +++ b/source/API/SBCommandReturnObject.cpp @@ -17,8 +17,8 @@ #include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/Utility/ConstString.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" using namespace lldb; using namespace lldb_private; @@ -182,7 +182,7 @@ bool SBCommandReturnObject::GetDescription(SBStream &description) { Stream &strm = description.ref(); if (m_opaque_ap) { - description.Printf("Status: "); + description.Printf("Error: "); lldb::ReturnStatus status = m_opaque_ap->GetStatus(); if (status == lldb::eReturnStatusStarted) strm.PutCString("Started"); @@ -271,7 +271,7 @@ void SBCommandReturnObject::SetError(lldb::SBError &error, if (error.IsValid()) m_opaque_ap->SetError(error.ref(), fallback_error_cstr); else if (fallback_error_cstr) - m_opaque_ap->SetError(Error(), fallback_error_cstr); + m_opaque_ap->SetError(Status(), fallback_error_cstr); } } diff --git a/source/API/SBDebugger.cpp b/source/API/SBDebugger.cpp index 8d23d3eb8505..3cdb6bbfd5f9 100644 --- a/source/API/SBDebugger.cpp +++ b/source/API/SBDebugger.cpp @@ -57,7 +57,7 @@ using namespace lldb_private; static llvm::sys::DynamicLibrary LoadPlugin(const lldb::DebuggerSP &debugger_sp, const FileSpec &spec, - Error &error) { + Status &error) { llvm::sys::DynamicLibrary dynlib = llvm::sys::DynamicLibrary::getPermanentLibrary(spec.GetPath().c_str()); if (dynlib.isValid()) { @@ -551,7 +551,7 @@ SBDebugger::CreateTargetWithFileAndTargetTriple(const char *filename, TargetSP target_sp; if (m_opaque_sp) { const bool add_dependent_modules = true; - Error error(m_opaque_sp->GetTargetList().CreateTarget( + Status error(m_opaque_sp->GetTargetList().CreateTarget( *m_opaque_sp, filename, target_triple, add_dependent_modules, nullptr, target_sp)); sb_target.SetSP(target_sp); @@ -574,7 +574,7 @@ SBTarget SBDebugger::CreateTargetWithFileAndArch(const char *filename, SBTarget sb_target; TargetSP target_sp; if (m_opaque_sp) { - Error error; + Status error; const bool add_dependent_modules = true; error = m_opaque_sp->GetTargetList().CreateTarget( @@ -600,7 +600,7 @@ SBTarget SBDebugger::CreateTarget(const char *filename) { SBTarget sb_target; TargetSP target_sp; if (m_opaque_sp) { - Error error; + Status error; const bool add_dependent_modules = true; error = m_opaque_sp->GetTargetList().CreateTarget( *m_opaque_sp, filename, "", add_dependent_modules, nullptr, target_sp); @@ -873,7 +873,7 @@ SBError SBDebugger::SetInternalVariable(const char *var_name, const char *value, SBError sb_error; DebuggerSP debugger_sp(Debugger::FindDebuggerWithInstanceName( ConstString(debugger_instance_name))); - Error error; + Status error; if (debugger_sp) { ExecutionContext exe_ctx( debugger_sp->GetCommandInterpreter().GetExecutionContext()); @@ -894,7 +894,7 @@ SBDebugger::GetInternalVariableValue(const char *var_name, SBStringList ret_value; DebuggerSP debugger_sp(Debugger::FindDebuggerWithInstanceName( ConstString(debugger_instance_name))); - Error error; + Status error; if (debugger_sp) { ExecutionContext exe_ctx( debugger_sp->GetCommandInterpreter().GetExecutionContext()); diff --git a/source/API/SBError.cpp b/source/API/SBError.cpp index a692a9678cde..b2811d0ac381 100644 --- a/source/API/SBError.cpp +++ b/source/API/SBError.cpp @@ -9,8 +9,8 @@ #include "lldb/API/SBError.h" #include "lldb/API/SBStream.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" #include <stdarg.h> @@ -21,7 +21,7 @@ SBError::SBError() : m_opaque_ap() {} SBError::SBError(const SBError &rhs) : m_opaque_ap() { if (rhs.IsValid()) - m_opaque_ap.reset(new Error(*rhs)); + m_opaque_ap.reset(new Status(*rhs)); } SBError::~SBError() {} @@ -31,7 +31,7 @@ const SBError &SBError::operator=(const SBError &rhs) { if (m_opaque_ap.get()) *m_opaque_ap = *rhs; else - m_opaque_ap.reset(new Error(*rhs)); + m_opaque_ap.reset(new Status(*rhs)); } else m_opaque_ap.reset(); @@ -108,7 +108,7 @@ void SBError::SetError(uint32_t err, ErrorType type) { m_opaque_ap->SetError(err, type); } -void SBError::SetError(const Error &lldb_error) { +void SBError::SetError(const Status &lldb_error) { CreateIfNeeded(); *m_opaque_ap = lldb_error; } @@ -141,19 +141,19 @@ bool SBError::IsValid() const { return m_opaque_ap.get() != NULL; } void SBError::CreateIfNeeded() { if (m_opaque_ap.get() == NULL) - m_opaque_ap.reset(new Error()); + m_opaque_ap.reset(new Status()); } -lldb_private::Error *SBError::operator->() { return m_opaque_ap.get(); } +lldb_private::Status *SBError::operator->() { return m_opaque_ap.get(); } -lldb_private::Error *SBError::get() { return m_opaque_ap.get(); } +lldb_private::Status *SBError::get() { return m_opaque_ap.get(); } -lldb_private::Error &SBError::ref() { +lldb_private::Status &SBError::ref() { CreateIfNeeded(); return *m_opaque_ap; } -const lldb_private::Error &SBError::operator*() const { +const lldb_private::Status &SBError::operator*() const { // Be sure to call "IsValid()" before calling this function or it will crash return *m_opaque_ap; } diff --git a/source/API/SBFrame.cpp b/source/API/SBFrame.cpp index d52bbe8069f8..684a707dda94 100644 --- a/source/API/SBFrame.cpp +++ b/source/API/SBFrame.cpp @@ -606,7 +606,7 @@ lldb::SBValue SBFrame::GetValueForVariablePath(const char *var_path, frame = exe_ctx.GetFramePtr(); if (frame) { VariableSP var_sp; - Error error; + Status error; ValueObjectSP value_sp(frame->GetValueForVariableExpressionPath( var_path, eNoDynamicValues, StackFrame::eExpressionPathOptionCheckPtrVsMember | diff --git a/source/API/SBHostOS.cpp b/source/API/SBHostOS.cpp index c25499db89cd..90b75a6ecd7b 100644 --- a/source/API/SBHostOS.cpp +++ b/source/API/SBHostOS.cpp @@ -80,7 +80,7 @@ lldb::thread_t SBHostOS::ThreadCreate(const char *name, void SBHostOS::ThreadCreated(const char *name) {} bool SBHostOS::ThreadCancel(lldb::thread_t thread, SBError *error_ptr) { - Error error; + Status error; HostThread host_thread(thread); error = host_thread.Cancel(); if (error_ptr) @@ -90,7 +90,7 @@ bool SBHostOS::ThreadCancel(lldb::thread_t thread, SBError *error_ptr) { } bool SBHostOS::ThreadDetach(lldb::thread_t thread, SBError *error_ptr) { - Error error; + Status error; #if defined(_WIN32) if (error_ptr) error_ptr->SetErrorString("ThreadDetach is not supported on this platform"); @@ -106,7 +106,7 @@ bool SBHostOS::ThreadDetach(lldb::thread_t thread, SBError *error_ptr) { bool SBHostOS::ThreadJoin(lldb::thread_t thread, lldb::thread_result_t *result, SBError *error_ptr) { - Error error; + Status error; HostThread host_thread(thread); error = host_thread.Join(result); if (error_ptr) diff --git a/source/API/SBModule.cpp b/source/API/SBModule.cpp index 3865ba927977..17f3dcc5656d 100644 --- a/source/API/SBModule.cpp +++ b/source/API/SBModule.cpp @@ -37,8 +37,8 @@ SBModule::SBModule(const lldb::ModuleSP &module_sp) : m_opaque_sp(module_sp) {} SBModule::SBModule(const SBModuleSpec &module_spec) : m_opaque_sp() { ModuleSP module_sp; - Error error = ModuleList::GetSharedModule(*module_spec.m_opaque_ap, module_sp, - NULL, NULL, NULL); + Status error = ModuleList::GetSharedModule(*module_spec.m_opaque_ap, + module_sp, NULL, NULL, NULL); if (module_sp) SetSP(module_sp); } diff --git a/source/API/SBPlatform.cpp b/source/API/SBPlatform.cpp index 0f1b99236a71..87cbc4537a3c 100644 --- a/source/API/SBPlatform.cpp +++ b/source/API/SBPlatform.cpp @@ -17,7 +17,7 @@ #include "lldb/Interpreter/Args.h" #include "lldb/Target/Platform.h" #include "lldb/Target/Target.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "llvm/Support/FileSystem.h" @@ -205,7 +205,7 @@ const char *SBPlatformShellCommand::GetOutput() { SBPlatform::SBPlatform() : m_opaque_sp() {} SBPlatform::SBPlatform(const char *platform_name) : m_opaque_sp() { - Error error; + Status error; if (platform_name && platform_name[0]) m_opaque_sp = Platform::Create(ConstString(platform_name), error); } @@ -374,7 +374,7 @@ SBError SBPlatform::Put(SBFileSpec &src, SBFileSpec &dst) { return platform_sp->PutFile(src.ref(), dst.ref(), permissions); } - Error error; + Status error; error.SetErrorStringWithFormat("'src' argument doesn't exist: '%s'", src.ref().GetPath().c_str()); return error; @@ -386,7 +386,7 @@ SBError SBPlatform::Install(SBFileSpec &src, SBFileSpec &dst) { if (src.Exists()) return platform_sp->Install(src.ref(), dst.ref()); - Error error; + Status error; error.SetErrorStringWithFormat("'src' argument doesn't exist: '%s'", src.ref().GetPath().c_str()); return error; @@ -397,7 +397,7 @@ SBError SBPlatform::Run(SBPlatformShellCommand &shell_command) { return ExecuteConnected([&](const lldb::PlatformSP &platform_sp) { const char *command = shell_command.GetCommand(); if (!command) - return Error("invalid shell command (empty)"); + return Status("invalid shell command (empty)"); const char *working_dir = shell_command.GetWorkingDirectory(); if (working_dir == NULL) { @@ -427,7 +427,7 @@ SBError SBPlatform::Kill(const lldb::pid_t pid) { } SBError SBPlatform::ExecuteConnected( - const std::function<Error(const lldb::PlatformSP &)> &func) { + const std::function<Status(const lldb::PlatformSP &)> &func) { SBError sb_error; const auto platform_sp(GetSP()); if (platform_sp) { diff --git a/source/API/SBProcess.cpp b/source/API/SBProcess.cpp index 0348113a9873..8b79e521a371 100644 --- a/source/API/SBProcess.cpp +++ b/source/API/SBProcess.cpp @@ -281,7 +281,7 @@ size_t SBProcess::PutSTDIN(const char *src, size_t src_len) { size_t ret_val = 0; ProcessSP process_sp(GetSP()); if (process_sp) { - Error error; + Status error; ret_val = process_sp->PutSTDIN(src, src_len, error); } @@ -298,7 +298,7 @@ size_t SBProcess::GetSTDOUT(char *dst, size_t dst_len) const { size_t bytes_read = 0; ProcessSP process_sp(GetSP()); if (process_sp) { - Error error; + Status error; bytes_read = process_sp->GetSTDOUT(dst, dst_len, error); } @@ -317,7 +317,7 @@ size_t SBProcess::GetSTDERR(char *dst, size_t dst_len) const { size_t bytes_read = 0; ProcessSP process_sp(GetSP()); if (process_sp) { - Error error; + Status error; bytes_read = process_sp->GetSTDERR(dst, dst_len, error); } @@ -336,7 +336,7 @@ size_t SBProcess::GetAsyncProfileData(char *dst, size_t dst_len) const { size_t bytes_read = 0; ProcessSP process_sp(GetSP()); if (process_sp) { - Error error; + Status error; bytes_read = process_sp->GetAsyncProfileData(dst, dst_len, error); } diff --git a/source/API/SBStream.cpp b/source/API/SBStream.cpp index 5ae5a01589de..159ec07e4e02 100644 --- a/source/API/SBStream.cpp +++ b/source/API/SBStream.cpp @@ -10,7 +10,7 @@ #include "lldb/API/SBStream.h" #include "lldb/Core/StreamFile.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/Stream.h" #include "lldb/Utility/StreamString.h" diff --git a/source/API/SBStructuredData.cpp b/source/API/SBStructuredData.cpp index 2fca56f2f223..971c4ab2295d 100644 --- a/source/API/SBStructuredData.cpp +++ b/source/API/SBStructuredData.cpp @@ -14,7 +14,7 @@ #include "lldb/Core/StructuredData.h" #include "lldb/Core/StructuredDataImpl.h" #include "lldb/Target/StructuredDataPlugin.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/Stream.h" using namespace lldb; @@ -62,7 +62,7 @@ SBError SBStructuredData::GetAsJSON(lldb::SBStream &stream) const { } lldb::SBError SBStructuredData::GetDescription(lldb::SBStream &stream) const { - Error error = m_impl_up->GetDescription(stream.ref()); + Status error = m_impl_up->GetDescription(stream.ref()); SBError sb_error; sb_error.SetError(error); return sb_error; diff --git a/source/API/SBTarget.cpp b/source/API/SBTarget.cpp index 4032383eb56c..0ab7375ccc30 100644 --- a/source/API/SBTarget.cpp +++ b/source/API/SBTarget.cpp @@ -74,7 +74,7 @@ using namespace lldb_private; namespace { -Error AttachToProcess(ProcessAttachInfo &attach_info, Target &target) { +Status AttachToProcess(ProcessAttachInfo &attach_info, Target &target) { std::lock_guard<std::recursive_mutex> guard(target.GetAPIMutex()); auto process_sp = target.GetProcessSP(); @@ -85,8 +85,8 @@ Error AttachToProcess(ProcessAttachInfo &attach_info, Target &target) { // listener, so if a valid listener is supplied, we need to error out // to let the client know. if (attach_info.GetListener()) - return Error("process is connected and already has a listener, pass " - "empty listener"); + return Status("process is connected and already has a listener, pass " + "empty listener"); } } @@ -1279,7 +1279,7 @@ lldb::SBWatchpoint SBTarget::WatchAddress(lldb::addr_t addr, size_t size, } // Target::CreateWatchpoint() is thread safe. - Error cw_error; + Status cw_error; // This API doesn't take in a type, so we can't figure out what it is. CompilerType *type = NULL; watchpoint_sp = @@ -1863,7 +1863,7 @@ lldb::SBInstructionList SBTarget::ReadInstructions(lldb::SBAddress base_addr, DataBufferHeap data( target_sp->GetArchitecture().GetMaximumOpcodeByteSize() * count, 0); bool prefer_file_cache = false; - lldb_private::Error error; + lldb_private::Status error; lldb::addr_t load_addr = LLDB_INVALID_ADDRESS; const size_t bytes_read = target_sp->ReadMemory(*addr_ptr, prefer_file_cache, data.GetBytes(), diff --git a/source/API/SBThread.cpp b/source/API/SBThread.cpp index 3961a7f925a0..2c82bc3bcdcf 100644 --- a/source/API/SBThread.cpp +++ b/source/API/SBThread.cpp @@ -562,7 +562,7 @@ bool SBThread::GetInfoItemByPathAsString(const char *path, SBStream &strm) { info_root_sp->GetObjectForDotSeparatedPath(path); if (node) { if (node->GetType() == StructuredData::Type::eTypeString) { - strm.Printf("%s", node->GetAsString()->GetValue().c_str()); + strm.Printf("%s", node->GetAsString()->GetValue().str().c_str()); success = true; } if (node->GetType() == StructuredData::Type::eTypeInteger) { @@ -1037,7 +1037,7 @@ SBError SBThread::JumpToLine(lldb::SBFileSpec &file_spec, uint32_t line) { Thread *thread = exe_ctx.GetThreadPtr(); - Error err = thread->JumpToLine(file_spec.get(), line, true); + Status err = thread->JumpToLine(file_spec.get(), line, true); sb_error.SetError(err); return sb_error; } diff --git a/source/API/SBValue.cpp b/source/API/SBValue.cpp index ea0f9f591ab9..b6f044c61a78 100644 --- a/source/API/SBValue.cpp +++ b/source/API/SBValue.cpp @@ -112,7 +112,7 @@ public: lldb::ValueObjectSP GetSP(Process::StopLocker &stop_locker, std::unique_lock<std::recursive_mutex> &lock, - Error &error) { + Status &error) { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); if (!m_valobj_sp) { error.SetErrorString("invalid value object"); @@ -218,12 +218,12 @@ public: return in_value.GetSP(m_stop_locker, m_lock, m_lock_error); } - Error &GetError() { return m_lock_error; } + Status &GetError() { return m_lock_error; } private: Process::StopLocker m_stop_locker; std::unique_lock<std::recursive_mutex> m_lock; - Error m_lock_error; + Status m_lock_error; }; SBValue::SBValue() : m_opaque_sp() {} @@ -1112,7 +1112,7 @@ SBValue SBValue::Dereference() { ValueLocker locker; lldb::ValueObjectSP value_sp(GetSP(locker)); if (value_sp) { - Error error; + Status error; sb_value = value_sp->Dereference(error); } Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); @@ -1336,7 +1336,7 @@ lldb::SBValue SBValue::AddressOf() { ValueLocker locker; lldb::ValueObjectSP value_sp(GetSP(locker)); if (value_sp) { - Error error; + Status error; sb_value.SetSP(value_sp->AddressOf(error), GetPreferDynamicValue(), GetPreferSyntheticValue()); } @@ -1445,7 +1445,7 @@ lldb::SBData SBValue::GetData() { lldb::ValueObjectSP value_sp(GetSP(locker)); if (value_sp) { DataExtractorSP data_sp(new DataExtractor()); - Error error; + Status error; value_sp->GetData(*data_sp, error); if (error.Success()) *sb_data = data_sp; @@ -1475,7 +1475,7 @@ bool SBValue::SetData(lldb::SBData &data, SBError &error) { error.SetErrorString("No data to set"); ret = false; } else { - Error set_error; + Status set_error; value_sp->SetData(*data_extractor, set_error); @@ -1541,7 +1541,7 @@ lldb::SBWatchpoint SBValue::Watch(bool resolve_location, bool read, bool write, if (write) watch_type |= LLDB_WATCH_TYPE_WRITE; - Error rc; + Status rc; CompilerType type(value_sp->GetCompilerType()); WatchpointSP watchpoint_sp = target_sp->CreateWatchpoint(addr, byte_size, &type, watch_type, rc); diff --git a/source/API/SystemInitializerFull.cpp b/source/API/SystemInitializerFull.cpp index 23aec1d6fa0a..6be352567e8b 100644 --- a/source/API/SystemInitializerFull.cpp +++ b/source/API/SystemInitializerFull.cpp @@ -400,7 +400,8 @@ void SystemInitializerFull::InitializeSWIG() { } void SystemInitializerFull::Terminate() { - Timer scoped_timer(LLVM_PRETTY_FUNCTION, LLVM_PRETTY_FUNCTION); + static Timer::Category func_cat(LLVM_PRETTY_FUNCTION); + Timer scoped_timer(func_cat, LLVM_PRETTY_FUNCTION); Debugger::SettingsTerminate(); diff --git a/source/Breakpoint/Breakpoint.cpp b/source/Breakpoint/Breakpoint.cpp index 2b44691186c0..4c58f8231344 100644 --- a/source/Breakpoint/Breakpoint.cpp +++ b/source/Breakpoint/Breakpoint.cpp @@ -127,7 +127,7 @@ StructuredData::ObjectSP Breakpoint::SerializeToStructuredData() { } lldb::BreakpointSP Breakpoint::CreateFromStructuredData( - Target &target, StructuredData::ObjectSP &object_data, Error &error) { + Target &target, StructuredData::ObjectSP &object_data, Status &error) { BreakpointSP result_sp; StructuredData::Dictionary *breakpoint_dict = object_data->GetAsDictionary(); @@ -146,7 +146,7 @@ lldb::BreakpointSP Breakpoint::CreateFromStructuredData( return result_sp; } - Error create_error; + Status create_error; BreakpointResolverSP resolver_sp = BreakpointResolver::CreateFromStructuredData(*resolver_dict, create_error); @@ -207,10 +207,10 @@ lldb::BreakpointSP Breakpoint::CreateFromStructuredData( if (success && names_array) { size_t num_names = names_array->GetSize(); for (size_t i = 0; i < num_names; i++) { - std::string name; - Error error; + llvm::StringRef name; + Status error; success = names_array->GetItemAtIndexAsString(i, name); - result_sp->AddName(name.c_str(), error); + result_sp->AddName(name, error); } } @@ -242,7 +242,7 @@ bool Breakpoint::SerializedBreakpointMatchesNames( std::vector<std::string>::iterator end = names.end(); for (size_t i = 0; i < num_names; i++) { - std::string name; + llvm::StringRef name; if (names_array->GetItemAtIndexAsString(i, name)) { if (std::find(begin, end, name) != end) { return true; @@ -833,10 +833,10 @@ size_t Breakpoint::GetNumResolvedLocations() const { size_t Breakpoint::GetNumLocations() const { return m_locations.GetSize(); } -bool Breakpoint::AddName(const char *new_name, Error &error) { - if (!new_name) +bool Breakpoint::AddName(llvm::StringRef new_name, Status &error) { + if (new_name.empty()) return false; - if (!BreakpointID::StringIsBreakpointName(llvm::StringRef(new_name), error)) { + if (!BreakpointID::StringIsBreakpointName(new_name, error)) { error.SetErrorStringWithFormat("input name \"%s\" not a breakpoint name.", new_name); return false; @@ -997,8 +997,9 @@ bool Breakpoint::BreakpointPrecondition::EvaluatePrecondition( void Breakpoint::BreakpointPrecondition::GetDescription( Stream &stream, lldb::DescriptionLevel level) {} -Error Breakpoint::BreakpointPrecondition::ConfigurePrecondition(Args &options) { - Error error; +Status +Breakpoint::BreakpointPrecondition::ConfigurePrecondition(Args &options) { + Status error; error.SetErrorString("Base breakpoint precondition has no options."); return error; } diff --git a/source/Breakpoint/BreakpointID.cpp b/source/Breakpoint/BreakpointID.cpp index 07742d9d7cf8..112f7c0b5195 100644 --- a/source/Breakpoint/BreakpointID.cpp +++ b/source/Breakpoint/BreakpointID.cpp @@ -15,7 +15,7 @@ // Project includes #include "lldb/Breakpoint/Breakpoint.h" #include "lldb/Breakpoint/BreakpointID.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/Stream.h" using namespace lldb; @@ -98,7 +98,7 @@ BreakpointID::ParseCanonicalReference(llvm::StringRef input) { return BreakpointID(bp_id, loc_id); } -bool BreakpointID::StringIsBreakpointName(llvm::StringRef str, Error &error) { +bool BreakpointID::StringIsBreakpointName(llvm::StringRef str, Status &error) { error.Clear(); if (str.empty()) return false; diff --git a/source/Breakpoint/BreakpointIDList.cpp b/source/Breakpoint/BreakpointIDList.cpp index 037b03e1e46a..7b461147a4e9 100644 --- a/source/Breakpoint/BreakpointIDList.cpp +++ b/source/Breakpoint/BreakpointIDList.cpp @@ -137,7 +137,7 @@ void BreakpointIDList::FindAndReplaceIDRanges(Args &old_args, Target *target, } llvm::StringRef range_expr; - Error error; + Status error; std::tie(range_from, range_to) = BreakpointIDList::SplitIDRangeExpression(current_arg); diff --git a/source/Breakpoint/BreakpointList.cpp b/source/Breakpoint/BreakpointList.cpp index 7f35588ea877..15bcb34a3d85 100644 --- a/source/Breakpoint/BreakpointList.cpp +++ b/source/Breakpoint/BreakpointList.cpp @@ -139,7 +139,7 @@ BreakpointList::FindBreakpointByID(break_id_t break_id) const { bool BreakpointList::FindBreakpointsByName(const char *name, BreakpointList &matching_bps) { - Error error; + Status error; if (!name) return false; diff --git a/source/Breakpoint/BreakpointLocation.cpp b/source/Breakpoint/BreakpointLocation.cpp index 52bdefc4077f..ec8f141e8d38 100644 --- a/source/Breakpoint/BreakpointLocation.cpp +++ b/source/Breakpoint/BreakpointLocation.cpp @@ -197,7 +197,7 @@ const char *BreakpointLocation::GetConditionText(size_t *hash) const { } bool BreakpointLocation::ConditionSaysStop(ExecutionContext &exe_ctx, - Error &error) { + Status &error) { Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS); std::lock_guard<std::mutex> guard(m_condition_mutex); @@ -260,7 +260,7 @@ bool BreakpointLocation::ConditionSaysStop(ExecutionContext &exe_ctx, options.SetResultIsInternal( true); // Don't generate a user variable for condition expressions. - Error expr_error; + Status expr_error; diagnostics.Clear(); diff --git a/source/Breakpoint/BreakpointOptions.cpp b/source/Breakpoint/BreakpointOptions.cpp index 9851990a838e..bef63cc0f222 100644 --- a/source/Breakpoint/BreakpointOptions.cpp +++ b/source/Breakpoint/BreakpointOptions.cpp @@ -63,7 +63,7 @@ BreakpointOptions::CommandData::SerializeToStructuredData() { std::unique_ptr<BreakpointOptions::CommandData> BreakpointOptions::CommandData::CreateFromStructuredData( - const StructuredData::Dictionary &options_dict, Error &error) { + const StructuredData::Dictionary &options_dict, Status &error) { std::unique_ptr<CommandData> data_up(new CommandData()); bool found_something = false; @@ -73,7 +73,7 @@ BreakpointOptions::CommandData::CreateFromStructuredData( if (success) found_something = true; - std::string interpreter_str; + llvm::StringRef interpreter_str; ScriptLanguage interp_language; success = options_dict.GetValueForKeyAsString( GetKey(OptionNames::Interpreter), interpreter_str); @@ -99,7 +99,7 @@ BreakpointOptions::CommandData::CreateFromStructuredData( found_something = true; size_t num_elems = user_source->GetSize(); for (size_t i = 0; i < num_elems; i++) { - std::string elem_string; + llvm::StringRef elem_string; success = user_source->GetItemAtIndexAsString(i, elem_string); if (success) data_up->user_source.AppendString(elem_string); @@ -196,7 +196,7 @@ BreakpointOptions::~BreakpointOptions() = default; std::unique_ptr<BreakpointOptions> BreakpointOptions::CreateFromStructuredData( Target &target, const StructuredData::Dictionary &options_dict, - Error &error) { + Status &error) { bool enabled = true; bool one_shot = false; int32_t ignore_count = 0; @@ -230,7 +230,7 @@ std::unique_ptr<BreakpointOptions> BreakpointOptions::CreateFromStructuredData( success = options_dict.GetValueForKeyAsDictionary( CommandData::GetSerializationKey(), cmds_dict); if (success && cmds_dict) { - Error cmds_error; + Status cmds_error; cmd_data_up = CommandData::CreateFromStructuredData(*cmds_dict, cmds_error); if (cmds_error.Fail()) { error.SetErrorStringWithFormat( @@ -260,7 +260,7 @@ std::unique_ptr<BreakpointOptions> BreakpointOptions::CreateFromStructuredData( .c_str()); return nullptr; } - Error script_error; + Status script_error; script_error = interp->SetBreakpointCommandCallback(bp_options.get(), cmd_data_up); if (script_error.Fail()) { @@ -275,7 +275,7 @@ std::unique_ptr<BreakpointOptions> BreakpointOptions::CreateFromStructuredData( success = options_dict.GetValueForKeyAsDictionary( ThreadSpec::GetSerializationKey(), thread_spec_dict); if (success) { - Error thread_spec_error; + Status thread_spec_error; std::unique_ptr<ThreadSpec> thread_spec_up = ThreadSpec::CreateFromStructuredData(*thread_spec_dict, thread_spec_error); diff --git a/source/Breakpoint/BreakpointResolver.cpp b/source/Breakpoint/BreakpointResolver.cpp index f2579a0877e2..31aefb08f976 100644 --- a/source/Breakpoint/BreakpointResolver.cpp +++ b/source/Breakpoint/BreakpointResolver.cpp @@ -56,9 +56,9 @@ const char *BreakpointResolver::ResolverTyToName(enum ResolverTy type) { } BreakpointResolver::ResolverTy -BreakpointResolver::NameToResolverTy(const char *name) { +BreakpointResolver::NameToResolverTy(llvm::StringRef name) { for (size_t i = 0; i < LastKnownResolverType; i++) { - if (strcmp(name, g_ty_to_name[i]) == 0) + if (name == g_ty_to_name[i]) return (ResolverTy)i; } return UnknownResolver; @@ -72,14 +72,14 @@ BreakpointResolver::BreakpointResolver(Breakpoint *bkpt, BreakpointResolver::~BreakpointResolver() {} BreakpointResolverSP BreakpointResolver::CreateFromStructuredData( - const StructuredData::Dictionary &resolver_dict, Error &error) { + const StructuredData::Dictionary &resolver_dict, Status &error) { BreakpointResolverSP result_sp; if (!resolver_dict.IsValid()) { error.SetErrorString("Can't deserialize from an invalid data object."); return result_sp; } - std::string subclass_name; + llvm::StringRef subclass_name; bool success = resolver_dict.GetValueForKeyAsString( GetSerializationSubclassKey(), subclass_name); @@ -90,10 +90,10 @@ BreakpointResolverSP BreakpointResolver::CreateFromStructuredData( return result_sp; } - ResolverTy resolver_type = NameToResolverTy(subclass_name.c_str()); + ResolverTy resolver_type = NameToResolverTy(subclass_name); if (resolver_type == UnknownResolver) { - error.SetErrorStringWithFormat("Unknown resolver type: %s.", - subclass_name.c_str()); + error.SetErrorStringWithFormatv("Unknown resolver type: {0}.", + subclass_name); return result_sp; } diff --git a/source/Breakpoint/BreakpointResolverAddress.cpp b/source/Breakpoint/BreakpointResolverAddress.cpp index 4674ef08eae1..32f2045ed59a 100644 --- a/source/Breakpoint/BreakpointResolverAddress.cpp +++ b/source/Breakpoint/BreakpointResolverAddress.cpp @@ -44,8 +44,8 @@ BreakpointResolverAddress::~BreakpointResolverAddress() {} BreakpointResolver *BreakpointResolverAddress::CreateFromStructuredData( Breakpoint *bkpt, const StructuredData::Dictionary &options_dict, - Error &error) { - std::string module_name; + Status &error) { + llvm::StringRef module_name; lldb::addr_t addr_offset; FileSpec module_filespec; bool success; diff --git a/source/Breakpoint/BreakpointResolverFileLine.cpp b/source/Breakpoint/BreakpointResolverFileLine.cpp index 610c8c956cf5..780d25db9ccb 100644 --- a/source/Breakpoint/BreakpointResolverFileLine.cpp +++ b/source/Breakpoint/BreakpointResolverFileLine.cpp @@ -38,8 +38,8 @@ BreakpointResolverFileLine::~BreakpointResolverFileLine() {} BreakpointResolver *BreakpointResolverFileLine::CreateFromStructuredData( Breakpoint *bkpt, const StructuredData::Dictionary &options_dict, - Error &error) { - std::string filename; + Status &error) { + llvm::StringRef filename; uint32_t line_no; bool check_inlines; bool skip_prologue; diff --git a/source/Breakpoint/BreakpointResolverFileRegex.cpp b/source/Breakpoint/BreakpointResolverFileRegex.cpp index df6f5c2e4bf2..54c05a042468 100644 --- a/source/Breakpoint/BreakpointResolverFileRegex.cpp +++ b/source/Breakpoint/BreakpointResolverFileRegex.cpp @@ -37,10 +37,10 @@ BreakpointResolverFileRegex::~BreakpointResolverFileRegex() {} BreakpointResolver *BreakpointResolverFileRegex::CreateFromStructuredData( Breakpoint *bkpt, const StructuredData::Dictionary &options_dict, - Error &error) { + Status &error) { bool success; - std::string regex_string; + llvm::StringRef regex_string; success = options_dict.GetValueForKeyAsString( GetKey(OptionNames::RegexString), regex_string); if (!success) { @@ -65,7 +65,7 @@ BreakpointResolver *BreakpointResolverFileRegex::CreateFromStructuredData( if (success && names_array) { size_t num_names = names_array->GetSize(); for (size_t i = 0; i < num_names; i++) { - std::string name; + llvm::StringRef name; success = names_array->GetItemAtIndexAsString(i, name); if (!success) { error.SetErrorStringWithFormat( diff --git a/source/Breakpoint/BreakpointResolverName.cpp b/source/Breakpoint/BreakpointResolverName.cpp index f8ce775096ce..468de35db0ee 100644 --- a/source/Breakpoint/BreakpointResolverName.cpp +++ b/source/Breakpoint/BreakpointResolverName.cpp @@ -92,16 +92,16 @@ BreakpointResolverName::BreakpointResolverName( BreakpointResolver *BreakpointResolverName::CreateFromStructuredData( Breakpoint *bkpt, const StructuredData::Dictionary &options_dict, - Error &error) { + Status &error) { LanguageType language = eLanguageTypeUnknown; - std::string language_name; + llvm::StringRef language_name; bool success = options_dict.GetValueForKeyAsString( GetKey(OptionNames::LanguageName), language_name); if (success) { language = Language::GetLanguageTypeFromString(language_name); if (language == eLanguageTypeUnknown) { - error.SetErrorStringWithFormat("BRN::CFSD: Unknown language: %s.", - language_name.c_str()); + error.SetErrorStringWithFormatv("BRN::CFSD: Unknown language: {0}.", + language_name); return nullptr; } } @@ -122,7 +122,7 @@ BreakpointResolver *BreakpointResolverName::CreateFromStructuredData( return nullptr; } - std::string regex_text; + llvm::StringRef regex_text; success = options_dict.GetValueForKeyAsString( GetKey(OptionNames::RegexString), regex_text); if (success) { @@ -162,7 +162,7 @@ BreakpointResolver *BreakpointResolverName::CreateFromStructuredData( std::vector<uint32_t> name_masks; for (size_t i = 0; i < num_elem; i++) { uint32_t name_mask; - std::string name; + llvm::StringRef name; success = names_array->GetItemAtIndexAsString(i, name); if (!success) { diff --git a/source/Breakpoint/Watchpoint.cpp b/source/Breakpoint/Watchpoint.cpp index 3dbd6d23821c..a141a6b5c2f9 100644 --- a/source/Breakpoint/Watchpoint.cpp +++ b/source/Breakpoint/Watchpoint.cpp @@ -286,7 +286,7 @@ void Watchpoint::SetCondition(const char *condition) { m_condition_ap.reset(); } else { // Pass nullptr for expr_prefix (no translation-unit level definitions). - Error error; + Status error; m_condition_ap.reset(m_target.GetUserExpressionForLanguage( condition, llvm::StringRef(), lldb::eLanguageTypeUnknown, UserExpression::eResultTypeAny, EvaluateExpressionOptions(), error)); diff --git a/source/Commands/CommandObjectArgs.cpp b/source/Commands/CommandObjectArgs.cpp index 8042aa9d81db..92c2107dc33c 100644 --- a/source/Commands/CommandObjectArgs.cpp +++ b/source/Commands/CommandObjectArgs.cpp @@ -55,10 +55,10 @@ CommandObjectArgs::CommandOptions::CommandOptions( CommandObjectArgs::CommandOptions::~CommandOptions() = default; -Error CommandObjectArgs::CommandOptions::SetOptionValue( +Status CommandObjectArgs::CommandOptions::SetOptionValue( uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) { - Error error; + Status error; const int short_option = m_getopt_table[option_idx].val; error.SetErrorStringWithFormat("invalid short option character '%c'", diff --git a/source/Commands/CommandObjectArgs.h b/source/Commands/CommandObjectArgs.h index a4b3f9fed0ee..aa7d2411adc8 100644 --- a/source/Commands/CommandObjectArgs.h +++ b/source/Commands/CommandObjectArgs.h @@ -27,8 +27,8 @@ public: ~CommandOptions() override; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override; void OptionParsingStarting(ExecutionContext *execution_context) override; diff --git a/source/Commands/CommandObjectBreakpoint.cpp b/source/Commands/CommandObjectBreakpoint.cpp index d77cf55b60e9..266864d1a1f0 100644 --- a/source/Commands/CommandObjectBreakpoint.cpp +++ b/source/Commands/CommandObjectBreakpoint.cpp @@ -178,9 +178,9 @@ public: ~CommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override { + Status error; const int short_option = m_getopt_table[option_idx].val; switch (short_option) { @@ -662,7 +662,7 @@ protected: .get(); } break; case eSetTypeException: { - Error precond_error; + Status precond_error; bp = target ->CreateExceptionBreakpoint( m_options.m_exception_language, m_options.m_catch_bp, @@ -705,7 +705,7 @@ protected: bp->GetOptions()->SetCondition(m_options.m_condition.c_str()); if (!m_options.m_breakpoint_names.empty()) { - Error name_error; + Status name_error; for (auto name : m_options.m_breakpoint_names) { bp->AddName(name.c_str(), name_error); if (name_error.Fail()) { @@ -844,9 +844,9 @@ public: ~CommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override { + Status error; const int short_option = m_getopt_table[option_idx].val; switch (short_option) { @@ -1305,9 +1305,9 @@ public: ~CommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override { + Status error; const int short_option = m_getopt_table[option_idx].val; switch (short_option) { @@ -1452,9 +1452,9 @@ public: ~CommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override { + Status error; const int short_option = m_getopt_table[option_idx].val; switch (short_option) { @@ -1611,9 +1611,9 @@ public: ~CommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override { + Status error; const int short_option = m_getopt_table[option_idx].val; switch (short_option) { @@ -1751,9 +1751,9 @@ public: return llvm::makeArrayRef(g_breakpoint_name_options); } - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override { + Status error; const int short_option = g_breakpoint_name_options[option_idx].short_option; switch (short_option) { @@ -1864,8 +1864,8 @@ protected: lldb::break_id_t bp_id = valid_bp_ids.GetBreakpointIDAtIndex(index).GetBreakpointID(); BreakpointSP bp_sp = breakpoints.FindBreakpointByID(bp_id); - Error error; // We don't need to check the error here, since the option - // parser checked it... + Status error; // We don't need to check the error here, since the option + // parser checked it... bp_sp->AddName(m_name_options.m_name.GetCurrentValue(), error); } } @@ -2093,9 +2093,9 @@ public: ~CommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override { + Status error; const int short_option = m_getopt_table[option_idx].val; switch (short_option) { @@ -2103,7 +2103,7 @@ public: m_filename.assign(option_arg); break; case 'N': { - Error name_error; + Status name_error; if (!BreakpointID::StringIsBreakpointName(llvm::StringRef(option_arg), name_error)) { error.SetErrorStringWithFormat("Invalid breakpoint name: %s", @@ -2150,8 +2150,8 @@ protected: FileSpec input_spec(m_options.m_filename, true); BreakpointIDList new_bps; - Error error = target->CreateBreakpointsFromFile(input_spec, - m_options.m_names, new_bps); + Status error = target->CreateBreakpointsFromFile( + input_spec, m_options.m_names, new_bps); if (!error.Success()) { result.AppendError(error.AsCString()); @@ -2223,9 +2223,9 @@ public: ~CommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override { + Status error; const int short_option = m_getopt_table[option_idx].val; switch (short_option) { @@ -2281,7 +2281,7 @@ protected: return false; } } - Error error = target->SerializeBreakpointsToFile( + Status error = target->SerializeBreakpointsToFile( FileSpec(m_options.m_filename, true), valid_bp_ids, m_options.m_append); if (!error.Success()) { result.AppendErrorWithFormat("error serializing breakpoints: %s.", diff --git a/source/Commands/CommandObjectBreakpointCommand.cpp b/source/Commands/CommandObjectBreakpointCommand.cpp index 73c0c314533c..de4911953107 100644 --- a/source/Commands/CommandObjectBreakpointCommand.cpp +++ b/source/Commands/CommandObjectBreakpointCommand.cpp @@ -281,9 +281,9 @@ are no syntax errors may indicate that a function was declared but never called. ~CommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override { + Status error; const int short_option = m_getopt_table[option_idx].val; switch (short_option) { @@ -511,9 +511,9 @@ public: ~CommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override { + Status error; const int short_option = m_getopt_table[option_idx].val; switch (short_option) { diff --git a/source/Commands/CommandObjectBugreport.cpp b/source/Commands/CommandObjectBugreport.cpp index 04050e3a6692..7ba8ab945eae 100644 --- a/source/Commands/CommandObjectBugreport.cpp +++ b/source/Commands/CommandObjectBugreport.cpp @@ -84,7 +84,7 @@ protected: open_options |= File::eOpenOptionTruncate; StreamFileSP outfile_stream = std::make_shared<StreamFile>(); - Error error = outfile_stream->GetFile().Open(path, open_options); + Status error = outfile_stream->GetFile().Open(path, open_options); if (error.Fail()) { result.AppendErrorWithFormat("Failed to open file '%s' for %s: %s\n", path, append ? "append" : "write", diff --git a/source/Commands/CommandObjectCommands.cpp b/source/Commands/CommandObjectCommands.cpp index e39c0330b653..c9d71a65754b 100644 --- a/source/Commands/CommandObjectCommands.cpp +++ b/source/Commands/CommandObjectCommands.cpp @@ -71,9 +71,9 @@ protected: ~CommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override { + Status error; const int short_option = m_getopt_table[option_idx].val; switch (short_option) { @@ -261,9 +261,9 @@ protected: ~CommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override { + Status error; const int short_option = m_getopt_table[option_idx].val; switch (short_option) { @@ -371,9 +371,9 @@ protected: return llvm::makeArrayRef(g_alias_options); } - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, + ExecutionContext *execution_context) override { + Status error; const int short_option = GetDefinitions()[option_idx].short_option; std::string option_str(option_value); @@ -579,7 +579,7 @@ protected: if (!ParseOptions(args, result)) return false; - Error error(m_option_group.NotifyOptionParsingFinished(&exe_ctx)); + Status error(m_option_group.NotifyOptionParsingFinished(&exe_ctx)); if (error.Fail()) { result.AppendError(error.AsCString()); result.SetStatus(eReturnStatusFailed); @@ -1030,7 +1030,7 @@ protected: bool check_only = false; for (size_t i = 0; i < num_lines; ++i) { llvm::StringRef bytes_strref(lines[i]); - Error error = AppendRegexSubstitution(bytes_strref, check_only); + Status error = AppendRegexSubstitution(bytes_strref, check_only); if (error.Fail()) { if (!m_interpreter.GetDebugger() .GetCommandInterpreter() @@ -1058,7 +1058,7 @@ protected: return false; } - Error error; + Status error; auto name = command[0].ref; m_regex_cmd_ap = llvm::make_unique<CommandObjectRegexCommand>( m_interpreter, name, m_options.GetHelp(), m_options.GetSyntax(), 10, 0, @@ -1101,9 +1101,9 @@ protected: return result.Succeeded(); } - Error AppendRegexSubstitution(const llvm::StringRef ®ex_sed, - bool check_only) { - Error error; + Status AppendRegexSubstitution(const llvm::StringRef ®ex_sed, + bool check_only) { + Status error; if (!m_regex_cmd_ap) { error.SetErrorStringWithFormat( @@ -1215,9 +1215,9 @@ private: ~CommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override { + Status error; const int short_option = m_getopt_table[option_idx].val; switch (short_option) { @@ -1311,7 +1311,7 @@ protected: CommandReturnObject &result) override { ScriptInterpreter *scripter = m_interpreter.GetScriptInterpreter(); - Error error; + Status error; result.SetStatus(eReturnStatusInvalid); @@ -1400,7 +1400,7 @@ protected: CommandReturnObject &result) override { ScriptInterpreter *scripter = m_interpreter.GetScriptInterpreter(); - Error error; + Status error; result.SetStatus(eReturnStatusInvalid); @@ -1487,9 +1487,9 @@ protected: ~CommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override { + Status error; const int short_option = m_getopt_table[option_idx].val; switch (short_option) { @@ -1534,7 +1534,7 @@ protected: } for (auto &entry : command.entries()) { - Error error; + Status error; const bool init_session = true; // FIXME: this is necessary because CommandObject::CheckRequirements() @@ -1619,9 +1619,9 @@ protected: ~CommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override { + Status error; const int short_option = m_getopt_table[option_idx].val; switch (short_option) { diff --git a/source/Commands/CommandObjectDisassemble.cpp b/source/Commands/CommandObjectDisassemble.cpp index 4496462476b4..5d0f2417f992 100644 --- a/source/Commands/CommandObjectDisassemble.cpp +++ b/source/Commands/CommandObjectDisassemble.cpp @@ -71,10 +71,10 @@ CommandObjectDisassemble::CommandOptions::CommandOptions() CommandObjectDisassemble::CommandOptions::~CommandOptions() = default; -Error CommandObjectDisassemble::CommandOptions::SetOptionValue( +Status CommandObjectDisassemble::CommandOptions::SetOptionValue( uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) { - Error error; + Status error; const int short_option = m_getopt_table[option_idx].val; @@ -224,11 +224,11 @@ void CommandObjectDisassemble::CommandOptions::OptionParsingStarting( some_location_specified = false; } -Error CommandObjectDisassemble::CommandOptions::OptionParsingFinished( +Status CommandObjectDisassemble::CommandOptions::OptionParsingFinished( ExecutionContext *execution_context) { if (!some_location_specified) current_function = true; - return Error(); + return Status(); } llvm::ArrayRef<OptionDefinition> diff --git a/source/Commands/CommandObjectDisassemble.h b/source/Commands/CommandObjectDisassemble.h index db89aa24d6a0..8ca390056dd8 100644 --- a/source/Commands/CommandObjectDisassemble.h +++ b/source/Commands/CommandObjectDisassemble.h @@ -32,8 +32,8 @@ public: ~CommandOptions() override; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override; void OptionParsingStarting(ExecutionContext *execution_context) override; @@ -49,7 +49,7 @@ public: return flavor_string.c_str(); } - Error OptionParsingFinished(ExecutionContext *execution_context) override; + Status OptionParsingFinished(ExecutionContext *execution_context) override; bool show_mixed; // Show mixed source/assembly bool show_bytes; diff --git a/source/Commands/CommandObjectExpression.cpp b/source/Commands/CommandObjectExpression.cpp index 8a0afce741e9..b6e0016c88e4 100644 --- a/source/Commands/CommandObjectExpression.cpp +++ b/source/Commands/CommandObjectExpression.cpp @@ -69,10 +69,10 @@ static OptionDefinition g_expression_options[] = { // clang-format on }; -Error CommandObjectExpression::CommandOptions::SetOptionValue( +Status CommandObjectExpression::CommandOptions::SetOptionValue( uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) { - Error error; + Status error; const int short_option = GetDefinitions()[option_idx].short_option; @@ -295,15 +295,15 @@ CommandObjectExpression::~CommandObjectExpression() = default; Options *CommandObjectExpression::GetOptions() { return &m_option_group; } -static lldb_private::Error +static lldb_private::Status CanBeUsedForElementCountPrinting(ValueObject &valobj) { CompilerType type(valobj.GetCompilerType()); CompilerType pointee; if (!type.IsPointerType(&pointee)) - return Error("as it does not refer to a pointer"); + return Status("as it does not refer to a pointer"); if (pointee.IsVoidType()) - return Error("as it refers to a pointer to void"); - return Error(); + return Status("as it refers to a pointer to void"); + return Status(); } bool CommandObjectExpression::EvaluateExpression(const char *expr, @@ -384,7 +384,7 @@ bool CommandObjectExpression::EvaluateExpression(const char *expr, result_valobj_sp->SetFormat(format); if (m_varobj_options.elem_count > 0) { - Error error(CanBeUsedForElementCountPrinting(*result_valobj_sp)); + Status error(CanBeUsedForElementCountPrinting(*result_valobj_sp)); if (error.Fail()) { result->AppendErrorWithFormat( "expression cannot be used with --element-count %s\n", @@ -533,7 +533,7 @@ bool CommandObjectExpression::DoExecute(const char *command, if (!ParseOptions(args, result)) return false; - Error error(m_option_group.NotifyOptionParsingFinished(&exe_ctx)); + Status error(m_option_group.NotifyOptionParsingFinished(&exe_ctx)); if (error.Fail()) { result.AppendError(error.AsCString()); result.SetStatus(eReturnStatusFailed); @@ -564,7 +564,7 @@ bool CommandObjectExpression::DoExecute(const char *command, // interpreter, // so just push one bool initialize = false; - Error repl_error; + Status repl_error; REPLSP repl_sp(target->GetREPL( repl_error, m_command_options.language, nullptr, false)); diff --git a/source/Commands/CommandObjectExpression.h b/source/Commands/CommandObjectExpression.h index 7c21adcc26fe..0cf2a7263d52 100644 --- a/source/Commands/CommandObjectExpression.h +++ b/source/Commands/CommandObjectExpression.h @@ -34,8 +34,8 @@ public: llvm::ArrayRef<OptionDefinition> GetDefinitions() override; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, - ExecutionContext *execution_context) override; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, + ExecutionContext *execution_context) override; void OptionParsingStarting(ExecutionContext *execution_context) override; diff --git a/source/Commands/CommandObjectFrame.cpp b/source/Commands/CommandObjectFrame.cpp index 7e81f5f94140..8b981a93ad7f 100644 --- a/source/Commands/CommandObjectFrame.cpp +++ b/source/Commands/CommandObjectFrame.cpp @@ -77,9 +77,9 @@ public: ~CommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override { + Status error; const int short_option = m_getopt_table[option_idx].val; switch (short_option) { case 'r': @@ -263,9 +263,9 @@ public: ~CommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override { + Status error; const int short_option = m_getopt_table[option_idx].val; switch (short_option) { case 'r': @@ -604,7 +604,7 @@ protected: } else // No regex, either exact variable names or variable // expressions. { - Error error; + Status error; uint32_t expr_path_options = StackFrame::eExpressionPathOptionCheckPtrVsMember | StackFrame::eExpressionPathOptionsAllowDirectIVarAccess | diff --git a/source/Commands/CommandObjectHelp.h b/source/Commands/CommandObjectHelp.h index cd9006619bc8..f1f87f8e63cc 100644 --- a/source/Commands/CommandObjectHelp.h +++ b/source/Commands/CommandObjectHelp.h @@ -46,9 +46,9 @@ public: ~CommandOptions() override {} - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override { + Status error; const int short_option = m_getopt_table[option_idx].val; switch (short_option) { diff --git a/source/Commands/CommandObjectLog.cpp b/source/Commands/CommandObjectLog.cpp index 2099310d32c3..e545d5679725 100644 --- a/source/Commands/CommandObjectLog.cpp +++ b/source/Commands/CommandObjectLog.cpp @@ -93,9 +93,9 @@ public: ~CommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override { + Status error; const int short_option = m_getopt_table[option_idx].val; switch (short_option) { diff --git a/source/Commands/CommandObjectMemory.cpp b/source/Commands/CommandObjectMemory.cpp index 1679614fe3f7..8f4c186a8d69 100644 --- a/source/Commands/CommandObjectMemory.cpp +++ b/source/Commands/CommandObjectMemory.cpp @@ -74,9 +74,9 @@ public: return llvm::makeArrayRef(g_read_memory_options); } - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, + ExecutionContext *execution_context) override { + Status error; const int short_option = g_read_memory_options[option_idx].short_option; switch (short_option) { @@ -120,8 +120,8 @@ public: m_offset.Clear(); } - Error FinalizeSettings(Target *target, OptionGroupFormat &format_options) { - Error error; + Status FinalizeSettings(Target *target, OptionGroupFormat &format_options) { + Status error; OptionValueUInt64 &byte_size_value = format_options.GetByteSizeValue(); OptionValueUInt64 &count_value = format_options.GetCountValue(); const bool byte_size_option_set = byte_size_value.OptionWasSet(); @@ -378,7 +378,7 @@ protected: } CompilerType clang_ast_type; - Error error; + Status error; const char *view_as_type_cstr = m_memory_options.m_view_as_type.GetCurrentValue(); @@ -716,7 +716,7 @@ protected: while (item_count < count) { std::string buffer; buffer.resize(item_byte_size + 1, 0); - Error error; + Status error; size_t read = target->ReadCStringFromMemory(data_addr, &buffer[0], item_byte_size + 1, error); if (error.Fail()) { @@ -909,9 +909,9 @@ public: return llvm::makeArrayRef(g_memory_find_option_table); } - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, + ExecutionContext *execution_context) override { + Status error; const int short_option = g_memory_find_option_table[option_idx].short_option; @@ -1008,7 +1008,7 @@ protected: return 0; uint8_t retval = 0; - Error error; + Status error; if (0 == m_process_sp->ReadMemory(m_base_addr + offset, &retval, 1, error)) { m_is_valid = false; @@ -1035,7 +1035,7 @@ protected: return false; } - Error error; + Status error; lldb::addr_t low_addr = Args::StringToAddress(&m_exe_ctx, command[0].ref, LLDB_INVALID_ADDRESS, &error); if (low_addr == LLDB_INVALID_ADDRESS || error.Fail()) { @@ -1202,9 +1202,9 @@ public: return llvm::makeArrayRef(g_memory_write_option_table); } - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, + ExecutionContext *execution_context) override { + Status error; const int short_option = g_memory_write_option_table[option_idx].short_option; @@ -1344,7 +1344,7 @@ protected: OptionValueUInt64 &byte_size_value = m_format_options.GetByteSizeValue(); size_t item_byte_size = byte_size_value.GetCurrentValue(); - Error error; + Status error; lldb::addr_t addr = Args::StringToAddress(&m_exe_ctx, command[0].ref, LLDB_INVALID_ADDRESS, &error); @@ -1365,7 +1365,7 @@ protected: if (data_sp) { length = data_sp->GetByteSize(); if (length > 0) { - Error error; + Status error; size_t bytes_written = process->WriteMemory(addr, data_sp->GetBytes(), length, error); @@ -1506,7 +1506,7 @@ protected: // Include the NULL for C strings... if (m_format_options.GetFormat() == eFormatCString) ++len; - Error error; + Status error; if (process->WriteMemory(addr, entry.c_str(), len, error) == len) { addr += len; } else { @@ -1574,7 +1574,7 @@ protected: } if (!buffer.GetString().empty()) { - Error error; + Status error; if (process->WriteMemory(addr, buffer.GetString().data(), buffer.GetString().size(), error) == buffer.GetString().size()) @@ -1641,7 +1641,7 @@ protected: return false; } - Error error; + Status error; lldb::addr_t addr = Args::StringToAddress(&m_exe_ctx, command[0].ref, LLDB_INVALID_ADDRESS, &error); @@ -1699,7 +1699,7 @@ protected: bool DoExecute(Args &command, CommandReturnObject &result) override { ProcessSP process_sp = m_exe_ctx.GetProcessSP(); if (process_sp) { - Error error; + Status error; lldb::addr_t load_addr = m_prev_end_addr; m_prev_end_addr = LLDB_INVALID_ADDRESS; diff --git a/source/Commands/CommandObjectPlatform.cpp b/source/Commands/CommandObjectPlatform.cpp index 62ea683e6e0d..5fa851f584a7 100644 --- a/source/Commands/CommandObjectPlatform.cpp +++ b/source/Commands/CommandObjectPlatform.cpp @@ -85,10 +85,10 @@ public: ~OptionPermissions() override = default; - lldb_private::Error + lldb_private::Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override { - Error error; + Status error; char short_option = (char)GetDefinitions()[option_idx].short_option; switch (short_option) { case 'v': { @@ -200,7 +200,7 @@ protected: if (platform_name && platform_name[0]) { const bool select = true; m_platform_options.SetPlatformName(platform_name); - Error error; + Status error; ArchSpec platform_arch; PlatformSP platform_sp(m_platform_options.CreatePlatformWithOptions( m_interpreter, ArchSpec(), select, error, platform_arch)); @@ -329,7 +329,7 @@ protected: PlatformSP platform_sp( m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform()); if (platform_sp) { - Error error(platform_sp->ConnectRemote(args)); + Status error(platform_sp->ConnectRemote(args)); if (error.Success()) { platform_sp->GetStatus(ostrm); result.SetStatus(eReturnStatusSuccessFinishResult); @@ -382,7 +382,7 @@ protected: m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform()); if (platform_sp) { if (args.GetArgumentCount() == 0) { - Error error; + Status error; if (platform_sp->IsConnected()) { // Cache the instance name if there is one since we are @@ -498,7 +498,8 @@ public: else mode = lldb::eFilePermissionsUserRWX | lldb::eFilePermissionsGroupRWX | lldb::eFilePermissionsWorldRX; - Error error = platform_sp->MakeDirectory(FileSpec{cmd_line, false}, mode); + Status error = + platform_sp->MakeDirectory(FileSpec{cmd_line, false}, mode); if (error.Success()) { result.SetStatus(eReturnStatusSuccessFinishResult); } else { @@ -539,7 +540,7 @@ public: PlatformSP platform_sp( m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform()); if (platform_sp) { - Error error; + Status error; std::string cmd_line; args.GetCommandString(cmd_line); mode_t perms; @@ -599,7 +600,7 @@ public: args.GetCommandString(cmd_line); const lldb::user_id_t fd = StringConvert::ToUInt64(cmd_line.c_str(), UINT64_MAX); - Error error; + Status error; bool success = platform_sp->CloseFile(fd, error); if (success) { result.AppendMessageWithFormat("file %" PRIu64 " closed.\n", fd); @@ -646,7 +647,7 @@ public: const lldb::user_id_t fd = StringConvert::ToUInt64(cmd_line.c_str(), UINT64_MAX); std::string buffer(m_options.m_count, 0); - Error error; + Status error; uint32_t retcode = platform_sp->ReadFile( fd, m_options.m_offset, &buffer[0], m_options.m_count, error); result.AppendMessageWithFormat("Return = %d\n", retcode); @@ -668,9 +669,9 @@ protected: ~CommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override { + Status error; char short_option = (char)m_getopt_table[option_idx].val; switch (short_option) { @@ -738,7 +739,7 @@ public: if (platform_sp) { std::string cmd_line; args.GetCommandString(cmd_line); - Error error; + Status error; const lldb::user_id_t fd = StringConvert::ToUInt64(cmd_line.c_str(), UINT64_MAX); uint32_t retcode = @@ -762,9 +763,9 @@ protected: ~CommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override { + Status error; char short_option = (char)m_getopt_table[option_idx].val; switch (short_option) { @@ -889,8 +890,8 @@ public: if (platform_sp) { const char *remote_file_path = args.GetArgumentAtIndex(0); const char *local_file_path = args.GetArgumentAtIndex(1); - Error error = platform_sp->GetFile(FileSpec(remote_file_path, false), - FileSpec(local_file_path, false)); + Status error = platform_sp->GetFile(FileSpec(remote_file_path, false), + FileSpec(local_file_path, false)); if (error.Success()) { result.AppendMessageWithFormat( "successfully get-file from %s (remote) to %s (host)\n", @@ -999,7 +1000,7 @@ public: PlatformSP platform_sp( m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform()); if (platform_sp) { - Error error(platform_sp->PutFile(src_fs, dst_fs)); + Status error(platform_sp->PutFile(src_fs, dst_fs)); if (error.Success()) { result.SetStatus(eReturnStatusSuccessFinishNoResult); } else { @@ -1043,7 +1044,7 @@ protected: } if (platform_sp) { - Error error; + Status error; const size_t argc = args.GetArgumentCount(); Target *target = m_exe_ctx.GetTargetPtr(); Module *exe_module = target->GetExecutableModulePointer(); @@ -1153,7 +1154,7 @@ protected: } if (platform_sp) { - Error error; + Status error; if (args.GetArgumentCount() == 0) { if (platform_sp) { Stream &ostrm = result.GetOutputStream(); @@ -1271,9 +1272,9 @@ protected: ~CommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override { + Status error; const int short_option = m_getopt_table[option_idx].val; bool success = false; @@ -1449,7 +1450,7 @@ protected: if (platform_sp) { const size_t argc = args.GetArgumentCount(); if (argc > 0) { - Error error; + Status error; if (platform_sp->IsConnected()) { Stream &ostrm = result.GetOutputStream(); @@ -1515,9 +1516,9 @@ public: ~CommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override { + Status error; char short_option = (char)m_getopt_table[option_idx].val; switch (short_option) { case 'p': { @@ -1624,7 +1625,7 @@ public: PlatformSP platform_sp( m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform()); if (platform_sp) { - Error err; + Status err; ProcessSP remote_process_sp = platform_sp->Attach( m_options.attach_info, m_interpreter.GetDebugger(), nullptr, err); if (err.Fail()) { @@ -1700,9 +1701,9 @@ public: return llvm::makeArrayRef(g_platform_shell_options); } - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override { + Status error; const char short_option = (char)GetDefinitions()[option_idx].short_option; @@ -1782,7 +1783,7 @@ public: PlatformSP platform_sp( m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform()); - Error error; + Status error; if (platform_sp) { FileSpec working_dir{}; std::string output; @@ -1861,7 +1862,7 @@ public: return false; } - Error error = platform_sp->Install(src, dst); + Status error = platform_sp->Install(src, dst); if (error.Success()) { result.SetStatus(eReturnStatusSuccessFinishNoResult); } else { diff --git a/source/Commands/CommandObjectPlugin.cpp b/source/Commands/CommandObjectPlugin.cpp index 7ae968b95fc8..7e1b7f61f766 100644 --- a/source/Commands/CommandObjectPlugin.cpp +++ b/source/Commands/CommandObjectPlugin.cpp @@ -68,7 +68,7 @@ protected: return false; } - Error error; + Status error; FileSpec dylib_fspec(command[0].ref, true); diff --git a/source/Commands/CommandObjectProcess.cpp b/source/Commands/CommandObjectProcess.cpp index 557bdeecc22c..9fbdd7630548 100644 --- a/source/Commands/CommandObjectProcess.cpp +++ b/source/Commands/CommandObjectProcess.cpp @@ -74,7 +74,7 @@ protected: } else { if (process->GetShouldDetach()) { bool keep_stopped = false; - Error detach_error(process->Detach(keep_stopped)); + Status detach_error(process->Detach(keep_stopped)); if (detach_error.Success()) { result.SetStatus(eReturnStatusSuccessFinishResult); process = nullptr; @@ -85,7 +85,7 @@ protected: result.SetStatus(eReturnStatusFailed); } } else { - Error destroy_error(process->Destroy(false)); + Status destroy_error(process->Destroy(false)); if (destroy_error.Success()) { result.SetStatus(eReturnStatusSuccessFinishResult); process = nullptr; @@ -231,7 +231,7 @@ protected: } StreamString stream; - Error error = target->Launch(m_options.launch_info, &stream); + Status error = target->Launch(m_options.launch_info, &stream); if (error.Success()) { ProcessSP process_sp(target->GetProcessSP()); @@ -338,9 +338,9 @@ public: ~CommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override { + Status error; const int short_option = m_getopt_table[option_idx].val; switch (short_option) { case 'c': @@ -470,7 +470,7 @@ protected: if (target == nullptr) { // If there isn't a current target create one. TargetSP new_target_sp; - Error error; + Status error; error = m_interpreter.GetDebugger().GetTargetList().CreateTarget( m_interpreter.GetDebugger(), "", "", false, @@ -603,9 +603,9 @@ protected: ~CommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override { + Status error; const int short_option = m_getopt_table[option_idx].val; switch (short_option) { case 'i': @@ -687,7 +687,7 @@ protected: const uint32_t iohandler_id = process->GetIOHandlerID(); StreamString stream; - Error error; + Status error; if (synchronous_execution) error = process->ResumeSynchronous(&stream); else @@ -751,9 +751,9 @@ public: ~CommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override { + Status error; const int short_option = m_getopt_table[option_idx].val; switch (short_option) { @@ -816,7 +816,7 @@ protected: else keep_stopped = false; - Error error(process->Detach(keep_stopped)); + Status error(process->Detach(keep_stopped)); if (error.Success()) { result.SetStatus(eReturnStatusSuccessFinishResult); } else { @@ -854,9 +854,9 @@ public: ~CommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override { + Status error; const int short_option = m_getopt_table[option_idx].val; switch (short_option) { @@ -919,7 +919,7 @@ protected: if (!m_options.plugin_name.empty()) plugin_name = m_options.plugin_name.c_str(); - Error error; + Status error; Debugger &debugger = m_interpreter.GetDebugger(); PlatformSP platform_sp = m_interpreter.GetPlatform(true); ProcessSP process_sp = platform_sp->ConnectProcess( @@ -983,9 +983,9 @@ public: ~CommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override { + Status error; const int short_option = m_getopt_table[option_idx].val; switch (short_option) { case 'i': @@ -1033,7 +1033,7 @@ protected: Process *process = m_exe_ctx.GetProcessPtr(); for (auto &entry : command.entries()) { - Error error; + Status error; PlatformSP platform = process->GetTarget().GetPlatform(); llvm::StringRef image_path = entry.ref; uint32_t image_token = LLDB_INVALID_IMAGE_TOKEN; @@ -1103,7 +1103,7 @@ protected: result.SetStatus(eReturnStatusFailed); break; } else { - Error error(process->GetTarget().GetPlatform()->UnloadImage( + Status error(process->GetTarget().GetPlatform()->UnloadImage( process, image_token)); if (error.Success()) { result.AppendMessageWithFormat( @@ -1169,7 +1169,7 @@ protected: command.GetArgumentAtIndex(0)); result.SetStatus(eReturnStatusFailed); } else { - Error error(process->Signal(signo)); + Status error(process->Signal(signo)); if (error.Success()) { result.SetStatus(eReturnStatusSuccessFinishResult); } else { @@ -1215,7 +1215,7 @@ protected: if (command.GetArgumentCount() == 0) { bool clear_thread_plans = true; - Error error(process->Halt(clear_thread_plans)); + Status error(process->Halt(clear_thread_plans)); if (error.Success()) { result.SetStatus(eReturnStatusSuccessFinishResult); } else { @@ -1258,7 +1258,7 @@ protected: } if (command.GetArgumentCount() == 0) { - Error error(process->Destroy(true)); + Status error(process->Destroy(true)); if (error.Success()) { result.SetStatus(eReturnStatusSuccessFinishResult); } else { @@ -1298,7 +1298,7 @@ protected: if (process_sp) { if (command.GetArgumentCount() == 1) { FileSpec output_file(command.GetArgumentAtIndex(0), false); - Error error = PluginManager::SaveCore(process_sp, output_file); + Status error = PluginManager::SaveCore(process_sp, output_file); if (error.Success()) { result.SetStatus(eReturnStatusSuccessFinishResult); } else { @@ -1377,9 +1377,9 @@ public: ~CommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override { + Status error; const int short_option = m_getopt_table[option_idx].val; switch (short_option) { diff --git a/source/Commands/CommandObjectRegister.cpp b/source/Commands/CommandObjectRegister.cpp index 4d856d6bd1e0..6de8c667e7a7 100644 --- a/source/Commands/CommandObjectRegister.cpp +++ b/source/Commands/CommandObjectRegister.cpp @@ -257,9 +257,9 @@ protected: alternate_name.Clear(); } - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, + ExecutionContext *execution_context) override { + Status error; const int short_option = GetDefinitions()[option_idx].short_option; switch (short_option) { case 's': { @@ -367,7 +367,7 @@ protected: if (reg_info) { RegisterValue reg_value; - Error error(reg_value.SetValueFromString(reg_info, value_str)); + Status error(reg_value.SetValueFromString(reg_info, value_str)); if (error.Success()) { if (reg_ctx->WriteRegister(reg_info, reg_value)) { // Toss all frames and anything else in the thread diff --git a/source/Commands/CommandObjectSettings.cpp b/source/Commands/CommandObjectSettings.cpp index 4a9f69f9c192..d42466cd13b1 100644 --- a/source/Commands/CommandObjectSettings.cpp +++ b/source/Commands/CommandObjectSettings.cpp @@ -102,9 +102,9 @@ insert-before or insert-after."); ~CommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override { + Status error; const int short_option = m_getopt_table[option_idx].val; switch (short_option) { @@ -167,7 +167,7 @@ insert-before or insert-after."); // Complete setting value const char *setting_var_name = input.GetArgumentAtIndex(setting_var_idx); - Error error; + Status error; lldb::OptionValueSP value_sp( m_interpreter.GetDebugger().GetPropertyValue( &m_exe_ctx, setting_var_name, false, error)); @@ -211,7 +211,7 @@ protected: const char *var_value_cstr = Args::StripSpaces(var_value_string, true, false, false); - Error error; + Status error; if (m_options.m_global) { error = m_interpreter.GetDebugger().SetPropertyValue( nullptr, eVarSetOperationAssign, var_name, var_value_cstr); @@ -296,7 +296,7 @@ protected: if (!args.empty()) { for (const auto &arg : args) { - Error error(m_interpreter.GetDebugger().DumpPropertyValue( + Status error(m_interpreter.GetDebugger().DumpPropertyValue( &m_exe_ctx, result.GetOutputStream(), arg.ref, OptionValue::eDumpGroupValue)); if (error.Success()) { @@ -494,7 +494,7 @@ protected: const char *var_value_cstr = Args::StripSpaces(var_value_string, true, true, false); - Error error(m_interpreter.GetDebugger().SetPropertyValue( + Status error(m_interpreter.GetDebugger().SetPropertyValue( &m_exe_ctx, eVarSetOperationRemove, var_name, var_value_cstr)); if (error.Fail()) { result.AppendError(error.AsCString()); @@ -602,7 +602,7 @@ protected: const char *var_value_cstr = Args::StripSpaces(var_value_string, true, true, false); - Error error(m_interpreter.GetDebugger().SetPropertyValue( + Status error(m_interpreter.GetDebugger().SetPropertyValue( &m_exe_ctx, eVarSetOperationReplace, var_name, var_value_cstr)); if (error.Fail()) { result.AppendError(error.AsCString()); @@ -716,7 +716,7 @@ protected: const char *var_value_cstr = Args::StripSpaces(var_value_string, true, true, false); - Error error(m_interpreter.GetDebugger().SetPropertyValue( + Status error(m_interpreter.GetDebugger().SetPropertyValue( &m_exe_ctx, eVarSetOperationInsertBefore, var_name, var_value_cstr)); if (error.Fail()) { result.AppendError(error.AsCString()); @@ -827,7 +827,7 @@ protected: const char *var_value_cstr = Args::StripSpaces(var_value_string, true, true, false); - Error error(m_interpreter.GetDebugger().SetPropertyValue( + Status error(m_interpreter.GetDebugger().SetPropertyValue( &m_exe_ctx, eVarSetOperationInsertAfter, var_name, var_value_cstr)); if (error.Fail()) { result.AppendError(error.AsCString()); @@ -929,7 +929,7 @@ protected: const char *var_value_cstr = Args::StripSpaces(var_value_string, true, true, false); - Error error(m_interpreter.GetDebugger().SetPropertyValue( + Status error(m_interpreter.GetDebugger().SetPropertyValue( &m_exe_ctx, eVarSetOperationAppend, var_name, var_value_cstr)); if (error.Fail()) { result.AppendError(error.AsCString()); @@ -1006,7 +1006,7 @@ protected: return false; } - Error error(m_interpreter.GetDebugger().SetPropertyValue( + Status error(m_interpreter.GetDebugger().SetPropertyValue( &m_exe_ctx, eVarSetOperationClear, var_name, llvm::StringRef())); if (error.Fail()) { result.AppendError(error.AsCString()); diff --git a/source/Commands/CommandObjectSource.cpp b/source/Commands/CommandObjectSource.cpp index 1b9ee1bf8c73..f3c92b9a28c0 100644 --- a/source/Commands/CommandObjectSource.cpp +++ b/source/Commands/CommandObjectSource.cpp @@ -59,9 +59,9 @@ class CommandObjectSourceInfo : public CommandObjectParsed { ~CommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override { + Status error; const int short_option = GetDefinitions()[option_idx].short_option; switch (short_option) { case 'l': @@ -683,9 +683,9 @@ class CommandObjectSourceList : public CommandObjectParsed { ~CommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override { + Status error; const int short_option = GetDefinitions()[option_idx].short_option; switch (short_option) { case 'l': diff --git a/source/Commands/CommandObjectTarget.cpp b/source/Commands/CommandObjectTarget.cpp index a2df4909dc02..343530ea4f35 100644 --- a/source/Commands/CommandObjectTarget.cpp +++ b/source/Commands/CommandObjectTarget.cpp @@ -269,8 +269,8 @@ protected: } const char *file_path = command.GetArgumentAtIndex(0); - Timer scoped_timer(LLVM_PRETTY_FUNCTION, "(lldb) target create '%s'", - file_path); + static Timer::Category func_cat(LLVM_PRETTY_FUNCTION); + Timer scoped_timer(func_cat, "(lldb) target create '%s'", file_path); FileSpec file_spec; if (file_path) @@ -284,7 +284,7 @@ protected: llvm::StringRef arch_cstr = m_arch_option.GetArchitectureName(); const bool get_dependent_files = m_add_dependents.GetOptionValue().GetCurrentValue(); - Error error(debugger.GetTargetList().CreateTarget( + Status error(debugger.GetTargetList().CreateTarget( debugger, file_path, arch_cstr, get_dependent_files, nullptr, target_sp)); @@ -303,7 +303,7 @@ protected: if (file_spec && file_spec.Exists()) { // if the remote file does not exist, push it there if (!platform_sp->GetFileExists(remote_file)) { - Error err = platform_sp->PutFile(file_spec, remote_file); + Status err = platform_sp->PutFile(file_spec, remote_file); if (err.Fail()) { result.AppendError(err.AsCString()); result.SetStatus(eReturnStatusFailed); @@ -324,7 +324,7 @@ protected: } if (file_path) { // copy the remote file to the local file - Error err = platform_sp->GetFile(remote_file, file_spec); + Status err = platform_sp->GetFile(remote_file, file_spec); if (err.Fail()) { result.AppendError(err.AsCString()); result.SetStatus(eReturnStatusFailed); @@ -839,7 +839,7 @@ protected: matches = target->GetImages().FindGlobalVariables( regex, true, UINT32_MAX, variable_list); } else { - Error error(Variable::GetValuesForVariableExpressionPath( + Status error(Variable::GetValuesForVariableExpressionPath( arg, m_exe_ctx.GetBestExecutionContextScope(), GetVariableCallback, target, variable_list, valobj_list)); matches = variable_list.GetSize(); @@ -1993,9 +1993,9 @@ public: ~CommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override { + Status error; const int short_option = m_getopt_table[option_idx].val; switch (short_option) { @@ -2515,7 +2515,7 @@ protected: m_symbol_file.GetOptionValue().GetCurrentValue(); if (!module_spec.GetArchitecture().IsValid()) module_spec.GetArchitecture() = target->GetArchitecture(); - Error error; + Status error; ModuleSP module_sp(target->GetSharedModule(module_spec, &error)); if (!module_sp) { const char *error_cstr = error.AsCString(); @@ -2750,7 +2750,7 @@ protected: process->Flush(); } if (load) { - Error error = module->LoadInMemory(*target, set_pc); + Status error = module->LoadInMemory(*target, set_pc); if (error.Fail()) { result.AppendError(error.AsCString()); return false; @@ -2857,9 +2857,9 @@ public: ~CommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override { + Status error; const int short_option = m_getopt_table[option_idx].val; if (short_option == 'g') { @@ -3220,9 +3220,9 @@ public: ~CommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override { + Status error; const int short_option = m_getopt_table[option_idx].val; @@ -3520,9 +3520,9 @@ public: ~CommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override { + Status error; const int short_option = m_getopt_table[option_idx].val; @@ -4114,7 +4114,7 @@ protected: // Make sure we load any scripting resources that may be embedded // in the debug info files in case the platform supports that. - Error error; + Status error; StreamString feedback_stream; module_sp->LoadScriptingResourceInTarget(target, error, &feedback_stream); @@ -4398,9 +4398,9 @@ public: return llvm::makeArrayRef(g_target_stop_hook_add_options); } - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override { + Status error; const int short_option = m_getopt_table[option_idx].val; switch (short_option) { diff --git a/source/Commands/CommandObjectThread.cpp b/source/Commands/CommandObjectThread.cpp index 7ba6f2c19a8d..6b0f1b455bc1 100644 --- a/source/Commands/CommandObjectThread.cpp +++ b/source/Commands/CommandObjectThread.cpp @@ -162,9 +162,9 @@ public: ~CommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override { + Status error; const int short_option = m_getopt_table[option_idx].val; switch (short_option) { @@ -330,9 +330,9 @@ public: ~CommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override { + Status error; const int short_option = m_getopt_table[option_idx].val; switch (short_option) { @@ -556,7 +556,7 @@ protected: AddressRange range; SymbolContext sc = frame->GetSymbolContext(eSymbolContextEverything); if (m_options.m_end_line != LLDB_INVALID_LINE_NUMBER) { - Error error; + Status error; if (!sc.GetAddressRangeFromHereToEndLine(m_options.m_end_line, range, error)) { result.AppendErrorWithFormat("invalid end-line option: %s.", @@ -565,7 +565,7 @@ protected: return false; } } else if (m_options.m_end_line_is_block_end) { - Error error; + Status error; Block *block = frame->GetSymbolContext(eSymbolContextBlock).block; if (!block) { result.AppendErrorWithFormat("Could not find the current block."); @@ -660,7 +660,7 @@ protected: const uint32_t iohandler_id = process->GetIOHandlerID(); StreamString stream; - Error error; + Status error; if (synchronous_execution) error = process->ResumeSynchronous(&stream); else @@ -841,7 +841,7 @@ public: } StreamString stream; - Error error; + Status error; if (synchronous_execution) error = process->ResumeSynchronous(&stream); else @@ -908,9 +908,9 @@ public: ~CommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override { + Status error; const int short_option = m_getopt_table[option_idx].val; switch (short_option) { @@ -1174,7 +1174,7 @@ protected: process->GetThreadList().SetSelectedThreadByID(m_options.m_thread_idx); StreamString stream; - Error error; + Status error; if (synchronous_execution) error = process->ResumeSynchronous(&stream); else @@ -1325,10 +1325,10 @@ public: m_json_stopinfo = false; } - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override { + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override { const int short_option = m_getopt_table[option_idx].val; - Error error; + Status error; switch (short_option) { case 'j': @@ -1340,7 +1340,7 @@ public: break; default: - return Error("invalid short option character '%c'", short_option); + return Status("invalid short option character '%c'", short_option); } return error; } @@ -1418,9 +1418,9 @@ public: ~CommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override { + Status error; const int short_option = m_getopt_table[option_idx].val; switch (short_option) { @@ -1498,7 +1498,7 @@ protected: "called expressions"); Thread *thread = m_exe_ctx.GetThreadPtr(); - Error error; + Status error; error = thread->UnwindInnermostExpression(); if (!error.Success()) { result.AppendErrorWithFormat("Unwinding expression failed - %s.", @@ -1553,7 +1553,7 @@ protected: } } - Error error; + Status error; ThreadSP thread_sp = m_exe_ctx.GetThreadSP(); const bool broadcast = true; error = thread_sp->ReturnFromFrame(frame_sp, return_valobj_sp, broadcast); @@ -1602,24 +1602,24 @@ public: m_force = false; } - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override { + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override { const int short_option = m_getopt_table[option_idx].val; - Error error; + Status error; switch (short_option) { case 'f': m_filenames.AppendIfUnique(FileSpec(option_arg, false)); if (m_filenames.GetSize() > 1) - return Error("only one source file expected."); + return Status("only one source file expected."); break; case 'l': if (option_arg.getAsInteger(0, m_line_num)) - return Error("invalid line number: '%s'.", option_arg.str().c_str()); + return Status("invalid line number: '%s'.", option_arg.str().c_str()); break; case 'b': if (option_arg.getAsInteger(0, m_line_offset)) - return Error("invalid line offset: '%s'.", option_arg.str().c_str()); + return Status("invalid line offset: '%s'.", option_arg.str().c_str()); break; case 'a': m_load_addr = Args::StringToAddress(execution_context, option_arg, @@ -1629,7 +1629,7 @@ public: m_force = true; break; default: - return Error("invalid short option character '%c'", short_option); + return Status("invalid short option character '%c'", short_option); } return error; } @@ -1702,7 +1702,7 @@ protected: } std::string warnings; - Error err = thread->JumpToLine(file, line, m_options.m_force, &warnings); + Status err = thread->JumpToLine(file, line, m_options.m_force, &warnings); if (err.Fail()) { result.SetError(err); @@ -1747,9 +1747,9 @@ public: ~CommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override { + Status error; const int short_option = m_getopt_table[option_idx].val; switch (short_option) { diff --git a/source/Commands/CommandObjectType.cpp b/source/Commands/CommandObjectType.cpp index b34a42738d4f..2d4271cab362 100644 --- a/source/Commands/CommandObjectType.cpp +++ b/source/Commands/CommandObjectType.cpp @@ -127,8 +127,8 @@ private: ~CommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override; void OptionParsingStarting(ExecutionContext *execution_context) override; @@ -213,7 +213,7 @@ public: options->m_flags, funct_name_str.c_str(), lines.CopyList(" ").c_str())); - Error error; + Status error; for (size_t i = 0; i < options->m_target_types.GetSize(); i++) { const char *type_name = @@ -283,7 +283,7 @@ public: static bool AddSummary(ConstString type_name, lldb::TypeSummaryImplSP entry, SummaryFormatType type, std::string category, - Error *error = nullptr); + Status *error = nullptr); protected: bool DoExecute(Args &command, CommandReturnObject &result) override; @@ -321,9 +321,9 @@ private: ~CommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override { + Status error; const int short_option = m_getopt_table[option_idx].val; bool success; @@ -464,7 +464,7 @@ protected: DataVisualization::Categories::GetCategory( ConstString(options->m_category.c_str()), category); - Error error; + Status error; for (size_t i = 0; i < options->m_target_types.GetSize(); i++) { const char *type_name = @@ -523,7 +523,7 @@ public: static bool AddSynth(ConstString type_name, lldb::SyntheticChildrenSP entry, SynthFormatType type, std::string category_name, - Error *error); + Status *error); }; //------------------------------------------------------------------------- @@ -562,9 +562,9 @@ private: m_custom_type_name.clear(); } - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, + ExecutionContext *execution_context) override { + Status error; const int short_option = g_type_format_add_options[option_idx].short_option; bool success; @@ -769,9 +769,9 @@ protected: ~CommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override { + Status error; const int short_option = m_getopt_table[option_idx].val; switch (short_option) { @@ -909,9 +909,9 @@ private: ~CommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override { + Status error; const int short_option = m_getopt_table[option_idx].val; switch (short_option) { @@ -1025,9 +1025,9 @@ class CommandObjectTypeFormatterList : public CommandObjectParsed { ~CommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override { + Status error; const int short_option = m_getopt_table[option_idx].val; switch (short_option) { case 'w': @@ -1243,10 +1243,10 @@ public: #endif // LLDB_DISABLE_PYTHON -Error CommandObjectTypeSummaryAdd::CommandOptions::SetOptionValue( +Status CommandObjectTypeSummaryAdd::CommandOptions::SetOptionValue( uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) { - Error error; + Status error; const int short_option = m_getopt_table[option_idx].val; bool success; @@ -1423,7 +1423,7 @@ bool CommandObjectTypeSummaryAdd::Execute_ScriptSummary( // if I am here, script_format must point to something good, so I can add that // as a script summary to all interested parties - Error error; + Status error; for (auto &entry : command.entries()) { CommandObjectTypeSummaryAdd::AddSummary( @@ -1498,7 +1498,7 @@ bool CommandObjectTypeSummaryAdd::Execute_StringSummary( lldb::TypeSummaryImplSP entry(string_format.release()); // now I have a valid format, let's add it to every type - Error error; + Status error; for (auto &arg_entry : command.entries()) { if (arg_entry.ref.empty()) { result.AppendError("empty typenames not allowed"); @@ -1681,7 +1681,7 @@ bool CommandObjectTypeSummaryAdd::AddSummary(ConstString type_name, TypeSummaryImplSP entry, SummaryFormatType type, std::string category_name, - Error *error) { + Status *error) { lldb::TypeCategoryImplSP category; DataVisualization::Categories::GetCategory(ConstString(category_name.c_str()), category); @@ -1799,9 +1799,9 @@ class CommandObjectTypeCategoryDefine : public CommandObjectParsed { ~CommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override { + Status error; const int short_option = m_getopt_table[option_idx].val; switch (short_option) { @@ -1903,9 +1903,9 @@ class CommandObjectTypeCategoryEnable : public CommandObjectParsed { ~CommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override { + Status error; const int short_option = m_getopt_table[option_idx].val; switch (short_option) { @@ -2080,9 +2080,9 @@ class CommandObjectTypeCategoryDisable : public CommandObjectParsed { ~CommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override { + Status error; const int short_option = m_getopt_table[option_idx].val; switch (short_option) { @@ -2407,7 +2407,7 @@ bool CommandObjectTypeSynthAdd::Execute_PythonClass( DataVisualization::Categories::GetCategory( ConstString(m_options.m_category.c_str()), category); - Error error; + Status error; for (auto &arg_entry : command.entries()) { if (arg_entry.ref.empty()) { @@ -2450,7 +2450,7 @@ bool CommandObjectTypeSynthAdd::AddSynth(ConstString type_name, SyntheticChildrenSP entry, SynthFormatType type, std::string category_name, - Error *error) { + Status *error) { lldb::TypeCategoryImplSP category; DataVisualization::Categories::GetCategory(ConstString(category_name.c_str()), category); @@ -2512,9 +2512,9 @@ private: ~CommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override { + Status error; const int short_option = m_getopt_table[option_idx].val; bool success; @@ -2586,7 +2586,7 @@ private: bool AddFilter(ConstString type_name, TypeFilterImplSP entry, FilterFormatType type, std::string category_name, - Error *error) { + Status *error) { lldb::TypeCategoryImplSP category; DataVisualization::Categories::GetCategory( ConstString(category_name.c_str()), category); @@ -2717,7 +2717,7 @@ protected: DataVisualization::Categories::GetCategory( ConstString(m_options.m_category.c_str()), category); - Error error; + Status error; WarnOnPotentialUnquotedUnsignedType(command, result); @@ -2787,9 +2787,9 @@ protected: return llvm::makeArrayRef(g_type_lookup_options); } - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, + ExecutionContext *execution_context) override { + Status error; const int short_option = g_type_lookup_options[option_idx].short_option; @@ -2899,7 +2899,7 @@ public: if (!ParseOptions(args, result)) return false; - Error error(m_option_group.NotifyOptionParsingFinished(&exe_ctx)); + Status error(m_option_group.NotifyOptionParsingFinished(&exe_ctx)); if (error.Fail()) { result.AppendError(error.AsCString()); result.SetStatus(eReturnStatusFailed); diff --git a/source/Commands/CommandObjectWatchpoint.cpp b/source/Commands/CommandObjectWatchpoint.cpp index 1ad53cdb88ad..9c84c992e715 100644 --- a/source/Commands/CommandObjectWatchpoint.cpp +++ b/source/Commands/CommandObjectWatchpoint.cpp @@ -197,9 +197,9 @@ public: ~CommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override { + Status error; const int short_option = m_getopt_table[option_idx].val; switch (short_option) { @@ -245,7 +245,7 @@ protected: if (target->GetProcessSP() && target->GetProcessSP()->IsAlive()) { uint32_t num_supported_hardware_watchpoints; - Error error = target->GetProcessSP()->GetWatchpointSupportInfo( + Status error = target->GetProcessSP()->GetWatchpointSupportInfo( num_supported_hardware_watchpoints); if (error.Success()) result.AppendMessageWithFormat( @@ -561,9 +561,9 @@ public: ~CommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override { + Status error; const int short_option = m_getopt_table[option_idx].val; switch (short_option) { @@ -689,9 +689,9 @@ public: ~CommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override { + Status error; const int short_option = m_getopt_table[option_idx].val; switch (short_option) { @@ -881,7 +881,7 @@ protected: } // Things have checked out ok... - Error error; + Status error; uint32_t expr_path_options = StackFrame::eExpressionPathOptionCheckPtrVsMember | StackFrame::eExpressionPathOptionsAllowDirectIVarAccess; @@ -895,7 +895,7 @@ protected: VariableList variable_list; ValueObjectList valobj_list; - Error error(Variable::GetValuesForVariableExpressionPath( + Status error(Variable::GetValuesForVariableExpressionPath( command.GetArgumentAtIndex(0), m_exe_ctx.GetBestExecutionContextScope(), GetVariableCallback, target, variable_list, valobj_list)); @@ -1060,7 +1060,7 @@ protected: if (!ParseOptions(args, result)) return false; - Error error(m_option_group.NotifyOptionParsingFinished(&exe_ctx)); + Status error(m_option_group.NotifyOptionParsingFinished(&exe_ctx)); if (error.Fail()) { result.AppendError(error.AsCString()); result.SetStatus(eReturnStatusFailed); @@ -1135,7 +1135,7 @@ protected: /// of the expression, so convert to that if we found a valid type. CompilerType compiler_type(valobj_sp->GetCompilerType()); - Error error; + Status error; Watchpoint *wp = target->CreateWatchpoint(addr, size, &compiler_type, watch_type, error) .get(); diff --git a/source/Commands/CommandObjectWatchpointCommand.cpp b/source/Commands/CommandObjectWatchpointCommand.cpp index 1509c487a8a7..ec7e4a1f9cde 100644 --- a/source/Commands/CommandObjectWatchpointCommand.cpp +++ b/source/Commands/CommandObjectWatchpointCommand.cpp @@ -319,9 +319,9 @@ are no syntax errors may indicate that a function was declared but never called. ~CommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override { - Error error; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override { + Status error; const int short_option = m_getopt_table[option_idx].val; switch (short_option) { diff --git a/source/Core/Address.cpp b/source/Core/Address.cpp index 91229a9b18eb..6328e433852a 100644 --- a/source/Core/Address.cpp +++ b/source/Core/Address.cpp @@ -33,8 +33,8 @@ #include "lldb/Utility/ConstString.h" // for ConstString #include "lldb/Utility/DataExtractor.h" // for DataExtractor #include "lldb/Utility/Endian.h" // for InlHostByteOrder -#include "lldb/Utility/Error.h" // for Error #include "lldb/Utility/FileSpec.h" // for FileSpec +#include "lldb/Utility/Status.h" // for Status #include "lldb/Utility/Stream.h" // for Stream #include "lldb/Utility/StreamString.h" // for StreamString @@ -67,7 +67,7 @@ static size_t ReadBytes(ExecutionContextScope *exe_scope, TargetSP target_sp(exe_scope->CalculateTarget()); if (target_sp) { - Error error; + Status error; bool prefer_file_cache = false; return target_sp->ReadMemory(address, prefer_file_cache, dst, dst_len, error); @@ -322,7 +322,7 @@ addr_t Address::GetCallableLoadAddress(Target *target, bool is_indirect) const { if (is_indirect && target) { ProcessSP processSP = target->GetProcessSP(); - Error error; + Status error; if (processSP) { code_addr = processSP->ResolveIndirectFunction(this, error); if (!error.Success()) @@ -734,7 +734,7 @@ bool Address::Dump(Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, if (process) { addr_t load_addr = GetLoadAddress(target); if (load_addr != LLDB_INVALID_ADDRESS) { - Error memory_error; + Status memory_error; |