Add a setting to allow users to enable expressions that crash LLDB to show up in crash logs.

<rdar://problem/11549320> 

llvm-svn: 196613
This commit is contained in:
Greg Clayton 2013-12-06 21:59:52 +00:00
parent 186507dac6
commit fb6621ef4b
3 changed files with 25 additions and 11 deletions

View File

@ -164,6 +164,9 @@ public:
bool
GetUseFastStepping() const;
bool
GetDisplayExpressionsInCrashlogs () const;
LoadScriptFromSymFile
GetLoadScriptFromSymbolFile() const;

View File

@ -1386,20 +1386,22 @@ SBFrame::EvaluateExpression (const char *expr, const SBExpressionOptions &option
frame = exe_ctx.GetFramePtr();
if (frame)
{
#ifdef LLDB_CONFIGURATION_DEBUG
StreamString frame_description;
frame->DumpUsingSettingsFormat (&frame_description);
Host::SetCrashDescriptionWithFormat ("SBFrame::EvaluateExpression (expr = \"%s\", fetch_dynamic_value = %u) %s",
expr, options.GetFetchDynamicValue(), frame_description.GetString().c_str());
#endif
exe_results = target->EvaluateExpression (expr,
if (target->GetDisplayExpressionsInCrashlogs())
{
StreamString frame_description;
frame->DumpUsingSettingsFormat (&frame_description);
Host::SetCrashDescriptionWithFormat ("SBFrame::EvaluateExpression (expr = \"%s\", fetch_dynamic_value = %u) %s",
expr, options.GetFetchDynamicValue(), frame_description.GetString().c_str());
}
exe_results = target->EvaluateExpression (expr,
frame,
expr_value_sp,
options.ref());
expr_result.SetSP(expr_value_sp, options.GetFetchDynamicValue());
#ifdef LLDB_CONFIGURATION_DEBUG
Host::SetCrashDescription (NULL);
#endif
if (target->GetDisplayExpressionsInCrashlogs())
Host::SetCrashDescription (NULL);
}
else
{

View File

@ -2510,6 +2510,7 @@ g_properties[] =
"'complete' is the default value for this setting which will load all sections and symbols by reading them from memory (slowest, most accurate). "
"'partial' will load sections and attempt to find function bounds without downloading the symbol table (faster, still accurate, missing symbol names). "
"'minimal' is the fastest setting and will load section data with no symbols, but should rarely be used as stack frames in these memory regions will be inaccurate and not provide any context (fastest). " },
{ "display-expression-in-crashlogs" , OptionValue::eTypeBoolean , false, false, NULL, NULL, "Expressions that crash will show up in crash logs if the host system supports executable specific crash log strings and this setting is set to true." },
{ NULL , OptionValue::eTypeInvalid , false, 0 , NULL, NULL, NULL }
};
enum
@ -2541,7 +2542,8 @@ enum
ePropertyHexImmediateStyle,
ePropertyUseFastStepping,
ePropertyLoadScriptFromSymbolFile,
ePropertyMemoryModuleLoadLevel
ePropertyMemoryModuleLoadLevel,
ePropertyDisplayExpressionsInCrashlogs
};
@ -2920,6 +2922,13 @@ TargetProperties::GetUseFastStepping () const
return m_collection_sp->GetPropertyAtIndexAsBoolean (NULL, idx, g_properties[idx].default_uint_value != 0);
}
bool
TargetProperties::GetDisplayExpressionsInCrashlogs () const
{
const uint32_t idx = ePropertyDisplayExpressionsInCrashlogs;
return m_collection_sp->GetPropertyAtIndexAsBoolean (NULL, idx, g_properties[idx].default_uint_value != 0);
}
LoadScriptFromSymFile
TargetProperties::GetLoadScriptFromSymbolFile () const
{