bool ValueObjectPrinter::ShouldExpandEmptyAggregates() { TypeSummaryImpl *entry = GetSummaryFormatter(); if (!entry) return true; return entry->DoesPrintEmptyAggregates(); }
bool ValueObjectPrinter::ShouldPrintChildren (bool is_failed_description, DumpValueObjectOptions::PointerDepth& curr_ptr_depth) { const bool is_ref = IsRef (); const bool is_ptr = IsPtr (); const bool is_uninit = IsUninitialized(); if (is_uninit) return false; // if the user has specified an element count, always print children // as it is explicit user demand being honored if (m_options.m_element_count > 0) return true; TypeSummaryImpl* entry = GetSummaryFormatter(); if (m_options.m_use_objc) return false; if (is_failed_description || m_curr_depth < m_options.m_max_depth) { // We will show children for all concrete types. We won't show // pointer contents unless a pointer depth has been specified. // We won't reference contents unless the reference is the // root object (depth of zero). // Use a new temporary pointer depth in case we override the // current pointer depth below... if (is_ptr || is_ref) { // We have a pointer or reference whose value is an address. // Make sure that address is not NULL AddressType ptr_address_type; if (m_valobj->GetPointerValue (&ptr_address_type) == 0) return false; const bool is_root_level = m_curr_depth == 0; if (is_ref && is_root_level) { // If this is the root object (depth is zero) that we are showing // and it is a reference, and no pointer depth has been supplied // print out what it references. Don't do this at deeper depths // otherwise we can end up with infinite recursion... return true; } return curr_ptr_depth.CanAllowExpansion(false, entry, m_valobj, m_summary); } return (!entry || entry->DoesPrintChildren(m_valobj) || m_summary.empty()); } return false; }
bool ValueObjectPrinter::PrintValueAndSummaryIfNeeded(bool &value_printed, bool &summary_printed) { bool error_printed = false; if (ShouldPrintValueObject()) { if (!CheckScopeIfNeeded()) m_error.assign("out of scope"); if (m_error.empty()) { GetValueSummaryError(m_value, m_summary, m_error); } if (m_error.size()) { // we need to support scenarios in which it is actually fine for a value // to have no type // but - on the other hand - if we get an error *AND* have no type, we try // to get out // gracefully, since most often that combination means "could not resolve // a type" // and the default failure mode is quite ugly if (!m_compiler_type.IsValid()) { m_stream->Printf(" <could not resolve type>"); return false; } error_printed = true; m_stream->Printf(" <%s>\n", m_error.c_str()); } else { // Make sure we have a value and make sure the summary didn't // specify that the value should not be printed - and do not print // the value if this thing is nil // (but show the value if the user passes a format explicitly) TypeSummaryImpl *entry = GetSummaryFormatter(); if (!IsNil() && !IsUninitialized() && !m_value.empty() && (entry == NULL || (entry->DoesPrintValue(m_valobj) || m_options.m_format != eFormatDefault) || m_summary.empty()) && !m_options.m_hide_value) { if (m_options.m_hide_pointer_value && IsPointerValue(m_valobj->GetCompilerType())) { } else { m_stream->Printf(" %s", m_value.c_str()); value_printed = true; } } if (m_summary.size()) { m_stream->Printf(" %s", m_summary.c_str()); summary_printed = true; } } } return !error_printed; }
bool ValueObjectPrinter::ShouldPrintChildren (bool is_failed_description, uint32_t& curr_ptr_depth) { const bool is_ref = IsRef (); const bool is_ptr = IsPtr (); if (is_failed_description || m_curr_depth < options.m_max_depth) { // We will show children for all concrete types. We won't show // pointer contents unless a pointer depth has been specified. // We won't reference contents unless the reference is the // root object (depth of zero). // Use a new temporary pointer depth in case we override the // current pointer depth below... uint32_t curr_ptr_depth = m_ptr_depth; if (is_ptr || is_ref) { // We have a pointer or reference whose value is an address. // Make sure that address is not NULL AddressType ptr_address_type; if (m_valobj->GetPointerValue (&ptr_address_type) == 0) return false; else if (is_ref && m_curr_depth == 0) { // If this is the root object (depth is zero) that we are showing // and it is a reference, and no pointer depth has been supplied // print out what it references. Don't do this at deeper depths // otherwise we can end up with infinite recursion... curr_ptr_depth = 1; } if (curr_ptr_depth == 0) return false; } TypeSummaryImpl* entry = GetSummaryFormatter(); return (!entry || entry->DoesPrintChildren() || m_summary.empty()); } return false; }
bool ValueObjectPrinter::PrintValueAndSummaryIfNeeded (bool& value_printed, bool& summary_printed) { bool error_printed = false; if (ShouldPrintValueObject()) { if (!CheckScopeIfNeeded()) m_error.assign("out of scope"); if (m_error.empty()) { GetValueSummaryError(m_value, m_summary, m_error); } if (m_error.size()) { error_printed = true; m_stream->Printf (" <%s>\n", m_error.c_str()); } else { // Make sure we have a value and make sure the summary didn't // specify that the value should not be printed - and do not print // the value if this thing is nil // (but show the value if the user passes a format explicitly) TypeSummaryImpl* entry = GetSummaryFormatter(); if (!IsNil() && !m_value.empty() && (entry == NULL || (entry->DoesPrintValue(m_valobj) || m_options.m_format != eFormatDefault) || m_summary.empty()) && !m_options.m_hide_value) { if (m_options.m_hide_pointer_value && IsPointerValue(m_valobj->GetCompilerType())) {} else { m_stream->Printf(" %s", m_value.c_str()); value_printed = true; } } if (m_summary.size()) { m_stream->Printf(" %s", m_summary.c_str()); summary_printed = true; } } } return !error_printed; }