diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-05-16 19:47:58 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-05-16 19:47:58 +0000 |
commit | b76161e41bc2c07cd47f9c61f875d1be95e26d10 (patch) | |
tree | d03c19ce10dec6419f97df1d4dac9d47eb88982f /source/Plugins | |
parent | 8b4000f13b303cc154136abc74c55670673e2a96 (diff) | |
download | src-b76161e41bc2c07cd47f9c61f875d1be95e26d10.tar.gz src-b76161e41bc2c07cd47f9c61f875d1be95e26d10.zip |
Vendor import of lldb trunk r303197:vendor/lldb/lldb-trunk-r303197
Notes
Notes:
svn path=/vendor/lldb/dist/; revision=318378
svn path=/vendor/lldb/lldb-trunk-r303197/; revision=318379; tag=vendor/lldb/lldb-trunk-r303197
Diffstat (limited to 'source/Plugins')
274 files changed, 3069 insertions, 2960 deletions
diff --git a/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp b/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp index dc1c8dcf4ab0..06b1c7054c1f 100644 --- a/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp +++ b/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/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h b/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h index 39f57a0c5ee2..5aa817c20ec2 100644 --- a/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h +++ b/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/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp b/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp index c5e53361bf99..a545dfc837da 100644 --- a/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp +++ b/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/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.h b/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.h index 93a548a79682..589e2ea468ef 100644 --- a/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.h +++ b/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/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp b/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp index bbaec25b37b8..c393ac9c916b 100644 --- a/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp +++ b/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/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h b/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h index 4a2555ac61a2..88fb6ffd7a40 100644 --- a/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h +++ b/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/source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp b/source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp index 3df225cc895d..614c6e893806 100644 --- a/source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp +++ b/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/source/Plugins/ABI/SysV-arm/ABISysV_arm.h b/source/Plugins/ABI/SysV-arm/ABISysV_arm.h index d85b3dff0ca5..81f1277419a6 100644 --- a/source/Plugins/ABI/SysV-arm/ABISysV_arm.h +++ b/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/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp b/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp index 65cbd271e979..b202c8395776 100644 --- a/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp +++ b/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/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.h b/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.h index 68c300c0909d..c048e8634ae5 100644 --- a/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.h +++ b/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/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp b/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp index 0b024dbac07d..425bf2ce0bf6 100644 --- a/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp +++ b/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/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.h b/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.h index aed3dd71b69a..5f808291eac0 100644 --- a/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.h +++ b/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/source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp b/source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp index aee102c16ba1..cb3644d46af4 100644 --- a/source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp +++ b/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/source/Plugins/ABI/SysV-i386/ABISysV_i386.h b/source/Plugins/ABI/SysV-i386/ABISysV_i386.h index 8d1d76b5dfd9..038bf656b1f1 100644 --- a/source/Plugins/ABI/SysV-i386/ABISysV_i386.h +++ b/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/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp b/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp index 69725e30b063..a77252a20499 100644 --- a/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp +++ b/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/source/Plugins/ABI/SysV-mips/ABISysV_mips.h b/source/Plugins/ABI/SysV-mips/ABISysV_mips.h index 7ac51463e6eb..980553c506bd 100644 --- a/source/Plugins/ABI/SysV-mips/ABISysV_mips.h +++ b/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/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp b/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp index bbcf2e575825..baa478ea1106 100644 --- a/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp +++ b/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/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.h b/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.h index 672a43825625..ac7d9b871946 100644 --- a/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.h +++ b/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/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp b/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp index 2dff0d203611..00adfe1be82d 100644 --- a/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp +++ b/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/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.h b/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.h index c9c1c985f679..8cb9bf24881f 100644 --- a/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.h +++ b/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/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp b/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp index 59430caa6e37..449990d71304 100644 --- a/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp +++ b/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/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.h b/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.h index 7f321dff49c1..29237a68fc9e 100644 --- a/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.h +++ b/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/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.cpp b/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.cpp index a899b24cea5c..7f76d49bfb0f 100644 --- a/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.cpp +++ b/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/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.h b/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.h index 6ccabd6f75ec..e233a900e395 100644 --- a/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.h +++ b/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/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp b/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp index 42bb9d057e61..deccca8c29e9 100644 --- a/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp +++ b/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/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h b/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h index 29f2ce133d42..8d420e88167c 100644 --- a/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h +++ b/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/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp b/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp index e144ef18b413..21e19bf2b127 100644 --- a/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp +++ b/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/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp b/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp index 80f3f6857fd4..a82b3fe267b3 100644 --- a/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp +++ b/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/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h b/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h index 7ca9bada1a1f..ad4f7c631d84 100644 --- a/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h +++ b/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/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp b/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp index 25bf6e9a7296..d0d60017e869 100644 --- a/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp +++ b/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/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.h b/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.h index 05709d07fd67..200a4171bd1c 100644 --- a/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.h +++ b/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/source/Plugins/DynamicLoader/Hexagon-DYLD/HexagonDYLDRendezvous.cpp b/source/Plugins/DynamicLoader/Hexagon-DYLD/HexagonDYLDRendezvous.cpp index f22644aec107..1ef1be5d0adb 100644 --- a/source/Plugins/DynamicLoader/Hexagon-DYLD/HexagonDYLDRendezvous.cpp +++ b/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/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp b/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp index 4ffd216e98a7..703b461f6fe1 100644 --- a/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp +++ b/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp @@ -440,8 +440,8 @@ bool DynamicLoaderDarwin::JSONImageInformationIntoImageInfo( Segment segment; StructuredData::Dictionary *seg = segments->GetItemAtIndex(j)->GetAsDictionary(); - segment.name = ConstString( - seg->GetValueForKey("name")->GetAsString()->GetValue().c_str()); + segment.name = + ConstString(seg->GetValueForKey("name")->GetAsString()->GetValue()); segment.vmaddr = seg->GetValueForKey("vmaddr")->GetAsInteger()->GetValue(); segment.vmsize = @@ -478,8 +478,8 @@ bool DynamicLoaderDarwin::JSONImageInformationIntoImageInfo( image_infos[i].segments.push_back(segment); } - image_infos[i].uuid.SetFromCString( - image->GetValueForKey("uuid")->GetAsString()->GetValue().c_str()); + image_infos[i].uuid.SetFromStringRef( + image->GetValueForKey("uuid")->GetAsString()->GetValue()); // All sections listed in the dyld image info structure will all // either be fixed up already, or they will all be off by a single @@ -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/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp b/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp index c824653b2e93..66085a23759b 100644 --- a/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp +++ b/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/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h b/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h index 60c4beed383b..dd42686195b1 100644 --- a/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h +++ b/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/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp b/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp index 46742c1f9b5e..e0def58f41c1 100644 --- a/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp +++ b/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/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h b/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h index d5f1b51e508a..81c2fcfb194f 100644 --- a/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h +++ b/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/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp b/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp index c4917c08fa90..c1986976b0fc 100644 --- a/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp +++ b/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/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp b/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp index c809d2c77834..5f56bfc027a4 100644 --- a/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp +++ b/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/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h b/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h index 8e4be1d4a06a..86e0311c2919 100644 --- a/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h +++ b/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/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp b/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp index 04f1f3390570..291695cb68c1 100644 --- a/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp +++ b/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/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.h b/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.h index 413ad80a2fd9..2d18ec86afd3 100644 --- a/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.h +++ b/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/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp b/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp index 20bf3609f46f..c381326ebf4f 100644 --- a/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp +++ b/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/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h b/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h index 3494082eea8d..de6e295f7891 100644 --- a/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h +++ b/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/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp b/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp index 1f78fb96bc34..256d46a15420 100644 --- a/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp +++ b/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; @@ -1987,8 +1987,33 @@ void ClangExpressionDeclMap::AddOneFunction(NameSearchContext &context, .GetOpaqueDeclContext(); clang::FunctionDecl *src_function_decl = llvm::dyn_cast_or_null<clang::FunctionDecl>(src_decl_context); - - if (src_function_decl) { + if (src_function_decl && + src_function_decl->getTemplateSpecializationInfo()) { + clang::FunctionTemplateDecl *function_template = + src_function_decl->getTemplateSpecializationInfo()->getTemplate(); + clang::FunctionTemplateDecl *copied_function_template = + llvm::dyn_cast_or_null<clang::FunctionTemplateDecl>( + m_ast_importer_sp->CopyDecl(m_ast_context, + src_ast->getASTContext(), + function_template)); + if (copied_function_template) { + if (log) { + ASTDumper ast_dumper((clang::Decl *)copied_function_template); + + StreamString ss; + + function->DumpSymbolContext(&ss); + + log->Printf(" CEDM::FEVD[%u] Imported decl for function template" + " %s (description %s), returned %s", + current_id, + copied_function_template->getNameAsString().c_str(), + ss.GetData(), ast_dumper.GetCString()); + } + + context.AddNamedDecl(copied_function_template); + } + } else if (src_function_decl) { if (clang::FunctionDecl *copied_function_decl = llvm::dyn_cast_or_null<clang::FunctionDecl>( m_ast_importer_sp->CopyDecl(m_ast_context, diff --git a/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp b/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp index 6c923ced1ec2..4e20be79f68b 100644 --- a/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp +++ b/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/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h b/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h index f0203f36e59b..3e6a109a4af3 100644 --- a/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h +++ b/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/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp b/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp index 95d81db12801..2a6261a6df4d 100644 --- a/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp +++ b/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/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h b/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h index 155c153b873c..88a78798b657 100644 --- a/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h +++ b/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/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp b/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp index a54ab4a2267a..065e5db4c9f8 100644 --- a/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp +++ b/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/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp b/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp index 68a214ee4683..13f5657eedd8 100644 --- a/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp +++ b/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/source/Plugins/ExpressionParser/Clang/IRForTarget.h b/source/Plugins/ExpressionParser/Clang/IRForTarget.h index eb52730f3a87..93ce8aa44eb2 100644 --- a/source/Plugins/ExpressionParser/Clang/IRForTarget.h +++ b/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/source/Plugins/ExpressionParser/Go/GoParser.cpp b/source/Plugins/ExpressionParser/Go/GoParser.cpp index 0bae4a4574d9..538bd05e25f8 100644 --- a/source/Plugins/ExpressionParser/Go/GoParser.cpp +++ b/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/source/Plugins/ExpressionParser/Go/GoParser.h b/source/Plugins/ExpressionParser/Go/GoParser.h index bd1285580228..9ed2ae2033bd 100644 --- a/source/Plugins/ExpressionParser/Go/GoParser.h +++ b/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/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp b/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp index 50d45a1ad1e7..f4b8cfbe03d4 100644 --- a/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp +++ b/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/source/Plugins/Instruction/ARM/EmulateInstructionARM.h b/source/Plugins/Instruction/ARM/EmulateInstructionARM.h index 40a31169ecd8..fb1867c6362a 100644 --- a/source/Plugins/Instruction/ARM/EmulateInstructionARM.h +++ b/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/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp b/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp index 655fada3a4b3..54dd237eb4b7 100644 --- a/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp +++ b/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/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.h b/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.h index 475410ab2d13..253bb935bca7 100644 --- a/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.h +++ b/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/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp b/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp index aa7c6e5d1fe0..4d1d89abb1d0 100644 --- a/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp +++ b/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/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.h b/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.h index 0375056f87c7..8d6e0be3cd78 100644 --- a/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.h +++ b/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/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp b/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp index 4c90a1901da7..1e6d98756958 100644 --- a/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp +++ b/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/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.h b/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.h index 1e5be516d130..c2433d59830e 100644 --- a/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.h +++ b/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/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp b/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp index 96370528f260..91c5d6ce3d60 100644 --- a/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp +++ b/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/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp b/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp index 562d988be837..d7b518982fcf 100644 --- a/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp +++ b/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/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp b/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp index b97d67a0bb42..7ef3aecdb89f 100644 --- a/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp +++ b/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/source/Plugins/Language/CPlusPlus/BlockPointer.cpp b/source/Plugins/Language/CPlusPlus/BlockPointer.cpp index db7c24675825..5e8f051dec98 100644 --- a/source/Plugins/Language/CPlusPlus/BlockPointer.cpp +++ b/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/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp b/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp index b69b69530428..0f6fb54e8384 100644 --- a/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp +++ b/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/source/Plugins/Language/CPlusPlus/LibCxx.cpp b/source/Plugins/Language/CPlusPlus/LibCxx.cpp index 659a12b7eecf..11245e1310b7 100644 --- a/source/Plugins/Language/CPlusPlus/LibCxx.cpp +++ b/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/source/Plugins/Language/CPlusPlus/LibCxxList.cpp b/source/Plugins/Language/CPlusPlus/LibCxxList.cpp index 4ad3df3d6038..56d8edaba72a 100644 --- a/source/Plugins/Language/CPlusPlus/LibCxxList.cpp +++ b/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/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp b/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp index 293d64075921..b7215dbcbb48 100644 --- a/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp +++ b/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/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp b/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp index 526bae6900f5..190b5f64381e 100644 --- a/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp +++ b/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/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp b/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp index 96d7e51deba4..6f601c9f6ccb 100644 --- a/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp +++ b/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/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp b/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp index a4633db8157e..e3018a1884be 100644 --- a/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp +++ b/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/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp b/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp index 7693961cae17..b6d664df16ef 100644 --- a/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp +++ b/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/source/Plugins/Language/Go/GoFormatterFunctions.cpp b/source/Plugins/Language/Go/GoFormatterFunctions.cpp index 0f78f643321b..aac75205c6ef 100644 --- a/source/Plugins/Language/Go/GoFormatterFunctions.cpp +++ b/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/source/Plugins/Language/Java/JavaFormatterFunctions.cpp b/source/Plugins/Language/Java/JavaFormatterFunctions.cpp index 286651a64409..498795c90be8 100644 --- a/source/Plugins/Language/Java/JavaFormatterFunctions.cpp +++ b/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/source/Plugins/Language/ObjC/CF.cpp b/source/Plugins/Language/ObjC/CF.cpp index a75c034afa9f..9bb8eeab1d2e 100644 --- a/source/Plugins/Language/ObjC/CF.cpp +++ b/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/source/Plugins/Language/ObjC/Cocoa.cpp b/source/Plugins/Language/ObjC/Cocoa.cpp index 0fc690606d16..dd3dc434f753 100644 --- a/source/Plugins/Language/ObjC/Cocoa.cpp +++ b/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/source/Plugins/Language/ObjC/NSArray.cpp b/source/Plugins/Language/ObjC/NSArray.cpp index 79773fdf1d15..b07b9ba5888f 100644 --- a/source/Plugins/Language/ObjC/NSArray.cpp +++ b/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/source/Plugins/Language/ObjC/NSDictionary.cpp b/source/Plugins/Language/ObjC/NSDictionary.cpp index 672cc1a26f4e..6df83d52acca 100644 --- a/source/Plugins/Language/ObjC/NSDictionary.cpp +++ b/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/source/Plugins/Language/ObjC/NSError.cpp b/source/Plugins/Language/ObjC/NSError.cpp index e8044d3b0013..4365a12b54e1 100644 --- a/source/Plugins/Language/ObjC/NSError.cpp +++ b/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/source/Plugins/Language/ObjC/NSException.cpp b/source/Plugins/Language/ObjC/NSException.cpp index aa86e207783d..1da4f6de19a0 100644 --- a/source/Plugins/Language/ObjC/NSException.cpp +++ b/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/source/Plugins/Language/ObjC/NSSet.cpp b/source/Plugins/Language/ObjC/NSSet.cpp index adefba902b61..b6f6ff7af19d 100644 --- a/source/Plugins/Language/ObjC/NSSet.cpp +++ b/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/source/Plugins/Language/ObjC/NSString.cpp b/source/Plugins/Language/ObjC/NSString.cpp index d0258be8211e..3b4edf68e063 100644 --- a/source/Plugins/Language/ObjC/NSString.cpp +++ b/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/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp b/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp index e308747378d3..e5a459dfe861 100644 --- a/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp +++ b/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/source/Plugins/LanguageRuntime/Go/GoLanguageRuntime.cpp b/source/Plugins/LanguageRuntime/Go/GoLanguageRuntime.cpp index c52fc1e121d8..6670f89dde5f 100644 --- a/source/Plugins/LanguageRuntime/Go/GoLanguageRuntime.cpp +++ b/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/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp index 6b5e6b1eb764..ecb0b64f2346 100644 --- a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp +++ b/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/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp index 6b27009a0727..eacc98a07193 100644 --- a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp +++ b/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/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp index 2c92b922b9df..566fefaf7984 100644 --- a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp +++ b/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/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp index 42c5fe9248f6..f15bcaa13844 100644 --- a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp +++ b/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, @@ -1803,7 +1803,8 @@ lldb::addr_t AppleObjCRuntimeV2::GetSharedCacheReadOnlyAddress() { void AppleObjCRuntimeV2::UpdateISAToDescriptorMapIfNeeded() { Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_TYPES)); - Timer scoped_timer(LLVM_PRETTY_FUNCTION, LLVM_PRETTY_FUNCTION); + static Timer::Category func_cat(LLVM_PRETTY_FUNCTION); + Timer scoped_timer(func_cat, LLVM_PRETTY_FUNCTION); // Else we need to check with our process to see when the map was updated. Process *process = GetProcess(); @@ -2019,7 +2020,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 +2051,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 +2263,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 +2350,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/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp index 8ce65b07684f..a6e9c0c16f16 100644 --- a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp +++ b/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/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp b/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp index 7a9e66cf5481..7e46afcccdab 100644 --- a/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp +++ b/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/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h b/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h index 5b2bb57ac8c8..0fe9134ce9e4 100644 --- a/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h +++ b/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/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptScriptGroup.cpp b/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptScriptGroup.cpp index 9ca8fb4444c0..fe4ae21a0c39 100644 --- a/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptScriptGroup.cpp +++ b/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/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp b/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp index 35247edfbd56..b9e49d1faa1b 100644 --- a/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp +++ b/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/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp b/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp index 928157516808..8a388a667372 100644 --- a/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp +++ b/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp @@ -301,8 +301,9 @@ ObjectContainer *ObjectContainerBSDArchive::CreateInstance( DataExtractor data; data.SetData(data_sp, data_offset, length); if (file && data_sp && ObjectContainerBSDArchive::MagicBytesMatch(data)) { + static Timer::Category func_cat(LLVM_PRETTY_FUNCTION); Timer scoped_timer( - LLVM_PRETTY_FUNCTION, + func_cat, "ObjectContainerBSDArchive::CreateInstance (module = %s, file = " "%p, file_offset = 0x%8.8" PRIx64 ", file_size = 0x%8.8" PRIx64 ")", module_sp->GetFileSpec().GetPath().c_str(), diff --git a/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp index 0720cca27341..b71d6fa4ebea 100644 --- a/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ b/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" @@ -727,8 +727,9 @@ size_t ObjectFileELF::GetModuleSpecifications( uint32_t core_notes_crc = 0; if (!gnu_debuglink_crc) { + static Timer::Category func_cat(LLVM_PRETTY_FUNCTION); lldb_private::Timer scoped_timer( - LLVM_PRETTY_FUNCTION, + func_cat, "Calculating module crc32 %s with size %" PRIu64 " KiB", file.GetLastPathComponent().AsCString(), (file.GetByteSize() - file_offset) / 1024); @@ -1079,7 +1080,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 +1233,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 +1764,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/source/Plugins/ObjectFile/ELF/ObjectFileELF.h b/source/Plugins/ObjectFile/ELF/ObjectFileELF.h index 9b2d58b7be82..06f1a4d22d2d 100644 --- a/source/Plugins/ObjectFile/ELF/ObjectFileELF.h +++ b/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/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp index 84ecfdc67bee..1a4ae1a21aec 100644 --- a/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp +++ b/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" @@ -2121,8 +2121,8 @@ UUID ObjectFileMachO::GetSharedCacheUUID(FileSpec dyld_shared_cache, } size_t ObjectFileMachO::ParseSymtab() { - Timer scoped_timer(LLVM_PRETTY_FUNCTION, - "ObjectFileMachO::ParseSymtab () module = %s", + static Timer::Category func_cat(LLVM_PRETTY_FUNCTION); + Timer scoped_timer(func_cat, "ObjectFileMachO::ParseSymtab () module = %s", m_file.GetFilename().AsCString("")); ModuleSP module_sp(GetModule()); if (!module_sp) @@ -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/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h b/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h index 96379a4db411..9a42f41a4c94 100644 --- a/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h +++ b/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/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp b/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp index c89383a7b7ba..dcb9527f24c8 100644 --- a/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp +++ b/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/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h b/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h index 2313047735e0..d8a94e19d34f 100644 --- a/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h +++ b/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/source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.cpp b/source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.cpp index 094e258a7a03..d6553f6e5142 100644 --- a/source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.cpp +++ b/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/source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.h b/source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.h index 3f741dc04f51..135d53387387 100644 --- a/source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.h +++ b/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/source/Plugins/OperatingSystem/Go/OperatingSystemGo.cpp b/source/Plugins/OperatingSystem/Go/OperatingSystemGo.cpp index 1a0c32729865..75bc518f7538 100644 --- a/source/Plugins/OperatingSystem/Go/OperatingSystemGo.cpp +++ b/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()) { @@ -340,8 +340,8 @@ bool OperatingSystemGo::UpdateThreadList(ThreadList &old_thread_list, memory_thread->IsValid()) { memory_thread->ClearBackingThread(); } else { - memory_thread.reset(new ThreadMemory( - *m_process, goroutine.m_goid, nullptr, nullptr, goroutine.m_gobuf)); + memory_thread.reset(new ThreadMemory(*m_process, goroutine.m_goid, "", "", + goroutine.m_gobuf)); } // Search for the backing thread if the goroutine is running. if (2 == (goroutine.m_status & 0xfff)) { @@ -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/source/Plugins/OperatingSystem/Go/OperatingSystemGo.h b/source/Plugins/OperatingSystem/Go/OperatingSystemGo.h index d289985c72ad..5d255a348a63 100644 --- a/source/Plugins/OperatingSystem/Go/OperatingSystemGo.h +++ b/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/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp b/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp index dbbb55e474f8..14bf0784dc2c 100644 --- a/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp +++ b/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 @@ -240,8 +240,8 @@ ThreadSP OperatingSystemPython::CreateThreadFromThreadInfo( uint32_t core_number; addr_t reg_data_addr; - std::string name; - std::string queue; + llvm::StringRef name; + llvm::StringRef queue; thread_dict.GetValueForKeyAsInteger("core", core_number, UINT32_MAX); thread_dict.GetValueForKeyAsInteger("register_data_addr", reg_data_addr, @@ -266,8 +266,8 @@ ThreadSP OperatingSystemPython::CreateThreadFromThreadInfo( if (!thread_sp) { if (did_create_ptr) *did_create_ptr = true; - thread_sp.reset(new ThreadMemory(*m_process, tid, name.c_str(), - queue.c_str(), reg_data_addr)); + thread_sp.reset( + new ThreadMemory(*m_process, tid, name, queue, reg_data_addr)); } if (core_number < core_thread_list.GetSize(false)) { diff --git a/source/Plugins/Platform/Android/AdbClient.cpp b/source/Plugins/Platform/Android/AdbClient.cpp index 2060bd1de735..d3bcee6f487d 100644 --- a/source/Plugins/Platform/Android/AdbClient.cpp +++ b/source/Plugins/Platform/Android/AdbClient.cpp @@ -46,7 +46,7 @@ using namespace std::chrono; namespace { -const seconds kReadTimeout(8); +const seconds kReadTimeout(12); const char *kOKAY = "OKAY"; const char *kFAIL = "FAIL"; const char *kDATA = "DATA"; @@ -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/source/Plugins/Platform/Android/AdbClient.h b/source/Plugins/Platform/Android/AdbClient.h index 9e8726c93b61..0d2100fc5663 100644 --- a/source/Plugins/Platform/Android/AdbClient.h +++ b/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/source/Plugins/Platform/Android/PlatformAndroid.cpp b/source/Plugins/Platform/Android/PlatformAndroid.cpp index ad3918d4e202..d896a9f99e63 100644 --- a/source/Plugins/Platform/Android/PlatformAndroid.cpp +++ b/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/source/Plugins/Platform/Android/PlatformAndroid.h b/source/Plugins/Platform/Android/PlatformAndroid.h index 8417055733f6..8fb4cc71a69f 100644 --- a/source/Plugins/Platform/Android/PlatformAndroid.h +++ b/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/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp b/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp index 034518c1d2e3..dbc74833e287 100644 --- a/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp +++ b/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/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.h b/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.h index 6d5bfecd9938..1bd13ffe89fe 100644 --- a/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.h +++ b/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/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp b/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp index 2a150b5d452b..53cec45f986e 100644 --- a/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp +++ b/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/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h b/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h index c8ac7b29f3a2..4bde2148a4d4 100644 --- a/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h +++ b/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/source/Plugins/Platform/Kalimba/PlatformKalimba.cpp b/source/Plugins/Platform/Kalimba/PlatformKalimba.cpp index 08a3a6aa6c26..00327e485bf3 100644 --- a/source/Plugins/Platform/Kalimba/PlatformKalimba.cpp +++ b/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/source/Plugins/Platform/Kalimba/PlatformKalimba.h b/source/Plugins/Platform/Kalimba/PlatformKalimba.h index 0c94ec9ec8f7..53a8e5594aaa 100644 --- a/source/Plugins/Platform/Kalimba/PlatformKalimba.h +++ b/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/source/Plugins/Platform/Linux/PlatformLinux.cpp b/source/Plugins/Platform/Linux/PlatformLinux.cpp index 4dd5398fcfa3..0bf00ea30798 100644 --- a/source/Plugins/Platform/Linux/PlatformLinux.cpp +++ b/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/source/Plugins/Platform/Linux/PlatformLinux.h b/source/Plugins/Platform/Linux/PlatformLinux.h index f1386d1e4fe5..bc7b723427f8 100644 --- a/source/Plugins/Platform/Linux/PlatformLinux.h +++ b/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/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp b/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp index 478d482eb024..0197d27e76ef 100644 --- a/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp +++ b/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/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.h b/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.h index 34f2ba2d9bfb..44feb019dc73 100644 --- a/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.h +++ b/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/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp b/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp index 38fe412c8574..52188eefb366 100644 --- a/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp +++ b/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/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.h b/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.h index 311ba05d76a2..8cecb4d496ab 100644 --- a/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.h +++ b/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/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp b/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp index 1ffdc1ab7c8e..b9f493294a03 100644 --- a/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp +++ b/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/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.h b/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.h index 2b15611df47b..30aa42c964a5 100644 --- a/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.h +++ b/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/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp b/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp index 02459045869a..d69a02e41d51 100644 --- a/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp +++ b/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/source/Plugins/Platform/MacOSX/PlatformDarwin.h b/source/Plugins/Platform/MacOSX/PlatformDarwin.h index 9430c269c27e..6495609ac495 100644 --- a/source/Plugins/Platform/MacOSX/PlatformDarwin.h +++ b/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/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp b/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp index 08df0565acc8..f168fb6fda5e 100644 --- a/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp +++ b/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/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h b/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h index 6ee5916e613a..9b3ec5e0d717 100644 --- a/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h +++ b/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/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp b/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp index 11d0457a783e..c08417a80ae4 100644 --- a/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp +++ b/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/source/Plugins/Platform/MacOSX/PlatformMacOSX.h b/source/Plugins/Platform/MacOSX/PlatformMacOSX.h index d5b5d69f1fb3..d1e609258d4d 100644 --- a/source/Plugins/Platform/MacOSX/PlatformMacOSX.h +++ b/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/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp b/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp index 6fdaa5997b46..38facc4aa124 100644 --- a/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp +++ b/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/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp b/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp index 186926430973..bbd8f1698937 100644 --- a/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp +++ b/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/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp b/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp index 0302e7b3aaf8..f7395fb8cf3d 100644 --- a/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp +++ b/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/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.h b/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.h index 55fb4f920c66..f159e8575d76 100644 --- a/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.h +++ b/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/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp b/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp index ec1109fb4b44..c52b636c8496 100644 --- a/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp +++ b/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/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp b/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp index 9a082c701f02..3037dd854be7 100644 --- a/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp +++ b/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/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.h b/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.h index c8c7872b530d..2d81d6229f73 100644 --- a/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.h +++ b/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/source/Plugins/Platform/MacOSX/PlatformiOSSimulatorCoreSimulatorSupport.h b/source/Plugins/Platform/MacOSX/PlatformiOSSimulatorCoreSimulatorSupport.h index 2a2a6f73a0e1..31e11a60e419 100644 --- a/source/Plugins/Platform/MacOSX/PlatformiOSSimulatorCoreSimulatorSupport.h +++ b/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/source/Plugins/Platform/MacOSX/PlatformiOSSimulatorCoreSimulatorSupport.mm b/source/Plugins/Platform/MacOSX/PlatformiOSSimulatorCoreSimulatorSupport.mm index de92aa0de7aa..6a49b645c1e1 100644 --- a/source/Plugins/Platform/MacOSX/PlatformiOSSimulatorCoreSimulatorSupport.mm +++ b/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/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp b/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp index 409f12deefca..9df5b9fac380 100644 --- a/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp +++ b/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/source/Plugins/Platform/NetBSD/PlatformNetBSD.h b/source/Plugins/Platform/NetBSD/PlatformNetBSD.h index 500c61dab970..b1aaa4ab5f59 100644 --- a/source/Plugins/Platform/NetBSD/PlatformNetBSD.h +++ b/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/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp b/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp index e3816d0276b2..edb8ec951d37 100644 --- a/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp +++ b/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/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp b/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp index 0032c804987c..f4cf22ad7583 100644 --- a/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp +++ b/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/source/Plugins/Platform/POSIX/PlatformPOSIX.h b/source/Plugins/Platform/POSIX/PlatformPOSIX.h index 6c5c62797a6e..742702b07b88 100644 --- a/source/Plugins/Platform/POSIX/PlatformPOSIX.h +++ b/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/source/Plugins/Platform/Windows/PlatformWindows.cpp b/source/Plugins/Platform/Windows/PlatformWindows.cpp index f57842ee6e51..3535df0c65cc 100644 --- a/source/Plugins/Platform/Windows/PlatformWindows.cpp +++ b/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/source/Plugins/Platform/Windows/PlatformWindows.h b/source/Plugins/Platform/Windows/PlatformWindows.h index 375d5c5dad2f..9af42116680e 100644 --- a/source/Plugins/Platform/Windows/PlatformWindows.h +++ b/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/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp b/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp index 218c62860114..645bfdfa770d 100644 --- a/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp +++ b/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 @@ -784,7 +784,7 @@ const UnixSignalsSP &PlatformRemoteGDBServer::GetRemoteUnixSignals() { if (!dict->GetValueForKeyAsInteger("signo", signo)) return false; - std::string name; + llvm::StringRef name; if (!dict->GetValueForKeyAsString("name", name)) return false; @@ -809,7 +809,7 @@ const UnixSignalsSP &PlatformRemoteGDBServer::GetRemoteUnixSignals() { if (object_sp && object_sp->IsValid()) description = object_sp->GetStringValue(); - remote_signals_sp->AddSignal(signo, name.c_str(), suppress, stop, + remote_signals_sp->AddSignal(signo, name.str().c_str(), suppress, stop, notify, description.c_str()); return true; }); @@ -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/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h b/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h index edc223a2d7fb..210544f752e6 100644 --- a/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h +++ b/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/source/Plugins/Process/Darwin/DarwinProcessLauncher.cpp b/source/Plugins/Process/Darwin/DarwinProcessLauncher.cpp index feb7a11584f8..6845a36730c9 100644 --- a/source/Plugins/Process/Darwin/DarwinProcessLauncher.cpp +++ b/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/source/Plugins/Process/Darwin/DarwinProcessLauncher.h b/source/Plugins/Process/Darwin/DarwinProcessLauncher.h index d1af4d09f8b7..a0e8ce5cb9dc 100644 --- a/source/Plugins/Process/Darwin/DarwinProcessLauncher.h +++ b/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/source/Plugins/Process/Darwin/MachException.cpp b/source/Plugins/Process/Darwin/MachException.cpp index 5a97a4b01be3..7d956dfc6506 100644 --- a/source/Plugins/Process/Darwin/MachException.cpp +++ b/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/source/Plugins/Process/Darwin/MachException.h b/source/Plugins/Process/Darwin/MachException.h index ac8cd7030c55..2da6a36a921e 100644 --- a/source/Plugins/Process/Darwin/MachException.h +++ b/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/source/Plugins/Process/Darwin/NativeProcessDarwin.cpp b/source/Plugins/Process/Darwin/NativeProcessDarwin.cpp index 65ab12fe1adf..f6c8c78ccb73 100644 --- a/source/Plugins/Process/Darwin/NativeProcessDarwin.cpp +++ b/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/source/Plugins/Process/Darwin/NativeProcessDarwin.h b/source/Plugins/Process/Darwin/NativeProcessDarwin.h index 01fdd64b1273..2214bbc52ca4 100644 --- a/source/Plugins/Process/Darwin/NativeProcessDarwin.h +++ b/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/source/Plugins/Process/Darwin/NativeThreadDarwin.cpp b/source/Plugins/Process/Darwin/NativeThreadDarwin.cpp index b04f9053136b..07398ab7b678 100644 --- a/source/Plugins/Process/Darwin/NativeThreadDarwin.cpp +++ b/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/source/Plugins/Process/Darwin/NativeThreadDarwin.h b/source/Plugins/Process/Darwin/NativeThreadDarwin.h index b8d9089e673e..f66f8fe8738c 100644 --- a/source/Plugins/Process/Darwin/NativeThreadDarwin.h +++ b/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/source/Plugins/Process/Darwin/NativeThreadListDarwin.cpp b/source/Plugins/Process/Darwin/NativeThreadListDarwin.cpp index fa06fb8b2a5f..7d44adeec375 100644 --- a/source/Plugins/Process/Darwin/NativeThreadListDarwin.cpp +++ b/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/source/Plugins/Process/Darwin/NativeThreadListDarwin.h b/source/Plugins/Process/Darwin/NativeThreadListDarwin.h index 2b194bcc1537..7b59afb96e95 100644 --- a/source/Plugins/Process/Darwin/NativeThreadListDarwin.h +++ b/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/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp b/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp index 93d294fd040a..3046150e3246 100644 --- a/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp +++ b/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/source/Plugins/Process/FreeBSD/ProcessFreeBSD.h b/source/Plugins/Process/FreeBSD/ProcessFreeBSD.h index 063eb6f68123..7ed2a56cd549 100644 --- a/source/Plugins/Process/FreeBSD/ProcessFreeBSD.h +++ b/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/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp b/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp index 68ab41651162..1667490f1344 100644 --- a/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp +++ b/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/source/Plugins/Process/FreeBSD/ProcessMonitor.h b/source/Plugins/Process/FreeBSD/ProcessMonitor.h index 58629189b7b8..0963453a31b1 100644 --- a/source/Plugins/Process/FreeBSD/ProcessMonitor.h +++ b/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/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_arm.cpp b/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_arm.cpp index 14171d614c9e..59d42b9ad72e 100644 --- a/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_arm.cpp +++ b/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/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_arm64.cpp b/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_arm64.cpp index 8a8eb0520cca..93ffeb5ea79b 100644 --- a/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_arm64.cpp +++ b/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/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_mips64.cpp b/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_mips64.cpp index ab50a5db3f3e..b911ee222015 100644 --- a/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_mips64.cpp +++ b/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/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_powerpc.cpp b/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_powerpc.cpp index 70eec945ce8d..bc1d4df89fc8 100644 --- a/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_powerpc.cpp +++ b/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/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_x86.cpp b/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_x86.cpp index 036306058ff8..1cd8f1aafa6e 100644 --- a/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_x86.cpp +++ b/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/source/Plugins/Process/Linux/NativeProcessLinux.cpp b/source/Plugins/Process/Linux/NativeProcessLinux.cpp index 914d690ad88c..15e7c9b5f698 100644 --- a/source/Plugins/Process/Linux/NativeProcessLinux.cpp +++ b/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/source/Plugins/Process/Linux/NativeProcessLinux.h b/source/Plugins/Process/Linux/NativeProcessLinux.h index e4809d082b50..98fc88baab6e 100644 --- a/source/Plugins/Process/Linux/NativeProcessLinux.h +++ b/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/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp b/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp index be256e972215..43253f388019 100644 --- a/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp +++ b/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/source/Plugins/Process/Linux/NativeRegisterContextLinux.h b/source/Plugins/Process/Linux/NativeRegisterContextLinux.h index 4dfc5365f357..26074a6ce0e3 100644 --- a/source/Plugins/Process/Linux/NativeRegisterContextLinux.h +++ b/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/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp b/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp index 2dd23ad75a03..22b7d10869fe 100644 --- a/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp +++ b/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/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.h b/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.h index 824ac88ad9ef..ec99c05e1644 100644 --- a/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.h +++ b/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/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp b/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp index f3715147fa3e..c3b58f16256a 100644 --- a/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp +++ b/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/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h b/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h index 4ffbd97ee33a..9877dec37c48 100644 --- a/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h +++ b/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/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp b/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp index 7c5c42477170..dee2c064a346 100644 --- a/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp +++ b/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/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.h b/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.h index 1b25609205df..3e14da5a2725 100644 --- a/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.h +++ b/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/source/Plugins/Process/Linux/NativeRegisterContextLinux_s390x.cpp b/source/Plugins/Process/Linux/NativeRegisterContextLinux_s390x.cpp index 3e782d39f72e..c2a696e08bf9 100644 --- a/source/Plugins/Process/Linux/NativeRegisterContextLinux_s390x.cpp +++ b/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/source/Plugins/Process/Linux/NativeRegisterContextLinux_s390x.h b/source/Plugins/Process/Linux/NativeRegisterContextLinux_s390x.h index 4bd737767fa4..3ffbaeeb0bba 100644 --- a/source/Plugins/Process/Linux/NativeRegisterContextLinux_s390x.h +++ b/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/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp b/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp index dd35705a8ae8..59dc9e9f7d45 100755 --- a/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp +++ b/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/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.h b/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.h index cc05ec06b297..abb0dba4d91c 100644 --- a/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.h +++ b/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/source/Plugins/Process/Linux/NativeThreadLinux.cpp b/source/Plugins/Process/Linux/NativeThreadLinux.cpp index 04b6fe6d71e9..b1d13668f327 100644 --- a/source/Plugins/Process/Linux/NativeThreadLinux.cpp +++ b/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/source/Plugins/Process/Linux/NativeThreadLinux.h b/source/Plugins/Process/Linux/NativeThreadLinux.h index 42697497c0af..b9126b3752a0 100644 --- a/source/Plugins/Process/Linux/NativeThreadLinux.h +++ b/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/source/Plugins/Process/Linux/SingleStepCheck.cpp b/source/Plugins/Process/Linux/SingleStepCheck.cpp index 4e979bd45532..251cb4b2f10a 100644 --- a/source/Plugins/Process/Linux/SingleStepCheck.cpp +++ b/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; @@ -66,7 +66,7 @@ bool WorkaroundNeeded() { Log *log = ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_THREAD); ::pid_t child_pid = fork(); if (child_pid == -1) { - LLDB_LOG(log, "failed to fork(): {0}", Error(errno, eErrorTypePOSIX)); + LLDB_LOG(log, "failed to fork(): {0}", Status(errno, eErrorTypePOSIX)); return false; } if (child_pid == 0) @@ -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/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp b/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp index da0ed9aa0c6a..46d522531a5b 100644 --- a/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp +++ b/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/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.h b/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.h index eed3daa4647e..afac6601a56b 100644 --- a/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.h +++ b/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/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp b/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp index 6b2e675afaea..f01f1ace583c 100644 --- a/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp +++ b/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/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h b/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h index 8f1033b9fd36..52b9441e0e79 100644 --- a/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h +++ b/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; |