}
if (m_summary.size()) {
- m_stream->Printf(" %s", m_summary.c_str());
+ if (ShouldShowName() || value_printed)
+ m_stream->PutChar(' ');
+ m_stream->PutCString(m_summary);
summary_printed = true;
}
}
return m_valobj;
}
-void ValueObjectPrinter::PrintChildrenPreamble() {
+void ValueObjectPrinter::PrintChildrenPreamble(bool value_printed,
+ bool summary_printed) {
if (m_options.m_flat_output) {
if (ShouldPrintValueObject())
m_stream->EOL();
if (ShouldPrintValueObject()) {
if (IsRef()) {
m_stream->PutCString(": ");
- } else if (ShouldShowName()) {
+ } else if (value_printed || summary_printed || ShouldShowName()) {
m_stream->PutChar(' ');
}
m_stream->PutCString("{\n");
for (size_t idx = 0; idx < num_children; ++idx) {
if (ValueObjectSP child_sp = GenerateChild(synth_m_valobj, idx)) {
if (!any_children_printed) {
- PrintChildrenPreamble();
+ PrintChildrenPreamble(value_printed, summary_printed);
any_children_printed = true;
}
PrintChild(child_sp, curr_ptr_depth);
self.runCmd("settings set auto-one-line-summaries false")
self._expect_cmd(f"dwim-print s", "frame variable")
self._expect_cmd(f"dwim-print (struct Structure)s", "expression")
+
+ def test_summary_strings(self):
+ """Test dwim-print with nested values (structs, etc)."""
+ self.build()
+ lldbutil.run_to_source_breakpoint(self, "// break here", lldb.SBFileSpec("main.c"))
+ self.runCmd("settings set auto-one-line-summaries false")
+ self.runCmd("type summary add -e -s 'stub summary' Structure")
+ self._expect_cmd(f"dwim-print s", "frame variable")
+ self._expect_cmd(f"dwim-print (struct Structure)s", "expression")