[Lldb-commits] [lldb] r244281 - Change the warning message about optimization to be printed once

Jason Molenda via lldb-commits lldb-commits at lists.llvm.org
Thu Aug 6 14:54:30 PDT 2015


Author: jmolenda
Date: Thu Aug  6 16:54:29 2015
New Revision: 244281

URL: http://llvm.org/viewvc/llvm-project?rev=244281&view=rev
Log:
Change the warning message about optimization to be printed once
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> 

Modified:
    lldb/trunk/source/Target/Thread.cpp

Modified: lldb/trunk/source/Target/Thread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Thread.cpp?rev=244281&r1=244280&r2=244281&view=diff
==============================================================================
--- lldb/trunk/source/Target/Thread.cpp (original)
+++ lldb/trunk/source/Target/Thread.cpp Thu Aug  6 16:54:29 2015
@@ -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 (Sta
 {
     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());
             }
         }
     }




More information about the lldb-commits mailing list