diff options
Diffstat (limited to 'source/Core')
32 files changed, 249 insertions, 243 deletions
diff --git a/source/Core/Address.cpp b/source/Core/Address.cpp index 91229a9b18eb1..6328e433852a0 100644 --- a/source/Core/Address.cpp +++ b/source/Core/Address.cpp @@ -33,8 +33,8 @@ #include "lldb/Utility/ConstString.h" // for ConstString #include "lldb/Utility/DataExtractor.h" // for DataExtractor #include "lldb/Utility/Endian.h" // for InlHostByteOrder -#include "lldb/Utility/Error.h" // for Error #include "lldb/Utility/FileSpec.h" // for FileSpec +#include "lldb/Utility/Status.h" // for Status #include "lldb/Utility/Stream.h" // for Stream #include "lldb/Utility/StreamString.h" // for StreamString @@ -67,7 +67,7 @@ static size_t ReadBytes(ExecutionContextScope *exe_scope, TargetSP target_sp(exe_scope->CalculateTarget()); if (target_sp) { - Error error; + Status error; bool prefer_file_cache = false; return target_sp->ReadMemory(address, prefer_file_cache, dst, dst_len, error); @@ -322,7 +322,7 @@ addr_t Address::GetCallableLoadAddress(Target *target, bool is_indirect) const { if (is_indirect && target) { ProcessSP processSP = target->GetProcessSP(); - Error error; + Status error; if (processSP) { code_addr = processSP->ResolveIndirectFunction(this, error); if (!error.Success()) @@ -734,7 +734,7 @@ bool Address::Dump(Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, if (process) { addr_t load_addr = GetLoadAddress(target); if (load_addr != LLDB_INVALID_ADDRESS) { - Error memory_error; + Status memory_error; addr_t dereferenced_load_addr = process->ReadPointerFromMemory(load_addr, memory_error); if (dereferenced_load_addr != LLDB_INVALID_ADDRESS) { diff --git a/source/Core/ArchSpec.cpp b/source/Core/ArchSpec.cpp index 7c1b399177fd9..91b73847ac1f3 100644 --- a/source/Core/ArchSpec.cpp +++ b/source/Core/ArchSpec.cpp @@ -1555,7 +1555,7 @@ static void StopInfoOverrideCallbackTypeARM(lldb_private::Thread &thread) { #if 0 // ARM mode: check for condition on intsruction const addr_t pc = reg_ctx_sp->GetPC(); - Error error; + Status error; // If we fail to read the opcode we will get UINT64_MAX as the // result in "opcode" which we can use to detect if we read a // valid opcode. @@ -1635,7 +1635,7 @@ void ArchSpec::PiecewiseTripleCompare( } bool ArchSpec::IsAlwaysThumbInstructions() const { - std::string Error; + std::string Status; if (GetTriple().getArch() == llvm::Triple::arm || GetTriple().getArch() == llvm::Triple::thumb) { // v. https://en.wikipedia.org/wiki/ARM_Cortex-M diff --git a/source/Core/Communication.cpp b/source/Core/Communication.cpp index a543858582efd..72873a9510b53 100644 --- a/source/Core/Communication.cpp +++ b/source/Core/Communication.cpp @@ -15,9 +15,9 @@ #include "lldb/Host/HostThread.h" #include "lldb/Host/ThreadLauncher.h" #include "lldb/Utility/ConstString.h" // for ConstString -#include "lldb/Utility/Error.h" // for Error #include "lldb/Utility/Log.h" #include "lldb/Utility/Logging.h" // for LogIfAnyCategoriesSet, LIBLLDB... +#include "lldb/Utility/Status.h" // for Status #include "llvm/ADT/None.h" // for None #include "llvm/ADT/Optional.h" // for Optional @@ -75,7 +75,7 @@ void Communication::Clear() { StopReadThread(nullptr); } -ConnectionStatus Communication::Connect(const char *url, Error *error_ptr) { +ConnectionStatus Communication::Connect(const char *url, Status *error_ptr) { Clear(); lldb_private::LogIfAnyCategoriesSet(LIBLLDB_LOG_COMMUNICATION, @@ -90,7 +90,7 @@ ConnectionStatus Communication::Connect(const char *url, Error *error_ptr) { return eConnectionStatusNoConnection; } -ConnectionStatus Communication::Disconnect(Error *error_ptr) { +ConnectionStatus Communication::Disconnect(Status *error_ptr) { lldb_private::LogIfAnyCategoriesSet(LIBLLDB_LOG_COMMUNICATION, "%p Communication::Disconnect ()", this); @@ -123,7 +123,7 @@ bool Communication::HasConnection() const { size_t Communication::Read(void *dst, size_t dst_len, const Timeout<std::micro> &timeout, - ConnectionStatus &status, Error *error_ptr) { + ConnectionStatus &status, Status *error_ptr) { Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_COMMUNICATION); LLDB_LOG( log, @@ -170,7 +170,7 @@ size_t Communication::Read(void *dst, size_t dst_len, } size_t Communication::Write(const void *src, size_t src_len, - ConnectionStatus &status, Error *error_ptr) { + ConnectionStatus &status, Status *error_ptr) { lldb::ConnectionSP connection_sp(m_connection_sp); std::lock_guard<std::mutex> guard(m_write_mutex); @@ -189,7 +189,7 @@ size_t Communication::Write(const void *src, size_t src_len, return 0; } -bool Communication::StartReadThread(Error *error_ptr) { +bool Communication::StartReadThread(Status *error_ptr) { if (error_ptr) error_ptr->Clear(); @@ -212,7 +212,7 @@ bool Communication::StartReadThread(Error *error_ptr) { return m_read_thread_enabled; } -bool Communication::StopReadThread(Error *error_ptr) { +bool Communication::StopReadThread(Status *error_ptr) { if (!m_read_thread.IsJoinable()) return true; @@ -225,15 +225,15 @@ bool Communication::StopReadThread(Error *error_ptr) { // error = m_read_thread.Cancel(); - Error error = m_read_thread.Join(nullptr); + Status error = m_read_thread.Join(nullptr); return error.Success(); } -bool Communication::JoinReadThread(Error *error_ptr) { +bool Communication::JoinReadThread(Status *error_ptr) { if (!m_read_thread.IsJoinable()) return true; - Error error = m_read_thread.Join(nullptr); + Status error = m_read_thread.Join(nullptr); return error.Success(); } @@ -280,7 +280,7 @@ void Communication::AppendBytesToCache(const uint8_t *bytes, size_t len, size_t Communication::ReadFromConnection(void *dst, size_t dst_len, const Timeout<std::micro> &timeout, ConnectionStatus &status, - Error *error_ptr) { + Status *error_ptr) { lldb::ConnectionSP connection_sp(m_connection_sp); if (connection_sp) return connection_sp->Read(dst, dst_len, timeout, status, error_ptr); @@ -303,7 +303,7 @@ lldb::thread_result_t Communication::ReadThread(lldb::thread_arg_t p) { uint8_t buf[1024]; - Error error; + Status error; ConnectionStatus status = eConnectionStatusSuccess; bool done = false; while (!done && comm->m_read_thread_enabled) { diff --git a/source/Core/Debugger.cpp b/source/Core/Debugger.cpp index 751ceed13149e..75fcedb10156f 100644 --- a/source/Core/Debugger.cpp +++ b/source/Core/Debugger.cpp @@ -287,9 +287,10 @@ enum { LoadPluginCallbackType Debugger::g_load_plugin_callback = nullptr; -Error Debugger::SetPropertyValue(const ExecutionContext *exe_ctx, - VarSetOperationType op, - llvm::StringRef property_path, llvm::StringRef value) { +Status Debugger::SetPropertyValue(const ExecutionContext *exe_ctx, + VarSetOperationType op, + llvm::StringRef property_path, + llvm::StringRef value) { bool is_load_script = (property_path == "target.load-script-from-symbol-file"); bool is_escape_non_printables = (property_path == "escape-non-printables"); TargetSP target_sp; @@ -299,7 +300,7 @@ Error Debugger::SetPropertyValue(const ExecutionContext *exe_ctx, load_script_old_value = target_sp->TargetProperties::GetLoadScriptFromSymbolFile(); } - Error error(Properties::SetPropertyValue(exe_ctx, op, property_path, value)); + Status error(Properties::SetPropertyValue(exe_ctx, op, property_path, value)); if (error.Success()) { // FIXME it would be nice to have "on-change" callbacks for properties if (property_path == g_properties[ePropertyPrompt].name) { @@ -321,7 +322,7 @@ Error Debugger::SetPropertyValue(const ExecutionContext *exe_ctx, load_script_old_value == eLoadScriptFromSymFileWarn) { if (target_sp->TargetProperties::GetLoadScriptFromSymbolFile() == eLoadScriptFromSymFileTrue) { - std::list<Error> errors; + std::list<Status> errors; StreamString feedback_stream; if (!target_sp->LoadScriptingResources(errors, &feedback_stream)) { StreamFileSP stream_sp(GetErrorFile()); @@ -550,7 +551,7 @@ void Debugger::SettingsInitialize() { Target::SettingsInitialize(); } void Debugger::SettingsTerminate() { Target::SettingsTerminate(); } -bool Debugger::LoadPlugin(const FileSpec &spec, Error &error) { +bool Debugger::LoadPlugin(const FileSpec &spec, Status &error) { if (g_load_plugin_callback) { llvm::sys::DynamicLibrary dynlib = g_load_plugin_callback(shared_from_this(), spec, error); @@ -570,7 +571,7 @@ bool Debugger::LoadPlugin(const FileSpec &spec, Error &error) { static FileSpec::EnumerateDirectoryResult LoadPluginCallback(void *baton, llvm::sys::fs::file_type ft, const FileSpec &file_spec) { - Error error; + Status error; static ConstString g_dylibext("dylib"); static ConstString g_solibext("so"); @@ -595,7 +596,7 @@ LoadPluginCallback(void *baton, llvm::sys::fs::file_type ft, return FileSpec::eEnumerateDirectoryResultNext; } - Error plugin_load_error; + Status plugin_load_error; debugger->LoadPlugin(plugin_file_spec, plugin_load_error); return FileSpec::eEnumerateDirectoryResultNext; @@ -1365,7 +1366,7 @@ size_t Debugger::GetProcessSTDOUT(Process *process, Stream *stream) { process = target_sp->GetProcessSP().get(); } if (process) { - Error error; + Status error; size_t len; char stdio_buffer[1024]; while ((len = process->GetSTDOUT(stdio_buffer, sizeof(stdio_buffer), @@ -1393,7 +1394,7 @@ size_t Debugger::GetProcessSTDERR(Process *process, Stream *stream) { process = target_sp->GetProcessSP().get(); } if (process) { - Error error; + Status error; size_t len; char stdio_buffer[1024]; while ((len = process->GetSTDERR(stdio_buffer, sizeof(stdio_buffer), @@ -1463,7 +1464,7 @@ void Debugger::HandleProcessEvent(const EventSP &event_sp) { EventDataStructuredData::GetObjectFromEvent(event_sp.get()); if (output_stream_sp) { StreamString content_stream; - Error error = + Status error = plugin_sp->GetDescription(structured_data_sp, content_stream); if (error.Success()) { if (!content_stream.GetString().empty()) { @@ -1702,8 +1703,8 @@ Target *Debugger::GetSelectedOrDummyTarget(bool prefer_dummy) { return GetDummyTarget(); } -Error Debugger::RunREPL(LanguageType language, const char *repl_options) { - Error err; +Status Debugger::RunREPL(LanguageType language, const char *repl_options) { + Status err; FileSpec repl_executable; if (language == eLanguageTypeUnknown) { diff --git a/source/Core/Disassembler.cpp b/source/Core/Disassembler.cpp index 51d93d9acdbbe..0a5d763b6d3f1 100644 --- a/source/Core/Disassembler.cpp +++ b/source/Core/Disassembler.cpp @@ -35,8 +35,8 @@ #include "lldb/Target/Thread.h" // for Thread #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/DataExtractor.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/RegularExpression.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/Stream.h" // for Stream #include "lldb/Utility/StreamString.h" // for StreamString #include "lldb/lldb-private-enumerations.h" // for InstructionType:... @@ -59,7 +59,8 @@ using namespace lldb_private; DisassemblerSP Disassembler::FindPlugin(const ArchSpec &arch, const char *flavor, const char *plugin_name) { - Timer scoped_timer(LLVM_PRETTY_FUNCTION, + static Timer::Category func_cat(LLVM_PRETTY_FUNCTION); + Timer scoped_timer(func_cat, "Disassembler::FindPlugin (arch = %s, plugin_name = %s)", arch.GetArchitectureName(), plugin_name); @@ -340,7 +341,7 @@ bool Disassembler::ElideMixedSourceAndDisassemblyLine( } else { TargetSP target_sp = exe_ctx.GetTargetSP(); if (target_sp) { - Error error; + Status error; OptionValueSP value_sp = target_sp->GetDebugger().GetPropertyValue( &exe_ctx, "target.process.thread.step-avoid-regexp", false, error); if (value_sp && value_sp->GetType() == OptionValue::eTypeRegex) { @@ -1118,7 +1119,7 @@ InstructionList::GetIndexOfNextBranchInstruction(uint32_t start, while (i > start) { --i; - Error error; + Status error; uint32_t inst_bytes; bool prefer_file_cache = false; // Read from process if process is running lldb::addr_t load_addr = LLDB_INVALID_ADDRESS; @@ -1179,7 +1180,7 @@ size_t Disassembler::ParseInstructions(const ExecutionContext *exe_ctx, auto data_sp = std::make_shared<DataBufferHeap>(byte_size, '\0'); - Error error; + Status error; lldb::addr_t load_addr = LLDB_INVALID_ADDRESS; const size_t bytes_read = target->ReadMemory( range.GetBaseAddress(), prefer_file_cache, data_sp->GetBytes(), @@ -1224,7 +1225,7 @@ size_t Disassembler::ParseInstructions(const ExecutionContext *exe_ctx, DataBufferHeap *heap_buffer = new DataBufferHeap(byte_size, '\0'); DataBufferSP data_sp(heap_buffer); - Error error; + Status error; lldb::addr_t load_addr = LLDB_INVALID_ADDRESS; const size_t bytes_read = target->ReadMemory(start, prefer_file_cache, heap_buffer->GetBytes(), @@ -1460,4 +1461,3 @@ std::function<bool(const Instruction::Operand &)> lldb_private::OperandMatchers::MatchOpType(Instruction::Operand::Type type) { return [type](const Instruction::Operand &op) { return op.m_type == type; }; } - diff --git a/source/Core/DynamicLoader.cpp b/source/Core/DynamicLoader.cpp index 03fad244acfc4..5477498dadc8c 100644 --- a/source/Core/DynamicLoader.cpp +++ b/source/Core/DynamicLoader.cpp @@ -181,7 +181,7 @@ ModuleSP DynamicLoader::LoadModuleAtAddress(const FileSpec &file, // address to read the file out of the memory instead of a load bias. bool is_loaded = false; lldb::addr_t load_addr; - Error error = m_process->GetFileLoadAddress(file, is_loaded, load_addr); + Status error = m_process->GetFileLoadAddress(file, is_loaded, load_addr); if (error.Success() && is_loaded) { check_alternative_file_name = false; base_addr = load_addr; @@ -193,7 +193,7 @@ ModuleSP DynamicLoader::LoadModuleAtAddress(const FileSpec &file, // different name based on the memory region info. if (check_alternative_file_name) { MemoryRegionInfo memory_info; - Error error = m_process->GetMemoryRegionInfo(base_addr, memory_info); + Status error = m_process->GetMemoryRegionInfo(base_addr, memory_info); if (error.Success() && memory_info.GetMapped() && memory_info.GetRange().GetRangeBase() == base_addr && !(memory_info.GetName().IsEmpty())) { @@ -223,7 +223,7 @@ ModuleSP DynamicLoader::LoadModuleAtAddress(const FileSpec &file, int64_t DynamicLoader::ReadUnsignedIntWithSizeInBytes(addr_t addr, int size_in_bytes) { - Error error; + Status error; uint64_t value = m_process->ReadUnsignedIntegerFromMemory(addr, size_in_bytes, 0, error); if (error.Fail()) @@ -233,7 +233,7 @@ int64_t DynamicLoader::ReadUnsignedIntWithSizeInBytes(addr_t addr, } addr_t DynamicLoader::ReadPointer(addr_t addr) { - Error error; + Status error; addr_t value = m_process->ReadPointerFromMemory(addr, error); if (error.Fail()) return LLDB_INVALID_ADDRESS; diff --git a/source/Core/EmulateInstruction.cpp b/source/Core/EmulateInstruction.cpp index f18a4af67ef92..2ee2c79de2708 100644 --- a/source/Core/EmulateInstruction.cpp +++ b/source/Core/EmulateInstruction.cpp @@ -19,7 +19,7 @@ #include "lldb/Target/StackFrame.h" // for StackFrame #include "lldb/Utility/ConstString.h" // for ConstString #include "lldb/Utility/DataExtractor.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/Stream.h" // for Stream, Stream::::eBinary #include "lldb/Utility/StreamString.h" #include "lldb/lldb-forward.h" // for ProcessSP @@ -263,7 +263,7 @@ size_t EmulateInstruction::ReadMemoryFrame(EmulateInstruction *instruction, ProcessSP process_sp(frame->CalculateProcess()); if (process_sp) { - Error error; + Status error; return process_sp->ReadMemory(addr, dst, dst_len, error); } return 0; @@ -280,7 +280,7 @@ size_t EmulateInstruction::WriteMemoryFrame(EmulateInstruction *instruction, ProcessSP process_sp(frame->CalculateProcess()); if (process_sp) { - Error error; + Status error; return process_sp->WriteMemory(addr, src, src_len, error); } diff --git a/source/Core/FormatEntity.cpp b/source/Core/FormatEntity.cpp index 835a1c54a0e05..9fb294aad2fb9 100644 --- a/source/Core/FormatEntity.cpp +++ b/source/Core/FormatEntity.cpp @@ -303,7 +303,7 @@ void FormatEntity::Entry::AppendText(const char *cstr) { return AppendText(llvm::StringRef(cstr)); } -Error FormatEntity::Parse(const llvm::StringRef &format_str, Entry &entry) { +Status FormatEntity::Parse(const llvm::StringRef &format_str, Entry &entry) { entry.Clear(); entry.type = Entry::Type::Root; llvm::StringRef modifiable_format(format_str); @@ -408,7 +408,7 @@ static bool RunScriptFormatKeyword(Stream &s, const SymbolContext *sc, ScriptInterpreter *script_interpreter = target->GetDebugger().GetCommandInterpreter().GetScriptInterpreter(); if (script_interpreter) { - Error error; + Status error; std::string script_output; if (script_interpreter->RunScriptFormatKeyword(script_function_name, t, @@ -778,7 +778,7 @@ static bool DumpValue(Stream &s, const SymbolContext *sc, var_name_final_if_array_range, index_lower, index_higher); - Error error; + Status error; const std::string &expr_path = entry.string; @@ -824,7 +824,7 @@ static bool DumpValue(Stream &s, const SymbolContext *sc, // this happens when we are not going through // GetValueForVariableExpressionPath // to get to the target ValueObject - Error error; + Status error; target = target->Dereference(error).get(); if (error.Fail()) { if (log) @@ -1050,7 +1050,7 @@ static bool FormatThreadExtendedInfoRecurse( s.Printf("%f", value->GetAsFloat()->GetValue()); return true; } else if (value->GetType() == StructuredData::Type::eTypeString) { - s.Printf("%s", value->GetAsString()->GetValue().c_str()); + s.Format("{0}", value->GetAsString()->GetValue()); return true; } else if (value->GetType() == StructuredData::Type::eTypeArray) { if (value->GetAsArray()->GetSize() > 0) { @@ -1079,7 +1079,7 @@ bool FormatEntity::FormatStringRef(const llvm::StringRef &format_str, Stream &s, bool initial_function) { if (!format_str.empty()) { FormatEntity::Entry root; - Error error = FormatEntity::Parse(format_str, root); + Status error = FormatEntity::Parse(format_str, root); if (error.Success()) { return FormatEntity::Format(root, s, sc, exe_ctx, addr, valobj, function_changed, initial_function); @@ -1096,7 +1096,7 @@ bool FormatEntity::FormatCString(const char *format, Stream &s, if (format && format[0]) { FormatEntity::Entry root; llvm::StringRef format_str(format); - Error error = FormatEntity::Parse(format_str, root); + Status error = FormatEntity::Parse(format_str, root); if (error.Success()) { return FormatEntity::Format(root, s, sc, exe_ctx, addr, valobj, function_changed, initial_function); @@ -1866,10 +1866,10 @@ static bool DumpCommaSeparatedChildEntryNames( return false; } -static Error ParseEntry(const llvm::StringRef &format_str, - const FormatEntity::Entry::Definition *parent, - FormatEntity::Entry &entry) { - Error error; +static Status ParseEntry(const llvm::StringRef &format_str, + const FormatEntity::Entry::Definition *parent, + FormatEntity::Entry &entry) { + Status error; const size_t sep_pos = format_str.find_first_of(".[:"); const char sep_char = @@ -1956,7 +1956,7 @@ static const FormatEntity::Entry::Definition * FindEntry(const llvm::StringRef &format_str, const FormatEntity::Entry::Definition *parent, llvm::StringRef &remainder) { - Error error; + Status error; std::pair<llvm::StringRef, llvm::StringRef> p = format_str.split('.'); const size_t n = parent->num_children; @@ -1983,9 +1983,9 @@ FindEntry(const llvm::StringRef &format_str, return parent; } -Error FormatEntity::ParseInternal(llvm::StringRef &format, Entry &parent_entry, - uint32_t depth) { - Error error; +Status FormatEntity::ParseInternal(llvm::StringRef &format, Entry &parent_entry, + uint32_t depth) { + Status error; while (!format.empty() && error.Success()) { const size_t non_special_chars = format.find_first_of("${}\\"); @@ -2279,10 +2279,10 @@ Error FormatEntity::ParseInternal(llvm::StringRef &format, Entry &parent_entry, return error; } -Error FormatEntity::ExtractVariableInfo(llvm::StringRef &format_str, - llvm::StringRef &variable_name, - llvm::StringRef &variable_format) { - Error error; +Status FormatEntity::ExtractVariableInfo(llvm::StringRef &format_str, + llvm::StringRef &variable_name, + llvm::StringRef &variable_format) { + Status error; variable_name = llvm::StringRef(); variable_format = llvm::StringRef(); diff --git a/source/Core/IOHandler.cpp b/source/Core/IOHandler.cpp index b5dd0bd8a25f0..e5fe490991f9b 100644 --- a/source/Core/IOHandler.cpp +++ b/source/Core/IOHandler.cpp @@ -27,7 +27,7 @@ #include "lldb/Core/StreamFile.h" #include "lldb/Host/File.h" // for File #include "lldb/Host/Predicate.h" // for Predicate, ::eBroad... -#include "lldb/Utility/Error.h" // for Error +#include "lldb/Utility/Status.h" // for Status #include "lldb/Utility/StreamString.h" // for StreamString #include "lldb/Utility/StringList.h" // for StringList #include "lldb/lldb-forward.h" // for StreamFileSP @@ -515,7 +515,7 @@ bool IOHandlerEditline::GetLines(StringList &lines, bool &interrupted) { } else { #endif bool done = false; - Error error; + Status error; while (!done) { // Show line numbers if we are asked to @@ -4640,7 +4640,7 @@ void IOHandlerCursesGUI::Activate() { WindowSP threads_window_sp( main_window_sp->CreateSubWindow("Threads", threads_bounds, false)); WindowSP status_window_sp( - main_window_sp->CreateSubWindow("Status", status_bounds, false)); + main_window_sp->CreateSubWindow("Error", status_bounds, false)); status_window_sp->SetCanBeActive( false); // Don't let the status bar become the active window main_window_sp->SetDelegate( diff --git a/source/Core/Mangled.cpp b/source/Core/Mangled.cpp index 3d96340b911ce..c2e9b8904a0ad 100644 --- a/source/Core/Mangled.cpp +++ b/source/Core/Mangled.cpp @@ -258,8 +258,8 @@ Mangled::GetDemangledName(lldb::LanguageType language) const { // haven't already decoded our mangled name. if (m_mangled && !m_demangled) { // We need to generate and cache the demangled name. - Timer scoped_timer(LLVM_PRETTY_FUNCTION, - "Mangled::GetDemangledName (m_mangled = %s)", + static Timer::Category func_cat(LLVM_PRETTY_FUNCTION); + Timer scoped_timer(func_cat, "Mangled::GetDemangledName (m_mangled = %s)", m_mangled.GetCString()); Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DEMANGLE); diff --git a/source/Core/Module.cpp b/source/Core/Module.cpp index d168474c3479b..1b510d2ff7b2b 100644 --- a/source/Core/Module.cpp +++ b/source/Core/Module.cpp @@ -39,10 +39,10 @@ #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" #include "lldb/Utility/DataBufferHeap.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/Log.h" #include "lldb/Utility/Logging.h" // for GetLogIfAn... #include "lldb/Utility/RegularExpression.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/Stream.h" // for Stream #include "lldb/Utility/StreamString.h" @@ -322,7 +322,7 @@ Module::~Module() { } ObjectFile *Module::GetMemoryObjectFile(const lldb::ProcessSP &process_sp, - lldb::addr_t header_addr, Error &error, + lldb::addr_t header_addr, Status &error, size_t size_to_read) { if (m_objfile_sp) { error.SetErrorString("object file already exists"); @@ -331,7 +331,7 @@ ObjectFile *Module::GetMemoryObjectFile(const lldb::ProcessSP &process_sp, if (process_sp) { m_did_load_objfile = true; auto data_ap = llvm::make_unique<DataBufferHeap>(size_to_read, 0); - Error readmem_error; + Status readmem_error; const size_t bytes_read = process_sp->ReadMemory(header_addr, data_ap->GetBytes(), data_ap->GetByteSize(), readmem_error); @@ -429,8 +429,8 @@ void Module::DumpSymbolContext(Stream *s) { size_t Module::GetNumCompileUnits() { std::lock_guard<std::recursive_mutex> guard(m_mutex); - Timer scoped_timer(LLVM_PRETTY_FUNCTION, - "Module::GetNumCompileUnits (module = %p)", + static Timer::Category func_cat(LLVM_PRETTY_FUNCTION); + Timer scoped_timer(func_cat, "Module::GetNumCompileUnits (module = %p)", static_cast<void *>(this)); SymbolVendor *symbols = GetSymbolVendor(); if (symbols) @@ -453,7 +453,8 @@ CompUnitSP Module::GetCompileUnitAtIndex(size_t index) { bool Module::ResolveFileAddress(lldb::addr_t vm_addr, Address &so_addr) { std::lock_guard<std::recursive_mutex> guard(m_mutex); - Timer scoped_timer(LLVM_PRETTY_FUNCTION, + static Timer::Category func_cat(LLVM_PRETTY_FUNCTION); + Timer scoped_timer(func_cat, "Module::ResolveFileAddress (vm_addr = 0x%" PRIx64 ")", vm_addr); SectionList *section_list = GetSectionList(); @@ -616,7 +617,8 @@ uint32_t Module::ResolveSymbolContextsForFileSpec(const FileSpec &file_spec, uint32_t resolve_scope, SymbolContextList &sc_list) { std::lock_guard<std::recursive_mutex> guard(m_mutex); - Timer scoped_timer(LLVM_PRETTY_FUNCTION, + static Timer::Category func_cat(LLVM_PRETTY_FUNCTION); + Timer scoped_timer(func_cat, "Module::ResolveSymbolContextForFilePath (%s:%u, " "check_inlines = %s, resolve_scope = 0x%8.8x)", file_spec.GetPath().c_str(), line, @@ -987,7 +989,8 @@ size_t Module::FindTypes_Impl( const CompilerDeclContext *parent_decl_ctx, bool append, size_t max_matches, llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files, TypeMap &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); if (!sc.module_sp || sc.module_sp.get() == this) { SymbolVendor *symbols = GetSymbolVendor(); if (symbols) @@ -1078,7 +1081,8 @@ SymbolVendor *Module::GetSymbolVendor(bool can_create, if (!m_did_load_symbol_vendor.load() && can_create) { ObjectFile *obj_file = GetObjectFile(); if (obj_file != nullptr) { - 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); m_symfile_ap.reset( SymbolVendor::FindPlugin(shared_from_this(), feedback_strm)); m_did_load_symbol_vendor = true; @@ -1278,8 +1282,8 @@ ObjectFile *Module::GetObjectFile() { if (!m_did_load_objfile.load()) { std::lock_guard<std::recursive_mutex> guard(m_mutex); if (!m_did_load_objfile.load()) { - Timer scoped_timer(LLVM_PRETTY_FUNCTION, - "Module::GetObjectFile () module = %s", + static Timer::Category func_cat(LLVM_PRETTY_FUNCTION); + Timer scoped_timer(func_cat, "Module::GetObjectFile () module = %s", GetFileSpec().GetFilename().AsCString("")); DataBufferSP data_sp; lldb::offset_t data_offset = 0; @@ -1338,9 +1342,9 @@ SectionList *Module::GetUnifiedSectionList() { const Symbol *Module::FindFirstSymbolWithNameAndType(const ConstString &name, SymbolType symbol_type) { + static Timer::Category func_cat(LLVM_PRETTY_FUNCTION); Timer scoped_timer( - LLVM_PRETTY_FUNCTION, - "Module::FindFirstSymbolWithNameAndType (name = %s, type = %i)", + func_cat, "Module::FindFirstSymbolWithNameAndType (name = %s, type = %i)", name.AsCString(), symbol_type); SymbolVendor *sym_vendor = GetSymbolVendor(); if (sym_vendor) { @@ -1372,7 +1376,8 @@ void Module::SymbolIndicesToSymbolContextList( size_t Module::FindFunctionSymbols(const ConstString &name, uint32_t name_type_mask, SymbolContextList &sc_list) { - Timer scoped_timer(LLVM_PRETTY_FUNCTION, + static Timer::Category func_cat(LLVM_PRETTY_FUNCTION); + Timer scoped_timer(func_cat, "Module::FindSymbolsFunctions (name = %s, mask = 0x%8.8x)", name.AsCString(), name_type_mask); SymbolVendor *sym_vendor = GetSymbolVendor(); @@ -1390,9 +1395,9 @@ size_t Module::FindSymbolsWithNameAndType(const ConstString &name, // No need to protect this call using m_mutex all other method calls are // already thread safe. + static Timer::Category func_cat(LLVM_PRETTY_FUNCTION); Timer scoped_timer( - LLVM_PRETTY_FUNCTION, - "Module::FindSymbolsWithNameAndType (name = %s, type = %i)", + func_cat, "Module::FindSymbolsWithNameAndType (name = %s, type = %i)", name.AsCString(), symbol_type); const size_t initial_size = sc_list.GetSize(); SymbolVendor *sym_vendor = GetSymbolVendor(); @@ -1413,8 +1418,9 @@ size_t Module::FindSymbolsMatchingRegExAndType(const RegularExpression ®ex, // No need to protect this call using m_mutex all other method calls are // already thread safe. + static Timer::Category func_cat(LLVM_PRETTY_FUNCTION); Timer scoped_timer( - LLVM_PRETTY_FUNCTION, + func_cat, "Module::FindSymbolsMatchingRegExAndType (regex = %s, type = %i)", regex.GetText().str().c_str(), symbol_type); const size_t initial_size = sc_list.GetSize(); @@ -1537,7 +1543,7 @@ bool Module::IsLoadedInTarget(Target *target) { return false; } -bool Module::LoadScriptingResourceInTarget(Target *target, Error &error, +bool Module::LoadScriptingResourceInTarget(Target *target, Status &error, Stream *feedback_stream) { if (!target) { error.SetErrorString("invalid destination Target"); @@ -1717,6 +1723,6 @@ bool Module::GetIsDynamicLinkEditor() { return false; } -Error Module::LoadInMemory(Target &target, bool set_pc) { +Status Module::LoadInMemory(Target &target, bool set_pc) { return m_objfile_sp->LoadInMemory(target, set_pc); } diff --git a/source/Core/ModuleList.cpp b/source/Core/ModuleList.cpp index da23329cc3b6d..b04299ead8042 100644 --- a/source/Core/ModuleList.cpp +++ b/source/Core/ModuleList.cpp @@ -704,17 +704,17 @@ size_t ModuleList::RemoveOrphanSharedModules(bool mandatory) { return GetSharedModuleList().RemoveOrphans(mandatory); } -Error ModuleList::GetSharedModule(const ModuleSpec &module_spec, - ModuleSP &module_sp, - const FileSpecList *module_search_paths_ptr, - ModuleSP *old_module_sp_ptr, - bool *did_create_ptr, bool always_create) { +Status ModuleList::GetSharedModule(const ModuleSpec &module_spec, + ModuleSP &module_sp, + const FileSpecList *module_search_paths_ptr, + ModuleSP *old_module_sp_ptr, + bool *did_create_ptr, bool always_create) { ModuleList &shared_module_list = GetSharedModuleList(); std::lock_guard<std::recursive_mutex> guard( shared_module_list.m_modules_mutex); char path[PATH_MAX]; - Error error; + Status error; module_sp.reset(); @@ -821,7 +821,7 @@ Error ModuleList::GetSharedModule(const ModuleSpec &module_spec, *did_create_ptr = true; shared_module_list.ReplaceEquivalent(module_sp); - return Error(); + return Status(); } } } else { @@ -955,14 +955,14 @@ bool ModuleList::RemoveSharedModuleIfOrphaned(const Module *module_ptr) { } bool ModuleList::LoadScriptingResourcesInTarget(Target *target, - std::list<Error> &errors, + std::list<Status> &errors, Stream *feedback_stream, bool continue_on_error) { if (!target) return false; std::lock_guard<std::recursive_mutex> guard(m_modules_mutex); for (auto module : m_modules) { - Error error; + Status error; if (module) { if (!module->LoadScriptingResourceInTarget(target, error, feedback_stream)) { diff --git a/source/Core/PluginManager.cpp b/source/Core/PluginManager.cpp index bd4ba59952043..9bb615b6a55e2 100644 --- a/source/Core/PluginManager.cpp +++ b/source/Core/PluginManager.cpp @@ -13,8 +13,8 @@ #include "lldb/Host/HostInfo.h" #include "lldb/Interpreter/OptionValueProperties.h" #include "lldb/Utility/ConstString.h" // for ConstString -#include "lldb/Utility/Error.h" #include "lldb/Utility/FileSpec.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/StringList.h" // for StringList #if defined(LLVM_ON_WIN32) @@ -93,7 +93,7 @@ static FileSpec::EnumerateDirectoryResult LoadPluginCallback(void *baton, llvm::sys::fs::file_type ft, const FileSpec &file_spec) { // PluginManager *plugin_manager = (PluginManager *)baton; - Error error; + Status error; namespace fs = llvm::sys::fs; // If we have a regular file, a symbolic link or unknown file type, try @@ -1066,9 +1066,9 @@ PluginManager::GetObjectFileCreateMemoryCallbackForPluginName( return nullptr; } -Error PluginManager::SaveCore(const lldb::ProcessSP &process_sp, - const FileSpec &outfile) { - Error error; +Status PluginManager::SaveCore(const lldb::ProcessSP &process_sp, + const FileSpec &outfile) { + Status error; std::lock_guard<std::recursive_mutex> guard(GetObjectFileMutex()); ObjectFileInstances &instances = GetObjectFileInstances(); diff --git a/source/Core/RegisterValue.cpp b/source/Core/RegisterValue.cpp index 26a7515febc3c..28ce67e63dc2f 100644 --- a/source/Core/RegisterValue.cpp +++ b/source/Core/RegisterValue.cpp @@ -13,7 +13,7 @@ #include "lldb/Core/Scalar.h" #include "lldb/Interpreter/Args.h" #include "lldb/Utility/DataExtractor.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/Stream.h" #include "lldb/Utility/StreamString.h" #include "lldb/lldb-defines.h" // for LLDB_INVALID_ADDRESS @@ -102,7 +102,7 @@ bool RegisterValue::GetData(DataExtractor &data) const { uint32_t RegisterValue::GetAsMemoryData(const RegisterInfo *reg_info, void *dst, uint32_t dst_len, lldb::ByteOrder dst_byte_order, - Error &error) const { + Status &error) const { if (reg_info == nullptr) { error.SetErrorString("invalid register info argument."); return 0; @@ -148,7 +148,7 @@ uint32_t RegisterValue::GetAsMemoryData(const RegisterInfo *reg_info, void *dst, uint32_t RegisterValue::SetFromMemoryData(const RegisterInfo *reg_info, const void *src, uint32_t src_len, lldb::ByteOrder src_byte_order, - Error &error) { + Status &error) { if (reg_info == nullptr) { error.SetErrorString("invalid register info argument."); return 0; @@ -163,7 +163,7 @@ uint32_t RegisterValue::SetFromMemoryData(const RegisterInfo *reg_info, // // Case 2: src_len > dst_len // - // Error! (The register should always be big enough to hold the data) + // Status! (The register should always be big enough to hold the data) // // Case 3: src_len < dst_len // @@ -257,11 +257,11 @@ RegisterValue::Type RegisterValue::SetType(const RegisterInfo *reg_info) { return m_type; } -Error RegisterValue::SetValueFromData(const RegisterInfo *reg_info, - DataExtractor &src, - lldb::offset_t src_offset, - bool partial_data_ok) { - Error error; +Status RegisterValue::SetValueFromData(const RegisterInfo *reg_info, + DataExtractor &src, + lldb::offset_t src_offset, + bool partial_data_ok) { + Status error; if (src.GetByteSize() == 0) { error.SetErrorString("empty data."); @@ -391,9 +391,9 @@ static bool ParseVectorEncoding(const RegisterInfo *reg_info, return true; } -Error RegisterValue::SetValueFromString(const RegisterInfo *reg_info, - llvm::StringRef value_str) { - Error error; +Status RegisterValue::SetValueFromString(const RegisterInfo *reg_info, + llvm::StringRef value_str) { + Status error; if (reg_info == nullptr) { error.SetErrorString("Invalid register info argument."); return error; diff --git a/source/Core/Scalar.cpp b/source/Core/Scalar.cpp index 3adf850986484..630083bae9308 100644 --- a/source/Core/Scalar.cpp +++ b/source/Core/Scalar.cpp @@ -12,7 +12,7 @@ #include "lldb/Host/StringConvert.h" #include "lldb/Utility/DataExtractor.h" #include "lldb/Utility/Endian.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/Stream.h" #include "lldb/lldb-types.h" // for offset_t @@ -2460,9 +2460,9 @@ const Scalar lldb_private::operator>>(const Scalar &lhs, const Scalar &rhs) { return result; } -Error Scalar::SetValueFromCString(const char *value_str, Encoding encoding, - size_t byte_size) { - Error error; +Status Scalar::SetValueFromCString(const char *value_str, Encoding encoding, + size_t byte_size) { + Status error; if (value_str == nullptr || value_str[0] == '\0') { error.SetErrorString("Invalid c-string value string."); return error; @@ -2596,9 +2596,9 @@ Error Scalar::SetValueFromCString(const char *value_str, Encoding encoding, return error; } -Error Scalar::SetValueFromData(DataExtractor &data, lldb::Encoding encoding, - size_t byte_size) { - Error error; +Status Scalar::SetValueFromData(DataExtractor &data, lldb::Encoding encoding, + size_t byte_size) { + Status error; type128 int128; type256 int256; @@ -2762,7 +2762,7 @@ bool Scalar::SignExtend(uint32_t sign_bit_pos) { size_t Scalar::GetAsMemoryData(void *dst, size_t dst_len, lldb::ByteOrder dst_byte_order, - Error &error) const { + Status &error) const { // Get a data extractor that points to the native scalar data DataExtractor data; if (!GetData(data)) { diff --git a/source/Core/SearchFilter.cpp b/source/Core/SearchFilter.cpp index 6d29e21c310e7..0701955233a1f 100644 --- a/source/Core/SearchFilter.cpp +++ b/source/Core/SearchFilter.cpp @@ -16,7 +16,7 @@ #include "lldb/Symbol/SymbolContext.h" // for SymbolContext #include "lldb/Target/Target.h" #include "lldb/Utility/ConstString.h" // for ConstString -#include "lldb/Utility/Error.h" // for Error +#include "lldb/Utility/Status.h" // for Status #include "lldb/Utility/Stream.h" // for Stream #include "lldb/lldb-enumerations.h" // for SymbolContextItem::eSymbolCo... @@ -55,9 +55,9 @@ const char *SearchFilter::FilterTyToName(enum FilterTy type) { return g_ty_to_name[type]; } -SearchFilter::FilterTy SearchFilter::NameToFilterTy(const char *name) { +SearchFilter::FilterTy SearchFilter::NameToFilterTy(llvm::StringRef name) { for (size_t i = 0; i <= LastKnownFilterType; i++) { - if (strcmp(name, g_ty_to_name[i]) == 0) + if (name == g_ty_to_name[i]) return (FilterTy)i; } return UnknownFilter; @@ -80,14 +80,14 @@ SearchFilter::~SearchFilter() = default; SearchFilterSP SearchFilter::CreateFromStructuredData( Target &target, const StructuredData::Dictionary &filter_dict, - Error &error) { + Status &error) { SearchFilterSP result_sp; if (!filter_dict.IsValid()) { error.SetErrorString("Can't deserialize from an invalid data object."); return result_sp; } - std::string subclass_name; + llvm::StringRef subclass_name; bool success = filter_dict.GetValueForKeyAsString( GetSerializationSubclassKey(), subclass_name); @@ -96,10 +96,9 @@ SearchFilterSP SearchFilter::CreateFromStructuredData( return result_sp; } - FilterTy filter_type = NameToFilterTy(subclass_name.c_str()); + FilterTy filter_type = NameToFilterTy(subclass_name); if (filter_type == UnknownFilter) { - error.SetErrorStringWithFormat("Unknown filter type: %s.", - subclass_name.c_str()); + error.SetErrorStringWithFormatv("Unknown filter type: {0}.", subclass_name); return result_sp; } @@ -338,7 +337,8 @@ Searcher::CallbackReturn SearchFilter::DoFunctionIteration( // "black list". //---------------------------------------------------------------------- SearchFilterSP SearchFilterForUnconstrainedSearches::CreateFromStructuredData( - Target &target, const StructuredData::Dictionary &data_dict, Error &error) { + Target &target, const StructuredData::Dictionary &data_dict, + Status &error) { // No options for an unconstrained search. return std::make_shared<SearchFilterForUnconstrainedSearches>( target.shared_from_this()); @@ -466,7 +466,8 @@ SearchFilterByModule::DoCopyForBreakpoint(Breakpoint &breakpoint) { } SearchFilterSP SearchFilterByModule::CreateFromStructuredData( - Target &target, const StructuredData::Dictionary &data_dict, Error &error) { + Target &target, const StructuredData::Dictionary &data_dict, + Status &error) { StructuredData::Array *modules_array; bool success = data_dict.GetValueForKeyAsArray(GetKey(OptionNames::ModList), modules_array); @@ -482,7 +483,7 @@ SearchFilterSP SearchFilterByModule::CreateFromStructuredData( return nullptr; } - std::string module; + llvm::StringRef module; success = modules_array->GetItemAtIndexAsString(0, module); if (!success) { error.SetErrorString("SFBM::CFSD: filter module item not a string."); @@ -628,7 +629,8 @@ SearchFilterByModuleList::DoCopyForBreakpoint(Breakpoint &breakpoint) { } SearchFilterSP SearchFilterByModuleList::CreateFromStructuredData( - Target &target, const StructuredData::Dictionary &data_dict, Error &error) { + Target &target, const StructuredData::Dictionary &data_dict, + Status &error) { StructuredData::Array *modules_array; bool success = data_dict.GetValueForKeyAsArray(GetKey(OptionNames::ModList), modules_array); @@ -636,7 +638,7 @@ SearchFilterSP SearchFilterByModuleList::CreateFromStructuredData( if (success) { size_t num_modules = modules_array->GetSize(); for (size_t i = 0; i < num_modules; i++) { - std::string module; + llvm::StringRef module; success = modules_array->GetItemAtIndexAsString(i, module); if (!success) { error.SetErrorStringWithFormat( @@ -691,7 +693,8 @@ operator=(const SearchFilterByModuleListAndCU &rhs) { SearchFilterByModuleListAndCU::~SearchFilterByModuleListAndCU() = default; lldb::SearchFilterSP SearchFilterByModuleListAndCU::CreateFromStructuredData( - Target &target, const StructuredData::Dictionary &data_dict, Error &error) { + Target &target, const StructuredData::Dictionary &data_dict, + Status &error) { StructuredData::Array *modules_array = nullptr; SearchFilterSP result_sp; bool success = data_dict.GetValueForKeyAsArray(GetKey(OptionNames::ModList), @@ -700,7 +703,7 @@ lldb::SearchFilterSP SearchFilterByModuleListAndCU::CreateFromStructuredData( if (success) { size_t num_modules = modules_array->GetSize(); for (size_t i = 0; i < num_modules; i++) { - std::string module; + llvm::StringRef module; success = modules_array->GetItemAtIndexAsString(i, module); if (!success) { error.SetErrorStringWithFormat( @@ -722,7 +725,7 @@ lldb::SearchFilterSP SearchFilterByModuleListAndCU::CreateFromStructuredData( size_t num_cus = cus_array->GetSize(); FileSpecList cus; for (size_t i = 0; i < num_cus; i++) { - std::string cu; + llvm::StringRef cu; success = cus_array->GetItemAtIndexAsString(i, cu); if (!success) { error.SetErrorStringWithFormat( diff --git a/source/Core/StructuredData.cpp b/source/Core/StructuredData.cpp index 649c4615ad4fc..d52b7730cc657 100644 --- a/source/Core/StructuredData.cpp +++ b/source/Core/StructuredData.cpp @@ -12,9 +12,9 @@ #include "lldb/Host/File.h" #include "lldb/Host/StringConvert.h" #include "lldb/Utility/DataBuffer.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/JSON.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/Stream.h" // for Stream #include "lldb/Utility/StreamString.h" #include "lldb/lldb-enumerations.h" // for FilePermissions::eFilePermiss... @@ -40,7 +40,7 @@ static StructuredData::ObjectSP ParseJSONObject(JSONParser &json_parser); static StructuredData::ObjectSP ParseJSONArray(JSONParser &json_parser); StructuredData::ObjectSP -StructuredData::ParseJSONFromFile(const FileSpec &input_spec, Error &error) { +StructuredData::ParseJSONFromFile(const FileSpec &input_spec, Status &error) { StructuredData::ObjectSP return_sp; if (!input_spec.Exists()) { error.SetErrorStringWithFormat("input file %s does not exist.", diff --git a/source/Core/Timer.cpp b/source/Core/Timer.cpp index 60da39b7f199c..6de4516f721dd 100644 --- a/source/Core/Timer.cpp +++ b/source/Core/Timer.cpp @@ -27,8 +27,8 @@ using namespace lldb_private; #define TIMER_INDENT_AMOUNT 2 namespace { -typedef std::map<const char *, std::chrono::nanoseconds> TimerCategoryMap; typedef std::vector<Timer *> TimerStack; +static std::atomic<Timer::Category *> g_categories; } // end of anonymous namespace std::atomic<bool> Timer::g_quiet(true); @@ -38,16 +38,6 @@ static std::mutex &GetFileMutex() { return *g_file_mutex_ptr; } -static std::mutex &GetCategoryMutex() { - static std::mutex g_category_mutex; - return g_category_mutex; -} - -static TimerCategoryMap &GetCategoryMap() { - static TimerCategoryMap g_category_map; - return g_category_map; -} - static void ThreadSpecificCleanup(void *p) { delete static_cast<TimerStack *>(p); } @@ -64,9 +54,17 @@ static TimerStack *GetTimerStackForCurrentThread() { return (TimerStack *)timer_stack; } +Timer::Category::Category(const char *cat) : m_name(cat) { + m_nanos.store(0, std::memory_order_release); + Category *expected = g_categories; + do { + m_next = expected; + } while (!g_categories.compare_exchange_weak(expected, this)); +} + void Timer::SetQuiet(bool value) { g_quiet = value; } -Timer::Timer(const char *category, const char *format, ...) +Timer::Timer(Timer::Category &category, const char *format, ...) : m_category(category), m_total_start(std::chrono::steady_clock::now()) { TimerStack *stack = GetTimerStackForCurrentThread(); if (!stack) @@ -114,11 +112,7 @@ Timer::~Timer() { stack->back()->ChildDuration(total_dur); // Keep total results for each category so we can dump results. - { - std::lock_guard<std::mutex> guard(GetCategoryMutex()); - TimerCategoryMap &category_map = GetCategoryMap(); - category_map[m_category] += timer_dur; - } + m_category.m_nanos += std::chrono::nanoseconds(timer_dur).count(); } void Timer::SetDisplayDepth(uint32_t depth) { g_display_depth = depth; } @@ -126,33 +120,32 @@ void Timer::SetDisplayDepth(uint32_t depth) { g_display_depth = depth; } /* binary function predicate: * - returns whether a person is less than another person */ -static bool -CategoryMapIteratorSortCriterion(const TimerCategoryMap::const_iterator &lhs, - const TimerCategoryMap::const_iterator &rhs) { - return lhs->second > rhs->second; + +typedef std::pair<const char *, uint64_t> TimerEntry; + +static bool CategoryMapIteratorSortCriterion(const TimerEntry &lhs, + const TimerEntry &rhs) { + return lhs.second > rhs.second; } void Timer::ResetCategoryTimes() { - std::lock_guard<std::mutex> guard(GetCategoryMutex()); - TimerCategoryMap &category_map = GetCategoryMap(); - category_map.clear(); + for (Category *i = g_categories; i; i = i->m_next) + i->m_nanos.store(0, std::memory_order_release); } void Timer::DumpCategoryTimes(Stream *s) { - std::lock_guard<std::mutex> guard(GetCategoryMutex()); - TimerCategoryMap &category_map = GetCategoryMap(); - std::vector<TimerCategoryMap::const_iterator> sorted_iterators; - TimerCategoryMap::const_iterator pos, end = category_map.end(); - for (pos = category_map.begin(); pos != end; ++pos) { - sorted_iterators.push_back(pos); - } - std::sort(sorted_iterators.begin(), sorted_iterators.end(), - CategoryMapIteratorSortCriterion); - - const size_t count = sorted_iterators.size(); - for (size_t i = 0; i < count; ++i) { - const auto timer = sorted_iterators[i]->second; - s->Printf("%.9f sec for %s\n", std::chrono::duration<double>(timer).count(), - sorted_iterators[i]->first); + std::vector<TimerEntry> sorted; + for (Category *i = g_categories; i; i = i->m_next) { + uint64_t nanos = i->m_nanos.load(std::memory_order_acquire); + if (nanos) + sorted.push_back(std::make_pair(i->m_name, nanos)); } + if (sorted.empty()) + return; // Later code will break without any elements. + + // Sort by time + std::sort(sorted.begin(), sorted.end(), CategoryMapIteratorSortCriterion); + + for (const auto &timer : sorted) + s->Printf("%.9f sec for %s\n", timer.second / 1000000000., timer.first); } diff --git a/source/Core/UserSettingsController.cpp b/source/Core/UserSettingsController.cpp index 59a88ccdb931b..a4661a6c9e8cc 100644 --- a/source/Core/UserSettingsController.cpp +++ b/source/Core/UserSettingsController.cpp @@ -10,7 +10,7 @@ #include "lldb/Core/UserSettingsController.h" #include "lldb/Interpreter/OptionValueProperties.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/Stream.h" #include <memory> // for shared_ptr @@ -32,21 +32,23 @@ using namespace lldb; using namespace lldb_private; lldb::OptionValueSP -Properties::GetPropertyValue(const ExecutionContext *exe_ctx, llvm::StringRef path, - bool will_modify, Error &error) const { +Properties::GetPropertyValue(const ExecutionContext *exe_ctx, + llvm::StringRef path, bool will_modify, + Status &error) const { OptionValuePropertiesSP properties_sp(GetValueProperties()); if (properties_sp) return properties_sp->GetSubValue(exe_ctx, path, will_modify, error); return lldb::OptionValueSP(); } -Error Properties::SetPropertyValue(const ExecutionContext *exe_ctx, - VarSetOperationType op, llvm::StringRef path, - llvm::StringRef value) { +Status Properties::SetPropertyValue(const ExecutionContext *exe_ctx, + VarSetOperationType op, + llvm::StringRef path, + llvm::StringRef value) { OptionValuePropertiesSP properties_sp(GetValueProperties()); if (properties_sp) return properties_sp->SetSubValue(exe_ctx, op, path, value); - Error error; + Status error; error.SetErrorString("no properties"); return error; } @@ -67,15 +69,16 @@ void Properties::DumpAllDescriptions(CommandInterpreter &interpreter, return properties_sp->DumpAllDescriptions(interpreter, strm); } -Error Properties::DumpPropertyValue(const ExecutionContext *exe_ctx, - Stream &strm, llvm::StringRef property_path, - uint32_t dump_mask) { +Status Properties::DumpPropertyValue(const ExecutionContext *exe_ctx, + Stream &strm, + llvm::StringRef property_path, + uint32_t dump_mask) { OptionValuePropertiesSP properties_sp(GetValueProperties()); if (properties_sp) { return properties_sp->DumpPropertyValue(exe_ctx, strm, property_path, dump_mask); } - Error error; + Status error; error.SetErrorString("empty property list"); return error; } diff --git a/source/Core/Value.cpp b/source/Core/Value.cpp index 9aaddf77021cf..63385511edb66 100644 --- a/source/Core/Value.cpp +++ b/source/Core/Value.cpp @@ -144,7 +144,7 @@ Type *Value::GetType() { size_t Value::AppendDataToHostBuffer(const Value &rhs) { size_t curr_size = m_data_buffer.GetByteSize(); - Error error; + Status error; switch (rhs.GetValueType()) { case eValueTypeScalar: { const size_t scalar_size = rhs.m_value.GetByteSize(); @@ -207,7 +207,7 @@ bool Value::ValueOf(ExecutionContext *exe_ctx) { return false; } -uint64_t Value::GetValueByteSize(Error *error_ptr, ExecutionContext *exe_ctx) { +uint64_t Value::GetValueByteSize(Status *error_ptr, ExecutionContext *exe_ctx) { uint64_t byte_size = 0; switch (m_context_type) { @@ -315,11 +315,11 @@ bool Value::GetData(DataExtractor &data) { return false; } -Error Value::GetValueAsData(ExecutionContext *exe_ctx, DataExtractor &data, - uint32_t data_offset, Module *module) { +Status Value::GetValueAsData(ExecutionContext *exe_ctx, DataExtractor &data, + uint32_t data_offset, Module *module) { data.Clear(); - Error error; + Status error; lldb::addr_t address = LLDB_INVALID_ADDRESS; AddressType address_type = eAddressTypeFile; Address file_so_addr; @@ -623,7 +623,7 @@ Scalar &Value::ResolveValue(ExecutionContext *exe_ctx) { { DataExtractor data; lldb::addr_t addr = m_value.ULongLong(LLDB_INVALID_ADDRESS); - Error error(GetValueAsData(exe_ctx, data, 0, NULL)); + Status error(GetValueAsData(exe_ctx, data, 0, NULL)); if (error.Success()) { Scalar scalar; if (compiler_type.GetValueAsScalar(data, 0, data.GetByteSize(), diff --git a/source/Core/ValueObject.cpp b/source/Core/ValueObject.cpp index 9e6b9da78b991..c09139fe2b09e 100644 --- a/source/Core/ValueObject.cpp +++ b/source/Core/ValueObject.cpp @@ -347,7 +347,7 @@ DataExtractor &ValueObject::GetDataExtractor() { return m_data; } -const Error &ValueObject::GetError() { +const Status &ValueObject::GetError() { UpdateValueIfNeeded(false); return m_error; } @@ -423,7 +423,7 @@ bool ValueObject::ResolveValue(Scalar &scalar) { return false; } -bool ValueObject::IsLogicalTrue(Error &error) { +bool ValueObject::IsLogicalTrue(Status &error) { if (Language *language = Language::FindPlugin(GetObjectRuntimeLanguage())) { LazyBool is_logical_true = language->IsLogicalTrue(*this, error); switch (is_logical_true) { @@ -771,7 +771,7 @@ size_t ValueObject::GetPointeeData(DataExtractor &data, uint32_t item_idx, if (item_idx == 0 && item_count == 1) // simply a deref { if (is_pointer_type) { - Error error; + Status error; ValueObjectSP pointee_sp = Dereference(error); if (error.Fail() || pointee_sp.get() == NULL) return 0; @@ -780,13 +780,13 @@ size_t ValueObject::GetPointeeData(DataExtractor &data, uint32_t item_idx, ValueObjectSP child_sp = GetChildAtIndex(0, true); if (child_sp.get() == NULL) return 0; - Error error; + Status error; return child_sp->GetData(data, error); } return true; } else /* (items > 1) */ { - Error error; + Status error; lldb_private::DataBufferHeap *heap_buf_ptr = NULL; lldb::DataBufferSP data_sp(heap_buf_ptr = new lldb_private::DataBufferHeap()); @@ -848,7 +848,7 @@ size_t ValueObject::GetPointeeData(DataExtractor &data, uint32_t item_idx, return 0; } -uint64_t ValueObject::GetData(DataExtractor &data, Error &error) { +uint64_t ValueObject::GetData(DataExtractor &data, Status &error) { UpdateValueIfNeeded(false); ExecutionContext exe_ctx(GetExecutionContextRef()); error = m_value.GetValueAsData(&exe_ctx, data, 0, GetModule().get()); @@ -866,7 +866,7 @@ uint64_t ValueObject::GetData(DataExtractor &data, Error &error) { return data.GetByteSize(); } -bool ValueObject::SetData(DataExtractor &data, Error &error) { +bool ValueObject::SetData(DataExtractor &data, Status &error) { error.Clear(); // Make sure our value is up to date first so that our location and location // type is valid. @@ -884,7 +884,7 @@ bool ValueObject::SetData(DataExtractor &data, Error &error) { switch (value_type) { case Value::eValueTypeScalar: { - Error set_error = + Status set_error = m_value.GetScalar().SetValueFromData(data, encoding, byte_size); if (!set_error.Success()) { @@ -938,7 +938,7 @@ static bool CopyStringDataToBufferSP(const StreamString &source, } std::pair<size_t, bool> -ValueObject::ReadPointedString(lldb::DataBufferSP &buffer_sp, Error &error, +ValueObject::ReadPointedString(lldb::DataBufferSP &buffer_sp, Status &error, uint32_t max_length, bool honor_array, Format item_format) { bool was_capped = false; @@ -1285,7 +1285,7 @@ bool ValueObject::DumpPrintableRepresentation( custom_format == eFormatVectorOfChar)) // print char[] & char* directly { - Error error; + Status error; lldb::DataBufferSP buffer_sp; std::pair<size_t, bool> read_string = ReadPointedString( buffer_sp, error, 0, (custom_format == eFormatVectorOfChar) || @@ -1561,7 +1561,7 @@ addr_t ValueObject::GetPointerValue(AddressType *address_type) { return address; } -bool ValueObject::SetValueFromCString(const char *value_str, Error &error) { +bool ValueObject::SetValueFromCString(const char *value_str, Status &error) { error.Clear(); // Make sure our value is up to date first so that our location and location // type is valid. @@ -2185,7 +2185,7 @@ ValueObjectSP ValueObject::GetValueForExpressionPath( if ((final_task_on_target ? *final_task_on_target : dummy_final_task_on_target) == ValueObject::eExpressionPathAftermathDereference) { - Error error; + Status error; ValueObjectSP final_value = ret_val->Dereference(error); if (error.Fail() || !final_value.get()) { if (reason_to_stop) @@ -2202,7 +2202,7 @@ ValueObjectSP ValueObject::GetValueForExpressionPath( } if (*final_task_on_target == ValueObject::eExpressionPathAftermathTakeAddress) { - Error error; + Status error; ValueObjectSP final_value = ret_val->AddressOf(error); if (error.Fail() || !final_value.get()) { if (reason_to_stop) @@ -2552,7 +2552,7 @@ ValueObjectSP ValueObject::GetValueForExpressionPath_Impl( // and use this as // a bitfield pointee_compiler_type_info.Test(eTypeIsScalar)) { - Error error; + Status error; root = root->Dereference(error); if (error.Fail() || !root) { *reason_to_stop = @@ -2697,7 +2697,7 @@ ValueObjectSP ValueObject::GetValueForExpressionPath_Impl( *what_next == ValueObject::eExpressionPathAftermathDereference && pointee_compiler_type_info.Test(eTypeIsScalar)) { - Error error; + Status error; root = root->Dereference(error); if (error.Fail() || !root) { *reason_to_stop = @@ -2839,7 +2839,7 @@ lldb::addr_t ValueObject::GetCPPVTableAddress(AddressType &address_type) { return LLDB_INVALID_ADDRESS; } -ValueObjectSP ValueObject::Dereference(Error &error) { +ValueObjectSP ValueObject::Dereference(Status &error) { if (m_deref_valobj) return m_deref_valobj->GetSP(); @@ -2904,7 +2904,7 @@ ValueObjectSP ValueObject::Dereference(Error &error) { } } -ValueObjectSP ValueObject::AddressOf(Error &error) { +ValueObjectSP ValueObject::AddressOf(Status &error) { if (m_addr_of_valobj_sp) return m_addr_of_valobj_sp; @@ -3191,7 +3191,7 @@ lldb::ValueObjectSP ValueObject::CreateValueObjectFromAddress( if (ptr_result_valobj_sp) { ptr_result_valobj_sp->GetValue().SetValueType( Value::eValueTypeLoadAddress); - Error err; + Status err; ptr_result_valobj_sp = ptr_result_valobj_sp->Dereference(err); if (ptr_result_valobj_sp && !name.empty()) ptr_result_valobj_sp->SetName(ConstString(name)); diff --git a/source/Core/ValueObjectCast.cpp b/source/Core/ValueObjectCast.cpp index aa4cf60c1f9e5..a489bdc74f5fd 100644 --- a/source/Core/ValueObjectCast.cpp +++ b/source/Core/ValueObjectCast.cpp @@ -14,7 +14,7 @@ #include "lldb/Core/ValueObject.h" #include "lldb/Symbol/CompilerType.h" #include "lldb/Target/ExecutionContext.h" -#include "lldb/Utility/Error.h" // for Error +#include "lldb/Utility/Status.h" // for Status namespace lldb_private { class ConstString; diff --git a/source/Core/ValueObjectChild.cpp b/source/Core/ValueObjectChild.cpp index eeb28c960a3a7..591bc21711aec 100644 --- a/source/Core/ValueObjectChild.cpp +++ b/source/Core/ValueObjectChild.cpp @@ -14,9 +14,9 @@ #include "lldb/Symbol/CompilerType.h" #include "lldb/Target/ExecutionContext.h" #include "lldb/Target/Process.h" -#include "lldb/Utility/Error.h" // for Error -#include "lldb/Utility/Flags.h" // for Flags -#include "lldb/lldb-forward.h" // for ProcessSP, ModuleSP +#include "lldb/Utility/Flags.h" // for Flags +#include "lldb/Utility/Status.h" // for Status +#include "lldb/lldb-forward.h" // for ProcessSP, ModuleSP #include <functional> // for _Func_impl<>::_Mybase #include <memory> // for shared_ptr diff --git a/source/Core/ValueObjectConstResult.cpp b/source/Core/ValueObjectConstResult.cpp index cf437ce6f7d57..1023696c35a72 100644 --- a/source/Core/ValueObjectConstResult.cpp +++ b/source/Core/ValueObjectConstResult.cpp @@ -163,12 +163,12 @@ ValueObjectConstResult::ValueObjectConstResult( } ValueObjectSP ValueObjectConstResult::Create(ExecutionContextScope *exe_scope, - const Error &error) { + const Status &error) { return (new ValueObjectConstResult(exe_scope, error))->GetSP(); } ValueObjectConstResult::ValueObjectConstResult(ExecutionContextScope *exe_scope, - const Error &error) + const Status &error) : ValueObject(exe_scope), m_type_name(), m_byte_size(0), m_impl(this) { m_error = error; SetIsConstant(); @@ -234,7 +234,7 @@ bool ValueObjectConstResult::IsInScope() { return true; } -lldb::ValueObjectSP ValueObjectConstResult::Dereference(Error &error) { +lldb::ValueObjectSP ValueObjectConstResult::Dereference(Status &error) { return m_impl.Dereference(error); } @@ -245,7 +245,7 @@ lldb::ValueObjectSP ValueObjectConstResult::GetSyntheticChildAtOffset( name_const_str); } -lldb::ValueObjectSP ValueObjectConstResult::AddressOf(Error &error) { +lldb::ValueObjectSP ValueObjectConstResult::AddressOf(Status &error) { return m_impl.AddressOf(error); } diff --git a/source/Core/ValueObjectConstResultCast.cpp b/source/Core/ValueObjectConstResultCast.cpp index f575bebd7110e..c04043264af10 100644 --- a/source/Core/ValueObjectConstResultCast.cpp +++ b/source/Core/ValueObjectConstResultCast.cpp @@ -13,7 +13,7 @@ namespace lldb_private { class DataExtractor; } namespace lldb_private { -class Error; +class Status; } namespace lldb_private { class ValueObject; @@ -30,7 +30,7 @@ ValueObjectConstResultCast::ValueObjectConstResultCast( ValueObjectConstResultCast::~ValueObjectConstResultCast() {} -lldb::ValueObjectSP ValueObjectConstResultCast::Dereference(Error &error) { +lldb::ValueObjectSP ValueObjectConstResultCast::Dereference(Status &error) { return m_impl.Dereference(error); } @@ -41,7 +41,7 @@ lldb::ValueObjectSP ValueObjectConstResultCast::GetSyntheticChildAtOffset( name_const_str); } -lldb::ValueObjectSP ValueObjectConstResultCast::AddressOf(Error &error) { +lldb::ValueObjectSP ValueObjectConstResultCast::AddressOf(Status &error) { return m_impl.AddressOf(error); } diff --git a/source/Core/ValueObjectConstResultChild.cpp b/source/Core/ValueObjectConstResultChild.cpp index 9c6ad8becf3b6..3e9f876841620 100644 --- a/source/Core/ValueObjectConstResultChild.cpp +++ b/source/Core/ValueObjectConstResultChild.cpp @@ -14,7 +14,7 @@ namespace lldb_private { class DataExtractor; } namespace lldb_private { -class Error; +class Status; } namespace lldb_private { class ValueObject; @@ -37,7 +37,7 @@ ValueObjectConstResultChild::ValueObjectConstResultChild( ValueObjectConstResultChild::~ValueObjectConstResultChild() {} -lldb::ValueObjectSP ValueObjectConstResultChild::Dereference(Error &error) { +lldb::ValueObjectSP ValueObjectConstResultChild::Dereference(Status &error) { return m_impl.Dereference(error); } @@ -48,7 +48,7 @@ lldb::ValueObjectSP ValueObjectConstResultChild::GetSyntheticChildAtOffset( name_const_str); } -lldb::ValueObjectSP ValueObjectConstResultChild::AddressOf(Error &error) { +lldb::ValueObjectSP ValueObjectConstResultChild::AddressOf(Status &error) { return m_impl.AddressOf(error); } diff --git a/source/Core/ValueObjectConstResultImpl.cpp b/source/Core/ValueObjectConstResultImpl.cpp index ed25ea8071a2c..714634ed56e3f 100644 --- a/source/Core/ValueObjectConstResultImpl.cpp +++ b/source/Core/ValueObjectConstResultImpl.cpp @@ -27,7 +27,7 @@ namespace lldb_private { class DataExtractor; } namespace lldb_private { -class Error; +class Status; } using namespace lldb; @@ -39,7 +39,7 @@ ValueObjectConstResultImpl::ValueObjectConstResultImpl( m_live_address_type(eAddressTypeLoad), m_load_addr_backend(), m_address_of_backend() {} -lldb::ValueObjectSP ValueObjectConstResultImpl::Dereference(Error &error) { +lldb::ValueObjectSP ValueObjectConstResultImpl::Dereference(Status &error) { if (m_impl_backend == NULL) return lldb::ValueObjectSP(); @@ -108,7 +108,7 @@ lldb::ValueObjectSP ValueObjectConstResultImpl::GetSyntheticChildAtOffset( offset, type, can_create, name_const_str); } -lldb::ValueObjectSP ValueObjectConstResultImpl::AddressOf(Error &error) { +lldb::ValueObjectSP ValueObjectConstResultImpl::AddressOf(Status &error) { if (m_address_of_backend.get() != NULL) return m_address_of_backend; diff --git a/source/Core/ValueObjectDynamicValue.cpp b/source/Core/ValueObjectDynamicValue.cpp index 59bbc025f9947..bb39caa767eb9 100644 --- a/source/Core/ValueObjectDynamicValue.cpp +++ b/source/Core/ValueObjectDynamicValue.cpp @@ -20,9 +20,9 @@ #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" #include "lldb/Utility/DataExtractor.h" // for DataExtractor -#include "lldb/Utility/Error.h" // for Error #include "lldb/Utility/Log.h" #include "lldb/Utility/Logging.h" // for GetLogIfAllCategoriesSet +#include "lldb/Utility/Status.h" // for Status #include "lldb/lldb-types.h" // for addr_t, offset_t #include <string.h> // for strcmp, size_t @@ -275,7 +275,7 @@ bool ValueObjectDynamicValue::UpdateValue() { bool ValueObjectDynamicValue::IsInScope() { return m_parent->IsInScope(); } bool ValueObjectDynamicValue::SetValueFromCString(const char *value_str, - Error &error) { + Status &error) { if (!UpdateValueIfNeeded(false)) { error.SetErrorString("unable to read value"); return false; @@ -310,7 +310,7 @@ bool ValueObjectDynamicValue::SetValueFromCString(const char *value_str, return ret_val; } -bool ValueObjectDynamicValue::SetData(DataExtractor &data, Error &error) { +bool ValueObjectDynamicValue::SetData(DataExtractor &data, Status &error) { if (!UpdateValueIfNeeded(false)) { error.SetErrorString("unable to read value"); return false; diff --git a/source/Core/ValueObjectMemory.cpp b/source/Core/ValueObjectMemory.cpp index 0fb8f0d2de03a..713751110dcef 100644 --- a/source/Core/ValueObjectMemory.cpp +++ b/source/Core/ValueObjectMemory.cpp @@ -17,7 +17,7 @@ #include "lldb/Target/ExecutionContext.h" #include "lldb/Target/Target.h" #include "lldb/Utility/DataExtractor.h" // for DataExtractor -#include "lldb/Utility/Error.h" // for Error +#include "lldb/Utility/Status.h" // for Status #include "lldb/lldb-types.h" // for addr_t #include "llvm/Support/ErrorHandling.h" // for llvm_unreachable diff --git a/source/Core/ValueObjectRegister.cpp b/source/Core/ValueObjectRegister.cpp index 6469340201e50..05022d3ed10a4 100644 --- a/source/Core/ValueObjectRegister.cpp +++ b/source/Core/ValueObjectRegister.cpp @@ -20,7 +20,7 @@ #include "lldb/Target/StackFrame.h" // for StackFrame #include "lldb/Target/Target.h" #include "lldb/Utility/DataExtractor.h" // for DataExtractor -#include "lldb/Utility/Error.h" // for Error +#include "lldb/Utility/Status.h" // for Status #include "lldb/Utility/Stream.h" // for Stream #include "llvm/ADT/StringRef.h" // for StringRef @@ -318,7 +318,7 @@ bool ValueObjectRegister::UpdateValue() { } bool ValueObjectRegister::SetValueFromCString(const char *value_str, - Error &error) { + Status &error) { // The new value will be in the m_data. Copy that into our register value. error = m_reg_value.SetValueFromString(&m_reg_info, llvm::StringRef(value_str)); @@ -332,7 +332,7 @@ bool ValueObjectRegister::SetValueFromCString(const char *value_str, return false; } -bool ValueObjectRegister::SetData(DataExtractor &data, Error &error) { +bool ValueObjectRegister::SetData(DataExtractor &data, Status &error) { error = m_reg_value.SetValueFromData(&m_reg_info, data, 0, false); if (error.Success()) { if (m_reg_ctx_sp->WriteRegister(&m_reg_info, m_reg_value)) { diff --git a/source/Core/ValueObjectSyntheticFilter.cpp b/source/Core/ValueObjectSyntheticFilter.cpp index f0fd76ed09fc2..87310c423cb89 100644 --- a/source/Core/ValueObjectSyntheticFilter.cpp +++ b/source/Core/ValueObjectSyntheticFilter.cpp @@ -13,10 +13,10 @@ #include "lldb/Core/ValueObject.h" #include "lldb/DataFormatters/TypeSynthetic.h" #include "lldb/Target/ExecutionContext.h" // for ExecutionContext -#include "lldb/Utility/Error.h" // for Error #include "lldb/Utility/Log.h" #include "lldb/Utility/Logging.h" // for GetLogIfAllCategoriesSet #include "lldb/Utility/SharingPtr.h" // for SharingPtr +#include "lldb/Utility/Status.h" // for Status #include "llvm/ADT/STLExtras.h" @@ -324,7 +324,7 @@ bool ValueObjectSynthetic::CanProvideValue() { } bool ValueObjectSynthetic::SetValueFromCString(const char *value_str, - Error &error) { + Status &error) { return m_parent->SetValueFromCString(value_str, error); } diff --git a/source/Core/ValueObjectVariable.cpp b/source/Core/ValueObjectVariable.cpp index 169f8f0f6c289..9b9e51a0abb87 100644 --- a/source/Core/ValueObjectVariable.cpp +++ b/source/Core/ValueObjectVariable.cpp @@ -29,7 +29,7 @@ #include "lldb/Target/RegisterContext.h" #include "lldb/Target/Target.h" #include "lldb/Utility/DataExtractor.h" // for DataExtractor -#include "lldb/Utility/Error.h" // for Error +#include "lldb/Utility/Status.h" // for Status #include "lldb/lldb-private-enumerations.h" // for AddressType::eAddressTy... #include "lldb/lldb-types.h" // for addr_t @@ -344,7 +344,7 @@ const char *ValueObjectVariable::GetLocationAsCString() { } bool ValueObjectVariable::SetValueFromCString(const char *value_str, - Error &error) { + Status &error) { if (!UpdateValueIfNeeded()) { error.SetErrorString("unable to update value before writing"); return false; @@ -373,7 +373,7 @@ bool ValueObjectVariable::SetValueFromCString(const char *value_str, return ValueObject::SetValueFromCString(value_str, error); } -bool ValueObjectVariable::SetData(DataExtractor &data, Error &error) { +bool ValueObjectVariable::SetData(DataExtractor &data, Status &error) { if (!UpdateValueIfNeeded()) { error.SetErrorString("unable to update value before writing"); return false; |