summaryrefslogtreecommitdiffstats
path: root/lldb/source/DataFormatters/ValueObjectPrinter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/DataFormatters/ValueObjectPrinter.cpp')
-rw-r--r--lldb/source/DataFormatters/ValueObjectPrinter.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/lldb/source/DataFormatters/ValueObjectPrinter.cpp b/lldb/source/DataFormatters/ValueObjectPrinter.cpp
index 65e5e3f4582..3ce5051cc4e 100644
--- a/lldb/source/DataFormatters/ValueObjectPrinter.cpp
+++ b/lldb/source/DataFormatters/ValueObjectPrinter.cpp
@@ -71,6 +71,8 @@ ValueObjectPrinter::PrintValueObject ()
if (ShouldPrintValueObject())
{
+ PrintValidationMarkerIfNeeded();
+
PrintLocationIfNeeded();
m_stream->Indent();
@@ -89,6 +91,8 @@ ValueObjectPrinter::PrintValueObject ()
else
m_stream->EOL();
+ PrintValidationErrorIfNeeded();
+
return true;
}
@@ -624,3 +628,44 @@ ValueObjectPrinter::PrintChildrenIfNeeded (bool value_printed,
else
m_stream->EOL();
}
+
+bool
+ValueObjectPrinter::ShouldPrintValidation ()
+{
+ return options.m_run_validator;
+}
+
+bool
+ValueObjectPrinter::PrintValidationMarkerIfNeeded ()
+{
+ if (!ShouldPrintValidation())
+ return false;
+
+ m_validation = m_valobj->GetValidationStatus();
+
+ if (TypeValidatorResult::Failure == m_validation.first)
+ {
+ m_stream->Printf("! ");
+ return true;
+ }
+
+ return false;
+}
+
+bool
+ValueObjectPrinter::PrintValidationErrorIfNeeded ()
+{
+ if (!ShouldPrintValidation())
+ return false;
+
+ if (TypeValidatorResult::Success == m_validation.first)
+ return false;
+
+ if (m_validation.second.empty())
+ m_validation.second.assign("unknown error");
+
+ m_stream->Printf(" ! validation error: %s", m_validation.second.c_str());
+ m_stream->EOL();
+
+ return true;
+}
OpenPOWER on IntegriCloud