Added a 'void' format so that the user can manually

suppress all non-error output from the "expression"
command.

<rdar://problem/11225150>

llvm-svn: 161502
This commit is contained in:
Sean Callanan 2012-08-08 17:35:10 +00:00
parent 1c7c8f7637
commit bf154daee6
5 changed files with 40 additions and 30 deletions

View File

@ -124,6 +124,7 @@ namespace lldb {
eFormatAddressInfo, // Describe what an address points to (func + offset with file/line, symbol + offset, data, etc)
eFormatHexFloat, // ISO C99 hex float string
eFormatInstruction, // Disassemble an opcode
eFormatVoid, // Do not print this
kNumFormats
} Format;

View File

@ -335,44 +335,51 @@ CommandObjectExpression::EvaluateExpression
}
}
}
if (result_valobj_sp)
{
Format format = m_format_options.GetFormat();
if (result_valobj_sp->GetError().Success())
{
Format format = m_format_options.GetFormat();
if (format != eFormatDefault)
result_valobj_sp->SetFormat (format);
if (format != eFormatVoid)
{
if (format != eFormatDefault)
result_valobj_sp->SetFormat (format);
ValueObject::DumpValueObjectOptions options;
options.SetMaximumPointerDepth(0)
.SetMaximumDepth(UINT32_MAX)
.SetShowLocation(false)
.SetShowTypes(m_command_options.show_types)
.SetUseObjectiveC(m_command_options.print_object)
.SetUseDynamicType(use_dynamic)
.SetScopeChecked(true)
.SetFlatOutput(false)
.SetUseSyntheticValue(true)
.SetIgnoreCap(false)
.SetFormat(format)
.SetSummary()
.SetShowSummary(!m_command_options.print_object);
ValueObject::DumpValueObject (*(output_stream),
result_valobj_sp.get(), // Variable object to dump
options);
if (result)
result->SetStatus (eReturnStatusSuccessFinishResult);
ValueObject::DumpValueObjectOptions options;
options.SetMaximumPointerDepth(0)
.SetMaximumDepth(UINT32_MAX)
.SetShowLocation(false)
.SetShowTypes(m_command_options.show_types)
.SetUseObjectiveC(m_command_options.print_object)
.SetUseDynamicType(use_dynamic)
.SetScopeChecked(true)
.SetFlatOutput(false)
.SetUseSyntheticValue(true)
.SetIgnoreCap(false)
.SetFormat(format)
.SetSummary()
.SetShowSummary(!m_command_options.print_object);
ValueObject::DumpValueObject (*(output_stream),
result_valobj_sp.get(), // Variable object to dump
options);
if (result)
result->SetStatus (eReturnStatusSuccessFinishResult);
}
}
else
{
if (result_valobj_sp->GetError().GetError() == ClangUserExpression::kNoResult)
{
error_stream->PutCString("<no result>\n");
if (result)
result->SetStatus (eReturnStatusSuccessFinishResult);
if (format != eFormatVoid)
{
error_stream->PutCString("<no result>\n");
if (result)
result->SetStatus (eReturnStatusSuccessFinishResult);
}
}
else
{

View File

@ -1108,6 +1108,7 @@ protected:
case eFormatAddressInfo:
case eFormatHexFloat:
case eFormatInstruction:
case eFormatVoid:
result.AppendError("unsupported format for writing memory");
result.SetStatus(eReturnStatusFailed);
return false;

View File

@ -65,7 +65,8 @@ g_format_infos[] =
{ eFormatCharArray , 'a' , "character array" },
{ eFormatAddressInfo , 'A' , "address" },
{ eFormatHexFloat , 'X' , "hex float" },
{ eFormatInstruction , 'i' , "instruction" }
{ eFormatInstruction , 'i' , "instruction" },
{ eFormatVoid , 'v' , "void" }
};
static uint32_t

View File

@ -4319,7 +4319,7 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx,
if (stop_state == eStateExited)
event_to_broadcast_sp = event_sp;
errors.Printf ("Execution stopped with unexpected state.");
errors.Printf ("Execution stopped with unexpected state.\n");
return_value = eExecutionInterrupted;
break;
}