diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2017-04-16 16:04:10 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2017-04-16 16:04:10 +0000 |
| commit | 74a628f776edb588bff8f8f5cc16eac947c9d631 (patch) | |
| tree | dc32e010ac4902621e5a279bfeb48628f7f0e166 /source/DataFormatters | |
| parent | afed7be32164a598f8172282c249af7266c48b46 (diff) | |
Notes
Diffstat (limited to 'source/DataFormatters')
| -rw-r--r-- | source/DataFormatters/CMakeLists.txt | 10 | ||||
| -rw-r--r-- | source/DataFormatters/CXXFunctionPointer.cpp | 2 | ||||
| -rw-r--r-- | source/DataFormatters/FormatManager.cpp | 58 | ||||
| -rw-r--r-- | source/DataFormatters/FormattersHelpers.cpp | 4 | ||||
| -rw-r--r-- | source/DataFormatters/StringPrinter.cpp | 2 | ||||
| -rw-r--r-- | source/DataFormatters/TypeCategoryMap.cpp | 2 | ||||
| -rw-r--r-- | source/DataFormatters/TypeFormat.cpp | 10 | ||||
| -rw-r--r-- | source/DataFormatters/TypeSummary.cpp | 2 | ||||
| -rw-r--r-- | source/DataFormatters/TypeSynthetic.cpp | 2 | ||||
| -rw-r--r-- | source/DataFormatters/TypeValidator.cpp | 2 | ||||
| -rw-r--r-- | source/DataFormatters/ValueObjectPrinter.cpp | 35 | ||||
| -rw-r--r-- | source/DataFormatters/VectorType.cpp | 10 |
12 files changed, 58 insertions, 81 deletions
diff --git a/source/DataFormatters/CMakeLists.txt b/source/DataFormatters/CMakeLists.txt index bfb5c8b9f68b..b8596779005d 100644 --- a/source/DataFormatters/CMakeLists.txt +++ b/source/DataFormatters/CMakeLists.txt @@ -16,4 +16,14 @@ add_lldb_library(lldbDataFormatters TypeValidator.cpp ValueObjectPrinter.cpp VectorType.cpp + + LINK_LIBS + lldbCore + lldbInterpreter + lldbSymbol + lldbTarget + lldbUtility + + LINK_COMPONENTS + Support ) diff --git a/source/DataFormatters/CXXFunctionPointer.cpp b/source/DataFormatters/CXXFunctionPointer.cpp index 41e9d4b382b3..fad67a9d5b7a 100644 --- a/source/DataFormatters/CXXFunctionPointer.cpp +++ b/source/DataFormatters/CXXFunctionPointer.cpp @@ -9,10 +9,10 @@ #include "lldb/DataFormatters/CXXFunctionPointer.h" -#include "lldb/Core/Stream.h" #include "lldb/Core/ValueObject.h" #include "lldb/Target/SectionLoadList.h" #include "lldb/Target/Target.h" +#include "lldb/Utility/Stream.h" #include <string> diff --git a/source/DataFormatters/FormatManager.cpp b/source/DataFormatters/FormatManager.cpp index 6e5fdf92305f..7619b6f6f82b 100644 --- a/source/DataFormatters/FormatManager.cpp +++ b/source/DataFormatters/FormatManager.cpp @@ -17,11 +17,11 @@ // Project includes #include "lldb/Core/Debugger.h" -#include "lldb/Core/Log.h" #include "lldb/DataFormatters/FormattersHelpers.h" #include "lldb/DataFormatters/LanguageCategory.h" #include "lldb/Target/ExecutionContext.h" #include "lldb/Target/Language.h" +#include "lldb/Utility/Log.h" using namespace lldb; using namespace lldb_private; @@ -660,11 +660,9 @@ FormatManager::GetFormat(ValueObject &valobj, if (log) { log->Printf( "[FormatManager::GetFormat] Cache search success. Returning."); - if (log->GetDebug()) - log->Printf("[FormatManager::GetFormat] Cache hits: %" PRIu64 - " - Cache Misses: %" PRIu64, - m_format_cache.GetCacheHits(), - m_format_cache.GetCacheMisses()); + LLDB_LOGV(log, "Cache hits: {0} - Cache Misses: {1}", + m_format_cache.GetCacheHits(), + m_format_cache.GetCacheMisses()); } return retval; } @@ -705,10 +703,8 @@ FormatManager::GetFormat(ValueObject &valobj, match_data.GetTypeForCache().AsCString("<invalid>")); m_format_cache.SetFormat(match_data.GetTypeForCache(), retval); } - if (log && log->GetDebug()) - log->Printf("[FormatManager::GetFormat] Cache hits: %" PRIu64 - " - Cache Misses: %" PRIu64, - m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses()); + LLDB_LOGV(log, "Cache hits: {0} - Cache Misses: {1}", + m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses()); return retval; } @@ -742,11 +738,9 @@ FormatManager::GetSummaryFormat(ValueObject &valobj, if (log) { log->Printf("[FormatManager::GetSummaryFormat] Cache search success. " "Returning."); - if (log->GetDebug()) - log->Printf("[FormatManager::GetSummaryFormat] Cache hits: %" PRIu64 - " - Cache Misses: %" PRIu64, - m_format_cache.GetCacheHits(), - m_format_cache.GetCacheMisses()); + LLDB_LOGV(log, "Cache hits: {0} - Cache Misses: {1}", + m_format_cache.GetCacheHits(), + m_format_cache.GetCacheMisses()); } return retval; } @@ -787,10 +781,8 @@ FormatManager::GetSummaryFormat(ValueObject &valobj, match_data.GetTypeForCache().AsCString("<invalid>")); m_format_cache.SetSummary(match_data.GetTypeForCache(), retval); } - if (log && log->GetDebug()) - log->Printf("[FormatManager::GetSummaryFormat] Cache hits: %" PRIu64 - " - Cache Misses: %" PRIu64, - m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses()); + LLDB_LOGV(log, "Cache hits: {0} - Cache Misses: {1}", + m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses()); return retval; } @@ -825,11 +817,9 @@ FormatManager::GetSyntheticChildren(ValueObject &valobj, if (log) { log->Printf("[FormatManager::GetSyntheticChildren] Cache search " "success. Returning."); - if (log->GetDebug()) - log->Printf( - "[FormatManager::GetSyntheticChildren] Cache hits: %" PRIu64 - " - Cache Misses: %" PRIu64, - m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses()); + LLDB_LOGV(log, "Cache hits: {0} - Cache Misses: {1}", + m_format_cache.GetCacheHits(), + m_format_cache.GetCacheMisses()); } return retval; } @@ -871,10 +861,8 @@ FormatManager::GetSyntheticChildren(ValueObject &valobj, match_data.GetTypeForCache().AsCString("<invalid>")); m_format_cache.SetSynthetic(match_data.GetTypeForCache(), retval); } - if (log && log->GetDebug()) - log->Printf("[FormatManager::GetSyntheticChildren] Cache hits: %" PRIu64 - " - Cache Misses: %" PRIu64, - m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses()); + LLDB_LOGV(log, "Cache hits: {0} - Cache Misses: {1}", + m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses()); return retval; } #endif @@ -895,11 +883,9 @@ FormatManager::GetValidator(ValueObject &valobj, if (log) { log->Printf( "[FormatManager::GetValidator] Cache search success. Returning."); - if (log->GetDebug()) - log->Printf("[FormatManager::GetValidator] Cache hits: %" PRIu64 - " - Cache Misses: %" PRIu64, - m_format_cache.GetCacheHits(), - m_format_cache.GetCacheMisses()); + LLDB_LOGV(log, "Cache hits: {0} - Cache Misses: {1}", + m_format_cache.GetCacheHits(), + m_format_cache.GetCacheMisses()); } return retval; } @@ -940,10 +926,8 @@ FormatManager::GetValidator(ValueObject &valobj, match_data.GetTypeForCache().AsCString("<invalid>")); m_format_cache.SetValidator(match_data.GetTypeForCache(), retval); } - if (log && log->GetDebug()) - log->Printf("[FormatManager::GetValidator] Cache hits: %" PRIu64 - " - Cache Misses: %" PRIu64, - m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses()); + LLDB_LOGV(log, "Cache hits: {0} - Cache Misses: {1}", + m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses()); return retval; } diff --git a/source/DataFormatters/FormattersHelpers.cpp b/source/DataFormatters/FormattersHelpers.cpp index 68802b902a23..460a49690d3d 100644 --- a/source/DataFormatters/FormattersHelpers.cpp +++ b/source/DataFormatters/FormattersHelpers.cpp @@ -17,11 +17,11 @@ // Project includes #include "lldb/DataFormatters/FormattersHelpers.h" -#include "lldb/Core/ConstString.h" -#include "lldb/Core/RegularExpression.h" #include "lldb/Target/StackFrame.h" #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" +#include "lldb/Utility/ConstString.h" +#include "lldb/Utility/RegularExpression.h" using namespace lldb; using namespace lldb_private; diff --git a/source/DataFormatters/StringPrinter.cpp b/source/DataFormatters/StringPrinter.cpp index 4021bd5d9284..7ca3744a247a 100644 --- a/source/DataFormatters/StringPrinter.cpp +++ b/source/DataFormatters/StringPrinter.cpp @@ -11,11 +11,11 @@ #include "lldb/DataFormatters/StringPrinter.h" #include "lldb/Core/Debugger.h" -#include "lldb/Core/Error.h" #include "lldb/Core/ValueObject.h" #include "lldb/Target/Language.h" #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" +#include "lldb/Utility/Error.h" #include "llvm/Support/ConvertUTF.h" diff --git a/source/DataFormatters/TypeCategoryMap.cpp b/source/DataFormatters/TypeCategoryMap.cpp index cc85288c23fc..d2da672f13dc 100644 --- a/source/DataFormatters/TypeCategoryMap.cpp +++ b/source/DataFormatters/TypeCategoryMap.cpp @@ -10,8 +10,8 @@ #include "lldb/DataFormatters/TypeCategoryMap.h" -#include "lldb/Core/Log.h" #include "lldb/DataFormatters/FormatClasses.h" +#include "lldb/Utility/Log.h" // C Includes // C++ Includes diff --git a/source/DataFormatters/TypeFormat.cpp b/source/DataFormatters/TypeFormat.cpp index 8bd369b3532e..4d1a0096bb68 100644 --- a/source/DataFormatters/TypeFormat.cpp +++ b/source/DataFormatters/TypeFormat.cpp @@ -19,13 +19,15 @@ #include "lldb/lldb-enumerations.h" #include "lldb/lldb-public.h" -#include "lldb/Core/StreamString.h" +#include "lldb/Core/DumpDataExtractor.h" #include "lldb/DataFormatters/FormatManager.h" #include "lldb/Symbol/CompilerType.h" #include "lldb/Symbol/SymbolContext.h" #include "lldb/Symbol/SymbolFile.h" #include "lldb/Symbol/TypeList.h" #include "lldb/Target/Target.h" +#include "lldb/Utility/DataExtractor.h" +#include "lldb/Utility/StreamString.h" using namespace lldb; using namespace lldb_private; @@ -60,9 +62,9 @@ bool TypeFormatImpl_Format::FormatObject(ValueObject *valobj, return false; StreamString reg_sstr; - data.Dump(®_sstr, 0, GetFormat(), reg_info->byte_size, 1, UINT32_MAX, - LLDB_INVALID_ADDRESS, 0, 0, - exe_ctx.GetBestExecutionContextScope()); + DumpDataExtractor(data, ®_sstr, 0, GetFormat(), reg_info->byte_size, + 1, UINT32_MAX, LLDB_INVALID_ADDRESS, 0, 0, + exe_ctx.GetBestExecutionContextScope()); dest = reg_sstr.GetString(); } } else { diff --git a/source/DataFormatters/TypeSummary.cpp b/source/DataFormatters/TypeSummary.cpp index 610d2fe7998a..09a7ff8d7d36 100644 --- a/source/DataFormatters/TypeSummary.cpp +++ b/source/DataFormatters/TypeSummary.cpp @@ -20,13 +20,13 @@ #include "lldb/lldb-public.h" #include "lldb/Core/Debugger.h" -#include "lldb/Core/StreamString.h" #include "lldb/Core/ValueObject.h" #include "lldb/DataFormatters/ValueObjectPrinter.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Symbol/CompilerType.h" #include "lldb/Target/StackFrame.h" #include "lldb/Target/Target.h" +#include "lldb/Utility/StreamString.h" using namespace lldb; using namespace lldb_private; diff --git a/source/DataFormatters/TypeSynthetic.cpp b/source/DataFormatters/TypeSynthetic.cpp index 0f7bd9aa7951..28a51dae6b20 100644 --- a/source/DataFormatters/TypeSynthetic.cpp +++ b/source/DataFormatters/TypeSynthetic.cpp @@ -19,12 +19,12 @@ #include "lldb/lldb-public.h" #include "lldb/Core/Debugger.h" -#include "lldb/Core/StreamString.h" #include "lldb/DataFormatters/TypeSynthetic.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/ScriptInterpreter.h" #include "lldb/Symbol/CompilerType.h" #include "lldb/Target/Target.h" +#include "lldb/Utility/StreamString.h" using namespace lldb; using namespace lldb_private; diff --git a/source/DataFormatters/TypeValidator.cpp b/source/DataFormatters/TypeValidator.cpp index 2affd7311e07..7a5b8d565292 100644 --- a/source/DataFormatters/TypeValidator.cpp +++ b/source/DataFormatters/TypeValidator.cpp @@ -15,7 +15,7 @@ // Project includes #include "lldb/DataFormatters/TypeValidator.h" -#include "lldb/Core/StreamString.h" +#include "lldb/Utility/StreamString.h" using namespace lldb; using namespace lldb_private; diff --git a/source/DataFormatters/ValueObjectPrinter.cpp b/source/DataFormatters/ValueObjectPrinter.cpp index d6efe78e49a8..863ff3af12e8 100644 --- a/source/DataFormatters/ValueObjectPrinter.cpp +++ b/source/DataFormatters/ValueObjectPrinter.cpp @@ -13,12 +13,12 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/Stream.h" #include "lldb/Core/ValueObject.h" #include "lldb/DataFormatters/DataVisualization.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Target/Language.h" #include "lldb/Target/Target.h" +#include "lldb/Utility/Stream.h" using namespace lldb; using namespace lldb_private; @@ -457,7 +457,12 @@ bool ValueObjectPrinter::PrintObjectDescriptionIfNeeded(bool value_printed, else object_desc = GetDescriptionForDisplay(); if (object_desc && *object_desc) { - m_stream->Printf("%s\n", object_desc); + // If the description already ends with a \n don't add another one. + size_t object_end = strlen(object_desc) - 1; + if (object_desc[object_end] == '\n') + m_stream->Printf("%s", object_desc); + else + m_stream->Printf("%s\n", object_desc); return true; } else if (value_printed == false && summary_printed == false) return true; @@ -468,32 +473,11 @@ bool ValueObjectPrinter::PrintObjectDescriptionIfNeeded(bool value_printed, return true; } -bool DumpValueObjectOptions::PointerDepth::CanAllowExpansion( - bool is_root, TypeSummaryImpl *entry, ValueObject *valobj, - const std::string &summary) { - switch (m_mode) { - case Mode::Always: - return (m_count > 0); - case Mode::Never: - return false; - case Mode::Default: - if (is_root) - m_count = std::min<decltype(m_count)>(m_count, 1); - return m_count > 0; - case Mode::Formatters: - if (!entry || entry->DoesPrintChildren(valobj) || summary.empty()) - return m_count > 0; - return false; - } - return false; -} - bool DumpValueObjectOptions::PointerDepth::CanAllowExpansion() const { switch (m_mode) { case Mode::Always: case Mode::Default: - case Mode::Formatters: - return (m_count > 0); + return m_count > 0; case Mode::Never: return false; } @@ -546,8 +530,7 @@ bool ValueObjectPrinter::ShouldPrintChildren( return true; } - return curr_ptr_depth.CanAllowExpansion(false, entry, m_valobj, - m_summary); + return curr_ptr_depth.CanAllowExpansion(); } return (!entry || entry->DoesPrintChildren(m_valobj) || m_summary.empty()); diff --git a/source/DataFormatters/VectorType.cpp b/source/DataFormatters/VectorType.cpp index 652bde792ab4..4fb92cad3988 100644 --- a/source/DataFormatters/VectorType.cpp +++ b/source/DataFormatters/VectorType.cpp @@ -204,14 +204,12 @@ public: if (idx >= CalculateNumChildren()) return lldb::ValueObjectSP(); auto offset = idx * m_child_type.GetByteSize(nullptr); - ValueObjectSP child_sp( - m_backend.GetSyntheticChildAtOffset(offset, m_child_type, true)); - if (!child_sp) - return child_sp; - StreamString idx_name; idx_name.Printf("[%" PRIu64 "]", (uint64_t)idx); - child_sp->SetName(ConstString(idx_name.GetString())); + ValueObjectSP child_sp(m_backend.GetSyntheticChildAtOffset( + offset, m_child_type, true, ConstString(idx_name.GetString()))); + if (!child_sp) + return child_sp; child_sp->SetFormat(m_item_format); |
