diff options
Diffstat (limited to 'source/Expression/IRExecutionUnit.cpp')
-rw-r--r-- | source/Expression/IRExecutionUnit.cpp | 97 |
1 files changed, 43 insertions, 54 deletions
diff --git a/source/Expression/IRExecutionUnit.cpp b/source/Expression/IRExecutionUnit.cpp index 25404ad313e12..b10628e10cc5e 100644 --- a/source/Expression/IRExecutionUnit.cpp +++ b/source/Expression/IRExecutionUnit.cpp @@ -122,10 +122,10 @@ Status IRExecutionUnit::DisassembleFunction(Stream &stream, return ret; } - if (log) - log->Printf("Found function, has local address 0x%" PRIx64 - " and remote address 0x%" PRIx64, - (uint64_t)func_local_addr, (uint64_t)func_remote_addr); + LLDB_LOGF(log, + "Found function, has local address 0x%" PRIx64 + " and remote address 0x%" PRIx64, + (uint64_t)func_local_addr, (uint64_t)func_remote_addr); std::pair<lldb::addr_t, lldb::addr_t> func_range; @@ -138,9 +138,8 @@ Status IRExecutionUnit::DisassembleFunction(Stream &stream, return ret; } - if (log) - log->Printf("Function's code range is [0x%" PRIx64 "+0x%" PRIx64 "]", - func_range.first, func_range.second); + LLDB_LOGF(log, "Function's code range is [0x%" PRIx64 "+0x%" PRIx64 "]", + func_range.first, func_range.second); Target *target = exe_ctx.GetTargetPtr(); if (!target) { @@ -188,7 +187,7 @@ Status IRExecutionUnit::DisassembleFunction(Stream &stream, target->GetArchitecture().GetAddressByteSize()); if (log) { - log->Printf("Function data has contents:"); + LLDB_LOGF(log, "Function data has contents:"); extractor.PutToLog(log, 0, extractor.GetByteSize(), func_remote_addr, 16, DataExtractor::TypeUInt8); } @@ -255,7 +254,7 @@ void IRExecutionUnit::GetRunnableInfo(Status &error, lldb::addr_t &func_addr, oss.flush(); - log->Printf("Module being sent to JIT: \n%s", s.c_str()); + LLDB_LOGF(log, "Module being sent to JIT: \n%s", s.c_str()); } m_module_up->getContext().setInlineAsmDiagnosticHandler(ReportInlineAsmError, @@ -317,7 +316,7 @@ void IRExecutionUnit::GetRunnableInfo(Status &error, lldb::addr_t &func_addr, }; if (process_sp->GetTarget().GetEnableSaveObjects()) { - m_object_cache_up = llvm::make_unique<ObjectDumper>(); + m_object_cache_up = std::make_unique<ObjectDumper>(); m_execution_engine_up->setObjectCache(m_object_cache_up.get()); } @@ -433,20 +432,20 @@ void IRExecutionUnit::GetRunnableInfo(Status &error, lldb::addr_t &func_addr, } if (log) { - log->Printf("Code can be run in the target."); + LLDB_LOGF(log, "Code can be run in the target."); StreamString disassembly_stream; Status err = DisassembleFunction(disassembly_stream, process_sp); if (!err.Success()) { - log->Printf("Couldn't disassemble function : %s", - err.AsCString("unknown error")); + LLDB_LOGF(log, "Couldn't disassemble function : %s", + err.AsCString("unknown error")); } else { - log->Printf("Function disassembly:\n%s", disassembly_stream.GetData()); + LLDB_LOGF(log, "Function disassembly:\n%s", disassembly_stream.GetData()); } - log->Printf("Sections: "); + LLDB_LOGF(log, "Sections: "); for (AllocationRecord &record : m_records) { if (record.m_process_address != LLDB_INVALID_ADDRESS) { record.dump(log); @@ -599,11 +598,10 @@ uint8_t *IRExecutionUnit::MemoryManager::allocateCodeSection( GetSectionTypeFromSectionName(SectionName, AllocationKind::Code), Size, Alignment, SectionID, SectionName.str().c_str())); - if (log) { - log->Printf("IRExecutionUnit::allocateCodeSection(Size=0x%" PRIx64 - ", Alignment=%u, SectionID=%u) = %p", - (uint64_t)Size, Alignment, SectionID, (void *)return_value); - } + LLDB_LOGF(log, + "IRExecutionUnit::allocateCodeSection(Size=0x%" PRIx64 + ", Alignment=%u, SectionID=%u) = %p", + (uint64_t)Size, Alignment, SectionID, (void *)return_value); if (m_parent.m_reported_allocations) { Status err; @@ -631,11 +629,10 @@ uint8_t *IRExecutionUnit::MemoryManager::allocateDataSection( (uintptr_t)return_value, permissions, GetSectionTypeFromSectionName(SectionName, AllocationKind::Data), Size, Alignment, SectionID, SectionName.str().c_str())); - if (log) { - log->Printf("IRExecutionUnit::allocateDataSection(Size=0x%" PRIx64 - ", Alignment=%u, SectionID=%u) = %p", - (uint64_t)Size, Alignment, SectionID, (void *)return_value); - } + LLDB_LOGF(log, + "IRExecutionUnit::allocateDataSection(Size=0x%" PRIx64 + ", Alignment=%u, SectionID=%u) = %p", + (uint64_t)Size, Alignment, SectionID, (void *)return_value); if (m_parent.m_reported_allocations) { Status err; @@ -661,11 +658,7 @@ FindBestAlternateMangledName(ConstString demangled, if (!sym_ctx.module_sp) return ConstString(); - SymbolVendor *sym_vendor = sym_ctx.module_sp->GetSymbolVendor(); - if (!sym_vendor) - return ConstString(); - - lldb_private::SymbolFile *sym_file = sym_vendor->GetSymbolFile(); + lldb_private::SymbolFile *sym_file = sym_ctx.module_sp->GetSymbolFile(); if (!sym_file) return ConstString(); @@ -676,7 +669,7 @@ FindBestAlternateMangledName(ConstString demangled, std::vector<ConstString> param_matches; for (size_t i = 0; i < alternates.size(); i++) { ConstString alternate_mangled_name = alternates[i]; - Mangled mangled(alternate_mangled_name, true); + Mangled mangled(alternate_mangled_name); ConstString demangled = mangled.GetDemangledName(lang_type); CPlusPlusLanguage::MethodName alternate_cpp_name(demangled); @@ -724,7 +717,7 @@ void IRExecutionUnit::CollectCandidateCPlusPlusNames( ConstString name = C_spec.name; if (CPlusPlusLanguage::IsCPPMangledName(name.GetCString())) { - Mangled mangled(name, true); + Mangled mangled(name); ConstString demangled = mangled.GetDemangledName(lldb::eLanguageTypeC_plus_plus); @@ -861,7 +854,6 @@ lldb::addr_t IRExecutionUnit::FindInSymbols( sc.module_sp->FindFunctions(spec.name, nullptr, spec.mask, true, // include_symbols false, // include_inlines - true, // append sc_list); } @@ -877,7 +869,6 @@ lldb::addr_t IRExecutionUnit::FindInSymbols( sc.target_sp->GetImages().FindFunctions(spec.name, spec.mask, true, // include_symbols false, // include_inlines - true, // append sc_list); } @@ -1042,17 +1033,15 @@ IRExecutionUnit::MemoryManager::GetSymbolAddressAndPresence( lldb::addr_t ret = m_parent.FindSymbol(name_cs, missing_weak); if (ret == LLDB_INVALID_ADDRESS) { - if (log) - log->Printf( - "IRExecutionUnit::getSymbolAddress(Name=\"%s\") = <not found>", - Name.c_str()); + LLDB_LOGF(log, + "IRExecutionUnit::getSymbolAddress(Name=\"%s\") = <not found>", + Name.c_str()); m_parent.ReportSymbolLookupError(name_cs); return 0; } else { - if (log) - log->Printf("IRExecutionUnit::getSymbolAddress(Name=\"%s\") = %" PRIx64, - Name.c_str(), ret); + LLDB_LOGF(log, "IRExecutionUnit::getSymbolAddress(Name=\"%s\") = %" PRIx64, + Name.c_str(), ret); return ret; } } @@ -1075,15 +1064,14 @@ IRExecutionUnit::GetRemoteAddressForLocal(lldb::addr_t local_address) { lldb::addr_t ret = record.m_process_address + (local_address - record.m_host_address); - if (log) { - log->Printf( - "IRExecutionUnit::GetRemoteAddressForLocal() found 0x%" PRIx64 - " in [0x%" PRIx64 "..0x%" PRIx64 "], and returned 0x%" PRIx64 - " from [0x%" PRIx64 "..0x%" PRIx64 "].", - local_address, (uint64_t)record.m_host_address, - (uint64_t)record.m_host_address + (uint64_t)record.m_size, ret, - record.m_process_address, record.m_process_address + record.m_size); - } + LLDB_LOGF(log, + "IRExecutionUnit::GetRemoteAddressForLocal() found 0x%" PRIx64 + " in [0x%" PRIx64 "..0x%" PRIx64 "], and returned 0x%" PRIx64 + " from [0x%" PRIx64 "..0x%" PRIx64 "].", + local_address, (uint64_t)record.m_host_address, + (uint64_t)record.m_host_address + (uint64_t)record.m_size, ret, + record.m_process_address, + record.m_process_address + record.m_size); return ret; } @@ -1210,10 +1198,11 @@ void IRExecutionUnit::AllocationRecord::dump(Log *log) { if (!log) return; - log->Printf("[0x%llx+0x%llx]->0x%llx (alignment %d, section ID %d, name %s)", - (unsigned long long)m_host_address, (unsigned long long)m_size, - (unsigned long long)m_process_address, (unsigned)m_alignment, - (unsigned)m_section_id, m_name.c_str()); + LLDB_LOGF(log, + "[0x%llx+0x%llx]->0x%llx (alignment %d, section ID %d, name %s)", + (unsigned long long)m_host_address, (unsigned long long)m_size, + (unsigned long long)m_process_address, (unsigned)m_alignment, + (unsigned)m_section_id, m_name.c_str()); } lldb::ByteOrder IRExecutionUnit::GetByteOrder() const { |