summaryrefslogtreecommitdiffstats
path: root/contrib/llvm/tools/lldb/source/DataFormatters
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm/tools/lldb/source/DataFormatters')
-rw-r--r--contrib/llvm/tools/lldb/source/DataFormatters/CXXFunctionPointer.cpp2
-rw-r--r--contrib/llvm/tools/lldb/source/DataFormatters/FormatManager.cpp58
-rw-r--r--contrib/llvm/tools/lldb/source/DataFormatters/FormattersHelpers.cpp4
-rw-r--r--contrib/llvm/tools/lldb/source/DataFormatters/StringPrinter.cpp6
-rw-r--r--contrib/llvm/tools/lldb/source/DataFormatters/TypeCategory.cpp21
-rw-r--r--contrib/llvm/tools/lldb/source/DataFormatters/TypeCategoryMap.cpp2
-rw-r--r--contrib/llvm/tools/lldb/source/DataFormatters/TypeFormat.cpp18
-rw-r--r--contrib/llvm/tools/lldb/source/DataFormatters/TypeSummary.cpp2
-rw-r--r--contrib/llvm/tools/lldb/source/DataFormatters/TypeSynthetic.cpp2
-rw-r--r--contrib/llvm/tools/lldb/source/DataFormatters/TypeValidator.cpp2
-rw-r--r--contrib/llvm/tools/lldb/source/DataFormatters/ValueObjectPrinter.cpp35
-rw-r--r--contrib/llvm/tools/lldb/source/DataFormatters/VectorType.cpp10
12 files changed, 57 insertions, 105 deletions
diff --git a/contrib/llvm/tools/lldb/source/DataFormatters/CXXFunctionPointer.cpp b/contrib/llvm/tools/lldb/source/DataFormatters/CXXFunctionPointer.cpp
index 41e9d4b..fad67a9 100644
--- a/contrib/llvm/tools/lldb/source/DataFormatters/CXXFunctionPointer.cpp
+++ b/contrib/llvm/tools/lldb/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/contrib/llvm/tools/lldb/source/DataFormatters/FormatManager.cpp b/contrib/llvm/tools/lldb/source/DataFormatters/FormatManager.cpp
index 6e5fdf9..7619b6f 100644
--- a/contrib/llvm/tools/lldb/source/DataFormatters/FormatManager.cpp
+++ b/contrib/llvm/tools/lldb/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/contrib/llvm/tools/lldb/source/DataFormatters/FormattersHelpers.cpp b/contrib/llvm/tools/lldb/source/DataFormatters/FormattersHelpers.cpp
index 68802b9..460a496 100644
--- a/contrib/llvm/tools/lldb/source/DataFormatters/FormattersHelpers.cpp
+++ b/contrib/llvm/tools/lldb/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/contrib/llvm/tools/lldb/source/DataFormatters/StringPrinter.cpp b/contrib/llvm/tools/lldb/source/DataFormatters/StringPrinter.cpp
index 4021bd5..84143a5 100644
--- a/contrib/llvm/tools/lldb/source/DataFormatters/StringPrinter.cpp
+++ b/contrib/llvm/tools/lldb/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/Status.h"
#include "llvm/Support/ConvertUTF.h"
@@ -417,7 +417,7 @@ bool StringPrinter::ReadStringAndDumpToStream<
StringPrinter::StringElementType::ASCII>(
const ReadStringAndDumpToStreamOptions &options) {
assert(options.GetStream() && "need a Stream to print the string to");
- Error my_error;
+ Status my_error;
ProcessSP process_sp(options.GetProcessSP());
@@ -561,7 +561,7 @@ static bool ReadUTFBufferAndDumpToStream(
if (!buffer_sp->GetBytes())
return false;
- Error error;
+ Status error;
char *buffer = reinterpret_cast<char *>(buffer_sp->GetBytes());
if (needs_zero_terminator)
diff --git a/contrib/llvm/tools/lldb/source/DataFormatters/TypeCategory.cpp b/contrib/llvm/tools/lldb/source/DataFormatters/TypeCategory.cpp
index db3372c..184a8c9 100644
--- a/contrib/llvm/tools/lldb/source/DataFormatters/TypeCategory.cpp
+++ b/contrib/llvm/tools/lldb/source/DataFormatters/TypeCategory.cpp
@@ -36,23 +36,8 @@ TypeCategoryImpl::TypeCategoryImpl(
static bool IsApplicable(lldb::LanguageType category_lang,
lldb::LanguageType valobj_lang) {
switch (category_lang) {
- // these are not languages that LLDB would ordinarily deal with
- // only allow an exact equality here, since we really don't know
- // any better
- case eLanguageTypeAda83:
- case eLanguageTypeCobol74:
- case eLanguageTypeCobol85:
- case eLanguageTypeFortran77:
- case eLanguageTypeFortran90:
- case eLanguageTypePascal83:
- case eLanguageTypeModula2:
- case eLanguageTypeJava:
- case eLanguageTypeAda95:
- case eLanguageTypeFortran95:
- case eLanguageTypePLI:
- case eLanguageTypeUPC:
- case eLanguageTypeD:
- case eLanguageTypePython:
+ // Unless we know better, allow only exact equality.
+ default:
return category_lang == valobj_lang;
// the C family, we consider it as one
@@ -80,7 +65,7 @@ static bool IsApplicable(lldb::LanguageType category_lang,
valobj_lang == eLanguageTypeC_plus_plus ||
valobj_lang == eLanguageTypeObjC;
- default:
+ // Categories with unspecified language match everything.
case eLanguageTypeUnknown:
return true;
}
diff --git a/contrib/llvm/tools/lldb/source/DataFormatters/TypeCategoryMap.cpp b/contrib/llvm/tools/lldb/source/DataFormatters/TypeCategoryMap.cpp
index cc85288..d2da672 100644
--- a/contrib/llvm/tools/lldb/source/DataFormatters/TypeCategoryMap.cpp
+++ b/contrib/llvm/tools/lldb/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/contrib/llvm/tools/lldb/source/DataFormatters/TypeFormat.cpp b/contrib/llvm/tools/lldb/source/DataFormatters/TypeFormat.cpp
index 8bd369b..333fe91 100644
--- a/contrib/llvm/tools/lldb/source/DataFormatters/TypeFormat.cpp
+++ b/contrib/llvm/tools/lldb/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;
@@ -54,15 +56,15 @@ bool TypeFormatImpl_Format::FormatObject(ValueObject *valobj,
if (context_type == Value::eContextTypeRegisterInfo) {
const RegisterInfo *reg_info = value.GetRegisterInfo();
if (reg_info) {
- Error error;
+ Status error;
valobj->GetData(data, error);
if (error.Fail())
return false;
StreamString reg_sstr;
- data.Dump(&reg_sstr, 0, GetFormat(), reg_info->byte_size, 1, UINT32_MAX,
- LLDB_INVALID_ADDRESS, 0, 0,
- exe_ctx.GetBestExecutionContextScope());
+ DumpDataExtractor(data, &reg_sstr, 0, GetFormat(), reg_info->byte_size,
+ 1, UINT32_MAX, LLDB_INVALID_ADDRESS, 0, 0,
+ exe_ctx.GetBestExecutionContextScope());
dest = reg_sstr.GetString();
}
} else {
@@ -80,7 +82,7 @@ bool TypeFormatImpl_Format::FormatObject(ValueObject *valobj,
TargetSP target_sp(valobj->GetTargetSP());
if (target_sp) {
size_t max_len = target_sp->GetMaximumSizeOfStringSummary();
- Error error;
+ Status error;
DataBufferSP buffer_sp(new DataBufferHeap(max_len + 1, 0));
Address address(valobj->GetPointerValue());
if (target_sp->ReadCStringFromMemory(
@@ -90,7 +92,7 @@ bool TypeFormatImpl_Format::FormatObject(ValueObject *valobj,
}
}
} else {
- Error error;
+ Status error;
valobj->GetData(data, error);
if (error.Fail())
return false;
@@ -183,7 +185,7 @@ bool TypeFormatImpl_EnumType::FormatObject(ValueObject *valobj,
if (valobj_enum_type.IsValid() == false)
return false;
DataExtractor data;
- Error error;
+ Status error;
valobj->GetData(data, error);
if (error.Fail())
return false;
diff --git a/contrib/llvm/tools/lldb/source/DataFormatters/TypeSummary.cpp b/contrib/llvm/tools/lldb/source/DataFormatters/TypeSummary.cpp
index 610d2fe..09a7ff8 100644
--- a/contrib/llvm/tools/lldb/source/DataFormatters/TypeSummary.cpp
+++ b/contrib/llvm/tools/lldb/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/contrib/llvm/tools/lldb/source/DataFormatters/TypeSynthetic.cpp b/contrib/llvm/tools/lldb/source/DataFormatters/TypeSynthetic.cpp
index 0f7bd9a..28a51da 100644
--- a/contrib/llvm/tools/lldb/source/DataFormatters/TypeSynthetic.cpp
+++ b/contrib/llvm/tools/lldb/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/contrib/llvm/tools/lldb/source/DataFormatters/TypeValidator.cpp b/contrib/llvm/tools/lldb/source/DataFormatters/TypeValidator.cpp
index 2affd73..7a5b8d5 100644
--- a/contrib/llvm/tools/lldb/source/DataFormatters/TypeValidator.cpp
+++ b/contrib/llvm/tools/lldb/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/contrib/llvm/tools/lldb/source/DataFormatters/ValueObjectPrinter.cpp b/contrib/llvm/tools/lldb/source/DataFormatters/ValueObjectPrinter.cpp
index d6efe78..863ff3a 100644
--- a/contrib/llvm/tools/lldb/source/DataFormatters/ValueObjectPrinter.cpp
+++ b/contrib/llvm/tools/lldb/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/contrib/llvm/tools/lldb/source/DataFormatters/VectorType.cpp b/contrib/llvm/tools/lldb/source/DataFormatters/VectorType.cpp
index 652bde7..4fb92ca 100644
--- a/contrib/llvm/tools/lldb/source/DataFormatters/VectorType.cpp
+++ b/contrib/llvm/tools/lldb/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);
OpenPOWER on IntegriCloud