diff options
Diffstat (limited to 'lldb/source/Target')
-rw-r--r-- | lldb/source/Target/Memory.cpp | 46 | ||||
-rw-r--r-- | lldb/source/Target/SectionLoadList.cpp | 26 | ||||
-rw-r--r-- | lldb/source/Target/ThreadPlanCallFunction.cpp | 5 |
3 files changed, 29 insertions, 48 deletions
diff --git a/lldb/source/Target/Memory.cpp b/lldb/source/Target/Memory.cpp index 775d0b305f2..808d671ff4f 100644 --- a/lldb/source/Target/Memory.cpp +++ b/lldb/source/Target/Memory.cpp @@ -263,16 +263,16 @@ AllocatedBlock::~AllocatedBlock() {} lldb::addr_t AllocatedBlock::ReserveBlock(uint32_t size) { addr_t addr = LLDB_INVALID_ADDRESS; - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_VERBOSE)); + Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); if (size <= m_byte_size) { const uint32_t needed_chunks = CalculateChunksNeededForSize(size); if (m_offset_to_chunk_size.empty()) { m_offset_to_chunk_size[0] = needed_chunks; - if (log) - log->Printf("[1] AllocatedBlock::ReserveBlock(%p) (size = %u (0x%x)) " - "=> offset = 0x%x, %u %u bit chunks", - (void *)this, size, size, 0, needed_chunks, m_chunk_size); + LLDB_LOGV(log, + "[1] ({0}) (size = {1} ({1:x})) => offset = {2:x}, {3} " + "{4} bit chunks", + this, size, 0, needed_chunks, m_chunk_size); addr = m_addr; } else { uint32_t last_offset = 0; @@ -285,12 +285,11 @@ lldb::addr_t AllocatedBlock::ReserveBlock(uint32_t size) { CalculateChunksNeededForSize(bytes_available); if (num_chunks >= needed_chunks) { m_offset_to_chunk_size[last_offset] = needed_chunks; - if (log) - log->Printf("[2] AllocatedBlock::ReserveBlock(%p) (size = %u " - "(0x%x)) => offset = 0x%x, %u %u bit chunks - " - "num_chunks %zu", - (void *)this, size, size, last_offset, needed_chunks, - m_chunk_size, m_offset_to_chunk_size.size()); + LLDB_LOGV(log, + "[2] ({0}) (size = {1} ({1:x})) => offset = {2:x}, " + "{3} {4} bit chunks- num_chunks {5}", + this, size, last_offset, needed_chunks, m_chunk_size, + m_offset_to_chunk_size.size()); addr = m_addr + last_offset; break; } @@ -304,12 +303,11 @@ lldb::addr_t AllocatedBlock::ReserveBlock(uint32_t size) { CalculateChunksNeededForSize(m_byte_size - last_offset); if (chunks_left >= needed_chunks) { m_offset_to_chunk_size[last_offset] = needed_chunks; - if (log) - log->Printf("[3] AllocatedBlock::ReserveBlock(%p) (size = %u " - "(0x%x)) => offset = 0x%x, %u %u bit chunks - " - "num_chunks %zu", - (void *)this, size, size, last_offset, needed_chunks, - m_chunk_size, m_offset_to_chunk_size.size()); + LLDB_LOGV(log, + "[3] ({0}) (size = {1} ({1:x})) => offset = {2:x}, " + "{3} {4} bit chunks- num_chunks {5}", + this, size, last_offset, needed_chunks, m_chunk_size, + m_offset_to_chunk_size.size()); addr = m_addr + last_offset; break; } @@ -371,10 +369,7 @@ lldb::addr_t AllocatedBlock::ReserveBlock(uint32_t size) { // } } - if (log) - log->Printf("AllocatedBlock::ReserveBlock(%p) (size = %u (0x%x)) => " - "0x%16.16" PRIx64, - (void *)this, size, size, (uint64_t)addr); + LLDB_LOGV(log, "({0}) (size = {1} ({1:x})) => {2:x}", this, size, addr); return addr; } @@ -386,12 +381,9 @@ bool AllocatedBlock::FreeBlock(addr_t addr) { m_offset_to_chunk_size.erase(pos); success = true; } - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_VERBOSE)); - if (log) - log->Printf("AllocatedBlock::FreeBlock(%p) (addr = 0x%16.16" PRIx64 - ") => %i, num_chunks: %zu", - (void *)this, (uint64_t)addr, success, - m_offset_to_chunk_size.size()); + Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + LLDB_LOGV(log, "({0}) (addr = {1:x}) => {2}, num_chunks: {3}", this, addr, + success, m_offset_to_chunk_size.size()); return success; } diff --git a/lldb/source/Target/SectionLoadList.cpp b/lldb/source/Target/SectionLoadList.cpp index 0ac5cfac7f2..3dc39443566 100644 --- a/lldb/source/Target/SectionLoadList.cpp +++ b/lldb/source/Target/SectionLoadList.cpp @@ -67,21 +67,13 @@ SectionLoadList::GetSectionLoadAddress(const lldb::SectionSP §ion) const { bool SectionLoadList::SetSectionLoadAddress(const lldb::SectionSP §ion, addr_t load_addr, bool warn_multiple) { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER | - LIBLLDB_LOG_VERBOSE)); - + Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); ModuleSP module_sp(section->GetModule()); if (module_sp) { - if (log) { - const FileSpec &module_file_spec(module_sp->GetFileSpec()); - log->Printf("SectionLoadList::%s (section = %p (%s.%s), load_addr = " - "0x%16.16" PRIx64 ") module = %p", - __FUNCTION__, static_cast<void *>(section.get()), - module_file_spec.GetPath().c_str(), - section->GetName().AsCString(), load_addr, - static_cast<void *>(module_sp.get())); - } + LLDB_LOGV(log, "(section = {0} ({1}.{2}), load_addr = {3:x}) module = {4}", + section.get(), module_sp->GetFileSpec(), section->GetName(), + load_addr, module_sp.get()); if (section->GetByteSize() == 0) return false; // No change @@ -147,10 +139,9 @@ size_t SectionLoadList::SetSectionUnloaded(const lldb::SectionSP §ion_sp) { size_t unload_count = 0; if (section_sp) { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER | - LIBLLDB_LOG_VERBOSE)); + Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); - if (log) { + if (log && log->GetVerbose()) { ModuleSP module_sp = section_sp->GetModule(); std::string module_name("<Unknown>"); if (module_sp) { @@ -183,10 +174,9 @@ size_t SectionLoadList::SetSectionUnloaded(const lldb::SectionSP §ion_sp) { bool SectionLoadList::SetSectionUnloaded(const lldb::SectionSP §ion_sp, addr_t load_addr) { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER | - LIBLLDB_LOG_VERBOSE)); + Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); - if (log) { + if (log && log->GetVerbose()) { ModuleSP module_sp = section_sp->GetModule(); std::string module_name("<Unknown>"); if (module_sp) { diff --git a/lldb/source/Target/ThreadPlanCallFunction.cpp b/lldb/source/Target/ThreadPlanCallFunction.cpp index 0a0bee3787b..7f9f918ae22 100644 --- a/lldb/source/Target/ThreadPlanCallFunction.cpp +++ b/lldb/source/Target/ThreadPlanCallFunction.cpp @@ -174,9 +174,8 @@ ThreadPlanCallFunction::~ThreadPlanCallFunction() { } void ThreadPlanCallFunction::ReportRegisterState(const char *message) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP | - LIBLLDB_LOG_VERBOSE)); - if (log) { + Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + if (log && log->GetVerbose()) { StreamString strm; RegisterContext *reg_ctx = m_thread.GetRegisterContext().get(); |