Change the warning message about optimization to be printed once
authorJason Molenda <jmolenda@apple.com>
Thu, 6 Aug 2015 21:54:29 +0000 (21:54 +0000)
committerJason Molenda <jmolenda@apple.com>
Thu, 6 Aug 2015 21:54:29 +0000 (21:54 +0000)
per Module instead of once per CompileUnit, and print the
module name.  A module may have a mix of compile units built with
optimization and compile units built without optimization -- the
warning won't be printed until the user selects a stack frame of
a function that was built with optimization.  And as before, it
will only be printed once per module per debug session.

<rdar://problem/19281172>

llvm-svn: 244281

lldb/source/Target/Thread.cpp

index 0327fe7..3acc74a 100644 (file)
@@ -11,6 +11,7 @@
 #include "lldb/Core/Debugger.h"
 #include "lldb/Core/Log.h"
 #include "lldb/Core/FormatEntity.h"
+#include "lldb/Core/Module.h"
 #include "lldb/Core/State.h"
 #include "lldb/Core/Stream.h"
 #include "lldb/Core/StreamString.h"
@@ -428,12 +429,12 @@ Thread::FunctionOptimizationWarning (StackFrame *frame)
 {
     if (frame && frame->HasDebugInformation())
     {
-        SymbolContext sc = frame->GetSymbolContext (eSymbolContextFunction | eSymbolContextCompUnit);
-        if (sc.function && sc.function->GetIsOptimized() == true && sc.comp_unit)
+        SymbolContext sc = frame->GetSymbolContext (eSymbolContextFunction | eSymbolContextModule);
+        if (sc.function && sc.function->GetIsOptimized() == true && sc.module_sp.get())
         {
-            if (sc.line_entry.file.GetFilename().IsEmpty() == false)
+            if (sc.module_sp->GetFileSpec().GetFilename().IsEmpty() == false)
             {
-                GetProcess()->PrintWarning (Process::Warnings::eWarningsOptimization, sc.comp_unit, "%s was compiled with optimization - stepping may behave oddly; variables may not be available.\n", sc.line_entry.file.GetFilename().GetCString());
+                GetProcess()->PrintWarning (Process::Warnings::eWarningsOptimization, sc.module_sp.get(), "%s was compiled with optimization - stepping may behave oddly; variables may not be available.\n", sc.module_sp->GetFileSpec().GetFilename().GetCString());
             }
         }
     }