// area for cases where our desired output is not backed by some other longer-term storage
StreamString strm;
- bool reset_format = false;
- if (custom_format != eFormatInvalid && GetFormat() == lldb::eFormatDefault)
- {
- reset_format = true;
+ if (custom_format != eFormatInvalid)
SetFormat(custom_format);
- }
switch(val_obj_display)
{
}
}
-
if (cstr)
- {
s.PutCString(cstr);
- if (reset_format)
- SetFormat(lldb::eFormatDefault);
- }
else
{
- if (reset_format)
- SetFormat(lldb::eFormatDefault);
if (m_error.Fail())
{
if (do_dump_error)
// even if we have an error message as output, that's a success
// from our callers' perspective, so return true
var_success = true;
+
+ if (custom_format != eFormatInvalid)
+ SetFormat(eFormatDefault);
}
return var_success;
std::string& summary,
std::string& error)
{
- lldb::Format original_format;
- bool custom_format = options.m_format != eFormatDefault && options.m_format != m_valobj->GetFormat();
- if (custom_format)
+ if (options.m_format != eFormatDefault && options.m_format != m_valobj->GetFormat())
{
- original_format = m_valobj->GetFormat();
- m_valobj->SetFormat(options.m_format);
+ m_valobj->GetValueAsCString(options.m_format,
+ value);
+ }
+ else
+ {
+ const char* val_cstr = m_valobj->GetValueAsCString();
+ if (val_cstr)
+ value.assign(val_cstr);
}
- const char* val_cstr = m_valobj->GetValueAsCString();
- value.assign(val_cstr ? val_cstr : "");
const char* err_cstr = m_valobj->GetError().AsCString();
if (err_cstr)
error.assign(err_cstr);
}
}
}
- if (custom_format)
- m_valobj->SetFormat(original_format);
}
bool
"""
-Test that the user can input a format and it will prevail over summary format's choices.
+Test that the user can input a format but it will not prevail over summary format's choices.
"""
import os, time
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
@dsym_test
def test_with_dsym_and_run_command(self):
- """Test that the user can input a format and it will prevail over summary format's choices."""
+ """Test that the user can input a format but it will not prevail over summary format's choices."""
self.buildDsym()
self.data_formatter_commands()
@dwarf_test
def test_with_dwarf_and_run_command(self):
- """Test that the user can input a format and it will prevail over summary format's choices."""
+ """Test that the user can input a format but it will not prevail over summary format's choices."""
self.buildDwarf()
self.data_formatter_commands()
self.line = line_number('main.cpp', '// Set break point at this line.')
def data_formatter_commands(self):
- """Test that the user can input a format and it will prevail over summary format's choices."""
+ """Test that the user can input a format but it will not prevail over summary format's choices."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd('type summary add Pair -s "x=${var.x%d},y=${var.y%u}"')
self.expect("frame variable p1", substrs = ['(Pair) p1 = x=3,y=4294967293']);
- self.expect("frame variable -f x p1", substrs = ['(Pair) p1 = x=0x00000003,y=0xfffffffd']);
- self.expect("frame variable -f d p1", substrs = ['(Pair) p1 = x=3,y=-3']);
+ self.expect("frame variable -f x p1", substrs = ['(Pair) p1 = x=0x00000003,y=0xfffffffd'], matching=False);
+ self.expect("frame variable -f d p1", substrs = ['(Pair) p1 = x=3,y=-3'], matching=False);
self.expect("frame variable p1", substrs = ['(Pair) p1 = x=3,y=4294967293']);
self.runCmd('type summary add Pair -s "x=${var.x%x},y=${var.y%u}"')
self.expect("frame variable p1", substrs = ['(Pair) p1 = x=0x00000003,y=4294967293']);
- self.expect("frame variable -f d p1", substrs = ['(Pair) p1 = x=3,y=-3']);
+ self.expect("frame variable -f d p1", substrs = ['(Pair) p1 = x=3,y=-3'],matching=False);
if __name__ == '__main__':
import atexit