diff options
| author | Zachary Turner <zturner@google.com> | 2017-05-12 04:51:55 +0000 |
|---|---|---|
| committer | Zachary Turner <zturner@google.com> | 2017-05-12 04:51:55 +0000 |
| commit | 97206d572797bddc1bba71bb1c18c97f19d69053 (patch) | |
| tree | fdf21d24485672cf97c800264d135b9d5d2ecdce | |
| parent | 3086b45a2fae833e8419885e78c598d936cc6429 (diff) | |
| download | bcm5719-llvm-97206d572797bddc1bba71bb1c18c97f19d69053.tar.gz bcm5719-llvm-97206d572797bddc1bba71bb1c18c97f19d69053.zip | |
Rename Error -> Status.
This renames the LLDB error class to Status, as discussed
on the lldb-dev mailing list.
A change of this magnitude cannot easily be done without
find and replace, but that has potential to catch unwanted
occurrences of common strings such as "Error". Every effort
was made to find all the obvious things such as the word "Error"
appearing in a string, etc, but it's possible there are still
some lingering occurences left around. Hopefully nothing too
serious.
llvm-svn: 302872
655 files changed, 5887 insertions, 5772 deletions
diff --git a/lldb/include/lldb/API/SBError.h b/lldb/include/lldb/API/SBError.h index a3b1f87053a..a099a9be271 100644 --- a/lldb/include/lldb/API/SBError.h +++ b/lldb/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/lldb/include/lldb/API/SBPlatform.h b/lldb/include/lldb/API/SBPlatform.h index 3f7e1acb74b..952e3106631 100644 --- a/lldb/include/lldb/API/SBPlatform.h +++ b/lldb/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/lldb/include/lldb/API/SBTarget.h b/lldb/include/lldb/API/SBTarget.h index 21341fbc27f..62398fcd4b9 100644 --- a/lldb/include/lldb/API/SBTarget.h +++ b/lldb/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/lldb/include/lldb/Breakpoint/Breakpoint.h b/lldb/include/lldb/Breakpoint/Breakpoint.h index 4a16df047ee..3f7bdf26134 100644 --- a/lldb/include/lldb/Breakpoint/Breakpoint.h +++ b/lldb/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(const char *new_name, Status &error); void RemoveName(const char *name_to_remove) { if (name_to_remove) diff --git a/lldb/include/lldb/Breakpoint/BreakpointID.h b/lldb/include/lldb/Breakpoint/BreakpointID.h index aa4add4cd66..57411b31631 100644 --- a/lldb/include/lldb/Breakpoint/BreakpointID.h +++ b/lldb/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/lldb/include/lldb/Breakpoint/BreakpointLocation.h b/lldb/include/lldb/Breakpoint/BreakpointLocation.h index d0567ccf2e0..a1086aa3fe5 100644 --- a/lldb/include/lldb/Breakpoint/BreakpointLocation.h +++ b/lldb/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/lldb/include/lldb/Breakpoint/BreakpointOptions.h b/lldb/include/lldb/Breakpoint/BreakpointOptions.h index 024e915908c..4ed8469eba3 100644 --- a/lldb/include/lldb/Breakpoint/BreakpointOptions.h +++ b/lldb/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/lldb/include/lldb/Breakpoint/BreakpointResolver.h b/lldb/include/lldb/Breakpoint/BreakpointResolver.h index 7a57250d632..4f92feaa5dc 100644 --- a/lldb/include/lldb/Breakpoint/BreakpointResolver.h +++ b/lldb/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(); diff --git a/lldb/include/lldb/Breakpoint/BreakpointResolverAddress.h b/lldb/include/lldb/Breakpoint/BreakpointResolverAddress.h index 6d2d505811f..9d757c8853b 100644 --- a/lldb/include/lldb/Breakpoint/BreakpointResolverAddress.h +++ b/lldb/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/lldb/include/lldb/Breakpoint/BreakpointResolverFileLine.h b/lldb/include/lldb/Breakpoint/BreakpointResolverFileLine.h index 50750b1fbdf..f7bba3d4ccb 100644 --- a/lldb/include/lldb/Breakpoint/BreakpointResolverFileLine.h +++ b/lldb/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/lldb/include/lldb/Breakpoint/BreakpointResolverFileRegex.h b/lldb/include/lldb/Breakpoint/BreakpointResolverFileRegex.h index 6f00dac3f0a..d620e99ffc6 100644 --- a/lldb/include/lldb/Breakpoint/BreakpointResolverFileRegex.h +++ b/lldb/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/lldb/include/lldb/Breakpoint/BreakpointResolverName.h b/lldb/include/lldb/Breakpoint/BreakpointResolverName.h index 4223125d926..c7716d5146e 100644 --- a/lldb/include/lldb/Breakpoint/BreakpointResolverName.h +++ b/lldb/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/lldb/include/lldb/Breakpoint/Watchpoint.h b/lldb/include/lldb/Breakpoint/Watchpoint.h index beb7bad1ee9..69067a56762 100644 --- a/lldb/include/lldb/Breakpoint/Watchpoint.h +++ b/lldb/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/lldb/include/lldb/Core/Communication.h b/lldb/include/lldb/Core/Communication.h index 9459573ca90..57fa483bd3a 100644 --- a/lldb/include/lldb/Core/Communication.h +++ b/lldb/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/lldb/include/lldb/Core/Connection.h b/lldb/include/lldb/Core/Connection.h index 8d84377e375..27757b2f77e 100644 --- a/lldb/include/lldb/Core/Connection.h +++ b/lldb/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/lldb/include/lldb/Core/Debugger.h b/lldb/include/lldb/Core/Debugger.h index 56201273fdd..cedf9ecdb12 100644 --- a/lldb/include/lldb/Core/Debugger.h +++ b/lldb/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/lldb/include/lldb/Core/FormatEntity.h b/lldb/include/lldb/Core/FormatEntity.h index 6705c155cef..aa5ccb48e56 100644 --- a/lldb/include/lldb/Core/FormatEntity.h +++ b/lldb/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/lldb/include/lldb/Core/MappedHash.h b/lldb/include/lldb/Core/MappedHash.h index cab98ee5b30..18d383ed581 100644 --- a/lldb/include/lldb/Core/MappedHash.h +++ b/lldb/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/lldb/include/lldb/Core/Module.h b/lldb/include/lldb/Core/Module.h index 33735bc99f6..2ffe57ad8a4 100644 --- a/lldb/include/lldb/Core/Module.h +++ b/lldb/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/lldb/include/lldb/Core/ModuleList.h b/lldb/include/lldb/Core/ModuleList.h index d82d1c0d48d..4b637c9b042 100644 --- a/lldb/include/lldb/Core/ModuleList.h +++ b/lldb/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/lldb/include/lldb/Core/PluginManager.h b/lldb/include/lldb/Core/PluginManager.h index 645ab85eaa7..d9851e5ecfc 100644 --- a/lldb/include/lldb/Core/PluginManager.h +++ b/lldb/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/lldb/include/lldb/Core/RegisterValue.h b/lldb/include/lldb/Core/RegisterValue.h index 66c4689d702..a45db00fb76 100644 --- a/lldb/include/lldb/Core/RegisterValue.h +++ b/lldb/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/lldb/include/lldb/Core/Scalar.h b/lldb/include/lldb/Core/Scalar.h index c534044af75..943398b8802 100644 --- a/lldb/include/lldb/Core/Scalar.h +++ b/lldb/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/lldb/include/lldb/Core/SearchFilter.h b/lldb/include/lldb/Core/SearchFilter.h index 829305ff5de..51a20d98af3 100644 --- a/lldb/include/lldb/Core/SearchFilter.h +++ b/lldb/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(); @@ -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/lldb/include/lldb/Core/StructuredData.h b/lldb/include/lldb/Core/StructuredData.h index eecfd86f798..1cf2a2b1847 100644 --- a/lldb/include/lldb/Core/StructuredData.h +++ b/lldb/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; @@ -558,7 +558,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/lldb/include/lldb/Core/StructuredDataImpl.h b/lldb/include/lldb/Core/StructuredDataImpl.h index 94f9cce5254..81d59f83ac3 100644 --- a/lldb/include/lldb/Core/StructuredDataImpl.h +++ b/lldb/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/lldb/include/lldb/Core/UserSettingsController.h b/lldb/include/lldb/Core/UserSettingsController.h index 0207187f071..67bc9b2c071 100644 --- a/lldb/include/lldb/Core/UserSettingsController.h +++ b/lldb/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/lldb/include/lldb/Core/Value.h b/lldb/include/lldb/Core/Value.h index 9a667cf6575..678b56fc49f 100644 --- a/lldb/include/lldb/Core/Value.h +++ b/lldb/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/lldb/include/lldb/Core/ValueObject.h b/lldb/include/lldb/Core/ValueObject.h index 0898754b211..fa1d14870b0 100644 --- a/lldb/include/lldb/Core/ValueObject.h +++ b/lldb/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/lldb/include/lldb/Core/ValueObjectConstResult.h b/lldb/include/lldb/Core/ValueObjectConstResult.h index 403d19324c4..1f56129df24 100644 --- a/lldb/include/lldb/Core/ValueObjectConstResult.h +++ b/lldb/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/lldb/include/lldb/Core/ValueObjectConstResultCast.h b/lldb/include/lldb/Core/ValueObjectConstResultCast.h index 3443bfb4885..442cce42085 100644 --- a/lldb/include/lldb/Core/ValueObjectConstResultCast.h +++ b/lldb/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/lldb/include/lldb/Core/ValueObjectConstResultChild.h b/lldb/include/lldb/Core/ValueObjectConstResultChild.h index 3da59dc2eb5..a74da0013ab 100644 --- a/lldb/include/lldb/Core/ValueObjectConstResultChild.h +++ b/lldb/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/lldb/include/lldb/Core/ValueObjectConstResultImpl.h b/lldb/include/lldb/Core/ValueObjectConstResultImpl.h index 2586aab4c78..d86f25e3057 100644 --- a/lldb/include/lldb/Core/ValueObjectConstResultImpl.h +++ b/lldb/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/lldb/include/lldb/Core/ValueObjectDynamicValue.h b/lldb/include/lldb/Core/ValueObjectDynamicValue.h index 99eb1ebcf97..018ee2c764b 100644 --- a/lldb/include/lldb/Core/ValueObjectDynamicValue.h +++ b/lldb/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/lldb/include/lldb/Core/ValueObjectRegister.h b/lldb/include/lldb/Core/ValueObjectRegister.h index 50d0e12bb3f..2aaef9bee99 100644 --- a/lldb/include/lldb/Core/ValueObjectRegister.h +++ b/lldb/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/lldb/include/lldb/Core/ValueObjectSyntheticFilter.h b/lldb/include/lldb/Core/ValueObjectSyntheticFilter.h index d83f038744e..e32e1403041 100644 --- a/lldb/include/lldb/Core/ValueObjectSyntheticFilter.h +++ b/lldb/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/lldb/include/lldb/Core/ValueObjectVariable.h b/lldb/include/lldb/Core/ValueObjectVariable.h index dbb7c2b9483..9dd140a84f4 100644 --- a/lldb/include/lldb/Core/ValueObjectVariable.h +++ b/lldb/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/lldb/include/lldb/DataFormatters/TypeSummary.h b/lldb/include/lldb/DataFormatters/TypeSummary.h index fbfc25dd9c9..a4d51b06548 100644 --- a/lldb/include/lldb/DataFormatters/TypeSummary.h +++ b/lldb/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/lldb/include/lldb/Expression/DWARFExpression.h b/lldb/include/lldb/Expression/DWARFExpression.h index ae9eb3fb2d1..1816c3b7a00 100644 --- a/lldb/include/lldb/Expression/DWARFExpression.h +++ b/lldb/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/lldb/include/lldb/Expression/ExpressionParser.h b/lldb/include/lldb/Expression/ExpressionParser.h index 9f33908b8f1..19526d28b9b 100644 --- a/lldb/include/lldb/Expression/ExpressionParser.h +++ b/lldb/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/lldb/include/lldb/Expression/IRExecutionUnit.h b/lldb/include/lldb/Expression/IRExecutionUnit.h index 635e0b727d5..b0b4d7a5c58 100644 --- a/lldb/include/lldb/Expression/IRExecutionUnit.h +++ b/lldb/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/lldb/include/lldb/Expression/IRInterpreter.h b/lldb/include/lldb/Expression/IRInterpreter.h index f9392c18c25..36e03c6fc4f 100644 --- a/lldb/include/lldb/Expression/IRInterpreter.h +++ b/lldb/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/lldb/include/lldb/Expression/IRMemoryMap.h b/lldb/include/lldb/Expression/IRMemoryMap.h index c1a194d1afa..abb5cd74505 100644 --- a/lldb/include/lldb/Expression/IRMemoryMap.h +++ b/lldb/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/lldb/include/lldb/Expression/LLVMUserExpression.h b/lldb/include/lldb/Expression/LLVMUserExpression.h index 48d0161991d..745d413e077 100644 --- a/lldb/include/lldb/Expression/LLVMUserExpression.h +++ b/lldb/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/lldb/include/lldb/Expression/Materializer.h b/lldb/include/lldb/Expression/Materializer.h index ed3f91cc67e..b86bc656d6b 100644 --- a/lldb/include/lldb/Expression/Materializer.h +++ b/lldb/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/lldb/include/lldb/Expression/REPL.h b/lldb/include/lldb/Expression/REPL.h index 56d31cfd3b1..0c1e97fec25 100644 --- a/lldb/include/lldb/Expression/REPL.h +++ b/lldb/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/lldb/include/lldb/Expression/UserExpression.h b/lldb/include/lldb/Expression/UserExpression.h index fca667e8ee9..ced5cb2bf2b 100644 --- a/lldb/include/lldb/Expression/UserExpression.h +++ b/lldb/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/lldb/include/lldb/Expression/UtilityFunction.h b/lldb/include/lldb/Expression/UtilityFunction.h index 0e2b87da20a..9c54db35fa3 100644 --- a/lldb/include/lldb/Expression/UtilityFunction.h +++ b/lldb/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/lldb/include/lldb/Host/File.h b/lldb/include/lldb/Host/File.h index 35317780f1c..560a655237f 100644 --- a/lldb/include/lldb/Host/File.h +++ b/lldb/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/lldb/include/lldb/Host/FileCache.h b/lldb/include/lldb/Host/FileCache.h index 094ee695ce3..1c03540c1eb 100644 --- a/lldb/include/lldb/Host/FileCache.h +++ b/lldb/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/lldb/include/lldb/Host/FileSystem.h b/lldb/include/lldb/Host/FileSystem.h index 794308ff424..c13d5c84c63 100644 --- a/lldb/include/lldb/Host/FileSystem.h +++ b/lldb/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/lldb/include/lldb/Host/Host.h b/lldb/include/lldb/Host/Host.h index 8415d429d5e..c474dccab5d 100644 --- a/lldb/include/lldb/Host/Host.h +++ b/lldb/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/lldb/include/lldb/Host/HostNativeProcessBase.h b/lldb/include/lldb/Host/HostNativeProcessBase.h index 0befe867c29..07f98c24776 100644 --- a/lldb/include/lldb/Host/HostNativeProcessBase.h +++ b/lldb/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/lldb/include/lldb/Host/HostNativeThreadBase.h b/lldb/include/lldb/Host/HostNativeThreadBase.h index 9bf86e0759f..f1f89f3b75f 100644 --- a/lldb/include/lldb/Host/HostNativeThreadBase.h +++ b/lldb/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/lldb/include/lldb/Host/HostProcess.h b/lldb/include/lldb/Host/HostProcess.h index 56c3ddd9a1c..dfc997bd81f 100644 --- a/lldb/include/lldb/Host/HostProcess.h +++ b/lldb/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/lldb/include/lldb/Host/HostThread.h b/lldb/include/lldb/Host/HostThread.h index 96314813cf7..0d2fbe6045a 100644 --- a/lldb/include/lldb/Host/HostThread.h +++ b/lldb/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/lldb/include/lldb/Host/IOObject.h b/lldb/include/lldb/Host/IOObject.h index 90e0bcdcd9d..98ad5056de7 100644 --- a/lldb/include/lldb/Host/IOObject.h +++ b/lldb/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/lldb/include/lldb/Host/LockFileBase.h b/lldb/include/lldb/Host/LockFileBase.h index 74eafb27932..4eda1916c72 100644 --- a/lldb/include/lldb/Host/LockFileBase.h +++ b/lldb/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/lldb/include/lldb/Host/MainLoop.h b/lldb/include/lldb/Host/MainLoop.h index f5d906e98a7..a722348b884 100644 --- a/lldb/include/lldb/Host/MainLoop.h +++ b/lldb/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/lldb/include/lldb/Host/MainLoopBase.h b/lldb/include/lldb/Host/MainLoopBase.h index b746a9cb208..39ca9a0f0c9 100644 --- a/lldb/include/lldb/Host/MainLoopBase.h +++ b/lldb/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/lldb/include/lldb/Host/MonitoringProcessLauncher.h b/lldb/include/lldb/Host/MonitoringProcessLauncher.h index 7aa819a16c7..9ad36e90a77 100644 --- a/lldb/include/lldb/Host/MonitoringProcessLauncher.h +++ b/lldb/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/lldb/include/lldb/Host/PipeBase.h b/lldb/include/lldb/Host/PipeBase.h index f141b5d413a..ad62072c7ba 100644 --- a/lldb/include/lldb/Host/PipeBase.h +++ b/lldb/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/lldb/include/lldb/Host/ProcessLauncher.h b/lldb/include/lldb/Host/ProcessLauncher.h index 12049a69b3d..49fa84113f6 100644 --- a/lldb/include/lldb/Host/ProcessLauncher.h +++ b/lldb/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/lldb/include/lldb/Host/Socket.h b/lldb/include/lldb/Host/Socket.h index 36d506281cf..c4233a233a8 100644 --- a/lldb/include/lldb/Host/Socket.h +++ b/lldb/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/lldb/include/lldb/Host/ThreadLauncher.h b/lldb/include/lldb/Host/ThreadLauncher.h index 4e388ca6bb9..b50f0e2c2c4 100644 --- a/lldb/include/lldb/Host/ThreadLauncher.h +++ b/lldb/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/lldb/include/lldb/Host/common/NativeBreakpoint.h b/lldb/include/lldb/Host/common/NativeBreakpoint.h index 2f872e1d5a5..73639d64c9e 100644 --- a/lldb/include/lldb/Host/common/NativeBreakpoint.h +++ b/lldb/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/lldb/include/lldb/Host/common/NativeBreakpointList.h b/lldb/include/lldb/Host/common/NativeBreakpointList.h index 1d314e02b1d..ffa659fdd86 100644 --- a/lldb/include/lldb/Host/common/NativeBreakpointList.h +++ b/lldb/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/lldb/include/lldb/Host/common/NativeProcessProtocol.h b/lldb/include/lldb/Host/common/NativeProcessProtocol.h index 7ad09d41eac..388edef0578 100644 --- a/lldb/include/lldb/Host/common/NativeProcessProtocol.h +++ b/lldb/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/lldb/include/lldb/Host/common/NativeRegisterContext.h b/lldb/include/lldb/Host/common/NativeRegisterContext.h index 1d8b51c60cc..982d81b9ac4 100644 --- a/lldb/include/lldb/Host/common/NativeRegisterContext.h +++ b/lldb/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/lldb/include/lldb/Host/common/NativeThreadProtocol.h b/lldb/include/lldb/Host/common/NativeThreadProtocol.h index 8f26616a2b4..2e6c96a34cf 100644 --- a/lldb/include/lldb/Host/common/NativeThreadProtocol.h +++ b/lldb/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/lldb/include/lldb/Host/common/NativeWatchpointList.h b/lldb/include/lldb/Host/common/NativeWatchpointList.h index ae3476f5f07..02920e6faac 100644 --- a/lldb/include/lldb/Host/common/NativeWatchpointList.h +++ b/lldb/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/lldb/include/lldb/Host/common/SoftwareBreakpoint.h b/lldb/include/lldb/Host/common/SoftwareBreakpoint.h index 703f6bb95d4..e0f235fecd9 100644 --- a/lldb/include/lldb/Host/common/SoftwareBreakpoint.h +++ b/lldb/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/lldb/include/lldb/Host/common/TCPSocket.h b/lldb/include/lldb/Host/common/TCPSocket.h index 5b72f344019..0d32a70fd38 100644 --- a/lldb/include/lldb/Host/common/TCPSocket.h +++ b/lldb/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/lldb/include/lldb/Host/common/UDPSocket.h b/lldb/include/lldb/Host/common/UDPSocket.h index 977ce151e4f..27b2d1dc983 100644 --- a/lldb/include/lldb/Host/common/UDPSocket.h +++ b/lldb/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/lldb/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h b/lldb/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h index f002dd167ce..f57c9368400 100644 --- a/lldb/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h +++ b/lldb/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/lldb/include/lldb/Host/posix/DomainSocket.h b/lldb/include/lldb/Host/posix/DomainSocket.h index 78a3dc89828..e66b3f971fa 100644 --- a/lldb/include/lldb/Host/posix/DomainSocket.h +++ b/lldb/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/lldb/include/lldb/Host/posix/HostProcessPosix.h b/lldb/include/lldb/Host/posix/HostProcessPosix.h index aed3cccef2e..0a6d8822d44 100644 --- a/lldb/include/lldb/Host/posix/HostProcessPosix.h +++ b/lldb/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/lldb/include/lldb/Host/posix/HostThreadPosix.h b/lldb/include/lldb/Host/posix/HostThreadPosix.h index 99b99d767b1..c230a61bc57 100644 --- a/lldb/include/lldb/Host/posix/HostThreadPosix.h +++ b/lldb/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/lldb/include/lldb/Host/posix/LockFilePosix.h b/lldb/include/lldb/Host/posix/LockFilePosix.h index dde9bd0eefe..a59a7fe3e72 100644 --- a/lldb/include/lldb/Host/posix/LockFilePosix.h +++ b/lldb/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/lldb/include/lldb/Host/posix/PipePosix.h b/lldb/include/lldb/Host/posix/PipePosix.h index 738f95ed0db..8208b1b8bd6 100644 --- a/lldb/include/lldb/Host/posix/PipePosix.h +++ b/lldb/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/lldb/include/lldb/Host/posix/ProcessLauncherPosix.h b/lldb/include/lldb/Host/posix/ProcessLauncherPosix.h index e481e3dc7ea..4800c406604 100644 --- a/lldb/include/lldb/Host/posix/ProcessLauncherPosix.h +++ b/lldb/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/lldb/include/lldb/Host/posix/ProcessLauncherPosixFork.h b/lldb/include/lldb/Host/posix/ProcessLauncherPosixFork.h index 77bdab535c1..1193a20b4d3 100644 --- a/lldb/include/lldb/Host/posix/ProcessLauncherPosixFork.h +++ b/lldb/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/lldb/include/lldb/Host/windows/ConnectionGenericFileWindows.h b/lldb/include/lldb/Host/windows/ConnectionGenericFileWindows.h index 4a5a3858a82..9309288b8c0 100644 --- a/lldb/include/lldb/Host/windows/ConnectionGenericFileWindows.h +++ b/lldb/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/lldb/include/lldb/Host/windows/HostProcessWindows.h b/lldb/include/lldb/Host/windows/HostProcessWindows.h index 2896c7be793..4ef35337d70 100644 --- a/lldb/include/lldb/Host/windows/HostProcessWindows.h +++ b/lldb/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/lldb/include/lldb/Host/windows/HostThreadWindows.h b/lldb/include/lldb/Host/windows/HostThreadWindows.h index 2acc28e29b5..35d83c0ba2b 100644 --- a/lldb/include/lldb/Host/windows/HostThreadWindows.h +++ b/lldb/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/lldb/include/lldb/Host/windows/LockFileWindows.h b/lldb/include/lldb/Host/windows/LockFileWindows.h index 9cd1faedc26..10456a1b8b2 100644 --- a/lldb/include/lldb/Host/windows/LockFileWindows.h +++ b/lldb/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/lldb/include/lldb/Host/windows/PipeWindows.h b/lldb/include/lldb/Host/windows/PipeWindows.h index e9468ffc415..86dec5a79d8 100644 --- a/lldb/include/lldb/Host/windows/PipeWindows.h +++ b/lldb/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/lldb/include/lldb/Host/windows/ProcessLauncherWindows.h b/lldb/include/lldb/Host/windows/ProcessLauncherWindows.h index 9f9e3970937..1df377d5eb8 100644 --- a/lldb/include/lldb/Host/windows/ProcessLauncherWindows.h +++ b/lldb/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/lldb/include/lldb/Interpreter/Args.h b/lldb/include/lldb/Interpreter/Args.h index bdbf81e02d9..98046cd5954 100644 --- a/lldb/include/lldb/Interpreter/Args.h +++ b/lldb/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/lldb/include/lldb/Interpreter/CommandInterpreter.h b/lldb/include/lldb/Interpreter/CommandInterpreter.h index 031ea10d6ad..f47411079a3 100644 --- a/lldb/include/lldb/Interpreter/CommandInterpreter.h +++ b/lldb/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/lldb/include/lldb/Interpreter/CommandReturnObject.h b/lldb/include/lldb/Interpreter/CommandReturnObject.h index 8e467e11847..7b04c391bc7 100644 --- a/lldb/include/lldb/Interpreter/CommandReturnObject.h +++ b/lldb/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/lldb/include/lldb/Interpreter/OptionGroupArchitecture.h b/lldb/include/lldb/Interpreter/OptionGroupArchitecture.h index 742cd6d1321..e73a53421f2 100644 --- a/lldb/include/lldb/Interpreter/OptionGroupArchitecture.h +++ b/lldb/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/lldb/include/lldb/Interpreter/OptionGroupBoolean.h b/lldb/include/lldb/Interpreter/OptionGroupBoolean.h index 931a6d73e72..53d08d79d67 100644 --- a/lldb/include/lldb/Interpreter/OptionGroupBoolean.h +++ b/lldb/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/lldb/include/lldb/Interpreter/OptionGroupFile.h b/lldb/include/lldb/Interpreter/OptionGroupFile.h index 93e3ed75d34..d0c25b8bf8e 100644 --- a/lldb/include/lldb/Interpreter/OptionGroupFile.h +++ b/lldb/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/lldb/include/lldb/Interpreter/OptionGroupFormat.h b/lldb/include/lldb/Interpreter/OptionGroupFormat.h index f3a42037afc..ddf2ccece3b 100644 --- a/lldb/include/lldb/Interpreter/OptionGroupFormat.h +++ b/lldb/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/lldb/include/lldb/Interpreter/OptionGroupOutputFile.h b/lldb/include/lldb/Interpreter/OptionGroupOutputFile.h index cb891f0f7ec..19453c6215e 100644 --- a/lldb/include/lldb/Interpreter/OptionGroupOutputFile.h +++ b/lldb/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/lldb/include/lldb/Interpreter/OptionGroupPlatform.h b/lldb/include/lldb/Interpreter/OptionGroupPlatform.h index 8cee9a67186..e7966240027 100644 --- a/lldb/include/lldb/Interpreter/OptionGroupPlatform.h +++ b/lldb/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/lldb/include/lldb/Interpreter/OptionGroupString.h b/lldb/include/lldb/Interpreter/OptionGroupString.h index 21bfc08d130..01e8aa9dc3b 100644 --- a/lldb/include/lldb/Interpreter/OptionGroupString.h +++ b/lldb/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/lldb/include/lldb/Interpreter/OptionGroupUInt64.h b/lldb/include/lldb/Interpreter/OptionGroupUInt64.h index 3f04eac7288..82eb0e26af9 100644 --- a/lldb/include/lldb/Interpreter/OptionGroupUInt64.h +++ b/lldb/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/lldb/include/lldb/Interpreter/OptionGroupUUID.h b/lldb/include/lldb/Interpreter/OptionGroupUUID.h index 9a7c6cf9cff..def97d5f255 100644 --- a/lldb/include/lldb/Interpreter/OptionGroupUUID.h +++ b/lldb/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/lldb/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h b/lldb/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h index 694464b8b91..0e075773b3f 100644 --- a/lldb/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h +++ b/lldb/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/lldb/include/lldb/Interpreter/OptionGroupVariable.h b/lldb/include/lldb/Interpreter/OptionGroupVariable.h index 0735de45d1a..c9e90320e14 100644 --- a/lldb/include/lldb/Interpreter/OptionGroupVariable.h +++ b/lldb/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/lldb/include/lldb/Interpreter/OptionGroupWatchpoint.h b/lldb/include/lldb/Interpreter/OptionGroupWatchpoint.h index c67c8f071b5..f2665638ba8 100644 --- a/lldb/include/lldb/Interpreter/OptionGroupWatchpoint.h +++ b/lldb/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/lldb/include/lldb/Interpreter/OptionValue.h b/lldb/include/lldb/Interpreter/OptionValue.h index 648ad33e2fc..6008e1ea441 100644 --- a/lldb/include/lldb/Interpreter/OptionValue.h +++ b/lldb/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/lldb/include/lldb/Interpreter/OptionValueArch.h b/lldb/include/lldb/Interpreter/OptionValueArch.h index aa548124e2d..e1a354d4ae2 100644 --- a/lldb/include/lldb/Interpreter/OptionValueArch.h +++ b/lldb/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/lldb/include/lldb/Interpreter/OptionValueArray.h b/lldb/include/lldb/Interpreter/OptionValueArray.h index 1e568cac402..bbf4e371a89 100644 --- a/lldb/include/lldb/Interpreter/OptionValueArray.h +++ b/lldb/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/lldb/include/lldb/Interpreter/OptionValueBoolean.h b/lldb/include/lldb/Interpreter/OptionValueBoolean.h index d429c0577ec..1ff84dd3367 100644 --- a/lldb/include/lldb/Interpreter/OptionValueBoolean.h +++ b/lldb/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/lldb/include/lldb/Interpreter/OptionValueChar.h b/lldb/include/lldb/Interpreter/OptionValueChar.h index d1864470057..0c5f602efe9 100644 --- a/lldb/include/lldb/Interpreter/OptionValueChar.h +++ b/lldb/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/lldb/include/lldb/Interpreter/OptionValueDictionary.h b/lldb/include/lldb/Interpreter/OptionValueDictionary.h index 5d015a55a8f..4e8c86008ea 100644 --- a/lldb/include/lldb/Interpreter/OptionValueDictionary.h +++ b/lldb/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/lldb/include/lldb/Interpreter/OptionValueEnumeration.h b/lldb/include/lldb/Interpreter/OptionValueEnumeration.h index d47248b72c6..4aa8823e620 100644 --- a/lldb/include/lldb/Interpreter/OptionValueEnumeration.h +++ b/lldb/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/lldb/include/lldb/Interpreter/OptionValueFileSpec.h b/lldb/include/lldb/Interpreter/OptionValueFileSpec.h index 654c04d4d27..b53c03471e2 100644 --- a/lldb/include/lldb/Interpreter/OptionValueFileSpec.h +++ b/lldb/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/lldb/include/lldb/Interpreter/OptionValueFileSpecList.h b/lldb/include/lldb/Interpreter/OptionValueFileSpecList.h index 1e42362c916..9529fbcf38b 100644 --- a/lldb/include/lldb/Interpreter/OptionValueFileSpecList.h +++ b/lldb/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/lldb/include/lldb/Interpreter/OptionValueFormat.h b/lldb/include/lldb/Interpreter/OptionValueFormat.h index 5351aeca062..ce7997024b0 100644 --- a/lldb/include/lldb/Interpreter/OptionValueFormat.h +++ b/lldb/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/lldb/include/lldb/Interpreter/OptionValueFormatEntity.h b/lldb/include/lldb/Interpreter/OptionValueFormatEntity.h index 472cd9ee4f9..e5a65b7e7eb 100644 --- a/lldb/include/lldb/Interpreter/OptionValueFormatEntity.h +++ b/lldb/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/lldb/include/lldb/Interpreter/OptionValueLanguage.h b/lldb/include/lldb/Interpreter/OptionValueLanguage.h index a388a6a92ea..8f81c5df073 100644 --- a/lldb/include/lldb/Interpreter/OptionValueLanguage.h +++ b/lldb/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/lldb/include/lldb/Interpreter/OptionValuePathMappings.h b/lldb/include/lldb/Interpreter/OptionValuePathMappings.h index d5336aafc99..0e2e98d74b7 100644 --- a/lldb/include/lldb/Interpreter/OptionValuePathMappings.h +++ b/lldb/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/lldb/include/lldb/Interpreter/OptionValueProperties.h b/lldb/include/lldb/Interpreter/OptionValueProperties.h index 0b49e0b0067..16d31aa4ea9 100644 --- a/lldb/include/lldb/Interpreter/OptionValueProperties.h +++ b/lldb/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/lldb/include/lldb/Interpreter/OptionValueRegex.h b/lldb/include/lldb/Interpreter/OptionValueRegex.h index 7bb8d419bde..afe9318ae01 100644 --- a/lldb/include/lldb/Interpreter/OptionValueRegex.h +++ b/lldb/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/lldb/include/lldb/Interpreter/OptionValueSInt64.h b/lldb/include/lldb/Interpreter/OptionValueSInt64.h index 1e164786687..a6893d23e69 100644 --- a/lldb/include/lldb/Interpreter/OptionValueSInt64.h +++ b/lldb/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/lldb/include/lldb/Interpreter/OptionValueString.h b/lldb/include/lldb/Interpreter/OptionValueString.h index 18b8215fe3c..4a9f2227680 100644 --- a/lldb/include/lldb/Interpreter/OptionValueString.h +++ b/lldb/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/lldb/include/lldb/Interpreter/OptionValueUInt64.h b/lldb/include/lldb/Interpreter/OptionValueUInt64.h index cbf932b1bda..be13ff07372 100644 --- a/lldb/include/lldb/Interpreter/OptionValueUInt64.h +++ b/lldb/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/lldb/include/lldb/Interpreter/OptionValueUUID.h b/lldb/include/lldb/Interpreter/OptionValueUUID.h index 62c25859580..6e0aeebb0e9 100644 --- a/lldb/include/lldb/Interpreter/OptionValueUUID.h +++ b/lldb/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/lldb/include/lldb/Interpreter/Options.h b/lldb/include/lldb/Interpreter/Options.h index fc5ff972da4..87121005575 100644 --- a/lldb/include/lldb/Interpreter/Options.h +++ b/lldb/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/lldb/include/lldb/Interpreter/ScriptInterpreter.h b/lldb/include/lldb/Interpreter/ScriptInterpreter.h index 271a5bba761..01b342ae41c 100644 --- a/lldb/include/lldb/Interpreter/ScriptInterpreter.h +++ b/lldb/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/lldb/include/lldb/Symbol/ObjectFile.h b/lldb/include/lldb/Symbol/ObjectFile.h index 296c9ff2129..a4c7b01ece1 100644 --- a/lldb/include/lldb/Symbol/ObjectFile.h +++ b/lldb/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/lldb/include/lldb/Symbol/SymbolContext.h b/lldb/include/lldb/Symbol/SymbolContext.h index 2ca3fdb7128..e4dcc73bb52 100644 --- a/lldb/include/lldb/Symbol/SymbolContext.h +++ b/lldb/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/lldb/include/lldb/Symbol/Variable.h b/lldb/include/lldb/Symbol/Variable.h index f076a04434e..507b4130904 100644 --- a/lldb/include/lldb/Symbol/Variable.h +++ b/lldb/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/lldb/include/lldb/Target/ABI.h b/lldb/include/lldb/Target/ABI.h index 4b611d244e2..a8e08e1a800 100644 --- a/lldb/include/lldb/Target/ABI.h +++ b/lldb/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/lldb/include/lldb/Target/DynamicLoader.h b/lldb/include/lldb/Target/DynamicLoader.h index ced6ef44000..b5890662d4e 100644 --- a/lldb/include/lldb/Target/DynamicLoader.h +++ b/lldb/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/lldb/include/lldb/Target/Language.h b/lldb/include/lldb/Target/Language.h index bcf840f93ed..f81679f7812 100644 --- a/lldb/include/lldb/Target/Language.h +++ b/lldb/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/lldb/include/lldb/Target/LanguageRuntime.h b/lldb/include/lldb/Target/LanguageRuntime.h index a57216e8479..98db941669c 100644 --- a/lldb/include/lldb/Target/LanguageRuntime.h +++ b/lldb/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/lldb/include/lldb/Target/Memory.h b/lldb/include/lldb/Target/Memory.h index f0a4bc5881f..af6be15df9f 100644 --- a/lldb/include/lldb/Target/Memory.h +++ b/lldb/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/lldb/include/lldb/Target/ModuleCache.h b/lldb/include/lldb/Target/ModuleCache.h index 49a7c97c60c..4959ee8ea0a 100644 --- a/lldb/include/lldb/Target/ModuleCache.h +++ b/lldb/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/lldb/include/lldb/Target/ObjCLanguageRuntime.h b/lldb/include/lldb/Target/ObjCLanguageRuntime.h index 0a9ffa933bd..97a2a731581 100644 --- a/lldb/include/lldb/Target/ObjCLanguageRuntime.h +++ b/lldb/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/lldb/include/lldb/Target/PathMappingList.h b/lldb/include/lldb/Target/PathMappingList.h index 2b844882e4a..b1b551f2d24 100644 --- a/lldb/include/lldb/Target/PathMappingList.h +++ b/lldb/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/lldb/include/lldb/Target/Platform.h b/lldb/include/lldb/Target/Platform.h index fb05d3e06dd..cc007d959c6 100644 --- a/lldb/include/lldb/Target/Platform.h +++ b/lldb/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/lldb/include/lldb/Target/Process.h b/lldb/include/lldb/Target/Process.h index 9a749efa7ae..d2ab85d1652 100644 --- a/lldb/include/lldb/Target/Process.h +++ b/lldb/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/lldb/include/lldb/Target/ProcessLaunchInfo.h b/lldb/include/lldb/Target/ProcessLaunchInfo.h index 083e0bbed8b..93a1a9ebd23 100644 --- a/lldb/include/lldb/Target/ProcessLaunchInfo.h +++ b/lldb/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/lldb/include/lldb/Target/ProcessStructReader.h b/lldb/include/lldb/Target/ProcessStructReader.h index acc5c1f3268..cfc8fe11a39 100644 --- a/lldb/include/lldb/Target/ProcessStructReader.h +++ b/lldb/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/lldb/include/lldb/Target/RegisterContext.h b/lldb/include/lldb/Target/RegisterContext.h index 485645b2dc1..c438a0cd12c 100644 --- a/lldb/include/lldb/Target/RegisterContext.h +++ b/lldb/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/lldb/include/lldb/Target/StackFrame.h b/lldb/include/lldb/Target/StackFrame.h index 1f25575e236..cb503875a5c 100644 --- a/lldb/include/lldb/Target/StackFrame.h +++ b/lldb/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/lldb/include/lldb/Target/StructuredDataPlugin.h b/lldb/include/lldb/Target/StructuredDataPlugin.h index aa4452a9c3f..a4d2c038262 100644 --- a/lldb/include/lldb/Target/StructuredDataPlugin.h +++ b/lldb/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/lldb/include/lldb/Target/Target.h b/lldb/include/lldb/Target/Target.h index 8aa263f5925..ff945193990 100644 --- a/lldb/include/lldb/Target/Target.h +++ b/lldb/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/lldb/include/lldb/Target/TargetList.h b/lldb/include/lldb/Target/TargetList.h index 81b81dba775..43f4520369b 100644 --- a/lldb/include/lldb/Target/TargetList.h +++ b/lldb/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/lldb/include/lldb/Target/Thread.h b/lldb/include/lldb/Target/Thread.h index 47d0b7d767d..cfab1306927 100644 --- a/lldb/include/lldb/Target/Thread.h +++ b/lldb/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/lldb/include/lldb/Target/ThreadSpec.h b/lldb/include/lldb/Target/ThreadSpec.h index 204f1f9fbd7..0306d2126b6 100644 --- a/lldb/include/lldb/Target/ThreadSpec.h +++ b/lldb/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(); diff --git a/lldb/include/lldb/Utility/JSON.h b/lldb/include/lldb/Utility/JSON.h index 5c5d382048c..bf8ed9afc00 100644 --- a/lldb/include/lldb/Utility/JSON.h +++ b/lldb/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/lldb/include/lldb/Utility/RegularExpression.h b/lldb/include/lldb/Utility/RegularExpression.h index d97e3564758..dba7001ce0f 100644 --- a/lldb/include/lldb/Utility/RegularExpression.h +++ b/lldb/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/lldb/include/lldb/Utility/SelectHelper.h b/lldb/include/lldb/Utility/SelectHelper.h index 5fa856b15d9..12950d032fb 100644 --- a/lldb/include/lldb/Utility/SelectHelper.h +++ b/lldb/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/lldb/include/lldb/Utility/Error.h b/lldb/include/lldb/Utility/Status.h index a236ab45a0b..4ac191b1f61 100644 --- a/lldb/include/lldb/Utility/Error.h +++ b/lldb/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/lldb/include/lldb/lldb-forward.h b/lldb/include/lldb/lldb-forward.h index 2180b31527e..392dc641558 100644 --- a/lldb/include/lldb/lldb-forward.h +++ b/lldb/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/lldb/include/lldb/lldb-private-enumerations.h b/lldb/include/lldb/lldb-private-enumerations.h index 9572bee8117..33226566523 100644 --- a/lldb/include/lldb/lldb-private-enumerations.h +++ b/lldb/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/lldb/include/lldb/lldb-private-interfaces.h b/lldb/include/lldb/lldb-private-interfaces.h index d3e80075625..9f25eb1f9a2 100644 --- a/lldb/include/lldb/lldb-private-interfaces.h +++ b/lldb/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/lldb/include/lldb/lldb-private-types.h b/lldb/include/lldb/lldb-private-types.h index 4f192b66369..fd21641218f 100644 --- a/lldb/include/lldb/lldb-private-types.h +++ b/lldb/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/source/API/SBBreakpoint.cpp b/lldb/source/API/SBBreakpoint.cpp index 0b661a646f3..bf9603248d7 100644 --- a/lldb/source/API/SBBreakpoint.cpp +++ b/lldb/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/lldb/source/API/SBBreakpointLocation.cpp b/lldb/source/API/SBBreakpointLocation.cpp index d8779ffe2ba..dc9c00d8dd5 100644 --- a/lldb/source/API/SBBreakpointLocation.cpp +++ b/lldb/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/lldb/source/API/SBCommandReturnObject.cpp b/lldb/source/API/SBCommandReturnObject.cpp index 7eed94e05b1..5a8909b98e5 100644 --- a/lldb/source/API/SBCommandReturnObject.cpp +++ b/lldb/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/lldb/source/API/SBDebugger.cpp b/lldb/source/API/SBDebugger.cpp index 8d23d3eb850..3cdb6bbfd5f 100644 --- a/lldb/source/API/SBDebugger.cpp +++ b/lldb/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/lldb/source/API/SBError.cpp b/lldb/source/API/SBError.cpp index a692a9678cd..b2811d0ac38 100644 --- a/lldb/source/API/SBError.cpp +++ b/lldb/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/lldb/source/API/SBFrame.cpp b/lldb/source/API/SBFrame.cpp index d52bbe8069f..684a707dda9 100644 --- a/lldb/source/API/SBFrame.cpp +++ b/lldb/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/lldb/source/API/SBHostOS.cpp b/lldb/source/API/SBHostOS.cpp index c25499db89c..90b75a6ecd7 100644 --- a/lldb/source/API/SBHostOS.cpp +++ b/lldb/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/lldb/source/API/SBModule.cpp b/lldb/source/API/SBModule.cpp index 3865ba92797..17f3dcc5656 100644 --- a/lldb/source/API/SBModule.cpp +++ b/lldb/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/lldb/source/API/SBPlatform.cpp b/lldb/source/API/SBPlatform.cpp index 0f1b99236a7..87cbc4537a3 100644 --- a/lldb/source/API/SBPlatform.cpp +++ b/lldb/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/lldb/source/API/SBProcess.cpp b/lldb/source/API/SBProcess.cpp index 0348113a987..8b79e521a37 100644 --- a/lldb/source/API/SBProcess.cpp +++ b/lldb/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/lldb/source/API/SBStream.cpp b/lldb/source/API/SBStream.cpp index 5ae5a01589d..159ec07e4e0 100644 --- a/lldb/source/API/SBStream.cpp +++ b/lldb/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/lldb/source/API/SBStructuredData.cpp b/lldb/source/API/SBStructuredData.cpp index 2fca56f2f22..971c4ab2295 100644 --- a/lldb/source/API/SBStructuredData.cpp +++ b/lldb/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/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp index 4032383eb56..0ab7375ccc3 100644 --- a/lldb/source/API/SBTarget.cpp +++ b/lldb/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/lldb/source/API/SBThread.cpp b/lldb/source/API/SBThread.cpp index 3961a7f925a..be84c064c40 100644 --- a/lldb/source/API/SBThread.cpp +++ b/lldb/source/API/SBThread.cpp @@ -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/lldb/source/API/SBValue.cpp b/lldb/source/API/SBValue.cpp index ea0f9f591ab..b6f044c61a7 100644 --- a/lldb/source/API/SBValue.cpp +++ b/lldb/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/lldb/source/Breakpoint/Breakpoint.cpp b/lldb/source/Breakpoint/Breakpoint.cpp index 2b44691186c..c839c1eb344 100644 --- a/lldb/source/Breakpoint/Breakpoint.cpp +++ b/lldb/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); @@ -208,7 +208,7 @@ lldb::BreakpointSP Breakpoint::CreateFromStructuredData( size_t num_names = names_array->GetSize(); for (size_t i = 0; i < num_names; i++) { std::string name; - Error error; + Status error; success = names_array->GetItemAtIndexAsString(i, name); result_sp->AddName(name.c_str(), error); } @@ -833,7 +833,7 @@ size_t Breakpoint::GetNumResolvedLocations() const { size_t Breakpoint::GetNumLocations() const { return m_locations.GetSize(); } -bool Breakpoint::AddName(const char *new_name, Error &error) { +bool Breakpoint::AddName(const char *new_name, Status &error) { if (!new_name) return false; if (!BreakpointID::StringIsBreakpointName(llvm::StringRef(new_name), error)) { @@ -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/lldb/source/Breakpoint/BreakpointID.cpp b/lldb/source/Breakpoint/BreakpointID.cpp index 07742d9d7cf..112f7c0b519 100644 --- a/lldb/source/Breakpoint/BreakpointID.cpp +++ b/lldb/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/lldb/source/Breakpoint/BreakpointIDList.cpp b/lldb/source/Breakpoint/BreakpointIDList.cpp index 037b03e1e46..7b461147a4e 100644 --- a/lldb/source/Breakpoint/BreakpointIDList.cpp +++ b/lldb/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/lldb/source/Breakpoint/BreakpointList.cpp b/lldb/source/Breakpoint/BreakpointList.cpp index 7f35588ea87..15bcb34a3d8 100644 --- a/lldb/source/Breakpoint/BreakpointList.cpp +++ b/lldb/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/lldb/source/Breakpoint/BreakpointLocation.cpp b/lldb/source/Breakpoint/BreakpointLocation.cpp index 52bdefc4077..ec8f141e8d3 100644 --- a/lldb/source/Breakpoint/BreakpointLocation.cpp +++ b/lldb/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/lldb/source/Breakpoint/BreakpointOptions.cpp b/lldb/source/Breakpoint/BreakpointOptions.cpp index 9851990a838..9b9c9c2aec7 100644 --- a/lldb/source/Breakpoint/BreakpointOptions.cpp +++ b/lldb/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; @@ -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/lldb/source/Breakpoint/BreakpointResolver.cpp b/lldb/source/Breakpoint/BreakpointResolver.cpp index f2579a0877e..a6a3689e866 100644 --- a/lldb/source/Breakpoint/BreakpointResolver.cpp +++ b/lldb/source/Breakpoint/BreakpointResolver.cpp @@ -72,7 +72,7 @@ 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."); diff --git a/lldb/source/Breakpoint/BreakpointResolverAddress.cpp b/lldb/source/Breakpoint/BreakpointResolverAddress.cpp index 4674ef08eae..32e503cfb4d 100644 --- a/lldb/source/Breakpoint/BreakpointResolverAddress.cpp +++ b/lldb/source/Breakpoint/BreakpointResolverAddress.cpp @@ -44,7 +44,7 @@ BreakpointResolverAddress::~BreakpointResolverAddress() {} BreakpointResolver *BreakpointResolverAddress::CreateFromStructuredData( Breakpoint *bkpt, const StructuredData::Dictionary &options_dict, - Error &error) { + Status &error) { std::string module_name; lldb::addr_t addr_offset; FileSpec module_filespec; diff --git a/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp b/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp index 610c8c956cf..f618c1a3b56 100644 --- a/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp +++ b/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp @@ -38,7 +38,7 @@ BreakpointResolverFileLine::~BreakpointResolverFileLine() {} BreakpointResolver *BreakpointResolverFileLine::CreateFromStructuredData( Breakpoint *bkpt, const StructuredData::Dictionary &options_dict, - Error &error) { + Status &error) { std::string filename; uint32_t line_no; bool check_inlines; diff --git a/lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp b/lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp index df6f5c2e4bf..8fe908d7d25 100644 --- a/lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp +++ b/lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp @@ -37,7 +37,7 @@ BreakpointResolverFileRegex::~BreakpointResolverFileRegex() {} BreakpointResolver *BreakpointResolverFileRegex::CreateFromStructuredData( Breakpoint *bkpt, const StructuredData::Dictionary &options_dict, - Error &error) { + Status &error) { bool success; std::string regex_string; diff --git a/lldb/source/Breakpoint/BreakpointResolverName.cpp b/lldb/source/Breakpoint/BreakpointResolverName.cpp index f8ce775096c..8da05b0f85f 100644 --- a/lldb/source/Breakpoint/BreakpointResolverName.cpp +++ b/lldb/source/Breakpoint/BreakpointResolverName.cpp @@ -92,7 +92,7 @@ BreakpointResolverName::BreakpointResolverName( BreakpointResolver *BreakpointResolverName::CreateFromStructuredData( Breakpoint *bkpt, const StructuredData::Dictionary &options_dict, - Error &error) { + Status &error) { LanguageType language = eLanguageTypeUnknown; std::string language_name; bool success = options_dict.GetValueForKeyAsString( diff --git a/lldb/source/Breakpoint/Watchpoint.cpp b/lldb/source/Breakpoint/Watchpoint.cpp index 3dbd6d23821..a141a6b5c2f 100644 --- a/lldb/source/Breakpoint/Watchpoint.cpp +++ b/lldb/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/lldb/source/Commands/CommandObjectArgs.cpp b/lldb/source/Commands/CommandObjectArgs.cpp index 8042aa9d81d..92c2107dc33 100644 --- a/lldb/source/Commands/CommandObjectArgs.cpp +++ b/lldb/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/lldb/source/Commands/CommandObjectArgs.h b/lldb/source/Commands/CommandObjectArgs.h index a4b3f9fed0e..aa7d2411adc 100644 --- a/lldb/source/Commands/CommandObjectArgs.h +++ b/lldb/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/lldb/source/Commands/CommandObjectBreakpoint.cpp b/lldb/source/Commands/CommandObjectBreakpoint.cpp index d77cf55b60e..266864d1a1f 100644 --- a/lldb/source/Commands/CommandObjectBreakpoint.cpp +++ b/lldb/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/lldb/source/Commands/CommandObjectBreakpointCommand.cpp b/lldb/source/Commands/CommandObjectBreakpointCommand.cpp index 73c0c314533..de491195310 100644 --- a/lldb/source/Commands/CommandObjectBreakpointCommand.cpp +++ b/lldb/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/lldb/source/Commands/CommandObjectBugreport.cpp b/lldb/source/Commands/CommandObjectBugreport.cpp index 04050e3a669..7ba8ab945ea 100644 --- a/lldb/source/Commands/CommandObjectBugreport.cpp +++ b/lldb/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/lldb/source/Commands/CommandObjectCommands.cpp b/lldb/source/Commands/CommandObjectCommands.cpp index e39c0330b65..c9d71a65754 100644 --- a/lldb/source/Commands/CommandObjectCommands.cpp +++ b/lldb/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/lldb/source/Commands/CommandObjectDisassemble.cpp b/lldb/source/Commands/CommandObjectDisassemble.cpp index 4496462476b..5d0f2417f99 100644 --- a/lldb/source/Commands/CommandObjectDisassemble.cpp +++ b/lldb/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/lldb/source/Commands/CommandObjectDisassemble.h b/lldb/source/Commands/CommandObjectDisassemble.h index db89aa24d6a..8ca390056dd 100644 --- a/lldb/source/Commands/CommandObjectDisassemble.h +++ b/lldb/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/lldb/source/Commands/CommandObjectExpression.cpp b/lldb/source/Commands/CommandObjectExpression.cpp index 8a0afce741e..b6e0016c88e 100644 --- a/lldb/source/Commands/CommandObjectExpression.cpp +++ b/lldb/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/lldb/source/Commands/CommandObjectExpression.h b/lldb/source/Commands/CommandObjectExpression.h index 7c21adcc26f..0cf2a7263d5 100644 --- a/lldb/source/Commands/CommandObjectExpression.h +++ b/lldb/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/lldb/source/Commands/CommandObjectFrame.cpp b/lldb/source/Commands/CommandObjectFrame.cpp index 7e81f5f9414..8b981a93ad7 100644 --- a/lldb/source/Commands/CommandObjectFrame.cpp +++ b/lldb/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/lldb/source/Commands/CommandObjectHelp.h b/lldb/source/Commands/CommandObjectHelp.h index cd9006619bc..f1f87f8e63c 100644 --- a/lldb/source/Commands/CommandObjectHelp.h +++ b/lldb/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/lldb/source/Commands/CommandObjectLog.cpp b/lldb/source/Commands/CommandObjectLog.cpp index 2099310d32c..e545d567972 100644 --- a/lldb/source/Commands/CommandObjectLog.cpp +++ b/lldb/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/lldb/source/Commands/CommandObjectMemory.cpp b/lldb/source/Commands/CommandObjectMemory.cpp index 1679614fe3f..8f4c186a8d6 100644 --- a/lldb/source/Commands/CommandObjectMemory.cpp +++ b/lldb/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/lldb/source/Commands/CommandObjectPlatform.cpp b/lldb/source/Commands/CommandObjectPlatform.cpp index 62ea683e6e0..5fa851f584a 100644 --- a/lldb/source/Commands/CommandObjectPlatform.cpp +++ b/lldb/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/lldb/source/Commands/CommandObjectPlugin.cpp b/lldb/source/Commands/CommandObjectPlugin.cpp index 7ae968b95fc..7e1b7f61f76 100644 --- a/lldb/source/Commands/CommandObjectPlugin.cpp +++ b/lldb/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/lldb/source/Commands/CommandObjectProcess.cpp b/lldb/source/Commands/CommandObjectProcess.cpp index 557bdeecc22..9fbdd763054 100644 --- a/lldb/source/Commands/CommandObjectProcess.cpp +++ b/lldb/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/lldb/source/Commands/CommandObjectRegister.cpp b/lldb/source/Commands/CommandObjectRegister.cpp index 4d856d6bd1e..6de8c667e7a 100644 --- a/lldb/source/Commands/CommandObjectRegister.cpp +++ b/lldb/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/lldb/source/Commands/CommandObjectSettings.cpp b/lldb/source/Commands/CommandObjectSettings.cpp index 4a9f69f9c19..d42466cd13b 100644 --- a/lldb/source/Commands/CommandObjectSettings.cpp +++ b/lldb/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/lldb/source/Commands/CommandObjectSource.cpp b/lldb/source/Commands/CommandObjectSource.cpp index 1b9ee1bf8c7..f3c92b9a28c 100644 --- a/lldb/source/Commands/CommandObjectSource.cpp +++ b/lldb/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/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index a2df4909dc0..56da1da34cb 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -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/lldb/source/Commands/CommandObjectThread.cpp b/lldb/source/Commands/CommandObjectThread.cpp index 7ba6f2c19a8..6b0f1b455bc 100644 --- a/lldb/source/Commands/CommandObjectThread.cpp +++ b/lldb/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/lldb/source/Commands/CommandObjectType.cpp b/lldb/source/Commands/CommandObjectType.cpp index b34a42738d4..2d4271cab36 100644 --- a/lldb/source/Commands/CommandObjectType.cpp +++ b/lldb/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/lldb/source/Commands/CommandObjectWatchpoint.cpp b/lldb/source/Commands/CommandObjectWatchpoint.cpp index 1ad53cdb88a..9c84c992e71 100644 --- a/lldb/source/Commands/CommandObjectWatchpoint.cpp +++ b/lldb/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/lldb/source/Commands/CommandObjectWatchpointCommand.cpp b/lldb/source/Commands/CommandObjectWatchpointCommand.cpp index 1509c487a8a..ec7e4a1f9cd 100644 --- a/lldb/source/Commands/CommandObjectWatchpointCommand.cpp +++ b/lldb/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/lldb/source/Core/Address.cpp b/lldb/source/Core/Address.cpp index 91229a9b18e..6328e433852 100644 --- a/lldb/source/Core/Address.cpp +++ b/lldb/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; addr_t dereferenced_load_addr = process->ReadPointerFromMemory(load_addr, memory_error); if (dereferenced_load_addr != LLDB_INVALID_ADDRESS) { diff --git a/lldb/source/Core/ArchSpec.cpp b/lldb/source/Core/ArchSpec.cpp index 7c1b399177f..91b73847ac1 100644 --- a/lldb/source/Core/ArchSpec.cpp +++ b/lldb/source/Core/ArchSpec.cpp @@ -1555,7 +1555,7 @@ static void StopInfoOverrideCallbackTypeARM(lldb_private::Thread &thread) { #if 0 // ARM mode: check for condition on intsruction const addr_t pc = reg_ctx_sp->GetPC(); - Error error; + Status error; // If we fail to read the opcode we will get UINT64_MAX as the // result in "opcode" which we can use to detect if we read a // valid opcode. @@ -1635,7 +1635,7 @@ void ArchSpec::PiecewiseTripleCompare( } bool ArchSpec::IsAlwaysThumbInstructions() const { - std::string Error; + std::string Status; if (GetTriple().getArch() == llvm::Triple::arm || GetTriple().getArch() == llvm::Triple::thumb) { // v. https://en.wikipedia.org/wiki/ARM_Cortex-M diff --git a/lldb/source/Core/Communication.cpp b/lldb/source/Core/Communication.cpp index a543858582e..72873a9510b 100644 --- a/lldb/source/Core/Communication.cpp +++ b/lldb/source/Core/Communication.cpp @@ -15,9 +15,9 @@ #include "lldb/Host/HostThread.h" #include "lldb/Host/ThreadLauncher.h" #include "lldb/Utility/ConstString.h" // for ConstString -#include "lldb/Utility/Error.h" // for Error #include "lldb/Utility/Log.h" #include "lldb/Utility/Logging.h" // for LogIfAnyCategoriesSet, LIBLLDB... +#include "lldb/Utility/Status.h" // for Status #include "llvm/ADT/None.h" // for None #include "llvm/ADT/Optional.h" // for Optional @@ -75,7 +75,7 @@ void Communication::Clear() { StopReadThread(nullptr); } -ConnectionStatus Communication::Connect(const char *url, Error *error_ptr) { +ConnectionStatus Communication::Connect(const char *url, Status *error_ptr) { Clear(); lldb_private::LogIfAnyCategoriesSet(LIBLLDB_LOG_COMMUNICATION, @@ -90,7 +90,7 @@ ConnectionStatus Communication::Connect(const char *url, Error *error_ptr) { return eConnectionStatusNoConnection; } -ConnectionStatus Communication::Disconnect(Error *error_ptr) { +ConnectionStatus Communication::Disconnect(Status *error_ptr) { lldb_private::LogIfAnyCategoriesSet(LIBLLDB_LOG_COMMUNICATION, "%p Communication::Disconnect ()", this); @@ -123,7 +123,7 @@ bool Communication::HasConnection() const { size_t Communication::Read(void *dst, size_t dst_len, const Timeout<std::micro> &timeout, - ConnectionStatus &status, Error *error_ptr) { + ConnectionStatus &status, Status *error_ptr) { Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_COMMUNICATION); LLDB_LOG( log, @@ -170,7 +170,7 @@ size_t Communication::Read(void *dst, size_t dst_len, } size_t Communication::Write(const void *src, size_t src_len, - ConnectionStatus &status, Error *error_ptr) { + ConnectionStatus &status, Status *error_ptr) { lldb::ConnectionSP connection_sp(m_connection_sp); std::lock_guard<std::mutex> guard(m_write_mutex); @@ -189,7 +189,7 @@ size_t Communication::Write(const void *src, size_t src_len, return 0; } -bool Communication::StartReadThread(Error *error_ptr) { +bool Communication::StartReadThread(Status *error_ptr) { if (error_ptr) error_ptr->Clear(); @@ -212,7 +212,7 @@ bool Communication::StartReadThread(Error *error_ptr) { return m_read_thread_enabled; } -bool Communication::StopReadThread(Error *error_ptr) { +bool Communication::StopReadThread(Status *error_ptr) { if (!m_read_thread.IsJoinable()) return true; @@ -225,15 +225,15 @@ bool Communication::StopReadThread(Error *error_ptr) { // error = m_read_thread.Cancel(); - Error error = m_read_thread.Join(nullptr); + Status error = m_read_thread.Join(nullptr); return error.Success(); } -bool Communication::JoinReadThread(Error *error_ptr) { +bool Communication::JoinReadThread(Status *error_ptr) { if (!m_read_thread.IsJoinable()) return true; - Error error = m_read_thread.Join(nullptr); + Status error = m_read_thread.Join(nullptr); return error.Success(); } @@ -280,7 +280,7 @@ void Communication::AppendBytesToCache(const uint8_t *bytes, size_t len, size_t Communication::ReadFromConnection(void *dst, size_t dst_len, const Timeout<std::micro> &timeout, ConnectionStatus &status, - Error *error_ptr) { + Status *error_ptr) { lldb::ConnectionSP connection_sp(m_connection_sp); if (connection_sp) return connection_sp->Read(dst, dst_len, timeout, status, error_ptr); @@ -303,7 +303,7 @@ lldb::thread_result_t Communication::ReadThread(lldb::thread_arg_t p) { uint8_t buf[1024]; - Error error; + Status error; ConnectionStatus status = eConnectionStatusSuccess; bool done = false; while (!done && comm->m_read_thread_enabled) { diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp index 751ceed1314..75fcedb1015 100644 --- a/lldb/source/Core/Debugger.cpp +++ b/lldb/source/Core/Debugger.cpp @@ -287,9 +287,10 @@ enum { LoadPluginCallbackType Debugger::g_load_plugin_callback = nullptr; -Error Debugger::SetPropertyValue(const ExecutionContext *exe_ctx, - VarSetOperationType op, - llvm::StringRef property_path, llvm::StringRef value) { +Status Debugger::SetPropertyValue(const ExecutionContext *exe_ctx, + VarSetOperationType op, + llvm::StringRef property_path, + llvm::StringRef value) { bool is_load_script = (property_path == "target.load-script-from-symbol-file"); bool is_escape_non_printables = (property_path == "escape-non-printables"); TargetSP target_sp; @@ -299,7 +300,7 @@ Error Debugger::SetPropertyValue(const ExecutionContext *exe_ctx, load_script_old_value = target_sp->TargetProperties::GetLoadScriptFromSymbolFile(); } - Error error(Properties::SetPropertyValue(exe_ctx, op, property_path, value)); + Status error(Properties::SetPropertyValue(exe_ctx, op, property_path, value)); if (error.Success()) { // FIXME it would be nice to have "on-change" callbacks for properties if (property_path == g_properties[ePropertyPrompt].name) { @@ -321,7 +322,7 @@ Error Debugger::SetPropertyValue(const ExecutionContext *exe_ctx, load_script_old_value == eLoadScriptFromSymFileWarn) { if (target_sp->TargetProperties::GetLoadScriptFromSymbolFile() == eLoadScriptFromSymFileTrue) { - std::list<Error> errors; + std::list<Status> errors; StreamString feedback_stream; if (!target_sp->LoadScriptingResources(errors, &feedback_stream)) { StreamFileSP stream_sp(GetErrorFile()); @@ -550,7 +551,7 @@ void Debugger::SettingsInitialize() { Target::SettingsInitialize(); } void Debugger::SettingsTerminate() { Target::SettingsTerminate(); } -bool Debugger::LoadPlugin(const FileSpec &spec, Error &error) { +bool Debugger::LoadPlugin(const FileSpec &spec, Status &error) { if (g_load_plugin_callback) { llvm::sys::DynamicLibrary dynlib = g_load_plugin_callback(shared_from_this(), spec, error); @@ -570,7 +571,7 @@ bool Debugger::LoadPlugin(const FileSpec &spec, Error &error) { static FileSpec::EnumerateDirectoryResult LoadPluginCallback(void *baton, llvm::sys::fs::file_type ft, const FileSpec &file_spec) { - Error error; + Status error; static ConstString g_dylibext("dylib"); static ConstString g_solibext("so"); @@ -595,7 +596,7 @@ LoadPluginCallback(void *baton, llvm::sys::fs::file_type ft, return FileSpec::eEnumerateDirectoryResultNext; } - Error plugin_load_error; + Status plugin_load_error; debugger->LoadPlugin(plugin_file_spec, plugin_load_error); return FileSpec::eEnumerateDirectoryResultNext; @@ -1365,7 +1366,7 @@ size_t Debugger::GetProcessSTDOUT(Process *process, Stream *stream) { process = target_sp->GetProcessSP().get(); } if (process) { - Error error; + Status error; size_t len; char stdio_buffer[1024]; while ((len = process->GetSTDOUT(stdio_buffer, sizeof(stdio_buffer), @@ -1393,7 +1394,7 @@ size_t Debugger::GetProcessSTDERR(Process *process, Stream *stream) { process = target_sp->GetProcessSP().get(); } if (process) { - Error error; + Status error; size_t len; char stdio_buffer[1024]; while ((len = process->GetSTDERR(stdio_buffer, sizeof(stdio_buffer), @@ -1463,7 +1464,7 @@ void Debugger::HandleProcessEvent(const EventSP &event_sp) { EventDataStructuredData::GetObjectFromEvent(event_sp.get()); if (output_stream_sp) { StreamString content_stream; - Error error = + Status error = plugin_sp->GetDescription(structured_data_sp, content_stream); if (error.Success()) { if (!content_stream.GetString().empty()) { @@ -1702,8 +1703,8 @@ Target *Debugger::GetSelectedOrDummyTarget(bool prefer_dummy) { return GetDummyTarget(); } -Error Debugger::RunREPL(LanguageType language, const char *repl_options) { - Error err; +Status Debugger::RunREPL(LanguageType language, const char *repl_options) { + Status err; FileSpec repl_executable; if (language == eLanguageTypeUnknown) { diff --git a/lldb/source/Core/Disassembler.cpp b/lldb/source/Core/Disassembler.cpp index 51d93d9acdb..eb79022c43a 100644 --- a/lldb/source/Core/Disassembler.cpp +++ b/lldb/source/Core/Disassembler.cpp @@ -35,8 +35,8 @@ #include "lldb/Target/Thread.h" // for Thread #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/DataExtractor.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/RegularExpression.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/Stream.h" // for Stream #include "lldb/Utility/StreamString.h" // for StreamString #include "lldb/lldb-private-enumerations.h" // for InstructionType:... @@ -340,7 +340,7 @@ bool Disassembler::ElideMixedSourceAndDisassemblyLine( } else { TargetSP target_sp = exe_ctx.GetTargetSP(); if (target_sp) { - Error error; + Status error; OptionValueSP value_sp = target_sp->GetDebugger().GetPropertyValue( &exe_ctx, "target.process.thread.step-avoid-regexp", false, error); if (value_sp && value_sp->GetType() == OptionValue::eTypeRegex) { @@ -1118,7 +1118,7 @@ InstructionList::GetIndexOfNextBranchInstruction(uint32_t start, while (i > start) { --i; - Error error; + Status error; uint32_t inst_bytes; bool prefer_file_cache = false; // Read from process if process is running lldb::addr_t load_addr = LLDB_INVALID_ADDRESS; @@ -1179,7 +1179,7 @@ size_t Disassembler::ParseInstructions(const ExecutionContext *exe_ctx, auto data_sp = std::make_shared<DataBufferHeap>(byte_size, '\0'); - Error error; + Status error; lldb::addr_t load_addr = LLDB_INVALID_ADDRESS; const size_t bytes_read = target->ReadMemory( range.GetBaseAddress(), prefer_file_cache, data_sp->GetBytes(), @@ -1224,7 +1224,7 @@ size_t Disassembler::ParseInstructions(const ExecutionContext *exe_ctx, DataBufferHeap *heap_buffer = new DataBufferHeap(byte_size, '\0'); DataBufferSP data_sp(heap_buffer); - Error error; + Status error; lldb::addr_t load_addr = LLDB_INVALID_ADDRESS; const size_t bytes_read = target->ReadMemory(start, prefer_file_cache, heap_buffer->GetBytes(), diff --git a/lldb/source/Core/DynamicLoader.cpp b/lldb/source/Core/DynamicLoader.cpp index 03fad244acf..5477498dadc 100644 --- a/lldb/source/Core/DynamicLoader.cpp +++ b/lldb/source/Core/DynamicLoader.cpp @@ -181,7 +181,7 @@ ModuleSP DynamicLoader::LoadModuleAtAddress(const FileSpec &file, // address to read the file out of the memory instead of a load bias. bool is_loaded = false; lldb::addr_t load_addr; - Error error = m_process->GetFileLoadAddress(file, is_loaded, load_addr); + Status error = m_process->GetFileLoadAddress(file, is_loaded, load_addr); if (error.Success() && is_loaded) { check_alternative_file_name = false; base_addr = load_addr; @@ -193,7 +193,7 @@ ModuleSP DynamicLoader::LoadModuleAtAddress(const FileSpec &file, // different name based on the memory region info. if (check_alternative_file_name) { MemoryRegionInfo memory_info; - Error error = m_process->GetMemoryRegionInfo(base_addr, memory_info); + Status error = m_process->GetMemoryRegionInfo(base_addr, memory_info); if (error.Success() && memory_info.GetMapped() && memory_info.GetRange().GetRangeBase() == base_addr && !(memory_info.GetName().IsEmpty())) { @@ -223,7 +223,7 @@ ModuleSP DynamicLoader::LoadModuleAtAddress(const FileSpec &file, int64_t DynamicLoader::ReadUnsignedIntWithSizeInBytes(addr_t addr, int size_in_bytes) { - Error error; + Status error; uint64_t value = m_process->ReadUnsignedIntegerFromMemory(addr, size_in_bytes, 0, error); if (error.Fail()) @@ -233,7 +233,7 @@ int64_t DynamicLoader::ReadUnsignedIntWithSizeInBytes(addr_t addr, } addr_t DynamicLoader::ReadPointer(addr_t addr) { - Error error; + Status error; addr_t value = m_process->ReadPointerFromMemory(addr, error); if (error.Fail()) return LLDB_INVALID_ADDRESS; diff --git a/lldb/source/Core/EmulateInstruction.cpp b/lldb/source/Core/EmulateInstruction.cpp index f18a4af67ef..2ee2c79de27 100644 --- a/lldb/source/Core/EmulateInstruction.cpp +++ b/lldb/source/Core/EmulateInstruction.cpp @@ -19,7 +19,7 @@ #include "lldb/Target/StackFrame.h" // for StackFrame #include "lldb/Utility/ConstString.h" // for ConstString #include "lldb/Utility/DataExtractor.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/Stream.h" // for Stream, Stream::::eBinary #include "lldb/Utility/StreamString.h" #include "lldb/lldb-forward.h" // for ProcessSP @@ -263,7 +263,7 @@ size_t EmulateInstruction::ReadMemoryFrame(EmulateInstruction *instruction, ProcessSP process_sp(frame->CalculateProcess()); if (process_sp) { - Error error; + Status error; return process_sp->ReadMemory(addr, dst, dst_len, error); } return 0; @@ -280,7 +280,7 @@ size_t EmulateInstruction::WriteMemoryFrame(EmulateInstruction *instruction, ProcessSP process_sp(frame->CalculateProcess()); if (process_sp) { - Error error; + Status error; return process_sp->WriteMemory(addr, src, src_len, error); } diff --git a/lldb/source/Core/FormatEntity.cpp b/lldb/source/Core/FormatEntity.cpp index 835a1c54a0e..05f986978e5 100644 --- a/lldb/source/Core/FormatEntity.cpp +++ b/lldb/source/Core/FormatEntity.cpp @@ -303,7 +303,7 @@ void FormatEntity::Entry::AppendText(const char *cstr) { return AppendText(llvm::StringRef(cstr)); } -Error FormatEntity::Parse(const llvm::StringRef &format_str, Entry &entry) { +Status FormatEntity::Parse(const llvm::StringRef &format_str, Entry &entry) { entry.Clear(); entry.type = Entry::Type::Root; llvm::StringRef modifiable_format(format_str); @@ -408,7 +408,7 @@ static bool RunScriptFormatKeyword(Stream &s, const SymbolContext *sc, ScriptInterpreter *script_interpreter = target->GetDebugger().GetCommandInterpreter().GetScriptInterpreter(); if (script_interpreter) { - Error error; + Status error; std::string script_output; if (script_interpreter->RunScriptFormatKeyword(script_function_name, t, @@ -778,7 +778,7 @@ static bool DumpValue(Stream &s, const SymbolContext *sc, var_name_final_if_array_range, index_lower, index_higher); - Error error; + Status error; const std::string &expr_path = entry.string; @@ -824,7 +824,7 @@ static bool DumpValue(Stream &s, const SymbolContext *sc, // this happens when we are not going through // GetValueForVariableExpressionPath // to get to the target ValueObject - Error error; + Status error; target = target->Dereference(error).get(); if (error.Fail()) { if (log) @@ -1079,7 +1079,7 @@ bool FormatEntity::FormatStringRef(const llvm::StringRef &format_str, Stream &s, bool initial_function) { if (!format_str.empty()) { FormatEntity::Entry root; - Error error = FormatEntity::Parse(format_str, root); + Status error = FormatEntity::Parse(format_str, root); if (error.Success()) { return FormatEntity::Format(root, s, sc, exe_ctx, addr, valobj, function_changed, initial_function); @@ -1096,7 +1096,7 @@ bool FormatEntity::FormatCString(const char *format, Stream &s, if (format && format[0]) { FormatEntity::Entry root; llvm::StringRef format_str(format); - Error error = FormatEntity::Parse(format_str, root); + Status error = FormatEntity::Parse(format_str, root); if (error.Success()) { return FormatEntity::Format(root, s, sc, exe_ctx, addr, valobj, function_changed, initial_function); @@ -1866,10 +1866,10 @@ static bool DumpCommaSeparatedChildEntryNames( return false; } -static Error ParseEntry(const llvm::StringRef &format_str, - const FormatEntity::Entry::Definition *parent, - FormatEntity::Entry &entry) { - Error error; +static Status ParseEntry(const llvm::StringRef &format_str, + const FormatEntity::Entry::Definition *parent, + FormatEntity::Entry &entry) { + Status error; const size_t sep_pos = format_str.find_first_of(".[:"); const char sep_char = @@ -1956,7 +1956,7 @@ static const FormatEntity::Entry::Definition * FindEntry(const llvm::StringRef &format_str, const FormatEntity::Entry::Definition *parent, llvm::StringRef &remainder) { - Error error; + Status error; std::pair<llvm::StringRef, llvm::StringRef> p = format_str.split('.'); const size_t n = parent->num_children; @@ -1983,9 +1983,9 @@ FindEntry(const llvm::StringRef &format_str, return parent; } -Error FormatEntity::ParseInternal(llvm::StringRef &format, Entry &parent_entry, - uint32_t depth) { - Error error; +Status FormatEntity::ParseInternal(llvm::StringRef &format, Entry &parent_entry, + uint32_t depth) { + Status error; while (!format.empty() && error.Success()) { const size_t non_special_chars = format.find_first_of("${}\\"); @@ -2279,10 +2279,10 @@ Error FormatEntity::ParseInternal(llvm::StringRef &format, Entry &parent_entry, return error; } -Error FormatEntity::ExtractVariableInfo(llvm::StringRef &format_str, - llvm::StringRef &variable_name, - llvm::StringRef &variable_format) { - Error error; +Status FormatEntity::ExtractVariableInfo(llvm::StringRef &format_str, + llvm::StringRef &variable_name, + llvm::StringRef &variable_format) { + Status error; variable_name = llvm::StringRef(); variable_format = llvm::StringRef(); diff --git a/lldb/source/Core/IOHandler.cpp b/lldb/source/Core/IOHandler.cpp index b5dd0bd8a25..e5fe490991f 100644 --- a/lldb/source/Core/IOHandler.cpp +++ b/lldb/source/Core/IOHandler.cpp @@ -27,7 +27,7 @@ #include "lldb/Core/StreamFile.h" #include "lldb/Host/File.h" // for File #include "lldb/Host/Predicate.h" // for Predicate, ::eBroad... -#include "lldb/Utility/Error.h" // for Error +#include "lldb/Utility/Status.h" // for Status #include "lldb/Utility/StreamString.h" // for StreamString #include "lldb/Utility/StringList.h" // for StringList #include "lldb/lldb-forward.h" // for StreamFileSP @@ -515,7 +515,7 @@ bool IOHandlerEditline::GetLines(StringList &lines, bool &interrupted) { } else { #endif bool done = false; - Error error; + Status error; while (!done) { // Show line numbers if we are asked to @@ -4640,7 +4640,7 @@ void IOHandlerCursesGUI::Activate() { WindowSP threads_window_sp( main_window_sp->CreateSubWindow("Threads", threads_bounds, false)); WindowSP status_window_sp( - main_window_sp->CreateSubWindow("Status", status_bounds, false)); + main_window_sp->CreateSubWindow("Error", status_bounds, false)); status_window_sp->SetCanBeActive( false); // Don't let the status bar become the active window main_window_sp->SetDelegate( diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp index d168474c347..0de866ac8a2 100644 --- a/lldb/source/Core/Module.cpp +++ b/lldb/source/Core/Module.cpp @@ -39,10 +39,10 @@ #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" #include "lldb/Utility/DataBufferHeap.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/Log.h" #include "lldb/Utility/Logging.h" // for GetLogIfAn... #include "lldb/Utility/RegularExpression.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/Stream.h" // for Stream #include "lldb/Utility/StreamString.h" @@ -322,7 +322,7 @@ Module::~Module() { } ObjectFile *Module::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) { if (m_objfile_sp) { error.SetErrorString("object file already exists"); @@ -331,7 +331,7 @@ ObjectFile *Module::GetMemoryObjectFile(const lldb::ProcessSP &process_sp, if (process_sp) { m_did_load_objfile = true; auto data_ap = llvm::make_unique<DataBufferHeap>(size_to_read, 0); - Error readmem_error; + Status readmem_error; const size_t bytes_read = process_sp->ReadMemory(header_addr, data_ap->GetBytes(), data_ap->GetByteSize(), readmem_error); @@ -1537,7 +1537,7 @@ bool Module::IsLoadedInTarget(Target *target) { return false; } -bool Module::LoadScriptingResourceInTarget(Target *target, Error &error, +bool Module::LoadScriptingResourceInTarget(Target *target, Status &error, Stream *feedback_stream) { if (!target) { error.SetErrorString("invalid destination Target"); @@ -1717,6 +1717,6 @@ bool Module::GetIsDynamicLinkEditor() { return false; } -Error Module::LoadInMemory(Target &target, bool set_pc) { +Status Module::LoadInMemory(Target &target, bool set_pc) { return m_objfile_sp->LoadInMemory(target, set_pc); } diff --git a/lldb/source/Core/ModuleList.cpp b/lldb/source/Core/ModuleList.cpp index da23329cc3b..b04299ead80 100644 --- a/lldb/source/Core/ModuleList.cpp +++ b/lldb/source/Core/ModuleList.cpp @@ -704,17 +704,17 @@ size_t ModuleList::RemoveOrphanSharedModules(bool mandatory) { return GetSharedModuleList().RemoveOrphans(mandatory); } -Error ModuleList::GetSharedModule(const ModuleSpec &module_spec, - ModuleSP &module_sp, - const FileSpecList *module_search_paths_ptr, - ModuleSP *old_module_sp_ptr, - bool *did_create_ptr, bool always_create) { +Status ModuleList::GetSharedModule(const ModuleSpec &module_spec, + ModuleSP &module_sp, + const FileSpecList *module_search_paths_ptr, + ModuleSP *old_module_sp_ptr, + bool *did_create_ptr, bool always_create) { ModuleList &shared_module_list = GetSharedModuleList(); std::lock_guard<std::recursive_mutex> guard( shared_module_list.m_modules_mutex); char path[PATH_MAX]; - Error error; + Status error; module_sp.reset(); @@ -821,7 +821,7 @@ Error ModuleList::GetSharedModule(const ModuleSpec &module_spec, *did_create_ptr = true; shared_module_list.ReplaceEquivalent(module_sp); - return Error(); + return Status(); } } } else { @@ -955,14 +955,14 @@ bool ModuleList::RemoveSharedModuleIfOrphaned(const Module *module_ptr) { } bool ModuleList::LoadScriptingResourcesInTarget(Target *target, - std::list<Error> &errors, + std::list<Status> &errors, Stream *feedback_stream, bool continue_on_error) { if (!target) return false; std::lock_guard<std::recursive_mutex> guard(m_modules_mutex); for (auto module : m_modules) { - Error error; + Status error; if (module) { if (!module->LoadScriptingResourceInTarget(target, error, feedback_stream)) { diff --git a/lldb/source/Core/PluginManager.cpp b/lldb/source/Core/PluginManager.cpp index bd4ba599520..9bb615b6a55 100644 --- a/lldb/source/Core/PluginManager.cpp +++ b/lldb/source/Core/PluginManager.cpp @@ -13,8 +13,8 @@ #include "lldb/Host/HostInfo.h" #include "lldb/Interpreter/OptionValueProperties.h" #include "lldb/Utility/ConstString.h" // for ConstString -#include "lldb/Utility/Error.h" #include "lldb/Utility/FileSpec.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/StringList.h" // for StringList #if defined(LLVM_ON_WIN32) @@ -93,7 +93,7 @@ static FileSpec::EnumerateDirectoryResult LoadPluginCallback(void *baton, llvm::sys::fs::file_type ft, const FileSpec &file_spec) { // PluginManager *plugin_manager = (PluginManager *)baton; - Error error; + Status error; namespace fs = llvm::sys::fs; // If we have a regular file, a symbolic link or unknown file type, try @@ -1066,9 +1066,9 @@ PluginManager::GetObjectFileCreateMemoryCallbackForPluginName( return nullptr; } -Error PluginManager::SaveCore(const lldb::ProcessSP &process_sp, - const FileSpec &outfile) { - Error error; +Status PluginManager::SaveCore(const lldb::ProcessSP &process_sp, + const FileSpec &outfile) { + Status error; std::lock_guard<std::recursive_mutex> guard(GetObjectFileMutex()); ObjectFileInstances &instances = GetObjectFileInstances(); diff --git a/lldb/source/Core/RegisterValue.cpp b/lldb/source/Core/RegisterValue.cpp index 26a7515febc..28ce67e63dc 100644 --- a/lldb/source/Core/RegisterValue.cpp +++ b/lldb/source/Core/RegisterValue.cpp @@ -13,7 +13,7 @@ #include "lldb/Core/Scalar.h" #include "lldb/Interpreter/Args.h" #include "lldb/Utility/DataExtractor.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/Stream.h" #include "lldb/Utility/StreamString.h" #include "lldb/lldb-defines.h" // for LLDB_INVALID_ADDRESS @@ -102,7 +102,7 @@ bool RegisterValue::GetData(DataExtractor &data) const { uint32_t RegisterValue::GetAsMemoryData(const RegisterInfo *reg_info, void *dst, uint32_t dst_len, lldb::ByteOrder dst_byte_order, - Error &error) const { + Status &error) const { if (reg_info == nullptr) { error.SetErrorString("invalid register info argument."); return 0; @@ -148,7 +148,7 @@ uint32_t RegisterValue::GetAsMemoryData(const RegisterInfo *reg_info, void *dst, uint32_t RegisterValue::SetFromMemoryData(const RegisterInfo *reg_info, const void *src, uint32_t src_len, lldb::ByteOrder src_byte_order, - Error &error) { + Status &error) { if (reg_info == nullptr) { error.SetErrorString("invalid register info argument."); return 0; @@ -163,7 +163,7 @@ uint32_t RegisterValue::SetFromMemoryData(const RegisterInfo *reg_info, // // Case 2: src_len > dst_len // - // Error! (The register should always be big enough to hold the data) + // Status! (The register should always be big enough to hold the data) // // Case 3: src_len < dst_len // @@ -257,11 +257,11 @@ RegisterValue::Type RegisterValue::SetType(const RegisterInfo *reg_info) { return m_type; } -Error RegisterValue::SetValueFromData(const RegisterInfo *reg_info, - DataExtractor &src, - lldb::offset_t src_offset, - bool partial_data_ok) { - Error error; +Status RegisterValue::SetValueFromData(const RegisterInfo *reg_info, + DataExtractor &src, + lldb::offset_t src_offset, + bool partial_data_ok) { + Status error; if (src.GetByteSize() == 0) { error.SetErrorString("empty data."); @@ -391,9 +391,9 @@ static bool ParseVectorEncoding(const RegisterInfo *reg_info, return true; } -Error RegisterValue::SetValueFromString(const RegisterInfo *reg_info, - llvm::StringRef value_str) { - Error error; +Status RegisterValue::SetValueFromString(const RegisterInfo *reg_info, + llvm::StringRef value_str) { + Status error; if (reg_info == nullptr) { error.SetErrorString("Invalid register info argument."); return error; diff --git a/lldb/source/Core/Scalar.cpp b/lldb/source/Core/Scalar.cpp index 3adf8509864..630083bae93 100644 --- a/lldb/source/Core/Scalar.cpp +++ b/lldb/source/Core/Scalar.cpp @@ -12,7 +12,7 @@ #include "lldb/Host/StringConvert.h" #include "lldb/Utility/DataExtractor.h" #include "lldb/Utility/Endian.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/Stream.h" #include "lldb/lldb-types.h" // for offset_t @@ -2460,9 +2460,9 @@ const Scalar lldb_private::operator>>(const Scalar &lhs, const Scalar &rhs) { return result; } -Error Scalar::SetValueFromCString(const char *value_str, Encoding encoding, - size_t byte_size) { - Error error; +Status Scalar::SetValueFromCString(const char *value_str, Encoding encoding, + size_t byte_size) { + Status error; if (value_str == nullptr || value_str[0] == '\0') { error.SetErrorString("Invalid c-string value string."); return error; @@ -2596,9 +2596,9 @@ Error Scalar::SetValueFromCString(const char *value_str, Encoding encoding, return error; } -Error Scalar::SetValueFromData(DataExtractor &data, lldb::Encoding encoding, - size_t byte_size) { - Error error; +Status Scalar::SetValueFromData(DataExtractor &data, lldb::Encoding encoding, + size_t byte_size) { + Status error; type128 int128; type256 int256; @@ -2762,7 +2762,7 @@ bool Scalar::SignExtend(uint32_t sign_bit_pos) { size_t Scalar::GetAsMemoryData(void *dst, size_t dst_len, lldb::ByteOrder dst_byte_order, - Error &error) const { + Status &error) const { // Get a data extractor that points to the native scalar data DataExtractor data; if (!GetData(data)) { diff --git a/lldb/source/Core/SearchFilter.cpp b/lldb/source/Core/SearchFilter.cpp index 6d29e21c310..b92a24b9240 100644 --- a/lldb/source/Core/SearchFilter.cpp +++ b/lldb/source/Core/SearchFilter.cpp @@ -16,7 +16,7 @@ #include "lldb/Symbol/SymbolContext.h" // for SymbolContext #include "lldb/Target/Target.h" #include "lldb/Utility/ConstString.h" // for ConstString -#include "lldb/Utility/Error.h" // for Error +#include "lldb/Utility/Status.h" // for Status #include "lldb/Utility/Stream.h" // for Stream #include "lldb/lldb-enumerations.h" // for SymbolContextItem::eSymbolCo... @@ -80,7 +80,7 @@ SearchFilter::~SearchFilter() = default; SearchFilterSP SearchFilter::CreateFromStructuredData( Target &target, const StructuredData::Dictionary &filter_dict, - Error &error) { + Status &error) { SearchFilterSP result_sp; if (!filter_dict.IsValid()) { error.SetErrorString("Can't deserialize from an invalid data object."); @@ -338,7 +338,8 @@ Searcher::CallbackReturn SearchFilter::DoFunctionIteration( // "black list". //---------------------------------------------------------------------- SearchFilterSP SearchFilterForUnconstrainedSearches::CreateFromStructuredData( - Target &target, const StructuredData::Dictionary &data_dict, Error &error) { + Target &target, const StructuredData::Dictionary &data_dict, + Status &error) { // No options for an unconstrained search. return std::make_shared<SearchFilterForUnconstrainedSearches>( target.shared_from_this()); @@ -466,7 +467,8 @@ SearchFilterByModule::DoCopyForBreakpoint(Breakpoint &breakpoint) { } SearchFilterSP SearchFilterByModule::CreateFromStructuredData( - Target &target, const StructuredData::Dictionary &data_dict, Error &error) { + Target &target, const StructuredData::Dictionary &data_dict, + Status &error) { StructuredData::Array *modules_array; bool success = data_dict.GetValueForKeyAsArray(GetKey(OptionNames::ModList), modules_array); @@ -628,7 +630,8 @@ SearchFilterByModuleList::DoCopyForBreakpoint(Breakpoint &breakpoint) { } SearchFilterSP SearchFilterByModuleList::CreateFromStructuredData( - Target &target, const StructuredData::Dictionary &data_dict, Error &error) { + Target &target, const StructuredData::Dictionary &data_dict, + Status &error) { StructuredData::Array *modules_array; bool success = data_dict.GetValueForKeyAsArray(GetKey(OptionNames::ModList), modules_array); @@ -691,7 +694,8 @@ operator=(const SearchFilterByModuleListAndCU &rhs) { SearchFilterByModuleListAndCU::~SearchFilterByModuleListAndCU() = default; lldb::SearchFilterSP SearchFilterByModuleListAndCU::CreateFromStructuredData( - Target &target, const StructuredData::Dictionary &data_dict, Error &error) { + Target &target, const StructuredData::Dictionary &data_dict, + Status &error) { StructuredData::Array *modules_array = nullptr; SearchFilterSP result_sp; bool success = data_dict.GetValueForKeyAsArray(GetKey(OptionNames::ModList), diff --git a/lldb/source/Core/StructuredData.cpp b/lldb/source/Core/StructuredData.cpp index 649c4615ad4..d52b7730cc6 100644 --- a/lldb/source/Core/StructuredData.cpp +++ b/lldb/source/Core/StructuredData.cpp @@ -12,9 +12,9 @@ #include "lldb/Host/File.h" #include "lldb/Host/StringConvert.h" #include "lldb/Utility/DataBuffer.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/JSON.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/Stream.h" // for Stream #include "lldb/Utility/StreamString.h" #include "lldb/lldb-enumerations.h" // for FilePermissions::eFilePermiss... @@ -40,7 +40,7 @@ static StructuredData::ObjectSP ParseJSONObject(JSONParser &json_parser); static StructuredData::ObjectSP ParseJSONArray(JSONParser &json_parser); StructuredData::ObjectSP -StructuredData::ParseJSONFromFile(const FileSpec &input_spec, Error &error) { +StructuredData::ParseJSONFromFile(const FileSpec &input_spec, Status &error) { StructuredData::ObjectSP return_sp; if (!input_spec.Exists()) { error.SetErrorStringWithFormat("input file %s does not exist.", diff --git a/lldb/source/Core/UserSettingsController.cpp b/lldb/source/Core/UserSettingsController.cpp index 59a88ccdb93..a4661a6c9e8 100644 --- a/lldb/source/Core/UserSettingsController.cpp +++ b/lldb/source/Core/UserSettingsController.cpp @@ -10,7 +10,7 @@ #include "lldb/Core/UserSettingsController.h" #include "lldb/Interpreter/OptionValueProperties.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/Stream.h" #include <memory> // for shared_ptr @@ -32,21 +32,23 @@ using namespace lldb; using namespace lldb_private; lldb::OptionValueSP -Properties::GetPropertyValue(const ExecutionContext *exe_ctx, llvm::StringRef path, - bool will_modify, Error &error) const { +Properties::GetPropertyValue(const ExecutionContext *exe_ctx, + llvm::StringRef path, bool will_modify, + Status &error) const { OptionValuePropertiesSP properties_sp(GetValueProperties()); if (properties_sp) return properties_sp->GetSubValue(exe_ctx, path, will_modify, error); return lldb::OptionValueSP(); } -Error Properties::SetPropertyValue(const ExecutionContext *exe_ctx, - VarSetOperationType op, llvm::StringRef path, - llvm::StringRef value) { +Status Properties::SetPropertyValue(const ExecutionContext *exe_ctx, + VarSetOperationType op, + llvm::StringRef path, + llvm::StringRef value) { OptionValuePropertiesSP properties_sp(GetValueProperties()); if (properties_sp) return properties_sp->SetSubValue(exe_ctx, op, path, value); - Error error; + Status error; error.SetErrorString("no properties"); return error; } @@ -67,15 +69,16 @@ void Properties::DumpAllDescriptions(CommandInterpreter &interpreter, return properties_sp->DumpAllDescriptions(interpreter, strm); } -Error Properties::DumpPropertyValue(const ExecutionContext *exe_ctx, - Stream &strm, llvm::StringRef property_path, - uint32_t dump_mask) { +Status Properties::DumpPropertyValue(const ExecutionContext *exe_ctx, + Stream &strm, + llvm::StringRef property_path, + uint32_t dump_mask) { OptionValuePropertiesSP properties_sp(GetValueProperties()); if (properties_sp) { return properties_sp->DumpPropertyValue(exe_ctx, strm, property_path, dump_mask); } - Error error; + Status error; error.SetErrorString("empty property list"); return error; } diff --git a/lldb/source/Core/Value.cpp b/lldb/source/Core/Value.cpp index 9aaddf77021..63385511edb 100644 --- a/lldb/source/Core/Value.cpp +++ b/lldb/source/Core/Value.cpp @@ -144,7 +144,7 @@ Type *Value::GetType() { size_t Value::AppendDataToHostBuffer(const Value &rhs) { size_t curr_size = m_data_buffer.GetByteSize(); - Error error; + Status error; switch (rhs.GetValueType()) { case eValueTypeScalar: { const size_t scalar_size = rhs.m_value.GetByteSize(); @@ -207,7 +207,7 @@ bool Value::ValueOf(ExecutionContext *exe_ctx) { return false; } -uint64_t Value::GetValueByteSize(Error *error_ptr, ExecutionContext *exe_ctx) { +uint64_t Value::GetValueByteSize(Status *error_ptr, ExecutionContext *exe_ctx) { uint64_t byte_size = 0; switch (m_context_type) { @@ -315,11 +315,11 @@ bool Value::GetData(DataExtractor &data) { return false; } -Error Value::GetValueAsData(ExecutionContext *exe_ctx, DataExtractor &data, - uint32_t data_offset, Module *module) { +Status Value::GetValueAsData(ExecutionContext *exe_ctx, DataExtractor &data, + uint32_t data_offset, Module *module) { data.Clear(); - Error error; + Status error; lldb::addr_t address = LLDB_INVALID_ADDRESS; AddressType address_type = eAddressTypeFile; Address file_so_addr; @@ -623,7 +623,7 @@ Scalar &Value::ResolveValue(ExecutionContext *exe_ctx) { { DataExtractor data; lldb::addr_t addr = m_value.ULongLong(LLDB_INVALID_ADDRESS); - Error error(GetValueAsData(exe_ctx, data, 0, NULL)); + Status error(GetValueAsData(exe_ctx, data, 0, NULL)); if (error.Success()) { Scalar scalar; if (compiler_type.GetValueAsScalar(data, 0, data.GetByteSize(), diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp index 9e6b9da78b9..c09139fe2b0 100644 --- a/lldb/source/Core/ValueObject.cpp +++ b/lldb/source/Core/ValueObject.cpp @@ -347,7 +347,7 @@ DataExtractor &ValueObject::GetDataExtractor() { return m_data; } -const Error &ValueObject::GetError() { +const Status &ValueObject::GetError() { UpdateValueIfNeeded(false); return m_error; } @@ -423,7 +423,7 @@ bool ValueObject::ResolveValue(Scalar &scalar) { return false; } -bool ValueObject::IsLogicalTrue(Error &error) { +bool ValueObject::IsLogicalTrue(Status &error) { if (Language *language = Language::FindPlugin(GetObjectRuntimeLanguage())) { LazyBool is_logical_true = language->IsLogicalTrue(*this, error); switch (is_logical_true) { @@ -771,7 +771,7 @@ size_t ValueObject::GetPointeeData(DataExtractor &data, uint32_t item_idx, if (item_idx == 0 && item_count == 1) // simply a deref { if (is_pointer_type) { - Error error; + Status error; ValueObjectSP pointee_sp = Dereference(error); if (error.Fail() || pointee_sp.get() == NULL) return 0; @@ -780,13 +780,13 @@ size_t ValueObject::GetPointeeData(DataExtractor &data, uint32_t item_idx, ValueObjectSP child_sp = GetChildAtIndex(0, true); if (child_sp.get() == NULL) return 0; - Error error; + Status error; return child_sp->GetData(data, error); } return true; } else /* (items > 1) */ { - Error error; + Status error; lldb_private::DataBufferHeap *heap_buf_ptr = NULL; lldb::DataBufferSP data_sp(heap_buf_ptr = new lldb_private::DataBufferHeap()); @@ -848,7 +848,7 @@ size_t ValueObject::GetPointeeData(DataExtractor &data, uint32_t item_idx, return 0; } -uint64_t ValueObject::GetData(DataExtractor &data, Error &error) { +uint64_t ValueObject::GetData(DataExtractor &data, Status &error) { UpdateValueIfNeeded(false); ExecutionContext exe_ctx(GetExecutionContextRef()); error = m_value.GetValueAsData(&exe_ctx, data, 0, GetModule().get()); @@ -866,7 +866,7 @@ uint64_t ValueObject::GetData(DataExtractor &data, Error &error) { return data.GetByteSize(); } -bool ValueObject::SetData(DataExtractor &data, Error &error) { +bool ValueObject::SetData(DataExtractor &data, Status &error) { error.Clear(); // Make sure our value is up to date first so that our location and location // type is valid. @@ -884,7 +884,7 @@ bool ValueObject::SetData(DataExtractor &data, Error &error) { switch (value_type) { case Value::eValueTypeScalar: { - Error set_error = + Status set_error = m_value.GetScalar().SetValueFromData(data, encoding, byte_size); if (!set_error.Success()) { @@ -938,7 +938,7 @@ static bool CopyStringDataToBufferSP(const StreamString &source, } std::pair<size_t, bool> -ValueObject::ReadPointedString(lldb::DataBufferSP &buffer_sp, Error &error, +ValueObject::ReadPointedString(lldb::DataBufferSP &buffer_sp, Status &error, uint32_t max_length, bool honor_array, Format item_format) { bool was_capped = false; @@ -1285,7 +1285,7 @@ bool ValueObject::DumpPrintableRepresentation( custom_format == eFormatVectorOfChar)) // print char[] & char* directly { - Error error; + Status error; lldb::DataBufferSP buffer_sp; std::pair<size_t, bool> read_string = ReadPointedString( buffer_sp, error, 0, (custom_format == eFormatVectorOfChar) || @@ -1561,7 +1561,7 @@ addr_t ValueObject::GetPointerValue(AddressType *address_type) { return address; } -bool ValueObject::SetValueFromCString(const char *value_str, Error &error) { +bool ValueObject::SetValueFromCString(const char *value_str, Status &error) { error.Clear(); // Make sure our value is up to date first so that our location and location // type is valid. @@ -2185,7 +2185,7 @@ ValueObjectSP ValueObject::GetValueForExpressionPath( if ((final_task_on_target ? *final_task_on_target : dummy_final_task_on_target) == ValueObject::eExpressionPathAftermathDereference) { - Error error; + Status error; ValueObjectSP final_value = ret_val->Dereference(error); if (error.Fail() || !final_value.get()) { if (reason_to_stop) @@ -2202,7 +2202,7 @@ ValueObjectSP ValueObject::GetValueForExpressionPath( } if (*final_task_on_target == ValueObject::eExpressionPathAftermathTakeAddress) { - Error error; + Status error; ValueObjectSP final_value = ret_val->AddressOf(error); if (error.Fail() || !final_value.get()) { if (reason_to_stop) @@ -2552,7 +2552,7 @@ ValueObjectSP ValueObject::GetValueForExpressionPath_Impl( // and use this as // a bitfield pointee_compiler_type_info.Test(eTypeIsScalar)) { - Error error; + Status error; root = root->Dereference(error); if (error.Fail() || !root) { *reason_to_stop = @@ -2697,7 +2697,7 @@ ValueObjectSP ValueObject::GetValueForExpressionPath_Impl( *what_next == ValueObject::eExpressionPathAftermathDereference && pointee_compiler_type_info.Test(eTypeIsScalar)) { - Error error; + Status error; root = root->Dereference(error); if (error.Fail() || !root) { *reason_to_stop = @@ -2839,7 +2839,7 @@ lldb::addr_t ValueObject::GetCPPVTableAddress(AddressType &address_type) { return LLDB_INVALID_ADDRESS; } -ValueObjectSP ValueObject::Dereference(Error &error) { +ValueObjectSP ValueObject::Dereference(Status &error) { if (m_deref_valobj) return m_deref_valobj->GetSP(); @@ -2904,7 +2904,7 @@ ValueObjectSP ValueObject::Dereference(Error &error) { } } -ValueObjectSP ValueObject::AddressOf(Error &error) { +ValueObjectSP ValueObject::AddressOf(Status &error) { if (m_addr_of_valobj_sp) return m_addr_of_valobj_sp; @@ -3191,7 +3191,7 @@ lldb::ValueObjectSP ValueObject::CreateValueObjectFromAddress( if (ptr_result_valobj_sp) { ptr_result_valobj_sp->GetValue().SetValueType( Value::eValueTypeLoadAddress); - Error err; + Status err; ptr_result_valobj_sp = ptr_result_valobj_sp->Dereference(err); if (ptr_result_valobj_sp && !name.empty()) ptr_result_valobj_sp->SetName(ConstString(name)); diff --git a/lldb/source/Core/ValueObjectCast.cpp b/lldb/source/Core/ValueObjectCast.cpp index aa4cf60c1f9..a489bdc74f5 100644 --- a/lldb/source/Core/ValueObjectCast.cpp +++ b/lldb/source/Core/ValueObjectCast.cpp @@ -14,7 +14,7 @@ #include "lldb/Core/ValueObject.h" #include "lldb/Symbol/CompilerType.h" #include "lldb/Target/ExecutionContext.h" -#include "lldb/Utility/Error.h" // for Error +#include "lldb/Utility/Status.h" // for Status namespace lldb_private { class ConstString; diff --git a/lldb/source/Core/ValueObjectChild.cpp b/lldb/source/Core/ValueObjectChild.cpp index eeb28c960a3..591bc21711a 100644 --- a/lldb/source/Core/ValueObjectChild.cpp +++ b/lldb/source/Core/ValueObjectChild.cpp @@ -14,9 +14,9 @@ #include "lldb/Symbol/CompilerType.h" #include "lldb/Target/ExecutionContext.h" #include "lldb/Target/Process.h" -#include "lldb/Utility/Error.h" // for Error -#include "lldb/Utility/Flags.h" // for Flags -#include "lldb/lldb-forward.h" // for ProcessSP, ModuleSP +#include "lldb/Utility/Flags.h" // for Flags +#include "lldb/Utility/Status.h" // for Status +#include "lldb/lldb-forward.h" // for ProcessSP, ModuleSP #include <functional> // for _Func_impl<>::_Mybase #include <memory> // for shared_ptr diff --git a/lldb/source/Core/ValueObjectConstResult.cpp b/lldb/source/Core/ValueObjectConstResult.cpp index cf437ce6f7d..1023696c35a 100644 --- a/lldb/source/Core/ValueObjectConstResult.cpp +++ b/lldb/source/Core/ValueObjectConstResult.cpp @@ -163,12 +163,12 @@ ValueObjectConstResult::ValueObjectConstResult( } ValueObjectSP ValueObjectConstResult::Create(ExecutionContextScope *exe_scope, - const Error &error) { + const Status &error) { return (new ValueObjectConstResult(exe_scope, error))->GetSP(); } ValueObjectConstResult::ValueObjectConstResult(ExecutionContextScope *exe_scope, - const Error &error) + const Status &error) : ValueObject(exe_scope), m_type_name(), m_byte_size(0), m_impl(this) { m_error = error; SetIsConstant(); @@ -234,7 +234,7 @@ bool ValueObjectConstResult::IsInScope() { return true; } -lldb::ValueObjectSP ValueObjectConstResult::Dereference(Error &error) { +lldb::ValueObjectSP ValueObjectConstResult::Dereference(Status &error) { return m_impl.Dereference(error); } @@ -245,7 +245,7 @@ lldb::ValueObjectSP ValueObjectConstResult::GetSyntheticChildAtOffset( name_const_str); } -lldb::ValueObjectSP ValueObjectConstResult::AddressOf(Error &error) { +lldb::ValueObjectSP ValueObjectConstResult::AddressOf(Status &error) { return m_impl.AddressOf(error); } diff --git a/lldb/source/Core/ValueObjectConstResultCast.cpp b/lldb/source/Core/ValueObjectConstResultCast.cpp index f575bebd711..c04043264af 100644 --- a/lldb/source/Core/ValueObjectConstResultCast.cpp +++ b/lldb/source/Core/ValueObjectConstResultCast.cpp @@ -13,7 +13,7 @@ namespace lldb_private { class DataExtractor; } namespace lldb_private { -class Error; +class Status; } namespace lldb_private { class ValueObject; @@ -30,7 +30,7 @@ ValueObjectConstResultCast::ValueObjectConstResultCast( ValueObjectConstResultCast::~ValueObjectConstResultCast() {} -lldb::ValueObjectSP ValueObjectConstResultCast::Dereference(Error &error) { +lldb::ValueObjectSP ValueObjectConstResultCast::Dereference(Status &error) { return m_impl.Dereference(error); } @@ -41,7 +41,7 @@ lldb::ValueObjectSP ValueObjectConstResultCast::GetSyntheticChildAtOffset( name_const_str); } -lldb::ValueObjectSP ValueObjectConstResultCast::AddressOf(Error &error) { +lldb::ValueObjectSP ValueObjectConstResultCast::AddressOf(Status &error) { return m_impl.AddressOf(error); } diff --git a/lldb/source/Core/ValueObjectConstResultChild.cpp b/lldb/source/Core/ValueObjectConstResultChild.cpp index 9c6ad8becf3..3e9f8768416 100644 --- a/lldb/source/Core/ValueObjectConstResultChild.cpp +++ b/lldb/source/Core/ValueObjectConstResultChild.cpp @@ -14,7 +14,7 @@ namespace lldb_private { class DataExtractor; } namespace lldb_private { -class Error; +class Status; } namespace lldb_private { class ValueObject; @@ -37,7 +37,7 @@ ValueObjectConstResultChild::ValueObjectConstResultChild( ValueObjectConstResultChild::~ValueObjectConstResultChild() {} -lldb::ValueObjectSP ValueObjectConstResultChild::Dereference(Error &error) { +lldb::ValueObjectSP ValueObjectConstResultChild::Dereference(Status &error) { return m_impl.Dereference(error); } @@ -48,7 +48,7 @@ lldb::ValueObjectSP ValueObjectConstResultChild::GetSyntheticChildAtOffset( name_const_str); } -lldb::ValueObjectSP ValueObjectConstResultChild::AddressOf(Error &error) { +lldb::ValueObjectSP ValueObjectConstResultChild::AddressOf(Status &error) { return m_impl.AddressOf(error); } diff --git a/lldb/source/Core/ValueObjectConstResultImpl.cpp b/lldb/source/Core/ValueObjectConstResultImpl.cpp index ed25ea8071a..714634ed56e 100644 --- a/lldb/source/Core/ValueObjectConstResultImpl.cpp +++ b/lldb/source/Core/ValueObjectConstResultImpl.cpp @@ -27,7 +27,7 @@ namespace lldb_private { class DataExtractor; } namespace lldb_private { -class Error; +class Status; } using namespace lldb; @@ -39,7 +39,7 @@ ValueObjectConstResultImpl::ValueObjectConstResultImpl( m_live_address_type(eAddressTypeLoad), m_load_addr_backend(), m_address_of_backend() {} -lldb::ValueObjectSP ValueObjectConstResultImpl::Dereference(Error &error) { +lldb::ValueObjectSP ValueObjectConstResultImpl::Dereference(Status &error) { if (m_impl_backend == NULL) return lldb::ValueObjectSP(); @@ -108,7 +108,7 @@ lldb::ValueObjectSP ValueObjectConstResultImpl::GetSyntheticChildAtOffset( offset, type, can_create, name_const_str); } -lldb::ValueObjectSP ValueObjectConstResultImpl::AddressOf(Error &error) { +lldb::ValueObjectSP ValueObjectConstResultImpl::AddressOf(Status &error) { if (m_address_of_backend.get() != NULL) return m_address_of_backend; diff --git a/lldb/source/Core/ValueObjectDynamicValue.cpp b/lldb/source/Core/ValueObjectDynamicValue.cpp index 59bbc025f99..bb39caa767e 100644 --- a/lldb/source/Core/ValueObjectDynamicValue.cpp +++ b/lldb/source/Core/ValueObjectDynamicValue.cpp @@ -20,9 +20,9 @@ #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" #include "lldb/Utility/DataExtractor.h" // for DataExtractor -#include "lldb/Utility/Error.h" // for Error #include "lldb/Utility/Log.h" #include "lldb/Utility/Logging.h" // for GetLogIfAllCategoriesSet +#include "lldb/Utility/Status.h" // for Status #include "lldb/lldb-types.h" // for addr_t, offset_t #include <string.h> // for strcmp, size_t @@ -275,7 +275,7 @@ bool ValueObjectDynamicValue::UpdateValue() { bool ValueObjectDynamicValue::IsInScope() { return m_parent->IsInScope(); } bool ValueObjectDynamicValue::SetValueFromCString(const char *value_str, - Error &error) { + Status &error) { if (!UpdateValueIfNeeded(false)) { error.SetErrorString("unable to read value"); return false; @@ -310,7 +310,7 @@ bool ValueObjectDynamicValue::SetValueFromCString(const char *value_str, return ret_val; } -bool ValueObjectDynamicValue::SetData(DataExtractor &data, Error &error) { +bool ValueObjectDynamicValue::SetData(DataExtractor &data, Status &error) { if (!UpdateValueIfNeeded(false)) { error.SetErrorString("unable to read value"); return false; diff --git a/lldb/source/Core/ValueObjectMemory.cpp b/lldb/source/Core/ValueObjectMemory.cpp index 0fb8f0d2de0..713751110dc 100644 --- a/lldb/source/Core/ValueObjectMemory.cpp +++ b/lldb/source/Core/ValueObjectMemory.cpp @@ -17,7 +17,7 @@ #include "lldb/Target/ExecutionContext.h" #include "lldb/Target/Target.h" #include "lldb/Utility/DataExtractor.h" // for DataExtractor -#include "lldb/Utility/Error.h" // for Error +#include "lldb/Utility/Status.h" // for Status #include "lldb/lldb-types.h" // for addr_t #include "llvm/Support/ErrorHandling.h" // for llvm_unreachable diff --git a/lldb/source/Core/ValueObjectRegister.cpp b/lldb/source/Core/ValueObjectRegister.cpp index 6469340201e..05022d3ed10 100644 --- a/lldb/source/Core/ValueObjectRegister.cpp +++ b/lldb/source/Core/ValueObjectRegister.cpp @@ -20,7 +20,7 @@ #include "lldb/Target/StackFrame.h" // for StackFrame #include "lldb/Target/Target.h" #include "lldb/Utility/DataExtractor.h" // for DataExtractor -#include "lldb/Utility/Error.h" // for Error +#include "lldb/Utility/Status.h" // for Status #include "lldb/Utility/Stream.h" // for Stream #include "llvm/ADT/StringRef.h" // for StringRef @@ -318,7 +318,7 @@ bool ValueObjectRegister::UpdateValue() { } bool ValueObjectRegister::SetValueFromCString(const char *value_str, - Error &error) { + Status &error) { // The new value will be in the m_data. Copy that into our register value. error = m_reg_value.SetValueFromString(&m_reg_info, llvm::StringRef(value_str)); @@ -332,7 +332,7 @@ bool ValueObjectRegister::SetValueFromCString(const char *value_str, return false; } -bool ValueObjectRegister::SetData(DataExtractor &data, Error &error) { +bool ValueObjectRegister::SetData(DataExtractor &data, Status &error) { error = m_reg_value.SetValueFromData(&m_reg_info, data, 0, false); if (error.Success()) { if (m_reg_ctx_sp->WriteRegister(&m_reg_info, m_reg_value)) { diff --git a/lldb/source/Core/ValueObjectSyntheticFilter.cpp b/lldb/source/Core/ValueObjectSyntheticFilter.cpp index f0fd76ed09f..87310c423cb 100644 --- a/lldb/source/Core/ValueObjectSyntheticFilter.cpp +++ b/lldb/source/Core/ValueObjectSyntheticFilter.cpp @@ -13,10 +13,10 @@ #include "lldb/Core/ValueObject.h" #include "lldb/DataFormatters/TypeSynthetic.h" #include "lldb/Target/ExecutionContext.h" // for ExecutionContext -#include "lldb/Utility/Error.h" // for Error #include "lldb/Utility/Log.h" #include "lldb/Utility/Logging.h" // for GetLogIfAllCategoriesSet #include "lldb/Utility/SharingPtr.h" // for SharingPtr +#include "lldb/Utility/Status.h" // for Status #include "llvm/ADT/STLExtras.h" @@ -324,7 +324,7 @@ bool ValueObjectSynthetic::CanProvideValue() { } bool ValueObjectSynthetic::SetValueFromCString(const char *value_str, - Error &error) { + Status &error) { return m_parent->SetValueFromCString(value_str, error); } diff --git a/lldb/source/Core/ValueObjectVariable.cpp b/lldb/source/Core/ValueObjectVariable.cpp index 169f8f0f6c2..9b9e51a0abb 100644 --- a/lldb/source/Core/ValueObjectVariable.cpp +++ b/lldb/source/Core/ValueObjectVariable.cpp @@ -29,7 +29,7 @@ #include "lldb/Target/RegisterContext.h" #include "lldb/Target/Target.h" #include "lldb/Utility/DataExtractor.h" // for DataExtractor -#include "lldb/Utility/Error.h" // for Error +#include "lldb/Utility/Status.h" // for Status #include "lldb/lldb-private-enumerations.h" // for AddressType::eAddressTy... #include "lldb/lldb-types.h" // for addr_t @@ -344,7 +344,7 @@ const char *ValueObjectVariable::GetLocationAsCString() { } bool ValueObjectVariable::SetValueFromCString(const char *value_str, - Error &error) { + Status &error) { if (!UpdateValueIfNeeded()) { error.SetErrorString("unable to update value before writing"); return false; @@ -373,7 +373,7 @@ bool ValueObjectVariable::SetValueFromCString(const char *value_str, return ValueObject::SetValueFromCString(value_str, error); } -bool ValueObjectVariable::SetData(DataExtractor &data, Error &error) { +bool ValueObjectVariable::SetData(DataExtractor &data, Status &error) { if (!UpdateValueIfNeeded()) { error.SetErrorString("unable to update value before writing"); return false; diff --git a/lldb/source/DataFormatters/StringPrinter.cpp b/lldb/source/DataFormatters/StringPrinter.cpp index 7ca3744a247..84143a54108 100644 --- a/lldb/source/DataFormatters/StringPrinter.cpp +++ b/lldb/source/DataFormatters/StringPrinter.cpp @@ -15,7 +15,7 @@ #include "lldb/Target/Language.h" #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "llvm/Support/ConvertUTF.h" @@ -417,7 +417,7 @@ bool StringPrinter::ReadStringAndDumpToStream< StringPrinter::StringElementType::ASCII>( const ReadStringAndDumpToStreamOptions &options) { assert(options.GetStream() && "need a Stream to print the string to"); - Error my_error; + Status my_error; ProcessSP process_sp(options.GetProcessSP()); @@ -561,7 +561,7 @@ static bool ReadUTFBufferAndDumpToStream( if (!buffer_sp->GetBytes()) return false; - Error error; + Status error; char *buffer = reinterpret_cast<char *>(buffer_sp->GetBytes()); if (needs_zero_terminator) diff --git a/lldb/source/DataFormatters/TypeFormat.cpp b/lldb/source/DataFormatters/TypeFormat.cpp index 4d1a0096bb6..333fe91b76d 100644 --- a/lldb/source/DataFormatters/TypeFormat.cpp +++ b/lldb/source/DataFormatters/TypeFormat.cpp @@ -56,7 +56,7 @@ bool TypeFormatImpl_Format::FormatObject(ValueObject *valobj, if (context_type == Value::eContextTypeRegisterInfo) { const RegisterInfo *reg_info = value.GetRegisterInfo(); if (reg_info) { - Error error; + Status error; valobj->GetData(data, error); if (error.Fail()) return false; @@ -82,7 +82,7 @@ bool TypeFormatImpl_Format::FormatObject(ValueObject *valobj, TargetSP target_sp(valobj->GetTargetSP()); if (target_sp) { size_t max_len = target_sp->GetMaximumSizeOfStringSummary(); - Error error; + Status error; DataBufferSP buffer_sp(new DataBufferHeap(max_len + 1, 0)); Address address(valobj->GetPointerValue()); if (target_sp->ReadCStringFromMemory( @@ -92,7 +92,7 @@ bool TypeFormatImpl_Format::FormatObject(ValueObject *valobj, } } } else { - Error error; + Status error; valobj->GetData(data, error); if (error.Fail()) return false; @@ -185,7 +185,7 @@ bool TypeFormatImpl_EnumType::FormatObject(ValueObject *valobj, if (valobj_enum_type.IsValid() == false) return false; DataExtractor data; - Error error; + Status error; valobj->GetData(data, error); if (error.Fail()) return false; diff --git a/lldb/source/Expression/DWARFExpression.cpp b/lldb/source/Expression/DWARFExpression.cpp index 928577cd7ee..592a30cdd78 100644 --- a/lldb/source/Expression/DWARFExpression.cpp +++ b/lldb/source/Expression/DWARFExpression.cpp @@ -655,7 +655,7 @@ void DWARFExpression::GetDescription(Stream *s, lldb::DescriptionLevel level, static bool ReadRegisterValueAsScalar(RegisterContext *reg_ctx, lldb::RegisterKind reg_kind, - uint32_t reg_num, Error *error_ptr, + uint32_t reg_num, Status *error_ptr, Value &value) { if (reg_ctx == NULL) { if (error_ptr) @@ -1250,7 +1250,7 @@ bool DWARFExpression::Evaluate(ExecutionContextScope *exe_scope, lldb::addr_t loclist_base_load_addr, const Value *initial_value_ptr, const Value *object_address_ptr, Value &result, - Error *error_ptr) const { + Status *error_ptr) const { ExecutionContext exe_ctx(exe_scope); return Evaluate(&exe_ctx, expr_locals, decl_map, nullptr, loclist_base_load_addr, initial_value_ptr, object_address_ptr, @@ -1261,7 +1261,7 @@ bool DWARFExpression::Evaluate( ExecutionContext *exe_ctx, ClangExpressionVariableList *expr_locals, 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 { + const Value *object_address_ptr, Value &result, Status *error_ptr) const { ModuleSP module_sp = m_module_wp.lock(); if (IsLocationList()) { @@ -1333,7 +1333,7 @@ bool DWARFExpression::Evaluate( DWARFCompileUnit *dwarf_cu, const lldb::offset_t opcodes_offset, const lldb::offset_t opcodes_length, const lldb::RegisterKind reg_kind, const Value *initial_value_ptr, const Value *object_address_ptr, - Value &result, Error *error_ptr) { + Value &result, Status *error_ptr) { if (opcodes_length == 0) { if (error_ptr) @@ -1467,7 +1467,7 @@ bool DWARFExpression::Evaluate( if (process) { lldb::addr_t pointer_addr = stack.back().GetScalar().ULongLong(LLDB_INVALID_ADDRESS); - Error error; + Status error; lldb::addr_t pointer_value = process->ReadPointerFromMemory(pointer_addr, error); if (pointer_value != LLDB_INVALID_ADDRESS) { @@ -1572,7 +1572,7 @@ bool DWARFExpression::Evaluate( lldb::addr_t pointer_addr = stack.back().GetScalar().ULongLong(LLDB_INVALID_ADDRESS); uint8_t addr_bytes[sizeof(lldb::addr_t)]; - Error error; + Status error; if (process->ReadMemory(pointer_addr, &addr_bytes, size, error) == size) { DataExtractor addr_data(addr_bytes, sizeof(addr_bytes), @@ -2568,7 +2568,7 @@ bool DWARFExpression::Evaluate( ::memset(curr_piece.GetBuffer().GetBytes(), 0, piece_byte_size); pieces.AppendDataToHostBuffer(curr_piece); } else { - Error error; + Status error; // Extract the current piece into "curr_piece" Value curr_piece_source_value(stack.back()); stack.pop_back(); diff --git a/lldb/source/Expression/FunctionCaller.cpp b/lldb/source/Expression/FunctionCaller.cpp index e2f38a9f50b..6f60f8bf9c1 100644 --- a/lldb/source/Expression/FunctionCaller.cpp +++ b/lldb/source/Expression/FunctionCaller.cpp @@ -86,7 +86,7 @@ bool FunctionCaller::WriteFunctionWrapper( bool can_interpret = false; // should stay that way - Error jit_error(m_parser->PrepareForExecution( + Status jit_error(m_parser->PrepareForExecution( m_jit_start_addr, m_jit_end_addr, m_execution_unit_sp, exe_ctx, can_interpret, eExecutionPolicyAlways)); @@ -135,7 +135,7 @@ bool FunctionCaller::WriteFunctionArguments( return false; } - Error error; + Status error; lldb::ExpressionResults return_value = lldb::eExpressionSetupError; Process *process = exe_ctx.GetProcessPtr(); @@ -172,7 +172,7 @@ bool FunctionCaller::WriteFunctionArguments( // FIXME: We will need to extend this for Variadic functions. - Error value_error; + Status value_error; size_t num_args = arg_values.GetSize(); if (num_args != m_arg_values.GetSize()) { @@ -289,7 +289,7 @@ bool FunctionCaller::FetchFunctionResults(ExecutionContext &exe_ctx, if (process != jit_process_sp.get()) return false; - Error error; + Status error; ret_value.GetScalar() = process->ReadUnsignedIntegerFromMemory( args_addr + m_return_offset, m_return_size, 0, error); diff --git a/lldb/source/Expression/IRDynamicChecks.cpp b/lldb/source/Expression/IRDynamicChecks.cpp index 44ff6295ca1..0c8cba2050c 100644 --- a/lldb/source/Expression/IRDynamicChecks.cpp +++ b/lldb/source/Expression/IRDynamicChecks.cpp @@ -51,7 +51,7 @@ DynamicCheckerFunctions::~DynamicCheckerFunctions() = default; bool DynamicCheckerFunctions::Install(DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx) { - Error error; + Status error; m_valid_pointer_check.reset( exe_ctx.GetTargetRef().GetUtilityFunctionForLanguage( g_valid_pointer_check_text, lldb::eLanguageTypeC, diff --git a/lldb/source/Expression/IRExecutionUnit.cpp b/lldb/source/Expression/IRExecutionUnit.cpp index 4309caefbd4..e31483f1728 100644 --- a/lldb/source/Expression/IRExecutionUnit.cpp +++ b/lldb/source/Expression/IRExecutionUnit.cpp @@ -50,7 +50,7 @@ IRExecutionUnit::IRExecutionUnit(std::unique_ptr<llvm::LLVMContext> &context_ap, m_reported_allocations(false) {} lldb::addr_t IRExecutionUnit::WriteNow(const uint8_t *bytes, size_t size, - Error &error) { + Status &error) { const bool zero_memory = false; lldb::addr_t allocation_process_addr = Malloc(size, 8, lldb::ePermissionsWritable | lldb::ePermissionsReadable, @@ -62,7 +62,7 @@ lldb::addr_t IRExecutionUnit::WriteNow(const uint8_t *bytes, size_t size, WriteMemory(allocation_process_addr, bytes, size, error); if (!error.Success()) { - Error err; + Status err; Free(allocation_process_addr, err); return LLDB_INVALID_ADDRESS; @@ -71,7 +71,7 @@ lldb::addr_t IRExecutionUnit::WriteNow(const uint8_t *bytes, size_t size, if (Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)) { DataBufferHeap my_buffer(size, 0); - Error err; + Status err; ReadMemory(my_buffer.GetBytes(), allocation_process_addr, size, err); if (err.Success()) { @@ -90,18 +90,18 @@ void IRExecutionUnit::FreeNow(lldb::addr_t allocation) { if (allocation == LLDB_INVALID_ADDRESS) return; - Error err; + Status err; Free(allocation, err); } -Error IRExecutionUnit::DisassembleFunction(Stream &stream, - lldb::ProcessSP &process_wp) { +Status IRExecutionUnit::DisassembleFunction(Stream &stream, + lldb::ProcessSP &process_wp) { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); ExecutionContext exe_ctx(process_wp); - Error ret; + Status ret; ret.Clear(); @@ -152,7 +152,7 @@ Error IRExecutionUnit::DisassembleFunction(Stream &stream, lldb::DataBufferSP buffer_sp(new DataBufferHeap(func_range.second, 0)); Process *process = exe_ctx.GetProcessPtr(); - Error err; + Status err; process->ReadMemory(func_remote_addr, buffer_sp->GetBytes(), buffer_sp->GetByteSize(), err); @@ -203,7 +203,7 @@ Error IRExecutionUnit::DisassembleFunction(Stream &stream, static void ReportInlineAsmError(const llvm::SMDiagnostic &diagnostic, void *Context, unsigned LocCookie) { - Error *err = static_cast<Error *>(Context); + Status *err = static_cast<Status *>(Context); if (err && err->Success()) { err->SetErrorToGenericError(); @@ -216,7 +216,7 @@ void IRExecutionUnit::ReportSymbolLookupError(const ConstString &name) { m_failed_lookups.push_back(name); } -void IRExecutionUnit::GetRunnableInfo(Error &error, lldb::addr_t &func_addr, +void IRExecutionUnit::GetRunnableInfo(Status &error, lldb::addr_t &func_addr, lldb::addr_t &func_end) { lldb::ProcessSP process_sp(GetProcessWP().lock()); @@ -452,7 +452,7 @@ void IRExecutionUnit::GetRunnableInfo(Error &error, lldb::addr_t &func_addr, StreamString disassembly_stream; - Error err = DisassembleFunction(disassembly_stream, process_sp); + Status err = DisassembleFunction(disassembly_stream, process_sp); if (!err.Success()) { log->Printf("Couldn't disassemble function : %s", @@ -467,7 +467,7 @@ void IRExecutionUnit::GetRunnableInfo(Error &error, lldb::addr_t &func_addr, record.dump(log); DataBufferHeap my_buffer(record.m_size, 0); - Error err; + Status err; ReadMemory(my_buffer.GetBytes(), record.m_process_address, record.m_size, err); @@ -643,7 +643,7 @@ uint8_t *IRExecutionUnit::MemoryManager::allocateCodeSection( } if (m_parent.m_reported_allocations) { - Error err; + Status err; lldb::ProcessSP process_sp = m_parent.GetBestExecutionContextScope()->CalculateProcess(); @@ -675,7 +675,7 @@ uint8_t *IRExecutionUnit::MemoryManager::allocateDataSection( } if (m_parent.m_reported_allocations) { - Error err; + Status err; lldb::ProcessSP process_sp = m_parent.GetBestExecutionContextScope()->CalculateProcess(); @@ -1104,7 +1104,7 @@ IRExecutionUnit::GetRemoteRangeForLocal(lldb::addr_t local_address) { } bool IRExecutionUnit::CommitOneAllocation(lldb::ProcessSP &process_sp, - Error &error, + Status &error, AllocationRecord &record) { if (record.m_process_address != LLDB_INVALID_ADDRESS) { return true; @@ -1145,7 +1145,7 @@ bool IRExecutionUnit::CommitOneAllocation(lldb::ProcessSP &process_sp, bool IRExecutionUnit::CommitAllocations(lldb::ProcessSP &process_sp) { bool ret = true; - lldb_private::Error err; + lldb_private::Status err; for (AllocationRecord &record : m_records) { ret = CommitOneAllocation(process_sp, err, record); @@ -1189,7 +1189,7 @@ bool IRExecutionUnit::WriteData(lldb::ProcessSP &process_sp) { bool wrote_something = false; for (AllocationRecord &record : m_records) { if (record.m_process_address != LLDB_INVALID_ADDRESS) { - lldb_private::Error err; + lldb_private::Status err; WriteMemory(record.m_process_address, (uint8_t *)record.m_host_address, record.m_size, err); if (err.Success()) diff --git a/lldb/source/Expression/IRInterpreter.cpp b/lldb/source/Expression/IRInterpreter.cpp index 6867443cdf5..6b5e22329af 100644 --- a/lldb/source/Expression/IRInterpreter.cpp +++ b/lldb/source/Expression/IRInterpreter.cpp @@ -18,8 +18,8 @@ #include "lldb/Utility/ConstString.h" #include "lldb/Utility/DataExtractor.h" #include "lldb/Utility/Endian.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/StreamString.h" #include "lldb/Target/ABI.h" @@ -189,7 +189,7 @@ public: size_t value_size = m_target_data.getTypeStoreSize(value->getType()); lldb_private::DataExtractor value_extractor; - lldb_private::Error extract_error; + lldb_private::Status extract_error; m_execution_unit.GetMemoryData(value_extractor, process_address, value_size, extract_error); @@ -224,13 +224,13 @@ public: lldb_private::DataBufferHeap buf(value_byte_size, 0); - lldb_private::Error get_data_error; + lldb_private::Status get_data_error; if (!cast_scalar.GetAsMemoryData(buf.GetBytes(), buf.GetByteSize(), m_byte_order, get_data_error)) return false; - lldb_private::Error write_error; + lldb_private::Status write_error; m_execution_unit.WriteMemory(process_address, buf.GetBytes(), buf.GetByteSize(), write_error); @@ -322,12 +322,12 @@ public: if (data_address == LLDB_INVALID_ADDRESS) return false; - lldb_private::Error write_error; + lldb_private::Status write_error; m_execution_unit.WritePointerToMemory(data_address, address, write_error); if (!write_error.Success()) { - lldb_private::Error free_error; + lldb_private::Status free_error; m_execution_unit.Free(data_address, free_error); return false; } @@ -356,7 +356,7 @@ public: size_t constant_size = m_target_data.getTypeStoreSize(constant->getType()); lldb_private::DataBufferHeap buf(constant_size, 0); - lldb_private::Error get_data_error; + lldb_private::Status get_data_error; lldb_private::Scalar resolved_scalar( resolved_value.zextOrTrunc(llvm::NextPowerOf2(constant_size) * 8)); @@ -364,7 +364,7 @@ public: m_byte_order, get_data_error)) return false; - lldb_private::Error write_error; + lldb_private::Status write_error; m_execution_unit.WriteMemory(process_address, buf.GetBytes(), buf.GetByteSize(), write_error); @@ -391,7 +391,7 @@ public: } lldb::addr_t Malloc(llvm::Type *type) { - lldb_private::Error alloc_error; + lldb_private::Status alloc_error; return Malloc(m_target_data.getTypeAllocSize(type), m_target_data.getPrefTypeAlignment(type)); @@ -402,7 +402,7 @@ public: lldb_private::DataBufferHeap buf(length, 0); - lldb_private::Error read_error; + lldb_private::Status read_error; m_execution_unit.ReadMemory(buf.GetBytes(), addr, length, read_error); @@ -433,7 +433,7 @@ public: if (const Constant *constant = dyn_cast<Constant>(value)) { if (!ResolveConstant(data_address, constant)) { - lldb_private::Error free_error; + lldb_private::Status free_error; m_execution_unit.Free(data_address, free_error); return LLDB_INVALID_ADDRESS; } @@ -499,7 +499,7 @@ static bool CanResolveConstant(llvm::Constant *constant) { } bool IRInterpreter::CanInterpret(llvm::Module &module, llvm::Function &function, - lldb_private::Error &error, + lldb_private::Status &error, const bool support_function_calls) { lldb_private::Log *log( lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); @@ -648,7 +648,7 @@ bool IRInterpreter::CanInterpret(llvm::Module &module, llvm::Function &function, bool IRInterpreter::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) { @@ -867,7 +867,7 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function, return false; } - lldb_private::Error write_error; + lldb_private::Status write_error; execution_unit.WritePointerToMemory(P, R, write_error); @@ -876,7 +876,7 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function, log->Printf("Couldn't write the result pointer for an AllocaInst"); error.SetErrorToGenericError(); error.SetErrorString(memory_write_error); - lldb_private::Error free_error; + lldb_private::Status free_error; execution_unit.Free(P, free_error); execution_unit.Free(R, free_error); return false; @@ -1349,7 +1349,7 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function, } lldb::addr_t R; - lldb_private::Error read_error; + lldb_private::Status read_error; execution_unit.ReadPointerFromMemory(&R, P, read_error); if (!read_error.Success()) { @@ -1374,7 +1374,7 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function, return false; } - lldb_private::Error write_error; + lldb_private::Status write_error; execution_unit.WriteMemory(D, buffer.GetBytes(), buffer.GetByteSize(), write_error); if (!write_error.Success()) { @@ -1442,7 +1442,7 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function, } lldb::addr_t R; - lldb_private::Error read_error; + lldb_private::Status read_error; execution_unit.ReadPointerFromMemory(&R, P, read_error); if (!read_error.Success()) { @@ -1467,7 +1467,7 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function, return false; } - lldb_private::Error write_error; + lldb_private::Status write_error; execution_unit.WriteMemory(R, buffer.GetBytes(), buffer.GetByteSize(), write_error); if (!write_error.Success()) { diff --git a/lldb/source/Expression/IRMemoryMap.cpp b/lldb/source/Expression/IRMemoryMap.cpp index 66510ac978a..817c75e66a3 100644 --- a/lldb/source/Expression/IRMemoryMap.cpp +++ b/lldb/source/Expression/IRMemoryMap.cpp @@ -14,9 +14,9 @@ #include "lldb/Target/Target.h" #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/DataExtractor.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/LLDBAssert.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" using namespace lldb_private; @@ -31,7 +31,7 @@ IRMemoryMap::~IRMemoryMap() { if (process_sp) { AllocationMap::iterator iter; - Error err; + Status err; while ((iter = m_allocations.begin()) != m_allocations.end()) { err.Clear(); @@ -66,7 +66,7 @@ lldb::addr_t IRMemoryMap::FindSpace(size_t size) { return ret; if (process_is_alive && process_sp->CanJIT()) { - Error alloc_error; + Status alloc_error; ret = process_sp->AllocateMemory(size, lldb::ePermissionsReadable | lldb::ePermissionsWritable, @@ -104,7 +104,7 @@ lldb::addr_t IRMemoryMap::FindSpace(size_t size) { end_of_memory != 0xffffffffull); MemoryRegionInfo region_info; - Error err = process_sp->GetMemoryRegionInfo(ret, region_info); + Status err = process_sp->GetMemoryRegionInfo(ret, region_info); if (err.Success()) { while (true) { if (region_info.GetReadable() != MemoryRegionInfo::OptionalBool::eNo || @@ -297,7 +297,7 @@ IRMemoryMap::Allocation::Allocation(lldb::addr_t process_alloc, lldb::addr_t IRMemoryMap::Malloc(size_t size, uint8_t alignment, uint32_t permissions, AllocationPolicy policy, - bool zero_memory, Error &error) { + bool zero_memory, Status &error) { lldb_private::Log *log( lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); error.Clear(); @@ -397,7 +397,7 @@ lldb::addr_t IRMemoryMap::Malloc(size_t size, uint8_t alignment, permissions, alignment, policy); if (zero_memory) { - Error write_error; + Status write_error; std::vector<uint8_t> zero_buf(size, 0); WriteMemory(aligned_address, zero_buf.data(), size, write_error); } @@ -429,7 +429,7 @@ lldb::addr_t IRMemoryMap::Malloc(size_t size, uint8_t alignment, return aligned_address; } -void IRMemoryMap::Leak(lldb::addr_t process_address, Error &error) { +void IRMemoryMap::Leak(lldb::addr_t process_address, Status &error) { error.Clear(); AllocationMap::iterator iter = m_allocations.find(process_address); @@ -445,7 +445,7 @@ void IRMemoryMap::Leak(lldb::addr_t process_address, Error &error) { allocation.m_leak = true; } -void IRMemoryMap::Free(lldb::addr_t process_address, Error &error) { +void IRMemoryMap::Free(lldb::addr_t process_address, Status &error) { error.Clear(); AllocationMap::iterator iter = m_allocations.find(process_address); @@ -512,7 +512,8 @@ bool IRMemoryMap::GetAllocSize(lldb::addr_t address, size_t &size) { } void IRMemoryMap::WriteMemory(lldb::addr_t process_address, - const uint8_t *bytes, size_t size, Error &error) { + const uint8_t *bytes, size_t size, + Status &error) { error.Clear(); AllocationMap::iterator iter = FindAllocation(process_address, size); @@ -587,7 +588,7 @@ void IRMemoryMap::WriteMemory(lldb::addr_t process_address, void IRMemoryMap::WriteScalarToMemory(lldb::addr_t process_address, Scalar &scalar, size_t size, - Error &error) { + Status &error) { error.Clear(); if (size == UINT32_MAX) @@ -612,7 +613,7 @@ void IRMemoryMap::WriteScalarToMemory(lldb::addr_t process_address, } void IRMemoryMap::WritePointerToMemory(lldb::addr_t process_address, - lldb::addr_t address, Error &error) { + lldb::addr_t address, Status &error) { error.Clear(); Scalar scalar(address); @@ -621,7 +622,7 @@ void IRMemoryMap::WritePointerToMemory(lldb::addr_t process_address, } void IRMemoryMap::ReadMemory(uint8_t *bytes, lldb::addr_t process_address, - size_t size, Error &error) { + size_t size, Status &error) { error.Clear(); AllocationMap::iterator iter = FindAllocation(process_address, size); @@ -717,7 +718,7 @@ void IRMemoryMap::ReadMemory(uint8_t *bytes, lldb::addr_t process_address, void IRMemoryMap::ReadScalarFromMemory(Scalar &scalar, lldb::addr_t process_address, - size_t size, Error &error) { + size_t size, Status &error) { error.Clear(); if (size > 0) { @@ -760,7 +761,7 @@ void IRMemoryMap::ReadScalarFromMemory(Scalar &scalar, void IRMemoryMap::ReadPointerFromMemory(lldb::addr_t *address, lldb::addr_t process_address, - Error &error) { + Status &error) { error.Clear(); Scalar pointer_scalar; @@ -777,7 +778,7 @@ void IRMemoryMap::ReadPointerFromMemory(lldb::addr_t *address, void IRMemoryMap::GetMemoryData(DataExtractor &extractor, lldb::addr_t process_address, size_t size, - Error &error) { + Status &error) { error.Clear(); if (size > 0) { diff --git a/lldb/source/Expression/LLVMUserExpression.cpp b/lldb/source/Expression/LLVMUserExpression.cpp index 396a7e29503..83acb8249ba 100644 --- a/lldb/source/Expression/LLVMUserExpression.cpp +++ b/lldb/source/Expression/LLVMUserExpression.cpp @@ -106,7 +106,7 @@ LLVMUserExpression::DoExecute(DiagnosticManager &diagnostic_manager, return lldb::eExpressionSetupError; } - Error interpreter_error; + Status interpreter_error; std::vector<lldb::addr_t> args; @@ -270,7 +270,7 @@ bool LLVMUserExpression::FinalizeJITExecution( return false; } - Error dematerialize_error; + Status dematerialize_error; m_dematerializer_sp->Dematerialize(dematerialize_error, function_stack_bottom, function_stack_top); @@ -309,7 +309,7 @@ bool LLVMUserExpression::PrepareToExecuteJITExpression( if (m_jit_start_addr != LLDB_INVALID_ADDRESS || m_can_interpret) { if (m_materialized_address == LLDB_INVALID_ADDRESS) { - Error alloc_error; + Status alloc_error; IRMemoryMap::AllocationPolicy policy = m_can_interpret ? IRMemoryMap::eAllocationPolicyHostOnly @@ -335,7 +335,7 @@ bool LLVMUserExpression::PrepareToExecuteJITExpression( struct_address = m_materialized_address; if (m_can_interpret && m_stack_frame_bottom == LLDB_INVALID_ADDRESS) { - Error alloc_error; + Status alloc_error; const size_t stack_frame_size = 512 * 1024; @@ -357,7 +357,7 @@ bool LLVMUserExpression::PrepareToExecuteJITExpression( } } - Error materialize_error; + Status materialize_error; m_dematerializer_sp = m_materializer_ap->Materialize( frame, *m_execution_unit_sp, struct_address, materialize_error); diff --git a/lldb/source/Expression/Materializer.cpp b/lldb/source/Expression/Materializer.cpp index 8a22daa5acd..39fc5c8c253 100644 --- a/lldb/source/Expression/Materializer.cpp +++ b/lldb/source/Expression/Materializer.cpp @@ -74,12 +74,12 @@ public: m_alignment = 8; } - void MakeAllocation(IRMemoryMap &map, Error &err) { + void MakeAllocation(IRMemoryMap &map, Status &err) { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); // Allocate a spare memory area to store the persistent variable's contents. - Error allocate_error; + Status allocate_error; const bool zero_memory = false; lldb::addr_t mem = map.Malloc( @@ -112,7 +112,7 @@ public: if (m_persistent_variable_sp->m_flags & ExpressionVariable::EVKeepInTarget) { - Error leak_error; + Status leak_error; map.Leak(mem, leak_error); m_persistent_variable_sp->m_flags &= ~ExpressionVariable::EVNeedsAllocation; @@ -120,7 +120,7 @@ public: // Write the contents of the variable to the area. - Error write_error; + Status write_error; map.WriteMemory(mem, m_persistent_variable_sp->GetValueBytes(), m_persistent_variable_sp->GetByteSize(), write_error); @@ -134,8 +134,8 @@ public: } } - void DestroyAllocation(IRMemoryMap &map, Error &err) { - Error deallocate_error; + void DestroyAllocation(IRMemoryMap &map, Status &err) { + Status deallocate_error; map.Free((lldb::addr_t)m_persistent_variable_sp->m_live_sp->GetValue() .GetScalar() @@ -153,7 +153,7 @@ public: } void Materialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map, - lldb::addr_t process_address, Error &err) override { + lldb::addr_t process_address, Status &err) override { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); const lldb::addr_t load_addr = process_address + m_offset; @@ -181,7 +181,7 @@ public: m_persistent_variable_sp->m_live_sp) || m_persistent_variable_sp->m_flags & ExpressionVariable::EVIsLLDBAllocated) { - Error write_error; + Status write_error; map.WriteScalarToMemory( load_addr, @@ -204,7 +204,7 @@ public: 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) override { + lldb::addr_t frame_bottom, Status &err) override { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); const lldb::addr_t load_addr = process_address + m_offset; @@ -234,7 +234,7 @@ public: // live variable data hasn't been set up yet. Do this now. lldb::addr_t location; - Error read_error; + Status read_error; map.ReadPointerFromMemory(&location, load_addr, read_error); @@ -304,7 +304,7 @@ public: m_persistent_variable_sp->ValueUpdated(); - Error read_error; + Status read_error; map.ReadMemory(m_persistent_variable_sp->GetValueBytes(), mem, m_persistent_variable_sp->GetByteSize(), read_error); @@ -353,7 +353,7 @@ public: Log *log) override { StreamString dump_stream; - Error err; + Status err; const lldb::addr_t load_addr = process_address + m_offset; @@ -416,7 +416,7 @@ private: uint32_t Materializer::AddPersistentVariable( lldb::ExpressionVariableSP &persistent_variable_sp, - PersistentVariableDelegate *delegate, Error &err) { + PersistentVariableDelegate *delegate, Status &err) { EntityVector::iterator iter = m_entities.insert(m_entities.end(), EntityUP()); iter->reset(new EntityPersistentVariable(persistent_variable_sp, delegate)); uint32_t ret = AddStructMember(**iter); @@ -439,7 +439,7 @@ public: } void Materialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map, - lldb::addr_t process_address, Error &err) override { + lldb::addr_t process_address, Status &err) override { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); const lldb::addr_t load_addr = process_address + m_offset; @@ -464,7 +464,7 @@ public: return; } - Error valobj_error = valobj_sp->GetError(); + Status valobj_error = valobj_sp->GetError(); if (valobj_error.Fail()) { err.SetErrorStringWithFormat("couldn't get the value of variable %s: %s", @@ -475,7 +475,7 @@ public: if (m_is_reference) { DataExtractor valobj_extractor; - Error extract_error; + Status extract_error; valobj_sp->GetData(valobj_extractor, extract_error); if (!extract_error.Success()) { @@ -488,7 +488,7 @@ public: lldb::offset_t offset = 0; lldb::addr_t reference_addr = valobj_extractor.GetAddress(&offset); - Error write_error; + Status write_error; map.WritePointerToMemory(load_addr, reference_addr, write_error); if (!write_error.Success()) { @@ -504,7 +504,7 @@ public: lldb::addr_t addr_of_valobj = valobj_sp->GetAddressOf(scalar_is_load_address, &address_type); if (addr_of_valobj != LLDB_INVALID_ADDRESS) { - Error write_error; + Status write_error; map.WritePointerToMemory(load_addr, addr_of_valobj, write_error); if (!write_error.Success()) { @@ -515,7 +515,7 @@ public: } } else { DataExtractor data; - Error extract_error; + Status extract_error; valobj_sp->GetData(data, extract_error); if (!extract_error.Success()) { err.SetErrorStringWithFormat("couldn't get the value of %s: %s", @@ -554,7 +554,7 @@ public: if (!byte_align) byte_align = 1; - Error alloc_error; + Status alloc_error; const bool zero_memory = false; m_temporary_allocation = map.Malloc( @@ -574,7 +574,7 @@ public: return; } - Error write_error; + Status write_error; map.WriteMemory(m_temporary_allocation, data.GetDataStart(), data.GetByteSize(), write_error); @@ -586,7 +586,7 @@ public: return; } - Error pointer_write_error; + Status pointer_write_error; map.WritePointerToMemory(load_addr, m_temporary_allocation, pointer_write_error); @@ -603,7 +603,7 @@ public: 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) override { + lldb::addr_t frame_bottom, Status &err) override { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); const lldb::addr_t load_addr = process_address + m_offset; @@ -631,7 +631,7 @@ public: lldb_private::DataExtractor data; - Error extract_error; + Status extract_error; map.GetMemoryData(data, m_temporary_allocation, valobj_sp->GetByteSize(), extract_error); @@ -652,7 +652,7 @@ public: } } - Error set_error; + Status set_error; if (actually_write) { valobj_sp->SetData(data, set_error); @@ -665,7 +665,7 @@ public: } } - Error free_error; + Status free_error; map.Free(m_temporary_allocation, free_error); @@ -689,7 +689,7 @@ public: const lldb::addr_t load_addr = process_address + m_offset; dump_stream.Printf("0x%" PRIx64 ": EntityVariable\n", load_addr); - Error err; + Status err; lldb::addr_t ptr = LLDB_INVALID_ADDRESS; @@ -746,7 +746,7 @@ public: void Wipe(IRMemoryMap &map, lldb::addr_t process_address) override { if (m_temporary_allocation != LLDB_INVALID_ADDRESS) { - Error free_error; + Status free_error; map.Free(m_temporary_allocation, free_error); @@ -763,7 +763,7 @@ private: lldb::DataBufferSP m_original_data; }; -uint32_t Materializer::AddVariable(lldb::VariableSP &variable_sp, Error &err) { +uint32_t Materializer::AddVariable(lldb::VariableSP &variable_sp, Status &err) { EntityVector::iterator iter = m_entities.insert(m_entities.end(), EntityUP()); iter->reset(new EntityVariable(variable_sp)); uint32_t ret = AddStructMember(**iter); @@ -787,7 +787,7 @@ public: } void Materialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map, - lldb::addr_t process_address, Error &err) override { + lldb::addr_t process_address, Status &err) override { if (!m_is_program_reference) { if (m_temporary_allocation != LLDB_INVALID_ADDRESS) { err.SetErrorString("Trying to create a temporary region for the result " @@ -806,7 +806,7 @@ public: if (!byte_align) byte_align = 1; - Error alloc_error; + Status alloc_error; const bool zero_memory = true; m_temporary_allocation = map.Malloc( @@ -822,7 +822,7 @@ public: return; } - Error pointer_write_error; + Status pointer_write_error; map.WritePointerToMemory(load_addr, m_temporary_allocation, pointer_write_error); @@ -837,7 +837,7 @@ public: 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) override { + lldb::addr_t frame_bottom, Status &err) override { err.Clear(); ExecutionContextScope *exe_scope = map.GetBestExecutionContextScope(); @@ -849,7 +849,7 @@ public: } lldb::addr_t address; - Error read_error; + Status read_error; const lldb::addr_t load_addr = process_address + m_offset; map.ReadPointerFromMemory(&address, load_addr, read_error); @@ -867,7 +867,7 @@ public: return; } - Error type_system_error; + Status type_system_error; TypeSystem *type_system = target_sp->GetScratchTypeSystemForLanguage( &type_system_error, m_type.GetMinimumLanguage()); @@ -937,7 +937,7 @@ public: ret->m_flags |= ExpressionVariable::EVNeedsAllocation; if (m_temporary_allocation != LLDB_INVALID_ADDRESS) { - Error free_error; + Status free_error; map.Free(m_temporary_allocation, free_error); } } else { @@ -956,7 +956,7 @@ public: dump_stream.Printf("0x%" PRIx64 ": EntityResultVariable\n", load_addr); - Error err; + Status err; lldb::addr_t ptr = LLDB_INVALID_ADDRESS; @@ -1013,7 +1013,7 @@ public: void Wipe(IRMemoryMap &map, lldb::addr_t process_address) override { if (!m_keep_in_memory && m_temporary_allocation != LLDB_INVALID_ADDRESS) { - Error free_error; + Status free_error; map.Free(m_temporary_allocation, free_error); } @@ -1036,7 +1036,7 @@ uint32_t Materializer::AddResultVariable(const CompilerType &type, bool is_program_reference, bool keep_in_memory, PersistentVariableDelegate *delegate, - Error &err) { + Status &err) { EntityVector::iterator iter = m_entities.insert(m_entities.end(), EntityUP()); iter->reset(new EntityResultVariable(type, is_program_reference, keep_in_memory, delegate)); @@ -1054,7 +1054,7 @@ public: } void Materialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map, - lldb::addr_t process_address, Error &err) override { + lldb::addr_t process_address, Status &err) override { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); const lldb::addr_t load_addr = process_address + m_offset; @@ -1086,7 +1086,7 @@ public: if (resolved_address == LLDB_INVALID_ADDRESS) resolved_address = sym_address.GetFileAddress(); - Error pointer_write_error; + Status pointer_write_error; map.WritePointerToMemory(load_addr, resolved_address, pointer_write_error); @@ -1100,7 +1100,7 @@ public: 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) override { + lldb::addr_t frame_bottom, Status &err) override { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); const lldb::addr_t load_addr = process_address + m_offset; @@ -1118,7 +1118,7 @@ public: Log *log) override { StreamString dump_stream; - Error err; + Status err; const lldb::addr_t load_addr = process_address + m_offset; @@ -1151,7 +1151,7 @@ private: Symbol m_symbol; }; -uint32_t Materializer::AddSymbol(const Symbol &symbol_sp, Error &err) { +uint32_t Materializer::AddSymbol(const Symbol &symbol_sp, Status &err) { EntityVector::iterator iter = m_entities.insert(m_entities.end(), EntityUP()); iter->reset(new EntitySymbol(symbol_sp)); uint32_t ret = AddStructMember(**iter); @@ -1169,7 +1169,7 @@ public: } void Materialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map, - lldb::addr_t process_address, Error &err) override { + lldb::addr_t process_address, Status &err) override { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); const lldb::addr_t load_addr = process_address + m_offset; @@ -1216,7 +1216,7 @@ public: m_register_contents.reset(new DataBufferHeap(register_data.GetDataStart(), register_data.GetByteSize())); - Error write_error; + Status write_error; map.WriteMemory(load_addr, register_data.GetDataStart(), register_data.GetByteSize(), write_error); @@ -1231,7 +1231,7 @@ public: 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) override { + lldb::addr_t frame_bottom, Status &err) override { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); const lldb::addr_t load_addr = process_address + m_offset; @@ -1242,7 +1242,7 @@ public: (uint64_t)load_addr, m_register_info.name); } - Error extract_error; + Status extract_error; DataExtractor register_data; @@ -1291,7 +1291,7 @@ public: Log *log) override { StreamString dump_stream; - Error err; + Status err; const lldb::addr_t load_addr = process_address + m_offset; @@ -1326,7 +1326,7 @@ private: }; uint32_t Materializer::AddRegister(const RegisterInfo ®ister_info, - Error &err) { + Status &err) { EntityVector::iterator iter = m_entities.insert(m_entities.end(), EntityUP()); iter->reset(new EntityRegister(register_info)); uint32_t ret = AddStructMember(**iter); @@ -1346,7 +1346,7 @@ Materializer::~Materializer() { Materializer::DematerializerSP Materializer::Materialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map, - lldb::addr_t process_address, Error &error) { + lldb::addr_t process_address, Status &error) { ExecutionContextScope *exe_scope = frame_sp.get(); if (!exe_scope) @@ -1389,7 +1389,7 @@ Materializer::Materialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map, return ret; } -void Materializer::Dematerializer::Dematerialize(Error &error, +void Materializer::Dematerializer::Dematerialize(Status &error, lldb::addr_t frame_bottom, lldb::addr_t frame_top) { lldb::StackFrameSP frame_sp; diff --git a/lldb/source/Expression/REPL.cpp b/lldb/source/Expression/REPL.cpp index e404537562b..84a6405f326 100644 --- a/lldb/source/Expression/REPL.cpp +++ b/lldb/source/Expression/REPL.cpp @@ -42,7 +42,7 @@ REPL::REPL(LLVMCastKind kind, Target &target) : m_target(target), m_kind(kind) { REPL::~REPL() = default; -lldb::REPLSP REPL::Create(Error &err, lldb::LanguageType language, +lldb::REPLSP REPL::Create(Status &err, lldb::LanguageType language, Debugger *debugger, Target *target, const char *repl_options) { uint32_t idx = 0; @@ -309,7 +309,7 @@ void REPL::IOHandlerInputComplete(IOHandler &io_handler, std::string &code) { const char *expr_prefix = nullptr; lldb::ValueObjectSP result_valobj_sp; - Error error; + Status error; lldb::ModuleSP jit_module_sp; lldb::ExpressionResults execution_results = UserExpression::Evaluate(exe_ctx, expr_options, code.c_str(), @@ -518,8 +518,8 @@ bool QuitCommandOverrideCallback(void *baton, const char **argv) { return false; } -Error REPL::RunLoop() { - Error error; +Status REPL::RunLoop() { + Status error; error = DoInitialization(); m_repl_source_path = GetSourcePath(); diff --git a/lldb/source/Expression/UserExpression.cpp b/lldb/source/Expression/UserExpression.cpp index c7cf106e19d..3386bc4577a 100644 --- a/lldb/source/Expression/UserExpression.cpp +++ b/lldb/source/Expression/UserExpression.cpp @@ -101,7 +101,7 @@ bool UserExpression::MatchesContext(ExecutionContext &exe_ctx) { lldb::addr_t UserExpression::GetObjectPointer(lldb::StackFrameSP frame_sp, ConstString &object_name, - Error &err) { + Status &err) { err.Clear(); if (!frame_sp) { @@ -140,7 +140,7 @@ lldb::addr_t UserExpression::GetObjectPointer(lldb::StackFrameSP frame_sp, lldb::ExpressionResults UserExpression::Evaluate( ExecutionContext &exe_ctx, const EvaluateExpressionOptions &options, llvm::StringRef expr, llvm::StringRef prefix, - lldb::ValueObjectSP &result_valobj_sp, Error &error, uint32_t line_offset, + lldb::ValueObjectSP &result_valobj_sp, Status &error, uint32_t line_offset, std::string *fixed_expression, lldb::ModuleSP *jit_module_sp_ptr) { Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_EXPRESSIONS | LIBLLDB_LOG_STEP)); diff --git a/lldb/source/Expression/UtilityFunction.cpp b/lldb/source/Expression/UtilityFunction.cpp index 6772fd18ac5..52f3bfc4d12 100644 --- a/lldb/source/Expression/UtilityFunction.cpp +++ b/lldb/source/Expression/UtilityFunction.cpp @@ -65,7 +65,7 @@ UtilityFunction::~UtilityFunction() { FunctionCaller *UtilityFunction::MakeFunctionCaller( const CompilerType &return_type, const ValueList &arg_value_list, - lldb::ThreadSP thread_to_use_sp, Error &error) { + lldb::ThreadSP thread_to_use_sp, Status &error) { if (m_caller_up) return m_caller_up.get(); diff --git a/lldb/source/Host/common/Editline.cpp b/lldb/source/Host/common/Editline.cpp index 851287e7633..7d4b398a171 100644 --- a/lldb/source/Host/common/Editline.cpp +++ b/lldb/source/Host/common/Editline.cpp @@ -14,10 +14,10 @@ #include "lldb/Host/ConnectionFileDescriptor.h" #include "lldb/Host/Editline.h" #include "lldb/Host/Host.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/LLDBAssert.h" #include "lldb/Utility/SelectHelper.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/StreamString.h" #include "lldb/Utility/StringList.h" #include "lldb/Utility/Timeout.h" diff --git a/lldb/source/Host/common/File.cpp b/lldb/source/Host/common/File.cpp index 1869a6db49c..3de93ebc220 100644 --- a/lldb/source/Host/common/File.cpp +++ b/lldb/source/Host/common/File.cpp @@ -157,8 +157,8 @@ void File::SetStream(FILE *fh, bool transfer_ownership) { m_own_stream = transfer_ownership; } -Error File::Open(const char *path, uint32_t options, uint32_t permissions) { - Error error; +Status File::Open(const char *path, uint32_t options, uint32_t permissions) { + Status error; if (IsValid()) Close(); @@ -246,20 +246,20 @@ Error File::Open(const char *path, uint32_t options, uint32_t permissions) { return error; } -uint32_t File::GetPermissions(const FileSpec &file_spec, Error &error) { +uint32_t File::GetPermissions(const FileSpec &file_spec, Status &error) { if (file_spec) { error.Clear(); auto Perms = llvm::sys::fs::getPermissions(file_spec.GetPath()); if (Perms) return *Perms; - error = Error(Perms.getError()); + error = Status(Perms.getError()); return 0; } else error.SetErrorString("empty file spec"); return 0; } -uint32_t File::GetPermissions(Error &error) const { +uint32_t File::GetPermissions(Status &error) const { int fd = GetDescriptor(); if (fd != kInvalidDescriptor) { struct stat file_stats; @@ -275,8 +275,8 @@ uint32_t File::GetPermissions(Error &error) const { return 0; } -Error File::Close() { - Error error; +Status File::Close() { + Status error; if (StreamIsValid() && m_own_stream) { if (::fclose(m_stream) == EOF) error.SetErrorToErrno(); @@ -305,8 +305,8 @@ void File::Clear() { eLazyBoolCalculate; } -Error File::GetFileSpec(FileSpec &file_spec) const { - Error error; +Status File::GetFileSpec(FileSpec &file_spec) const { + Status error; #ifdef F_GETPATH if (IsValid()) { char path[PATH_MAX]; @@ -340,7 +340,7 @@ Error File::GetFileSpec(FileSpec &file_spec) const { return error; } -off_t File::SeekFromStart(off_t offset, Error *error_ptr) { +off_t File::SeekFromStart(off_t offset, Status *error_ptr) { off_t result = 0; if (DescriptorIsValid()) { result = ::lseek(m_descriptor, offset, SEEK_SET); @@ -366,7 +366,7 @@ off_t File::SeekFromStart(off_t offset, Error *error_ptr) { return result; } -off_t File::SeekFromCurrent(off_t offset, Error *error_ptr) { +off_t File::SeekFromCurrent(off_t offset, Status *error_ptr) { off_t result = -1; if (DescriptorIsValid()) { result = ::lseek(m_descriptor, offset, SEEK_CUR); @@ -392,7 +392,7 @@ off_t File::SeekFromCurrent(off_t offset, Error *error_ptr) { return result; } -off_t File::SeekFromEnd(off_t offset, Error *error_ptr) { +off_t File::SeekFromEnd(off_t offset, Status *error_ptr) { off_t result = -1; if (DescriptorIsValid()) { result = ::lseek(m_descriptor, offset, SEEK_END); @@ -418,8 +418,8 @@ off_t File::SeekFromEnd(off_t offset, Error *error_ptr) { return result; } -Error File::Flush() { - Error error; +Status File::Flush() { + Status error; if (StreamIsValid()) { int err = 0; do { @@ -434,8 +434,8 @@ Error File::Flush() { return error; } -Error File::Sync() { - Error error; +Status File::Sync() { + Status error; if (DescriptorIsValid()) { #ifdef _WIN32 int err = FlushFileBuffers((HANDLE)_get_osfhandle(m_descriptor)); @@ -462,8 +462,8 @@ Error File::Sync() { #define MAX_WRITE_SIZE INT_MAX #endif -Error File::Read(void *buf, size_t &num_bytes) { - Error error; +Status File::Read(void *buf, size_t &num_bytes) { + Status error; #if defined(MAX_READ_SIZE) if (num_bytes > MAX_READ_SIZE) { @@ -524,8 +524,8 @@ Error File::Read(void *buf, size_t &num_bytes) { return error; } -Error File::Write(const void *buf, size_t &num_bytes) { - Error error; +Status File::Write(const void *buf, size_t &num_bytes) { + Status error; #if defined(MAX_WRITE_SIZE) if (num_bytes > MAX_WRITE_SIZE) { @@ -588,8 +588,8 @@ Error File::Write(const void *buf, size_t &num_bytes) { return error; } -Error File::Read(void *buf, size_t &num_bytes, off_t &offset) { - Error error; +Status File::Read(void *buf, size_t &num_bytes, off_t &offset) { + Status error; #if defined(MAX_READ_SIZE) if (num_bytes > MAX_READ_SIZE) { @@ -650,9 +650,9 @@ Error File::Read(void *buf, size_t &num_bytes, off_t &offset) { return error; } -Error File::Read(size_t &num_bytes, off_t &offset, bool null_terminate, - DataBufferSP &data_buffer_sp) { - Error error; +Status File::Read(size_t &num_bytes, off_t &offset, bool null_terminate, + DataBufferSP &data_buffer_sp) { + Status error; if (num_bytes > 0) { int fd = GetDescriptor(); @@ -694,8 +694,8 @@ Error File::Read(size_t &num_bytes, off_t &offset, bool null_terminate, return error; } -Error File::Write(const void *buf, size_t &num_bytes, off_t &offset) { - Error error; +Status File::Write(const void *buf, size_t &num_bytes, off_t &offset) { + Status error; #if defined(MAX_WRITE_SIZE) if (num_bytes > MAX_WRITE_SIZE) { diff --git a/lldb/source/Host/common/FileCache.cpp b/lldb/source/Host/common/FileCache.cpp index db71813e4ff..b4629255c85 100644 --- a/lldb/source/Host/common/FileCache.cpp +++ b/lldb/source/Host/common/FileCache.cpp @@ -24,7 +24,7 @@ FileCache &FileCache::GetInstance() { } lldb::user_id_t FileCache::OpenFile(const FileSpec &file_spec, uint32_t flags, - uint32_t mode, Error &error) { + uint32_t mode, Status &error) { std::string path(file_spec.GetPath()); if (path.empty()) { error.SetErrorString("empty path"); @@ -39,7 +39,7 @@ lldb::user_id_t FileCache::OpenFile(const FileSpec &file_spec, uint32_t flags, return fd; } -bool FileCache::CloseFile(lldb::user_id_t fd, Error &error) { +bool FileCache::CloseFile(lldb::user_id_t fd, Status &error) { if (fd == UINT64_MAX) { error.SetErrorString("invalid file descriptor"); return false; @@ -60,7 +60,8 @@ bool FileCache::CloseFile(lldb::user_id_t fd, Error &error) { } uint64_t FileCache::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) { if (fd == UINT64_MAX) { error.SetErrorString("invalid file descriptor"); return UINT64_MAX; @@ -86,7 +87,7 @@ uint64_t FileCache::WriteFile(lldb::user_id_t fd, uint64_t offset, } uint64_t FileCache::ReadFile(lldb::user_id_t fd, uint64_t offset, void *dst, - uint64_t dst_len, Error &error) { + uint64_t dst_len, Status &error) { if (fd == UINT64_MAX) { error.SetErrorString("invalid file descriptor"); return UINT64_MAX; diff --git a/lldb/source/Host/common/Host.cpp b/lldb/source/Host/common/Host.cpp index 7754d96ad33..da35022c813 100644 --- a/lldb/source/Host/common/Host.cpp +++ b/lldb/source/Host/common/Host.cpp @@ -63,9 +63,9 @@ #include "lldb/Target/UnixSignals.h" #include "lldb/Utility/CleanUp.h" #include "lldb/Utility/DataBufferLLVM.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" #include "lldb/lldb-private-forward.h" #include "llvm/ADT/SmallString.h" #include "llvm/Support/FileSystem.h" @@ -484,19 +484,19 @@ MonitorShellCommand(std::shared_ptr<ShellInfo> shell_info, lldb::pid_t pid, return true; } -Error Host::RunShellCommand(const char *command, const FileSpec &working_dir, - int *status_ptr, int *signo_ptr, - std::string *command_output_ptr, - uint32_t timeout_sec, bool run_in_default_shell) { +Status Host::RunShellCommand(const char *command, const FileSpec &working_dir, + int *status_ptr, int *signo_ptr, + std::string *command_output_ptr, + uint32_t timeout_sec, bool run_in_default_shell) { return RunShellCommand(Args(command), working_dir, status_ptr, signo_ptr, command_output_ptr, timeout_sec, run_in_default_shell); } -Error Host::RunShellCommand(const Args &args, const FileSpec &working_dir, - int *status_ptr, int *signo_ptr, - std::string *command_output_ptr, - uint32_t timeout_sec, bool run_in_default_shell) { - Error error; +Status Host::RunShellCommand(const Args &args, const FileSpec &working_dir, + int *status_ptr, int *signo_ptr, + std::string *command_output_ptr, + uint32_t timeout_sec, bool run_in_default_shell) { + Status error; ProcessLaunchInfo launch_info; launch_info.SetArchitecture(HostInfo::GetArchitecture()); if (run_in_default_shell) { @@ -654,10 +654,10 @@ short Host::GetPosixspawnFlags(const ProcessLaunchInfo &launch_info) { return flags; } -Error Host::LaunchProcessPosixSpawn(const char *exe_path, - const ProcessLaunchInfo &launch_info, - lldb::pid_t &pid) { - Error error; +Status Host::LaunchProcessPosixSpawn(const char *exe_path, + const ProcessLaunchInfo &launch_info, + lldb::pid_t &pid) { + Status error; Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST | LIBLLDB_LOG_PROCESS)); @@ -866,7 +866,7 @@ Error Host::LaunchProcessPosixSpawn(const char *exe_path, } bool Host::AddPosixSpawnFileAction(void *_file_actions, const FileAction *info, - Log *log, Error &error) { + Log *log, Status &error) { if (info == NULL) return false; @@ -947,7 +947,7 @@ bool Host::AddPosixSpawnFileAction(void *_file_actions, const FileAction *info, // The functions below implement process launching via posix_spawn() for Linux, // FreeBSD and NetBSD. -Error Host::LaunchProcess(ProcessLaunchInfo &launch_info) { +Status Host::LaunchProcess(ProcessLaunchInfo &launch_info) { std::unique_ptr<ProcessLauncher> delegate_launcher; #if defined(_WIN32) delegate_launcher.reset(new ProcessLauncherWindows()); @@ -958,7 +958,7 @@ Error Host::LaunchProcess(ProcessLaunchInfo &launch_info) { #endif MonitoringProcessLauncher launcher(std::move(delegate_launcher)); - Error error; + Status error; HostProcess process = launcher.LaunchProcess(launch_info, error); // TODO(zturner): It would be better if the entire HostProcess were returned diff --git a/lldb/source/Host/common/HostProcess.cpp b/lldb/source/Host/common/HostProcess.cpp index 2d99d8e1fc9..15403332151 100644 --- a/lldb/source/Host/common/HostProcess.cpp +++ b/lldb/source/Host/common/HostProcess.cpp @@ -21,9 +21,9 @@ HostProcess::HostProcess(lldb::process_t process) HostProcess::~HostProcess() {} -Error HostProcess::Terminate() { return m_native_process->Terminate(); } +Status HostProcess::Terminate() { return m_native_process->Terminate(); } -Error HostProcess::GetMainModule(FileSpec &file_spec) const { +Status HostProcess::GetMainModule(FileSpec &file_spec) const { return m_native_process->GetMainModule(file_spec); } diff --git a/lldb/source/Host/common/HostThread.cpp b/lldb/source/Host/common/HostThread.cpp index 738b7ef72f1..02882c52390 100644 --- a/lldb/source/Host/common/HostThread.cpp +++ b/lldb/source/Host/common/HostThread.cpp @@ -18,11 +18,11 @@ HostThread::HostThread() : m_native_thread(new HostNativeThread) {} HostThread::HostThread(lldb::thread_t thread) : m_native_thread(new HostNativeThread(thread)) {} -Error HostThread::Join(lldb::thread_result_t *result) { +Status HostThread::Join(lldb::thread_result_t *result) { return m_native_thread->Join(result); } -Error HostThread::Cancel() { return m_native_thread->Cancel(); } +Status HostThread::Cancel() { return m_native_thread->Cancel(); } void HostThread::Reset() { return m_native_thread->Reset(); } diff --git a/lldb/source/Host/common/LockFileBase.cpp b/lldb/source/Host/common/LockFileBase.cpp index b30acc5d504..a8d7881ab89 100644 --- a/lldb/source/Host/common/LockFileBase.cpp +++ b/lldb/source/Host/common/LockFileBase.cpp @@ -14,9 +14,9 @@ using namespace lldb_private; namespace { -Error AlreadyLocked() { return Error("Already locked"); } +Status AlreadyLocked() { return Status("Already locked"); } -Error NotLocked() { return Error("Not locked"); } +Status NotLocked() { return Status("Not locked"); } } LockFileBase::LockFileBase(int fd) @@ -24,31 +24,31 @@ LockFileBase::LockFileBase(int fd) bool LockFileBase::IsLocked() const { return m_locked; } -Error LockFileBase::WriteLock(const uint64_t start, const uint64_t len) { +Status LockFileBase::WriteLock(const uint64_t start, const uint64_t len) { return DoLock([&](const uint64_t start, const uint64_t len) { return DoWriteLock(start, len); }, start, len); } -Error LockFileBase::TryWriteLock(const uint64_t start, const uint64_t len) { +Status LockFileBase::TryWriteLock(const uint64_t start, const uint64_t len) { return DoLock([&](const uint64_t start, const uint64_t len) { return DoTryWriteLock(start, len); }, start, len); } -Error LockFileBase::ReadLock(const uint64_t start, const uint64_t len) { +Status LockFileBase::ReadLock(const uint64_t start, const uint64_t len) { return DoLock([&](const uint64_t start, const uint64_t len) { return DoReadLock(start, len); }, start, len); } -Error LockFileBase::TryReadLock(const uint64_t start, const uint64_t len) { +Status LockFileBase::TryReadLock(const uint64_t start, const uint64_t len) { return DoLock([&](const uint64_t start, const uint64_t len) { return DoTryReadLock(start, len); }, start, len); } -Error LockFileBase::Unlock() { +Status LockFileBase::Unlock() { if (!IsLocked()) return NotLocked(); @@ -63,10 +63,10 @@ Error LockFileBase::Unlock() { bool LockFileBase::IsValidFile() const { return m_fd != -1; } -Error LockFileBase::DoLock(const Locker &locker, const uint64_t start, - const uint64_t len) { +Status LockFileBase::DoLock(const Locker &locker, const uint64_t start, + const uint64_t len) { if (!IsValidFile()) - return Error("File is invalid"); + return Status("File is invalid"); if (IsLocked()) return AlreadyLocked(); diff --git a/lldb/source/Host/common/MainLoop.cpp b/lldb/source/Host/common/MainLoop.cpp index abd52f7f46f..7de6f7fa865 100644 --- a/lldb/source/Host/common/MainLoop.cpp +++ b/lldb/source/Host/common/MainLoop.cpp @@ -10,13 +10,13 @@ #include "llvm/Config/llvm-config.h" #include "lldb/Host/MainLoop.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include <algorithm> #include <cassert> #include <cerrno> #include <csignal> -#include <vector> #include <time.h> +#include <vector> // Multiplexing is implemented using kqueue on systems that support it (BSD // variants including OSX). On linux we use ppoll, while android uses pselect @@ -73,7 +73,7 @@ public: RunImpl(MainLoop &loop); ~RunImpl() = default; - Error Poll(); + Status Poll(); void ProcessEvents(); private: @@ -100,7 +100,7 @@ MainLoop::RunImpl::RunImpl(MainLoop &loop) : loop(loop) { in_events.reserve(loop.m_read_fds.size()); } -Error MainLoop::RunImpl::Poll() { +Status MainLoop::RunImpl::Poll() { in_events.resize(loop.m_read_fds.size()); unsigned i = 0; for (auto &fd : loop.m_read_fds) @@ -110,8 +110,8 @@ Error MainLoop::RunImpl::Poll() { out_events, llvm::array_lengthof(out_events), nullptr); if (num_events < 0) - return Error("kevent() failed with error %d\n", num_events); - return Error(); + return Status("kevent() failed with error %d\n", num_events); + return Status(); } void MainLoop::RunImpl::ProcessEvents() { @@ -154,7 +154,7 @@ sigset_t MainLoop::RunImpl::get_sigmask() { } #ifdef FORCE_PSELECT -Error MainLoop::RunImpl::Poll() { +Status MainLoop::RunImpl::Poll() { FD_ZERO(&read_fd_set); int nfds = 0; for (const auto &fd : loop.m_read_fds) { @@ -165,12 +165,12 @@ Error MainLoop::RunImpl::Poll() { sigset_t sigmask = get_sigmask(); if (pselect(nfds, &read_fd_set, nullptr, nullptr, nullptr, &sigmask) == -1 && errno != EINTR) - return Error(errno, eErrorTypePOSIX); + return Status(errno, eErrorTypePOSIX); - return Error(); + return Status(); } #else -Error MainLoop::RunImpl::Poll() { +Status MainLoop::RunImpl::Poll() { read_fds.clear(); sigset_t sigmask = get_sigmask(); @@ -185,9 +185,9 @@ Error MainLoop::RunImpl::Poll() { if (ppoll(read_fds.data(), read_fds.size(), nullptr, &sigmask) == -1 && errno != EINTR) - return Error(errno, eErrorTypePOSIX); + return Status(errno, eErrorTypePOSIX); - return Error(); + return Status(); } #endif @@ -234,9 +234,9 @@ MainLoop::~MainLoop() { assert(m_signals.size() == 0); } -MainLoop::ReadHandleUP -MainLoop::RegisterReadObject(const IOObjectSP &object_sp, - const Callback &callback, Error &error) { +MainLoop::ReadHandleUP MainLoop::RegisterReadObject(const IOObjectSP &object_sp, + const Callback &callback, + Status &error) { #ifdef LLVM_ON_WIN32 if (object_sp->GetFdType() != IOObject:: eFDTypeSocket) { error.SetErrorString("MainLoop: non-socket types unsupported on Windows"); @@ -263,8 +263,7 @@ MainLoop::RegisterReadObject(const IOObjectSP &object_sp, // be unblocked in // the Run() function to check for signal delivery. MainLoop::SignalHandleUP -MainLoop::RegisterSignal(int signo, const Callback &callback, - Error &error) { +MainLoop::RegisterSignal(int signo, const Callback &callback, Status &error) { #ifdef SIGNAL_POLLING_UNSUPPORTED error.SetErrorString("Signal polling is not supported on this platform."); return nullptr; @@ -318,7 +317,7 @@ void MainLoop::UnregisterReadObject(IOObject::WaitableHandle handle) { void MainLoop::UnregisterSignal(int signo) { #if SIGNAL_POLLING_UNSUPPORTED - Error("Signal polling is not supported on this platform."); + Status("Signal polling is not supported on this platform."); #else auto it = m_signals.find(signo); assert(it != m_signals.end()); @@ -344,10 +343,10 @@ void MainLoop::UnregisterSignal(int signo) { #endif } -Error MainLoop::Run() { +Status MainLoop::Run() { m_terminate_request = false; - - Error error; + + Status error; RunImpl impl(*this); // run until termination or until we run out of things to listen to @@ -360,9 +359,9 @@ Error MainLoop::Run() { impl.ProcessEvents(); if (m_terminate_request) - return Error(); + return Status(); } - return Error(); + return Status(); } void MainLoop::ProcessSignal(int signo) { diff --git a/lldb/source/Host/common/MonitoringProcessLauncher.cpp b/lldb/source/Host/common/MonitoringProcessLauncher.cpp index 2aa6c7f50b6..f1fcd0b44c1 100644 --- a/lldb/source/Host/common/MonitoringProcessLauncher.cpp +++ b/lldb/source/Host/common/MonitoringProcessLauncher.cpp @@ -14,8 +14,8 @@ #include "lldb/Target/Platform.h" #include "lldb/Target/Process.h" #include "lldb/Target/ProcessLaunchInfo.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" #include "llvm/Support/FileSystem.h" @@ -28,7 +28,7 @@ MonitoringProcessLauncher::MonitoringProcessLauncher( HostProcess MonitoringProcessLauncher::LaunchProcess(const ProcessLaunchInfo &launch_info, - Error &error) { + Status &error) { ProcessLaunchInfo resolved_info(launch_info); error.Clear(); diff --git a/lldb/source/Host/common/NativeBreakpoint.cpp b/lldb/source/Host/common/NativeBreakpoint.cpp index 8a3ee72179c..5eee3de482c 100644 --- a/lldb/source/Host/common/NativeBreakpoint.cpp +++ b/lldb/source/Host/common/NativeBreakpoint.cpp @@ -9,8 +9,8 @@ #include "lldb/Host/common/NativeBreakpoint.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" #include "lldb/lldb-defines.h" using namespace lldb_private; @@ -44,7 +44,7 @@ int32_t NativeBreakpoint::DecRef() { return m_ref_count; } -Error NativeBreakpoint::Enable() { +Status NativeBreakpoint::Enable() { Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); if (m_enabled) { @@ -53,7 +53,7 @@ Error NativeBreakpoint::Enable() { log->Printf("NativeBreakpoint::%s addr = 0x%" PRIx64 " already enabled, ignoring.", __FUNCTION__, m_addr); - return Error(); + return Status(); } // Log and enable. @@ -61,7 +61,7 @@ Error NativeBreakpoint::Enable() { log->Printf("NativeBreakpoint::%s addr = 0x%" PRIx64 " enabling...", __FUNCTION__, m_addr); - Error error = DoEnable(); + Status error = DoEnable(); if (error.Success()) { m_enabled = true; if (log) @@ -76,7 +76,7 @@ Error NativeBreakpoint::Enable() { return error; } -Error NativeBreakpoint::Disable() { +Status NativeBreakpoint::Disable() { Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); if (!m_enabled) { @@ -85,7 +85,7 @@ Error NativeBreakpoint::Disable() { log->Printf("NativeBreakpoint::%s addr = 0x%" PRIx64 " already disabled, ignoring.", __FUNCTION__, m_addr); - return Error(); + return Status(); } // Log and disable. @@ -93,7 +93,7 @@ Error NativeBreakpoint::Disable() { log->Printf("NativeBreakpoint::%s addr = 0x%" PRIx64 " disabling...", __FUNCTION__, m_addr); - Error error = DoDisable(); + Status error = DoDisable(); if (error.Success()) { m_enabled = false; if (log) diff --git a/lldb/source/Host/common/NativeBreakpointList.cpp b/lldb/source/Host/common/NativeBreakpointList.cpp index 60608a0bbc5..ce5eb94a8d1 100644 --- a/lldb/source/Host/common/NativeBreakpointList.cpp +++ b/lldb/source/Host/common/NativeBreakpointList.cpp @@ -19,9 +19,9 @@ using namespace lldb_private; NativeBreakpointList::NativeBreakpointList() : m_mutex() {} -Error NativeBreakpointList::AddRef(lldb::addr_t addr, size_t size_hint, - bool hardware, - CreateBreakpointFunc create_func) { +Status NativeBreakpointList::AddRef(lldb::addr_t addr, size_t size_hint, + bool hardware, + CreateBreakpointFunc create_func) { Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); if (log) log->Printf("NativeBreakpointList::%s addr = 0x%" PRIx64 @@ -40,7 +40,7 @@ Error NativeBreakpointList::AddRef(lldb::addr_t addr, size_t size_hint, __FUNCTION__, addr); iter->second->AddRef(); - return Error(); + return Status(); } // Create a new breakpoint using the given create func. @@ -51,7 +51,7 @@ Error NativeBreakpointList::AddRef(lldb::addr_t addr, size_t size_hint, __FUNCTION__, addr, size_hint, hardware ? "true" : "false"); NativeBreakpointSP breakpoint_sp; - Error error = create_func(addr, size_hint, hardware, breakpoint_sp); + Status error = create_func(addr, size_hint, hardware, breakpoint_sp); if (error.Fail()) { if (log) log->Printf( @@ -70,8 +70,8 @@ Error NativeBreakpointList::AddRef(lldb::addr_t addr, size_t size_hint, return error; } -Error NativeBreakpointList::DecRef(lldb::addr_t addr) { - Error error; +Status NativeBreakpointList::DecRef(lldb::addr_t addr) { + Status error; Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); if (log) @@ -142,7 +142,7 @@ Error NativeBreakpointList::DecRef(lldb::addr_t addr) { return error; } -Error NativeBreakpointList::EnableBreakpoint(lldb::addr_t addr) { +Status NativeBreakpointList::EnableBreakpoint(lldb::addr_t addr) { Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); if (log) log->Printf("NativeBreakpointList::%s addr = 0x%" PRIx64, __FUNCTION__, @@ -157,14 +157,14 @@ Error NativeBreakpointList::EnableBreakpoint(lldb::addr_t addr) { if (log) log->Printf("NativeBreakpointList::%s addr = 0x%" PRIx64 " -- NOT FOUND", __FUNCTION__, addr); - return Error("breakpoint not found"); + return Status("breakpoint not found"); } // Enable it. return iter->second->Enable(); } -Error NativeBreakpointList::DisableBreakpoint(lldb::addr_t addr) { +Status NativeBreakpointList::DisableBreakpoint(lldb::addr_t addr) { Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); if (log) log->Printf("NativeBreakpointList::%s addr = 0x%" PRIx64, __FUNCTION__, @@ -179,15 +179,15 @@ Error NativeBreakpointList::DisableBreakpoint(lldb::addr_t addr) { if (log) log->Printf("NativeBreakpointList::%s addr = 0x%" PRIx64 " -- NOT FOUND", __FUNCTION__, addr); - return Error("breakpoint not found"); + return Status("breakpoint not found"); } // Disable it. return iter->second->Disable(); } -Error NativeBreakpointList::GetBreakpoint(lldb::addr_t addr, - NativeBreakpointSP &breakpoint_sp) { +Status NativeBreakpointList::GetBreakpoint(lldb::addr_t addr, + NativeBreakpointSP &breakpoint_sp) { Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); if (log) log->Printf("NativeBreakpointList::%s addr = 0x%" PRIx64, __FUNCTION__, @@ -200,16 +200,16 @@ Error NativeBreakpointList::GetBreakpoint(lldb::addr_t addr, if (iter == m_breakpoints.end()) { // Not found! breakpoint_sp.reset(); - return Error("breakpoint not found"); + return Status("breakpoint not found"); } // Disable it. breakpoint_sp = iter->second; - return Error(); + return Status(); } -Error NativeBreakpointList::RemoveTrapsFromBuffer(lldb::addr_t addr, void *buf, - size_t size) const { +Status NativeBreakpointList::RemoveTrapsFromBuffer(lldb::addr_t addr, void *buf, + size_t size) const { for (const auto &map : m_breakpoints) { lldb::addr_t bp_addr = map.first; // Breapoint not in range, ignore @@ -225,5 +225,5 @@ Error NativeBreakpointList::RemoveTrapsFromBuffer(lldb::addr_t addr, void *buf, auto opcode_size = software_bp_sp->m_opcode_size; ::memcpy(opcode_addr, saved_opcodes, opcode_size); } - return Error(); + return Status(); } diff --git a/lldb/source/Host/common/NativeProcessProtocol.cpp b/lldb/source/Host/common/NativeProcessProtocol.cpp index 9d4149d700b..6f1a9f895b6 100644 --- a/lldb/source/Host/common/NativeProcessProtocol.cpp +++ b/lldb/source/Host/common/NativeProcessProtocol.cpp @@ -36,8 +36,8 @@ NativeProcessProtocol::NativeProcessProtocol(lldb::pid_t pid) m_delegates_mutex(), m_delegates(), m_breakpoint_list(), m_watchpoint_list(), m_terminal_fd(-1), m_stop_id(0) {} -lldb_private::Error NativeProcessProtocol::Interrupt() { - Error error; +lldb_private::Status NativeProcessProtocol::Interrupt() { + Status error; #if !defined(SIGSTOP) error.SetErrorString("local host does not support signaling"); return error; @@ -46,17 +46,17 @@ lldb_private::Error NativeProcessProtocol::Interrupt() { #endif } -Error NativeProcessProtocol::IgnoreSignals(llvm::ArrayRef<int> signals) { +Status NativeProcessProtocol::IgnoreSignals(llvm::ArrayRef<int> signals) { m_signals_to_ignore.clear(); m_signals_to_ignore.insert(signals.begin(), signals.end()); - return Error(); + return Status(); } -lldb_private::Error +lldb_private::Status NativeProcessProtocol::GetMemoryRegionInfo(lldb::addr_t load_addr, MemoryRegionInfo &range_info) { // Default: not implemented. - return Error("not implemented"); + return Status("not implemented"); } bool NativeProcessProtocol::GetExitStatus(ExitType *exit_type, int *status, @@ -173,9 +173,9 @@ NativeProcessProtocol::GetHardwareDebugSupportInfo() const { reg_ctx_sp->NumSupportedHardwareWatchpoints()); } -Error NativeProcessProtocol::SetWatchpoint(lldb::addr_t addr, size_t size, - uint32_t watch_flags, - bool hardware) { +Status NativeProcessProtocol::SetWatchpoint(lldb::addr_t addr, size_t size, + uint32_t watch_flags, + bool hardware) { // This default implementation assumes setting the watchpoint for // the process will require setting the watchpoint for each of the // threads. Furthermore, it will track watchpoints set for the @@ -205,7 +205,7 @@ Error NativeProcessProtocol::SetWatchpoint(lldb::addr_t addr, size_t size, if (!thread_sp) continue; - Error thread_error = + Status thread_error = thread_sp->SetWatchpoint(addr, size, watch_flags, hardware); if (thread_error.Fail() && hardware) { // Try software watchpoints since we failed on hardware watchpoint setting @@ -227,7 +227,7 @@ Error NativeProcessProtocol::SetWatchpoint(lldb::addr_t addr, size_t size, // set so that we get back to a consistent state of "not // set" for the watchpoint. for (auto unwatch_thread_sp : watchpoint_established_threads) { - Error remove_error = unwatch_thread_sp->RemoveWatchpoint(addr); + Status remove_error = unwatch_thread_sp->RemoveWatchpoint(addr); if (remove_error.Fail() && log) { log->Warning("NativeProcessProtocol::%s (): RemoveWatchpoint failed " "for pid=%" PRIu64 ", tid=%" PRIu64 ": %s", @@ -242,11 +242,11 @@ Error NativeProcessProtocol::SetWatchpoint(lldb::addr_t addr, size_t size, return m_watchpoint_list.Add(addr, size, watch_flags, hardware); } -Error NativeProcessProtocol::RemoveWatchpoint(lldb::addr_t addr) { +Status NativeProcessProtocol::RemoveWatchpoint(lldb::addr_t addr) { // Update the thread list UpdateThreads(); - Error overall_error; + Status overall_error; std::lock_guard<std::recursive_mutex> guard(m_threads_mutex); for (auto thread_sp : m_threads) { @@ -254,7 +254,7 @@ Error NativeProcessProtocol::RemoveWatchpoint(lldb::addr_t addr) { if (!thread_sp) continue; - const Error thread_error = thread_sp->RemoveWatchpoint(addr); + const Status thread_error = thread_sp->RemoveWatchpoint(addr); if (thread_error.Fail()) { // Keep track of the first thread error if any threads // fail. We want to try to remove the watchpoint from @@ -263,7 +263,7 @@ Error NativeProcessProtocol::RemoveWatchpoint(lldb::addr_t addr) { overall_error = thread_error; } } - const Error error = m_watchpoint_list.Remove(addr); + const Status error = m_watchpoint_list.Remove(addr); return overall_error.Fail() ? overall_error : error; } @@ -272,8 +272,8 @@ NativeProcessProtocol::GetHardwareBreakpointMap() const { return m_hw_breakpoints_map; } -Error NativeProcessProtocol::SetHardwareBreakpoint(lldb::addr_t addr, - size_t size) { +Status NativeProcessProtocol::SetHardwareBreakpoint(lldb::addr_t addr, + size_t size) { // This default implementation assumes setting a hardware breakpoint for // this process will require setting same hardware breakpoint for each // of its existing threads. New thread will do the same once created. @@ -287,7 +287,7 @@ Error NativeProcessProtocol::SetHardwareBreakpoint(lldb::addr_t addr, if (hw_debug_cap == llvm::None || hw_debug_cap->first == 0 || hw_debug_cap->first <= m_hw_breakpoints_map.size()) - return Error("Target does not have required no of hardware breakpoints"); + return Status("Target does not have required no of hardware breakpoints"); // Vector below stores all thread pointer for which we have we successfully // set this hardware breakpoint. If any of the current process threads fails @@ -302,7 +302,7 @@ Error NativeProcessProtocol::SetHardwareBreakpoint(lldb::addr_t addr, if (!thread_sp) continue; - Error thread_error = thread_sp->SetHardwareBreakpoint(addr, size); + Status thread_error = thread_sp->SetHardwareBreakpoint(addr, size); if (thread_error.Success()) { // Remember that we set this breakpoint successfully in // case we need to clear it later. @@ -312,7 +312,8 @@ Error NativeProcessProtocol::SetHardwareBreakpoint(lldb::addr_t addr, // set so that we get back to a consistent state of "not // set" for this hardware breakpoint. for (auto rollback_thread_sp : breakpoint_established_threads) { - Error remove_error = rollback_thread_sp->RemoveHardwareBreakpoint(addr); + Status remove_error = + rollback_thread_sp->RemoveHardwareBreakpoint(addr); if (remove_error.Fail() && log) { log->Warning("NativeProcessProtocol::%s (): RemoveHardwareBreakpoint" " failed for pid=%" PRIu64 ", tid=%" PRIu64 ": %s", @@ -329,14 +330,14 @@ Error NativeProcessProtocol::SetHardwareBreakpoint(lldb::addr_t addr, // process. m_hw_breakpoints_map[addr] = {addr, size}; - return Error(); + return Status(); } -Error NativeProcessProtocol::RemoveHardwareBreakpoint(lldb::addr_t addr) { +Status NativeProcessProtocol::RemoveHardwareBreakpoint(lldb::addr_t addr) { // Update the thread list UpdateThreads(); - Error error; + Status error; std::lock_guard<std::recursive_mutex> guard(m_threads_mutex); for (auto thread_sp : m_threads) { @@ -413,8 +414,8 @@ void NativeProcessProtocol::NotifyDidExec() { } } -Error NativeProcessProtocol::SetSoftwareBreakpoint(lldb::addr_t addr, - uint32_t size_hint) { +Status NativeProcessProtocol::SetSoftwareBreakpoint(lldb::addr_t addr, + uint32_t size_hint) { Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); if (log) log->Printf("NativeProcessProtocol::%s addr = 0x%" PRIx64, __FUNCTION__, @@ -423,25 +424,25 @@ Error NativeProcessProtocol::SetSoftwareBreakpoint(lldb::addr_t addr, return m_breakpoint_list.AddRef( addr, size_hint, false, [this](lldb::addr_t addr, size_t size_hint, bool /* hardware */, - NativeBreakpointSP &breakpoint_sp) -> Error { + NativeBreakpointSP &breakpoint_sp) -> Status { return SoftwareBreakpoint::CreateSoftwareBreakpoint( *this, addr, size_hint, breakpoint_sp); }); } -Error NativeProcessProtocol::RemoveBreakpoint(lldb::addr_t addr, - bool hardware) { +Status NativeProcessProtocol::RemoveBreakpoint(lldb::addr_t addr, + bool hardware) { if (hardware) return RemoveHardwareBreakpoint(addr); else return m_breakpoint_list.DecRef(addr); } -Error NativeProcessProtocol::EnableBreakpoint(lldb::addr_t addr) { +Status NativeProcessProtocol::EnableBreakpoint(lldb::addr_t addr) { return m_breakpoint_list.EnableBreakpoint(addr); } -Error NativeProcessProtocol::DisableBreakpoint(lldb::addr_t addr) { +Status NativeProcessProtocol::DisableBreakpoint(lldb::addr_t addr) { return m_breakpoint_list.DisableBreakpoint(addr); } @@ -483,25 +484,26 @@ void NativeProcessProtocol::DoStopIDBumped(uint32_t /* newBumpId */) { // Default implementation does nothing. } -Error NativeProcessProtocol::ResolveProcessArchitecture(lldb::pid_t pid, - ArchSpec &arch) { +Status NativeProcessProtocol::ResolveProcessArchitecture(lldb::pid_t pid, + ArchSpec &arch) { // Grab process info for the running process. ProcessInstanceInfo process_info; if (!Host::GetProcessInfo(pid, process_info)) - return Error("failed to get process info"); + return Status("failed to get process info"); // Resolve the executable module. ModuleSpecList module_specs; if (!ObjectFile::GetModuleSpecifications(process_info.GetExecutableFile(), 0, 0, module_specs)) - return Error("failed to get module specifications"); + return Status("failed to get module specifications"); lldbassert(module_specs.GetSize() == 1); arch = module_specs.GetModuleSpecRefAtIndex(0).GetArchitecture(); if (arch.IsValid()) - return Error(); + return Status(); else - return Error("failed to retrieve a valid architecture from the exe module"); + return Status( + "failed to retrieve a valid architecture from the exe module"); } #if !defined(__linux__) && !defined(__NetBSD__) @@ -509,17 +511,17 @@ Error NativeProcessProtocol::ResolveProcessArchitecture(lldb::pid_t pid, // Stubs are // provided to make the rest of the code link on non-supported platforms. -Error NativeProcessProtocol::Launch(ProcessLaunchInfo &launch_info, - NativeDelegate &native_delegate, - MainLoop &mainloop, - NativeProcessProtocolSP &process_sp) { +Status NativeProcessProtocol::Launch(ProcessLaunchInfo &launch_info, + NativeDelegate &native_delegate, + MainLoop &mainloop, + NativeProcessProtocolSP &process_sp) { llvm_unreachable("Platform has no NativeProcessProtocol support"); } -Error NativeProcessProtocol::Attach(lldb::pid_t pid, - NativeDelegate &native_delegate, - MainLoop &mainloop, - NativeProcessProtocolSP &process_sp) { +Status NativeProcessProtocol::Attach(lldb::pid_t pid, + NativeDelegate &native_delegate, + MainLoop &mainloop, + NativeProcessProtocolSP &process_sp) { llvm_unreachable("Platform has no NativeProcessProtocol support"); } diff --git a/lldb/source/Host/common/NativeRegisterContext.cpp b/lldb/source/Host/common/NativeRegisterContext.cpp index 3bc0a0d9705..2ca95d70796 100644 --- a/lldb/source/Host/common/NativeRegisterContext.cpp +++ b/lldb/source/Host/common/NativeRegisterContext.cpp @@ -138,7 +138,7 @@ NativeRegisterContext::GetPCfromBreakpointLocation(lldb::addr_t fail_value) { return GetPC(fail_value); } -Error NativeRegisterContext::SetPC(lldb::addr_t pc) { +Status NativeRegisterContext::SetPC(lldb::addr_t pc) { uint32_t reg = ConvertRegisterKindToRegisterNumber(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_PC); return WriteRegisterFromUnsigned(reg, pc); @@ -150,7 +150,7 @@ lldb::addr_t NativeRegisterContext::GetSP(lldb::addr_t fail_value) { return ReadRegisterAsUnsigned(reg, fail_value); } -Error NativeRegisterContext::SetSP(lldb::addr_t sp) { +Status NativeRegisterContext::SetSP(lldb::addr_t sp) { uint32_t reg = ConvertRegisterKindToRegisterNumber(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_SP); return WriteRegisterFromUnsigned(reg, sp); @@ -162,7 +162,7 @@ lldb::addr_t NativeRegisterContext::GetFP(lldb::addr_t fail_value) { return ReadRegisterAsUnsigned(reg, fail_value); } -Error NativeRegisterContext::SetFP(lldb::addr_t fp) { +Status NativeRegisterContext::SetFP(lldb::addr_t fp) { uint32_t reg = ConvertRegisterKindToRegisterNumber(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_FP); return WriteRegisterFromUnsigned(reg, fp); @@ -195,7 +195,7 @@ NativeRegisterContext::ReadRegisterAsUnsigned(const RegisterInfo *reg_info, if (reg_info) { RegisterValue value; - Error error = ReadRegister(reg_info, value); + Status error = ReadRegister(reg_info, value); if (error.Success()) { if (log) log->Printf("NativeRegisterContext::%s ReadRegister() succeeded, value " @@ -215,22 +215,23 @@ NativeRegisterContext::ReadRegisterAsUnsigned(const RegisterInfo *reg_info, return fail_value; } -Error NativeRegisterContext::WriteRegisterFromUnsigned(uint32_t reg, - uint64_t uval) { +Status NativeRegisterContext::WriteRegisterFromUnsigned(uint32_t reg, + uint64_t uval) { if (reg == LLDB_INVALID_REGNUM) - return Error("NativeRegisterContext::%s (): reg is invalid", __FUNCTION__); + return Status("NativeRegisterContext::%s (): reg is invalid", __FUNCTION__); return WriteRegisterFromUnsigned(GetRegisterInfoAtIndex(reg), uval); } -Error NativeRegisterContext::WriteRegisterFromUnsigned( - const RegisterInfo *reg_info, uint64_t uval) { +Status +NativeRegisterContext::WriteRegisterFromUnsigned(const RegisterInfo *reg_info, + uint64_t uval) { assert(reg_info); if (!reg_info) - return Error("reg_info is nullptr"); + return Status("reg_info is nullptr"); RegisterValue value; if (!value.SetUInt(uval, reg_info->byte_size)) - return Error("RegisterValue::SetUInt () failed"); + return Status("RegisterValue::SetUInt () failed"); return WriteRegister(reg_info, value); } @@ -246,18 +247,18 @@ uint32_t NativeRegisterContext::SetHardwareBreakpoint(lldb::addr_t addr, return LLDB_INVALID_INDEX32; } -Error NativeRegisterContext::ClearAllHardwareBreakpoints() { - return Error("not implemented"); +Status NativeRegisterContext::ClearAllHardwareBreakpoints() { + return Status("not implemented"); } bool NativeRegisterContext::ClearHardwareBreakpoint(uint32_t hw_idx) { return false; } -Error NativeRegisterContext::GetHardwareBreakHitIndex(uint32_t &bp_index, - lldb::addr_t trap_addr) { +Status NativeRegisterContext::GetHardwareBreakHitIndex(uint32_t &bp_index, + lldb::addr_t trap_addr) { bp_index = LLDB_INVALID_INDEX32; - return Error("not implemented"); + return Status("not implemented"); } uint32_t NativeRegisterContext::NumSupportedHardwareWatchpoints() { return 0; } @@ -272,25 +273,25 @@ bool NativeRegisterContext::ClearHardwareWatchpoint(uint32_t hw_index) { return false; } -Error NativeRegisterContext::ClearAllHardwareWatchpoints() { - return Error("not implemented"); +Status NativeRegisterContext::ClearAllHardwareWatchpoints() { + return Status("not implemented"); } -Error NativeRegisterContext::IsWatchpointHit(uint32_t wp_index, bool &is_hit) { +Status NativeRegisterContext::IsWatchpointHit(uint32_t wp_index, bool &is_hit) { is_hit = false; - return Error("not implemented"); + return Status("not implemented"); } -Error NativeRegisterContext::GetWatchpointHitIndex(uint32_t &wp_index, - lldb::addr_t trap_addr) { +Status NativeRegisterContext::GetWatchpointHitIndex(uint32_t &wp_index, + lldb::addr_t trap_addr) { wp_index = LLDB_INVALID_INDEX32; - return Error("not implemented"); + return Status("not implemented"); } -Error NativeRegisterContext::IsWatchpointVacant(uint32_t wp_index, - bool &is_vacant) { +Status NativeRegisterContext::IsWatchpointVacant(uint32_t wp_index, + bool &is_vacant) { is_vacant = false; - return Error("not implemented"); + return Status("not implemented"); } lldb::addr_t NativeRegisterContext::GetWatchpointAddress(uint32_t wp_index) { @@ -303,10 +304,10 @@ lldb::addr_t NativeRegisterContext::GetWatchpointHitAddress(uint32_t wp_index) { bool NativeRegisterContext::HardwareSingleStep(bool enable) { return false; } -Error NativeRegisterContext::ReadRegisterValueFromMemory( +Status NativeRegisterContext::ReadRegisterValueFromMemory( const RegisterInfo *reg_info, lldb::addr_t src_addr, size_t src_len, RegisterValue ®_value) { - Error error; + Status error; if (reg_info == nullptr) { error.SetErrorString("invalid register info argument."); return error; @@ -321,7 +322,7 @@ Error NativeRegisterContext::ReadRegisterValueFromMemory( // // Case 2: src_len > dst_len // - // Error! (The register should always be big enough to hold the data) + // Status! (The register should always be big enough to hold the data) // // Case 3: src_len < dst_len // @@ -383,13 +384,13 @@ Error NativeRegisterContext::ReadRegisterValueFromMemory( return error; } -Error NativeRegisterContext::WriteRegisterValueToMemory( +Status NativeRegisterContext::WriteRegisterValueToMemory( const RegisterInfo *reg_info, lldb::addr_t dst_addr, size_t dst_len, const RegisterValue ®_value) { uint8_t dst[RegisterValue::kMaxRegisterByteSize]; - Error error; + Status error; NativeProcessProtocolSP process_sp(m_thread.GetProcess()); if (process_sp) { @@ -400,7 +401,7 @@ Error NativeRegisterContext::WriteRegisterValueToMemory( // they are the same. lldb::ByteOrder byte_order; if (!process_sp->GetByteOrder(byte_order)) - return Error("NativeProcessProtocol::GetByteOrder () failed"); + return Status("NativeProcessProtocol::GetByteOrder () failed"); const size_t bytes_copied = reg_value.GetAsMemoryData(reg_info, dst, dst_len, byte_order, error); diff --git a/lldb/source/Host/common/NativeThreadProtocol.cpp b/lldb/source/Host/common/NativeThreadProtocol.cpp index 2e76cff0d67..29e25bbc569 100644 --- a/lldb/source/Host/common/NativeThreadProtocol.cpp +++ b/lldb/source/Host/common/NativeThreadProtocol.cpp @@ -20,46 +20,46 @@ NativeThreadProtocol::NativeThreadProtocol(NativeProcessProtocol *process, lldb::tid_t tid) : m_process_wp(process->shared_from_this()), m_tid(tid) {} -Error NativeThreadProtocol::ReadRegister(uint32_t reg, - RegisterValue ®_value) { +Status NativeThreadProtocol::ReadRegister(uint32_t reg, + RegisterValue ®_value) { NativeRegisterContextSP register_context_sp = GetRegisterContext(); if (!register_context_sp) - return Error("no register context"); + return Status("no register context"); const RegisterInfo *const reg_info = register_context_sp->GetRegisterInfoAtIndex(reg); if (!reg_info) - return Error("no register info for reg num %" PRIu32, reg); + return Status("no register info for reg num %" PRIu32, reg); return register_context_sp->ReadRegister(reg_info, reg_value); ; } -Error NativeThreadProtocol::WriteRegister(uint32_t reg, - const RegisterValue ®_value) { +Status NativeThreadProtocol::WriteRegister(uint32_t reg, + const RegisterValue ®_value) { NativeRegisterContextSP register_context_sp = GetRegisterContext(); if (!register_context_sp) - return Error("no register context"); + return Status("no register context"); const RegisterInfo *const reg_info = register_context_sp->GetRegisterInfoAtIndex(reg); if (!reg_info) - return Error("no register info for reg num %" PRIu32, reg); + return Status("no register info for reg num %" PRIu32, reg); return register_context_sp->WriteRegister(reg_info, reg_value); } -Error NativeThreadProtocol::SaveAllRegisters(lldb::DataBufferSP &data_sp) { +Status NativeThreadProtocol::SaveAllRegisters(lldb::DataBufferSP &data_sp) { NativeRegisterContextSP register_context_sp = GetRegisterContext(); if (!register_context_sp) - return Error("no register context"); + return Status("no register context"); return register_context_sp->WriteAllRegisterValues(data_sp); } -Error NativeThreadProtocol::RestoreAllRegisters(lldb::DataBufferSP &data_sp) { +Status NativeThreadProtocol::RestoreAllRegisters(lldb::DataBufferSP &data_sp) { NativeRegisterContextSP register_context_sp = GetRegisterContext(); if (!register_context_sp) - return Error("no register context"); + return Status("no register context"); return register_context_sp->ReadAllRegisterValues(data_sp); } diff --git a/lldb/source/Host/common/NativeWatchpointList.cpp b/lldb/source/Host/common/NativeWatchpointList.cpp index 168e5b42b96..e6ef7300eb2 100644 --- a/lldb/source/Host/common/NativeWatchpointList.cpp +++ b/lldb/source/Host/common/NativeWatchpointList.cpp @@ -14,15 +14,15 @@ using namespace lldb; using namespace lldb_private; -Error NativeWatchpointList::Add(addr_t addr, size_t size, uint32_t watch_flags, - bool hardware) { +Status NativeWatchpointList::Add(addr_t addr, size_t size, uint32_t watch_flags, + bool hardware) { m_watchpoints[addr] = {addr, size, watch_flags, hardware}; - return Error(); + return Status(); } -Error NativeWatchpointList::Remove(addr_t addr) { +Status NativeWatchpointList::Remove(addr_t addr) { m_watchpoints.erase(addr); - return Error(); + return Status(); } const NativeWatchpointList::WatchpointMap & diff --git a/lldb/source/Host/common/PipeBase.cpp b/lldb/source/Host/common/PipeBase.cpp index cf7e6c97c3c..632bfcb3a2e 100644 --- a/lldb/source/Host/common/PipeBase.cpp +++ b/lldb/source/Host/common/PipeBase.cpp @@ -13,12 +13,13 @@ using namespace lldb_private; PipeBase::~PipeBase() = default; -Error PipeBase::OpenAsWriter(llvm::StringRef name, bool child_process_inherit) { +Status PipeBase::OpenAsWriter(llvm::StringRef name, + bool child_process_inherit) { return OpenAsWriterWithTimeout(name, child_process_inherit, std::chrono::microseconds::zero()); } -Error PipeBase::Read(void *buf, size_t size, size_t &bytes_read) { +Status PipeBase::Read(void *buf, size_t size, size_t &bytes_read) { return ReadWithTimeout(buf, size, std::chrono::microseconds::zero(), bytes_read); } diff --git a/lldb/source/Host/common/Socket.cpp b/lldb/source/Host/common/Socket.cpp index d73b5d0ad07..0df9dc02c70 100644 --- a/lldb/source/Host/common/Socket.cpp +++ b/lldb/source/Host/common/Socket.cpp @@ -79,7 +79,7 @@ Socket::~Socket() { Close(); } std::unique_ptr<Socket> Socket::Create(const SocketProtocol protocol, bool child_processes_inherit, - Error &error) { + Status &error) { error.Clear(); std::unique_ptr<Socket> socket_up; @@ -118,14 +118,14 @@ std::unique_ptr<Socket> Socket::Create(const SocketProtocol protocol, return socket_up; } -Error Socket::TcpConnect(llvm::StringRef host_and_port, - bool child_processes_inherit, Socket *&socket) { +Status Socket::TcpConnect(llvm::StringRef host_and_port, + bool child_processes_inherit, Socket *&socket) { Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_COMMUNICATION)); if (log) log->Printf("Socket::%s (host/port = %s)", __FUNCTION__, host_and_port.data()); - Error error; + Status error; std::unique_ptr<Socket> connect_socket( Create(ProtocolTcp, child_processes_inherit, error)); if (error.Fail()) @@ -138,14 +138,14 @@ Error Socket::TcpConnect(llvm::StringRef host_and_port, return error; } -Error Socket::TcpListen(llvm::StringRef host_and_port, - bool child_processes_inherit, Socket *&socket, - Predicate<uint16_t> *predicate, int backlog) { +Status Socket::TcpListen(llvm::StringRef host_and_port, + bool child_processes_inherit, Socket *&socket, + Predicate<uint16_t> *predicate, int backlog) { Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION)); if (log) log->Printf("Socket::%s (%s)", __FUNCTION__, host_and_port.data()); - Error error; + Status error; std::string host_str; std::string port_str; int32_t port = INT32_MIN; @@ -179,8 +179,8 @@ Error Socket::TcpListen(llvm::StringRef host_and_port, return error; } -Error Socket::UdpConnect(llvm::StringRef host_and_port, - bool child_processes_inherit, Socket *&socket) { +Status Socket::UdpConnect(llvm::StringRef host_and_port, + bool child_processes_inherit, Socket *&socket) { Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION)); if (log) log->Printf("Socket::%s (host/port = %s)", __FUNCTION__, @@ -189,9 +189,10 @@ Error Socket::UdpConnect(llvm::StringRef host_and_port, return UDPSocket::Connect(host_and_port, child_processes_inherit, socket); } -Error Socket::UnixDomainConnect(llvm::StringRef name, - bool child_processes_inherit, Socket *&socket) { - Error error; +Status Socket::UnixDomainConnect(llvm::StringRef name, + bool child_processes_inherit, + Socket *&socket) { + Status error; std::unique_ptr<Socket> connect_socket( Create(ProtocolUnixDomain, child_processes_inherit, error)); if (error.Fail()) @@ -204,9 +205,9 @@ Error Socket::UnixDomainConnect(llvm::StringRef name, return error; } -Error Socket::UnixDomainAccept(llvm::StringRef name, - bool child_processes_inherit, Socket *&socket) { - Error error; +Status Socket::UnixDomainAccept(llvm::StringRef name, + bool child_processes_inherit, Socket *&socket) { + Status error; std::unique_ptr<Socket> listen_socket( Create(ProtocolUnixDomain, child_processes_inherit, error)); if (error.Fail()) @@ -220,10 +221,10 @@ Error Socket::UnixDomainAccept(llvm::StringRef name, return error; } -Error Socket::UnixAbstractConnect(llvm::StringRef name, - bool child_processes_inherit, - Socket *&socket) { - Error error; +Status Socket::UnixAbstractConnect(llvm::StringRef name, + bool child_processes_inherit, + Socket *&socket) { + Status error; std::unique_ptr<Socket> connect_socket( Create(ProtocolUnixAbstract, child_processes_inherit, error)); if (error.Fail()) @@ -235,10 +236,10 @@ Error Socket::UnixAbstractConnect(llvm::StringRef name, return error; } -Error Socket::UnixAbstractAccept(llvm::StringRef name, - bool child_processes_inherit, - Socket *&socket) { - Error error; +Status Socket::UnixAbstractAccept(llvm::StringRef name, + bool child_processes_inherit, + Socket *&socket) { + Status error; std::unique_ptr<Socket> listen_socket( Create(ProtocolUnixAbstract, child_processes_inherit, error)); if (error.Fail()) @@ -254,7 +255,7 @@ Error Socket::UnixAbstractAccept(llvm::StringRef name, bool Socket::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) { static RegularExpression g_regex( llvm::StringRef("([^:]+|\\[[0-9a-fA-F:]+.*\\]):([0-9]+)")); RegularExpression::Match regex_match(2); @@ -304,8 +305,8 @@ IOObject::WaitableHandle Socket::GetWaitableHandle() { return m_socket; } -Error Socket::Read(void *buf, size_t &num_bytes) { - Error error; +Status Socket::Read(void *buf, size_t &num_bytes) { + Status error; int bytes_received = 0; do { bytes_received = ::recv(m_socket, static_cast<char *>(buf), num_bytes, 0); @@ -330,8 +331,8 @@ Error Socket::Read(void *buf, size_t &num_bytes) { return error; } -Error Socket::Write(const void *buf, size_t &num_bytes) { - Error error; +Status Socket::Write(const void *buf, size_t &num_bytes) { + Status error; int bytes_sent = 0; do { bytes_sent = Send(buf, num_bytes); @@ -356,13 +357,13 @@ Error Socket::Write(const void *buf, size_t &num_bytes) { return error; } -Error Socket::PreDisconnect() { - Error error; +Status Socket::PreDisconnect() { + Status error; return error; } -Error Socket::Close() { - Error error; +Status Socket::Close() { + Status error; if (!IsValid() || !m_should_close_fd) return error; @@ -404,7 +405,7 @@ size_t Socket::Send(const void *buf, const size_t num_bytes) { return ::send(m_socket, static_cast<const char *>(buf), num_bytes, 0); } -void Socket::SetLastError(Error &error) { +void Socket::SetLastError(Status &error) { #if defined(_WIN32) error.SetError(::WSAGetLastError(), lldb::eErrorTypeWin32); #else @@ -414,7 +415,7 @@ void Socket::SetLastError(Error &error) { NativeSocket Socket::CreateSocket(const int domain, const int type, const int protocol, - bool child_processes_inherit, Error &error) { + bool child_processes_inherit, Status &error) { error.Clear(); auto socket_type = type; #ifdef SOCK_CLOEXEC @@ -430,7 +431,7 @@ NativeSocket Socket::CreateSocket(const int domain, const int type, NativeSocket Socket::AcceptSocket(NativeSocket sockfd, struct sockaddr *addr, socklen_t *addrlen, - bool child_processes_inherit, Error &error) { + bool child_processes_inherit, Status &error) { error.Clear(); #if defined(ANDROID_USE_ACCEPT_WORKAROUND) // Hack: diff --git a/lldb/source/Host/common/SoftwareBreakpoint.cpp b/lldb/source/Host/common/SoftwareBreakpoint.cpp index 436cb2bb112..14dbafd94c0 100644 --- a/lldb/source/Host/common/SoftwareBreakpoint.cpp +++ b/lldb/source/Host/common/SoftwareBreakpoint.cpp @@ -10,8 +10,8 @@ #include "lldb/Host/common/SoftwareBreakpoint.h" #include "lldb/Host/Debug.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" #include "lldb/Host/common/NativeProcessProtocol.h" @@ -21,7 +21,7 @@ using namespace lldb_private; // static members // ------------------------------------------------------------------- -Error SoftwareBreakpoint::CreateSoftwareBreakpoint( +Status SoftwareBreakpoint::CreateSoftwareBreakpoint( NativeProcessProtocol &process, lldb::addr_t addr, size_t size_hint, NativeBreakpointSP &breakpoint_sp) { Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); @@ -30,15 +30,15 @@ Error SoftwareBreakpoint::CreateSoftwareBreakpoint( // Validate the address. if (addr == LLDB_INVALID_ADDRESS) - return Error("SoftwareBreakpoint::%s invalid load address specified.", - __FUNCTION__); + return Status("SoftwareBreakpoint::%s invalid load address specified.", + __FUNCTION__); // Ask the NativeProcessProtocol subclass to fill in the correct software // breakpoint // trap for the breakpoint site. size_t bp_opcode_size = 0; const uint8_t *bp_opcode_bytes = NULL; - Error error = process.GetSoftwareBreakpointTrapOpcode( + Status error = process.GetSoftwareBreakpointTrapOpcode( size_hint, bp_opcode_size, bp_opcode_bytes); if (error.Fail()) { @@ -54,10 +54,10 @@ Error SoftwareBreakpoint::CreateSoftwareBreakpoint( if (log) log->Printf("SoftwareBreakpoint::%s failed to retrieve any trap opcodes", __FUNCTION__); - return Error("SoftwareBreakpoint::GetSoftwareBreakpointTrapOpcode() " - "returned zero, unable to get breakpoint trap for address " - "0x%" PRIx64, - addr); + return Status("SoftwareBreakpoint::GetSoftwareBreakpointTrapOpcode() " + "returned zero, unable to get breakpoint trap for address " + "0x%" PRIx64, + addr); } if (bp_opcode_size > MAX_TRAP_OPCODE_SIZE) { @@ -65,10 +65,10 @@ Error SoftwareBreakpoint::CreateSoftwareBreakpoint( log->Printf("SoftwareBreakpoint::%s cannot support %zu trapcode bytes, " "max size is %zu", __FUNCTION__, bp_opcode_size, MAX_TRAP_OPCODE_SIZE); - return Error("SoftwareBreakpoint::GetSoftwareBreakpointTrapOpcode() " - "returned too many trap opcode bytes: requires %zu but we " - "only support a max of %zu", - bp_opcode_size, MAX_TRAP_OPCODE_SIZE); + return Status("SoftwareBreakpoint::GetSoftwareBreakpointTrapOpcode() " + "returned too many trap opcode bytes: requires %zu but we " + "only support a max of %zu", + bp_opcode_size, MAX_TRAP_OPCODE_SIZE); } // Validate that we received opcodes. @@ -76,10 +76,10 @@ Error SoftwareBreakpoint::CreateSoftwareBreakpoint( if (log) log->Printf("SoftwareBreakpoint::%s failed to retrieve trap opcode bytes", __FUNCTION__); - return Error("SoftwareBreakpoint::GetSoftwareBreakpointTrapOpcode() " - "returned NULL trap opcode bytes, unable to get breakpoint " - "trap for address 0x%" PRIx64, - addr); + return Status("SoftwareBreakpoint::GetSoftwareBreakpointTrapOpcode() " + "returned NULL trap opcode bytes, unable to get breakpoint " + "trap for address 0x%" PRIx64, + addr); } // Enable the breakpoint. @@ -103,10 +103,10 @@ Error SoftwareBreakpoint::CreateSoftwareBreakpoint( // breakpoint. breakpoint_sp.reset(new SoftwareBreakpoint(process, addr, saved_opcode_bytes, bp_opcode_bytes, bp_opcode_size)); - return Error(); + return Status(); } -Error SoftwareBreakpoint::EnableSoftwareBreakpoint( +Status SoftwareBreakpoint::EnableSoftwareBreakpoint( NativeProcessProtocol &process, lldb::addr_t addr, size_t bp_opcode_size, const uint8_t *bp_opcode_bytes, uint8_t *saved_opcode_bytes) { assert(bp_opcode_size <= MAX_TRAP_OPCODE_SIZE && @@ -121,7 +121,7 @@ Error SoftwareBreakpoint::EnableSoftwareBreakpoint( // Save the original opcodes by reading them so we can restore later. size_t bytes_read = 0; - Error error = + Status error = process.ReadMemory(addr, saved_opcode_bytes, bp_opcode_size, bytes_read); if (error.Fail()) { if (log) @@ -138,10 +138,10 @@ Error SoftwareBreakpoint::EnableSoftwareBreakpoint( "attempting to set breakpoint: attempted to read %zu bytes " "but only read %zu", __FUNCTION__, bp_opcode_size, bytes_read); - return Error("SoftwareBreakpoint::%s failed to read memory while " - "attempting to set breakpoint: attempted to read %zu bytes " - "but only read %zu", - __FUNCTION__, bp_opcode_size, bytes_read); + return Status("SoftwareBreakpoint::%s failed to read memory while " + "attempting to set breakpoint: attempted to read %zu bytes " + "but only read %zu", + __FUNCTION__, bp_opcode_size, bytes_read); } // Log what we read. @@ -197,10 +197,11 @@ Error SoftwareBreakpoint::EnableSoftwareBreakpoint( "attempting to verify breakpoint: attempted to read %zu " "bytes but only read %zu", __FUNCTION__, bp_opcode_size, verify_bytes_read); - return Error("SoftwareBreakpoint::%s failed to read memory while " - "attempting to verify breakpoint: attempted to read %zu bytes " - "but only read %zu", - __FUNCTION__, bp_opcode_size, verify_bytes_read); + return Status( + "SoftwareBreakpoint::%s failed to read memory while " + "attempting to verify breakpoint: attempted to read %zu bytes " + "but only read %zu", + __FUNCTION__, bp_opcode_size, verify_bytes_read); } if (::memcmp(bp_opcode_bytes, verify_bp_opcode_bytes, bp_opcode_size) != 0) { @@ -209,17 +210,17 @@ Error SoftwareBreakpoint::EnableSoftwareBreakpoint( "writing failed - trap opcodes not successfully read back " "after writing when setting breakpoint at 0x%" PRIx64, __FUNCTION__, addr); - return Error("SoftwareBreakpoint::%s: verification of software breakpoint " - "writing failed - trap opcodes not successfully read back " - "after writing when setting breakpoint at 0x%" PRIx64, - __FUNCTION__, addr); + return Status("SoftwareBreakpoint::%s: verification of software breakpoint " + "writing failed - trap opcodes not successfully read back " + "after writing when setting breakpoint at 0x%" PRIx64, + __FUNCTION__, addr); } if (log) log->Printf("SoftwareBreakpoint::%s addr = 0x%" PRIx64 " -- SUCCESS", __FUNCTION__, addr); - return Error(); + return Status(); } // ------------------------------------------------------------------- @@ -240,13 +241,13 @@ SoftwareBreakpoint::SoftwareBreakpoint(NativeProcessProtocol &process, ::memcpy(m_trap_opcodes, trap_opcodes, opcode_size); } -Error SoftwareBreakpoint::DoEnable() { +Status SoftwareBreakpoint::DoEnable() { return EnableSoftwareBreakpoint(m_process, m_addr, m_opcode_size, m_trap_opcodes, m_saved_opcodes); } -Error SoftwareBreakpoint::DoDisable() { - Error error; +Status SoftwareBreakpoint::DoDisable() { + Status error; assert(m_addr && (m_addr != LLDB_INVALID_ADDRESS) && "can't remove a software breakpoint for an invalid address"); diff --git a/lldb/source/Host/common/TCPSocket.cpp b/lldb/source/Host/common/TCPSocket.cpp index 55db4bb0c45..c013334ce23 100644 --- a/lldb/source/Host/common/TCPSocket.cpp +++ b/lldb/source/Host/common/TCPSocket.cpp @@ -117,8 +117,8 @@ std::string TCPSocket::GetRemoteIPAddress() const { return ""; } -Error TCPSocket::CreateSocket(int domain) { - Error error; +Status TCPSocket::CreateSocket(int domain) { + Status error; if (IsValid()) error = Close(); if (error.Fail()) @@ -128,13 +128,13 @@ Error TCPSocket::CreateSocket(int domain) { return error; } -Error TCPSocket::Connect(llvm::StringRef name) { +Status TCPSocket::Connect(llvm::StringRef name) { Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_COMMUNICATION)); if (log) log->Printf("TCPSocket::%s (host/port = %s)", __FUNCTION__, name.data()); - Error error; + Status error; std::string host_str; std::string port_str; int32_t port = INT32_MIN; @@ -166,12 +166,12 @@ Error TCPSocket::Connect(llvm::StringRef name) { return error; } -Error TCPSocket::Listen(llvm::StringRef name, int backlog) { +Status TCPSocket::Listen(llvm::StringRef name, int backlog) { Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION)); if (log) log->Printf("TCPSocket::%s (%s)", __FUNCTION__, name.data()); - Error error; + Status error; std::string host_str; std::string port_str; int32_t port = INT32_MIN; @@ -227,8 +227,8 @@ void TCPSocket::CloseListenSockets() { m_listen_sockets.clear(); } -Error TCPSocket::Accept(Socket *&conn_socket) { - Error error; +Status TCPSocket::Accept(Socket *&conn_socket) { + Status error; if (m_listen_sockets.size() == 0) { error.SetErrorString("No open listening sockets!"); return error; diff --git a/lldb/source/Host/common/ThreadLauncher.cpp b/lldb/source/Host/common/ThreadLauncher.cpp index 32641efe408..f3401016393 100644 --- a/lldb/source/Host/common/ThreadLauncher.cpp +++ b/lldb/source/Host/common/ThreadLauncher.cpp @@ -24,9 +24,9 @@ using namespace lldb_private; HostThread ThreadLauncher::LaunchThread(llvm::StringRef name, lldb::thread_func_t thread_function, lldb::thread_arg_t thread_arg, - Error *error_ptr, + Status *error_ptr, size_t min_stack_byte_size) { - Error error; + Status error; if (error_ptr) error_ptr->Clear(); diff --git a/lldb/source/Host/common/UDPSocket.cpp b/lldb/source/Host/common/UDPSocket.cpp index ce8d90891b2..21dacbc626e 100644 --- a/lldb/source/Host/common/UDPSocket.cpp +++ b/lldb/source/Host/common/UDPSocket.cpp @@ -42,27 +42,27 @@ size_t UDPSocket::Send(const void *buf, const size_t num_bytes) { m_sockaddr, m_sockaddr.GetLength()); } -Error UDPSocket::Connect(llvm::StringRef name) { - return Error("%s", g_not_supported_error); +Status UDPSocket::Connect(llvm::StringRef name) { + return Status("%s", g_not_supported_error); } -Error UDPSocket::Listen(llvm::StringRef name, int backlog) { - return Error("%s", g_not_supported_error); +Status UDPSocket::Listen(llvm::StringRef name, int backlog) { + return Status("%s", g_not_supported_error); } -Error UDPSocket::Accept(Socket *&socket) { - return Error("%s", g_not_supported_error); +Status UDPSocket::Accept(Socket *&socket) { + return Status("%s", g_not_supported_error); } -Error UDPSocket::Connect(llvm::StringRef name, bool child_processes_inherit, - Socket *&socket) { +Status UDPSocket::Connect(llvm::StringRef name, bool child_processes_inherit, + Socket *&socket) { std::unique_ptr<UDPSocket> final_socket; Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION)); if (log) log->Printf("UDPSocket::%s (host/port = %s)", __FUNCTION__, name.data()); - Error error; + Status error; std::string host_str; std::string port_str; int32_t port = INT32_MIN; diff --git a/lldb/source/Host/freebsd/Host.cpp b/lldb/source/Host/freebsd/Host.cpp index f1abb49055e..bd547bbeb9c 100644 --- a/lldb/source/Host/freebsd/Host.cpp +++ b/lldb/source/Host/freebsd/Host.cpp @@ -34,8 +34,8 @@ #include "lldb/Target/Process.h" #include "lldb/Utility/DataExtractor.h" #include "lldb/Utility/Endian.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/StreamString.h" #include "lldb/Utility/CleanUp.h" @@ -248,6 +248,6 @@ size_t Host::GetEnvironment(StringList &env) { return i; } -Error Host::ShellExpandArguments(ProcessLaunchInfo &launch_info) { - return Error("unimplemented"); +Status Host::ShellExpandArguments(ProcessLaunchInfo &launch_info) { + return Status("unimplemented"); } diff --git a/lldb/source/Host/linux/Host.cpp b/lldb/source/Host/linux/Host.cpp index 810222cbbf2..486d4e3f0b8 100644 --- a/lldb/source/Host/linux/Host.cpp +++ b/lldb/source/Host/linux/Host.cpp @@ -22,8 +22,8 @@ #include "llvm/Support/ScopedPrinter.h" // Project includes #include "lldb/Target/Process.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" #include "lldb/Host/Host.h" #include "lldb/Host/HostInfo.h" @@ -162,7 +162,7 @@ static bool GetProcessAndStatInfo(::pid_t pid, ssize_t len = readlink(ProcExe.c_str(), &ExePath[0], PATH_MAX); if (len <= 0) { LLDB_LOG(log, "failed to read link exe link for {0}: {1}", pid, - Error(errno, eErrorTypePOSIX)); + Status(errno, eErrorTypePOSIX)); return false; } ExePath.resize(len); @@ -305,6 +305,6 @@ size_t Host::GetEnvironment(StringList &env) { return i; } -Error Host::ShellExpandArguments(ProcessLaunchInfo &launch_info) { - return Error("unimplemented"); +Status Host::ShellExpandArguments(ProcessLaunchInfo &launch_info) { + return Status("unimplemented"); } diff --git a/lldb/source/Host/macosx/Host.mm b/lldb/source/Host/macosx/Host.mm index 4c51e8ff154..b2492105bfd 100644 --- a/lldb/source/Host/macosx/Host.mm +++ b/lldb/source/Host/macosx/Host.mm @@ -140,7 +140,7 @@ bool Host::ResolveExecutableInBundle(FileSpec &file) { static void *AcceptPIDFromInferior(void *arg) { const char *connect_url = (const char *)arg; ConnectionFileDescriptor file_conn; - Error error; + Status error; if (file_conn.Connect(connect_url, &error) == eConnectionStatusSuccess) { char pid_str[256]; ::memset(pid_str, 0, sizeof(pid_str)); @@ -310,7 +310,7 @@ static bool WaitForProcessToSIGSTOP(const lldb::pid_t pid, // // lldb::pid_t pid = LLDB_INVALID_PROCESS_ID; // -// Error lldb_error; +// Status lldb_error; // // Sleep and wait a bit for debugserver to start to listen... // char connect_url[128]; // ::snprintf (connect_url, sizeof(connect_url), "unix-accept://%s", @@ -377,10 +377,10 @@ tell application \"Terminal\"\n\ do script the_shell_script\n\ end tell\n"; -static Error +static Status LaunchInNewTerminalWithAppleScript(const char *exe_path, ProcessLaunchInfo &launch_info) { - Error error; + Status error; char unix_socket_name[PATH_MAX] = "/tmp/XXXXXX"; if (::mktemp(unix_socket_name) == NULL) { error.SetErrorString("failed to make temporary path for a unix socket"); @@ -500,7 +500,7 @@ LaunchInNewTerminalWithAppleScript(const char *exe_path, lldb::pid_t pid = LLDB_INVALID_PROCESS_ID; - Error lldb_error; + Status lldb_error; // Sleep and wait a bit for debugserver to start to listen... ConnectionFileDescriptor file_conn; char connect_url[128]; @@ -946,8 +946,8 @@ static void PackageXPCArguments(xpc_object_t message, const char *prefix, Once obtained, it will be valid for as long as the process lives. */ static AuthorizationRef authorizationRef = NULL; -static Error getXPCAuthorization(ProcessLaunchInfo &launch_info) { - Error error; +static Status getXPCAuthorization(ProcessLaunchInfo &launch_info) { + Status error; Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST | LIBLLDB_LOG_PROCESS)); @@ -1024,11 +1024,11 @@ static Error getXPCAuthorization(ProcessLaunchInfo &launch_info) { } #endif -static Error LaunchProcessXPC(const char *exe_path, - ProcessLaunchInfo &launch_info, - lldb::pid_t &pid) { +static Status LaunchProcessXPC(const char *exe_path, + ProcessLaunchInfo &launch_info, + lldb::pid_t &pid) { #if !NO_XPC_SERVICES - Error error = getXPCAuthorization(launch_info); + Status error = getXPCAuthorization(launch_info); if (error.Fail()) return error; @@ -1156,7 +1156,7 @@ static Error LaunchProcessXPC(const char *exe_path, return error; #else - Error error; + Status error; return error; #endif } @@ -1177,8 +1177,8 @@ static bool ShouldLaunchUsingXPC(ProcessLaunchInfo &launch_info) { return result; } -Error Host::LaunchProcess(ProcessLaunchInfo &launch_info) { - Error error; +Status Host::LaunchProcess(ProcessLaunchInfo &launch_info) { + Status error; char exe_path[PATH_MAX]; PlatformSP host_platform_sp(Platform::GetHostPlatform()); @@ -1246,8 +1246,8 @@ Error Host::LaunchProcess(ProcessLaunchInfo &launch_info) { return error; } -Error Host::ShellExpandArguments(ProcessLaunchInfo &launch_info) { - Error error; +Status Host::ShellExpandArguments(ProcessLaunchInfo &launch_info) { + Status error; if (launch_info.GetFlags().Test(eLaunchFlagShellExpandArguments)) { FileSpec expand_tool_spec; if (!HostInfo::GetLLDBPath(lldb::ePathTypeSupportExecutableDir, diff --git a/lldb/source/Host/macosx/Symbols.cpp b/lldb/source/Host/macosx/Symbols.cpp index a5085681495..20508a65856 100644 --- a/lldb/source/Host/macosx/Symbols.cpp +++ b/lldb/source/Host/macosx/Symbols.cpp @@ -536,7 +536,7 @@ bool Symbols::DownloadObjectAndSymbolFile(ModuleSpec &module_spec, log->Printf("Calling %s with file %s to find dSYM", g_dsym_for_uuid_exe_path, file_path); } - Error error = Host::RunShellCommand( + Status error = Host::RunShellCommand( command.GetData(), NULL, // current working directory &exit_status, // Exit status diff --git a/lldb/source/Host/netbsd/Host.cpp b/lldb/source/Host/netbsd/Host.cpp index 6a6b8ab51a1..bbe34a83d99 100644 --- a/lldb/source/Host/netbsd/Host.cpp +++ b/lldb/source/Host/netbsd/Host.cpp @@ -33,8 +33,8 @@ #include "lldb/Target/Process.h" #include "lldb/Utility/DataExtractor.h" #include "lldb/Utility/Endian.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/StreamString.h" #include "lldb/Utility/CleanUp.h" @@ -254,6 +254,6 @@ bool Host::GetProcessInfo(lldb::pid_t pid, ProcessInstanceInfo &process_info) { return false; } -Error Host::ShellExpandArguments(ProcessLaunchInfo &launch_info) { - return Error("unimplemented"); +Status Host::ShellExpandArguments(ProcessLaunchInfo &launch_info) { + return Status("unimplemented"); } diff --git a/lldb/source/Host/openbsd/Host.cpp b/lldb/source/Host/openbsd/Host.cpp index c9ff69366c2..7e4a64fbd9a 100644 --- a/lldb/source/Host/openbsd/Host.cpp +++ b/lldb/source/Host/openbsd/Host.cpp @@ -30,8 +30,8 @@ #include "lldb/Target/Process.h" #include "lldb/Utility/DataExtractor.h" #include "lldb/Utility/Endian.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/StreamString.h" #include "lldb/Utility/CleanUp.h" @@ -220,6 +220,6 @@ bool Host::GetProcessInfo(lldb::pid_t pid, ProcessInstanceInfo &process_info) { return false; } -Error Host::ShellExpandArguments(ProcessLaunchInfo &launch_info) { - return Error("unimplemented"); +Status Host::ShellExpandArguments(ProcessLaunchInfo &launch_info) { + return Status("unimplemented"); } diff --git a/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp b/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp index befc847d8a8..7a0c92b4491 100644 --- a/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp +++ b/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp @@ -123,7 +123,7 @@ void ConnectionFileDescriptor::OpenCommandPipe() { Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION)); // Make the command file descriptor here: - Error result = m_pipe.CreateNew(m_child_processes_inherit); + Status result = m_pipe.CreateNew(m_child_processes_inherit); if (!result.Success()) { if (log) log->Printf("%p ConnectionFileDescriptor::OpenCommandPipe () - could not " @@ -153,7 +153,7 @@ bool ConnectionFileDescriptor::IsConnected() const { } ConnectionStatus ConnectionFileDescriptor::Connect(llvm::StringRef path, - Error *error_ptr) { + Status *error_ptr) { std::lock_guard<std::recursive_mutex> guard(m_mutex); Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION)); if (log) @@ -299,11 +299,11 @@ ConnectionStatus ConnectionFileDescriptor::Connect(llvm::StringRef path, bool ConnectionFileDescriptor::InterruptRead() { size_t bytes_written = 0; - Error result = m_pipe.Write("i", 1, bytes_written); + Status result = m_pipe.Write("i", 1, bytes_written); return result.Success(); } -ConnectionStatus ConnectionFileDescriptor::Disconnect(Error *error_ptr) { +ConnectionStatus ConnectionFileDescriptor::Disconnect(Status *error_ptr) { Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION)); if (log) log->Printf("%p ConnectionFileDescriptor::Disconnect ()", @@ -337,7 +337,7 @@ ConnectionStatus ConnectionFileDescriptor::Disconnect(Error *error_ptr) { if (!locker.try_lock()) { if (m_pipe.CanWrite()) { size_t bytes_written = 0; - Error result = m_pipe.Write("q", 1, bytes_written); + Status result = m_pipe.Write("q", 1, bytes_written); if (log) log->Printf("%p ConnectionFileDescriptor::Disconnect(): Couldn't get " "the lock, sent 'q' to %d, error = '%s'.", @@ -351,8 +351,8 @@ ConnectionStatus ConnectionFileDescriptor::Disconnect(Error *error_ptr) { locker.lock(); } - Error error = m_read_sp->Close(); - Error error2 = m_write_sp->Close(); + Status error = m_read_sp->Close(); + Status error2 = m_write_sp->Close(); if (error.Fail() || error2.Fail()) status = eConnectionStatusError; if (error_ptr) @@ -369,7 +369,7 @@ ConnectionStatus ConnectionFileDescriptor::Disconnect(Error *error_ptr) { size_t ConnectionFileDescriptor::Read(void *dst, size_t dst_len, const Timeout<std::micro> &timeout, ConnectionStatus &status, - Error *error_ptr) { + Status *error_ptr) { Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION)); std::unique_lock<std::recursive_mutex> locker(m_mutex, std::defer_lock); @@ -394,7 +394,7 @@ size_t ConnectionFileDescriptor::Read(void *dst, size_t dst_len, if (status != eConnectionStatusSuccess) return 0; - Error error; + Status error; size_t bytes_read = dst_len; error = m_read_sp->Read(dst, bytes_read); @@ -476,7 +476,7 @@ size_t ConnectionFileDescriptor::Read(void *dst, size_t dst_len, size_t ConnectionFileDescriptor::Write(const void *src, size_t src_len, ConnectionStatus &status, - Error *error_ptr) { + Status *error_ptr) { Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION)); if (log) log->Printf( @@ -491,7 +491,7 @@ size_t ConnectionFileDescriptor::Write(const void *src, size_t src_len, return 0; } - Error error; + Status error; size_t bytes_sent = src_len; error = m_write_sp->Write(src, bytes_sent); @@ -553,7 +553,7 @@ std::string ConnectionFileDescriptor::GetURI() { return m_uri; } ConnectionStatus ConnectionFileDescriptor::BytesAvailable(const Timeout<std::micro> &timeout, - Error *error_ptr) { + Status *error_ptr) { // Don't need to take the mutex here separately since we are only called from // Read. If we // ever get used more generally we will need to lock here as well. @@ -588,7 +588,7 @@ ConnectionFileDescriptor::BytesAvailable(const Timeout<std::micro> &timeout, while (handle == m_read_sp->GetWaitableHandle()) { - Error error = select_helper.Select(); + Status error = select_helper.Select(); if (error_ptr) *error_ptr = error; @@ -653,9 +653,9 @@ ConnectionFileDescriptor::BytesAvailable(const Timeout<std::micro> &timeout, ConnectionStatus ConnectionFileDescriptor::NamedSocketAccept(llvm::StringRef socket_name, - Error *error_ptr) { + Status *error_ptr) { Socket *socket = nullptr; - Error error = + Status error = Socket::UnixDomainAccept(socket_name, m_child_processes_inherit, socket); if (error_ptr) *error_ptr = error; @@ -670,9 +670,9 @@ ConnectionFileDescriptor::NamedSocketAccept(llvm::StringRef socket_name, ConnectionStatus ConnectionFileDescriptor::NamedSocketConnect(llvm::StringRef socket_name, - Error *error_ptr) { + Status *error_ptr) { Socket *socket = nullptr; - Error error = + Status error = Socket::UnixDomainConnect(socket_name, m_child_processes_inherit, socket); if (error_ptr) *error_ptr = error; @@ -687,10 +687,10 @@ ConnectionFileDescriptor::NamedSocketConnect(llvm::StringRef socket_name, lldb::ConnectionStatus ConnectionFileDescriptor::UnixAbstractSocketConnect(llvm::StringRef socket_name, - Error *error_ptr) { + Status *error_ptr) { Socket *socket = nullptr; - Error error = Socket::UnixAbstractConnect(socket_name, - m_child_processes_inherit, socket); + Status error = Socket::UnixAbstractConnect(socket_name, + m_child_processes_inherit, socket); if (error_ptr) *error_ptr = error; m_write_sp.reset(socket); @@ -704,13 +704,13 @@ ConnectionFileDescriptor::UnixAbstractSocketConnect(llvm::StringRef socket_name, ConnectionStatus ConnectionFileDescriptor::SocketListenAndAccept(llvm::StringRef s, - Error *error_ptr) { + Status *error_ptr) { m_port_predicate.SetValue(0, eBroadcastNever); Socket *socket = nullptr; m_waiting_for_accept = true; - Error error = Socket::TcpListen(s, m_child_processes_inherit, socket, - &m_port_predicate); + Status error = Socket::TcpListen(s, m_child_processes_inherit, socket, + &m_port_predicate); if (error_ptr) *error_ptr = error; if (error.Fail()) @@ -732,9 +732,9 @@ ConnectionFileDescriptor::SocketListenAndAccept(llvm::StringRef s, } ConnectionStatus ConnectionFileDescriptor::ConnectTCP(llvm::StringRef s, - Error *error_ptr) { + Status *error_ptr) { Socket *socket = nullptr; - Error error = Socket::TcpConnect(s, m_child_processes_inherit, socket); + Status error = Socket::TcpConnect(s, m_child_processes_inherit, socket); if (error_ptr) *error_ptr = error; m_write_sp.reset(socket); @@ -747,9 +747,9 @@ ConnectionStatus ConnectionFileDescriptor::ConnectTCP(llvm::StringRef s, } ConnectionStatus ConnectionFileDescriptor::ConnectUDP(llvm::StringRef s, - Error *error_ptr) { + Status *error_ptr) { Socket *socket = nullptr; - Error error = Socket::UdpConnect(s, m_child_processes_inherit, socket); + Status error = Socket::UdpConnect(s, m_child_processes_inherit, socket); if (error_ptr) *error_ptr = error; m_write_sp.reset(socket); diff --git a/lldb/source/Host/posix/DomainSocket.cpp b/lldb/source/Host/posix/DomainSocket.cpp index 33c71268c2e..3e3abadc2e5 100644 --- a/lldb/source/Host/posix/DomainSocket.cpp +++ b/lldb/source/Host/posix/DomainSocket.cpp @@ -72,13 +72,13 @@ DomainSocket::DomainSocket(NativeSocket socket, m_socket = socket; } -Error DomainSocket::Connect(llvm::StringRef name) { +Status DomainSocket::Connect(llvm::StringRef name) { sockaddr_un saddr_un; socklen_t saddr_un_len; if (!SetSockAddr(name, GetNameOffset(), &saddr_un, saddr_un_len)) - return Error("Failed to set socket address"); + return Status("Failed to set socket address"); - Error error; + Status error; m_socket = CreateSocket(kDomain, kType, 0, m_child_processes_inherit, error); if (error.Fail()) return error; @@ -89,15 +89,15 @@ Error DomainSocket::Connect(llvm::StringRef name) { return error; } -Error DomainSocket::Listen(llvm::StringRef name, int backlog) { +Status DomainSocket::Listen(llvm::StringRef name, int backlog) { sockaddr_un saddr_un; socklen_t saddr_un_len; if (!SetSockAddr(name, GetNameOffset(), &saddr_un, saddr_un_len)) - return Error("Failed to set socket address"); + return Status("Failed to set socket address"); DeleteSocketFile(name); - Error error; + Status error; m_socket = CreateSocket(kDomain, kType, 0, m_child_processes_inherit, error); if (error.Fail()) return error; @@ -110,8 +110,8 @@ Error DomainSocket::Listen(llvm::StringRef name, int backlog) { return error; } -Error DomainSocket::Accept(Socket *&socket) { - Error error; +Status DomainSocket::Accept(Socket *&socket) { + Status error; auto conn_fd = AcceptSocket(GetNativeSocket(), nullptr, nullptr, m_child_processes_inherit, error); if (error.Success()) diff --git a/lldb/source/Host/posix/FileSystem.cpp b/lldb/source/Host/posix/FileSystem.cpp index 22f337fcfec..e5a99e1aa75 100644 --- a/lldb/source/Host/posix/FileSystem.cpp +++ b/lldb/source/Host/posix/FileSystem.cpp @@ -26,7 +26,7 @@ // lldb Includes #include "lldb/Host/Host.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/StreamString.h" #include "llvm/Support/FileSystem.h" @@ -36,15 +36,15 @@ using namespace lldb_private; const char *FileSystem::DEV_NULL = "/dev/null"; -Error FileSystem::Symlink(const FileSpec &src, const FileSpec &dst) { - Error error; +Status FileSystem::Symlink(const FileSpec &src, const FileSpec &dst) { + Status error; if (::symlink(dst.GetCString(), src.GetCString()) == -1) error.SetErrorToErrno(); return error; } -Error FileSystem::Readlink(const FileSpec &src, FileSpec &dst) { - Error error; +Status FileSystem::Readlink(const FileSpec &src, FileSpec &dst) { + Status error; char buf[PATH_MAX]; ssize_t count = ::readlink(src.GetCString(), buf, sizeof(buf) - 1); if (count < 0) @@ -56,22 +56,22 @@ Error FileSystem::Readlink(const FileSpec &src, FileSpec &dst) { return error; } -Error FileSystem::ResolveSymbolicLink(const FileSpec &src, FileSpec &dst) { +Status FileSystem::ResolveSymbolicLink(const FileSpec &src, FileSpec &dst) { char resolved_path[PATH_MAX]; if (!src.GetPath(resolved_path, sizeof(resolved_path))) { - return Error("Couldn't get the canonical path for %s", src.GetCString()); + return Status("Couldn't get the canonical path for %s", src.GetCString()); } char real_path[PATH_MAX + 1]; if (realpath(resolved_path, real_path) == nullptr) { - Error err; + Status err; err.SetErrorToErrno(); return err; } dst = FileSpec(real_path, false); - return Error(); + return Status(); } FILE *FileSystem::Fopen(const char *path, const char *mode) { diff --git a/lldb/source/Host/posix/HostProcessPosix.cpp b/lldb/source/Host/posix/HostProcessPosix.cpp index 9dd9fef94cd..b5505dbec65 100644 --- a/lldb/source/Host/posix/HostProcessPosix.cpp +++ b/lldb/source/Host/posix/HostProcessPosix.cpp @@ -29,9 +29,9 @@ HostProcessPosix::HostProcessPosix(lldb::process_t process) HostProcessPosix::~HostProcessPosix() {} -Error HostProcessPosix::Signal(int signo) const { +Status HostProcessPosix::Signal(int signo) const { if (m_process == kInvalidPosixProcess) { - Error error; + Status error; error.SetErrorString("HostProcessPosix refers to an invalid process"); return error; } @@ -39,8 +39,8 @@ Error HostProcessPosix::Signal(int signo) const { return HostProcessPosix::Signal(m_process, signo); } -Error HostProcessPosix::Signal(lldb::process_t process, int signo) { - Error error; +Status HostProcessPosix::Signal(lldb::process_t process, int signo) { + Status error; if (-1 == ::kill(process, signo)) error.SetErrorToErrno(); @@ -48,10 +48,10 @@ Error HostProcessPosix::Signal(lldb::process_t process, int signo) { return error; } -Error HostProcessPosix::Terminate() { return Signal(SIGKILL); } +Status HostProcessPosix::Terminate() { return Signal(SIGKILL); } -Error HostProcessPosix::GetMainModule(FileSpec &file_spec) const { - Error error; +Status HostProcessPosix::GetMainModule(FileSpec &file_spec) const { + Status error; // Use special code here because proc/[pid]/exe is a symbolic link. char link_path[PATH_MAX]; @@ -82,7 +82,7 @@ bool HostProcessPosix::IsRunning() const { return false; // Send this process the null signal. If it succeeds the process is running. - Error error = Signal(0); + Status error = Signal(0); return error.Success(); } diff --git a/lldb/source/Host/posix/HostThreadPosix.cpp b/lldb/source/Host/posix/HostThreadPosix.cpp index 073b7b0b11e..0f4434d25e2 100644 --- a/lldb/source/Host/posix/HostThreadPosix.cpp +++ b/lldb/source/Host/posix/HostThreadPosix.cpp @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// #include "lldb/Host/posix/HostThreadPosix.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include <errno.h> #include <pthread.h> @@ -23,8 +23,8 @@ HostThreadPosix::HostThreadPosix(lldb::thread_t thread) HostThreadPosix::~HostThreadPosix() {} -Error HostThreadPosix::Join(lldb::thread_result_t *result) { - Error error; +Status HostThreadPosix::Join(lldb::thread_result_t *result) { + Status error; if (IsJoinable()) { int err = ::pthread_join(m_thread, result); error.SetError(err, lldb::eErrorTypePOSIX); @@ -38,8 +38,8 @@ Error HostThreadPosix::Join(lldb::thread_result_t *result) { return error; } -Error HostThreadPosix::Cancel() { - Error error; +Status HostThreadPosix::Cancel() { + Status error; if (IsJoinable()) { #ifndef __ANDROID__ #ifndef __FreeBSD__ @@ -54,8 +54,8 @@ Error HostThreadPosix::Cancel() { return error; } -Error HostThreadPosix::Detach() { - Error error; +Status HostThreadPosix::Detach() { + Status error; if (IsJoinable()) { int err = ::pthread_detach(m_thread); error.SetError(err, eErrorTypePOSIX); diff --git a/lldb/source/Host/posix/LockFilePosix.cpp b/lldb/source/Host/posix/LockFilePosix.cpp index d1cc617146d..2b7d548a021 100644 --- a/lldb/source/Host/posix/LockFilePosix.cpp +++ b/lldb/source/Host/posix/LockFilePosix.cpp @@ -16,8 +16,8 @@ using namespace lldb_private; namespace { -Error fileLock(int fd, int cmd, int lock_type, const uint64_t start, - const uint64_t len) { +Status fileLock(int fd, int cmd, int lock_type, const uint64_t start, + const uint64_t len) { struct flock fl; fl.l_type = lock_type; @@ -26,7 +26,7 @@ Error fileLock(int fd, int cmd, int lock_type, const uint64_t start, fl.l_len = len; fl.l_pid = ::getpid(); - Error error; + Status error; if (::fcntl(fd, cmd, &fl) == -1) error.SetErrorToErrno(); @@ -39,22 +39,22 @@ LockFilePosix::LockFilePosix(int fd) : LockFileBase(fd) {} LockFilePosix::~LockFilePosix() { Unlock(); } -Error LockFilePosix::DoWriteLock(const uint64_t start, const uint64_t len) { +Status LockFilePosix::DoWriteLock(const uint64_t start, const uint64_t len) { return fileLock(m_fd, F_SETLKW, F_WRLCK, start, len); } -Error LockFilePosix::DoTryWriteLock(const uint64_t start, const uint64_t len) { +Status LockFilePosix::DoTryWriteLock(const uint64_t start, const uint64_t len) { return fileLock(m_fd, F_SETLK, F_WRLCK, start, len); } -Error LockFilePosix::DoReadLock(const uint64_t start, const uint64_t len) { +Status LockFilePosix::DoReadLock(const uint64_t start, const uint64_t len) { return fileLock(m_fd, F_SETLKW, F_RDLCK, start, len); } -Error LockFilePosix::DoTryReadLock(const uint64_t start, const uint64_t len) { +Status LockFilePosix::DoTryReadLock(const uint64_t start, const uint64_t len) { return fileLock(m_fd, F_SETLK, F_RDLCK, start, len); } -Error LockFilePosix::DoUnlock() { +Status LockFilePosix::DoUnlock() { return fileLock(m_fd, F_SETLK, F_UNLCK, m_start, m_len); } diff --git a/lldb/source/Host/posix/PipePosix.cpp b/lldb/source/Host/posix/PipePosix.cpp index 3ac5d480de8..da99fd70242 100644 --- a/lldb/source/Host/posix/PipePosix.cpp +++ b/lldb/source/Host/posix/PipePosix.cpp @@ -82,11 +82,11 @@ PipePosix &PipePosix::operator=(PipePosix &&pipe_posix) { PipePosix::~PipePosix() { Close(); } -Error PipePosix::CreateNew(bool child_processes_inherit) { +Status PipePosix::CreateNew(bool child_processes_inherit) { if (CanRead() || CanWrite()) - return Error(EINVAL, eErrorTypePOSIX); + return Status(EINVAL, eErrorTypePOSIX); - Error error; + Status error; #if PIPE2_SUPPORTED if (::pipe2(m_fds, (child_processes_inherit) ? 0 : O_CLOEXEC) == 0) return error; @@ -111,20 +111,20 @@ Error PipePosix::CreateNew(bool child_processes_inherit) { return error; } -Error PipePosix::CreateNew(llvm::StringRef name, bool child_process_inherit) { +Status PipePosix::CreateNew(llvm::StringRef name, bool child_process_inherit) { if (CanRead() || CanWrite()) - return Error("Pipe is already opened"); + return Status("Pipe is already opened"); - Error error; + Status error; if (::mkfifo(name.data(), 0660) != 0) error.SetErrorToErrno(); return error; } -Error PipePosix::CreateWithUniqueName(llvm::StringRef prefix, - bool child_process_inherit, - llvm::SmallVectorImpl<char> &name) { +Status PipePosix::CreateWithUniqueName(llvm::StringRef prefix, + bool child_process_inherit, + llvm::SmallVectorImpl<char> &name) { llvm::SmallString<PATH_MAX> named_pipe_path; llvm::SmallString<PATH_MAX> pipe_spec((prefix + ".%%%%%%").str()); FileSpec tmpdir_file_spec; @@ -139,7 +139,7 @@ Error PipePosix::CreateWithUniqueName(llvm::StringRef prefix, // It's possible that another process creates the target path after we've // verified it's available but before we create it, in which case we // should try again. - Error error; + Status error; do { llvm::sys::fs::createUniqueFile(tmpdir_file_spec.GetPath(), named_pipe_path); @@ -151,16 +151,16 @@ Error PipePosix::CreateWithUniqueName(llvm::StringRef prefix, return error; } -Error PipePosix::OpenAsReader(llvm::StringRef name, - bool child_process_inherit) { +Status PipePosix::OpenAsReader(llvm::StringRef name, + bool child_process_inherit) { if (CanRead() || CanWrite()) - return Error("Pipe is already opened"); + return Status("Pipe is already opened"); int flags = O_RDONLY | O_NONBLOCK; if (!child_process_inherit) flags |= O_CLOEXEC; - Error error; + Status error; int fd = ::open(name.data(), flags); if (fd != -1) m_fds[READ] = fd; @@ -170,11 +170,12 @@ Error PipePosix::OpenAsReader(llvm::StringRef name, return error; } -Error PipePosix::OpenAsWriterWithTimeout( - llvm::StringRef name, bool child_process_inherit, - const std::chrono::microseconds &timeout) { +Status +PipePosix::OpenAsWriterWithTimeout(llvm::StringRef name, + bool child_process_inherit, + const std::chrono::microseconds &timeout) { if (CanRead() || CanWrite()) - return Error("Pipe is already opened"); + return Status("Pipe is already opened"); int flags = O_WRONLY | O_NONBLOCK; if (!child_process_inherit) @@ -187,7 +188,7 @@ Error PipePosix::OpenAsWriterWithTimeout( if (timeout != microseconds::zero()) { const auto dur = duration_cast<microseconds>(finish_time - Now()).count(); if (dur <= 0) - return Error("timeout exceeded - reader hasn't opened so far"); + return Status("timeout exceeded - reader hasn't opened so far"); } errno = 0; @@ -196,7 +197,7 @@ Error PipePosix::OpenAsWriterWithTimeout( const auto errno_copy = errno; // We may get ENXIO if a reader side of the pipe hasn't opened yet. if (errno_copy != ENXIO) - return Error(errno_copy, eErrorTypePOSIX); + return Status(errno_copy, eErrorTypePOSIX); std::this_thread::sleep_for( milliseconds(OPEN_WRITER_SLEEP_TIMEOUT_MSECS)); @@ -205,7 +206,7 @@ Error PipePosix::OpenAsWriterWithTimeout( } } - return Error(); + return Status(); } int PipePosix::GetReadFileDescriptor() const { return m_fds[READ]; } @@ -229,7 +230,7 @@ void PipePosix::Close() { CloseWriteFileDescriptor(); } -Error PipePosix::Delete(llvm::StringRef name) { +Status PipePosix::Delete(llvm::StringRef name) { return llvm::sys::fs::remove(name); } @@ -255,12 +256,12 @@ void PipePosix::CloseWriteFileDescriptor() { } } -Error PipePosix::ReadWithTimeout(void *buf, size_t size, - const std::chrono::microseconds &timeout, - size_t &bytes_read) { +Status PipePosix::ReadWithTimeout(void *buf, size_t size, + const std::chrono::microseconds &timeout, + size_t &bytes_read) { bytes_read = 0; if (!CanRead()) - return Error(EINVAL, eErrorTypePOSIX); + return Status(EINVAL, eErrorTypePOSIX); const int fd = GetReadFileDescriptor(); @@ -268,7 +269,7 @@ Error PipePosix::ReadWithTimeout(void *buf, size_t size, select_helper.SetTimeout(timeout); select_helper.FDSetRead(fd); - Error error; + Status error; while (error.Success()) { error = select_helper.Select(); if (error.Success()) { @@ -287,17 +288,17 @@ Error PipePosix::ReadWithTimeout(void *buf, size_t size, return error; } -Error PipePosix::Write(const void *buf, size_t size, size_t &bytes_written) { +Status PipePosix::Write(const void *buf, size_t size, size_t &bytes_written) { bytes_written = 0; if (!CanWrite()) - return Error(EINVAL, eErrorTypePOSIX); + return Status(EINVAL, eErrorTypePOSIX); const int fd = GetWriteFileDescriptor(); SelectHelper select_helper; select_helper.SetTimeout(std::chrono::seconds(0)); select_helper.FDSetWrite(fd); - Error error; + Status error; while (error.Success()) { error = select_helper.Select(); if (error.Success()) { diff --git a/lldb/source/Host/posix/ProcessLauncherPosix.cpp b/lldb/source/Host/posix/ProcessLauncherPosix.cpp index f90bf0cd88a..6d07be1eec6 100644 --- a/lldb/source/Host/posix/ProcessLauncherPosix.cpp +++ b/lldb/source/Host/posix/ProcessLauncherPosix.cpp @@ -20,7 +20,7 @@ using namespace lldb_private; HostProcess ProcessLauncherPosix::LaunchProcess(const ProcessLaunchInfo &launch_info, - Error &error) { + Status &error) { lldb::pid_t pid; char exe_path[PATH_MAX]; diff --git a/lldb/source/Host/posix/ProcessLauncherPosixFork.cpp b/lldb/source/Host/posix/ProcessLauncherPosixFork.cpp index 91c32d6e642..378670cd2a9 100644 --- a/lldb/source/Host/posix/ProcessLauncherPosixFork.cpp +++ b/lldb/source/Host/posix/ProcessLauncherPosixFork.cpp @@ -190,7 +190,7 @@ static void LLVM_ATTRIBUTE_NORETURN ChildFunc(int error_fd, HostProcess ProcessLauncherPosixFork::LaunchProcess(const ProcessLaunchInfo &launch_info, - Error &error) { + Status &error) { char exe_path[PATH_MAX]; launch_info.GetExecutableFile().GetPath(exe_path, sizeof(exe_path)); diff --git a/lldb/source/Host/windows/ConnectionGenericFileWindows.cpp b/lldb/source/Host/windows/ConnectionGenericFileWindows.cpp index 8fc038f3f9b..41bdb5f41fb 100644 --- a/lldb/source/Host/windows/ConnectionGenericFileWindows.cpp +++ b/lldb/source/Host/windows/ConnectionGenericFileWindows.cpp @@ -8,8 +8,8 @@ //===----------------------------------------------------------------------===// #include "lldb/Host/windows/ConnectionGenericFileWindows.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/Timeout.h" #include "llvm/ADT/STLExtras.h" @@ -43,10 +43,10 @@ public: size_t GetBytes() const { return m_bytes; } ConnectionStatus GetStatus() const { return m_status; } - const Error &GetError() const { return m_error; } + const Status &GetError() const { return m_error; } private: - Error m_error; + Status m_error; size_t m_bytes; ConnectionStatus m_status; }; @@ -94,7 +94,7 @@ bool ConnectionGenericFile::IsConnected() const { } lldb::ConnectionStatus ConnectionGenericFile::Connect(llvm::StringRef path, - Error *error_ptr) { + Status *error_ptr) { Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION)); if (log) log->Printf("%p ConnectionGenericFile::Connect (url = '%s')", @@ -137,7 +137,7 @@ lldb::ConnectionStatus ConnectionGenericFile::Connect(llvm::StringRef path, return eConnectionStatusSuccess; } -lldb::ConnectionStatus ConnectionGenericFile::Disconnect(Error *error_ptr) { +lldb::ConnectionStatus ConnectionGenericFile::Disconnect(Status *error_ptr) { Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION)); if (log) log->Printf("%p ConnectionGenericFile::Disconnect ()", @@ -171,7 +171,7 @@ lldb::ConnectionStatus ConnectionGenericFile::Disconnect(Error *error_ptr) { size_t ConnectionGenericFile::Read(void *dst, size_t dst_len, const Timeout<std::micro> &timeout, lldb::ConnectionStatus &status, - Error *error_ptr) { + Status *error_ptr) { ReturnInfo return_info; BOOL result = 0; DWORD bytes_read = 0; @@ -269,7 +269,7 @@ finish: size_t ConnectionGenericFile::Write(const void *src, size_t src_len, lldb::ConnectionStatus &status, - Error *error_ptr) { + Status *error_ptr) { ReturnInfo return_info; DWORD bytes_written = 0; BOOL result = 0; diff --git a/lldb/source/Host/windows/FileSystem.cpp b/lldb/source/Host/windows/FileSystem.cpp index 092b70b1f4d..02b7e550f86 100644 --- a/lldb/source/Host/windows/FileSystem.cpp +++ b/lldb/source/Host/windows/FileSystem.cpp @@ -27,8 +27,8 @@ const char *FileSystem::DEV_NULL = "nul"; const char *FileSystem::PATH_CONVERSION_ERROR = "Error converting path between UTF-8 and native encoding"; -Error FileSystem::Symlink(const FileSpec &src, const FileSpec &dst) { - Error error; +Status FileSystem::Symlink(const FileSpec &src, const FileSpec &dst) { + Status error; std::wstring wsrc, wdst; if (!llvm::ConvertUTF8toWide(src.GetCString(), wsrc) || !llvm::ConvertUTF8toWide(dst.GetCString(), wdst)) @@ -48,8 +48,8 @@ Error FileSystem::Symlink(const FileSpec &src, const FileSpec &dst) { return error; } -Error FileSystem::Readlink(const FileSpec &src, FileSpec &dst) { - Error error; +Status FileSystem::Readlink(const FileSpec &src, FileSpec &dst) { + Status error; std::wstring wsrc; if (!llvm::ConvertUTF8toWide(src.GetCString(), wsrc)) { error.SetErrorString(PATH_CONVERSION_ERROR); @@ -81,8 +81,8 @@ Error FileSystem::Readlink(const FileSpec &src, FileSpec &dst) { return error; } -Error FileSystem::ResolveSymbolicLink(const FileSpec &src, FileSpec &dst) { - return Error("ResolveSymbolicLink() isn't implemented on Windows"); +Status FileSystem::ResolveSymbolicLink(const FileSpec &src, FileSpec &dst) { + return Status("ResolveSymbolicLink() isn't implemented on Windows"); } FILE *FileSystem::Fopen(const char *path, const char *mode) { diff --git a/lldb/source/Host/windows/Host.cpp b/lldb/source/Host/windows/Host.cpp index 9a6957b2a1f..e1acd23d5c8 100644 --- a/lldb/source/Host/windows/Host.cpp +++ b/lldb/source/Host/windows/Host.cpp @@ -16,8 +16,8 @@ // Other libraries and framework includes // Project includes #include "lldb/Target/Process.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" #include "lldb/Core/StreamFile.h" #include "lldb/Core/StructuredData.h" @@ -50,7 +50,7 @@ bool GetTripleForProcess(const FileSpec &executable, llvm::Triple &triple) { imageBinary.SeekFromStart(peOffset); imageBinary.Read(&peHead, readSize); if (peHead != 0x00004550) // "PE\0\0", little-endian - return false; // Error: Can't find PE header + return false; // Status: Can't find PE header readSize = 2; imageBinary.Read(&machineType, readSize); triple.setVendor(llvm::Triple::PC); @@ -196,8 +196,8 @@ HostThread Host::StartMonitoringChildProcess( return HostThread(); } -Error Host::ShellExpandArguments(ProcessLaunchInfo &launch_info) { - Error error; +Status Host::ShellExpandArguments(ProcessLaunchInfo &launch_info) { + Status error; if (launch_info.GetFlags().Test(eLaunchFlagShellExpandArguments)) { FileSpec expand_tool_spec; if (!HostInfo::GetLLDBPath(lldb::ePathTypeSupportExecutableDir, diff --git a/lldb/source/Host/windows/HostProcessWindows.cpp b/lldb/source/Host/windows/HostProcessWindows.cpp index 3bbc84a4ca5..49d42ce0542 100644 --- a/lldb/source/Host/windows/HostProcessWindows.cpp +++ b/lldb/source/Host/windows/HostProcessWindows.cpp @@ -37,8 +37,8 @@ HostProcessWindows::~HostProcessWindows() { Close(); } void HostProcessWindows::SetOwnsHandle(bool owns) { m_owns_handle = owns; } -Error HostProcessWindows::Terminate() { - Error error; +Status HostProcessWindows::Terminate() { + Status error; if (m_process == nullptr) error.SetError(ERROR_INVALID_HANDLE, lldb::eErrorTypeWin32); @@ -48,8 +48,8 @@ Error HostProcessWindows::Terminate() { return error; } -Error HostProcessWindows::GetMainModule(FileSpec &file_spec) const { - Error error; +Status HostProcessWindows::GetMainModule(FileSpec &file_spec) const { + Status error; if (m_process == nullptr) error.SetError(ERROR_INVALID_HANDLE, lldb::eErrorTypeWin32); diff --git a/lldb/source/Host/windows/HostThreadWindows.cpp b/lldb/source/Host/windows/HostThreadWindows.cpp index aa791714c33..3d603ff6166 100644 --- a/lldb/source/Host/windows/HostThreadWindows.cpp +++ b/lldb/source/Host/windows/HostThreadWindows.cpp @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/Host/windows/HostThreadWindows.h" #include "lldb/Host/windows/windows.h" @@ -33,8 +33,8 @@ HostThreadWindows::~HostThreadWindows() { Reset(); } void HostThreadWindows::SetOwnsHandle(bool owns) { m_owns_handle = owns; } -Error HostThreadWindows::Join(lldb::thread_result_t *result) { - Error error; +Status HostThreadWindows::Join(lldb::thread_result_t *result) { + Status error; if (IsJoinable()) { DWORD wait_result = ::WaitForSingleObject(m_thread, INFINITE); if (WAIT_OBJECT_0 == wait_result && result) { @@ -51,8 +51,8 @@ Error HostThreadWindows::Join(lldb::thread_result_t *result) { return error; } -Error HostThreadWindows::Cancel() { - Error error; +Status HostThreadWindows::Cancel() { + Status error; DWORD result = ::QueueUserAPC(::ExitThreadProxy, m_thread, 0); error.SetError(result, eErrorTypeWin32); diff --git a/lldb/source/Host/windows/LockFileWindows.cpp b/lldb/source/Host/windows/LockFileWindows.cpp index 0e7f595e6cf..2178fd1f5f6 100644 --- a/lldb/source/Host/windows/LockFileWindows.cpp +++ b/lldb/source/Host/windows/LockFileWindows.cpp @@ -16,22 +16,22 @@ using namespace lldb_private; namespace { -Error fileLock(HANDLE file_handle, DWORD flags, const uint64_t start, - const uint64_t len) { +Status fileLock(HANDLE file_handle, DWORD flags, const uint64_t start, + const uint64_t len) { if (start != 0) - return Error("Non-zero start lock regions are not supported"); + return Status("Non-zero start lock regions are not supported"); OVERLAPPED overlapped = {}; if (!::LockFileEx(file_handle, flags, 0, len, 0, &overlapped) && ::GetLastError() != ERROR_IO_PENDING) - return Error(::GetLastError(), eErrorTypeWin32); + return Status(::GetLastError(), eErrorTypeWin32); DWORD bytes; if (!::GetOverlappedResult(file_handle, &overlapped, &bytes, TRUE)) - return Error(::GetLastError(), eErrorTypeWin32); + return Status(::GetLastError(), eErrorTypeWin32); - return Error(); + return Status(); } } // namespace @@ -45,34 +45,35 @@ bool LockFileWindows::IsValidFile() const { return LockFileBase::IsValidFile() && m_file != INVALID_HANDLE_VALUE; } -Error LockFileWindows::DoWriteLock(const uint64_t start, const uint64_t len) { +Status LockFileWindows::DoWriteLock(const uint64_t start, const uint64_t len) { return fileLock(m_file, LOCKFILE_EXCLUSIVE_LOCK, start, len); } -Error LockFileWindows::DoTryWriteLock(const uint64_t start, - const uint64_t len) { +Status LockFileWindows::DoTryWriteLock(const uint64_t start, + const uint64_t len) { return fileLock(m_file, LOCKFILE_EXCLUSIVE_LOCK | LOCKFILE_FAIL_IMMEDIATELY, start, len); } -Error LockFileWindows::DoReadLock(const uint64_t start, const uint64_t len) { +Status LockFileWindows::DoReadLock(const uint64_t start, const uint64_t len) { return fileLock(m_file, 0, start, len); } -Error LockFileWindows::DoTryReadLock(const uint64_t start, const uint64_t len) { +Status LockFileWindows::DoTryReadLock(const uint64_t start, + const uint64_t len) { return fileLock(m_file, LOCKFILE_FAIL_IMMEDIATELY, start, len); } -Error LockFileWindows::DoUnlock() { +Status LockFileWindows::DoUnlock() { OVERLAPPED overlapped = {}; if (!::UnlockFileEx(m_file, 0, m_len, 0, &overlapped) && ::GetLastError() != ERROR_IO_PENDING) - return Error(::GetLastError(), eErrorTypeWin32); + return Status(::GetLastError(), eErrorTypeWin32); DWORD bytes; if (!::GetOverlappedResult(m_file, &overlapped, &bytes, TRUE)) - return Error(::GetLastError(), eErrorTypeWin32); + return Status(::GetLastError(), eErrorTypeWin32); - return Error(); + return Status(); } diff --git a/lldb/source/Host/windows/PipeWindows.cpp b/lldb/source/Host/windows/PipeWindows.cpp index 407f0468e6c..e8f4753d11e 100644 --- a/lldb/source/Host/windows/PipeWindows.cpp +++ b/lldb/source/Host/windows/PipeWindows.cpp @@ -39,7 +39,7 @@ PipeWindows::PipeWindows() { PipeWindows::~PipeWindows() { Close(); } -Error PipeWindows::CreateNew(bool child_process_inherit) { +Status PipeWindows::CreateNew(bool child_process_inherit) { // Even for anonymous pipes, we open a named pipe. This is because you cannot // get // overlapped i/o on Windows without using a named pipe. So we synthesize a @@ -54,12 +54,13 @@ Error PipeWindows::CreateNew(bool child_process_inherit) { return CreateNew(pipe_name.c_str(), child_process_inherit); } -Error PipeWindows::CreateNew(llvm::StringRef name, bool child_process_inherit) { +Status PipeWindows::CreateNew(llvm::StringRef name, + bool child_process_inherit) { if (name.empty()) - return Error(ERROR_INVALID_PARAMETER, eErrorTypeWin32); + return Status(ERROR_INVALID_PARAMETER, eErrorTypeWin32); if (CanRead() || CanWrite()) - return Error(ERROR_ALREADY_EXISTS, eErrorTypeWin32); + return Status(ERROR_ALREADY_EXISTS, eErrorTypeWin32); std::string pipe_path = "\\\\.\\Pipe\\"; pipe_path.append(name); @@ -71,13 +72,13 @@ Error PipeWindows::CreateNew(llvm::StringRef name, bool child_process_inherit) { pipe_path.c_str(), PIPE_ACCESS_INBOUND | read_mode, PIPE_TYPE_BYTE | PIPE_WAIT, 1, 1024, 1024, 120 * 1000, NULL); if (INVALID_HANDLE_VALUE == m_read) - return Error(::GetLastError(), eErrorTypeWin32); + return Status(::GetLastError(), eErrorTypeWin32); m_read_fd = _open_osfhandle((intptr_t)m_read, _O_RDONLY); ZeroMemory(&m_read_overlapped, sizeof(m_read_overlapped)); m_read_overlapped.hEvent = ::CreateEvent(nullptr, TRUE, FALSE, nullptr); // Open the write end of the pipe. - Error result = OpenNamedPipe(name, child_process_inherit, false); + Status result = OpenNamedPipe(name, child_process_inherit, false); if (!result.Success()) { CloseReadFileDescriptor(); return result; @@ -86,11 +87,11 @@ Error PipeWindows::CreateNew(llvm::StringRef name, bool child_process_inherit) { return result; } -Error PipeWindows::CreateWithUniqueName(llvm::StringRef prefix, - bool child_process_inherit, - llvm::SmallVectorImpl<char> &name) { +Status PipeWindows::CreateWithUniqueName(llvm::StringRef prefix, + bool child_process_inherit, + llvm::SmallVectorImpl<char> &name) { llvm::SmallString<128> pipe_name; - Error error; + Status error; ::UUID unique_id; RPC_CSTR unique_string; RPC_STATUS status = ::UuidCreate(&unique_id); @@ -110,27 +111,28 @@ Error PipeWindows::CreateWithUniqueName(llvm::StringRef prefix, return error; } -Error PipeWindows::OpenAsReader(llvm::StringRef name, - bool child_process_inherit) { +Status PipeWindows::OpenAsReader(llvm::StringRef name, + bool child_process_inherit) { if (CanRead() || CanWrite()) - return Error(ERROR_ALREADY_EXISTS, eErrorTypeWin32); + return Status(ERROR_ALREADY_EXISTS, eErrorTypeWin32); return OpenNamedPipe(name, child_process_inherit, true); } -Error PipeWindows::OpenAsWriterWithTimeout( - llvm::StringRef name, bool child_process_inherit, - const std::chrono::microseconds &timeout) { +Status +PipeWindows::OpenAsWriterWithTimeout(llvm::StringRef name, + bool child_process_inherit, + const std::chrono::microseconds &timeout) { if (CanRead() || CanWrite()) - return Error(ERROR_ALREADY_EXISTS, eErrorTypeWin32); + return Status(ERROR_ALREADY_EXISTS, eErrorTypeWin32); return OpenNamedPipe(name, child_process_inherit, false); } -Error PipeWindows::OpenNamedPipe(llvm::StringRef name, - bool child_process_inherit, bool is_read) { +Status PipeWindows::OpenNamedPipe(llvm::StringRef name, + bool child_process_inherit, bool is_read) { if (name.empty()) - return Error(ERROR_INVALID_PARAMETER, eErrorTypeWin32); + return Status(ERROR_INVALID_PARAMETER, eErrorTypeWin32); assert(is_read ? !CanRead() : !CanWrite()); @@ -144,7 +146,7 @@ Error PipeWindows::OpenNamedPipe(llvm::StringRef name, m_read = ::CreateFileA(pipe_path.c_str(), GENERIC_READ, 0, &attributes, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL); if (INVALID_HANDLE_VALUE == m_read) - return Error(::GetLastError(), eErrorTypeWin32); + return Status(::GetLastError(), eErrorTypeWin32); m_read_fd = _open_osfhandle((intptr_t)m_read, _O_RDONLY); @@ -154,14 +156,14 @@ Error PipeWindows::OpenNamedPipe(llvm::StringRef name, m_write = ::CreateFileA(pipe_path.c_str(), GENERIC_WRITE, 0, &attributes, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL); if (INVALID_HANDLE_VALUE == m_write) - return Error(::GetLastError(), eErrorTypeWin32); + return Status(::GetLastError(), eErrorTypeWin32); m_write_fd = _open_osfhandle((intptr_t)m_write, _O_WRONLY); ZeroMemory(&m_write_overlapped, sizeof(m_write_overlapped)); } - return Error(); + return Status(); } int PipeWindows::GetReadFileDescriptor() const { return m_read_fd; } @@ -217,7 +219,7 @@ void PipeWindows::Close() { CloseWriteFileDescriptor(); } -Error PipeWindows::Delete(llvm::StringRef name) { return Error(); } +Status PipeWindows::Delete(llvm::StringRef name) { return Status(); } bool PipeWindows::CanRead() const { return (m_read != INVALID_HANDLE_VALUE); } @@ -229,18 +231,18 @@ PipeWindows::GetReadNativeHandle() { return m_read; } HANDLE PipeWindows::GetWriteNativeHandle() { return m_write; } -Error PipeWindows::ReadWithTimeout(void *buf, size_t size, - const std::chrono::microseconds &duration, - size_t &bytes_read) { +Status PipeWindows::ReadWithTimeout(void *buf, size_t size, + const std::chrono::microseconds &duration, + size_t &bytes_read) { if (!CanRead()) - return Error(ERROR_INVALID_HANDLE, eErrorTypeWin32); + return Status(ERROR_INVALID_HANDLE, eErrorTypeWin32); bytes_read = 0; DWORD sys_bytes_read = size; BOOL result = ::ReadFile(m_read, buf, sys_bytes_read, &sys_bytes_read, &m_read_overlapped); if (!result && GetLastError() != ERROR_IO_PENDING) - return Error(::GetLastError(), eErrorTypeWin32); + return Status(::GetLastError(), eErrorTypeWin32); DWORD timeout = (duration == std::chrono::microseconds::zero()) ? INFINITE @@ -263,33 +265,33 @@ Error PipeWindows::ReadWithTimeout(void *buf, size_t size, failed = false; } if (failed) - return Error(failure_error, eErrorTypeWin32); + return Status(failure_error, eErrorTypeWin32); } // Now we call GetOverlappedResult setting bWait to false, since we've already // waited // as long as we're willing to. if (!GetOverlappedResult(m_read, &m_read_overlapped, &sys_bytes_read, FALSE)) - return Error(::GetLastError(), eErrorTypeWin32); + return Status(::GetLastError(), eErrorTypeWin32); bytes_read = sys_bytes_read; - return Error(); + return Status(); } -Error PipeWindows::Write(const void *buf, size_t num_bytes, - size_t &bytes_written) { +Status PipeWindows::Write(const void *buf, size_t num_bytes, + size_t &bytes_written) { if (!CanWrite()) - return Error(ERROR_INVALID_HANDLE, eErrorTypeWin32); + return Status(ERROR_INVALID_HANDLE, eErrorTypeWin32); DWORD sys_bytes_written = 0; BOOL write_result = ::WriteFile(m_write, buf, num_bytes, &sys_bytes_written, &m_write_overlapped); if (!write_result && GetLastError() != ERROR_IO_PENDING) - return Error(::GetLastError(), eErrorTypeWin32); + return Status(::GetLastError(), eErrorTypeWin32); BOOL result = GetOverlappedResult(m_write, &m_write_overlapped, &sys_bytes_written, TRUE); if (!result) - return Error(::GetLastError(), eErrorTypeWin32); - return Error(); + return Status(::GetLastError(), eErrorTypeWin32); + return Status(); } diff --git a/lldb/source/Host/windows/ProcessLauncherWindows.cpp b/lldb/source/Host/windows/ProcessLauncherWindows.cpp index 16805ba7df8..56089742f09 100644 --- a/lldb/source/Host/windows/ProcessLauncherWindows.cpp +++ b/lldb/source/Host/windows/ProcessLauncherWindows.cpp @@ -41,7 +41,7 @@ void CreateEnvironmentBuffer(const Args &env, std::vector<char> &buffer) { HostProcess ProcessLauncherWindows::LaunchProcess(const ProcessLaunchInfo &launch_info, - Error &error) { + Status &error) { error.Clear(); std::string executable; diff --git a/lldb/source/Interpreter/Args.cpp b/lldb/source/Interpreter/Args.cpp index 5bfe13f55e4..a23ba3094b2 100644 --- a/lldb/source/Interpreter/Args.cpp +++ b/lldb/source/Interpreter/Args.cpp @@ -420,10 +420,10 @@ void Args::SetArguments(const char **argv) { SetArguments(ArgvToArgc(argv), argv); } -Error Args::ParseOptions(Options &options, ExecutionContext *execution_context, - PlatformSP platform_sp, bool require_validation) { +Status Args::ParseOptions(Options &options, ExecutionContext *execution_context, + PlatformSP platform_sp, bool require_validation) { StreamString sstr; - Error error; + Status error; Option *long_options = options.GetLongOptions(); if (long_options == nullptr) { error.SetErrorStringWithFormat("invalid long options"); @@ -547,7 +547,7 @@ void Args::Clear() { lldb::addr_t Args::StringToAddress(const ExecutionContext *exe_ctx, llvm::StringRef s, lldb::addr_t fail_value, - Error *error_ptr) { + Status *error_ptr) { bool error_set = false; if (s.empty()) { if (error_ptr) @@ -630,7 +630,7 @@ lldb::addr_t Args::StringToAddress(const ExecutionContext *exe_ctx, if (regex_match.GetMatchAtIndex(s, 3, str)) { if (!llvm::StringRef(str).getAsInteger(0, offset)) { - Error error; + Status error; addr = StringToAddress(exe_ctx, name.c_str(), LLDB_INVALID_ADDRESS, &error); if (addr != LLDB_INVALID_ADDRESS) { @@ -774,7 +774,7 @@ const char *Args::GetShellSafeArgument(const FileSpec &shell, int64_t Args::StringToOptionEnum(llvm::StringRef s, OptionEnumValueElement *enum_values, - int32_t fail_value, Error &error) { + int32_t fail_value, Status &error) { error.Clear(); if (!enum_values) { error.SetErrorString("invalid enumeration argument"); @@ -819,10 +819,10 @@ Args::StringToScriptLanguage(llvm::StringRef s, lldb::ScriptLanguage fail_value, return fail_value; } -Error Args::StringToFormat(const char *s, lldb::Format &format, - size_t *byte_size_ptr) { +Status Args::StringToFormat(const char *s, lldb::Format &format, + size_t *byte_size_ptr) { format = eFormatInvalid; - Error error; + Status error; if (s && s[0]) { if (byte_size_ptr) { diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp index 8703bc97f06..ade9ddfa9de 100644 --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -1373,7 +1373,7 @@ CommandObject *CommandInterpreter::BuildAliasResult( return alias_cmd_obj; } -Error CommandInterpreter::PreprocessCommand(std::string &command) { +Status CommandInterpreter::PreprocessCommand(std::string &command) { // The command preprocessor needs to do things to the command // line before any parsing of arguments or anything else is done. // The only current stuff that gets preprocessed is anything enclosed @@ -1381,7 +1381,7 @@ Error CommandInterpreter::PreprocessCommand(std::string &command) { // the result of the expression must be a scalar that can be substituted // into the command. An example would be: // (lldb) memory read `$rsp + 20` - Error error; // Error for any expressions that might not evaluate + Status error; // Status for any expressions that might not evaluate size_t start_backtick; size_t pos = 0; while ((start_backtick = command.find('`', pos)) != std::string::npos) { @@ -1601,7 +1601,7 @@ bool CommandInterpreter::HandleCommand(const char *command_line, return true; } - Error error(PreprocessCommand(command_string)); + Status error(PreprocessCommand(command_string)); if (error.Fail()) { result.AppendError(error.AsCString()); @@ -2355,8 +2355,8 @@ void CommandInterpreter::HandleCommandsFromFile( StreamFileSP input_file_sp(new StreamFile()); std::string cmd_file_path = cmd_file.GetPath(); - Error error = input_file_sp->GetFile().Open(cmd_file_path.c_str(), - File::eOpenOptionRead); + Status error = input_file_sp->GetFile().Open(cmd_file_path.c_str(), + File::eOpenOptionRead); if (error.Success()) { Debugger &debugger = GetDebugger(); @@ -2653,7 +2653,7 @@ size_t CommandInterpreter::GetProcessOutput() { char stdio_buffer[1024]; size_t len; size_t total_bytes = 0; - Error error; + Status error; TargetSP target_sp(m_debugger.GetTargetList().GetSelectedTarget()); if (target_sp) { ProcessSP process_sp(target_sp->GetProcessSP()); diff --git a/lldb/source/Interpreter/CommandObject.cpp b/lldb/source/Interpreter/CommandObject.cpp index 2a6c77d7deb..f9a5b10bb4b 100644 --- a/lldb/source/Interpreter/CommandObject.cpp +++ b/lldb/source/Interpreter/CommandObject.cpp @@ -99,7 +99,7 @@ bool CommandObject::ParseOptions(Args &args, CommandReturnObject &result) { // See if the subclass has options? Options *options = GetOptions(); if (options != nullptr) { - Error error; + Status error; auto exe_ctx = GetCommandInterpreter().GetExecutionContext(); options->NotifyOptionParsingStarting(&exe_ctx); diff --git a/lldb/source/Interpreter/CommandReturnObject.cpp b/lldb/source/Interpreter/CommandReturnObject.cpp index 00fcff510cf..75c02588066 100644 --- a/lldb/source/Interpreter/CommandReturnObject.cpp +++ b/lldb/source/Interpreter/CommandReturnObject.cpp @@ -13,7 +13,7 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/StreamString.h" using namespace lldb; @@ -111,7 +111,7 @@ void CommandReturnObject::AppendError(llvm::StringRef in_string) { GetErrorStream() << "error: " << in_string << "\n"; } -void CommandReturnObject::SetError(const Error &error, +void CommandReturnObject::SetError(const Status &error, const char *fallback_error_cstr) { const char *error_cstr = error.AsCString(); if (error_cstr == nullptr) @@ -127,7 +127,7 @@ void CommandReturnObject::SetError(llvm::StringRef error_str) { SetStatus(eReturnStatusFailed); } -// Similar to AppendError, but do not prepend 'Error: ' to message, and +// Similar to AppendError, but do not prepend 'Status: ' to message, and // don't append "\n" to the end of it. void CommandReturnObject::AppendRawError(llvm::StringRef in_string) { diff --git a/lldb/source/Interpreter/OptionGroupArchitecture.cpp b/lldb/source/Interpreter/OptionGroupArchitecture.cpp index 4a6bf48a24d..d5354fe0739 100644 --- a/lldb/source/Interpreter/OptionGroupArchitecture.cpp +++ b/lldb/source/Interpreter/OptionGroupArchitecture.cpp @@ -41,10 +41,11 @@ bool OptionGroupArchitecture::GetArchitecture(Platform *platform, return arch.IsValid(); } -Error OptionGroupArchitecture::SetOptionValue( - uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) { - Error error; +Status +OptionGroupArchitecture::SetOptionValue(uint32_t option_idx, + llvm::StringRef option_arg, + ExecutionContext *execution_context) { + Status error; const int short_option = g_option_table[option_idx].short_option; switch (short_option) { diff --git a/lldb/source/Interpreter/OptionGroupBoolean.cpp b/lldb/source/Interpreter/OptionGroupBoolean.cpp index 4956b83c8f7..5fd4ce7aecf 100644 --- a/lldb/source/Interpreter/OptionGroupBoolean.cpp +++ b/lldb/source/Interpreter/OptionGroupBoolean.cpp @@ -40,10 +40,10 @@ OptionGroupBoolean::OptionGroupBoolean(uint32_t usage_mask, bool required, OptionGroupBoolean::~OptionGroupBoolean() {} -Error OptionGroupBoolean::SetOptionValue(uint32_t option_idx, - llvm::StringRef option_value, - ExecutionContext *execution_context) { - Error error; +Status OptionGroupBoolean::SetOptionValue(uint32_t option_idx, + llvm::StringRef option_value, + ExecutionContext *execution_context) { + Status error; if (m_option_definition.option_has_arg == OptionParser::eNoArgument) { // Not argument, toggle the default value and mark the option as having been // set diff --git a/lldb/source/Interpreter/OptionGroupFile.cpp b/lldb/source/Interpreter/OptionGroupFile.cpp index 995a6a46e48..d45f00a6661 100644 --- a/lldb/source/Interpreter/OptionGroupFile.cpp +++ b/lldb/source/Interpreter/OptionGroupFile.cpp @@ -38,10 +38,10 @@ OptionGroupFile::OptionGroupFile(uint32_t usage_mask, bool required, OptionGroupFile::~OptionGroupFile() {} -Error OptionGroupFile::SetOptionValue(uint32_t option_idx, - llvm::StringRef option_arg, - ExecutionContext *execution_context) { - Error error(m_file.SetValueFromString(option_arg)); +Status OptionGroupFile::SetOptionValue(uint32_t option_idx, + llvm::StringRef option_arg, + ExecutionContext *execution_context) { + Status error(m_file.SetValueFromString(option_arg)); return error; } @@ -69,10 +69,11 @@ OptionGroupFileList::OptionGroupFileList( OptionGroupFileList::~OptionGroupFileList() {} -Error OptionGroupFileList::SetOptionValue(uint32_t option_idx, - llvm::StringRef option_value, - ExecutionContext *execution_context) { - Error error(m_file_list.SetValueFromString(option_value)); +Status +OptionGroupFileList::SetOptionValue(uint32_t option_idx, + llvm::StringRef option_value, + ExecutionContext *execution_context) { + Status error(m_file_list.SetValueFromString(option_value)); return error; } diff --git a/lldb/source/Interpreter/OptionGroupFormat.cpp b/lldb/source/Interpreter/OptionGroupFormat.cpp index df5e2b3cd34..7c4239f9264 100644 --- a/lldb/source/Interpreter/OptionGroupFormat.cpp +++ b/lldb/source/Interpreter/OptionGroupFormat.cpp @@ -58,10 +58,10 @@ llvm::ArrayRef<OptionDefinition> OptionGroupFormat::GetDefinitions() { return result.take_front(2); } -Error OptionGroupFormat::SetOptionValue(uint32_t option_idx, - llvm::StringRef option_arg, - ExecutionContext *execution_context) { - Error error; +Status OptionGroupFormat::SetOptionValue(uint32_t option_idx, + llvm::StringRef option_arg, + ExecutionContext *execution_context) { + Status error; const int short_option = g_option_table[option_idx].short_option; switch (short_option) { diff --git a/lldb/source/Interpreter/OptionGroupOutputFile.cpp b/lldb/source/Interpreter/OptionGroupOutputFile.cpp index 7b0ee61dd7e..fd406494ea9 100644 --- a/lldb/source/Interpreter/OptionGroupOutputFile.cpp +++ b/lldb/source/Interpreter/OptionGroupOutputFile.cpp @@ -38,10 +38,11 @@ llvm::ArrayRef<OptionDefinition> OptionGroupOutputFile::GetDefinitions() { return llvm::makeArrayRef(g_option_table); } -Error OptionGroupOutputFile::SetOptionValue( - uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) { - Error error; +Status +OptionGroupOutputFile::SetOptionValue(uint32_t option_idx, + llvm::StringRef option_arg, + ExecutionContext *execution_context) { + Status error; const int short_option = g_option_table[option_idx].short_option; switch (short_option) { diff --git a/lldb/source/Interpreter/OptionGroupPlatform.cpp b/lldb/source/Interpreter/OptionGroupPlatform.cpp index f6edca82a14..5747c6a8815 100644 --- a/lldb/source/Interpreter/OptionGroupPlatform.cpp +++ b/lldb/source/Interpreter/OptionGroupPlatform.cpp @@ -22,7 +22,7 @@ using namespace lldb_private; PlatformSP OptionGroupPlatform::CreatePlatformWithOptions( CommandInterpreter &interpreter, const ArchSpec &arch, bool make_selected, - Error &error, ArchSpec &platform_arch) const { + Status &error, ArchSpec &platform_arch) const { PlatformSP platform_sp; if (!m_platform_name.empty()) { @@ -92,10 +92,11 @@ llvm::ArrayRef<OptionDefinition> OptionGroupPlatform::GetDefinitions() { return result.drop_front(); } -Error OptionGroupPlatform::SetOptionValue(uint32_t option_idx, - llvm::StringRef option_arg, - ExecutionContext *execution_context) { - Error error; +Status +OptionGroupPlatform::SetOptionValue(uint32_t option_idx, + llvm::StringRef option_arg, + ExecutionContext *execution_context) { + Status error; if (!m_include_platform_option) ++option_idx; diff --git a/lldb/source/Interpreter/OptionGroupString.cpp b/lldb/source/Interpreter/OptionGroupString.cpp index 5705264dba2..1a161945a17 100644 --- a/lldb/source/Interpreter/OptionGroupString.cpp +++ b/lldb/source/Interpreter/OptionGroupString.cpp @@ -39,10 +39,10 @@ OptionGroupString::OptionGroupString(uint32_t usage_mask, bool required, OptionGroupString::~OptionGroupString() {} -Error OptionGroupString::SetOptionValue(uint32_t option_idx, - llvm::StringRef option_arg, - ExecutionContext *execution_context) { - Error error(m_value.SetValueFromString(option_arg)); +Status OptionGroupString::SetOptionValue(uint32_t option_idx, + llvm::StringRef option_arg, + ExecutionContext *execution_context) { + Status error(m_value.SetValueFromString(option_arg)); return error; } diff --git a/lldb/source/Interpreter/OptionGroupUInt64.cpp b/lldb/source/Interpreter/OptionGroupUInt64.cpp index a6a0d49232c..ae4828c3e92 100644 --- a/lldb/source/Interpreter/OptionGroupUInt64.cpp +++ b/lldb/source/Interpreter/OptionGroupUInt64.cpp @@ -39,10 +39,10 @@ OptionGroupUInt64::OptionGroupUInt64(uint32_t usage_mask, bool required, OptionGroupUInt64::~OptionGroupUInt64() {} -Error OptionGroupUInt64::SetOptionValue(uint32_t option_idx, - llvm::StringRef option_arg, - ExecutionContext *execution_context) { - Error error(m_value.SetValueFromString(option_arg)); +Status OptionGroupUInt64::SetOptionValue(uint32_t option_idx, + llvm::StringRef option_arg, + ExecutionContext *execution_context) { + Status error(m_value.SetValueFromString(option_arg)); return error; } diff --git a/lldb/source/Interpreter/OptionGroupUUID.cpp b/lldb/source/Interpreter/OptionGroupUUID.cpp index 32a9962b5b9..bf02d1b660c 100644 --- a/lldb/source/Interpreter/OptionGroupUUID.cpp +++ b/lldb/source/Interpreter/OptionGroupUUID.cpp @@ -31,10 +31,10 @@ llvm::ArrayRef<OptionDefinition> OptionGroupUUID::GetDefinitions() { return llvm::makeArrayRef(g_option_table); } -Error OptionGroupUUID::SetOptionValue(uint32_t option_idx, - llvm::StringRef option_arg, - ExecutionContext *execution_context) { - Error error; +Status OptionGroupUUID::SetOptionValue(uint32_t option_idx, + llvm::StringRef option_arg, + ExecutionContext *execution_context) { + Status error; const int short_option = g_option_table[option_idx].short_option; switch (short_option) { diff --git a/lldb/source/Interpreter/OptionGroupValueObjectDisplay.cpp b/lldb/source/Interpreter/OptionGroupValueObjectDisplay.cpp index 89acf3f0d3f..ce27d948c93 100644 --- a/lldb/source/Interpreter/OptionGroupValueObjectDisplay.cpp +++ b/lldb/source/Interpreter/OptionGroupValueObjectDisplay.cpp @@ -75,10 +75,10 @@ OptionGroupValueObjectDisplay::GetDefinitions() { return llvm::makeArrayRef(g_option_table); } -Error OptionGroupValueObjectDisplay::SetOptionValue( +Status OptionGroupValueObjectDisplay::SetOptionValue( uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) { - Error error; + Status error; const int short_option = g_option_table[option_idx].short_option; bool success = false; diff --git a/lldb/source/Interpreter/OptionGroupVariable.cpp b/lldb/source/Interpreter/OptionGroupVariable.cpp index 760563071d7..0793d373144 100644 --- a/lldb/source/Interpreter/OptionGroupVariable.cpp +++ b/lldb/source/Interpreter/OptionGroupVariable.cpp @@ -17,7 +17,7 @@ #include "lldb/Host/OptionParser.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Target/Target.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" using namespace lldb; using namespace lldb_private; @@ -52,20 +52,20 @@ static OptionDefinition g_variable_options[] = { "Specify a summary string to use to format the variable output."}, }; -static Error ValidateNamedSummary(const char *str, void *) { +static Status ValidateNamedSummary(const char *str, void *) { if (!str || !str[0]) - return Error("must specify a valid named summary"); + return Status("must specify a valid named summary"); TypeSummaryImplSP summary_sp; if (DataVisualization::NamedSummaryFormats::GetSummaryFormat( ConstString(str), summary_sp) == false) - return Error("must specify a valid named summary"); - return Error(); + return Status("must specify a valid named summary"); + return Status(); } -static Error ValidateSummaryString(const char *str, void *) { +static Status ValidateSummaryString(const char *str, void *) { if (!str || !str[0]) - return Error("must specify a non-empty summary string"); - return Error(); + return Status("must specify a non-empty summary string"); + return Status(); } OptionGroupVariable::OptionGroupVariable(bool show_frame_options) @@ -74,10 +74,11 @@ OptionGroupVariable::OptionGroupVariable(bool show_frame_options) OptionGroupVariable::~OptionGroupVariable() {} -Error OptionGroupVariable::SetOptionValue(uint32_t option_idx, - llvm::StringRef option_arg, - ExecutionContext *execution_context) { - Error error; +Status +OptionGroupVariable::SetOptionValue(uint32_t option_idx, + llvm::StringRef option_arg, + ExecutionContext *execution_context) { + Status error; if (!include_frame_options) option_idx += 3; const int short_option = g_variable_options[option_idx].short_option; diff --git a/lldb/source/Interpreter/OptionGroupWatchpoint.cpp b/lldb/source/Interpreter/OptionGroupWatchpoint.cpp index 1e6fab929ca..dd4b8c86c91 100644 --- a/lldb/source/Interpreter/OptionGroupWatchpoint.cpp +++ b/lldb/source/Interpreter/OptionGroupWatchpoint.cpp @@ -56,10 +56,11 @@ OptionGroupWatchpoint::OptionGroupWatchpoint() : OptionGroup() {} OptionGroupWatchpoint::~OptionGroupWatchpoint() {} -Error OptionGroupWatchpoint::SetOptionValue( - uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) { - Error error; +Status +OptionGroupWatchpoint::SetOptionValue(uint32_t option_idx, + llvm::StringRef option_arg, + ExecutionContext *execution_context) { + Status error; const int short_option = g_option_table[option_idx].short_option; switch (short_option) { case 'w': { diff --git a/lldb/source/Interpreter/OptionValue.cpp b/lldb/source/Interpreter/OptionValue.cpp index 5f42f7f7056..afcace2567c 100644 --- a/lldb/source/Interpreter/OptionValue.cpp +++ b/lldb/source/Interpreter/OptionValue.cpp @@ -42,10 +42,10 @@ uint64_t OptionValue::GetUInt64Value(uint64_t fail_value, bool *success_ptr) { return fail_value; } -Error OptionValue::SetSubValue(const ExecutionContext *exe_ctx, - VarSetOperationType op, llvm::StringRef name, - llvm::StringRef value) { - Error error; +Status OptionValue::SetSubValue(const ExecutionContext *exe_ctx, + VarSetOperationType op, llvm::StringRef name, + llvm::StringRef value) { + Status error; error.SetErrorStringWithFormat("SetSubValue is not supported"); return error; } @@ -507,7 +507,7 @@ const char *OptionValue::GetBuiltinTypeAsCString(Type t) { } lldb::OptionValueSP OptionValue::CreateValueFromCStringForTypeMask( - const char *value_cstr, uint32_t type_mask, Error &error) { + const char *value_cstr, uint32_t type_mask, Status &error) { // If only 1 bit is set in the type mask for a dictionary or array // then we know how to decode a value from a cstring lldb::OptionValueSP value_sp; @@ -582,9 +582,9 @@ size_t OptionValue::AutoComplete(CommandInterpreter &interpreter, return matches.GetSize(); } -Error OptionValue::SetValueFromString(llvm::StringRef value, - VarSetOperationType op) { - Error error; +Status OptionValue::SetValueFromString(llvm::StringRef value, + VarSetOperationType op) { + Status error; switch (op) { case eVarSetOperationReplace: error.SetErrorStringWithFormat( diff --git a/lldb/source/Interpreter/OptionValueArch.cpp b/lldb/source/Interpreter/OptionValueArch.cpp index 3e41300a418..1d920a11472 100644 --- a/lldb/source/Interpreter/OptionValueArch.cpp +++ b/lldb/source/Interpreter/OptionValueArch.cpp @@ -38,9 +38,9 @@ void OptionValueArch::DumpValue(const ExecutionContext *exe_ctx, Stream &strm, } } -Error OptionValueArch::SetValueFromString(llvm::StringRef value, - VarSetOperationType op) { - Error error; +Status OptionValueArch::SetValueFromString(llvm::StringRef value, + VarSetOperationType op) { + Status error; switch (op) { case eVarSetOperationClear: Clear(); diff --git a/lldb/source/Interpreter/OptionValueArray.cpp b/lldb/source/Interpreter/OptionValueArray.cpp index 0d1825cec28..8b62070352a 100644 --- a/lldb/source/Interpreter/OptionValueArray.cpp +++ b/lldb/source/Interpreter/OptionValueArray.cpp @@ -70,18 +70,19 @@ void OptionValueArray::DumpValue(const ExecutionContext *exe_ctx, Stream &strm, } } -Error OptionValueArray::SetValueFromString(llvm::StringRef value, - VarSetOperationType op) { +Status OptionValueArray::SetValueFromString(llvm::StringRef value, + VarSetOperationType op) { Args args(value.str()); - Error error = SetArgs(args, op); + Status error = SetArgs(args, op); if (error.Success()) NotifyValueChanged(); return error; } lldb::OptionValueSP -OptionValueArray::GetSubValue(const ExecutionContext *exe_ctx, llvm::StringRef name, - bool will_modify, Error &error) const { +OptionValueArray::GetSubValue(const ExecutionContext *exe_ctx, + llvm::StringRef name, bool will_modify, + Status &error) const { if (name.empty() || name.front() != '[') { error.SetErrorStringWithFormat( "invalid value path '%s', %s values only support '[<index>]' subvalues " @@ -149,8 +150,8 @@ size_t OptionValueArray::GetArgs(Args &args) const { return args.GetArgumentCount(); } -Error OptionValueArray::SetArgs(const Args &args, VarSetOperationType op) { - Error error; +Status OptionValueArray::SetArgs(const Args &args, VarSetOperationType op) { + Status error; const size_t argc = args.GetArgumentCount(); switch (op) { case eVarSetOperationInvalid: diff --git a/lldb/source/Interpreter/OptionValueBoolean.cpp b/lldb/source/Interpreter/OptionValueBoolean.cpp index 92e4d891c1a..2cb84cd6abb 100644 --- a/lldb/source/Interpreter/OptionValueBoolean.cpp +++ b/lldb/source/Interpreter/OptionValueBoolean.cpp @@ -35,9 +35,9 @@ void OptionValueBoolean::DumpValue(const ExecutionContext *exe_ctx, } } -Error OptionValueBoolean::SetValueFromString(llvm::StringRef value_str, - VarSetOperationType op) { - Error error; +Status OptionValueBoolean::SetValueFromString(llvm::StringRef value_str, + VarSetOperationType op) { + Status error; switch (op) { case eVarSetOperationClear: Clear(); diff --git a/lldb/source/Interpreter/OptionValueChar.cpp b/lldb/source/Interpreter/OptionValueChar.cpp index 1f6acf61c68..27684a27264 100644 --- a/lldb/source/Interpreter/OptionValueChar.cpp +++ b/lldb/source/Interpreter/OptionValueChar.cpp @@ -36,9 +36,9 @@ void OptionValueChar::DumpValue(const ExecutionContext *exe_ctx, Stream &strm, } } -Error OptionValueChar::SetValueFromString(llvm::StringRef value, - VarSetOperationType op) { - Error error; +Status OptionValueChar::SetValueFromString(llvm::StringRef value, + VarSetOperationType op) { + Status error; switch (op) { case eVarSetOperationClear: Clear(); diff --git a/lldb/source/Interpreter/OptionValueDictionary.cpp b/lldb/source/Interpreter/OptionValueDictionary.cpp index dfba435603b..b245a09c195 100644 --- a/lldb/source/Interpreter/OptionValueDictionary.cpp +++ b/lldb/source/Interpreter/OptionValueDictionary.cpp @@ -90,8 +90,9 @@ size_t OptionValueDictionary::GetArgs(Args &args) const { return args.GetArgumentCount(); } -Error OptionValueDictionary::SetArgs(const Args &args, VarSetOperationType op) { - Error error; +Status OptionValueDictionary::SetArgs(const Args &args, + VarSetOperationType op) { + Status error; const size_t argc = args.GetArgumentCount(); switch (op) { case eVarSetOperationClear: @@ -197,10 +198,10 @@ Error OptionValueDictionary::SetArgs(const Args &args, VarSetOperationType op) { return error; } -Error OptionValueDictionary::SetValueFromString(llvm::StringRef value, - VarSetOperationType op) { +Status OptionValueDictionary::SetValueFromString(llvm::StringRef value, + VarSetOperationType op) { Args args(value.str()); - Error error = SetArgs(args, op); + Status error = SetArgs(args, op); if (error.Success()) NotifyValueChanged(); return error; @@ -208,8 +209,8 @@ Error OptionValueDictionary::SetValueFromString(llvm::StringRef value, lldb::OptionValueSP OptionValueDictionary::GetSubValue(const ExecutionContext *exe_ctx, - llvm::StringRef name, bool will_modify, - Error &error) const { + llvm::StringRef name, bool will_modify, + Status &error) const { lldb::OptionValueSP value_sp; if (name.empty()) return nullptr; @@ -258,10 +259,11 @@ OptionValueDictionary::GetSubValue(const ExecutionContext *exe_ctx, return value_sp->GetSubValue(exe_ctx, sub_name, will_modify, error); } -Error OptionValueDictionary::SetSubValue(const ExecutionContext *exe_ctx, - VarSetOperationType op, - llvm::StringRef name, llvm::StringRef value) { - Error error; +Status OptionValueDictionary::SetSubValue(const ExecutionContext *exe_ctx, + VarSetOperationType op, + llvm::StringRef name, + llvm::StringRef value) { + Status error; const bool will_modify = true; lldb::OptionValueSP value_sp(GetSubValue(exe_ctx, name, will_modify, error)); if (value_sp) diff --git a/lldb/source/Interpreter/OptionValueEnumeration.cpp b/lldb/source/Interpreter/OptionValueEnumeration.cpp index 2bff0bdcec3..9510f4a671d 100644 --- a/lldb/source/Interpreter/OptionValueEnumeration.cpp +++ b/lldb/source/Interpreter/OptionValueEnumeration.cpp @@ -45,9 +45,9 @@ void OptionValueEnumeration::DumpValue(const ExecutionContext *exe_ctx, } } -Error OptionValueEnumeration::SetValueFromString(llvm::StringRef value, - VarSetOperationType op) { - Error error; +Status OptionValueEnumeration::SetValueFromString(llvm::StringRef value, + VarSetOperationType op) { + Status error; switch (op) { case eVarSetOperationClear: Clear(); diff --git a/lldb/source/Interpreter/OptionValueFileSpec.cpp b/lldb/source/Interpreter/OptionValueFileSpec.cpp index 0df581af5d6..b235d4ac686 100644 --- a/lldb/source/Interpreter/OptionValueFileSpec.cpp +++ b/lldb/source/Interpreter/OptionValueFileSpec.cpp @@ -54,9 +54,9 @@ void OptionValueFileSpec::DumpValue(const ExecutionContext *exe_ctx, } } -Error OptionValueFileSpec::SetValueFromString(llvm::StringRef value, - VarSetOperationType op) { - Error error; +Status OptionValueFileSpec::SetValueFromString(llvm::StringRef value, + VarSetOperationType op) { + Status error; switch (op) { case eVarSetOperationClear: Clear(); diff --git a/lldb/source/Interpreter/OptionValueFileSpecLIst.cpp b/lldb/source/Interpreter/OptionValueFileSpecLIst.cpp index 9cddf32206e..7773bdc5ea9 100644 --- a/lldb/source/Interpreter/OptionValueFileSpecLIst.cpp +++ b/lldb/source/Interpreter/OptionValueFileSpecLIst.cpp @@ -38,9 +38,9 @@ void OptionValueFileSpecList::DumpValue(const ExecutionContext *exe_ctx, } } -Error OptionValueFileSpecList::SetValueFromString(llvm::StringRef value, - VarSetOperationType op) { - Error error; +Status OptionValueFileSpecList::SetValueFromString(llvm::StringRef value, + VarSetOperationType op) { + Status error; Args args(value.str()); const size_t argc = args.GetArgumentCount(); diff --git a/lldb/source/Interpreter/OptionValueFormat.cpp b/lldb/source/Interpreter/OptionValueFormat.cpp index 7d58f63a381..24dd8fd5f71 100644 --- a/lldb/source/Interpreter/OptionValueFormat.cpp +++ b/lldb/source/Interpreter/OptionValueFormat.cpp @@ -31,9 +31,9 @@ void OptionValueFormat::DumpValue(const ExecutionContext *exe_ctx, Stream &strm, } } -Error OptionValueFormat::SetValueFromString(llvm::StringRef value, - VarSetOperationType op) { - Error error; +Status OptionValueFormat::SetValueFromString(llvm::StringRef value, + VarSetOperationType op) { + Status error; switch (op) { case eVarSetOperationClear: Clear(); diff --git a/lldb/source/Interpreter/OptionValueFormatEntity.cpp b/lldb/source/Interpreter/OptionValueFormatEntity.cpp index 5259398dcd3..e9431d4562e 100644 --- a/lldb/source/Interpreter/OptionValueFormatEntity.cpp +++ b/lldb/source/Interpreter/OptionValueFormatEntity.cpp @@ -25,7 +25,7 @@ OptionValueFormatEntity::OptionValueFormatEntity(const char *default_format) m_default_entry() { if (default_format && default_format[0]) { llvm::StringRef default_format_str(default_format); - Error error = FormatEntity::Parse(default_format_str, m_default_entry); + Status error = FormatEntity::Parse(default_format_str, m_default_entry); if (error.Success()) { m_default_format = default_format; m_current_format = default_format; @@ -52,9 +52,9 @@ void OptionValueFormatEntity::DumpValue(const ExecutionContext *exe_ctx, } } -Error OptionValueFormatEntity::SetValueFromString(llvm::StringRef value_str, - VarSetOperationType op) { - Error error; +Status OptionValueFormatEntity::SetValueFromString(llvm::StringRef value_str, + VarSetOperationType op) { + Status error; switch (op) { case eVarSetOperationClear: Clear(); diff --git a/lldb/source/Interpreter/OptionValueLanguage.cpp b/lldb/source/Interpreter/OptionValueLanguage.cpp index 2ea152c436c..3290e88c181 100644 --- a/lldb/source/Interpreter/OptionValueLanguage.cpp +++ b/lldb/source/Interpreter/OptionValueLanguage.cpp @@ -32,9 +32,9 @@ void OptionValueLanguage::DumpValue(const ExecutionContext *exe_ctx, } } -Error OptionValueLanguage::SetValueFromString(llvm::StringRef value, - VarSetOperationType op) { - Error error; +Status OptionValueLanguage::SetValueFromString(llvm::StringRef value, + VarSetOperationType op) { + Status error; switch (op) { case eVarSetOperationClear: Clear(); diff --git a/lldb/source/Interpreter/OptionValuePathMappings.cpp b/lldb/source/Interpreter/OptionValuePathMappings.cpp index 54797422cba..5f805720bd3 100644 --- a/lldb/source/Interpreter/OptionValuePathMappings.cpp +++ b/lldb/source/Interpreter/OptionValuePathMappings.cpp @@ -40,9 +40,9 @@ void OptionValuePathMappings::DumpValue(const ExecutionContext *exe_ctx, } } -Error OptionValuePathMappings::SetValueFromString(llvm::StringRef value, - VarSetOperationType op) { - Error error; +Status OptionValuePathMappings::SetValueFromString(llvm::StringRef value, + VarSetOperationType op) { + Status error; Args args(value.str()); const size_t argc = args.GetArgumentCount(); diff --git a/lldb/source/Interpreter/OptionValueProperties.cpp b/lldb/source/Interpreter/OptionValueProperties.cpp index 732769f6e6d..ae766960559 100644 --- a/lldb/source/Interpreter/OptionValueProperties.cpp +++ b/lldb/source/Interpreter/OptionValueProperties.cpp @@ -116,8 +116,8 @@ OptionValueProperties::GetValueForKey(const ExecutionContext *exe_ctx, lldb::OptionValueSP OptionValueProperties::GetSubValue(const ExecutionContext *exe_ctx, - llvm::StringRef name, bool will_modify, - Error &error) const { + llvm::StringRef name, bool will_modify, + Status &error) const { lldb::OptionValueSP value_sp; if (name.empty()) return OptionValueSP(); @@ -201,10 +201,11 @@ OptionValueProperties::GetSubValue(const ExecutionContext *exe_ctx, return value_sp; } -Error OptionValueProperties::SetSubValue(const ExecutionContext *exe_ctx, - VarSetOperationType op, - llvm::StringRef name, llvm::StringRef value) { - Error error; +Status OptionValueProperties::SetSubValue(const ExecutionContext *exe_ctx, + VarSetOperationType op, + llvm::StringRef name, + llvm::StringRef value) { + Status error; const bool will_modify = true; lldb::OptionValueSP value_sp(GetSubValue(exe_ctx, name, will_modify, error)); if (value_sp) @@ -523,9 +524,9 @@ bool OptionValueProperties::Clear() { return true; } -Error OptionValueProperties::SetValueFromString(llvm::StringRef value, - VarSetOperationType op) { - Error error; +Status OptionValueProperties::SetValueFromString(llvm::StringRef value, + VarSetOperationType op) { + Status error; // Args args(value_cstr); // const size_t argc = args.GetArgumentCount(); @@ -564,11 +565,11 @@ void OptionValueProperties::DumpValue(const ExecutionContext *exe_ctx, } } -Error OptionValueProperties::DumpPropertyValue(const ExecutionContext *exe_ctx, - Stream &strm, - llvm::StringRef property_path, - uint32_t dump_mask) { - Error error; +Status OptionValueProperties::DumpPropertyValue(const ExecutionContext *exe_ctx, + Stream &strm, + llvm::StringRef property_path, + uint32_t dump_mask) { + Status error; const bool will_modify = false; lldb::OptionValueSP value_sp( GetSubValue(exe_ctx, property_path, will_modify, error)); diff --git a/lldb/source/Interpreter/OptionValueRegex.cpp b/lldb/source/Interpreter/OptionValueRegex.cpp index 6823300c515..aee8f97db16 100644 --- a/lldb/source/Interpreter/OptionValueRegex.cpp +++ b/lldb/source/Interpreter/OptionValueRegex.cpp @@ -32,9 +32,9 @@ void OptionValueRegex::DumpValue(const ExecutionContext *exe_ctx, Stream &strm, } } -Error OptionValueRegex::SetValueFromString(llvm::StringRef value, - VarSetOperationType op) { - Error error; +Status OptionValueRegex::SetValueFromString(llvm::StringRef value, + VarSetOperationType op) { + Status error; switch (op) { case eVarSetOperationInvalid: case eVarSetOperationInsertBefore: diff --git a/lldb/source/Interpreter/OptionValueSInt64.cpp b/lldb/source/Interpreter/OptionValueSInt64.cpp index 3bdbfb9e2fa..9dbcd58dc3e 100644 --- a/lldb/source/Interpreter/OptionValueSInt64.cpp +++ b/lldb/source/Interpreter/OptionValueSInt64.cpp @@ -34,9 +34,9 @@ void OptionValueSInt64::DumpValue(const ExecutionContext *exe_ctx, Stream &strm, } } -Error OptionValueSInt64::SetValueFromString(llvm::StringRef value_ref, - VarSetOperationType op) { - Error error; +Status OptionValueSInt64::SetValueFromString(llvm::StringRef value_ref, + VarSetOperationType op) { + Status error; switch (op) { case eVarSetOperationClear: Clear(); diff --git a/lldb/source/Interpreter/OptionValueString.cpp b/lldb/source/Interpreter/OptionValueString.cpp index 149ccbc7b51..1d7332dd41a 100644 --- a/lldb/source/Interpreter/OptionValueString.cpp +++ b/lldb/source/Interpreter/OptionValueString.cpp @@ -47,9 +47,9 @@ void OptionValueString::DumpValue(const ExecutionContext *exe_ctx, Stream &strm, } } -Error OptionValueString::SetValueFromString(llvm::StringRef value, - VarSetOperationType op) { - Error error; +Status OptionValueString::SetValueFromString(llvm::StringRef value, + VarSetOperationType op) { + Status error; std::string value_str = value.str(); value = value.trim(); @@ -127,27 +127,27 @@ lldb::OptionValueSP OptionValueString::DeepCopy() const { return OptionValueSP(new OptionValueString(*this)); } -Error OptionValueString::SetCurrentValue(llvm::StringRef value) { +Status OptionValueString::SetCurrentValue(llvm::StringRef value) { if (m_validator) { - Error error(m_validator(value.str().c_str(), m_validator_baton)); + Status error(m_validator(value.str().c_str(), m_validator_baton)); if (error.Fail()) return error; } m_current_value.assign(value); - return Error(); + return Status(); } -Error OptionValueString::AppendToCurrentValue(const char *value) { +Status OptionValueString::AppendToCurrentValue(const char *value) { if (value && value[0]) { if (m_validator) { std::string new_value(m_current_value); new_value.append(value); - Error error(m_validator(value, m_validator_baton)); + Status error(m_validator(value, m_validator_baton)); if (error.Fail()) return error; m_current_value.assign(new_value); } else m_current_value.append(value); } - return Error(); + return Status(); } diff --git a/lldb/source/Interpreter/OptionValueUInt64.cpp b/lldb/source/Interpreter/OptionValueUInt64.cpp index 826c9e5ba88..c8db1bd532c 100644 --- a/lldb/source/Interpreter/OptionValueUInt64.cpp +++ b/lldb/source/Interpreter/OptionValueUInt64.cpp @@ -21,7 +21,7 @@ using namespace lldb; using namespace lldb_private; lldb::OptionValueSP OptionValueUInt64::Create(llvm::StringRef value_str, - Error &error) { + Status &error) { lldb::OptionValueSP value_sp(new OptionValueUInt64()); error = value_sp->SetValueFromString(value_str); if (error.Fail()) @@ -40,9 +40,9 @@ void OptionValueUInt64::DumpValue(const ExecutionContext *exe_ctx, Stream &strm, } } -Error OptionValueUInt64::SetValueFromString(llvm::StringRef value_ref, - VarSetOperationType op) { - Error error; +Status OptionValueUInt64::SetValueFromString(llvm::StringRef value_ref, + VarSetOperationType op) { + Status error; switch (op) { case eVarSetOperationClear: Clear(); diff --git a/lldb/source/Interpreter/OptionValueUUID.cpp b/lldb/source/Interpreter/OptionValueUUID.cpp index 7378195a2f9..bec04cba8c3 100644 --- a/lldb/source/Interpreter/OptionValueUUID.cpp +++ b/lldb/source/Interpreter/OptionValueUUID.cpp @@ -32,9 +32,9 @@ void OptionValueUUID::DumpValue(const ExecutionContext *exe_ctx, Stream &strm, } } -Error OptionValueUUID::SetValueFromString(llvm::StringRef value, - VarSetOperationType op) { - Error error; +Status OptionValueUUID::SetValueFromString(llvm::StringRef value, + VarSetOperationType op) { + Status error; switch (op) { case eVarSetOperationClear: Clear(); diff --git a/lldb/source/Interpreter/Options.cpp b/lldb/source/Interpreter/Options.cpp index b8b9bdf54a0..f8b1a8d6beb 100644 --- a/lldb/source/Interpreter/Options.cpp +++ b/lldb/source/Interpreter/Options.cpp @@ -42,8 +42,8 @@ void Options::NotifyOptionParsingStarting(ExecutionContext *execution_context) { OptionParsingStarting(execution_context); } -Error Options::NotifyOptionParsingFinished( - ExecutionContext *execution_context) { +Status +Options::NotifyOptionParsingFinished(ExecutionContext *execution_context) { return OptionParsingFinished(execution_context); } @@ -905,13 +905,13 @@ void OptionGroupOptions::Finalize() { m_did_finalize = true; } -Error OptionGroupOptions::SetOptionValue(uint32_t option_idx, - llvm::StringRef option_value, - ExecutionContext *execution_context) { +Status OptionGroupOptions::SetOptionValue(uint32_t option_idx, + llvm::StringRef option_value, + ExecutionContext *execution_context) { // After calling OptionGroupOptions::Append(...), you must finalize the groups // by calling OptionGroupOptions::Finlize() assert(m_did_finalize); - Error error; + Status error; if (option_idx < m_option_infos.size()) { error = m_option_infos[option_idx].option_group->SetOptionValue( m_option_infos[option_idx].option_index, option_value, @@ -935,10 +935,10 @@ void OptionGroupOptions::OptionParsingStarting( } } } -Error OptionGroupOptions::OptionParsingFinished( - ExecutionContext *execution_context) { +Status +OptionGroupOptions::OptionParsingFinished(ExecutionContext *execution_context) { std::set<OptionGroup *> group_set; - Error error; + Status error; OptionInfos::iterator pos, end = m_option_infos.end(); for (pos = m_option_infos.begin(); pos != end; ++pos) { OptionGroup *group = pos->option_group; diff --git a/lldb/source/Interpreter/ScriptInterpreter.cpp b/lldb/source/Interpreter/ScriptInterpreter.cpp index 0f7e1f8d74f..57f7eea6e4c 100644 --- a/lldb/source/Interpreter/ScriptInterpreter.cpp +++ b/lldb/source/Interpreter/ScriptInterpreter.cpp @@ -15,7 +15,7 @@ #include "lldb/Host/PseudoTerminal.h" #include "lldb/Interpreter/CommandReturnObject.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/Stream.h" #include "lldb/Utility/StringList.h" @@ -75,10 +75,10 @@ ScriptInterpreter::StringToLanguage(const llvm::StringRef &language) { return eScriptLanguageUnknown; } -Error ScriptInterpreter::SetBreakpointCommandCallback( +Status ScriptInterpreter::SetBreakpointCommandCallback( std::vector<BreakpointOptions *> &bp_options_vec, const char *callback_text) { - Error return_error; + Status return_error; for (BreakpointOptions *bp_options : bp_options_vec) { return_error = SetBreakpointCommandCallback(bp_options, callback_text); if (return_error.Success()) diff --git a/lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp b/lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp index dc1c8dcf4ab..06b1c7054c1 100644 --- a/lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp +++ b/lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp @@ -30,7 +30,7 @@ #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" #include "lldb/Utility/ConstString.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "Plugins/Process/Utility/ARMDefines.h" #include "Utility/ARM_DWARF_Registers.h" @@ -1533,7 +1533,7 @@ bool ABIMacOSX_arm::GetArgumentValues(Thread &thread, ValueList &values) const { // Arguments 5 on up are on the stack const uint32_t arg_byte_size = (bit_width + (8 - 1)) / 8; - Error error; + Status error; if (!exe_ctx.GetProcessRef().ReadScalarIntegerFromMemory( sp, arg_byte_size, is_signed, value->GetScalar(), error)) return false; @@ -1619,7 +1619,7 @@ ValueObjectSP ABIMacOSX_arm::GetReturnValueObjectImpl( reg_ctx->ReadRegister(r1_reg_info, r1_reg_value) && reg_ctx->ReadRegister(r2_reg_info, r2_reg_value) && reg_ctx->ReadRegister(r3_reg_info, r3_reg_value)) { - Error error; + Status error; if (r0_reg_value.GetAsMemoryData(r0_reg_info, heap_data_ap->GetBytes() + 0, 4, byte_order, error) && @@ -1702,9 +1702,9 @@ ValueObjectSP ABIMacOSX_arm::GetReturnValueObjectImpl( return return_valobj_sp; } -Error ABIMacOSX_arm::SetReturnValueObject(lldb::StackFrameSP &frame_sp, - lldb::ValueObjectSP &new_value_sp) { - Error error; +Status ABIMacOSX_arm::SetReturnValueObject(lldb::StackFrameSP &frame_sp, + lldb::ValueObjectSP &new_value_sp) { + Status error; if (!new_value_sp) { error.SetErrorString("Empty value object for return value."); return error; @@ -1728,7 +1728,7 @@ Error ABIMacOSX_arm::SetReturnValueObject(lldb::StackFrameSP &frame_sp, if (compiler_type.IsIntegerOrEnumerationType(is_signed) || compiler_type.IsPointerType()) { DataExtractor data; - Error data_error; + Status data_error; size_t num_bytes = new_value_sp->GetData(data, data_error); if (data_error.Fail()) { error.SetErrorStringWithFormat( diff --git a/lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h b/lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h index 39f57a0c5ee..5aa817c20ec 100644 --- a/lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h +++ b/lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h @@ -30,7 +30,7 @@ public: bool GetArgumentValues(lldb_private::Thread &thread, lldb_private::ValueList &values) const override; - lldb_private::Error + lldb_private::Status SetReturnValueObject(lldb::StackFrameSP &frame_sp, lldb::ValueObjectSP &new_value) override; diff --git a/lldb/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp b/lldb/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp index c5e53361bf9..a545dfc837d 100644 --- a/lldb/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp +++ b/lldb/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp @@ -22,7 +22,6 @@ #include "lldb/Core/RegisterValue.h" #include "lldb/Core/Scalar.h" #include "lldb/Core/Value.h" -#include "lldb/Core/Value.h" #include "lldb/Core/ValueObjectConstResult.h" #include "lldb/Symbol/UnwindPlan.h" #include "lldb/Target/Process.h" @@ -30,8 +29,8 @@ #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" #include "lldb/Utility/ConstString.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" #include "Utility/ARM64_DWARF_Registers.h" @@ -1841,7 +1840,7 @@ bool ABIMacOSX_arm64::GetArgumentValues(Thread &thread, // Arguments 5 on up are on the stack const uint32_t arg_byte_size = (bit_width + (8 - 1)) / 8; - Error error; + Status error; if (!exe_ctx.GetProcessRef().ReadScalarIntegerFromMemory( sp, arg_byte_size, is_signed, value->GetScalar(), error)) return false; @@ -1860,9 +1859,10 @@ bool ABIMacOSX_arm64::GetArgumentValues(Thread &thread, return true; } -Error ABIMacOSX_arm64::SetReturnValueObject(lldb::StackFrameSP &frame_sp, - lldb::ValueObjectSP &new_value_sp) { - Error error; +Status +ABIMacOSX_arm64::SetReturnValueObject(lldb::StackFrameSP &frame_sp, + lldb::ValueObjectSP &new_value_sp) { + Status error; if (!new_value_sp) { error.SetErrorString("Empty value object for return value."); return error; @@ -1880,7 +1880,7 @@ Error ABIMacOSX_arm64::SetReturnValueObject(lldb::StackFrameSP &frame_sp, if (reg_ctx) { DataExtractor data; - Error data_error; + Status data_error; const uint64_t byte_size = new_value_sp->GetData(data, data_error); if (data_error.Fail()) { error.SetErrorStringWithFormat( @@ -2124,7 +2124,7 @@ static bool LoadValueFromConsecutiveGPRRegisters( std::unique_ptr<DataBufferHeap> heap_data_ap( new DataBufferHeap(byte_size, 0)); const ByteOrder byte_order = exe_ctx.GetProcessRef().GetByteOrder(); - Error error; + Status error; CompilerType base_type; const uint32_t homogeneous_count = @@ -2305,7 +2305,7 @@ ValueObjectSP ABIMacOSX_arm64::GetReturnValueObjectImpl( RegisterValue x1_reg_value; if (reg_ctx->ReadRegister(x0_reg_info, x0_reg_value) && reg_ctx->ReadRegister(x1_reg_info, x1_reg_value)) { - Error error; + Status error; if (x0_reg_value.GetAsMemoryData( x0_reg_info, heap_data_ap->GetBytes() + 0, 8, byte_order, error) && @@ -2402,7 +2402,7 @@ ValueObjectSP ABIMacOSX_arm64::GetReturnValueObjectImpl( const ByteOrder byte_order = exe_ctx.GetProcessRef().GetByteOrder(); RegisterValue reg_value; if (reg_ctx->ReadRegister(v0_info, reg_value)) { - Error error; + Status error; if (reg_value.GetAsMemoryData(v0_info, heap_data_ap->GetBytes(), heap_data_ap->GetByteSize(), byte_order, error)) { diff --git a/lldb/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.h b/lldb/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.h index 93a548a7968..589e2ea468e 100644 --- a/lldb/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.h +++ b/lldb/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.h @@ -92,7 +92,7 @@ public: uint32_t GetPluginVersion() override; - lldb_private::Error + lldb_private::Status SetReturnValueObject(lldb::StackFrameSP &frame_sp, lldb::ValueObjectSP &new_value) override; diff --git a/lldb/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp b/lldb/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp index bbaec25b37b..c393ac9c916 100644 --- a/lldb/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp +++ b/lldb/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp @@ -29,7 +29,7 @@ #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" #include "lldb/Utility/ConstString.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" using namespace lldb; using namespace lldb_private; @@ -746,7 +746,7 @@ bool ABIMacOSX_i386::PrepareTrivialCall(Thread &thread, addr_t sp, // Make room for the argument(s) on the stack - Error error; + Status error; RegisterValue reg_value; // Write any arguments onto the stack @@ -793,7 +793,7 @@ static bool ReadIntegerArgument(Scalar &scalar, unsigned int bit_width, addr_t ¤t_stack_argument) { uint32_t byte_size = (bit_width + (8 - 1)) / 8; - Error error; + Status error; if (process->ReadScalarIntegerFromMemory(current_stack_argument, byte_size, is_signed, scalar, error)) { current_stack_argument += byte_size; @@ -849,9 +849,9 @@ bool ABIMacOSX_i386::GetArgumentValues(Thread &thread, return true; } -Error ABIMacOSX_i386::SetReturnValueObject(lldb::StackFrameSP &frame_sp, - lldb::ValueObjectSP &new_value_sp) { - Error error; +Status ABIMacOSX_i386::SetReturnValueObject(lldb::StackFrameSP &frame_sp, + lldb::ValueObjectSP &new_value_sp) { + Status error; if (!new_value_sp) { error.SetErrorString("Empty value object for return value."); return error; @@ -875,7 +875,7 @@ Error ABIMacOSX_i386::SetReturnValueObject(lldb::StackFrameSP &frame_sp, if (compiler_type.IsIntegerOrEnumerationType(is_signed) || compiler_type.IsPointerType()) { DataExtractor data; - Error data_error; + Status data_error; size_t num_bytes = new_value_sp->GetData(data, data_error); if (data_error.Fail()) { error.SetErrorStringWithFormat( diff --git a/lldb/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h b/lldb/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h index 4a2555ac61a..88fb6ffd7a4 100644 --- a/lldb/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h +++ b/lldb/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h @@ -31,7 +31,7 @@ public: bool GetArgumentValues(lldb_private::Thread &thread, lldb_private::ValueList &values) const override; - lldb_private::Error + lldb_private::Status SetReturnValueObject(lldb::StackFrameSP &frame_sp, lldb::ValueObjectSP &new_value) override; diff --git a/lldb/source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp b/lldb/source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp index 3df225cc895..614c6e89380 100644 --- a/lldb/source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp +++ b/lldb/source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp @@ -30,7 +30,7 @@ #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" #include "lldb/Utility/ConstString.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "Plugins/Process/Utility/ARMDefines.h" #include "Utility/ARM_DWARF_Registers.h" @@ -1518,7 +1518,7 @@ bool ABISysV_arm::GetArgumentValues(Thread &thread, ValueList &values) const { // Arguments 5 on up are on the stack const uint32_t arg_byte_size = (bit_width + (8 - 1)) / 8; - Error error; + Status error; if (!exe_ctx.GetProcessRef().ReadScalarIntegerFromMemory( sp, arg_byte_size, is_signed, value->GetScalar(), error)) return false; @@ -1534,7 +1534,7 @@ bool ABISysV_arm::GetArgumentValues(Thread &thread, ValueList &values) const { static bool GetReturnValuePassedInMemory(Thread &thread, RegisterContext *reg_ctx, size_t byte_size, Value &value) { - Error error; + Status error; DataBufferHeap buffer(byte_size, 0); const RegisterInfo *r0_reg_info = @@ -1815,7 +1815,7 @@ ValueObjectSP ABISysV_arm::GetReturnValueObjectImpl( // Make sure we have enough room in "data_sp" if ((data_offset + vfp_byte_size) <= data_sp->GetByteSize()) { - Error error; + Status error; const size_t bytes_copied = reg_value.GetAsMemoryData( reg_info, data_sp->GetBytes() + data_offset, vfp_byte_size, byte_order, error); @@ -1846,9 +1846,9 @@ ValueObjectSP ABISysV_arm::GetReturnValueObjectImpl( return return_valobj_sp; } -Error ABISysV_arm::SetReturnValueObject(lldb::StackFrameSP &frame_sp, - lldb::ValueObjectSP &new_value_sp) { - Error error; +Status ABISysV_arm::SetReturnValueObject(lldb::StackFrameSP &frame_sp, + lldb::ValueObjectSP &new_value_sp) { + Status error; if (!new_value_sp) { error.SetErrorString("Empty value object for return value."); return error; @@ -1872,7 +1872,7 @@ Error ABISysV_arm::SetReturnValueObject(lldb::StackFrameSP &frame_sp, if (compiler_type.IsIntegerOrEnumerationType(is_signed) || compiler_type.IsPointerType()) { DataExtractor data; - Error data_error; + Status data_error; size_t num_bytes = new_value_sp->GetData(data, data_error); if (data_error.Fail()) { error.SetErrorStringWithFormat( diff --git a/lldb/source/Plugins/ABI/SysV-arm/ABISysV_arm.h b/lldb/source/Plugins/ABI/SysV-arm/ABISysV_arm.h index d85b3dff0ca..81f1277419a 100644 --- a/lldb/source/Plugins/ABI/SysV-arm/ABISysV_arm.h +++ b/lldb/source/Plugins/ABI/SysV-arm/ABISysV_arm.h @@ -30,7 +30,7 @@ public: bool GetArgumentValues(lldb_private::Thread &thread, lldb_private::ValueList &values) const override; - lldb_private::Error + lldb_private::Status SetReturnValueObject(lldb::StackFrameSP &frame_sp, lldb::ValueObjectSP &new_value) override; diff --git a/lldb/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp b/lldb/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp index 65cbd271e97..b202c839577 100644 --- a/lldb/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp +++ b/lldb/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp @@ -30,8 +30,8 @@ #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" #include "lldb/Utility/ConstString.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" #include "Utility/ARM64_DWARF_Registers.h" @@ -1813,7 +1813,7 @@ bool ABISysV_arm64::GetArgumentValues(Thread &thread, ValueList &values) const { // Arguments 5 on up are on the stack const uint32_t arg_byte_size = (bit_width + (8 - 1)) / 8; - Error error; + Status error; if (!exe_ctx.GetProcessRef().ReadScalarIntegerFromMemory( sp, arg_byte_size, is_signed, value->GetScalar(), error)) return false; @@ -1832,9 +1832,9 @@ bool ABISysV_arm64::GetArgumentValues(Thread &thread, ValueList &values) const { return true; } -Error ABISysV_arm64::SetReturnValueObject(lldb::StackFrameSP &frame_sp, - lldb::ValueObjectSP &new_value_sp) { - Error error; +Status ABISysV_arm64::SetReturnValueObject(lldb::StackFrameSP &frame_sp, + lldb::ValueObjectSP &new_value_sp) { + Status error; if (!new_value_sp) { error.SetErrorString("Empty value object for return value."); return error; @@ -1852,7 +1852,7 @@ Error ABISysV_arm64::SetReturnValueObject(lldb::StackFrameSP &frame_sp, if (reg_ctx) { DataExtractor data; - Error data_error; + Status data_error; const uint64_t byte_size = new_value_sp->GetData(data, data_error); if (data_error.Fail()) { error.SetErrorStringWithFormat( @@ -2101,7 +2101,7 @@ static bool LoadValueFromConsecutiveGPRRegisters( std::unique_ptr<DataBufferHeap> heap_data_ap( new DataBufferHeap(byte_size, 0)); const ByteOrder byte_order = exe_ctx.GetProcessRef().GetByteOrder(); - Error error; + Status error; CompilerType base_type; const uint32_t homogeneous_count = @@ -2277,7 +2277,7 @@ ValueObjectSP ABISysV_arm64::GetReturnValueObjectImpl( RegisterValue x1_reg_value; if (reg_ctx->ReadRegister(x0_reg_info, x0_reg_value) && reg_ctx->ReadRegister(x1_reg_info, x1_reg_value)) { - Error error; + Status error; if (x0_reg_value.GetAsMemoryData( x0_reg_info, heap_data_ap->GetBytes() + 0, 8, byte_order, error) && @@ -2372,7 +2372,7 @@ ValueObjectSP ABISysV_arm64::GetReturnValueObjectImpl( const ByteOrder byte_order = exe_ctx.GetProcessRef().GetByteOrder(); RegisterValue reg_value; if (reg_ctx->ReadRegister(v0_info, reg_value)) { - Error error; + Status error; if (reg_value.GetAsMemoryData(v0_info, heap_data_ap->GetBytes(), heap_data_ap->GetByteSize(), byte_order, error)) { diff --git a/lldb/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.h b/lldb/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.h index 68c300c0909..c048e8634ae 100644 --- a/lldb/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.h +++ b/lldb/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.h @@ -31,7 +31,7 @@ public: bool GetArgumentValues(lldb_private::Thread &thread, lldb_private::ValueList &values) const override; - lldb_private::Error + lldb_private::Status SetReturnValueObject(lldb::StackFrameSP &frame_sp, lldb::ValueObjectSP &new_value) override; diff --git a/lldb/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp b/lldb/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp index 0b024dbac07..425bf2ce0bf 100644 --- a/lldb/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp +++ b/lldb/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp @@ -31,8 +31,8 @@ #include "lldb/Target/Thread.h" #include "lldb/Utility/ConstString.h" #include "lldb/Utility/DataExtractor.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" using namespace lldb; using namespace lldb_private; @@ -1073,7 +1073,7 @@ bool ABISysV_hexagon::PrepareTrivialCall( llvm::Type &prototype, llvm::ArrayRef<ABI::CallArgument> args) const { // default number of register passed arguments for varg functions const int nVArgRegParams = 1; - Error error; + Status error; // grab the process so we have access to the memory for spilling lldb::ProcessSP proc = thread.GetProcess(); @@ -1195,9 +1195,10 @@ bool ABISysV_hexagon::GetArgumentValues(Thread &thread, return false; } -Error ABISysV_hexagon::SetReturnValueObject(lldb::StackFrameSP &frame_sp, - lldb::ValueObjectSP &new_value_sp) { - Error error; +Status +ABISysV_hexagon::SetReturnValueObject(lldb::StackFrameSP &frame_sp, + lldb::ValueObjectSP &new_value_sp) { + Status error; return error; } diff --git a/lldb/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.h b/lldb/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.h index aed3dd71b69..5f808291eac 100644 --- a/lldb/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.h +++ b/lldb/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.h @@ -39,7 +39,7 @@ public: bool GetArgumentValues(lldb_private::Thread &thread, lldb_private::ValueList &values) const override; - lldb_private::Error + lldb_private::Status SetReturnValueObject(lldb::StackFrameSP &frame_sp, lldb::ValueObjectSP &new_value) override; diff --git a/lldb/source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp b/lldb/source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp index aee102c16ba..cb3644d46af 100755 --- a/lldb/source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp +++ b/lldb/source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp @@ -31,8 +31,8 @@ #include "lldb/Target/Thread.h" #include "lldb/Utility/ConstString.h" #include "lldb/Utility/DataExtractor.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" using namespace lldb; using namespace lldb_private; @@ -237,7 +237,7 @@ bool ABISysV_i386::PrepareTrivialCall(Thread &thread, addr_t sp, if (!reg_info_32) return false; // TODO this should actually never happen - Error error; + Status error; RegisterValue reg_value; // Make room for the argument(s) on the stack @@ -280,7 +280,7 @@ static bool ReadIntegerArgument(Scalar &scalar, unsigned int bit_width, bool is_signed, Process *process, addr_t ¤t_stack_argument) { uint32_t byte_size = (bit_width + (8 - 1)) / 8; - Error error; + Status error; if (!process) return false; @@ -333,9 +333,9 @@ bool ABISysV_i386::GetArgumentValues(Thread &thread, ValueList &values) const { return true; } -Error ABISysV_i386::SetReturnValueObject(lldb::StackFrameSP &frame_sp, - lldb::ValueObjectSP &new_value_sp) { - Error error; +Status ABISysV_i386::SetReturnValueObject(lldb::StackFrameSP &frame_sp, + lldb::ValueObjectSP &new_value_sp) { + Status error; if (!new_value_sp) { error.SetErrorString("Empty value object for return value."); return error; @@ -351,7 +351,7 @@ Error ABISysV_i386::SetReturnValueObject(lldb::StackFrameSP &frame_sp, Thread *thread = frame_sp->GetThread().get(); RegisterContext *reg_ctx = thread->GetRegisterContext().get(); DataExtractor data; - Error data_error; + Status data_error; size_t num_bytes = new_value_sp->GetData(data, data_error); bool register_write_successful = true; @@ -661,7 +661,7 @@ ValueObjectSP ABISysV_i386::GetReturnValueObjectSimple( const ByteOrder byte_order = process_sp->GetByteOrder(); RegisterValue reg_value; if (reg_ctx->ReadRegister(vec_reg, reg_value)) { - Error error; + Status error; if (reg_value.GetAsMemoryData(vec_reg, heap_data_ap->GetBytes(), heap_data_ap->GetByteSize(), byte_order, error)) { @@ -688,7 +688,7 @@ ValueObjectSP ABISysV_i386::GetReturnValueObjectSimple( if (reg_ctx->ReadRegister(vec_reg, reg_value) && reg_ctx->ReadRegister(vec_reg2, reg_value2)) { - Error error; + Status error; if (reg_value.GetAsMemoryData(vec_reg, heap_data_ap->GetBytes(), vec_reg->byte_size, byte_order, error) && diff --git a/lldb/source/Plugins/ABI/SysV-i386/ABISysV_i386.h b/lldb/source/Plugins/ABI/SysV-i386/ABISysV_i386.h index 8d1d76b5dfd..038bf656b1f 100644 --- a/lldb/source/Plugins/ABI/SysV-i386/ABISysV_i386.h +++ b/lldb/source/Plugins/ABI/SysV-i386/ABISysV_i386.h @@ -33,7 +33,7 @@ public: bool GetArgumentValues(lldb_private::Thread &thread, lldb_private::ValueList &values) const override; - lldb_private::Error + lldb_private::Status SetReturnValueObject(lldb::StackFrameSP &frame_sp, lldb::ValueObjectSP &new_value) override; diff --git a/lldb/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp b/lldb/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp index 69725e30b06..a77252a2049 100644 --- a/lldb/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp +++ b/lldb/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp @@ -31,8 +31,8 @@ #include "lldb/Target/Thread.h" #include "lldb/Utility/ConstString.h" #include "lldb/Utility/DataExtractor.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" using namespace lldb; using namespace lldb_private; @@ -654,7 +654,7 @@ bool ABISysV_mips::PrepareTrivialCall(Thread &thread, addr_t sp, } } - Error error; + Status error; const RegisterInfo *pc_reg_info = reg_ctx->GetRegisterInfo(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_PC); const RegisterInfo *sp_reg_info = @@ -710,9 +710,9 @@ bool ABISysV_mips::GetArgumentValues(Thread &thread, ValueList &values) const { return false; } -Error ABISysV_mips::SetReturnValueObject(lldb::StackFrameSP &frame_sp, - lldb::ValueObjectSP &new_value_sp) { - Error error; +Status ABISysV_mips::SetReturnValueObject(lldb::StackFrameSP &frame_sp, + lldb::ValueObjectSP &new_value_sp) { + Status error; if (!new_value_sp) { error.SetErrorString("Empty value object for return value."); return error; @@ -736,7 +736,7 @@ Error ABISysV_mips::SetReturnValueObject(lldb::StackFrameSP &frame_sp, if (compiler_type.IsIntegerOrEnumerationType(is_signed) || compiler_type.IsPointerType()) { DataExtractor data; - Error data_error; + Status data_error; size_t num_bytes = new_value_sp->GetData(data, data_error); if (data_error.Fail()) { error.SetErrorStringWithFormat( diff --git a/lldb/source/Plugins/ABI/SysV-mips/ABISysV_mips.h b/lldb/source/Plugins/ABI/SysV-mips/ABISysV_mips.h index 7ac51463e6e..980553c506b 100644 --- a/lldb/source/Plugins/ABI/SysV-mips/ABISysV_mips.h +++ b/lldb/source/Plugins/ABI/SysV-mips/ABISysV_mips.h @@ -31,7 +31,7 @@ public: bool GetArgumentValues(lldb_private::Thread &thread, lldb_private::ValueList &values) const override; - lldb_private::Error + lldb_private::Status SetReturnValueObject(lldb::StackFrameSP &frame_sp, lldb::ValueObjectSP &new_value) override; diff --git a/lldb/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp b/lldb/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp index bbcf2e57582..baa478ea110 100644 --- a/lldb/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp +++ b/lldb/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp @@ -31,8 +31,8 @@ #include "lldb/Target/Thread.h" #include "lldb/Utility/ConstString.h" #include "lldb/Utility/DataExtractor.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" using namespace lldb; using namespace lldb_private; @@ -617,7 +617,7 @@ bool ABISysV_mips64::PrepareTrivialCall(Thread &thread, addr_t sp, sp &= ~(0xfull); // 16-byte alignment - Error error; + Status error; const RegisterInfo *pc_reg_info = reg_ctx->GetRegisterInfo(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_PC); const RegisterInfo *sp_reg_info = @@ -674,9 +674,9 @@ bool ABISysV_mips64::GetArgumentValues(Thread &thread, return false; } -Error ABISysV_mips64::SetReturnValueObject(lldb::StackFrameSP &frame_sp, - lldb::ValueObjectSP &new_value_sp) { - Error error; +Status ABISysV_mips64::SetReturnValueObject(lldb::StackFrameSP &frame_sp, + lldb::ValueObjectSP &new_value_sp) { + Status error; if (!new_value_sp) { error.SetErrorString("Empty value object for return value."); return error; @@ -696,7 +696,7 @@ Error ABISysV_mips64::SetReturnValueObject(lldb::StackFrameSP &frame_sp, error.SetErrorString("no registers are available"); DataExtractor data; - Error data_error; + Status data_error; size_t num_bytes = new_value_sp->GetData(data, data_error); if (data_error.Fail()) { error.SetErrorStringWithFormat( @@ -754,7 +754,7 @@ ValueObjectSP ABISysV_mips64::GetReturnValueObjectImpl( Thread &thread, CompilerType &return_compiler_type) const { ValueObjectSP return_valobj_sp; Value value; - Error error; + Status error; ExecutionContext exe_ctx(thread.shared_from_this()); if (exe_ctx.GetTargetPtr() == nullptr || exe_ctx.GetProcessPtr() == nullptr) diff --git a/lldb/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.h b/lldb/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.h index 672a4382562..ac7d9b87194 100644 --- a/lldb/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.h +++ b/lldb/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.h @@ -31,7 +31,7 @@ public: bool GetArgumentValues(lldb_private::Thread &thread, lldb_private::ValueList &values) const override; - lldb_private::Error + lldb_private::Status SetReturnValueObject(lldb::StackFrameSP &frame_sp, lldb::ValueObjectSP &new_value) override; diff --git a/lldb/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp b/lldb/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp index 2dff0d20361..00adfe1be82 100644 --- a/lldb/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp +++ b/lldb/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp @@ -31,8 +31,8 @@ #include "lldb/Target/Thread.h" #include "lldb/Utility/ConstString.h" #include "lldb/Utility/DataExtractor.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" using namespace lldb; using namespace lldb_private; @@ -282,7 +282,7 @@ bool ABISysV_ppc::PrepareTrivialCall(Thread &thread, addr_t sp, sp -= 8; - Error error; + Status error; const RegisterInfo *pc_reg_info = reg_ctx->GetRegisterInfo(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_PC); const RegisterInfo *sp_reg_info = @@ -376,7 +376,7 @@ static bool ReadIntegerArgument(Scalar &scalar, unsigned int bit_width, scalar.SignExtend(bit_width); } else { uint32_t byte_size = (bit_width + (8 - 1)) / 8; - Error error; + Status error; if (thread.GetProcess()->ReadScalarIntegerFromMemory( current_stack_argument, byte_size, is_signed, scalar, error)) { current_stack_argument += byte_size; @@ -464,9 +464,9 @@ bool ABISysV_ppc::GetArgumentValues(Thread &thread, ValueList &values) const { return true; } -Error ABISysV_ppc::SetReturnValueObject(lldb::StackFrameSP &frame_sp, - lldb::ValueObjectSP &new_value_sp) { - Error error; +Status ABISysV_ppc::SetReturnValueObject(lldb::StackFrameSP &frame_sp, + lldb::ValueObjectSP &new_value_sp) { + Status error; if (!new_value_sp) { error.SetErrorString("Empty value object for return value."); return error; @@ -492,7 +492,7 @@ Error ABISysV_ppc::SetReturnValueObject(lldb::StackFrameSP &frame_sp, const RegisterInfo *reg_info = reg_ctx->GetRegisterInfoByName("r3", 0); DataExtractor data; - Error data_error; + Status data_error; size_t num_bytes = new_value_sp->GetData(data, data_error); if (data_error.Fail()) { error.SetErrorStringWithFormat( @@ -518,7 +518,7 @@ Error ABISysV_ppc::SetReturnValueObject(lldb::StackFrameSP &frame_sp, size_t bit_width = compiler_type.GetBitSize(frame_sp.get()); if (bit_width <= 64) { DataExtractor data; - Error data_error; + Status data_error; size_t num_bytes = new_value_sp->GetData(data, data_error); if (data_error.Fail()) { error.SetErrorStringWithFormat( @@ -663,7 +663,7 @@ ValueObjectSP ABISysV_ppc::GetReturnValueObjectSimple( const ByteOrder byte_order = process_sp->GetByteOrder(); RegisterValue reg_value; if (reg_ctx->ReadRegister(altivec_reg, reg_value)) { - Error error; + Status error; if (reg_value.GetAsMemoryData( altivec_reg, heap_data_ap->GetBytes(), heap_data_ap->GetByteSize(), byte_order, error)) { diff --git a/lldb/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.h b/lldb/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.h index c9c1c985f67..8cb9bf24881 100644 --- a/lldb/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.h +++ b/lldb/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.h @@ -31,7 +31,7 @@ public: bool GetArgumentValues(lldb_private::Thread &thread, lldb_private::ValueList &values) const override; - lldb_private::Error + lldb_private::Status SetReturnValueObject(lldb::StackFrameSP &frame_sp, lldb::ValueObjectSP &new_value) override; diff --git a/lldb/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp b/lldb/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp index 59430caa6e3..449990d7130 100644 --- a/lldb/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp +++ b/lldb/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp @@ -31,8 +31,8 @@ #include "lldb/Target/Thread.h" #include "lldb/Utility/ConstString.h" #include "lldb/Utility/DataExtractor.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" using namespace lldb; using namespace lldb_private; @@ -282,7 +282,7 @@ bool ABISysV_ppc64::PrepareTrivialCall(Thread &thread, addr_t sp, sp -= 8; - Error error; + Status error; const RegisterInfo *pc_reg_info = reg_ctx->GetRegisterInfo(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_PC); const RegisterInfo *sp_reg_info = @@ -376,7 +376,7 @@ static bool ReadIntegerArgument(Scalar &scalar, unsigned int bit_width, scalar.SignExtend(bit_width); } else { uint32_t byte_size = (bit_width + (8 - 1)) / 8; - Error error; + Status error; if (thread.GetProcess()->ReadScalarIntegerFromMemory( current_stack_argument, byte_size, is_signed, scalar, error)) { current_stack_argument += byte_size; @@ -464,9 +464,9 @@ bool ABISysV_ppc64::GetArgumentValues(Thread &thread, ValueList &values) const { return true; } -Error ABISysV_ppc64::SetReturnValueObject(lldb::StackFrameSP &frame_sp, - lldb::ValueObjectSP &new_value_sp) { - Error error; +Status ABISysV_ppc64::SetReturnValueObject(lldb::StackFrameSP &frame_sp, + lldb::ValueObjectSP &new_value_sp) { + Status error; if (!new_value_sp) { error.SetErrorString("Empty value object for return value."); return error; @@ -492,7 +492,7 @@ Error ABISysV_ppc64::SetReturnValueObject(lldb::StackFrameSP &frame_sp, const RegisterInfo *reg_info = reg_ctx->GetRegisterInfoByName("r3", 0); DataExtractor data; - Error data_error; + Status data_error; size_t num_bytes = new_value_sp->GetData(data, data_error); if (data_error.Fail()) { error.SetErrorStringWithFormat( @@ -518,7 +518,7 @@ Error ABISysV_ppc64::SetReturnValueObject(lldb::StackFrameSP &frame_sp, size_t bit_width = compiler_type.GetBitSize(frame_sp.get()); if (bit_width <= 64) { DataExtractor data; - Error data_error; + Status data_error; size_t num_bytes = new_value_sp->GetData(data, data_error); if (data_error.Fail()) { error.SetErrorStringWithFormat( @@ -663,7 +663,7 @@ ValueObjectSP ABISysV_ppc64::GetReturnValueObjectSimple( const ByteOrder byte_order = process_sp->GetByteOrder(); RegisterValue reg_value; if (reg_ctx->ReadRegister(altivec_reg, reg_value)) { - Error error; + Status error; if (reg_value.GetAsMemoryData( altivec_reg, heap_data_ap->GetBytes(), heap_data_ap->GetByteSize(), byte_order, error)) { diff --git a/lldb/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.h b/lldb/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.h index 7f321dff49c..29237a68fc9 100644 --- a/lldb/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.h +++ b/lldb/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.h @@ -31,7 +31,7 @@ public: bool GetArgumentValues(lldb_private::Thread &thread, lldb_private::ValueList &values) const override; - lldb_private::Error + lldb_private::Status SetReturnValueObject(lldb::StackFrameSP &frame_sp, lldb::ValueObjectSP &new_value) override; diff --git a/lldb/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.cpp b/lldb/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.cpp index a899b24cea5..7f76d49bfb0 100644 --- a/lldb/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.cpp +++ b/lldb/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.cpp @@ -31,8 +31,8 @@ #include "lldb/Target/Thread.h" #include "lldb/Utility/ConstString.h" #include "lldb/Utility/DataExtractor.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" using namespace lldb; using namespace lldb_private; @@ -268,7 +268,7 @@ bool ABISysV_s390x::PrepareTrivialCall(Thread &thread, addr_t sp, if (!reg_ctx->WriteRegisterFromUnsigned(reg_info, args[i])) return false; } else { - Error error; + Status error; if (log) log->Printf("About to write arg%" PRIu64 " (0x%" PRIx64 ") onto stack", static_cast<uint64_t>(i + 1), args[i]); @@ -321,7 +321,7 @@ static bool ReadIntegerArgument(Scalar &scalar, unsigned int bit_width, scalar.SignExtend(bit_width); } else { uint32_t byte_size = (bit_width + (8 - 1)) / 8; - Error error; + Status error; if (thread.GetProcess()->ReadScalarIntegerFromMemory( current_stack_argument + 8 - byte_size, byte_size, is_signed, scalar, error)) { @@ -401,9 +401,9 @@ bool ABISysV_s390x::GetArgumentValues(Thread &thread, ValueList &values) const { return true; } -Error ABISysV_s390x::SetReturnValueObject(lldb::StackFrameSP &frame_sp, - lldb::ValueObjectSP &new_value_sp) { - Error error; +Status ABISysV_s390x::SetReturnValueObject(lldb::StackFrameSP &frame_sp, + lldb::ValueObjectSP &new_value_sp) { + Status error; if (!new_value_sp) { error.SetErrorString("Empty value object for return value."); return error; @@ -429,7 +429,7 @@ Error ABISysV_s390x::SetReturnValueObject(lldb::StackFrameSP &frame_sp, const RegisterInfo *reg_info = reg_ctx->GetRegisterInfoByName("r2", 0); DataExtractor data; - Error data_error; + Status data_error; size_t num_bytes = new_value_sp->GetData(data, data_error); if (data_error.Fail()) { error.SetErrorStringWithFormat( @@ -457,7 +457,7 @@ Error ABISysV_s390x::SetReturnValueObject(lldb::StackFrameSP &frame_sp, const RegisterInfo *f0_info = reg_ctx->GetRegisterInfoByName("f0", 0); RegisterValue f0_value; DataExtractor data; - Error data_error; + Status data_error; size_t num_bytes = new_value_sp->GetData(data, data_error); if (data_error.Fail()) { error.SetErrorStringWithFormat( diff --git a/lldb/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.h b/lldb/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.h index 6ccabd6f75e..e233a900e39 100644 --- a/lldb/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.h +++ b/lldb/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.h @@ -31,7 +31,7 @@ public: bool GetArgumentValues(lldb_private::Thread &thread, lldb_private::ValueList &values) const override; - lldb_private::Error + lldb_private::Status SetReturnValueObject(lldb::StackFrameSP &frame_sp, lldb::ValueObjectSP &new_value) override; diff --git a/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp b/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp index 42bb9d057e6..deccca8c29e 100644 --- a/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp +++ b/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp @@ -31,8 +31,8 @@ #include "lldb/Target/Thread.h" #include "lldb/Utility/ConstString.h" #include "lldb/Utility/DataExtractor.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" using namespace lldb; using namespace lldb_private; @@ -1152,7 +1152,7 @@ bool ABISysV_x86_64::PrepareTrivialCall(Thread &thread, addr_t sp, sp -= 8; - Error error; + Status error; const RegisterInfo *pc_reg_info = reg_ctx->GetRegisterInfo(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_PC); const RegisterInfo *sp_reg_info = @@ -1246,7 +1246,7 @@ static bool ReadIntegerArgument(Scalar &scalar, unsigned int bit_width, scalar.SignExtend(bit_width); } else { uint32_t byte_size = (bit_width + (8 - 1)) / 8; - Error error; + Status error; if (thread.GetProcess()->ReadScalarIntegerFromMemory( current_stack_argument, byte_size, is_signed, scalar, error)) { current_stack_argument += byte_size; @@ -1329,9 +1329,9 @@ bool ABISysV_x86_64::GetArgumentValues(Thread &thread, return true; } -Error ABISysV_x86_64::SetReturnValueObject(lldb::StackFrameSP &frame_sp, - lldb::ValueObjectSP &new_value_sp) { - Error error; +Status ABISysV_x86_64::SetReturnValueObject(lldb::StackFrameSP &frame_sp, + lldb::ValueObjectSP &new_value_sp) { + Status error; if (!new_value_sp) { error.SetErrorString("Empty value object for return value."); return error; @@ -1357,7 +1357,7 @@ Error ABISysV_x86_64::SetReturnValueObject(lldb::StackFrameSP &frame_sp, const RegisterInfo *reg_info = reg_ctx->GetRegisterInfoByName("rax", 0); DataExtractor data; - Error data_error; + Status data_error; size_t num_bytes = new_value_sp->GetData(data, data_error); if (data_error.Fail()) { error.SetErrorStringWithFormat( @@ -1386,7 +1386,7 @@ Error ABISysV_x86_64::SetReturnValueObject(lldb::StackFrameSP &frame_sp, reg_ctx->GetRegisterInfoByName("xmm0", 0); RegisterValue xmm0_value; DataExtractor data; - Error data_error; + Status data_error; size_t num_bytes = new_value_sp->GetData(data, data_error); if (data_error.Fail()) { error.SetErrorStringWithFormat( @@ -1542,7 +1542,7 @@ ValueObjectSP ABISysV_x86_64::GetReturnValueObjectSimple( const ByteOrder byte_order = process_sp->GetByteOrder(); RegisterValue reg_value; if (reg_ctx->ReadRegister(altivec_reg, reg_value)) { - Error error; + Status error; if (reg_value.GetAsMemoryData( altivec_reg, heap_data_ap->GetBytes(), heap_data_ap->GetByteSize(), byte_order, error)) { @@ -1569,7 +1569,7 @@ ValueObjectSP ABISysV_x86_64::GetReturnValueObjectSimple( if (reg_ctx->ReadRegister(altivec_reg, reg_value) && reg_ctx->ReadRegister(altivec_reg2, reg_value2)) { - Error error; + Status error; if (reg_value.GetAsMemoryData( altivec_reg, heap_data_ap->GetBytes(), altivec_reg->byte_size, byte_order, error) && diff --git a/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h b/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h index 29f2ce133d4..8d420e88167 100644 --- a/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h +++ b/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h @@ -31,7 +31,7 @@ public: bool GetArgumentValues(lldb_private::Thread &thread, lldb_private::ValueList &values) const override; - lldb_private::Error + lldb_private::Status SetReturnValueObject(lldb::StackFrameSP &frame_sp, lldb::ValueObjectSP &new_value) override; diff --git a/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp b/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp index e144ef18b41..21e19bf2b12 100644 --- a/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp +++ b/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp @@ -885,9 +885,9 @@ DisassemblerLLVMC::LLVMCDisassembler::LLVMCDisassembler( const char *triple, const char *cpu, const char *features_str, unsigned flavor, DisassemblerLLVMC &owner) : m_is_valid(true) { - std::string Error; + std::string Status; const llvm::Target *curr_target = - llvm::TargetRegistry::lookupTarget(triple, Error); + llvm::TargetRegistry::lookupTarget(triple, Status); if (!curr_target) { m_is_valid = false; return; diff --git a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp index 80f3f6857fd..a82b3fe267b 100644 --- a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp +++ b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp @@ -239,7 +239,7 @@ DynamicLoaderDarwinKernel::SearchForKernelWithDebugHints(Process *process) { if (GetGlobalProperties()->GetScanType() == eKASLRScanNone) return LLDB_INVALID_ADDRESS; - Error read_err; + Status read_err; addr_t kernel_addresses_64[] = { 0xfffffff000004010ULL, // newest arm64 devices 0xffffff8000004010ULL, // 2014-2015-ish arm64 devices @@ -395,7 +395,7 @@ DynamicLoaderDarwinKernel::CheckForKernelImageAtAddress(lldb::addr_t addr, // valid Mach-O magic field there // (the first field of the mach_header/mach_header_64 struct). - Error read_error; + Status read_error; uint8_t magicbuf[4]; if (process->ReadMemoryFromInferior (addr, magicbuf, sizeof (magicbuf), read_error) != sizeof (magicbuf)) return UUID(); @@ -483,7 +483,7 @@ DynamicLoaderDarwinKernel::DynamicLoaderDarwinKernel(Process *process, m_kext_summary_header_ptr_addr(), m_kext_summary_header_addr(), m_kext_summary_header(), m_known_kexts(), m_mutex(), m_break_id(LLDB_INVALID_BREAK_ID) { - Error error; + Status error; PlatformSP platform_sp( Platform::Create(PlatformDarwinKernel::GetPluginNameStatic(), error)); // Only select the darwin-kernel Platform if we've been asked to load kexts. @@ -1086,7 +1086,7 @@ bool DynamicLoaderDarwinKernel::ReadKextSummaryHeader() { if (m_kext_summary_header_ptr_addr.IsValid()) { const uint32_t addr_size = m_kernel.GetAddressByteSize(); const ByteOrder byte_order = m_kernel.GetByteOrder(); - Error error; + Status error; // Read enough bytes for a "OSKextLoadedKextSummaryHeader" structure // which is currently 4 uint32_t and a pointer. uint8_t buf[24]; @@ -1338,7 +1338,7 @@ uint32_t DynamicLoaderDarwinKernel::ReadKextSummaries( image_infos.resize(image_infos_count); const size_t count = image_infos.size() * m_kext_summary_header.entry_size; DataBufferHeap data(count, 0); - Error error; + Status error; const bool prefer_file_cache = false; const size_t bytes_read = m_process->GetTarget().ReadMemory( @@ -1517,8 +1517,8 @@ DynamicLoaderDarwinKernel::GetStepThroughTrampolinePlan(Thread &thread, return thread_plan_sp; } -Error DynamicLoaderDarwinKernel::CanLoadImage() { - Error error; +Status DynamicLoaderDarwinKernel::CanLoadImage() { + Status error; error.SetErrorString( "always unsafe to load or unload shared libraries in the darwin kernel"); return error; diff --git a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h index 7ca9bada1a1..ad4f7c631d8 100644 --- a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h +++ b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h @@ -61,7 +61,7 @@ public: lldb::ThreadPlanSP GetStepThroughTrampolinePlan(lldb_private::Thread &thread, bool stop_others) override; - lldb_private::Error CanLoadImage() override; + lldb_private::Status CanLoadImage() override; //------------------------------------------------------------------ // PluginInterface protocol diff --git a/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp b/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp index 25bf6e9a729..d0d60017e86 100644 --- a/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp +++ b/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp @@ -213,7 +213,7 @@ ModuleSP DynamicLoaderHexagonDYLD::GetTargetExecutable() { } // AD: Needs to be updated? -Error DynamicLoaderHexagonDYLD::CanLoadImage() { return Error(); } +Status DynamicLoaderHexagonDYLD::CanLoadImage() { return Status(); } void DynamicLoaderHexagonDYLD::UpdateLoadedSections(ModuleSP module, addr_t link_map_addr, @@ -558,7 +558,7 @@ const SectionList *DynamicLoaderHexagonDYLD::GetSectionListFromModule( } static int ReadInt(Process *process, addr_t addr) { - Error error; + Status error; int value = (int)process->ReadUnsignedIntegerFromMemory( addr, sizeof(uint32_t), 0, error); if (error.Fail()) diff --git a/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.h b/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.h index 05709d07fd6..200a4171bd1 100644 --- a/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.h +++ b/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.h @@ -47,7 +47,7 @@ public: lldb::ThreadPlanSP GetStepThroughTrampolinePlan(lldb_private::Thread &thread, bool stop_others) override; - lldb_private::Error CanLoadImage() override; + lldb_private::Status CanLoadImage() override; lldb::addr_t GetThreadLocalData(const lldb::ModuleSP module, const lldb::ThreadSP thread, diff --git a/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/HexagonDYLDRendezvous.cpp b/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/HexagonDYLDRendezvous.cpp index f22644aec10..1ef1be5d0ad 100644 --- a/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/HexagonDYLDRendezvous.cpp +++ b/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/HexagonDYLDRendezvous.cpp @@ -16,8 +16,8 @@ #include "lldb/Symbol/SymbolContext.h" #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Target/Process.h" @@ -33,7 +33,7 @@ using namespace lldb_private; static addr_t ResolveRendezvousAddress(Process *process) { addr_t info_location; addr_t info_addr; - Error error; + Status error; info_location = process->GetImageInfoAddress(); @@ -222,7 +222,7 @@ bool HexagonDYLDRendezvous::TakeSnapshot(SOEntryList &entry_list) { addr_t HexagonDYLDRendezvous::ReadWord(addr_t addr, uint64_t *dst, size_t size) { - Error error; + Status error; *dst = m_process->ReadUnsignedIntegerFromMemory(addr, size, 0, error); if (error.Fail()) @@ -232,7 +232,7 @@ addr_t HexagonDYLDRendezvous::ReadWord(addr_t addr, uint64_t *dst, } addr_t HexagonDYLDRendezvous::ReadPointer(addr_t addr, addr_t *dst) { - Error error; + Status error; *dst = m_process->ReadPointerFromMemory(addr, error); if (error.Fail()) @@ -243,7 +243,7 @@ addr_t HexagonDYLDRendezvous::ReadPointer(addr_t addr, addr_t *dst) { std::string HexagonDYLDRendezvous::ReadStringFromMemory(addr_t addr) { std::string str; - Error error; + Status error; size_t size; char c; @@ -304,7 +304,7 @@ bool HexagonDYLDRendezvous::FindMetadata(const char *name, PThreadField field, if (addr == LLDB_INVALID_ADDRESS) return false; - Error error; + Status error; value = (uint32_t)m_process->ReadUnsignedIntegerFromMemory( addr + field * sizeof(uint32_t), sizeof(uint32_t), 0, error); if (error.Fail()) diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp index 4ffd216e98a..aaab97609d5 100644 --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp @@ -962,7 +962,7 @@ DynamicLoaderDarwin::GetStepThroughTrampolinePlan(Thread &thread, for (Address address : addresses) { Symbol *symbol = address.CalculateSymbolContextSymbol(); if (symbol && symbol->IsIndirect()) { - Error error; + Status error; Address symbol_address = symbol->GetAddress(); addr_t resolved_addr = thread.GetProcess()->ResolveIndirectFunction( &symbol_address, error); @@ -1062,7 +1062,7 @@ DynamicLoaderDarwin::GetThreadLocalData(const lldb::ModuleSP module_sp, lldb_private::Address tls_addr; if (module_sp->ResolveFileAddress(tls_file_addr, tls_addr)) { - Error error; + Status error; const size_t tsl_data_size = addr_size * 3; Target &target = m_process->GetTarget(); if (target.ReadMemory(tls_addr, false, buf, tsl_data_size, error) == diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp index c824653b2e9..66085a23759 100644 --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp @@ -270,7 +270,7 @@ bool DynamicLoaderMacOS::NotifyBreakpointHit(void *baton, if (header_array != static_cast<uint64_t>(-1)) { std::vector<addr_t> image_load_addresses; for (uint64_t i = 0; i < image_infos_count; i++) { - Error error; + Status error; addr_t addr = process->ReadUnsignedIntegerFromMemory( header_array + (8 * i), 8, LLDB_INVALID_ADDRESS, error); if (addr != LLDB_INVALID_ADDRESS) { @@ -397,8 +397,8 @@ DynamicLoaderMacOS::GetDyldLockVariableAddressFromModule(Module *module) { // 0; // // in libdyld.dylib. -Error DynamicLoaderMacOS::CanLoadImage() { - Error error; +Status DynamicLoaderMacOS::CanLoadImage() { + Status error; addr_t symbol_address = LLDB_INVALID_ADDRESS; Target &target = m_process->GetTarget(); const ModuleList &target_modules = target.GetImages(); diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h index 60c4beed383..dd42686195b 100644 --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h @@ -62,7 +62,7 @@ public: //------------------------------------------------------------------ bool ProcessDidExec() override; - lldb_private::Error CanLoadImage() override; + lldb_private::Status CanLoadImage() override; bool GetSharedCacheInformation( lldb::addr_t &base_address, lldb_private::UUID &uuid, diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp index 46742c1f9b5..e0def58f41c 100644 --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp @@ -201,7 +201,7 @@ void DynamicLoaderMacOSXDYLD::DoInitialImageFetch() { m_process->GetTarget().GetArchitecture().GetByteOrder(); uint8_t buf[4]; DataExtractor data(buf, sizeof(buf), byte_order, 4); - Error error; + Status error; if (m_process->ReadMemory(shlib_addr, buf, 4, error) == 4) { lldb::offset_t offset = 0; uint32_t magic = data.GetU32(&offset); @@ -463,7 +463,7 @@ bool DynamicLoaderMacOSXDYLD::ReadAllImageInfosStructure() { UNUSED_IF_ASSERT_DISABLED(count_v13); assert(sizeof(buf) >= count_v13); - Error error; + Status error; if (m_process->ReadMemory(m_dyld_all_image_infos_addr, buf, 4, error) == 4) { m_dyld_all_image_infos.version = data.GetU32(&offset); @@ -683,7 +683,7 @@ bool DynamicLoaderMacOSXDYLD::ReadImageInfos( image_infos.resize(image_infos_count); const size_t count = image_infos.size() * 3 * addr_size; DataBufferHeap info_data(count, 0); - Error error; + Status error; const size_t bytes_read = m_process->ReadMemory( image_infos_addr, info_data.GetBytes(), info_data.GetByteSize(), error); if (bytes_read == count) { @@ -793,7 +793,7 @@ bool DynamicLoaderMacOSXDYLD::ReadMachHeader(lldb::addr_t addr, llvm::MachO::mach_header *header, DataExtractor *load_command_data) { DataBufferHeap header_bytes(sizeof(llvm::MachO::mach_header), 0); - Error error; + Status error; size_t bytes_read = m_process->ReadMemory(addr, header_bytes.GetBytes(), header_bytes.GetByteSize(), error); if (bytes_read == sizeof(llvm::MachO::mach_header)) { @@ -1069,8 +1069,8 @@ bool DynamicLoaderMacOSXDYLD::SetNotificationBreakpoint() { return m_break_id != LLDB_INVALID_BREAK_ID; } -Error DynamicLoaderMacOSXDYLD::CanLoadImage() { - Error error; +Status DynamicLoaderMacOSXDYLD::CanLoadImage() { + Status error; // In order for us to tell if we can load a shared library we verify that // the dylib_info_addr isn't zero (which means no shared libraries have // been set yet, or dyld is currently mucking with the shared library list). @@ -1107,7 +1107,7 @@ bool DynamicLoaderMacOSXDYLD::GetSharedCacheInformation( // Version 13 and higher of dyld_all_image_infos is required to get the // sharedCacheUUID field. - Error err; + Status err; uint32_t version_or_magic = m_process->ReadUnsignedIntegerFromMemory(all_image_infos, 4, -1, err); if (version_or_magic != static_cast<uint32_t>(-1) && @@ -1140,7 +1140,7 @@ bool DynamicLoaderMacOSXDYLD::GetSharedCacheInformation( // The sharedCacheBaseAddress field is the next one in the // dyld_all_image_infos struct. addr_t sharedCacheBaseAddr_address = sharedCacheUUID_address + 16; - Error error; + Status error; base_address = m_process->ReadUnsignedIntegerFromMemory( sharedCacheBaseAddr_address, wordsize, LLDB_INVALID_ADDRESS, error); diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h index d5f1b51e508..81c2fcfb194 100644 --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h @@ -65,7 +65,7 @@ public: //------------------------------------------------------------------ bool ProcessDidExec() override; - lldb_private::Error CanLoadImage() override; + lldb_private::Status CanLoadImage() override; bool GetSharedCacheInformation( lldb::addr_t &base_address, lldb_private::UUID &uuid, diff --git a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp index c4917c08fa9..c1986976b0f 100644 --- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp +++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp @@ -18,8 +18,8 @@ #include "lldb/Target/Platform.h" #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" #include "llvm/Support/Path.h" @@ -34,7 +34,7 @@ static addr_t ResolveRendezvousAddress(Process *process) { Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); addr_t info_location; addr_t info_addr; - Error error; + Status error; if (!process) { if (log) @@ -420,7 +420,7 @@ bool DYLDRendezvous::TakeSnapshot(SOEntryList &entry_list) { } addr_t DYLDRendezvous::ReadWord(addr_t addr, uint64_t *dst, size_t size) { - Error error; + Status error; *dst = m_process->ReadUnsignedIntegerFromMemory(addr, size, 0, error); if (error.Fail()) @@ -430,7 +430,7 @@ addr_t DYLDRendezvous::ReadWord(addr_t addr, uint64_t *dst, size_t size) { } addr_t DYLDRendezvous::ReadPointer(addr_t addr, addr_t *dst) { - Error error; + Status error; *dst = m_process->ReadPointerFromMemory(addr, error); if (error.Fail()) @@ -441,7 +441,7 @@ addr_t DYLDRendezvous::ReadPointer(addr_t addr, addr_t *dst) { std::string DYLDRendezvous::ReadStringFromMemory(addr_t addr) { std::string str; - Error error; + Status error; if (addr == LLDB_INVALID_ADDRESS) return std::string(); @@ -479,7 +479,7 @@ void DYLDRendezvous::UpdateBaseAddrIfNecessary(SOEntry &entry, if (isLoadBiasIncorrect(m_process->GetTarget(), file_path)) { lldb::addr_t load_addr = LLDB_INVALID_ADDRESS; bool is_loaded = false; - Error error = + Status error = m_process->GetFileLoadAddress(entry.file_spec, is_loaded, load_addr); if (error.Success() && is_loaded) entry.base_addr = load_addr; @@ -545,7 +545,7 @@ bool DYLDRendezvous::FindMetadata(const char *name, PThreadField field, if (addr == LLDB_INVALID_ADDRESS) return false; - Error error; + Status error; value = (uint32_t)m_process->ReadUnsignedIntegerFromMemory( addr + field * sizeof(uint32_t), sizeof(uint32_t), 0, error); if (error.Fail()) diff --git a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp index c809d2c7783..5f56bfc027a 100644 --- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp +++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp @@ -222,7 +222,7 @@ void DynamicLoaderPOSIXDYLD::DidLaunch() { } } -Error DynamicLoaderPOSIXDYLD::CanLoadImage() { return Error(); } +Status DynamicLoaderPOSIXDYLD::CanLoadImage() { return Status(); } void DynamicLoaderPOSIXDYLD::UpdateLoadedSections(ModuleSP module, addr_t link_map_addr, diff --git a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h index 8e4be1d4a06..86e0311c291 100644 --- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h +++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h @@ -52,7 +52,7 @@ public: lldb::ThreadPlanSP GetStepThroughTrampolinePlan(lldb_private::Thread &thread, bool stop_others) override; - lldb_private::Error CanLoadImage() override; + lldb_private::Status CanLoadImage() override; lldb::addr_t GetThreadLocalData(const lldb::ModuleSP module, const lldb::ThreadSP thread, diff --git a/lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp b/lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp index 04f1f339057..291695cb68c 100644 --- a/lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp +++ b/lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp @@ -132,8 +132,8 @@ DynamicLoaderStatic::GetStepThroughTrampolinePlan(Thread &thread, return ThreadPlanSP(); } -Error DynamicLoaderStatic::CanLoadImage() { - Error error; +Status DynamicLoaderStatic::CanLoadImage() { + Status error; error.SetErrorString("can't load images on with a static debug session"); return error; } diff --git a/lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.h b/lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.h index 413ad80a2fd..2d18ec86afd 100644 --- a/lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.h +++ b/lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.h @@ -52,7 +52,7 @@ public: lldb::ThreadPlanSP GetStepThroughTrampolinePlan(lldb_private::Thread &thread, bool stop_others) override; - lldb_private::Error CanLoadImage() override; + lldb_private::Status CanLoadImage() override; //------------------------------------------------------------------ // PluginInterface protocol diff --git a/lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp b/lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp index 20bf3609f46..c381326ebf4 100644 --- a/lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp +++ b/lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp @@ -61,7 +61,7 @@ void DynamicLoaderWindowsDYLD::DidAttach() {} void DynamicLoaderWindowsDYLD::DidLaunch() {} -Error DynamicLoaderWindowsDYLD::CanLoadImage() { return Error(); } +Status DynamicLoaderWindowsDYLD::CanLoadImage() { return Status(); } ConstString DynamicLoaderWindowsDYLD::GetPluginName() { return GetPluginNameStatic(); diff --git a/lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h b/lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h index 3494082eea8..de6e295f789 100644 --- a/lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h +++ b/lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h @@ -34,7 +34,7 @@ public: void DidAttach() override; void DidLaunch() override; - Error CanLoadImage() override; + Status CanLoadImage() override; lldb::ThreadPlanSP GetStepThroughTrampolinePlan(Thread &thread, bool stop) override; diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp index a3cdfa9d5f1..256d46a1542 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp @@ -43,8 +43,8 @@ #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" #include "lldb/Utility/Endian.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" #include "lldb/lldb-private.h" #include "clang/AST/ASTConsumer.h" #include "clang/AST/ASTContext.h" @@ -191,7 +191,7 @@ bool ClangExpressionDeclMap::AddPersistentVariable(const NamedDecl *decl, return false; if (m_parser_vars->m_materializer && is_result) { - Error err; + Status err; ExecutionContext &exe_ctx = m_parser_vars->m_exe_ctx; Target *target = exe_ctx.GetTargetPtr(); @@ -364,7 +364,7 @@ bool ClangExpressionDeclMap::AddValueToStruct(const NamedDecl *decl, if (m_parser_vars->m_materializer) { uint32_t offset = 0; - Error err; + Status err; if (is_persistent_variable) { ExpressionVariableSP var_sp(var->shared_from_this()); @@ -1630,7 +1630,7 @@ bool ClangExpressionDeclMap::GetVariableValue(VariableSP &var, DWARFExpression &var_location_expr = var->LocationExpression(); Target *target = m_parser_vars->m_exe_ctx.GetTargetPtr(); - Error err; + Status err; if (var->GetLocationIsConstantValueData()) { DataExtractor const_value_extractor; diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp index 6c923ced1ec..4e20be79f68 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp @@ -756,7 +756,7 @@ static bool FindFunctionInModule(ConstString &mangled_name, return false; } -lldb_private::Error ClangExpressionParser::PrepareForExecution( +lldb_private::Status ClangExpressionParser::PrepareForExecution( lldb::addr_t &func_addr, lldb::addr_t &func_end, lldb::IRExecutionUnitSP &execution_unit_sp, ExecutionContext &exe_ctx, bool &can_interpret, ExecutionPolicy execution_policy) { @@ -764,7 +764,7 @@ lldb_private::Error ClangExpressionParser::PrepareForExecution( func_end = LLDB_INVALID_ADDRESS; Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); - lldb_private::Error err; + lldb_private::Status err; std::unique_ptr<llvm::Module> llvm_module_ap( m_code_generator->ReleaseModule()); @@ -857,7 +857,7 @@ lldb_private::Error ClangExpressionParser::PrepareForExecution( if (execution_policy != eExecutionPolicyAlways && execution_policy != eExecutionPolicyTopLevel) { - lldb_private::Error interpret_error; + lldb_private::Status interpret_error; bool interpret_function_calls = !process ? false : process->CanInterpretFunctionCalls(); @@ -941,9 +941,9 @@ lldb_private::Error ClangExpressionParser::PrepareForExecution( return err; } -lldb_private::Error ClangExpressionParser::RunStaticInitializers( +lldb_private::Status ClangExpressionParser::RunStaticInitializers( lldb::IRExecutionUnitSP &execution_unit_sp, ExecutionContext &exe_ctx) { - lldb_private::Error err; + lldb_private::Status err; lldbassert(execution_unit_sp.get()); lldbassert(exe_ctx.HasThreadScope()); diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h index f0203f36e59..3e6a109a4af 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h @@ -14,7 +14,7 @@ #include "lldb/Core/ClangForward.h" #include "lldb/Expression/DiagnosticManager.h" #include "lldb/Expression/ExpressionParser.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/lldb-public.h" #include <string> @@ -110,7 +110,7 @@ public: /// An error code indicating the success or failure of the operation. /// Test with Success(). //------------------------------------------------------------------ - Error + Status PrepareForExecution(lldb::addr_t &func_addr, lldb::addr_t &func_end, lldb::IRExecutionUnitSP &execution_unit_sp, ExecutionContext &exe_ctx, bool &can_interpret, @@ -128,8 +128,8 @@ public: /// @return /// The error code indicating the //------------------------------------------------------------------ - Error RunStaticInitializers(lldb::IRExecutionUnitSP &execution_unit_sp, - ExecutionContext &exe_ctx); + Status RunStaticInitializers(lldb::IRExecutionUnitSP &execution_unit_sp, + ExecutionContext &exe_ctx); //------------------------------------------------------------------ /// Returns a string representing current ABI. diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp index 95d81db1280..2a6261a6df4 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp @@ -83,7 +83,7 @@ ClangUserExpression::ClangUserExpression( ClangUserExpression::~ClangUserExpression() {} -void ClangUserExpression::ScanContext(ExecutionContext &exe_ctx, Error &err) { +void ClangUserExpression::ScanContext(ExecutionContext &exe_ctx, Status &err) { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); if (log) @@ -315,7 +315,7 @@ bool ClangUserExpression::Parse(DiagnosticManager &diagnostic_manager, bool generate_debug_info) { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); - Error err; + Status err; InstallContext(exe_ctx); @@ -501,7 +501,7 @@ bool ClangUserExpression::Parse(DiagnosticManager &diagnostic_manager, // { - Error jit_error = parser.PrepareForExecution( + Status jit_error = parser.PrepareForExecution( m_jit_start_addr, m_jit_end_addr, m_execution_unit_sp, exe_ctx, m_can_interpret, execution_policy); @@ -517,7 +517,7 @@ bool ClangUserExpression::Parse(DiagnosticManager &diagnostic_manager, } if (exe_ctx.GetProcessPtr() && execution_policy == eExecutionPolicyTopLevel) { - Error static_init_error = + Status static_init_error = parser.RunStaticInitializers(m_execution_unit_sp, exe_ctx); if (!static_init_error.Success()) { @@ -603,7 +603,7 @@ bool ClangUserExpression::AddArguments(ExecutionContext &exe_ctx, return false; } - Error object_ptr_error; + Status object_ptr_error; object_ptr = GetObjectPointer(frame_sp, object_name, object_ptr_error); diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h b/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h index 155c153b873..88a78798b65 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h @@ -168,7 +168,7 @@ private: //------------------------------------------------------------------ void ScanContext(ExecutionContext &exe_ctx, - lldb_private::Error &err) override; + lldb_private::Status &err) override; bool AddArguments(ExecutionContext &exe_ctx, std::vector<lldb::addr_t> &args, lldb::addr_t struct_address, diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp index a54ab4a2267..065e5db4c9f 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp @@ -118,7 +118,7 @@ bool ClangUtilityFunction::Install(DiagnosticManager &diagnostic_manager, bool can_interpret = false; // should stay that way - Error jit_error = parser.PrepareForExecution( + Status jit_error = parser.PrepareForExecution( m_jit_start_addr, m_jit_end_addr, m_execution_unit_sp, exe_ctx, can_interpret, eExecutionPolicyAlways); diff --git a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp index 68a214ee468..13f5657eedd 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp @@ -1263,7 +1263,7 @@ bool IRForTarget::MaterializeInitializer(uint8_t *data, Constant *initializer) { lldb_private::Scalar scalar = int_initializer->getValue().zextOrTrunc( llvm::NextPowerOf2(constant_size) * 8); - lldb_private::Error get_data_error; + lldb_private::Status get_data_error; if (!scalar.GetAsMemoryData(data, constant_size, lldb_private::endian::InlHostByteOrder(), get_data_error)) diff --git a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.h b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.h index eb52730f3a8..93ce8aa44eb 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.h +++ b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.h @@ -13,7 +13,7 @@ #include "lldb/Symbol/TaggedASTType.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-public.h" diff --git a/lldb/source/Plugins/ExpressionParser/Go/GoParser.cpp b/lldb/source/Plugins/ExpressionParser/Go/GoParser.cpp index 0bae4a4574d..538bd05e25f 100644 --- a/lldb/source/Plugins/ExpressionParser/Go/GoParser.cpp +++ b/lldb/source/Plugins/ExpressionParser/Go/GoParser.cpp @@ -12,7 +12,7 @@ #include "GoParser.h" #include "Plugins/ExpressionParser/Go/GoAST.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "llvm/ADT/SmallString.h" using namespace lldb_private; @@ -860,7 +860,7 @@ llvm::StringRef GoParser::CopyString(llvm::StringRef s) { return m_strings.insert(std::make_pair(s, 'x')).first->getKey(); } -void GoParser::GetError(Error &error) { +void GoParser::GetError(Status &error) { llvm::StringRef want; if (m_failed) want = diff --git a/lldb/source/Plugins/ExpressionParser/Go/GoParser.h b/lldb/source/Plugins/ExpressionParser/Go/GoParser.h index bd128558022..9ed2ae2033b 100644 --- a/lldb/source/Plugins/ExpressionParser/Go/GoParser.h +++ b/lldb/source/Plugins/ExpressionParser/Go/GoParser.h @@ -82,7 +82,7 @@ public: return m_lexer.BytesRemaining() == 0 && m_pos == m_tokens.size(); } - void GetError(Error &error); + void GetError(Status &error); private: class Rule; diff --git a/lldb/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp b/lldb/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp index 50d45a1ad1e..f4b8cfbe03d 100644 --- a/lldb/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp +++ b/lldb/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp @@ -150,7 +150,7 @@ public: CompilerType EvaluateType(const GoASTExpr *e); - Error &error() { return m_error; } + Status &error() { return m_error; } private: std::nullptr_t NotImplemented(const GoASTExpr *e) { @@ -163,7 +163,7 @@ private: lldb::StackFrameSP m_frame; GoParser m_parser; DynamicValueType m_use_dynamic; - Error m_error; + Status m_error; llvm::StringRef m_package; std::vector<std::unique_ptr<GoASTStmt>> m_statements; }; @@ -254,7 +254,7 @@ GoUserExpression::DoExecute(DiagnosticManager &diagnostic_manager, m_interpreter->set_use_dynamic(options.GetUseDynamic()); ValueObjectSP result_val_sp = m_interpreter->Evaluate(exe_ctx); - Error err = m_interpreter->error(); + Status err = m_interpreter->error(); m_interpreter.reset(); if (!result_val_sp) { diff --git a/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.h b/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.h index 40a31169ecd..fb1867c6362 100644 --- a/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.h +++ b/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.h @@ -13,7 +13,7 @@ #include "Plugins/Process/Utility/ARMDefines.h" #include "lldb/Core/EmulateInstruction.h" #include "lldb/Utility/ConstString.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" namespace lldb_private { diff --git a/lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp b/lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp index 655fada3a4b..54dd237eb4b 100644 --- a/lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp +++ b/lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp @@ -846,7 +846,7 @@ bool EmulateInstructionARM64::EmulateLDPSTP(const uint32_t opcode) { Context context_t2; uint8_t buffer[RegisterValue::kMaxRegisterByteSize]; - Error error; + Status error; switch (memop) { case MemOp_STORE: { @@ -992,7 +992,7 @@ bool EmulateInstructionARM64::EmulateLDRSTRImm(const uint32_t opcode) { return false; } - Error error; + Status error; bool success = false; uint64_t address; uint8_t buffer[RegisterValue::kMaxRegisterByteSize]; diff --git a/lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.h b/lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.h index 475410ab2d1..253bb935bca 100644 --- a/lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.h +++ b/lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.h @@ -17,7 +17,7 @@ #include "Plugins/Process/Utility/ARMDefines.h" #include "lldb/Core/EmulateInstruction.h" #include "lldb/Interpreter/OptionValue.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" class EmulateInstructionARM64 : public lldb_private::EmulateInstruction { public: diff --git a/lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp b/lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp index aa7c6e5d1fe..4d1d89abb1d 100644 --- a/lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp +++ b/lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp @@ -63,10 +63,10 @@ EmulateInstructionMIPS::EmulateInstructionMIPS( const lldb_private::ArchSpec &arch) : EmulateInstruction(arch) { /* Create instance of llvm::MCDisassembler */ - std::string Error; + std::string Status; llvm::Triple triple = arch.GetTriple(); const llvm::Target *target = - llvm::TargetRegistry::lookupTarget(triple.getTriple(), Error); + llvm::TargetRegistry::lookupTarget(triple.getTriple(), Status); /* * If we fail to get the target then we haven't registered it. The @@ -83,7 +83,7 @@ EmulateInstructionMIPS::EmulateInstructionMIPS( LLVMInitializeMipsAsmPrinter(); LLVMInitializeMipsTargetMC(); LLVMInitializeMipsDisassembler(); - target = llvm::TargetRegistry::lookupTarget(triple.getTriple(), Error); + target = llvm::TargetRegistry::lookupTarget(triple.getTriple(), Status); } #endif @@ -1019,7 +1019,7 @@ bool EmulateInstructionMIPS::SetInstruction(const Opcode &insn_opcode, if (EmulateInstruction::SetInstruction(insn_opcode, inst_addr, target)) { if (inst_addr.GetAddressClass() == eAddressClassCodeAlternateISA) { - Error error; + Status error; lldb::addr_t load_addr = LLDB_INVALID_ADDRESS; /* @@ -1297,7 +1297,7 @@ bool EmulateInstructionMIPS::Emulate_SW(llvm::MCInst &insn) { context.SetRegisterToRegisterPlusOffset(reg_info_src, reg_info_base, 0); uint8_t buffer[RegisterValue::kMaxRegisterByteSize]; - Error error; + Status error; if (!ReadRegister(®_info_base, data_src)) return false; @@ -1563,7 +1563,7 @@ bool EmulateInstructionMIPS::Emulate_SWSP(llvm::MCInst &insn) { context.SetRegisterToRegisterPlusOffset(reg_info_src, reg_info_base, 0); uint8_t buffer[RegisterValue::kMaxRegisterByteSize]; - Error error; + Status error; if (!ReadRegister(®_info_base, data_src)) return false; @@ -1646,7 +1646,7 @@ bool EmulateInstructionMIPS::Emulate_SWM16_32(llvm::MCInst &insn) { context.SetRegisterToRegisterPlusOffset(reg_info_src, reg_info_base, 0); uint8_t buffer[RegisterValue::kMaxRegisterByteSize]; - Error error; + Status error; if (!ReadRegister(®_info_base, data_src)) return false; diff --git a/lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.h b/lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.h index 0375056f87c..8d6e0be3cd7 100644 --- a/lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.h +++ b/lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.h @@ -23,7 +23,7 @@ class MCInst; #include "lldb/Core/EmulateInstruction.h" #include "lldb/Interpreter/OptionValue.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" class EmulateInstructionMIPS : public lldb_private::EmulateInstruction { public: diff --git a/lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp b/lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp index 4c90a1901da..1e6d9875695 100644 --- a/lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp +++ b/lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp @@ -63,10 +63,10 @@ EmulateInstructionMIPS64::EmulateInstructionMIPS64( const lldb_private::ArchSpec &arch) : EmulateInstruction(arch) { /* Create instance of llvm::MCDisassembler */ - std::string Error; + std::string Status; llvm::Triple triple = arch.GetTriple(); const llvm::Target *target = - llvm::TargetRegistry::lookupTarget(triple.getTriple(), Error); + llvm::TargetRegistry::lookupTarget(triple.getTriple(), Status); /* * If we fail to get the target then we haven't registered it. The @@ -83,7 +83,7 @@ EmulateInstructionMIPS64::EmulateInstructionMIPS64( LLVMInitializeMipsAsmPrinter(); LLVMInitializeMipsTargetMC(); LLVMInitializeMipsDisassembler(); - target = llvm::TargetRegistry::lookupTarget(triple.getTriple(), Error); + target = llvm::TargetRegistry::lookupTarget(triple.getTriple(), Status); } #endif @@ -1141,7 +1141,7 @@ bool EmulateInstructionMIPS64::Emulate_SD(llvm::MCInst &insn) { context.SetRegisterToRegisterPlusOffset(reg_info_src, reg_info_base, 0); uint8_t buffer[RegisterValue::kMaxRegisterByteSize]; - Error error; + Status error; if (!ReadRegister(®_info_base, data_src)) return false; diff --git a/lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.h b/lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.h index 1e5be516d13..c2433d59830 100644 --- a/lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.h +++ b/lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.h @@ -16,7 +16,7 @@ // Project includes #include "lldb/Core/EmulateInstruction.h" #include "lldb/Interpreter/OptionValue.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" namespace llvm { class MCDisassembler; diff --git a/lldb/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp b/lldb/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp index 96370528f26..91c5d6ce3d6 100644 --- a/lldb/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp +++ b/lldb/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp @@ -134,7 +134,7 @@ StructuredData::ObjectSP AddressSanitizerRuntime::RetrieveReportData() { ValueObjectSP return_value_sp; ExecutionContext exe_ctx; - Error eval_error; + Status eval_error; frame_sp->CalculateExecutionContext(exe_ctx); ExpressionResults result = UserExpression::Evaluate( exe_ctx, options, address_sanitizer_retrieve_report_data_command, "", @@ -171,7 +171,7 @@ StructuredData::ObjectSP AddressSanitizerRuntime::RetrieveReportData() { return_value_sp->GetValueForExpressionPath(".description") ->GetValueAsUnsigned(0); std::string description; - Error error; + Status error; process_sp->ReadCStringFromMemory(description_ptr, description, error); StructuredData::Dictionary *dict = new StructuredData::Dictionary(); diff --git a/lldb/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp b/lldb/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp index 562d988be83..d7b518982fc 100644 --- a/lldb/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp +++ b/lldb/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp @@ -256,7 +256,7 @@ static std::string RetrieveString(ValueObjectSP return_value_sp, return_value_sp->GetValueForExpressionPath(expression_path.c_str()) ->GetValueAsUnsigned(0); std::string str; - Error error; + Status error; process_sp->ReadCStringFromMemory(ptr, str, error); return str; } @@ -325,7 +325,7 @@ ThreadSanitizerRuntime::RetrieveReportData(ExecutionContextRef exe_ctx_ref) { ValueObjectSP main_value; ExecutionContext exe_ctx; - Error eval_error; + Status eval_error; frame_sp->CalculateExecutionContext(exe_ctx); ExpressionResults result = UserExpression::Evaluate( exe_ctx, options, thread_sanitizer_retrieve_report_data_command, "", diff --git a/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp b/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp index b97d67a0bb4..7ef3aecdb89 100644 --- a/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp +++ b/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp @@ -103,7 +103,7 @@ bool ReadJITEntry(const addr_t from_addr, Process *process, const size_t data_byte_size = llvm::alignTo(sizeof(ptr_t) * 3, uint64_align_bytes) + sizeof(uint64_t); - Error error; + Status error; DataBufferHeap data(data_byte_size, 0); size_t bytes_read = process->ReadMemory(from_addr, data.GetBytes(), data.GetByteSize(), error); @@ -277,7 +277,7 @@ bool JITLoaderGDB::ReadJITDescriptorImpl(bool all_entries) { jit_descriptor<ptr_t> jit_desc; const size_t jit_desc_size = sizeof(jit_desc); - Error error; + Status error; size_t bytes_read = m_process->DoReadMemory(m_jit_descriptor_addr, &jit_desc, jit_desc_size, error); if (bytes_read != jit_desc_size || !error.Success()) { diff --git a/lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp b/lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp index db7c2467582..5e8f051dec9 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp @@ -44,7 +44,7 @@ public: return; } - Error err; + Status err; TypeSystem *type_system = target_sp->GetScratchTypeSystemForLanguage( &err, lldb::eLanguageTypeC_plus_plus); @@ -133,7 +133,7 @@ public: return lldb::ValueObjectSP(); } - Error err; + Status err; ValueObjectSP struct_sp = struct_pointer_sp->Dereference(err); if (!struct_sp || !err.Success()) { diff --git a/lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp b/lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp index b69b6953042..0f6fb54e838 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp @@ -24,7 +24,7 @@ #include "lldb/Target/Thread.h" #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/Endian.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/Stream.h" #include <algorithm> @@ -129,7 +129,7 @@ bool lldb_private::formatters::WCharStringSummaryProvider( bool lldb_private::formatters::Char16SummaryProvider( ValueObject &valobj, Stream &stream, const TypeSummaryOptions &) { DataExtractor data; - Error error; + Status error; valobj.GetData(data, error); if (error.Fail()) @@ -155,7 +155,7 @@ bool lldb_private::formatters::Char16SummaryProvider( bool lldb_private::formatters::Char32SummaryProvider( ValueObject &valobj, Stream &stream, const TypeSummaryOptions &) { DataExtractor data; - Error error; + Status error; valobj.GetData(data, error); if (error.Fail()) @@ -181,7 +181,7 @@ bool lldb_private::formatters::Char32SummaryProvider( bool lldb_private::formatters::WCharSummaryProvider( ValueObject &valobj, Stream &stream, const TypeSummaryOptions &) { DataExtractor data; - Error error; + Status error; valobj.GetData(data, error); if (error.Fail()) diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp index 659a12b7eec..11245e1310b 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp @@ -26,7 +26,7 @@ #include "lldb/Target/Target.h" #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/Endian.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/Stream.h" using namespace lldb; @@ -53,7 +53,7 @@ bool lldb_private::formatters::LibcxxSmartPointerSummaryProvider( return true; } else { bool print_pointee = false; - Error error; + Status error; ValueObjectSP pointee_sp = ptr_sp->Dereference(error); if (pointee_sp && error.Success()) { if (pointee_sp->DumpPrintableRepresentation( @@ -181,7 +181,7 @@ bool lldb_private::formatters::LibCxxMapIteratorSyntheticFrontEnd::Update() { }); DataBufferSP buffer_sp(new DataBufferHeap(tree_node_type.GetByteSize(nullptr),0)); ProcessSP process_sp(target_sp->GetProcessSP()); - Error error; + Status error; process_sp->ReadMemory(addr, buffer_sp->GetBytes(), buffer_sp->GetByteSize(), error); if (error.Fail()) return false; diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp index 4ad3df3d603..56d8edaba72 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp @@ -20,7 +20,7 @@ #include "lldb/Target/Target.h" #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/Endian.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/Stream.h" using namespace lldb; @@ -291,7 +291,7 @@ lldb_private::formatters::LibcxxStdListSyntheticFrontEnd::GetChildAtIndex( // we need to copy current_sp into a new object otherwise we will end up with // all items named __value_ DataExtractor data; - Error error; + Status error; current_sp->GetData(data, error); if (error.Fail()) return lldb::ValueObjectSP(); @@ -312,7 +312,7 @@ bool lldb_private::formatters::LibcxxStdListSyntheticFrontEnd::Update() { m_slow_runner.SetEntry(nullptr); m_fast_runner.SetEntry(nullptr); - Error err; + Status err; ValueObjectSP backend_addr(m_backend.AddressOf(err)); m_list_capping_size = 0; if (m_backend.GetTargetSP()) diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp index 293d6407592..b7215dbcbb4 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp @@ -20,7 +20,7 @@ #include "lldb/Target/Target.h" #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/Endian.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/Stream.h" using namespace lldb; @@ -259,7 +259,7 @@ bool lldb_private::formatters::LibcxxStdMapSyntheticFrontEnd::GetDataType() { return true; m_element_type.Clear(); ValueObjectSP deref; - Error error; + Status error; deref = m_root_node->Dereference(error); if (!deref || error.Fail()) return false; @@ -365,7 +365,7 @@ lldb_private::formatters::LibcxxStdMapSyntheticFrontEnd::GetChildAtIndex( } if (GetDataType()) { if (!need_to_skip) { - Error error; + Status error; iterated_sp = iterated_sp->Dereference(error); if (!iterated_sp || error.Fail()) { m_tree = nullptr; @@ -406,7 +406,7 @@ lldb_private::formatters::LibcxxStdMapSyntheticFrontEnd::GetChildAtIndex( // we need to copy current_sp into a new object otherwise we will end up with // all items named __value_ DataExtractor data; - Error error; + Status error; iterated_sp->GetData(data, error); if (error.Fail()) { m_tree = nullptr; diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp index 526bae6900f..190b5f64381 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp @@ -20,7 +20,7 @@ #include "lldb/Target/Target.h" #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/Endian.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/Stream.h" using namespace lldb; @@ -83,7 +83,7 @@ lldb::ValueObjectSP lldb_private::formatters:: if (m_next_element == nullptr) return lldb::ValueObjectSP(); - Error error; + Status error; ValueObjectSP node_sp = m_next_element->Dereference(error); if (!node_sp || error.Fail()) return lldb::ValueObjectSP(); @@ -153,7 +153,7 @@ lldb::ValueObjectSP lldb_private::formatters:: StreamString stream; stream.Printf("[%" PRIu64 "]", (uint64_t)idx); DataExtractor data; - Error error; + Status error; val_hash.first->GetData(data, error); if (error.Fail()) return lldb::ValueObjectSP(); diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp index 96d7e51deba..6f601c9f6cc 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp @@ -209,7 +209,7 @@ lldb_private::formatters::LibcxxVectorBoolSyntheticFrontEnd::GetChildAtIndex( return ValueObjectSP(); uint8_t byte = 0; uint8_t mask = 0; - Error err; + Status err; size_t bytes_read = process_sp->ReadMemory(byte_location, &byte, 1, err); if (err.Fail() || bytes_read == 0) return ValueObjectSP(); diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp index a4633db8157..e3018a1884b 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp @@ -21,7 +21,7 @@ #include "lldb/Target/Target.h" #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/Endian.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/Stream.h" using namespace lldb; @@ -209,7 +209,7 @@ bool VectorIteratorSyntheticFrontEnd::Update() { return false; if (item_ptr->GetValueAsUnsigned(0) == 0) return false; - Error err; + Status err; m_exe_ctx_ref = valobj_sp->GetExecutionContextRef(); m_item_sp = CreateValueObjectFromAddress( "item", item_ptr->GetValueAsUnsigned(0), m_exe_ctx_ref, @@ -251,7 +251,7 @@ bool lldb_private::formatters::LibStdcppStringSummaryProvider( return false; StringPrinter::ReadStringAndDumpToStreamOptions options(valobj); - Error error; + Status error; lldb::addr_t addr_of_data = process_sp->ReadPointerFromMemory(addr_of_string, error); if (error.Fail() || addr_of_data == 0 || @@ -308,7 +308,7 @@ bool lldb_private::formatters::LibStdcppWStringSummaryProvider( nullptr); // Safe to pass NULL for exe_scope here StringPrinter::ReadStringAndDumpToStreamOptions options(valobj); - Error error; + Status error; lldb::addr_t addr_of_data = process_sp->ReadPointerFromMemory(addr_of_string, error); if (error.Fail() || addr_of_data == 0 || @@ -414,7 +414,7 @@ bool lldb_private::formatters::LibStdcppSmartPointerSummaryProvider( return true; } - Error error; + Status error; ValueObjectSP pointee_sp = ptr_sp->Dereference(error); if (pointee_sp && error.Success()) { if (pointee_sp->DumpPrintableRepresentation( diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp index 7693961cae1..b6d664df16e 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp @@ -79,7 +79,7 @@ bool LibStdcppUniquePtrSyntheticFrontEnd::Update() { m_del_obj = del_obj->Clone(ConstString("deleter")); if (m_ptr_obj) { - Error error; + Status error; ValueObjectSP obj_obj = m_ptr_obj->Dereference(error); if (error.Success()) { m_obj_obj = obj_obj->Clone(ConstString("object")); diff --git a/lldb/source/Plugins/Language/Go/GoFormatterFunctions.cpp b/lldb/source/Plugins/Language/Go/GoFormatterFunctions.cpp index 0f78f643321..aac75205c6e 100644 --- a/lldb/source/Plugins/Language/Go/GoFormatterFunctions.cpp +++ b/lldb/source/Plugins/Language/Go/GoFormatterFunctions.cpp @@ -96,7 +96,7 @@ bool lldb_private::formatters::GoStringSummaryProvider( return false; if (valobj.IsPointerType()) { - Error err; + Status err; ValueObjectSP deref = valobj.Dereference(err); if (!err.Success()) return false; diff --git a/lldb/source/Plugins/Language/Java/JavaFormatterFunctions.cpp b/lldb/source/Plugins/Language/Java/JavaFormatterFunctions.cpp index 286651a6440..498795c90be 100644 --- a/lldb/source/Plugins/Language/Java/JavaFormatterFunctions.cpp +++ b/lldb/source/Plugins/Language/Java/JavaFormatterFunctions.cpp @@ -57,7 +57,7 @@ public: valobj->GetAddressOf() + JavaASTContext::CalculateArrayElementOffset(type, idx); - Error error; + Status error; size_t byte_size = element_type.GetByteSize(nullptr); DataBufferSP buffer_sp(new DataBufferHeap(byte_size, 0)); size_t bytes_read = process_sp->ReadMemory(address, buffer_sp->GetBytes(), @@ -86,7 +86,7 @@ private: if (!m_backend.IsPointerOrReferenceType()) return m_backend.GetSP(); - Error error; + Status error; return m_backend.Dereference(error); } }; @@ -96,7 +96,7 @@ private: bool lldb_private::formatters::JavaStringSummaryProvider( ValueObject &valobj, Stream &stream, const TypeSummaryOptions &opts) { if (valobj.IsPointerOrReferenceType()) { - Error error; + Status error; ValueObjectSP deref = valobj.Dereference(error); if (error.Fail()) return false; @@ -145,7 +145,7 @@ bool lldb_private::formatters::JavaStringSummaryProvider( bool lldb_private::formatters::JavaArraySummaryProvider( ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options) { if (valobj.IsPointerOrReferenceType()) { - Error error; + Status error; ValueObjectSP deref = valobj.Dereference(error); if (error.Fail()) return false; diff --git a/lldb/source/Plugins/Language/ObjC/CF.cpp b/lldb/source/Plugins/Language/ObjC/CF.cpp index a75c034afa9..9bb8eeab1d2 100644 --- a/lldb/source/Plugins/Language/ObjC/CF.cpp +++ b/lldb/source/Plugins/Language/ObjC/CF.cpp @@ -20,7 +20,7 @@ #include "lldb/Target/Target.h" #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/Endian.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/Stream.h" using namespace lldb; @@ -88,7 +88,7 @@ bool lldb_private::formatters::CFBagSummaryProvider( if (is_type_ok) { lldb::addr_t offset = 2 * ptr_size + 4 + valobj_addr; - Error error; + Status error; count = process_sp->ReadUnsignedIntegerFromMemory(offset, 4, 0, error); if (error.Fail()) return false; @@ -152,7 +152,7 @@ bool lldb_private::formatters::CFBitVectorSummaryProvider( if (is_type_ok == false) return false; - Error error; + Status error; count = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + 2 * ptr_size, ptr_size, 0, error); if (error.Fail()) @@ -281,7 +281,7 @@ bool lldb_private::formatters::CFBinaryHeapSummaryProvider( if (is_type_ok) { lldb::addr_t offset = 2 * ptr_size + valobj_addr; - Error error; + Status error; count = process_sp->ReadUnsignedIntegerFromMemory(offset, 4, 0, error); if (error.Fail()) return false; diff --git a/lldb/source/Plugins/Language/ObjC/Cocoa.cpp b/lldb/source/Plugins/Language/ObjC/Cocoa.cpp index 0fc690606d1..dd3dc434f75 100644 --- a/lldb/source/Plugins/Language/ObjC/Cocoa.cpp +++ b/lldb/source/Plugins/Language/ObjC/Cocoa.cpp @@ -28,7 +28,7 @@ #include "lldb/Target/Target.h" #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/Endian.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/Stream.h" #include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h" @@ -218,7 +218,7 @@ bool lldb_private::formatters::NSMachPortSummaryProvider( if (!strcmp(class_name, "NSMachPort")) { uint64_t offset = (ptr_size == 4 ? 12 : 20); - Error error; + Status error; port_number = process_sp->ReadUnsignedIntegerFromMemory( offset + valobj_addr, 4, 0, error); if (error.Success()) { @@ -267,7 +267,7 @@ bool lldb_private::formatters::NSIndexSetSummaryProvider( do { if (!strcmp(class_name, "NSIndexSet") || !strcmp(class_name, "NSMutableIndexSet")) { - Error error; + Status error; uint32_t mode = process_sp->ReadUnsignedIntegerFromMemory( valobj_addr + ptr_size, 4, 0, error); if (error.Fail()) @@ -461,7 +461,7 @@ bool lldb_private::formatters::NSNumberSummaryProvider( } return true; } else { - Error error; + Status error; uint8_t data_type = (process_sp->ReadUnsignedIntegerFromMemory( valobj_addr + ptr_size, 1, 0, error) & 0x1F); @@ -653,7 +653,7 @@ bool lldb_private::formatters::NSDateSummaryProvider( process_sp->GetTarget().GetArchitecture().GetTriple()); uint32_t delta = (triple.isWatchOS() && triple.isWatchABI()) ? 8 : ptr_size; - Error error; + Status error; date_value_bits = process_sp->ReadUnsignedIntegerFromMemory( valobj_addr + delta, 8, 0, error); memcpy(&date_value, &date_value_bits, sizeof(date_value_bits)); @@ -661,7 +661,7 @@ bool lldb_private::formatters::NSDateSummaryProvider( return false; } } else if (class_name == g_NSCalendarDate) { - Error error; + Status error; date_value_bits = process_sp->ReadUnsignedIntegerFromMemory( valobj_addr + 2 * ptr_size, 8, 0, error); memcpy(&date_value, &date_value_bits, sizeof(date_value_bits)); @@ -788,14 +788,14 @@ bool lldb_private::formatters::NSDataSummaryProvider( !strcmp(class_name, "NSConcreteMutableData") || !strcmp(class_name, "__NSCFData")) { uint32_t offset = (is_64bit ? 16 : 8); - Error error; + Status error; value = process_sp->ReadUnsignedIntegerFromMemory( valobj_addr + offset, is_64bit ? 8 : 4, 0, error); if (error.Fail()) return false; } else if (!strcmp(class_name, "_NSInlineData")) { uint32_t offset = (is_64bit ? 8 : 4); - Error error; + Status error; value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + offset, 2, 0, error); if (error.Fail()) @@ -818,7 +818,7 @@ bool lldb_private::formatters::ObjCBOOLSummaryProvider( ValueObjectSP real_guy_sp = valobj.GetSP(); if (type_info & eTypeIsPointer) { - Error err; + Status err; real_guy_sp = valobj.Dereference(err); if (err.Fail() || !real_guy_sp) return false; @@ -893,7 +893,7 @@ bool lldb_private::formatters::ObjCSELSummaryProvider( exe_ctx, charstar); } else { DataExtractor data; - Error error; + Status error; valobj.GetData(data, error); if (error.Fail()) return false; diff --git a/lldb/source/Plugins/Language/ObjC/NSArray.cpp b/lldb/source/Plugins/Language/ObjC/NSArray.cpp index 79773fdf1d1..b07b9ba5888 100644 --- a/lldb/source/Plugins/Language/ObjC/NSArray.cpp +++ b/lldb/source/Plugins/Language/ObjC/NSArray.cpp @@ -26,7 +26,7 @@ #include "lldb/Target/Target.h" #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/Endian.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/Stream.h" using namespace lldb; @@ -262,13 +262,13 @@ bool lldb_private::formatters::NSArraySummaryProvider( return false; if (class_name == g_NSArrayI) { - Error error; + Status error; value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + ptr_size, ptr_size, 0, error); if (error.Fail()) return false; } else if (class_name == g_NSArrayM) { - Error error; + Status error; value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + ptr_size, ptr_size, 0, error); if (error.Fail()) @@ -278,7 +278,7 @@ bool lldb_private::formatters::NSArraySummaryProvider( } else if (class_name == g_NSArray1) { value = 1; } else if (class_name == g_NSArrayCF) { - Error error; + Status error; value = process_sp->ReadUnsignedIntegerFromMemory( valobj_addr + 2 * ptr_size, ptr_size, 0, error); if (error.Fail()) @@ -364,7 +364,7 @@ bool lldb_private::formatters::NSArrayMSyntheticFrontEnd_109::Update() { if (!valobj_sp) return false; m_exe_ctx_ref = valobj_sp->GetExecutionContextRef(); - Error error; + Status error; error.Clear(); lldb::ProcessSP process_sp(valobj_sp->GetProcessSP()); if (!process_sp) @@ -395,7 +395,7 @@ bool lldb_private::formatters::NSArrayMSyntheticFrontEnd_1010::Update() { if (!valobj_sp) return false; m_exe_ctx_ref = valobj_sp->GetExecutionContextRef(); - Error error; + Status error; error.Clear(); lldb::ProcessSP process_sp(valobj_sp->GetProcessSP()); if (!process_sp) @@ -538,7 +538,7 @@ bool lldb_private::formatters::NSArrayISyntheticFrontEnd::Update() { if (!valobj_sp) return false; m_exe_ctx_ref = valobj_sp->GetExecutionContextRef(); - Error error; + Status error; error.Clear(); lldb::ProcessSP process_sp(valobj_sp->GetProcessSP()); if (!process_sp) @@ -566,7 +566,7 @@ lldb_private::formatters::NSArrayISyntheticFrontEnd::GetChildAtIndex( ProcessSP process_sp = m_exe_ctx_ref.GetProcessSP(); if (!process_sp) return lldb::ValueObjectSP(); - Error error; + Status error; if (error.Fail()) return lldb::ValueObjectSP(); StreamString idx_name; @@ -665,7 +665,7 @@ lldb_private::formatters::NSArraySyntheticFrontEndCreator( Flags flags(valobj_type.GetTypeInfo()); if (flags.IsClear(eTypeIsPointer)) { - Error error; + Status error; valobj_sp = valobj_sp->AddressOf(error); if (error.Fail() || !valobj_sp) return nullptr; diff --git a/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp b/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp index 672cc1a26f4..6df83d52acc 100644 --- a/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp +++ b/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp @@ -27,7 +27,7 @@ #include "lldb/Target/Target.h" #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/Endian.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/Stream.h" using namespace lldb; @@ -256,14 +256,14 @@ bool lldb_private::formatters::NSDictionarySummaryProvider( return false; if (class_name == g_DictionaryI) { - Error error; + Status error; value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + ptr_size, ptr_size, 0, error); if (error.Fail()) return false; value &= (is_64bit ? ~0xFC00000000000000UL : ~0xFC000000U); } else if (class_name == g_DictionaryM) { - Error error; + Status error; value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + ptr_size, ptr_size, 0, error); if (error.Fail()) @@ -274,7 +274,7 @@ bool lldb_private::formatters::NSDictionarySummaryProvider( } /*else if (!strcmp(class_name,"__NSCFDictionary")) { - Error error; + Status error; value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + (is_64bit ? 20 : 12), 4, 0, error); if (error.Fail()) @@ -321,7 +321,7 @@ lldb_private::formatters::NSDictionarySyntheticFrontEndCreator( Flags flags(valobj_type.GetTypeInfo()); if (flags.IsClear(eTypeIsPointer)) { - Error error; + Status error; valobj_sp = valobj_sp->AddressOf(error); if (error.Fail() || !valobj_sp) return nullptr; @@ -400,7 +400,7 @@ bool lldb_private::formatters::NSDictionaryISyntheticFrontEnd::Update() { if (!valobj_sp) return false; m_exe_ctx_ref = valobj_sp->GetExecutionContextRef(); - Error error; + Status error; error.Clear(); lldb::ProcessSP process_sp(valobj_sp->GetProcessSP()); if (!process_sp) @@ -449,7 +449,7 @@ lldb_private::formatters::NSDictionaryISyntheticFrontEnd::GetChildAtIndex( ProcessSP process_sp = m_exe_ctx_ref.GetProcessSP(); if (!process_sp) return lldb::ValueObjectSP(); - Error error; + Status error; key_at_idx = process_sp->ReadPointerFromMemory(key_at_idx, error); if (error.Fail()) return lldb::ValueObjectSP(); @@ -553,7 +553,7 @@ lldb_private::formatters::NSDictionary1SyntheticFrontEnd::GetChildAtIndex( m_backend.GetValueAsUnsigned(LLDB_INVALID_ADDRESS) + ptr_size; lldb::addr_t value_ptr = key_ptr + ptr_size; - Error error; + Status error; lldb::addr_t value_at_idx = process_sp->ReadPointerFromMemory(key_ptr, error); if (error.Fail()) @@ -625,7 +625,7 @@ bool lldb_private::formatters::NSDictionaryMSyntheticFrontEnd::Update() { if (!valobj_sp) return false; m_exe_ctx_ref = valobj_sp->GetExecutionContextRef(); - Error error; + Status error; error.Clear(); lldb::ProcessSP process_sp(valobj_sp->GetProcessSP()); if (!process_sp) @@ -679,7 +679,7 @@ lldb_private::formatters::NSDictionaryMSyntheticFrontEnd::GetChildAtIndex( ProcessSP process_sp = m_exe_ctx_ref.GetProcessSP(); if (!process_sp) return lldb::ValueObjectSP(); - Error error; + Status error; key_at_idx = process_sp->ReadPointerFromMemory(key_at_idx, error); if (error.Fail()) return lldb::ValueObjectSP(); diff --git a/lldb/source/Plugins/Language/ObjC/NSError.cpp b/lldb/source/Plugins/Language/ObjC/NSError.cpp index e8044d3b001..4365a12b54e 100644 --- a/lldb/source/Plugins/Language/ObjC/NSError.cpp +++ b/lldb/source/Plugins/Language/ObjC/NSError.cpp @@ -24,7 +24,7 @@ #include "lldb/Target/Target.h" #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/Endian.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/Stream.h" #include "Plugins/Language/ObjC/NSString.h" @@ -46,7 +46,7 @@ static lldb::addr_t DerefToNSErrorPointer(ValueObject &valobj) { Flags pointee_flags(pointee_type.GetTypeInfo()); if (pointee_flags.AllSet(eTypeIsPointer)) { if (ProcessSP process_sp = valobj.GetProcessSP()) { - Error error; + Status error; ptr_value = process_sp->ReadPointerFromMemory(ptr_value, error); } } @@ -71,7 +71,7 @@ bool lldb_private::formatters::NSError_SummaryProvider( lldb::addr_t code_location = ptr_value + 2 * ptr_size; lldb::addr_t domain_location = ptr_value + 3 * ptr_size; - Error error; + Status error; uint64_t code = process_sp->ReadUnsignedIntegerFromMemory(code_location, ptr_size, 0, error); if (error.Fail()) @@ -152,7 +152,7 @@ public: size_t ptr_size = process_sp->GetAddressByteSize(); userinfo_location += 4 * ptr_size; - Error error; + Status error; lldb::addr_t userinfo = process_sp->ReadPointerFromMemory(userinfo_location, error); if (userinfo == LLDB_INVALID_ADDRESS || error.Fail()) diff --git a/lldb/source/Plugins/Language/ObjC/NSException.cpp b/lldb/source/Plugins/Language/ObjC/NSException.cpp index aa86e207783..1da4f6de19a 100644 --- a/lldb/source/Plugins/Language/ObjC/NSException.cpp +++ b/lldb/source/Plugins/Language/ObjC/NSException.cpp @@ -24,7 +24,7 @@ #include "lldb/Target/Target.h" #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/Endian.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/Stream.h" #include "Plugins/Language/ObjC/NSString.h" @@ -55,7 +55,7 @@ bool lldb_private::formatters::NSException_SummaryProvider( lldb::addr_t name_location = ptr_value + 1 * ptr_size; lldb::addr_t reason_location = ptr_value + 2 * ptr_size; - Error error; + Status error; lldb::addr_t name = process_sp->ReadPointerFromMemory(name_location, error); if (error.Fail() || name == LLDB_INVALID_ADDRESS) return false; @@ -146,7 +146,7 @@ public: size_t ptr_size = process_sp->GetAddressByteSize(); userinfo_location += 3 * ptr_size; - Error error; + Status error; lldb::addr_t userinfo = process_sp->ReadPointerFromMemory(userinfo_location, error); if (userinfo == LLDB_INVALID_ADDRESS || error.Fail()) diff --git a/lldb/source/Plugins/Language/ObjC/NSSet.cpp b/lldb/source/Plugins/Language/ObjC/NSSet.cpp index adefba902b6..b6f6ff7af19 100644 --- a/lldb/source/Plugins/Language/ObjC/NSSet.cpp +++ b/lldb/source/Plugins/Language/ObjC/NSSet.cpp @@ -22,7 +22,7 @@ #include "lldb/Target/Target.h" #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/Endian.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/Stream.h" using namespace lldb; @@ -185,14 +185,14 @@ bool lldb_private::formatters::NSSetSummaryProvider( return false; if (!strcmp(class_name, "__NSSetI")) { - Error error; + Status error; value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + ptr_size, ptr_size, 0, error); if (error.Fail()) return false; value &= (is_64bit ? ~0xFC00000000000000UL : ~0xFC000000U); } else if (!strcmp(class_name, "__NSSetM")) { - Error error; + Status error; value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + ptr_size, ptr_size, 0, error); if (error.Fail()) @@ -201,7 +201,7 @@ bool lldb_private::formatters::NSSetSummaryProvider( } /*else if (!strcmp(class_name,"__NSCFSet")) { - Error error; + Status error; value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + (is_64bit ? 20 : 12), 4, 0, error); if (error.Fail()) @@ -211,7 +211,7 @@ bool lldb_private::formatters::NSSetSummaryProvider( } else if (!strcmp(class_name,"NSCountedSet")) { - Error error; + Status error; value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + ptr_size, ptr_size, 0, error); if (error.Fail()) @@ -262,7 +262,7 @@ lldb_private::formatters::NSSetSyntheticFrontEndCreator( Flags flags(valobj_type.GetTypeInfo()); if (flags.IsClear(eTypeIsPointer)) { - Error error; + Status error; valobj_sp = valobj_sp->AddressOf(error); if (error.Fail() || !valobj_sp) return nullptr; @@ -338,7 +338,7 @@ bool lldb_private::formatters::NSSetISyntheticFrontEnd::Update() { if (!valobj_sp) return false; m_exe_ctx_ref = valobj_sp->GetExecutionContextRef(); - Error error; + Status error; if (valobj_sp->IsPointerType()) { valobj_sp = valobj_sp->Dereference(error); if (error.Fail() || !valobj_sp) @@ -391,7 +391,7 @@ lldb_private::formatters::NSSetISyntheticFrontEnd::GetChildAtIndex(size_t idx) { obj_at_idx = m_data_ptr + (test_idx * m_ptr_size); if (!process_sp) return lldb::ValueObjectSP(); - Error error; + Status error; obj_at_idx = process_sp->ReadPointerFromMemory(obj_at_idx, error); if (error.Fail()) return lldb::ValueObjectSP(); @@ -487,7 +487,7 @@ bool lldb_private::formatters::NSSetMSyntheticFrontEnd::Update() { if (!valobj_sp) return false; m_exe_ctx_ref = valobj_sp->GetExecutionContextRef(); - Error error; + Status error; if (valobj_sp->IsPointerType()) { valobj_sp = valobj_sp->Dereference(error); if (error.Fail() || !valobj_sp) @@ -542,7 +542,7 @@ lldb_private::formatters::NSSetMSyntheticFrontEnd::GetChildAtIndex(size_t idx) { obj_at_idx = m_objs_addr + (test_idx * m_ptr_size); if (!process_sp) return lldb::ValueObjectSP(); - Error error; + Status error; obj_at_idx = process_sp->ReadPointerFromMemory(obj_at_idx, error); if (error.Fail()) return lldb::ValueObjectSP(); diff --git a/lldb/source/Plugins/Language/ObjC/NSString.cpp b/lldb/source/Plugins/Language/ObjC/NSString.cpp index d0258be8211..3b4edf68e06 100644 --- a/lldb/source/Plugins/Language/ObjC/NSString.cpp +++ b/lldb/source/Plugins/Language/ObjC/NSString.cpp @@ -20,7 +20,7 @@ #include "lldb/Target/Target.h" #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/Endian.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/Stream.h" using namespace lldb; @@ -103,7 +103,7 @@ bool lldb_private::formatters::NSStringSummaryProvider( if (process_sp->GetByteOrder() != lldb::eByteOrderLittle) info_bits_location += 3; - Error error; + Status error; uint8_t info_bits = process_sp->ReadUnsignedIntegerFromMemory( info_bits_location, 1, 0, error); @@ -258,7 +258,7 @@ bool lldb_private::formatters::NSStringSummaryProvider( // in this kind of string, the byte before the string content is a length // byte // so let's try and use it to handle the embedded NUL case - Error error; + Status error; explicit_length = process_sp->ReadUnsignedIntegerFromMemory(location, 1, 0, error); if (error.Fail() || explicit_length == 0) @@ -319,7 +319,7 @@ bool lldb_private::formatters::NSAttributedStringSummaryProvider( if (!child_ptr_sp) return false; DataExtractor data; - Error error; + Status error; child_ptr_sp->GetData(data, error); if (error.Fail()) return false; diff --git a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp index e308747378d..e5a459dfe86 100644 --- a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp +++ b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp @@ -31,8 +31,8 @@ #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" #include "lldb/Utility/ConstString.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" #include <vector> @@ -217,7 +217,7 @@ bool ItaniumABILanguageRuntime::GetDynamicTypeAndAddress( if (process == nullptr) return false; - Error error; + Status error; const lldb::addr_t vtable_address_point = process->ReadPointerFromMemory(original_ptr, error); diff --git a/lldb/source/Plugins/LanguageRuntime/Go/GoLanguageRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/Go/GoLanguageRuntime.cpp index c52fc1e121d..6670f89dde5 100644 --- a/lldb/source/Plugins/LanguageRuntime/Go/GoLanguageRuntime.cpp +++ b/lldb/source/Plugins/LanguageRuntime/Go/GoLanguageRuntime.cpp @@ -27,8 +27,8 @@ #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" #include "lldb/Utility/ConstString.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" #include "llvm/ADT/Twine.h" #include <vector> @@ -42,7 +42,7 @@ ValueObjectSP GetChild(ValueObject &obj, const char *name, ConstString name_const_str(name); ValueObjectSP result = obj.GetChildMemberWithName(name_const_str, true); if (dereference && result && result->IsPointerType()) { - Error err; + Status err; result = result->Dereference(err); if (err.Fail()) result.reset(); @@ -55,7 +55,7 @@ ConstString ReadString(ValueObject &str, Process *process) { ValueObjectSP data = GetChild(str, "str", false); ValueObjectSP len = GetChild(str, "len"); if (len && data) { - Error err; + Status err; lldb::addr_t addr = data->GetPointerValue(); if (addr == LLDB_INVALID_ADDRESS) return result; @@ -97,7 +97,7 @@ CompilerType LookupRuntimeType(ValueObjectSP type, ExecutionContext *exe_ctx, *is_direct = GoASTContext::IsDirectIface(kind); if (GoASTContext::IsPointerKind(kind)) { CompilerType type_ptr = type->GetCompilerType().GetPointerType(); - Error err; + Status err; ValueObjectSP elem = type->CreateValueObjectFromAddress("elem", type->GetAddressOf() + type->GetByteSize(), @@ -138,7 +138,7 @@ bool GoLanguageRuntime::GetDynamicTypeAndAddress( value_type = Value::eValueTypeScalar; class_type_or_name.Clear(); if (CouldHaveDynamicValue(in_value)) { - Error err; + Status err; ValueObjectSP iface = in_value.GetStaticValue(); ValueObjectSP data_sp = GetChild(*iface, "data", false); if (!data_sp) diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp index 6b5e6b1eb76..ecb0b64f234 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp @@ -52,7 +52,7 @@ bool ClassDescriptorV2::objc_class_t::Read(Process *process, + ptr_size; // uintptr_t data_NEVER_USE; DataBufferHeap objc_class_buf(objc_class_size, '\0'); - Error error; + Status error; process->ReadMemory(addr, objc_class_buf.GetBytes(), objc_class_size, error); if (error.Fail()) { @@ -92,7 +92,7 @@ bool ClassDescriptorV2::class_rw_t::Read(Process *process, lldb::addr_t addr) { + ptr_size; // Class nextSiblingClass; DataBufferHeap buffer(size, '\0'); - Error error; + Status error; process->ReadMemory(addr, buffer.GetBytes(), size, error); if (error.Fail()) { @@ -132,7 +132,7 @@ bool ClassDescriptorV2::class_ro_t::Read(Process *process, lldb::addr_t addr) { + ptr_size; // const property_list_t *baseProperties; DataBufferHeap buffer(size, '\0'); - Error error; + Status error; process->ReadMemory(addr, buffer.GetBytes(), size, error); if (error.Fail()) { @@ -180,7 +180,7 @@ bool ClassDescriptorV2::Read_class_row( class_ro.reset(); class_rw.reset(); - Error error; + Status error; uint32_t class_row_t_flags = process->ReadUnsignedIntegerFromMemory( objc_class.m_data_ptr, sizeof(uint32_t), 0, error); if (!error.Success()) @@ -219,7 +219,7 @@ bool ClassDescriptorV2::method_list_t::Read(Process *process, + sizeof(uint32_t); // uint32_t count; DataBufferHeap buffer(size, '\0'); - Error error; + Status error; process->ReadMemory(addr, buffer.GetBytes(), size, error); if (error.Fail()) { @@ -242,7 +242,7 @@ bool ClassDescriptorV2::method_t::Read(Process *process, lldb::addr_t addr) { size_t size = GetSize(process); DataBufferHeap buffer(size, '\0'); - Error error; + Status error; process->ReadMemory(addr, buffer.GetBytes(), size, error); if (error.Fail()) { @@ -276,7 +276,7 @@ bool ClassDescriptorV2::ivar_list_t::Read(Process *process, lldb::addr_t addr) { + sizeof(uint32_t); // uint32_t count; DataBufferHeap buffer(size, '\0'); - Error error; + Status error; process->ReadMemory(addr, buffer.GetBytes(), size, error); if (error.Fail()) { @@ -299,7 +299,7 @@ bool ClassDescriptorV2::ivar_t::Read(Process *process, lldb::addr_t addr) { size_t size = GetSize(process); DataBufferHeap buffer(size, '\0'); - Error error; + Status error; process->ReadMemory(addr, buffer.GetBytes(), size, error); if (error.Fail()) { @@ -527,7 +527,7 @@ void ClassDescriptorV2::iVarsStorage::fill(AppleObjCRuntimeV2 &runtime, "{3}, type_size = {4}", name, type, offset_ptr, size, ivar_type.GetByteSize(nullptr)); Scalar offset_scalar; - Error error; + Status error; const int offset_ptr_size = 4; const bool is_signed = false; size_t read = process->ReadScalarIntegerFromMemory( diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp index 6b27009a072..eacc98a0719 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp @@ -31,8 +31,8 @@ #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" #include "lldb/Utility/ConstString.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/StreamString.h" #include <vector> @@ -145,7 +145,7 @@ bool AppleObjCRuntime::GetObjectDescription(Stream &strm, Value &value, lldb::addr_t wrapper_struct_addr = LLDB_INVALID_ADDRESS; if (!m_print_object_caller_up) { - Error error; + Status error; m_print_object_caller_up.reset( exe_scope->CalculateTarget()->GetFunctionCallerForLanguage( eLanguageTypeObjC, return_compiler_type, *function_address, @@ -185,7 +185,7 @@ bool AppleObjCRuntime::GetObjectDescription(Stream &strm, Value &value, size_t full_buffer_len = sizeof(buf) - 1; size_t curr_len = full_buffer_len; while (curr_len == full_buffer_len) { - Error error; + Status error; curr_len = process->ReadCStringFromMemory(result_ptr + cstr_len, buf, sizeof(buf), error); strm.Write(buf, curr_len); diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp index 2c92b922b9d..566fefaf798 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp @@ -28,8 +28,8 @@ #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" #include "lldb/Utility/ConstString.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/StreamString.h" #include <vector> @@ -172,7 +172,7 @@ UtilityFunction *AppleObjCRuntimeV1::CreateObjectChecker(const char *name) { name); assert(strformatsize < (int)sizeof(buf->contents)); - Error error; + Status error; return GetTargetRef().GetUtilityFunctionForLanguage( buf->contents, eLanguageTypeObjC, name, error); } @@ -196,7 +196,7 @@ void AppleObjCRuntimeV1::ClassDescriptorV1::Initialize( m_valid = true; - Error error; + Status error; m_isa = process_sp->ReadPointerFromMemory(isa, error); @@ -302,7 +302,7 @@ lldb::addr_t AppleObjCRuntimeV1::GetISAHashTablePointer() { symbol->GetAddressRef().GetLoadAddress(&process->GetTarget()); if (objc_debug_class_hash_addr != LLDB_INVALID_ADDRESS) { - Error error; + Status error; lldb::addr_t objc_debug_class_hash_ptr = process->ReadPointerFromMemory(objc_debug_class_hash_addr, error); if (objc_debug_class_hash_ptr != 0 && @@ -348,7 +348,7 @@ void AppleObjCRuntimeV1::UpdateISAToDescriptorMapIfNeeded() { // const void *info; // } NXHashTable; - Error error; + Status error; DataBufferHeap buffer(1024, 0); if (process->ReadMemory(hash_table_ptr, buffer.GetBytes(), 20, error) == 20) { diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp index 42c5fe9248f..7928408083d 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp @@ -51,8 +51,8 @@ #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" #include "lldb/Utility/ConstString.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/Stream.h" #include "lldb/Utility/StreamString.h" @@ -338,7 +338,7 @@ __lldb_apple_objc_v2_get_shared_cache_class_info (void *objc_opt_ro_ptr, static uint64_t ExtractRuntimeGlobalSymbol(Process *process, ConstString name, - const ModuleSP &module_sp, Error &error, + const ModuleSP &module_sp, Status &error, bool read_value = true, uint8_t byte_size = 0, uint64_t default_value = LLDB_INVALID_ADDRESS, SymbolType sym_type = lldb::eSymbolTypeData) { @@ -483,9 +483,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 'v': @@ -676,7 +676,7 @@ protected: const char *arg_str = command.GetArgumentAtIndex(i); if (!arg_str) continue; - Error error; + Status error; lldb::addr_t arg_addr = Args::StringToAddress( &exe_ctx, arg_str, LLDB_INVALID_ADDRESS, &error); if (arg_addr == 0 || arg_addr == LLDB_INVALID_ADDRESS || error.Fail()) @@ -895,7 +895,7 @@ UtilityFunction *AppleObjCRuntimeV2::CreateObjectChecker(const char *name) { assert(len < (int)sizeof(check_function_code)); UNUSED_IF_ASSERT_DISABLED(len); - Error error; + Status error; return GetTargetRef().GetUtilityFunctionForLanguage( check_function_code, eLanguageTypeObjC, name, error); } @@ -927,7 +927,7 @@ size_t AppleObjCRuntimeV2::GetByteOffsetForIvar(CompilerType &parent_ast_type, addr_t ivar_offset_address = LLDB_INVALID_ADDRESS; - Error error; + Status error; SymbolContext ivar_offset_symbol; if (sc_list.GetSize() == 1 && sc_list.GetContextAtIndex(0, ivar_offset_symbol)) { @@ -984,7 +984,7 @@ public: m_map_pair_size = m_process->GetAddressByteSize() * 2; m_invalid_key = m_process->GetAddressByteSize() == 8 ? UINT64_MAX : UINT32_MAX; - Error err; + Status err; // This currently holds true for all platforms we support, but we might // need to change this to use get the actually byte size of "unsigned" @@ -1077,7 +1077,7 @@ public: size_t map_pair_size = m_parent.m_map_pair_size; lldb::addr_t pair_ptr = pairs_ptr + (m_index * map_pair_size); - Error err; + Status err; lldb::addr_t key = m_parent.m_process->ReadPointerFromMemory(pair_ptr, err); @@ -1106,7 +1106,7 @@ public: const lldb::addr_t pairs_ptr = m_parent.m_buckets_ptr; const size_t map_pair_size = m_parent.m_map_pair_size; const lldb::addr_t invalid_key = m_parent.m_invalid_key; - Error err; + Status err; while (m_index--) { lldb::addr_t pair_ptr = pairs_ptr + (m_index * map_pair_size); @@ -1218,7 +1218,7 @@ AppleObjCRuntimeV2::GetClassDescriptor(ValueObject &valobj) { Process *process = exe_ctx.GetProcessPtr(); if (process) { - Error error; + Status error; ObjCISA isa = process->ReadPointerFromMemory(isa_pointer, error); if (isa != LLDB_INVALID_ADDRESS) { objc_class_sp = GetClassDescriptorFromISA(isa); @@ -1255,7 +1255,7 @@ lldb::addr_t AppleObjCRuntimeV2::GetISAHashTablePointer() { symbol->GetLoadAddress(&process->GetTarget()); if (gdb_objc_realized_classes_ptr != LLDB_INVALID_ADDRESS) { - Error error; + Status error; m_isa_hash_table_ptr = process->ReadPointerFromMemory( gdb_objc_realized_classes_ptr, error); } @@ -1295,7 +1295,7 @@ AppleObjCRuntimeV2::UpdateISAToDescriptorMapDynamic( const uint32_t addr_size = process->GetAddressByteSize(); - Error err; + Status err; // Read the total number of classes from the hash table const uint32_t num_classes = hash_table.GetCount(); @@ -1315,7 +1315,7 @@ AppleObjCRuntimeV2::UpdateISAToDescriptorMapDynamic( FunctionCaller *get_class_info_function = nullptr; if (!m_get_class_info_code.get()) { - Error error; + Status error; m_get_class_info_code.reset(GetTargetRef().GetUtilityFunctionForLanguage( g_get_dynamic_class_info_body, eLanguageTypeObjC, g_get_dynamic_class_info_name, error)); @@ -1547,7 +1547,7 @@ AppleObjCRuntimeV2::UpdateISAToDescriptorMapSharedCache() { const uint32_t addr_size = process->GetAddressByteSize(); - Error err; + Status err; uint32_t num_class_infos = 0; @@ -1568,7 +1568,7 @@ AppleObjCRuntimeV2::UpdateISAToDescriptorMapSharedCache() { FunctionCaller *get_shared_cache_class_info_function = nullptr; if (!m_get_shared_cache_class_info_code.get()) { - Error error; + Status error; m_get_shared_cache_class_info_code.reset( GetTargetRef().GetUtilityFunctionForLanguage( g_get_shared_cache_class_info_body, eLanguageTypeObjC, @@ -2019,7 +2019,7 @@ AppleObjCRuntimeV2::NonPointerISACache::CreateInstance( AppleObjCRuntimeV2 &runtime, const lldb::ModuleSP &objc_module_sp) { Process *process(runtime.GetProcess()); - Error error; + Status error; auto objc_debug_isa_magic_mask = ExtractRuntimeGlobalSymbol( process, ConstString("objc_debug_isa_magic_mask"), objc_module_sp, error); @@ -2050,7 +2050,7 @@ AppleObjCRuntimeV2::TaggedPointerVendorV2::CreateInstance( AppleObjCRuntimeV2 &runtime, const lldb::ModuleSP &objc_module_sp) { Process *process(runtime.GetProcess()); - Error error; + Status error; auto objc_debug_taggedpointer_mask = ExtractRuntimeGlobalSymbol( process, ConstString("objc_debug_taggedpointer_mask"), objc_module_sp, @@ -2262,7 +2262,7 @@ AppleObjCRuntimeV2::TaggedPointerVendorRuntimeAssisted::GetClassDescriptor( Process *process(m_runtime.GetProcess()); uintptr_t slot_ptr = slot * process->GetAddressByteSize() + m_objc_debug_taggedpointer_classes; - Error error; + Status error; uintptr_t slot_data = process->ReadPointerFromMemory(slot_ptr, error); if (error.Fail() || slot_data == 0 || slot_data == uintptr_t(LLDB_INVALID_ADDRESS)) @@ -2349,7 +2349,7 @@ AppleObjCRuntimeV2::TaggedPointerVendorExtended::GetClassDescriptor( Process *process(m_runtime.GetProcess()); uintptr_t slot_ptr = slot * process->GetAddressByteSize() + m_objc_debug_taggedpointer_ext_classes; - Error error; + Status error; uintptr_t slot_data = process->ReadPointerFromMemory(slot_ptr, error); if (error.Fail() || slot_data == 0 || slot_data == uintptr_t(LLDB_INVALID_ADDRESS)) diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp index 8ce65b07684..a6e9c0c16f1 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp @@ -299,7 +299,7 @@ void AppleObjCTrampolineHandler::AppleObjCVTables::VTableRegion::SetUpRegion() { process_sp->GetByteOrder(), process_sp->GetAddressByteSize()); size_t actual_size = 8 + process_sp->GetAddressByteSize(); - Error error; + Status error; size_t bytes_read = process_sp->ReadMemory(m_header_addr, memory_buffer, actual_size, error); if (bytes_read != actual_size) { @@ -534,7 +534,7 @@ bool AppleObjCTrampolineHandler::AppleObjCVTables::RefreshTrampolines( return false; // Now get a pointer value from the zeroth argument. - Error error; + Status error; DataExtractor data; error = argument_values.GetValueAtIndex(0)->GetValueAsData(&exe_ctx, data, 0, NULL); @@ -555,7 +555,7 @@ bool AppleObjCTrampolineHandler::AppleObjCVTables::ReadRegions() { m_regions.clear(); if (!InitializeVTableSymbols()) return false; - Error error; + Status error; ProcessSP process_sp = GetProcessSP(); if (process_sp) { lldb::addr_t region_addr = @@ -770,7 +770,7 @@ AppleObjCTrampolineHandler::SetupDispatchFunction(Thread &thread, if (!m_impl_code.get()) { if (m_lookup_implementation_function_code != NULL) { - Error error; + Status error; m_impl_code.reset(exe_ctx.GetTargetRef().GetUtilityFunctionForLanguage( m_lookup_implementation_function_code, eLanguageTypeObjC, g_lookup_implementation_function_name, error)); @@ -802,7 +802,7 @@ AppleObjCTrampolineHandler::SetupDispatchFunction(Thread &thread, thread.GetProcess()->GetTarget().GetScratchClangASTContext(); CompilerType clang_void_ptr_type = clang_ast_context->GetBasicType(eBasicTypeVoid).GetPointerType(); - Error error; + Status error; impl_function_caller = m_impl_code->MakeFunctionCaller( clang_void_ptr_type, dispatch_values, thread_sp, error); diff --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp index 7a9e66cf548..7e46afcccda 100644 --- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp +++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp @@ -42,9 +42,9 @@ #include "lldb/Target/Thread.h" #include "lldb/Utility/ConstString.h" #include "lldb/Utility/DataBufferLLVM.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/Log.h" #include "lldb/Utility/RegularExpression.h" +#include "lldb/Utility/Status.h" using namespace lldb; using namespace lldb_private; @@ -123,7 +123,7 @@ struct GetArgsCtx { bool GetArgsX86(const GetArgsCtx &ctx, ArgItem *arg_list, size_t num_args) { Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE); - Error err; + Status err; // get the current stack pointer uint64_t sp = ctx.reg_ctx->GetSP(); @@ -136,7 +136,7 @@ bool GetArgsX86(const GetArgsCtx &ctx, ArgItem *arg_list, size_t num_args) { size_t arg_size = sizeof(uint32_t); // read the argument from memory arg.value = 0; - Error err; + Status err; size_t read = ctx.process->ReadMemory(sp, &arg.value, sizeof(uint32_t), err); if (read != arg_size || !err.Success()) { @@ -166,7 +166,7 @@ bool GetArgsX86_64(GetArgsCtx &ctx, ArgItem *arg_list, size_t num_args) { 4, // eBool, }}; - Error err; + Status err; // get the current stack pointer uint64_t sp = ctx.reg_ctx->GetSP(); @@ -230,7 +230,7 @@ bool GetArgsArm(GetArgsCtx &ctx, ArgItem *arg_list, size_t num_args) { Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE); - Error err; + Status err; // get the current stack pointer uint64_t sp = ctx.reg_ctx->GetSP(); @@ -310,7 +310,7 @@ bool GetArgsMipsel(GetArgsCtx &ctx, ArgItem *arg_list, size_t num_args) { Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE); - Error err; + Status err; // find offset to arguments on the stack (+16 to skip over a0-a3 shadow space) uint64_t sp = ctx.reg_ctx->GetSP() + 16; @@ -355,7 +355,7 @@ bool GetArgsMips64el(GetArgsCtx &ctx, ArgItem *arg_list, size_t num_args) { Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE); - Error err; + Status err; // get the current stack pointer uint64_t sp = ctx.reg_ctx->GetSP(); @@ -1189,7 +1189,7 @@ void RenderScriptRuntime::CaptureDebugHintScriptGroup2( // parse script group name ConstString group_name; { - Error err; + Status err; const uint64_t len = uint64_t(args[eGroupNameSize]); std::unique_ptr<char[]> buffer(new char[uint32_t(len + 1)]); m_process->ReadMemory(addr_t(args[eGroupName]), buffer.get(), len, err); @@ -1238,7 +1238,7 @@ void RenderScriptRuntime::CaptureDebugHintScriptGroup2( // extract script group kernel addresses from the target const addr_t ptr_addr = addr_t(args[eKernel]) + i * target_ptr_size; uint64_t kernel_addr = 0; - Error err; + Status err; size_t read = m_process->ReadMemory(ptr_addr, &kernel_addr, target_ptr_size, err); if (!err.Success() || read != target_ptr_size) { @@ -1337,7 +1337,7 @@ void RenderScriptRuntime::CaptureScriptInvokeForEachMulti( } const uint32_t target_ptr_size = m_process->GetAddressByteSize(); - Error err; + Status err; std::vector<uint64_t> allocs; // traverse allocation list @@ -1524,7 +1524,7 @@ void RenderScriptRuntime::CaptureScriptInit(RuntimeHook *hook, ExecutionContext &exe_ctx) { Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); - Error err; + Status err; Process *process = exe_ctx.GetProcessPtr(); enum { eRsContext, eRsScript, eRsResNamePtr, eRsCachedDirPtr }; @@ -1756,7 +1756,7 @@ bool RenderScriptRuntime::EvalRSExpression(const char *expr, // The result of the expression is invalid if (!expr_result->GetError().Success()) { - Error err = expr_result->GetError(); + Status err = expr_result->GetError(); // Expression returned is void, so this is actually a success if (err.GetError() == UserExpression::kNoResult) { if (log) @@ -2140,7 +2140,7 @@ bool RenderScriptRuntime::JITSubelements(Element &elem, case 1: // Name of child { lldb::addr_t address = static_cast<addr_t>(results); - Error err; + Status err; std::string name; GetProcess()->ReadCStringFromMemory(address, name, err); if (!err.Fail()) @@ -2386,7 +2386,7 @@ void RenderScriptRuntime::FindStructTypeName(Element &elem, if (found) { // Dereference since our Element type isn't a pointer. if (valobj_sp->IsPointerType()) { - Error err; + Status err; ValueObjectSP deref_valobj = valobj_sp->Dereference(err); if (!err.Fail()) valobj_sp = deref_valobj; @@ -2482,7 +2482,7 @@ RenderScriptRuntime::GetAllocationData(AllocationDetails *alloc, } // Read the inferior memory - Error err; + Status err; lldb::addr_t data_ptr = *alloc->data_ptr.get(); GetProcess()->ReadMemory(data_ptr, buffer.get(), size, err); if (err.Fail()) { @@ -2643,7 +2643,7 @@ bool RenderScriptRuntime::LoadAllocation(Stream &strm, const uint32_t alloc_id, // Copy file data from our buffer into the target allocation. lldb::addr_t alloc_data = *alloc->data_ptr.get(); - Error err; + Status err; size_t written = GetProcess()->WriteMemory(alloc_data, file_buf, size, err); if (!err.Success() || written != size) { strm.Printf("Error: Couldn't write data to allocation %s", err.AsCString()); @@ -2795,7 +2795,7 @@ bool RenderScriptRuntime::SaveAllocation(Stream &strm, const uint32_t alloc_id, log->Printf("%s - writing File Header, 0x%" PRIx64 " bytes", __FUNCTION__, (uint64_t)num_bytes); - Error err = file.Write(&head, num_bytes); + Status err = file.Write(&head, num_bytes); if (!err.Success()) { strm.Printf("Error: '%s' when writing to file '%s'", err.AsCString(), path); strm.EOL(); @@ -2900,7 +2900,7 @@ bool RenderScriptRuntime::LoadModule(const lldb::ModuleSP &module_sp) { const Symbol *debug_present = m_libRS->FindFirstSymbolWithNameAndType( gDbgPresentStr, eSymbolTypeData); if (debug_present) { - Error err; + Status err; uint32_t flag = 0x00000001U; Target &target = GetProcess()->GetTarget(); addr_t addr = debug_present->GetLoadAddress(&target); @@ -3179,7 +3179,7 @@ bool RSModuleDescriptor::ParseRSInfo() { return info_lines.size() > 0; } -void RenderScriptRuntime::Status(Stream &strm) const { +void RenderScriptRuntime::DumpStatus(Stream &strm) const { if (m_libRS) { strm.Printf("Runtime Library discovered."); strm.EOL(); @@ -3620,7 +3620,7 @@ RenderScriptRuntime::CreateKernelBreakpoint(const ConstString &name) { // Give RS breakpoints a specific name, so the user can manipulate them as a // group. - Error err; + Status err; if (!bp->AddName("RenderScriptKernel", err)) if (log) log->Printf("%s - error setting break name, '%s'.", __FUNCTION__, @@ -3648,7 +3648,7 @@ RenderScriptRuntime::CreateReductionBreakpoint(const ConstString &name, // Give RS breakpoints a specific name, so the user can manipulate them as a // group. - Error err; + Status err; if (!bp->AddName("RenderScriptReduction", err)) if (log) log->Printf("%s - error setting break name, '%s'.", __FUNCTION__, @@ -3664,7 +3664,7 @@ bool RenderScriptRuntime::GetFrameVarAsUnsigned(const StackFrameSP frame_sp, const char *var_name, uint64_t &val) { Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_LANGUAGE)); - Error err; + Status err; VariableSP var_sp; // Find variable in stack frame @@ -3889,7 +3889,7 @@ RenderScriptRuntime::CreateScriptGroupBreakpoint(const ConstString &name, m_filtersp, resolver_sp, false, false, false); // Give RS breakpoints a specific name, so the user can manipulate them as a // group. - Error err; + Status err; if (!bp->AddName(name.AsCString(), err)) if (log) log->Printf("%s - error setting break name, '%s'.", __FUNCTION__, @@ -4213,9 +4213,9 @@ public: ~CommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *exe_ctx) override { - Error err; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *exe_ctx) override { + Status err; StreamString err_str; const int short_option = m_getopt_table[option_idx].val; switch (short_option) { @@ -4369,9 +4369,9 @@ public: ~CommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *exe_ctx) override { - Error err; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *exe_ctx) override { + Status err; const int short_option = m_getopt_table[option_idx].val; switch (short_option) { @@ -4650,9 +4650,9 @@ public: ~CommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *exe_ctx) override { - Error err; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *exe_ctx) override { + Status err; const int short_option = m_getopt_table[option_idx].val; switch (short_option) { @@ -4772,9 +4772,9 @@ public: ~CommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *exe_ctx) override { - Error err; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *exe_ctx) override { + Status err; const int short_option = m_getopt_table[option_idx].val; switch (short_option) { @@ -4993,7 +4993,7 @@ public: RenderScriptRuntime *runtime = (RenderScriptRuntime *)m_exe_ctx.GetProcessPtr()->GetLanguageRuntime( eLanguageTypeExtRenderScript); - runtime->Status(result.GetOutputStream()); + runtime->DumpStatus(result.GetOutputStream()); result.SetStatus(eReturnStatusSuccessFinishResult); return true; } diff --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h index 5b2bb57ac8c..0fe9134ce9e 100644 --- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h +++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h @@ -374,7 +374,7 @@ public: void SetBreakAllKernels(bool do_break, lldb::TargetSP target); - void Status(Stream &strm) const; + void DumpStatus(Stream &strm) const; void ModulesDidLoad(const ModuleList &module_list) override; diff --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptScriptGroup.cpp b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptScriptGroup.cpp index 9ca8fb4444c..fe4ae21a0c3 100644 --- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptScriptGroup.cpp +++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptScriptGroup.cpp @@ -21,8 +21,8 @@ #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" #include "lldb/Utility/ConstString.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" #include "RenderScriptRuntime.h" #include "RenderScriptScriptGroup.h" diff --git a/lldb/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp b/lldb/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp index 35247edfbd5..b9e49d1faa1 100644 --- a/lldb/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp +++ b/lldb/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp @@ -170,7 +170,7 @@ HistoryThreads MemoryHistoryASan::GetHistoryThreads(lldb::addr_t address) { ExecutionContext exe_ctx(frame_sp); ValueObjectSP return_value_sp; StreamString expr; - Error eval_error; + Status eval_error; expr.Printf(memory_history_asan_command_format, address, address); EvaluateExpressionOptions options; diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp index 0720cca2734..13dde5bbd71 100644 --- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -25,8 +25,8 @@ #include "lldb/Target/SectionLoadList.h" #include "lldb/Target/Target.h" #include "lldb/Utility/DataBufferLLVM.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/Stream.h" #include "llvm/ADT/PointerUnion.h" @@ -1079,7 +1079,7 @@ Address ObjectFileELF::GetImageInfoAddress(Target *target) { if (dyn_base == LLDB_INVALID_ADDRESS) return Address(); - Error error; + Status error; if (symbol.d_tag == DT_MIPS_RLD_MAP) { // DT_MIPS_RLD_MAP tag stores an absolute address of the debug pointer. Address addr; @@ -1232,12 +1232,12 @@ size_t ObjectFileELF::ParseProgramHeaders() { m_header); } -lldb_private::Error +lldb_private::Status ObjectFileELF::RefineModuleDetailsFromNote(lldb_private::DataExtractor &data, lldb_private::ArchSpec &arch_spec, lldb_private::UUID &uuid) { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_MODULES)); - Error error; + Status error; lldb::offset_t offset = 0; @@ -1763,7 +1763,7 @@ size_t ObjectFileELF::GetSectionHeaderInfo(SectionHeaderColl §ion_headers, DataExtractor data; if (section_size && (set_data(data, sheader.sh_offset, section_size) == section_size)) { - Error error = RefineModuleDetailsFromNote(data, arch_spec, uuid); + Status error = RefineModuleDetailsFromNote(data, arch_spec, uuid); if (error.Fail()) { if (log) log->Printf("ObjectFileELF::%s ELF note processing failed: %s", diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h index 9b2d58b7be8..06f1a4d22d2 100644 --- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h +++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h @@ -375,7 +375,7 @@ private: unsigned PLTRelocationType(); - static lldb_private::Error + static lldb_private::Status RefineModuleDetailsFromNote(lldb_private::DataExtractor &data, lldb_private::ArchSpec &arch_spec, lldb_private::UUID &uuid); diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp index 84ecfdc67be..f5952d02397 100644 --- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp +++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp @@ -40,9 +40,9 @@ #include "lldb/Target/Thread.h" #include "lldb/Target/ThreadList.h" #include "lldb/Utility/DataBufferLLVM.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/StreamString.h" #include "lldb/Utility/UUID.h" @@ -3850,7 +3850,7 @@ size_t ObjectFileMachO::ParseSymtab() { symbol_name = NULL; } else { const addr_t str_addr = strtab_addr + nlist.n_strx; - Error str_error; + Status str_error; if (process->ReadCStringFromMemory(str_addr, memory_symbol_name, str_error)) symbol_name = memory_symbol_name.c_str(); @@ -5968,7 +5968,7 @@ bool ObjectFileMachO::SetLoadAddress(Target &target, lldb::addr_t value, } bool ObjectFileMachO::SaveCore(const lldb::ProcessSP &process_sp, - const FileSpec &outfile, Error &error) { + const FileSpec &outfile, Status &error) { if (process_sp) { Target &target = process_sp->GetTarget(); const ArchSpec target_arch = target.GetArchitecture(); @@ -5997,7 +5997,7 @@ bool ObjectFileMachO::SaveCore(const lldb::ProcessSP &process_sp, std::vector<segment_command_64> segment_load_commands; // uint32_t range_info_idx = 0; MemoryRegionInfo range_info; - Error range_error = process_sp->GetMemoryRegionInfo(0, range_info); + Status range_error = process_sp->GetMemoryRegionInfo(0, range_info); const uint32_t addr_byte_size = target_arch.GetAddressByteSize(); const ByteOrder byte_order = target_arch.GetByteOrder(); if (range_error.Success()) { @@ -6231,7 +6231,7 @@ bool ObjectFileMachO::SaveCore(const lldb::ProcessSP &process_sp, segment.vmsize, segment.vmaddr); addr_t bytes_left = segment.vmsize; addr_t addr = segment.vmaddr; - Error memory_read_error; + Status memory_read_error; while (bytes_left > 0 && error.Success()) { const size_t bytes_to_read = bytes_left > sizeof(bytes) ? sizeof(bytes) : bytes_left; diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h index 96379a4db41..9a42f41a4c9 100644 --- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h +++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h @@ -67,7 +67,7 @@ public: static bool SaveCore(const lldb::ProcessSP &process_sp, const lldb_private::FileSpec &outfile, - lldb_private::Error &error); + lldb_private::Status &error); static bool MagicBytesMatch(lldb::DataBufferSP &data_sp, lldb::addr_t offset, lldb::addr_t length); diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp index c89383a7b7b..dcb9527f24c 100644 --- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp +++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp @@ -145,7 +145,7 @@ size_t ObjectFilePECOFF::GetModuleSpecifications( bool ObjectFilePECOFF::SaveCore(const lldb::ProcessSP &process_sp, const lldb_private::FileSpec &outfile, - lldb_private::Error &error) { + lldb_private::Status &error) { return SaveMiniDump(process_sp, outfile, error); } @@ -440,7 +440,7 @@ DataExtractor ObjectFilePECOFF::ReadImageData(uint32_t offset, size_t size) { DataExtractor data; if (process_sp) { auto data_ap = llvm::make_unique<DataBufferHeap>(size, 0); - Error readmem_error; + Status readmem_error; size_t bytes_read = process_sp->ReadMemory(m_image_base + offset, data_ap->GetBytes(), data_ap->GetByteSize(), readmem_error); diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h index 2313047735e..d8a94e19d34 100644 --- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h +++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h @@ -85,7 +85,7 @@ public: static bool SaveCore(const lldb::ProcessSP &process_sp, const lldb_private::FileSpec &outfile, - lldb_private::Error &error); + lldb_private::Status &error); static bool MagicBytesMatch(lldb::DataBufferSP &data_sp); diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.cpp b/lldb/source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.cpp index 094e258a7a0..d6553f6e514 100644 --- a/lldb/source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.cpp +++ b/lldb/source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.cpp @@ -23,7 +23,7 @@ namespace lldb_private { bool SaveMiniDump(const lldb::ProcessSP &process_sp, const lldb_private::FileSpec &outfile, - lldb_private::Error &error) { + lldb_private::Status &error) { if (!process_sp) return false; #ifdef _WIN32 diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.h b/lldb/source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.h index 3f741dc04f5..135d5338738 100644 --- a/lldb/source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.h +++ b/lldb/source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.h @@ -16,7 +16,7 @@ namespace lldb_private { bool SaveMiniDump(const lldb::ProcessSP &process_sp, const lldb_private::FileSpec &outfile, - lldb_private::Error &error); + lldb_private::Status &error); } // namespace lldb_private diff --git a/lldb/source/Plugins/OperatingSystem/Go/OperatingSystemGo.cpp b/lldb/source/Plugins/OperatingSystem/Go/OperatingSystemGo.cpp index 1a0c3272986..709466cb103 100644 --- a/lldb/source/Plugins/OperatingSystem/Go/OperatingSystemGo.cpp +++ b/lldb/source/Plugins/OperatingSystem/Go/OperatingSystemGo.cpp @@ -315,7 +315,7 @@ bool OperatingSystemGo::UpdateThreadList(ThreadList &old_thread_list, // the // lldb_private::Process subclass, no memory threads will be in this list. - Error err; + Status err; for (uint64_t i = 0; i < allglen; ++i) { goroutines.push_back(CreateGoroutineAtIndex(i, err)); if (err.Fail()) { @@ -448,7 +448,7 @@ TypeSP OperatingSystemGo::FindType(TargetSP target_sp, const char *name) { } OperatingSystemGo::Goroutine -OperatingSystemGo::CreateGoroutineAtIndex(uint64_t idx, Error &err) { +OperatingSystemGo::CreateGoroutineAtIndex(uint64_t idx, Status &err) { err.Clear(); Goroutine result = {}; ValueObjectSP g = diff --git a/lldb/source/Plugins/OperatingSystem/Go/OperatingSystemGo.h b/lldb/source/Plugins/OperatingSystem/Go/OperatingSystemGo.h index d289985c72a..5d255a348a6 100644 --- a/lldb/source/Plugins/OperatingSystem/Go/OperatingSystemGo.h +++ b/lldb/source/Plugins/OperatingSystem/Go/OperatingSystemGo.h @@ -80,7 +80,7 @@ private: bool Init(lldb_private::ThreadList &threads); - Goroutine CreateGoroutineAtIndex(uint64_t idx, lldb_private::Error &err); + Goroutine CreateGoroutineAtIndex(uint64_t idx, lldb_private::Status &err); std::unique_ptr<DynamicRegisterInfo> m_reginfo; lldb::ValueObjectSP m_allg_sp; diff --git a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp index dbbb55e474f..0556318cc04 100644 --- a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp +++ b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp @@ -94,7 +94,7 @@ OperatingSystemPython::OperatingSystemPython(lldb_private::Process *process, char python_module_path_cstr[PATH_MAX]; python_module_path.GetPath(python_module_path_cstr, sizeof(python_module_path_cstr)); - Error error; + Status error; if (m_interpreter->LoadScriptingModule( python_module_path_cstr, allow_reload, init_session, error)) { // Strip the ".py" extension if there is one diff --git a/lldb/source/Plugins/Platform/Android/AdbClient.cpp b/lldb/source/Plugins/Platform/Android/AdbClient.cpp index 2060bd1de73..b64afc81057 100644 --- a/lldb/source/Plugins/Platform/Android/AdbClient.cpp +++ b/lldb/source/Plugins/Platform/Android/AdbClient.cpp @@ -65,9 +65,9 @@ const uint32_t kDefaultMode = 0100770; // S_IFREG | S_IRWXU | S_IRWXG const char *kSocketNamespaceAbstract = "localabstract"; const char *kSocketNamespaceFileSystem = "localfilesystem"; -Error ReadAllBytes(Connection &conn, void *buffer, size_t size) { +Status ReadAllBytes(Connection &conn, void *buffer, size_t size) { - Error error; + Status error; ConnectionStatus status; char *read_buffer = static_cast<char *>(buffer); @@ -86,7 +86,7 @@ Error ReadAllBytes(Connection &conn, void *buffer, size_t size) { now = steady_clock::now(); } if (total_read_bytes < size) - error = Error( + error = Status( "Unable to read requested number of bytes. Connection status: %d.", status); return error; @@ -94,8 +94,8 @@ Error ReadAllBytes(Connection &conn, void *buffer, size_t size) { } // namespace -Error AdbClient::CreateByDeviceID(const std::string &device_id, - AdbClient &adb) { +Status AdbClient::CreateByDeviceID(const std::string &device_id, + AdbClient &adb) { DeviceIDList connect_devices; auto error = adb.GetDevices(connect_devices); if (error.Fail()) @@ -109,15 +109,15 @@ Error AdbClient::CreateByDeviceID(const std::string &device_id, if (android_serial.empty()) { if (connect_devices.size() != 1) - return Error("Expected a single connected device, got instead %zu - try " - "setting 'ANDROID_SERIAL'", - connect_devices.size()); + return Status("Expected a single connected device, got instead %zu - try " + "setting 'ANDROID_SERIAL'", + connect_devices.size()); adb.SetDeviceID(connect_devices.front()); } else { auto find_it = std::find(connect_devices.begin(), connect_devices.end(), android_serial); if (find_it == connect_devices.end()) - return Error("Device \"%s\" not found", android_serial.c_str()); + return Status("Device \"%s\" not found", android_serial.c_str()); adb.SetDeviceID(*find_it); } @@ -136,15 +136,15 @@ void AdbClient::SetDeviceID(const std::string &device_id) { const std::string &AdbClient::GetDeviceID() const { return m_device_id; } -Error AdbClient::Connect() { - Error error; +Status AdbClient::Connect() { + Status error; m_conn.reset(new ConnectionFileDescriptor); m_conn->Connect("connect://localhost:5037", &error); return error; } -Error AdbClient::GetDevices(DeviceIDList &device_list) { +Status AdbClient::GetDevices(DeviceIDList &device_list) { device_list.clear(); auto error = SendMessage("host:devices"); @@ -171,8 +171,8 @@ Error AdbClient::GetDevices(DeviceIDList &device_list) { return error; } -Error AdbClient::SetPortForwarding(const uint16_t local_port, - const uint16_t remote_port) { +Status AdbClient::SetPortForwarding(const uint16_t local_port, + const uint16_t remote_port) { char message[48]; snprintf(message, sizeof(message), "forward:tcp:%d;tcp:%d", local_port, remote_port); @@ -184,9 +184,10 @@ Error AdbClient::SetPortForwarding(const uint16_t local_port, return ReadResponseStatus(); } -Error AdbClient::SetPortForwarding(const uint16_t local_port, - llvm::StringRef remote_socket_name, - const UnixSocketNamespace socket_namespace) { +Status +AdbClient::SetPortForwarding(const uint16_t local_port, + llvm::StringRef remote_socket_name, + const UnixSocketNamespace socket_namespace) { char message[PATH_MAX]; const char *sock_namespace_str = (socket_namespace == UnixSocketNamespaceAbstract) @@ -202,7 +203,7 @@ Error AdbClient::SetPortForwarding(const uint16_t local_port, return ReadResponseStatus(); } -Error AdbClient::DeletePortForwarding(const uint16_t local_port) { +Status AdbClient::DeletePortForwarding(const uint16_t local_port) { char message[32]; snprintf(message, sizeof(message), "killforward:tcp:%d", local_port); @@ -213,8 +214,8 @@ Error AdbClient::DeletePortForwarding(const uint16_t local_port) { return ReadResponseStatus(); } -Error AdbClient::SendMessage(const std::string &packet, const bool reconnect) { - Error error; +Status AdbClient::SendMessage(const std::string &packet, const bool reconnect) { + Status error; if (!m_conn || reconnect) { error = Connect(); if (error.Fail()) @@ -235,13 +236,13 @@ Error AdbClient::SendMessage(const std::string &packet, const bool reconnect) { return error; } -Error AdbClient::SendDeviceMessage(const std::string &packet) { +Status AdbClient::SendDeviceMessage(const std::string &packet) { std::ostringstream msg; msg << "host-serial:" << m_device_id << ":" << packet; return SendMessage(msg.str()); } -Error AdbClient::ReadMessage(std::vector<char> &message) { +Status AdbClient::ReadMessage(std::vector<char> &message) { message.clear(); char buffer[5]; @@ -262,19 +263,19 @@ Error AdbClient::ReadMessage(std::vector<char> &message) { return error; } -Error AdbClient::ReadMessageStream(std::vector<char> &message, - milliseconds timeout) { +Status AdbClient::ReadMessageStream(std::vector<char> &message, + milliseconds timeout) { auto start = steady_clock::now(); message.clear(); - Error error; + Status error; lldb::ConnectionStatus status = lldb::eConnectionStatusSuccess; char buffer[1024]; while (error.Success() && status == lldb::eConnectionStatusSuccess) { auto end = steady_clock::now(); auto elapsed = end - start; if (elapsed >= timeout) - return Error("Timed out"); + return Status("Timed out"); size_t n = m_conn->Read(buffer, sizeof(buffer), duration_cast<microseconds>(timeout - elapsed), @@ -285,7 +286,7 @@ Error AdbClient::ReadMessageStream(std::vector<char> &message, return error; } -Error AdbClient::ReadResponseStatus() { +Status AdbClient::ReadResponseStatus() { char response_id[5]; static const size_t packet_len = 4; @@ -301,9 +302,9 @@ Error AdbClient::ReadResponseStatus() { return error; } -Error AdbClient::GetResponseError(const char *response_id) { +Status AdbClient::GetResponseError(const char *response_id) { if (strcmp(response_id, kFAIL) != 0) - return Error("Got unexpected response id from adb: \"%s\"", response_id); + return Status("Got unexpected response id from adb: \"%s\"", response_id); std::vector<char> error_message; auto error = ReadMessage(error_message); @@ -314,7 +315,7 @@ Error AdbClient::GetResponseError(const char *response_id) { return error; } -Error AdbClient::SwitchDeviceTransport() { +Status AdbClient::SwitchDeviceTransport() { std::ostringstream msg; msg << "host:transport:" << m_device_id; @@ -325,19 +326,20 @@ Error AdbClient::SwitchDeviceTransport() { return ReadResponseStatus(); } -Error AdbClient::StartSync() { +Status AdbClient::StartSync() { auto error = SwitchDeviceTransport(); if (error.Fail()) - return Error("Failed to switch to device transport: %s", error.AsCString()); + return Status("Failed to switch to device transport: %s", + error.AsCString()); error = Sync(); if (error.Fail()) - return Error("Sync failed: %s", error.AsCString()); + return Status("Sync failed: %s", error.AsCString()); return error; } -Error AdbClient::Sync() { +Status AdbClient::Sync() { auto error = SendMessage("sync:", false); if (error.Fail()) return error; @@ -345,17 +347,18 @@ Error AdbClient::Sync() { return ReadResponseStatus(); } -Error AdbClient::ReadAllBytes(void *buffer, size_t size) { +Status AdbClient::ReadAllBytes(void *buffer, size_t size) { return ::ReadAllBytes(*m_conn, buffer, size); } -Error AdbClient::internalShell(const char *command, milliseconds timeout, - std::vector<char> &output_buf) { +Status AdbClient::internalShell(const char *command, milliseconds timeout, + std::vector<char> &output_buf) { output_buf.clear(); auto error = SwitchDeviceTransport(); if (error.Fail()) - return Error("Failed to switch to device transport: %s", error.AsCString()); + return Status("Failed to switch to device transport: %s", + error.AsCString()); StreamString adb_command; adb_command.Printf("shell:%s", command); @@ -376,15 +379,15 @@ Error AdbClient::internalShell(const char *command, milliseconds timeout, static const char *kShellPrefix = "/system/bin/sh:"; if (output_buf.size() > strlen(kShellPrefix)) { if (!memcmp(&output_buf[0], kShellPrefix, strlen(kShellPrefix))) - return Error("Shell command %s failed: %s", command, - std::string(output_buf.begin(), output_buf.end()).c_str()); + return Status("Shell command %s failed: %s", command, + std::string(output_buf.begin(), output_buf.end()).c_str()); } - return Error(); + return Status(); } -Error AdbClient::Shell(const char *command, milliseconds timeout, - std::string *output) { +Status AdbClient::Shell(const char *command, milliseconds timeout, + std::string *output) { std::vector<char> output_buffer; auto error = internalShell(command, timeout, output_buffer); if (error.Fail()) @@ -395,8 +398,8 @@ Error AdbClient::Shell(const char *command, milliseconds timeout, return error; } -Error AdbClient::ShellToFile(const char *command, milliseconds timeout, - const FileSpec &output_file_spec) { +Status AdbClient::ShellToFile(const char *command, milliseconds timeout, + const FileSpec &output_file_spec) { std::vector<char> output_buffer; auto error = internalShell(command, timeout, output_buffer); if (error.Fail()) @@ -406,17 +409,17 @@ Error AdbClient::ShellToFile(const char *command, milliseconds timeout, std::error_code EC; llvm::raw_fd_ostream dst(output_filename, EC, llvm::sys::fs::F_None); if (EC) - return Error("Unable to open local file %s", output_filename.c_str()); + return Status("Unable to open local file %s", output_filename.c_str()); dst.write(&output_buffer[0], output_buffer.size()); dst.close(); if (dst.has_error()) - return Error("Failed to write file %s", output_filename.c_str()); - return Error(); + return Status("Failed to write file %s", output_filename.c_str()); + return Status(); } std::unique_ptr<AdbClient::SyncService> -AdbClient::GetSyncService(Error &error) { +AdbClient::GetSyncService(Status &error) { std::unique_ptr<SyncService> sync_service; error = StartSync(); if (error.Success()) @@ -425,15 +428,15 @@ AdbClient::GetSyncService(Error &error) { return sync_service; } -Error AdbClient::SyncService::internalPullFile(const FileSpec &remote_file, - const FileSpec &local_file) { +Status AdbClient::SyncService::internalPullFile(const FileSpec &remote_file, + const FileSpec &local_file) { const auto local_file_path = local_file.GetPath(); llvm::FileRemover local_file_remover(local_file_path); std::error_code EC; llvm::raw_fd_ostream dst(local_file_path, EC, llvm::sys::fs::F_None); if (EC) - return Error("Unable to open local file %s", local_file_path.c_str()); + return Status("Unable to open local file %s", local_file_path.c_str()); const auto remote_file_path = remote_file.GetPath(false); auto error = SendSyncRequest(kRECV, remote_file_path.length(), @@ -452,18 +455,18 @@ Error AdbClient::SyncService::internalPullFile(const FileSpec &remote_file, } dst.close(); if (dst.has_error()) - return Error("Failed to write file %s", local_file_path.c_str()); + return Status("Failed to write file %s", local_file_path.c_str()); local_file_remover.releaseFile(); return error; } -Error AdbClient::SyncService::internalPushFile(const FileSpec &local_file, - const FileSpec &remote_file) { +Status AdbClient::SyncService::internalPushFile(const FileSpec &local_file, + const FileSpec &remote_file) { const auto local_file_path(local_file.GetPath()); std::ifstream src(local_file_path.c_str(), std::ios::in | std::ios::binary); if (!src.is_open()) - return Error("Unable to open local file %s", local_file_path.c_str()); + return Status("Unable to open local file %s", local_file_path.c_str()); std::stringstream file_description; file_description << remote_file.GetPath(false).c_str() << "," << kDefaultMode; @@ -478,7 +481,7 @@ Error AdbClient::SyncService::internalPushFile(const FileSpec &local_file, size_t chunk_size = src.gcount(); error = SendSyncRequest(kDATA, chunk_size, chunk); if (error.Fail()) - return Error("Failed to send file chunk: %s", error.AsCString()); + return Status("Failed to send file chunk: %s", error.AsCString()); } error = SendSyncRequest( kDONE, llvm::sys::toTimeT(FileSystem::GetModificationTime(local_file)), @@ -490,31 +493,31 @@ Error AdbClient::SyncService::internalPushFile(const FileSpec &local_file, uint32_t data_len; error = ReadSyncHeader(response_id, data_len); if (error.Fail()) - return Error("Failed to read DONE response: %s", error.AsCString()); + return Status("Failed to read DONE response: %s", error.AsCString()); if (response_id == kFAIL) { std::string error_message(data_len, 0); error = ReadAllBytes(&error_message[0], data_len); if (error.Fail()) - return Error("Failed to read DONE error message: %s", error.AsCString()); - return Error("Failed to push file: %s", error_message.c_str()); + return Status("Failed to read DONE error message: %s", error.AsCString()); + return Status("Failed to push file: %s", error_message.c_str()); } else if (response_id != kOKAY) - return Error("Got unexpected DONE response: %s", response_id.c_str()); + return Status("Got unexpected DONE response: %s", response_id.c_str()); // If there was an error reading the source file, finish the adb file // transfer first so that adb isn't expecting any more data. if (src.bad()) - return Error("Failed read on %s", local_file_path.c_str()); + return Status("Failed read on %s", local_file_path.c_str()); return error; } -Error AdbClient::SyncService::internalStat(const FileSpec &remote_file, - uint32_t &mode, uint32_t &size, - uint32_t &mtime) { +Status AdbClient::SyncService::internalStat(const FileSpec &remote_file, + uint32_t &mode, uint32_t &size, + uint32_t &mtime) { const std::string remote_file_path(remote_file.GetPath(false)); auto error = SendSyncRequest(kSTAT, remote_file_path.length(), remote_file_path.c_str()); if (error.Fail()) - return Error("Failed to send request: %s", error.AsCString()); + return Status("Failed to send request: %s", error.AsCString()); static const size_t stat_len = strlen(kSTAT); static const size_t response_len = stat_len + (sizeof(uint32_t) * 3); @@ -522,7 +525,7 @@ Error AdbClient::SyncService::internalStat(const FileSpec &remote_file, std::vector<char> buffer(response_len); error = ReadAllBytes(&buffer[0], buffer.size()); if (error.Fail()) - return Error("Failed to read response: %s", error.AsCString()); + return Status("Failed to read response: %s", error.AsCString()); DataExtractor extractor(&buffer[0], buffer.size(), eByteOrderLittle, sizeof(void *)); @@ -530,33 +533,33 @@ Error AdbClient::SyncService::internalStat(const FileSpec &remote_file, const void *command = extractor.GetData(&offset, stat_len); if (!command) - return Error("Failed to get response command"); + return Status("Failed to get response command"); const char *command_str = static_cast<const char *>(command); if (strncmp(command_str, kSTAT, stat_len)) - return Error("Got invalid stat command: %s", command_str); + return Status("Got invalid stat command: %s", command_str); mode = extractor.GetU32(&offset); size = extractor.GetU32(&offset); mtime = extractor.GetU32(&offset); - return Error(); + return Status(); } -Error AdbClient::SyncService::PullFile(const FileSpec &remote_file, - const FileSpec &local_file) { +Status AdbClient::SyncService::PullFile(const FileSpec &remote_file, + const FileSpec &local_file) { return executeCommand([this, &remote_file, &local_file]() { return internalPullFile(remote_file, local_file); }); } -Error AdbClient::SyncService::PushFile(const FileSpec &local_file, - const FileSpec &remote_file) { +Status AdbClient::SyncService::PushFile(const FileSpec &local_file, + const FileSpec &remote_file) { return executeCommand([this, &local_file, &remote_file]() { return internalPushFile(local_file, remote_file); }); } -Error AdbClient::SyncService::Stat(const FileSpec &remote_file, uint32_t &mode, - uint32_t &size, uint32_t &mtime) { +Status AdbClient::SyncService::Stat(const FileSpec &remote_file, uint32_t &mode, + uint32_t &size, uint32_t &mtime) { return executeCommand([this, &remote_file, &mode, &size, &mtime]() { return internalStat(remote_file, mode, size, mtime); }); @@ -569,10 +572,10 @@ bool AdbClient::SyncService::IsConnected() const { AdbClient::SyncService::SyncService(std::unique_ptr<Connection> &&conn) : m_conn(std::move(conn)) {} -Error AdbClient::SyncService::executeCommand( - const std::function<Error()> &cmd) { +Status +AdbClient::SyncService::executeCommand(const std::function<Status()> &cmd) { if (!m_conn) - return Error("SyncService is disconnected"); + return Status("SyncService is disconnected"); const auto error = cmd(); if (error.Fail()) @@ -583,15 +586,15 @@ Error AdbClient::SyncService::executeCommand( AdbClient::SyncService::~SyncService() {} -Error AdbClient::SyncService::SendSyncRequest(const char *request_id, - const uint32_t data_len, - const void *data) { +Status AdbClient::SyncService::SendSyncRequest(const char *request_id, + const uint32_t data_len, + const void *data) { const DataBufferSP data_sp(new DataBufferHeap(kSyncPacketLen, 0)); DataEncoder encoder(data_sp, eByteOrderLittle, sizeof(void *)); auto offset = encoder.PutData(0, request_id, strlen(request_id)); encoder.PutU32(offset, data_len); - Error error; + Status error; ConnectionStatus status; m_conn->Write(data_sp->GetBytes(), kSyncPacketLen, status, &error); if (error.Fail()) @@ -602,8 +605,8 @@ Error AdbClient::SyncService::SendSyncRequest(const char *request_id, return error; } -Error AdbClient::SyncService::ReadSyncHeader(std::string &response_id, - uint32_t &data_len) { +Status AdbClient::SyncService::ReadSyncHeader(std::string &response_id, + uint32_t &data_len) { char buffer[kSyncPacketLen]; auto error = ReadAllBytes(buffer, kSyncPacketLen); @@ -617,8 +620,8 @@ Error AdbClient::SyncService::ReadSyncHeader(std::string &response_id, return error; } -Error AdbClient::SyncService::PullFileChunk(std::vector<char> &buffer, - bool &eof) { +Status AdbClient::SyncService::PullFileChunk(std::vector<char> &buffer, + bool &eof) { buffer.clear(); std::string response_id; @@ -638,14 +641,14 @@ Error AdbClient::SyncService::PullFileChunk(std::vector<char> &buffer, std::string error_message(data_len, 0); error = ReadAllBytes(&error_message[0], data_len); if (error.Fail()) - return Error("Failed to read pull error message: %s", error.AsCString()); - return Error("Failed to pull file: %s", error_message.c_str()); + return Status("Failed to read pull error message: %s", error.AsCString()); + return Status("Failed to pull file: %s", error_message.c_str()); } else - return Error("Pull failed with unknown response: %s", response_id.c_str()); + return Status("Pull failed with unknown response: %s", response_id.c_str()); - return Error(); + return Status(); } -Error AdbClient::SyncService::ReadAllBytes(void *buffer, size_t size) { +Status AdbClient::SyncService::ReadAllBytes(void *buffer, size_t size) { return ::ReadAllBytes(*m_conn, buffer, size); } diff --git a/lldb/source/Plugins/Platform/Android/AdbClient.h b/lldb/source/Plugins/Platform/Android/AdbClient.h index 9e8726c93b6..0d2100fc566 100644 --- a/lldb/source/Plugins/Platform/Android/AdbClient.h +++ b/lldb/source/Plugins/Platform/Android/AdbClient.h @@ -10,7 +10,7 @@ #ifndef liblldb_AdbClient_h_ #define liblldb_AdbClient_h_ -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include <chrono> #include <functional> #include <list> @@ -39,42 +39,42 @@ public: public: ~SyncService(); - Error PullFile(const FileSpec &remote_file, const FileSpec &local_file); + Status PullFile(const FileSpec &remote_file, const FileSpec &local_file); - Error PushFile(const FileSpec &local_file, const FileSpec &remote_file); + Status PushFile(const FileSpec &local_file, const FileSpec &remote_file); - Error Stat(const FileSpec &remote_file, uint32_t &mode, uint32_t &size, - uint32_t &mtime); + Status Stat(const FileSpec &remote_file, uint32_t &mode, uint32_t &size, + uint32_t &mtime); bool IsConnected() const; private: explicit SyncService(std::unique_ptr<Connection> &&conn); - Error SendSyncRequest(const char *request_id, const uint32_t data_len, - const void *data); + Status SendSyncRequest(const char *request_id, const uint32_t data_len, + const void *data); - Error ReadSyncHeader(std::string &response_id, uint32_t &data_len); + Status ReadSyncHeader(std::string &response_id, uint32_t &data_len); - Error PullFileChunk(std::vector<char> &buffer, bool &eof); + Status PullFileChunk(std::vector<char> &buffer, bool &eof); - Error ReadAllBytes(void *buffer, size_t size); + Status ReadAllBytes(void *buffer, size_t size); - Error internalPullFile(const FileSpec &remote_file, - const FileSpec &local_file); + Status internalPullFile(const FileSpec &remote_file, + const FileSpec &local_file); - Error internalPushFile(const FileSpec &local_file, - const FileSpec &remote_file); + Status internalPushFile(const FileSpec &local_file, + const FileSpec &remote_file); - Error internalStat(const FileSpec &remote_file, uint32_t &mode, - uint32_t &size, uint32_t &mtime); + Status internalStat(const FileSpec &remote_file, uint32_t &mode, + uint32_t &size, uint32_t &mtime); - Error executeCommand(const std::function<Error()> &cmd); + Status executeCommand(const std::function<Status()> &cmd); std::unique_ptr<Connection> m_conn; }; - static Error CreateByDeviceID(const std::string &device_id, AdbClient &adb); + static Status CreateByDeviceID(const std::string &device_id, AdbClient &adb); AdbClient(); explicit AdbClient(const std::string &device_id); @@ -83,52 +83,53 @@ public: const std::string &GetDeviceID() const; - Error GetDevices(DeviceIDList &device_list); + Status GetDevices(DeviceIDList &device_list); - Error SetPortForwarding(const uint16_t local_port, - const uint16_t remote_port); + Status SetPortForwarding(const uint16_t local_port, + const uint16_t remote_port); - Error SetPortForwarding(const uint16_t local_port, - llvm::StringRef remote_socket_name, - const UnixSocketNamespace socket_namespace); + Status SetPortForwarding(const uint16_t local_port, + llvm::StringRef remote_socket_name, + const UnixSocketNamespace socket_namespace); - Error DeletePortForwarding(const uint16_t local_port); + Status DeletePortForwarding(const uint16_t local_port); - Error Shell(const char *command, std::chrono::milliseconds timeout, - std::string *output); + Status Shell(const char *command, std::chrono::milliseconds timeout, + std::string *output); - Error ShellToFile(const char *command, std::chrono::milliseconds timeout, - const FileSpec &output_file_spec); + Status ShellToFile(const char *command, std::chrono::milliseconds timeout, + const FileSpec &output_file_spec); - std::unique_ptr<SyncService> GetSyncService(Error &error); + std::unique_ptr<SyncService> GetSyncService(Status &error); - Error SwitchDeviceTransport(); + Status SwitchDeviceTransport(); private: - Error Connect(); + Status Connect(); void SetDeviceID(const std::string &device_id); - Error SendMessage(const std::string &packet, const bool reconnect = true); + Status SendMessage(const std::string &packet, const bool reconnect = true); - Error SendDeviceMessage(const std::string &packet); + Status SendDeviceMessage(const std::string &packet); - Error ReadMessage(std::vector<char> &message); + Status ReadMessage(std::vector<char> &message); - Error ReadMessageStream(std::vector<char> &message, std::chrono::milliseconds timeout); + Status ReadMessageStream(std::vector<char> &message, + std::chrono::milliseconds timeout); - Error GetResponseError(const char *response_id); + Status GetResponseError(const char *response_id); - Error ReadResponseStatus(); + Status ReadResponseStatus(); - Error Sync(); + Status Sync(); - Error StartSync(); + Status StartSync(); - Error internalShell(const char *command, std::chrono::milliseconds timeout, - std::vector<char> &output_buf); + Status internalShell(const char *command, std::chrono::milliseconds timeout, + std::vector<char> &output_buf); - Error ReadAllBytes(void *buffer, size_t size); + Status ReadAllBytes(void *buffer, size_t size); std::string m_device_id; std::unique_ptr<Connection> m_conn; diff --git a/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp b/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp index ad3918d4e20..d896a9f99e6 100644 --- a/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp +++ b/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp @@ -154,12 +154,12 @@ ConstString PlatformAndroid::GetPluginName() { return GetPluginNameStatic(IsHost()); } -Error PlatformAndroid::ConnectRemote(Args &args) { +Status PlatformAndroid::ConnectRemote(Args &args) { m_device_id.clear(); if (IsHost()) { - return Error("can't connect to the host platform '%s', always connected", - GetPluginName().GetCString()); + return Status("can't connect to the host platform '%s', always connected", + GetPluginName().GetCString()); } if (!m_remote_platform_sp) @@ -169,9 +169,9 @@ Error PlatformAndroid::ConnectRemote(Args &args) { llvm::StringRef scheme, host, path; const char *url = args.GetArgumentAtIndex(0); if (!url) - return Error("URL is null."); + return Status("URL is null."); if (!UriParser::Parse(url, scheme, host, port, path)) - return Error("Invalid URL: %s", url); + return Status("Invalid URL: %s", url); if (host != "localhost") m_device_id = host; @@ -187,8 +187,8 @@ Error PlatformAndroid::ConnectRemote(Args &args) { return error; } -Error PlatformAndroid::GetFile(const FileSpec &source, - const FileSpec &destination) { +Status PlatformAndroid::GetFile(const FileSpec &source, + const FileSpec &destination) { if (IsHost() || !m_remote_platform_sp) return PlatformLinux::GetFile(source, destination); @@ -198,7 +198,7 @@ Error PlatformAndroid::GetFile(const FileSpec &source, source_spec = GetRemoteWorkingDirectory().CopyByAppendingPathComponent( source_spec.GetCString(false)); - Error error; + Status error; auto sync_service = GetSyncService(error); if (error.Fail()) return error; @@ -219,7 +219,7 @@ Error PlatformAndroid::GetFile(const FileSpec &source, source_file); if (strchr(source_file, '\'') != nullptr) - return Error("Doesn't support single-quotes in filenames"); + return Status("Doesn't support single-quotes in filenames"); // mode == 0 can signify that adbd cannot access the file // due security constraints - try "cat ..." as a fallback. @@ -231,9 +231,9 @@ Error PlatformAndroid::GetFile(const FileSpec &source, return adb.ShellToFile(cmd, minutes(1), destination); } -Error PlatformAndroid::PutFile(const FileSpec &source, - const FileSpec &destination, uint32_t uid, - uint32_t gid) { +Status PlatformAndroid::PutFile(const FileSpec &source, + const FileSpec &destination, uint32_t uid, + uint32_t gid) { if (IsHost() || !m_remote_platform_sp) return PlatformLinux::PutFile(source, destination, uid, gid); @@ -244,7 +244,7 @@ Error PlatformAndroid::PutFile(const FileSpec &source, destination_spec.GetCString(false)); // TODO: Set correct uid and gid on remote file. - Error error; + Status error; auto sync_service = GetSyncService(error); if (error.Fail()) return error; @@ -253,18 +253,18 @@ Error PlatformAndroid::PutFile(const FileSpec &source, const char *PlatformAndroid::GetCacheHostname() { return m_device_id.c_str(); } -Error PlatformAndroid::DownloadModuleSlice(const FileSpec &src_file_spec, - const uint64_t src_offset, - const uint64_t src_size, - const FileSpec &dst_file_spec) { +Status PlatformAndroid::DownloadModuleSlice(const FileSpec &src_file_spec, + const uint64_t src_offset, + const uint64_t src_size, + const FileSpec &dst_file_spec) { if (src_offset != 0) - return Error("Invalid offset - %" PRIu64, src_offset); + return Status("Invalid offset - %" PRIu64, src_offset); return GetFile(src_file_spec, dst_file_spec); } -Error PlatformAndroid::DisconnectRemote() { - Error error = PlatformLinux::DisconnectRemote(); +Status PlatformAndroid::DisconnectRemote() { + Status error = PlatformLinux::DisconnectRemote(); if (error.Success()) { m_device_id.clear(); m_sdk_version = 0; @@ -285,7 +285,7 @@ uint32_t PlatformAndroid::GetSdkVersion() { std::string version_string; AdbClient adb(m_device_id); - Error error = + Status error = adb.Shell("getprop ro.build.version.sdk", seconds(5), &version_string); version_string = llvm::StringRef(version_string).trim().str(); @@ -301,34 +301,34 @@ uint32_t PlatformAndroid::GetSdkVersion() { return m_sdk_version; } -Error PlatformAndroid::DownloadSymbolFile(const lldb::ModuleSP &module_sp, - const FileSpec &dst_file_spec) { +Status PlatformAndroid::DownloadSymbolFile(const lldb::ModuleSP &module_sp, + const FileSpec &dst_file_spec) { // For oat file we can try to fetch additional debug info from the device ConstString extension = module_sp->GetFileSpec().GetFileNameExtension(); if (extension != ConstString("oat") && extension != ConstString("odex")) - return Error( + return Status( "Symbol file downloading only supported for oat and odex files"); // If we have no information about the platform file we can't execute oatdump if (!module_sp->GetPlatformFileSpec()) - return Error("No platform file specified"); + return Status("No platform file specified"); // Symbolizer isn't available before SDK version 23 if (GetSdkVersion() < 23) - return Error("Symbol file generation only supported on SDK 23+"); + return Status("Symbol file generation only supported on SDK 23+"); // If we already have symtab then we don't have to try and generate one if (module_sp->GetSectionList()->FindSectionByName(ConstString(".symtab")) != nullptr) - return Error("Symtab already available in the module"); + return Status("Symtab already available in the module"); AdbClient adb(m_device_id); std::string tmpdir; - Error error = adb.Shell("mktemp --directory --tmpdir /data/local/tmp", - seconds(5), &tmpdir); + Status error = adb.Shell("mktemp --directory --tmpdir /data/local/tmp", + seconds(5), &tmpdir); if (error.Fail() || tmpdir.empty()) - return Error("Failed to generate temporary directory on the device (%s)", - error.AsCString()); + return Status("Failed to generate temporary directory on the device (%s)", + error.AsCString()); tmpdir = llvm::StringRef(tmpdir).trim().str(); // Create file remover for the temporary directory created on the device @@ -336,7 +336,7 @@ Error PlatformAndroid::DownloadSymbolFile(const lldb::ModuleSP &module_sp, tmpdir_remover(&tmpdir, [&adb](std::string *s) { StreamString command; command.Printf("rm -rf %s", s->c_str()); - Error error = adb.Shell(command.GetData(), seconds(5), nullptr); + Status error = adb.Shell(command.GetData(), seconds(5), nullptr); Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); if (log && error.Fail()) @@ -353,7 +353,7 @@ Error PlatformAndroid::DownloadSymbolFile(const lldb::ModuleSP &module_sp, symfile_platform_filespec.GetCString(false)); error = adb.Shell(command.GetData(), minutes(1), nullptr); if (error.Fail()) - return Error("Oatdump failed: %s", error.AsCString()); + return Status("Oatdump failed: %s", error.AsCString()); // Download the symbolfile from the remote device return GetFile(symfile_platform_filespec, dst_file_spec); @@ -375,7 +375,7 @@ const char *PlatformAndroid::GetLibdlFunctionDeclarations() const { )"; } -AdbClient::SyncService *PlatformAndroid::GetSyncService(Error &error) { +AdbClient::SyncService *PlatformAndroid::GetSyncService(Status &error) { if (m_adb_sync_svc && m_adb_sync_svc->IsConnected()) return m_adb_sync_svc.get(); diff --git a/lldb/source/Plugins/Platform/Android/PlatformAndroid.h b/lldb/source/Plugins/Platform/Android/PlatformAndroid.h index 8417055733f..8fb4cc71a69 100644 --- a/lldb/source/Plugins/Platform/Android/PlatformAndroid.h +++ b/lldb/source/Plugins/Platform/Android/PlatformAndroid.h @@ -51,35 +51,35 @@ public: // lldb_private::Platform functions //------------------------------------------------------------ - Error ConnectRemote(Args &args) override; + Status ConnectRemote(Args &args) override; - Error GetFile(const FileSpec &source, const FileSpec &destination) override; + Status GetFile(const FileSpec &source, const FileSpec &destination) override; - Error PutFile(const FileSpec &source, const FileSpec &destination, - uint32_t uid = UINT32_MAX, uint32_t gid = UINT32_MAX) override; + Status PutFile(const FileSpec &source, const FileSpec &destination, + uint32_t uid = UINT32_MAX, uint32_t gid = UINT32_MAX) override; uint32_t GetSdkVersion(); bool GetRemoteOSVersion() override; - Error DisconnectRemote() override; + Status DisconnectRemote() override; uint32_t GetDefaultMemoryCacheLineSize() override; protected: const char *GetCacheHostname() override; - Error DownloadModuleSlice(const FileSpec &src_file_spec, - const uint64_t src_offset, const uint64_t src_size, - const FileSpec &dst_file_spec) override; + Status DownloadModuleSlice(const FileSpec &src_file_spec, + const uint64_t src_offset, const uint64_t src_size, + const FileSpec &dst_file_spec) override; - Error DownloadSymbolFile(const lldb::ModuleSP &module_sp, - const FileSpec &dst_file_spec) override; + Status DownloadSymbolFile(const lldb::ModuleSP &module_sp, + const FileSpec &dst_file_spec) override; const char *GetLibdlFunctionDeclarations() const override; private: - AdbClient::SyncService *GetSyncService(Error &error); + AdbClient::SyncService *GetSyncService(Status &error); std::unique_ptr<AdbClient::SyncService> m_adb_sync_svc; std::string m_device_id; diff --git a/lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp b/lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp index 034518c1d2e..dbc74833e28 100644 --- a/lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp +++ b/lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp @@ -10,8 +10,8 @@ // Other libraries and framework includes #include "lldb/Host/ConnectionFileDescriptor.h" #include "lldb/Host/common/TCPSocket.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/UriParser.h" #include "PlatformAndroidRemoteGDBServer.h" @@ -25,7 +25,7 @@ using namespace platform_android; static const lldb::pid_t g_remote_platform_pid = 0; // Alias for the process id of lldb-platform -static Error ForwardPortWithAdb( +static Status ForwardPortWithAdb( const uint16_t local_port, const uint16_t remote_port, llvm::StringRef remote_socket_name, const llvm::Optional<AdbClient::UnixSocketNamespace> &socket_namespace, @@ -53,20 +53,20 @@ static Error ForwardPortWithAdb( remote_socket_name.str().c_str(), local_port); if (!socket_namespace) - return Error("Invalid socket namespace"); + return Status("Invalid socket namespace"); return adb.SetPortForwarding(local_port, remote_socket_name, *socket_namespace); } -static Error DeleteForwardPortWithAdb(uint16_t local_port, - const std::string &device_id) { +static Status DeleteForwardPortWithAdb(uint16_t local_port, + const std::string &device_id) { AdbClient adb(device_id); return adb.DeletePortForwarding(local_port); } -static Error FindUnusedPort(uint16_t &port) { - Error error; +static Status FindUnusedPort(uint16_t &port) { + Status error; std::unique_ptr<TCPSocket> tcp_socket(new TCPSocket(true, false)); if (error.Fail()) return error; @@ -107,19 +107,20 @@ bool PlatformAndroidRemoteGDBServer::KillSpawnedProcess(lldb::pid_t pid) { return m_gdb_client.KillSpawnedProcess(pid); } -Error PlatformAndroidRemoteGDBServer::ConnectRemote(Args &args) { +Status PlatformAndroidRemoteGDBServer::ConnectRemote(Args &args) { m_device_id.clear(); if (args.GetArgumentCount() != 1) - return Error("\"platform connect\" takes a single argument: <connect-url>"); + return Status( + "\"platform connect\" takes a single argument: <connect-url>"); int remote_port; llvm::StringRef scheme, host, path; const char *url = args.GetArgumentAtIndex(0); if (!url) - return Error("URL is null."); + return Status("URL is null."); if (!UriParser::Parse(url, scheme, host, remote_port, path)) - return Error("Invalid URL: %s", url); + return Status("Invalid URL: %s", url); if (host != "localhost") m_device_id = host; @@ -150,7 +151,7 @@ Error PlatformAndroidRemoteGDBServer::ConnectRemote(Args &args) { return error; } -Error PlatformAndroidRemoteGDBServer::DisconnectRemote() { +Status PlatformAndroidRemoteGDBServer::DisconnectRemote() { DeleteForwardPort(g_remote_platform_pid); return PlatformRemoteGDBServer::DisconnectRemote(); } @@ -173,12 +174,12 @@ void PlatformAndroidRemoteGDBServer::DeleteForwardPort(lldb::pid_t pid) { m_port_forwards.erase(it); } -Error PlatformAndroidRemoteGDBServer::MakeConnectURL( +Status PlatformAndroidRemoteGDBServer::MakeConnectURL( const lldb::pid_t pid, const uint16_t remote_port, llvm::StringRef remote_socket_name, std::string &connect_url) { static const int kAttempsNum = 5; - Error error; + Status error; // There is a race possibility that somebody will occupy // a port while we're in between FindUnusedPort and ForwardPortWithAdb - // adding the loop to mitigate such problem. @@ -205,7 +206,7 @@ Error PlatformAndroidRemoteGDBServer::MakeConnectURL( lldb::ProcessSP PlatformAndroidRemoteGDBServer::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) { // We don't have the pid of the remote gdbserver when it isn't started by us // but we still want // to store the list of port forwards we set up in our port forward map. diff --git a/lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.h b/lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.h index 6d5bfecd993..1bd13ffe89f 100644 --- a/lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.h +++ b/lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.h @@ -33,15 +33,15 @@ public: ~PlatformAndroidRemoteGDBServer() override; - Error ConnectRemote(Args &args) override; + Status ConnectRemote(Args &args) override; - Error DisconnectRemote() override; + Status DisconnectRemote() override; lldb::ProcessSP ConnectProcess(llvm::StringRef connect_url, llvm::StringRef plugin_name, lldb_private::Debugger &debugger, lldb_private::Target *target, - lldb_private::Error &error) override; + lldb_private::Status &error) override; protected: std::string m_device_id; @@ -54,9 +54,9 @@ protected: void DeleteForwardPort(lldb::pid_t pid); - Error MakeConnectURL(const lldb::pid_t pid, const uint16_t remote_port, - llvm::StringRef remote_socket_name, - std::string &connect_url); + Status MakeConnectURL(const lldb::pid_t pid, const uint16_t remote_port, + llvm::StringRef remote_socket_name, + std::string &connect_url); private: DISALLOW_COPY_AND_ASSIGN(PlatformAndroidRemoteGDBServer); diff --git a/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp index 2a150b5d452..53cec45f986 100644 --- a/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp +++ b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp @@ -27,9 +27,9 @@ #include "lldb/Host/HostInfo.h" #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/StreamString.h" // Define these constants from FreeBSD mman.h for use when targeting @@ -255,8 +255,8 @@ PlatformFreeBSD::GetSoftwareBreakpointTrapOpcode(Target &target, } } -Error PlatformFreeBSD::LaunchProcess(ProcessLaunchInfo &launch_info) { - Error error; +Status PlatformFreeBSD::LaunchProcess(ProcessLaunchInfo &launch_info) { + Status error; if (IsHost()) { error = Platform::LaunchProcess(launch_info); } else { @@ -270,7 +270,7 @@ Error PlatformFreeBSD::LaunchProcess(ProcessLaunchInfo &launch_info) { lldb::ProcessSP PlatformFreeBSD::Attach(ProcessAttachInfo &attach_info, Debugger &debugger, Target *target, - Error &error) { + Status &error) { lldb::ProcessSP process_sp; if (IsHost()) { if (target == NULL) { diff --git a/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h index c8ac7b29f3a..4bde2148a4d 100644 --- a/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h +++ b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h @@ -54,10 +54,10 @@ public: size_t GetSoftwareBreakpointTrapOpcode(Target &target, BreakpointSite *bp_site) override; - Error LaunchProcess(ProcessLaunchInfo &launch_info) override; + Status LaunchProcess(ProcessLaunchInfo &launch_info) override; lldb::ProcessSP Attach(ProcessAttachInfo &attach_info, Debugger &debugger, - Target *target, Error &error) override; + Target *target, Status &error) override; void CalculateTrapHandlerSymbolNames() override; diff --git a/lldb/source/Plugins/Platform/Kalimba/PlatformKalimba.cpp b/lldb/source/Plugins/Platform/Kalimba/PlatformKalimba.cpp index 08a3a6aa6c2..00327e485bf 100644 --- a/lldb/source/Plugins/Platform/Kalimba/PlatformKalimba.cpp +++ b/lldb/source/Plugins/Platform/Kalimba/PlatformKalimba.cpp @@ -22,8 +22,8 @@ #include "lldb/Host/HostInfo.h" #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/FileSpec.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/StreamString.h" using namespace lldb; @@ -125,8 +125,8 @@ PlatformKalimba::GetSoftwareBreakpointTrapOpcode(Target & /*target*/, return 0; } -Error PlatformKalimba::LaunchProcess(ProcessLaunchInfo &launch_info) { - Error error; +Status PlatformKalimba::LaunchProcess(ProcessLaunchInfo &launch_info) { + Status error; if (IsHost()) { error.SetErrorString("native execution is not possible"); @@ -138,7 +138,7 @@ Error PlatformKalimba::LaunchProcess(ProcessLaunchInfo &launch_info) { lldb::ProcessSP PlatformKalimba::Attach(ProcessAttachInfo &attach_info, Debugger &debugger, Target *target, - Error &error) { + Status &error) { lldb::ProcessSP process_sp; if (IsHost()) { error.SetErrorString("native execution is not possible"); diff --git a/lldb/source/Plugins/Platform/Kalimba/PlatformKalimba.h b/lldb/source/Plugins/Platform/Kalimba/PlatformKalimba.h index 0c94ec9ec8f..53a8e5594aa 100644 --- a/lldb/source/Plugins/Platform/Kalimba/PlatformKalimba.h +++ b/lldb/source/Plugins/Platform/Kalimba/PlatformKalimba.h @@ -56,11 +56,11 @@ public: size_t GetSoftwareBreakpointTrapOpcode(Target &target, BreakpointSite *bp_site) override; - lldb_private::Error + lldb_private::Status LaunchProcess(lldb_private::ProcessLaunchInfo &launch_info) override; lldb::ProcessSP Attach(ProcessAttachInfo &attach_info, Debugger &debugger, - Target *target, Error &error) override; + Target *target, Status &error) override; // Kalimba processes can not be launched by spawning and attaching. bool CanDebugProcess() override { return false; } diff --git a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp index 4dd5398fcfa..0bf00ea3079 100644 --- a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp +++ b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp @@ -25,9 +25,9 @@ #include "lldb/Host/HostInfo.h" #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/StreamString.h" // Define these constants from Linux mman.h for use when targeting @@ -278,7 +278,7 @@ lldb::ProcessSP PlatformLinux::DebugProcess(ProcessLaunchInfo &launch_info, Debugger &debugger, Target *target, // Can be NULL, if NULL create a new // target, else use existing one - Error &error) { + Status &error) { Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); LLDB_LOG(log, "target {0}", target); diff --git a/lldb/source/Plugins/Platform/Linux/PlatformLinux.h b/lldb/source/Plugins/Platform/Linux/PlatformLinux.h index f1386d1e4fe..bc7b723427f 100644 --- a/lldb/source/Plugins/Platform/Linux/PlatformLinux.h +++ b/lldb/source/Plugins/Platform/Linux/PlatformLinux.h @@ -55,7 +55,7 @@ public: lldb::ProcessSP DebugProcess(ProcessLaunchInfo &launch_info, Debugger &debugger, Target *target, - Error &error) override; + Status &error) override; void CalculateTrapHandlerSymbolNames() override; diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp index 478d482eb02..0197d27e76e 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp @@ -21,8 +21,8 @@ // Project includes #include "lldb/Host/PseudoTerminal.h" #include "lldb/Target/Process.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/LLDBAssert.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/StreamString.h" #include "llvm/Support/Threading.h" @@ -55,14 +55,14 @@ PlatformAppleSimulator::PlatformAppleSimulator() //------------------------------------------------------------------ PlatformAppleSimulator::~PlatformAppleSimulator() {} -lldb_private::Error PlatformAppleSimulator::LaunchProcess( +lldb_private::Status PlatformAppleSimulator::LaunchProcess( lldb_private::ProcessLaunchInfo &launch_info) { #if defined(__APPLE__) LoadCoreSimulator(); CoreSimulatorSupport::Device device(GetSimulatorDevice()); if (device.GetState() != CoreSimulatorSupport::Device::State::Booted) { - Error boot_err; + Status boot_err; device.Boot(boot_err); if (boot_err.Fail()) return boot_err; @@ -72,11 +72,11 @@ lldb_private::Error PlatformAppleSimulator::LaunchProcess( if (spawned) { launch_info.SetProcessID(spawned.GetPID()); - return Error(); + return Status(); } else return spawned.GetError(); #else - Error err; + Status err; err.SetErrorString(UNSUPPORTED_ERROR); return err; #endif @@ -124,9 +124,9 @@ void PlatformAppleSimulator::GetStatus(Stream &strm) { #endif } -Error PlatformAppleSimulator::ConnectRemote(Args &args) { +Status PlatformAppleSimulator::ConnectRemote(Args &args) { #if defined(__APPLE__) - Error error; + Status error; if (args.GetArgumentCount() == 1) { if (m_device) DisconnectRemote(); @@ -156,18 +156,18 @@ Error PlatformAppleSimulator::ConnectRemote(Args &args) { } return error; #else - Error err; + Status err; err.SetErrorString(UNSUPPORTED_ERROR); return err; #endif } -Error PlatformAppleSimulator::DisconnectRemote() { +Status PlatformAppleSimulator::DisconnectRemote() { #if defined(__APPLE__) m_device.reset(); - return Error(); + return Status(); #else - Error err; + Status err; err.SetErrorString(UNSUPPORTED_ERROR); return err; #endif @@ -177,7 +177,7 @@ lldb::ProcessSP PlatformAppleSimulator::DebugProcess( ProcessLaunchInfo &launch_info, Debugger &debugger, Target *target, // Can be NULL, if NULL create a new target, else use // existing one - Error &error) { + Status &error) { #if defined(__APPLE__) ProcessSP process_sp; // Make sure we stop at the entry point diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.h b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.h index 34f2ba2d9bf..44feb019dc7 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.h +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.h @@ -38,19 +38,19 @@ public: virtual ~PlatformAppleSimulator(); - lldb_private::Error + lldb_private::Status LaunchProcess(lldb_private::ProcessLaunchInfo &launch_info) override; void GetStatus(lldb_private::Stream &strm) override; - lldb_private::Error ConnectRemote(lldb_private::Args &args) override; + lldb_private::Status ConnectRemote(lldb_private::Args &args) override; - lldb_private::Error DisconnectRemote() override; + lldb_private::Status DisconnectRemote() override; lldb::ProcessSP DebugProcess(lldb_private::ProcessLaunchInfo &launch_info, lldb_private::Debugger &debugger, lldb_private::Target *target, - lldb_private::Error &error) override; + lldb_private::Status &error) override; protected: std::mutex m_core_sim_path_mutex; diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp index 38fe412c857..52188eefb36 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp @@ -23,9 +23,9 @@ #include "lldb/Host/HostInfo.h" #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/StreamString.h" #include "llvm/Support/FileSystem.h" @@ -171,10 +171,10 @@ void PlatformAppleTVSimulator::GetStatus(Stream &strm) { strm.PutCString(" SDK Path: error: unable to locate SDK\n"); } -Error PlatformAppleTVSimulator::ResolveExecutable( +Status PlatformAppleTVSimulator::ResolveExecutable( const ModuleSpec &module_spec, lldb::ModuleSP &exe_module_sp, const FileSpecList *module_search_paths_ptr) { - Error error; + Status error; // Nothing special to do here, just use the actual file and architecture ModuleSpec resolved_module_spec(module_spec); @@ -301,10 +301,10 @@ const char *PlatformAppleTVSimulator::GetSDKDirectoryAsCString() { return NULL; } -Error PlatformAppleTVSimulator::GetSymbolFile(const FileSpec &platform_file, - const UUID *uuid_ptr, - FileSpec &local_file) { - Error error; +Status PlatformAppleTVSimulator::GetSymbolFile(const FileSpec &platform_file, + const UUID *uuid_ptr, + FileSpec &local_file) { + Status error; char platform_file_path[PATH_MAX]; if (platform_file.GetPath(platform_file_path, sizeof(platform_file_path))) { char resolved_path[PATH_MAX]; @@ -333,7 +333,7 @@ Error PlatformAppleTVSimulator::GetSymbolFile(const FileSpec &platform_file, return error; } -Error PlatformAppleTVSimulator::GetSharedModule( +Status PlatformAppleTVSimulator::GetSharedModule( const ModuleSpec &module_spec, lldb_private::Process *process, ModuleSP &module_sp, const FileSpecList *module_search_paths_ptr, ModuleSP *old_module_sp_ptr, bool *did_create_ptr) { @@ -341,7 +341,7 @@ Error PlatformAppleTVSimulator::GetSharedModule( // system. So first we ask for the file in the cached SDK, // then we attempt to get a shared module for the right architecture // with the right UUID. - Error error; + Status error; ModuleSpec platform_module_spec(module_spec); const FileSpec &platform_file = module_spec.GetFileSpec(); error = GetSymbolFile(platform_file, module_spec.GetUUIDPtr(), diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.h b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.h index 311ba05d76a..8cecb4d496a 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.h +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.h @@ -51,7 +51,7 @@ public: //------------------------------------------------------------ // lldb_private::Platform functions //------------------------------------------------------------ - lldb_private::Error ResolveExecutable( + lldb_private::Status ResolveExecutable( const lldb_private::ModuleSpec &module_spec, lldb::ModuleSP &module_sp, const lldb_private::FileSpecList *module_search_paths_ptr) override; @@ -59,12 +59,12 @@ public: void GetStatus(lldb_private::Stream &strm) override; - virtual lldb_private::Error + virtual lldb_private::Status GetSymbolFile(const lldb_private::FileSpec &platform_file, const lldb_private::UUID *uuid_ptr, lldb_private::FileSpec &local_file); - lldb_private::Error + lldb_private::Status GetSharedModule(const lldb_private::ModuleSpec &module_spec, lldb_private::Process *process, lldb::ModuleSP &module_sp, const lldb_private::FileSpecList *module_search_paths_ptr, diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp index 1ffdc1ab7c8..b9f493294a0 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp @@ -23,9 +23,9 @@ #include "lldb/Host/HostInfo.h" #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/StreamString.h" using namespace lldb; @@ -171,10 +171,10 @@ void PlatformAppleWatchSimulator::GetStatus(Stream &strm) { strm.PutCString(" SDK Path: error: unable to locate SDK\n"); } -Error PlatformAppleWatchSimulator::ResolveExecutable( +Status PlatformAppleWatchSimulator::ResolveExecutable( const ModuleSpec &module_spec, lldb::ModuleSP &exe_module_sp, const FileSpecList *module_search_paths_ptr) { - Error error; + Status error; // Nothing special to do here, just use the actual file and architecture ModuleSpec resolved_module_spec(module_spec); @@ -301,10 +301,10 @@ const char *PlatformAppleWatchSimulator::GetSDKDirectoryAsCString() { return NULL; } -Error PlatformAppleWatchSimulator::GetSymbolFile(const FileSpec &platform_file, - const UUID *uuid_ptr, - FileSpec &local_file) { - Error error; +Status PlatformAppleWatchSimulator::GetSymbolFile(const FileSpec &platform_file, + const UUID *uuid_ptr, + FileSpec &local_file) { + Status error; char platform_file_path[PATH_MAX]; if (platform_file.GetPath(platform_file_path, sizeof(platform_file_path))) { char resolved_path[PATH_MAX]; @@ -333,7 +333,7 @@ Error PlatformAppleWatchSimulator::GetSymbolFile(const FileSpec &platform_file, return error; } -Error PlatformAppleWatchSimulator::GetSharedModule( +Status PlatformAppleWatchSimulator::GetSharedModule( const ModuleSpec &module_spec, lldb_private::Process *process, ModuleSP &module_sp, const FileSpecList *module_search_paths_ptr, ModuleSP *old_module_sp_ptr, bool *did_create_ptr) { @@ -341,7 +341,7 @@ Error PlatformAppleWatchSimulator::GetSharedModule( // system. So first we ask for the file in the cached SDK, // then we attempt to get a shared module for the right architecture // with the right UUID. - Error error; + Status error; ModuleSpec platform_module_spec(module_spec); const FileSpec &platform_file = module_spec.GetFileSpec(); error = GetSymbolFile(platform_file, module_spec.GetUUIDPtr(), diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.h b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.h index 2b15611df47..30aa42c964a 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.h +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.h @@ -51,7 +51,7 @@ public: //------------------------------------------------------------ // lldb_private::Platform functions //------------------------------------------------------------ - lldb_private::Error ResolveExecutable( + lldb_private::Status ResolveExecutable( const lldb_private::ModuleSpec &module_spec, lldb::ModuleSP &module_sp, const lldb_private::FileSpecList *module_search_paths_ptr) override; @@ -59,12 +59,12 @@ public: void GetStatus(lldb_private::Stream &strm) override; - virtual lldb_private::Error + virtual lldb_private::Status GetSymbolFile(const lldb_private::FileSpec &platform_file, const lldb_private::UUID *uuid_ptr, lldb_private::FileSpec &local_file); - lldb_private::Error + lldb_private::Status GetSharedModule(const lldb_private::ModuleSpec &module_spec, lldb_private::Process *process, lldb::ModuleSP &module_sp, const lldb_private::FileSpecList *module_search_paths_ptr, diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp index 02459045869..d69a02e41d5 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp @@ -36,8 +36,8 @@ #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" #include "lldb/Utility/DataBufferLLVM.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" #include "llvm/ADT/STLExtras.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/Threading.h" @@ -195,10 +195,10 @@ FileSpecList PlatformDarwin::LocateExecutableScriptingResources( return file_list; } -Error PlatformDarwin::ResolveSymbolFile(Target &target, - const ModuleSpec &sym_spec, - FileSpec &sym_file) { - Error error; +Status PlatformDarwin::ResolveSymbolFile(Target &target, + const ModuleSpec &sym_spec, + FileSpec &sym_file) { + Status error; sym_file = sym_spec.GetSymbolFileSpec(); llvm::sys::fs::file_status st; @@ -219,23 +219,23 @@ Error PlatformDarwin::ResolveSymbolFile(Target &target, return error; } -static lldb_private::Error +static lldb_private::Status MakeCacheFolderForFile(const FileSpec &module_cache_spec) { FileSpec module_cache_folder = module_cache_spec.CopyByRemovingLastPathComponent(); return llvm::sys::fs::create_directory(module_cache_folder.GetPath()); } -static lldb_private::Error +static lldb_private::Status BringInRemoteFile(Platform *platform, const lldb_private::ModuleSpec &module_spec, const FileSpec &module_cache_spec) { MakeCacheFolderForFile(module_cache_spec); - Error err = platform->GetFile(module_spec.GetFileSpec(), module_cache_spec); + Status err = platform->GetFile(module_spec.GetFileSpec(), module_cache_spec); return err; } -lldb_private::Error PlatformDarwin::GetSharedModuleWithLocalCache( +lldb_private::Status PlatformDarwin::GetSharedModuleWithLocalCache( const lldb_private::ModuleSpec &module_spec, lldb::ModuleSP &module_sp, const lldb_private::FileSpecList *module_search_paths_ptr, lldb::ModuleSP *old_module_sp_ptr, bool *did_create_ptr) { @@ -252,7 +252,7 @@ lldb_private::Error PlatformDarwin::GetSharedModuleWithLocalCache( module_spec.GetSymbolFileSpec().GetDirectory().AsCString(), module_spec.GetSymbolFileSpec().GetFilename().AsCString()); - Error err; + Status err; err = ModuleList::GetSharedModule(module_spec, module_sp, module_search_paths_ptr, old_module_sp_ptr, @@ -286,7 +286,7 @@ lldb_private::Error PlatformDarwin::GetSharedModuleWithLocalCache( module_spec.GetArchitecture()); module_sp.reset(new Module(local_spec)); module_sp->SetPlatformFileSpec(module_spec.GetFileSpec()); - return Error(); + return Status(); } } @@ -300,7 +300,7 @@ lldb_private::Error PlatformDarwin::GetSharedModuleWithLocalCache( uint64_t high_local, high_remote, low_local, low_remote; auto MD5 = llvm::sys::fs::md5_contents(module_cache_spec.GetPath()); if (!MD5) - return Error(MD5.getError()); + return Status(MD5.getError()); std::tie(high_local, low_local) = MD5->words(); m_remote_platform_sp->CalculateMD5(module_spec.GetFileSpec(), @@ -314,7 +314,8 @@ lldb_private::Error PlatformDarwin::GetSharedModuleWithLocalCache( (IsHost() ? "host" : "remote"), module_spec.GetFileSpec().GetDirectory().AsCString(), module_spec.GetFileSpec().GetFilename().AsCString()); - Error err = BringInRemoteFile(this, module_spec, module_cache_spec); + Status err = + BringInRemoteFile(this, module_spec, module_cache_spec); if (err.Fail()) return err; } @@ -329,7 +330,7 @@ lldb_private::Error PlatformDarwin::GetSharedModuleWithLocalCache( (IsHost() ? "host" : "remote"), module_spec.GetFileSpec().GetDirectory().AsCString(), module_spec.GetFileSpec().GetFilename().AsCString()); - return Error(); + return Status(); } // bring in the remote module file @@ -338,7 +339,7 @@ lldb_private::Error PlatformDarwin::GetSharedModuleWithLocalCache( (IsHost() ? "host" : "remote"), module_spec.GetFileSpec().GetDirectory().AsCString(), module_spec.GetFileSpec().GetFilename().AsCString()); - Error err = BringInRemoteFile(this, module_spec, module_cache_spec); + Status err = BringInRemoteFile(this, module_spec, module_cache_spec); if (err.Fail()) return err; if (module_cache_spec.Exists()) { @@ -351,20 +352,20 @@ lldb_private::Error PlatformDarwin::GetSharedModuleWithLocalCache( ModuleSpec local_spec(module_cache_spec, module_spec.GetArchitecture()); module_sp.reset(new Module(local_spec)); module_sp->SetPlatformFileSpec(module_spec.GetFileSpec()); - return Error(); + return Status(); } else - return Error("unable to obtain valid module file"); + return Status("unable to obtain valid module file"); } else - return Error("no cache path"); + return Status("no cache path"); } else - return Error("unable to resolve module"); + return Status("unable to resolve module"); } -Error PlatformDarwin::GetSharedModule( +Status PlatformDarwin::GetSharedModule( const ModuleSpec &module_spec, Process *process, ModuleSP &module_sp, const FileSpecList *module_search_paths_ptr, ModuleSP *old_module_sp_ptr, bool *did_create_ptr) { - Error error; + Status error; module_sp.reset(); if (IsRemote()) { @@ -393,7 +394,7 @@ Error PlatformDarwin::GetSharedModule( ModuleSpec new_module_spec(module_spec); new_module_spec.GetFileSpec() = bundle_directory; if (Host::ResolveExecutableInBundle(new_module_spec.GetFileSpec())) { - Error new_error(Platform::GetSharedModule( + Status new_error(Platform::GetSharedModule( new_module_spec, process, module_sp, NULL, old_module_sp_ptr, did_create_ptr)); @@ -420,7 +421,7 @@ Error PlatformDarwin::GetSharedModule( if (new_file_spec.Exists()) { ModuleSpec new_module_spec(module_spec); new_module_spec.GetFileSpec() = new_file_spec; - Error new_error(Platform::GetSharedModule( + Status new_error(Platform::GetSharedModule( new_module_spec, process, module_sp, NULL, old_module_sp_ptr, did_create_ptr)); @@ -1185,7 +1186,7 @@ const char *PlatformDarwin::GetDeveloperDirectory() { int exit_status = -1; int signo = -1; std::string command_output; - Error error = + Status error = Host::RunShellCommand("/usr/bin/xcode-select --print-path", NULL, // current working directory &exit_status, &signo, &command_output, @@ -1361,7 +1362,7 @@ static FileSpec GetXcodeContentsPath() { int signo = 0; std::string output; const char *command = "/usr/bin/xcode-select -p"; - lldb_private::Error error = Host::RunShellCommand( + lldb_private::Status error = Host::RunShellCommand( command, // shell command to run NULL, // current working directory &status, // Put the exit status of the process in here @@ -1739,7 +1740,7 @@ lldb_private::FileSpec PlatformDarwin::LocateExecutable(const char *basename) { return FileSpec(); } -lldb_private::Error +lldb_private::Status PlatformDarwin::LaunchProcess(lldb_private::ProcessLaunchInfo &launch_info) { // Starting in Fall 2016 OSes, NSLog messages only get mirrored to stderr // if the OS_ACTIVITY_DT_MODE environment variable is set. (It doesn't diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h index 9430c269c27..6495609ac49 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h @@ -32,7 +32,7 @@ public: //------------------------------------------------------------ // lldb_private::Platform functions //------------------------------------------------------------ - lldb_private::Error + lldb_private::Status ResolveSymbolFile(lldb_private::Target &target, const lldb_private::ModuleSpec &sym_spec, lldb_private::FileSpec &sym_file) override; @@ -41,7 +41,7 @@ public: lldb_private::Target *target, lldb_private::Module &module, lldb_private::Stream *feedback_stream) override; - lldb_private::Error + lldb_private::Status GetSharedModule(const lldb_private::ModuleSpec &module_spec, lldb_private::Process *process, lldb::ModuleSP &module_sp, const lldb_private::FileSpecList *module_search_paths_ptr, @@ -79,7 +79,7 @@ public: lldb_private::FileSpec LocateExecutable(const char *basename) override; - lldb_private::Error + lldb_private::Status LaunchProcess(lldb_private::ProcessLaunchInfo &launch_info) override; static std::tuple<uint32_t, uint32_t, uint32_t, llvm::StringRef> @@ -90,7 +90,7 @@ protected: void ReadLibdispatchOffsets(lldb_private::Process *process); - virtual lldb_private::Error GetSharedModuleWithLocalCache( + virtual lldb_private::Status GetSharedModuleWithLocalCache( const lldb_private::ModuleSpec &module_spec, lldb::ModuleSP &module_sp, const lldb_private::FileSpecList *module_search_paths_ptr, lldb::ModuleSP *old_module_sp_ptr, bool *did_create_ptr); diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp index 08df0565acc..f168fb6fda5 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp @@ -31,9 +31,9 @@ #include "lldb/Target/Platform.h" #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/StreamString.h" #include "llvm/Support/FileSystem.h" @@ -664,11 +664,11 @@ bool PlatformDarwinKernel::KernelHasdSYMSibling(const FileSpec &kernel_binary) { return false; } -Error PlatformDarwinKernel::GetSharedModule( +Status PlatformDarwinKernel::GetSharedModule( const ModuleSpec &module_spec, Process *process, ModuleSP &module_sp, const FileSpecList *module_search_paths_ptr, ModuleSP *old_module_sp_ptr, bool *did_create_ptr) { - Error error; + Status error; module_sp.reset(); const FileSpec &platform_file = module_spec.GetFileSpec(); @@ -774,10 +774,10 @@ Error PlatformDarwinKernel::GetSharedModule( old_module_sp_ptr, did_create_ptr); } -Error PlatformDarwinKernel::ExamineKextForMatchingUUID( +Status PlatformDarwinKernel::ExamineKextForMatchingUUID( const FileSpec &kext_bundle_path, const lldb_private::UUID &uuid, const ArchSpec &arch, ModuleSP &exe_module_sp) { - Error error; + Status error; FileSpec exe_file = kext_bundle_path; Host::ResolveExecutableInBundle(exe_file); if (exe_file.Exists()) { diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h index 6ee5916e613..9b3ec5e0d71 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h @@ -66,7 +66,7 @@ public: void GetStatus(lldb_private::Stream &strm) override; - lldb_private::Error + lldb_private::Status GetSharedModule(const lldb_private::ModuleSpec &module_spec, lldb_private::Process *process, lldb::ModuleSP &module_sp, const lldb_private::FileSpecList *module_search_paths_ptr, @@ -139,7 +139,7 @@ protected: static bool KernelHasdSYMSibling(const lldb_private::FileSpec &kext_bundle_filepath); - lldb_private::Error + lldb_private::Status ExamineKextForMatchingUUID(const lldb_private::FileSpec &kext_bundle_path, const lldb_private::UUID &uuid, const lldb_private::ArchSpec &arch, diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp index 11d0457a783..c08417a80ae 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp @@ -27,9 +27,9 @@ #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" #include "lldb/Utility/DataBufferHeap.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/StreamString.h" using namespace lldb; @@ -190,7 +190,7 @@ ConstString PlatformMacOSX::GetSDKDirectory(lldb_private::Target &target) { int signo = 0; std::string output; const char *command = "xcrun -sdk macosx --show-sdk-path"; - lldb_private::Error error = RunShellCommand( + lldb_private::Status error = RunShellCommand( command, // shell command to run NULL, // current working directory &status, // Put the exit status of the process in here @@ -235,9 +235,9 @@ ConstString PlatformMacOSX::GetSDKDirectory(lldb_private::Target &target) { return ConstString(); } -Error PlatformMacOSX::GetSymbolFile(const FileSpec &platform_file, - const UUID *uuid_ptr, - FileSpec &local_file) { +Status PlatformMacOSX::GetSymbolFile(const FileSpec &platform_file, + const UUID *uuid_ptr, + FileSpec &local_file) { if (IsRemote()) { if (m_remote_platform_sp) return m_remote_platform_sp->GetFileWithUUID(platform_file, uuid_ptr, @@ -246,10 +246,10 @@ Error PlatformMacOSX::GetSymbolFile(const FileSpec &platform_file, // Default to the local case local_file = platform_file; - return Error(); + return Status(); } -lldb_private::Error +lldb_private::Status PlatformMacOSX::GetFileWithUUID(const lldb_private::FileSpec &platform_file, const lldb_private::UUID *uuid_ptr, lldb_private::FileSpec &local_file) { @@ -263,7 +263,7 @@ PlatformMacOSX::GetFileWithUUID(const lldb_private::FileSpec &platform_file, if (local_os_build.compare(remote_os_build) == 0) { // same OS version: the local file is good enough local_file = platform_file; - return Error(); + return Status(); } else { // try to find the file in the cache std::string cache_path(GetLocalCacheDirectory()); @@ -272,13 +272,14 @@ PlatformMacOSX::GetFileWithUUID(const lldb_private::FileSpec &platform_file, FileSpec module_cache_spec(cache_path, false); if (module_cache_spec.Exists()) { local_file = module_cache_spec; - return Error(); + return Status(); } // bring in the remote module file FileSpec module_cache_folder = module_cache_spec.CopyByRemovingLastPathComponent(); // try to make the local directory first - Error err(llvm::sys::fs::create_directory(module_cache_folder.GetPath())); + Status err( + llvm::sys::fs::create_directory(module_cache_folder.GetPath())); if (err.Fail()) return err; err = GetFile(platform_file, module_cache_spec); @@ -286,13 +287,13 @@ PlatformMacOSX::GetFileWithUUID(const lldb_private::FileSpec &platform_file, return err; if (module_cache_spec.Exists()) { local_file = module_cache_spec; - return Error(); + return Status(); } else - return Error("unable to obtain valid module file"); + return Status("unable to obtain valid module file"); } } local_file = platform_file; - return Error(); + return Status(); } bool PlatformMacOSX::GetSupportedArchitectureAtIndex(uint32_t idx, @@ -304,12 +305,12 @@ bool PlatformMacOSX::GetSupportedArchitectureAtIndex(uint32_t idx, #endif } -lldb_private::Error PlatformMacOSX::GetSharedModule( +lldb_private::Status PlatformMacOSX::GetSharedModule( const lldb_private::ModuleSpec &module_spec, Process *process, lldb::ModuleSP &module_sp, const lldb_private::FileSpecList *module_search_paths_ptr, lldb::ModuleSP *old_module_sp_ptr, bool *did_create_ptr) { - Error error = GetSharedModuleWithLocalCache( + Status error = GetSharedModuleWithLocalCache( module_spec, module_sp, module_search_paths_ptr, old_module_sp_ptr, did_create_ptr); @@ -324,7 +325,7 @@ lldb_private::Error PlatformMacOSX::GetSharedModule( lldb::ModuleSP x86_64_module_sp; lldb::ModuleSP old_x86_64_module_sp; bool did_create = false; - Error x86_64_error = GetSharedModuleWithLocalCache( + Status x86_64_error = GetSharedModuleWithLocalCache( module_spec_x86_64, x86_64_module_sp, module_search_paths_ptr, &old_x86_64_module_sp, &did_create); if (x86_64_module_sp && x86_64_module_sp->GetObjectFile()) { diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.h b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.h index d5b5d69f1fb..d1e609258d4 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.h +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.h @@ -45,7 +45,7 @@ public: uint32_t GetPluginVersion() override { return 1; } - lldb_private::Error + lldb_private::Status GetSharedModule(const lldb_private::ModuleSpec &module_spec, lldb_private::Process *process, lldb::ModuleSP &module_sp, const lldb_private::FileSpecList *module_search_paths_ptr, @@ -56,17 +56,18 @@ public: return GetDescriptionStatic(IsHost()); } - lldb_private::Error GetSymbolFile(const lldb_private::FileSpec &platform_file, - const lldb_private::UUID *uuid_ptr, - lldb_private::FileSpec &local_file); + lldb_private::Status + GetSymbolFile(const lldb_private::FileSpec &platform_file, + const lldb_private::UUID *uuid_ptr, + lldb_private::FileSpec &local_file); - lldb_private::Error + lldb_private::Status GetFile(const lldb_private::FileSpec &source, const lldb_private::FileSpec &destination) override { return PlatformDarwin::GetFile(source, destination); } - lldb_private::Error + lldb_private::Status GetFileWithUUID(const lldb_private::FileSpec &platform_file, const lldb_private::UUID *uuid_ptr, lldb_private::FileSpec &local_file) override; diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp index 6fdaa5997b4..38facc4aa12 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp @@ -25,9 +25,9 @@ #include "lldb/Host/Host.h" #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/StreamString.h" using namespace lldb; diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp index 18692643097..bbd8f169893 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp @@ -25,9 +25,9 @@ #include "lldb/Host/Host.h" #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/StreamString.h" using namespace lldb; diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp index 0302e7b3aaf..f7395fb8cf3 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp @@ -22,9 +22,9 @@ #include "lldb/Host/Host.h" #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/StreamString.h" using namespace lldb; @@ -75,10 +75,10 @@ void PlatformRemoteDarwinDevice::GetStatus(Stream &strm) { } } -Error PlatformRemoteDarwinDevice::ResolveExecutable( +Status PlatformRemoteDarwinDevice::ResolveExecutable( const ModuleSpec &ms, lldb::ModuleSP &exe_module_sp, const FileSpecList *module_search_paths_ptr) { - Error error; + Status error; // Nothing special to do here, just use the actual file and architecture ModuleSpec resolved_module_spec(ms); @@ -429,11 +429,11 @@ bool PlatformRemoteDarwinDevice::GetFileInSDK(const char *platform_file_path, return false; } -Error PlatformRemoteDarwinDevice::GetSymbolFile(const FileSpec &platform_file, - const UUID *uuid_ptr, - FileSpec &local_file) { +Status PlatformRemoteDarwinDevice::GetSymbolFile(const FileSpec &platform_file, + const UUID *uuid_ptr, + FileSpec &local_file) { Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); - Error error; + Status error; char platform_file_path[PATH_MAX]; if (platform_file.GetPath(platform_file_path, sizeof(platform_file_path))) { char resolved_path[PATH_MAX]; @@ -489,7 +489,7 @@ Error PlatformRemoteDarwinDevice::GetSymbolFile(const FileSpec &platform_file, return error; } -Error PlatformRemoteDarwinDevice::GetSharedModule( +Status PlatformRemoteDarwinDevice::GetSharedModule( const ModuleSpec &module_spec, Process *process, ModuleSP &module_sp, const FileSpecList *module_search_paths_ptr, ModuleSP *old_module_sp_ptr, bool *did_create_ptr) { @@ -500,7 +500,7 @@ Error PlatformRemoteDarwinDevice::GetSharedModule( const FileSpec &platform_file = module_spec.GetFileSpec(); Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); - Error error; + Status error; char platform_file_path[PATH_MAX]; if (platform_file.GetPath(platform_file_path, sizeof(platform_file_path))) { @@ -657,7 +657,7 @@ Error PlatformRemoteDarwinDevice::GetSharedModule( if (path_to_try.Exists()) { ModuleSpec new_module_spec(module_spec); new_module_spec.GetFileSpec() = path_to_try; - Error new_error(Platform::GetSharedModule( + Status new_error(Platform::GetSharedModule( new_module_spec, process, module_sp, NULL, old_module_sp_ptr, did_create_ptr)); diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.h b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.h index 55fb4f920c6..f159e8575d7 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.h +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.h @@ -30,18 +30,18 @@ public: //------------------------------------------------------------ // lldb_private::Platform functions //------------------------------------------------------------ - lldb_private::Error ResolveExecutable( + lldb_private::Status ResolveExecutable( const lldb_private::ModuleSpec &module_spec, lldb::ModuleSP &module_sp, const lldb_private::FileSpecList *module_search_paths_ptr) override; void GetStatus(lldb_private::Stream &strm) override; - virtual lldb_private::Error + virtual lldb_private::Status GetSymbolFile(const lldb_private::FileSpec &platform_file, const lldb_private::UUID *uuid_ptr, lldb_private::FileSpec &local_file); - lldb_private::Error + lldb_private::Status GetSharedModule(const lldb_private::ModuleSpec &module_spec, lldb_private::Process *process, lldb::ModuleSP &module_sp, const lldb_private::FileSpecList *module_search_paths_ptr, diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp index ec1109fb4b4..c52b636c849 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp @@ -22,9 +22,9 @@ #include "lldb/Host/Host.h" #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/StreamString.h" using namespace lldb; diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp index 9a082c701f0..3037dd854be 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp @@ -24,9 +24,9 @@ #include "lldb/Host/HostInfo.h" #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/StreamString.h" #include "llvm/Support/FileSystem.h" @@ -177,10 +177,10 @@ void PlatformiOSSimulator::GetStatus(Stream &strm) { PlatformAppleSimulator::GetStatus(strm); } -Error PlatformiOSSimulator::ResolveExecutable( +Status PlatformiOSSimulator::ResolveExecutable( const ModuleSpec &module_spec, lldb::ModuleSP &exe_module_sp, const FileSpecList *module_search_paths_ptr) { - Error error; + Status error; // Nothing special to do here, just use the actual file and architecture ModuleSpec resolved_module_spec(module_spec); @@ -306,10 +306,10 @@ const char *PlatformiOSSimulator::GetSDKDirectoryAsCString() { return NULL; } -Error PlatformiOSSimulator::GetSymbolFile(const FileSpec &platform_file, - const UUID *uuid_ptr, - FileSpec &local_file) { - Error error; +Status PlatformiOSSimulator::GetSymbolFile(const FileSpec &platform_file, + const UUID *uuid_ptr, + FileSpec &local_file) { + Status error; char platform_file_path[PATH_MAX]; if (platform_file.GetPath(platform_file_path, sizeof(platform_file_path))) { char resolved_path[PATH_MAX]; @@ -338,7 +338,7 @@ Error PlatformiOSSimulator::GetSymbolFile(const FileSpec &platform_file, return error; } -Error PlatformiOSSimulator::GetSharedModule( +Status PlatformiOSSimulator::GetSharedModule( const ModuleSpec &module_spec, Process *process, ModuleSP &module_sp, const FileSpecList *module_search_paths_ptr, ModuleSP *old_module_sp_ptr, bool *did_create_ptr) { @@ -346,7 +346,7 @@ Error PlatformiOSSimulator::GetSharedModule( // system. So first we ask for the file in the cached SDK, // then we attempt to get a shared module for the right architecture // with the right UUID. - Error error; + Status error; ModuleSpec platform_module_spec(module_spec); const FileSpec &platform_file = module_spec.GetFileSpec(); error = GetSymbolFile(platform_file, module_spec.GetUUIDPtr(), diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.h b/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.h index c8c7872b530..2d81d6229f7 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.h +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.h @@ -51,7 +51,7 @@ public: //------------------------------------------------------------ // lldb_private::Platform functions //------------------------------------------------------------ - lldb_private::Error ResolveExecutable( + lldb_private::Status ResolveExecutable( const lldb_private::ModuleSpec &module_spec, lldb::ModuleSP &module_sp, const lldb_private::FileSpecList *module_search_paths_ptr) override; @@ -59,12 +59,12 @@ public: void GetStatus(lldb_private::Stream &strm) override; - virtual lldb_private::Error + virtual lldb_private::Status GetSymbolFile(const lldb_private::FileSpec &platform_file, const lldb_private::UUID *uuid_ptr, lldb_private::FileSpec &local_file); - lldb_private::Error + lldb_private::Status GetSharedModule(const lldb_private::ModuleSpec &module_spec, lldb_private::Process *process, lldb::ModuleSP &module_sp, const lldb_private::FileSpecList *module_search_paths_ptr, diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulatorCoreSimulatorSupport.h b/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulatorCoreSimulatorSupport.h index 2a2a6f73a0e..31e11a60e41 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulatorCoreSimulatorSupport.h +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulatorCoreSimulatorSupport.h @@ -27,7 +27,7 @@ typedef void *id; #include "lldb/Interpreter/Args.h" #include "lldb/Target/ProcessLaunchInfo.h" #include "lldb/Utility/ConstString.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "llvm/ADT/Optional.h" @@ -39,17 +39,17 @@ public: explicit operator bool() { return m_pid != LLDB_INVALID_PROCESS_ID; } - lldb_private::Error GetError() { return m_error; } + lldb_private::Status GetError() { return m_error; } private: Process(lldb::pid_t p); - Process(lldb_private::Error error); + Process(lldb_private::Status error); - Process(lldb::pid_t p, lldb_private::Error error); + Process(lldb::pid_t p, lldb_private::Status error); lldb::pid_t m_pid; - lldb_private::Error m_error; + lldb_private::Status m_error; friend class Device; }; @@ -165,9 +165,9 @@ public: State GetState(); - bool Boot(lldb_private::Error &err); + bool Boot(lldb_private::Status &err); - bool Shutdown(lldb_private::Error &err); + bool Shutdown(lldb_private::Status &err); std::string GetUDID() const; diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulatorCoreSimulatorSupport.mm b/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulatorCoreSimulatorSupport.mm index de92aa0de7a..6a49b645c1e 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulatorCoreSimulatorSupport.mm +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulatorCoreSimulatorSupport.mm @@ -61,10 +61,10 @@ using namespace lldb_utility; CoreSimulatorSupport::Process::Process(lldb::pid_t p) : m_pid(p), m_error() {} -CoreSimulatorSupport::Process::Process(Error error) +CoreSimulatorSupport::Process::Process(Status error) : m_pid(LLDB_INVALID_PROCESS_ID), m_error(error) {} -CoreSimulatorSupport::Process::Process(lldb::pid_t p, Error error) +CoreSimulatorSupport::Process::Process(lldb::pid_t p, Status error) : m_pid(p), m_error(error) {} CoreSimulatorSupport::DeviceType::DeviceType() @@ -345,7 +345,7 @@ operator!=(const CoreSimulatorSupport::ModelIdentifier &lhs, return false; } -bool CoreSimulatorSupport::Device::Boot(Error &err) { +bool CoreSimulatorSupport::Device::Boot(Status &err) { if (m_dev == nil) { err.SetErrorString("no valid simulator instance"); return false; @@ -371,7 +371,7 @@ bool CoreSimulatorSupport::Device::Boot(Error &err) { } } -bool CoreSimulatorSupport::Device::Shutdown(Error &err) { +bool CoreSimulatorSupport::Device::Shutdown(Status &err) { NSError *nserror; if ([m_dev shutdownWithError:&nserror]) { err.Clear(); @@ -382,10 +382,10 @@ bool CoreSimulatorSupport::Device::Shutdown(Error &err) { } } -static Error HandleFileAction(ProcessLaunchInfo &launch_info, - NSMutableDictionary *options, NSString *key, - const int fd, File &file) { - Error error; +static Status HandleFileAction(ProcessLaunchInfo &launch_info, + NSMutableDictionary *options, NSString *key, + const int fd, File &file) { + Status error; const FileAction *file_action = launch_info.GetFileActionForFD(fd); if (file_action) { switch (file_action->GetAction()) { @@ -426,7 +426,7 @@ static Error HandleFileAction(ProcessLaunchInfo &launch_info, } } } - Error posix_error; + Status posix_error; int created_fd = open(file_spec.GetPath().c_str(), file_action->GetActionArgument(), S_IRUSR | S_IWUSR); @@ -499,7 +499,7 @@ CoreSimulatorSupport::Device::Spawn(ProcessLaunchInfo &launch_info) { [options setObject:env_dict forKey:kSimDeviceSpawnEnvironment]; } - Error error; + Status error; File stdin_file; File stdout_file; File stderr_file; diff --git a/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp b/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp index 409f12deefc..9df5b9fac38 100644 --- a/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp +++ b/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp @@ -25,9 +25,9 @@ #include "lldb/Host/HostInfo.h" #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/StreamString.h" // Define these constants from NetBSD mman.h for use when targeting @@ -262,11 +262,11 @@ bool PlatformNetBSD::CanDebugProcess() { // lldb-launch, llgs-attach. This differs from current lldb-launch, // debugserver-attach // approach on MacOSX. -lldb::ProcessSP -PlatformNetBSD::DebugProcess(ProcessLaunchInfo &launch_info, Debugger &debugger, - Target *target, // Can be NULL, if NULL create a new - // target, else use existing one - Error &error) { +lldb::ProcessSP PlatformNetBSD::DebugProcess( + ProcessLaunchInfo &launch_info, Debugger &debugger, + Target *target, // Can be NULL, if NULL create a new + // target, else use existing one + Status &error) { Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); if (log) log->Printf("PlatformNetBSD::%s entered (target %p)", __FUNCTION__, diff --git a/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.h b/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.h index 500c61dab97..b1aaa4ab5f5 100644 --- a/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.h +++ b/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.h @@ -55,7 +55,7 @@ public: lldb::ProcessSP DebugProcess(ProcessLaunchInfo &launch_info, Debugger &debugger, Target *target, - Error &error) override; + Status &error) override; void CalculateTrapHandlerSymbolNames() override; diff --git a/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp b/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp index e3816d0276b..edb8ec951d3 100644 --- a/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp +++ b/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp @@ -25,9 +25,9 @@ #include "lldb/Host/HostInfo.h" #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/StreamString.h" // Define these constants from OpenBSD mman.h for use when targeting diff --git a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp index 0032c804987..f4cf22ad758 100644 --- a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp +++ b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp @@ -88,7 +88,7 @@ bool PlatformPOSIX::IsConnected() const { return false; } -lldb_private::Error PlatformPOSIX::RunShellCommand( +lldb_private::Status PlatformPOSIX::RunShellCommand( const char *command, // Shouldn't be NULL const FileSpec & working_dir, // Pass empty FileSpec to use the current working directory @@ -109,14 +109,15 @@ lldb_private::Error PlatformPOSIX::RunShellCommand( status_ptr, signo_ptr, command_output, timeout_sec); else - return Error("unable to run a remote command without a platform"); + return Status("unable to run a remote command without a platform"); } } -Error PlatformPOSIX::ResolveExecutable(const ModuleSpec &module_spec, - lldb::ModuleSP &exe_module_sp, - const FileSpecList *module_search_paths_ptr) { - Error error; +Status +PlatformPOSIX::ResolveExecutable(const ModuleSpec &module_spec, + lldb::ModuleSP &exe_module_sp, + const FileSpecList *module_search_paths_ptr) { + Status error; // Nothing special to do here, just use the actual file and architecture char exe_path[PATH_MAX]; @@ -250,16 +251,16 @@ Error PlatformPOSIX::ResolveExecutable(const ModuleSpec &module_spec, return error; } -Error PlatformPOSIX::GetFileWithUUID(const FileSpec &platform_file, - const UUID *uuid_ptr, - FileSpec &local_file) { +Status PlatformPOSIX::GetFileWithUUID(const FileSpec &platform_file, + const UUID *uuid_ptr, + FileSpec &local_file) { if (IsRemote() && m_remote_platform_sp) return m_remote_platform_sp->GetFileWithUUID(platform_file, uuid_ptr, local_file); // Default to the local case local_file = platform_file; - return Error(); + return Status(); } bool PlatformPOSIX::GetProcessInfo(lldb::pid_t pid, @@ -282,16 +283,16 @@ PlatformPOSIX::FindProcesses(const ProcessInstanceInfoMatch &match_info, return 0; } -Error PlatformPOSIX::MakeDirectory(const FileSpec &file_spec, - uint32_t file_permissions) { +Status PlatformPOSIX::MakeDirectory(const FileSpec &file_spec, + uint32_t file_permissions) { if (m_remote_platform_sp) return m_remote_platform_sp->MakeDirectory(file_spec, file_permissions); else return Platform::MakeDirectory(file_spec, file_permissions); } -Error PlatformPOSIX::GetFilePermissions(const FileSpec &file_spec, - uint32_t &file_permissions) { +Status PlatformPOSIX::GetFilePermissions(const FileSpec &file_spec, + uint32_t &file_permissions) { if (m_remote_platform_sp) return m_remote_platform_sp->GetFilePermissions(file_spec, file_permissions); @@ -299,8 +300,8 @@ Error PlatformPOSIX::GetFilePermissions(const FileSpec &file_spec, return Platform::GetFilePermissions(file_spec, file_permissions); } -Error PlatformPOSIX::SetFilePermissions(const FileSpec &file_spec, - uint32_t file_permissions) { +Status PlatformPOSIX::SetFilePermissions(const FileSpec &file_spec, + uint32_t file_permissions) { if (m_remote_platform_sp) return m_remote_platform_sp->SetFilePermissions(file_spec, file_permissions); @@ -310,7 +311,7 @@ Error PlatformPOSIX::SetFilePermissions(const FileSpec &file_spec, lldb::user_id_t PlatformPOSIX::OpenFile(const FileSpec &file_spec, uint32_t flags, uint32_t mode, - Error &error) { + Status &error) { if (IsHost()) return FileCache::GetInstance().OpenFile(file_spec, flags, mode, error); else if (m_remote_platform_sp) @@ -319,7 +320,7 @@ lldb::user_id_t PlatformPOSIX::OpenFile(const FileSpec &file_spec, return Platform::OpenFile(file_spec, flags, mode, error); } -bool PlatformPOSIX::CloseFile(lldb::user_id_t fd, Error &error) { +bool PlatformPOSIX::CloseFile(lldb::user_id_t fd, Status &error) { if (IsHost()) return FileCache::GetInstance().CloseFile(fd, error); else if (m_remote_platform_sp) @@ -329,7 +330,7 @@ bool PlatformPOSIX::CloseFile(lldb::user_id_t fd, Error &error) { } uint64_t PlatformPOSIX::ReadFile(lldb::user_id_t fd, uint64_t offset, void *dst, - uint64_t dst_len, Error &error) { + uint64_t dst_len, Status &error) { if (IsHost()) return FileCache::GetInstance().ReadFile(fd, offset, dst, dst_len, error); else if (m_remote_platform_sp) @@ -340,7 +341,7 @@ uint64_t PlatformPOSIX::ReadFile(lldb::user_id_t fd, uint64_t offset, void *dst, uint64_t PlatformPOSIX::WriteFile(lldb::user_id_t fd, uint64_t offset, const void *src, uint64_t src_len, - Error &error) { + Status &error) { if (IsHost()) return FileCache::GetInstance().WriteFile(fd, offset, src, src_len, error); else if (m_remote_platform_sp) @@ -370,7 +371,7 @@ static uint32_t chown_file(Platform *platform, const char *path, return status; } -lldb_private::Error +lldb_private::Status PlatformPOSIX::PutFile(const lldb_private::FileSpec &source, const lldb_private::FileSpec &destination, uint32_t uid, uint32_t gid) { @@ -378,34 +379,34 @@ PlatformPOSIX::PutFile(const lldb_private::FileSpec &source, if (IsHost()) { if (FileSpec::Equal(source, destination, true)) - return Error(); + return Status(); // cp src dst // chown uid:gid dst std::string src_path(source.GetPath()); if (src_path.empty()) - return Error("unable to get file path for source"); + return Status("unable to get file path for source"); std::string dst_path(destination.GetPath()); if (dst_path.empty()) - return Error("unable to get file path for destination"); + return Status("unable to get file path for destination"); StreamString command; command.Printf("cp %s %s", src_path.c_str(), dst_path.c_str()); int status; RunShellCommand(command.GetData(), NULL, &status, NULL, NULL, 10); if (status != 0) - return Error("unable to perform copy"); + return Status("unable to perform copy"); if (uid == UINT32_MAX && gid == UINT32_MAX) - return Error(); + return Status(); if (chown_file(this, dst_path.c_str(), uid, gid) != 0) - return Error("unable to perform chown"); - return Error(); + return Status("unable to perform chown"); + return Status(); } else if (m_remote_platform_sp) { if (GetSupportsRSync()) { std::string src_path(source.GetPath()); if (src_path.empty()) - return Error("unable to get file path for source"); + return Status("unable to get file path for source"); std::string dst_path(destination.GetPath()); if (dst_path.empty()) - return Error("unable to get file path for destination"); + return Status("unable to get file path for destination"); StreamString command; if (GetIgnoresRemoteHostname()) { if (!GetRSyncPrefix()) @@ -424,8 +425,8 @@ PlatformPOSIX::PutFile(const lldb_private::FileSpec &source, if (retcode == 0) { // Don't chown a local file for a remote system // if (chown_file(this,dst_path.c_str(),uid,gid) != 0) - // return Error("unable to perform chown"); - return Error(); + // return Status("unable to perform chown"); + return Status(); } // if we are still here rsync has failed - let's try the slow way before // giving up @@ -446,7 +447,7 @@ lldb::user_id_t PlatformPOSIX::GetFileSize(const FileSpec &file_spec) { return Platform::GetFileSize(file_spec); } -Error PlatformPOSIX::CreateSymlink(const FileSpec &src, const FileSpec &dst) { +Status PlatformPOSIX::CreateSymlink(const FileSpec &src, const FileSpec &dst) { if (IsHost()) return FileSystem::Symlink(src, dst); else if (m_remote_platform_sp) @@ -464,7 +465,7 @@ bool PlatformPOSIX::GetFileExists(const FileSpec &file_spec) { return Platform::GetFileExists(file_spec); } -Error PlatformPOSIX::Unlink(const FileSpec &file_spec) { +Status PlatformPOSIX::Unlink(const FileSpec &file_spec) { if (IsHost()) return llvm::sys::fs::remove(file_spec.GetPath()); else if (m_remote_platform_sp) @@ -473,7 +474,7 @@ Error PlatformPOSIX::Unlink(const FileSpec &file_spec) { return Platform::Unlink(file_spec); } -lldb_private::Error PlatformPOSIX::GetFile( +lldb_private::Status PlatformPOSIX::GetFile( const lldb_private::FileSpec &source, // remote file path const lldb_private::FileSpec &destination) // local file path { @@ -482,22 +483,22 @@ lldb_private::Error PlatformPOSIX::GetFile( // Check the args, first. std::string src_path(source.GetPath()); if (src_path.empty()) - return Error("unable to get file path for source"); + return Status("unable to get file path for source"); std::string dst_path(destination.GetPath()); if (dst_path.empty()) - return Error("unable to get file path for destination"); + return Status("unable to get file path for destination"); if (IsHost()) { if (FileSpec::Equal(source, destination, true)) - return Error("local scenario->source and destination are the same file " - "path: no operation performed"); + return Status("local scenario->source and destination are the same file " + "path: no operation performed"); // cp src dst StreamString cp_command; cp_command.Printf("cp %s %s", src_path.c_str(), dst_path.c_str()); int status; RunShellCommand(cp_command.GetData(), NULL, &status, NULL, NULL, 10); if (status != 0) - return Error("unable to perform copy"); - return Error(); + return Status("unable to perform copy"); + return Status(); } else if (m_remote_platform_sp) { if (GetSupportsRSync()) { StreamString command; @@ -517,7 +518,7 @@ lldb_private::Error PlatformPOSIX::GetFile( int retcode; Host::RunShellCommand(command.GetData(), NULL, &retcode, NULL, NULL, 60); if (retcode == 0) - return Error(); + return Status(); // If we are here, rsync has failed - let's try the slow way before giving // up } @@ -527,12 +528,12 @@ lldb_private::Error PlatformPOSIX::GetFile( // close dst if (log) log->Printf("[GetFile] Using block by block transfer....\n"); - Error error; + Status error; user_id_t fd_src = OpenFile(source, File::eOpenOptionRead, lldb::eFilePermissionsFileDefault, error); if (fd_src == UINT64_MAX) - return Error("unable to open source file"); + return Status("unable to open source file"); uint32_t permissions = 0; error = GetFilePermissions(source, permissions); @@ -710,8 +711,8 @@ const char *PlatformPOSIX::GetGroupName(uint32_t gid) { return NULL; } -Error PlatformPOSIX::ConnectRemote(Args &args) { - Error error; +Status PlatformPOSIX::ConnectRemote(Args &args) { + Status error; if (IsHost()) { error.SetErrorStringWithFormat( "can't connect to the host platform '%s', always connected", @@ -753,8 +754,8 @@ Error PlatformPOSIX::ConnectRemote(Args &args) { return error; } -Error PlatformPOSIX::DisconnectRemote() { - Error error; +Status PlatformPOSIX::DisconnectRemote() { + Status error; if (IsHost()) { error.SetErrorStringWithFormat( @@ -769,8 +770,8 @@ Error PlatformPOSIX::DisconnectRemote() { return error; } -Error PlatformPOSIX::LaunchProcess(ProcessLaunchInfo &launch_info) { - Error error; +Status PlatformPOSIX::LaunchProcess(ProcessLaunchInfo &launch_info) { + Status error; if (IsHost()) { error = Platform::LaunchProcess(launch_info); @@ -783,19 +784,19 @@ Error PlatformPOSIX::LaunchProcess(ProcessLaunchInfo &launch_info) { return error; } -lldb_private::Error PlatformPOSIX::KillProcess(const lldb::pid_t pid) { +lldb_private::Status PlatformPOSIX::KillProcess(const lldb::pid_t pid) { if (IsHost()) return Platform::KillProcess(pid); if (m_remote_platform_sp) return m_remote_platform_sp->KillProcess(pid); - return Error("the platform is not currently connected"); + return Status("the platform is not currently connected"); } lldb::ProcessSP PlatformPOSIX::Attach(ProcessAttachInfo &attach_info, Debugger &debugger, Target *target, - Error &error) { + Status &error) { lldb::ProcessSP process_sp; Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM)); @@ -855,7 +856,7 @@ lldb::ProcessSP PlatformPOSIX::DebugProcess(ProcessLaunchInfo &launch_info, Debugger &debugger, Target *target, // Can be NULL, if NULL create a new // target, else use existing one - Error &error) { + Status &error) { ProcessSP process_sp; if (IsHost()) { @@ -881,23 +882,23 @@ void PlatformPOSIX::CalculateTrapHandlerSymbolNames() { m_trap_handlers.push_back(ConstString("_sigtramp")); } -Error PlatformPOSIX::EvaluateLibdlExpression( +Status PlatformPOSIX::EvaluateLibdlExpression( lldb_private::Process *process, const char *expr_cstr, const char *expr_prefix, lldb::ValueObjectSP &result_valobj_sp) { DynamicLoader *loader = process->GetDynamicLoader(); if (loader) { - Error error = loader->CanLoadImage(); + Status error = loader->CanLoadImage(); if (error.Fail()) return error; } ThreadSP thread_sp(process->GetThreadList().GetExpressionExecutionThread()); if (!thread_sp) - return Error("Selected thread isn't valid"); + return Status("Selected thread isn't valid"); StackFrameSP frame_sp(thread_sp->GetStackFrameAtIndex(0)); if (!frame_sp) - return Error("Frame 0 isn't valid"); + return Status("Frame 0 isn't valid"); ExecutionContext exe_ctx; frame_sp->CalculateExecutionContext(exe_ctx); @@ -910,7 +911,7 @@ Error PlatformPOSIX::EvaluateLibdlExpression( // don't do the work to trap them. expr_options.SetTimeout(std::chrono::seconds(2)); - Error expr_error; + Status expr_error; ExpressionResults result = UserExpression::Evaluate(exe_ctx, expr_options, expr_cstr, expr_prefix, result_valobj_sp, expr_error); @@ -919,12 +920,12 @@ Error PlatformPOSIX::EvaluateLibdlExpression( if (result_valobj_sp->GetError().Fail()) return result_valobj_sp->GetError(); - return Error(); + return Status(); } uint32_t PlatformPOSIX::DoLoadImage(lldb_private::Process *process, const lldb_private::FileSpec &remote_file, - lldb_private::Error &error) { + lldb_private::Status &error) { char path[PATH_MAX]; remote_file.GetPath(path, sizeof(path)); @@ -983,18 +984,18 @@ uint32_t PlatformPOSIX::DoLoadImage(lldb_private::Process *process, return LLDB_INVALID_IMAGE_TOKEN; } -Error PlatformPOSIX::UnloadImage(lldb_private::Process *process, - uint32_t image_token) { +Status PlatformPOSIX::UnloadImage(lldb_private::Process *process, + uint32_t image_token) { const addr_t image_addr = process->GetImagePtrFromToken(image_token); if (image_addr == LLDB_INVALID_ADDRESS) - return Error("Invalid image token"); + return Status("Invalid image token"); StreamString expr; expr.Printf("dlclose((void *)0x%" PRIx64 ")", image_addr); const char *prefix = GetLibdlFunctionDeclarations(); lldb::ValueObjectSP result_valobj_sp; - Error error = EvaluateLibdlExpression(process, expr.GetData(), prefix, - result_valobj_sp); + Status error = EvaluateLibdlExpression(process, expr.GetData(), prefix, + result_valobj_sp); if (error.Fail()) return error; @@ -1004,17 +1005,17 @@ Error PlatformPOSIX::UnloadImage(lldb_private::Process *process, Scalar scalar; if (result_valobj_sp->ResolveValue(scalar)) { if (scalar.UInt(1)) - return Error("expression failed: \"%s\"", expr.GetData()); + return Status("expression failed: \"%s\"", expr.GetData()); process->ResetImageToken(image_token); } - return Error(); + return Status(); } lldb::ProcessSP PlatformPOSIX::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) { if (m_remote_platform_sp) return m_remote_platform_sp->ConnectProcess(connect_url, plugin_name, debugger, target, error); @@ -1033,7 +1034,7 @@ const char *PlatformPOSIX::GetLibdlFunctionDeclarations() const { } size_t PlatformPOSIX::ConnectToWaitingProcesses(Debugger &debugger, - Error &error) { + Status &error) { if (m_remote_platform_sp) return m_remote_platform_sp->ConnectToWaitingProcesses(debugger, error); return Platform::ConnectToWaitingProcesses(debugger, error); diff --git a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.h b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.h index 6c5c62797a6..742702b07b8 100644 --- a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.h +++ b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.h @@ -43,29 +43,30 @@ public: const char *GetGroupName(uint32_t gid) override; - lldb_private::Error PutFile(const lldb_private::FileSpec &source, - const lldb_private::FileSpec &destination, - uint32_t uid = UINT32_MAX, - uint32_t gid = UINT32_MAX) override; + lldb_private::Status PutFile(const lldb_private::FileSpec &source, + const lldb_private::FileSpec &destination, + uint32_t uid = UINT32_MAX, + uint32_t gid = UINT32_MAX) override; lldb::user_id_t OpenFile(const lldb_private::FileSpec &file_spec, uint32_t flags, uint32_t mode, - lldb_private::Error &error) override; + lldb_private::Status &error) override; - bool CloseFile(lldb::user_id_t fd, lldb_private::Error &error) override; + bool CloseFile(lldb::user_id_t fd, lldb_private::Status &error) override; uint64_t ReadFile(lldb::user_id_t fd, uint64_t offset, void *dst, - uint64_t dst_len, lldb_private::Error &error) override; + uint64_t dst_len, lldb_private::Status &error) override; uint64_t WriteFile(lldb::user_id_t fd, uint64_t offset, const void *src, - uint64_t src_len, lldb_private::Error &error) override; + uint64_t src_len, lldb_private::Status &error) override; lldb::user_id_t GetFileSize(const lldb_private::FileSpec &file_spec) override; - lldb_private::Error CreateSymlink(const lldb_private::FileSpec &src, - const lldb_private::FileSpec &dst) override; + lldb_private::Status + CreateSymlink(const lldb_private::FileSpec &src, + const lldb_private::FileSpec &dst) override; - lldb_private::Error + lldb_private::Status GetFile(const lldb_private::FileSpec &source, const lldb_private::FileSpec &destination) override; @@ -88,7 +89,7 @@ public: bool IsConnected() const override; - lldb_private::Error RunShellCommand( + lldb_private::Status RunShellCommand( const char *command, // Shouldn't be nullptr const lldb_private::FileSpec &working_dir, // Pass empty FileSpec to use // the current working @@ -101,37 +102,39 @@ public: uint32_t timeout_sec) override; // Timeout in seconds to wait for shell program to finish - lldb_private::Error ResolveExecutable(const lldb_private::ModuleSpec &module_spec, - lldb::ModuleSP &module_sp, + lldb_private::Status ResolveExecutable( + const lldb_private::ModuleSpec &module_spec, lldb::ModuleSP &module_sp, const lldb_private::FileSpecList *module_search_paths_ptr) override; - lldb_private::Error GetFileWithUUID(const lldb_private::FileSpec &platform_file, const lldb_private::UUID *uuid, - lldb_private::FileSpec &local_file) override; + lldb_private::Status + GetFileWithUUID(const lldb_private::FileSpec &platform_file, + const lldb_private::UUID *uuid, + lldb_private::FileSpec &local_file) override; bool GetProcessInfo(lldb::pid_t pid, lldb_private::ProcessInstanceInfo &proc_info) override; uint32_t FindProcesses(const lldb_private::ProcessInstanceInfoMatch &match_info, lldb_private::ProcessInstanceInfoList &process_infos) override; - lldb_private::Error MakeDirectory(const lldb_private::FileSpec &file_spec, - uint32_t mode) override; + lldb_private::Status MakeDirectory(const lldb_private::FileSpec &file_spec, + uint32_t mode) override; - lldb_private::Error + lldb_private::Status GetFilePermissions(const lldb_private::FileSpec &file_spec, uint32_t &file_permissions) override; - lldb_private::Error + lldb_private::Status SetFilePermissions(const lldb_private::FileSpec &file_spec, uint32_t file_permissions) override; bool GetFileExists(const lldb_private::FileSpec &file_spec) override; - lldb_private::Error Unlink(const lldb_private::FileSpec &file_spec) override; + lldb_private::Status Unlink(const lldb_private::FileSpec &file_spec) override; - lldb_private::Error + lldb_private::Status LaunchProcess(lldb_private::ProcessLaunchInfo &launch_info) override; - lldb_private::Error KillProcess(const lldb::pid_t pid) override; + lldb_private::Status KillProcess(const lldb::pid_t pid) override; lldb::ProcessSP Attach(lldb_private::ProcessAttachInfo &attach_info, lldb_private::Debugger &debugger, @@ -139,7 +142,7 @@ public: // nullptr create a new // target, else use // existing one - lldb_private::Error &error) override; + lldb_private::Status &error) override; lldb::ProcessSP DebugProcess(lldb_private::ProcessLaunchInfo &launch_info, lldb_private::Debugger &debugger, @@ -148,7 +151,7 @@ public: // create a new // target, else use // existing one - lldb_private::Error &error) override; + lldb_private::Status &error) override; std::string GetPlatformSpecificConnectionInformation() override; @@ -157,25 +160,25 @@ public: void CalculateTrapHandlerSymbolNames() override; - lldb_private::Error ConnectRemote(lldb_private::Args &args) override; + lldb_private::Status ConnectRemote(lldb_private::Args &args) override; - lldb_private::Error DisconnectRemote() override; + lldb_private::Status DisconnectRemote() override; uint32_t DoLoadImage(lldb_private::Process *process, const lldb_private::FileSpec &remote_file, - lldb_private::Error &error) override; + lldb_private::Status &error) override; - lldb_private::Error UnloadImage(lldb_private::Process *process, - uint32_t image_token) override; + lldb_private::Status UnloadImage(lldb_private::Process *process, + uint32_t image_token) override; lldb::ProcessSP ConnectProcess(llvm::StringRef connect_url, llvm::StringRef plugin_name, lldb_private::Debugger &debugger, lldb_private::Target *target, - lldb_private::Error &error) override; + lldb_private::Status &error) override; size_t ConnectToWaitingProcesses(lldb_private::Debugger &debugger, - lldb_private::Error &error) override; + lldb_private::Status &error) override; lldb_private::ConstString GetFullNameForDylib(lldb_private::ConstString basename) override; @@ -193,7 +196,7 @@ protected: lldb::PlatformSP m_remote_platform_sp; // Allow multiple ways to connect to a // remote POSIX-compliant OS - lldb_private::Error + lldb_private::Status EvaluateLibdlExpression(lldb_private::Process *process, const char *expr_cstr, const char *expr_prefix, lldb::ValueObjectSP &result_valobj_sp); diff --git a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp index f57842ee6e5..3535df0c65c 100644 --- a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp +++ b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp @@ -27,7 +27,7 @@ #include "lldb/Core/PluginManager.h" #include "lldb/Host/HostInfo.h" #include "lldb/Target/Process.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" using namespace lldb; using namespace lldb_private; @@ -180,10 +180,10 @@ bool PlatformWindows::GetModuleSpec(const FileSpec &module_file_spec, return Platform::GetModuleSpec(module_file_spec, arch, module_spec); } -Error PlatformWindows::ResolveExecutable( +Status PlatformWindows::ResolveExecutable( const ModuleSpec &ms, lldb::ModuleSP &exe_module_sp, const FileSpecList *module_search_paths_ptr) { - Error error; + Status error; // Nothing special to do here, just use the actual file and architecture char exe_path[PATH_MAX]; @@ -323,8 +323,8 @@ bool PlatformWindows::IsConnected() const { return false; } -Error PlatformWindows::ConnectRemote(Args &args) { - Error error; +Status PlatformWindows::ConnectRemote(Args &args) { + Status error; if (IsHost()) { error.SetErrorStringWithFormat( "can't connect to the host platform '%s', always connected", @@ -353,8 +353,8 @@ Error PlatformWindows::ConnectRemote(Args &args) { return error; } -Error PlatformWindows::DisconnectRemote() { - Error error; +Status PlatformWindows::DisconnectRemote() { + Status error; if (IsHost()) { error.SetErrorStringWithFormat( @@ -396,8 +396,8 @@ PlatformWindows::FindProcesses(const ProcessInstanceInfoMatch &match_info, return match_count; } -Error PlatformWindows::LaunchProcess(ProcessLaunchInfo &launch_info) { - Error error; +Status PlatformWindows::LaunchProcess(ProcessLaunchInfo &launch_info) { + Status error; if (IsHost()) { error = Platform::LaunchProcess(launch_info); } else { @@ -411,7 +411,7 @@ Error PlatformWindows::LaunchProcess(ProcessLaunchInfo &launch_info) { ProcessSP PlatformWindows::DebugProcess(ProcessLaunchInfo &launch_info, Debugger &debugger, Target *target, - Error &error) { + Status &error) { // Windows has special considerations that must be followed when launching or // attaching to a process. The // key requirement is that when launching or attaching to a process, you must @@ -457,7 +457,7 @@ ProcessSP PlatformWindows::DebugProcess(ProcessLaunchInfo &launch_info, lldb::ProcessSP PlatformWindows::Attach(ProcessAttachInfo &attach_info, Debugger &debugger, Target *target, - Error &error) { + Status &error) { error.Clear(); lldb::ProcessSP process_sp; if (!IsHost()) { @@ -516,9 +516,9 @@ const char *PlatformWindows::GetGroupName(uint32_t gid) { return nullptr; } -Error PlatformWindows::GetFileWithUUID(const FileSpec &platform_file, - const UUID *uuid_ptr, - FileSpec &local_file) { +Status PlatformWindows::GetFileWithUUID(const FileSpec &platform_file, + const UUID *uuid_ptr, + FileSpec &local_file) { if (IsRemote()) { if (m_remote_platform_sp) return m_remote_platform_sp->GetFileWithUUID(platform_file, uuid_ptr, @@ -527,14 +527,14 @@ Error PlatformWindows::GetFileWithUUID(const FileSpec &platform_file, // Default to the local case local_file = platform_file; - return Error(); + return Status(); } -Error PlatformWindows::GetSharedModule( +Status PlatformWindows::GetSharedModule( const ModuleSpec &module_spec, Process *process, ModuleSP &module_sp, const FileSpecList *module_search_paths_ptr, ModuleSP *old_module_sp_ptr, bool *did_create_ptr) { - Error error; + Status error; module_sp.reset(); if (IsRemote()) { diff --git a/lldb/source/Plugins/Platform/Windows/PlatformWindows.h b/lldb/source/Plugins/Platform/Windows/PlatformWindows.h index 375d5c5dad2..9af42116680 100644 --- a/lldb/source/Plugins/Platform/Windows/PlatformWindows.h +++ b/lldb/source/Plugins/Platform/Windows/PlatformWindows.h @@ -49,9 +49,10 @@ public: const lldb_private::ArchSpec &arch, lldb_private::ModuleSpec &module_spec) override; - Error ResolveExecutable(const lldb_private::ModuleSpec &module_spec, - lldb::ModuleSP &module_sp, - const FileSpecList *module_search_paths_ptr) override; + Status + ResolveExecutable(const lldb_private::ModuleSpec &module_spec, + lldb::ModuleSP &module_sp, + const FileSpecList *module_search_paths_ptr) override; const char *GetDescription() override { return GetPluginDescriptionStatic(IsHost()); @@ -68,9 +69,9 @@ public: bool IsConnected() const override; - lldb_private::Error ConnectRemote(lldb_private::Args &args) override; + lldb_private::Status ConnectRemote(lldb_private::Args &args) override; - lldb_private::Error DisconnectRemote() override; + lldb_private::Status DisconnectRemote() override; const char *GetHostname() override; @@ -85,25 +86,25 @@ public: FindProcesses(const lldb_private::ProcessInstanceInfoMatch &match_info, lldb_private::ProcessInstanceInfoList &process_infos) override; - lldb_private::Error + lldb_private::Status LaunchProcess(lldb_private::ProcessLaunchInfo &launch_info) override; lldb::ProcessSP DebugProcess(lldb_private::ProcessLaunchInfo &launch_info, lldb_private::Debugger &debugger, lldb_private::Target *target, - lldb_private::Error &error) override; + lldb_private::Status &error) override; lldb::ProcessSP Attach(lldb_private::ProcessAttachInfo &attach_info, lldb_private::Debugger &debugger, lldb_private::Target *target, - lldb_private::Error &error) override; + lldb_private::Status &error) override; - lldb_private::Error + lldb_private::Status GetFileWithUUID(const lldb_private::FileSpec &platform_file, const lldb_private::UUID *uuid, lldb_private::FileSpec &local_file) override; - lldb_private::Error + lldb_private::Status GetSharedModule(const lldb_private::ModuleSpec &module_spec, lldb_private::Process *process, lldb::ModuleSP &module_sp, const lldb_private::FileSpecList *module_search_paths_ptr, diff --git a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp index 218c6286011..82c4efd8086 100644 --- a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp +++ b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp @@ -25,9 +25,9 @@ #include "lldb/Host/HostInfo.h" #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/StreamString.h" #include "lldb/Utility/UriParser.h" @@ -93,12 +93,12 @@ const char *PlatformRemoteGDBServer::GetDescription() { return GetDescriptionStatic(); } -Error PlatformRemoteGDBServer::ResolveExecutable( +Status PlatformRemoteGDBServer::ResolveExecutable( const ModuleSpec &module_spec, lldb::ModuleSP &exe_module_sp, const FileSpecList *module_search_paths_ptr) { // copied from PlatformRemoteiOS - Error error; + Status error; // Nothing special to do here, just use the actual file and architecture ModuleSpec resolved_module_spec(module_spec); @@ -189,12 +189,12 @@ bool PlatformRemoteGDBServer::GetModuleSpec(const FileSpec &module_file_spec, return true; } -Error PlatformRemoteGDBServer::GetFileWithUUID(const FileSpec &platform_file, - const UUID *uuid_ptr, - FileSpec &local_file) { +Status PlatformRemoteGDBServer::GetFileWithUUID(const FileSpec &platform_file, + const UUID *uuid_ptr, + FileSpec &local_file) { // Default to the local case local_file = platform_file; - return Error(); + return Status(); } //------------------------------------------------------------------ @@ -291,8 +291,8 @@ bool PlatformRemoteGDBServer::IsConnected() const { return m_gdb_client.IsConnected(); } -Error PlatformRemoteGDBServer::ConnectRemote(Args &args) { - Error error; +Status PlatformRemoteGDBServer::ConnectRemote(Args &args) { + Status error; if (IsConnected()) { error.SetErrorStringWithFormat("the platform is already connected to '%s', " "execute 'platform disconnect' to close the " @@ -306,10 +306,10 @@ Error PlatformRemoteGDBServer::ConnectRemote(Args &args) { std::string path; const char *url = args.GetArgumentAtIndex(0); if (!url) - return Error("URL is null."); + return Status("URL is null."); llvm::StringRef scheme, hostname, pathname; if (!UriParser::Parse(url, scheme, hostname, port, pathname)) - return Error("Invalid URL: %s", url); + return Status("Invalid URL: %s", url); m_platform_scheme = scheme; m_platform_hostname = hostname; path = pathname; @@ -336,8 +336,8 @@ Error PlatformRemoteGDBServer::ConnectRemote(Args &args) { return error; } -Error PlatformRemoteGDBServer::DisconnectRemote() { - Error error; +Status PlatformRemoteGDBServer::DisconnectRemote() { + Status error; m_gdb_client.Disconnect(&error); m_remote_signals_sp.reset(); return error; @@ -386,9 +386,9 @@ bool PlatformRemoteGDBServer::GetProcessInfo( return m_gdb_client.GetProcessInfo(pid, process_info); } -Error PlatformRemoteGDBServer::LaunchProcess(ProcessLaunchInfo &launch_info) { +Status PlatformRemoteGDBServer::LaunchProcess(ProcessLaunchInfo &launch_info) { Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); - Error error; + Status error; if (log) log->Printf("PlatformRemoteGDBServer::%s() called", __FUNCTION__); @@ -480,17 +480,17 @@ Error PlatformRemoteGDBServer::LaunchProcess(ProcessLaunchInfo &launch_info) { return error; } -Error PlatformRemoteGDBServer::KillProcess(const lldb::pid_t pid) { +Status PlatformRemoteGDBServer::KillProcess(const lldb::pid_t pid) { if (!KillSpawnedProcess(pid)) - return Error("failed to kill remote spawned process"); - return Error(); + return Status("failed to kill remote spawned process"); + return Status(); } lldb::ProcessSP PlatformRemoteGDBServer::DebugProcess( ProcessLaunchInfo &launch_info, Debugger &debugger, Target *target, // Can be NULL, if NULL create a new target, else use // existing one - Error &error) { + Status &error) { lldb::ProcessSP process_sp; if (IsRemote()) { if (IsConnected()) { @@ -577,7 +577,7 @@ lldb::ProcessSP PlatformRemoteGDBServer::Attach( ProcessAttachInfo &attach_info, Debugger &debugger, Target *target, // Can be NULL, if NULL create a new target, else use // existing one - Error &error) { + Status &error) { lldb::ProcessSP process_sp; if (IsRemote()) { if (IsConnected()) { @@ -625,9 +625,9 @@ lldb::ProcessSP PlatformRemoteGDBServer::Attach( return process_sp; } -Error PlatformRemoteGDBServer::MakeDirectory(const FileSpec &file_spec, - uint32_t mode) { - Error error = m_gdb_client.MakeDirectory(file_spec, mode); +Status PlatformRemoteGDBServer::MakeDirectory(const FileSpec &file_spec, + uint32_t mode) { + Status error = m_gdb_client.MakeDirectory(file_spec, mode); Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM); if (log) log->Printf("PlatformRemoteGDBServer::MakeDirectory(path='%s', mode=%o) " @@ -637,9 +637,9 @@ Error PlatformRemoteGDBServer::MakeDirectory(const FileSpec &file_spec, return error; } -Error PlatformRemoteGDBServer::GetFilePermissions(const FileSpec &file_spec, - uint32_t &file_permissions) { - Error error = m_gdb_client.GetFilePermissions(file_spec, file_permissions); +Status PlatformRemoteGDBServer::GetFilePermissions(const FileSpec &file_spec, + uint32_t &file_permissions) { + Status error = m_gdb_client.GetFilePermissions(file_spec, file_permissions); Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM); if (log) log->Printf("PlatformRemoteGDBServer::GetFilePermissions(path='%s', " @@ -649,9 +649,9 @@ Error PlatformRemoteGDBServer::GetFilePermissions(const FileSpec &file_spec, return error; } -Error PlatformRemoteGDBServer::SetFilePermissions(const FileSpec &file_spec, - uint32_t file_permissions) { - Error error = m_gdb_client.SetFilePermissions(file_spec, file_permissions); +Status PlatformRemoteGDBServer::SetFilePermissions(const FileSpec &file_spec, + uint32_t file_permissions) { + Status error = m_gdb_client.SetFilePermissions(file_spec, file_permissions); Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM); if (log) log->Printf("PlatformRemoteGDBServer::SetFilePermissions(path='%s', " @@ -663,11 +663,11 @@ Error PlatformRemoteGDBServer::SetFilePermissions(const FileSpec &file_spec, lldb::user_id_t PlatformRemoteGDBServer::OpenFile(const FileSpec &file_spec, uint32_t flags, uint32_t mode, - Error &error) { + Status &error) { return m_gdb_client.OpenFile(file_spec, flags, mode, error); } -bool PlatformRemoteGDBServer::CloseFile(lldb::user_id_t fd, Error &error) { +bool PlatformRemoteGDBServer::CloseFile(lldb::user_id_t fd, Status &error) { return m_gdb_client.CloseFile(fd, error); } @@ -678,27 +678,27 @@ PlatformRemoteGDBServer::GetFileSize(const FileSpec &file_spec) { uint64_t PlatformRemoteGDBServer::ReadFile(lldb::user_id_t fd, uint64_t offset, void *dst, uint64_t dst_len, - Error &error) { + Status &error) { return m_gdb_client.ReadFile(fd, offset, dst, dst_len, error); } uint64_t PlatformRemoteGDBServer::WriteFile(lldb::user_id_t fd, uint64_t offset, const void *src, uint64_t src_len, - Error &error) { + Status &error) { return m_gdb_client.WriteFile(fd, offset, src, src_len, error); } -Error PlatformRemoteGDBServer::PutFile(const FileSpec &source, - const FileSpec &destination, - uint32_t uid, uint32_t gid) { +Status PlatformRemoteGDBServer::PutFile(const FileSpec &source, + const FileSpec &destination, + uint32_t uid, uint32_t gid) { return Platform::PutFile(source, destination, uid, gid); } -Error PlatformRemoteGDBServer::CreateSymlink( +Status PlatformRemoteGDBServer::CreateSymlink( const FileSpec &src, // The name of the link is in src const FileSpec &dst) // The symlink points to dst { - Error error = m_gdb_client.CreateSymlink(src, dst); + Status error = m_gdb_client.CreateSymlink(src, dst); Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM); if (log) log->Printf("PlatformRemoteGDBServer::CreateSymlink(src='%s', dst='%s') " @@ -708,8 +708,8 @@ Error PlatformRemoteGDBServer::CreateSymlink( return error; } -Error PlatformRemoteGDBServer::Unlink(const FileSpec &file_spec) { - Error error = m_gdb_client.Unlink(file_spec); +Status PlatformRemoteGDBServer::Unlink(const FileSpec &file_spec) { + Status error = m_gdb_client.Unlink(file_spec); Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM); if (log) log->Printf("PlatformRemoteGDBServer::Unlink(path='%s') error = %u (%s)", @@ -721,7 +721,7 @@ bool PlatformRemoteGDBServer::GetFileExists(const FileSpec &file_spec) { return m_gdb_client.GetFileExists(file_spec); } -Error PlatformRemoteGDBServer::RunShellCommand( +Status PlatformRemoteGDBServer::RunShellCommand( const char *command, // Shouldn't be NULL const FileSpec & working_dir, // Pass empty FileSpec to use the current working directory @@ -852,7 +852,7 @@ std::string PlatformRemoteGDBServer::MakeUrl(const char *scheme, lldb::ProcessSP PlatformRemoteGDBServer::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) { if (!IsRemote() || !IsConnected()) { error.SetErrorString("Not connected to remote gdb server"); return nullptr; @@ -862,7 +862,7 @@ lldb::ProcessSP PlatformRemoteGDBServer::ConnectProcess( } size_t PlatformRemoteGDBServer::ConnectToWaitingProcesses(Debugger &debugger, - Error &error) { + Status &error) { std::vector<std::string> connection_urls; GetPendingGdbServerList(connection_urls); diff --git a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h index edc223a2d7f..210544f752e 100644 --- a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h +++ b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h @@ -50,38 +50,38 @@ public: //------------------------------------------------------------ // lldb_private::Platform functions //------------------------------------------------------------ - Error ResolveExecutable(const ModuleSpec &module_spec, - lldb::ModuleSP &module_sp, - const FileSpecList *module_search_paths_ptr) override; + Status + ResolveExecutable(const ModuleSpec &module_spec, lldb::ModuleSP &module_sp, + const FileSpecList *module_search_paths_ptr) override; bool GetModuleSpec(const FileSpec &module_file_spec, const ArchSpec &arch, ModuleSpec &module_spec) override; const char *GetDescription() override; - Error GetFileWithUUID(const FileSpec &platform_file, const UUID *uuid_ptr, - FileSpec &local_file) override; + Status GetFileWithUUID(const FileSpec &platform_file, const UUID *uuid_ptr, + FileSpec &local_file) override; bool GetProcessInfo(lldb::pid_t pid, ProcessInstanceInfo &proc_info) override; uint32_t FindProcesses(const ProcessInstanceInfoMatch &match_info, ProcessInstanceInfoList &process_infos) override; - Error LaunchProcess(ProcessLaunchInfo &launch_info) override; + Status LaunchProcess(ProcessLaunchInfo &launch_info) override; - Error KillProcess(const lldb::pid_t pid) override; + Status KillProcess(const lldb::pid_t pid) override; lldb::ProcessSP DebugProcess(ProcessLaunchInfo &launch_info, Debugger &debugger, Target *target, // Can be NULL, if NULL create a // new target, else use existing // one - Error &error) override; + Status &error) override; lldb::ProcessSP Attach(ProcessAttachInfo &attach_info, Debugger &debugger, Target *target, // Can be NULL, if NULL create a new // target, else use existing one - Error &error) override; + Status &error) override; bool GetSupportedArchitectureAtIndex(uint32_t idx, ArchSpec &arch) override; @@ -111,42 +111,42 @@ public: bool IsConnected() const override; - Error ConnectRemote(Args &args) override; + Status ConnectRemote(Args &args) override; - Error DisconnectRemote() override; + Status DisconnectRemote() override; - Error MakeDirectory(const FileSpec &file_spec, - uint32_t file_permissions) override; + Status MakeDirectory(const FileSpec &file_spec, + uint32_t file_permissions) override; - Error GetFilePermissions(const FileSpec &file_spec, - uint32_t &file_permissions) override; + Status GetFilePermissions(const FileSpec &file_spec, + uint32_t &file_permissions) override; - Error SetFilePermissions(const FileSpec &file_spec, - uint32_t file_permissions) override; + Status SetFilePermissions(const FileSpec &file_spec, + uint32_t file_permissions) override; lldb::user_id_t OpenFile(const FileSpec &file_spec, uint32_t flags, - uint32_t mode, Error &error) override; + uint32_t mode, Status &error) override; - bool CloseFile(lldb::user_id_t fd, Error &error) override; + bool CloseFile(lldb::user_id_t fd, Status &error) override; uint64_t ReadFile(lldb::user_id_t fd, uint64_t offset, void *data_ptr, - uint64_t len, Error &error) override; + uint64_t len, Status &error) override; uint64_t WriteFile(lldb::user_id_t fd, uint64_t offset, const void *data, - uint64_t len, Error &error) override; + uint64_t len, Status &error) override; lldb::user_id_t GetFileSize(const FileSpec &file_spec) override; - Error PutFile(const FileSpec &source, const FileSpec &destination, - uint32_t uid = UINT32_MAX, uint32_t gid = UINT32_MAX) override; + Status PutFile(const FileSpec &source, const FileSpec &destination, + uint32_t uid = UINT32_MAX, uint32_t gid = UINT32_MAX) override; - Error CreateSymlink(const FileSpec &src, const FileSpec &dst) override; + Status CreateSymlink(const FileSpec &src, const FileSpec &dst) override; bool GetFileExists(const FileSpec &file_spec) override; - Error Unlink(const FileSpec &path) override; + Status Unlink(const FileSpec &path) override; - Error RunShellCommand( + Status RunShellCommand( const char *command, // Shouldn't be NULL const FileSpec &working_dir, // Pass empty FileSpec to use the current // working directory @@ -166,10 +166,10 @@ public: llvm::StringRef plugin_name, lldb_private::Debugger &debugger, lldb_private::Target *target, - lldb_private::Error &error) override; + lldb_private::Status &error) override; size_t ConnectToWaitingProcesses(lldb_private::Debugger &debugger, - lldb_private::Error &error) override; + lldb_private::Status &error) override; virtual size_t GetPendingGdbServerList(std::vector<std::string> &connection_urls); diff --git a/lldb/source/Plugins/Process/Darwin/DarwinProcessLauncher.cpp b/lldb/source/Plugins/Process/Darwin/DarwinProcessLauncher.cpp index feb7a11584f..6845a36730c 100644 --- a/lldb/source/Plugins/Process/Darwin/DarwinProcessLauncher.cpp +++ b/lldb/source/Plugins/Process/Darwin/DarwinProcessLauncher.cpp @@ -32,8 +32,8 @@ #include "lldb/Host/PseudoTerminal.h" #include "lldb/Target/ProcessLaunchInfo.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/StreamString.h" #include "CFBundle.h" @@ -131,10 +131,10 @@ static bool ResolveExecutablePath(const char *path, char *resolved_path, // TODO check if we have a general purpose fork and exec. We may be // able to get rid of this entirely. -static Error ForkChildForPTraceDebugging(const char *path, char const *argv[], - char const *envp[], ::pid_t *pid, - int *pty_fd) { - Error error; +static Status ForkChildForPTraceDebugging(const char *path, char const *argv[], + char const *envp[], ::pid_t *pid, + int *pty_fd) { + Status error; if (!path || !argv || !envp || !pid || !pty_fd) { error.SetErrorString("invalid arguments"); return error; @@ -149,7 +149,7 @@ static Error ForkChildForPTraceDebugging(const char *path, char const *argv[], *pid = static_cast<::pid_t>(pty.Fork(fork_error, sizeof(fork_error))); if (*pid < 0) { //-------------------------------------------------------------- - // Error during fork. + // Status during fork. //-------------------------------------------------------------- *pid = static_cast<::pid_t>(LLDB_INVALID_PROCESS_ID); error.SetErrorStringWithFormat("%s(): fork failed: %s", __FUNCTION__, @@ -205,10 +205,10 @@ static Error ForkChildForPTraceDebugging(const char *path, char const *argv[], return error; } -static Error +static Status CreatePosixSpawnFileAction(const FileAction &action, posix_spawn_file_actions_t *file_actions) { - Error error; + Status error; // Log it. Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); @@ -270,11 +270,11 @@ CreatePosixSpawnFileAction(const FileAction &action, return error; } -static Error PosixSpawnChildForPTraceDebugging(const char *path, - ProcessLaunchInfo &launch_info, - ::pid_t *pid, - cpu_type_t *actual_cpu_type) { - Error error; +static Status PosixSpawnChildForPTraceDebugging(const char *path, + ProcessLaunchInfo &launch_info, + ::pid_t *pid, + cpu_type_t *actual_cpu_type) { + Status error; Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); if (!pid) { @@ -436,9 +436,9 @@ static Error PosixSpawnChildForPTraceDebugging(const char *path, return error; } -Error LaunchInferior(ProcessLaunchInfo &launch_info, int *pty_master_fd, - LaunchFlavor *launch_flavor) { - Error error; +Status LaunchInferior(ProcessLaunchInfo &launch_info, int *pty_master_fd, + LaunchFlavor *launch_flavor) { + Status error; Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); if (!launch_flavor) { diff --git a/lldb/source/Plugins/Process/Darwin/DarwinProcessLauncher.h b/lldb/source/Plugins/Process/Darwin/DarwinProcessLauncher.h index d1af4d09f8b..a0e8ce5cb9d 100644 --- a/lldb/source/Plugins/Process/Darwin/DarwinProcessLauncher.h +++ b/lldb/source/Plugins/Process/Darwin/DarwinProcessLauncher.h @@ -39,8 +39,9 @@ namespace darwin_process_launcher { /// @param[out] launch_flavor /// Contains the launch flavor used when launching the process. // ============================================================================= -Error LaunchInferior(ProcessLaunchInfo &launch_info, int *pty_master_fd, - lldb_private::process_darwin::LaunchFlavor *launch_flavor); +Status +LaunchInferior(ProcessLaunchInfo &launch_info, int *pty_master_fd, + lldb_private::process_darwin::LaunchFlavor *launch_flavor); } // darwin_process_launcher } // lldb_private diff --git a/lldb/source/Plugins/Process/Darwin/MachException.cpp b/lldb/source/Plugins/Process/Darwin/MachException.cpp index 5a97a4b01be..7d956dfc650 100644 --- a/lldb/source/Plugins/Process/Darwin/MachException.cpp +++ b/lldb/source/Plugins/Process/Darwin/MachException.cpp @@ -23,9 +23,9 @@ // LLDB includes #include "lldb/Target/UnixSignals.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/LLDBAssert.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/Stream.h" using namespace lldb; @@ -211,11 +211,11 @@ bool MachException::Data::GetStopInfo(struct ThreadStopInfo *stop_info, return true; } -Error MachException::Message::Receive(mach_port_t port, - mach_msg_option_t options, - mach_msg_timeout_t timeout, - mach_port_t notify_port) { - Error error; +Status MachException::Message::Receive(mach_port_t port, + mach_msg_option_t options, + mach_msg_timeout_t timeout, + mach_port_t notify_port) { + Status error; Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_VERBOSE)); mach_msg_timeout_t mach_msg_timeout = @@ -312,10 +312,10 @@ bool MachException::Message::CatchExceptionRaise(task_t task) { return success; } -Error MachException::Message::Reply(::pid_t inferior_pid, task_t inferior_task, - int signal) { +Status MachException::Message::Reply(::pid_t inferior_pid, task_t inferior_task, + int signal) { // Reply to the exception... - Error error; + Status error; Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_VERBOSE)); @@ -412,8 +412,8 @@ Error MachException::Message::Reply(::pid_t inferior_pid, task_t inferior_task, #define LLDB_EXC_MASK (EXC_MASK_ALL & ~EXC_MASK_RESOURCE) -Error MachException::PortInfo::Save(task_t task) { - Error error; +Status MachException::PortInfo::Save(task_t task) { + Status error; Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_VERBOSE)); if (log) @@ -471,8 +471,8 @@ Error MachException::PortInfo::Save(task_t task) { return error; } -Error MachException::PortInfo::Restore(task_t task) { - Error error; +Status MachException::PortInfo::Restore(task_t task) { + Status error; Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_VERBOSE)); diff --git a/lldb/source/Plugins/Process/Darwin/MachException.h b/lldb/source/Plugins/Process/Darwin/MachException.h index ac8cd7030c5..2da6a36a921 100644 --- a/lldb/source/Plugins/Process/Darwin/MachException.h +++ b/lldb/source/Plugins/Process/Darwin/MachException.h @@ -40,9 +40,9 @@ public: thread_state_flavor_t flavors[EXC_TYPES_COUNT]; mach_msg_type_number_t count; - Error Save(task_t task); + Status Save(task_t task); - Error Restore(task_t task); + Status Restore(task_t task); }; struct Data { @@ -96,11 +96,11 @@ public: bool CatchExceptionRaise(task_t task); - Error Reply(::pid_t inferior_pid, task_t inferior_task, int signal); + Status Reply(::pid_t inferior_pid, task_t inferior_task, int signal); - Error Receive(mach_port_t receive_port, mach_msg_option_t options, - mach_msg_timeout_t timeout, - mach_port_t notify_port = MACH_PORT_NULL); + Status Receive(mach_port_t receive_port, mach_msg_option_t options, + mach_msg_timeout_t timeout, + mach_port_t notify_port = MACH_PORT_NULL); void Dump(Stream &stream) const; diff --git a/lldb/source/Plugins/Process/Darwin/NativeProcessDarwin.cpp b/lldb/source/Plugins/Process/Darwin/NativeProcessDarwin.cpp index 65ab12fe1ad..f6c8c78ccb7 100644 --- a/lldb/source/Plugins/Process/Darwin/NativeProcessDarwin.cpp +++ b/lldb/source/Plugins/Process/Darwin/NativeProcessDarwin.cpp @@ -53,13 +53,13 @@ struct hack_task_dyld_info { // Public Static Methods // ----------------------------------------------------------------------------- -Error NativeProcessProtocol::Launch( +Status NativeProcessProtocol::Launch( ProcessLaunchInfo &launch_info, NativeProcessProtocol::NativeDelegate &native_delegate, MainLoop &mainloop, NativeProcessProtocolSP &native_process_sp) { Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); - Error error; + Status error; // Verify the working directory is valid if one was specified. FileSpec working_dir(launch_info.GetWorkingDirectory()); @@ -120,7 +120,7 @@ Error NativeProcessProtocol::Launch( return error; } -Error NativeProcessProtocol::Attach( +Status NativeProcessProtocol::Attach( lldb::pid_t pid, NativeProcessProtocol::NativeDelegate &native_delegate, MainLoop &mainloop, NativeProcessProtocolSP &native_process_sp) { Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); @@ -130,7 +130,7 @@ Error NativeProcessProtocol::Attach( // Retrieve the architecture for the running process. ArchSpec process_arch; - Error error = ResolveProcessArchitecture(pid, process_arch); + Status error = ResolveProcessArchitecture(pid, process_arch); if (!error.Success()) return error; @@ -174,9 +174,9 @@ NativeProcessDarwin::~NativeProcessDarwin() {} // Instance methods // ----------------------------------------------------------------------------- -Error NativeProcessDarwin::FinalizeLaunch(LaunchFlavor launch_flavor, - MainLoop &main_loop) { - Error error; +Status NativeProcessDarwin::FinalizeLaunch(LaunchFlavor launch_flavor, + MainLoop &main_loop) { + Status error; Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); #if 0 @@ -261,7 +261,7 @@ Error NativeProcessDarwin::FinalizeLaunch(LaunchFlavor launch_flavor, return error; } -Error NativeProcessDarwin::SaveExceptionPortInfo() { +Status NativeProcessDarwin::SaveExceptionPortInfo() { return m_exc_port_info.Save(m_task); } @@ -348,7 +348,7 @@ void *NativeProcessDarwin::DoExceptionThread() { // polling is expensive. On devices, we need to minimize overhead caused // by the process monitor. uint32_t num_exceptions_received = 0; - Error error; + Status error; task_t task = m_task; mach_msg_timeout_t periodic_timeout = 0; @@ -550,8 +550,8 @@ void *NativeProcessDarwin::DoExceptionThread() { return nullptr; } -Error NativeProcessDarwin::StartExceptionThread() { - Error error; +Status NativeProcessDarwin::StartExceptionThread() { + Status error; Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); if (log) log->Printf("NativeProcessDarwin::%s() called", __FUNCTION__); @@ -640,7 +640,7 @@ Error NativeProcessDarwin::StartExceptionThread() { } lldb::addr_t -NativeProcessDarwin::GetDYLDAllImageInfosAddress(Error &error) const { +NativeProcessDarwin::GetDYLDAllImageInfosAddress(Status &error) const { error.Clear(); struct hack_task_dyld_info dyld_info; @@ -694,7 +694,7 @@ uint32_t NativeProcessDarwin::GetCPUType() const { task_t NativeProcessDarwin::ExceptionMessageBundleComplete() { // We have a complete bundle of exceptions for our child process. - Error error; + Status error; Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_VERBOSE)); std::lock_guard<std::recursive_mutex> locker(m_exception_messages_mutex); @@ -737,7 +737,7 @@ task_t NativeProcessDarwin::ExceptionMessageBundleComplete() { const addr_t info_array_count_addr = aii_addr + 4; uint32_t info_array_count = 0; size_t bytes_read = 0; - Error read_error; + Status read_error; read_error = ReadMemory(info_array_count_addr, // source addr &info_array_count, // dest addr 4, // byte count @@ -885,8 +885,8 @@ void NativeProcessDarwin::StartSTDIOThread() { // TODO implement } -Error NativeProcessDarwin::StartWaitpidThread(MainLoop &main_loop) { - Error error; +Status NativeProcessDarwin::StartWaitpidThread(MainLoop &main_loop) { + Status error; Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); // Strategy: create a thread that sits on waitpid(), waiting for the @@ -973,7 +973,7 @@ void *NativeProcessDarwin::DoWaitpidThread() { // Ensure we don't get CPU starved. MaybeRaiseThreadPriority(); - Error error; + Status error; int status = -1; while (1) { @@ -1038,9 +1038,9 @@ void *NativeProcessDarwin::DoWaitpidThread() { return nullptr; } -Error NativeProcessDarwin::SendInferiorExitStatusToMainLoop(::pid_t pid, - int status) { - Error error; +Status NativeProcessDarwin::SendInferiorExitStatusToMainLoop(::pid_t pid, + int status) { + Status error; Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); size_t bytes_written = 0; @@ -1069,8 +1069,8 @@ Error NativeProcessDarwin::SendInferiorExitStatusToMainLoop(::pid_t pid, return error; } -Error NativeProcessDarwin::HandleWaitpidResult() { - Error error; +Status NativeProcessDarwin::HandleWaitpidResult() { + Status error; Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); // Read the pid. @@ -1126,7 +1126,7 @@ Error NativeProcessDarwin::HandleWaitpidResult() { return error; } -task_t NativeProcessDarwin::TaskPortForProcessID(Error &error, +task_t NativeProcessDarwin::TaskPortForProcessID(Status &error, bool force) const { if ((m_task == TASK_NULL) || force) { Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); @@ -1178,12 +1178,12 @@ task_t NativeProcessDarwin::TaskPortForProcessID(Error &error, } void NativeProcessDarwin::AttachToInferior(MainLoop &mainloop, lldb::pid_t pid, - Error &error) { + Status &error) { error.SetErrorString("TODO: implement"); } -Error NativeProcessDarwin::PrivateResume() { - Error error; +Status NativeProcessDarwin::PrivateResume() { + Status error; Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); std::lock_guard<std::recursive_mutex> locker(m_exception_messages_mutex); @@ -1225,8 +1225,8 @@ Error NativeProcessDarwin::PrivateResume() { return error; } -Error NativeProcessDarwin::ReplyToAllExceptions() { - Error error; +Status NativeProcessDarwin::ReplyToAllExceptions() { + Status error; Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_VERBOSE)); TaskPortForProcessID(error); @@ -1282,8 +1282,8 @@ Error NativeProcessDarwin::ReplyToAllExceptions() { return error; } -Error NativeProcessDarwin::ResumeTask() { - Error error; +Status NativeProcessDarwin::ResumeTask() { + Status error; Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); TaskPortForProcessID(error); @@ -1364,9 +1364,10 @@ bool NativeProcessDarwin::IsExceptionPortValid() const { return MACH_PORT_VALID(m_exception_port); } -Error NativeProcessDarwin::GetTaskBasicInfo( - task_t task, struct task_basic_info *info) const { - Error error; +Status +NativeProcessDarwin::GetTaskBasicInfo(task_t task, + struct task_basic_info *info) const { + Status error; Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); // Validate args. @@ -1412,8 +1413,8 @@ Error NativeProcessDarwin::GetTaskBasicInfo( return error; } -Error NativeProcessDarwin::SuspendTask() { - Error error; +Status NativeProcessDarwin::SuspendTask() { + Status error; Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); if (m_task == TASK_NULL) { @@ -1432,8 +1433,8 @@ Error NativeProcessDarwin::SuspendTask() { return error; } -Error NativeProcessDarwin::Resume(const ResumeActionList &resume_actions) { - Error error; +Status NativeProcessDarwin::Resume(const ResumeActionList &resume_actions) { + Status error; Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); if (log) @@ -1461,74 +1462,74 @@ Error NativeProcessDarwin::Resume(const ResumeActionList &resume_actions) { return error; } -Error NativeProcessDarwin::Halt() { - Error error; +Status NativeProcessDarwin::Halt() { + Status error; error.SetErrorString("TODO: implement"); return error; } -Error NativeProcessDarwin::Detach() { - Error error; +Status NativeProcessDarwin::Detach() { + Status error; error.SetErrorString("TODO: implement"); return error; } -Error NativeProcessDarwin::Signal(int signo) { - Error error; +Status NativeProcessDarwin::Signal(int signo) { + Status error; error.SetErrorString("TODO: implement"); return error; } -Error NativeProcessDarwin::Interrupt() { - Error error; +Status NativeProcessDarwin::Interrupt() { + Status error; error.SetErrorString("TODO: implement"); return error; } -Error NativeProcessDarwin::Kill() { - Error error; +Status NativeProcessDarwin::Kill() { + Status error; error.SetErrorString("TODO: implement"); return error; } -Error NativeProcessDarwin::GetMemoryRegionInfo(lldb::addr_t load_addr, - MemoryRegionInfo &range_info) { - Error error; +Status NativeProcessDarwin::GetMemoryRegionInfo(lldb::addr_t load_addr, + MemoryRegionInfo &range_info) { + Status error; error.SetErrorString("TODO: implement"); return error; } -Error NativeProcessDarwin::ReadMemory(lldb::addr_t addr, void *buf, size_t size, - size_t &bytes_read) { - Error error; +Status NativeProcessDarwin::ReadMemory(lldb::addr_t addr, void *buf, + size_t size, size_t &bytes_read) { + Status error; error.SetErrorString("TODO: implement"); return error; } -Error NativeProcessDarwin::ReadMemoryWithoutTrap(lldb::addr_t addr, void *buf, - size_t size, - size_t &bytes_read) { - Error error; +Status NativeProcessDarwin::ReadMemoryWithoutTrap(lldb::addr_t addr, void *buf, + size_t size, + size_t &bytes_read) { + Status error; error.SetErrorString("TODO: implement"); return error; } -Error NativeProcessDarwin::WriteMemory(lldb::addr_t addr, const void *buf, - size_t size, size_t &bytes_written) { - Error error; +Status NativeProcessDarwin::WriteMemory(lldb::addr_t addr, const void *buf, + size_t size, size_t &bytes_written) { + Status error; error.SetErrorString("TODO: implement"); return error; } -Error NativeProcessDarwin::AllocateMemory(size_t size, uint32_t permissions, - lldb::addr_t &addr) { - Error error; +Status NativeProcessDarwin::AllocateMemory(size_t size, uint32_t permissions, + lldb::addr_t &addr) { + Status error; error.SetErrorString("TODO: implement"); return error; } -Error NativeProcessDarwin::DeallocateMemory(lldb::addr_t addr) { - Error error; +Status NativeProcessDarwin::DeallocateMemory(lldb::addr_t addr) { + Status error; error.SetErrorString("TODO: implement"); return error; } @@ -1543,25 +1544,25 @@ bool NativeProcessDarwin::GetArchitecture(ArchSpec &arch) const { return false; } -Error NativeProcessDarwin::SetBreakpoint(lldb::addr_t addr, uint32_t size, - bool hardware) { - Error error; +Status NativeProcessDarwin::SetBreakpoint(lldb::addr_t addr, uint32_t size, + bool hardware) { + Status error; error.SetErrorString("TODO: implement"); return error; } void NativeProcessDarwin::DoStopIDBumped(uint32_t newBumpId) {} -Error NativeProcessDarwin::GetLoadedModuleFileSpec(const char *module_path, - FileSpec &file_spec) { - Error error; +Status NativeProcessDarwin::GetLoadedModuleFileSpec(const char *module_path, + FileSpec &file_spec) { + Status error; error.SetErrorString("TODO: implement"); return error; } -Error NativeProcessDarwin::GetFileLoadAddress(const llvm::StringRef &file_name, - lldb::addr_t &load_addr) { - Error error; +Status NativeProcessDarwin::GetFileLoadAddress(const llvm::StringRef &file_name, + lldb::addr_t &load_addr) { + Status error; error.SetErrorString("TODO: implement"); return error; } @@ -1569,10 +1570,10 @@ Error NativeProcessDarwin::GetFileLoadAddress(const llvm::StringRef &file_name, // ----------------------------------------------------------------- // NativeProcessProtocol protected interface // ----------------------------------------------------------------- -Error NativeProcessDarwin::GetSoftwareBreakpointTrapOpcode( +Status NativeProcessDarwin::GetSoftwareBreakpointTrapOpcode( size_t trap_opcode_size_hint, size_t &actual_opcode_size, const uint8_t *&trap_opcode_bytes) { - Error error; + Status error; error.SetErrorString("TODO: implement"); return error; } diff --git a/lldb/source/Plugins/Process/Darwin/NativeProcessDarwin.h b/lldb/source/Plugins/Process/Darwin/NativeProcessDarwin.h index 01fdd64b127..2214bbc52ca 100644 --- a/lldb/source/Plugins/Process/Darwin/NativeProcessDarwin.h +++ b/lldb/source/Plugins/Process/Darwin/NativeProcessDarwin.h @@ -37,7 +37,7 @@ #include "NativeThreadListDarwin.h" namespace lldb_private { -class Error; +class Status; class Scalar; namespace process_darwin { @@ -50,11 +50,11 @@ namespace process_darwin { /// /// Changes in the inferior process state are broadcasted. class NativeProcessDarwin : public NativeProcessProtocol { - friend Error NativeProcessProtocol::Launch( + friend Status NativeProcessProtocol::Launch( ProcessLaunchInfo &launch_info, NativeDelegate &native_delegate, MainLoop &mainloop, NativeProcessProtocolSP &process_sp); - friend Error NativeProcessProtocol::Attach( + friend Status NativeProcessProtocol::Attach( lldb::pid_t pid, NativeProcessProtocol::NativeDelegate &native_delegate, MainLoop &mainloop, NativeProcessProtocolSP &process_sp); @@ -64,34 +64,34 @@ public: // ----------------------------------------------------------------- // NativeProcessProtocol Interface // ----------------------------------------------------------------- - Error Resume(const ResumeActionList &resume_actions) override; + Status Resume(const ResumeActionList &resume_actions) override; - Error Halt() override; + Status Halt() override; - Error Detach() override; + Status Detach() override; - Error Signal(int signo) override; + Status Signal(int signo) override; - Error Interrupt() override; + Status Interrupt() override; - Error Kill() override; + Status Kill() override; - Error GetMemoryRegionInfo(lldb::addr_t load_addr, - MemoryRegionInfo &range_info) override; + Status GetMemoryRegionInfo(lldb::addr_t load_addr, + MemoryRegionInfo &range_info) override; - Error ReadMemory(lldb::addr_t addr, void *buf, size_t size, - size_t &bytes_read) override; + Status ReadMemory(lldb::addr_t addr, void *buf, size_t size, + size_t &bytes_read) override; - Error ReadMemoryWithoutTrap(lldb::addr_t addr, void *buf, size_t size, - size_t &bytes_read) override; + Status ReadMemoryWithoutTrap(lldb::addr_t addr, void *buf, size_t size, + size_t &bytes_read) override; - Error WriteMemory(lldb::addr_t addr, const void *buf, size_t size, - size_t &bytes_written) override; + Status WriteMemory(lldb::addr_t addr, const void *buf, size_t size, + size_t &bytes_written) override; - Error AllocateMemory(size_t size, uint32_t permissions, - lldb::addr_t &addr) override; + Status AllocateMemory(size_t size, uint32_t permissions, + lldb::addr_t &addr) override; - Error DeallocateMemory(lldb::addr_t addr) override; + Status DeallocateMemory(lldb::addr_t addr) override; lldb::addr_t GetSharedLibraryInfoAddress() override; @@ -99,15 +99,16 @@ public: bool GetArchitecture(ArchSpec &arch) const override; - Error SetBreakpoint(lldb::addr_t addr, uint32_t size, bool hardware) override; + Status SetBreakpoint(lldb::addr_t addr, uint32_t size, + bool hardware) override; void DoStopIDBumped(uint32_t newBumpId) override; - Error GetLoadedModuleFileSpec(const char *module_path, - FileSpec &file_spec) override; + Status GetLoadedModuleFileSpec(const char *module_path, + FileSpec &file_spec) override; - Error GetFileLoadAddress(const llvm::StringRef &file_name, - lldb::addr_t &load_addr) override; + Status GetFileLoadAddress(const llvm::StringRef &file_name, + lldb::addr_t &load_addr) override; NativeThreadDarwinSP GetThreadByID(lldb::tid_t id); @@ -116,9 +117,9 @@ public: // ----------------------------------------------------------------- // Interface used by NativeRegisterContext-derived classes. // ----------------------------------------------------------------- - static Error PtraceWrapper(int req, lldb::pid_t pid, void *addr = nullptr, - void *data = nullptr, size_t data_size = 0, - long *result = nullptr); + static Status PtraceWrapper(int req, lldb::pid_t pid, void *addr = nullptr, + void *data = nullptr, size_t data_size = 0, + long *result = nullptr); bool SupportHardwareSingleStepping() const; @@ -126,7 +127,7 @@ protected: // ----------------------------------------------------------------- // NativeProcessProtocol protected interface // ----------------------------------------------------------------- - Error + Status GetSoftwareBreakpointTrapOpcode(size_t trap_opcode_size_hint, size_t &actual_opcode_size, const uint8_t *&trap_opcode_bytes) override; @@ -236,19 +237,19 @@ private: /// operations. Failure here will force termination of the /// launched process and debugging session. // ----------------------------------------------------------------- - Error FinalizeLaunch(LaunchFlavor launch_flavor, MainLoop &main_loop); + Status FinalizeLaunch(LaunchFlavor launch_flavor, MainLoop &main_loop); - Error SaveExceptionPortInfo(); + Status SaveExceptionPortInfo(); void ExceptionMessageReceived(const MachException::Message &message); void MaybeRaiseThreadPriority(); - Error StartExceptionThread(); + Status StartExceptionThread(); - Error SendInferiorExitStatusToMainLoop(::pid_t pid, int status); + Status SendInferiorExitStatusToMainLoop(::pid_t pid, int status); - Error HandleWaitpidResult(); + Status HandleWaitpidResult(); bool ProcessUsingSpringBoard() const; @@ -258,7 +259,7 @@ private: void *DoExceptionThread(); - lldb::addr_t GetDYLDAllImageInfosAddress(Error &error) const; + lldb::addr_t GetDYLDAllImageInfosAddress(Status &error) const; static uint32_t GetCPUTypeForLocalProcess(::pid_t pid); @@ -268,25 +269,25 @@ private: void StartSTDIOThread(); - Error StartWaitpidThread(MainLoop &main_loop); + Status StartWaitpidThread(MainLoop &main_loop); static void *WaitpidThread(void *arg); void *DoWaitpidThread(); - task_t TaskPortForProcessID(Error &error, bool force = false) const; + task_t TaskPortForProcessID(Status &error, bool force = false) const; /// Attaches to an existing process. Forms the /// implementation of Process::DoAttach. - void AttachToInferior(MainLoop &mainloop, lldb::pid_t pid, Error &error); + void AttachToInferior(MainLoop &mainloop, lldb::pid_t pid, Status &error); - ::pid_t Attach(lldb::pid_t pid, Error &error); + ::pid_t Attach(lldb::pid_t pid, Status &error); - Error PrivateResume(); + Status PrivateResume(); - Error ReplyToAllExceptions(); + Status ReplyToAllExceptions(); - Error ResumeTask(); + Status ResumeTask(); bool IsTaskValid() const; @@ -296,11 +297,11 @@ private: bool IsExceptionPortValid() const; - Error GetTaskBasicInfo(task_t task, struct task_basic_info *info) const; + Status GetTaskBasicInfo(task_t task, struct task_basic_info *info) const; - Error SuspendTask(); + Status SuspendTask(); - static Error SetDefaultPtraceOpts(const lldb::pid_t); + static Status SetDefaultPtraceOpts(const lldb::pid_t); static void *MonitorThread(void *baton); @@ -319,7 +320,7 @@ private: void MonitorSignal(const siginfo_t &info, NativeThreadDarwin &thread, bool exited); - Error SetupSoftwareSingleStepping(NativeThreadDarwin &thread); + Status SetupSoftwareSingleStepping(NativeThreadDarwin &thread); #if 0 static ::ProcessMessage::CrashReason @@ -341,22 +342,22 @@ private: NativeThreadDarwinSP AddThread(lldb::tid_t thread_id); - Error GetSoftwareBreakpointPCOffset(uint32_t &actual_opcode_size); + Status GetSoftwareBreakpointPCOffset(uint32_t &actual_opcode_size); - Error FixupBreakpointPCAsNeeded(NativeThreadDarwin &thread); + Status FixupBreakpointPCAsNeeded(NativeThreadDarwin &thread); /// Writes a siginfo_t structure corresponding to the given thread /// ID to the memory region pointed to by @p siginfo. - Error GetSignalInfo(lldb::tid_t tid, void *siginfo); + Status GetSignalInfo(lldb::tid_t tid, void *siginfo); /// Writes the raw event message code (vis-a-vis PTRACE_GETEVENTMSG) /// corresponding to the given thread ID to the memory pointed to /// by @p message. - Error GetEventMessage(lldb::tid_t tid, unsigned long *message); + Status GetEventMessage(lldb::tid_t tid, unsigned long *message); void NotifyThreadDeath(lldb::tid_t tid); - Error Detach(lldb::tid_t tid); + Status Detach(lldb::tid_t tid); // This method is requests a stop on all threads which are still // running. It sets up a deferred delegate notification, which will @@ -370,8 +371,8 @@ private: // Resume the given thread, optionally passing it the given signal. // The type of resume operation (continue, single-step) depends on // the state parameter. - Error ResumeThread(NativeThreadDarwin &thread, lldb::StateType state, - int signo); + Status ResumeThread(NativeThreadDarwin &thread, lldb::StateType state, + int signo); void ThreadWasCreated(NativeThreadDarwin &thread); diff --git a/lldb/source/Plugins/Process/Darwin/NativeThreadDarwin.cpp b/lldb/source/Plugins/Process/Darwin/NativeThreadDarwin.cpp index b04f9053136..07398ab7b67 100644 --- a/lldb/source/Plugins/Process/Darwin/NativeThreadDarwin.cpp +++ b/lldb/source/Plugins/Process/Darwin/NativeThreadDarwin.cpp @@ -94,15 +94,15 @@ NativeRegisterContextSP NativeThreadDarwin::GetRegisterContext() { return NativeRegisterContextSP(); } -Error NativeThreadDarwin::SetWatchpoint(lldb::addr_t addr, size_t size, - uint32_t watch_flags, bool hardware) { - Error error; +Status NativeThreadDarwin::SetWatchpoint(lldb::addr_t addr, size_t size, + uint32_t watch_flags, bool hardware) { + Status error; error.SetErrorString("not yet implemented"); return error; } -Error NativeThreadDarwin::RemoveWatchpoint(lldb::addr_t addr) { - Error error; +Status NativeThreadDarwin::RemoveWatchpoint(lldb::addr_t addr) { + Status error; error.SetErrorString("not yet implemented"); return error; } diff --git a/lldb/source/Plugins/Process/Darwin/NativeThreadDarwin.h b/lldb/source/Plugins/Process/Darwin/NativeThreadDarwin.h index b8d9089e673..f66f8fe8738 100644 --- a/lldb/source/Plugins/Process/Darwin/NativeThreadDarwin.h +++ b/lldb/source/Plugins/Process/Darwin/NativeThreadDarwin.h @@ -58,10 +58,10 @@ public: NativeRegisterContextSP GetRegisterContext() override; - Error SetWatchpoint(lldb::addr_t addr, size_t size, uint32_t watch_flags, - bool hardware) override; + Status SetWatchpoint(lldb::addr_t addr, size_t size, uint32_t watch_flags, + bool hardware) override; - Error RemoveWatchpoint(lldb::addr_t addr) override; + Status RemoveWatchpoint(lldb::addr_t addr) override; // ----------------------------------------------------------------- // New methods that are fine for others to call. @@ -75,11 +75,11 @@ private: /// Resumes the thread. If @p signo is anything but /// LLDB_INVALID_SIGNAL_NUMBER, deliver that signal to the thread. - Error Resume(uint32_t signo); + Status Resume(uint32_t signo); /// Single steps the thread. If @p signo is anything but /// LLDB_INVALID_SIGNAL_NUMBER, deliver that signal to the thread. - Error SingleStep(uint32_t signo); + Status SingleStep(uint32_t signo); bool NotifyException(MachException::Data &exc); @@ -117,7 +117,7 @@ private: void SetExited(); - Error RequestStop(); + Status RequestStop(); // ------------------------------------------------------------------------- /// Return the mach thread port number for this thread. diff --git a/lldb/source/Plugins/Process/Darwin/NativeThreadListDarwin.cpp b/lldb/source/Plugins/Process/Darwin/NativeThreadListDarwin.cpp index fa06fb8b2a5..7d44adeec37 100644 --- a/lldb/source/Plugins/Process/Darwin/NativeThreadListDarwin.cpp +++ b/lldb/source/Plugins/Process/Darwin/NativeThreadListDarwin.cpp @@ -20,8 +20,8 @@ #include <sys/sysctl.h> // LLDB includes -#include "lldb/Utility/Error.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/Stream.h" #include "lldb/lldb-enumerations.h" @@ -343,7 +343,7 @@ uint32_t NativeThreadListDarwin::UpdateThreadList(NativeProcessDarwin &process, mach_msg_type_number_t thread_list_count = 0; task_t task = process.GetTask(); - Error error; + Status error; auto mach_err = ::task_threads(task, &thread_list, &thread_list_count); error.SetError(mach_err, eErrorTypeMachKernel); if (error.Fail()) { diff --git a/lldb/source/Plugins/Process/Darwin/NativeThreadListDarwin.h b/lldb/source/Plugins/Process/Darwin/NativeThreadListDarwin.h index 2b194bcc153..7b59afb96e9 100644 --- a/lldb/source/Plugins/Process/Darwin/NativeThreadListDarwin.h +++ b/lldb/source/Plugins/Process/Darwin/NativeThreadListDarwin.h @@ -123,7 +123,7 @@ protected: typedef collection::iterator iterator; typedef collection::const_iterator const_iterator; - // Consider having this return an lldb_private::Error. + // Consider having this return an lldb_private::Status. uint32_t UpdateThreadList(NativeProcessDarwin &process, bool update, collection *num_threads = nullptr); diff --git a/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp b/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp index 93d294fd040..3046150e324 100644 --- a/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp +++ b/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp @@ -111,8 +111,8 @@ uint32_t ProcessFreeBSD::GetPluginVersion() { return 1; } void ProcessFreeBSD::Terminate() {} -Error ProcessFreeBSD::DoDetach(bool keep_stopped) { - Error error; +Status ProcessFreeBSD::DoDetach(bool keep_stopped) { + Status error; if (keep_stopped) { error.SetErrorString("Detaching with keep_stopped true is not currently " "supported on FreeBSD."); @@ -127,7 +127,7 @@ Error ProcessFreeBSD::DoDetach(bool keep_stopped) { return error; } -Error ProcessFreeBSD::DoResume() { +Status ProcessFreeBSD::DoResume() { Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); SetPrivateState(eStateRunning); @@ -147,7 +147,7 @@ Error ProcessFreeBSD::DoResume() { m_monitor->ThreadSuspend(*t_pos, false); do_step = true; if (software_single_step) { - Error error = SetupSoftwareSingleStepping(*t_pos); + Status error = SetupSoftwareSingleStepping(*t_pos); if (error.Fail()) return error; } @@ -168,7 +168,7 @@ Error ProcessFreeBSD::DoResume() { else m_monitor->Resume(GetID(), m_resume_signo); - return Error(); + return Status(); } bool ProcessFreeBSD::UpdateThreadList(ThreadList &old_thread_list, @@ -209,7 +209,7 @@ bool ProcessFreeBSD::UpdateThreadList(ThreadList &old_thread_list, return true; } -Error ProcessFreeBSD::WillResume() { +Status ProcessFreeBSD::WillResume() { m_resume_signo = 0; m_suspend_tids.clear(); m_run_tids.clear(); @@ -293,9 +293,10 @@ bool ProcessFreeBSD::CanDebug(lldb::TargetSP target_sp, return true; } -Error ProcessFreeBSD::DoAttachToProcessWithID( - lldb::pid_t pid, const ProcessAttachInfo &attach_info) { - Error error; +Status +ProcessFreeBSD::DoAttachToProcessWithID(lldb::pid_t pid, + const ProcessAttachInfo &attach_info) { + Status error; assert(m_monitor == NULL); Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); @@ -343,8 +344,8 @@ Error ProcessFreeBSD::DoAttachToProcessWithID( return error; } -Error ProcessFreeBSD::WillLaunch(Module *module) { - Error error; +Status ProcessFreeBSD::WillLaunch(Module *module) { + Status error; return error; } @@ -366,8 +367,9 @@ ProcessFreeBSD::GetFileSpec(const lldb_private::FileAction *file_action, return file_spec; } -Error ProcessFreeBSD::DoLaunch(Module *module, ProcessLaunchInfo &launch_info) { - Error error; +Status ProcessFreeBSD::DoLaunch(Module *module, + ProcessLaunchInfo &launch_info) { + Status error; assert(m_monitor == NULL); FileSpec working_dir = launch_info.GetWorkingDirectory(); @@ -456,8 +458,8 @@ addr_t ProcessFreeBSD::GetImageInfoAddress() { return LLDB_INVALID_ADDRESS; } -Error ProcessFreeBSD::DoHalt(bool &caused_stop) { - Error error; +Status ProcessFreeBSD::DoHalt(bool &caused_stop) { + Status error; if (IsStopped()) { caused_stop = false; @@ -470,8 +472,8 @@ Error ProcessFreeBSD::DoHalt(bool &caused_stop) { return error; } -Error ProcessFreeBSD::DoSignal(int signal) { - Error error; +Status ProcessFreeBSD::DoSignal(int signal) { + Status error; if (kill(GetID(), signal)) error.SetErrorToErrno(); @@ -479,8 +481,8 @@ Error ProcessFreeBSD::DoSignal(int signal) { return error; } -Error ProcessFreeBSD::DoDestroy() { - Error error; +Status ProcessFreeBSD::DoDestroy() { + Status error; if (!HasExited()) { assert(m_monitor); @@ -513,7 +515,7 @@ void ProcessFreeBSD::DoDidExec() { target->GetArchitecture()); FileSpecList executable_search_paths( Target::GetDefaultExecutableSearchPaths()); - Error error = platform_sp->ResolveExecutable( + Status error = platform_sp->ResolveExecutable( exe_module_spec, exe_module_sp, executable_search_paths.GetSize() ? &executable_search_paths : NULL); if (!error.Success()) @@ -589,19 +591,19 @@ bool ProcessFreeBSD::IsAlive() { } size_t ProcessFreeBSD::DoReadMemory(addr_t vm_addr, void *buf, size_t size, - Error &error) { + Status &error) { assert(m_monitor); return m_monitor->ReadMemory(vm_addr, buf, size, error); } size_t ProcessFreeBSD::DoWriteMemory(addr_t vm_addr, const void *buf, - size_t size, Error &error) { + size_t size, Status &error) { assert(m_monitor); return m_monitor->WriteMemory(vm_addr, buf, size, error); } addr_t ProcessFreeBSD::DoAllocateMemory(size_t size, uint32_t permissions, - Error &error) { + Status &error) { addr_t allocated_addr = LLDB_INVALID_ADDRESS; unsigned prot = 0; @@ -626,8 +628,8 @@ addr_t ProcessFreeBSD::DoAllocateMemory(size_t size, uint32_t permissions, return allocated_addr; } -Error ProcessFreeBSD::DoDeallocateMemory(lldb::addr_t addr) { - Error error; +Status ProcessFreeBSD::DoDeallocateMemory(lldb::addr_t addr) { + Status error; MMapMap::iterator pos = m_addr_to_mmap_size.find(addr); if (pos != m_addr_to_mmap_size.end() && InferiorCallMunmap(this, addr, pos->second)) @@ -691,16 +693,16 @@ ProcessFreeBSD::GetSoftwareBreakpointTrapOpcode(BreakpointSite *bp_site) { return opcode_size; } -Error ProcessFreeBSD::EnableBreakpointSite(BreakpointSite *bp_site) { +Status ProcessFreeBSD::EnableBreakpointSite(BreakpointSite *bp_site) { return EnableSoftwareBreakpoint(bp_site); } -Error ProcessFreeBSD::DisableBreakpointSite(BreakpointSite *bp_site) { +Status ProcessFreeBSD::DisableBreakpointSite(BreakpointSite *bp_site) { return DisableSoftwareBreakpoint(bp_site); } -Error ProcessFreeBSD::EnableWatchpoint(Watchpoint *wp, bool notify) { - Error error; +Status ProcessFreeBSD::EnableWatchpoint(Watchpoint *wp, bool notify) { + Status error; if (wp) { user_id_t watchID = wp->GetID(); addr_t addr = wp->GetLoadAddress(); @@ -754,8 +756,8 @@ Error ProcessFreeBSD::EnableWatchpoint(Watchpoint *wp, bool notify) { return error; } -Error ProcessFreeBSD::DisableWatchpoint(Watchpoint *wp, bool notify) { - Error error; +Status ProcessFreeBSD::DisableWatchpoint(Watchpoint *wp, bool notify) { + Status error; if (wp) { user_id_t watchID = wp->GetID(); addr_t addr = wp->GetLoadAddress(); @@ -797,8 +799,8 @@ Error ProcessFreeBSD::DisableWatchpoint(Watchpoint *wp, bool notify) { return error; } -Error ProcessFreeBSD::GetWatchpointSupportInfo(uint32_t &num) { - Error error; +Status ProcessFreeBSD::GetWatchpointSupportInfo(uint32_t &num) { + Status error; std::lock_guard<std::recursive_mutex> guard(m_thread_list.GetMutex()); FreeBSDThread *thread = static_cast<FreeBSDThread *>( m_thread_list.GetThreadAtIndex(0, false).get()); @@ -809,8 +811,8 @@ Error ProcessFreeBSD::GetWatchpointSupportInfo(uint32_t &num) { return error; } -Error ProcessFreeBSD::GetWatchpointSupportInfo(uint32_t &num, bool &after) { - Error error = GetWatchpointSupportInfo(num); +Status ProcessFreeBSD::GetWatchpointSupportInfo(uint32_t &num, bool &after) { + Status error = GetWatchpointSupportInfo(num); // Watchpoints trigger and halt the inferior after // the corresponding instruction has been executed. after = true; @@ -855,7 +857,7 @@ ByteOrder ProcessFreeBSD::GetByteOrder() const { return m_byte_order; } -size_t ProcessFreeBSD::PutSTDIN(const char *buf, size_t len, Error &error) { +size_t ProcessFreeBSD::PutSTDIN(const char *buf, size_t len, Status &error) { ssize_t status; if ((status = write(m_monitor->GetTerminalFD(), buf, len)) < 0) { error.SetErrorToErrno(); @@ -943,7 +945,7 @@ static size_t ReadMemoryCallback(EmulateInstruction *instruction, void *baton, lldb::addr_t addr, void *dst, size_t length) { EmulatorBaton *emulator_baton = static_cast<EmulatorBaton *>(baton); - Error error; + Status error; size_t bytes_read = emulator_baton->m_process->DoReadMemory(addr, dst, length, error); if (!error.Success()) @@ -998,9 +1000,9 @@ bool ProcessFreeBSD::SingleStepBreakpointHit( return false; } -Error ProcessFreeBSD::SetSoftwareSingleStepBreakpoint(lldb::tid_t tid, - lldb::addr_t addr) { - Error error; +Status ProcessFreeBSD::SetSoftwareSingleStepBreakpoint(lldb::tid_t tid, + lldb::addr_t addr) { + Status error; Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); if (log) { @@ -1010,8 +1012,8 @@ Error ProcessFreeBSD::SetSoftwareSingleStepBreakpoint(lldb::tid_t tid, // Validate the address. if (addr == LLDB_INVALID_ADDRESS) - return Error("ProcessFreeBSD::%s invalid load address specified.", - __FUNCTION__); + return Status("ProcessFreeBSD::%s invalid load address specified.", + __FUNCTION__); Breakpoint *const sw_step_break = m_process->GetTarget().CreateBreakpoint(addr, true, false).get(); @@ -1023,7 +1025,7 @@ Error ProcessFreeBSD::SetSoftwareSingleStepBreakpoint(lldb::tid_t tid, __FUNCTION__, addr); m_threads_stepping_with_breakpoint.insert({tid, sw_step_break->GetID()}); - return Error(); + return Status(); } bool ProcessFreeBSD::IsSoftwareStepBreakpoint(lldb::tid_t tid) { @@ -1063,18 +1065,18 @@ bool ProcessFreeBSD::SupportHardwareSingleStepping() const { return true; } -Error ProcessFreeBSD::SetupSoftwareSingleStepping(lldb::tid_t tid) { +Status ProcessFreeBSD::SetupSoftwareSingleStepping(lldb::tid_t tid) { std::unique_ptr<EmulateInstruction> emulator_ap( EmulateInstruction::FindPlugin(GetTarget().GetArchitecture(), eInstructionTypePCModifying, nullptr)); if (emulator_ap == nullptr) - return Error("Instruction emulator not found!"); + return Status("Instruction emulator not found!"); FreeBSDThread *thread = static_cast<FreeBSDThread *>( m_thread_list.FindThreadByID(tid, false).get()); if (thread == NULL) - return Error("Thread not found not found!"); + return Status("Thread not found not found!"); lldb::RegisterContextSP register_context_sp = thread->GetRegisterContext(); @@ -1086,7 +1088,7 @@ Error ProcessFreeBSD::SetupSoftwareSingleStepping(lldb::tid_t tid) { emulator_ap->SetWriteRegCallback(&WriteRegisterCallback); if (!emulator_ap->ReadInstruction()) - return Error("Read instruction failed!"); + return Status("Read instruction failed!"); bool emulation_result = emulator_ap->EvaluateInstruction(eEmulateInstructionOptionAutoAdvancePC); @@ -1111,9 +1113,9 @@ Error ProcessFreeBSD::SetupSoftwareSingleStepping(lldb::tid_t tid) { // The instruction emulation failed after it modified the PC. It is an // unknown error where we can't continue because the next instruction is // modifying the PC but we don't know how. - return Error("Instruction emulation failed unexpectedly"); + return Status("Instruction emulation failed unexpectedly"); } SetSoftwareSingleStepBreakpoint(tid, next_pc); - return Error(); + return Status(); } diff --git a/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.h b/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.h index 063eb6f6812..7ed2a56cd54 100644 --- a/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.h +++ b/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.h @@ -47,7 +47,7 @@ public: ~ProcessFreeBSD(); - virtual lldb_private::Error WillResume() override; + virtual lldb_private::Status WillResume() override; //------------------------------------------------------------------ // PluginInterface protocol @@ -65,27 +65,27 @@ public: bool CanDebug(lldb::TargetSP target_sp, bool plugin_specified_by_name) override; - lldb_private::Error WillLaunch(lldb_private::Module *module) override; + lldb_private::Status WillLaunch(lldb_private::Module *module) override; - lldb_private::Error DoAttachToProcessWithID( + lldb_private::Status DoAttachToProcessWithID( lldb::pid_t pid, const lldb_private::ProcessAttachInfo &attach_info) override; - lldb_private::Error + lldb_private::Status DoLaunch(lldb_private::Module *exe_module, lldb_private::ProcessLaunchInfo &launch_info) override; void DidLaunch() override; - lldb_private::Error DoResume() override; + lldb_private::Status DoResume() override; - lldb_private::Error DoHalt(bool &caused_stop) override; + lldb_private::Status DoHalt(bool &caused_stop) override; - lldb_private::Error DoDetach(bool keep_stopped) override; + lldb_private::Status DoDetach(bool keep_stopped) override; - lldb_private::Error DoSignal(int signal) override; + lldb_private::Status DoSignal(int signal) override; - lldb_private::Error DoDestroy() override; + lldb_private::Status DoDestroy() override; void DoDidExec() override; @@ -94,35 +94,35 @@ public: bool IsAlive() override; size_t DoReadMemory(lldb::addr_t vm_addr, void *buf, size_t size, - lldb_private::Error &error) override; + lldb_private::Status &error) override; size_t DoWriteMemory(lldb::addr_t vm_addr, const void *buf, size_t size, - lldb_private::Error &error) override; + lldb_private::Status &error) override; lldb::addr_t DoAllocateMemory(size_t size, uint32_t permissions, - lldb_private::Error &error) override; + lldb_private::Status &error) override; - lldb_private::Error DoDeallocateMemory(lldb::addr_t ptr) override; + lldb_private::Status DoDeallocateMemory(lldb::addr_t ptr) override; virtual size_t GetSoftwareBreakpointTrapOpcode(lldb_private::BreakpointSite *bp_site); - lldb_private::Error + lldb_private::Status EnableBreakpointSite(lldb_private::BreakpointSite *bp_site) override; - lldb_private::Error + lldb_private::Status DisableBreakpointSite(lldb_private::BreakpointSite *bp_site) override; - lldb_private::Error EnableWatchpoint(lldb_private::Watchpoint *wp, - bool notify = true) override; - - lldb_private::Error DisableWatchpoint(lldb_private::Watchpoint *wp, + lldb_private::Status EnableWatchpoint(lldb_private::Watchpoint *wp, bool notify = true) override; - lldb_private::Error GetWatchpointSupportInfo(uint32_t &num) override; + lldb_private::Status DisableWatchpoint(lldb_private::Watchpoint *wp, + bool notify = true) override; + + lldb_private::Status GetWatchpointSupportInfo(uint32_t &num) override; - lldb_private::Error GetWatchpointSupportInfo(uint32_t &num, - bool &after) override; + lldb_private::Status GetWatchpointSupportInfo(uint32_t &num, + bool &after) override; virtual uint32_t UpdateThreadListIfNeeded(); @@ -134,7 +134,7 @@ public: lldb::addr_t GetImageInfoAddress() override; size_t PutSTDIN(const char *buf, size_t len, - lldb_private::Error &error) override; + lldb_private::Status &error) override; const lldb::DataBufferSP GetAuxvData() override; @@ -169,10 +169,10 @@ public: void *baton, lldb_private::StoppointCallbackContext *context, lldb::user_id_t break_id, lldb::user_id_t break_loc_id); - lldb_private::Error SetupSoftwareSingleStepping(lldb::tid_t tid); + lldb_private::Status SetupSoftwareSingleStepping(lldb::tid_t tid); - lldb_private::Error SetSoftwareSingleStepBreakpoint(lldb::tid_t tid, - lldb::addr_t addr); + lldb_private::Status SetSoftwareSingleStepBreakpoint(lldb::tid_t tid, + lldb::addr_t addr); bool IsSoftwareStepBreakpoint(lldb::tid_t tid); diff --git a/lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp b/lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp index 68ab4165116..1667490f134 100644 --- a/lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp +++ b/lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp @@ -29,7 +29,7 @@ #include "lldb/Target/RegisterContext.h" #include "lldb/Target/Thread.h" #include "lldb/Target/UnixSignals.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "FreeBSDThread.h" #include "Plugins/Process/POSIX/CrashReason.h" @@ -154,7 +154,7 @@ PtraceWrapper((req), (pid), (addr), (data)) // functions without needed to go thru the thread funnel. static size_t DoReadMemory(lldb::pid_t pid, lldb::addr_t vm_addr, void *buf, - size_t size, Error &error) { + size_t size, Status &error) { struct ptrace_io_desc pi_desc; pi_desc.piod_op = PIOD_READ_D; @@ -168,7 +168,7 @@ static size_t DoReadMemory(lldb::pid_t pid, lldb::addr_t vm_addr, void *buf, } static size_t DoWriteMemory(lldb::pid_t pid, lldb::addr_t vm_addr, - const void *buf, size_t size, Error &error) { + const void *buf, size_t size, Status &error) { struct ptrace_io_desc pi_desc; pi_desc.piod_op = PIOD_WRITE_D; @@ -183,7 +183,7 @@ static size_t DoWriteMemory(lldb::pid_t pid, lldb::addr_t vm_addr, // Simple helper function to ensure flags are enabled on the given file // descriptor. -static bool EnsureFDFlags(int fd, int flags, Error &error) { +static bool EnsureFDFlags(int fd, int flags, Status &error) { int status; if ((status = fcntl(fd, F_GETFL)) == -1) { @@ -221,7 +221,7 @@ public: /// @brief Implements ProcessMonitor::ReadMemory. class ReadOperation : public Operation { public: - ReadOperation(lldb::addr_t addr, void *buff, size_t size, Error &error, + ReadOperation(lldb::addr_t addr, void *buff, size_t size, Status &error, size_t &result) : m_addr(addr), m_buff(buff), m_size(size), m_error(error), m_result(result) {} @@ -232,7 +232,7 @@ private: lldb::addr_t m_addr; void *m_buff; size_t m_size; - Error &m_error; + Status &m_error; size_t &m_result; }; @@ -247,8 +247,8 @@ void ReadOperation::Execute(ProcessMonitor *monitor) { /// @brief Implements ProcessMonitor::WriteMemory. class WriteOperation : public Operation { public: - WriteOperation(lldb::addr_t addr, const void *buff, size_t size, Error &error, - size_t &result) + WriteOperation(lldb::addr_t addr, const void *buff, size_t size, + Status &error, size_t &result) : m_addr(addr), m_buff(buff), m_size(size), m_error(error), m_result(result) {} @@ -258,7 +258,7 @@ private: lldb::addr_t m_addr; const void *m_buff; size_t m_size; - Error &m_error; + Status &m_error; size_t &m_result; }; @@ -672,12 +672,12 @@ void KillOperation::Execute(ProcessMonitor *monitor) { /// @brief Implements ProcessMonitor::Detach. class DetachOperation : public Operation { public: - DetachOperation(Error &result) : m_error(result) {} + DetachOperation(Status &result) : m_error(result) {} void Execute(ProcessMonitor *monitor); private: - Error &m_error; + Status &m_error; }; void DetachOperation::Execute(ProcessMonitor *monitor) { @@ -731,7 +731,7 @@ ProcessMonitor::ProcessMonitor( const FileSpec &stdout_file_spec, const FileSpec &stderr_file_spec, const FileSpec &working_dir, const lldb_private::ProcessLaunchInfo & /* launch_info */, - lldb_private::Error &error) + lldb_private::Status &error) : m_process(static_cast<ProcessFreeBSD *>(process)), m_pid(LLDB_INVALID_PROCESS_ID), m_terminal_fd(-1), m_operation(0) { using namespace std::placeholders; @@ -777,7 +777,7 @@ WAIT_AGAIN: } ProcessMonitor::ProcessMonitor(ProcessFreeBSD *process, lldb::pid_t pid, - lldb_private::Error &error) + lldb_private::Status &error) : m_process(static_cast<ProcessFreeBSD *>(process)), m_pid(pid), m_terminal_fd(-1), m_operation(0) { using namespace std::placeholders; @@ -824,7 +824,7 @@ ProcessMonitor::~ProcessMonitor() { StopMonitor(); } //------------------------------------------------------------------------------ // Thread setup and tear down. -void ProcessMonitor::StartLaunchOpThread(LaunchArgs *args, Error &error) { +void ProcessMonitor::StartLaunchOpThread(LaunchArgs *args, Status &error) { static const char *g_thread_name = "lldb.process.freebsd.operation"; if (m_operation_thread.IsJoinable()) @@ -992,7 +992,7 @@ FINISH: } void ProcessMonitor::StartAttachOpThread(AttachArgs *args, - lldb_private::Error &error) { + lldb_private::Status &error) { static const char *g_thread_name = "lldb.process.freebsd.operation"; if (m_operation_thread.IsJoinable()) @@ -1240,7 +1240,7 @@ void ProcessMonitor::DoOperation(Operation *op) { } size_t ProcessMonitor::ReadMemory(lldb::addr_t vm_addr, void *buf, size_t size, - Error &error) { + Status &error) { size_t result; ReadOperation op(vm_addr, buf, size, error, result); DoOperation(&op); @@ -1248,7 +1248,7 @@ size_t ProcessMonitor::ReadMemory(lldb::addr_t vm_addr, void *buf, size_t size, } size_t ProcessMonitor::WriteMemory(lldb::addr_t vm_addr, const void *buf, - size_t size, lldb_private::Error &error) { + size_t size, lldb_private::Status &error) { size_t result; WriteOperation op(vm_addr, buf, size, error, result); DoOperation(&op); @@ -1389,8 +1389,8 @@ bool ProcessMonitor::GetEventMessage(lldb::tid_t tid, unsigned long *message) { return result; } -lldb_private::Error ProcessMonitor::Detach(lldb::tid_t tid) { - lldb_private::Error error; +lldb_private::Status ProcessMonitor::Detach(lldb::tid_t tid) { + lldb_private::Status error; if (tid != LLDB_INVALID_THREAD_ID) { DetachOperation op(error); DoOperation(&op); diff --git a/lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.h b/lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.h index 58629189b7b..0963453a31b 100644 --- a/lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.h +++ b/lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.h @@ -23,7 +23,7 @@ #include "lldb/lldb-types.h" namespace lldb_private { -class Error; +class Status; class Module; class Scalar; } // End lldb_private namespace. @@ -54,10 +54,10 @@ public: const lldb_private::FileSpec &stderr_file_spec, const lldb_private::FileSpec &working_dir, const lldb_private::ProcessLaunchInfo &launch_info, - lldb_private::Error &error); + lldb_private::Status &error); ProcessMonitor(ProcessFreeBSD *process, lldb::pid_t pid, - lldb_private::Error &error); + lldb_private::Status &error); ~ProcessMonitor(); @@ -86,14 +86,14 @@ public: /// /// This method is provided to implement Process::DoReadMemory. size_t ReadMemory(lldb::addr_t vm_addr, void *buf, size_t size, - lldb_private::Error &error); + lldb_private::Status &error); /// Writes @p size bytes from address @p vm_adder in the inferior process /// address space. /// /// This method is provided to implement Process::DoWriteMemory. size_t WriteMemory(lldb::addr_t vm_addr, const void *buf, size_t size, - lldb_private::Error &error); + lldb_private::Status &error); /// Reads the contents from the register identified by the given (architecture /// dependent) offset. @@ -178,7 +178,7 @@ public: /// Terminate the traced process. bool Kill(); - lldb_private::Error Detach(lldb::tid_t tid); + lldb_private::Status Detach(lldb::tid_t tid); void StopMonitor(); @@ -210,7 +210,7 @@ private: ProcessMonitor *m_monitor; // The monitor performing the attach. sem_t m_semaphore; // Posted to once operation complete. - lldb_private::Error m_error; // Set if process operation failed. + lldb_private::Status m_error; // Set if process operation failed. }; /// @class LauchArgs @@ -238,7 +238,7 @@ private: const lldb_private::FileSpec m_working_dir; // Working directory or empty. }; - void StartLaunchOpThread(LaunchArgs *args, lldb_private::Error &error); + void StartLaunchOpThread(LaunchArgs *args, lldb_private::Status &error); static void *LaunchOpThread(void *arg); @@ -252,7 +252,7 @@ private: lldb::pid_t m_pid; // pid of the process to be attached. }; - void StartAttachOpThread(AttachArgs *args, lldb_private::Error &error); + void StartAttachOpThread(AttachArgs *args, lldb_private::Status &error); static void *AttachOpThread(void *args); diff --git a/lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_arm.cpp b/lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_arm.cpp index 14171d614c9..59d42b9ad72 100644 --- a/lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_arm.cpp +++ b/lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_arm.cpp @@ -75,7 +75,7 @@ bool RegisterContextPOSIXProcessMonitor_arm::WriteRegister( // Read the full register. if (ReadRegister(full_reg_info, full_value)) { - Error error; + Status error; ByteOrder byte_order = GetByteOrder(); uint8_t dst[RegisterValue::kMaxRegisterByteSize]; diff --git a/lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_arm64.cpp b/lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_arm64.cpp index 8a8eb0520cc..93ffeb5ea79 100644 --- a/lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_arm64.cpp +++ b/lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_arm64.cpp @@ -77,7 +77,7 @@ bool RegisterContextPOSIXProcessMonitor_arm64::WriteRegister( // Read the full register. if (ReadRegister(full_reg_info, full_value)) { - lldb_private::Error error; + lldb_private::Status error; lldb::ByteOrder byte_order = GetByteOrder(); uint8_t dst[lldb_private::RegisterValue::kMaxRegisterByteSize]; diff --git a/lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_mips64.cpp b/lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_mips64.cpp index ab50a5db3f3..b911ee22201 100644 --- a/lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_mips64.cpp +++ b/lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_mips64.cpp @@ -76,7 +76,7 @@ bool RegisterContextPOSIXProcessMonitor_mips64::WriteRegister( // Read the full register. if (ReadRegister(full_reg_info, full_value)) { - Error error; + Status error; ByteOrder byte_order = GetByteOrder(); uint8_t dst[RegisterValue::kMaxRegisterByteSize]; diff --git a/lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_powerpc.cpp b/lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_powerpc.cpp index 70eec945ce8..bc1d4df89fc 100644 --- a/lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_powerpc.cpp +++ b/lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_powerpc.cpp @@ -88,7 +88,7 @@ bool RegisterContextPOSIXProcessMonitor_powerpc::WriteRegister( // Read the full register. if (ReadRegister(full_reg_info, full_value)) { - Error error; + Status error; ByteOrder byte_order = GetByteOrder(); uint8_t dst[RegisterValue::kMaxRegisterByteSize]; diff --git a/lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_x86.cpp b/lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_x86.cpp index 036306058ff..1cd8f1aafa6 100644 --- a/lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_x86.cpp +++ b/lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_x86.cpp @@ -130,7 +130,7 @@ bool RegisterContextPOSIXProcessMonitor_x86_64::WriteRegister( // Read the full register. if (ReadRegister(full_reg_info, full_value)) { - Error error; + Status error; ByteOrder byte_order = GetByteOrder(); uint8_t dst[RegisterValue::kMaxRegisterByteSize]; diff --git a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp index 914d690ad88..15e7c9b5f69 100644 --- a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp @@ -40,8 +40,8 @@ #include "lldb/Target/Process.h" #include "lldb/Target/ProcessLaunchInfo.h" #include "lldb/Target/Target.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/LLDBAssert.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/StringExtractor.h" #include "NativeThreadLinux.h" @@ -193,8 +193,8 @@ static_assert(sizeof(long) >= k_ptrace_word_size, // Simple helper function to ensure flags are enabled on the given file // descriptor. -static Error EnsureFDFlags(int fd, int flags) { - Error error; +static Status EnsureFDFlags(int fd, int flags) { + Status error; int status = fcntl(fd, F_GETFL); if (status == -1) { @@ -214,13 +214,13 @@ static Error EnsureFDFlags(int fd, int flags) { // Public Static Methods // ----------------------------------------------------------------------------- -Error NativeProcessProtocol::Launch( +Status NativeProcessProtocol::Launch( ProcessLaunchInfo &launch_info, NativeProcessProtocol::NativeDelegate &native_delegate, MainLoop &mainloop, NativeProcessProtocolSP &native_process_sp) { Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); - Error error; + Status error; // Verify the working directory is valid if one was specified. FileSpec working_dir{launch_info.GetWorkingDirectory()}; @@ -254,7 +254,7 @@ Error NativeProcessProtocol::Launch( return error; } -Error NativeProcessProtocol::Attach( +Status NativeProcessProtocol::Attach( lldb::pid_t pid, NativeProcessProtocol::NativeDelegate &native_delegate, MainLoop &mainloop, NativeProcessProtocolSP &native_process_sp) { Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); @@ -262,7 +262,7 @@ Error NativeProcessProtocol::Attach( // Retrieve the architecture for the running process. ArchSpec process_arch; - Error error = ResolveProcessArchitecture(pid, process_arch); + Status error = ResolveProcessArchitecture(pid, process_arch); if (!error.Success()) return error; @@ -292,7 +292,7 @@ NativeProcessLinux::NativeProcessLinux() m_pending_notification_tid(LLDB_INVALID_THREAD_ID) {} void NativeProcessLinux::AttachToInferior(MainLoop &mainloop, lldb::pid_t pid, - Error &error) { + Status &error) { Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); LLDB_LOG(log, "pid = {0:x}", pid); @@ -314,9 +314,9 @@ void NativeProcessLinux::AttachToInferior(MainLoop &mainloop, lldb::pid_t pid, Attach(pid, error); } -Error NativeProcessLinux::LaunchInferior(MainLoop &mainloop, - ProcessLaunchInfo &launch_info) { - Error error; +Status NativeProcessLinux::LaunchInferior(MainLoop &mainloop, + ProcessLaunchInfo &launch_info) { + Status error; m_sigchld_handle = mainloop.RegisterSignal( SIGCHLD, [this](MainLoopBase &) { SigchldHandler(); }, error); if (!m_sigchld_handle) @@ -402,7 +402,7 @@ Error NativeProcessLinux::LaunchInferior(MainLoop &mainloop, return error; } -::pid_t NativeProcessLinux::Attach(lldb::pid_t pid, Error &error) { +::pid_t NativeProcessLinux::Attach(lldb::pid_t pid, Status &error) { Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); // Use a map to keep track of the threads which we have attached/need to @@ -484,7 +484,7 @@ Error NativeProcessLinux::LaunchInferior(MainLoop &mainloop, return pid; } -Error NativeProcessLinux::SetDefaultPtraceOpts(lldb::pid_t pid) { +Status NativeProcessLinux::SetDefaultPtraceOpts(lldb::pid_t pid) { long ptrace_opts = 0; // Have the child raise an event on exit. This is used to keep the child in @@ -857,7 +857,7 @@ void NativeProcessLinux::MonitorSIGTRAP(const siginfo_t &info, { // If a watchpoint was hit, report it uint32_t wp_index; - Error error = thread.GetRegisterContext()->GetWatchpointHitIndex( + Status error = thread.GetRegisterContext()->GetWatchpointHitIndex( wp_index, (uintptr_t)info.si_addr); if (error.Fail()) LLDB_LOG(log, @@ -894,7 +894,7 @@ void NativeProcessLinux::MonitorSIGTRAP(const siginfo_t &info, { // If a watchpoint was hit, report it uint32_t wp_index; - Error error = thread.GetRegisterContext()->GetWatchpointHitIndex( + Status error = thread.GetRegisterContext()->GetWatchpointHitIndex( wp_index, LLDB_INVALID_ADDRESS); if (error.Fail()) LLDB_LOG(log, @@ -950,7 +950,7 @@ void NativeProcessLinux::MonitorBreakpoint(NativeThreadLinux &thread) { // Mark the thread as stopped at breakpoint. thread.SetStoppedByBreakpoint(); - Error error = FixupBreakpointPCAsNeeded(thread); + Status error = FixupBreakpointPCAsNeeded(thread); if (error.Fail()) LLDB_LOG(log, "pid = {0} fixup: {1}", thread.GetID(), error); @@ -1032,7 +1032,7 @@ void NativeProcessLinux::MonitorSignal(const siginfo_t &info, } else { // We can end up here if stop was initiated by LLGS but by this time a // thread stop has occurred - maybe initiated by another event. - Error error = ResumeThread(thread, thread.GetState(), 0); + Status error = ResumeThread(thread, thread.GetState(), 0); if (error.Fail()) LLDB_LOG(log, "failed to resume thread {0}: {1}", thread.GetID(), error); @@ -1108,7 +1108,7 @@ static bool ReadRegisterCallback(EmulateInstruction *instruction, void *baton, emulator_baton->m_reg_context->GetRegisterInfo( eRegisterKindDWARF, reg_info->kinds[eRegisterKindDWARF]); - Error error = + Status error = emulator_baton->m_reg_context->ReadRegister(full_reg_info, reg_value); if (error.Success()) return true; @@ -1140,9 +1140,9 @@ static lldb::addr_t ReadFlags(NativeRegisterContext *regsiter_context) { LLDB_INVALID_ADDRESS); } -Error NativeProcessLinux::SetupSoftwareSingleStepping( - NativeThreadLinux &thread) { - Error error; +Status +NativeProcessLinux::SetupSoftwareSingleStepping(NativeThreadLinux &thread) { + Status error; NativeRegisterContextSP register_context_sp = thread.GetRegisterContext(); std::unique_ptr<EmulateInstruction> emulator_ap( @@ -1150,7 +1150,7 @@ Error NativeProcessLinux::SetupSoftwareSingleStepping( nullptr)); if (emulator_ap == nullptr) - return Error("Instruction emulator not found!"); + return Status("Instruction emulator not found!"); EmulatorBaton baton(this, register_context_sp.get()); emulator_ap->SetBaton(&baton); @@ -1160,7 +1160,7 @@ Error NativeProcessLinux::SetupSoftwareSingleStepping( emulator_ap->SetWriteRegCallback(&WriteRegisterCallback); if (!emulator_ap->ReadInstruction()) - return Error("Read instruction failed!"); + return Status("Read instruction failed!"); bool emulation_result = emulator_ap->EvaluateInstruction(eEmulateInstructionOptionAutoAdvancePC); @@ -1198,7 +1198,7 @@ Error NativeProcessLinux::SetupSoftwareSingleStepping( // The instruction emulation failed after it modified the PC. It is an // unknown error where we can't continue because the next instruction is // modifying the PC but we don't know how. - return Error("Instruction emulation failed unexpectedly."); + return Status("Instruction emulation failed unexpectedly."); } if (m_arch.GetMachine() == llvm::Triple::arm) { @@ -1222,13 +1222,13 @@ Error NativeProcessLinux::SetupSoftwareSingleStepping( // If setting the breakpoint fails because next_pc is out of // the address space, ignore it and let the debugee segfault. if (error.GetError() == EIO || error.GetError() == EFAULT) { - return Error(); + return Status(); } else if (error.Fail()) return error; m_threads_stepping_with_breakpoint.insert({thread.GetID(), next_pc}); - return Error(); + return Status(); } bool NativeProcessLinux::SupportHardwareSingleStepping() const { @@ -1241,7 +1241,7 @@ bool NativeProcessLinux::SupportHardwareSingleStepping() const { return true; } -Error NativeProcessLinux::Resume(const ResumeActionList &resume_actions) { +Status NativeProcessLinux::Resume(const ResumeActionList &resume_actions) { Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); LLDB_LOG(log, "pid {0}", GetID()); @@ -1257,7 +1257,7 @@ Error NativeProcessLinux::Resume(const ResumeActionList &resume_actions) { continue; if (action->state == eStateStepping) { - Error error = SetupSoftwareSingleStepping( + Status error = SetupSoftwareSingleStepping( static_cast<NativeThreadLinux &>(*thread_sp)); if (error.Fail()) return error; @@ -1295,18 +1295,18 @@ Error NativeProcessLinux::Resume(const ResumeActionList &resume_actions) { llvm_unreachable("Unexpected state"); default: - return Error("NativeProcessLinux::%s (): unexpected state %s specified " - "for pid %" PRIu64 ", tid %" PRIu64, - __FUNCTION__, StateAsCString(action->state), GetID(), - thread_sp->GetID()); + return Status("NativeProcessLinux::%s (): unexpected state %s specified " + "for pid %" PRIu64 ", tid %" PRIu64, + __FUNCTION__, StateAsCString(action->state), GetID(), + thread_sp->GetID()); } } - return Error(); + return Status(); } -Error NativeProcessLinux::Halt() { - Error error; +Status NativeProcessLinux::Halt() { + Status error; if (kill(GetID(), SIGSTOP) != 0) error.SetErrorToErrno(); @@ -1314,8 +1314,8 @@ Error NativeProcessLinux::Halt() { return error; } -Error NativeProcessLinux::Detach() { - Error error; +Status NativeProcessLinux::Detach() { + Status error; // Stop monitoring the inferior. m_sigchld_handle.reset(); @@ -1325,7 +1325,7 @@ Error NativeProcessLinux::Detach() { return error; for (auto thread_sp : m_threads) { - Error e = Detach(thread_sp->GetID()); + Status e = Detach(thread_sp->GetID()); if (e.Fail()) error = e; // Save the error, but still attempt to detach from other threads. @@ -1334,8 +1334,8 @@ Error NativeProcessLinux::Detach() { return error; } -Error NativeProcessLinux::Signal(int signo) { - Error error; +Status NativeProcessLinux::Signal(int signo) { + Status error; Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); LLDB_LOG(log, "sending signal {0} ({1}) to pid {1}", signo, @@ -1347,7 +1347,7 @@ Error NativeProcessLinux::Signal(int signo) { return error; } -Error NativeProcessLinux::Interrupt() { +Status NativeProcessLinux::Interrupt() { // Pick a running thread (or if none, a not-dead stopped thread) as // the chosen thread that will be the stop-reason thread. Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); @@ -1375,8 +1375,8 @@ Error NativeProcessLinux::Interrupt() { } if (!running_thread_sp && !stopped_thread_sp) { - Error error("found no running/stepping or live stopped threads as target " - "for interrupt"); + Status error("found no running/stepping or live stopped threads as target " + "for interrupt"); LLDB_LOG(log, "skipping due to error: {0}", error); return error; @@ -1391,14 +1391,14 @@ Error NativeProcessLinux::Interrupt() { StopRunningThreads(deferred_signal_thread_sp->GetID()); - return Error(); + return Status(); } -Error NativeProcessLinux::Kill() { +Status NativeProcessLinux::Kill() { Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); LLDB_LOG(log, "pid {0}", GetID()); - Error error; + Status error; switch (m_state) { case StateType::eStateInvalid: @@ -1430,7 +1430,7 @@ Error NativeProcessLinux::Kill() { return error; } -static Error +static Status ParseMemoryRegionInfoFromProcMapsLine(llvm::StringRef &maps_line, MemoryRegionInfo &memory_region_info) { memory_region_info.Clear(); @@ -1447,7 +1447,7 @@ ParseMemoryRegionInfoFromProcMapsLine(llvm::StringRef &maps_line, // Parse out hyphen separating start and end address from range. if (!line_extractor.GetBytesLeft() || (line_extractor.GetChar() != '-')) - return Error( + return Status( "malformed /proc/{pid}/maps entry, missing dash between address range"); // Parse out the ending address @@ -1455,7 +1455,8 @@ ParseMemoryRegionInfoFromProcMapsLine(llvm::StringRef &maps_line, // Parse out the space after the address. if (!line_extractor.GetBytesLeft() || (line_extractor.GetChar() != ' ')) - return Error("malformed /proc/{pid}/maps entry, missing space after range"); + return Status( + "malformed /proc/{pid}/maps entry, missing space after range"); // Save the range. memory_region_info.GetRange().SetRangeBase(start_address); @@ -1467,8 +1468,8 @@ ParseMemoryRegionInfoFromProcMapsLine(llvm::StringRef &maps_line, // Parse out each permission entry. if (line_extractor.GetBytesLeft() < 4) - return Error("malformed /proc/{pid}/maps entry, missing some portion of " - "permissions"); + return Status("malformed /proc/{pid}/maps entry, missing some portion of " + "permissions"); // Handle read permission. const char read_perm_char = line_extractor.GetChar(); @@ -1477,7 +1478,7 @@ ParseMemoryRegionInfoFromProcMapsLine(llvm::StringRef &maps_line, else if (read_perm_char == '-') memory_region_info.SetReadable(MemoryRegionInfo::OptionalBool::eNo); else - return Error("unexpected /proc/{pid}/maps read permission char"); + return Status("unexpected /proc/{pid}/maps read permission char"); // Handle write permission. const char write_perm_char = line_extractor.GetChar(); @@ -1486,7 +1487,7 @@ ParseMemoryRegionInfoFromProcMapsLine(llvm::StringRef &maps_line, else if (write_perm_char == '-') memory_region_info.SetWritable(MemoryRegionInfo::OptionalBool::eNo); else - return Error("unexpected /proc/{pid}/maps write permission char"); + return Status("unexpected /proc/{pid}/maps write permission char"); // Handle execute permission. const char exec_perm_char = line_extractor.GetChar(); @@ -1495,7 +1496,7 @@ ParseMemoryRegionInfoFromProcMapsLine(llvm::StringRef &maps_line, else if (exec_perm_char == '-') memory_region_info.SetExecutable(MemoryRegionInfo::OptionalBool::eNo); else - return Error("unexpected /proc/{pid}/maps exec permission char"); + return Status("unexpected /proc/{pid}/maps exec permission char"); line_extractor.GetChar(); // Read the private bit line_extractor.SkipSpaces(); // Skip the separator @@ -1511,11 +1512,11 @@ ParseMemoryRegionInfoFromProcMapsLine(llvm::StringRef &maps_line, if (name) memory_region_info.SetName(name); - return Error(); + return Status(); } -Error NativeProcessLinux::GetMemoryRegionInfo(lldb::addr_t load_addr, - MemoryRegionInfo &range_info) { +Status NativeProcessLinux::GetMemoryRegionInfo(lldb::addr_t load_addr, + MemoryRegionInfo &range_info) { // FIXME review that the final memory region returned extends to the end of // the virtual address space, // with no perms if it is not mapped. @@ -1526,10 +1527,10 @@ Error NativeProcessLinux::GetMemoryRegionInfo(lldb::addr_t load_addr, if (m_supports_mem_region == LazyBool::eLazyBoolNo) { // We're done. - return Error("unsupported"); + return Status("unsupported"); } - Error error = PopulateMemoryRegionCache(); + Status error = PopulateMemoryRegionCache(); if (error.Fail()) { return error; } @@ -1585,7 +1586,7 @@ Error NativeProcessLinux::GetMemoryRegionInfo(lldb::addr_t load_addr, return error; } -Error NativeProcessLinux::PopulateMemoryRegionCache() { +Status NativeProcessLinux::PopulateMemoryRegionCache() { Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); // If our cache is empty, pull the latest. There should always be at least @@ -1593,7 +1594,7 @@ Error NativeProcessLinux::PopulateMemoryRegionCache() { if (!m_mem_region_cache.empty()) { LLDB_LOG(log, "reusing {0} cached memory region entries", m_mem_region_cache.size()); - return Error(); + return Status(); } auto BufferOrError = getProcFile(GetID(), "maps"); @@ -1606,7 +1607,8 @@ Error NativeProcessLinux::PopulateMemoryRegionCache() { StringRef Line; std::tie(Line, Rest) = Rest.split('\n'); MemoryRegionInfo info; - const Error parse_error = ParseMemoryRegionInfoFromProcMapsLine(Line, info); + const Status parse_error = + ParseMemoryRegionInfoFromProcMapsLine(Line, info); if (parse_error.Fail()) { LLDB_LOG(log, "failed to parse proc maps line '{0}': {1}", Line, parse_error); @@ -1625,7 +1627,7 @@ Error NativeProcessLinux::PopulateMemoryRegionCache() { LLDB_LOG(log, "failed to find any procfs maps entries, assuming no support " "for memory region metadata retrieval"); - return Error("not supported"); + return Status("not supported"); } LLDB_LOG(log, "read {0} memory region entries from /proc/{1}/maps", @@ -1633,7 +1635,7 @@ Error NativeProcessLinux::PopulateMemoryRegionCache() { // We support memory retrieval, remember that. m_supports_mem_region = LazyBool::eLazyBoolYes; - return Error(); + return Status(); } void NativeProcessLinux::DoStopIDBumped(uint32_t newBumpId) { @@ -1644,13 +1646,13 @@ void NativeProcessLinux::DoStopIDBumped(uint32_t newBumpId) { m_mem_region_cache.clear(); } -Error NativeProcessLinux::AllocateMemory(size_t size, uint32_t permissions, - lldb::addr_t &addr) { +Status NativeProcessLinux::AllocateMemory(size_t size, uint32_t permissions, + lldb::addr_t &addr) { // FIXME implementing this requires the equivalent of // InferiorCallPOSIX::InferiorCallMmap, which depends on // functional ThreadPlans working with Native*Protocol. #if 1 - return Error("not implemented yet"); + return Status("not implemented yet"); #else addr = LLDB_INVALID_ADDRESS; @@ -1668,20 +1670,20 @@ Error NativeProcessLinux::AllocateMemory(size_t size, uint32_t permissions, if (InferiorCallMmap(this, addr, 0, size, prot, eMmapFlagsAnon | eMmapFlagsPrivate, -1, 0)) { m_addr_to_mmap_size[addr] = size; - return Error(); + return Status(); } else { addr = LLDB_INVALID_ADDRESS; - return Error("unable to allocate %" PRIu64 - " bytes of memory with permissions %s", - size, GetPermissionsAsCString(permissions)); + return Status("unable to allocate %" PRIu64 + " bytes of memory with permissions %s", + size, GetPermissionsAsCString(permissions)); } #endif } -Error NativeProcessLinux::DeallocateMemory(lldb::addr_t addr) { +Status NativeProcessLinux::DeallocateMemory(lldb::addr_t addr) { // FIXME see comments in AllocateMemory - required lower-level // bits not in place yet (ThreadPlans) - return Error("not implemented"); + return Status("not implemented"); } lldb::addr_t NativeProcessLinux::GetSharedLibraryInfoAddress() { @@ -1702,7 +1704,7 @@ bool NativeProcessLinux::GetArchitecture(ArchSpec &arch) const { return true; } -Error NativeProcessLinux::GetSoftwareBreakpointPCOffset( +Status NativeProcessLinux::GetSoftwareBreakpointPCOffset( uint32_t &actual_opcode_size) { // FIXME put this behind a breakpoint protocol class that can be // set per architecture. Need ARM, MIPS support here. @@ -1713,11 +1715,11 @@ Error NativeProcessLinux::GetSoftwareBreakpointPCOffset( case llvm::Triple::x86: case llvm::Triple::x86_64: actual_opcode_size = static_cast<uint32_t>(sizeof(g_i386_opcode)); - return Error(); + return Status(); case llvm::Triple::systemz: actual_opcode_size = static_cast<uint32_t>(sizeof(g_s390x_opcode)); - return Error(); + return Status(); case llvm::Triple::arm: case llvm::Triple::aarch64: @@ -1727,30 +1729,30 @@ Error NativeProcessLinux::GetSoftwareBreakpointPCOffset( case llvm::Triple::mipsel: // On these architectures the PC don't get updated for breakpoint hits actual_opcode_size = 0; - return Error(); + return Status(); default: assert(false && "CPU type not supported!"); - return Error("CPU type not supported"); + return Status("CPU type not supported"); } } -Error NativeProcessLinux::SetBreakpoint(lldb::addr_t addr, uint32_t size, - bool hardware) { +Status NativeProcessLinux::SetBreakpoint(lldb::addr_t addr, uint32_t size, + bool hardware) { if (hardware) return SetHardwareBreakpoint(addr, size); else return SetSoftwareBreakpoint(addr, size); } -Error NativeProcessLinux::RemoveBreakpoint(lldb::addr_t addr, bool hardware) { +Status NativeProcessLinux::RemoveBreakpoint(lldb::addr_t addr, bool hardware) { if (hardware) return RemoveHardwareBreakpoint(addr); else return NativeProcessProtocol::RemoveBreakpoint(addr); } -Error NativeProcessLinux::GetSoftwareBreakpointTrapOpcode( +Status NativeProcessLinux::GetSoftwareBreakpointTrapOpcode( size_t trap_opcode_size_hint, size_t &actual_opcode_size, const uint8_t *&trap_opcode_bytes) { // FIXME put this behind a breakpoint protocol class that can be set per @@ -1769,49 +1771,49 @@ Error NativeProcessLinux::GetSoftwareBreakpointTrapOpcode( case llvm::Triple::aarch64: trap_opcode_bytes = g_aarch64_opcode; actual_opcode_size = sizeof(g_aarch64_opcode); - return Error(); + return Status(); case llvm::Triple::arm: switch (trap_opcode_size_hint) { case 2: trap_opcode_bytes = g_thumb_breakpoint_opcode; actual_opcode_size = sizeof(g_thumb_breakpoint_opcode); - return Error(); + return Status(); case 4: trap_opcode_bytes = g_arm_breakpoint_opcode; actual_opcode_size = sizeof(g_arm_breakpoint_opcode); - return Error(); + return Status(); default: assert(false && "Unrecognised trap opcode size hint!"); - return Error("Unrecognised trap opcode size hint!"); + return Status("Unrecognised trap opcode size hint!"); } case llvm::Triple::x86: case llvm::Triple::x86_64: trap_opcode_bytes = g_i386_opcode; actual_opcode_size = sizeof(g_i386_opcode); - return Error(); + return Status(); case llvm::Triple::mips: case llvm::Triple::mips64: trap_opcode_bytes = g_mips64_opcode; actual_opcode_size = sizeof(g_mips64_opcode); - return Error(); + return Status(); case llvm::Triple::mipsel: case llvm::Triple::mips64el: trap_opcode_bytes = g_mips64el_opcode; actual_opcode_size = sizeof(g_mips64el_opcode); - return Error(); + return Status(); case llvm::Triple::systemz: trap_opcode_bytes = g_s390x_opcode; actual_opcode_size = sizeof(g_s390x_opcode); - return Error(); + return Status(); default: assert(false && "CPU type not supported!"); - return Error("CPU type not supported"); + return Status("CPU type not supported"); } } @@ -1964,8 +1966,8 @@ NativeProcessLinux::GetCrashReasonForSIGBUS(const siginfo_t *info) } #endif -Error NativeProcessLinux::ReadMemory(lldb::addr_t addr, void *buf, size_t size, - size_t &bytes_read) { +Status NativeProcessLinux::ReadMemory(lldb::addr_t addr, void *buf, size_t size, + size_t &bytes_read) { if (ProcessVmReadvSupported()) { // The process_vm_readv path is about 50 times faster than ptrace api. We // want to use @@ -1989,7 +1991,7 @@ Error NativeProcessLinux::ReadMemory(lldb::addr_t addr, void *buf, size_t size, size, addr, success ? "Success" : strerror(errno)); if (success) - return Error(); + return Status(); // else the call failed for some reason, let's retry the read using ptrace // api. } @@ -2002,7 +2004,7 @@ Error NativeProcessLinux::ReadMemory(lldb::addr_t addr, void *buf, size_t size, LLDB_LOG(log, "addr = {0}, buf = {1}, size = {2}", addr, buf, size); for (bytes_read = 0; bytes_read < size; bytes_read += remainder) { - Error error = NativeProcessLinux::PtraceWrapper( + Status error = NativeProcessLinux::PtraceWrapper( PTRACE_PEEKDATA, GetID(), (void *)addr, nullptr, 0, &data); if (error.Fail()) return error; @@ -2017,23 +2019,23 @@ Error NativeProcessLinux::ReadMemory(lldb::addr_t addr, void *buf, size_t size, addr += k_ptrace_word_size; dst += k_ptrace_word_size; } - return Error(); + return Status(); } -Error NativeProcessLinux::ReadMemoryWithoutTrap(lldb::addr_t addr, void *buf, - size_t size, - size_t &bytes_read) { - Error error = ReadMemory(addr, buf, size, bytes_read); +Status NativeProcessLinux::ReadMemoryWithoutTrap(lldb::addr_t addr, void *buf, + size_t size, + size_t &bytes_read) { + Status error = ReadMemory(addr, buf, size, bytes_read); if (error.Fail()) return error; return m_breakpoint_list.RemoveTrapsFromBuffer(addr, buf, size); } -Error NativeProcessLinux::WriteMemory(lldb::addr_t addr, const void *buf, - size_t size, size_t &bytes_written) { +Status NativeProcessLinux::WriteMemory(lldb::addr_t addr, const void *buf, + size_t size, size_t &bytes_written) { const unsigned char *src = static_cast<const unsigned char *>(buf); size_t remainder; - Error error; + Status error; Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_MEMORY)); LLDB_LOG(log, "addr = {0}, buf = {1}, size = {2}", addr, buf, size); @@ -2075,18 +2077,18 @@ Error NativeProcessLinux::WriteMemory(lldb::addr_t addr, const void *buf, return error; } -Error NativeProcessLinux::GetSignalInfo(lldb::tid_t tid, void *siginfo) { +Status NativeProcessLinux::GetSignalInfo(lldb::tid_t tid, void *siginfo) { return PtraceWrapper(PTRACE_GETSIGINFO, tid, nullptr, siginfo); } -Error NativeProcessLinux::GetEventMessage(lldb::tid_t tid, - unsigned long *message) { +Status NativeProcessLinux::GetEventMessage(lldb::tid_t tid, + unsigned long *message) { return PtraceWrapper(PTRACE_GETEVENTMSG, tid, nullptr, message); } -Error NativeProcessLinux::Detach(lldb::tid_t tid) { +Status NativeProcessLinux::Detach(lldb::tid_t tid) { if (tid == LLDB_INVALID_THREAD_ID) - return Error(); + return Status(); return PtraceWrapper(PTRACE_DETACH, tid); } @@ -2137,10 +2139,11 @@ NativeThreadLinuxSP NativeProcessLinux::AddThread(lldb::tid_t thread_id) { return thread_sp; } -Error NativeProcessLinux::FixupBreakpointPCAsNeeded(NativeThreadLinux &thread) { +Status +NativeProcessLinux::FixupBreakpointPCAsNeeded(NativeThreadLinux &thread) { Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_BREAKPOINTS)); - Error error; + Status error; // Find out the size of a breakpoint (might depend on where we are in the // code). @@ -2179,7 +2182,7 @@ Error NativeProcessLinux::FixupBreakpointPCAsNeeded(NativeThreadLinux &thread) { "pid {0} no lldb breakpoint found at current pc with " "adjustment: {1}", GetID(), breakpoint_addr); - return Error(); + return Status(); } // If the breakpoint is not a software breakpoint, nothing to do. @@ -2188,7 +2191,7 @@ Error NativeProcessLinux::FixupBreakpointPCAsNeeded(NativeThreadLinux &thread) { log, "pid {0} breakpoint found at {1:x}, not software, nothing to adjust", GetID(), breakpoint_addr); - return Error(); + return Status(); } // @@ -2202,7 +2205,7 @@ Error NativeProcessLinux::FixupBreakpointPCAsNeeded(NativeThreadLinux &thread) { "pid {0} breakpoint found at {1:x}, it is software, but the " "size is zero, nothing to do (unexpected)", GetID(), breakpoint_addr); - return Error(); + return Status(); } // Change the program counter. @@ -2219,9 +2222,9 @@ Error NativeProcessLinux::FixupBreakpointPCAsNeeded(NativeThreadLinux &thread) { return error; } -Error NativeProcessLinux::GetLoadedModuleFileSpec(const char *module_path, - FileSpec &file_spec) { - Error error = PopulateMemoryRegionCache(); +Status NativeProcessLinux::GetLoadedModuleFileSpec(const char *module_path, + FileSpec &file_spec) { + Status error = PopulateMemoryRegionCache(); if (error.Fail()) return error; @@ -2231,17 +2234,17 @@ Error NativeProcessLinux::GetLoadedModuleFileSpec(const char *module_path, for (const auto &it : m_mem_region_cache) { if (it.second.GetFilename() == module_file_spec.GetFilename()) { file_spec = it.second; - return Error(); + return Status(); } } - return Error("Module file (%s) not found in /proc/%" PRIu64 "/maps file!", - module_file_spec.GetFilename().AsCString(), GetID()); + return Status("Module file (%s) not found in /proc/%" PRIu64 "/maps file!", + module_file_spec.GetFilename().AsCString(), GetID()); } -Error NativeProcessLinux::GetFileLoadAddress(const llvm::StringRef &file_name, - lldb::addr_t &load_addr) { +Status NativeProcessLinux::GetFileLoadAddress(const llvm::StringRef &file_name, + lldb::addr_t &load_addr) { load_addr = LLDB_INVALID_ADDRESS; - Error error = PopulateMemoryRegionCache(); + Status error = PopulateMemoryRegionCache(); if (error.Fail()) return error; @@ -2249,10 +2252,10 @@ Error NativeProcessLinux::GetFileLoadAddress(const llvm::StringRef &file_name, for (const auto &it : m_mem_region_cache) { if (it.second == file) { load_addr = it.first.GetRange().GetRangeBase(); - return Error(); + return Status(); } } - return Error("No load address found for specified file."); + return Status("No load address found for specified file."); } NativeThreadLinuxSP NativeProcessLinux::GetThreadByID(lldb::tid_t tid) { @@ -2260,8 +2263,8 @@ NativeThreadLinuxSP NativeProcessLinux::GetThreadByID(lldb::tid_t tid) { NativeProcessProtocol::GetThreadByID(tid)); } -Error NativeProcessLinux::ResumeThread(NativeThreadLinux &thread, - lldb::StateType state, int signo) { +Status NativeProcessLinux::ResumeThread(NativeThreadLinux &thread, + lldb::StateType state, int signo) { Log *const log = ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_THREAD); LLDB_LOG(log, "tid: {0}", thread.GetID()); @@ -2336,7 +2339,7 @@ void NativeProcessLinux::SignalIfAllThreadsStopped() { // Clear any temporary breakpoints we used to implement software single // stepping. for (const auto &thread_info : m_threads_stepping_with_breakpoint) { - Error error = RemoveBreakpoint(thread_info.second); + Status error = RemoveBreakpoint(thread_info.second); if (error.Fail()) LLDB_LOG(log, "pid = {0} remove stepping breakpoint: {1}", thread_info.first, error); @@ -2376,7 +2379,7 @@ void NativeProcessLinux::SigchldHandler() { if (errno == EINTR) continue; - Error error(errno, eErrorTypePOSIX); + Status error(errno, eErrorTypePOSIX); LLDB_LOG(log, "waitpid (-1, &status, _) failed: {0}", error); break; } @@ -2414,10 +2417,10 @@ void NativeProcessLinux::SigchldHandler() { // Wrapper for ptrace to catch errors and log calls. // Note that ptrace sets errno on error because -1 can be a valid result (i.e. // for PTRACE_PEEK*) -Error NativeProcessLinux::PtraceWrapper(int req, lldb::pid_t pid, void *addr, - void *data, size_t data_size, - long *result) { - Error error; +Status NativeProcessLinux::PtraceWrapper(int req, lldb::pid_t pid, void *addr, + void *data, size_t data_size, + long *result) { + Status error; long int ret; Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PTRACE)); diff --git a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.h b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.h index e4809d082b5..98fc88baab6 100644 --- a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.h +++ b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.h @@ -26,7 +26,7 @@ #include "lldb/Host/common/NativeProcessProtocol.h" namespace lldb_private { -class Error; +class Status; class Scalar; namespace process_linux { @@ -38,11 +38,11 @@ namespace process_linux { /// /// Changes in the inferior process state are broadcasted. class NativeProcessLinux : public NativeProcessProtocol { - friend Error NativeProcessProtocol::Launch( + friend Status NativeProcessProtocol::Launch( ProcessLaunchInfo &launch_info, NativeDelegate &native_delegate, MainLoop &mainloop, NativeProcessProtocolSP &process_sp); - friend Error NativeProcessProtocol::Attach( + friend Status NativeProcessProtocol::Attach( lldb::pid_t pid, NativeProcessProtocol::NativeDelegate &native_delegate, MainLoop &mainloop, NativeProcessProtocolSP &process_sp); @@ -50,34 +50,34 @@ public: // --------------------------------------------------------------------- // NativeProcessProtocol Interface // --------------------------------------------------------------------- - Error Resume(const ResumeActionList &resume_actions) override; + Status Resume(const ResumeActionList &resume_actions) override; - Error Halt() override; + Status Halt() override; - Error Detach() override; + Status Detach() override; - Error Signal(int signo) override; + Status Signal(int signo) override; - Error Interrupt() override; + Status Interrupt() override; - Error Kill() override; + Status Kill() override; - Error GetMemoryRegionInfo(lldb::addr_t load_addr, - MemoryRegionInfo &range_info) override; + Status GetMemoryRegionInfo(lldb::addr_t load_addr, + MemoryRegionInfo &range_info) override; - Error ReadMemory(lldb::addr_t addr, void *buf, size_t size, - size_t &bytes_read) override; + Status ReadMemory(lldb::addr_t addr, void *buf, size_t size, + size_t &bytes_read) override; - Error ReadMemoryWithoutTrap(lldb::addr_t addr, void *buf, size_t size, - size_t &bytes_read) override; + Status ReadMemoryWithoutTrap(lldb::addr_t addr, void *buf, size_t size, + size_t &bytes_read) override; - Error WriteMemory(lldb::addr_t addr, const void *buf, size_t size, - size_t &bytes_written) override; + Status WriteMemory(lldb::addr_t addr, const void *buf, size_t size, + size_t &bytes_written) override; - Error AllocateMemory(size_t size, uint32_t permissions, - lldb::addr_t &addr) override; + Status AllocateMemory(size_t size, uint32_t permissions, + lldb::addr_t &addr) override; - Error DeallocateMemory(lldb::addr_t addr) override; + Status DeallocateMemory(lldb::addr_t addr) override; lldb::addr_t GetSharedLibraryInfoAddress() override; @@ -85,17 +85,18 @@ public: bool GetArchitecture(ArchSpec &arch) const override; - Error SetBreakpoint(lldb::addr_t addr, uint32_t size, bool hardware) override; + Status SetBreakpoint(lldb::addr_t addr, uint32_t size, + bool hardware) override; - Error RemoveBreakpoint(lldb::addr_t addr, bool hardware = false) override; + Status RemoveBreakpoint(lldb::addr_t addr, bool hardware = false) override; void DoStopIDBumped(uint32_t newBumpId) override; - Error GetLoadedModuleFileSpec(const char *module_path, - FileSpec &file_spec) override; + Status GetLoadedModuleFileSpec(const char *module_path, + FileSpec &file_spec) override; - Error GetFileLoadAddress(const llvm::StringRef &file_name, - lldb::addr_t &load_addr) override; + Status GetFileLoadAddress(const llvm::StringRef &file_name, + lldb::addr_t &load_addr) override; NativeThreadLinuxSP GetThreadByID(lldb::tid_t id); @@ -107,9 +108,9 @@ public: // --------------------------------------------------------------------- // Interface used by NativeRegisterContext-derived classes. // --------------------------------------------------------------------- - static Error PtraceWrapper(int req, lldb::pid_t pid, void *addr = nullptr, - void *data = nullptr, size_t data_size = 0, - long *result = nullptr); + static Status PtraceWrapper(int req, lldb::pid_t pid, void *addr = nullptr, + void *data = nullptr, size_t data_size = 0, + long *result = nullptr); bool SupportHardwareSingleStepping() const; @@ -117,7 +118,7 @@ protected: // --------------------------------------------------------------------- // NativeProcessProtocol protected interface // --------------------------------------------------------------------- - Error + Status GetSoftwareBreakpointTrapOpcode(size_t trap_opcode_size_hint, size_t &actual_opcode_size, const uint8_t *&trap_opcode_bytes) override; @@ -140,15 +141,15 @@ private: // --------------------------------------------------------------------- NativeProcessLinux(); - Error LaunchInferior(MainLoop &mainloop, ProcessLaunchInfo &launch_info); + Status LaunchInferior(MainLoop &mainloop, ProcessLaunchInfo &launch_info); /// Attaches to an existing process. Forms the /// implementation of Process::DoAttach - void AttachToInferior(MainLoop &mainloop, lldb::pid_t pid, Error &error); + void AttachToInferior(MainLoop &mainloop, lldb::pid_t pid, Status &error); - ::pid_t Attach(lldb::pid_t pid, Error &error); + ::pid_t Attach(lldb::pid_t pid, Status &error); - static Error SetDefaultPtraceOpts(const lldb::pid_t); + static Status SetDefaultPtraceOpts(const lldb::pid_t); static void *MonitorThread(void *baton); @@ -167,7 +168,7 @@ private: void MonitorSignal(const siginfo_t &info, NativeThreadLinux &thread, bool exited); - Error SetupSoftwareSingleStepping(NativeThreadLinux &thread); + Status SetupSoftwareSingleStepping(NativeThreadLinux &thread); #if 0 static ::ProcessMessage::CrashReason @@ -189,22 +190,22 @@ private: NativeThreadLinuxSP AddThread(lldb::tid_t thread_id); - Error GetSoftwareBreakpointPCOffset(uint32_t &actual_opcode_size); + Status GetSoftwareBreakpointPCOffset(uint32_t &actual_opcode_size); - Error FixupBreakpointPCAsNeeded(NativeThreadLinux &thread); + Status FixupBreakpointPCAsNeeded(NativeThreadLinux &thread); /// Writes a siginfo_t structure corresponding to the given thread ID to the /// memory region pointed to by @p siginfo. - Error GetSignalInfo(lldb::tid_t tid, void *siginfo); + Status GetSignalInfo(lldb::tid_t tid, void *siginfo); /// Writes the raw event message code (vis-a-vis PTRACE_GETEVENTMSG) /// corresponding to the given thread ID to the memory pointed to by @p /// message. - Error GetEventMessage(lldb::tid_t tid, unsigned long *message); + Status GetEventMessage(lldb::tid_t tid, unsigned long *message); void NotifyThreadDeath(lldb::tid_t tid); - Error Detach(lldb::tid_t tid); + Status Detach(lldb::tid_t tid); // This method is requests a stop on all threads which are still running. It // sets up a @@ -219,14 +220,14 @@ private: // Resume the given thread, optionally passing it the given signal. The type // of resume // operation (continue, single-step) depends on the state parameter. - Error ResumeThread(NativeThreadLinux &thread, lldb::StateType state, - int signo); + Status ResumeThread(NativeThreadLinux &thread, lldb::StateType state, + int signo); void ThreadWasCreated(NativeThreadLinux &thread); void SigchldHandler(); - Error PopulateMemoryRegionCache(); + Status PopulateMemoryRegionCache(); }; } // namespace process_linux diff --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp index be256e97221..43253f38801 100644 --- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp @@ -41,18 +41,19 @@ lldb::ByteOrder NativeRegisterContextLinux::GetByteOrder() const { return byte_order; } -Error NativeRegisterContextLinux::ReadRegisterRaw(uint32_t reg_index, - RegisterValue ®_value) { +Status NativeRegisterContextLinux::ReadRegisterRaw(uint32_t reg_index, + RegisterValue ®_value) { const RegisterInfo *const reg_info = GetRegisterInfoAtIndex(reg_index); if (!reg_info) - return Error("register %" PRIu32 " not found", reg_index); + return Status("register %" PRIu32 " not found", reg_index); return DoReadRegisterValue(reg_info->byte_offset, reg_info->name, reg_info->byte_size, reg_value); } -Error NativeRegisterContextLinux::WriteRegisterRaw( - uint32_t reg_index, const RegisterValue ®_value) { +Status +NativeRegisterContextLinux::WriteRegisterRaw(uint32_t reg_index, + const RegisterValue ®_value) { uint32_t reg_to_write = reg_index; RegisterValue value_to_write = reg_value; @@ -60,7 +61,7 @@ Error NativeRegisterContextLinux::WriteRegisterRaw( const RegisterInfo *reg_info = GetRegisterInfoAtIndex(reg_index); if (reg_info->invalidate_regs && (reg_info->invalidate_regs[0] != LLDB_INVALID_REGNUM)) { - Error error; + Status error; RegisterValue full_value; uint32_t full_reg = reg_info->invalidate_regs[0]; @@ -99,71 +100,71 @@ Error NativeRegisterContextLinux::WriteRegisterRaw( assert(register_to_write_info_p && "register to write does not have valid RegisterInfo"); if (!register_to_write_info_p) - return Error("NativeRegisterContextLinux::%s failed to get RegisterInfo " - "for write register index %" PRIu32, - __FUNCTION__, reg_to_write); + return Status("NativeRegisterContextLinux::%s failed to get RegisterInfo " + "for write register index %" PRIu32, + __FUNCTION__, reg_to_write); return DoWriteRegisterValue(reg_info->byte_offset, reg_info->name, reg_value); } -Error NativeRegisterContextLinux::ReadGPR() { +Status NativeRegisterContextLinux::ReadGPR() { void *buf = GetGPRBuffer(); if (!buf) - return Error("GPR buffer is NULL"); + return Status("GPR buffer is NULL"); size_t buf_size = GetGPRSize(); return DoReadGPR(buf, buf_size); } -Error NativeRegisterContextLinux::WriteGPR() { +Status NativeRegisterContextLinux::WriteGPR() { void *buf = GetGPRBuffer(); if (!buf) - return Error("GPR buffer is NULL"); + return Status("GPR buffer is NULL"); size_t buf_size = GetGPRSize(); return DoWriteGPR(buf, buf_size); } -Error NativeRegisterContextLinux::ReadFPR() { +Status NativeRegisterContextLinux::ReadFPR() { void *buf = GetFPRBuffer(); if (!buf) - return Error("FPR buffer is NULL"); + return Status("FPR buffer is NULL"); size_t buf_size = GetFPRSize(); return DoReadFPR(buf, buf_size); } -Error NativeRegisterContextLinux::WriteFPR() { +Status NativeRegisterContextLinux::WriteFPR() { void *buf = GetFPRBuffer(); if (!buf) - return Error("FPR buffer is NULL"); + return Status("FPR buffer is NULL"); size_t buf_size = GetFPRSize(); return DoWriteFPR(buf, buf_size); } -Error NativeRegisterContextLinux::ReadRegisterSet(void *buf, size_t buf_size, - unsigned int regset) { +Status NativeRegisterContextLinux::ReadRegisterSet(void *buf, size_t buf_size, + unsigned int regset) { return NativeProcessLinux::PtraceWrapper(PTRACE_GETREGSET, m_thread.GetID(), static_cast<void *>(®set), buf, buf_size); } -Error NativeRegisterContextLinux::WriteRegisterSet(void *buf, size_t buf_size, - unsigned int regset) { +Status NativeRegisterContextLinux::WriteRegisterSet(void *buf, size_t buf_size, + unsigned int regset) { return NativeProcessLinux::PtraceWrapper(PTRACE_SETREGSET, m_thread.GetID(), static_cast<void *>(®set), buf, buf_size); } -Error NativeRegisterContextLinux::DoReadRegisterValue(uint32_t offset, - const char *reg_name, - uint32_t size, - RegisterValue &value) { +Status NativeRegisterContextLinux::DoReadRegisterValue(uint32_t offset, + const char *reg_name, + uint32_t size, + RegisterValue &value) { Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_REGISTERS)); long data; - Error error = NativeProcessLinux::PtraceWrapper( + Status error = NativeProcessLinux::PtraceWrapper( PTRACE_PEEKUSER, m_thread.GetID(), reinterpret_cast<void *>(offset), nullptr, 0, &data); @@ -175,7 +176,7 @@ Error NativeRegisterContextLinux::DoReadRegisterValue(uint32_t offset, return error; } -Error NativeRegisterContextLinux::DoWriteRegisterValue( +Status NativeRegisterContextLinux::DoWriteRegisterValue( uint32_t offset, const char *reg_name, const RegisterValue &value) { Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_REGISTERS)); @@ -186,22 +187,22 @@ Error NativeRegisterContextLinux::DoWriteRegisterValue( PTRACE_POKEUSER, m_thread.GetID(), reinterpret_cast<void *>(offset), buf); } -Error NativeRegisterContextLinux::DoReadGPR(void *buf, size_t buf_size) { +Status NativeRegisterContextLinux::DoReadGPR(void *buf, size_t buf_size) { return NativeProcessLinux::PtraceWrapper(PTRACE_GETREGS, m_thread.GetID(), nullptr, buf, buf_size); } -Error NativeRegisterContextLinux::DoWriteGPR(void *buf, size_t buf_size) { +Status NativeRegisterContextLinux::DoWriteGPR(void *buf, size_t buf_size) { return NativeProcessLinux::PtraceWrapper(PTRACE_SETREGS, m_thread.GetID(), nullptr, buf, buf_size); } -Error NativeRegisterContextLinux::DoReadFPR(void *buf, size_t buf_size) { +Status NativeRegisterContextLinux::DoReadFPR(void *buf, size_t buf_size) { return NativeProcessLinux::PtraceWrapper(PTRACE_GETFPREGS, m_thread.GetID(), nullptr, buf, buf_size); } -Error NativeRegisterContextLinux::DoWriteFPR(void *buf, size_t buf_size) { +Status NativeRegisterContextLinux::DoWriteFPR(void *buf, size_t buf_size) { return NativeProcessLinux::PtraceWrapper(PTRACE_SETFPREGS, m_thread.GetID(), nullptr, buf, buf_size); } diff --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.h b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.h index 4dfc5365f35..26074a6ce0e 100644 --- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.h +++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.h @@ -39,24 +39,24 @@ public: protected: lldb::ByteOrder GetByteOrder() const; - virtual Error ReadRegisterRaw(uint32_t reg_index, RegisterValue ®_value); + virtual Status ReadRegisterRaw(uint32_t reg_index, RegisterValue ®_value); - virtual Error WriteRegisterRaw(uint32_t reg_index, - const RegisterValue ®_value); + virtual Status WriteRegisterRaw(uint32_t reg_index, + const RegisterValue ®_value); - virtual Error ReadRegisterSet(void *buf, size_t buf_size, - unsigned int regset); - - virtual Error WriteRegisterSet(void *buf, size_t buf_size, + virtual Status ReadRegisterSet(void *buf, size_t buf_size, unsigned int regset); - virtual Error ReadGPR(); + virtual Status WriteRegisterSet(void *buf, size_t buf_size, + unsigned int regset); + + virtual Status ReadGPR(); - virtual Error WriteGPR(); + virtual Status WriteGPR(); - virtual Error ReadFPR(); + virtual Status ReadFPR(); - virtual Error WriteFPR(); + virtual Status WriteFPR(); virtual void *GetGPRBuffer() { return nullptr; } @@ -71,19 +71,19 @@ protected: // The Do*** functions are executed on the privileged thread and can perform // ptrace // operations directly. - virtual Error DoReadRegisterValue(uint32_t offset, const char *reg_name, - uint32_t size, RegisterValue &value); + virtual Status DoReadRegisterValue(uint32_t offset, const char *reg_name, + uint32_t size, RegisterValue &value); - virtual Error DoWriteRegisterValue(uint32_t offset, const char *reg_name, - const RegisterValue &value); + virtual Status DoWriteRegisterValue(uint32_t offset, const char *reg_name, + const RegisterValue &value); - virtual Error DoReadGPR(void *buf, size_t buf_size); + virtual Status DoReadGPR(void *buf, size_t buf_size); - virtual Error DoWriteGPR(void *buf, size_t buf_size); + virtual Status DoWriteGPR(void *buf, size_t buf_size); - virtual Error DoReadFPR(void *buf, size_t buf_size); + virtual Status DoReadFPR(void *buf, size_t buf_size); - virtual Error DoWriteFPR(void *buf, size_t buf_size); + virtual Status DoWriteFPR(void *buf, size_t buf_size); }; } // namespace process_linux diff --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp index 2dd23ad75a0..22b7d10869f 100644 --- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp @@ -13,8 +13,8 @@ #include "lldb/Core/RegisterValue.h" #include "lldb/Utility/DataBufferHeap.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" #include "Plugins/Process/Linux/Procfs.h" #include "Plugins/Process/POSIX/ProcessPOSIXLog.h" @@ -157,9 +157,10 @@ NativeRegisterContextLinux_arm::GetRegisterSet(uint32_t set_index) const { return nullptr; } -Error NativeRegisterContextLinux_arm::ReadRegister(const RegisterInfo *reg_info, - RegisterValue ®_value) { - Error error; +Status +NativeRegisterContextLinux_arm::ReadRegister(const RegisterInfo *reg_info, + RegisterValue ®_value) { + Status error; if (!reg_info) { error.SetErrorString("reg_info NULL"); @@ -226,16 +227,17 @@ Error NativeRegisterContextLinux_arm::ReadRegister(const RegisterInfo *reg_info, return error; } -Error NativeRegisterContextLinux_arm::WriteRegister( - const RegisterInfo *reg_info, const RegisterValue ®_value) { +Status +NativeRegisterContextLinux_arm::WriteRegister(const RegisterInfo *reg_info, + const RegisterValue ®_value) { if (!reg_info) - return Error("reg_info NULL"); + return Status("reg_info NULL"); const uint32_t reg_index = reg_info->kinds[lldb::eRegisterKindLLDB]; if (reg_index == LLDB_INVALID_REGNUM) - return Error("no lldb regnum for %s", reg_info && reg_info->name - ? reg_info->name - : "<unknown register>"); + return Status("no lldb regnum for %s", reg_info && reg_info->name + ? reg_info->name + : "<unknown register>"); if (IsGPR(reg_index)) return WriteRegisterRaw(reg_index, reg_value); @@ -257,29 +259,29 @@ Error NativeRegisterContextLinux_arm::WriteRegister( break; default: assert(false && "Unhandled data size."); - return Error("unhandled register data size %" PRIu32, - reg_info->byte_size); + return Status("unhandled register data size %" PRIu32, + reg_info->byte_size); } - Error error = WriteFPR(); + Status error = WriteFPR(); if (error.Fail()) return error; - return Error(); + return Status(); } - return Error("failed - register wasn't recognized to be a GPR or an FPR, " - "write strategy unknown"); + return Status("failed - register wasn't recognized to be a GPR or an FPR, " + "write strategy unknown"); } -Error NativeRegisterContextLinux_arm::ReadAllRegisterValues( +Status NativeRegisterContextLinux_arm::ReadAllRegisterValues( lldb::DataBufferSP &data_sp) { - Error error; + Status error; data_sp.reset(new DataBufferHeap(REG_CONTEXT_SIZE, 0)); if (!data_sp) - return Error("failed to allocate DataBufferHeap instance of size %" PRIu64, - (uint64_t)REG_CONTEXT_SIZE); + return Status("failed to allocate DataBufferHeap instance of size %" PRIu64, + (uint64_t)REG_CONTEXT_SIZE); error = ReadGPR(); if (error.Fail()) @@ -304,9 +306,9 @@ Error NativeRegisterContextLinux_arm::ReadAllRegisterValues( return error; } -Error NativeRegisterContextLinux_arm::WriteAllRegisterValues( +Status NativeRegisterContextLinux_arm::WriteAllRegisterValues( const lldb::DataBufferSP &data_sp) { - Error error; + Status error; if (!data_sp) { error.SetErrorStringWithFormat( @@ -361,7 +363,7 @@ uint32_t NativeRegisterContextLinux_arm::NumSupportedHardwareBreakpoints() { if (log) log->Printf("NativeRegisterContextLinux_arm::%s()", __FUNCTION__); - Error error; + Status error; // Read hardware breakpoint and watchpoint information. error = ReadHardwareDebugInfo(); @@ -380,7 +382,7 @@ NativeRegisterContextLinux_arm::SetHardwareBreakpoint(lldb::addr_t addr, LLDB_LOG(log, "addr: {0:x}, size: {1:x}", addr, size); // Read hardware breakpoint and watchpoint information. - Error error = ReadHardwareDebugInfo(); + Status error = ReadHardwareDebugInfo(); if (error.Fail()) return LLDB_INVALID_INDEX32; @@ -438,7 +440,7 @@ bool NativeRegisterContextLinux_arm::ClearHardwareBreakpoint(uint32_t hw_idx) { LLDB_LOG(log, "hw_idx: {0}", hw_idx); // Read hardware breakpoint and watchpoint information. - Error error = ReadHardwareDebugInfo(); + Status error = ReadHardwareDebugInfo(); if (error.Fail()) return false; @@ -466,7 +468,7 @@ bool NativeRegisterContextLinux_arm::ClearHardwareBreakpoint(uint32_t hw_idx) { return true; } -Error NativeRegisterContextLinux_arm::GetHardwareBreakHitIndex( +Status NativeRegisterContextLinux_arm::GetHardwareBreakHitIndex( uint32_t &bp_index, lldb::addr_t trap_addr) { Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_BREAKPOINTS)); @@ -480,21 +482,21 @@ Error NativeRegisterContextLinux_arm::GetHardwareBreakHitIndex( if ((m_hbr_regs[bp_index].control & 0x1) && (trap_addr == break_addr)) { m_hbr_regs[bp_index].hit_addr = trap_addr; - return Error(); + return Status(); } } bp_index = LLDB_INVALID_INDEX32; - return Error(); + return Status(); } -Error NativeRegisterContextLinux_arm::ClearAllHardwareBreakpoints() { +Status NativeRegisterContextLinux_arm::ClearAllHardwareBreakpoints() { Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_BREAKPOINTS)); if (log) log->Printf("NativeRegisterContextLinux_arm::%s()", __FUNCTION__); - Error error; + Status error; // Read hardware breakpoint and watchpoint information. error = ReadHardwareDebugInfo(); @@ -527,14 +529,14 @@ Error NativeRegisterContextLinux_arm::ClearAllHardwareBreakpoints() { } } - return Error(); + return Status(); } uint32_t NativeRegisterContextLinux_arm::NumSupportedHardwareWatchpoints() { Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_WATCHPOINTS)); // Read hardware breakpoint and watchpoint information. - Error error = ReadHardwareDebugInfo(); + Status error = ReadHardwareDebugInfo(); if (error.Fail()) return 0; @@ -550,7 +552,7 @@ uint32_t NativeRegisterContextLinux_arm::SetHardwareWatchpoint( watch_flags); // Read hardware breakpoint and watchpoint information. - Error error = ReadHardwareDebugInfo(); + Status error = ReadHardwareDebugInfo(); if (error.Fail()) return LLDB_INVALID_INDEX32; @@ -654,7 +656,7 @@ bool NativeRegisterContextLinux_arm::ClearHardwareWatchpoint( LLDB_LOG(log, "wp_index: {0}", wp_index); // Read hardware breakpoint and watchpoint information. - Error error = ReadHardwareDebugInfo(); + Status error = ReadHardwareDebugInfo(); if (error.Fail()) return false; @@ -683,9 +685,9 @@ bool NativeRegisterContextLinux_arm::ClearHardwareWatchpoint( return true; } -Error NativeRegisterContextLinux_arm::ClearAllHardwareWatchpoints() { +Status NativeRegisterContextLinux_arm::ClearAllHardwareWatchpoints() { // Read hardware breakpoint and watchpoint information. - Error error = ReadHardwareDebugInfo(); + Status error = ReadHardwareDebugInfo(); if (error.Fail()) return error; @@ -715,7 +717,7 @@ Error NativeRegisterContextLinux_arm::ClearAllHardwareWatchpoints() { } } - return Error(); + return Status(); } uint32_t NativeRegisterContextLinux_arm::GetWatchpointSize(uint32_t wp_index) { @@ -745,8 +747,9 @@ bool NativeRegisterContextLinux_arm::WatchpointIsEnabled(uint32_t wp_index) { return false; } -Error NativeRegisterContextLinux_arm::GetWatchpointHitIndex( - uint32_t &wp_index, lldb::addr_t trap_addr) { +Status +NativeRegisterContextLinux_arm::GetWatchpointHitIndex(uint32_t &wp_index, + lldb::addr_t trap_addr) { Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_WATCHPOINTS)); LLDB_LOG(log, "wp_index: {0}, trap_addr: {1:x}", wp_index, trap_addr); @@ -760,12 +763,12 @@ Error NativeRegisterContextLinux_arm::GetWatchpointHitIndex( if (WatchpointIsEnabled(wp_index) && trap_addr >= watch_addr && trap_addr < watch_addr + watch_size) { m_hwp_regs[wp_index].hit_addr = trap_addr; - return Error(); + return Status(); } } wp_index = LLDB_INVALID_INDEX32; - return Error(); + return Status(); } lldb::addr_t @@ -796,11 +799,11 @@ NativeRegisterContextLinux_arm::GetWatchpointHitAddress(uint32_t wp_index) { return LLDB_INVALID_ADDRESS; } -Error NativeRegisterContextLinux_arm::ReadHardwareDebugInfo() { - Error error; +Status NativeRegisterContextLinux_arm::ReadHardwareDebugInfo() { + Status error; if (!m_refresh_hwdebug_info) { - return Error(); + return Status(); } unsigned int cap_val; @@ -819,9 +822,9 @@ Error NativeRegisterContextLinux_arm::ReadHardwareDebugInfo() { return error; } -Error NativeRegisterContextLinux_arm::WriteHardwareDebugRegs(int hwbType, - int hwb_index) { - Error error; +Status NativeRegisterContextLinux_arm::WriteHardwareDebugRegs(int hwbType, + int hwb_index) { + Status error; lldb::addr_t *addr_buf; uint32_t *ctrl_buf; @@ -869,7 +872,7 @@ uint32_t NativeRegisterContextLinux_arm::CalculateFprOffset( GetRegisterInfoAtIndex(m_reg_info.first_fpr)->byte_offset; } -Error NativeRegisterContextLinux_arm::DoReadRegisterValue( +Status NativeRegisterContextLinux_arm::DoReadRegisterValue( uint32_t offset, const char *reg_name, uint32_t size, RegisterValue &value) { // PTRACE_PEEKUSER don't work in the aarch64 linux kernel used on android @@ -881,17 +884,17 @@ Error NativeRegisterContextLinux_arm::DoReadRegisterValue( // comparision to processing time in lldb-server. assert(offset % 4 == 0 && "Try to write a register with unaligned offset"); if (offset + sizeof(uint32_t) > sizeof(m_gpr_arm)) - return Error("Register isn't fit into the size of the GPR area"); + return Status("Register isn't fit into the size of the GPR area"); - Error error = DoReadGPR(m_gpr_arm, sizeof(m_gpr_arm)); + Status error = DoReadGPR(m_gpr_arm, sizeof(m_gpr_arm)); if (error.Fail()) return error; value.SetUInt32(m_gpr_arm[offset / sizeof(uint32_t)]); - return Error(); + return Status(); } -Error NativeRegisterContextLinux_arm::DoWriteRegisterValue( +Status NativeRegisterContextLinux_arm::DoWriteRegisterValue( uint32_t offset, const char *reg_name, const RegisterValue &value) { // PTRACE_POKEUSER don't work in the aarch64 linux kernel used on android // devices (always return @@ -903,9 +906,9 @@ Error NativeRegisterContextLinux_arm::DoWriteRegisterValue( // lldb-server. assert(offset % 4 == 0 && "Try to write a register with unaligned offset"); if (offset + sizeof(uint32_t) > sizeof(m_gpr_arm)) - return Error("Register isn't fit into the size of the GPR area"); + return Status("Register isn't fit into the size of the GPR area"); - Error error = DoReadGPR(m_gpr_arm, sizeof(m_gpr_arm)); + Status error = DoReadGPR(m_gpr_arm, sizeof(m_gpr_arm)); if (error.Fail()) return error; @@ -927,7 +930,7 @@ Error NativeRegisterContextLinux_arm::DoWriteRegisterValue( return DoWriteGPR(m_gpr_arm, sizeof(m_gpr_arm)); } -Error NativeRegisterContextLinux_arm::DoReadGPR(void *buf, size_t buf_size) { +Status NativeRegisterContextLinux_arm::DoReadGPR(void *buf, size_t buf_size) { #ifdef __arm__ return NativeRegisterContextLinux::DoReadGPR(buf, buf_size); #else // __aarch64__ @@ -939,7 +942,7 @@ Error NativeRegisterContextLinux_arm::DoReadGPR(void *buf, size_t buf_size) { #endif // __arm__ } -Error NativeRegisterContextLinux_arm::DoWriteGPR(void *buf, size_t buf_size) { +Status NativeRegisterContextLinux_arm::DoWriteGPR(void *buf, size_t buf_size) { #ifdef __arm__ return NativeRegisterContextLinux::DoWriteGPR(buf, buf_size); #else // __aarch64__ @@ -951,7 +954,7 @@ Error NativeRegisterContextLinux_arm::DoWriteGPR(void *buf, size_t buf_size) { #endif // __arm__ } -Error NativeRegisterContextLinux_arm::DoReadFPR(void *buf, size_t buf_size) { +Status NativeRegisterContextLinux_arm::DoReadFPR(void *buf, size_t buf_size) { #ifdef __arm__ return NativeProcessLinux::PtraceWrapper(PTRACE_GETVFPREGS, m_thread.GetID(), nullptr, buf, buf_size); @@ -964,7 +967,7 @@ Error NativeRegisterContextLinux_arm::DoReadFPR(void *buf, size_t buf_size) { #endif // __arm__ } -Error NativeRegisterContextLinux_arm::DoWriteFPR(void *buf, size_t buf_size) { +Status NativeRegisterContextLinux_arm::DoWriteFPR(void *buf, size_t buf_size) { #ifdef __arm__ return NativeProcessLinux::PtraceWrapper(PTRACE_SETVFPREGS, m_thread.GetID(), nullptr, buf, buf_size); diff --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.h b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.h index 824ac88ad9e..ec99c05e164 100644 --- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.h +++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.h @@ -32,15 +32,15 @@ public: uint32_t GetUserRegisterCount() const override; - Error ReadRegister(const RegisterInfo *reg_info, - RegisterValue ®_value) override; + Status ReadRegister(const RegisterInfo *reg_info, + RegisterValue ®_value) override; - Error WriteRegister(const RegisterInfo *reg_info, - const RegisterValue ®_value) override; + Status WriteRegister(const RegisterInfo *reg_info, + const RegisterValue ®_value) override; - Error ReadAllRegisterValues(lldb::DataBufferSP &data_sp) override; + Status ReadAllRegisterValues(lldb::DataBufferSP &data_sp) override; - Error WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override; + Status WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override; //------------------------------------------------------------------ // Hardware breakpoints/watchpoint mangement functions @@ -52,10 +52,10 @@ public: bool ClearHardwareBreakpoint(uint32_t hw_idx) override; - Error ClearAllHardwareBreakpoints() override; + Status ClearAllHardwareBreakpoints() override; - Error GetHardwareBreakHitIndex(uint32_t &bp_index, - lldb::addr_t trap_addr) override; + Status GetHardwareBreakHitIndex(uint32_t &bp_index, + lldb::addr_t trap_addr) override; uint32_t NumSupportedHardwareWatchpoints() override; @@ -64,10 +64,10 @@ public: bool ClearHardwareWatchpoint(uint32_t hw_index) override; - Error ClearAllHardwareWatchpoints() override; + Status ClearAllHardwareWatchpoints() override; - Error GetWatchpointHitIndex(uint32_t &wp_index, - lldb::addr_t trap_addr) override; + Status GetWatchpointHitIndex(uint32_t &wp_index, + lldb::addr_t trap_addr) override; lldb::addr_t GetWatchpointHitAddress(uint32_t wp_index) override; @@ -81,19 +81,19 @@ public: enum DREGType { eDREGTypeWATCH = 0, eDREGTypeBREAK }; protected: - Error DoReadRegisterValue(uint32_t offset, const char *reg_name, - uint32_t size, RegisterValue &value) override; + Status DoReadRegisterValue(uint32_t offset, const char *reg_name, + uint32_t size, RegisterValue &value) override; - Error DoWriteRegisterValue(uint32_t offset, const char *reg_name, - const RegisterValue &value) override; + Status DoWriteRegisterValue(uint32_t offset, const char *reg_name, + const RegisterValue &value) override; - Error DoReadGPR(void *buf, size_t buf_size) override; + Status DoReadGPR(void *buf, size_t buf_size) override; - Error DoWriteGPR(void *buf, size_t buf_size) override; + Status DoWriteGPR(void *buf, size_t buf_size) override; - Error DoReadFPR(void *buf, size_t buf_size) override; + Status DoReadFPR(void *buf, size_t buf_size) override; - Error DoWriteFPR(void *buf, size_t buf_size) override; + Status DoWriteFPR(void *buf, size_t buf_size) override; void *GetGPRBuffer() override { return &m_gpr_arm; } @@ -155,9 +155,9 @@ private: bool IsFPR(unsigned reg) const; - Error ReadHardwareDebugInfo(); + Status ReadHardwareDebugInfo(); - Error WriteHardwareDebugRegs(int hwbType, int hwb_index); + Status WriteHardwareDebugRegs(int hwbType, int hwb_index); uint32_t CalculateFprOffset(const RegisterInfo *reg_info) const; }; diff --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp index f3715147fa3..c3b58f16256 100644 --- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp @@ -19,8 +19,8 @@ #include "lldb/Core/RegisterValue.h" #include "lldb/Host/common/NativeProcessProtocol.h" #include "lldb/Utility/DataBufferHeap.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" #include "Plugins/Process/Linux/NativeProcessLinux.h" #include "Plugins/Process/Linux/Procfs.h" @@ -180,9 +180,10 @@ uint32_t NativeRegisterContextLinux_arm64::GetUserRegisterCount() const { return count; } -Error NativeRegisterContextLinux_arm64::ReadRegister( - const RegisterInfo *reg_info, RegisterValue ®_value) { - Error error; +Status +NativeRegisterContextLinux_arm64::ReadRegister(const RegisterInfo *reg_info, + RegisterValue ®_value) { + Status error; if (!reg_info) { error.SetErrorString("reg_info NULL"); @@ -232,16 +233,16 @@ Error NativeRegisterContextLinux_arm64::ReadRegister( return error; } -Error NativeRegisterContextLinux_arm64::WriteRegister( +Status NativeRegisterContextLinux_arm64::WriteRegister( const RegisterInfo *reg_info, const RegisterValue ®_value) { if (!reg_info) - return Error("reg_info NULL"); + return Status("reg_info NULL"); const uint32_t reg_index = reg_info->kinds[lldb::eRegisterKindLLDB]; if (reg_index == LLDB_INVALID_REGNUM) - return Error("no lldb regnum for %s", reg_info && reg_info->name - ? reg_info->name - : "<unknown register>"); + return Status("no lldb regnum for %s", reg_info && reg_info->name + ? reg_info->name + : "<unknown register>"); if (IsGPR(reg_index)) return WriteRegisterRaw(reg_index, reg_value); @@ -263,29 +264,29 @@ Error NativeRegisterContextLinux_arm64::WriteRegister( break; default: assert(false && "Unhandled data size."); - return Error("unhandled register data size %" PRIu32, - reg_info->byte_size); + return Status("unhandled register data size %" PRIu32, + reg_info->byte_size); } - Error error = WriteFPR(); + Status error = WriteFPR(); if (error.Fail()) return error; - return Error(); + return Status(); } - return Error("failed - register wasn't recognized to be a GPR or an FPR, " - "write strategy unknown"); + return Status("failed - register wasn't recognized to be a GPR or an FPR, " + "write strategy unknown"); } -Error NativeRegisterContextLinux_arm64::ReadAllRegisterValues( +Status NativeRegisterContextLinux_arm64::ReadAllRegisterValues( lldb::DataBufferSP &data_sp) { - Error error; + Status error; data_sp.reset(new DataBufferHeap(REG_CONTEXT_SIZE, 0)); if (!data_sp) - return Error("failed to allocate DataBufferHeap instance of size %" PRIu64, - REG_CONTEXT_SIZE); + return Status("failed to allocate DataBufferHeap instance of size %" PRIu64, + REG_CONTEXT_SIZE); error = ReadGPR(); if (error.Fail()) @@ -310,9 +311,9 @@ Error NativeRegisterContextLinux_arm64::ReadAllRegisterValues( return error; } -Error NativeRegisterContextLinux_arm64::WriteAllRegisterValues( +Status NativeRegisterContextLinux_arm64::WriteAllRegisterValues( const lldb::DataBufferSP &data_sp) { - Error error; + Status error; if (!data_sp) { error.SetErrorStringWithFormat( @@ -367,7 +368,7 @@ uint32_t NativeRegisterContextLinux_arm64::NumSupportedHardwareBreakpoints() { if (log) log->Printf("NativeRegisterContextLinux_arm64::%s()", __FUNCTION__); - Error error; + Status error; // Read hardware breakpoint and watchpoint information. error = ReadHardwareDebugInfo(); @@ -385,7 +386,7 @@ NativeRegisterContextLinux_arm64::SetHardwareBreakpoint(lldb::addr_t addr, LLDB_LOG(log, "addr: {0:x}, size: {1:x}", addr, size); // Read hardware breakpoint and watchpoint information. - Error error = ReadHardwareDebugInfo(); + Status error = ReadHardwareDebugInfo(); if (error.Fail()) return LLDB_INVALID_INDEX32; @@ -443,7 +444,7 @@ bool NativeRegisterContextLinux_arm64::ClearHardwareBreakpoint( LLDB_LOG(log, "hw_idx: {0}", hw_idx); // Read hardware breakpoint and watchpoint information. - Error error = ReadHardwareDebugInfo(); + Status error = ReadHardwareDebugInfo(); if (error.Fail()) return false; @@ -471,7 +472,7 @@ bool NativeRegisterContextLinux_arm64::ClearHardwareBreakpoint( return true; } -Error NativeRegisterContextLinux_arm64::GetHardwareBreakHitIndex( +Status NativeRegisterContextLinux_arm64::GetHardwareBreakHitIndex( uint32_t &bp_index, lldb::addr_t trap_addr) { Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_BREAKPOINTS)); @@ -485,21 +486,21 @@ Error NativeRegisterContextLinux_arm64::GetHardwareBreakHitIndex( if ((m_hbr_regs[bp_index].control & 0x1) && (trap_addr == break_addr)) { m_hbr_regs[bp_index].hit_addr = trap_addr; - return Error(); + return Status(); } } bp_index = LLDB_INVALID_INDEX32; - return Error(); + return Status(); } -Error NativeRegisterContextLinux_arm64::ClearAllHardwareBreakpoints() { +Status NativeRegisterContextLinux_arm64::ClearAllHardwareBreakpoints() { Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_BREAKPOINTS)); if (log) log->Printf("NativeRegisterContextLinux_arm64::%s()", __FUNCTION__); - Error error; + Status error; // Read hardware breakpoint and watchpoint information. error = ReadHardwareDebugInfo(); @@ -532,14 +533,14 @@ Error NativeRegisterContextLinux_arm64::ClearAllHardwareBreakpoints() { } } - return Error(); + return Status(); } uint32_t NativeRegisterContextLinux_arm64::NumSupportedHardwareWatchpoints() { Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_WATCHPOINTS)); // Read hardware breakpoint and watchpoint information. - Error error = ReadHardwareDebugInfo(); + Status error = ReadHardwareDebugInfo(); if (error.Fail()) return 0; @@ -555,7 +556,7 @@ uint32_t NativeRegisterContextLinux_arm64::SetHardwareWatchpoint( watch_flags); // Read hardware breakpoint and watchpoint information. - Error error = ReadHardwareDebugInfo(); + Status error = ReadHardwareDebugInfo(); if (error.Fail()) return LLDB_INVALID_INDEX32; @@ -642,7 +643,7 @@ bool NativeRegisterContextLinux_arm64::ClearHardwareWatchpoint( LLDB_LOG(log, "wp_index: {0}", wp_index); // Read hardware breakpoint and watchpoint information. - Error error = ReadHardwareDebugInfo(); + Status error = ReadHardwareDebugInfo(); if (error.Fail()) return false; @@ -671,9 +672,9 @@ bool NativeRegisterContextLinux_arm64::ClearHardwareWatchpoint( return true; } -Error NativeRegisterContextLinux_arm64::ClearAllHardwareWatchpoints() { +Status NativeRegisterContextLinux_arm64::ClearAllHardwareWatchpoints() { // Read hardware breakpoint and watchpoint information. - Error error = ReadHardwareDebugInfo(); + Status error = ReadHardwareDebugInfo(); if (error.Fail()) return error; @@ -703,7 +704,7 @@ Error NativeRegisterContextLinux_arm64::ClearAllHardwareWatchpoints() { } } - return Error(); + return Status(); } uint32_t @@ -734,7 +735,7 @@ bool NativeRegisterContextLinux_arm64::WatchpointIsEnabled(uint32_t wp_index) { return false; } -Error NativeRegisterContextLinux_arm64::GetWatchpointHitIndex( +Status NativeRegisterContextLinux_arm64::GetWatchpointHitIndex( uint32_t &wp_index, lldb::addr_t trap_addr) { Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_WATCHPOINTS)); LLDB_LOG(log, "wp_index: {0}, trap_addr: {1:x}", wp_index, trap_addr); @@ -749,12 +750,12 @@ Error NativeRegisterContextLinux_arm64::GetWatchpointHitIndex( if (WatchpointIsEnabled(wp_index) && trap_addr >= watch_addr && trap_addr < watch_addr + watch_size) { m_hwp_regs[wp_index].hit_addr = trap_addr; - return Error(); + return Status(); } } wp_index = LLDB_INVALID_INDEX32; - return Error(); + return Status(); } lldb::addr_t @@ -785,9 +786,9 @@ NativeRegisterContextLinux_arm64::GetWatchpointHitAddress(uint32_t wp_index) { return LLDB_INVALID_ADDRESS; } -Error NativeRegisterContextLinux_arm64::ReadHardwareDebugInfo() { +Status NativeRegisterContextLinux_arm64::ReadHardwareDebugInfo() { if (!m_refresh_hwdebug_info) { - return Error(); + return Status(); } ::pid_t tid = m_thread.GetID(); @@ -795,7 +796,7 @@ Error NativeRegisterContextLinux_arm64::ReadHardwareDebugInfo() { int regset = NT_ARM_HW_WATCH; struct iovec ioVec; struct user_hwdebug_state dreg_state; - Error error; + Status error; ioVec.iov_base = &dreg_state; ioVec.iov_len = sizeof(dreg_state); @@ -820,10 +821,10 @@ Error NativeRegisterContextLinux_arm64::ReadHardwareDebugInfo() { return error; } -Error NativeRegisterContextLinux_arm64::WriteHardwareDebugRegs(int hwbType) { +Status NativeRegisterContextLinux_arm64::WriteHardwareDebugRegs(int hwbType) { struct iovec ioVec; struct user_hwdebug_state dreg_state; - Error error; + Status error; memset(&dreg_state, 0, sizeof(dreg_state)); ioVec.iov_base = &dreg_state; @@ -852,10 +853,10 @@ Error NativeRegisterContextLinux_arm64::WriteHardwareDebugRegs(int hwbType) { &hwbType, &ioVec, ioVec.iov_len); } -Error NativeRegisterContextLinux_arm64::DoReadRegisterValue( +Status NativeRegisterContextLinux_arm64::DoReadRegisterValue( uint32_t offset, const char *reg_name, uint32_t size, RegisterValue &value) { - Error error; + Status error; if (offset > sizeof(struct user_pt_regs)) { uintptr_t offset = offset - sizeof(struct user_pt_regs); if (offset > sizeof(struct user_fpsimd_state)) { @@ -899,9 +900,9 @@ Error NativeRegisterContextLinux_arm64::DoReadRegisterValue( return error; } -Error NativeRegisterContextLinux_arm64::DoWriteRegisterValue( +Status NativeRegisterContextLinux_arm64::DoWriteRegisterValue( uint32_t offset, const char *reg_name, const RegisterValue &value) { - Error error; + Status error; ::pid_t tid = m_thread.GetID(); if (offset > sizeof(struct user_pt_regs)) { uintptr_t offset = offset - sizeof(struct user_pt_regs); @@ -943,10 +944,10 @@ Error NativeRegisterContextLinux_arm64::DoWriteRegisterValue( return error; } -Error NativeRegisterContextLinux_arm64::DoReadGPR(void *buf, size_t buf_size) { +Status NativeRegisterContextLinux_arm64::DoReadGPR(void *buf, size_t buf_size) { int regset = NT_PRSTATUS; struct iovec ioVec; - Error error; + Status error; ioVec.iov_base = buf; ioVec.iov_len = buf_size; @@ -954,10 +955,11 @@ Error NativeRegisterContextLinux_arm64::DoReadGPR(void *buf, size_t buf_size) { ®set, &ioVec, buf_size); } -Error NativeRegisterContextLinux_arm64::DoWriteGPR(void *buf, size_t buf_size) { +Status NativeRegisterContextLinux_arm64::DoWriteGPR(void *buf, + size_t buf_size) { int regset = NT_PRSTATUS; struct iovec ioVec; - Error error; + Status error; ioVec.iov_base = buf; ioVec.iov_len = buf_size; @@ -965,10 +967,10 @@ Error NativeRegisterContextLinux_arm64::DoWriteGPR(void *buf, size_t buf_size) { ®set, &ioVec, buf_size); } -Error NativeRegisterContextLinux_arm64::DoReadFPR(void *buf, size_t buf_size) { +Status NativeRegisterContextLinux_arm64::DoReadFPR(void *buf, size_t buf_size) { int regset = NT_FPREGSET; struct iovec ioVec; - Error error; + Status error; ioVec.iov_base = buf; ioVec.iov_len = buf_size; @@ -976,10 +978,11 @@ Error NativeRegisterContextLinux_arm64::DoReadFPR(void *buf, size_t buf_size) { ®set, &ioVec, buf_size); } -Error NativeRegisterContextLinux_arm64::DoWriteFPR(void *buf, size_t buf_size) { +Status NativeRegisterContextLinux_arm64::DoWriteFPR(void *buf, + size_t buf_size) { int regset = NT_FPREGSET; struct iovec ioVec; - Error error; + Status error; ioVec.iov_base = buf; ioVec.iov_len = buf_size; diff --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h index 4ffbd97ee33..9877dec37c4 100644 --- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h +++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h @@ -32,15 +32,15 @@ public: const RegisterSet *GetRegisterSet(uint32_t set_index) const override; - Error ReadRegister(const RegisterInfo *reg_info, - RegisterValue ®_value) override; + Status ReadRegister(const RegisterInfo *reg_info, + RegisterValue ®_value) override; - Error WriteRegister(const RegisterInfo *reg_info, - const RegisterValue ®_value) override; + Status WriteRegister(const RegisterInfo *reg_info, + const RegisterValue ®_value) override; - Error ReadAllRegisterValues(lldb::DataBufferSP &data_sp) override; + Status ReadAllRegisterValues(lldb::DataBufferSP &data_sp) override; - Error WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override; + Status WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override; //------------------------------------------------------------------ // Hardware breakpoints/watchpoint mangement functions @@ -52,10 +52,10 @@ public: bool ClearHardwareBreakpoint(uint32_t hw_idx) override; - Error ClearAllHardwareBreakpoints() override; + Status ClearAllHardwareBreakpoints() override; - Error GetHardwareBreakHitIndex(uint32_t &bp_index, - lldb::addr_t trap_addr) override; + Status GetHardwareBreakHitIndex(uint32_t &bp_index, + lldb::addr_t trap_addr) override; uint32_t NumSupportedHardwareWatchpoints() override; @@ -64,10 +64,10 @@ public: bool ClearHardwareWatchpoint(uint32_t hw_index) override; - Error ClearAllHardwareWatchpoints() override; + Status ClearAllHardwareWatchpoints() override; - Error GetWatchpointHitIndex(uint32_t &wp_index, - lldb::addr_t trap_addr) override; + Status GetWatchpointHitIndex(uint32_t &wp_index, + lldb::addr_t trap_addr) override; lldb::addr_t GetWatchpointHitAddress(uint32_t wp_index) override; @@ -81,19 +81,19 @@ public: enum DREGType { eDREGTypeWATCH = 0, eDREGTypeBREAK }; protected: - Error DoReadRegisterValue(uint32_t offset, const char *reg_name, - uint32_t size, RegisterValue &value) override; + Status DoReadRegisterValue(uint32_t offset, const char *reg_name, + uint32_t size, RegisterValue &value) override; - Error DoWriteRegisterValue(uint32_t offset, const char *reg_name, - const RegisterValue &value) override; + Status DoWriteRegisterValue(uint32_t offset, const char *reg_name, + const RegisterValue &value) override; - Error DoReadGPR(void *buf, size_t buf_size) override; + Status DoReadGPR(void *buf, size_t buf_size) override; - Error DoWriteGPR(void *buf, size_t buf_size) override; + Status DoWriteGPR(void *buf, size_t buf_size) override; - Error DoReadFPR(void *buf, size_t buf_size) override; + Status DoReadFPR(void *buf, size_t buf_size) override; - Error DoWriteFPR(void *buf, size_t buf_size) override; + Status DoWriteFPR(void *buf, size_t buf_size) override; void *GetGPRBuffer() override { return &m_gpr_arm64; } @@ -155,9 +155,9 @@ private: bool IsFPR(unsigned reg) const; - Error ReadHardwareDebugInfo(); + Status ReadHardwareDebugInfo(); - Error WriteHardwareDebugRegs(int hwbType); + Status WriteHardwareDebugRegs(int hwbType); uint32_t CalculateFprOffset(const RegisterInfo *reg_info) const; }; diff --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp index 7c5c4247717..dee2c064a34 100644 --- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp @@ -25,9 +25,9 @@ #include "lldb/Host/Host.h" #include "lldb/Host/HostInfo.h" #include "lldb/Utility/DataBufferHeap.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/LLDBAssert.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" #include "lldb/lldb-enumerations.h" #include "lldb/lldb-private-enumerations.h" #define NT_MIPS_MSA 0x600 @@ -178,7 +178,7 @@ uint32_t NativeRegisterContextLinux_mips64::GetRegisterSetCount() const { lldb::addr_t NativeRegisterContextLinux_mips64::GetPCfromBreakpointLocation( lldb::addr_t fail_value) { - Error error; + Status error; RegisterValue pc_value; lldb::addr_t pc = fail_value; Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_BREAKPOINTS)); @@ -244,10 +244,10 @@ NativeRegisterContextLinux_mips64::GetRegisterSet(uint32_t set_index) const { } } -lldb_private::Error +lldb_private::Status NativeRegisterContextLinux_mips64::ReadRegister(const RegisterInfo *reg_info, RegisterValue ®_value) { - Error error; + Status error; if (!reg_info) { error.SetErrorString("reg_info NULL"); @@ -315,18 +315,18 @@ NativeRegisterContextLinux_mips64::ReadRegister(const RegisterInfo *reg_info, return error; } -lldb_private::Error NativeRegisterContextLinux_mips64::WriteRegister( +lldb_private::Status NativeRegisterContextLinux_mips64::WriteRegister( const RegisterInfo *reg_info, const RegisterValue ®_value) { - Error error; + Status error; assert(reg_info && "reg_info is null"); const uint32_t reg_index = reg_info->kinds[lldb::eRegisterKindLLDB]; if (reg_index == LLDB_INVALID_REGNUM) - return Error("no lldb regnum for %s", reg_info && reg_info->name - ? reg_info->name - : "<unknown register>"); + return Status("no lldb regnum for %s", reg_info && reg_info->name + ? reg_info->name + : "<unknown register>"); if (IsMSA(reg_index) && !IsMSAAvailable()) { error.SetErrorString("MSA not available on this processor"); @@ -383,9 +383,9 @@ lldb_private::Error NativeRegisterContextLinux_mips64::WriteRegister( return error; } -Error NativeRegisterContextLinux_mips64::ReadAllRegisterValues( +Status NativeRegisterContextLinux_mips64::ReadAllRegisterValues( lldb::DataBufferSP &data_sp) { - Error error; + Status error; data_sp.reset(new DataBufferHeap(REG_CONTEXT_SIZE, 0)); if (!data_sp) { @@ -426,9 +426,9 @@ Error NativeRegisterContextLinux_mips64::ReadAllRegisterValues( return error; } -Error NativeRegisterContextLinux_mips64::WriteAllRegisterValues( +Status NativeRegisterContextLinux_mips64::WriteAllRegisterValues( const lldb::DataBufferSP &data_sp) { - Error error; + Status error; if (!data_sp) { error.SetErrorStringWithFormat( @@ -481,8 +481,8 @@ Error NativeRegisterContextLinux_mips64::WriteAllRegisterValues( return error; } -Error NativeRegisterContextLinux_mips64::ReadCP1() { - Error error; +Status NativeRegisterContextLinux_mips64::ReadCP1() { + Status error; uint8_t *src = nullptr; uint8_t *dst = nullptr; @@ -529,8 +529,8 @@ NativeRegisterContextLinux_mips64::ReturnFPOffset(uint8_t reg_index, return fp_buffer_ptr; } -Error NativeRegisterContextLinux_mips64::WriteCP1() { - Error error; +Status NativeRegisterContextLinux_mips64::WriteCP1() { + Status error; uint8_t *src = nullptr; uint8_t *dst = nullptr; @@ -740,7 +740,7 @@ bool NativeRegisterContextLinux_mips64::IsMSAAvailable() { MSA_linux_mips msa_buf; unsigned int regset = NT_MIPS_MSA; - Error error = NativeProcessLinux::PtraceWrapper( + Status error = NativeProcessLinux::PtraceWrapper( PTRACE_GETREGSET, Host::GetCurrentProcessID(), static_cast<void *>(®set), &msa_buf, sizeof(MSA_linux_mips)); @@ -751,14 +751,14 @@ bool NativeRegisterContextLinux_mips64::IsMSAAvailable() { return false; } -Error NativeRegisterContextLinux_mips64::IsWatchpointHit(uint32_t wp_index, - bool &is_hit) { +Status NativeRegisterContextLinux_mips64::IsWatchpointHit(uint32_t wp_index, + bool &is_hit) { if (wp_index >= NumSupportedHardwareWatchpoints()) - return Error("Watchpoint index out of range"); + return Status("Watchpoint index out of range"); // reading the current state of watch regs struct pt_watch_regs watch_readback; - Error error = DoReadWatchPointRegisterValue( + Status error = DoReadWatchPointRegisterValue( m_thread.GetID(), static_cast<void *>(&watch_readback)); if (GetWatchHi(&watch_readback, wp_index) & (IRW)) { @@ -775,12 +775,12 @@ Error NativeRegisterContextLinux_mips64::IsWatchpointHit(uint32_t wp_index, return error; } -Error NativeRegisterContextLinux_mips64::GetWatchpointHitIndex( +Status NativeRegisterContextLinux_mips64::GetWatchpointHitIndex( uint32_t &wp_index, lldb::addr_t trap_addr) { uint32_t num_hw_wps = NumSupportedHardwareWatchpoints(); for (wp_index = 0; wp_index < num_hw_wps; ++wp_index) { bool is_hit; - Error error = IsWatchpointHit(wp_index, is_hit); + Status error = IsWatchpointHit(wp_index, is_hit); if (error.Fail()) { wp_index = LLDB_INVALID_INDEX32; } else if (is_hit) { @@ -788,15 +788,15 @@ Error NativeRegisterContextLinux_mips64::GetWatchpointHitIndex( } } wp_index = LLDB_INVALID_INDEX32; - return Error(); + return Status(); } -Error NativeRegisterContextLinux_mips64::IsWatchpointVacant(uint32_t wp_index, - bool &is_vacant) { +Status NativeRegisterContextLinux_mips64::IsWatchpointVacant(uint32_t wp_index, + bool &is_vacant) { is_vacant = false; - return Error("MIPS TODO: " - "NativeRegisterContextLinux_mips64::IsWatchpointVacant not " - "implemented"); + return Status("MIPS TODO: " + "NativeRegisterContextLinux_mips64::IsWatchpointVacant not " + "implemented"); } bool NativeRegisterContextLinux_mips64::ClearHardwareWatchpoint( @@ -821,8 +821,8 @@ bool NativeRegisterContextLinux_mips64::ClearHardwareWatchpoint( default_watch_regs.mips64.watch_masks[wp_index]; } - Error error = DoWriteWatchPointRegisterValue(m_thread.GetID(), - static_cast<void *>(®s)); + Status error = DoWriteWatchPointRegisterValue(m_thread.GetID(), + static_cast<void *>(®s)); if (!error.Fail()) { hw_addr_map[wp_index] = LLDB_INVALID_ADDRESS; return true; @@ -830,14 +830,14 @@ bool NativeRegisterContextLinux_mips64::ClearHardwareWatchpoint( return false; } -Error NativeRegisterContextLinux_mips64::ClearAllHardwareWatchpoints() { +Status NativeRegisterContextLinux_mips64::ClearAllHardwareWatchpoints() { return DoWriteWatchPointRegisterValue( m_thread.GetID(), static_cast<void *>(&default_watch_regs)); } -Error NativeRegisterContextLinux_mips64::SetHardwareWatchpointWithIndex( +Status NativeRegisterContextLinux_mips64::SetHardwareWatchpointWithIndex( lldb::addr_t addr, size_t size, uint32_t watch_flags, uint32_t wp_index) { - Error error; + Status error; error.SetErrorString("MIPS TODO: " "NativeRegisterContextLinux_mips64::" "SetHardwareWatchpointWithIndex not implemented"); @@ -910,7 +910,7 @@ static bool ReadRegisterCallback(EmulateInstruction *instruction, void *baton, emulator_baton->m_reg_context->GetRegisterInfo( lldb::eRegisterKindDWARF, reg_info->kinds[lldb::eRegisterKindDWARF]); - Error error = + Status error = emulator_baton->m_reg_context->ReadRegister(full_reg_info, reg_value); if (error.Success()) return true; @@ -991,12 +991,13 @@ uint32_t NativeRegisterContextLinux_mips64::NumSupportedHardwareWatchpoints() { return num_valid; } -Error NativeRegisterContextLinux_mips64::ReadRegisterRaw(uint32_t reg_index, - RegisterValue &value) { +Status +NativeRegisterContextLinux_mips64::ReadRegisterRaw(uint32_t reg_index, + RegisterValue &value) { const RegisterInfo *const reg_info = GetRegisterInfoAtIndex(reg_index); if (!reg_info) - return Error("register %" PRIu32 " not found", reg_index); + return Status("register %" PRIu32 " not found", reg_index); uint32_t offset = reg_info->kinds[lldb::eRegisterKindProcessPlugin]; @@ -1008,12 +1009,12 @@ Error NativeRegisterContextLinux_mips64::ReadRegisterRaw(uint32_t reg_index, value); } -Error NativeRegisterContextLinux_mips64::WriteRegisterRaw( +Status NativeRegisterContextLinux_mips64::WriteRegisterRaw( uint32_t reg_index, const RegisterValue &value) { const RegisterInfo *const reg_info = GetRegisterInfoAtIndex(reg_index); if (!reg_info) - return Error("register %" PRIu32 " not found", reg_index); + return Status("register %" PRIu32 " not found", reg_index); if (reg_info->invalidate_regs) lldbassert(false && "reg_info->invalidate_regs is unhandled"); @@ -1022,14 +1023,14 @@ Error NativeRegisterContextLinux_mips64::WriteRegisterRaw( return DoWriteRegisterValue(offset, reg_info->name, value); } -Error NativeRegisterContextLinux_mips64::Read_SR_Config(uint32_t offset, - const char *reg_name, - uint32_t size, - RegisterValue &value) { +Status NativeRegisterContextLinux_mips64::Read_SR_Config(uint32_t offset, + const char *reg_name, + uint32_t size, + RegisterValue &value) { GPR_linux_mips regs; ::memset(®s, 0, sizeof(GPR_linux_mips)); - Error error = NativeProcessLinux::PtraceWrapper( + Status error = NativeProcessLinux::PtraceWrapper( PTRACE_GETREGS, m_thread.GetID(), NULL, ®s, sizeof regs); if (error.Success()) { lldb_private::ArchSpec arch; @@ -1043,13 +1044,13 @@ Error NativeRegisterContextLinux_mips64::Read_SR_Config(uint32_t offset, return error; } -Error NativeRegisterContextLinux_mips64::DoReadWatchPointRegisterValue( +Status NativeRegisterContextLinux_mips64::DoReadWatchPointRegisterValue( lldb::tid_t tid, void *watch_readback) { return NativeProcessLinux::PtraceWrapper(PTRACE_GET_WATCH_REGS, m_thread.GetID(), watch_readback); } -Error NativeRegisterContextLinux_mips64::DoWriteWatchPointRegisterValue( +Status NativeRegisterContextLinux_mips64::DoWriteWatchPointRegisterValue( lldb::tid_t tid, void *watch_reg_value) { return NativeProcessLinux::PtraceWrapper(PTRACE_SET_WATCH_REGS, m_thread.GetID(), watch_reg_value); diff --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.h b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.h index 1b25609205d..3e14da5a272 100644 --- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.h +++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.h @@ -38,35 +38,36 @@ public: const RegisterSet *GetRegisterSet(uint32_t set_index) const override; - Error ReadRegister(const RegisterInfo *reg_info, - RegisterValue ®_value) override; + Status ReadRegister(const RegisterInfo *reg_info, + RegisterValue ®_value) override; - Error WriteRegister(const RegisterInfo *reg_info, - const RegisterValue ®_value) override; + Status WriteRegister(const RegisterInfo *reg_info, + const RegisterValue ®_value) override; - Error ReadAllRegisterValues(lldb::DataBufferSP &data_sp) override; + Status ReadAllRegisterValues(lldb::DataBufferSP &data_sp) override; - Error WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override; + Status WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override; - Error ReadCP1(); + Status ReadCP1(); - Error WriteCP1(); + Status WriteCP1(); uint8_t *ReturnFPOffset(uint8_t reg_index, uint32_t byte_offset); - Error IsWatchpointHit(uint32_t wp_index, bool &is_hit) override; + Status IsWatchpointHit(uint32_t wp_index, bool &is_hit) override; - Error GetWatchpointHitIndex(uint32_t &wp_index, - lldb::addr_t trap_addr) override; + Status GetWatchpointHitIndex(uint32_t &wp_index, + lldb::addr_t trap_addr) override; - Error IsWatchpointVacant(uint32_t wp_index, bool &is_vacant) override; + Status IsWatchpointVacant(uint32_t wp_index, bool &is_vacant) override; bool ClearHardwareWatchpoint(uint32_t wp_index) override; - Error ClearAllHardwareWatchpoints() override; + Status ClearAllHardwareWatchpoints() override; - Error SetHardwareWatchpointWithIndex(lldb::addr_t addr, size_t size, - uint32_t watch_flags, uint32_t wp_index); + Status SetHardwareWatchpointWithIndex(lldb::addr_t addr, size_t size, + uint32_t watch_flags, + uint32_t wp_index); uint32_t SetHardwareWatchpoint(lldb::addr_t addr, size_t size, uint32_t watch_flags) override; @@ -78,17 +79,17 @@ public: static bool IsMSAAvailable(); protected: - Error Read_SR_Config(uint32_t offset, const char *reg_name, uint32_t size, - RegisterValue &value); + Status Read_SR_Config(uint32_t offset, const char *reg_name, uint32_t size, + RegisterValue &value); - Error ReadRegisterRaw(uint32_t reg_index, RegisterValue &value) override; + Status ReadRegisterRaw(uint32_t reg_index, RegisterValue &value) override; - Error WriteRegisterRaw(uint32_t reg_index, - const RegisterValue &value) override; + Status WriteRegisterRaw(uint32_t reg_index, + const RegisterValue &value) override; - Error DoReadWatchPointRegisterValue(lldb::tid_t tid, void *watch_readback); + Status DoReadWatchPointRegisterValue(lldb::tid_t tid, void *watch_readback); - Error DoWriteWatchPointRegisterValue(lldb::tid_t tid, void *watch_readback); + Status DoWriteWatchPointRegisterValue(lldb::tid_t tid, void *watch_readback); bool IsFR0(); diff --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_s390x.cpp b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_s390x.cpp index 3e782d39f72..c2a696e08bf 100644 --- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_s390x.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_s390x.cpp @@ -14,8 +14,8 @@ #include "lldb/Core/RegisterValue.h" #include "lldb/Host/HostInfo.h" #include "lldb/Utility/DataBufferHeap.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" #include "Plugins/Process/Utility/RegisterContextLinux_s390x.h" @@ -192,20 +192,21 @@ bool NativeRegisterContextLinux_s390x::IsFPR(uint32_t reg_index) const { reg_index <= m_reg_info.last_fpr); } -Error NativeRegisterContextLinux_s390x::ReadRegister( - const RegisterInfo *reg_info, RegisterValue ®_value) { +Status +NativeRegisterContextLinux_s390x::ReadRegister(const RegisterInfo *reg_info, + RegisterValue ®_value) { if (!reg_info) - return Error("reg_info NULL"); + return Status("reg_info NULL"); const uint32_t reg = reg_info->kinds[lldb::eRegisterKindLLDB]; if (reg == LLDB_INVALID_REGNUM) - return Error("register \"%s\" is an internal-only lldb register, cannot " - "read directly", - reg_info->name); + return Status("register \"%s\" is an internal-only lldb register, cannot " + "read directly", + reg_info->name); if (IsGPR(reg)) { s390_regs regs; - Error error = DoReadGPR(®s, sizeof(regs)); + Status error = DoReadGPR(®s, sizeof(regs)); if (error.Fail()) return error; @@ -220,14 +221,14 @@ Error NativeRegisterContextLinux_s390x::ReadRegister( break; default: assert(false && "Unhandled data size."); - return Error("unhandled byte size: %" PRIu32, reg_info->byte_size); + return Status("unhandled byte size: %" PRIu32, reg_info->byte_size); } - return Error(); + return Status(); } if (IsFPR(reg)) { s390_fp_regs fp_regs; - Error error = DoReadFPR(&fp_regs, sizeof(fp_regs)); + Status error = DoReadFPR(&fp_regs, sizeof(fp_regs)); if (error.Fail()) return error; @@ -243,48 +244,48 @@ Error NativeRegisterContextLinux_s390x::ReadRegister( break; default: assert(false && "Unhandled data size."); - return Error("unhandled byte size: %" PRIu32, reg_info->byte_size); + return Status("unhandled byte size: %" PRIu32, reg_info->byte_size); } - return Error(); + return Status(); } if (reg == lldb_last_break_s390x) { uint64_t last_break; - Error error = DoReadRegisterSet(NT_S390_LAST_BREAK, &last_break, 8); + Status error = DoReadRegisterSet(NT_S390_LAST_BREAK, &last_break, 8); if (error.Fail()) return error; reg_value.SetUInt64(last_break); - return Error(); + return Status(); } if (reg == lldb_system_call_s390x) { uint32_t system_call; - Error error = DoReadRegisterSet(NT_S390_SYSTEM_CALL, &system_call, 4); + Status error = DoReadRegisterSet(NT_S390_SYSTEM_CALL, &system_call, 4); if (error.Fail()) return error; reg_value.SetUInt32(system_call); - return Error(); + return Status(); } - return Error("failed - register wasn't recognized"); + return Status("failed - register wasn't recognized"); } -Error NativeRegisterContextLinux_s390x::WriteRegister( +Status NativeRegisterContextLinux_s390x::WriteRegister( const RegisterInfo *reg_info, const RegisterValue ®_value) { if (!reg_info) - return Error("reg_info NULL"); + return Status("reg_info NULL"); const uint32_t reg = reg_info->kinds[lldb::eRegisterKindLLDB]; if (reg == LLDB_INVALID_REGNUM) - return Error("register \"%s\" is an internal-only lldb register, cannot " - "write directly", - reg_info->name); + return Status("register \"%s\" is an internal-only lldb register, cannot " + "write directly", + reg_info->name); if (IsGPR(reg)) { s390_regs regs; - Error error = DoReadGPR(®s, sizeof(regs)); + Status error = DoReadGPR(®s, sizeof(regs)); if (error.Fail()) return error; @@ -299,14 +300,14 @@ Error NativeRegisterContextLinux_s390x::WriteRegister( break; default: assert(false && "Unhandled data size."); - return Error("unhandled byte size: %" PRIu32, reg_info->byte_size); + return Status("unhandled byte size: %" PRIu32, reg_info->byte_size); } return DoWriteGPR(®s, sizeof(regs)); } if (IsFPR(reg)) { s390_fp_regs fp_regs; - Error error = DoReadFPR(&fp_regs, sizeof(fp_regs)); + Status error = DoReadFPR(&fp_regs, sizeof(fp_regs)); if (error.Fail()) return error; @@ -322,13 +323,13 @@ Error NativeRegisterContextLinux_s390x::WriteRegister( break; default: assert(false && "Unhandled data size."); - return Error("unhandled byte size: %" PRIu32, reg_info->byte_size); + return Status("unhandled byte size: %" PRIu32, reg_info->byte_size); } return DoWriteFPR(&fp_regs, sizeof(fp_regs)); } if (reg == lldb_last_break_s390x) { - return Error("The last break address is read-only"); + return Status("The last break address is read-only"); } if (reg == lldb_system_call_s390x) { @@ -336,12 +337,12 @@ Error NativeRegisterContextLinux_s390x::WriteRegister( return DoWriteRegisterSet(NT_S390_SYSTEM_CALL, &system_call, 4); } - return Error("failed - register wasn't recognized"); + return Status("failed - register wasn't recognized"); } -Error NativeRegisterContextLinux_s390x::ReadAllRegisterValues( +Status NativeRegisterContextLinux_s390x::ReadAllRegisterValues( lldb::DataBufferSP &data_sp) { - Error error; + Status error; data_sp.reset(new DataBufferHeap(REG_CONTEXT_SIZE, 0)); if (!data_sp) { @@ -383,9 +384,9 @@ Error NativeRegisterContextLinux_s390x::ReadAllRegisterValues( return error; } -Error NativeRegisterContextLinux_s390x::WriteAllRegisterValues( +Status NativeRegisterContextLinux_s390x::WriteAllRegisterValues( const lldb::DataBufferSP &data_sp) { - Error error; + Status error; if (!data_sp) { error.SetErrorStringWithFormat( @@ -428,19 +429,20 @@ Error NativeRegisterContextLinux_s390x::WriteAllRegisterValues( return error; } -Error NativeRegisterContextLinux_s390x::DoReadRegisterValue( +Status NativeRegisterContextLinux_s390x::DoReadRegisterValue( uint32_t offset, const char *reg_name, uint32_t size, RegisterValue &value) { - return Error("DoReadRegisterValue unsupported"); + return Status("DoReadRegisterValue unsupported"); } -Error NativeRegisterContextLinux_s390x::DoWriteRegisterValue( +Status NativeRegisterContextLinux_s390x::DoWriteRegisterValue( uint32_t offset, const char *reg_name, const RegisterValue &value) { - return Error("DoWriteRegisterValue unsupported"); + return Status("DoWriteRegisterValue unsupported"); } -Error NativeRegisterContextLinux_s390x::PeekUserArea(uint32_t offset, void *buf, - size_t buf_size) { +Status NativeRegisterContextLinux_s390x::PeekUserArea(uint32_t offset, + void *buf, + size_t buf_size) { ptrace_area parea; parea.len = buf_size; parea.process_addr = (addr_t)buf; @@ -450,9 +452,9 @@ Error NativeRegisterContextLinux_s390x::PeekUserArea(uint32_t offset, void *buf, m_thread.GetID(), &parea); } -Error NativeRegisterContextLinux_s390x::PokeUserArea(uint32_t offset, - const void *buf, - size_t buf_size) { +Status NativeRegisterContextLinux_s390x::PokeUserArea(uint32_t offset, + const void *buf, + size_t buf_size) { ptrace_area parea; parea.len = buf_size; parea.process_addr = (addr_t)buf; @@ -462,29 +464,31 @@ Error NativeRegisterContextLinux_s390x::PokeUserArea(uint32_t offset, m_thread.GetID(), &parea); } -Error NativeRegisterContextLinux_s390x::DoReadGPR(void *buf, size_t buf_size) { +Status NativeRegisterContextLinux_s390x::DoReadGPR(void *buf, size_t buf_size) { assert(buf_size == sizeof(s390_regs)); return PeekUserArea(offsetof(user_regs_struct, psw), buf, buf_size); } -Error NativeRegisterContextLinux_s390x::DoWriteGPR(void *buf, size_t buf_size) { +Status NativeRegisterContextLinux_s390x::DoWriteGPR(void *buf, + size_t buf_size) { assert(buf_size == sizeof(s390_regs)); return PokeUserArea(offsetof(user_regs_struct, psw), buf, buf_size); } -Error NativeRegisterContextLinux_s390x::DoReadFPR(void *buf, size_t buf_size) { +Status NativeRegisterContextLinux_s390x::DoReadFPR(void *buf, size_t buf_size) { assert(buf_size == sizeof(s390_fp_regs)); return PeekUserArea(offsetof(user_regs_struct, fp_regs), buf, buf_size); } -Error NativeRegisterContextLinux_s390x::DoWriteFPR(void *buf, size_t buf_size) { +Status NativeRegisterContextLinux_s390x::DoWriteFPR(void *buf, + size_t buf_size) { assert(buf_size == sizeof(s390_fp_regs)); return PokeUserArea(offsetof(user_regs_struct, fp_regs), buf, buf_size); } -Error NativeRegisterContextLinux_s390x::DoReadRegisterSet(uint32_t regset, - void *buf, - size_t buf_size) { +Status NativeRegisterContextLinux_s390x::DoReadRegisterSet(uint32_t regset, + void *buf, + size_t buf_size) { struct iovec iov; iov.iov_base = buf; iov.iov_len = buf_size; @@ -492,9 +496,9 @@ Error NativeRegisterContextLinux_s390x::DoReadRegisterSet(uint32_t regset, return ReadRegisterSet(&iov, buf_size, regset); } -Error NativeRegisterContextLinux_s390x::DoWriteRegisterSet(uint32_t regset, - const void *buf, - size_t buf_size) { +Status NativeRegisterContextLinux_s390x::DoWriteRegisterSet(uint32_t regset, + const void *buf, + size_t buf_size) { struct iovec iov; iov.iov_base = const_cast<void *>(buf); iov.iov_len = buf_size; @@ -502,20 +506,20 @@ Error NativeRegisterContextLinux_s390x::DoWriteRegisterSet(uint32_t regset, return WriteRegisterSet(&iov, buf_size, regset); } -Error NativeRegisterContextLinux_s390x::IsWatchpointHit(uint32_t wp_index, - bool &is_hit) { +Status NativeRegisterContextLinux_s390x::IsWatchpointHit(uint32_t wp_index, + bool &is_hit) { per_lowcore_bits per_lowcore; if (wp_index >= NumSupportedHardwareWatchpoints()) - return Error("Watchpoint index out of range"); + return Status("Watchpoint index out of range"); if (m_watchpoint_addr == LLDB_INVALID_ADDRESS) { is_hit = false; - return Error(); + return Status(); } - Error error = PeekUserArea(offsetof(user_regs_struct, per_info.lowcore), - &per_lowcore, sizeof(per_lowcore)); + Status error = PeekUserArea(offsetof(user_regs_struct, per_info.lowcore), + &per_lowcore, sizeof(per_lowcore)); if (error.Fail()) { is_hit = false; return error; @@ -531,15 +535,15 @@ Error NativeRegisterContextLinux_s390x::IsWatchpointHit(uint32_t wp_index, sizeof(per_lowcore)); } - return Error(); + return Status(); } -Error NativeRegisterContextLinux_s390x::GetWatchpointHitIndex( +Status NativeRegisterContextLinux_s390x::GetWatchpointHitIndex( uint32_t &wp_index, lldb::addr_t trap_addr) { uint32_t num_hw_wps = NumSupportedHardwareWatchpoints(); for (wp_index = 0; wp_index < num_hw_wps; ++wp_index) { bool is_hit; - Error error = IsWatchpointHit(wp_index, is_hit); + Status error = IsWatchpointHit(wp_index, is_hit); if (error.Fail()) { wp_index = LLDB_INVALID_INDEX32; return error; @@ -548,17 +552,17 @@ Error NativeRegisterContextLinux_s390x::GetWatchpointHitIndex( } } wp_index = LLDB_INVALID_INDEX32; - return Error(); + return Status(); } -Error NativeRegisterContextLinux_s390x::IsWatchpointVacant(uint32_t wp_index, - bool &is_vacant) { +Status NativeRegisterContextLinux_s390x::IsWatchpointVacant(uint32_t wp_index, + bool &is_vacant) { if (wp_index >= NumSupportedHardwareWatchpoints()) - return Error("Watchpoint index out of range"); + return Status("Watchpoint index out of range"); is_vacant = m_watchpoint_addr == LLDB_INVALID_ADDRESS; - return Error(); + return Status(); } bool NativeRegisterContextLinux_s390x::ClearHardwareWatchpoint( @@ -568,8 +572,8 @@ bool NativeRegisterContextLinux_s390x::ClearHardwareWatchpoint( if (wp_index >= NumSupportedHardwareWatchpoints()) return false; - Error error = PeekUserArea(offsetof(user_regs_struct, per_info), &per_info, - sizeof(per_info)); + Status error = PeekUserArea(offsetof(user_regs_struct, per_info), &per_info, + sizeof(per_info)); if (error.Fail()) return false; @@ -587,10 +591,10 @@ bool NativeRegisterContextLinux_s390x::ClearHardwareWatchpoint( return true; } -Error NativeRegisterContextLinux_s390x::ClearAllHardwareWatchpoints() { +Status NativeRegisterContextLinux_s390x::ClearAllHardwareWatchpoints() { if (ClearHardwareWatchpoint(0)) - return Error(); - return Error("Clearing all hardware watchpoints failed."); + return Status(); + return Status("Clearing all hardware watchpoints failed."); } uint32_t NativeRegisterContextLinux_s390x::SetHardwareWatchpoint( @@ -603,8 +607,8 @@ uint32_t NativeRegisterContextLinux_s390x::SetHardwareWatchpoint( if (m_watchpoint_addr != LLDB_INVALID_ADDRESS) return LLDB_INVALID_INDEX32; - Error error = PeekUserArea(offsetof(user_regs_struct, per_info), &per_info, - sizeof(per_info)); + Status error = PeekUserArea(offsetof(user_regs_struct, per_info), &per_info, + sizeof(per_info)); if (error.Fail()) return LLDB_INVALID_INDEX32; diff --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_s390x.h b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_s390x.h index 4bd737767fa..3ffbaeeb0bb 100644 --- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_s390x.h +++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_s390x.h @@ -33,26 +33,26 @@ public: uint32_t GetUserRegisterCount() const override; - Error ReadRegister(const RegisterInfo *reg_info, - RegisterValue ®_value) override; + Status ReadRegister(const RegisterInfo *reg_info, + RegisterValue ®_value) override; - Error WriteRegister(const RegisterInfo *reg_info, - const RegisterValue ®_value) override; + Status WriteRegister(const RegisterInfo *reg_info, + const RegisterValue ®_value) override; - Error ReadAllRegisterValues(lldb::DataBufferSP &data_sp) override; + Status ReadAllRegisterValues(lldb::DataBufferSP &data_sp) override; - Error WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override; + Status WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override; - Error IsWatchpointHit(uint32_t wp_index, bool &is_hit) override; + Status IsWatchpointHit(uint32_t wp_index, bool &is_hit) override; - Error GetWatchpointHitIndex(uint32_t &wp_index, - lldb::addr_t trap_addr) override; + Status GetWatchpointHitIndex(uint32_t &wp_index, + lldb::addr_t trap_addr) override; - Error IsWatchpointVacant(uint32_t wp_index, bool &is_vacant) override; + Status IsWatchpointVacant(uint32_t wp_index, bool &is_vacant) override; bool ClearHardwareWatchpoint(uint32_t wp_index) override; - Error ClearAllHardwareWatchpoints() override; + Status ClearAllHardwareWatchpoints() override; uint32_t SetHardwareWatchpoint(lldb::addr_t addr, size_t size, uint32_t watch_flags) override; @@ -62,19 +62,19 @@ public: uint32_t NumSupportedHardwareWatchpoints() override; protected: - Error DoReadRegisterValue(uint32_t offset, const char *reg_name, - uint32_t size, RegisterValue &value) override; + Status DoReadRegisterValue(uint32_t offset, const char *reg_name, + uint32_t size, RegisterValue &value) override; - Error DoWriteRegisterValue(uint32_t offset, const char *reg_name, - const RegisterValue &value) override; + Status DoWriteRegisterValue(uint32_t offset, const char *reg_name, + const RegisterValue &value) override; - Error DoReadGPR(void *buf, size_t buf_size) override; + Status DoReadGPR(void *buf, size_t buf_size) override; - Error DoWriteGPR(void *buf, size_t buf_size) override; + Status DoWriteGPR(void *buf, size_t buf_size) override; - Error DoReadFPR(void *buf, size_t buf_size) override; + Status DoReadFPR(void *buf, size_t buf_size) override; - Error DoWriteFPR(void *buf, size_t buf_size) override; + Status DoWriteFPR(void *buf, size_t buf_size) override; private: // Info about register ranges. @@ -99,13 +99,13 @@ private: bool IsFPR(uint32_t reg_index) const; - Error PeekUserArea(uint32_t offset, void *buf, size_t buf_size); + Status PeekUserArea(uint32_t offset, void *buf, size_t buf_size); - Error PokeUserArea(uint32_t offset, const void *buf, size_t buf_size); + Status PokeUserArea(uint32_t offset, const void *buf, size_t buf_size); - Error DoReadRegisterSet(uint32_t regset, void *buf, size_t buf_size); + Status DoReadRegisterSet(uint32_t regset, void *buf, size_t buf_size); - Error DoWriteRegisterSet(uint32_t regset, const void *buf, size_t buf_size); + Status DoWriteRegisterSet(uint32_t regset, const void *buf, size_t buf_size); }; } // namespace process_linux diff --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp index dd35705a8ae..59dc9e9f7d4 100644 --- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp @@ -14,8 +14,8 @@ #include "lldb/Core/RegisterValue.h" #include "lldb/Host/HostInfo.h" #include "lldb/Utility/DataBufferHeap.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" #include "Plugins/Process/Utility/RegisterContextLinux_i386.h" #include "Plugins/Process/Utility/RegisterContextLinux_x86_64.h" @@ -385,9 +385,10 @@ NativeRegisterContextLinux_x86_64::GetRegisterSet(uint32_t set_index) const { return nullptr; } -Error NativeRegisterContextLinux_x86_64::ReadRegister( - const RegisterInfo *reg_info, RegisterValue ®_value) { - Error error; +Status +NativeRegisterContextLinux_x86_64::ReadRegister(const RegisterInfo *reg_info, + RegisterValue ®_value) { + Status error; if (!reg_info) { error.SetErrorString("reg_info NULL"); @@ -529,15 +530,15 @@ Error NativeRegisterContextLinux_x86_64::ReadRegister( return error; } -Error NativeRegisterContextLinux_x86_64::WriteRegister( +Status NativeRegisterContextLinux_x86_64::WriteRegister( const RegisterInfo *reg_info, const RegisterValue ®_value) { assert(reg_info && "reg_info is null"); const uint32_t reg_index = reg_info->kinds[lldb::eRegisterKindLLDB]; if (reg_index == LLDB_INVALID_REGNUM) - return Error("no lldb regnum for %s", reg_info && reg_info->name - ? reg_info->name - : "<unknown register>"); + return Status("no lldb regnum for %s", reg_info && reg_info->name + ? reg_info->name + : "<unknown register>"); if (IsGPR(reg_index)) return WriteRegisterRaw(reg_index, reg_value); @@ -566,7 +567,7 @@ Error NativeRegisterContextLinux_x86_64::WriteRegister( ::memcpy(m_ymm_set.ymm[reg_index - m_reg_info.first_ymm].bytes, reg_value.GetBytes(), reg_value.GetByteSize()); if (!CopyYMMtoXSTATE(reg_index, GetByteOrder())) - return Error("CopyYMMtoXSTATE() failed"); + return Status("CopyYMMtoXSTATE() failed"); } if (reg_index >= m_reg_info.first_mpxr && @@ -574,7 +575,7 @@ Error NativeRegisterContextLinux_x86_64::WriteRegister( ::memcpy(m_mpx_set.mpxr[reg_index - m_reg_info.first_mpxr].bytes, reg_value.GetBytes(), reg_value.GetByteSize()); if (!CopyMPXtoXSTATE(reg_index)) - return Error("CopyMPXtoXSTATE() failed"); + return Status("CopyMPXtoXSTATE() failed"); } if (reg_index >= m_reg_info.first_mpxc && @@ -582,7 +583,7 @@ Error NativeRegisterContextLinux_x86_64::WriteRegister( ::memcpy(m_mpx_set.mpxc[reg_index - m_reg_info.first_mpxc].bytes, reg_value.GetBytes(), reg_value.GetByteSize()); if (!CopyMPXtoXSTATE(reg_index)) - return Error("CopyMPXtoXSTATE() failed"); + return Status("CopyMPXtoXSTATE() failed"); } } else { // Get pointer to m_fpr.xstate.fxsave variable and set the data to it. @@ -616,33 +617,33 @@ Error NativeRegisterContextLinux_x86_64::WriteRegister( break; default: assert(false && "Unhandled data size."); - return Error("unhandled register data size %" PRIu32, - reg_info->byte_size); + return Status("unhandled register data size %" PRIu32, + reg_info->byte_size); } } - Error error = WriteFPR(); + Status error = WriteFPR(); if (error.Fail()) return error; if (IsAVX(reg_index)) { if (!CopyYMMtoXSTATE(reg_index, GetByteOrder())) - return Error("CopyYMMtoXSTATE() failed"); + return Status("CopyYMMtoXSTATE() failed"); } if (IsMPX(reg_index)) { if (!CopyMPXtoXSTATE(reg_index)) - return Error("CopyMPXtoXSTATE() failed"); + return Status("CopyMPXtoXSTATE() failed"); } - return Error(); + return Status(); } - return Error("failed - register wasn't recognized to be a GPR or an FPR, " - "write strategy unknown"); + return Status("failed - register wasn't recognized to be a GPR or an FPR, " + "write strategy unknown"); } -Error NativeRegisterContextLinux_x86_64::ReadAllRegisterValues( +Status NativeRegisterContextLinux_x86_64::ReadAllRegisterValues( lldb::DataBufferSP &data_sp) { - Error error; + Status error; data_sp.reset(new DataBufferHeap(REG_CONTEXT_SIZE, 0)); if (!data_sp) { @@ -728,9 +729,9 @@ Error NativeRegisterContextLinux_x86_64::ReadAllRegisterValues( return error; } -Error NativeRegisterContextLinux_x86_64::WriteAllRegisterValues( +Status NativeRegisterContextLinux_x86_64::WriteAllRegisterValues( const lldb::DataBufferSP &data_sp) { - Error error; + Status error; if (!data_sp) { error.SetErrorStringWithFormat( @@ -857,7 +858,7 @@ bool NativeRegisterContextLinux_x86_64::IsFPR(uint32_t reg_index) const { reg_index <= m_reg_info.last_fpr); } -Error NativeRegisterContextLinux_x86_64::WriteFPR() { +Status NativeRegisterContextLinux_x86_64::WriteFPR() { switch (m_xstate_type) { case XStateType::FXSAVE: return WriteRegisterSet( @@ -867,7 +868,7 @@ Error NativeRegisterContextLinux_x86_64::WriteFPR() { return WriteRegisterSet(&m_iovec, sizeof(m_fpr.xstate.xsave), NT_X86_XSTATE); default: - return Error("Unrecognized FPR type."); + return Status("Unrecognized FPR type."); } } @@ -954,8 +955,8 @@ size_t NativeRegisterContextLinux_x86_64::GetFPRSize() { } } -Error NativeRegisterContextLinux_x86_64::ReadFPR() { - Error error; +Status NativeRegisterContextLinux_x86_64::ReadFPR() { + Status error; // Probe XSAVE and if it is not supported fall back to FXSAVE. if (m_xstate_type != XStateType::FXSAVE) { @@ -973,7 +974,7 @@ Error NativeRegisterContextLinux_x86_64::ReadFPR() { m_xstate_type = XStateType::FXSAVE; return error; } - return Error("Unrecognized FPR type."); + return Status("Unrecognized FPR type."); } bool NativeRegisterContextLinux_x86_64::IsMPX(uint32_t reg_index) const { @@ -1013,13 +1014,13 @@ bool NativeRegisterContextLinux_x86_64::CopyMPXtoXSTATE(uint32_t reg) { return true; } -Error NativeRegisterContextLinux_x86_64::IsWatchpointHit(uint32_t wp_index, - bool &is_hit) { +Status NativeRegisterContextLinux_x86_64::IsWatchpointHit(uint32_t wp_index, + bool &is_hit) { if (wp_index >= NumSupportedHardwareWatchpoints()) - return Error("Watchpoint index out of range"); + return Status("Watchpoint index out of range"); RegisterValue reg_value; - Error error = ReadRegisterRaw(m_reg_info.first_dr + 6, reg_value); + Status error = ReadRegisterRaw(m_reg_info.first_dr + 6, reg_value); if (error.Fail()) { is_hit = false; return error; @@ -1032,12 +1033,12 @@ Error NativeRegisterContextLinux_x86_64::IsWatchpointHit(uint32_t wp_index, return error; } -Error NativeRegisterContextLinux_x86_64::GetWatchpointHitIndex( +Status NativeRegisterContextLinux_x86_64::GetWatchpointHitIndex( uint32_t &wp_index, lldb::addr_t trap_addr) { uint32_t num_hw_wps = NumSupportedHardwareWatchpoints(); for (wp_index = 0; wp_index < num_hw_wps; ++wp_index) { bool is_hit; - Error error = IsWatchpointHit(wp_index, is_hit); + Status error = IsWatchpointHit(wp_index, is_hit); if (error.Fail()) { wp_index = LLDB_INVALID_INDEX32; return error; @@ -1046,16 +1047,16 @@ Error NativeRegisterContextLinux_x86_64::GetWatchpointHitIndex( } } wp_index = LLDB_INVALID_INDEX32; - return Error(); + return Status(); } -Error NativeRegisterContextLinux_x86_64::IsWatchpointVacant(uint32_t wp_index, - bool &is_vacant) { +Status NativeRegisterContextLinux_x86_64::IsWatchpointVacant(uint32_t wp_index, + bool &is_vacant) { if (wp_index >= NumSupportedHardwareWatchpoints()) - return Error("Watchpoint index out of range"); + return Status("Watchpoint index out of range"); RegisterValue reg_value; - Error error = ReadRegisterRaw(m_reg_info.first_dr + 7, reg_value); + Status error = ReadRegisterRaw(m_reg_info.first_dr + 7, reg_value); if (error.Fail()) { is_vacant = false; return error; @@ -1068,11 +1069,11 @@ Error NativeRegisterContextLinux_x86_64::IsWatchpointVacant(uint32_t wp_index, return error; } -Error NativeRegisterContextLinux_x86_64::SetHardwareWatchpointWithIndex( +Status NativeRegisterContextLinux_x86_64::SetHardwareWatchpointWithIndex( lldb::addr_t addr, size_t size, uint32_t watch_flags, uint32_t wp_index) { if (wp_index >= NumSupportedHardwareWatchpoints()) - return Error("Watchpoint index out of range"); + return Status("Watchpoint index out of range"); // Read only watchpoints aren't supported on x86_64. Fall back to read/write // waitchpoints instead. @@ -1082,17 +1083,17 @@ Error NativeRegisterContextLinux_x86_64::SetHardwareWatchpointWithIndex( watch_flags = 0x3; if (watch_flags != 0x1 && watch_flags != 0x3) - return Error("Invalid read/write bits for watchpoint"); + return Status("Invalid read/write bits for watchpoint"); if (size != 1 && size != 2 && size != 4 && size != 8) - return Error("Invalid size for watchpoint"); + return Status("Invalid size for watchpoint"); bool is_vacant; - Error error = IsWatchpointVacant(wp_index, is_vacant); + Status error = IsWatchpointVacant(wp_index, is_vacant); if (error.Fail()) return error; if (!is_vacant) - return Error("Watchpoint index not vacant"); + return Status("Watchpoint index not vacant"); RegisterValue reg_value; error = ReadRegisterRaw(m_reg_info.first_dr + 7, reg_value); @@ -1140,7 +1141,7 @@ bool NativeRegisterContextLinux_x86_64::ClearHardwareWatchpoint( // for watchpoints 0, 1, 2, or 3, respectively, // clear bits 0, 1, 2, or 3 of the debug status register (DR6) - Error error = ReadRegisterRaw(m_reg_info.first_dr + 6, reg_value); + Status error = ReadRegisterRaw(m_reg_info.first_dr + 6, reg_value); if (error.Fail()) return false; uint64_t bit_mask = 1 << wp_index; @@ -1161,11 +1162,11 @@ bool NativeRegisterContextLinux_x86_64::ClearHardwareWatchpoint( .Success(); } -Error NativeRegisterContextLinux_x86_64::ClearAllHardwareWatchpoints() { +Status NativeRegisterContextLinux_x86_64::ClearAllHardwareWatchpoints() { RegisterValue reg_value; // clear bits {0-4} of the debug status register (DR6) - Error error = ReadRegisterRaw(m_reg_info.first_dr + 6, reg_value); + Status error = ReadRegisterRaw(m_reg_info.first_dr + 6, reg_value); if (error.Fail()) return error; uint64_t bit_mask = 0xF; @@ -1189,7 +1190,7 @@ uint32_t NativeRegisterContextLinux_x86_64::SetHardwareWatchpoint( const uint32_t num_hw_watchpoints = NumSupportedHardwareWatchpoints(); for (uint32_t wp_index = 0; wp_index < num_hw_watchpoints; ++wp_index) { bool is_vacant; - Error error = IsWatchpointVacant(wp_index, is_vacant); + Status error = IsWatchpointVacant(wp_index, is_vacant); if (is_vacant) { error = SetHardwareWatchpointWithIndex(addr, size, watch_flags, wp_index); if (error.Success()) diff --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.h b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.h index cc05ec06b29..abb0dba4d91 100644 --- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.h +++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.h @@ -33,29 +33,30 @@ public: uint32_t GetUserRegisterCount() const override; - Error ReadRegister(const RegisterInfo *reg_info, - RegisterValue ®_value) override; + Status ReadRegister(const RegisterInfo *reg_info, + RegisterValue ®_value) override; - Error WriteRegister(const RegisterInfo *reg_info, - const RegisterValue ®_value) override; + Status WriteRegister(const RegisterInfo *reg_info, + const RegisterValue ®_value) override; - Error ReadAllRegisterValues(lldb::DataBufferSP &data_sp) override; + Status ReadAllRegisterValues(lldb::DataBufferSP &data_sp) override; - Error WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override; + Status WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override; - Error IsWatchpointHit(uint32_t wp_index, bool &is_hit) override; + Status IsWatchpointHit(uint32_t wp_index, bool &is_hit) override; - Error GetWatchpointHitIndex(uint32_t &wp_index, - lldb::addr_t trap_addr) override; + Status GetWatchpointHitIndex(uint32_t &wp_index, + lldb::addr_t trap_addr) override; - Error IsWatchpointVacant(uint32_t wp_index, bool &is_vacant) override; + Status IsWatchpointVacant(uint32_t wp_index, bool &is_vacant) override; bool ClearHardwareWatchpoint(uint32_t wp_index) override; - Error ClearAllHardwareWatchpoints() override; + Status ClearAllHardwareWatchpoints() override; - Error SetHardwareWatchpointWithIndex(lldb::addr_t addr, size_t size, - uint32_t watch_flags, uint32_t wp_index); + Status SetHardwareWatchpointWithIndex(lldb::addr_t addr, size_t size, + uint32_t watch_flags, + uint32_t wp_index); uint32_t SetHardwareWatchpoint(lldb::addr_t addr, size_t size, uint32_t watch_flags) override; @@ -71,9 +72,9 @@ protected: size_t GetFPRSize() override; - Error ReadFPR() override; + Status ReadFPR() override; - Error WriteFPR() override; + Status WriteFPR() override; private: // Private member types. diff --git a/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp index 04b6fe6d71e..b1d13668f32 100644 --- a/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp @@ -160,39 +160,40 @@ NativeRegisterContextSP NativeThreadLinux::GetRegisterContext() { return m_reg_context_sp; } -Error NativeThreadLinux::SetWatchpoint(lldb::addr_t addr, size_t size, - uint32_t watch_flags, bool hardware) { +Status NativeThreadLinux::SetWatchpoint(lldb::addr_t addr, size_t size, + uint32_t watch_flags, bool hardware) { if (!hardware) - return Error("not implemented"); + return Status("not implemented"); if (m_state == eStateLaunching) - return Error(); - Error error = RemoveWatchpoint(addr); + return Status(); + Status error = RemoveWatchpoint(addr); if (error.Fail()) return error; NativeRegisterContextSP reg_ctx = GetRegisterContext(); uint32_t wp_index = reg_ctx->SetHardwareWatchpoint(addr, size, watch_flags); if (wp_index == LLDB_INVALID_INDEX32) - return Error("Setting hardware watchpoint failed."); + return Status("Setting hardware watchpoint failed."); m_watchpoint_index_map.insert({addr, wp_index}); - return Error(); + return Status(); } -Error NativeThreadLinux::RemoveWatchpoint(lldb::addr_t addr) { +Status NativeThreadLinux::RemoveWatchpoint(lldb::addr_t addr) { auto wp = m_watchpoint_index_map.find(addr); if (wp == m_watchpoint_index_map.end()) - return Error(); + return Status(); uint32_t wp_index = wp->second; m_watchpoint_index_map.erase(wp); if (GetRegisterContext()->ClearHardwareWatchpoint(wp_index)) - return Error(); - return Error("Clearing hardware watchpoint failed."); + return Status(); + return Status("Clearing hardware watchpoint failed."); } -Error NativeThreadLinux::SetHardwareBreakpoint(lldb::addr_t addr, size_t size) { +Status NativeThreadLinux::SetHardwareBreakpoint(lldb::addr_t addr, + size_t size) { if (m_state == eStateLaunching) - return Error(); + return Status(); - Error error = RemoveHardwareBreakpoint(addr); + Status error = RemoveHardwareBreakpoint(addr); if (error.Fail()) return error; @@ -200,27 +201,27 @@ Error NativeThreadLinux::SetHardwareBreakpoint(lldb::addr_t addr, size_t size) { uint32_t bp_index = reg_ctx->SetHardwareBreakpoint(addr, size); if (bp_index == LLDB_INVALID_INDEX32) - return Error("Setting hardware breakpoint failed."); + return Status("Setting hardware breakpoint failed."); m_hw_break_index_map.insert({addr, bp_index}); - return Error(); + return Status(); } -Error NativeThreadLinux::RemoveHardwareBreakpoint(lldb::addr_t addr) { +Status NativeThreadLinux::RemoveHardwareBreakpoint(lldb::addr_t addr) { auto bp = m_hw_break_index_map.find(addr); if (bp == m_hw_break_index_map.end()) - return Error(); + return Status(); uint32_t bp_index = bp->second; if (GetRegisterContext()->ClearHardwareBreakpoint(bp_index)) { m_hw_break_index_map.erase(bp); - return Error(); + return Status(); } - return Error("Clearing hardware breakpoint failed."); + return Status("Clearing hardware breakpoint failed."); } -Error NativeThreadLinux::Resume(uint32_t signo) { +Status NativeThreadLinux::Resume(uint32_t signo) { const StateType new_state = StateType::eStateRunning; MaybeLogStateChange(new_state); m_state = new_state; @@ -262,7 +263,7 @@ Error NativeThreadLinux::Resume(uint32_t signo) { reinterpret_cast<void *>(data)); } -Error NativeThreadLinux::SingleStep(uint32_t signo) { +Status NativeThreadLinux::SingleStep(uint32_t signo) { const StateType new_state = StateType::eStateStepping; MaybeLogStateChange(new_state); m_state = new_state; @@ -422,7 +423,7 @@ void NativeThreadLinux::SetExited() { m_stop_info.reason = StopReason::eStopReasonThreadExiting; } -Error NativeThreadLinux::RequestStop() { +Status NativeThreadLinux::RequestStop() { Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); NativeProcessLinux &process = GetProcess(); @@ -435,7 +436,7 @@ Error NativeThreadLinux::RequestStop() { ", tid: %" PRIu64 ")", __FUNCTION__, pid, tid); - Error err; + Status err; errno = 0; if (::tgkill(pid, tid, SIGSTOP) != 0) { err.SetErrorToErrno(); diff --git a/lldb/source/Plugins/Process/Linux/NativeThreadLinux.h b/lldb/source/Plugins/Process/Linux/NativeThreadLinux.h index 42697497c0a..b9126b3752a 100644 --- a/lldb/source/Plugins/Process/Linux/NativeThreadLinux.h +++ b/lldb/source/Plugins/Process/Linux/NativeThreadLinux.h @@ -41,14 +41,14 @@ public: NativeRegisterContextSP GetRegisterContext() override; - Error SetWatchpoint(lldb::addr_t addr, size_t size, uint32_t watch_flags, - bool hardware) override; + Status SetWatchpoint(lldb::addr_t addr, size_t size, uint32_t watch_flags, + bool hardware) override; - Error RemoveWatchpoint(lldb::addr_t addr) override; + Status RemoveWatchpoint(lldb::addr_t addr) override; - Error SetHardwareBreakpoint(lldb::addr_t addr, size_t size) override; + Status SetHardwareBreakpoint(lldb::addr_t addr, size_t size) override; - Error RemoveHardwareBreakpoint(lldb::addr_t addr) override; + Status RemoveHardwareBreakpoint(lldb::addr_t addr) override; private: // --------------------------------------------------------------------- @@ -57,11 +57,11 @@ private: /// Resumes the thread. If @p signo is anything but /// LLDB_INVALID_SIGNAL_NUMBER, deliver that signal to the thread. - Error Resume(uint32_t signo); + Status Resume(uint32_t signo); /// Single steps the thread. If @p signo is anything but /// LLDB_INVALID_SIGNAL_NUMBER, deliver that signal to the thread. - Error SingleStep(uint32_t signo); + Status SingleStep(uint32_t signo); void SetStoppedBySignal(uint32_t signo, const siginfo_t *info = nullptr); @@ -86,7 +86,7 @@ private: void SetExited(); - Error RequestStop(); + Status RequestStop(); // --------------------------------------------------------------------- // Private interface diff --git a/lldb/source/Plugins/Process/Linux/SingleStepCheck.cpp b/lldb/source/Plugins/Process/Linux/SingleStepCheck.cpp index 4e979bd4553..f0059f15cc1 100644 --- a/lldb/source/Plugins/Process/Linux/SingleStepCheck.cpp +++ b/lldb/source/Plugins/Process/Linux/SingleStepCheck.cpp @@ -20,7 +20,7 @@ #include "Plugins/Process/POSIX/ProcessPOSIXLog.h" #include "lldb/Host/linux/Ptrace.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" using namespace lldb; using namespace lldb_private; @@ -77,7 +77,7 @@ bool WorkaroundNeeded() { if (sched_getaffinity(child_pid, sizeof available_cpus, &available_cpus) == -1) { LLDB_LOG(log, "failed to get available cpus: {0}", - Error(errno, eErrorTypePOSIX)); + Status(errno, eErrorTypePOSIX)); return false; } @@ -85,7 +85,7 @@ bool WorkaroundNeeded() { ::pid_t wpid = waitpid(child_pid, &status, __WALL); if (wpid != child_pid || !WIFSTOPPED(status)) { LLDB_LOG(log, "waitpid() failed (status = {0:x}): {1}", status, - Error(errno, eErrorTypePOSIX)); + Status(errno, eErrorTypePOSIX)); return false; } @@ -99,12 +99,12 @@ bool WorkaroundNeeded() { CPU_SET(cpu, &cpus); if (sched_setaffinity(child_pid, sizeof cpus, &cpus) == -1) { LLDB_LOG(log, "failed to switch to cpu {0}: {1}", cpu, - Error(errno, eErrorTypePOSIX)); + Status(errno, eErrorTypePOSIX)); continue; } int status; - Error error = + Status error = NativeProcessLinux::PtraceWrapper(PTRACE_SINGLESTEP, child_pid); if (error.Fail()) { LLDB_LOG(log, "single step failed: {0}", error); @@ -114,7 +114,7 @@ bool WorkaroundNeeded() { wpid = waitpid(child_pid, &status, __WALL); if (wpid != child_pid || !WIFSTOPPED(status)) { LLDB_LOG(log, "waitpid() failed (status = {0:x}): {1}", status, - Error(errno, eErrorTypePOSIX)); + Status(errno, eErrorTypePOSIX)); break; } if (WSTOPSIG(status) != SIGTRAP) { @@ -152,7 +152,7 @@ std::unique_ptr<SingleStepWorkaround> SingleStepWorkaround::Get(::pid_t tid) { if (sched_getaffinity(tid, sizeof original_set, &original_set) != 0) { // This should really not fail. But, just in case... LLDB_LOG(log, "Unable to get cpu affinity for thread {0}: {1}", tid, - Error(errno, eErrorTypePOSIX)); + Status(errno, eErrorTypePOSIX)); return nullptr; } @@ -164,7 +164,7 @@ std::unique_ptr<SingleStepWorkaround> SingleStepWorkaround::Get(::pid_t tid) { // to run on cpu 0. If that happens, only thing we can do is it log it and // continue... LLDB_LOG(log, "Unable to set cpu affinity for thread {0}: {1}", tid, - Error(errno, eErrorTypePOSIX)); + Status(errno, eErrorTypePOSIX)); } LLDB_LOG(log, "workaround for thread {0} prepared", tid); @@ -176,7 +176,7 @@ SingleStepWorkaround::~SingleStepWorkaround() { LLDB_LOG(log, "Removing workaround"); if (sched_setaffinity(m_tid, sizeof m_original_set, &m_original_set) != 0) { LLDB_LOG(log, "Unable to reset cpu affinity for thread {0}: {1}", m_tid, - Error(errno, eErrorTypePOSIX)); + Status(errno, eErrorTypePOSIX)); } } #endif diff --git a/lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp b/lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp index da0ed9aa0c6..46d522531a5 100644 --- a/lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp +++ b/lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp @@ -199,7 +199,7 @@ CommunicationKDP::WaitForPacketWithTimeoutMicroSeconds(DataExtractor &packet, size_t CommunicationKDP::WaitForPacketWithTimeoutMicroSecondsNoLock( DataExtractor &packet, uint32_t timeout_usec) { uint8_t buffer[8192]; - Error error; + Status error; Log *log(ProcessKDPLog::GetLogIfAllCategoriesSet(KDP_LOG_PACKETS)); @@ -602,7 +602,7 @@ bool CommunicationKDP::SendRequestDisconnect() { uint32_t CommunicationKDP::SendRequestReadMemory(lldb::addr_t addr, void *dst, uint32_t dst_len, - Error &error) { + Status &error) { PacketStreamType request_packet(Stream::eBinary, m_addr_byte_size, m_byte_order); bool use_64 = (GetVersion() >= 11); @@ -641,7 +641,7 @@ uint32_t CommunicationKDP::SendRequestReadMemory(lldb::addr_t addr, void *dst, uint32_t CommunicationKDP::SendRequestWriteMemory(lldb::addr_t addr, const void *src, uint32_t src_len, - Error &error) { + Status &error) { PacketStreamType request_packet(Stream::eBinary, m_addr_byte_size, m_byte_order); bool use_64 = (GetVersion() >= 11); @@ -675,7 +675,7 @@ bool CommunicationKDP::SendRawRequest( uint8_t command_byte, const void *src, // Raw packet payload bytes uint32_t src_len, // Raw packet payload length - DataExtractor &reply_packet, Error &error) { + DataExtractor &reply_packet, Status &error) { PacketStreamType request_packet(Stream::eBinary, m_addr_byte_size, m_byte_order); // Size is header + address size + uint32_t length @@ -1224,7 +1224,7 @@ void CommunicationKDP::DumpPacket(Stream &s, const DataExtractor &packet) { uint32_t CommunicationKDP::SendRequestReadRegisters(uint32_t cpu, uint32_t flavor, void *dst, uint32_t dst_len, - Error &error) { + Status &error) { PacketStreamType request_packet(Stream::eBinary, m_addr_byte_size, m_byte_order); const CommandType command = KDP_READREGS; @@ -1267,7 +1267,7 @@ uint32_t CommunicationKDP::SendRequestWriteRegisters(uint32_t cpu, uint32_t flavor, const void *src, uint32_t src_len, - Error &error) { + Status &error) { PacketStreamType request_packet(Stream::eBinary, m_addr_byte_size, m_byte_order); const CommandType command = KDP_WRITEREGS; diff --git a/lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.h b/lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.h index eed3daa4647..afac6601a56 100644 --- a/lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.h +++ b/lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.h @@ -128,22 +128,24 @@ public: bool SendRequestDisconnect(); uint32_t SendRequestReadMemory(lldb::addr_t addr, void *dst, - uint32_t dst_size, lldb_private::Error &error); + uint32_t dst_size, + lldb_private::Status &error); uint32_t SendRequestWriteMemory(lldb::addr_t addr, const void *src, - uint32_t src_len, lldb_private::Error &error); + uint32_t src_len, + lldb_private::Status &error); bool SendRawRequest(uint8_t command_byte, const void *src, uint32_t src_len, lldb_private::DataExtractor &reply, - lldb_private::Error &error); + lldb_private::Status &error); uint32_t SendRequestReadRegisters(uint32_t cpu, uint32_t flavor, void *dst, uint32_t dst_size, - lldb_private::Error &error); + lldb_private::Status &error); uint32_t SendRequestWriteRegisters(uint32_t cpu, uint32_t flavor, const void *src, uint32_t src_size, - lldb_private::Error &error); + lldb_private::Status &error); const char *GetKernelVersion(); diff --git a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp index 6b2e675afae..f01f1ace583 100644 --- a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp +++ b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp @@ -188,22 +188,22 @@ lldb_private::ConstString ProcessKDP::GetPluginName() { uint32_t ProcessKDP::GetPluginVersion() { return 1; } -Error ProcessKDP::WillLaunch(Module *module) { - Error error; +Status ProcessKDP::WillLaunch(Module *module) { + Status error; error.SetErrorString("launching not supported in kdp-remote plug-in"); return error; } -Error ProcessKDP::WillAttachToProcessWithID(lldb::pid_t pid) { - Error error; +Status ProcessKDP::WillAttachToProcessWithID(lldb::pid_t pid) { + Status error; error.SetErrorString( "attaching to a by process ID not supported in kdp-remote plug-in"); return error; } -Error ProcessKDP::WillAttachToProcessWithName(const char *process_name, - bool wait_for_launch) { - Error error; +Status ProcessKDP::WillAttachToProcessWithName(const char *process_name, + bool wait_for_launch) { + Status error; error.SetErrorString( "attaching to a by process name not supported in kdp-remote plug-in"); return error; @@ -223,8 +223,8 @@ bool ProcessKDP::GetHostArchitecture(ArchSpec &arch) { return false; } -Error ProcessKDP::DoConnectRemote(Stream *strm, llvm::StringRef remote_url) { - Error error; +Status ProcessKDP::DoConnectRemote(Stream *strm, llvm::StringRef remote_url) { + Status error; // Don't let any JIT happen when doing KDP as we can't allocate // memory and we don't want to be mucking with threads that might @@ -374,23 +374,26 @@ Error ProcessKDP::DoConnectRemote(Stream *strm, llvm::StringRef remote_url) { //---------------------------------------------------------------------- // Process Control //---------------------------------------------------------------------- -Error ProcessKDP::DoLaunch(Module *exe_module, ProcessLaunchInfo &launch_info) { - Error error; +Status ProcessKDP::DoLaunch(Module *exe_module, + ProcessLaunchInfo &launch_info) { + Status error; error.SetErrorString("launching not supported in kdp-remote plug-in"); return error; } -Error ProcessKDP::DoAttachToProcessWithID( - lldb::pid_t attach_pid, const ProcessAttachInfo &attach_info) { - Error error; +Status +ProcessKDP::DoAttachToProcessWithID(lldb::pid_t attach_pid, + const ProcessAttachInfo &attach_info) { + Status error; error.SetErrorString( "attach to process by ID is not suppported in kdp remote debugging"); return error; } -Error ProcessKDP::DoAttachToProcessWithName( - const char *process_name, const ProcessAttachInfo &attach_info) { - Error error; +Status +ProcessKDP::DoAttachToProcessWithName(const char *process_name, + const ProcessAttachInfo &attach_info) { + Status error; error.SetErrorString( "attach to process by name is not suppported in kdp remote debugging"); return error; @@ -417,10 +420,10 @@ lldb_private::DynamicLoader *ProcessKDP::GetDynamicLoader() { return m_dyld_ap.get(); } -Error ProcessKDP::WillResume() { return Error(); } +Status ProcessKDP::WillResume() { return Status(); } -Error ProcessKDP::DoResume() { - Error error; +Status ProcessKDP::DoResume() { + Status error; Log *log(ProcessKDPLog::GetLogIfAllCategoriesSet(KDP_LOG_PROCESS)); // Only start the async thread if we try to do any process control if (!m_async_thread.IsJoinable()) @@ -537,8 +540,8 @@ void ProcessKDP::RefreshStateAfterStop() { m_thread_list.RefreshStateAfterStop(); } -Error ProcessKDP::DoHalt(bool &caused_stop) { - Error error; +Status ProcessKDP::DoHalt(bool &caused_stop) { + Status error; if (m_comm.IsRunning()) { if (m_destroy_in_process) { @@ -553,8 +556,8 @@ Error ProcessKDP::DoHalt(bool &caused_stop) { return error; } -Error ProcessKDP::DoDetach(bool keep_stopped) { - Error error; +Status ProcessKDP::DoDetach(bool keep_stopped) { + Status error; Log *log(ProcessKDPLog::GetLogIfAllCategoriesSet(KDP_LOG_PROCESS)); if (log) log->Printf("ProcessKDP::DoDetach(keep_stopped = %i)", keep_stopped); @@ -588,7 +591,7 @@ Error ProcessKDP::DoDetach(bool keep_stopped) { return error; } -Error ProcessKDP::DoDestroy() { +Status ProcessKDP::DoDestroy() { // For KDP there really is no difference between destroy and detach bool keep_stopped = false; return DoDetach(keep_stopped); @@ -606,7 +609,7 @@ bool ProcessKDP::IsAlive() { // Process Memory //------------------------------------------------------------------ size_t ProcessKDP::DoReadMemory(addr_t addr, void *buf, size_t size, - Error &error) { + Status &error) { uint8_t *data_buffer = (uint8_t *)buf; if (m_comm.IsConnected()) { const size_t max_read_size = 512; @@ -634,7 +637,7 @@ size_t ProcessKDP::DoReadMemory(addr_t addr, void *buf, size_t size, } size_t ProcessKDP::DoWriteMemory(addr_t addr, const void *buf, size_t size, - Error &error) { + Status &error) { if (m_comm.IsConnected()) return m_comm.SendRequestWriteMemory(addr, buf, size, error); error.SetErrorString("not connected"); @@ -642,22 +645,22 @@ size_t ProcessKDP::DoWriteMemory(addr_t addr, const void *buf, size_t size, } lldb::addr_t ProcessKDP::DoAllocateMemory(size_t size, uint32_t permissions, - Error &error) { + Status &error) { error.SetErrorString( "memory allocation not suppported in kdp remote debugging"); return LLDB_INVALID_ADDRESS; } -Error ProcessKDP::DoDeallocateMemory(lldb::addr_t addr) { - Error error; +Status ProcessKDP::DoDeallocateMemory(lldb::addr_t addr) { + Status error; error.SetErrorString( "memory deallocation not suppported in kdp remote debugging"); return error; } -Error ProcessKDP::EnableBreakpointSite(BreakpointSite *bp_site) { +Status ProcessKDP::EnableBreakpointSite(BreakpointSite *bp_site) { if (m_comm.LocalBreakpointsAreSupported()) { - Error error; + Status error; if (!bp_site->IsEnabled()) { if (m_comm.SendRequestBreakpoint(true, bp_site->GetLoadAddress())) { bp_site->SetEnabled(true); @@ -671,9 +674,9 @@ Error ProcessKDP::EnableBreakpointSite(BreakpointSite *bp_site) { return EnableSoftwareBreakpoint(bp_site); } -Error ProcessKDP::DisableBreakpointSite(BreakpointSite *bp_site) { +Status ProcessKDP::DisableBreakpointSite(BreakpointSite *bp_site) { if (m_comm.LocalBreakpointsAreSupported()) { - Error error; + Status error; if (bp_site->IsEnabled()) { BreakpointSite::Type bp_type = bp_site->GetType(); if (bp_type == BreakpointSite::eExternal) { @@ -695,15 +698,15 @@ Error ProcessKDP::DisableBreakpointSite(BreakpointSite *bp_site) { return DisableSoftwareBreakpoint(bp_site); } -Error ProcessKDP::EnableWatchpoint(Watchpoint *wp, bool notify) { - Error error; +Status ProcessKDP::EnableWatchpoint(Watchpoint *wp, bool notify) { + Status error; error.SetErrorString( "watchpoints are not suppported in kdp remote debugging"); return error; } -Error ProcessKDP::DisableWatchpoint(Watchpoint *wp, bool notify) { - Error error; +Status ProcessKDP::DisableWatchpoint(Watchpoint *wp, bool notify) { + Status error; error.SetErrorString( "watchpoints are not suppported in kdp remote debugging"); return error; @@ -711,8 +714,8 @@ Error ProcessKDP::DisableWatchpoint(Watchpoint *wp, bool notify) { void ProcessKDP::Clear() { m_thread_list.Clear(); } -Error ProcessKDP::DoSignal(int signo) { - Error error; +Status ProcessKDP::DoSignal(int signo) { + Status error; error.SetErrorString( "sending signals is not suppported in kdp remote debugging"); return error; @@ -950,7 +953,7 @@ public: return false; } } - Error error; + Status error; DataExtractor reply; process->GetCommunication().SendRawRequest( command_byte, diff --git a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h index 8f1033b9fd3..52b9441e0e7 100644 --- a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h +++ b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h @@ -24,7 +24,7 @@ #include "lldb/Target/Process.h" #include "lldb/Target/Thread.h" #include "lldb/Utility/ConstString.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/StreamString.h" #include "lldb/Utility/StringList.h" @@ -68,26 +68,26 @@ public: //------------------------------------------------------------------ // Creating a new process, or attaching to an existing one //------------------------------------------------------------------ - lldb_private::Error WillLaunch(lldb_private::Module *module) override; + lldb_private::Status WillLaunch(lldb_private::Module *module) override; - lldb_private::Error + lldb_private::Status DoLaunch(lldb_private::Module *exe_module, lldb_private::ProcessLaunchInfo &launch_info) override; - lldb_private::Error WillAttachToProcessWithID(lldb::pid_t pid) override; + lldb_private::Status WillAttachToProcessWithID(lldb::pid_t pid) override; - lldb_private::Error + lldb_private::Status WillAttachToProcessWithName(const char *process_name, bool wait_for_launch) override; - lldb_private::Error DoConnectRemote(lldb_private::Stream *strm, - llvm::StringRef remote_url) override; + lldb_private::Status DoConnectRemote(lldb_private::Stream *strm, + llvm::StringRef remote_url) override; - lldb_private::Error DoAttachToProcessWithID( + lldb_private::Status DoAttachToProcessWithID( lldb::pid_t pid, const lldb_private::ProcessAttachInfo &attach_info) override; - lldb_private::Error DoAttachToProcessWithName( + lldb_private::Status DoAttachToProcessWithName( const char *process_name, const lldb_private::ProcessAttachInfo &attach_info) override; @@ -107,17 +107,17 @@ public: //------------------------------------------------------------------ // Process Control //------------------------------------------------------------------ - lldb_private::Error WillResume() override; + lldb_private::Status WillResume() override; - lldb_private::Error DoResume() override; + lldb_private::Status DoResume() override; - lldb_private::Error DoHalt(bool &caused_stop) override; + lldb_private::Status DoHalt(bool &caused_stop) override; - lldb_private::Error DoDetach(bool keep_stopped) override; + lldb_private::Status DoDetach(bool keep_stopped) override; - lldb_private::Error DoSignal(int signal) override; + lldb_private::Status DoSignal(int signal) override; - lldb_private::Error DoDestroy() override; + lldb_private::Status DoDestroy() override; void RefreshStateAfterStop() override; @@ -130,34 +130,34 @@ public: // Process Memory //------------------------------------------------------------------ size_t DoReadMemory(lldb::addr_t addr, void *buf, size_t size, - lldb_private::Error &error) override; + lldb_private::Status &error) override; size_t DoWriteMemory(lldb::addr_t addr, const void *buf, size_t size, - lldb_private::Error &error) override; + lldb_private::Status &error) override; lldb::addr_t DoAllocateMemory(size_t size, uint32_t permissions, - lldb_private::Error &error) override; + lldb_private::Status &error) override; - lldb_private::Error DoDeallocateMemory(lldb::addr_t ptr) override; + lldb_private::Status DoDeallocateMemory(lldb::addr_t ptr) override; //---------------------------------------------------------------------- // Process Breakpoints //---------------------------------------------------------------------- - lldb_private::Error + lldb_private::Status EnableBreakpointSite(lldb_private::BreakpointSite *bp_site) override; - lldb_private::Error + lldb_private::Status DisableBreakpointSite(lldb_private::BreakpointSite *bp_site) override; //---------------------------------------------------------------------- // Process Watchpoints //---------------------------------------------------------------------- - lldb_private::Error EnableWatchpoint(lldb_private::Watchpoint *wp, - bool notify = true) override; - - lldb_private::Error DisableWatchpoint(lldb_private::Watchpoint *wp, + lldb_private::Status EnableWatchpoint(lldb_private::Watchpoint *wp, bool notify = true) override; + lldb_private::Status DisableWatchpoint(lldb_private::Watchpoint *wp, + bool notify = true) override; + CommunicationKDP &GetCommunication() { return m_comm; } protected: diff --git a/lldb/source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_arm.cpp b/lldb/source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_arm.cpp index 06c33dba857..159a046b617 100644 --- a/lldb/source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_arm.cpp +++ b/lldb/source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_arm.cpp @@ -29,7 +29,7 @@ RegisterContextKDP_arm::~RegisterContextKDP_arm() {} int RegisterContextKDP_arm::DoReadGPR(lldb::tid_t tid, int flavor, GPR &gpr) { ProcessSP process_sp(CalculateProcess()); if (process_sp) { - Error error; + Status error; if (static_cast<ProcessKDP *>(process_sp.get()) ->GetCommunication() .SendRequestReadRegisters(tid, GPRRegSet, &gpr, sizeof(gpr), @@ -44,7 +44,7 @@ int RegisterContextKDP_arm::DoReadGPR(lldb::tid_t tid, int flavor, GPR &gpr) { int RegisterContextKDP_arm::DoReadFPU(lldb::tid_t tid, int flavor, FPU &fpu) { ProcessSP process_sp(CalculateProcess()); if (process_sp) { - Error error; + Status error; if (static_cast<ProcessKDP *>(process_sp.get()) ->GetCommunication() .SendRequestReadRegisters(tid, FPURegSet, &fpu, sizeof(fpu), @@ -59,7 +59,7 @@ int RegisterContextKDP_arm::DoReadFPU(lldb::tid_t tid, int flavor, FPU &fpu) { int RegisterContextKDP_arm::DoReadEXC(lldb::tid_t tid, int flavor, EXC &exc) { ProcessSP process_sp(CalculateProcess()); if (process_sp) { - Error error; + Status error; if (static_cast<ProcessKDP *>(process_sp.get()) ->GetCommunication() .SendRequestReadRegisters(tid, EXCRegSet, &exc, sizeof(exc), @@ -74,7 +74,7 @@ int RegisterContextKDP_arm::DoReadEXC(lldb::tid_t tid, int flavor, EXC &exc) { int RegisterContextKDP_arm::DoReadDBG(lldb::tid_t tid, int flavor, DBG &dbg) { ProcessSP process_sp(CalculateProcess()); if (process_sp) { - Error error; + Status error; if (static_cast<ProcessKDP *>(process_sp.get()) ->GetCommunication() .SendRequestReadRegisters(tid, DBGRegSet, &dbg, sizeof(dbg), @@ -90,7 +90,7 @@ int RegisterContextKDP_arm::DoWriteGPR(lldb::tid_t tid, int flavor, const GPR &gpr) { ProcessSP process_sp(CalculateProcess()); if (process_sp) { - Error error; + Status error; if (static_cast<ProcessKDP *>(process_sp.get()) ->GetCommunication() .SendRequestWriteRegisters(tid, GPRRegSet, &gpr, sizeof(gpr), @@ -106,7 +106,7 @@ int RegisterContextKDP_arm::DoWriteFPU(lldb::tid_t tid, int flavor, const FPU &fpu) { ProcessSP process_sp(CalculateProcess()); if (process_sp) { - Error error; + Status error; if (static_cast<ProcessKDP *>(process_sp.get()) ->GetCommunication() .SendRequestWriteRegisters(tid, FPURegSet, &fpu, sizeof(fpu), @@ -122,7 +122,7 @@ int RegisterContextKDP_arm::DoWriteEXC(lldb::tid_t tid, int flavor, const EXC &exc) { ProcessSP process_sp(CalculateProcess()); if (process_sp) { - Error error; + Status error; if (static_cast<ProcessKDP *>(process_sp.get()) ->GetCommunication() .SendRequestWriteRegisters(tid, EXCRegSet, &exc, sizeof(exc), @@ -138,7 +138,7 @@ int RegisterContextKDP_arm::DoWriteDBG(lldb::tid_t tid, int flavor, const DBG &dbg) { ProcessSP process_sp(CalculateProcess()); if (process_sp) { - Error error; + Status error; if (static_cast<ProcessKDP *>(process_sp.get()) ->GetCommunication() .SendRequestWriteRegisters(tid, DBGRegSet, &dbg, sizeof(dbg), diff --git a/lldb/source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_arm64.cpp b/lldb/source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_arm64.cpp index 6a2733e6275..44534a25256 100644 --- a/lldb/source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_arm64.cpp +++ b/lldb/source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_arm64.cpp @@ -30,7 +30,7 @@ RegisterContextKDP_arm64::~RegisterContextKDP_arm64() {} int RegisterContextKDP_arm64::DoReadGPR(lldb::tid_t tid, int flavor, GPR &gpr) { ProcessSP process_sp(CalculateProcess()); if (process_sp) { - Error error; + Status error; if (static_cast<ProcessKDP *>(process_sp.get()) ->GetCommunication() .SendRequestReadRegisters(tid, GPRRegSet, &gpr, sizeof(gpr), @@ -45,7 +45,7 @@ int RegisterContextKDP_arm64::DoReadGPR(lldb::tid_t tid, int flavor, GPR &gpr) { int RegisterContextKDP_arm64::DoReadFPU(lldb::tid_t tid, int flavor, FPU &fpu) { ProcessSP process_sp(CalculateProcess()); if (process_sp) { - Error error; + Status error; if (static_cast<ProcessKDP *>(process_sp.get()) ->GetCommunication() .SendRequestReadRegisters(tid, FPURegSet, &fpu, sizeof(fpu), @@ -60,7 +60,7 @@ int RegisterContextKDP_arm64::DoReadFPU(lldb::tid_t tid, int flavor, FPU &fpu) { int RegisterContextKDP_arm64::DoReadEXC(lldb::tid_t tid, int flavor, EXC &exc) { ProcessSP process_sp(CalculateProcess()); if (process_sp) { - Error error; + Status error; if (static_cast<ProcessKDP *>(process_sp.get()) ->GetCommunication() .SendRequestReadRegisters(tid, EXCRegSet, &exc, sizeof(exc), @@ -75,7 +75,7 @@ int RegisterContextKDP_arm64::DoReadEXC(lldb::tid_t tid, int flavor, EXC &exc) { int RegisterContextKDP_arm64::DoReadDBG(lldb::tid_t tid, int flavor, DBG &dbg) { ProcessSP process_sp(CalculateProcess()); if (process_sp) { - Error error; + Status error; if (static_cast<ProcessKDP *>(process_sp.get()) ->GetCommunication() .SendRequestReadRegisters(tid, DBGRegSet, &dbg, sizeof(dbg), @@ -91,7 +91,7 @@ int RegisterContextKDP_arm64::DoWriteGPR(lldb::tid_t tid, int flavor, const GPR &gpr) { ProcessSP process_sp(CalculateProcess()); if (process_sp) { - Error error; + Status error; if (static_cast<ProcessKDP *>(process_sp.get()) ->GetCommunication() .SendRequestWriteRegisters(tid, GPRRegSet, &gpr, sizeof(gpr), @@ -107,7 +107,7 @@ int RegisterContextKDP_arm64::DoWriteFPU(lldb::tid_t tid, int flavor, const FPU &fpu) { ProcessSP process_sp(CalculateProcess()); if (process_sp) { - Error error; + Status error; if (static_cast<ProcessKDP *>(process_sp.get()) ->GetCommunication() .SendRequestWriteRegisters(tid, FPURegSet, &fpu, sizeof(fpu), @@ -123,7 +123,7 @@ int RegisterContextKDP_arm64::DoWriteEXC(lldb::tid_t tid, int flavor, const EXC &exc) { ProcessSP process_sp(CalculateProcess()); if (process_sp) { - Error error; + Status error; if (static_cast<ProcessKDP *>(process_sp.get()) ->GetCommunication() .SendRequestWriteRegisters(tid, EXCRegSet, &exc, sizeof(exc), @@ -139,7 +139,7 @@ int RegisterContextKDP_arm64::DoWriteDBG(lldb::tid_t tid, int flavor, const DBG &dbg) { ProcessSP process_sp(CalculateProcess()); if (process_sp) { - Error error; + Status error; if (static_cast<ProcessKDP *>(process_sp.get()) ->GetCommunication() .SendRequestWriteRegisters(tid, DBGRegSet, &dbg, sizeof(dbg), diff --git a/lldb/source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_i386.cpp b/lldb/source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_i386.cpp index 4a130c18d07..e48232ad8dd 100644 --- a/lldb/source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_i386.cpp +++ b/lldb/source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_i386.cpp @@ -28,7 +28,7 @@ RegisterContextKDP_i386::~RegisterContextKDP_i386() {} int RegisterContextKDP_i386::DoReadGPR(lldb::tid_t tid, int flavor, GPR &gpr) { ProcessSP process_sp(CalculateProcess()); if (process_sp) { - Error error; + Status error; if (static_cast<ProcessKDP *>(process_sp.get()) ->GetCommunication() .SendRequestReadRegisters(tid, GPRRegSet, &gpr, sizeof(gpr), @@ -43,7 +43,7 @@ int RegisterContextKDP_i386::DoReadGPR(lldb::tid_t tid, int flavor, GPR &gpr) { int RegisterContextKDP_i386::DoReadFPU(lldb::tid_t tid, int flavor, FPU &fpu) { ProcessSP process_sp(CalculateProcess()); if (process_sp) { - Error error; + Status error; if (static_cast<ProcessKDP *>(process_sp.get()) ->GetCommunication() .SendRequestReadRegisters(tid, FPURegSet, &fpu, sizeof(fpu), @@ -58,7 +58,7 @@ int RegisterContextKDP_i386::DoReadFPU(lldb::tid_t tid, int flavor, FPU &fpu) { int RegisterContextKDP_i386::DoReadEXC(lldb::tid_t tid, int flavor, EXC &exc) { ProcessSP process_sp(CalculateProcess()); if (process_sp) { - Error error; + Status error; if (static_cast<ProcessKDP *>(process_sp.get()) ->GetCommunication() .SendRequestReadRegisters(tid, EXCRegSet, &exc, sizeof(exc), @@ -74,7 +74,7 @@ int RegisterContextKDP_i386::DoWriteGPR(lldb::tid_t tid, int flavor, const GPR &gpr) { ProcessSP process_sp(CalculateProcess()); if (process_sp) { - Error error; + Status error; if (static_cast<ProcessKDP *>(process_sp.get()) ->GetCommunication() .SendRequestWriteRegisters(tid, GPRRegSet, &gpr, sizeof(gpr), @@ -90,7 +90,7 @@ int RegisterContextKDP_i386::DoWriteFPU(lldb::tid_t tid, int flavor, const FPU &fpu) { ProcessSP process_sp(CalculateProcess()); if (process_sp) { - Error error; + Status error; if (static_cast<ProcessKDP *>(process_sp.get()) ->GetCommunication() .SendRequestWriteRegisters(tid, FPURegSet, &fpu, sizeof(fpu), @@ -106,7 +106,7 @@ int RegisterContextKDP_i386::DoWriteEXC(lldb::tid_t tid, int flavor, const EXC &exc) { ProcessSP process_sp(CalculateProcess()); if (process_sp) { - Error error; + Status error; if (static_cast<ProcessKDP *>(process_sp.get()) ->GetCommunication() .SendRequestWriteRegisters(tid, EXCRegSet, &exc, sizeof(exc), diff --git a/lldb/source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_x86_64.cpp b/lldb/source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_x86_64.cpp index ad10d3f6be5..50e11f38192 100644 --- a/lldb/source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_x86_64.cpp +++ b/lldb/source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_x86_64.cpp @@ -29,7 +29,7 @@ int RegisterContextKDP_x86_64::DoReadGPR(lldb::tid_t tid, int flavor, GPR &gpr) { ProcessSP process_sp(CalculateProcess()); if (process_sp) { - Error error; + Status error; if (static_cast<ProcessKDP *>(process_sp.get()) ->GetCommunication() .SendRequestReadRegisters(tid, GPRRegSet, &gpr, sizeof(gpr), @@ -45,7 +45,7 @@ int RegisterContextKDP_x86_64::DoReadFPU(lldb::tid_t tid, int flavor, FPU &fpu) { ProcessSP process_sp(CalculateProcess()); if (process_sp) { - Error error; + Status error; if (static_cast<ProcessKDP *>(process_sp.get()) ->GetCommunication() .SendRequestReadRegisters(tid, FPURegSet, &fpu, sizeof(fpu), @@ -61,7 +61,7 @@ int RegisterContextKDP_x86_64::DoReadEXC(lldb::tid_t tid, int flavor, EXC &exc) { ProcessSP process_sp(CalculateProcess()); if (process_sp) { - Error error; + Status error; if (static_cast<ProcessKDP *>(process_sp.get()) ->GetCommunication() .SendRequestReadRegisters(tid, EXCRegSet, &exc, sizeof(exc), @@ -77,7 +77,7 @@ int RegisterContextKDP_x86_64::DoWriteGPR(lldb::tid_t tid, int flavor, const GPR &gpr) { ProcessSP process_sp(CalculateProcess()); if (process_sp) { - Error error; + Status error; if (static_cast<ProcessKDP *>(process_sp.get()) ->GetCommunication() .SendRequestWriteRegisters(tid, GPRRegSet, &gpr, sizeof(gpr), @@ -93,7 +93,7 @@ int RegisterContextKDP_x86_64::DoWriteFPU(lldb::tid_t tid, int flavor, const FPU &fpu) { ProcessSP process_sp(CalculateProcess()); if (process_sp) { - Error error; + Status error; if (static_cast<ProcessKDP *>(process_sp.get()) ->GetCommunication() .SendRequestWriteRegisters(tid, FPURegSet, &fpu, sizeof(fpu), @@ -109,7 +109,7 @@ int RegisterContextKDP_x86_64::DoWriteEXC(lldb::tid_t tid, int flavor, const EXC &exc) { ProcessSP process_sp(CalculateProcess()); if (process_sp) { - Error error; + Status error; if (static_cast<ProcessKDP *>(process_sp.get()) ->GetCommunication() .SendRequestWriteRegisters(tid, EXCRegSet, &exc, sizeof(exc), diff --git a/lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp b/lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp index 347c12943bd..80751147b4f 100644 --- a/lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp +++ b/lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp @@ -68,8 +68,8 @@ static int convert_pid_status_to_return_code(int status) { // Simple helper function to ensure flags are enabled on the given file // descriptor. -static Error EnsureFDFlags(int fd, int flags) { - Error error; +static Status EnsureFDFlags(int fd, int flags) { + Status error; int status = fcntl(fd, F_GETFL); if (status == -1) { @@ -89,13 +89,13 @@ static Error EnsureFDFlags(int fd, int flags) { // Public Static Methods // ----------------------------------------------------------------------------- -Error NativeProcessProtocol::Launch( +Status NativeProcessProtocol::Launch( ProcessLaunchInfo &launch_info, NativeProcessProtocol::NativeDelegate &native_delegate, MainLoop &mainloop, NativeProcessProtocolSP &native_process_sp) { Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); - Error error; + Status error; // Verify the working directory is valid if one was specified. FileSpec working_dir{launch_info.GetWorkingDirectory()}; @@ -129,7 +129,7 @@ Error NativeProcessProtocol::Launch( return error; } -Error NativeProcessProtocol::Attach( +Status NativeProcessProtocol::Attach( lldb::pid_t pid, NativeProcessProtocol::NativeDelegate &native_delegate, MainLoop &mainloop, NativeProcessProtocolSP &native_process_sp) { Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); @@ -137,7 +137,7 @@ Error NativeProcessProtocol::Attach( // Retrieve the architecture for the running process. ArchSpec process_arch; - Error error = ResolveProcessArchitecture(pid, process_arch); + Status error = ResolveProcessArchitecture(pid, process_arch); if (!error.Success()) return error; @@ -245,7 +245,7 @@ void NativeProcessNetBSD::MonitorSIGTRAP(lldb::pid_t pid) { SetState(StateType::eStateStopped, true); break; case TRAP_EXEC: { - Error error = ReinitializeThreads(); + Status error = ReinitializeThreads(); if (error.Fail()) { SetState(StateType::eStateInvalid); return; @@ -262,7 +262,7 @@ void NativeProcessNetBSD::MonitorSIGTRAP(lldb::pid_t pid) { case TRAP_DBREG: { // If a watchpoint was hit, report it uint32_t wp_index; - Error error = + Status error = static_pointer_cast<NativeThreadNetBSD>(m_threads[info.psi_lwpid]) ->GetRegisterContext() ->GetWatchpointHitIndex(wp_index, @@ -318,10 +318,10 @@ void NativeProcessNetBSD::MonitorSignal(lldb::pid_t pid, int signal) { SetState(StateType::eStateStopped, true); } -Error NativeProcessNetBSD::PtraceWrapper(int req, lldb::pid_t pid, void *addr, - int data, int *result) { +Status NativeProcessNetBSD::PtraceWrapper(int req, lldb::pid_t pid, void *addr, + int data, int *result) { Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PTRACE)); - Error error; + Status error; int ret; errno = 0; @@ -341,7 +341,7 @@ Error NativeProcessNetBSD::PtraceWrapper(int req, lldb::pid_t pid, void *addr, return error; } -Error NativeProcessNetBSD::GetSoftwareBreakpointPCOffset( +Status NativeProcessNetBSD::GetSoftwareBreakpointPCOffset( uint32_t &actual_opcode_size) { // FIXME put this behind a breakpoint protocol class that can be // set per architecture. Need ARM, MIPS support here. @@ -349,17 +349,17 @@ Error NativeProcessNetBSD::GetSoftwareBreakpointPCOffset( switch (m_arch.GetMachine()) { case llvm::Triple::x86_64: actual_opcode_size = static_cast<uint32_t>(sizeof(g_i386_opcode)); - return Error(); + return Status(); default: assert(false && "CPU type not supported!"); - return Error("CPU type not supported"); + return Status("CPU type not supported"); } } -Error NativeProcessNetBSD::FixupBreakpointPCAsNeeded( - NativeThreadNetBSD &thread) { +Status +NativeProcessNetBSD::FixupBreakpointPCAsNeeded(NativeThreadNetBSD &thread) { Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_BREAKPOINTS)); - Error error; + Status error; // Find out the size of a breakpoint (might depend on where we are in the // code). NativeRegisterContextSP context_sp = thread.GetRegisterContext(); @@ -394,7 +394,7 @@ Error NativeProcessNetBSD::FixupBreakpointPCAsNeeded( "pid {0} no lldb breakpoint found at current pc with " "adjustment: {1}", GetID(), breakpoint_addr); - return Error(); + return Status(); } // If the breakpoint is not a software breakpoint, nothing to do. if (!breakpoint_sp->IsSoftwareBreakpoint()) { @@ -402,7 +402,7 @@ Error NativeProcessNetBSD::FixupBreakpointPCAsNeeded( log, "pid {0} breakpoint found at {1:x}, not software, nothing to adjust", GetID(), breakpoint_addr); - return Error(); + return Status(); } // // We have a software breakpoint and need to adjust the PC. @@ -414,7 +414,7 @@ Error NativeProcessNetBSD::FixupBreakpointPCAsNeeded( "pid {0} breakpoint found at {1:x}, it is software, but the " "size is zero, nothing to do (unexpected)", GetID(), breakpoint_addr); - return Error(); + return Status(); } // // We have a software breakpoint and need to adjust the PC. @@ -426,7 +426,7 @@ Error NativeProcessNetBSD::FixupBreakpointPCAsNeeded( "pid {0} breakpoint found at {1:x}, it is software, but the " "size is zero, nothing to do (unexpected)", GetID(), breakpoint_addr); - return Error(); + return Status(); } // Change the program counter. LLDB_LOG(log, "pid {0} tid {1}: changing PC from {2:x} to {3:x}", GetID(), @@ -440,7 +440,7 @@ Error NativeProcessNetBSD::FixupBreakpointPCAsNeeded( return error; } -Error NativeProcessNetBSD::Resume(const ResumeActionList &resume_actions) { +Status NativeProcessNetBSD::Resume(const ResumeActionList &resume_actions) { Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); LLDB_LOG(log, "pid {0}", GetID()); @@ -451,10 +451,10 @@ Error NativeProcessNetBSD::Resume(const ResumeActionList &resume_actions) { if (action == nullptr) { LLDB_LOG(log, "no action specified for pid {0} tid {1}", GetID(), thread_sp->GetID()); - return Error(); + return Status(); } - Error error; + Status error; switch (action->state) { case eStateRunning: { @@ -486,17 +486,17 @@ Error NativeProcessNetBSD::Resume(const ResumeActionList &resume_actions) { llvm_unreachable("Unexpected state"); default: - return Error("NativeProcessNetBSD::%s (): unexpected state %s specified " - "for pid %" PRIu64 ", tid %" PRIu64, - __FUNCTION__, StateAsCString(action->state), GetID(), - thread_sp->GetID()); + return Status("NativeProcessNetBSD::%s (): unexpected state %s specified " + "for pid %" PRIu64 ", tid %" PRIu64, + __FUNCTION__, StateAsCString(action->state), GetID(), + thread_sp->GetID()); } - return Error(); + return Status(); } -Error NativeProcessNetBSD::Halt() { - Error error; +Status NativeProcessNetBSD::Halt() { + Status error; if (kill(GetID(), SIGSTOP) != 0) error.SetErrorToErrno(); @@ -504,8 +504,8 @@ Error NativeProcessNetBSD::Halt() { return error; } -Error NativeProcessNetBSD::Detach() { - Error error; +Status NativeProcessNetBSD::Detach() { + Status error; // Stop monitoring the inferior. m_sigchld_handle.reset(); @@ -517,8 +517,8 @@ Error NativeProcessNetBSD::Detach() { return PtraceWrapper(PT_DETACH, GetID()); } -Error NativeProcessNetBSD::Signal(int signo) { - Error error; +Status NativeProcessNetBSD::Signal(int signo) { + Status error; if (kill(GetID(), signo)) error.SetErrorToErrno(); @@ -526,11 +526,11 @@ Error NativeProcessNetBSD::Signal(int signo) { return error; } -Error NativeProcessNetBSD::Kill() { +Status NativeProcessNetBSD::Kill() { Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); LLDB_LOG(log, "pid {0}", GetID()); - Error error; + Status error; switch (m_state) { case StateType::eStateInvalid: @@ -562,15 +562,15 @@ Error NativeProcessNetBSD::Kill() { return error; } -Error NativeProcessNetBSD::GetMemoryRegionInfo(lldb::addr_t load_addr, - MemoryRegionInfo &range_info) { +Status NativeProcessNetBSD::GetMemoryRegionInfo(lldb::addr_t load_addr, + MemoryRegionInfo &range_info) { if (m_supports_mem_region == LazyBool::eLazyBoolNo) { // We're done. - return Error("unsupported"); + return Status("unsupported"); } - Error error = PopulateMemoryRegionCache(); + Status error = PopulateMemoryRegionCache(); if (error.Fail()) { return error; } @@ -619,14 +619,14 @@ Error NativeProcessNetBSD::GetMemoryRegionInfo(lldb::addr_t load_addr, return error; } -Error NativeProcessNetBSD::PopulateMemoryRegionCache() { +Status NativeProcessNetBSD::PopulateMemoryRegionCache() { Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); // If our cache is empty, pull the latest. There should always be at least // one memory region if memory region handling is supported. if (!m_mem_region_cache.empty()) { LLDB_LOG(log, "reusing {0} cached memory region entries", m_mem_region_cache.size()); - return Error(); + return Status(); } struct kinfo_vmentry *vm; @@ -634,7 +634,7 @@ Error NativeProcessNetBSD::PopulateMemoryRegionCache() { vm = kinfo_getvmmap(GetID(), &count); if (vm == NULL) { m_supports_mem_region = LazyBool::eLazyBoolNo; - Error error; + Status error; error.SetErrorString("not supported"); return error; } @@ -674,7 +674,7 @@ Error NativeProcessNetBSD::PopulateMemoryRegionCache() { LLDB_LOG(log, "failed to find any vmmap entries, assuming no support " "for memory region metadata retrieval"); m_supports_mem_region = LazyBool::eLazyBoolNo; - Error error; + Status error; error.SetErrorString("not supported"); return error; } @@ -682,16 +682,16 @@ Error NativeProcessNetBSD::PopulateMemoryRegionCache() { m_mem_region_cache.size(), GetID()); // We support memory retrieval, remember that. m_supports_mem_region = LazyBool::eLazyBoolYes; - return Error(); + return Status(); } -Error NativeProcessNetBSD::AllocateMemory(size_t size, uint32_t permissions, - lldb::addr_t &addr) { - return Error("Unimplemented"); +Status NativeProcessNetBSD::AllocateMemory(size_t size, uint32_t permissions, + lldb::addr_t &addr) { + return Status("Unimplemented"); } -Error NativeProcessNetBSD::DeallocateMemory(lldb::addr_t addr) { - return Error("Unimplemented"); +Status NativeProcessNetBSD::DeallocateMemory(lldb::addr_t addr) { + return Status("Unimplemented"); } lldb::addr_t NativeProcessNetBSD::GetSharedLibraryInfoAddress() { @@ -706,15 +706,15 @@ bool NativeProcessNetBSD::GetArchitecture(ArchSpec &arch) const { return true; } -Error NativeProcessNetBSD::SetBreakpoint(lldb::addr_t addr, uint32_t size, - bool hardware) { +Status NativeProcessNetBSD::SetBreakpoint(lldb::addr_t addr, uint32_t size, + bool hardware) { if (hardware) - return Error("NativeProcessNetBSD does not support hardware breakpoints"); + return Status("NativeProcessNetBSD does not support hardware breakpoints"); else return SetSoftwareBreakpoint(addr, size); } -Error NativeProcessNetBSD::GetSoftwareBreakpointTrapOpcode( +Status NativeProcessNetBSD::GetSoftwareBreakpointTrapOpcode( size_t trap_opcode_size_hint, size_t &actual_opcode_size, const uint8_t *&trap_opcode_bytes) { static const uint8_t g_i386_opcode[] = {0xCC}; @@ -724,27 +724,27 @@ Error NativeProcessNetBSD::GetSoftwareBreakpointTrapOpcode( case llvm::Triple::x86_64: trap_opcode_bytes = g_i386_opcode; actual_opcode_size = sizeof(g_i386_opcode); - return Error(); + return Status(); default: assert(false && "CPU type not supported!"); - return Error("CPU type not supported"); + return Status("CPU type not supported"); } } -Error NativeProcessNetBSD::GetLoadedModuleFileSpec(const char *module_path, - FileSpec &file_spec) { - return Error("Unimplemented"); +Status NativeProcessNetBSD::GetLoadedModuleFileSpec(const char *module_path, + FileSpec &file_spec) { + return Status("Unimplemented"); } -Error NativeProcessNetBSD::GetFileLoadAddress(const llvm::StringRef &file_name, - lldb::addr_t &load_addr) { +Status NativeProcessNetBSD::GetFileLoadAddress(const llvm::StringRef &file_name, + lldb::addr_t &load_addr) { load_addr = LLDB_INVALID_ADDRESS; - return Error(); + return Status(); } -Error NativeProcessNetBSD::LaunchInferior(MainLoop &mainloop, - ProcessLaunchInfo &launch_info) { - Error error; +Status NativeProcessNetBSD::LaunchInferior(MainLoop &mainloop, + ProcessLaunchInfo &launch_info) { + Status error; m_sigchld_handle = mainloop.RegisterSignal( SIGCHLD, [this](MainLoopBase &) { SigchldHandler(); }, error); if (!m_sigchld_handle) @@ -826,7 +826,7 @@ Error NativeProcessNetBSD::LaunchInferior(MainLoop &mainloop, } void NativeProcessNetBSD::AttachToInferior(MainLoop &mainloop, lldb::pid_t pid, - Error &error) { + Status &error) { Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); LLDB_LOG(log, "pid = {0:x}", pid); @@ -862,7 +862,7 @@ void NativeProcessNetBSD::SigchldHandler() { if (errno == EINTR) return; - Error error(errno, eErrorTypePOSIX); + Status error(errno, eErrorTypePOSIX); LLDB_LOG(log, "waitpid ({0}, &status, _) failed: {1}", GetID(), error); } @@ -915,7 +915,7 @@ NativeThreadNetBSDSP NativeProcessNetBSD::AddThread(lldb::tid_t thread_id) { return thread_sp; } -::pid_t NativeProcessNetBSD::Attach(lldb::pid_t pid, Error &error) { +::pid_t NativeProcessNetBSD::Attach(lldb::pid_t pid, Status &error) { Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); if (pid <= 1) { @@ -956,8 +956,8 @@ NativeThreadNetBSDSP NativeProcessNetBSD::AddThread(lldb::tid_t thread_id) { return pid; } -Error NativeProcessNetBSD::ReadMemory(lldb::addr_t addr, void *buf, size_t size, - size_t &bytes_read) { +Status NativeProcessNetBSD::ReadMemory(lldb::addr_t addr, void *buf, + size_t size, size_t &bytes_read) { unsigned char *dst = static_cast<unsigned char *>(buf); struct ptrace_io_desc io; @@ -972,7 +972,7 @@ Error NativeProcessNetBSD::ReadMemory(lldb::addr_t addr, void *buf, size_t size, io.piod_offs = (void *)(addr + bytes_read); io.piod_addr = dst + bytes_read; - Error error = NativeProcessNetBSD::PtraceWrapper(PT_IO, GetID(), &io); + Status error = NativeProcessNetBSD::PtraceWrapper(PT_IO, GetID(), &io); if (error.Fail()) return error; @@ -980,22 +980,22 @@ Error NativeProcessNetBSD::ReadMemory(lldb::addr_t addr, void *buf, size_t size, io.piod_len = size - bytes_read; } while (bytes_read < size); - return Error(); + return Status(); } -Error NativeProcessNetBSD::ReadMemoryWithoutTrap(lldb::addr_t addr, void *buf, - size_t size, - size_t &bytes_read) { - Error error = ReadMemory(addr, buf, size, bytes_read); +Status NativeProcessNetBSD::ReadMemoryWithoutTrap(lldb::addr_t addr, void *buf, + size_t size, + size_t &bytes_read) { + Status error = ReadMemory(addr, buf, size, bytes_read); if (error.Fail()) return error; return m_breakpoint_list.RemoveTrapsFromBuffer(addr, buf, size); } -Error NativeProcessNetBSD::WriteMemory(lldb::addr_t addr, const void *buf, - size_t size, size_t &bytes_written) { +Status NativeProcessNetBSD::WriteMemory(lldb::addr_t addr, const void *buf, + size_t size, size_t &bytes_written) { const unsigned char *src = static_cast<const unsigned char *>(buf); - Error error; + Status error; struct ptrace_io_desc io; Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_MEMORY)); @@ -1009,7 +1009,7 @@ Error NativeProcessNetBSD::WriteMemory(lldb::addr_t addr, const void *buf, io.piod_addr = (void *)(src + bytes_written); io.piod_offs = (void *)(addr + bytes_written); - Error error = NativeProcessNetBSD::PtraceWrapper(PT_IO, GetID(), &io); + Status error = NativeProcessNetBSD::PtraceWrapper(PT_IO, GetID(), &io); if (error.Fail()) return error; @@ -1039,7 +1039,7 @@ NativeProcessNetBSD::GetAuxvData() const { .piod_addr = (void *)buf.get()->getBufferStart(), .piod_len = auxv_size}; - Error error = NativeProcessNetBSD::PtraceWrapper(PT_IO, GetID(), &io); + Status error = NativeProcessNetBSD::PtraceWrapper(PT_IO, GetID(), &io); if (error.Fail()) return std::error_code(error.GetError(), std::generic_category()); @@ -1050,13 +1050,13 @@ NativeProcessNetBSD::GetAuxvData() const { return buf; } -Error NativeProcessNetBSD::ReinitializeThreads() { +Status NativeProcessNetBSD::ReinitializeThreads() { // Clear old threads m_threads.clear(); // Initialize new thread struct ptrace_lwpinfo info = {}; - Error error = PtraceWrapper(PT_LWPINFO, GetID(), &info, sizeof(info)); + Status error = PtraceWrapper(PT_LWPINFO, GetID(), &info, sizeof(info)); if (error.Fail()) { return error; } diff --git a/lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.h b/lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.h index ae946a8e004..e18ba162e52 100644 --- a/lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.h +++ b/lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.h @@ -31,11 +31,11 @@ namespace process_netbsd { /// /// Changes in the inferior process state are broadcasted. class NativeProcessNetBSD : public NativeProcessProtocol { - friend Error NativeProcessProtocol::Launch( + friend Status NativeProcessProtocol::Launch( ProcessLaunchInfo &launch_info, NativeDelegate &native_delegate, MainLoop &mainloop, NativeProcessProtocolSP &process_sp); - friend Error NativeProcessProtocol::Attach( + friend Status NativeProcessProtocol::Attach( lldb::pid_t pid, NativeProcessProtocol::NativeDelegate &native_delegate, MainLoop &mainloop, NativeProcessProtocolSP &process_sp); @@ -43,32 +43,32 @@ public: // --------------------------------------------------------------------- // NativeProcessProtocol Interface // --------------------------------------------------------------------- - Error Resume(const ResumeActionList &resume_actions) override; + Status Resume(const ResumeActionList &resume_actions) override; - Error Halt() override; + Status Halt() override; - Error Detach() override; + Status Detach() override; - Error Signal(int signo) override; + Status Signal(int signo) override; - Error Kill() override; + Status Kill() override; - Error GetMemoryRegionInfo(lldb::addr_t load_addr, - MemoryRegionInfo &range_info) override; + Status GetMemoryRegionInfo(lldb::addr_t load_addr, + MemoryRegionInfo &range_info) override; - Error ReadMemory(lldb::addr_t addr, void *buf, size_t size, - size_t &bytes_read) override; + Status ReadMemory(lldb::addr_t addr, void *buf, size_t size, + size_t &bytes_read) override; - Error ReadMemoryWithoutTrap(lldb::addr_t addr, void *buf, size_t size, - size_t &bytes_read) override; + Status ReadMemoryWithoutTrap(lldb::addr_t addr, void *buf, size_t size, + size_t &bytes_read) override; - Error WriteMemory(lldb::addr_t addr, const void *buf, size_t size, - size_t &bytes_written) override; + Status WriteMemory(lldb::addr_t addr, const void *buf, size_t size, + size_t &bytes_written) override; - Error AllocateMemory(size_t size, uint32_t permissions, - lldb::addr_t &addr) override; + Status AllocateMemory(size_t size, uint32_t permissions, + lldb::addr_t &addr) override; - Error DeallocateMemory(lldb::addr_t addr) override; + Status DeallocateMemory(lldb::addr_t addr) override; lldb::addr_t GetSharedLibraryInfoAddress() override; @@ -76,13 +76,14 @@ public: bool GetArchitecture(ArchSpec &arch) const override; - Error SetBreakpoint(lldb::addr_t addr, uint32_t size, bool hardware) override; + Status SetBreakpoint(lldb::addr_t addr, uint32_t size, + bool hardware) override; - Error GetLoadedModuleFileSpec(const char *module_path, - FileSpec &file_spec) override; + Status GetLoadedModuleFileSpec(const char *module_path, + FileSpec &file_spec) override; - Error GetFileLoadAddress(const llvm::StringRef &file_name, - lldb::addr_t &load_addr) override; + Status GetFileLoadAddress(const llvm::StringRef &file_name, + lldb::addr_t &load_addr) override; llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> GetAuxvData() const override; @@ -90,15 +91,15 @@ public: // --------------------------------------------------------------------- // Interface used by NativeRegisterContext-derived classes. // --------------------------------------------------------------------- - static Error PtraceWrapper(int req, lldb::pid_t pid, void *addr = nullptr, - int data = 0, int *result = nullptr); + static Status PtraceWrapper(int req, lldb::pid_t pid, void *addr = nullptr, + int data = 0, int *result = nullptr); protected: // --------------------------------------------------------------------- // NativeProcessProtocol protected interface // --------------------------------------------------------------------- - Error + Status GetSoftwareBreakpointTrapOpcode(size_t trap_opcode_size_hint, size_t &actual_opcode_size, const uint8_t *&trap_opcode_bytes) override; @@ -116,8 +117,8 @@ private: NativeThreadNetBSDSP AddThread(lldb::tid_t thread_id); - Error LaunchInferior(MainLoop &mainloop, ProcessLaunchInfo &launch_info); - void AttachToInferior(MainLoop &mainloop, lldb::pid_t pid, Error &error); + Status LaunchInferior(MainLoop &mainloop, ProcessLaunchInfo &launch_info); + void AttachToInferior(MainLoop &mainloop, lldb::pid_t pid, Status &error); void MonitorCallback(lldb::pid_t pid, int signal); void MonitorExited(lldb::pid_t pid, int signal, int status); @@ -125,14 +126,14 @@ private: void MonitorSIGTRAP(lldb::pid_t pid); void MonitorSignal(lldb::pid_t pid, int signal); - Error GetSoftwareBreakpointPCOffset(uint32_t &actual_opcode_size); - Error FixupBreakpointPCAsNeeded(NativeThreadNetBSD &thread); - Error PopulateMemoryRegionCache(); + Status GetSoftwareBreakpointPCOffset(uint32_t &actual_opcode_size); + Status FixupBreakpointPCAsNeeded(NativeThreadNetBSD &thread); + Status PopulateMemoryRegionCache(); void SigchldHandler(); - ::pid_t Attach(lldb::pid_t pid, Error &error); + ::pid_t Attach(lldb::pid_t pid, Status &error); - Error ReinitializeThreads(); + Status ReinitializeThreads(); }; } // namespace process_netbsd diff --git a/lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.cpp b/lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.cpp index cd47deac73a..b442fc3462c 100644 --- a/lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.cpp +++ b/lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.cpp @@ -25,80 +25,80 @@ NativeRegisterContextNetBSD::NativeRegisterContextNetBSD( : NativeRegisterContextRegisterInfo(native_thread, concrete_frame_idx, reg_info_interface_p) {} -Error NativeRegisterContextNetBSD::ReadGPR() { +Status NativeRegisterContextNetBSD::ReadGPR() { void *buf = GetGPRBuffer(); if (!buf) - return Error("GPR buffer is NULL"); + return Status("GPR buffer is NULL"); return DoReadGPR(buf); } -Error NativeRegisterContextNetBSD::WriteGPR() { +Status NativeRegisterContextNetBSD::WriteGPR() { void *buf = GetGPRBuffer(); if (!buf) - return Error("GPR buffer is NULL"); + return Status("GPR buffer is NULL"); return DoWriteGPR(buf); } -Error NativeRegisterContextNetBSD::ReadFPR() { +Status NativeRegisterContextNetBSD::ReadFPR() { void *buf = GetFPRBuffer(); if (!buf) - return Error("FPR buffer is NULL"); + return Status("FPR buffer is NULL"); return DoReadFPR(buf); } -Error NativeRegisterContextNetBSD::WriteFPR() { +Status NativeRegisterContextNetBSD::WriteFPR() { void *buf = GetFPRBuffer(); if (!buf) - return Error("FPR buffer is NULL"); + return Status("FPR buffer is NULL"); return DoWriteFPR(buf); } -Error NativeRegisterContextNetBSD::ReadDBR() { +Status NativeRegisterContextNetBSD::ReadDBR() { void *buf = GetDBRBuffer(); if (!buf) - return Error("DBR buffer is NULL"); + return Status("DBR buffer is NULL"); return DoReadDBR(buf); } -Error NativeRegisterContextNetBSD::WriteDBR() { +Status NativeRegisterContextNetBSD::WriteDBR() { void *buf = GetDBRBuffer(); if (!buf) - return Error("DBR buffer is NULL"); + return Status("DBR buffer is NULL"); return DoWriteDBR(buf); } -Error NativeRegisterContextNetBSD::DoReadGPR(void *buf) { +Status NativeRegisterContextNetBSD::DoReadGPR(void *buf) { return NativeProcessNetBSD::PtraceWrapper(PT_GETREGS, GetProcessPid(), buf, m_thread.GetID()); } -Error NativeRegisterContextNetBSD::DoWriteGPR(void *buf) { +Status NativeRegisterContextNetBSD::DoWriteGPR(void *buf) { return NativeProcessNetBSD::PtraceWrapper(PT_SETREGS, GetProcessPid(), buf, m_thread.GetID()); } -Error NativeRegisterContextNetBSD::DoReadFPR(void *buf) { +Status NativeRegisterContextNetBSD::DoReadFPR(void *buf) { return NativeProcessNetBSD::PtraceWrapper(PT_GETFPREGS, GetProcessPid(), buf, m_thread.GetID()); } -Error NativeRegisterContextNetBSD::DoWriteFPR(void *buf) { +Status NativeRegisterContextNetBSD::DoWriteFPR(void *buf) { return NativeProcessNetBSD::PtraceWrapper(PT_SETFPREGS, GetProcessPid(), buf, m_thread.GetID()); } -Error NativeRegisterContextNetBSD::DoReadDBR(void *buf) { +Status NativeRegisterContextNetBSD::DoReadDBR(void *buf) { return NativeProcessNetBSD::PtraceWrapper(PT_GETDBREGS, GetProcessPid(), buf, m_thread.GetID()); } -Error NativeRegisterContextNetBSD::DoWriteDBR(void *buf) { +Status NativeRegisterContextNetBSD::DoWriteDBR(void *buf) { return NativeProcessNetBSD::PtraceWrapper(PT_SETDBREGS, GetProcessPid(), buf, m_thread.GetID()); } diff --git a/lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.h b/lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.h index d820baac3af..d96b7aea004 100644 --- a/lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.h +++ b/lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.h @@ -35,14 +35,14 @@ public: uint32_t concrete_frame_idx); protected: - virtual Error ReadGPR(); - virtual Error WriteGPR(); + virtual Status ReadGPR(); + virtual Status WriteGPR(); - virtual Error ReadFPR(); - virtual Error WriteFPR(); + virtual Status ReadFPR(); + virtual Status WriteFPR(); - virtual Error ReadDBR(); - virtual Error WriteDBR(); + virtual Status ReadDBR(); + virtual Status WriteDBR(); virtual void *GetGPRBuffer() { return nullptr; } virtual size_t GetGPRSize() { @@ -55,14 +55,14 @@ protected: virtual void *GetDBRBuffer() { return nullptr; } virtual size_t GetDBRSize() { return 0; } - virtual Error DoReadGPR(void *buf); - virtual Error DoWriteGPR(void *buf); + virtual Status DoReadGPR(void *buf); + virtual Status DoWriteGPR(void *buf); - virtual Error DoReadFPR(void *buf); - virtual Error DoWriteFPR(void *buf); + virtual Status DoReadFPR(void *buf); + virtual Status DoWriteFPR(void *buf); - virtual Error DoReadDBR(void *buf); - virtual Error DoWriteDBR(void *buf); + virtual Status DoReadDBR(void *buf); + virtual Status DoWriteDBR(void *buf); virtual NativeProcessNetBSD &GetProcess(); virtual ::pid_t GetProcessPid(); diff --git a/lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp b/lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp index dc37be7b934..9690da0e137 100644 --- a/lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp +++ b/lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp @@ -14,8 +14,8 @@ #include "lldb/Core/RegisterValue.h" #include "lldb/Host/HostInfo.h" #include "lldb/Utility/DataBufferHeap.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" #include "Plugins/Process/Utility/RegisterContextNetBSD_x86_64.h" @@ -251,9 +251,10 @@ int NativeRegisterContextNetBSD_x86_64::WriteRegisterSet(uint32_t set) { return -1; } -Error NativeRegisterContextNetBSD_x86_64::ReadRegister( - const RegisterInfo *reg_info, RegisterValue ®_value) { - Error error; +Status +NativeRegisterContextNetBSD_x86_64::ReadRegister(const RegisterInfo *reg_info, + RegisterValue ®_value) { + Status error; if (!reg_info) { error.SetErrorString("reg_info NULL"); @@ -446,10 +447,10 @@ Error NativeRegisterContextNetBSD_x86_64::ReadRegister( return error; } -Error NativeRegisterContextNetBSD_x86_64::WriteRegister( +Status NativeRegisterContextNetBSD_x86_64::WriteRegister( const RegisterInfo *reg_info, const RegisterValue ®_value) { - Error error; + Status error; if (!reg_info) { error.SetErrorString("reg_info NULL"); @@ -645,9 +646,9 @@ Error NativeRegisterContextNetBSD_x86_64::WriteRegister( return error; } -Error NativeRegisterContextNetBSD_x86_64::ReadAllRegisterValues( +Status NativeRegisterContextNetBSD_x86_64::ReadAllRegisterValues( lldb::DataBufferSP &data_sp) { - Error error; + Status error; data_sp.reset(new DataBufferHeap(REG_CONTEXT_SIZE, 0)); if (!data_sp) { @@ -680,9 +681,9 @@ Error NativeRegisterContextNetBSD_x86_64::ReadAllRegisterValues( return error; } -Error NativeRegisterContextNetBSD_x86_64::WriteAllRegisterValues( +Status NativeRegisterContextNetBSD_x86_64::WriteAllRegisterValues( const lldb::DataBufferSP &data_sp) { - Error error; + Status error; if (!data_sp) { error.SetErrorStringWithFormat( @@ -717,14 +718,14 @@ Error NativeRegisterContextNetBSD_x86_64::WriteAllRegisterValues( return error; } -Error NativeRegisterContextNetBSD_x86_64::IsWatchpointHit(uint32_t wp_index, - bool &is_hit) { +Status NativeRegisterContextNetBSD_x86_64::IsWatchpointHit(uint32_t wp_index, + bool &is_hit) { if (wp_index >= NumSupportedHardwareWatchpoints()) - return Error("Watchpoint index out of range"); + return Status("Watchpoint index out of range"); RegisterValue reg_value; const RegisterInfo *const reg_info = GetRegisterInfoAtIndex(lldb_dr6_x86_64); - Error error = ReadRegister(reg_info, reg_value); + Status error = ReadRegister(reg_info, reg_value); if (error.Fail()) { is_hit = false; return error; @@ -737,12 +738,12 @@ Error NativeRegisterContextNetBSD_x86_64::IsWatchpointHit(uint32_t wp_index, return error; } -Error NativeRegisterContextNetBSD_x86_64::GetWatchpointHitIndex( +Status NativeRegisterContextNetBSD_x86_64::GetWatchpointHitIndex( uint32_t &wp_index, lldb::addr_t trap_addr) { uint32_t num_hw_wps = NumSupportedHardwareWatchpoints(); for (wp_index = 0; wp_index < num_hw_wps; ++wp_index) { bool is_hit; - Error error = IsWatchpointHit(wp_index, is_hit); + Status error = IsWatchpointHit(wp_index, is_hit); if (error.Fail()) { wp_index = LLDB_INVALID_INDEX32; return error; @@ -751,17 +752,17 @@ Error NativeRegisterContextNetBSD_x86_64::GetWatchpointHitIndex( } } wp_index = LLDB_INVALID_INDEX32; - return Error(); + return Status(); } -Error NativeRegisterContextNetBSD_x86_64::IsWatchpointVacant(uint32_t wp_index, - bool &is_vacant) { +Status NativeRegisterContextNetBSD_x86_64::IsWatchpointVacant(uint32_t wp_index, + bool &is_vacant) { if (wp_index >= NumSupportedHardwareWatchpoints()) - return Error("Watchpoint index out of range"); + return Status("Watchpoint index out of range"); RegisterValue reg_value; const RegisterInfo *const reg_info = GetRegisterInfoAtIndex(lldb_dr7_x86_64); - Error error = ReadRegister(reg_info, reg_value); + Status error = ReadRegister(reg_info, reg_value); if (error.Fail()) { is_vacant = false; return error; @@ -774,11 +775,11 @@ Error NativeRegisterContextNetBSD_x86_64::IsWatchpointVacant(uint32_t wp_index, return error; } -Error NativeRegisterContextNetBSD_x86_64::SetHardwareWatchpointWithIndex( +Status NativeRegisterContextNetBSD_x86_64::SetHardwareWatchpointWithIndex( lldb::addr_t addr, size_t size, uint32_t watch_flags, uint32_t wp_index) { if (wp_index >= NumSupportedHardwareWatchpoints()) - return Error("Watchpoint index out of range"); + return Status("Watchpoint index out of range"); // Read only watchpoints aren't supported on x86_64. Fall back to read/write // waitchpoints instead. @@ -788,17 +789,17 @@ Error NativeRegisterContextNetBSD_x86_64::SetHardwareWatchpointWithIndex( watch_flags = 0x3; if (watch_flags != 0x1 && watch_flags != 0x3) - return Error("Invalid read/write bits for watchpoint"); + return Status("Invalid read/write bits for watchpoint"); if (size != 1 && size != 2 && size != 4 && size != 8) - return Error("Invalid size for watchpoint"); + return Status("Invalid size for watchpoint"); bool is_vacant; - Error error = IsWatchpointVacant(wp_index, is_vacant); + Status error = IsWatchpointVacant(wp_index, is_vacant); if (error.Fail()) return error; if (!is_vacant) - return Error("Watchpoint index not vacant"); + return Status("Watchpoint index not vacant"); RegisterValue reg_value; const RegisterInfo *const reg_info_dr7 = @@ -851,7 +852,7 @@ bool NativeRegisterContextNetBSD_x86_64::ClearHardwareWatchpoint( // clear bits 0, 1, 2, or 3 of the debug status register (DR6) const RegisterInfo *const reg_info_dr6 = GetRegisterInfoAtIndex(lldb_dr6_x86_64); - Error error = ReadRegister(reg_info_dr6, reg_value); + Status error = ReadRegister(reg_info_dr6, reg_value); if (error.Fail()) return false; uint64_t bit_mask = 1 << wp_index; @@ -873,13 +874,13 @@ bool NativeRegisterContextNetBSD_x86_64::ClearHardwareWatchpoint( return WriteRegister(reg_info_dr7, RegisterValue(control_bits)).Success(); } -Error NativeRegisterContextNetBSD_x86_64::ClearAllHardwareWatchpoints() { +Status NativeRegisterContextNetBSD_x86_64::ClearAllHardwareWatchpoints() { RegisterValue reg_value; // clear bits {0-4} of the debug status register (DR6) const RegisterInfo *const reg_info_dr6 = GetRegisterInfoAtIndex(lldb_dr6_x86_64); - Error error = ReadRegister(reg_info_dr6, reg_value); + Status error = ReadRegister(reg_info_dr6, reg_value); if (error.Fail()) return error; uint64_t bit_mask = 0xF; @@ -905,7 +906,7 @@ uint32_t NativeRegisterContextNetBSD_x86_64::SetHardwareWatchpoint( const uint32_t num_hw_watchpoints = NumSupportedHardwareWatchpoints(); for (uint32_t wp_index = 0; wp_index < num_hw_watchpoints; ++wp_index) { bool is_vacant; - Error error = IsWatchpointVacant(wp_index, is_vacant); + Status error = IsWatchpointVacant(wp_index, is_vacant); if (is_vacant) { error = SetHardwareWatchpointWithIndex(addr, size, watch_flags, wp_index); if (error.Success()) diff --git a/lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.h b/lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.h index 35b7cf1c2f1..5f5a6a0792e 100644 --- a/lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.h +++ b/lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.h @@ -36,29 +36,30 @@ public: const RegisterSet *GetRegisterSet(uint32_t set_index) const override; - Error ReadRegister(const RegisterInfo *reg_info, - RegisterValue ®_value) override; + Status ReadRegister(const RegisterInfo *reg_info, + RegisterValue ®_value) override; - Error WriteRegister(const RegisterInfo *reg_info, - const RegisterValue ®_value) override; + Status WriteRegister(const RegisterInfo *reg_info, + const RegisterValue ®_value) override; - Error ReadAllRegisterValues(lldb::DataBufferSP &data_sp) override; + Status ReadAllRegisterValues(lldb::DataBufferSP &data_sp) override; - Error WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override; + Status WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override; - Error IsWatchpointHit(uint32_t wp_index, bool &is_hit) override; + Status IsWatchpointHit(uint32_t wp_index, bool &is_hit) override; - Error GetWatchpointHitIndex(uint32_t &wp_index, - lldb::addr_t trap_addr) override; + Status GetWatchpointHitIndex(uint32_t &wp_index, + lldb::addr_t trap_addr) override; - Error IsWatchpointVacant(uint32_t wp_index, bool &is_vacant) override; + Status IsWatchpointVacant(uint32_t wp_index, bool &is_vacant) override; bool ClearHardwareWatchpoint(uint32_t wp_index) override; - Error ClearAllHardwareWatchpoints() override; + Status ClearAllHardwareWatchpoints() override; - Error SetHardwareWatchpointWithIndex(lldb::addr_t addr, size_t size, - uint32_t watch_flags, uint32_t wp_index); + Status SetHardwareWatchpointWithIndex(lldb::addr_t addr, size_t size, + uint32_t watch_flags, + uint32_t wp_index); uint32_t SetHardwareWatchpoint(lldb::addr_t addr, size_t size, uint32_t watch_flags) override; diff --git a/lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp b/lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp index 9beb65288c2..8a16431b016 100644 --- a/lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp +++ b/lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp @@ -160,40 +160,40 @@ NativeRegisterContextSP NativeThreadNetBSD::GetRegisterContext() { return m_reg_context_sp; } -Error NativeThreadNetBSD::SetWatchpoint(lldb::addr_t addr, size_t size, - uint32_t watch_flags, bool hardware) { +Status NativeThreadNetBSD::SetWatchpoint(lldb::addr_t addr, size_t size, + uint32_t watch_flags, bool hardware) { if (!hardware) - return Error("not implemented"); + return Status("not implemented"); if (m_state == eStateLaunching) - return Error(); - Error error = RemoveWatchpoint(addr); + return Status(); + Status error = RemoveWatchpoint(addr); if (error.Fail()) return error; NativeRegisterContextSP reg_ctx = GetRegisterContext(); uint32_t wp_index = reg_ctx->SetHardwareWatchpoint(addr, size, watch_flags); if (wp_index == LLDB_INVALID_INDEX32) - return Error("Setting hardware watchpoint failed."); + return Status("Setting hardware watchpoint failed."); m_watchpoint_index_map.insert({addr, wp_index}); - return Error(); + return Status(); } -Error NativeThreadNetBSD::RemoveWatchpoint(lldb::addr_t addr) { +Status NativeThreadNetBSD::RemoveWatchpoint(lldb::addr_t addr) { auto wp = m_watchpoint_index_map.find(addr); if (wp == m_watchpoint_index_map.end()) - return Error(); + return Status(); uint32_t wp_index = wp->second; m_watchpoint_index_map.erase(wp); if (GetRegisterContext()->ClearHardwareWatchpoint(wp_index)) - return Error(); - return Error("Clearing hardware watchpoint failed."); + return Status(); + return Status("Clearing hardware watchpoint failed."); } -Error NativeThreadNetBSD::SetHardwareBreakpoint(lldb::addr_t addr, - size_t size) { +Status NativeThreadNetBSD::SetHardwareBreakpoint(lldb::addr_t addr, + size_t size) { if (m_state == eStateLaunching) - return Error(); + return Status(); - Error error = RemoveHardwareBreakpoint(addr); + Status error = RemoveHardwareBreakpoint(addr); if (error.Fail()) return error; @@ -201,22 +201,22 @@ Error NativeThreadNetBSD::SetHardwareBreakpoint(lldb::addr_t addr, uint32_t bp_index = reg_ctx->SetHardwareBreakpoint(addr, size); if (bp_index == LLDB_INVALID_INDEX32) - return Error("Setting hardware breakpoint failed."); + return Status("Setting hardware breakpoint failed."); m_hw_break_index_map.insert({addr, bp_index}); - return Error(); + return Status(); } -Error NativeThreadNetBSD::RemoveHardwareBreakpoint(lldb::addr_t addr) { +Status NativeThreadNetBSD::RemoveHardwareBreakpoint(lldb::addr_t addr) { auto bp = m_hw_break_index_map.find(addr); if (bp == m_hw_break_index_map.end()) - return Error(); + return Status(); uint32_t bp_index = bp->second; if (GetRegisterContext()->ClearHardwareBreakpoint(bp_index)) { m_hw_break_index_map.erase(bp); - return Error(); + return Status(); } - return Error("Clearing hardware breakpoint failed."); + return Status("Clearing hardware breakpoint failed."); } diff --git a/lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.h b/lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.h index 96d7fd0ce03..dcd360cdd31 100644 --- a/lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.h +++ b/lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.h @@ -38,14 +38,14 @@ public: NativeRegisterContextSP GetRegisterContext() override; - Error SetWatchpoint(lldb::addr_t addr, size_t size, uint32_t watch_flags, - bool hardware) override; + Status SetWatchpoint(lldb::addr_t addr, size_t size, uint32_t watch_flags, + bool hardware) override; - Error RemoveWatchpoint(lldb::addr_t addr) override; + Status RemoveWatchpoint(lldb::addr_t addr) override; - Error SetHardwareBreakpoint(lldb::addr_t addr, size_t size) override; + Status SetHardwareBreakpoint(lldb::addr_t addr, size_t size) override; - Error RemoveHardwareBreakpoint(lldb::addr_t addr) override; + Status RemoveHardwareBreakpoint(lldb::addr_t addr) override; private: // --------------------------------------------------------------------- diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp index 485a39e6c9a..312c1887b58 100644 --- a/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp +++ b/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp @@ -1055,7 +1055,7 @@ bool RegisterContextLLDB::ReadRegisterValueFromRegisterLocation( case UnwindLLDB::RegisterLocation::eRegisterSavedAtHostMemoryLocation: llvm_unreachable("FIXME debugger inferior function call unwind"); case UnwindLLDB::RegisterLocation::eRegisterSavedAtMemoryLocation: { - Error error(ReadRegisterValueFromMemory( + Status error(ReadRegisterValueFromMemory( reg_info, regloc.location.target_memory_location, reg_info->byte_size, value)); success = error.Success(); @@ -1097,7 +1097,7 @@ bool RegisterContextLLDB::WriteRegisterValueToRegisterLocation( case UnwindLLDB::RegisterLocation::eRegisterSavedAtHostMemoryLocation: llvm_unreachable("FIXME debugger inferior function call unwind"); case UnwindLLDB::RegisterLocation::eRegisterSavedAtMemoryLocation: { - Error error(WriteRegisterValueToMemory( + Status error(WriteRegisterValueToMemory( reg_info, regloc.location.target_memory_location, reg_info->byte_size, value)); success = error.Success(); @@ -1514,7 +1514,7 @@ RegisterContextLLDB::SavedLocationForRegister( unwindplan_regloc.GetDWARFExpressionLength()); dwarfexpr.SetRegisterKind(unwindplan_registerkind); Value result; - Error error; + Status error; if (dwarfexpr.Evaluate(&exe_ctx, nullptr, nullptr, this, 0, nullptr, nullptr, result, &error)) { addr_t val; @@ -1769,7 +1769,7 @@ bool RegisterContextLLDB::ReadCFAValueForRow( GetRegisterInfoAtIndex(cfa_reg.GetAsKind(eRegisterKindLLDB)); RegisterValue reg_value; if (reg_info) { - Error error = ReadRegisterValueFromMemory( + Status error = ReadRegisterValueFromMemory( reg_info, cfa_reg_contents, reg_info->byte_size, reg_value); if (error.Success()) { cfa_value = reg_value.GetAsUInt64(); @@ -1824,7 +1824,7 @@ bool RegisterContextLLDB::ReadCFAValueForRow( row->GetCFAValue().GetDWARFExpressionLength()); dwarfexpr.SetRegisterKind(row_register_kind); Value result; - Error error; + Status error; if (dwarfexpr.Evaluate(&exe_ctx, nullptr, nullptr, this, 0, nullptr, nullptr, result, &error)) { cfa_value = result.GetScalar().ULongLong(); diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextMemory.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextMemory.cpp index eed5eec8fae..8f0dfd2a5b5 100644 --- a/lldb/source/Plugins/Process/Utility/RegisterContextMemory.cpp +++ b/lldb/source/Plugins/Process/Utility/RegisterContextMemory.cpp @@ -18,7 +18,7 @@ #include "lldb/Target/Process.h" #include "lldb/Target/Thread.h" #include "lldb/Utility/DataBufferHeap.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" using namespace lldb; using namespace lldb_private; @@ -101,8 +101,8 @@ bool RegisterContextMemory::WriteRegister(const RegisterInfo *reg_info, if (m_reg_data_addr != LLDB_INVALID_ADDRESS) { const uint32_t reg_num = reg_info->kinds[eRegisterKindLLDB]; addr_t reg_addr = m_reg_data_addr + reg_info->byte_offset; - Error error(WriteRegisterValueToMemory(reg_info, reg_addr, - reg_info->byte_size, reg_value)); + Status error(WriteRegisterValueToMemory(reg_info, reg_addr, + reg_info->byte_size, reg_value)); m_reg_valid[reg_num] = false; return error.Success(); } @@ -113,7 +113,7 @@ bool RegisterContextMemory::ReadAllRegisterValues(DataBufferSP &data_sp) { if (m_reg_data_addr != LLDB_INVALID_ADDRESS) { ProcessSP process_sp(CalculateProcess()); if (process_sp) { - Error error; + Status error; if (process_sp->ReadMemory(m_reg_data_addr, data_sp->GetBytes(), data_sp->GetByteSize(), error) == data_sp->GetByteSize()) { @@ -130,7 +130,7 @@ bool RegisterContextMemory::WriteAllRegisterValues( if (m_reg_data_addr != LLDB_INVALID_ADDRESS) { ProcessSP process_sp(CalculateProcess()); if (process_sp) { - Error error; + Status error; SetAllRegisterValid(false); if (process_sp->WriteMemory(m_reg_data_addr, data_sp->GetBytes(), data_sp->GetByteSize(), diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextThreadMemory.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextThreadMemory.cpp index 7d990e73b5b..96ad139f736 100644 --- a/lldb/source/Plugins/Process/Utility/RegisterContextThreadMemory.cpp +++ b/lldb/source/Plugins/Process/Utility/RegisterContextThreadMemory.cpp @@ -10,7 +10,7 @@ #include "lldb/Target/OperatingSystem.h" #include "lldb/Target/Process.h" #include "lldb/Target/Thread.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/lldb-private.h" #include "RegisterContextThreadMemory.h" @@ -194,26 +194,26 @@ bool RegisterContextThreadMemory::HardwareSingleStep(bool enable) { return false; } -Error RegisterContextThreadMemory::ReadRegisterValueFromMemory( +Status RegisterContextThreadMemory::ReadRegisterValueFromMemory( const lldb_private::RegisterInfo *reg_info, lldb::addr_t src_addr, uint32_t src_len, RegisterValue ®_value) { UpdateRegisterContext(); if (m_reg_ctx_sp) return m_reg_ctx_sp->ReadRegisterValueFromMemory(reg_info, src_addr, src_len, reg_value); - Error error; + Status error; error.SetErrorString("invalid register context"); return error; } -Error RegisterContextThreadMemory::WriteRegisterValueToMemory( +Status RegisterContextThreadMemory::WriteRegisterValueToMemory( const lldb_private::RegisterInfo *reg_info, lldb::addr_t dst_addr, uint32_t dst_len, const RegisterValue ®_value) { UpdateRegisterContext(); if (m_reg_ctx_sp) return m_reg_ctx_sp->WriteRegisterValueToMemory(reg_info, dst_addr, dst_len, reg_value); - Error error; + Status error; error.SetErrorString("invalid register context"); return error; } diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextThreadMemory.h b/lldb/source/Plugins/Process/Utility/RegisterContextThreadMemory.h index 7e0a2a9f7f1..3b3b0856a4c 100644 --- a/lldb/source/Plugins/Process/Utility/RegisterContextThreadMemory.h +++ b/lldb/source/Plugins/Process/Utility/RegisterContextThreadMemory.h @@ -80,13 +80,13 @@ public: bool HardwareSingleStep(bool enable) override; - Error ReadRegisterValueFromMemory(const lldb_private::RegisterInfo *reg_info, - lldb::addr_t src_addr, uint32_t src_len, - RegisterValue ®_value) override; + Status ReadRegisterValueFromMemory(const lldb_private::RegisterInfo *reg_info, + lldb::addr_t src_addr, uint32_t src_len, + RegisterValue ®_value) override; - Error WriteRegisterValueToMemory(const lldb_private::RegisterInfo *reg_info, - lldb::addr_t dst_addr, uint32_t dst_len, - const RegisterValue ®_value) override; + Status WriteRegisterValueToMemory(const lldb_private::RegisterInfo *reg_info, + lldb::addr_t dst_addr, uint32_t dst_len, + const RegisterValue ®_value) override; protected: void UpdateRegisterContext(); diff --git a/lldb/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp b/lldb/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp index e2691be603e..f907735d8f5 100644 --- a/lldb/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp +++ b/lldb/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp @@ -105,7 +105,7 @@ size_t UnwindMacOSXFrameBackchain::GetStackFrameData_i386( m_cursors.push_back(cursor); const size_t k_frame_size = sizeof(frame); - Error error; + Status error; while (frame.fp != 0 && frame.pc != 0 && ((frame.fp & 7) == 0)) { // Read both the FP and PC (8 bytes) if (process->ReadMemory(frame.fp, &frame.fp, k_frame_size, error) != @@ -196,7 +196,7 @@ size_t UnwindMacOSXFrameBackchain::GetStackFrameData_x86_64( Frame_x86_64 frame = {cursor.fp, cursor.pc}; m_cursors.push_back(cursor); - Error error; + Status error; const size_t k_frame_size = sizeof(frame); while (frame.fp != 0 && frame.pc != 0 && ((frame.fp & 7) == 0)) { // Read both the FP and PC (16 bytes) diff --git a/lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp b/lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp index b79359ba966..ac9e65c3c10 100644 --- a/lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp +++ b/lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp @@ -19,9 +19,9 @@ #include "lldb/Host/windows/ProcessLauncherWindows.h" #include "lldb/Target/Process.h" #include "lldb/Target/ProcessLaunchInfo.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" #include "Plugins/Process/Windows/Common/ProcessWindowsLog.h" @@ -60,11 +60,11 @@ DebuggerThread::DebuggerThread(DebugDelegateSP debug_delegate) DebuggerThread::~DebuggerThread() { ::CloseHandle(m_debugging_ended_event); } -Error DebuggerThread::DebugLaunch(const ProcessLaunchInfo &launch_info) { +Status DebuggerThread::DebugLaunch(const ProcessLaunchInfo &launch_info) { Log *log = ProcessWindowsLog::GetLogIfAny(WINDOWS_LOG_PROCESS); LLDB_LOG(log, "launching '{0}'", launch_info.GetExecutableFile().GetPath()); - Error error; + Status error; DebugLaunchContext *context = new DebugLaunchContext(this, launch_info); HostThread slave_thread(ThreadLauncher::LaunchThread( "lldb.plugin.process-windows.slave[?]", DebuggerThreadLaunchRoutine, @@ -76,12 +76,12 @@ Error DebuggerThread::DebugLaunch(const ProcessLaunchInfo &launch_info) { return error; } -Error DebuggerThread::DebugAttach(lldb::pid_t pid, - const ProcessAttachInfo &attach_info) { +Status DebuggerThread::DebugAttach(lldb::pid_t pid, + const ProcessAttachInfo &attach_info) { Log *log = ProcessWindowsLog::GetLogIfAny(WINDOWS_LOG_PROCESS); LLDB_LOG(log, "attaching to '{0}'", pid); - Error error; + Status error; DebugAttachContext *context = new DebugAttachContext(this, pid, attach_info); HostThread slave_thread(ThreadLauncher::LaunchThread( "lldb.plugin.process-windows.slave[?]", DebuggerThreadAttachRoutine, @@ -120,7 +120,7 @@ lldb::thread_result_t DebuggerThread::DebuggerThreadLaunchRoutine( LLDB_LOG(log, "preparing to launch '{0}' on background thread.", launch_info.GetExecutableFile().GetPath()); - Error error; + Status error; ProcessLauncherWindows launcher; HostProcess process(launcher.LaunchProcess(launch_info, error)); // If we couldn't create the process, notify waiters immediately. Otherwise @@ -152,7 +152,7 @@ lldb::thread_result_t DebuggerThread::DebuggerThreadAttachRoutine( pid); if (!DebugActiveProcess((DWORD)pid)) { - Error error(::GetLastError(), eErrorTypeWin32); + Status error(::GetLastError(), eErrorTypeWin32); m_debug_delegate->OnDebuggerError(error, 0); return 0; } @@ -167,8 +167,8 @@ lldb::thread_result_t DebuggerThread::DebuggerThreadAttachRoutine( return 0; } -Error DebuggerThread::StopDebugging(bool terminate) { - Error error; +Status DebuggerThread::StopDebugging(bool terminate) { + Status error; lldb::pid_t pid = m_process.GetProcessId(); @@ -515,7 +515,7 @@ DebuggerThread::HandleRipEvent(const RIP_INFO &info, DWORD thread_id) { LLDB_LOG(log, "encountered error {0} (type={1}) in process {2} thread {3}", info.dwError, info.dwType, m_process.GetProcessId(), thread_id); - Error error(info.dwError, eErrorTypeWin32); + Status error(info.dwError, eErrorTypeWin32); m_debug_delegate->OnDebuggerError(error, info.dwType); return DBG_CONTINUE; diff --git a/lldb/source/Plugins/Process/Windows/Common/DebuggerThread.h b/lldb/source/Plugins/Process/Windows/Common/DebuggerThread.h index ef4b47bab8c..fcf36f7dec9 100644 --- a/lldb/source/Plugins/Process/Windows/Common/DebuggerThread.h +++ b/lldb/source/Plugins/Process/Windows/Common/DebuggerThread.h @@ -32,8 +32,8 @@ public: DebuggerThread(DebugDelegateSP debug_delegate); virtual ~DebuggerThread(); - Error DebugLaunch(const ProcessLaunchInfo &launch_info); - Error DebugAttach(lldb::pid_t pid, const ProcessAttachInfo &attach_info); + Status DebugLaunch(const ProcessLaunchInfo &launch_info); + Status DebugAttach(lldb::pid_t pid, const ProcessAttachInfo &attach_info); HostProcess GetProcess() const { return m_process; } HostThread GetMainThread() const { return m_main_thread; } @@ -41,7 +41,7 @@ public: return m_active_exception; } - Error StopDebugging(bool terminate); + Status StopDebugging(bool terminate); void ContinueAsyncException(ExceptionResult result); diff --git a/lldb/source/Plugins/Process/Windows/Common/IDebugDelegate.h b/lldb/source/Plugins/Process/Windows/Common/IDebugDelegate.h index e88e0ada053..73c285f1ecc 100644 --- a/lldb/source/Plugins/Process/Windows/Common/IDebugDelegate.h +++ b/lldb/source/Plugins/Process/Windows/Common/IDebugDelegate.h @@ -16,7 +16,7 @@ #include <string> namespace lldb_private { -class Error; +class Status; class HostThread; //---------------------------------------------------------------------- @@ -39,7 +39,7 @@ public: lldb::addr_t module_addr) = 0; virtual void OnUnloadDll(lldb::addr_t module_addr) = 0; virtual void OnDebugString(const std::string &string) = 0; - virtual void OnDebuggerError(const Error &error, uint32_t type) = 0; + virtual void OnDebuggerError(const Status &error, uint32_t type) = 0; }; } diff --git a/lldb/source/Plugins/Process/Windows/Common/LocalDebugDelegate.cpp b/lldb/source/Plugins/Process/Windows/Common/LocalDebugDelegate.cpp index 600aef37250..92aa7e2678b 100644 --- a/lldb/source/Plugins/Process/Windows/Common/LocalDebugDelegate.cpp +++ b/lldb/source/Plugins/Process/Windows/Common/LocalDebugDelegate.cpp @@ -62,7 +62,7 @@ void LocalDebugDelegate::OnDebugString(const std::string &string) { process->OnDebugString(string); } -void LocalDebugDelegate::OnDebuggerError(const Error &error, uint32_t type) { +void LocalDebugDelegate::OnDebuggerError(const Status &error, uint32_t type) { if (ProcessWindowsSP process = GetProcessPointer()) process->OnDebuggerError(error, type); } diff --git a/lldb/source/Plugins/Process/Windows/Common/LocalDebugDelegate.h b/lldb/source/Plugins/Process/Windows/Common/LocalDebugDelegate.h index 819854a1e63..2cb479ccce8 100644 --- a/lldb/source/Plugins/Process/Windows/Common/LocalDebugDelegate.h +++ b/lldb/source/Plugins/Process/Windows/Common/LocalDebugDelegate.h @@ -55,7 +55,7 @@ public: lldb::addr_t module_addr) override; void OnUnloadDll(lldb::addr_t module_addr) override; void OnDebugString(const std::string &message) override; - void OnDebuggerError(const Error &error, uint32_t type) override; + void OnDebuggerError(const Status &error, uint32_t type) override; private: ProcessWindowsSP GetProcessPointer(); diff --git a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp index 56a98a8eef6..a1c9cfaed41 100644 --- a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp +++ b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp @@ -87,7 +87,7 @@ public: ~ProcessWindowsData() { ::CloseHandle(m_initial_stop_event); } - Error m_launch_error; + Status m_launch_error; DebuggerThreadSP m_debugger; StopInfoSP m_pending_stop_info; HANDLE m_initial_stop_event = nullptr; @@ -132,18 +132,18 @@ ProcessWindows::ProcessWindows(lldb::TargetSP target_sp, ProcessWindows::~ProcessWindows() {} -size_t ProcessWindows::GetSTDOUT(char *buf, size_t buf_size, Error &error) { +size_t ProcessWindows::GetSTDOUT(char *buf, size_t buf_size, Status &error) { error.SetErrorString("GetSTDOUT unsupported on Windows"); return 0; } -size_t ProcessWindows::GetSTDERR(char *buf, size_t buf_size, Error &error) { +size_t ProcessWindows::GetSTDERR(char *buf, size_t buf_size, Status &error) { error.SetErrorString("GetSTDERR unsupported on Windows"); return 0; } size_t ProcessWindows::PutSTDIN(const char *buf, size_t buf_size, - Error &error) { + Status &error) { error.SetErrorString("PutSTDIN unsupported on Windows"); return 0; } @@ -157,30 +157,30 @@ lldb_private::ConstString ProcessWindows::GetPluginName() { uint32_t ProcessWindows::GetPluginVersion() { return 1; } -Error ProcessWindows::EnableBreakpointSite(BreakpointSite *bp_site) { +Status ProcessWindows::EnableBreakpointSite(BreakpointSite *bp_site) { Log *log = ProcessWindowsLog::GetLogIfAny(WINDOWS_LOG_BREAKPOINTS); LLDB_LOG(log, "bp_site = {0:x}, id={1}, addr={2:x}", bp_site, bp_site->GetID(), bp_site->GetLoadAddress()); - Error error = EnableSoftwareBreakpoint(bp_site); + Status error = EnableSoftwareBreakpoint(bp_site); if (!error.Success()) LLDB_LOG(log, "error: {0}", error); return error; } -Error ProcessWindows::DisableBreakpointSite(BreakpointSite *bp_site) { +Status ProcessWindows::DisableBreakpointSite(BreakpointSite *bp_site) { Log *log = ProcessWindowsLog::GetLogIfAny(WINDOWS_LOG_BREAKPOINTS); LLDB_LOG(log, "bp_site = {0:x}, id={1}, addr={2:x}", bp_site, bp_site->GetID(), bp_site->GetLoadAddress()); - Error error = DisableSoftwareBreakpoint(bp_site); + Status error = DisableSoftwareBreakpoint(bp_site); if (!error.Success()) LLDB_LOG(log, "error: {0}", error); return error; } -Error ProcessWindows::DoDetach(bool keep_stopped) { +Status ProcessWindows::DoDetach(bool keep_stopped) { Log *log = ProcessWindowsLog::GetLogIfAny(WINDOWS_LOG_PROCESS); DebuggerThreadSP debugger_thread; StateType private_state; @@ -196,13 +196,13 @@ Error ProcessWindows::DoDetach(bool keep_stopped) { if (!m_session_data) { LLDB_LOG(log, "state = {0}, but there is no active session.", private_state); - return Error(); + return Status(); } debugger_thread = m_session_data->m_debugger; } - Error error; + Status error; if (private_state != eStateExited && private_state != eStateDetached) { LLDB_LOG(log, "detaching from process {0} while state = {1}.", debugger_thread->GetProcess().GetNativeProcess().GetSystemHandle(), @@ -226,8 +226,8 @@ Error ProcessWindows::DoDetach(bool keep_stopped) { return error; } -Error ProcessWindows::DoLaunch(Module *exe_module, - ProcessLaunchInfo &launch_info) { +Status ProcessWindows::DoLaunch(Module *exe_module, + ProcessLaunchInfo &launch_info) { // Even though m_session_data is accessed here, it is before a debugger thread // has been // kicked off. So there's no race conditions, and it shouldn't be necessary @@ -235,7 +235,7 @@ Error ProcessWindows::DoLaunch(Module *exe_module, // the mutex. Log *log = ProcessWindowsLog::GetLogIfAny(WINDOWS_LOG_PROCESS); - Error result; + Status result; if (!launch_info.GetFlags().Test(eLaunchFlagDebug)) { StreamString stream; stream.Printf("ProcessWindows unable to launch '%s'. ProcessWindows can " @@ -265,7 +265,7 @@ Error ProcessWindows::DoLaunch(Module *exe_module, } HostProcess process; - Error error = WaitForDebuggerConnection(debugger, process); + Status error = WaitForDebuggerConnection(debugger, process); if (error.Fail()) { LLDB_LOG(log, "failed launching '{0}'. {1}", launch_info.GetExecutableFile().GetPath(), error); @@ -288,8 +288,9 @@ Error ProcessWindows::DoLaunch(Module *exe_module, return result; } -Error ProcessWindows::DoAttachToProcessWithID( - lldb::pid_t pid, const ProcessAttachInfo &attach_info) { +Status +ProcessWindows::DoAttachToProcessWithID(lldb::pid_t pid, + const ProcessAttachInfo &attach_info) { Log *log = ProcessWindowsLog::GetLogIfAny(WINDOWS_LOG_PROCESS); m_session_data.reset( new ProcessWindowsData(!attach_info.GetContinueOnceAttached())); @@ -300,7 +301,7 @@ Error ProcessWindows::DoAttachToProcessWithID( m_session_data->m_debugger = debugger; DWORD process_id = static_cast<DWORD>(pid); - Error error = debugger->DebugAttach(process_id, attach_info); + Status error = debugger->DebugAttach(process_id, attach_info); if (error.Fail()) { LLDB_LOG( log, @@ -331,10 +332,10 @@ Error ProcessWindows::DoAttachToProcessWithID( return error; } -Error ProcessWindows::DoResume() { +Status ProcessWindows::DoResume() { Log *log = ProcessWindowsLog::GetLogIfAny(WINDOWS_LOG_PROCESS); llvm::sys::ScopedLock lock(m_mutex); - Error error; + Status error; StateType private_state = GetPrivateState(); if (private_state == eStateStopped || private_state == eStateCrashed) { @@ -369,7 +370,7 @@ Error ProcessWindows::DoResume() { return error; } -Error ProcessWindows::DoDestroy() { +Status ProcessWindows::DoDestroy() { Log *log = ProcessWindowsLog::GetLogIfAny(WINDOWS_LOG_PROCESS); DebuggerThreadSP debugger_thread; StateType private_state; @@ -386,13 +387,13 @@ Error ProcessWindows::DoDestroy() { if (!m_session_data) { LLDB_LOG(log, "warning: state = {0}, but there is no active session.", private_state); - return Error(); + return Status(); } debugger_thread = m_session_data->m_debugger; } - Error error; + Status error; if (private_state != eStateExited && private_state != eStateDetached) { LLDB_LOG(log, "Shutting down process {0} while state = {1}.", debugger_thread->GetProcess().GetNativeProcess().GetSystemHandle(), @@ -411,9 +412,9 @@ Error ProcessWindows::DoDestroy() { return error; } -Error ProcessWindows::DoHalt(bool &caused_stop) { +Status ProcessWindows::DoHalt(bool &caused_stop) { Log *log = ProcessWindowsLog::GetLogIfAny(WINDOWS_LOG_PROCESS); - Error error; + Status error; StateType state = GetPrivateState(); if (state == eStateStopped) caused_stop = false; @@ -623,7 +624,7 @@ bool ProcessWindows::IsAlive() { } size_t ProcessWindows::DoReadMemory(lldb::addr_t vm_addr, void *buf, - size_t size, Error &error) { + size_t size, Status &error) { Log *log = ProcessWindowsLog::GetLogIfAny(WINDOWS_LOG_MEMORY); llvm::sys::ScopedLock lock(m_mutex); @@ -645,7 +646,7 @@ size_t ProcessWindows::DoReadMemory(lldb::addr_t vm_addr, void *buf, } size_t ProcessWindows::DoWriteMemory(lldb::addr_t vm_addr, const void *buf, - size_t size, Error &error) { + size_t size, Status &error) { Log *log = ProcessWindowsLog::GetLogIfAny(WINDOWS_LOG_MEMORY); llvm::sys::ScopedLock lock(m_mutex); LLDB_LOG(log, "attempting to write {0} bytes into address {1:x}", size, @@ -669,10 +670,10 @@ size_t ProcessWindows::DoWriteMemory(lldb::addr_t vm_addr, const void *buf, return bytes_written; } -Error ProcessWindows::GetMemoryRegionInfo(lldb::addr_t vm_addr, - MemoryRegionInfo &info) { +Status ProcessWindows::GetMemoryRegionInfo(lldb::addr_t vm_addr, + MemoryRegionInfo &info) { Log *log = ProcessWindowsLog::GetLogIfAny(WINDOWS_LOG_MEMORY); - Error error; + Status error; llvm::sys::ScopedLock lock(m_mutex); info.Clear(); @@ -807,7 +808,7 @@ void ProcessWindows::OnDebuggerConnected(lldb::addr_t image_base) { FileSpec executable_file(file_name, true); ModuleSpec module_spec(executable_file); - Error error; + Status error; module = GetTarget().GetSharedModule(module_spec, &error); if (!module) { return; @@ -931,7 +932,7 @@ void ProcessWindows::OnLoadDll(const ModuleSpec &module_spec, // GetSharedModule() with // a new module will add it to the module list and return a corresponding // ModuleSP. - Error error; + Status error; ModuleSP module = GetTarget().GetSharedModule(module_spec, &error); bool load_addr_changed = false; module->SetLoadAddress(GetTarget(), module_addr, false, load_addr_changed); @@ -955,7 +956,7 @@ void ProcessWindows::OnUnloadDll(lldb::addr_t module_addr) { void ProcessWindows::OnDebugString(const std::string &string) {} -void ProcessWindows::OnDebuggerError(const Error &error, uint32_t type) { +void ProcessWindows::OnDebuggerError(const Status &error, uint32_t type) { llvm::sys::ScopedLock lock(m_mutex); Log *log = ProcessWindowsLog::GetLogIfAny(WINDOWS_LOG_PROCESS); @@ -981,9 +982,9 @@ void ProcessWindows::OnDebuggerError(const Error &error, uint32_t type) { } } -Error ProcessWindows::WaitForDebuggerConnection(DebuggerThreadSP debugger, - HostProcess &process) { - Error result; +Status ProcessWindows::WaitForDebuggerConnection(DebuggerThreadSP debugger, + HostProcess &process) { + Status result; Log *log = ProcessWindowsLog::GetLogIfAny(WINDOWS_LOG_PROCESS | WINDOWS_LOG_BREAKPOINTS); LLDB_LOG(log, "Waiting for loader breakpoint."); @@ -996,7 +997,7 @@ Error ProcessWindows::WaitForDebuggerConnection(DebuggerThreadSP debugger, process = debugger->GetProcess(); return m_session_data->m_launch_error; } else - return Error(::GetLastError(), eErrorTypeWin32); + return Status(::GetLastError(), eErrorTypeWin32); } // The Windows page protection bits are NOT independent masks that can be diff --git a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.h b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.h index f2db102299a..ed3938beb34 100644 --- a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.h +++ b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.h @@ -12,7 +12,7 @@ // Other libraries and framework includes #include "lldb/Target/Process.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/lldb-forward.h" #include "llvm/Support/Mutex.h" @@ -48,25 +48,25 @@ public: ~ProcessWindows(); - size_t GetSTDOUT(char *buf, size_t buf_size, Error &error) override; - size_t GetSTDERR(char *buf, size_t buf_size, Error &error) override; - size_t PutSTDIN(const char *buf, size_t buf_size, Error &error) override; + size_t GetSTDOUT(char *buf, size_t buf_size, Status &error) override; + size_t GetSTDERR(char *buf, size_t buf_size, Status &error) override; + size_t PutSTDIN(const char *buf, size_t buf_size, Status &error) override; // lldb_private::Process overrides ConstString GetPluginName() override; uint32_t GetPluginVersion() override; - Error EnableBreakpointSite(BreakpointSite *bp_site) override; - Error DisableBreakpointSite(BreakpointSite *bp_site) override; + Status EnableBreakpointSite(BreakpointSite *bp_site) override; + Status DisableBreakpointSite(BreakpointSite *bp_site) override; - Error DoDetach(bool keep_stopped) override; - Error DoLaunch(Module *exe_module, ProcessLaunchInfo &launch_info) override; - Error DoAttachToProcessWithID( + Status DoDetach(bool keep_stopped) override; + Status DoLaunch(Module *exe_module, ProcessLaunchInfo &launch_info) override; + Status DoAttachToProcessWithID( lldb::pid_t pid, const lldb_private::ProcessAttachInfo &attach_info) override; - Error DoResume() override; - Error DoDestroy() override; - Error DoHalt(bool &caused_stop) override; + Status DoResume() override; + Status DoDestroy() override; + Status DoHalt(bool &caused_stop) override; void DidLaunch() override; void DidAttach(lldb_private::ArchSpec &arch_spec) override; @@ -81,11 +81,11 @@ public: bool IsAlive() override; size_t DoReadMemory(lldb::addr_t vm_addr, void *buf, size_t size, - Error &error) override; + Status &error) override; size_t DoWriteMemory(lldb::addr_t vm_addr, const void *buf, size_t size, - Error &error) override; - Error GetMemoryRegionInfo(lldb::addr_t vm_addr, - MemoryRegionInfo &info) override; + Status &error) override; + Status GetMemoryRegionInfo(lldb::addr_t vm_addr, + MemoryRegionInfo &info) override; lldb::addr_t GetImageInfoAddress() override; @@ -100,11 +100,11 @@ public: lldb::addr_t module_addr) override; void OnUnloadDll(lldb::addr_t module_addr) override; void OnDebugString(const std::string &string) override; - void OnDebuggerError(const Error &error, uint32_t type) override; + void OnDebuggerError(const Status &error, uint32_t type) override; private: - Error WaitForDebuggerConnection(DebuggerThreadSP debugger, - HostProcess &process); + Status WaitForDebuggerConnection(DebuggerThreadSP debugger, + HostProcess &process); // These decode the page protection bits. static bool IsPageReadable(uint32_t protect); diff --git a/lldb/source/Plugins/Process/Windows/Common/RegisterContextWindows.cpp b/lldb/source/Plugins/Process/Windows/Common/RegisterContextWindows.cpp index bfed3044910..b3f507128f8 100644 --- a/lldb/source/Plugins/Process/Windows/Common/RegisterContextWindows.cpp +++ b/lldb/source/Plugins/Process/Windows/Common/RegisterContextWindows.cpp @@ -10,7 +10,7 @@ #include "lldb/Host/windows/HostThreadWindows.h" #include "lldb/Host/windows/windows.h" #include "lldb/Utility/DataBufferHeap.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/lldb-private-types.h" #include "ProcessWindowsLog.h" diff --git a/lldb/source/Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.cpp b/lldb/source/Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.cpp index 53fe1d90249..e64bade5ff9 100644 --- a/lldb/source/Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.cpp +++ b/lldb/source/Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.cpp @@ -10,7 +10,7 @@ #include "lldb/Core/RegisterValue.h" #include "lldb/Host/windows/HostThreadWindows.h" #include "lldb/Host/windows/windows.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/lldb-private-types.h" #include "RegisterContextWindows_x64.h" diff --git a/lldb/source/Plugins/Process/Windows/Common/x86/RegisterContextWindows_x86.cpp b/lldb/source/Plugins/Process/Windows/Common/x86/RegisterContextWindows_x86.cpp index 8127606583c..f56836de4a6 100644 --- a/lldb/source/Plugins/Process/Windows/Common/x86/RegisterContextWindows_x86.cpp +++ b/lldb/source/Plugins/Process/Windows/Common/x86/RegisterContextWindows_x86.cpp @@ -10,7 +10,7 @@ #include "lldb/Core/RegisterValue.h" #include "lldb/Host/windows/HostThreadWindows.h" #include "lldb/Host/windows/windows.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/lldb-private-types.h" #include "ProcessWindowsLog.h" diff --git a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp index 6561d2a0582..5a459e80348 100644 --- a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp +++ b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp @@ -84,8 +84,8 @@ bool ProcessElfCore::CanDebug(lldb::TargetSP target_sp, // For now we are just making sure the file exists for a given module if (!m_core_module_sp && m_core_file.Exists()) { ModuleSpec core_module_spec(m_core_file, target_sp->GetArchitecture()); - Error error(ModuleList::GetSharedModule(core_module_spec, m_core_module_sp, - NULL, NULL, NULL)); + Status error(ModuleList::GetSharedModule(core_module_spec, m_core_module_sp, + NULL, NULL, NULL)); if (m_core_module_sp) { ObjectFile *core_objfile = m_core_module_sp->GetObjectFile(); if (core_objfile && core_objfile->GetType() == ObjectFile::eTypeCoreFile) @@ -157,8 +157,8 @@ lldb::addr_t ProcessElfCore::AddAddressRangeFromLoadSegment( //---------------------------------------------------------------------- // Process Control //---------------------------------------------------------------------- -Error ProcessElfCore::DoLoadCore() { - Error error; +Status ProcessElfCore::DoLoadCore() { + Status error; if (!m_core_module_sp) { error.SetErrorString("invalid core module"); return error; @@ -289,7 +289,7 @@ bool ProcessElfCore::UpdateThreadList(ThreadList &old_thread_list, void ProcessElfCore::RefreshStateAfterStop() {} -Error ProcessElfCore::DoDestroy() { return Error(); } +Status ProcessElfCore::DoDestroy() { return Status(); } //------------------------------------------------------------------ // Process Queries @@ -301,14 +301,14 @@ bool ProcessElfCore::IsAlive() { return true; } // Process Memory //------------------------------------------------------------------ size_t ProcessElfCore::ReadMemory(lldb::addr_t addr, void *buf, size_t size, - Error &error) { + Status &error) { // Don't allow the caching that lldb_private::Process::ReadMemory does // since in core files we have it all cached our our core file anyway. return DoReadMemory(addr, buf, size, error); } -Error ProcessElfCore::GetMemoryRegionInfo(lldb::addr_t load_addr, - MemoryRegionInfo ®ion_info) { +Status ProcessElfCore::GetMemoryRegionInfo(lldb::addr_t load_addr, + MemoryRegionInfo ®ion_info) { region_info.Clear(); const VMRangeToPermissions::Entry *permission_entry = m_core_range_infos.FindEntryThatContainsOrFollows(load_addr); @@ -335,7 +335,7 @@ Error ProcessElfCore::GetMemoryRegionInfo(lldb::addr_t load_addr, region_info.SetExecutable(MemoryRegionInfo::eNo); region_info.SetMapped(MemoryRegionInfo::eNo); } - return Error(); + return Status(); } region_info.GetRange().SetRangeBase(load_addr); @@ -344,11 +344,11 @@ Error ProcessElfCore::GetMemoryRegionInfo(lldb::addr_t load_addr, region_info.SetWritable(MemoryRegionInfo::eNo); region_info.SetExecutable(MemoryRegionInfo::eNo); region_info.SetMapped(MemoryRegionInfo::eNo); - return Error(); + return Status(); } size_t ProcessElfCore::DoReadMemory(lldb::addr_t addr, void *buf, size_t size, - Error &error) { + Status &error) { ObjectFile *core_objfile = m_core_module_sp->GetObjectFile(); if (core_objfile == NULL) @@ -540,7 +540,7 @@ static void ParseOpenBSDProcInfo(ThreadData &thread_data, DataExtractor &data) { /// new thread when it finds NT_PRSTATUS or NT_PRPSINFO NOTE entry. /// For case (b) there may be either one NT_PRPSINFO per thread, or a single /// one that applies to all threads (depending on the platform type). -Error ProcessElfCore::ParseThreadContextsFromNoteSegment( +Status ProcessElfCore::ParseThreadContextsFromNoteSegment( const elf::ELFProgramHeader *segment_header, DataExtractor segment_data) { assert(segment_header && segment_header->p_type == llvm::ELF::PT_NOTE); @@ -555,7 +555,7 @@ Error ProcessElfCore::ParseThreadContextsFromNoteSegment( ELFLinuxSigInfo siginfo; size_t header_size; size_t len; - Error error; + Status error; // Loop through the NOTE entires in the segment while (offset < segment_header->p_filesz) { diff --git a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.h b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.h index cb2f31bde4c..dbf7f926f85 100644 --- a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.h +++ b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.h @@ -26,7 +26,7 @@ // Project includes #include "lldb/Target/Process.h" #include "lldb/Utility/ConstString.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "Plugins/ObjectFile/ELF/ELFHeader.h" @@ -66,7 +66,7 @@ public: //------------------------------------------------------------------ // Creating a new process, or attaching to an existing one //------------------------------------------------------------------ - lldb_private::Error DoLoadCore() override; + lldb_private::Status DoLoadCore() override; lldb_private::DynamicLoader *GetDynamicLoader() override; @@ -80,7 +80,7 @@ public: //------------------------------------------------------------------ // Process Control //------------------------------------------------------------------ - lldb_private::Error DoDestroy() override; + lldb_private::Status DoDestroy() override; void RefreshStateAfterStop() override; @@ -93,12 +93,12 @@ public: // Process Memory //------------------------------------------------------------------ size_t ReadMemory(lldb::addr_t addr, void *buf, size_t size, - lldb_private::Error &error) override; + lldb_private::Status &error) override; size_t DoReadMemory(lldb::addr_t addr, void *buf, size_t size, - lldb_private::Error &error) override; + lldb_private::Status &error) override; - lldb_private::Error + lldb_private::Status GetMemoryRegionInfo(lldb::addr_t load_addr, lldb_private::MemoryRegionInfo ®ion_info) override; @@ -160,7 +160,7 @@ private: std::vector<NT_FILE_Entry> m_nt_file_entries; // Parse thread(s) data structures(prstatus, prpsinfo) from given NOTE segment - lldb_private::Error ParseThreadContextsFromNoteSegment( + lldb_private::Status ParseThreadContextsFromNoteSegment( const elf::ELFProgramHeader *segment_header, lldb_private::DataExtractor segment_data); diff --git a/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.cpp b/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.cpp index 260ae15d7a5..5766923186d 100644 --- a/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.cpp +++ b/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.cpp @@ -71,7 +71,7 @@ bool RegisterContextCorePOSIX_x86_64::ReadRegister(const RegisterInfo *reg_info, return false; } - Error error; + Status error; value.SetFromMemoryData(reg_info, src + offset, reg_info->byte_size, lldb::eByteOrderLittle, error); diff --git a/lldb/source/Plugins/Process/elf-core/ThreadElfCore.cpp b/lldb/source/Plugins/Process/elf-core/ThreadElfCore.cpp index 13ad82d92c5..096c20363c7 100644 --- a/lldb/source/Plugins/Process/elf-core/ThreadElfCore.cpp +++ b/lldb/source/Plugins/Process/elf-core/ThreadElfCore.cpp @@ -274,8 +274,8 @@ size_t ELFLinuxPrStatus::GetSize(lldb_private::ArchSpec &arch) { } } -Error ELFLinuxPrStatus::Parse(DataExtractor &data, ArchSpec &arch) { - Error error; +Status ELFLinuxPrStatus::Parse(DataExtractor &data, ArchSpec &arch) { + Status error; if (GetSize(arch) > data.GetByteSize()) { error.SetErrorStringWithFormat( "NT_PRSTATUS size should be %zu, but the remaining bytes are: %" PRIu64, @@ -344,8 +344,8 @@ size_t ELFLinuxPrPsInfo::GetSize(lldb_private::ArchSpec &arch) { } } -Error ELFLinuxPrPsInfo::Parse(DataExtractor &data, ArchSpec &arch) { - Error error; +Status ELFLinuxPrPsInfo::Parse(DataExtractor &data, ArchSpec &arch) { + Status error; ByteOrder byteorder = data.GetByteOrder(); if (GetSize(arch) > data.GetByteSize()) { error.SetErrorStringWithFormat( @@ -413,8 +413,8 @@ size_t ELFLinuxSigInfo::GetSize(const lldb_private::ArchSpec &arch) { } } -Error ELFLinuxSigInfo::Parse(DataExtractor &data, const ArchSpec &arch) { - Error error; +Status ELFLinuxSigInfo::Parse(DataExtractor &data, const ArchSpec &arch) { + Status error; if (GetSize(arch) > data.GetByteSize()) { error.SetErrorStringWithFormat( "NT_SIGINFO size should be %zu, but the remaining bytes are: %" PRIu64, diff --git a/lldb/source/Plugins/Process/elf-core/ThreadElfCore.h b/lldb/source/Plugins/Process/elf-core/ThreadElfCore.h index 38c52658a23..52187541371 100644 --- a/lldb/source/Plugins/Process/elf-core/ThreadElfCore.h +++ b/lldb/source/Plugins/Process/elf-core/ThreadElfCore.h @@ -57,8 +57,8 @@ struct ELFLinuxPrStatus { ELFLinuxPrStatus(); - lldb_private::Error Parse(lldb_private::DataExtractor &data, - lldb_private::ArchSpec &arch); + lldb_private::Status Parse(lldb_private::DataExtractor &data, + lldb_private::ArchSpec &arch); // Return the bytesize of the structure // 64 bit - just sizeof @@ -78,8 +78,8 @@ struct ELFLinuxSigInfo { ELFLinuxSigInfo(); - lldb_private::Error Parse(lldb_private::DataExtractor &data, - const lldb_private::ArchSpec &arch); + lldb_private::Status Parse(lldb_private::DataExtractor &data, + const lldb_private::ArchSpec &arch); // Return the bytesize of the structure // 64 bit - just sizeof @@ -113,8 +113,8 @@ struct ELFLinuxPrPsInfo { ELFLinuxPrPsInfo(); - lldb_private::Error Parse(lldb_private::DataExtractor &data, - lldb_private::ArchSpec &arch); + lldb_private::Status Parse(lldb_private::DataExtractor &data, + lldb_private::ArchSpec &arch); // Return the bytesize of the structure // 64 bit - just sizeof diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp index d527b4daaab..0c4df7e3f30 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp @@ -319,7 +319,7 @@ GDBRemoteCommunication::WaitForPacketNoLock(StringExtractorGDBRemote &packet, Timeout<std::micro> timeout, bool sync_on_timeout) { uint8_t buffer[8192]; - Error error; + Status error; Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PACKETS)); @@ -933,9 +933,9 @@ GDBRemoteCommunication::CheckForPacket(const uint8_t *src, size_t src_len, return GDBRemoteCommunication::PacketType::Invalid; } -Error GDBRemoteCommunication::StartListenThread(const char *hostname, - uint16_t port) { - Error error; +Status GDBRemoteCommunication::StartListenThread(const char *hostname, + uint16_t port) { + Status error; if (m_listen_thread.IsJoinable()) { error.SetErrorString("listen thread already running"); } else { @@ -962,7 +962,7 @@ bool GDBRemoteCommunication::JoinListenThread() { lldb::thread_result_t GDBRemoteCommunication::ListenThread(lldb::thread_arg_t arg) { GDBRemoteCommunication *comm = (GDBRemoteCommunication *)arg; - Error error; + Status error; ConnectionFileDescriptor *connection = (ConnectionFileDescriptor *)comm->GetConnection(); @@ -975,7 +975,7 @@ GDBRemoteCommunication::ListenThread(lldb::thread_arg_t arg) { return NULL; } -Error GDBRemoteCommunication::StartDebugserverProcess( +Status GDBRemoteCommunication::StartDebugserverProcess( const char *url, Platform *platform, ProcessLaunchInfo &launch_info, uint16_t *port, const Args *inferior_args, int pass_comm_fd) { Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS)); @@ -984,7 +984,7 @@ Error GDBRemoteCommunication::StartDebugserverProcess( __FUNCTION__, url ? url : "<empty>", port ? *port : uint16_t(0)); - Error error; + Status error; // If we locate debugserver, keep that located version around static FileSpec g_debugserver_file_spec; diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h index b49e05e22d9..ce90de3e847 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h @@ -65,9 +65,9 @@ public: enum class PacketResult { Success = 0, // Success - ErrorSendFailed, // Error sending the packet + ErrorSendFailed, // Status sending the packet ErrorSendAck, // Didn't get an ack back after sending a packet - ErrorReplyFailed, // Error getting the reply + ErrorReplyFailed, // Status getting the reply ErrorReplyTimeout, // Timed out waiting for reply ErrorReplyInvalid, // Got a reply but it wasn't valid for the packet that // was sent @@ -131,7 +131,7 @@ public: // Start a debugserver instance on the current host using the // supplied connection URL. //------------------------------------------------------------------ - Error StartDebugserverProcess( + Status StartDebugserverProcess( const char *url, Platform *platform, // If non nullptr, then check with the platform for // the GDB server binary if it can't be located @@ -255,8 +255,8 @@ protected: // on m_bytes. The checksum was for the compressed packet. bool DecompressPacket(); - Error StartListenThread(const char *hostname = "127.0.0.1", - uint16_t port = 0); + Status StartListenThread(const char *hostname = "127.0.0.1", + uint16_t port = 0); bool JoinListenThread(); diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp index 2e94fa94331..8d91db87b5a 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp @@ -113,7 +113,7 @@ GDBRemoteCommunicationClient::~GDBRemoteCommunicationClient() { Disconnect(); } -bool GDBRemoteCommunicationClient::HandshakeWithServer(Error *error_ptr) { +bool GDBRemoteCommunicationClient::HandshakeWithServer(Status *error_ptr) { ResetDiscoverableSettings(false); // Start the read thread after we send the handshake ack since if we @@ -1394,8 +1394,8 @@ bool GDBRemoteCommunicationClient::DeallocateMemory(addr_t addr) { return false; } -Error GDBRemoteCommunicationClient::Detach(bool keep_stopped) { - Error error; +Status GDBRemoteCommunicationClient::Detach(bool keep_stopped) { + Status error; if (keep_stopped) { if (m_supports_detach_stay_stopped == eLazyBoolCalculate) { @@ -1434,9 +1434,9 @@ Error GDBRemoteCommunicationClient::Detach(bool keep_stopped) { return error; } -Error GDBRemoteCommunicationClient::GetMemoryRegionInfo( +Status GDBRemoteCommunicationClient::GetMemoryRegionInfo( lldb::addr_t addr, lldb_private::MemoryRegionInfo ®ion_info) { - Error error; + Status error; region_info.Clear(); if (m_supports_memory_region_info != eLazyBoolNo) { @@ -1529,8 +1529,8 @@ Error GDBRemoteCommunicationClient::GetMemoryRegionInfo( return error; } -Error GDBRemoteCommunicationClient::GetWatchpointSupportInfo(uint32_t &num) { - Error error; +Status GDBRemoteCommunicationClient::GetWatchpointSupportInfo(uint32_t &num) { + Status error; if (m_supports_watchpoint_support_info == eLazyBoolYes) { num = m_num_supported_hardware_watchpoints; @@ -1568,18 +1568,18 @@ Error GDBRemoteCommunicationClient::GetWatchpointSupportInfo(uint32_t &num) { return error; } -lldb_private::Error GDBRemoteCommunicationClient::GetWatchpointSupportInfo( +lldb_private::Status GDBRemoteCommunicationClient::GetWatchpointSupportInfo( uint32_t &num, bool &after, const ArchSpec &arch) { - Error error(GetWatchpointSupportInfo(num)); + Status error(GetWatchpointSupportInfo(num)); if (error.Success()) error = GetWatchpointsTriggerAfterInstruction(after, arch); return error; } -lldb_private::Error +lldb_private::Status GDBRemoteCommunicationClient::GetWatchpointsTriggerAfterInstruction( bool &after, const ArchSpec &arch) { - Error error; + Status error; llvm::Triple::ArchType atype = arch.GetMachine(); // we assume watchpoints will happen after running the relevant opcode @@ -2539,7 +2539,7 @@ uint8_t GDBRemoteCommunicationClient::SendGDBStoppointTypePacket( if (response.IsOKResponse()) return 0; - // Error while setting breakpoint, send back specific error + // Status while setting breakpoint, send back specific error if (response.IsErrorResponse()) return response.GetError(); @@ -2635,7 +2635,7 @@ lldb::addr_t GDBRemoteCommunicationClient::GetShlibInfoAddr() { return response.GetHexMaxU64(false, LLDB_INVALID_ADDRESS); } -lldb_private::Error GDBRemoteCommunicationClient::RunShellCommand( +lldb_private::Status GDBRemoteCommunicationClient::RunShellCommand( const char *command, // Shouldn't be NULL const FileSpec & working_dir, // Pass empty FileSpec to use the current working directory @@ -2661,32 +2661,32 @@ lldb_private::Error GDBRemoteCommunicationClient::RunShellCommand( if (SendPacketAndWaitForResponse(stream.GetString(), response, false) == PacketResult::Success) { if (response.GetChar() != 'F') - return Error("malformed reply"); + return Status("malformed reply"); if (response.GetChar() != ',') - return Error("malformed reply"); + return Status("malformed reply"); uint32_t exitcode = response.GetHexMaxU32(false, UINT32_MAX); if (exitcode == UINT32_MAX) - return Error("unable to run remote process"); + return Status("unable to run remote process"); else if (status_ptr) *status_ptr = exitcode; if (response.GetChar() != ',') - return Error("malformed reply"); + return Status("malformed reply"); uint32_t signo = response.GetHexMaxU32(false, UINT32_MAX); if (signo_ptr) *signo_ptr = signo; if (response.GetChar() != ',') - return Error("malformed reply"); + return Status("malformed reply"); std::string output; response.GetEscapedBinaryData(output); if (command_output) command_output->assign(output); - return Error(); + return Status(); } - return Error("unable to send packet"); + return Status("unable to send packet"); } -Error GDBRemoteCommunicationClient::MakeDirectory(const FileSpec &file_spec, - uint32_t file_permissions) { +Status GDBRemoteCommunicationClient::MakeDirectory(const FileSpec &file_spec, + uint32_t file_permissions) { std::string path{file_spec.GetPath(false)}; lldb_private::StreamString stream; stream.PutCString("qPlatform_mkdir:"); @@ -2698,16 +2698,17 @@ Error GDBRemoteCommunicationClient::MakeDirectory(const FileSpec &file_spec, if (SendPacketAndWaitForResponse(packet, response, false) != PacketResult::Success) - return Error("failed to send '%s' packet", packet.str().c_str()); + return Status("failed to send '%s' packet", packet.str().c_str()); if (response.GetChar() != 'F') - return Error("invalid response to '%s' packet", packet.str().c_str()); + return Status("invalid response to '%s' packet", packet.str().c_str()); - return Error(response.GetU32(UINT32_MAX), eErrorTypePOSIX); + return Status(response.GetU32(UINT32_MAX), eErrorTypePOSIX); } -Error GDBRemoteCommunicationClient::SetFilePermissions( - const FileSpec &file_spec, uint32_t file_permissions) { +Status +GDBRemoteCommunicationClient::SetFilePermissions(const FileSpec &file_spec, + uint32_t file_permissions) { std::string path{file_spec.GetPath(false)}; lldb_private::StreamString stream; stream.PutCString("qPlatform_chmod:"); @@ -2719,16 +2720,16 @@ Error GDBRemoteCommunicationClient::SetFilePermissions( if (SendPacketAndWaitForResponse(packet, response, false) != PacketResult::Success) - return Error("failed to send '%s' packet", stream.GetData()); + return Status("failed to send '%s' packet", stream.GetData()); if (response.GetChar() != 'F') - return Error("invalid response to '%s' packet", stream.GetData()); + return Status("invalid response to '%s' packet", stream.GetData()); - return Error(response.GetU32(UINT32_MAX), eErrorTypePOSIX); + return Status(response.GetU32(UINT32_MAX), eErrorTypePOSIX); } static uint64_t ParseHostIOPacketResponse(StringExtractorGDBRemote &response, - uint64_t fail_result, Error &error) { + uint64_t fail_result, Status &error) { response.SetFilePos(0); if (response.GetChar() != 'F') return fail_result; @@ -2748,7 +2749,7 @@ static uint64_t ParseHostIOPacketResponse(StringExtractorGDBRemote &response, lldb::user_id_t GDBRemoteCommunicationClient::OpenFile(const lldb_private::FileSpec &file_spec, uint32_t flags, mode_t mode, - Error &error) { + Status &error) { std::string path(file_spec.GetPath(false)); lldb_private::StreamString stream; stream.PutCString("vFile:open:"); @@ -2767,7 +2768,8 @@ GDBRemoteCommunicationClient::OpenFile(const lldb_private::FileSpec &file_spec, return UINT64_MAX; } -bool GDBRemoteCommunicationClient::CloseFile(lldb::user_id_t fd, Error &error) { +bool GDBRemoteCommunicationClient::CloseFile(lldb::user_id_t fd, + Status &error) { lldb_private::StreamString stream; stream.Printf("vFile:close:%i", (int)fd); StringExtractorGDBRemote response; @@ -2796,10 +2798,11 @@ lldb::user_id_t GDBRemoteCommunicationClient::GetFileSize( return UINT64_MAX; } -Error GDBRemoteCommunicationClient::GetFilePermissions( - const FileSpec &file_spec, uint32_t &file_permissions) { +Status +GDBRemoteCommunicationClient::GetFilePermissions(const FileSpec &file_spec, + uint32_t &file_permissions) { std::string path{file_spec.GetPath(false)}; - Error error; + Status error; lldb_private::StreamString stream; stream.PutCString("vFile:mode:"); stream.PutCStringAsRawHex8(path.c_str()); @@ -2834,7 +2837,7 @@ Error GDBRemoteCommunicationClient::GetFilePermissions( uint64_t GDBRemoteCommunicationClient::ReadFile(lldb::user_id_t fd, uint64_t offset, void *dst, uint64_t dst_len, - Error &error) { + Status &error) { lldb_private::StreamString stream; stream.Printf("vFile:pread:%i,%" PRId64 ",%" PRId64, (int)fd, dst_len, offset); @@ -2868,7 +2871,7 @@ uint64_t GDBRemoteCommunicationClient::WriteFile(lldb::user_id_t fd, uint64_t offset, const void *src, uint64_t src_len, - Error &error) { + Status &error) { lldb_private::StreamGDBRemote stream; stream.Printf("vFile:pwrite:%i,%" PRId64 ",", (int)fd, offset); stream.PutEscapedBytes(src, src_len); @@ -2896,10 +2899,10 @@ uint64_t GDBRemoteCommunicationClient::WriteFile(lldb::user_id_t fd, return 0; } -Error GDBRemoteCommunicationClient::CreateSymlink(const FileSpec &src, - const FileSpec &dst) { +Status GDBRemoteCommunicationClient::CreateSymlink(const FileSpec &src, + const FileSpec &dst) { std::string src_path{src.GetPath(false)}, dst_path{dst.GetPath(false)}; - Error error; + Status error; lldb_private::StreamGDBRemote stream; stream.PutCString("vFile:symlink:"); // the unix symlink() command reverses its parameters where the dst if first, @@ -2930,9 +2933,9 @@ Error GDBRemoteCommunicationClient::CreateSymlink(const FileSpec &src, return error; } -Error GDBRemoteCommunicationClient::Unlink(const FileSpec &file_spec) { +Status GDBRemoteCommunicationClient::Unlink(const FileSpec &file_spec) { std::string path{file_spec.GetPath(false)}; - Error error; + Status error; lldb_private::StreamGDBRemote stream; stream.PutCString("vFile:unlink:"); // the unix symlink() command reverses its parameters where the dst if first, @@ -3311,7 +3314,7 @@ GDBRemoteCommunicationClient::GetModulesInfo( bool GDBRemoteCommunicationClient::ReadExtFeature( const lldb_private::ConstString object, const lldb_private::ConstString annex, std::string &out, - lldb_private::Error &err) { + lldb_private::Status &err) { std::stringstream output; StringExtractorGDBRemote chunk; @@ -3590,7 +3593,7 @@ GDBRemoteCommunicationClient::GetSupportedStructuredDataPlugins() { : nullptr; } -Error GDBRemoteCommunicationClient::SendSignalsToIgnore( +Status GDBRemoteCommunicationClient::SendSignalsToIgnore( llvm::ArrayRef<int32_t> signals) { // Format packet: // QPassSignals:<hex_sig1>;<hex_sig2>...;<hex_sigN> @@ -3601,18 +3604,18 @@ Error GDBRemoteCommunicationClient::SendSignalsToIgnore( auto send_status = SendPacketAndWaitForResponse(packet, response, false); if (send_status != GDBRemoteCommunication::PacketResult::Success) - return Error("Sending QPassSignals packet failed"); + return Status("Sending QPassSignals packet failed"); if (response.IsOKResponse()) { - return Error(); + return Status(); } else { - return Error("Unknown error happened during sending QPassSignals packet."); + return Status("Unknown error happened during sending QPassSignals packet."); } } -Error GDBRemoteCommunicationClient::ConfigureRemoteStructuredData( +Status GDBRemoteCommunicationClient::ConfigureRemoteStructuredData( const ConstString &type_name, const StructuredData::ObjectSP &config_sp) { - Error error; + Status error; if (type_name.GetLength() == 0) { error.SetErrorString("invalid type_name argument"); diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h index 63b9708cc9a..08d0bd5d690 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h @@ -41,7 +41,7 @@ public: // After connecting, send the handshake to the server to make sure // we are communicating with it. //------------------------------------------------------------------ - bool HandshakeWithServer(Error *error_ptr); + bool HandshakeWithServer(Status *error_ptr); // For packets which specify a range of output to be returned, // return all of the output via a series of request packets of the form @@ -230,17 +230,17 @@ public: bool DeallocateMemory(lldb::addr_t addr); - Error Detach(bool keep_stopped); + Status Detach(bool keep_stopped); - Error GetMemoryRegionInfo(lldb::addr_t addr, MemoryRegionInfo &range_info); + Status GetMemoryRegionInfo(lldb::addr_t addr, MemoryRegionInfo &range_info); - Error GetWatchpointSupportInfo(uint32_t &num); + Status GetWatchpointSupportInfo(uint32_t &num); - Error GetWatchpointSupportInfo(uint32_t &num, bool &after, - const ArchSpec &arch); + Status GetWatchpointSupportInfo(uint32_t &num, bool &after, + const ArchSpec &arch); - Error GetWatchpointsTriggerAfterInstruction(bool &after, - const ArchSpec &arch); + Status GetWatchpointsTriggerAfterInstruction(bool &after, + const ArchSpec &arch); const ArchSpec &GetHostArchitecture(); @@ -365,33 +365,33 @@ public: bool &sequence_mutex_unavailable); lldb::user_id_t OpenFile(const FileSpec &file_spec, uint32_t flags, - mode_t mode, Error &error); + mode_t mode, Status &error); - bool CloseFile(lldb::user_id_t fd, Error &error); + bool CloseFile(lldb::user_id_t fd, Status &error); lldb::user_id_t GetFileSize(const FileSpec &file_spec); - Error GetFilePermissions(const FileSpec &file_spec, - uint32_t &file_permissions); + Status GetFilePermissions(const FileSpec &file_spec, + uint32_t &file_permissions); - Error SetFilePermissions(const FileSpec &file_spec, - uint32_t file_permissions); + Status SetFilePermissions(const FileSpec &file_spec, + uint32_t file_permissions); 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); 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); - Error CreateSymlink(const FileSpec &src, const FileSpec &dst); + Status CreateSymlink(const FileSpec &src, const FileSpec &dst); - Error Unlink(const FileSpec &file_spec); + Status Unlink(const FileSpec &file_spec); - Error MakeDirectory(const FileSpec &file_spec, uint32_t mode); + Status MakeDirectory(const FileSpec &file_spec, uint32_t mode); bool GetFileExists(const FileSpec &file_spec); - Error RunShellCommand( + Status RunShellCommand( const char *command, // Shouldn't be nullptr const FileSpec &working_dir, // Pass empty FileSpec to use the current // working directory @@ -448,12 +448,12 @@ public: bool ReadExtFeature(const lldb_private::ConstString object, const lldb_private::ConstString annex, std::string &out, - lldb_private::Error &err); + lldb_private::Status &err); void ServeSymbolLookups(lldb_private::Process *process); // Sends QPassSignals packet to the server with given signals to ignore. - Error SendSignalsToIgnore(llvm::ArrayRef<int32_t> signals); + Status SendSignalsToIgnore(llvm::ArrayRef<int32_t> signals); //------------------------------------------------------------------ /// Return the feature set supported by the gdb-remote server. @@ -495,7 +495,7 @@ public: /// /// @see \b Process::ConfigureStructuredData(...) for details. //------------------------------------------------------------------ - Error + Status ConfigureRemoteStructuredData(const ConstString &type_name, const StructuredData::ObjectSP &config_sp); diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp index 934824e214d..dac675ee943 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp @@ -39,7 +39,7 @@ void GDBRemoteCommunicationServer::RegisterPacketHandler( GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServer::GetPacketAndSendResponse( - Timeout<std::micro> timeout, Error &error, bool &interrupt, bool &quit) { + Timeout<std::micro> timeout, Status &error, bool &interrupt, bool &quit) { StringExtractorGDBRemote packet; PacketResult packet_result = WaitForPacketNoLock(packet, timeout, false); diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.h b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.h index 0c583e62d76..6eb25f8b9f9 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.h +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.h @@ -31,8 +31,8 @@ class GDBRemoteCommunicationServer : public GDBRemoteCommunication { public: using PortMap = std::map<uint16_t, lldb::pid_t>; using PacketHandler = - std::function<PacketResult(StringExtractorGDBRemote &packet, Error &error, - bool &interrupt, bool &quit)>; + std::function<PacketResult(StringExtractorGDBRemote &packet, + Status &error, bool &interrupt, bool &quit)>; GDBRemoteCommunicationServer(const char *comm_name, const char *listener_name); @@ -44,7 +44,7 @@ public: PacketHandler handler); PacketResult GetPacketAndSendResponse(Timeout<std::micro> timeout, - Error &error, bool &interrupt, + Status &error, bool &interrupt, bool &quit); // After connecting, do a little handshake with the client to make sure diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp index 66c1b15ff85..d0000a001ce 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp @@ -523,7 +523,7 @@ GDBRemoteCommunicationServerCommon::Handle_vFile_Open( File::ConvertOpenOptionsForPOSIXOpen(packet.GetHexMaxU32(false, 0)); if (packet.GetChar() == ',') { mode_t mode = packet.GetHexMaxU32(false, 0600); - Error error; + Status error; const FileSpec path_spec{path, true}; int fd = ::open(path_spec.GetCString(), flags, mode); const int save_errno = fd == -1 ? errno : 0; @@ -544,7 +544,7 @@ GDBRemoteCommunicationServerCommon::Handle_vFile_Close( StringExtractorGDBRemote &packet) { packet.SetFilePos(::strlen("vFile:close:")); int fd = packet.GetS32(-1); - Error error; + Status error; int err = -1; int save_errno = 0; if (fd >= 0) { @@ -663,7 +663,7 @@ GDBRemoteCommunicationServerCommon::Handle_vFile_Mode( std::string path; packet.GetHexByteString(path); if (!path.empty()) { - Error error; + Status error; const uint32_t mode = File::GetPermissions(FileSpec{path, true}, error); StreamString response; response.Printf("F%u", mode); @@ -702,7 +702,7 @@ GDBRemoteCommunicationServerCommon::Handle_vFile_symlink( packet.GetHexByteStringTerminatedBy(dst, ','); packet.GetChar(); // Skip ',' char packet.GetHexByteString(src); - Error error = FileSystem::Symlink(FileSpec{src, true}, FileSpec{dst, false}); + Status error = FileSystem::Symlink(FileSpec{src, true}, FileSpec{dst, false}); StreamString response; response.Printf("F%u,%u", error.GetError(), error.GetError()); return SendPacketNoLock(response.GetString()); @@ -714,7 +714,7 @@ GDBRemoteCommunicationServerCommon::Handle_vFile_unlink( packet.SetFilePos(::strlen("vFile:unlink:")); std::string path; packet.GetHexByteString(path); - Error error(llvm::sys::fs::remove(path)); + Status error(llvm::sys::fs::remove(path)); StreamString response; response.Printf("F%u,%u", error.GetError(), error.GetError()); return SendPacketNoLock(response.GetString()); @@ -736,7 +736,7 @@ GDBRemoteCommunicationServerCommon::Handle_qPlatform_shell( packet.GetHexByteString(working_dir); int status, signo; std::string output; - Error err = + Status err = Host::RunShellCommand(path.c_str(), FileSpec{working_dir, true}, &status, &signo, &output, timeout); StreamGDBRemote response; @@ -794,7 +794,7 @@ GDBRemoteCommunicationServerCommon::Handle_qPlatform_mkdir( if (packet.GetChar() == ',') { std::string path; packet.GetHexByteString(path); - Error error(llvm::sys::fs::create_directory(path, mode)); + Status error(llvm::sys::fs::create_directory(path, mode)); StreamGDBRemote response; response.Printf("F%u", error.GetError()); @@ -814,7 +814,7 @@ GDBRemoteCommunicationServerCommon::Handle_qPlatform_chmod( if (packet.GetChar() == ',') { std::string path; packet.GetHexByteString(path); - Error error(llvm::sys::fs::setPermissions(path, perms)); + Status error(llvm::sys::fs::setPermissions(path, perms)); StreamGDBRemote response; response.Printf("F%u", error.GetError()); diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.h b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.h index 321a92266bd..14d5612af20 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.h +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.h @@ -38,7 +38,7 @@ public: protected: ProcessLaunchInfo m_process_launch_info; - Error m_process_launch_error; + Status m_process_launch_error; ProcessInstanceInfoList m_proc_infos; uint32_t m_proc_infos_index; bool m_thread_suffix_supported; @@ -130,7 +130,7 @@ protected: PacketResult (T::*handler)(StringExtractorGDBRemote &packet)) { RegisterPacketHandler(packet_type, [this, handler](StringExtractorGDBRemote packet, - Error &error, bool &interrupt, + Status &error, bool &interrupt, bool &quit) { return (static_cast<T *>(this)->*handler)(packet); }); @@ -144,10 +144,10 @@ protected: /// with all the information for a child process to be launched. /// /// @return - /// An Error object indicating the success or failure of the + /// An Status object indicating the success or failure of the /// launch. //------------------------------------------------------------------ - virtual Error LaunchProcess() = 0; + virtual Status LaunchProcess() = 0; virtual FileSpec FindModuleFile(const std::string &module_path, const ArchSpec &arch); diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp index 290889ec662..ec7c2f5330d 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp @@ -184,35 +184,36 @@ void GDBRemoteCommunicationServerLLGS::RegisterPacketHandlers() { &GDBRemoteCommunicationServerLLGS::Handle_QPassSignals); RegisterPacketHandler(StringExtractorGDBRemote::eServerPacketType_k, - [this](StringExtractorGDBRemote packet, Error &error, + [this](StringExtractorGDBRemote packet, Status &error, bool &interrupt, bool &quit) { quit = true; return this->Handle_k(packet); }); } -Error GDBRemoteCommunicationServerLLGS::SetLaunchArguments( - const char *const args[], int argc) { +Status +GDBRemoteCommunicationServerLLGS::SetLaunchArguments(const char *const args[], + int argc) { if ((argc < 1) || !args || !args[0] || !args[0][0]) - return Error("%s: no process command line specified to launch", - __FUNCTION__); + return Status("%s: no process command line specified to launch", + __FUNCTION__); m_process_launch_info.SetArguments(const_cast<const char **>(args), true); - return Error(); + return Status(); } -Error GDBRemoteCommunicationServerLLGS::SetLaunchFlags( - unsigned int launch_flags) { +Status +GDBRemoteCommunicationServerLLGS::SetLaunchFlags(unsigned int launch_flags) { m_process_launch_info.GetFlags().Set(launch_flags); - return Error(); + return Status(); } -Error GDBRemoteCommunicationServerLLGS::LaunchProcess() { +Status GDBRemoteCommunicationServerLLGS::LaunchProcess() { Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); if (!m_process_launch_info.GetArguments().GetArgumentCount()) - return Error("%s: no process command line specified to launch", - __FUNCTION__); + return Status("%s: no process command line specified to launch", + __FUNCTION__); const bool should_forward_stdio = m_process_launch_info.GetFileActionForFD(STDIN_FILENO) == nullptr || @@ -224,7 +225,7 @@ Error GDBRemoteCommunicationServerLLGS::LaunchProcess() { const bool default_to_use_pty = true; m_process_launch_info.FinalizeFileActions(nullptr, default_to_use_pty); - Error error; + Status error; { std::lock_guard<std::recursive_mutex> guard(m_debugged_process_mutex); assert(!m_debugged_process_sp && "lldb-server creating debugged " @@ -286,8 +287,8 @@ Error GDBRemoteCommunicationServerLLGS::LaunchProcess() { return error; } -Error GDBRemoteCommunicationServerLLGS::AttachToProcess(lldb::pid_t pid) { - Error error; +Status GDBRemoteCommunicationServerLLGS::AttachToProcess(lldb::pid_t pid) { + Status error; Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); if (log) @@ -298,10 +299,10 @@ Error GDBRemoteCommunicationServerLLGS::AttachToProcess(lldb::pid_t pid) { // else. if (m_debugged_process_sp && m_debugged_process_sp->GetID() != LLDB_INVALID_PROCESS_ID) - return Error("cannot attach to a process %" PRIu64 - " when another process with pid %" PRIu64 - " is being debugged.", - pid, m_debugged_process_sp->GetID()); + return Status("cannot attach to a process %" PRIu64 + " when another process with pid %" PRIu64 + " is being debugged.", + pid, m_debugged_process_sp->GetID()); // Try to attach. error = NativeProcessProtocol::Attach(pid, *this, m_mainloop, @@ -420,7 +421,7 @@ static void WriteRegisterValueInHexFixedWidth( lldb::ByteOrder byte_order) { RegisterValue reg_value; if (!reg_value_p) { - Error error = reg_ctx_sp->ReadRegister(®_info, reg_value); + Status error = reg_ctx_sp->ReadRegister(®_info, reg_value); if (error.Success()) reg_value_p = ®_value; // else log. @@ -488,7 +489,7 @@ static JSONObject::SP GetRegistersAsJSON(NativeThreadProtocol &thread) { // registers. RegisterValue reg_value; - Error error = reg_ctx_sp->ReadRegister(reg_info_p, reg_value); + Status error = reg_ctx_sp->ReadRegister(reg_info_p, reg_value); if (error.Fail()) { if (log) log->Printf("%s failed to read register '%s' index %" PRIu32 ": %s", @@ -739,7 +740,7 @@ GDBRemoteCommunicationServerLLGS::SendStopReplyPacketForThread( reg_ctx_sp->GetRegisterInfoAtIndex(reg_to_read); RegisterValue reg_value; - Error error = reg_ctx_sp->ReadRegister(reg_info_p, reg_value); + Status error = reg_ctx_sp->ReadRegister(reg_info_p, reg_value); if (error.Fail()) { if (log) log->Printf("%s failed to read register '%s' index %" PRIu32 ": %s", @@ -793,7 +794,7 @@ GDBRemoteCommunicationServerLLGS::SendStopReplyPacketForThread( } else if (reg_info_p->value_regs == nullptr) { // Only expediate registers that are not contained in other registers. RegisterValue reg_value; - Error error = reg_ctx_sp->ReadRegister(reg_info_p, reg_value); + Status error = reg_ctx_sp->ReadRegister(reg_info_p, reg_value); if (error.Success()) { response.Printf("%.02x:", *reg_num_p); WriteRegisterValueInHexFixedWidth(response, reg_ctx_sp, *reg_info_p, @@ -960,7 +961,7 @@ void GDBRemoteCommunicationServerLLGS::DataAvailableCallback() { bool interrupt = false; bool done = false; - Error error; + Status error; while (true) { const PacketResult result = GetPacketAndSendResponse( std::chrono::microseconds(0), error, interrupt, done); @@ -978,12 +979,12 @@ void GDBRemoteCommunicationServerLLGS::DataAvailableCallback() { } } -Error GDBRemoteCommunicationServerLLGS::InitializeConnection( +Status GDBRemoteCommunicationServerLLGS::InitializeConnection( std::unique_ptr<Connection> &&connection) { IOObjectSP read_object_sp = connection->GetReadObject(); GDBRemoteCommunicationServer::SetConnection(connection.release()); - Error error; + Status error; m_network_handle_up = m_mainloop.RegisterReadObject( read_object_sp, [this](MainLoopBase &) { DataAvailableCallback(); }, error); @@ -1005,8 +1006,8 @@ GDBRemoteCommunicationServerLLGS::SendONotification(const char *buffer, return SendPacketNoLock(response.GetString()); } -Error GDBRemoteCommunicationServerLLGS::SetSTDIOFileDescriptor(int fd) { - Error error; +Status GDBRemoteCommunicationServerLLGS::SetSTDIOFileDescriptor(int fd) { + Status error; // Set up the reading/handling of process I/O std::unique_ptr<ConnectionFileDescriptor> conn_up( @@ -1024,7 +1025,7 @@ Error GDBRemoteCommunicationServerLLGS::SetSTDIOFileDescriptor(int fd) { return error; } - return Error(); + return Status(); } void GDBRemoteCommunicationServerLLGS::StartSTDIOForwarding() { @@ -1032,7 +1033,7 @@ void GDBRemoteCommunicationServerLLGS::StartSTDIOForwarding() { if (!m_stdio_communication.IsConnected()) return; - Error error; + Status error; lldbassert(!m_stdio_handle_up); m_stdio_handle_up = m_mainloop.RegisterReadObject( m_stdio_communication.GetConnection()->GetReadObject(), @@ -1055,7 +1056,7 @@ void GDBRemoteCommunicationServerLLGS::StopSTDIOForwarding() { void GDBRemoteCommunicationServerLLGS::SendProcessOutput() { char buffer[1024]; ConnectionStatus status; - Error error; + Status error; while (true) { size_t bytes_read = m_stdio_communication.Read( buffer, sizeof buffer, std::chrono::microseconds(0), status, &error); @@ -1140,7 +1141,7 @@ GDBRemoteCommunicationServerLLGS::Handle_k(StringExtractorGDBRemote &packet) { return PacketResult::Success; } - Error error = m_debugged_process_sp->Kill(); + Status error = m_debugged_process_sp->Kill(); if (error.Fail() && log) log->Printf("GDBRemoteCommunicationServerLLGS::%s Failed to kill debugged " "process %" PRIu64 ": %s", @@ -1223,7 +1224,7 @@ GDBRemoteCommunicationServerLLGS::Handle_C(StringExtractorGDBRemote &packet) { } ResumeActionList resume_actions(StateType::eStateRunning, 0); - Error error; + Status error; // We have two branches: what to do if a continue thread is specified (in // which case we target @@ -1304,7 +1305,7 @@ GDBRemoteCommunicationServerLLGS::Handle_c(StringExtractorGDBRemote &packet) { // Build the ResumeActionList ResumeActionList actions(StateType::eStateRunning, 0); - Error error = m_debugged_process_sp->Resume(actions); + Status error = m_debugged_process_sp->Resume(actions); if (error.Fail()) { if (log) { log->Printf( @@ -1428,7 +1429,7 @@ GDBRemoteCommunicationServerLLGS::Handle_vCont( thread_actions.Append(thread_action); } - Error error = m_debugged_process_sp->Resume(thread_actions); + Status error = m_debugged_process_sp->Resume(thread_actions); if (error.Fail()) { if (log) { log->Printf("GDBRemoteCommunicationServerLLGS::%s vCont failed for " @@ -1853,7 +1854,7 @@ GDBRemoteCommunicationServerLLGS::Handle_p(StringExtractorGDBRemote &packet) { // Retrieve the value RegisterValue reg_value; - Error error = reg_context_sp->ReadRegister(reg_info, reg_value); + Status error = reg_context_sp->ReadRegister(reg_info, reg_value); if (error.Fail()) { if (log) log->Printf("GDBRemoteCommunicationServerLLGS::%s failed, read of " @@ -1973,7 +1974,7 @@ GDBRemoteCommunicationServerLLGS::Handle_P(StringExtractorGDBRemote &packet) { StreamGDBRemote response; RegisterValue reg_value(reg_bytes, reg_size, process_arch.GetByteOrder()); - Error error = reg_context_sp->WriteRegister(reg_info, reg_value); + Status error = reg_context_sp->WriteRegister(reg_info, reg_value); if (error.Fail()) { if (log) log->Printf("GDBRemoteCommunicationServerLLGS::%s failed, write of " @@ -2088,7 +2089,7 @@ GDBRemoteCommunicationServerLLGS::Handle_I(StringExtractorGDBRemote &packet) { // TODO: enqueue this block in circular buffer and send window size to // remote host ConnectionStatus status; - Error error; + Status error; m_stdio_communication.Write(tmp, read, status, &error); if (error.Fail()) { return SendErrorResponse(0x15); @@ -2114,7 +2115,7 @@ GDBRemoteCommunicationServerLLGS::Handle_interrupt( } // Interrupt the process. - Error error = m_debugged_process_sp->Interrupt(); + Status error = m_debugged_process_sp->Interrupt(); if (error.Fail()) { if (log) { log->Printf( @@ -2181,7 +2182,7 @@ GDBRemoteCommunicationServerLLGS::Handle_memory_read( // Retrieve the process memory. size_t bytes_read = 0; - Error error = m_debugged_process_sp->ReadMemoryWithoutTrap( + Status error = m_debugged_process_sp->ReadMemoryWithoutTrap( read_addr, &buf[0], byte_count, bytes_read); if (error.Fail()) { if (log) @@ -2282,8 +2283,8 @@ GDBRemoteCommunicationServerLLGS::Handle_M(StringExtractorGDBRemote &packet) { // Write the process memory. size_t bytes_written = 0; - Error error = m_debugged_process_sp->WriteMemory(write_addr, &buf[0], - byte_count, bytes_written); + Status error = m_debugged_process_sp->WriteMemory(write_addr, &buf[0], + byte_count, bytes_written); if (error.Fail()) { if (log) log->Printf("GDBRemoteCommunicationServerLLGS::%s pid %" PRIu64 @@ -2329,7 +2330,7 @@ GDBRemoteCommunicationServerLLGS::Handle_qMemoryRegionInfoSupported( // Test if we can get any region back when asking for the region around NULL. MemoryRegionInfo region_info; - const Error error = + const Status error = m_debugged_process_sp->GetMemoryRegionInfo(0, region_info); if (error.Fail()) { // We don't support memory region info collection for this @@ -2367,7 +2368,7 @@ GDBRemoteCommunicationServerLLGS::Handle_qMemoryRegionInfo( // Get the memory region info for the target address. MemoryRegionInfo region_info; - const Error error = + const Status error = m_debugged_process_sp->GetMemoryRegionInfo(read_addr, region_info); if (error.Fail()) { // Return the error message. @@ -2485,7 +2486,7 @@ GDBRemoteCommunicationServerLLGS::Handle_Z(StringExtractorGDBRemote &packet) { if (want_breakpoint) { // Try to set the breakpoint. - const Error error = + const Status error = m_debugged_process_sp->SetBreakpoint(addr, size, want_hardware); if (error.Success()) return SendOKResponse(); @@ -2498,7 +2499,7 @@ GDBRemoteCommunicationServerLLGS::Handle_Z(StringExtractorGDBRemote &packet) { return SendErrorResponse(0x09); } else { // Try to set the watchpoint. - const Error error = m_debugged_process_sp->SetWatchpoint( + const Status error = m_debugged_process_sp->SetWatchpoint( addr, size, watch_flags, want_hardware); if (error.Success()) return SendOKResponse(); @@ -2582,7 +2583,7 @@ GDBRemoteCommunicationServerLLGS::Handle_z(StringExtractorGDBRemote &packet) { if (want_breakpoint) { // Try to clear the breakpoint. - const Error error = + const Status error = m_debugged_process_sp->RemoveBreakpoint(addr, want_hardware); if (error.Success()) return SendOKResponse(); @@ -2595,7 +2596,7 @@ GDBRemoteCommunicationServerLLGS::Handle_z(StringExtractorGDBRemote &packet) { return SendErrorResponse(0x09); } else { // Try to clear the watchpoint. - const Error error = m_debugged_process_sp->RemoveWatchpoint(addr); + const Status error = m_debugged_process_sp->RemoveWatchpoint(addr); if (error.Success()) return SendOKResponse(); Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_WATCHPOINTS)); @@ -2646,7 +2647,7 @@ GDBRemoteCommunicationServerLLGS::Handle_s(StringExtractorGDBRemote &packet) { // All other threads stop while we're single stepping a thread. actions.SetDefaultThreadActionIfNeeded(eStateStopped, 0); - Error error = m_debugged_process_sp->Resume(actions); + Status error = m_debugged_process_sp->Resume(actions); if (error.Fail()) { if (log) log->Printf("GDBRemoteCommunicationServerLLGS::%s pid %" PRIu64 @@ -2782,7 +2783,7 @@ GDBRemoteCommunicationServerLLGS::Handle_QSaveRegisterState( // Save registers to a buffer. DataBufferSP register_data_sp; - Error error = reg_context_sp->ReadAllRegisterValues(register_data_sp); + Status error = reg_context_sp->ReadAllRegisterValues(register_data_sp); if (error.Fail()) { if (log) log->Printf("GDBRemoteCommunicationServerLLGS::%s pid %" PRIu64 @@ -2871,7 +2872,7 @@ GDBRemoteCommunicationServerLLGS::Handle_QRestoreRegisterState( m_saved_registers_map.erase(it); } - Error error = reg_context_sp->WriteAllRegisterValues(register_data_sp); + Status error = reg_context_sp->WriteAllRegisterValues(register_data_sp); if (error.Fail()) { if (log) log->Printf("GDBRemoteCommunicationServerLLGS::%s pid %" PRIu64 @@ -2906,7 +2907,7 @@ GDBRemoteCommunicationServerLLGS::Handle_vAttach( "pid %" PRIu64, __FUNCTION__, pid); - Error error = AttachToProcess(pid); + Status error = AttachToProcess(pid); if (error.Fail()) { if (log) @@ -2954,7 +2955,7 @@ GDBRemoteCommunicationServerLLGS::Handle_D(StringExtractorGDBRemote &packet) { return SendIllFormedResponse(packet, "Invalid pid"); } - const Error error = m_debugged_process_sp->Detach(); + const Status error = m_debugged_process_sp->Detach(); if (error.Fail()) { if (log) log->Printf("GDBRemoteCommunicationServerLLGS::%s failed to detach from " @@ -3058,7 +3059,7 @@ GDBRemoteCommunicationServerLLGS::Handle_qFileLoadAddress( packet.GetHexByteString(file_name); lldb::addr_t file_load_address = LLDB_INVALID_ADDRESS; - Error error = + Status error = m_debugged_process_sp->GetFileLoadAddress(file_name, file_load_address); if (error.Fail()) return SendErrorResponse(69); @@ -3098,7 +3099,7 @@ GDBRemoteCommunicationServerLLGS::Handle_QPassSignals( if (!m_debugged_process_sp) return SendErrorResponse(68); - Error error = m_debugged_process_sp->IgnoreSignals(signals); + Status error = m_debugged_process_sp->IgnoreSignals(signals); if (error.Fail()) return SendErrorResponse(69); @@ -3112,7 +3113,7 @@ void GDBRemoteCommunicationServerLLGS::MaybeCloseInferiorTerminalConnection() { if (m_stdio_communication.IsConnected()) { auto connection = m_stdio_communication.GetConnection(); if (connection) { - Error error; + Status error; connection->Disconnect(&error); if (error.Success()) { diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h index a47927e1c64..ebda9a911d3 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h @@ -51,10 +51,10 @@ public: /// The number of elements in the args array of cstring pointers. /// /// @return - /// An Error object indicating the success or failure of making + /// An Status object indicating the success or failure of making /// the setting. //------------------------------------------------------------------ - Error SetLaunchArguments(const char *const args[], int argc); + Status SetLaunchArguments(const char *const args[], int argc); //------------------------------------------------------------------ /// Specify the launch flags for the process. @@ -63,10 +63,10 @@ public: /// The launch flags to use when launching this process. /// /// @return - /// An Error object indicating the success or failure of making + /// An Status object indicating the success or failure of making /// the setting. //------------------------------------------------------------------ - Error SetLaunchFlags(unsigned int launch_flags); + Status SetLaunchFlags(unsigned int launch_flags); //------------------------------------------------------------------ /// Launch a process with the current launch settings. @@ -76,10 +76,10 @@ public: /// with all the information for a child process to be launched. /// /// @return - /// An Error object indicating the success or failure of the + /// An Status object indicating the success or failure of the /// launch. //------------------------------------------------------------------ - Error LaunchProcess() override; + Status LaunchProcess() override; //------------------------------------------------------------------ /// Attach to a process. @@ -88,10 +88,10 @@ public: /// configured Platform. /// /// @return - /// An Error object indicating the success or failure of the + /// An Status object indicating the success or failure of the /// attach operation. //------------------------------------------------------------------ - Error AttachToProcess(lldb::pid_t pid); + Status AttachToProcess(lldb::pid_t pid); //------------------------------------------------------------------ // NativeProcessProtocol::NativeDelegate overrides @@ -103,7 +103,7 @@ public: void DidExec(NativeProcessProtocol *process) override; - Error InitializeConnection(std::unique_ptr<Connection> &&connection); + Status InitializeConnection(std::unique_ptr<Connection> &&connection); protected: MainLoop &m_mainloop; @@ -213,7 +213,7 @@ protected: lldb::tid_t GetContinueThreadID() const { return m_continue_tid; } - Error SetSTDIOFileDescriptor(int fd); + Status SetSTDIOFileDescriptor(int fd); FileSpec FindModuleFile(const std::string &module_path, const ArchSpec &arch) override; diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp index ae1c1adb5b4..73e3732df3e 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp @@ -82,7 +82,7 @@ GDBRemoteCommunicationServerPlatform::GDBRemoteCommunicationServerPlatform( &GDBRemoteCommunicationServerPlatform::Handle_jSignalsInfo); RegisterPacketHandler(StringExtractorGDBRemote::eServerPacketType_interrupt, - [](StringExtractorGDBRemote packet, Error &error, + [](StringExtractorGDBRemote packet, Status &error, bool &interrupt, bool &quit) { error.SetErrorString("interrupt received"); interrupt = true; @@ -95,7 +95,7 @@ GDBRemoteCommunicationServerPlatform::GDBRemoteCommunicationServerPlatform( //---------------------------------------------------------------------- GDBRemoteCommunicationServerPlatform::~GDBRemoteCommunicationServerPlatform() {} -Error GDBRemoteCommunicationServerPlatform::LaunchGDBServer( +Status GDBRemoteCommunicationServerPlatform::LaunchGDBServer( const lldb_private::Args &args, std::string hostname, lldb::pid_t &pid, uint16_t &port, std::string &socket_name) { if (port == UINT16_MAX) @@ -147,7 +147,7 @@ Error GDBRemoteCommunicationServerPlatform::LaunchGDBServer( port_ptr = nullptr; } - Error error = StartDebugserverProcess( + Status error = StartDebugserverProcess( url.str().c_str(), nullptr, debugserver_launch_info, port_ptr, &args, -1); pid = debugserver_launch_info.GetProcessID(); @@ -192,7 +192,7 @@ GDBRemoteCommunicationServerPlatform::Handle_qLaunchGDBServer( lldb::pid_t debugserver_pid = LLDB_INVALID_PROCESS_ID; std::string socket_name; - Error error = + Status error = LaunchGDBServer(Args(), hostname, debugserver_pid, port, socket_name); if (error.Fail()) { if (log) @@ -439,10 +439,10 @@ bool GDBRemoteCommunicationServerPlatform::DebugserverProcessReaped( return true; } -Error GDBRemoteCommunicationServerPlatform::LaunchProcess() { +Status GDBRemoteCommunicationServerPlatform::LaunchProcess() { if (!m_process_launch_info.GetArguments().GetArgumentCount()) - return Error("%s: no process command line specified to launch", - __FUNCTION__); + return Status("%s: no process command line specified to launch", + __FUNCTION__); // specify the process monitor if not already set. This should // generally be what happens since we need to reap started @@ -454,7 +454,7 @@ Error GDBRemoteCommunicationServerPlatform::LaunchProcess() { this, std::placeholders::_1), false); - Error error = Host::LaunchProcess(m_process_launch_info); + Status error = Host::LaunchProcess(m_process_launch_info); if (!error.Success()) { fprintf(stderr, "%s: failed to launch executable %s", __FUNCTION__, m_process_launch_info.GetArguments().GetArgumentAtIndex(0)); diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.h b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.h index 472d86e3a15..aed5106272d 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.h +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.h @@ -34,7 +34,7 @@ public: ~GDBRemoteCommunicationServerPlatform() override; - Error LaunchProcess() override; + Status LaunchProcess() override; // Set both ports to zero to let the platform automatically bind to // a port chosen by the OS. @@ -61,9 +61,9 @@ public: void SetInferiorArguments(const lldb_private::Args &args); - Error LaunchGDBServer(const lldb_private::Args &args, std::string hostname, - lldb::pid_t &pid, uint16_t &port, - std::string &socket_name); + Status LaunchGDBServer(const lldb_private::Args &args, std::string hostname, + lldb::pid_t &pid, uint16_t &port, + std::string &socket_name); void SetPendingGdbServer(lldb::pid_t pid, uint16_t port, const std::string &socket_name); diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp index ea4acc74893..612c7144451 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp @@ -95,8 +95,8 @@ bool GDBRemoteRegisterContext::ReadRegister(const RegisterInfo *reg_info, // Read the register if (ReadRegisterBytes(reg_info, m_reg_data)) { const bool partial_data_ok = false; - Error error(value.SetValueFromData(reg_info, m_reg_data, - reg_info->byte_offset, partial_data_ok)); + Status error(value.SetValueFromData( + reg_info, m_reg_data, reg_info->byte_offset, partial_data_ok)); return error.Success(); } return false; diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index c4ae5e36d9a..37a4153711d 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -97,8 +97,8 @@ namespace lldb { // function and get the packet history dumped to a file. void DumpProcessGDBRemotePacketHistory(void *p, const char *path) { StreamFile strm; - Error error(strm.GetFile().Open(path, File::eOpenOptionWrite | - File::eOpenOptionCanCreate)); + Status error(strm.GetFile().Open(path, File::eOpenOptionWrite | + File::eOpenOptionCanCreate)); if (error.Success()) ((ProcessGDBRemote *)p)->GetGDBRemote().DumpHistory(strm); } @@ -324,7 +324,7 @@ bool ProcessGDBRemote::ParsePythonTargetDefinition( const FileSpec &target_definition_fspec) { ScriptInterpreter *interpreter = GetTarget().GetDebugger().GetCommandInterpreter().GetScriptInterpreter(); - Error error; + Status error; StructuredData::ObjectSP module_object_sp( interpreter->LoadPluginModule(target_definition_fspec, error)); if (module_object_sp) { @@ -639,23 +639,23 @@ void ProcessGDBRemote::BuildDynamicRegisterInfo(bool force) { m_register_info.Finalize(GetTarget().GetArchitecture()); } -Error ProcessGDBRemote::WillLaunch(Module *module) { +Status ProcessGDBRemote::WillLaunch(Module *module) { return WillLaunchOrAttach(); } -Error ProcessGDBRemote::WillAttachToProcessWithID(lldb::pid_t pid) { +Status ProcessGDBRemote::WillAttachToProcessWithID(lldb::pid_t pid) { return WillLaunchOrAttach(); } -Error ProcessGDBRemote::WillAttachToProcessWithName(const char *process_name, - bool wait_for_launch) { +Status ProcessGDBRemote::WillAttachToProcessWithName(const char *process_name, + bool wait_for_launch) { return WillLaunchOrAttach(); } -Error ProcessGDBRemote::DoConnectRemote(Stream *strm, - llvm::StringRef remote_url) { +Status ProcessGDBRemote::DoConnectRemote(Stream *strm, + llvm::StringRef remote_url) { Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS)); - Error error(WillLaunchOrAttach()); + Status error(WillLaunchOrAttach()); if (error.Fail()) return error; @@ -744,8 +744,8 @@ Error ProcessGDBRemote::DoConnectRemote(Stream *strm, return error; } -Error ProcessGDBRemote::WillLaunchOrAttach() { - Error error; +Status ProcessGDBRemote::WillLaunchOrAttach() { + Status error; m_stdio_communication.Clear(); return error; } @@ -753,10 +753,10 @@ Error ProcessGDBRemote::WillLaunchOrAttach() { //---------------------------------------------------------------------- // Process Control //---------------------------------------------------------------------- -Error ProcessGDBRemote::DoLaunch(Module *exe_module, - ProcessLaunchInfo &launch_info) { +Status ProcessGDBRemote::DoLaunch(Module *exe_module, + ProcessLaunchInfo &launch_info) { Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS)); - Error error; + Status error; if (log) log->Printf("ProcessGDBRemote::%s() entered", __FUNCTION__); @@ -965,8 +965,8 @@ Error ProcessGDBRemote::DoLaunch(Module *exe_module, return error; } -Error ProcessGDBRemote::ConnectToDebugserver(llvm::StringRef connect_url) { - Error error; +Status ProcessGDBRemote::ConnectToDebugserver(llvm::StringRef connect_url) { + Status error; // Only connect if we have a valid connect URL Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS)); @@ -1169,10 +1169,10 @@ void ProcessGDBRemote::DidLaunch() { DidLaunchOrAttach(process_arch); } -Error ProcessGDBRemote::DoAttachToProcessWithID( +Status ProcessGDBRemote::DoAttachToProcessWithID( lldb::pid_t attach_pid, const ProcessAttachInfo &attach_info) { Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS)); - Error error; + Status error; if (log) log->Printf("ProcessGDBRemote::%s()", __FUNCTION__); @@ -1197,9 +1197,9 @@ Error ProcessGDBRemote::DoAttachToProcessWithID( return error; } -Error ProcessGDBRemote::DoAttachToProcessWithName( +Status ProcessGDBRemote::DoAttachToProcessWithName( const char *process_name, const ProcessAttachInfo &attach_info) { - Error error; + Status error; // Clear out and clean up from any current state Clear(); @@ -1247,18 +1247,18 @@ void ProcessGDBRemote::DidAttach(ArchSpec &process_arch) { DidLaunchOrAttach(process_arch); } -Error ProcessGDBRemote::WillResume() { +Status ProcessGDBRemote::WillResume() { m_continue_c_tids.clear(); m_continue_C_tids.clear(); m_continue_s_tids.clear(); m_continue_S_tids.clear(); m_jstopinfo_sp.reset(); m_jthreadsinfo_sp.reset(); - return Error(); + return Status(); } -Error ProcessGDBRemote::DoResume() { - Error error; +Status ProcessGDBRemote::DoResume() { + Status error; Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS)); if (log) log->Printf("ProcessGDBRemote::Resume()"); @@ -2400,8 +2400,8 @@ void ProcessGDBRemote::RefreshStateAfterStop() { m_thread_list_real.RefreshStateAfterStop(); } -Error ProcessGDBRemote::DoHalt(bool &caused_stop) { - Error error; +Status ProcessGDBRemote::DoHalt(bool &caused_stop) { + Status error; if (m_public_state.GetValue() == eStateAttaching) { // We are being asked to halt during an attach. We need to just close @@ -2412,8 +2412,8 @@ Error ProcessGDBRemote::DoHalt(bool &caused_stop) { return error; } -Error ProcessGDBRemote::DoDetach(bool keep_stopped) { - Error error; +Status ProcessGDBRemote::DoDetach(bool keep_stopped) { + Status error; Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS)); if (log) log->Printf("ProcessGDBRemote::DoDetach(keep_stopped: %i)", keep_stopped); @@ -2441,8 +2441,8 @@ Error ProcessGDBRemote::DoDetach(bool keep_stopped) { return error; } -Error ProcessGDBRemote::DoDestroy() { - Error error; +Status ProcessGDBRemote::DoDestroy() { + Status error; Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS)); if (log) log->Printf("ProcessGDBRemote::DoDestroy()"); @@ -2722,7 +2722,7 @@ void ProcessGDBRemote::WillPublicStop() { // Process Memory //------------------------------------------------------------------ size_t ProcessGDBRemote::DoReadMemory(addr_t addr, void *buf, size_t size, - Error &error) { + Status &error) { GetMaxMemorySize(); bool binary_memory_read = m_gdb_comm.GetxPacketSupported(); // M and m packets take 2 bytes for 1 byte of memory @@ -2781,7 +2781,7 @@ size_t ProcessGDBRemote::DoReadMemory(addr_t addr, void *buf, size_t size, } size_t ProcessGDBRemote::DoWriteMemory(addr_t addr, const void *buf, - size_t size, Error &error) { + size_t size, Status &error) { GetMaxMemorySize(); // M and m packets take 2 bytes for 1 byte of memory size_t max_memory_size = m_max_memory_size / 2; @@ -2822,7 +2822,7 @@ size_t ProcessGDBRemote::DoWriteMemory(addr_t addr, const void *buf, lldb::addr_t ProcessGDBRemote::DoAllocateMemory(size_t size, uint32_t permissions, - Error &error) { + Status &error) { Log *log( GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_EXPRESSIONS)); addr_t allocated_addr = LLDB_INVALID_ADDRESS; @@ -2866,27 +2866,27 @@ lldb::addr_t ProcessGDBRemote::DoAllocateMemory(size_t size, return allocated_addr; } -Error ProcessGDBRemote::GetMemoryRegionInfo(addr_t load_addr, - MemoryRegionInfo ®ion_info) { +Status ProcessGDBRemote::GetMemoryRegionInfo(addr_t load_addr, + MemoryRegionInfo ®ion_info) { - Error error(m_gdb_comm.GetMemoryRegionInfo(load_addr, region_info)); + Status error(m_gdb_comm.GetMemoryRegionInfo(load_addr, region_info)); return error; } -Error ProcessGDBRemote::GetWatchpointSupportInfo(uint32_t &num) { +Status ProcessGDBRemote::GetWatchpointSupportInfo(uint32_t &num) { - Error error(m_gdb_comm.GetWatchpointSupportInfo(num)); + Status error(m_gdb_comm.GetWatchpointSupportInfo(num)); return error; } -Error ProcessGDBRemote::GetWatchpointSupportInfo(uint32_t &num, bool &after) { - Error error(m_gdb_comm.GetWatchpointSupportInfo( +Status ProcessGDBRemote::GetWatchpointSupportInfo(uint32_t &num, bool &after) { + Status error(m_gdb_comm.GetWatchpointSupportInfo( num, after, GetTarget().GetArchitecture())); return error; } -Error ProcessGDBRemote::DoDeallocateMemory(lldb::addr_t addr) { - Error error; +Status ProcessGDBRemote::DoDeallocateMemory(lldb::addr_t addr) { + Status error; LazyBool supported = m_gdb_comm.SupportsAllocDeallocMemory(); switch (supported) { @@ -2924,7 +2924,7 @@ Error ProcessGDBRemote::DoDeallocateMemory(lldb::addr_t addr) { // Process STDIO //------------------------------------------------------------------ size_t ProcessGDBRemote::PutSTDIN(const char *src, size_t src_len, - Error &error) { + Status &error) { if (m_stdio_communication.IsConnected()) { ConnectionStatus status; m_stdio_communication.Write(src, src_len, status, NULL); @@ -2934,8 +2934,8 @@ size_t ProcessGDBRemote::PutSTDIN(const char *src, size_t src_len, return 0; } -Error ProcessGDBRemote::EnableBreakpointSite(BreakpointSite *bp_site) { - Error error; +Status ProcessGDBRemote::EnableBreakpointSite(BreakpointSite *bp_site) { + Status error; assert(bp_site != NULL); // Get logging info @@ -3072,8 +3072,8 @@ Error ProcessGDBRemote::EnableBreakpointSite(BreakpointSite *bp_site) { return EnableSoftwareBreakpoint(bp_site); } -Error ProcessGDBRemote::DisableBreakpointSite(BreakpointSite *bp_site) { - Error error; +Status ProcessGDBRemote::DisableBreakpointSite(BreakpointSite *bp_site) { + Status error; assert(bp_site != NULL); addr_t addr = bp_site->GetLoadAddress(); user_id_t site_id = bp_site->GetID(); @@ -3141,8 +3141,8 @@ static GDBStoppointType GetGDBStoppointType(Watchpoint *wp) { return eWatchpointWrite; } -Error ProcessGDBRemote::EnableWatchpoint(Watchpoint *wp, bool notify) { - Error error; +Status ProcessGDBRemote::EnableWatchpoint(Watchpoint *wp, bool notify) { + Status error; if (wp) { user_id_t watchID = wp->GetID(); addr_t addr = wp->GetLoadAddress(); @@ -3178,8 +3178,8 @@ Error ProcessGDBRemote::EnableWatchpoint(Watchpoint *wp, bool notify) { return error; } -Error ProcessGDBRemote::DisableWatchpoint(Watchpoint *wp, bool notify) { - Error error; +Status ProcessGDBRemote::DisableWatchpoint(Watchpoint *wp, bool notify) { + Status error; if (wp) { user_id_t watchID = wp->GetID(); @@ -3231,8 +3231,8 @@ void ProcessGDBRemote::Clear() { m_thread_list.Clear(); } -Error ProcessGDBRemote::DoSignal(int signo) { - Error error; +Status ProcessGDBRemote::DoSignal(int signo) { + Status error; Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS)); if (log) log->Printf("ProcessGDBRemote::DoSignal (signal = %d)", signo); @@ -3242,15 +3242,15 @@ Error ProcessGDBRemote::DoSignal(int signo) { return error; } -Error ProcessGDBRemote::EstablishConnectionIfNeeded( - const ProcessInfo &process_info) { +Status +ProcessGDBRemote::EstablishConnectionIfNeeded(const ProcessInfo &process_info) { // Make sure we aren't already connected? if (m_gdb_comm.IsConnected()) - return Error(); + return Status(); PlatformSP platform_sp(GetTarget().GetPlatform()); if (platform_sp && !platform_sp->IsHost()) - return Error("Lost debug server connection"); + return Status("Lost debug server connection"); auto error = LaunchAndConnectToDebugserver(process_info); if (error.Fail()) { @@ -3277,11 +3277,11 @@ static bool SetCloexecFlag(int fd) { } #endif -Error ProcessGDBRemote::LaunchAndConnectToDebugserver( +Status ProcessGDBRemote::LaunchAndConnectToDebugserver( const ProcessInfo &process_info) { using namespace std::placeholders; // For _1, _2, etc. - Error error; + Status error; if (m_debugserver_pid == LLDB_INVALID_PROCESS_ID) { // If we locate debugserver, keep that located version around static FileSpec g_debugserver_file_spec; @@ -3739,30 +3739,30 @@ bool ProcessGDBRemote::NewThreadNotifyBreakpointHit( return false; } -Error ProcessGDBRemote::UpdateAutomaticSignalFiltering() { +Status ProcessGDBRemote::UpdateAutomaticSignalFiltering() { Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS)); LLDB_LOG(log, "Check if need to update ignored signals"); // QPassSignals package is not supported by the server, // there is no way we can ignore any signals on server side. if (!m_gdb_comm.GetQPassSignalsSupported()) - return Error(); + return Status(); // No signals, nothing to send. if (m_unix_signals_sp == nullptr) - return Error(); + return Status(); // Signals' version hasn't changed, no need to send anything. uint64_t new_signals_version = m_unix_signals_sp->GetVersion(); if (new_signals_version == m_last_signals_version) { LLDB_LOG(log, "Signals' version hasn't changed. version={0}", m_last_signals_version); - return Error(); + return Status(); } auto signals_to_ignore = m_unix_signals_sp->GetFilteredSignals(false, false, false); - Error error = m_gdb_comm.SendSignalsToIgnore(signals_to_ignore); + Status error = m_gdb_comm.SendSignalsToIgnore(signals_to_ignore); LLDB_LOG(log, "Signals' version changed. old version={0}, new version={1}, " @@ -3820,11 +3820,11 @@ DynamicLoader *ProcessGDBRemote::GetDynamicLoader() { return m_dyld_ap.get(); } -Error ProcessGDBRemote::SendEventData(const char *data) { +Status ProcessGDBRemote::SendEventData(const char *data) { int return_value; bool was_supported; - Error error; + Status error; return_value = m_gdb_comm.SendLaunchEventDataPacket(data, &was_supported); if (return_value != 0) { @@ -3995,7 +3995,7 @@ StructuredData::ObjectSP ProcessGDBRemote::GetSharedCacheInfo() { return object_sp; } -Error ProcessGDBRemote::ConfigureStructuredData( +Status ProcessGDBRemote::ConfigureStructuredData( const ConstString &type_name, const StructuredData::ObjectSP &config_sp) { return m_gdb_comm.ConfigureRemoteStructuredData(type_name, config_sp); } @@ -4332,7 +4332,7 @@ bool ProcessGDBRemote::GetGDBServerRegisterInfo(ArchSpec &arch_to_use) { // request the target xml file std::string raw; - lldb_private::Error lldberr; + lldb_private::Status lldberr; if (!comm.ReadExtFeature(ConstString("features"), ConstString("target.xml"), raw, lldberr)) { return false; @@ -4424,10 +4424,10 @@ bool ProcessGDBRemote::GetGDBServerRegisterInfo(ArchSpec &arch_to_use) { return m_register_info.GetNumRegisters() > 0; } -Error ProcessGDBRemote::GetLoadedModuleList(LoadedModuleInfoList &list) { +Status ProcessGDBRemote::GetLoadedModuleList(LoadedModuleInfoList &list) { // Make sure LLDB has an XML parser it can use first if (!XMLDocument::XMLEnabled()) - return Error(0, ErrorType::eErrorTypeGeneric); + return Status(0, ErrorType::eErrorTypeGeneric); Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS); if (log) @@ -4441,11 +4441,11 @@ Error ProcessGDBRemote::GetLoadedModuleList(LoadedModuleInfoList &list) { // request the loaded library list std::string raw; - lldb_private::Error lldberr; + lldb_private::Status lldberr; if (!comm.ReadExtFeature(ConstString("libraries-svr4"), ConstString(""), raw, lldberr)) - return Error(0, ErrorType::eErrorTypeGeneric); + return Status(0, ErrorType::eErrorTypeGeneric); // parse the xml file in memory if (log) @@ -4453,11 +4453,11 @@ Error ProcessGDBRemote::GetLoadedModuleList(LoadedModuleInfoList &list) { XMLDocument doc; if (!doc.ParseMemory(raw.c_str(), raw.size(), "noname.xml")) - return Error(0, ErrorType::eErrorTypeGeneric); + return Status(0, ErrorType::eErrorTypeGeneric); XMLNode root_element = doc.GetRootElement("library-list-svr4"); if (!root_element) - return Error(); + return Status(); // main link map structure llvm::StringRef main_lm = root_element.GetAttributeValue("main-lm"); @@ -4528,22 +4528,22 @@ Error ProcessGDBRemote::GetLoadedModuleList(LoadedModuleInfoList &list) { // request the loaded library list std::string raw; - lldb_private::Error lldberr; + lldb_private::Status lldberr; if (!comm.ReadExtFeature(ConstString("libraries"), ConstString(""), raw, lldberr)) - return Error(0, ErrorType::eErrorTypeGeneric); + return Status(0, ErrorType::eErrorTypeGeneric); if (log) log->Printf("parsing: %s", raw.c_str()); XMLDocument doc; if (!doc.ParseMemory(raw.c_str(), raw.size(), "noname.xml")) - return Error(0, ErrorType::eErrorTypeGeneric); + return Status(0, ErrorType::eErrorTypeGeneric); XMLNode root_element = doc.GetRootElement("library-list"); if (!root_element) - return Error(); + return Status(); root_element.ForEachChildElementWithName( "library", [log, &list](const XMLNode &library) -> bool { @@ -4584,10 +4584,10 @@ Error ProcessGDBRemote::GetLoadedModuleList(LoadedModuleInfoList &list) { log->Printf("found %" PRId32 " modules in total", (int)list.m_list.size()); } else { - return Error(0, ErrorType::eErrorTypeGeneric); + return Status(0, ErrorType::eErrorTypeGeneric); } - return Error(); + return Status(); } lldb::ModuleSP ProcessGDBRemote::LoadModuleAtAddress(const FileSpec &file, @@ -4686,15 +4686,15 @@ size_t ProcessGDBRemote::LoadModules() { return LoadModules(module_list); } -Error ProcessGDBRemote::GetFileLoadAddress(const FileSpec &file, - bool &is_loaded, - lldb::addr_t &load_addr) { +Status ProcessGDBRemote::GetFileLoadAddress(const FileSpec &file, + bool &is_loaded, + lldb::addr_t &load_addr) { is_loaded = false; load_addr = LLDB_INVALID_ADDRESS; std::string file_path = file.GetPath(false); if (file_path.empty()) - return Error("Empty file name specified"); + return Status("Empty file name specified"); StreamString packet; packet.PutCString("qFileLoadAddress:"); @@ -4704,27 +4704,28 @@ Error ProcessGDBRemote::GetFileLoadAddress(const FileSpec &file, if (m_gdb_comm.SendPacketAndWaitForResponse(packet.GetString(), response, false) != GDBRemoteCommunication::PacketResult::Success) - return Error("Sending qFileLoadAddress packet failed"); + return Status("Sending qFileLoadAddress packet failed"); if (response.IsErrorResponse()) { if (response.GetError() == 1) { // The file is not loaded into the inferior is_loaded = false; load_addr = LLDB_INVALID_ADDRESS; - return Error(); + return Status(); } - return Error( + return Status( "Fetching file load address from remote server returned an error"); } if (response.IsNormalResponse()) { is_loaded = true; load_addr = response.GetHexMaxU64(false, LLDB_INVALID_ADDRESS); - return Error(); + return Status(); } - return Error("Unknown error happened during sending the load address packet"); + return Status( + "Unknown error happened during sending the load address packet"); } void ProcessGDBRemote::ModulesDidLoad(ModuleList &module_list) { diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h index a1794d0f505..60f0464f86b 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h @@ -30,7 +30,7 @@ #include "lldb/Target/Process.h" #include "lldb/Target/Thread.h" #include "lldb/Utility/ConstString.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/StreamString.h" #include "lldb/Utility/StringExtractor.h" #include "lldb/Utility/StringList.h" @@ -78,25 +78,25 @@ public: //------------------------------------------------------------------ // Creating a new process, or attaching to an existing one //------------------------------------------------------------------ - Error WillLaunch(Module *module) override; + Status WillLaunch(Module *module) override; - Error DoLaunch(Module *exe_module, ProcessLaunchInfo &launch_info) override; + Status DoLaunch(Module *exe_module, ProcessLaunchInfo &launch_info) override; void DidLaunch() override; - Error WillAttachToProcessWithID(lldb::pid_t pid) override; + Status WillAttachToProcessWithID(lldb::pid_t pid) override; - Error WillAttachToProcessWithName(const char *process_name, - bool wait_for_launch) override; + Status WillAttachToProcessWithName(const char *process_name, + bool wait_for_launch) override; - Error DoConnectRemote(Stream *strm, llvm::StringRef remote_url) override; + Status DoConnectRemote(Stream *strm, llvm::StringRef remote_url) override; - Error WillLaunchOrAttach(); + Status WillLaunchOrAttach(); - Error DoAttachToProcessWithID(lldb::pid_t pid, - const ProcessAttachInfo &attach_info) override; + Status DoAttachToProcessWithID(lldb::pid_t pid, + const ProcessAttachInfo &attach_info) override; - Error + Status DoAttachToProcessWithName(const char *process_name, const ProcessAttachInfo &attach_info) override; @@ -112,19 +112,19 @@ public: //------------------------------------------------------------------ // Process Control //------------------------------------------------------------------ - Error WillResume() override; + Status WillResume() override; - Error DoResume() override; + Status DoResume() override; - Error DoHalt(bool &caused_stop) override; + Status DoHalt(bool &caused_stop) override; - Error DoDetach(bool keep_stopped) override; + Status DoDetach(bool keep_stopped) override; bool DetachRequiresHalt() override { return true; } - Error DoSignal(int signal) override; + Status DoSignal(int signal) override; - Error DoDestroy() override; + Status DoDestroy() override; void RefreshStateAfterStop() override; @@ -143,41 +143,41 @@ public: // Process Memory //------------------------------------------------------------------ size_t DoReadMemory(lldb::addr_t addr, void *buf, size_t size, - Error &error) override; + Status &error) override; size_t DoWriteMemory(lldb::addr_t addr, const void *buf, size_t size, - Error &error) override; + Status &error) override; lldb::addr_t DoAllocateMemory(size_t size, uint32_t permissions, - Error &error) override; + Status &error) override; - Error GetMemoryRegionInfo(lldb::addr_t load_addr, - MemoryRegionInfo ®ion_info) override; + Status GetMemoryRegionInfo(lldb::addr_t load_addr, + MemoryRegionInfo ®ion_info) override; - Error DoDeallocateMemory(lldb::addr_t ptr) override; + Status DoDeallocateMemory(lldb::addr_t ptr) override; //------------------------------------------------------------------ // Process STDIO //------------------------------------------------------------------ - size_t PutSTDIN(const char *buf, size_t buf_size, Error &error) override; + size_t PutSTDIN(const char *buf, size_t buf_size, Status &error) override; //---------------------------------------------------------------------- // Process Breakpoints //---------------------------------------------------------------------- - Error EnableBreakpointSite(BreakpointSite *bp_site) override; + Status EnableBreakpointSite(BreakpointSite *bp_site) override; - Error DisableBreakpointSite(BreakpointSite *bp_site) override; + Status DisableBreakpointSite(BreakpointSite *bp_site) override; //---------------------------------------------------------------------- // Process Watchpoints //---------------------------------------------------------------------- - Error EnableWatchpoint(Watchpoint *wp, bool notify = true) override; + Status EnableWatchpoint(Watchpoint *wp, bool notify = true) override; - Error DisableWatchpoint(Watchpoint *wp, bool notify = true) override; + Status DisableWatchpoint(Watchpoint *wp, bool notify = true) override; - Error GetWatchpointSupportInfo(uint32_t &num) override; + Status GetWatchpointSupportInfo(uint32_t &num) override; - Error GetWatchpointSupportInfo(uint32_t &num, bool &after) override; + Status GetWatchpointSupportInfo(uint32_t &num, bool &after) override; bool StartNoticingNewThreads() override; @@ -185,7 +185,7 @@ public: GDBRemoteCommunicationClient &GetGDBRemote() { return m_gdb_comm; } - Error SendEventData(const char *data) override; + Status SendEventData(const char *data) override; //---------------------------------------------------------------------- // Override DidExit so we can disconnect from the remote GDB server @@ -207,8 +207,8 @@ public: size_t LoadModules() override; - Error GetFileLoadAddress(const FileSpec &file, bool &is_loaded, - lldb::addr_t &load_addr) override; + Status GetFileLoadAddress(const FileSpec &file, bool &is_loaded, + lldb::addr_t &load_addr) override; void ModulesDidLoad(ModuleList &module_list) override; @@ -216,7 +216,7 @@ public: GetLoadedDynamicLibrariesInfos(lldb::addr_t image_list_address, lldb::addr_t image_count) override; - Error + Status ConfigureStructuredData(const ConstString &type_name, const StructuredData::ObjectSP &config_sp) override; @@ -315,9 +315,9 @@ protected: bool UpdateThreadList(ThreadList &old_thread_list, ThreadList &new_thread_list) override; - Error EstablishConnectionIfNeeded(const ProcessInfo &process_info); + Status EstablishConnectionIfNeeded(const ProcessInfo &process_info); - Error LaunchAndConnectToDebugserver(const ProcessInfo &process_info); + Status LaunchAndConnectToDebugserver(const ProcessInfo &process_info); void KillDebugserverProcess(); @@ -379,7 +379,7 @@ protected: void DidLaunchOrAttach(ArchSpec &process_arch); - Error ConnectToDebugserver(llvm::StringRef host_port); + Status ConnectToDebugserver(llvm::StringRef host_port); const char *GetDispatchQueueNameForThread(lldb::addr_t thread_dispatch_qaddr, std::string &dispatch_queue_name); @@ -390,14 +390,14 @@ protected: bool GetGDBServerRegisterInfo(ArchSpec &arch); // Query remote GDBServer for a detailed loaded library list - Error GetLoadedModuleList(LoadedModuleInfoList &); + Status GetLoadedModuleList(LoadedModuleInfoList &); lldb::ModuleSP LoadModuleAtAddress(const FileSpec &file, lldb::addr_t link_map, lldb::addr_t base_addr, bool value_is_offset); - Error UpdateAutomaticSignalFiltering() override; + Status UpdateAutomaticSignalFiltering() override; private: //------------------------------------------------------------------ diff --git a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp index 3b636b9795f..a6178500dfc 100644 --- a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp +++ b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp @@ -97,8 +97,8 @@ bool ProcessMachCore::CanDebug(lldb::TargetSP target_sp, // ModuleSpecList::FindMatchingModuleSpec // enforces a strict arch mach. ModuleSpec core_module_spec(m_core_file); - Error error(ModuleList::GetSharedModule(core_module_spec, m_core_module_sp, - NULL, NULL, NULL)); + Status error(ModuleList::GetSharedModule(core_module_spec, m_core_module_sp, + NULL, NULL, NULL)); if (m_core_module_sp) { ObjectFile *core_objfile = m_core_module_sp->GetObjectFile(); @@ -143,7 +143,7 @@ bool ProcessMachCore::GetDynamicLoaderAddress(lldb::addr_t addr) { Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER | LIBLLDB_LOG_PROCESS)); llvm::MachO::mach_header header; - Error error; + Status error; if (DoReadMemory(addr, &header, sizeof(header), error) != sizeof(header)) return false; if (header.magic == llvm::MachO::MH_CIGAM || @@ -200,10 +200,10 @@ bool ProcessMachCore::GetDynamicLoaderAddress(lldb::addr_t addr) { //---------------------------------------------------------------------- // Process Control //---------------------------------------------------------------------- -Error ProcessMachCore::DoLoadCore() { +Status ProcessMachCore::DoLoadCore() { Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER | LIBLLDB_LOG_PROCESS)); - Error error; + Status error; if (!m_core_module_sp) { error.SetErrorString("invalid core module"); return error; @@ -514,7 +514,7 @@ void ProcessMachCore::RefreshStateAfterStop() { // SetThreadStopInfo (m_last_stop_packet); } -Error ProcessMachCore::DoDestroy() { return Error(); } +Status ProcessMachCore::DoDestroy() { return Status(); } //------------------------------------------------------------------ // Process Queries @@ -528,14 +528,14 @@ bool ProcessMachCore::WarnBeforeDetach() const { return false; } // Process Memory //------------------------------------------------------------------ size_t ProcessMachCore::ReadMemory(addr_t addr, void *buf, size_t size, - Error &error) { + Status &error) { // Don't allow the caching that lldb_private::Process::ReadMemory does // since in core files we have it all cached our our core file anyway. return DoReadMemory(addr, buf, size, error); } size_t ProcessMachCore::DoReadMemory(addr_t addr, void *buf, size_t size, - Error &error) { + Status &error) { ObjectFile *core_objfile = m_core_module_sp->GetObjectFile(); size_t bytes_read = 0; @@ -589,8 +589,8 @@ size_t ProcessMachCore::DoReadMemory(addr_t addr, void *buf, size_t size, return bytes_read; } -Error ProcessMachCore::GetMemoryRegionInfo(addr_t load_addr, - MemoryRegionInfo ®ion_info) { +Status ProcessMachCore::GetMemoryRegionInfo(addr_t load_addr, + MemoryRegionInfo ®ion_info) { region_info.Clear(); const VMRangeToPermissions::Entry *permission_entry = m_core_range_infos.FindEntryThatContainsOrFollows(load_addr); @@ -617,7 +617,7 @@ Error ProcessMachCore::GetMemoryRegionInfo(addr_t load_addr, region_info.SetExecutable(MemoryRegionInfo::eNo); region_info.SetMapped(MemoryRegionInfo::eNo); } - return Error(); + return Status(); } region_info.GetRange().SetRangeBase(load_addr); @@ -626,7 +626,7 @@ Error ProcessMachCore::GetMemoryRegionInfo(addr_t load_addr, region_info.SetWritable(MemoryRegionInfo::eNo); region_info.SetExecutable(MemoryRegionInfo::eNo); region_info.SetMapped(MemoryRegionInfo::eNo); - return Error(); + return Status(); } void ProcessMachCore::Clear() { m_thread_list.Clear(); } diff --git a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.h b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.h index 99bb4a60ff3..101df6b7911 100644 --- a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.h +++ b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.h @@ -19,7 +19,7 @@ // Project includes #include "lldb/Target/Process.h" #include "lldb/Utility/ConstString.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" class ThreadKDP; @@ -54,7 +54,7 @@ public: //------------------------------------------------------------------ // Creating a new process, or attaching to an existing one //------------------------------------------------------------------ - lldb_private::Error DoLoadCore() override; + lldb_private::Status DoLoadCore() override; lldb_private::DynamicLoader *GetDynamicLoader() override; @@ -68,7 +68,7 @@ public: //------------------------------------------------------------------ // Process Control //------------------------------------------------------------------ - lldb_private::Error DoDestroy() override; + lldb_private::Status DoDestroy() override; void RefreshStateAfterStop() override; @@ -83,12 +83,12 @@ public: // Process Memory //------------------------------------------------------------------ size_t ReadMemory(lldb::addr_t addr, void *buf, size_t size, - lldb_private::Error &error) override; + lldb_private::Status &error) override; size_t DoReadMemory(lldb::addr_t addr, void *buf, size_t size, - lldb_private::Error &error) override; + lldb_private::Status &error) override; - lldb_private::Error + lldb_private::Status GetMemoryRegionInfo(lldb::addr_t load_addr, lldb_private::MemoryRegionInfo ®ion_info) override; diff --git a/lldb/source/Plugins/Process/minidump/MinidumpParser.cpp b/lldb/source/Plugins/Process/minidump/MinidumpParser.cpp index 37b3709c09c..36350fdb639 100644 --- a/lldb/source/Plugins/Process/minidump/MinidumpParser.cpp +++ b/lldb/source/Plugins/Process/minidump/MinidumpParser.cpp @@ -45,7 +45,7 @@ MinidumpParser::Create(const lldb::DataBufferSP &data_buf_sp) { } const MinidumpDirectory *directory = nullptr; - Error error; + Status error; llvm::ArrayRef<uint8_t> directory_data( data_buf_sp->GetBytes() + directory_list_offset, sizeof(MinidumpDirectory) * header->streams_count); @@ -126,7 +126,7 @@ MinidumpParser::GetThreadContextWow64(const MinidumpThread &td) { return {}; const TEB64 *wow64teb; - Error error = consumeObject(teb_mem, wow64teb); + Status error = consumeObject(teb_mem, wow64teb); if (error.Fail()) return {}; diff --git a/lldb/source/Plugins/Process/minidump/MinidumpParser.h b/lldb/source/Plugins/Process/minidump/MinidumpParser.h index 189aeb3d64e..df6deb482af 100644 --- a/lldb/source/Plugins/Process/minidump/MinidumpParser.h +++ b/lldb/source/Plugins/Process/minidump/MinidumpParser.h @@ -17,7 +17,7 @@ // Other libraries and framework includes #include "lldb/Core/ArchSpec.h" #include "lldb/Utility/DataBuffer.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/DenseMap.h" diff --git a/lldb/source/Plugins/Process/minidump/MinidumpTypes.cpp b/lldb/source/Plugins/Process/minidump/MinidumpTypes.cpp index 863d124a7cc..24ce3f94c09 100644 --- a/lldb/source/Plugins/Process/minidump/MinidumpTypes.cpp +++ b/lldb/source/Plugins/Process/minidump/MinidumpTypes.cpp @@ -19,7 +19,7 @@ using namespace minidump; const MinidumpHeader *MinidumpHeader::Parse(llvm::ArrayRef<uint8_t> &data) { const MinidumpHeader *header = nullptr; - Error error = consumeObject(data, header); + Status error = consumeObject(data, header); const MinidumpHeaderConstants signature = static_cast<const MinidumpHeaderConstants>( @@ -45,7 +45,7 @@ lldb_private::minidump::parseMinidumpString(llvm::ArrayRef<uint8_t> &data) { std::string result; const uint32_t *source_length; - Error error = consumeObject(data, source_length); + Status error = consumeObject(data, source_length); if (error.Fail() || *source_length > data.size() || *source_length % 2 != 0) return llvm::None; @@ -71,7 +71,7 @@ lldb_private::minidump::parseMinidumpString(llvm::ArrayRef<uint8_t> &data) { // MinidumpThread const MinidumpThread *MinidumpThread::Parse(llvm::ArrayRef<uint8_t> &data) { const MinidumpThread *thread = nullptr; - Error error = consumeObject(data, thread); + Status error = consumeObject(data, thread); if (error.Fail()) return nullptr; @@ -81,7 +81,7 @@ const MinidumpThread *MinidumpThread::Parse(llvm::ArrayRef<uint8_t> &data) { llvm::ArrayRef<MinidumpThread> MinidumpThread::ParseThreadList(llvm::ArrayRef<uint8_t> &data) { const llvm::support::ulittle32_t *thread_count; - Error error = consumeObject(data, thread_count); + Status error = consumeObject(data, thread_count); if (error.Fail() || *thread_count * sizeof(MinidumpThread) > data.size()) return {}; @@ -93,7 +93,7 @@ MinidumpThread::ParseThreadList(llvm::ArrayRef<uint8_t> &data) { const MinidumpSystemInfo * MinidumpSystemInfo::Parse(llvm::ArrayRef<uint8_t> &data) { const MinidumpSystemInfo *system_info; - Error error = consumeObject(data, system_info); + Status error = consumeObject(data, system_info); if (error.Fail()) return nullptr; @@ -103,7 +103,7 @@ MinidumpSystemInfo::Parse(llvm::ArrayRef<uint8_t> &data) { // MinidumpMiscInfo const MinidumpMiscInfo *MinidumpMiscInfo::Parse(llvm::ArrayRef<uint8_t> &data) { const MinidumpMiscInfo *misc_info; - Error error = consumeObject(data, misc_info); + Status error = consumeObject(data, misc_info); if (error.Fail()) return nullptr; @@ -147,7 +147,7 @@ lldb::pid_t LinuxProcStatus::GetPid() const { return pid; } // Module stuff const MinidumpModule *MinidumpModule::Parse(llvm::ArrayRef<uint8_t> &data) { const MinidumpModule *module = nullptr; - Error error = consumeObject(data, module); + Status error = consumeObject(data, module); if (error.Fail()) return nullptr; @@ -158,7 +158,7 @@ llvm::ArrayRef<MinidumpModule> MinidumpModule::ParseModuleList(llvm::ArrayRef<uint8_t> &data) { const llvm::support::ulittle32_t *modules_count; - Error error = consumeObject(data, modules_count); + Status error = consumeObject(data, modules_count); if (error.Fail() || *modules_count * sizeof(MinidumpModule) > data.size()) return {}; @@ -170,7 +170,7 @@ MinidumpModule::ParseModuleList(llvm::ArrayRef<uint8_t> &data) { const MinidumpExceptionStream * MinidumpExceptionStream::Parse(llvm::ArrayRef<uint8_t> &data) { const MinidumpExceptionStream *exception_stream = nullptr; - Error error = consumeObject(data, exception_stream); + Status error = consumeObject(data, exception_stream); if (error.Fail()) return nullptr; @@ -180,7 +180,7 @@ MinidumpExceptionStream::Parse(llvm::ArrayRef<uint8_t> &data) { llvm::ArrayRef<MinidumpMemoryDescriptor> MinidumpMemoryDescriptor::ParseMemoryList(llvm::ArrayRef<uint8_t> &data) { const llvm::support::ulittle32_t *mem_ranges_count; - Error error = consumeObject(data, mem_ranges_count); + Status error = consumeObject(data, mem_ranges_count); if (error.Fail() || *mem_ranges_count * sizeof(MinidumpMemoryDescriptor) > data.size()) return {}; @@ -193,7 +193,7 @@ MinidumpMemoryDescriptor::ParseMemoryList(llvm::ArrayRef<uint8_t> &data) { std::pair<llvm::ArrayRef<MinidumpMemoryDescriptor64>, uint64_t> MinidumpMemoryDescriptor64::ParseMemory64List(llvm::ArrayRef<uint8_t> &data) { const llvm::support::ulittle64_t *mem_ranges_count; - Error error = consumeObject(data, mem_ranges_count); + Status error = consumeObject(data, mem_ranges_count); if (error.Fail() || *mem_ranges_count * sizeof(MinidumpMemoryDescriptor64) > data.size()) return {}; @@ -213,7 +213,7 @@ MinidumpMemoryDescriptor64::ParseMemory64List(llvm::ArrayRef<uint8_t> &data) { std::vector<const MinidumpMemoryInfo *> MinidumpMemoryInfo::ParseMemoryInfoList(llvm::ArrayRef<uint8_t> &data) { const MinidumpMemoryInfoListHeader *header; - Error error = consumeObject(data, header); + Status error = consumeObject(data, header); if (error.Fail() || header->size_of_header < sizeof(MinidumpMemoryInfoListHeader) || header->size_of_entry < sizeof(MinidumpMemoryInfo)) diff --git a/lldb/source/Plugins/Process/minidump/MinidumpTypes.h b/lldb/source/Plugins/Process/minidump/MinidumpTypes.h index 42de7eaaca0..6de4f55a769 100644 --- a/lldb/source/Plugins/Process/minidump/MinidumpTypes.h +++ b/lldb/source/Plugins/Process/minidump/MinidumpTypes.h @@ -13,7 +13,7 @@ // Project includes // Other libraries and framework includes -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/BitmaskEnum.h" @@ -158,8 +158,8 @@ enum class MinidumpMiscInfoFlags : uint32_t { }; template <typename T> -Error consumeObject(llvm::ArrayRef<uint8_t> &Buffer, const T *&Object) { - Error error; +Status consumeObject(llvm::ArrayRef<uint8_t> &Buffer, const T *&Object) { + Status error; if (Buffer.size() < sizeof(T)) { error.SetErrorString("Insufficient buffer!"); return error; diff --git a/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp b/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp index f3f4664ad6e..d4d65c044ea 100644 --- a/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp +++ b/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp @@ -113,8 +113,8 @@ void ProcessMinidump::Terminate() { PluginManager::UnregisterPlugin(ProcessMinidump::CreateInstance); } -Error ProcessMinidump::DoLoadCore() { - Error error; +Status ProcessMinidump::DoLoadCore() { + Status error; m_thread_list = m_minidump_parser.GetThreads(); m_active_exception = m_minidump_parser.GetExceptionStream(); @@ -141,7 +141,7 @@ ConstString ProcessMinidump::GetPluginName() { return GetPluginNameStatic(); } uint32_t ProcessMinidump::GetPluginVersion() { return 1; } -Error ProcessMinidump::DoDestroy() { return Error(); } +Status ProcessMinidump::DoDestroy() { return Status(); } void ProcessMinidump::RefreshStateAfterStop() { if (!m_active_exception) @@ -184,14 +184,14 @@ bool ProcessMinidump::IsAlive() { return true; } bool ProcessMinidump::WarnBeforeDetach() const { return false; } size_t ProcessMinidump::ReadMemory(lldb::addr_t addr, void *buf, size_t size, - Error &error) { + Status &error) { // Don't allow the caching that lldb_private::Process::ReadMemory does // since we have it all cached in our dump file anyway. return DoReadMemory(addr, buf, size, error); } size_t ProcessMinidump::DoReadMemory(lldb::addr_t addr, void *buf, size_t size, - Error &error) { + Status &error) { llvm::ArrayRef<uint8_t> mem = m_minidump_parser.GetMemory(addr, size); if (mem.empty()) { @@ -215,9 +215,9 @@ ArchSpec ProcessMinidump::GetArchitecture() { return ArchSpec(triple); } -Error ProcessMinidump::GetMemoryRegionInfo(lldb::addr_t load_addr, - MemoryRegionInfo &range_info) { - Error error; +Status ProcessMinidump::GetMemoryRegionInfo(lldb::addr_t load_addr, + MemoryRegionInfo &range_info) { + Status error; auto info = m_minidump_parser.GetMemoryRegionInfo(load_addr); if (!info) { error.SetErrorString("No valid MemoryRegionInfo found!"); @@ -278,7 +278,7 @@ void ProcessMinidump::ReadModuleList() { const auto file_spec = FileSpec(name.getValue(), true); ModuleSpec module_spec = file_spec; - Error error; + Status error; lldb::ModuleSP module_sp = GetTarget().GetSharedModule(module_spec, &error); if (!module_sp || error.Fail()) { continue; diff --git a/lldb/source/Plugins/Process/minidump/ProcessMinidump.h b/lldb/source/Plugins/Process/minidump/ProcessMinidump.h index 62407f92755..d5c46be9735 100644 --- a/lldb/source/Plugins/Process/minidump/ProcessMinidump.h +++ b/lldb/source/Plugins/Process/minidump/ProcessMinidump.h @@ -19,7 +19,7 @@ #include "lldb/Target/StopInfo.h" #include "lldb/Target/Target.h" #include "lldb/Utility/ConstString.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "llvm/Support/Format.h" #include "llvm/Support/raw_ostream.h" @@ -53,7 +53,7 @@ public: bool CanDebug(lldb::TargetSP target_sp, bool plugin_specified_by_name) override; - Error DoLoadCore() override; + Status DoLoadCore() override; DynamicLoader *GetDynamicLoader() override; @@ -61,7 +61,7 @@ public: uint32_t GetPluginVersion() override; - Error DoDestroy() override; + Status DoDestroy() override; void RefreshStateAfterStop() override; @@ -70,15 +70,15 @@ public: bool WarnBeforeDetach() const override; size_t ReadMemory(lldb::addr_t addr, void *buf, size_t size, - Error &error) override; + Status &error) override; size_t DoReadMemory(lldb::addr_t addr, void *buf, size_t size, - Error &error) override; + Status &error) override; ArchSpec GetArchitecture(); - Error GetMemoryRegionInfo(lldb::addr_t load_addr, - MemoryRegionInfo &range_info) override; + Status GetMemoryRegionInfo(lldb::addr_t load_addr, + MemoryRegionInfo &range_info) override; bool GetProcessInfo(ProcessInstanceInfo &info) override; diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp index cfab9b33e66..985a7978c6a 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp @@ -723,7 +723,7 @@ bool ScriptInterpreterPython::ExecuteOneLine( // the result object Pipe pipe; - Error pipe_result = pipe.CreateNew(false); + Status pipe_result = pipe.CreateNew(false); if (pipe_result.Success()) { #if defined(_WIN32) lldb::file_t read_file = pipe.GetReadNativeHandle(); @@ -1133,9 +1133,9 @@ bool ScriptInterpreterPython::ExecuteOneLineWithReturn( return ret_success; } -Error ScriptInterpreterPython::ExecuteMultipleLines( +Status ScriptInterpreterPython::ExecuteMultipleLines( const char *in_string, const ExecuteScriptOptions &options) { - Error error; + Status error; Locker locker(this, ScriptInterpreterPython::Locker::AcquireLock | ScriptInterpreterPython::Locker::InitSession | @@ -1220,10 +1220,10 @@ void ScriptInterpreterPython::SetBreakpointCommandCallbackFunction( bp_options, oneliner.c_str()); } -Error ScriptInterpreterPython::SetBreakpointCommandCallback( +Status ScriptInterpreterPython::SetBreakpointCommandCallback( BreakpointOptions *bp_options, std::unique_ptr<BreakpointOptions::CommandData> &cmd_data_up) { - Error error; + Status error; error = GenerateBreakpointCommandCallbackData(cmd_data_up->user_source, cmd_data_up->script_source); if (error.Fail()) { @@ -1237,7 +1237,7 @@ Error ScriptInterpreterPython::SetBreakpointCommandCallback( } // Set a Python one-liner as the callback for the breakpoint. -Error ScriptInterpreterPython::SetBreakpointCommandCallback( +Status ScriptInterpreterPython::SetBreakpointCommandCallback( BreakpointOptions *bp_options, const char *command_body_text) { auto data_ap = llvm::make_unique<CommandDataPython>(); @@ -1248,8 +1248,8 @@ Error ScriptInterpreterPython::SetBreakpointCommandCallback( // the callback will actually invoke. data_ap->user_source.SplitIntoLines(command_body_text); - Error error = GenerateBreakpointCommandCallbackData(data_ap->user_source, - data_ap->script_source); + Status error = GenerateBreakpointCommandCallbackData(data_ap->user_source, + data_ap->script_source); if (error.Success()) { auto baton_sp = std::make_shared<BreakpointOptions::CommandBaton>(std::move(data_ap)); @@ -1285,20 +1285,20 @@ void ScriptInterpreterPython::SetWatchpointCommandCallback( return; } -Error ScriptInterpreterPython::ExportFunctionDefinitionToInterpreter( +Status ScriptInterpreterPython::ExportFunctionDefinitionToInterpreter( StringList &function_def) { // Convert StringList to one long, newline delimited, const char *. std::string function_def_string(function_def.CopyList()); - Error error = ExecuteMultipleLines( + Status error = ExecuteMultipleLines( function_def_string.c_str(), ScriptInterpreter::ExecuteScriptOptions().SetEnableIO(false)); return error; } -Error ScriptInterpreterPython::GenerateFunction(const char *signature, - const StringList &input) { - Error error; +Status ScriptInterpreterPython::GenerateFunction(const char *signature, + const StringList &input) { + Status error; int num_lines = input.GetSize(); if (num_lines == 0) { error.SetErrorString("No input data."); @@ -1830,7 +1830,7 @@ lldb::StateType ScriptInterpreterPython::ScriptedThreadPlanGetRunState( StructuredData::ObjectSP ScriptInterpreterPython::LoadPluginModule(const FileSpec &file_spec, - lldb_private::Error &error) { + lldb_private::Status &error) { if (!file_spec.Exists()) { error.SetErrorString("no such file"); return StructuredData::ObjectSP(); @@ -1847,7 +1847,7 @@ ScriptInterpreterPython::LoadPluginModule(const FileSpec &file_spec, StructuredData::DictionarySP ScriptInterpreterPython::GetDynamicSettings( StructuredData::ObjectSP plugin_module_sp, Target *target, - const char *setting_name, lldb_private::Error &error) { + const char *setting_name, lldb_private::Status &error) { if (!plugin_module_sp || !target || !setting_name || !setting_name[0] || !g_swig_plugin_get) return StructuredData::DictionarySP(); @@ -1943,12 +1943,12 @@ bool ScriptInterpreterPython::GenerateTypeSynthClass(const char *oneliner, return GenerateTypeSynthClass(input, output, name_token); } -Error ScriptInterpreterPython::GenerateBreakpointCommandCallbackData( +Status ScriptInterpreterPython::GenerateBreakpointCommandCallbackData( StringList &user_input, std::string &output) { static uint32_t num_created_functions = 0; user_input.RemoveBlankLines(); StreamString sstr; - Error error; + Status error; if (user_input.GetSize() == 0) { error.SetErrorString("No input data."); return error; @@ -2395,7 +2395,7 @@ ConstString ScriptInterpreterPython::GetSyntheticTypeName( bool ScriptInterpreterPython::RunScriptFormatKeyword(const char *impl_function, Process *process, std::string &output, - Error &error) { + Status &error) { bool ret_val; if (!process) { error.SetErrorString("no process"); @@ -2424,7 +2424,7 @@ bool ScriptInterpreterPython::RunScriptFormatKeyword(const char *impl_function, bool ScriptInterpreterPython::RunScriptFormatKeyword(const char *impl_function, Thread *thread, std::string &output, - Error &error) { + Status &error) { bool ret_val; if (!thread) { error.SetErrorString("no thread"); @@ -2453,7 +2453,7 @@ bool ScriptInterpreterPython::RunScriptFormatKeyword(const char *impl_function, bool ScriptInterpreterPython::RunScriptFormatKeyword(const char *impl_function, Target *target, std::string &output, - Error &error) { + Status &error) { bool ret_val; if (!target) { error.SetErrorString("no thread"); @@ -2482,7 +2482,7 @@ bool ScriptInterpreterPython::RunScriptFormatKeyword(const char *impl_function, bool ScriptInterpreterPython::RunScriptFormatKeyword(const char *impl_function, StackFrame *frame, std::string &output, - Error &error) { + Status &error) { bool ret_val; if (!frame) { error.SetErrorString("no frame"); @@ -2511,7 +2511,7 @@ bool ScriptInterpreterPython::RunScriptFormatKeyword(const char *impl_function, bool ScriptInterpreterPython::RunScriptFormatKeyword(const char *impl_function, ValueObject *value, std::string &output, - Error &error) { + Status &error) { bool ret_val; if (!value) { error.SetErrorString("no value"); @@ -2551,7 +2551,7 @@ uint64_t replace_all(std::string &str, const std::string &oldStr, bool ScriptInterpreterPython::LoadScriptingModule( const char *pathname, bool can_reload, bool init_session, - lldb_private::Error &error, StructuredData::ObjectSP *module_sp) { + lldb_private::Status &error, StructuredData::ObjectSP *module_sp) { if (!pathname || !pathname[0]) { error.SetErrorString("invalid pathname"); return false; @@ -2742,7 +2742,7 @@ ScriptInterpreterPython::SynchronicityHandler::~SynchronicityHandler() { bool ScriptInterpreterPython::RunScriptBasedCommand( const char *impl_function, const char *args, ScriptedCommandSynchronicity synchronicity, - lldb_private::CommandReturnObject &cmd_retobj, Error &error, + lldb_private::CommandReturnObject &cmd_retobj, Status &error, const lldb_private::ExecutionContext &exe_ctx) { if (!impl_function) { error.SetErrorString("no function to execute"); @@ -2790,7 +2790,7 @@ bool ScriptInterpreterPython::RunScriptBasedCommand( bool ScriptInterpreterPython::RunScriptBasedCommand( StructuredData::GenericSP impl_obj_sp, const char *args, ScriptedCommandSynchronicity synchronicity, - lldb_private::CommandReturnObject &cmd_retobj, Error &error, + lldb_private::CommandReturnObject &cmd_retobj, Status &error, const lldb_private::ExecutionContext &exe_ctx) { if (!impl_obj_sp || !impl_obj_sp->IsValid()) { error.SetErrorString("no function to execute"); diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h index 7b0e1b000d6..a71fcea7519 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h @@ -161,11 +161,11 @@ public: void *ret_value, const ExecuteScriptOptions &options = ExecuteScriptOptions()) override; - lldb_private::Error ExecuteMultipleLines( + lldb_private::Status ExecuteMultipleLines( const char *in_string, const ExecuteScriptOptions &options = ExecuteScriptOptions()) override; - Error + Status ExportFunctionDefinitionToInterpreter(StringList &function_def) override; bool GenerateTypeScriptFunction(StringList &input, std::string &output, @@ -229,12 +229,12 @@ public: StructuredData::ObjectSP LoadPluginModule(const FileSpec &file_spec, - lldb_private::Error &error) override; + lldb_private::Status &error) override; StructuredData::DictionarySP GetDynamicSettings(StructuredData::ObjectSP plugin_module_sp, Target *target, const char *setting_name, - lldb_private::Error &error) override; + lldb_private::Status &error) override; size_t CalculateNumChildren(const StructuredData::ObjectSP &implementor, uint32_t max) override; @@ -262,21 +262,21 @@ 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) override; bool 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) override; - Error GenerateFunction(const char *signature, - const StringList &input) override; + Status GenerateFunction(const char *signature, + const StringList &input) override; - Error GenerateBreakpointCommandCallbackData(StringList &input, - std::string &output) override; + Status GenerateBreakpointCommandCallbackData(StringList &input, + std::string &output) override; bool GenerateWatchpointCommandCallbackData(StringList &input, std::string &output) override; @@ -332,23 +332,23 @@ public: } bool RunScriptFormatKeyword(const char *impl_function, Process *process, - std::string &output, Error &error) override; + std::string &output, Status &error) override; bool RunScriptFormatKeyword(const char *impl_function, Thread *thread, - std::string &output, Error &error) override; + std::string &output, Status &error) override; bool RunScriptFormatKeyword(const char *impl_function, Target *target, - std::string &output, Error &error) override; + std::string &output, Status &error) override; bool RunScriptFormatKeyword(const char *impl_function, StackFrame *frame, - std::string &output, Error &error) override; + std::string &output, Status &error) override; bool RunScriptFormatKeyword(const char *impl_function, ValueObject *value, - std::string &output, Error &error) override; + std::string &output, Status &error) override; bool LoadScriptingModule(const char *filename, bool can_reload, bool init_session, - lldb_private::Error &error, + lldb_private::Status &error, StructuredData::ObjectSP *module_sp = nullptr) override; bool IsReservedWord(const char *word) override; @@ -364,14 +364,14 @@ public: CommandReturnObject &result) override; /// Set the callback body text into the callback for the breakpoint. - Error SetBreakpointCommandCallback(BreakpointOptions *bp_options, - const char *callback_body) override; + Status SetBreakpointCommandCallback(BreakpointOptions *bp_options, + const char *callback_body) override; void SetBreakpointCommandCallbackFunction(BreakpointOptions *bp_options, const char *function_name) override; /// This one is for deserialization: - Error SetBreakpointCommandCallback( + Status SetBreakpointCommandCallback( BreakpointOptions *bp_options, std::unique_ptr<BreakpointOptions::CommandData> &data_up) override; diff --git a/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp b/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp index 041d827d526..82ecdc5a0a0 100644 --- a/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp +++ b/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp @@ -209,7 +209,7 @@ public: using OperationCreationFunc = std::function<FilterRuleSP(bool accept, size_t attribute_index, - const std::string &op_arg, Error &error)>; + const std::string &op_arg, Status &error)>; static void RegisterOperation(const ConstString &operation, const OperationCreationFunc &creation_func) { @@ -218,7 +218,7 @@ public: static FilterRuleSP CreateRule(bool match_accepts, size_t attribute, const ConstString &operation, - const std::string &op_arg, Error &error) { + const std::string &op_arg, Status &error) { // Find the creation func for this type of filter rule. auto map = GetCreationFuncMap(); auto find_it = map.find(operation); @@ -304,7 +304,8 @@ protected: private: static FilterRuleSP CreateOperation(bool accept, size_t attribute_index, - const std::string &op_arg, Error &error) { + const std::string &op_arg, + Status &error) { // We treat the op_arg as a regex. Validate it. if (op_arg.empty()) { error.SetErrorString("regex filter type requires a regex " @@ -358,7 +359,8 @@ protected: private: static FilterRuleSP CreateOperation(bool accept, size_t attribute_index, - const std::string &op_arg, Error &error) { + const std::string &op_arg, + Status &error) { if (op_arg.empty()) { error.SetErrorString("exact match filter type requires an " "argument containing the text that must " @@ -524,9 +526,9 @@ public: m_filter_rules.clear(); } - 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) { @@ -664,8 +666,8 @@ public: bool GetBroadcastEvents() const { return m_broadcast_events; } private: - Error ParseFilterRule(llvm::StringRef rule_text) { - Error error; + Status ParseFilterRule(llvm::StringRef rule_text) { + Status error; if (rule_text.empty()) { error.SetErrorString("invalid rule_text"); @@ -899,7 +901,7 @@ protected: // Send configuration to the feature by way of the process. // Construct the options we will use. auto config_sp = m_options_sp->BuildConfigurationData(m_enable); - const Error error = + const Status error = process_sp->ConfigureStructuredData(GetDarwinLogTypeName(), config_sp); // Report results. @@ -1040,7 +1042,7 @@ public: } }; -EnableOptionsSP ParseAutoEnableOptions(Error &error, Debugger &debugger) { +EnableOptionsSP ParseAutoEnableOptions(Status &error, Debugger &debugger) { // We are abusing the options data model here so that we can parse // options without requiring the Debugger instance. @@ -1212,7 +1214,7 @@ void StructuredDataDarwinLog::HandleArrivalOfStructuredData( // to inspect, including showing backtraces. } -static void SetErrorWithJSON(Error &error, const char *message, +static void SetErrorWithJSON(Status &error, const char *message, StructuredData::Object &object) { if (!message) { error.SetErrorString("Internal error: message not set."); @@ -1226,9 +1228,9 @@ static void SetErrorWithJSON(Error &error, const char *message, error.SetErrorStringWithFormat("%s: %s", message, object_stream.GetData()); } -Error StructuredDataDarwinLog::GetDescription( +Status StructuredDataDarwinLog::GetDescription( const StructuredData::ObjectSP &object_sp, lldb_private::Stream &stream) { - Error error; + Status error; if (!object_sp) { error.SetErrorString("No structured data."); @@ -1483,9 +1485,9 @@ void StructuredDataDarwinLog::DebuggerInitialize(Debugger &debugger) { } } -Error StructuredDataDarwinLog::FilterLaunchInfo(ProcessLaunchInfo &launch_info, - Target *target) { - Error error; +Status StructuredDataDarwinLog::FilterLaunchInfo(ProcessLaunchInfo &launch_info, + Target *target) { + Status error; // If we're not debugging this launched process, there's nothing for us // to do here. @@ -1991,7 +1993,7 @@ void StructuredDataDarwinLog::EnableNow() { // We can run it directly. // Send configuration to the feature by way of the process. - const Error error = + const Status error = process_sp->ConfigureStructuredData(GetDarwinLogTypeName(), config_sp); // Report results. diff --git a/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.h b/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.h index 7eaab127c3f..77b6e7be71c 100644 --- a/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.h +++ b/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.h @@ -67,8 +67,8 @@ public: Process &process, const ConstString &type_name, const StructuredData::ObjectSP &object_sp) override; - Error GetDescription(const StructuredData::ObjectSP &object_sp, - lldb_private::Stream &stream) override; + Status GetDescription(const StructuredData::ObjectSP &object_sp, + lldb_private::Stream &stream) override; bool GetEnabled(const ConstString &type_name) const override; @@ -96,7 +96,8 @@ private: lldb::user_id_t break_id, lldb::user_id_t break_loc_id); - static Error FilterLaunchInfo(ProcessLaunchInfo &launch_info, Target *target); + static Status FilterLaunchInfo(ProcessLaunchInfo &launch_info, + Target *target); // ------------------------------------------------------------------------- // Internal helper methods used by friend classes diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserOCaml.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserOCaml.cpp index 2e5be393dea..3b1466df21b 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserOCaml.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserOCaml.cpp @@ -8,8 +8,8 @@ #include "lldb/Symbol/ObjectFile.h" #include "lldb/Symbol/Type.h" #include "lldb/Symbol/TypeList.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" using namespace lldb; using namespace lldb_private; diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp index 022ce5523a0..8d87c201ece 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp @@ -202,7 +202,7 @@ bool DWARFDebugInfoEntry::Extract(SymbolFileDWARF *dwarf2Data, const uint32_t cu_end_offset = cu->GetNextCompileUnitOffset(); lldb::offset_t offset = *offset_ptr; // if (offset >= cu_end_offset) - // Log::Error("DIE at offset 0x%8.8x is beyond the end of the current + // Log::Status("DIE at offset 0x%8.8x is beyond the end of the current // compile unit (0x%8.8x)", m_offset, cu_end_offset); if ((offset < cu_end_offset) && debug_info_data.ValidOffset(offset)) { m_offset = offset; diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index ad6af8dfebd..a6cfccf8f39 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -1599,7 +1599,7 @@ void SymbolFileDWARF::UpdateExternalModuleListIfNeeded() { dwo_module_spec.GetArchitecture() = m_obj_file->GetModule()->GetArchitecture(); // printf ("Loading dwo = '%s'\n", dwo_path); - Error error = ModuleList::GetSharedModule( + Status error = ModuleList::GetSharedModule( dwo_module_spec, module_sp, NULL, NULL, NULL); if (!module_sp) { GetObjectFile()->GetModule()->ReportWarning( @@ -1637,7 +1637,7 @@ SymbolFileDWARF::GlobalVariableMap &SymbolFileDWARF::GetGlobalAranges() { if (var_sp && !var_sp->GetLocationIsConstantValueData()) { const DWARFExpression &location = var_sp->LocationExpression(); Value location_result; - Error error; + Status error; if (location.Evaluate(nullptr, nullptr, nullptr, LLDB_INVALID_ADDRESS, nullptr, nullptr, location_result, &error)) { diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp index ff96267b883..3f0c7db676f 100644 --- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp @@ -150,7 +150,7 @@ lldb::addr_t AppleGetItemInfoHandler::SetupGetItemInfoFunction( if (!m_get_item_info_impl_code.get()) { if (g_get_item_info_function_code != NULL) { - Error error; + Status error; m_get_item_info_impl_code.reset( exe_ctx.GetTargetRef().GetUtilityFunctionForLanguage( g_get_item_info_function_code, eLanguageTypeObjC, @@ -177,7 +177,7 @@ lldb::addr_t AppleGetItemInfoHandler::SetupGetItemInfoFunction( } // Next make the runner function for our implementation utility function. - Error error; + Status error; TypeSystem *type_system = thread.GetProcess()->GetTarget().GetScratchTypeSystemForLanguage( @@ -230,7 +230,8 @@ lldb::addr_t AppleGetItemInfoHandler::SetupGetItemInfoFunction( AppleGetItemInfoHandler::GetItemInfoReturnInfo AppleGetItemInfoHandler::GetItemInfo(Thread &thread, uint64_t item, addr_t page_to_free, - uint64_t page_to_free_size, Error &error) { + uint64_t page_to_free_size, + Status &error) { lldb::StackFrameSP thread_cur_frame = thread.GetStackFrameAtIndex(0); ProcessSP process_sp(thread.CalculateProcess()); TargetSP target_sp(thread.CalculateTarget()); diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.h b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.h index db05a19cf9e..373808e0f7e 100644 --- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.h +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.h @@ -20,7 +20,7 @@ // Project includes #include "lldb/Expression/UtilityFunction.h" #include "lldb/Symbol/CompilerType.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/lldb-public.h" // This class will insert a UtilityFunction into the inferior process for @@ -95,7 +95,7 @@ public: GetItemInfoReturnInfo GetItemInfo(Thread &thread, lldb::addr_t item, lldb::addr_t page_to_free, uint64_t page_to_free_size, - lldb_private::Error &error); + lldb_private::Status &error); void Detach(); diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp index 911a07f5d73..e3d03a6f948 100644 --- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp @@ -155,7 +155,7 @@ lldb::addr_t AppleGetPendingItemsHandler::SetupGetPendingItemsFunction( if (!m_get_pending_items_impl_code.get()) { if (g_get_pending_items_function_code != NULL) { - Error error; + Status error; m_get_pending_items_impl_code.reset( exe_ctx.GetTargetRef().GetUtilityFunctionForLanguage( g_get_pending_items_function_code, eLanguageTypeObjC, @@ -183,7 +183,7 @@ lldb::addr_t AppleGetPendingItemsHandler::SetupGetPendingItemsFunction( } // Next make the runner function for our implementation utility function. - Error error; + Status error; ClangASTContext *clang_ast_context = thread.GetProcess()->GetTarget().GetScratchClangASTContext(); CompilerType get_pending_items_return_type = @@ -234,7 +234,7 @@ AppleGetPendingItemsHandler::GetPendingItemsReturnInfo AppleGetPendingItemsHandler::GetPendingItems(Thread &thread, addr_t queue, addr_t page_to_free, uint64_t page_to_free_size, - Error &error) { + Status &error) { lldb::StackFrameSP thread_cur_frame = thread.GetStackFrameAtIndex(0); ProcessSP process_sp(thread.CalculateProcess()); TargetSP target_sp(thread.CalculateTarget()); diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.h b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.h index 95e19625ff8..139e05b1b6c 100644 --- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.h +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.h @@ -20,7 +20,7 @@ // Other libraries and framework includes // Project includes #include "lldb/Symbol/CompilerType.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/lldb-public.h" // This class will insert a UtilityFunction into the inferior process for @@ -99,7 +99,7 @@ public: GetPendingItemsReturnInfo GetPendingItems(Thread &thread, lldb::addr_t queue, lldb::addr_t page_to_free, uint64_t page_to_free_size, - lldb_private::Error &error); + lldb_private::Status &error); void Detach(); diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp index 3de294f6e80..c1654eb62cc 100644 --- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp @@ -167,7 +167,7 @@ AppleGetQueuesHandler::SetupGetQueuesFunction(Thread &thread, if (!m_get_queues_impl_code_up.get()) { if (g_get_current_queues_function_code != NULL) { - Error error; + Status error; m_get_queues_impl_code_up.reset( exe_ctx.GetTargetRef().GetUtilityFunctionForLanguage( g_get_current_queues_function_code, eLanguageTypeC, @@ -202,7 +202,7 @@ AppleGetQueuesHandler::SetupGetQueuesFunction(Thread &thread, thread.GetProcess()->GetTarget().GetScratchClangASTContext(); CompilerType get_queues_return_type = clang_ast_context->GetBasicType(eBasicTypeVoid).GetPointerType(); - Error error; + Status error; get_queues_caller = m_get_queues_impl_code_up->MakeFunctionCaller( get_queues_return_type, get_queues_arglist, thread_sp, error); if (error.Fail() || get_queues_caller == nullptr) { @@ -237,7 +237,7 @@ AppleGetQueuesHandler::SetupGetQueuesFunction(Thread &thread, AppleGetQueuesHandler::GetQueuesReturnInfo AppleGetQueuesHandler::GetCurrentQueues(Thread &thread, addr_t page_to_free, uint64_t page_to_free_size, - Error &error) { + Status &error) { lldb::StackFrameSP thread_cur_frame = thread.GetStackFrameAtIndex(0); ProcessSP process_sp(thread.CalculateProcess()); TargetSP target_sp(thread.CalculateTarget()); diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.h b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.h index 3e20fbe08d2..f1c79044496 100644 --- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.h +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.h @@ -19,7 +19,7 @@ // Other libraries and framework includes // Project includes #include "lldb/Symbol/CompilerType.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/lldb-public.h" // This class will insert a UtilityFunction into the inferior process for @@ -92,7 +92,7 @@ public: GetQueuesReturnInfo GetCurrentQueues(Thread &thread, lldb::addr_t page_to_free, uint64_t page_to_free_size, - lldb_private::Error &error); + lldb_private::Status &error); void Detach(); diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp index c3c0f4423c8..8d83922af1e 100644 --- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp @@ -161,7 +161,7 @@ lldb::addr_t AppleGetThreadItemInfoHandler::SetupGetThreadItemInfoFunction( // First stage is to make the ClangUtility to hold our injected function: if (!m_get_thread_item_info_impl_code.get()) { - Error error; + Status error; if (g_get_thread_item_info_function_code != NULL) { m_get_thread_item_info_impl_code.reset( exe_ctx.GetTargetRef().GetUtilityFunctionForLanguage( @@ -243,7 +243,7 @@ AppleGetThreadItemInfoHandler::GetThreadItemInfo(Thread &thread, tid_t thread_id, addr_t page_to_free, uint64_t page_to_free_size, - Error &error) { + Status &error) { lldb::StackFrameSP thread_cur_frame = thread.GetStackFrameAtIndex(0); ProcessSP process_sp(thread.CalculateProcess()); TargetSP target_sp(thread.CalculateTarget()); diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.h b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.h index 53fdda2d5ca..62730809e0d 100644 --- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.h +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.h @@ -20,7 +20,7 @@ // Other libraries and framework includes // Project includes #include "lldb/Symbol/CompilerType.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/lldb-public.h" // This class will insert a UtilityFunction into the inferior process for @@ -93,7 +93,7 @@ public: lldb::tid_t thread_id, lldb::addr_t page_to_free, uint64_t page_to_free_size, - lldb_private::Error &error); + lldb_private::Status &error); void Detach(); diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp index 394f05ca770..1a538b236c1 100644 --- a/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp @@ -129,7 +129,7 @@ SystemRuntimeMacOSX::GetQueueNameFromThreadQAddress(addr_t dispatch_qaddr) { // deref it to get the address of the dispatch_queue_t structure for this // thread's // queue. - Error error; + Status error; addr_t dispatch_queue_addr = m_process->ReadPointerFromMemory(dispatch_qaddr, error); if (error.Success()) { @@ -164,7 +164,7 @@ SystemRuntimeMacOSX::GetQueueNameFromThreadQAddress(addr_t dispatch_qaddr) { lldb::addr_t SystemRuntimeMacOSX::GetLibdispatchQueueAddressFromThreadQAddress( addr_t dispatch_qaddr) { addr_t libdispatch_queue_t_address = LLDB_INVALID_ADDRESS; - Error error; + Status error; libdispatch_queue_t_address = m_process->ReadPointerFromMemory(dispatch_qaddr, error); if (!error.Success()) { @@ -181,7 +181,7 @@ lldb::QueueKind SystemRuntimeMacOSX::GetQueueKind(addr_t dispatch_queue_addr) { ReadLibdispatchOffsets(); if (m_libdispatch_offsets.IsValid() && m_libdispatch_offsets.dqo_version >= 4) { - Error error; + Status error; uint64_t width = m_process->ReadUnsignedIntegerFromMemory( dispatch_queue_addr + m_libdispatch_offsets.dqo_width, m_libdispatch_offsets.dqo_width_size, 0, error); @@ -252,7 +252,7 @@ SystemRuntimeMacOSX::GetQueueIDFromThreadQAddress(lldb::addr_t dispatch_qaddr) { // deref it to get the address of the dispatch_queue_t structure for this // thread's // queue. - Error error; + Status error; uint64_t dispatch_queue_addr = m_process->ReadPointerFromMemory(dispatch_qaddr, error); if (error.Success()) { @@ -313,7 +313,7 @@ void SystemRuntimeMacOSX::ReadLibdispatchOffsets() { m_process->GetByteOrder(), m_process->GetAddressByteSize()); - Error error; + Status error; if (m_process->ReadMemory(m_dispatch_queue_offsets_addr, memory_buffer, sizeof(memory_buffer), error) == sizeof(memory_buffer)) { @@ -361,7 +361,7 @@ void SystemRuntimeMacOSX::ReadLibpthreadOffsets() { DataExtractor data(memory_buffer, sizeof(memory_buffer), m_process->GetByteOrder(), m_process->GetAddressByteSize()); - Error error; + Status error; if (m_process->ReadMemory(m_libpthread_layout_offsets_addr, memory_buffer, sizeof(memory_buffer), error) == sizeof(memory_buffer)) { @@ -416,7 +416,7 @@ void SystemRuntimeMacOSX::ReadLibdispatchTSDIndexes() { Address dti_struct_addr; if (m_process->GetTarget().ResolveLoadAddress (m_dispatch_tsd_indexes_addr, dti_struct_addr)) { - Error error; + Status error; uint16_t version = m_process->GetTarget().ReadUnsignedIntegerFromMemory (dti_struct_addr, false, 2, UINT16_MAX, error); if (error.Success() && dti_version != UINT16_MAX) { @@ -470,7 +470,7 @@ ThreadSP SystemRuntimeMacOSX::GetExtendedBacktraceThread(ThreadSP real_thread, ThreadSP originating_thread_sp; if (BacktraceRecordingHeadersInitialized() && type == ConstString("libdispatch")) { - Error error; + Status error; // real_thread is either an actual, live thread (in which case we need to // call into @@ -532,7 +532,7 @@ SystemRuntimeMacOSX::GetExtendedBacktraceFromItemRef(lldb::addr_t item_ref) { AppleGetItemInfoHandler::GetItemInfoReturnInfo ret; ThreadSP cur_thread_sp( m_process->GetThreadList().GetExpressionExecutionThread()); - Error error; + Status error; ret = m_get_item_info_handler.GetItemInfo(*cur_thread_sp.get(), item_ref, m_page_to_free, m_page_to_free_size, error); @@ -667,7 +667,7 @@ bool SystemRuntimeMacOSX::BacktraceRecordingHeadersInitialized() { queue_info_data_offset_address != LLDB_INVALID_ADDRESS && item_info_version_address != LLDB_INVALID_ADDRESS && item_info_data_offset_address != LLDB_INVALID_ADDRESS) { - Error error; + Status error; m_lib_backtrace_recording_info.queue_info_version = m_process->ReadUnsignedIntegerFromMemory(queue_info_version_address, 2, 0, error); @@ -715,7 +715,7 @@ void SystemRuntimeMacOSX::PopulateQueueList( ThreadSP cur_thread_sp( m_process->GetThreadList().GetExpressionExecutionThread()); if (cur_thread_sp) { - Error error; + Status error; queue_info_pointer = m_get_queues_handler.GetCurrentQueues( *cur_thread_sp.get(), m_page_to_free, m_page_to_free_size, error); m_page_to_free = LLDB_INVALID_ADDRESS; @@ -783,7 +783,7 @@ SystemRuntimeMacOSX::GetPendingItemRefsForQueue(lldb::addr_t queue) { ThreadSP cur_thread_sp( m_process->GetThreadList().GetExpressionExecutionThread()); if (cur_thread_sp) { - Error error; + Status error; pending_items_pointer = m_get_pending_items_handler.GetPendingItems( *cur_thread_sp.get(), queue, m_page_to_free, m_page_to_free_size, error); @@ -877,7 +877,7 @@ void SystemRuntimeMacOSX::CompleteQueueItem(QueueItem *queue_item, ThreadSP cur_thread_sp( m_process->GetThreadList().GetExpressionExecutionThread()); - Error error; + Status error; ret = m_get_item_info_handler.GetItemInfo(*cur_thread_sp.get(), item_ref, m_page_to_free, m_page_to_free_size, error); @@ -910,7 +910,7 @@ void SystemRuntimeMacOSX::CompleteQueueItem(QueueItem *queue_item, void SystemRuntimeMacOSX::PopulateQueuesUsingLibBTR( lldb::addr_t queues_buffer, uint64_t queues_buffer_size, uint64_t count, lldb_private::QueueList &queue_list) { - Error error; + Status error; DataBufferHeap data(queues_buffer_size, 0); Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYSTEM_RUNTIME)); if (m_process->ReadMemory(queues_buffer, data.GetBytes(), queues_buffer_size, diff --git a/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp b/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp index 84e16991cce..3976f40dd8d 100644 --- a/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp +++ b/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp @@ -21,8 +21,8 @@ #include "lldb/Target/Thread.h" #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/DataExtractor.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/StreamString.h" using namespace lldb; @@ -37,7 +37,7 @@ bool UnwindAssemblyInstEmulation::GetNonCallSiteUnwindPlanFromAssembly( std::vector<uint8_t> function_text(range.GetByteSize()); ProcessSP process_sp(thread.GetProcess()); if (process_sp) { - Error error; + Status error; const bool prefer_file_cache = true; if (process_sp->GetTarget().ReadMemory( range.GetBaseAddress(), prefer_file_cache, function_text.data(), diff --git a/lldb/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp b/lldb/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp index e7209747409..c171f0f4d2a 100644 --- a/lldb/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp +++ b/lldb/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp @@ -26,7 +26,7 @@ #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" #include "lldb/Target/UnwindAssembly.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" using namespace lldb; using namespace lldb_private; @@ -54,7 +54,7 @@ bool UnwindAssembly_x86::GetNonCallSiteUnwindPlanFromAssembly( return false; const bool prefer_file_cache = true; std::vector<uint8_t> function_text(func.GetByteSize()); - Error error; + Status error; if (process_sp->GetTarget().ReadMemory( func.GetBaseAddress(), prefer_file_cache, function_text.data(), func.GetByteSize(), error) == func.GetByteSize()) { @@ -161,7 +161,7 @@ bool UnwindAssembly_x86::AugmentUnwindPlanFromCallSite( return false; const bool prefer_file_cache = true; std::vector<uint8_t> function_text(func.GetByteSize()); - Error error; + Status error; if (process_sp->GetTarget().ReadMemory( func.GetBaseAddress(), prefer_file_cache, function_text.data(), func.GetByteSize(), error) == func.GetByteSize()) { @@ -192,7 +192,7 @@ bool UnwindAssembly_x86::GetFastUnwindPlan(AddressRange &func, Thread &thread, if (process_sp) { Target &target(process_sp->GetTarget()); const bool prefer_file_cache = true; - Error error; + Status error; if (target.ReadMemory(func.GetBaseAddress(), prefer_file_cache, opcode_data.data(), 4, error) == 4) { uint8_t i386_push_mov[] = {0x55, 0x89, 0xe5}; @@ -228,7 +228,7 @@ bool UnwindAssembly_x86::FirstNonPrologueInsn( const bool prefer_file_cache = true; std::vector<uint8_t> function_text(func.GetByteSize()); - Error error; + Status error; if (target->ReadMemory(func.GetBaseAddress(), prefer_file_cache, function_text.data(), func.GetByteSize(), error) == func.GetByteSize()) { diff --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/ClangASTContext.cpp index d03c5a684a1..688aa45d2d1 100644 --- a/lldb/source/Symbol/ClangASTContext.cpp +++ b/lldb/source/Symbol/ClangASTContext.cpp @@ -6433,7 +6433,7 @@ CompilerType ClangASTContext::GetChildCompilerTypeAtIndex( if (base_class->isVirtual()) { bool handled = false; if (valobj) { - Error err; + Status err; AddressType addr_type = eAddressTypeInvalid; lldb::addr_t vtable_ptr_addr = valobj->GetCPPVTableAddress(addr_type); @@ -8827,7 +8827,7 @@ ClangASTContext::ConvertStringToFloatValue(lldb::opaque_compiler_type_t type, if (dst_size >= byte_size) { Scalar scalar = ap_float.bitcastToAPInt().zextOrTrunc( llvm::NextPowerOf2(byte_size) * 8); - lldb_private::Error get_data_error; + lldb_private::Status get_data_error; if (scalar.GetAsMemoryData(dst, byte_size, lldb_private::endian::InlHostByteOrder(), get_data_error)) @@ -9396,7 +9396,7 @@ void ClangASTContext::DumpSummary(lldb::opaque_compiler_type_t type, buf.back() = '\0'; size_t bytes_read; size_t total_cstr_len = 0; - Error error; + Status error; while ((bytes_read = process->ReadMemory(pointer_address, &buf.front(), buf.size(), error)) > 0) { const size_t len = strlen((const char *)&buf.front()); diff --git a/lldb/source/Symbol/CompactUnwindInfo.cpp b/lldb/source/Symbol/CompactUnwindInfo.cpp index 77fcd33bbb3..bc367496003 100644 --- a/lldb/source/Symbol/CompactUnwindInfo.cpp +++ b/lldb/source/Symbol/CompactUnwindInfo.cpp @@ -272,7 +272,7 @@ void CompactUnwindInfo::ScanIndex(const ProcessSP &process_sp) { return; m_section_contents_if_encrypted.reset( new DataBufferHeap(m_section_sp->GetByteSize(), 0)); - Error error; + Status error; if (process_sp->ReadMemory( m_section_sp->GetLoadBaseAddress(&process_sp->GetTarget()), m_section_contents_if_encrypted->GetBytes(), @@ -836,7 +836,7 @@ bool CompactUnwindInfo::CreateUnwindPlan_x86_64(Target &target, if (process_sp) { Address subl_payload_addr(function_info.valid_range_offset_start, sl); subl_payload_addr.Slide(offset_to_subl_insn); - Error error; + Status error; uint64_t large_stack_size = process_sp->ReadUnsignedIntegerFromMemory( subl_payload_addr.GetLoadAddress(&target), 4, 0, error); if (large_stack_size != 0 && error.Success()) { @@ -1100,7 +1100,7 @@ bool CompactUnwindInfo::CreateUnwindPlan_i386(Target &target, if (process_sp) { Address subl_payload_addr(function_info.valid_range_offset_start, sl); subl_payload_addr.Slide(offset_to_subl_insn); - Error error; + Status error; uint64_t large_stack_size = process_sp->ReadUnsignedIntegerFromMemory( subl_payload_addr.GetLoadAddress(&target), 4, 0, error); if (large_stack_size != 0 && error.Success()) { diff --git a/lldb/source/Symbol/CompilerType.cpp b/lldb/source/Symbol/CompilerType.cpp index cc33dc19622..e3880af27f2 100644 --- a/lldb/source/Symbol/CompilerType.cpp +++ b/lldb/source/Symbol/CompilerType.cpp @@ -1004,7 +1004,7 @@ bool CompilerType::ReadFromMemory(lldb_private::ExecutionContext *exe_ctx, if (exe_ctx) process = exe_ctx->GetProcessPtr(); if (process) { - Error error; + Status error; return process->ReadMemory(addr, dst, byte_size, error) == byte_size; } } @@ -1039,7 +1039,7 @@ bool CompilerType::WriteToMemory(lldb_private::ExecutionContext *exe_ctx, if (exe_ctx) process = exe_ctx->GetProcessPtr(); if (process) { - Error error; + Status error; return process->WriteMemory(addr, new_value.GetData(), byte_size, error) == byte_size; } diff --git a/lldb/source/Symbol/JavaASTContext.cpp b/lldb/source/Symbol/JavaASTContext.cpp index ac029dfe5dc..ae4e9d5134b 100644 --- a/lldb/source/Symbol/JavaASTContext.cpp +++ b/lldb/source/Symbol/JavaASTContext.cpp @@ -137,7 +137,7 @@ public: if (m_dynamic_type_id.Evaluate(exe_ctx->GetBestExecutionContextScope(), nullptr, nullptr, 0, &obj_load_address, nullptr, result, nullptr)) { - Error error; + Status error; lldb::addr_t type_id_addr = result.GetScalar().UInt(); lldb::ProcessSP process_sp = exe_ctx->GetProcessSP(); @@ -303,7 +303,7 @@ public: if (!m_length_expression.IsValid()) return UINT32_MAX; - Error error; + Status error; ValueObjectSP address_obj = value_obj->AddressOf(error); if (error.Fail()) return UINT32_MAX; diff --git a/lldb/source/Symbol/ObjectFile.cpp b/lldb/source/Symbol/ObjectFile.cpp index 483a315defb..9b2318e885d 100644 --- a/lldb/source/Symbol/ObjectFile.cpp +++ b/lldb/source/Symbol/ObjectFile.cpp @@ -454,7 +454,7 @@ DataBufferSP ObjectFile::ReadMemory(const ProcessSP &process_sp, DataBufferSP data_sp; if (process_sp) { std::unique_ptr<DataBufferHeap> data_ap(new DataBufferHeap(byte_size, 0)); - Error error; + Status error; const size_t bytes_read = process_sp->ReadMemory( addr, data_ap->GetBytes(), data_ap->GetByteSize(), error); if (bytes_read == byte_size) @@ -493,7 +493,7 @@ size_t ObjectFile::ReadSectionData(const Section *section, if (IsInMemory()) { ProcessSP process_sp(m_process_wp.lock()); if (process_sp) { - Error error; + Status error; const addr_t base_load_addr = section->GetLoadBaseAddress(&process_sp->GetTarget()); if (base_load_addr != LLDB_INVALID_ADDRESS) @@ -654,17 +654,17 @@ ConstString ObjectFile::GetNextSyntheticSymbolName() { return ConstString(ss.GetString()); } -Error ObjectFile::LoadInMemory(Target &target, bool set_pc) { - Error error; +Status ObjectFile::LoadInMemory(Target &target, bool set_pc) { + Status error; ProcessSP process = target.CalculateProcess(); if (!process) - return Error("No Process"); + return Status("No Process"); if (set_pc && !GetEntryPointAddress().IsValid()) - return Error("No entry address in object file"); + return Status("No entry address in object file"); SectionList *section_list = GetSectionList(); if (!section_list) - return Error("No section in object file"); + return Status("No section in object file"); size_t section_count = section_list->GetNumSections(0); for (size_t i = 0; i < section_count; ++i) { SectionSP section_sp = section_list->GetSectionAtIndex(i); diff --git a/lldb/source/Symbol/SymbolContext.cpp b/lldb/source/Symbol/SymbolContext.cpp index d99bfc60926..5ea6f91200c 100644 --- a/lldb/source/Symbol/SymbolContext.cpp +++ b/lldb/source/Symbol/SymbolContext.cpp @@ -735,7 +735,7 @@ LineEntry SymbolContext::GetFunctionStartLineEntry() const { bool SymbolContext::GetAddressRangeFromHereToEndLine(uint32_t end_line, AddressRange &range, - Error &error) { + Status &error) { if (!line_entry.IsValid()) { error.SetErrorString("Symbol context has no line table."); return false; diff --git a/lldb/source/Symbol/Type.cpp b/lldb/source/Symbol/Type.cpp index 89fc9f974c6..53d9c5cc96a 100644 --- a/lldb/source/Symbol/Type.cpp +++ b/lldb/source/Symbol/Type.cpp @@ -410,7 +410,7 @@ bool Type::ReadFromMemory(ExecutionContext *exe_ctx, lldb::addr_t addr, if (exe_ctx) { Process *process = exe_ctx->GetProcessPtr(); if (process) { - Error error; + Status error; return exe_ctx->GetProcessPtr()->ReadMemory(addr, dst, byte_size, error) == byte_size; } diff --git a/lldb/source/Symbol/Variable.cpp b/lldb/source/Symbol/Variable.cpp index 0d1db1cdeac..fd19a099496 100644 --- a/lldb/source/Symbol/Variable.cpp +++ b/lldb/source/Symbol/Variable.cpp @@ -330,11 +330,11 @@ bool Variable::IsInScope(StackFrame *frame) { return false; } -Error Variable::GetValuesForVariableExpressionPath( +Status Variable::GetValuesForVariableExpressionPath( llvm::StringRef variable_expr_path, ExecutionContextScope *scope, GetVariableCallback callback, void *baton, VariableList &variable_list, ValueObjectList &valobj_list) { - Error error; + Status error; if (!callback || variable_expr_path.empty()) { error.SetErrorString("unknown error"); return error; @@ -350,7 +350,7 @@ Error Variable::GetValuesForVariableExpressionPath( return error; } for (uint32_t i = 0; i < valobj_list.GetSize();) { - Error tmp_error; + Status tmp_error; ValueObjectSP valobj_sp( valobj_list.GetValueObjectAtIndex(i)->Dereference(tmp_error)); if (tmp_error.Fail()) { @@ -368,7 +368,7 @@ Error Variable::GetValuesForVariableExpressionPath( valobj_list); if (error.Success()) { for (uint32_t i = 0; i < valobj_list.GetSize();) { - Error tmp_error; + Status tmp_error; ValueObjectSP valobj_sp( valobj_list.GetValueObjectAtIndex(i)->AddressOf(tmp_error)); if (tmp_error.Fail()) { diff --git a/lldb/source/Target/Language.cpp b/lldb/source/Target/Language.cpp index 8fef32a3b18..cde6f8654ae 100644 --- a/lldb/source/Target/Language.cpp +++ b/lldb/source/Target/Language.cpp @@ -387,7 +387,7 @@ DumpValueObjectOptions::DeclPrintingHelper Language::GetDeclPrintingHelper() { return nullptr; } -LazyBool Language::IsLogicalTrue(ValueObject &valobj, Error &error) { +LazyBool Language::IsLogicalTrue(ValueObject &valobj, Status &error) { return eLazyBoolCalculate; } diff --git a/lldb/source/Target/LanguageRuntime.cpp b/lldb/source/Target/LanguageRuntime.cpp index d0018b6df11..bd02121f6a4 100644 --- a/lldb/source/Target/LanguageRuntime.cpp +++ b/lldb/source/Target/LanguageRuntime.cpp @@ -89,7 +89,8 @@ ExceptionSearchFilter::DoCopyForBreakpoint(Breakpoint &breakpoint) { } SearchFilter *ExceptionSearchFilter::CreateFromStructuredData( - Target &target, const StructuredData::Dictionary &data_dict, Error &error) { + Target &target, const StructuredData::Dictionary &data_dict, + Status &error) { SearchFilter *result = nullptr; return result; } diff --git a/lldb/source/Target/Memory.cpp b/lldb/source/Target/Memory.cpp index c78bd7ad7b3..ced35941868 100644 --- a/lldb/source/Target/Memory.cpp +++ b/lldb/source/Target/Memory.cpp @@ -129,7 +129,8 @@ bool MemoryCache::RemoveInvalidRange(lldb::addr_t base_addr, return false; } -size_t MemoryCache::Read(addr_t addr, void *dst, size_t dst_len, Error &error) { +size_t MemoryCache::Read(addr_t addr, void *dst, size_t dst_len, + Status &error) { size_t bytes_left = dst_len; // Check the L1 cache for a range that contain the entire memory read. @@ -344,7 +345,7 @@ void AllocatedMemoryCache::Clear() { AllocatedMemoryCache::AllocatedBlockSP AllocatedMemoryCache::AllocatePage(uint32_t byte_size, uint32_t permissions, - uint32_t chunk_size, Error &error) { + uint32_t chunk_size, Status &error) { AllocatedBlockSP block_sp; const size_t page_size = 4096; const size_t num_pages = (byte_size + page_size - 1) / page_size; @@ -370,7 +371,7 @@ AllocatedMemoryCache::AllocatePage(uint32_t byte_size, uint32_t permissions, lldb::addr_t AllocatedMemoryCache::AllocateMemory(size_t byte_size, uint32_t permissions, - Error &error) { + Status &error) { std::lock_guard<std::recursive_mutex> guard(m_mutex); addr_t addr = LLDB_INVALID_ADDRESS; diff --git a/lldb/source/Target/ModuleCache.cpp b/lldb/source/Target/ModuleCache.cpp index a4aa26a0e48..2b654772639 100644 --- a/lldb/source/Target/ModuleCache.cpp +++ b/lldb/source/Target/ModuleCache.cpp @@ -54,7 +54,7 @@ private: FileSpec m_file_spec; public: - ModuleLock(const FileSpec &root_dir_spec, const UUID &uuid, Error &error); + ModuleLock(const FileSpec &root_dir_spec, const UUID &uuid, Status &error); void Delete(); }; @@ -64,7 +64,7 @@ static FileSpec JoinPath(const FileSpec &path1, const char *path2) { return result_spec; } -static Error MakeDirectory(const FileSpec &dir_path) { +static Status MakeDirectory(const FileSpec &dir_path) { namespace fs = llvm::sys::fs; return fs::create_directories(dir_path.GetPath(), true, fs::perms::owner_all); @@ -92,7 +92,7 @@ void DeleteExistingModule(const FileSpec &root_dir_spec, if (!module_uuid.IsValid()) return; - Error error; + Status error; ModuleLock lock(root_dir_spec, module_uuid, error); if (error.Fail()) { if (log) @@ -125,17 +125,17 @@ void DecrementRefExistingModule(const FileSpec &root_dir_spec, llvm::sys::fs::remove(symfile_spec.GetPath()); } -Error CreateHostSysRootModuleLink(const FileSpec &root_dir_spec, - const char *hostname, - const FileSpec &platform_module_spec, - const FileSpec &local_module_spec, - bool delete_existing) { +Status CreateHostSysRootModuleLink(const FileSpec &root_dir_spec, + const char *hostname, + const FileSpec &platform_module_spec, + const FileSpec &local_module_spec, + bool delete_existing) { const auto sysroot_module_path_spec = JoinPath(JoinPath(root_dir_spec, hostname), platform_module_spec.GetPath().c_str()); if (sysroot_module_path_spec.Exists()) { if (!delete_existing) - return Error(); + return Status(); DecrementRefExistingModule(root_dir_spec, sysroot_module_path_spec); } @@ -152,7 +152,7 @@ Error CreateHostSysRootModuleLink(const FileSpec &root_dir_spec, } // namespace ModuleLock::ModuleLock(const FileSpec &root_dir_spec, const UUID &uuid, - Error &error) { + Status &error) { const auto lock_dir_spec = JoinPath(root_dir_spec, kLockDirName); error = MakeDirectory(lock_dir_spec); if (error.Fail()) @@ -184,9 +184,9 @@ void ModuleLock::Delete() { ///////////////////////////////////////////////////////////////////////// -Error ModuleCache::Put(const FileSpec &root_dir_spec, const char *hostname, - const ModuleSpec &module_spec, const FileSpec &tmp_file, - const FileSpec &target_file) { +Status ModuleCache::Put(const FileSpec &root_dir_spec, const char *hostname, + const ModuleSpec &module_spec, const FileSpec &tmp_file, + const FileSpec &target_file) { const auto module_spec_dir = GetModuleDirectory(root_dir_spec, module_spec.GetUUID()); const auto module_file_path = @@ -196,27 +196,27 @@ Error ModuleCache::Put(const FileSpec &root_dir_spec, const char *hostname, const auto err_code = llvm::sys::fs::rename(tmp_file_path, module_file_path.GetPath()); if (err_code) - return Error("Failed to rename file %s to %s: %s", tmp_file_path.c_str(), - module_file_path.GetPath().c_str(), - err_code.message().c_str()); + return Status("Failed to rename file %s to %s: %s", tmp_file_path.c_str(), + module_file_path.GetPath().c_str(), + err_code.message().c_str()); const auto error = CreateHostSysRootModuleLink( root_dir_spec, hostname, target_file, module_file_path, true); if (error.Fail()) - return Error("Failed to create link to %s: %s", - module_file_path.GetPath().c_str(), error.AsCString()); - return Error(); + return Status("Failed to create link to %s: %s", + module_file_path.GetPath().c_str(), error.AsCString()); + return Status(); } -Error ModuleCache::Get(const FileSpec &root_dir_spec, const char *hostname, - const ModuleSpec &module_spec, - ModuleSP &cached_module_sp, bool *did_create_ptr) { +Status ModuleCache::Get(const FileSpec &root_dir_spec, const char *hostname, + const ModuleSpec &module_spec, + ModuleSP &cached_module_sp, bool *did_create_ptr) { const auto find_it = m_loaded_modules.find(module_spec.GetUUID().GetAsString()); if (find_it != m_loaded_modules.end()) { cached_module_sp = (*find_it).second.lock(); if (cached_module_sp) - return Error(); + return Status(); m_loaded_modules.erase(find_it); } @@ -226,10 +226,10 @@ Error ModuleCache::Get(const FileSpec &root_dir_spec, const char *hostname, module_spec_dir, module_spec.GetFileSpec().GetFilename().AsCString()); if (!module_file_path.Exists()) - return Error("Module %s not found", module_file_path.GetPath().c_str()); + return Status("Module %s not found", module_file_path.GetPath().c_str()); if (module_file_path.GetByteSize() != module_spec.GetObjectSize()) - return Error("Module %s has invalid file size", - module_file_path.GetPath().c_str()); + return Status("Module %s has invalid file size", + module_file_path.GetPath().c_str()); // We may have already cached module but downloaded from an another host - in // this case let's create a link to it. @@ -237,8 +237,8 @@ Error ModuleCache::Get(const FileSpec &root_dir_spec, const char *hostname, module_spec.GetFileSpec(), module_file_path, false); if (error.Fail()) - return Error("Failed to create link to %s: %s", - module_file_path.GetPath().c_str(), error.AsCString()); + return Status("Failed to create link to %s: %s", + module_file_path.GetPath().c_str(), error.AsCString()); auto cached_module_spec(module_spec); cached_module_spec.GetUUID().Clear(); // Clear UUID since it may contain md5 @@ -258,16 +258,16 @@ Error ModuleCache::Get(const FileSpec &root_dir_spec, const char *hostname, m_loaded_modules.insert( std::make_pair(module_spec.GetUUID().GetAsString(), cached_module_sp)); - return Error(); + return Status(); } -Error ModuleCache::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 ModuleCache::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) { const auto module_spec_dir = GetModuleDirectory(root_dir_spec, module_spec.GetUUID()); auto error = MakeDirectory(module_spec_dir); @@ -276,9 +276,9 @@ Error ModuleCache::GetAndPut(const FileSpec &root_dir_spec, ModuleLock lock(root_dir_spec, module_spec.GetUUID(), error); if (error.Fail()) - return Error("Failed to lock module %s: %s", - module_spec.GetUUID().GetAsString().c_str(), - error.AsCString()); + return Status("Failed to lock module %s: %s", + module_spec.GetUUID().GetAsString().c_str(), + error.AsCString()); const auto escaped_hostname(GetEscapedHostname(hostname)); // Check local cache for a module. @@ -291,13 +291,13 @@ Error ModuleCache::GetAndPut(const FileSpec &root_dir_spec, error = module_downloader(module_spec, tmp_download_file_spec); llvm::FileRemover tmp_file_remover(tmp_download_file_spec.GetPath()); if (error.Fail()) - return Error("Failed to download module: %s", error.AsCString()); + return Status("Failed to download module: %s", error.AsCString()); // Put downloaded file into local module cache. error = Put(root_dir_spec, escaped_hostname.c_str(), module_spec, tmp_download_file_spec, module_spec.GetFileSpec()); if (error.Fail()) - return Error("Failed to put module into cache: %s", error.AsCString()); + return Status("Failed to put module into cache: %s", error.AsCString()); tmp_file_remover.releaseFile(); error = Get(root_dir_spec, escaped_hostname.c_str(), module_spec, @@ -315,17 +315,18 @@ Error ModuleCache::GetAndPut(const FileSpec &root_dir_spec, // module might // contain the necessary symbols and the debugging is also possible without // a symfile. - return Error(); + return Status(); error = Put(root_dir_spec, escaped_hostname.c_str(), module_spec, tmp_download_sym_file_spec, GetSymbolFileSpec(module_spec.GetFileSpec())); if (error.Fail()) - return Error("Failed to put symbol file into cache: %s", error.AsCString()); + return Status("Failed to put symbol file into cache: %s", + error.AsCString()); tmp_symfile_remover.releaseFile(); FileSpec symfile_spec = GetSymbolFileSpec(cached_module_sp->GetFileSpec()); cached_module_sp->SetSymbolFileFileSpec(symfile_spec); - return Error(); + return Status(); } diff --git a/lldb/source/Target/ObjCLanguageRuntime.cpp b/lldb/source/Target/ObjCLanguageRuntime.cpp index 6aeb4c46df4..165c75a0952 100644 --- a/lldb/source/Target/ObjCLanguageRuntime.cpp +++ b/lldb/source/Target/ObjCLanguageRuntime.cpp @@ -250,7 +250,7 @@ ObjCLanguageRuntime::GetClassDescriptor(ValueObject &valobj) { Process *process = exe_ctx.GetProcessPtr(); if (process) { - Error error; + Status error; ObjCISA isa = process->ReadPointerFromMemory(isa_pointer, error); if (isa != LLDB_INVALID_ADDRESS) objc_class_sp = GetClassDescriptorFromISA(isa); @@ -377,9 +377,9 @@ bool ObjCLanguageRuntime::ObjCExceptionPrecondition::EvaluatePrecondition( void ObjCLanguageRuntime::ObjCExceptionPrecondition::GetDescription( Stream &stream, lldb::DescriptionLevel level) {} -Error ObjCLanguageRuntime::ObjCExceptionPrecondition::ConfigurePrecondition( +Status ObjCLanguageRuntime::ObjCExceptionPrecondition::ConfigurePrecondition( Args &args) { - Error error; + Status error; if (args.GetArgumentCount() > 0) error.SetErrorString( "The ObjC Exception breakpoint doesn't support extra options."); diff --git a/lldb/source/Target/PathMappingList.cpp b/lldb/source/Target/PathMappingList.cpp index 4fbaee98da6..b834a3600d0 100644 --- a/lldb/source/Target/PathMappingList.cpp +++ b/lldb/source/Target/PathMappingList.cpp @@ -16,8 +16,8 @@ // Project includes #include "lldb/Host/PosixApi.h" #include "lldb/Target/PathMappingList.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/FileSpec.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/Stream.h" using namespace lldb; diff --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp index fd909075a24..cfd971e9de6 100644 --- a/lldb/source/Target/Platform.cpp +++ b/lldb/source/Target/Platform.cpp @@ -39,9 +39,9 @@ #include "lldb/Target/Target.h" #include "lldb/Target/UnixSignals.h" #include "lldb/Utility/DataBufferHeap.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" #include "llvm/Support/FileSystem.h" @@ -170,11 +170,11 @@ void Platform::SetHostPlatform(const lldb::PlatformSP &platform_sp) { } } -Error Platform::GetFileWithUUID(const FileSpec &platform_file, - const UUID *uuid_ptr, FileSpec &local_file) { +Status Platform::GetFileWithUUID(const FileSpec &platform_file, + const UUID *uuid_ptr, FileSpec &local_file) { // Default to the local case local_file = platform_file; - return Error(); + return Status(); } FileSpecList @@ -217,11 +217,11 @@ Platform::LocateExecutableScriptingResources(Target *target, Module &module, // return PlatformSP(); //} -Error Platform::GetSharedModule(const ModuleSpec &module_spec, Process *process, - ModuleSP &module_sp, - const FileSpecList *module_search_paths_ptr, - ModuleSP *old_module_sp_ptr, - bool *did_create_ptr) { +Status Platform::GetSharedModule(const ModuleSpec &module_spec, + Process *process, ModuleSP &module_sp, + const FileSpecList *module_search_paths_ptr, + ModuleSP *old_module_sp_ptr, + bool *did_create_ptr) { if (IsHost()) return ModuleList::GetSharedModule( module_spec, module_sp, module_search_paths_ptr, old_module_sp_ptr, @@ -229,7 +229,7 @@ Error Platform::GetSharedModule(const ModuleSpec &module_spec, Process *process, return GetRemoteSharedModule(module_spec, process, module_sp, [&](const ModuleSpec &spec) { - Error error = ModuleList::GetSharedModule( + Status error = ModuleList::GetSharedModule( spec, module_sp, module_search_paths_ptr, old_module_sp_ptr, did_create_ptr, false); if (error.Success() && module_sp) @@ -267,7 +267,7 @@ PlatformSP Platform::Find(const ConstString &name) { return PlatformSP(); } -PlatformSP Platform::Create(const ConstString &name, Error &error) { +PlatformSP Platform::Create(const ConstString &name, Status &error) { PlatformCreateInstance create_callback = nullptr; lldb::PlatformSP platform_sp; if (name) { @@ -295,7 +295,7 @@ PlatformSP Platform::Create(const ConstString &name, Error &error) { } PlatformSP Platform::Create(const ArchSpec &arch, ArchSpec *platform_arch_ptr, - Error &error) { + Status &error) { lldb::PlatformSP platform_sp; if (arch.IsValid()) { // Scope for locker @@ -540,7 +540,7 @@ FileSpec Platform::GetWorkingDirectory() { struct RecurseCopyBaton { const FileSpec &dst; Platform *platform_ptr; - Error error; + Status error; }; static FileSpec::EnumerateDirectoryResult @@ -560,7 +560,7 @@ RecurseCopy_Callback(void *baton, llvm::sys::fs::file_type ft, FileSpec dst_dir = rc_baton->dst; if (!dst_dir.GetFilename()) dst_dir.GetFilename() = src.GetLastPathComponent(); - Error error = rc_baton->platform_ptr->MakeDirectory( + Status error = rc_baton->platform_ptr->MakeDirectory( dst_dir, lldb::eFilePermissionsDirectoryDefault); if (error.Fail()) { rc_baton->error.SetErrorStringWithFormat( @@ -575,7 +575,8 @@ RecurseCopy_Callback(void *baton, llvm::sys::fs::file_type ft, // when we enumerate we can quickly fill in the filename for dst copies FileSpec recurse_dst; recurse_dst.GetDirectory().SetCString(dst_dir.GetPath().c_str()); - RecurseCopyBaton rc_baton2 = {recurse_dst, rc_baton->platform_ptr, Error()}; + RecurseCopyBaton rc_baton2 = {recurse_dst, rc_baton->platform_ptr, + Status()}; FileSpec::EnumerateDirectory(src_dir_path, true, true, true, RecurseCopy_Callback, &rc_baton2); if (rc_baton2.error.Fail()) { @@ -612,7 +613,7 @@ RecurseCopy_Callback(void *baton, llvm::sys::fs::file_type ft, FileSpec dst_file = rc_baton->dst; if (!dst_file.GetFilename()) dst_file.GetFilename() = src.GetFilename(); - Error err = rc_baton->platform_ptr->PutFile(src, dst_file); + Status err = rc_baton->platform_ptr->PutFile(src, dst_file); if (err.Fail()) { rc_baton->error.SetErrorString(err.AsCString()); return FileSpec::eEnumerateDirectoryResultQuit; // got an error, bail out @@ -629,8 +630,8 @@ RecurseCopy_Callback(void *baton, llvm::sys::fs::file_type ft, llvm_unreachable("Unhandled file_type!"); } -Error Platform::Install(const FileSpec &src, const FileSpec &dst) { - Error error; +Status Platform::Install(const FileSpec &src, const FileSpec &dst) { + Status error; Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM); if (log) @@ -708,7 +709,7 @@ Error Platform::Install(const FileSpec &src, const FileSpec &dst) { FileSpec recurse_dst; recurse_dst.GetDirectory().SetCString(fixed_dst.GetCString()); std::string src_dir_path(src.GetPath()); - RecurseCopyBaton baton = {recurse_dst, this, Error()}; + RecurseCopyBaton baton = {recurse_dst, this, Status()}; FileSpec::EnumerateDirectory(src_dir_path, true, true, true, RecurseCopy_Callback, &baton); return baton.error; @@ -757,11 +758,12 @@ bool Platform::SetWorkingDirectory(const FileSpec &file_spec) { } } -Error Platform::MakeDirectory(const FileSpec &file_spec, uint32_t permissions) { +Status Platform::MakeDirectory(const FileSpec &file_spec, + uint32_t permissions) { if (IsHost()) return llvm::sys::fs::create_directory(file_spec.GetPath(), permissions); else { - Error error; + Status error; error.SetErrorStringWithFormat("remote platform %s doesn't support %s", GetPluginName().GetCString(), LLVM_PRETTY_FUNCTION); @@ -769,15 +771,15 @@ Error Platform::MakeDirectory(const FileSpec &file_spec, uint32_t permissions) { } } -Error Platform::GetFilePermissions(const FileSpec &file_spec, - uint32_t &file_permissions) { +Status Platform::GetFilePermissions(const FileSpec &file_spec, + uint32_t &file_permissions) { if (IsHost()) { auto Value = llvm::sys::fs::getPermissions(file_spec.GetPath()); if (Value) file_permissions = Value.get(); - return Error(Value.getError()); + return Status(Value.getError()); } else { - Error error; + Status error; error.SetErrorStringWithFormat("remote platform %s doesn't support %s", GetPluginName().GetCString(), LLVM_PRETTY_FUNCTION); @@ -785,13 +787,13 @@ Error Platform::GetFilePermissions(const FileSpec &file_spec, } } -Error Platform::SetFilePermissions(const FileSpec &file_spec, - uint32_t file_permissions) { +Status Platform::SetFilePermissions(const FileSpec &file_spec, + uint32_t file_permissions) { if (IsHost()) { auto Perms = static_cast<llvm::sys::fs::perms>(file_permissions); return llvm::sys::fs::setPermissions(file_spec.GetPath(), Perms); } else { - Error error; + Status error; error.SetErrorStringWithFormat("remote platform %s doesn't support %s", GetPluginName().GetCString(), LLVM_PRETTY_FUNCTION); @@ -877,10 +879,11 @@ bool Platform::SetOSVersion(uint32_t major, uint32_t minor, uint32_t update) { return false; } -Error Platform::ResolveExecutable(const ModuleSpec &module_spec, - lldb::ModuleSP &exe_module_sp, - const FileSpecList *module_search_paths_ptr) { - Error error; +Status +Platform::ResolveExecutable(const ModuleSpec &module_spec, + lldb::ModuleSP &exe_module_sp, + const FileSpecList *module_search_paths_ptr) { + Status error; if (module_spec.GetFileSpec().Exists()) { if (module_spec.GetArchitecture().IsValid()) { error = ModuleList::GetSharedModule(module_spec, exe_module_sp, @@ -909,9 +912,9 @@ Error Platform::ResolveExecutable(const ModuleSpec &module_spec, return error; } -Error Platform::ResolveSymbolFile(Target &target, const ModuleSpec &sym_spec, - FileSpec &sym_file) { - Error error; +Status Platform::ResolveSymbolFile(Target &target, const ModuleSpec &sym_spec, + FileSpec &sym_file) { + Status error; if (sym_spec.GetSymbolFileSpec().Exists()) sym_file = sym_spec.GetSymbolFileSpec(); else @@ -960,8 +963,8 @@ const ArchSpec &Platform::GetSystemArchitecture() { return m_system_arch; } -Error Platform::ConnectRemote(Args &args) { - Error error; +Status Platform::ConnectRemote(Args &args) { + Status error; if (IsHost()) error.SetErrorStringWithFormat("The currently selected platform (%s) is " "the host platform and is always connected.", @@ -973,8 +976,8 @@ Error Platform::ConnectRemote(Args &args) { return error; } -Error Platform::DisconnectRemote() { - Error error; +Status Platform::DisconnectRemote() { + Status error; if (IsHost()) error.SetErrorStringWithFormat("The currently selected platform (%s) is " "the host platform and is always connected.", @@ -1005,8 +1008,8 @@ uint32_t Platform::FindProcesses(const ProcessInstanceInfoMatch &match_info, return match_count; } -Error Platform::LaunchProcess(ProcessLaunchInfo &launch_info) { - Error error; +Status Platform::LaunchProcess(ProcessLaunchInfo &launch_info) { + Status error; Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); if (log) log->Printf("Platform::%s()", __FUNCTION__); @@ -1057,13 +1060,13 @@ Error Platform::LaunchProcess(ProcessLaunchInfo &launch_info) { return error; } -Error Platform::ShellExpandArguments(ProcessLaunchInfo &launch_info) { +Status Platform::ShellExpandArguments(ProcessLaunchInfo &launch_info) { if (IsHost()) return Host::ShellExpandArguments(launch_info); - return Error("base lldb_private::Platform class can't expand arguments"); + return Status("base lldb_private::Platform class can't expand arguments"); } -Error Platform::KillProcess(const lldb::pid_t pid) { +Status Platform::KillProcess(const lldb::pid_t pid) { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); if (log) log->Printf("Platform::%s, pid %" PRIu64, __FUNCTION__, pid); @@ -1083,19 +1086,19 @@ Error Platform::KillProcess(const lldb::pid_t pid) { } if (!IsHost()) { - return Error( + return Status( "base lldb_private::Platform class can't kill remote processes unless " "they are controlled by a process plugin"); } Host::Kill(pid, SIGTERM); - return Error(); + return Status(); } lldb::ProcessSP Platform::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) { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); if (log) log->Printf("Platform::%s entered (target %p)", __FUNCTION__, @@ -1186,7 +1189,7 @@ lldb::PlatformSP Platform::GetPlatformForArchitecture(const ArchSpec &arch, ArchSpec *platform_arch_ptr) { lldb::PlatformSP platform_sp; - Error error; + Status error; if (arch.IsValid()) platform_sp = Platform::Create(arch, platform_arch_ptr, error); return platform_sp; @@ -1230,8 +1233,8 @@ bool Platform::IsCompatibleArchitecture(const ArchSpec &arch, return false; } -Error Platform::PutFile(const FileSpec &source, const FileSpec &destination, - uint32_t uid, uint32_t gid) { +Status Platform::PutFile(const FileSpec &source, const FileSpec &destination, + uint32_t uid, uint32_t gid) { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); if (log) log->Printf("[PutFile] Using block by block transfer....\n"); @@ -1243,13 +1246,13 @@ Error Platform::PutFile(const FileSpec &source, const FileSpec &destination, source_open_options |= File::eOpenOptionDontFollowSymlinks; File source_file(source, source_open_options, lldb::eFilePermissionsUserRW); - Error error; + Status error; uint32_t permissions = source_file.GetPermissions(error); if (permissions == 0) permissions = lldb::eFilePermissionsFileDefault; if (!source_file.IsValid()) - return Error("PutFile: unable to open source file"); + return Status("PutFile: unable to open source file"); lldb::user_id_t dest_file = OpenFile( destination, File::eOpenOptionCanCreate | File::eOpenOptionWrite | File::eOpenOptionTruncate | File::eOpenOptionCloseOnExec, @@ -1260,7 +1263,7 @@ Error Platform::PutFile(const FileSpec &source, const FileSpec &destination, if (error.Fail()) return error; if (dest_file == UINT64_MAX) - return Error("unable to open target file"); + return Status("unable to open target file"); lldb::DataBufferSP buffer_sp(new DataBufferHeap(1024, 0)); uint64_t offset = 0; for (;;) { @@ -1291,16 +1294,16 @@ Error Platform::PutFile(const FileSpec &source, const FileSpec &destination, return error; } -Error Platform::GetFile(const FileSpec &source, const FileSpec &destination) { - Error error("unimplemented"); +Status Platform::GetFile(const FileSpec &source, const FileSpec &destination) { + Status error("unimplemented"); return error; } -Error Platform::CreateSymlink( - const FileSpec &src, // The name of the link is in src - const FileSpec &dst) // The symlink points to dst +Status +Platform::CreateSymlink(const FileSpec &src, // The name of the link is in src + const FileSpec &dst) // The symlink points to dst { - Error error("unimplemented"); + Status error("unimplemented"); return error; } @@ -1308,8 +1311,8 @@ bool Platform::GetFileExists(const lldb_private::FileSpec &file_spec) { return false; } -Error Platform::Unlink(const FileSpec &path) { - Error error("unimplemented"); +Status Platform::Unlink(const FileSpec &path) { + Status error("unimplemented"); return error; } @@ -1323,7 +1326,7 @@ uint64_t Platform::ConvertMmapFlagsToPlatform(const ArchSpec &arch, return flags_platform; } -lldb_private::Error Platform::RunShellCommand( +lldb_private::Status Platform::RunShellCommand( const char *command, // Shouldn't be nullptr const FileSpec & working_dir, // Pass empty FileSpec to use the current working directory @@ -1339,7 +1342,7 @@ lldb_private::Error Platform::RunShellCommand( return Host::RunShellCommand(command, working_dir, status_ptr, signo_ptr, command_output, timeout_sec); else - return Error("unimplemented"); + return Status("unimplemented"); } bool Platform::CalculateMD5(const FileSpec &file_spec, uint64_t &low, @@ -1402,11 +1405,11 @@ void OptionGroupPlatformRSync::OptionParsingStarting( m_ignores_remote_hostname = false; } -lldb_private::Error +lldb_private::Status OptionGroupPlatformRSync::SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) { - Error error; + Status error; char short_option = (char)GetDefinitions()[option_idx].short_option; switch (short_option) { case 'r': @@ -1448,11 +1451,11 @@ void OptionGroupPlatformSSH::OptionParsingStarting( m_ssh_opts.clear(); } -lldb_private::Error +lldb_private::Status OptionGroupPlatformSSH::SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) { - Error error; + Status error; char short_option = (char)GetDefinitions()[option_idx].short_option; switch (short_option) { case 's': @@ -1480,10 +1483,10 @@ void OptionGroupPlatformCaching::OptionParsingStarting( m_cache_dir.clear(); } -lldb_private::Error OptionGroupPlatformCaching::SetOptionValue( +lldb_private::Status OptionGroupPlatformCaching::SetOptionValue( uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) { - Error error; + Status error; char short_option = (char)GetDefinitions()[option_idx].short_option; switch (short_option) { case 'c': @@ -1514,10 +1517,9 @@ const std::vector<ConstString> &Platform::GetTrapHandlerSymbolNames() { return m_trap_handlers; } -Error Platform::GetCachedExecutable(ModuleSpec &module_spec, - lldb::ModuleSP &module_sp, - const FileSpecList *module_search_paths_ptr, - Platform &remote_platform) { +Status Platform::GetCachedExecutable( + ModuleSpec &module_spec, lldb::ModuleSP &module_sp, + const FileSpecList *module_search_paths_ptr, Platform &remote_platform) { const auto platform_spec = module_spec.GetFileSpec(); const auto error = LoadCachedExecutable( module_spec, module_sp, module_search_paths_ptr, remote_platform); @@ -1529,7 +1531,7 @@ Error Platform::GetCachedExecutable(ModuleSpec &module_spec, return error; } -Error Platform::LoadCachedExecutable( +Status Platform::LoadCachedExecutable( const ModuleSpec &module_spec, lldb::ModuleSP &module_sp, const FileSpecList *module_search_paths_ptr, Platform &remote_platform) { return GetRemoteSharedModule(module_spec, nullptr, module_sp, @@ -1540,11 +1542,11 @@ Error Platform::LoadCachedExecutable( nullptr); } -Error Platform::GetRemoteSharedModule(const ModuleSpec &module_spec, - Process *process, - lldb::ModuleSP &module_sp, - const ModuleResolver &module_resolver, - bool *did_create_ptr) { +Status Platform::GetRemoteSharedModule(const ModuleSpec &module_spec, + Process *process, + lldb::ModuleSP &module_sp, + const ModuleResolver &module_resolver, + bool *did_create_ptr) { // Get module information from a target. ModuleSpec resolved_module_spec; bool got_module_spec = false; @@ -1561,7 +1563,7 @@ Error Platform::GetRemoteSharedModule(const ModuleSpec &module_spec, } if (module_spec.GetArchitecture().IsValid() == false) { - Error error; + Status error; // No valid architecture was specified, ask the platform for // the architectures that we should be using (in the correct order) // and see if we can find a match that way @@ -1600,7 +1602,7 @@ Error Platform::GetRemoteSharedModule(const ModuleSpec &module_spec, const auto error = module_resolver(resolved_module_spec); if (error.Fail()) { if (GetCachedSharedModule(resolved_module_spec, module_sp, did_create_ptr)) - return Error(); + return Status(); } return error; @@ -1640,11 +1642,11 @@ bool Platform::GetCachedSharedModule(const ModuleSpec &module_spec, return false; } -Error Platform::DownloadModuleSlice(const FileSpec &src_file_spec, - const uint64_t src_offset, - const uint64_t src_size, - const FileSpec &dst_file_spec) { - Error error; +Status Platform::DownloadModuleSlice(const FileSpec &src_file_spec, + const uint64_t src_offset, + const uint64_t src_size, + const FileSpec &dst_file_spec) { + Status error; std::error_code EC; llvm::raw_fd_ostream dst(dst_file_spec.GetPath(), EC, llvm::sys::fs::F_None); @@ -1682,15 +1684,15 @@ Error Platform::DownloadModuleSlice(const FileSpec &src_file_spec, dst.write(&buffer[0], n_read); } - Error close_error; + Status close_error; CloseFile(src_fd, close_error); // Ignoring close error. return error; } -Error Platform::DownloadSymbolFile(const lldb::ModuleSP &module_sp, - const FileSpec &dst_file_spec) { - return Error( +Status Platform::DownloadSymbolFile(const lldb::ModuleSP &module_sp, + const FileSpec &dst_file_spec) { + return Status( "Symbol file downloading not supported by the default platform."); } @@ -1716,7 +1718,7 @@ const UnixSignalsSP &Platform::GetUnixSignals() { uint32_t Platform::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) { if (local_file && remote_file) { // Both local and remote file was specified. Install the local file to the // given location. @@ -1752,21 +1754,21 @@ uint32_t Platform::LoadImage(lldb_private::Process *process, uint32_t Platform::DoLoadImage(lldb_private::Process *process, const lldb_private::FileSpec &remote_file, - lldb_private::Error &error) { + lldb_private::Status &error) { error.SetErrorString("LoadImage is not supported on the current platform"); return LLDB_INVALID_IMAGE_TOKEN; } -Error Platform::UnloadImage(lldb_private::Process *process, - uint32_t image_token) { - return Error("UnloadImage is not supported on the current platform"); +Status Platform::UnloadImage(lldb_private::Process *process, + uint32_t image_token) { + return Status("UnloadImage is not supported on the current platform"); } lldb::ProcessSP Platform::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) { error.Clear(); if (!target) { @@ -1795,7 +1797,7 @@ lldb::ProcessSP Platform::ConnectProcess(llvm::StringRef connect_url, } size_t Platform::ConnectToWaitingProcesses(lldb_private::Debugger &debugger, - lldb_private::Error &error) { + lldb_private::Status &error) { error.Clear(); return 0; } diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index 0bc58f073bf..77da2b306e4 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -415,10 +415,10 @@ void ProcessInstanceInfo::DumpAsTableRow(Stream &s, Platform *platform, } } -Error ProcessLaunchCommandOptions::SetOptionValue( +Status ProcessLaunchCommandOptions::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; switch (short_option) { @@ -1610,13 +1610,13 @@ void Process::SetPublicState(StateType new_state, bool restarted) { } } -Error Process::Resume() { +Status Process::Resume() { Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_STATE | LIBLLDB_LOG_PROCESS)); if (log) log->Printf("Process::Resume -- locking run lock"); if (!m_public_run_lock.TrySetRunning()) { - Error error("Resume request failed - process still running."); + Status error("Resume request failed - process still running."); if (log) log->Printf("Process::Resume: -- TrySetRunning failed, not resuming."); return error; @@ -1624,13 +1624,13 @@ Error Process::Resume() { return PrivateResume(); } -Error Process::ResumeSynchronous(Stream *stream) { +Status Process::ResumeSynchronous(Stream *stream) { Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_STATE | LIBLLDB_LOG_PROCESS)); if (log) log->Printf("Process::ResumeSynchronous -- locking run lock"); if (!m_public_run_lock.TrySetRunning()) { - Error error("Resume request failed - process still running."); + Status error("Resume request failed - process still running."); if (log) log->Printf("Process::Resume: -- TrySetRunning failed, not resuming."); return error; @@ -1640,7 +1640,7 @@ Error Process::ResumeSynchronous(Stream *stream) { Listener::MakeListener("lldb.Process.ResumeSynchronous.hijack")); HijackProcessEvents(listener_sp); - Error error = PrivateResume(); + Status error = PrivateResume(); if (error.Success()) { StateType state = WaitForProcessToStop(llvm::None, NULL, true, listener_sp, stream); @@ -1813,8 +1813,8 @@ void Process::DisableAllBreakpointSites() { }); } -Error Process::ClearBreakpointSiteByID(lldb::user_id_t break_id) { - Error error(DisableBreakpointSiteByID(break_id)); +Status Process::ClearBreakpointSiteByID(lldb::user_id_t break_id) { + Status error(DisableBreakpointSiteByID(break_id)); if (error.Success()) m_breakpoint_site_list.Remove(break_id); @@ -1822,8 +1822,8 @@ Error Process::ClearBreakpointSiteByID(lldb::user_id_t break_id) { return error; } -Error Process::DisableBreakpointSiteByID(lldb::user_id_t break_id) { - Error error; +Status Process::DisableBreakpointSiteByID(lldb::user_id_t break_id) { + Status error; BreakpointSiteSP bp_site_sp = m_breakpoint_site_list.FindByID(break_id); if (bp_site_sp) { if (bp_site_sp->IsEnabled()) @@ -1836,8 +1836,8 @@ Error Process::DisableBreakpointSiteByID(lldb::user_id_t break_id) { return error; } -Error Process::EnableBreakpointSiteByID(lldb::user_id_t break_id) { - Error error; +Status Process::EnableBreakpointSiteByID(lldb::user_id_t break_id) { + Status error; BreakpointSiteSP bp_site_sp = m_breakpoint_site_list.FindByID(break_id); if (bp_site_sp) { if (!bp_site_sp->IsEnabled()) @@ -1882,7 +1882,7 @@ Process::CreateBreakpointSite(const BreakpointLocationSP &owner, if (owner->ShouldResolveIndirectFunctions()) { Symbol *symbol = owner->GetAddress().CalculateSymbolContextSymbol(); if (symbol && symbol->IsIndirect()) { - Error error; + Status error; Address symbol_address = symbol->GetAddress(); load_addr = ResolveIndirectFunction(&symbol_address, error); if (!error.Success() && show_error) { @@ -1919,7 +1919,7 @@ Process::CreateBreakpointSite(const BreakpointLocationSP &owner, bp_site_sp.reset(new BreakpointSite(&m_breakpoint_site_list, owner, load_addr, use_hardware)); if (bp_site_sp) { - Error error = EnableBreakpointSite(bp_site_sp.get()); + Status error = EnableBreakpointSite(bp_site_sp.get()); if (error.Success()) { owner->SetBreakpointSite(bp_site_sp); return m_breakpoint_site_list.Add(bp_site_sp); @@ -1989,8 +1989,8 @@ size_t Process::GetSoftwareBreakpointTrapOpcode(BreakpointSite *bp_site) { return 0; } -Error Process::EnableSoftwareBreakpoint(BreakpointSite *bp_site) { - Error error; +Status Process::EnableSoftwareBreakpoint(BreakpointSite *bp_site) { + Status error; assert(bp_site != nullptr); Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); const addr_t bp_addr = bp_site->GetLoadAddress(); @@ -2065,8 +2065,8 @@ Error Process::EnableSoftwareBreakpoint(BreakpointSite *bp_site) { return error; } -Error Process::DisableSoftwareBreakpoint(BreakpointSite *bp_site) { - Error error; +Status Process::DisableSoftwareBreakpoint(BreakpointSite *bp_site) { + Status error; assert(bp_site != nullptr); Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); addr_t bp_addr = bp_site->GetLoadAddress(); @@ -2158,7 +2158,7 @@ Error Process::DisableSoftwareBreakpoint(BreakpointSite *bp_site) { // Uncomment to verify memory caching works after making changes to caching code //#define VERIFY_MEMORY_READS -size_t Process::ReadMemory(addr_t addr, void *buf, size_t size, Error &error) { +size_t Process::ReadMemory(addr_t addr, void *buf, size_t size, Status &error) { error.Clear(); if (!GetDisableMemoryCache()) { #if defined(VERIFY_MEMORY_READS) @@ -2177,7 +2177,7 @@ size_t Process::ReadMemory(addr_t addr, void *buf, size_t size, Error &error) { assert(verify_buf.size() == size); const size_t cache_bytes_read = m_memory_cache.Read(this, addr, buf, size, error); - Error verify_error; + Status verify_error; const size_t verify_bytes_read = ReadMemoryFromInferior(addr, const_cast<char *>(verify_buf.data()), verify_buf.size(), verify_error); @@ -2200,7 +2200,7 @@ size_t Process::ReadMemory(addr_t addr, void *buf, size_t size, Error &error) { } size_t Process::ReadCStringFromMemory(addr_t addr, std::string &out_str, - Error &error) { + Status &error) { char buf[256]; out_str.clear(); addr_t curr_addr = addr; @@ -2220,7 +2220,7 @@ size_t Process::ReadCStringFromMemory(addr_t addr, std::string &out_str, } size_t Process::ReadStringFromMemory(addr_t addr, char *dst, size_t max_bytes, - Error &error, size_t type_width) { + Status &error, size_t type_width) { size_t total_bytes_read = 0; if (dst && max_bytes && type_width && max_bytes >= type_width) { // Ensure a null terminator independent of the number of bytes that is read. @@ -2273,13 +2273,14 @@ size_t Process::ReadStringFromMemory(addr_t addr, char *dst, size_t max_bytes, // correct code to find // null terminators. size_t Process::ReadCStringFromMemory(addr_t addr, char *dst, - size_t dst_max_len, Error &result_error) { + size_t dst_max_len, + Status &result_error) { size_t total_cstr_len = 0; if (dst && dst_max_len) { result_error.Clear(); // NULL out everything just to be safe memset(dst, 0, dst_max_len); - Error error; + Status error; addr_t curr_addr = addr; const size_t cache_line_size = m_memory_cache.GetMemoryCacheLineSize(); size_t bytes_left = dst_max_len - 1; @@ -2318,7 +2319,7 @@ size_t Process::ReadCStringFromMemory(addr_t addr, char *dst, } size_t Process::ReadMemoryFromInferior(addr_t addr, void *buf, size_t size, - Error &error) { + Status &error) { if (buf == nullptr || size == 0) return 0; @@ -2344,7 +2345,7 @@ size_t Process::ReadMemoryFromInferior(addr_t addr, void *buf, size_t size, uint64_t Process::ReadUnsignedIntegerFromMemory(lldb::addr_t vm_addr, size_t integer_byte_size, uint64_t fail_value, - Error &error) { + Status &error) { Scalar scalar; if (ReadScalarIntegerFromMemory(vm_addr, integer_byte_size, false, scalar, error)) @@ -2354,7 +2355,8 @@ uint64_t Process::ReadUnsignedIntegerFromMemory(lldb::addr_t vm_addr, int64_t Process::ReadSignedIntegerFromMemory(lldb::addr_t vm_addr, size_t integer_byte_size, - int64_t fail_value, Error &error) { + int64_t fail_value, + Status &error) { Scalar scalar; if (ReadScalarIntegerFromMemory(vm_addr, integer_byte_size, true, scalar, error)) @@ -2362,7 +2364,7 @@ int64_t Process::ReadSignedIntegerFromMemory(lldb::addr_t vm_addr, return fail_value; } -addr_t Process::ReadPointerFromMemory(lldb::addr_t vm_addr, Error &error) { +addr_t Process::ReadPointerFromMemory(lldb::addr_t vm_addr, Status &error) { Scalar scalar; if (ReadScalarIntegerFromMemory(vm_addr, GetAddressByteSize(), false, scalar, error)) @@ -2371,7 +2373,7 @@ addr_t Process::ReadPointerFromMemory(lldb::addr_t vm_addr, Error &error) { } bool Process::WritePointerToMemory(lldb::addr_t vm_addr, lldb::addr_t ptr_value, - Error &error) { + Status &error) { Scalar scalar; const uint32_t addr_byte_size = GetAddressByteSize(); if (addr_byte_size <= 4) @@ -2383,7 +2385,7 @@ bool Process::WritePointerToMemory(lldb::addr_t vm_addr, lldb::addr_t ptr_value, } size_t Process::WriteMemoryPrivate(addr_t addr, const void *buf, size_t size, - Error &error) { + Status &error) { size_t bytes_written = 0; const uint8_t *bytes = (const uint8_t *)buf; @@ -2399,7 +2401,7 @@ size_t Process::WriteMemoryPrivate(addr_t addr, const void *buf, size_t size, } size_t Process::WriteMemory(addr_t addr, const void *buf, size_t size, - Error &error) { + Status &error) { #if defined(ENABLE_MEMORY_CACHING) m_memory_cache.Flush(addr, size); #endif @@ -2478,7 +2480,7 @@ size_t Process::WriteMemory(addr_t addr, const void *buf, size_t size, } size_t Process::WriteScalarToMemory(addr_t addr, const Scalar &scalar, - size_t byte_size, Error &error) { + size_t byte_size, Status &error) { if (byte_size == UINT32_MAX) byte_size = scalar.GetByteSize(); if (byte_size > 0) { @@ -2497,7 +2499,7 @@ size_t Process::WriteScalarToMemory(addr_t addr, const Scalar &scalar, size_t Process::ReadScalarIntegerFromMemory(addr_t addr, uint32_t byte_size, bool is_signed, Scalar &scalar, - Error &error) { + Status &error) { uint64_t uval = 0; if (byte_size == 0) { error.SetErrorString("byte size is zero"); @@ -2527,7 +2529,7 @@ size_t Process::ReadScalarIntegerFromMemory(addr_t addr, uint32_t byte_size, #define USE_ALLOCATE_MEMORY_CACHE 1 addr_t Process::AllocateMemory(size_t size, uint32_t permissions, - Error &error) { + Status &error) { if (GetPrivateState() != eStateStopped) return LLDB_INVALID_ADDRESS; @@ -2548,7 +2550,7 @@ addr_t Process::AllocateMemory(size_t size, uint32_t permissions, } addr_t Process::CallocateMemory(size_t size, uint32_t permissions, - Error &error) { + Status &error) { addr_t return_addr = AllocateMemory(size, permissions, error); if (error.Success()) { std::string buffer(size, 0); @@ -2560,7 +2562,7 @@ addr_t Process::CallocateMemory(size_t size, uint32_t permissions, bool Process::CanJIT() { if (m_can_jit == eCanJITDontKnow) { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); - Error err; + Status err; uint64_t allocated_memory = AllocateMemory( 8, ePermissionsReadable | ePermissionsWritable | ePermissionsExecutable, @@ -2595,8 +2597,8 @@ void Process::SetCanRunCode(bool can_run_code) { m_can_interpret_function_calls = can_run_code; } -Error Process::DeallocateMemory(addr_t ptr) { - Error error; +Status Process::DeallocateMemory(addr_t ptr) { + Status error; #if defined(USE_ALLOCATE_MEMORY_CACHE) if (!m_allocated_memory_cache.DeallocateMemory(ptr)) { error.SetErrorStringWithFormat( @@ -2625,7 +2627,7 @@ ModuleSP Process::ReadModuleFromMemory(const FileSpec &file_spec, } ModuleSP module_sp(new Module(file_spec, ArchSpec())); if (module_sp) { - Error error; + Status error; ObjectFile *objfile = module_sp->GetMemoryObjectFile( shared_from_this(), header_addr, error, size_to_read); if (objfile) @@ -2638,7 +2640,7 @@ bool Process::GetLoadAddressPermissions(lldb::addr_t load_addr, uint32_t &permissions) { MemoryRegionInfo range_info; permissions = 0; - Error error(GetMemoryRegionInfo(load_addr, range_info)); + Status error(GetMemoryRegionInfo(load_addr, range_info)); if (!error.Success()) return false; if (range_info.GetReadable() == MemoryRegionInfo::eDontKnow || @@ -2659,14 +2661,14 @@ bool Process::GetLoadAddressPermissions(lldb::addr_t load_addr, return true; } -Error Process::EnableWatchpoint(Watchpoint *watchpoint, bool notify) { - Error error; +Status Process::EnableWatchpoint(Watchpoint *watchpoint, bool notify) { + Status error; error.SetErrorString("watchpoints are not supported"); return error; } -Error Process::DisableWatchpoint(Watchpoint *watchpoint, bool notify) { - Error error; +Status Process::DisableWatchpoint(Watchpoint *watchpoint, bool notify) { + Status error; error.SetErrorString("watchpoints are not supported"); return error; } @@ -2702,8 +2704,8 @@ void Process::LoadOperatingSystemPlugin(bool flush) { Flush(); } -Error Process::Launch(ProcessLaunchInfo &launch_info) { - Error error; +Status Process::Launch(ProcessLaunchInfo &launch_info) { + Status error; m_abi_sp.reset(); m_dyld_ap.reset(); m_jit_loaders_ap.reset(); @@ -2823,8 +2825,8 @@ Error Process::Launch(ProcessLaunchInfo &launch_info) { return error; } -Error Process::LoadCore() { - Error error = DoLoadCore(); +Status Process::LoadCore() { + Status error = DoLoadCore(); if (error.Success()) { ListenerSP listener_sp( Listener::MakeListener("lldb.process.load_core_listener")); @@ -2977,7 +2979,7 @@ ListenerSP ProcessAttachInfo::GetListenerForProcess(Debugger &debugger) { return debugger.GetListener(); } -Error Process::Attach(ProcessAttachInfo &attach_info) { +Status Process::Attach(ProcessAttachInfo &attach_info) { m_abi_sp.reset(); m_process_input_reader.reset(); m_dyld_ap.reset(); @@ -2987,7 +2989,7 @@ Error Process::Attach(ProcessAttachInfo &attach_info) { m_stop_info_override_callback = nullptr; lldb::pid_t attach_pid = attach_info.GetProcessID(); - Error error; + Status error; if (attach_pid == LLDB_INVALID_PROCESS_ID) { char process_name[PATH_MAX]; @@ -3221,14 +3223,14 @@ void Process::CompleteAttach() { m_stop_info_override_callback = process_arch.GetStopInfoOverrideCallback(); } -Error Process::ConnectRemote(Stream *strm, llvm::StringRef remote_url) { +Status Process::ConnectRemote(Stream *strm, llvm::StringRef remote_url) { m_abi_sp.reset(); m_process_input_reader.reset(); // Find the process and its architecture. Make sure it matches the // architecture of the current Target, and if not adjust it. - Error error(DoConnectRemote(strm, remote_url)); + Status error(DoConnectRemote(strm, remote_url)); if (error.Success()) { if (GetID() != LLDB_INVALID_PROCESS_ID) { EventSP event_sp; @@ -3253,7 +3255,7 @@ Error Process::ConnectRemote(Stream *strm, llvm::StringRef remote_url) { return error; } -Error Process::PrivateResume() { +Status Process::PrivateResume() { Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_STEP)); if (log) @@ -3266,7 +3268,7 @@ Error Process::PrivateResume() { // our signal filters before resuming. UpdateAutomaticSignalFiltering(); - Error error(WillResume()); + Status error(WillResume()); // Tell the process it is about to resume before the thread list if (error.Success()) { // Now let the thread list know we are about to resume so it @@ -3311,9 +3313,9 @@ Error Process::PrivateResume() { return error; } -Error Process::Halt(bool clear_thread_plans, bool use_run_lock) { +Status Process::Halt(bool clear_thread_plans, bool use_run_lock) { if (!StateIsRunningState(m_public_state.GetValue())) - return Error("Process is not running."); + return Status("Process is not running."); // Don't clear the m_clear_thread_plans_on_stop, only set it to true if // in case it was already set and some thread plan logic calls halt on its @@ -3334,7 +3336,7 @@ Error Process::Halt(bool clear_thread_plans, bool use_run_lock) { RestoreProcessEvents(); SetExitStatus(SIGKILL, "Cancelled async attach."); Destroy(false); - return Error(); + return Status(); } // Wait for 10 second for the process to stop. @@ -3344,16 +3346,16 @@ Error Process::Halt(bool clear_thread_plans, bool use_run_lock) { if (state == eStateInvalid || !event_sp) { // We timed out and didn't get a stop event... - return Error("Halt timed out. State = %s", StateAsCString(GetState())); + return Status("Halt timed out. State = %s", StateAsCString(GetState())); } BroadcastEvent(event_sp); - return Error(); + return Status(); } -Error Process::StopForDestroyOrDetach(lldb::EventSP &exit_event_sp) { - Error error; +Status Process::StopForDestroyOrDetach(lldb::EventSP &exit_event_sp) { + Status error; // Check both the public & private states here. If we're hung evaluating an // expression, for instance, then @@ -3400,18 +3402,19 @@ Error Process::StopForDestroyOrDetach(lldb::EventSP &exit_event_sp) { // then continue on. StateType private_state = m_private_state.GetValue(); if (private_state != eStateStopped) { - return Error("Attempt to stop the target in order to detach timed out. " - "State = %s", - StateAsCString(GetState())); + return Status( + "Attempt to stop the target in order to detach timed out. " + "State = %s", + StateAsCString(GetState())); } } } return error; } -Error Process::Detach(bool keep_stopped) { +Status Process::Detach(bool keep_stopped) { EventSP exit_event_sp; - Error error; + Status error; m_destroy_in_process = true; error = WillDetach(); @@ -3463,7 +3466,7 @@ Error Process::Detach(bool keep_stopped) { return error; } -Error Process::Destroy(bool force_kill) { +Status Process::Destroy(bool force_kill) { // Tell ourselves we are in the process of destroying the process, so that we // don't do any unnecessary work @@ -3483,7 +3486,7 @@ Error Process::Destroy(bool force_kill) { m_destroy_in_process = true; - Error error(WillDestroy()); + Status error(WillDestroy()); if (error.Success()) { EventSP exit_event_sp; if (DestroyRequiresHalt()) { @@ -3538,8 +3541,8 @@ Error Process::Destroy(bool force_kill) { return error; } -Error Process::Signal(int signal) { - Error error(WillSignal()); +Status Process::Signal(int signal) { + Status error(WillSignal()); if (error.Success()) { error = DoSignal(signal); if (error.Success()) @@ -3967,9 +3970,9 @@ void Process::HandlePrivateEvent(EventSP &event_sp) { } } -Error Process::HaltPrivate() { +Status Process::HaltPrivate() { EventSP event_sp; - Error error(WillHalt()); + Status error(WillHalt()); if (error.Fail()) return error; @@ -4037,7 +4040,7 @@ thread_result_t Process::RunPrivateStateThread(bool is_secondary_thread) { log->Printf("Process::%s (arg = %p, pid = %" PRIu64 ") woke up with an interrupt - Halting.", __FUNCTION__, static_cast<void *>(this), GetID()); - Error error = HaltPrivate(); + Status error = HaltPrivate(); if (error.Fail() && log) log->Printf("Process::%s (arg = %p, pid = %" PRIu64 ") failed to halt the process: %s", @@ -4477,7 +4480,7 @@ Process::GetStructuredDataPlugin(const ConstString &type_name) const { return StructuredDataPluginSP(); } -size_t Process::GetAsyncProfileData(char *buf, size_t buf_size, Error &error) { +size_t Process::GetAsyncProfileData(char *buf, size_t buf_size, Status &error) { std::lock_guard<std::recursive_mutex> guard(m_profile_data_comm_mutex); if (m_profile_data.empty()) return 0; @@ -4505,7 +4508,7 @@ size_t Process::GetAsyncProfileData(char *buf, size_t buf_size, Error &error) { // Process STDIO //------------------------------------------------------------------ -size_t Process::GetSTDOUT(char *buf, size_t buf_size, Error &error) { +size_t Process::GetSTDOUT(char *buf, size_t buf_size, Status &error) { std::lock_guard<std::recursive_mutex> guard(m_stdio_communication_mutex); size_t bytes_available = m_stdout_data.size(); if (bytes_available > 0) { @@ -4525,7 +4528,7 @@ size_t Process::GetSTDOUT(char *buf, size_t buf_size, Error &error) { return bytes_available; } -size_t Process::GetSTDERR(char *buf, size_t buf_size, Error &error) { +size_t Process::GetSTDERR(char *buf, size_t buf_size, Status &error) { std::lock_guard<std::recursive_mutex> gaurd(m_stdio_communication_mutex); size_t bytes_available = m_stderr_data.size(); if (bytes_available > 0) { @@ -4588,7 +4591,7 @@ public: SelectHelper select_helper; select_helper.FDSetRead(read_fd); select_helper.FDSetRead(pipe_read_fd); - Error error = select_helper.Select(); + Status error = select_helper.Select(); if (error.Fail()) { SetIsDone(true); @@ -4606,7 +4609,7 @@ public: if (select_helper.FDIsSetRead(pipe_read_fd)) { size_t bytes_read; // Consume the interrupt byte - Error error = m_pipe.Read(&ch, 1, bytes_read); + Status error = m_pipe.Read(&ch, 1, bytes_read); if (error.Success()) { switch (ch) { case 'q': @@ -4657,7 +4660,7 @@ public: if (m_active) { char ch = 'i'; // Send 'i' for interrupt size_t bytes_written = 0; - Error result = m_pipe.Write(&ch, 1, bytes_written); + Status result = m_pipe.Write(&ch, 1, bytes_written); return result.Success(); } else { // This IOHandler might be pushed on the stack, but not being run @@ -5082,7 +5085,7 @@ Process::RunThreadPlan(ExecutionContext &exe_ctx, if (do_resume) { num_resumes++; - Error resume_error = PrivateResume(); + Status resume_error = PrivateResume(); if (!resume_error.Success()) { diagnostic_manager.Printf( eDiagnosticSeverityError, @@ -5361,7 +5364,7 @@ Process::RunThreadPlan(ExecutionContext &exe_ctx, bool do_halt = true; const uint32_t num_retries = 5; while (try_halt_again < num_retries) { - Error halt_error; + Status halt_error; if (do_halt) { if (log) log->Printf("Process::RunThreadPlan(): Running Halt."); @@ -5473,7 +5476,7 @@ Process::RunThreadPlan(ExecutionContext &exe_ctx, // plan, shut it down now. if (backup_private_state_thread.IsJoinable()) { StopPrivateStateThread(); - Error error; + Status error; m_private_state_thread = backup_private_state_thread; if (stopper_base_plan_sp) { thread->DiscardThreadPlansUpToPlan(stopper_base_plan_sp); @@ -5862,7 +5865,7 @@ void Process::DidExec() { target.DidExec(); } -addr_t Process::ResolveIndirectFunction(const Address *address, Error &error) { +addr_t Process::ResolveIndirectFunction(const Address *address, Status &error) { if (address == nullptr) { error.SetErrorString("Invalid address argument"); return LLDB_INVALID_ADDRESS; @@ -6090,10 +6093,10 @@ Process::AdvanceAddressToNextBranchInstruction(Address default_stop_addr, return retval; } -Error Process::GetMemoryRegions( - std::vector<lldb::MemoryRegionInfoSP> ®ion_list) { +Status +Process::GetMemoryRegions(std::vector<lldb::MemoryRegionInfoSP> ®ion_list) { - Error error; + Status error; lldb::addr_t range_end = 0; @@ -6116,12 +6119,13 @@ Error Process::GetMemoryRegions( return error; } -Error Process::ConfigureStructuredData( - const ConstString &type_name, const StructuredData::ObjectSP &config_sp) { +Status +Process::ConfigureStructuredData(const ConstString &type_name, + const StructuredData::ObjectSP &config_sp) { // If you get this, the Process-derived class needs to implement a method // to enable an already-reported asynchronous structured data feature. // See ProcessGDBRemote for an example implementation over gdb-remote. - return Error("unimplemented"); + return Status("unimplemented"); } void Process::MapSupportedStructuredDataPlugins( @@ -6229,8 +6233,8 @@ bool Process::RouteAsyncStructuredData( return true; } -Error Process::UpdateAutomaticSignalFiltering() { +Status Process::UpdateAutomaticSignalFiltering() { // Default implementation does nothign. // No automatic signal filtering to speak of. - return Error(); + return Status(); } diff --git a/lldb/source/Target/ProcessLaunchInfo.cpp b/lldb/source/Target/ProcessLaunchInfo.cpp index 7de55f2fdcf..3fa40dcc5ca 100644 --- a/lldb/source/Target/ProcessLaunchInfo.cpp +++ b/lldb/source/Target/ProcessLaunchInfo.cpp @@ -330,7 +330,7 @@ void ProcessLaunchInfo::FinalizeFileActions(Target *target, } bool ProcessLaunchInfo::ConvertArgumentsForLaunchingInShell( - Error &error, bool localhost, bool will_debug, + Status &error, bool localhost, bool will_debug, bool first_arg_is_full_shell_command, int32_t num_resumes) { error.Clear(); diff --git a/lldb/source/Target/RegisterContext.cpp b/lldb/source/Target/RegisterContext.cpp index 6cbfb04a6e9..66164c175e4 100644 --- a/lldb/source/Target/RegisterContext.cpp +++ b/lldb/source/Target/RegisterContext.cpp @@ -91,7 +91,7 @@ RegisterContext::UpdateDynamicRegisterSize(const lldb_private::ArchSpec &arch, DWARFExpression dwarf_expr(opcode_ctx, dwarf_data, nullptr, 0, dwarf_opcode_len); Value result; - Error error; + Status error; const lldb::offset_t offset = 0; if (dwarf_expr.Evaluate(&exe_ctx, nullptr, nullptr, this, opcode_ctx, dwarf_data, nullptr, offset, dwarf_opcode_len, @@ -299,11 +299,10 @@ bool RegisterContext::ClearHardwareWatchpoint(uint32_t hw_index) { bool RegisterContext::HardwareSingleStep(bool enable) { return false; } -Error RegisterContext::ReadRegisterValueFromMemory(const RegisterInfo *reg_info, - lldb::addr_t src_addr, - uint32_t src_len, - RegisterValue ®_value) { - Error error; +Status RegisterContext::ReadRegisterValueFromMemory( + const RegisterInfo *reg_info, lldb::addr_t src_addr, uint32_t src_len, + RegisterValue ®_value) { + Status error; if (reg_info == nullptr) { error.SetErrorString("invalid register info argument."); return error; @@ -318,7 +317,7 @@ Error RegisterContext::ReadRegisterValueFromMemory(const RegisterInfo *reg_info, // // Case 2: src_len > dst_len // - // Error! (The register should always be big enough to hold the data) + // Status! (The register should always be big enough to hold the data) // // Case 3: src_len < dst_len // @@ -371,12 +370,12 @@ Error RegisterContext::ReadRegisterValueFromMemory(const RegisterInfo *reg_info, return error; } -Error RegisterContext::WriteRegisterValueToMemory( +Status RegisterContext::WriteRegisterValueToMemory( const RegisterInfo *reg_info, lldb::addr_t dst_addr, uint32_t dst_len, const RegisterValue ®_value) { uint8_t dst[RegisterValue::kMaxRegisterByteSize]; - Error error; + Status error; ProcessSP process_sp(m_thread.GetProcess()); if (process_sp) { diff --git a/lldb/source/Target/StackFrame.cpp b/lldb/source/Target/StackFrame.cpp index 7b7b596c977..9deebcaf925 100644 --- a/lldb/source/Target/StackFrame.cpp +++ b/lldb/source/Target/StackFrame.cpp @@ -488,7 +488,7 @@ StackFrame::GetInScopeVariableList(bool get_file_globals, ValueObjectSP StackFrame::GetValueForVariableExpressionPath( llvm::StringRef var_expr, DynamicValueType use_dynamic, uint32_t options, - VariableSP &var_sp, Error &error) { + VariableSP &var_sp, Status &error) { llvm::StringRef original_var_expr = var_expr; // We can't fetch variable information for a history stack frame. if (m_is_history_frame) @@ -631,7 +631,7 @@ ValueObjectSP StackFrame::GetValueForVariableExpressionPath( // If we have a non pointer type with a sythetic value then lets check if // we have an sythetic dereference specified. if (!valobj_sp->IsPointerType() && valobj_sp->HasSyntheticValue()) { - Error deref_error; + Status deref_error; if (valobj_sp->GetCompilerType().IsReferenceType()) { valobj_sp = valobj_sp->GetSyntheticValue()->Dereference(deref_error); if (error.Fail()) { @@ -775,7 +775,7 @@ ValueObjectSP StackFrame::GetValueForVariableExpressionPath( // what we have is *ptr[low]. the most similar C++ syntax is to deref // ptr and extract bit low out of it. reading array item low would be // done by saying ptr[low], without a deref * sign - Error error; + Status error; ValueObjectSP temp(valobj_sp->Dereference(error)); if (error.Fail()) { valobj_sp->GetExpressionPath(var_expr_path_strm, false); @@ -794,7 +794,7 @@ ValueObjectSP StackFrame::GetValueForVariableExpressionPath( // (an operation that is equivalent to deref-ing arr) // and extract bit low out of it. reading array item low // would be done by saying arr[low], without a deref * sign - Error error; + Status error; ValueObjectSP temp(valobj_sp->GetChildAtIndex(0, true)); if (error.Fail()) { valobj_sp->GetExpressionPath(var_expr_path_strm, false); @@ -977,7 +977,7 @@ ValueObjectSP StackFrame::GetValueForVariableExpressionPath( // deref ptr and extract bits low thru high out of it. reading array // items low thru high would be done by saying ptr[low-high], without // a deref * sign - Error error; + Status error; ValueObjectSP temp(valobj_sp->Dereference(error)); if (error.Fail()) { valobj_sp->GetExpressionPath(var_expr_path_strm, false); @@ -994,7 +994,7 @@ ValueObjectSP StackFrame::GetValueForVariableExpressionPath( // arr[0] (an operation that is equivalent to deref-ing arr) and extract // bits low thru high out of it. reading array items low thru high would // be done by saying arr[low-high], without a deref * sign - Error error; + Status error; ValueObjectSP temp(valobj_sp->GetChildAtIndex(0, true)); if (error.Fail()) { valobj_sp->GetExpressionPath(var_expr_path_strm, false); @@ -1065,7 +1065,7 @@ ValueObjectSP StackFrame::GetValueForVariableExpressionPath( return valobj_sp; } -bool StackFrame::GetFrameBaseValue(Scalar &frame_base, Error *error_ptr) { +bool StackFrame::GetFrameBaseValue(Scalar &frame_base, Status *error_ptr) { std::lock_guard<std::recursive_mutex> guard(m_mutex); if (!m_cfa_is_valid) { m_frame_base_error.SetErrorString( @@ -1111,7 +1111,7 @@ bool StackFrame::GetFrameBaseValue(Scalar &frame_base, Error *error_ptr) { return m_frame_base_error.Success(); } -DWARFExpression *StackFrame::GetFrameBaseExpression(Error *error_ptr) { +DWARFExpression *StackFrame::GetFrameBaseExpression(Status *error_ptr) { if (!m_sc.function) { if (error_ptr) { error_ptr->SetErrorString("No function in symbol context."); @@ -1426,7 +1426,7 @@ ValueObjectSP GetValueForDereferincingOffset(StackFrame &frame, return ValueObjectSP(); } - Error error; + Status error; ValueObjectSP pointee = base->Dereference(error); if (!pointee) { diff --git a/lldb/source/Target/StopInfo.cpp b/lldb/source/Target/StopInfo.cpp index 8d40c7678b9..6af5ce1b2eb 100644 --- a/lldb/source/Target/StopInfo.cpp +++ b/lldb/source/Target/StopInfo.cpp @@ -435,7 +435,7 @@ protected: // shouldn't stop that will win. if (bp_loc_sp->GetConditionText() != nullptr) { - Error condition_error; + Status condition_error; bool condition_says_stop = bp_loc_sp->ConditionSaysStop(exe_ctx, condition_error); @@ -796,7 +796,7 @@ protected: expr_options.SetUnwindOnError(true); expr_options.SetIgnoreBreakpoints(true); ValueObjectSP result_value_sp; - Error error; + Status error; result_code = UserExpression::Evaluate( exe_ctx, expr_options, wp_sp->GetConditionText(), llvm::StringRef(), result_value_sp, error); diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index 5c9e92aaaa2..ffe321eed4d 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -182,7 +182,7 @@ const lldb::ProcessSP &Target::CreateProcess(ListenerSP listener_sp, const lldb::ProcessSP &Target::GetProcessSP() const { return m_process_sp; } -lldb::REPLSP Target::GetREPL(Error &err, lldb::LanguageType language, +lldb::REPLSP Target::GetREPL(Status &err, lldb::LanguageType language, const char *repl_options, bool can_create) { if (language == eLanguageTypeUnknown) { std::set<LanguageType> repl_languages; @@ -547,7 +547,7 @@ BreakpointSP Target::CreateFuncRegexBreakpoint( lldb::BreakpointSP Target::CreateExceptionBreakpoint(enum lldb::LanguageType language, bool catch_bp, bool throw_bp, bool internal, - Args *additional_args, Error *error) { + Args *additional_args, Status *error) { BreakpointSP exc_bkpt_sp = LanguageRuntime::CreateExceptionBreakpoint( *this, language, catch_bp, throw_bp, internal); if (exc_bkpt_sp && additional_args) { @@ -604,9 +604,9 @@ bool Target::ProcessIsValid() { return (m_process_sp && m_process_sp->IsAlive()); } -static bool CheckIfWatchpointsExhausted(Target *target, Error &error) { +static bool CheckIfWatchpointsExhausted(Target *target, Status &error) { uint32_t num_supported_hardware_watchpoints; - Error rc = target->GetProcessSP()->GetWatchpointSupportInfo( + Status rc = target->GetProcessSP()->GetWatchpointSupportInfo( num_supported_hardware_watchpoints); if (num_supported_hardware_watchpoints == 0) { error.SetErrorStringWithFormat( @@ -621,7 +621,7 @@ static bool CheckIfWatchpointsExhausted(Target *target, Error &error) { // the OptionGroupWatchpoint::WatchType enum type. WatchpointSP Target::CreateWatchpoint(lldb::addr_t addr, size_t size, const CompilerType *type, uint32_t kind, - Error &error) { + Status &error) { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS)); if (log) log->Printf("Target::%s (addr = 0x%8.8" PRIx64 " size = %" PRIu64 @@ -797,10 +797,10 @@ bool Target::EnableBreakpointByID(break_id_t break_id) { return false; } -Error Target::SerializeBreakpointsToFile(const FileSpec &file, - const BreakpointIDList &bp_ids, - bool append) { - Error error; +Status Target::SerializeBreakpointsToFile(const FileSpec &file, + const BreakpointIDList &bp_ids, + bool append) { + Status error; if (!file) { error.SetErrorString("Invalid FileSpec."); @@ -891,19 +891,19 @@ Error Target::SerializeBreakpointsToFile(const FileSpec &file, return error; } -Error Target::CreateBreakpointsFromFile(const FileSpec &file, - BreakpointIDList &new_bps) { +Status Target::CreateBreakpointsFromFile(const FileSpec &file, + BreakpointIDList &new_bps) { std::vector<std::string> no_names; return CreateBreakpointsFromFile(file, no_names, new_bps); } -Error Target::CreateBreakpointsFromFile(const FileSpec &file, - std::vector<std::string> &names, - BreakpointIDList &new_bps) { +Status Target::CreateBreakpointsFromFile(const FileSpec &file, + std::vector<std::string> &names, + BreakpointIDList &new_bps) { std::unique_lock<std::recursive_mutex> lock; GetBreakpointList().GetListMutex(lock); - Error error; + Status error; StructuredData::ObjectSP input_data_sp = StructuredData::ParseJSONFromFile(file, error); if (!error.Success()) { @@ -979,7 +979,7 @@ bool Target::RemoveAllWatchpoints(bool end_to_end) { if (!wp_sp) return false; - Error rc = m_process_sp->DisableWatchpoint(wp_sp.get()); + Status rc = m_process_sp->DisableWatchpoint(wp_sp.get()); if (rc.Fail()) return false; } @@ -1011,7 +1011,7 @@ bool Target::DisableAllWatchpoints(bool end_to_end) { if (!wp_sp) return false; - Error rc = m_process_sp->DisableWatchpoint(wp_sp.get()); + Status rc = m_process_sp->DisableWatchpoint(wp_sp.get()); if (rc.Fail()) return false; } @@ -1041,7 +1041,7 @@ bool Target::EnableAllWatchpoints(bool end_to_end) { if (!wp_sp) return false; - Error rc = m_process_sp->EnableWatchpoint(wp_sp.get()); + Status rc = m_process_sp->EnableWatchpoint(wp_sp.get()); if (rc.Fail()) return false; } @@ -1114,7 +1114,7 @@ bool Target::DisableWatchpointByID(lldb::watch_id_t watch_id) { WatchpointSP wp_sp = m_watchpoint_list.FindByID(watch_id); if (wp_sp) { - Error rc = m_process_sp->DisableWatchpoint(wp_sp.get()); + Status rc = m_process_sp->DisableWatchpoint(wp_sp.get()); if (rc.Success()) return true; @@ -1134,7 +1134,7 @@ bool Target::EnableWatchpointByID(lldb::watch_id_t watch_id) { WatchpointSP wp_sp = m_watchpoint_list.FindByID(watch_id); if (wp_sp) { - Error rc = m_process_sp->EnableWatchpoint(wp_sp.get()); + Status rc = m_process_sp->EnableWatchpoint(wp_sp.get()); if (rc.Success()) return true; @@ -1198,7 +1198,7 @@ Module *Target::GetExecutableModulePointer() { static void LoadScriptingResourceForModule(const ModuleSP &module_sp, Target *target) { - Error error; + Status error; StreamString feedback_stream; if (module_sp && !module_sp->LoadScriptingResourceInTarget(target, error, @@ -1335,9 +1335,9 @@ bool Target::SetArchitecture(const ArchSpec &arch_spec) { arch_spec.GetArchitectureName(), arch_spec.GetTriple().getTriple().c_str()); ModuleSpec module_spec(executable_sp->GetFileSpec(), other); - Error error = ModuleList::GetSharedModule(module_spec, executable_sp, - &GetExecutableSearchPaths(), - nullptr, nullptr); + Status error = ModuleList::GetSharedModule(module_spec, executable_sp, + &GetExecutableSearchPaths(), + nullptr, nullptr); if (!error.Fail() && executable_sp) { SetExecutableModule(executable_sp, true); @@ -1474,7 +1474,7 @@ bool Target::ModuleIsExcludedForUnconstrainedSearches( } size_t Target::ReadMemoryFromFileCache(const Address &addr, void *dst, - size_t dst_len, Error &error) { + size_t dst_len, Status &error) { SectionSP section_sp(addr.GetSection()); if (section_sp) { // If the contents of this section are encrypted, the on-disk file is @@ -1506,7 +1506,7 @@ size_t Target::ReadMemoryFromFileCache(const Address &addr, void *dst, } size_t Target::ReadMemory(const Address &addr, bool prefer_file_cache, - void *dst, size_t dst_len, Error &error, + void *dst, size_t dst_len, Status &error, lldb::addr_t *load_addr_ptr) { error.Clear(); @@ -1598,7 +1598,7 @@ size_t Target::ReadMemory(const Address &addr, bool prefer_file_cache, } size_t Target::ReadCStringFromMemory(const Address &addr, std::string &out_str, - Error &error) { + Status &error) { char buf[256]; out_str.clear(); addr_t curr_addr = addr.GetLoadAddress(this); @@ -1620,13 +1620,13 @@ size_t Target::ReadCStringFromMemory(const Address &addr, std::string &out_str, } size_t Target::ReadCStringFromMemory(const Address &addr, char *dst, - size_t dst_max_len, Error &result_error) { + size_t dst_max_len, Status &result_error) { size_t total_cstr_len = 0; if (dst && dst_max_len) { result_error.Clear(); // NULL out everything just to be safe memset(dst, 0, dst_max_len); - Error error; + Status error; addr_t curr_addr = addr.GetLoadAddress(this); Address address(addr); @@ -1675,7 +1675,7 @@ size_t Target::ReadCStringFromMemory(const Address &addr, char *dst, size_t Target::ReadScalarIntegerFromMemory(const Address &addr, bool prefer_file_cache, uint32_t byte_size, bool is_signed, - Scalar &scalar, Error &error) { + Scalar &scalar, Status &error) { uint64_t uval; if (byte_size <= sizeof(uval)) { @@ -1705,7 +1705,7 @@ uint64_t Target::ReadUnsignedIntegerFromMemory(const Address &addr, bool prefer_file_cache, size_t integer_byte_size, uint64_t fail_value, - Error &error) { + Status &error) { Scalar scalar; if (ReadScalarIntegerFromMemory(addr, prefer_file_cache, integer_byte_size, false, scalar, error)) @@ -1714,7 +1714,7 @@ uint64_t Target::ReadUnsignedIntegerFromMemory(const Address &addr, } bool Target::ReadPointerFromMemory(const Address &addr, bool prefer_file_cache, - Error &error, Address &pointer_addr) { + Status &error, Address &pointer_addr) { Scalar scalar; if (ReadScalarIntegerFromMemory(addr, prefer_file_cache, m_arch.GetAddressByteSize(), false, scalar, @@ -1744,10 +1744,10 @@ bool Target::ReadPointerFromMemory(const Address &addr, bool prefer_file_cache, } ModuleSP Target::GetSharedModule(const ModuleSpec &module_spec, - Error *error_ptr) { + Status *error_ptr) { ModuleSP module_sp; - Error error; + Status error; // First see if we already have this module in our module list. If we do, // then we're done, we don't need @@ -1918,7 +1918,7 @@ void Target::ImageSearchPathsChanged(const PathMappingList &path_list, target->SetExecutableModule(exe_module_sp, true); } -TypeSystem *Target::GetScratchTypeSystemForLanguage(Error *error, +TypeSystem *Target::GetScratchTypeSystemForLanguage(Status *error, lldb::LanguageType language, bool create_on_demand) { if (!m_valid) @@ -1968,8 +1968,8 @@ Target::GetPersistentExpressionStateForLanguage(lldb::LanguageType language) { UserExpression *Target::GetUserExpressionForLanguage( llvm::StringRef expr, llvm::StringRef prefix, lldb::LanguageType language, Expression::ResultType desired_type, - const EvaluateExpressionOptions &options, Error &error) { - Error type_system_error; + const EvaluateExpressionOptions &options, Status &error) { + Status type_system_error; TypeSystem *type_system = GetScratchTypeSystemForLanguage(&type_system_error, language); @@ -1996,8 +1996,8 @@ UserExpression *Target::GetUserExpressionForLanguage( FunctionCaller *Target::GetFunctionCallerForLanguage( lldb::LanguageType language, const CompilerType &return_type, const Address &function_address, const ValueList &arg_value_list, - const char *name, Error &error) { - Error type_system_error; + const char *name, Status &error) { + Status type_system_error; TypeSystem *type_system = GetScratchTypeSystemForLanguage(&type_system_error, language); FunctionCaller *persistent_fn = nullptr; @@ -2023,8 +2023,8 @@ FunctionCaller *Target::GetFunctionCallerForLanguage( UtilityFunction * Target::GetUtilityFunctionForLanguage(const char *text, lldb::LanguageType language, - const char *name, Error &error) { - Error type_system_error; + const char *name, Status &error) { + Status type_system_error; TypeSystem *type_system = GetScratchTypeSystemForLanguage(&type_system_error, language); UtilityFunction *utility_fn = nullptr; @@ -2162,7 +2162,7 @@ ExpressionResults Target::EvaluateExpression( execution_results = eExpressionCompleted; } else { const char *prefix = GetExpressionPrefixContentsAsCString(); - Error error; + Status error; execution_results = UserExpression::Evaluate(exe_ctx, options, expr, prefix, result_valobj_sp, error, 0, // Line Number @@ -2653,8 +2653,8 @@ const TargetPropertiesSP &Target::GetGlobalProperties() { return *g_settings_sp_ptr; } -Error Target::Install(ProcessLaunchInfo *launch_info) { - Error error; +Status Target::Install(ProcessLaunchInfo *launch_info) { + Status error; PlatformSP platform_sp(GetPlatform()); if (platform_sp) { if (platform_sp->IsRemote()) { @@ -2784,8 +2784,8 @@ bool Target::SetSectionUnloaded(const lldb::SectionSP §ion_sp, void Target::ClearAllLoadedSections() { m_section_load_history.Clear(); } -Error Target::Launch(ProcessLaunchInfo &launch_info, Stream *stream) { - Error error; +Status Target::Launch(ProcessLaunchInfo &launch_info, Stream *stream) { + Status error; Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_TARGET)); if (log) @@ -2933,7 +2933,7 @@ Error Target::Launch(ProcessLaunchInfo &launch_info, Stream *stream) { error = m_process_sp->PrivateResume(); } if (!error.Success()) { - Error error2; + Status error2; error2.SetErrorStringWithFormat( "process resume at entry point failed: %s", error.AsCString()); error = error2; @@ -2971,7 +2971,7 @@ Error Target::Launch(ProcessLaunchInfo &launch_info, Stream *stream) { } m_process_sp->RestoreProcessEvents(); } else { - Error error2; + Status error2; error2.SetErrorStringWithFormat("process launch failed: %s", error.AsCString()); error = error2; @@ -2979,15 +2979,15 @@ Error Target::Launch(ProcessLaunchInfo &launch_info, Stream *stream) { return error; } -Error Target::Attach(ProcessAttachInfo &attach_info, Stream *stream) { +Status Target::Attach(ProcessAttachInfo &attach_info, Stream *stream) { auto state = eStateInvalid; auto process_sp = GetProcessSP(); if (process_sp) { state = process_sp->GetState(); if (process_sp->IsAlive() && state != eStateConnected) { if (state == eStateAttaching) - return Error("process attach is in progress"); - return Error("a process is already being debugged"); + return Status("process attach is in progress"); + return Status("a process is already being debugged"); } } @@ -3001,8 +3001,8 @@ Error Target::Attach(ProcessAttachInfo &attach_info, Stream *stream) { old_exec_module_sp->GetPlatformFileSpec().GetFilename(); if (!attach_info.ProcessInfoSpecified()) { - return Error("no process specified, create a target with a file, or " - "specify the --pid or --name"); + return Status("no process specified, create a target with a file, or " + "specify the --pid or --name"); } } @@ -3016,7 +3016,7 @@ Error Target::Attach(ProcessAttachInfo &attach_info, Stream *stream) { attach_info.SetHijackListener(hijack_listener_sp); } - Error error; + Status error; if (state != eStateConnected && platform_sp != nullptr && platform_sp->CanDebugProcess()) { SetPlatform(platform_sp); diff --git a/lldb/source/Target/TargetList.cpp b/lldb/source/Target/TargetList.cpp index 0849c18b89e..b5963afd5c6 100644 --- a/lldb/source/Target/TargetList.cpp +++ b/lldb/source/Target/TargetList.cpp @@ -55,33 +55,33 @@ TargetList::~TargetList() { m_target_list.clear(); } -Error TargetList::CreateTarget(Debugger &debugger, - llvm::StringRef user_exe_path, - llvm::StringRef triple_str, - bool get_dependent_files, - const OptionGroupPlatform *platform_options, - TargetSP &target_sp) { +Status TargetList::CreateTarget(Debugger &debugger, + llvm::StringRef user_exe_path, + llvm::StringRef triple_str, + bool get_dependent_files, + const OptionGroupPlatform *platform_options, + TargetSP &target_sp) { return CreateTargetInternal(debugger, user_exe_path, triple_str, get_dependent_files, platform_options, target_sp, false); } -Error TargetList::CreateTarget(Debugger &debugger, - llvm::StringRef user_exe_path, - const ArchSpec &specified_arch, - bool get_dependent_files, - PlatformSP &platform_sp, TargetSP &target_sp) { +Status TargetList::CreateTarget(Debugger &debugger, + llvm::StringRef user_exe_path, + const ArchSpec &specified_arch, + bool get_dependent_files, + PlatformSP &platform_sp, TargetSP &target_sp) { return CreateTargetInternal(debugger, user_exe_path, specified_arch, get_dependent_files, platform_sp, target_sp, false); } -Error TargetList::CreateTargetInternal( +Status TargetList::CreateTargetInternal( Debugger &debugger, llvm::StringRef user_exe_path, llvm::StringRef triple_str, bool get_dependent_files, const OptionGroupPlatform *platform_options, TargetSP &target_sp, bool is_dummy_target) { - Error error; + Status error; PlatformSP platform_sp; // This is purposely left empty unless it is specified by triple_cstr. @@ -302,34 +302,34 @@ lldb::TargetSP TargetList::GetDummyTarget(lldb_private::Debugger &debugger) { ArchSpec arch(Target::GetDefaultArchitecture()); if (!arch.IsValid()) arch = HostInfo::GetArchitecture(); - Error err = CreateDummyTarget( + Status err = CreateDummyTarget( debugger, arch.GetTriple().getTriple().c_str(), m_dummy_target_sp); } return m_dummy_target_sp; } -Error TargetList::CreateDummyTarget(Debugger &debugger, - llvm::StringRef specified_arch_name, - lldb::TargetSP &target_sp) { +Status TargetList::CreateDummyTarget(Debugger &debugger, + llvm::StringRef specified_arch_name, + lldb::TargetSP &target_sp) { PlatformSP host_platform_sp(Platform::GetHostPlatform()); return CreateTargetInternal( debugger, (const char *)nullptr, specified_arch_name, false, (const OptionGroupPlatform *)nullptr, target_sp, true); } -Error TargetList::CreateTargetInternal(Debugger &debugger, - llvm::StringRef user_exe_path, - const ArchSpec &specified_arch, - bool get_dependent_files, - lldb::PlatformSP &platform_sp, - lldb::TargetSP &target_sp, - bool is_dummy_target) { +Status TargetList::CreateTargetInternal(Debugger &debugger, + llvm::StringRef user_exe_path, + const ArchSpec &specified_arch, + bool get_dependent_files, + lldb::PlatformSP &platform_sp, + lldb::TargetSP &target_sp, + bool is_dummy_target) { Timer scoped_timer(LLVM_PRETTY_FUNCTION, "TargetList::CreateTarget (file = '%s', arch = '%s')", user_exe_path.str().c_str(), specified_arch.GetArchitectureName()); - Error error; + Status error; ArchSpec arch(specified_arch); diff --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp index 4b21382ff86..1759928c904 100644 --- a/lldb/source/Target/Thread.cpp +++ b/lldb/source/Target/Thread.cpp @@ -1335,8 +1335,8 @@ bool Thread::PlanIsBasePlan(ThreadPlan *plan_ptr) { return m_plan_stack[0].get() == plan_ptr; } -Error Thread::UnwindInnermostExpression() { - Error error; +Status Thread::UnwindInnermostExpression() { + Status error; int stack_size = m_plan_stack.size(); // If the input plan is nullptr, discard all plans. Otherwise make sure this @@ -1635,11 +1635,11 @@ lldb::StackFrameSP Thread::GetFrameWithConcreteFrameIndex(uint32_t unwind_idx) { return GetStackFrameList()->GetFrameWithConcreteFrameIndex(unwind_idx); } -Error Thread::ReturnFromFrameWithIndex(uint32_t frame_idx, - lldb::ValueObjectSP return_value_sp, - bool broadcast) { +Status Thread::ReturnFromFrameWithIndex(uint32_t frame_idx, + lldb::ValueObjectSP return_value_sp, + bool broadcast) { StackFrameSP frame_sp = GetStackFrameAtIndex(frame_idx); - Error return_error; + Status return_error; if (!frame_sp) { return_error.SetErrorStringWithFormat( @@ -1650,10 +1650,10 @@ Error Thread::ReturnFromFrameWithIndex(uint32_t frame_idx, return ReturnFromFrame(frame_sp, return_value_sp, broadcast); } -Error Thread::ReturnFromFrame(lldb::StackFrameSP frame_sp, - lldb::ValueObjectSP return_value_sp, - bool broadcast) { - Error return_error; +Status Thread::ReturnFromFrame(lldb::StackFrameSP frame_sp, + lldb::ValueObjectSP return_value_sp, + bool broadcast) { + Status return_error; if (!frame_sp) { return_error.SetErrorString("Can't return to a null frame."); @@ -1740,8 +1740,8 @@ static void DumpAddressList(Stream &s, const std::vector<Address> &list, } } -Error Thread::JumpToLine(const FileSpec &file, uint32_t line, - bool can_leave_function, std::string *warnings) { +Status Thread::JumpToLine(const FileSpec &file, uint32_t line, + bool can_leave_function, std::string *warnings) { ExecutionContext exe_ctx(GetStackFrameAtIndex(0)); Target *target = exe_ctx.GetTargetPtr(); TargetSP target_sp = exe_ctx.GetTargetSP(); @@ -1769,16 +1769,16 @@ Error Thread::JumpToLine(const FileSpec &file, uint32_t line, // Check if we got anything. if (candidates.empty()) { if (outside_function.empty()) { - return Error("Cannot locate an address for %s:%i.", - file.GetFilename().AsCString(), line); + return Status("Cannot locate an address for %s:%i.", + file.GetFilename().AsCString(), line); } else if (outside_function.size() == 1) { - return Error("%s:%i is outside the current function.", - file.GetFilename().AsCString(), line); + return Status("%s:%i is outside the current function.", + file.GetFilename().AsCString(), line); } else { StreamString sstr; DumpAddressList(sstr, outside_function, target); - return Error("%s:%i has multiple candidate locations:\n%s", - file.GetFilename().AsCString(), line, sstr.GetData()); + return Status("%s:%i has multiple candidate locations:\n%s", + file.GetFilename().AsCString(), line, sstr.GetData()); } } @@ -1794,9 +1794,9 @@ Error Thread::JumpToLine(const FileSpec &file, uint32_t line, } if (!reg_ctx->SetPC(dest)) - return Error("Cannot change PC to target address."); + return Status("Cannot change PC to target address."); - return Error(); + return Status(); } void Thread::DumpUsingSettingsFormat(Stream &strm, uint32_t frame_idx, @@ -2117,12 +2117,12 @@ bool Thread::IsStillAtLastBreakpointHit() { return false; } -Error Thread::StepIn(bool source_step, - LazyBool step_in_avoids_code_without_debug_info, - LazyBool step_out_avoids_code_without_debug_info) +Status Thread::StepIn(bool source_step, + LazyBool step_in_avoids_code_without_debug_info, + LazyBool step_out_avoids_code_without_debug_info) { - Error error; + Status error; Process *process = GetProcess().get(); if (StateIsStoppedState(process->GetState(), true)) { StackFrameSP frame_sp = GetStackFrameAtIndex(0); @@ -2153,9 +2153,9 @@ Error Thread::StepIn(bool source_step, return error; } -Error Thread::StepOver(bool source_step, - LazyBool step_out_avoids_code_without_debug_info) { - Error error; +Status Thread::StepOver(bool source_step, + LazyBool step_out_avoids_code_without_debug_info) { + Status error; Process *process = GetProcess().get(); if (StateIsStoppedState(process->GetState(), true)) { StackFrameSP frame_sp = GetStackFrameAtIndex(0); @@ -2186,8 +2186,8 @@ Error Thread::StepOver(bool source_step, return error; } -Error Thread::StepOut() { - Error error; +Status Thread::StepOut() { + Status error; Process *process = GetProcess().get(); if (StateIsStoppedState(process->GetState(), true)) { const bool first_instruction = false; diff --git a/lldb/source/Target/ThreadPlanCallFunction.cpp b/lldb/source/Target/ThreadPlanCallFunction.cpp index 2c630d59e84..e3b9ae15dc9 100644 --- a/lldb/source/Target/ThreadPlanCallFunction.cpp +++ b/lldb/source/Target/ThreadPlanCallFunction.cpp @@ -58,7 +58,7 @@ bool ThreadPlanCallFunction::ConstructorSetup( // If we can't read memory at the point of the process where we are planning // to put our function, we're // not going to get any further... - Error error; + Status error; process_sp->ReadUnsignedIntegerFromMemory(m_function_sp, 4, 0, error); if (!error.Success()) { m_constructor_errors.Printf( diff --git a/lldb/source/Target/ThreadPlanTracer.cpp b/lldb/source/Target/ThreadPlanTracer.cpp index f8368123a0c..014c7fd2797 100644 --- a/lldb/source/Target/ThreadPlanTracer.cpp +++ b/lldb/source/Target/ThreadPlanTracer.cpp @@ -145,7 +145,7 @@ void ThreadPlanAssemblyTracer::Log() { Disassembler *disassembler = GetDisassembler(); if (disassembler) { - Error err; + Status err; process_sp->ReadMemory(pc, buffer, sizeof(buffer), err); if (err.Success()) { diff --git a/lldb/source/Target/ThreadSpec.cpp b/lldb/source/Target/ThreadSpec.cpp index c7eec078612..ba77edd1f31 100644 --- a/lldb/source/Target/ThreadSpec.cpp +++ b/lldb/source/Target/ThreadSpec.cpp @@ -39,7 +39,7 @@ const ThreadSpec &ThreadSpec::operator=(const ThreadSpec &rhs) { } std::unique_ptr<ThreadSpec> ThreadSpec::CreateFromStructuredData( - const StructuredData::Dictionary &spec_dict, Error &error) { + const StructuredData::Dictionary &spec_dict, Status &error) { uint32_t index = UINT32_MAX; lldb::tid_t tid = LLDB_INVALID_THREAD_ID; std::string name; diff --git a/lldb/source/Utility/CMakeLists.txt b/lldb/source/Utility/CMakeLists.txt index d4e8e361017..a1675670f0b 100644 --- a/lldb/source/Utility/CMakeLists.txt +++ b/lldb/source/Utility/CMakeLists.txt @@ -5,7 +5,6 @@ add_lldb_library(lldbUtility DataBufferLLVM.cpp DataEncoder.cpp DataExtractor.cpp - Error.cpp FastDemangle.cpp FileSpec.cpp History.cpp @@ -18,6 +17,7 @@ add_lldb_library(lldbUtility RegularExpression.cpp SelectHelper.cpp SharingPtr.cpp + Status.cpp Stream.cpp StreamCallback.cpp StreamGDBRemote.cpp diff --git a/lldb/source/Utility/JSON.cpp b/lldb/source/Utility/JSON.cpp index d20d9e46fef..cb23f140cbf 100644 --- a/lldb/source/Utility/JSON.cpp +++ b/lldb/source/Utility/JSON.cpp @@ -246,7 +246,7 @@ JSONParser::Token JSONParser::GetToken(std::string &value) { "error: an error occurred getting a character from offset %" PRIu64, start_index); value = std::move(error.GetString()); - return Token::Error; + return Token::Status; } else { const bool is_end_quote = escaped_ch == '"'; @@ -259,13 +259,13 @@ JSONParser::Token JSONParser::GetToken(std::string &value) { "character 0x%4.4x at offset %" PRIu64, escaped_ch, start_index); value = std::move(error.GetString()); - return Token::Error; + return Token::Status; } } else if (is_end_quote) { return Token::String; } else if (is_null) { value = "error: missing end quote for string"; - return Token::Error; + return Token::Status; } } } @@ -316,7 +316,7 @@ JSONParser::Token JSONParser::GetToken(std::string &value) { error.Printf("error: extra decimal point found at offset %" PRIu64, start_index); value = std::move(error.GetString()); - return Token::Error; + return Token::Status; } else { got_decimal_point = true; ++m_index; // Skip this character @@ -330,7 +330,7 @@ JSONParser::Token JSONParser::GetToken(std::string &value) { "error: extra exponent character found at offset %" PRIu64, start_index); value = std::move(error.GetString()); - return Token::Error; + return Token::Status; } else { exp_index = m_index; ++m_index; // Skip this character @@ -346,7 +346,7 @@ JSONParser::Token JSONParser::GetToken(std::string &value) { error.Printf("error: unexpected %c character at offset %" PRIu64, next_ch, start_index); value = std::move(error.GetString()); - return Token::Error; + return Token::Status; } break; @@ -368,7 +368,7 @@ JSONParser::Token JSONParser::GetToken(std::string &value) { "at offset in float value \"%s\"", value.c_str()); value = std::move(error.GetString()); - return Token::Error; + return Token::Status; } } else { // No exponent, but we need at least one decimal after the decimal @@ -379,7 +379,7 @@ JSONParser::Token JSONParser::GetToken(std::string &value) { error.Printf("error: no digits after decimal point \"%s\"", value.c_str()); value = std::move(error.GetString()); - return Token::Error; + return Token::Status; } } } else { @@ -390,14 +390,14 @@ JSONParser::Token JSONParser::GetToken(std::string &value) { } else { error.Printf("error: no digits negate sign \"%s\"", value.c_str()); value = std::move(error.GetString()); - return Token::Error; + return Token::Status; } } } else { error.Printf("error: invalid number found at offset %" PRIu64, start_index); value = std::move(error.GetString()); - return Token::Error; + return Token::Status; } } break; default: @@ -407,7 +407,7 @@ JSONParser::Token JSONParser::GetToken(std::string &value) { " (around character '%c')", start_index, ch); value = std::move(error.GetString()); - return Token::Error; + return Token::Status; } int JSONParser::GetEscapedChar(bool &was_escaped) { diff --git a/lldb/source/Utility/SelectHelper.cpp b/lldb/source/Utility/SelectHelper.cpp index 7b0557ea192..a46213f8bfc 100644 --- a/lldb/source/Utility/SelectHelper.cpp +++ b/lldb/source/Utility/SelectHelper.cpp @@ -15,8 +15,8 @@ #endif #include "lldb/Utility/SelectHelper.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/LLDBAssert.h" +#include "lldb/Utility/Status.h" #include "lldb/lldb-enumerations.h" // for ErrorType::eErrorTypePOSIX #include "lldb/lldb-types.h" // for socket_t @@ -90,14 +90,14 @@ static void updateMaxFd(llvm::Optional<lldb::socket_t> &vold, vold = std::max(*vold, vnew); } -lldb_private::Error SelectHelper::Select() { - lldb_private::Error error; +lldb_private::Status SelectHelper::Select() { + lldb_private::Status error; #ifdef _MSC_VER // On windows FD_SETSIZE limits the number of file descriptors, not their // numeric value. lldbassert(m_fd_map.size() <= FD_SETSIZE); if (m_fd_map.size() > FD_SETSIZE) - return lldb_private::Error("Too many file descriptors for select()"); + return lldb_private::Status("Too many file descriptors for select()"); #endif llvm::Optional<lldb::socket_t> max_read_fd; diff --git a/lldb/source/Utility/Error.cpp b/lldb/source/Utility/Status.cpp index b21ee57b61a..5996be1e4e0 100644 --- a/lldb/source/Utility/Error.cpp +++ b/lldb/source/Utility/Status.cpp @@ -1,4 +1,5 @@ -//===-- Error.cpp -----------------------------------------------*- C++ -*-===// +//===-- Status.cpp -----------------------------------------------*- C++ +//-*-===// // // The LLVM Compiler Infrastructure // @@ -7,7 +8,7 @@ // //===----------------------------------------------------------------------===// -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/VASPrintf.h" #include "lldb/lldb-defines.h" // for LLDB_GENERIC_ERROR @@ -35,18 +36,18 @@ class raw_ostream; using namespace lldb; using namespace lldb_private; -Error::Error() : m_code(0), m_type(eErrorTypeInvalid), m_string() {} +Status::Status() : m_code(0), m_type(eErrorTypeInvalid), m_string() {} -Error::Error(ValueType err, ErrorType type) +Status::Status(ValueType err, ErrorType type) : m_code(err), m_type(type), m_string() {} -Error::Error(std::error_code EC) +Status::Status(std::error_code EC) : m_code(EC.value()), m_type(ErrorType::eErrorTypeGeneric), m_string(EC.message()) {} -Error::Error(const Error &rhs) = default; +Status::Status(const Status &rhs) = default; -Error::Error(const char *format, ...) +Status::Status(const char *format, ...) : m_code(0), m_type(eErrorTypeInvalid), m_string() { va_list args; va_start(args, format); @@ -58,7 +59,7 @@ Error::Error(const char *format, ...) //---------------------------------------------------------------------- // Assignment operator //---------------------------------------------------------------------- -const Error &Error::operator=(const Error &rhs) { +const Status &Status::operator=(const Status &rhs) { if (this != &rhs) { m_code = rhs.m_code; m_type = rhs.m_type; @@ -70,21 +71,21 @@ const Error &Error::operator=(const Error &rhs) { //---------------------------------------------------------------------- // Assignment operator //---------------------------------------------------------------------- -const Error &Error::operator=(uint32_t err) { +const Status &Status::operator=(uint32_t err) { m_code = err; m_type = eErrorTypeMachKernel; m_string.clear(); return *this; } -Error::~Error() = default; +Status::~Status() = default; //---------------------------------------------------------------------- // Get the error value as a NULL C string. The error string will be // fetched and cached on demand. The cached error string value will // remain until the error value is changed or cleared. //---------------------------------------------------------------------- -const char *Error::AsCString(const char *default_error_str) const { +const char *Status::AsCString(const char *default_error_str) const { if (Success()) return nullptr; @@ -119,7 +120,7 @@ const char *Error::AsCString(const char *default_error_str) const { //---------------------------------------------------------------------- // Clear the error and any cached error string that it might contain. //---------------------------------------------------------------------- -void Error::Clear() { +void Status::Clear() { m_code = 0; m_type = eErrorTypeInvalid; m_string.clear(); @@ -128,38 +129,38 @@ void Error::Clear() { //---------------------------------------------------------------------- // Access the error value. //---------------------------------------------------------------------- -Error::ValueType Error::GetError() const { return m_code; } +Status::ValueType Status::GetError() const { return m_code; } //---------------------------------------------------------------------- // Access the error type. //---------------------------------------------------------------------- -ErrorType Error::GetType() const { return m_type; } +ErrorType Status::GetType() const { return m_type; } //---------------------------------------------------------------------- // Returns true if this object contains a value that describes an // error or otherwise non-success result. //---------------------------------------------------------------------- -bool Error::Fail() const { return m_code != 0; } +bool Status::Fail() const { return m_code != 0; } //---------------------------------------------------------------------- // Set accesssor for the error value to "err" and the type to // "eErrorTypeMachKernel" //---------------------------------------------------------------------- -void Error::SetMachError(uint32_t err) { +void Status::SetMachError(uint32_t err) { m_code = err; m_type = eErrorTypeMachKernel; m_string.clear(); } -void Error::SetExpressionError(lldb::ExpressionResults result, - const char *mssg) { +void Status::SetExpressionError(lldb::ExpressionResults result, + const char *mssg) { m_code = result; m_type = eErrorTypeExpression; m_string = mssg; } -int Error::SetExpressionErrorWithFormat(lldb::ExpressionResults result, - const char *format, ...) { +int Status::SetExpressionErrorWithFormat(lldb::ExpressionResults result, + const char *format, ...) { int length = 0; if (format != nullptr && format[0]) { @@ -178,7 +179,7 @@ int Error::SetExpressionErrorWithFormat(lldb::ExpressionResults result, //---------------------------------------------------------------------- // Set accesssor for the error value and type. //---------------------------------------------------------------------- -void Error::SetError(ValueType err, ErrorType type) { +void Status::SetError(ValueType err, ErrorType type) { m_code = err; m_type = type; m_string.clear(); @@ -188,7 +189,7 @@ void Error::SetError(ValueType err, ErrorType type) { // Update the error value to be "errno" and update the type to // be "POSIX". //---------------------------------------------------------------------- -void Error::SetErrorToErrno() { +void Status::SetErrorToErrno() { m_code = errno; m_type = eErrorTypePOSIX; m_string.clear(); @@ -198,7 +199,7 @@ void Error::SetErrorToErrno() { // Update the error value to be LLDB_GENERIC_ERROR and update the type // to be "Generic". //---------------------------------------------------------------------- -void Error::SetErrorToGenericError() { +void Status::SetErrorToGenericError() { m_code = LLDB_GENERIC_ERROR; m_type = eErrorTypeGeneric; m_string.clear(); @@ -210,7 +211,7 @@ void Error::SetErrorToGenericError() { // The error string value will remain until the error value is // cleared or a new error value/type is assigned. //---------------------------------------------------------------------- -void Error::SetErrorString(llvm::StringRef err_str) { +void Status::SetErrorString(llvm::StringRef err_str) { if (!err_str.empty()) { // If we have an error string, we should always at least have an error // set to a generic value. @@ -226,7 +227,7 @@ void Error::SetErrorString(llvm::StringRef err_str) { /// @param format /// A printf style format string //------------------------------------------------------------------ -int Error::SetErrorStringWithFormat(const char *format, ...) { +int Status::SetErrorStringWithFormat(const char *format, ...) { if (format != nullptr && format[0]) { va_list args; va_start(args, format); @@ -239,7 +240,7 @@ int Error::SetErrorStringWithFormat(const char *format, ...) { return 0; } -int Error::SetErrorStringWithVarArg(const char *format, va_list args) { +int Status::SetErrorStringWithVarArg(const char *format, va_list args) { if (format != nullptr && format[0]) { // If we have an error string, we should always at least have // an error set to a generic value. @@ -260,14 +261,14 @@ int Error::SetErrorStringWithVarArg(const char *format, va_list args) { // Returns true if the error code in this object is considered a // successful return value. //---------------------------------------------------------------------- -bool Error::Success() const { return m_code == 0; } +bool Status::Success() const { return m_code == 0; } -bool Error::WasInterrupted() const { +bool Status::WasInterrupted() const { return (m_type == eErrorTypePOSIX && m_code == EINTR); } -void llvm::format_provider<lldb_private::Error>::format( - const lldb_private::Error &error, llvm::raw_ostream &OS, +void llvm::format_provider<lldb_private::Status>::format( + const lldb_private::Status &error, llvm::raw_ostream &OS, llvm::StringRef Options) { llvm::format_provider<llvm::StringRef>::format(error.AsCString(), OS, Options); diff --git a/lldb/tools/debugserver/source/DNBError.h b/lldb/tools/debugserver/source/DNBError.h index edca38ad6db..419f4b9492e 100644 --- a/lldb/tools/debugserver/source/DNBError.h +++ b/lldb/tools/debugserver/source/DNBError.h @@ -49,7 +49,7 @@ public: m_flavor = Generic; m_str.clear(); } - ValueType Error() const { return m_err; } + ValueType Status() const { return m_err; } FlavorType Flavor() const { return m_flavor; } ValueType operator=(kern_return_t err) { diff --git a/lldb/tools/debugserver/source/JSON.cpp b/lldb/tools/debugserver/source/JSON.cpp index 19ebfd000f5..c914f2498f0 100644 --- a/lldb/tools/debugserver/source/JSON.cpp +++ b/lldb/tools/debugserver/source/JSON.cpp @@ -282,7 +282,7 @@ JSONParser::Token JSONParser::GetToken(std::string &value) { error << "error: an error occurred getting a character from offset " << start_index; value = error.str(); - return Token::Error; + return Token::Status; } else { const bool is_end_quote = escaped_ch == '"'; @@ -296,13 +296,13 @@ JSONParser::Token JSONParser::GetToken(std::string &value) { << std::setprecision(4) << std::hex << escaped_ch; error << " at offset " << start_index; value = error.str(); - return Token::Error; + return Token::Status; } } else if (is_end_quote) { return Token::String; } else if (is_null) { value = "error: missing end quote for string"; - return Token::Error; + return Token::Status; } } } @@ -352,7 +352,7 @@ JSONParser::Token JSONParser::GetToken(std::string &value) { if (got_decimal_point) { error << "error: extra decimal point found at offset " << start_index; value = error.str(); - return Token::Error; + return Token::Status; } else { got_decimal_point = true; ++m_index; // Skip this character @@ -365,7 +365,7 @@ JSONParser::Token JSONParser::GetToken(std::string &value) { error << "error: extra exponent character found at offset " << start_index; value = error.str(); - return Token::Error; + return Token::Status; } else { exp_index = m_index; ++m_index; // Skip this character @@ -381,7 +381,7 @@ JSONParser::Token JSONParser::GetToken(std::string &value) { error << "error: unexpected " << next_ch << " character at offset " << start_index; value = error.str(); - return Token::Error; + return Token::Status; } break; @@ -403,7 +403,7 @@ JSONParser::Token JSONParser::GetToken(std::string &value) { "offset in float value \"" << value.c_str() << "\""; value = error.str(); - return Token::Error; + return Token::Status; } } else { // No exponent, but we need at least one decimal after the decimal @@ -414,7 +414,7 @@ JSONParser::Token JSONParser::GetToken(std::string &value) { error << "error: no digits after decimal point \"" << value.c_str() << "\""; value = error.str(); - return Token::Error; + return Token::Status; } } } else { @@ -425,13 +425,13 @@ JSONParser::Token JSONParser::GetToken(std::string &value) { } else { error << "error: no digits negate sign \"" << value.c_str() << "\""; value = error.str(); - return Token::Error; + return Token::Status; } } } else { error << "error: invalid number found at offset " << start_index; value = error.str(); - return Token::Error; + return Token::Status; } } break; default: @@ -440,7 +440,7 @@ JSONParser::Token JSONParser::GetToken(std::string &value) { error << "error: failed to parse token at offset " << start_index << " (around character '" << ch << "')"; value = error.str(); - return Token::Error; + return Token::Status; } int JSONParser::GetEscapedChar(bool &was_escaped) { diff --git a/lldb/tools/debugserver/source/JSON.h b/lldb/tools/debugserver/source/JSON.h index eee62f45332..252ff021f91 100644 --- a/lldb/tools/debugserver/source/JSON.h +++ b/lldb/tools/debugserver/source/JSON.h @@ -270,7 +270,7 @@ class JSONParser : public StdStringExtractor { public: enum Token { Invalid, - Error, + Status, ObjectStart, ObjectEnd, ArrayStart, diff --git a/lldb/tools/debugserver/source/MacOSX/MachException.cpp b/lldb/tools/debugserver/source/MacOSX/MachException.cpp index f6e778232b8..5f085867db2 100644 --- a/lldb/tools/debugserver/source/MacOSX/MachException.cpp +++ b/lldb/tools/debugserver/source/MacOSX/MachException.cpp @@ -267,7 +267,7 @@ kern_return_t MachException::Message::Receive(mach_port_t port, exc_msg.hdr.msgh_reserved, exc_msg.hdr.msgh_id, options, 0, sizeof(exc_msg.data), port, mach_msg_timeout, notify_port); } - return err.Error(); + return err.Status(); } bool MachException::Message::CatchExceptionRaise(task_t task) { @@ -349,7 +349,7 @@ kern_return_t MachException::Message::Reply(MachProcess *process, int signal) { MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); if (err.Fail()) { - if (err.Error() == MACH_SEND_INTERRUPTED) { + if (err.Status() == MACH_SEND_INTERRUPTED) { if (DNBLogCheckLogBit(LOG_EXCEPTIONS)) err.LogThreaded("::mach_msg() - send interrupted"); // TODO: keep retrying to reply??? @@ -357,7 +357,7 @@ kern_return_t MachException::Message::Reply(MachProcess *process, int signal) { if (state.task_port == process->Task().TaskPort()) { DNBLogThreaded("error: mach_msg() returned an error when replying to a " "mach exception: error = %u", - err.Error()); + err.Status()); } else { if (DNBLogCheckLogBit(LOG_EXCEPTIONS)) err.LogThreaded("::mach_msg() - failed (child of task)"); @@ -365,7 +365,7 @@ kern_return_t MachException::Message::Reply(MachProcess *process, int signal) { } } - return err.Error(); + return err.Status(); } void MachException::Data::Dump() const { @@ -430,7 +430,7 @@ kern_return_t MachException::PortInfo::Save(task_t task) { "maskCnt => %u, ports, behaviors, flavors )", task, mask, count); - if (err.Error() == KERN_INVALID_ARGUMENT && mask != PREV_EXC_MASK_ALL) { + if (err.Status() == KERN_INVALID_ARGUMENT && mask != PREV_EXC_MASK_ALL) { mask = PREV_EXC_MASK_ALL; count = (sizeof(ports) / sizeof(ports[0])); err = ::task_get_exception_ports(task, mask, masks, &count, ports, @@ -444,7 +444,7 @@ kern_return_t MachException::PortInfo::Save(task_t task) { mask = 0; count = 0; } - return err.Error(); + return err.Status(); } kern_return_t MachException::PortInfo::Restore(task_t task) { @@ -469,7 +469,7 @@ kern_return_t MachException::PortInfo::Restore(task_t task) { } } count = 0; - return err.Error(); + return err.Status(); } const char *MachException::Name(exception_type_t exc_type) { diff --git a/lldb/tools/debugserver/source/MacOSX/MachProcess.mm b/lldb/tools/debugserver/source/MacOSX/MachProcess.mm index 0daaca1db37..a93f724849b 100644 --- a/lldb/tools/debugserver/source/MacOSX/MachProcess.mm +++ b/lldb/tools/debugserver/source/MacOSX/MachProcess.mm @@ -1215,7 +1215,7 @@ bool MachProcess::Kill(const struct timespec *timeout_abstime) { err.SetErrorToErrno(); DNBLogThreadedIf(LOG_PROCESS, "MachProcess::Kill() DoSIGSTOP() ::ptrace " "(PT_KILL, pid=%u, 0, 0) => 0x%8.8x (%s)", - m_pid, err.Error(), err.AsString()); + m_pid, err.Status(), err.AsString()); m_thread_actions = DNBThreadResumeActions(eStateRunning, 0); PrivateResume(); @@ -2970,7 +2970,8 @@ pid_t MachProcess::LaunchForDebug( DNBError ptrace_err(errno, DNBError::POSIX); DNBLogThreadedIf(LOG_PROCESS, "error: failed to attach to spawned pid " "%d (err = %i, errno = %i (%s))", - m_pid, err, ptrace_err.Error(), ptrace_err.AsString()); + m_pid, err, ptrace_err.Status(), + ptrace_err.AsString()); launch_err.SetError(NUB_GENERIC_ERROR, DNBError::Generic); } } else { @@ -3181,7 +3182,7 @@ pid_t MachProcess::ForkChildForPTraceDebugging(const char *path, char const *envp[], MachProcess *process, DNBError &launch_err) { - PseudoTerminal::Error pty_error = PseudoTerminal::success; + PseudoTerminal::Status pty_error = PseudoTerminal::success; // Use a fork that ties the child process's stdin/out/err to a pseudo // terminal so we can read it in our MachProcess::STDIOThread @@ -3191,7 +3192,7 @@ pid_t MachProcess::ForkChildForPTraceDebugging(const char *path, if (pid < 0) { //-------------------------------------------------------------- - // Error during fork. + // Status during fork. //-------------------------------------------------------------- return pid; } else if (pid == 0) { @@ -3406,7 +3407,7 @@ pid_t MachProcess::SBForkChildForPTraceDebugging( PseudoTerminal pty; if (!no_stdio) { - PseudoTerminal::Error pty_err = + PseudoTerminal::Status pty_err = pty.OpenFirstAvailableMaster(O_RDWR | O_NOCTTY); if (pty_err == PseudoTerminal::success) { const char *slave_name = pty.SlaveName(); @@ -3607,7 +3608,7 @@ pid_t MachProcess::BoardServiceForkChildForPTraceDebugging( PseudoTerminal pty; if (!no_stdio) { - PseudoTerminal::Error pty_err = + PseudoTerminal::Status pty_err = pty.OpenFirstAvailableMaster(O_RDWR | O_NOCTTY); if (pty_err == PseudoTerminal::success) { const char *slave_name = pty.SlaveName(); diff --git a/lldb/tools/debugserver/source/MacOSX/MachTask.mm b/lldb/tools/debugserver/source/MacOSX/MachTask.mm index 37897a5a6ac..bd7047ecdff 100644 --- a/lldb/tools/debugserver/source/MacOSX/MachTask.mm +++ b/lldb/tools/debugserver/source/MacOSX/MachTask.mm @@ -88,7 +88,7 @@ kern_return_t MachTask::Suspend() { err = ::task_suspend(task); if (DNBLogCheckLogBit(LOG_TASK) || err.Fail()) err.LogThreaded("::task_suspend ( target_task = 0x%4.4x )", task); - return err.Error(); + return err.Status(); } //---------------------------------------------------------------------- @@ -113,7 +113,7 @@ kern_return_t MachTask::Resume() { err.LogThreaded("::task_resume ( target_task = 0x%4.4x )", task); } } - return err.Error(); + return err.Status(); } //---------------------------------------------------------------------- @@ -531,7 +531,7 @@ task_t MachTask::TaskPortForProcessID(pid_t pid, DNBError &err, char str[1024]; ::snprintf(str, sizeof(str), "::task_for_pid ( target_tport = 0x%4.4x, " "pid = %d, &task ) => err = 0x%8.8x (%s)", - task_self, pid, err.Error(), + task_self, pid, err.Status(), err.AsString() ? err.AsString() : "success"); if (err.Fail()) err.SetErrorString(str); @@ -583,7 +583,7 @@ kern_return_t MachTask::BasicInfo(task_t task, struct task_basic_info *info) { info->suspend_count, (uint64_t)info->virtual_size, (uint64_t)info->resident_size, user, system); } - return err.Error(); + return err.Status(); } //---------------------------------------------------------------------- @@ -687,7 +687,7 @@ kern_return_t MachTask::ShutDownExcecptionThread() { err.LogThreaded("::mach_port_deallocate ( task = 0x%4.4x, name = 0x%4.4x )", task_self, exception_port); - return err.Error(); + return err.Status(); } void *MachTask::ExceptionThread(void *arg) { @@ -805,7 +805,7 @@ void *MachTask::ExceptionThread(void *arg) { MACH_RCV_MSG | MACH_RCV_INTERRUPT, 0); } - if (err.Error() == MACH_RCV_INTERRUPTED) { + if (err.Status() == MACH_RCV_INTERRUPTED) { // If we have no task port we should exit this thread if (!mach_task->ExceptionPortIsValid()) { DNBLogThreadedIf(LOG_EXCEPTIONS, "thread cancelled..."); @@ -824,7 +824,7 @@ void *MachTask::ExceptionThread(void *arg) { // Our task has died, exit the thread. break; } - } else if (err.Error() == MACH_RCV_TIMED_OUT) { + } else if (err.Status() == MACH_RCV_TIMED_OUT) { if (num_exceptions_received > 0) { // We were receiving all current exceptions with a timeout of zero // it is time to go back to our normal looping mode @@ -860,7 +860,7 @@ void *MachTask::ExceptionThread(void *arg) { } } #endif - } else if (err.Error() != KERN_SUCCESS) { + } else if (err.Status() != KERN_SUCCESS) { DNBLogThreadedIf(LOG_EXCEPTIONS, "got some other error, do something " "about it??? nah, continuing for " "now..."); @@ -947,7 +947,7 @@ nub_addr_t MachTask::AllocateMemory(size_t size, uint32_t permissions) { DNBError err; err = ::mach_vm_allocate(task, &addr, size, TRUE); - if (err.Error() == KERN_SUCCESS) { + if (err.Status() == KERN_SUCCESS) { // Set the protections: vm_prot_t mach_prot = VM_PROT_NONE; if (permissions & eMemoryPermissionsReadable) @@ -958,7 +958,7 @@ nub_addr_t MachTask::AllocateMemory(size_t size, uint32_t permissions) { mach_prot |= VM_PROT_EXECUTE; err = ::mach_vm_protect(task, addr, size, 0, mach_prot); - if (err.Error() == KERN_SUCCESS) { + if (err.Status() == KERN_SUCCESS) { m_allocations.insert(std::make_pair(addr, size)); return addr; } diff --git a/lldb/tools/debugserver/source/MacOSX/MachThreadList.cpp b/lldb/tools/debugserver/source/MacOSX/MachThreadList.cpp index cf0e205b349..05e9627b591 100644 --- a/lldb/tools/debugserver/source/MacOSX/MachThreadList.cpp +++ b/lldb/tools/debugserver/source/MacOSX/MachThreadList.cpp @@ -294,7 +294,7 @@ MachThreadList::UpdateThreadList(MachProcess *process, bool update, "thread_list_count => %u )", task, thread_list, thread_list_count); - if (err.Error() == KERN_SUCCESS && thread_list_count > 0) { + if (err.Status() == KERN_SUCCESS && thread_list_count > 0) { MachThreadList::collection currThreads; size_t idx; // Iterator through the current thread list and see which threads diff --git a/lldb/tools/debugserver/source/MacOSX/MachVMMemory.cpp b/lldb/tools/debugserver/source/MacOSX/MachVMMemory.cpp index 76806ab1cc1..12f16ccb9f5 100644 --- a/lldb/tools/debugserver/source/MacOSX/MachVMMemory.cpp +++ b/lldb/tools/debugserver/source/MacOSX/MachVMMemory.cpp @@ -501,7 +501,7 @@ nub_size_t MachVMMemory::Write(task_t task, nub_addr_t address, nub_size_t bytes_written = WriteRegion(task, curr_addr, curr_data, curr_data_count); if (bytes_written <= 0) { - // Error should have already be posted by WriteRegion... + // Status should have already be posted by WriteRegion... break; } else { total_bytes_written += bytes_written; diff --git a/lldb/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp b/lldb/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp index 175aab1ae3f..2841ddb1108 100644 --- a/lldb/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp +++ b/lldb/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp @@ -696,14 +696,14 @@ kern_return_t DNBArchMachARM::EnableHardwareSingleStep(bool enable) { if (err.Fail()) { err.LogThreaded("%s: failed to read the GPR registers", __FUNCTION__); - return err.Error(); + return err.Status(); } err = GetDBGState(false); if (err.Fail()) { err.LogThreaded("%s: failed to read the DBG registers", __FUNCTION__); - return err.Error(); + return err.Status(); } // The use of __arm64__ here is not ideal. If debugserver is running on diff --git a/lldb/tools/debugserver/source/MacOSX/arm64/DNBArchImplARM64.cpp b/lldb/tools/debugserver/source/MacOSX/arm64/DNBArchImplARM64.cpp index 7d04170623d..51bc5aaee5b 100644 --- a/lldb/tools/debugserver/source/MacOSX/arm64/DNBArchImplARM64.cpp +++ b/lldb/tools/debugserver/source/MacOSX/arm64/DNBArchImplARM64.cpp @@ -546,14 +546,14 @@ kern_return_t DNBArchMachARM64::EnableHardwareSingleStep(bool enable) { if (err.Fail()) { err.LogThreaded("%s: failed to read the GPR registers", __FUNCTION__); - return err.Error(); + return err.Status(); } err = GetDBGState(false); if (err.Fail()) { err.LogThreaded("%s: failed to read the DBG registers", __FUNCTION__); - return err.Error(); + return err.Status(); } if (enable) { diff --git a/lldb/tools/debugserver/source/PseudoTerminal.cpp b/lldb/tools/debugserver/source/PseudoTerminal.cpp index 616aec989c8..892574a61dc 100644 --- a/lldb/tools/debugserver/source/PseudoTerminal.cpp +++ b/lldb/tools/debugserver/source/PseudoTerminal.cpp @@ -65,7 +65,7 @@ void PseudoTerminal::CloseSlave() { // RETURNS: // Zero when successful, non-zero indicating an error occurred. //---------------------------------------------------------------------- -PseudoTerminal::Error PseudoTerminal::OpenFirstAvailableMaster(int oflag) { +PseudoTerminal::Status PseudoTerminal::OpenFirstAvailableMaster(int oflag) { // Open the master side of a pseudo terminal m_master_fd = ::posix_openpt(oflag); if (m_master_fd < 0) { @@ -97,7 +97,7 @@ PseudoTerminal::Error PseudoTerminal::OpenFirstAvailableMaster(int oflag) { // RETURNS: // Zero when successful, non-zero indicating an error occurred. //---------------------------------------------------------------------- -PseudoTerminal::Error PseudoTerminal::OpenSlave(int oflag) { +PseudoTerminal::Status PseudoTerminal::OpenSlave(int oflag) { CloseSlave(); // Open the master side of a pseudo terminal @@ -153,7 +153,7 @@ const char *PseudoTerminal::SlaveName() const { // in the child process: zero //---------------------------------------------------------------------- -pid_t PseudoTerminal::Fork(PseudoTerminal::Error &error) { +pid_t PseudoTerminal::Fork(PseudoTerminal::Status &error) { pid_t pid = invalid_pid; error = OpenFirstAvailableMaster(O_RDWR | O_NOCTTY); diff --git a/lldb/tools/debugserver/source/PseudoTerminal.h b/lldb/tools/debugserver/source/PseudoTerminal.h index 409c78ff5e3..f6b71f8909a 100644 --- a/lldb/tools/debugserver/source/PseudoTerminal.h +++ b/lldb/tools/debugserver/source/PseudoTerminal.h @@ -22,7 +22,7 @@ class PseudoTerminal { public: enum { invalid_fd = -1, invalid_pid = -1 }; - enum Error { + enum Status { success = 0, err_posix_openpt_failed = -2, err_grantpt_failed = -3, @@ -44,8 +44,8 @@ public: void CloseMaster(); void CloseSlave(); - Error OpenFirstAvailableMaster(int oflag); - Error OpenSlave(int oflag); + Status OpenFirstAvailableMaster(int oflag); + Status OpenSlave(int oflag); int MasterFD() const { return m_master_fd; } int SlaveFD() const { return m_slave_fd; } int ReleaseMasterFD() { @@ -67,7 +67,7 @@ public: const char *SlaveName() const; - pid_t Fork(Error &error); + pid_t Fork(Status &error); protected: //------------------------------------------------------------------ diff --git a/lldb/tools/debugserver/source/RNBContext.cpp b/lldb/tools/debugserver/source/RNBContext.cpp index 483cdf9a486..c1319af0232 100644 --- a/lldb/tools/debugserver/source/RNBContext.cpp +++ b/lldb/tools/debugserver/source/RNBContext.cpp @@ -266,7 +266,7 @@ const char *RNBContext::LaunchStatusAsString(std::string &s) { else { char error_num_str[64]; snprintf(error_num_str, sizeof(error_num_str), "%u", - m_launch_status.Error()); + m_launch_status.Status()); s = error_num_str; } return s.c_str(); diff --git a/lldb/tools/debugserver/source/RNBRemote.cpp b/lldb/tools/debugserver/source/RNBRemote.cpp index 94260c61929..038142a0351 100644 --- a/lldb/tools/debugserver/source/RNBRemote.cpp +++ b/lldb/tools/debugserver/source/RNBRemote.cpp @@ -1628,7 +1628,7 @@ rnb_err_t RNBRemote::HandlePacket_H(const char *p) { } rnb_err_t RNBRemote::HandlePacket_qLaunchSuccess(const char *p) { - if (m_ctx.HasValidProcessID() || m_ctx.LaunchStatus().Error() == 0) + if (m_ctx.HasValidProcessID() || m_ctx.LaunchStatus().Status() == 0) return SendPacket("OK"); std::ostringstream ret_str; std::string status_str; diff --git a/lldb/tools/lldb-mi/MICmdBase.cpp b/lldb/tools/lldb-mi/MICmdBase.cpp index c645d84c1e9..cd5bf27c73f 100644 --- a/lldb/tools/lldb-mi/MICmdBase.cpp +++ b/lldb/tools/lldb-mi/MICmdBase.cpp @@ -195,7 +195,7 @@ bool CMICmdBase::HasMIResultRecordExtra() const { // metadata // object and set the command's error status. // Type: Method. -// Args: rErrMsg - (R) Error description. +// Args: rErrMsg - (R) Status description. // Return: None. // Throws: None. //-- diff --git a/lldb/tools/lldb-mi/MICmdCmdData.h b/lldb/tools/lldb-mi/MICmdCmdData.h index 683e41022af..ab8d6ba5cd1 100644 --- a/lldb/tools/lldb-mi/MICmdCmdData.h +++ b/lldb/tools/lldb-mi/MICmdCmdData.h @@ -77,7 +77,7 @@ private: bool m_bExpressionValid; // True = yes is valid, false = not valid bool m_bEvaluatedExpression; // True = yes is expression evaluated, false = // failed - lldb::SBError m_Error; // Error object, which is examined when + lldb::SBError m_Error; // Status object, which is examined when // m_bEvaluatedExpression is false CMIUtilString m_strValue; CMICmnMIValueTuple m_miValueTuple; diff --git a/lldb/tools/lldb-mi/MIDriver.cpp b/lldb/tools/lldb-mi/MIDriver.cpp index ea8b57297dd..49e8588bf73 100644 --- a/lldb/tools/lldb-mi/MIDriver.cpp +++ b/lldb/tools/lldb-mi/MIDriver.cpp @@ -710,7 +710,7 @@ const CMIUtilString &CMIDriver::GetDriverId() const { return GetId(); } // Check the error message if the function returns a failure. // Type: Overridden. // Args: vCmd - (R) Command instruction to interpret. -// vwErrMsg - (W) Error description on command failing. +// vwErrMsg - (W) Status description on command failing. // Return: MIstatus::success - Command succeeded. // MIstatus::failure - Command failed. // Throws: None. diff --git a/lldb/tools/lldb-mi/MIDriverBase.cpp b/lldb/tools/lldb-mi/MIDriverBase.cpp index 0620b6154b1..f70da6ea08e 100644 --- a/lldb/tools/lldb-mi/MIDriverBase.cpp +++ b/lldb/tools/lldb-mi/MIDriverBase.cpp @@ -44,7 +44,7 @@ CMIDriverBase::~CMIDriverBase() { m_pDriverFallThru = NULL; } // Check the error message if the function returns a failure. // Type: Overridden. // Args: vCmd - (R) Command instruction to interpret. -// vwErrMsg - (W) Error description on command failing. +// vwErrMsg - (W) Status description on command failing. // Return: MIstatus::success - Command succeeded. // MIstatus::failure - Command failed. // Throws: None. diff --git a/lldb/tools/lldb-server/Acceptor.cpp b/lldb/tools/lldb-server/Acceptor.cpp index 48a364886dc..16db9e9d30d 100644 --- a/lldb/tools/lldb-server/Acceptor.cpp +++ b/lldb/tools/lldb-server/Acceptor.cpp @@ -56,11 +56,11 @@ const char *FindSchemeByProtocol(const Socket::SocketProtocol protocol) { } } -Error Acceptor::Listen(int backlog) { +Status Acceptor::Listen(int backlog) { return m_listener_socket_up->Listen(StringRef(m_name), backlog); } -Error Acceptor::Accept(const bool child_processes_inherit, Connection *&conn) { +Status Acceptor::Accept(const bool child_processes_inherit, Connection *&conn) { Socket *conn_socket = nullptr; auto error = m_listener_socket_up->Accept(conn_socket); if (error.Success()) @@ -81,7 +81,7 @@ std::string Acceptor::GetLocalSocketId() const { return m_local_socket_id(); } std::unique_ptr<Acceptor> Acceptor::Create(StringRef name, const bool child_processes_inherit, - Error &error) { + Status &error) { error.Clear(); Socket::SocketProtocol socket_protocol = Socket::ProtocolUnixDomain; diff --git a/lldb/tools/lldb-server/Acceptor.h b/lldb/tools/lldb-server/Acceptor.h index 410970915f1..207bb4d973a 100644 --- a/lldb/tools/lldb-server/Acceptor.h +++ b/lldb/tools/lldb-server/Acceptor.h @@ -11,7 +11,7 @@ #include "lldb/Core/Connection.h" #include "lldb/Host/Socket.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include <functional> #include <memory> @@ -28,13 +28,13 @@ class Acceptor { public: virtual ~Acceptor() = default; - Error Listen(int backlog); + Status Listen(int backlog); - Error Accept(const bool child_processes_inherit, Connection *&conn); + Status Accept(const bool child_processes_inherit, Connection *&conn); static std::unique_ptr<Acceptor> Create(llvm::StringRef name, const bool child_processes_inherit, - Error &error); + Status &error); Socket::SocketProtocol GetSocketProtocol() const; diff --git a/lldb/tools/lldb-server/lldb-gdbserver.cpp b/lldb/tools/lldb-server/lldb-gdbserver.cpp index 59f5a44ce4e..6139bfabee3 100644 --- a/lldb/tools/lldb-server/lldb-gdbserver.cpp +++ b/lldb/tools/lldb-server/lldb-gdbserver.cpp @@ -35,7 +35,7 @@ #include "lldb/Host/Pipe.h" #include "lldb/Host/Socket.h" #include "lldb/Host/StringConvert.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #ifndef LLGS_PROGRAM_NAME #define LLGS_PROGRAM_NAME "lldb-server" @@ -112,7 +112,7 @@ static void display_usage(const char *progname, const char *subcommand) { void handle_attach_to_pid(GDBRemoteCommunicationServerLLGS &gdb_server, lldb::pid_t pid) { - Error error = gdb_server.AttachToProcess(pid); + Status error = gdb_server.AttachToProcess(pid); if (error.Fail()) { fprintf(stderr, "error: failed to attach to pid %" PRIu64 ": %s\n", pid, error.AsCString()); @@ -145,7 +145,7 @@ void handle_attach(GDBRemoteCommunicationServerLLGS &gdb_server, void handle_launch(GDBRemoteCommunicationServerLLGS &gdb_server, int argc, const char *const argv[]) { - Error error; + Status error; error = gdb_server.SetLaunchArguments(argv, argc); if (error.Fail()) { fprintf(stderr, "error: failed to set launch args for '%s': %s\n", argv[0], @@ -170,15 +170,15 @@ void handle_launch(GDBRemoteCommunicationServerLLGS &gdb_server, int argc, } } -Error writeSocketIdToPipe(Pipe &port_pipe, const std::string &socket_id) { +Status writeSocketIdToPipe(Pipe &port_pipe, const std::string &socket_id) { size_t bytes_written = 0; // Write the port number as a C string with the NULL terminator. return port_pipe.Write(socket_id.c_str(), socket_id.size() + 1, bytes_written); } -Error writeSocketIdToPipe(const char *const named_pipe_path, - const std::string &socket_id) { +Status writeSocketIdToPipe(const char *const named_pipe_path, + const std::string &socket_id) { Pipe port_name_pipe; // Wait for 10 seconds for pipe to be opened. auto error = port_name_pipe.OpenAsWriterWithTimeout(named_pipe_path, false, @@ -188,9 +188,9 @@ Error writeSocketIdToPipe(const char *const named_pipe_path, return writeSocketIdToPipe(port_name_pipe, socket_id); } -Error writeSocketIdToPipe(int unnamed_pipe_fd, const std::string &socket_id) { +Status writeSocketIdToPipe(int unnamed_pipe_fd, const std::string &socket_id) { #if defined(_WIN32) - return Error("Unnamed pipes are not supported on Windows."); + return Status("Unnamed pipes are not supported on Windows."); #else Pipe port_pipe{Pipe::kInvalidDescriptor, unnamed_pipe_fd}; return writeSocketIdToPipe(port_pipe, socket_id); @@ -202,7 +202,7 @@ void ConnectToRemote(MainLoop &mainloop, bool reverse_connect, const char *const host_and_port, const char *const progname, const char *const subcommand, const char *const named_pipe_path, int unnamed_pipe_fd) { - Error error; + Status error; if (host_and_port && host_and_port[0]) { // Parse out host and port. @@ -311,7 +311,7 @@ void ConnectToRemote(MainLoop &mainloop, // main //---------------------------------------------------------------------- int main_gdbserver(int argc, char *argv[]) { - Error error; + Status error; MainLoop mainloop; #ifndef _WIN32 // Setup signal handlers first thing. diff --git a/lldb/tools/lldb-server/lldb-platform.cpp b/lldb/tools/lldb-server/lldb-platform.cpp index d9790cdf43a..8d45682566b 100644 --- a/lldb/tools/lldb-server/lldb-platform.cpp +++ b/lldb/tools/lldb-server/lldb-platform.cpp @@ -34,8 +34,8 @@ #include "lldb/Host/HostGetOpt.h" #include "lldb/Host/OptionParser.h" #include "lldb/Host/common/TCPSocket.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/FileSpec.h" +#include "lldb/Utility/Status.h" using namespace lldb; using namespace lldb_private; @@ -98,13 +98,13 @@ static void display_usage(const char *progname, const char *subcommand) { exit(0); } -static Error save_socket_id_to_file(const std::string &socket_id, - const FileSpec &file_spec) { +static Status save_socket_id_to_file(const std::string &socket_id, + const FileSpec &file_spec) { FileSpec temp_file_spec(file_spec.GetDirectory().AsCString(), false); - Error error(llvm::sys::fs::create_directory(temp_file_spec.GetPath())); + Status error(llvm::sys::fs::create_directory(temp_file_spec.GetPath())); if (error.Fail()) - return Error("Failed to create directory %s: %s", - temp_file_spec.GetCString(), error.AsCString()); + return Status("Failed to create directory %s: %s", + temp_file_spec.GetCString(), error.AsCString()); llvm::SmallString<64> temp_file_path; temp_file_spec.AppendPathComponent("port-file.%%%%%%"); @@ -112,7 +112,7 @@ static Error save_socket_id_to_file(const std::string &socket_id, auto err_code = llvm::sys::fs::createUniqueFile(temp_file_spec.GetPath(), FD, temp_file_path); if (err_code) - return Error("Failed to create temp file: %s", err_code.message().c_str()); + return Status("Failed to create temp file: %s", err_code.message().c_str()); llvm::FileRemover tmp_file_remover(temp_file_path); @@ -121,16 +121,16 @@ static Error save_socket_id_to_file(const std::string &socket_id, temp_file << socket_id; temp_file.close(); if (temp_file.has_error()) - return Error("Failed to write to port file."); + return Status("Failed to write to port file."); } err_code = llvm::sys::fs::rename(temp_file_path, file_spec.GetPath()); if (err_code) - return Error("Failed to rename file %s to %s: %s", temp_file_path.c_str(), - file_spec.GetPath().c_str(), err_code.message().c_str()); + return Status("Failed to rename file %s to %s: %s", temp_file_path.c_str(), + file_spec.GetPath().c_str(), err_code.message().c_str()); tmp_file_remover.releaseFile(); - return Error(); + return Status(); } //---------------------------------------------------------------------- @@ -144,7 +144,7 @@ int main_platform(int argc, char *argv[]) { signal(SIGPIPE, SIG_IGN); signal(SIGHUP, signal_handler); int long_option_index = 0; - Error error; + Status error; std::string listen_host_port; int ch; @@ -350,9 +350,9 @@ int main_platform(int argc, char *argv[]) { lldb::pid_t pid = LLDB_INVALID_PROCESS_ID; uint16_t port = 0; std::string socket_name; - Error error = platform.LaunchGDBServer(inferior_arguments, - "", // hostname - pid, port, socket_name); + Status error = platform.LaunchGDBServer(inferior_arguments, + "", // hostname + pid, port, socket_name); if (error.Success()) platform.SetPendingGdbServer(pid, port, socket_name); else diff --git a/lldb/unittests/Breakpoint/BreakpointIDTest.cpp b/lldb/unittests/Breakpoint/BreakpointIDTest.cpp index a84fa543952..5cded9912f1 100644 --- a/lldb/unittests/Breakpoint/BreakpointIDTest.cpp +++ b/lldb/unittests/Breakpoint/BreakpointIDTest.cpp @@ -10,7 +10,7 @@ #include "gtest/gtest.h" #include "lldb/Breakpoint/BreakpointID.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "llvm/ADT/StringRef.h" @@ -18,7 +18,7 @@ using namespace lldb; using namespace lldb_private; TEST(BreakpointIDTest, StringIsBreakpointName) { - Error E; + Status E; EXPECT_FALSE(BreakpointID::StringIsBreakpointName("1breakpoint", E)); EXPECT_FALSE(BreakpointID::StringIsBreakpointName("-", E)); EXPECT_FALSE(BreakpointID::StringIsBreakpointName("", E)); diff --git a/lldb/unittests/Core/ScalarTest.cpp b/lldb/unittests/Core/ScalarTest.cpp index 3c4995c4908..692aa8aaf11 100644 --- a/lldb/unittests/Core/ScalarTest.cpp +++ b/lldb/unittests/Core/ScalarTest.cpp @@ -12,7 +12,7 @@ #include "lldb/Core/Scalar.h" #include "lldb/Utility/DataExtractor.h" #include "lldb/Utility/Endian.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/StreamString.h" using namespace lldb_private; @@ -44,11 +44,11 @@ TEST(ScalarTest, GetBytes) { Scalar f_scalar; DataExtractor e_data(e, sizeof(e), endian::InlHostByteOrder(), sizeof(void *)); - Error e_error = + Status e_error = e_scalar.SetValueFromData(e_data, lldb::eEncodingUint, sizeof(e)); DataExtractor f_data(f, sizeof(f), endian::InlHostByteOrder(), sizeof(void *)); - Error f_error = + Status f_error = f_scalar.SetValueFromData(f_data, lldb::eEncodingUint, sizeof(f)); ASSERT_EQ(0, memcmp(&a, a_scalar.GetBytes(), sizeof(a))); ASSERT_EQ(0, memcmp(&b, b_scalar.GetBytes(), sizeof(b))); diff --git a/lldb/unittests/Editline/EditlineTest.cpp b/lldb/unittests/Editline/EditlineTest.cpp index f4976a34819..668d1f54212 100644 --- a/lldb/unittests/Editline/EditlineTest.cpp +++ b/lldb/unittests/Editline/EditlineTest.cpp @@ -22,7 +22,7 @@ #include "lldb/Host/Editline.h" #include "lldb/Host/Pipe.h" #include "lldb/Host/PseudoTerminal.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/StringList.h" namespace { @@ -91,7 +91,7 @@ private: EditlineAdapter::EditlineAdapter() : _editline_sp(), _pty(), _pty_master_fd(-1), _pty_slave_fd(-1), _el_slave_file() { - lldb_private::Error error; + lldb_private::Status error; // Open the first master pty available. char error_string[256]; diff --git a/lldb/unittests/Expression/GoParserTest.cpp b/lldb/unittests/Expression/GoParserTest.cpp index 710dc5e4e86..2af75acda91 100644 --- a/lldb/unittests/Expression/GoParserTest.cpp +++ b/lldb/unittests/Expression/GoParserTest.cpp @@ -13,7 +13,7 @@ #include "gtest/gtest.h" #include "Plugins/ExpressionParser/Go/GoParser.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" using namespace lldb_private; @@ -64,7 +64,7 @@ testing::AssertionResult CheckStatement(const char *_s, const char *c_expr, GoParser parser(code); std::unique_ptr<GoASTStmt> stmt(parser.Statement()); if (parser.Failed() || !stmt) { - Error err; + Status err; parser.GetError(err); return testing::AssertionFailure() << "Error parsing " << c_expr << "\n\t" << err.AsCString(); diff --git a/lldb/unittests/Host/MainLoopTest.cpp b/lldb/unittests/Host/MainLoopTest.cpp index a2a673d38ca..3a39ea1c9ac 100644 --- a/lldb/unittests/Host/MainLoopTest.cpp +++ b/lldb/unittests/Host/MainLoopTest.cpp @@ -32,7 +32,7 @@ public: void SetUp() override { bool child_processes_inherit = false; - Error error; + Status error; std::unique_ptr<TCPSocket> listen_socket_up( new TCPSocket(true, child_processes_inherit)); ASSERT_TRUE(error.Success()); @@ -40,7 +40,7 @@ public: ASSERT_TRUE(error.Success()); Socket *accept_socket; - std::future<Error> accept_error = std::async(std::launch::async, [&] { + std::future<Status> accept_error = std::async(std::launch::async, [&] { return listen_socket_up->Accept(accept_socket); }); @@ -81,7 +81,7 @@ TEST_F(MainLoopTest, ReadObject) { MainLoop loop; - Error error; + Status error; auto handle = loop.RegisterReadObject(socketpair[1], make_callback(), error); ASSERT_TRUE(error.Success()); ASSERT_TRUE(handle); @@ -96,7 +96,7 @@ TEST_F(MainLoopTest, TerminatesImmediately) { ASSERT_TRUE(socketpair[1]->Write(&X, len).Success()); MainLoop loop; - Error error; + Status error; auto handle0 = loop.RegisterReadObject(socketpair[0], make_callback(), error); ASSERT_TRUE(error.Success()); auto handle1 = loop.RegisterReadObject(socketpair[1], make_callback(), error); @@ -109,7 +109,7 @@ TEST_F(MainLoopTest, TerminatesImmediately) { #ifdef LLVM_ON_UNIX TEST_F(MainLoopTest, Signal) { MainLoop loop; - Error error; + Status error; auto handle = loop.RegisterSignal(SIGUSR1, make_callback(), error); ASSERT_TRUE(error.Success()); diff --git a/lldb/unittests/Host/SocketTest.cpp b/lldb/unittests/Host/SocketTest.cpp index eda3a11fc10..d8fdc593ed4 100644 --- a/lldb/unittests/Host/SocketTest.cpp +++ b/lldb/unittests/Host/SocketTest.cpp @@ -43,7 +43,7 @@ protected: static void AcceptThread(Socket *listen_socket, const char *listen_remote_address, bool child_processes_inherit, Socket **accept_socket, - Error *error) { + Status *error) { *error = listen_socket->Accept(*accept_socket); } @@ -53,7 +53,7 @@ protected: const std::function<std::string(const SocketType &)> &get_connect_addr, std::unique_ptr<SocketType> *a_up, std::unique_ptr<SocketType> *b_up) { bool child_processes_inherit = false; - Error error; + Status error; std::unique_ptr<SocketType> listen_socket_up( new SocketType(true, child_processes_inherit)); EXPECT_FALSE(error.Fail()); @@ -61,7 +61,7 @@ protected: EXPECT_FALSE(error.Fail()); EXPECT_TRUE(listen_socket_up->IsValid()); - Error accept_error; + Status accept_error; Socket *accept_socket; std::thread accept_thread(AcceptThread, listen_socket_up.get(), listen_remote_address, child_processes_inherit, @@ -94,7 +94,7 @@ TEST_F(SocketTest, DecodeHostAndPort) { std::string host_str; std::string port_str; int32_t port; - Error error; + Status error; EXPECT_TRUE(Socket::DecodeHostAndPort("localhost:1138", host_str, port_str, port, &error)); EXPECT_STREQ("localhost", host_str.c_str()); diff --git a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp index d1eb3a7e9c9..56a7e74269a 100644 --- a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp +++ b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp @@ -318,7 +318,7 @@ TEST_F(GDBRemoteCommunicationClientTest, SendSignalsToIgnore) { const lldb::tid_t tid = 0x47; const uint32_t reg_num = 4; - std::future<Error> result = std::async(std::launch::async, [&] { + std::future<Status> result = std::async(std::launch::async, [&] { return client.SendSignalsToIgnore({2, 3, 5, 7, 0xB, 0xD, 0x11}); }); @@ -342,7 +342,7 @@ TEST_F(GDBRemoteCommunicationClientTest, GetMemoryRegionInfo) { const lldb::addr_t addr = 0xa000; MemoryRegionInfo region_info; - std::future<Error> result = std::async(std::launch::async, [&] { + std::future<Status> result = std::async(std::launch::async, [&] { return client.GetMemoryRegionInfo(addr, region_info); }); @@ -363,7 +363,7 @@ TEST_F(GDBRemoteCommunicationClientTest, GetMemoryRegionInfoInvalidResponse) { const lldb::addr_t addr = 0x4000; MemoryRegionInfo region_info; - std::future<Error> result = std::async(std::launch::async, [&] { + std::future<Status> result = std::async(std::launch::async, [&] { return client.GetMemoryRegionInfo(addr, region_info); }); diff --git a/lldb/unittests/Process/gdb-remote/GDBRemoteTestUtils.cpp b/lldb/unittests/Process/gdb-remote/GDBRemoteTestUtils.cpp index 6440e814efd..4a86b91c048 100644 --- a/lldb/unittests/Process/gdb-remote/GDBRemoteTestUtils.cpp +++ b/lldb/unittests/Process/gdb-remote/GDBRemoteTestUtils.cpp @@ -32,16 +32,15 @@ void GDBRemoteTest::TearDownTestCase() { void Connect(GDBRemoteCommunication &client, GDBRemoteCommunication &server) { bool child_processes_inherit = false; - Error error; + Status error; TCPSocket listen_socket(true, child_processes_inherit); ASSERT_FALSE(error.Fail()); error = listen_socket.Listen("127.0.0.1:0", 5); ASSERT_FALSE(error.Fail()); Socket *accept_socket; - std::future<Error> accept_error = std::async(std::launch::async, [&] { - return listen_socket.Accept(accept_socket); - }); + std::future<Status> accept_error = std::async( + std::launch::async, [&] { return listen_socket.Accept(accept_socket); }); char connect_remote_address[64]; snprintf(connect_remote_address, sizeof(connect_remote_address), diff --git a/lldb/unittests/Target/ModuleCacheTest.cpp b/lldb/unittests/Target/ModuleCacheTest.cpp index 09b3edc4148..8914f8b5eac 100644 --- a/lldb/unittests/Target/ModuleCacheTest.cpp +++ b/lldb/unittests/Target/ModuleCacheTest.cpp @@ -104,7 +104,7 @@ void ModuleCacheTest::TryGetAndPut(const FileSpec &cache_dir, bool did_create; bool download_called = false; - Error error = mc.GetAndPut( + Status error = mc.GetAndPut( cache_dir, hostname, module_spec, [this, &download_called](const ModuleSpec &module_spec, const FileSpec &tmp_download_file_spec) { @@ -114,10 +114,10 @@ void ModuleCacheTest::TryGetAndPut(const FileSpec &cache_dir, std::error_code ec = llvm::sys::fs::copy_file( s_test_executable, tmp_download_file_spec.GetCString()); EXPECT_FALSE(ec); - return Error(); + return Status(); }, [](const ModuleSP &module_sp, const FileSpec &tmp_download_file_spec) { - return Error("Not supported."); + return Status("Not supported."); }, module_sp, &did_create); EXPECT_EQ(expect_download, download_called); diff --git a/lldb/unittests/Utility/CMakeLists.txt b/lldb/unittests/Utility/CMakeLists.txt index 60868bcb414..86ac3c46d77 100644 --- a/lldb/unittests/Utility/CMakeLists.txt +++ b/lldb/unittests/Utility/CMakeLists.txt @@ -2,9 +2,9 @@ add_subdirectory(Mocks) add_lldb_unittest(UtilityTests ConstStringTest.cpp - ErrorTest.cpp LogTest.cpp NameMatchesTest.cpp + StatusTest.cpp StringExtractorTest.cpp TaskPoolTest.cpp TildeExpressionResolverTest.cpp diff --git a/lldb/unittests/Utility/ErrorTest.cpp b/lldb/unittests/Utility/StatusTest.cpp index a114b26ebe5..9655610e4aa 100644 --- a/lldb/unittests/Utility/ErrorTest.cpp +++ b/lldb/unittests/Utility/StatusTest.cpp @@ -1,4 +1,4 @@ -//===-- ErrorTest.cpp -------------------------------------------*- C++ -*-===// +//===-- StatusTest.cpp ------------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -7,13 +7,13 @@ // //===----------------------------------------------------------------------===// -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "gtest/gtest.h" using namespace lldb_private; -TEST(ErrorTest, Formatv) { - EXPECT_EQ("", llvm::formatv("{0}", Error()).str()); - EXPECT_EQ("Hello Error", llvm::formatv("{0}", Error("Hello Error")).str()); - EXPECT_EQ("Hello", llvm::formatv("{0:5}", Error("Hello Error")).str()); +TEST(StatusTest, Formatv) { + EXPECT_EQ("", llvm::formatv("{0}", Status()).str()); + EXPECT_EQ("Hello Status", llvm::formatv("{0}", Status("Hello Status")).str()); + EXPECT_EQ("Hello", llvm::formatv("{0:5}", Status("Hello Error")).str()); } diff --git a/lldb/unittests/debugserver/RNBSocketTest.cpp b/lldb/unittests/debugserver/RNBSocketTest.cpp index 76a1b49064f..163e12bfcac 100644 --- a/lldb/unittests/debugserver/RNBSocketTest.cpp +++ b/lldb/unittests/debugserver/RNBSocketTest.cpp @@ -30,7 +30,7 @@ static void ServerCallbackv4(const void *baton, in_port_t port) { Socket *client_socket; char addr_buffer[256]; sprintf(addr_buffer, "%s:%d", baton, port); - Error err = Socket::TcpConnect(addr_buffer, false, client_socket); + Status err = Socket::TcpConnect(addr_buffer, false, client_socket); if (err.Fail()) abort(); char buffer[32]; @@ -101,7 +101,7 @@ void TestSocketConnect(const char *addr) { Socket *server_socket; Predicate<uint16_t> port_predicate; port_predicate.SetValue(0, eBroadcastNever); - Error err = + Status err = Socket::TcpListen(addr_wrap, false, server_socket, &port_predicate); ASSERT_FALSE(err.Fail()); |

