From 03c9cd08520ade71caedc4ea5468cc8116dd42d6 Mon Sep 17 00:00:00 2001 From: Jason Molenda Date: Thu, 6 Aug 2015 21:54:29 +0000 Subject: [PATCH] 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. llvm-svn: 244281 --- lldb/source/Target/Thread.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp index 0327fe7..3acc74a 100644 --- a/lldb/source/Target/Thread.cpp +++ b/lldb/source/Target/Thread.cpp @@ -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()); } } } -- 2.7.4