Author: gclayton
Date: Fri Dec  6 15:59:52 2013
New Revision: 196613

URL: http://llvm.org/viewvc/llvm-project?rev=196613&view=rev
Log:
Add a setting to allow users to enable expressions that crash LLDB to show up 
in crash logs.

<rdar://problem/11549320> 



Modified:
    lldb/trunk/include/lldb/Target/Target.h
    lldb/trunk/source/API/SBFrame.cpp
    lldb/trunk/source/Target/Target.cpp

Modified: lldb/trunk/include/lldb/Target/Target.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Target.h?rev=196613&r1=196612&r2=196613&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Target.h (original)
+++ lldb/trunk/include/lldb/Target/Target.h Fri Dec  6 15:59:52 2013
@@ -164,6 +164,9 @@ public:
 
     bool
     GetUseFastStepping() const;
+    
+    bool
+    GetDisplayExpressionsInCrashlogs () const;
 
     LoadScriptFromSymFile
     GetLoadScriptFromSymbolFile() const;

Modified: lldb/trunk/source/API/SBFrame.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFrame.cpp?rev=196613&r1=196612&r2=196613&view=diff
==============================================================================
--- lldb/trunk/source/API/SBFrame.cpp (original)
+++ lldb/trunk/source/API/SBFrame.cpp Fri Dec  6 15:59:52 2013
@@ -1386,20 +1386,22 @@ SBFrame::EvaluateExpression (const char
             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
             {

Modified: lldb/trunk/source/Target/Target.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=196613&r1=196612&r2=196613&view=diff
==============================================================================
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Fri Dec  6 15:59:52 2013
@@ -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 ()
     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
 {


_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits

Reply via email to