diff options
Diffstat (limited to 'source/DataFormatters')
-rw-r--r-- | source/DataFormatters/CXXFormatterFunctions.cpp | 2 | ||||
-rw-r--r-- | source/DataFormatters/FormatManager.cpp | 2 | ||||
-rw-r--r-- | source/DataFormatters/LibCxx.cpp | 5 | ||||
-rw-r--r-- | source/DataFormatters/LibCxxInitializerList.cpp | 2 | ||||
-rw-r--r-- | source/DataFormatters/LibCxxVector.cpp | 2 | ||||
-rw-r--r-- | source/DataFormatters/TypeSummary.cpp | 36 | ||||
-rw-r--r-- | source/DataFormatters/TypeSynthetic.cpp | 24 |
7 files changed, 51 insertions, 22 deletions
diff --git a/source/DataFormatters/CXXFormatterFunctions.cpp b/source/DataFormatters/CXXFormatterFunctions.cpp index 04cdadf5a98fe..5aa8289794c1c 100644 --- a/source/DataFormatters/CXXFormatterFunctions.cpp +++ b/source/DataFormatters/CXXFormatterFunctions.cpp @@ -317,7 +317,7 @@ lldb_private::formatters::WCharStringSummaryProvider (ValueObject& valobj, Strea return false; ClangASTType wchar_clang_type = ClangASTContext::GetBasicType(ast, lldb::eBasicTypeWChar); - const uint32_t wchar_size = wchar_clang_type.GetBitSize(); + const uint32_t wchar_size = wchar_clang_type.GetBitSize(nullptr); ReadStringAndDumpToStreamOptions options(valobj); options.SetLocation(data_addr); diff --git a/source/DataFormatters/FormatManager.cpp b/source/DataFormatters/FormatManager.cpp index 01799cef5e4ee..ae52b3309ed8c 100644 --- a/source/DataFormatters/FormatManager.cpp +++ b/source/DataFormatters/FormatManager.cpp @@ -251,6 +251,8 @@ FormatManager::GetPossibleMatches (ValueObject& valobj, do { lldb::ProcessSP process_sp = valobj.GetProcessSP(); + if (!process_sp) + break; ObjCLanguageRuntime* runtime = process_sp->GetObjCLanguageRuntime(); if (runtime == nullptr) break; diff --git a/source/DataFormatters/LibCxx.cpp b/source/DataFormatters/LibCxx.cpp index 26bbcf91242f1..728ad84341f01 100644 --- a/source/DataFormatters/LibCxx.cpp +++ b/source/DataFormatters/LibCxx.cpp @@ -14,6 +14,7 @@ #include "lldb/Core/DataBufferHeap.h" #include "lldb/Core/Debugger.h" #include "lldb/Core/Error.h" +#include "lldb/Core/FormatEntity.h" #include "lldb/Core/Stream.h" #include "lldb/Core/ValueObject.h" #include "lldb/Core/ValueObjectConstResult.h" @@ -139,7 +140,7 @@ lldb_private::formatters::LibcxxVectorBoolSyntheticFrontEnd::GetChildAtIndex (si return ValueObjectSP(); } bool bit_set = ((byte & mask) != 0); - DataBufferSP buffer_sp(new DataBufferHeap(m_bool_type.GetByteSize(),0)); + DataBufferSP buffer_sp(new DataBufferHeap(m_bool_type.GetByteSize(nullptr),0)); if (bit_set && buffer_sp && buffer_sp->GetBytes()) *(buffer_sp->GetBytes()) = 1; // regardless of endianness, anything non-zero is true StreamString name; name.Printf("[%" PRIu64 "]", (uint64_t)idx); @@ -460,5 +461,5 @@ lldb_private::formatters::LibcxxContainerSummaryProvider (ValueObject& valobj, S return false; stream.Printf("0x%016" PRIx64 " ", value); } - return Debugger::FormatPrompt("size=${svar%#}", NULL, NULL, NULL, stream, &valobj); + return FormatEntity::FormatStringRef("size=${svar%#}", stream, NULL, NULL, NULL, &valobj, false, false); } diff --git a/source/DataFormatters/LibCxxInitializerList.cpp b/source/DataFormatters/LibCxxInitializerList.cpp index e76b0bec95ce2..91f1f90507a75 100644 --- a/source/DataFormatters/LibCxxInitializerList.cpp +++ b/source/DataFormatters/LibCxxInitializerList.cpp @@ -107,7 +107,7 @@ lldb_private::formatters::LibcxxInitializerListSyntheticFrontEnd::Update() if (kind != lldb::eTemplateArgumentKindType || false == m_element_type.IsValid()) return false; - m_element_size = m_element_type.GetByteSize(); + m_element_size = m_element_type.GetByteSize(nullptr); if (m_element_size > 0) m_start = m_backend.GetChildMemberWithName(g___begin_,true).get(); // store raw pointers or end up with a circular dependency diff --git a/source/DataFormatters/LibCxxVector.cpp b/source/DataFormatters/LibCxxVector.cpp index 26c62afbed2b9..d0e6be486d654 100644 --- a/source/DataFormatters/LibCxxVector.cpp +++ b/source/DataFormatters/LibCxxVector.cpp @@ -115,7 +115,7 @@ lldb_private::formatters::LibcxxStdVectorSyntheticFrontEnd::Update() if (!data_type_finder_sp) return false; m_element_type = data_type_finder_sp->GetClangType().GetPointeeType(); - m_element_size = m_element_type.GetByteSize(); + m_element_size = m_element_type.GetByteSize(nullptr); if (m_element_size > 0) { diff --git a/source/DataFormatters/TypeSummary.cpp b/source/DataFormatters/TypeSummary.cpp index ff089af58cb70..4c9cd582e6426 100644 --- a/source/DataFormatters/TypeSummary.cpp +++ b/source/DataFormatters/TypeSummary.cpp @@ -86,13 +86,30 @@ m_flags(flags) StringSummaryFormat::StringSummaryFormat (const TypeSummaryImpl::Flags& flags, const char *format_cstr) : -TypeSummaryImpl(flags), -m_format() + TypeSummaryImpl(flags), + m_format_str() { - if (format_cstr) - m_format.assign(format_cstr); + SetSummaryString (format_cstr); } +void +StringSummaryFormat::SetSummaryString (const char* format_cstr) +{ + m_format.Clear(); + if (format_cstr && format_cstr[0]) + { + m_format_str = format_cstr; + m_error = FormatEntity::Parse(format_cstr, m_format); + } + else + { + m_format_str.clear(); + m_error.Clear(); + } +} + + + bool StringSummaryFormat::FormatObject (ValueObject *valobj, std::string& retval, @@ -120,7 +137,7 @@ StringSummaryFormat::FormatObject (ValueObject *valobj, } else { - if (Debugger::FormatPrompt(m_format.c_str(), &sc, &exe_ctx, &sc.line_entry.range.GetBaseAddress(), s, valobj)) + if (FormatEntity::Format(m_format, s, &sc, &exe_ctx, &sc.line_entry.range.GetBaseAddress(), valobj, false, false)) { retval.assign(s.GetString()); return true; @@ -138,7 +155,10 @@ StringSummaryFormat::GetDescription () { StreamString sstr; - sstr.Printf ("`%s`%s%s%s%s%s%s%s", m_format.c_str(), + sstr.Printf ("`%s`%s%s%s%s%s%s%s%s%s", + m_format_str.c_str(), + m_error.Fail() ? " error: " : "", + m_error.Fail() ? m_error.AsCString() : "", Cascades() ? "" : " (not cascading)", !DoesPrintChildren(nullptr) ? "" : " (show children)", !DoesPrintValue(nullptr) ? " (hide value)" : "", @@ -153,8 +173,8 @@ CXXFunctionSummaryFormat::CXXFunctionSummaryFormat (const TypeSummaryImpl::Flags Callback impl, const char* description) : TypeSummaryImpl(flags), -m_impl(impl), -m_description(description ? description : "") + m_impl(impl), + m_description(description ? description : "") { } diff --git a/source/DataFormatters/TypeSynthetic.cpp b/source/DataFormatters/TypeSynthetic.cpp index 13c1c7508b683..b150b2bb6ee3c 100644 --- a/source/DataFormatters/TypeSynthetic.cpp +++ b/source/DataFormatters/TypeSynthetic.cpp @@ -68,18 +68,24 @@ size_t TypeFilterImpl::FrontEnd::GetIndexOfChildWithName (const ConstString &name) { const char* name_cstr = name.GetCString(); - for (size_t i = 0; i < filter->GetCount(); i++) + if (name_cstr) { - const char* expr_cstr = filter->GetExpressionPathAtIndex(i); - if (expr_cstr) + for (size_t i = 0; i < filter->GetCount(); i++) { - if (*expr_cstr == '.') - expr_cstr++; - else if (*expr_cstr == '-' && *(expr_cstr+1) == '>') - expr_cstr += 2; + const char* expr_cstr = filter->GetExpressionPathAtIndex(i); + if (expr_cstr) + { + if (*expr_cstr == '.') + expr_cstr++; + else if (*expr_cstr == '-' && *(expr_cstr+1) == '>') + expr_cstr += 2; + } + if (expr_cstr) + { + if (!::strcmp(name_cstr, expr_cstr)) + return i; + } } - if (!::strcmp(name_cstr, expr_cstr)) - return i; } return UINT32_MAX; } |