Second part of indicating when the user is stopped in optimized code.
authorJason Molenda <jmolenda@apple.com>
Thu, 6 Aug 2015 03:27:10 +0000 (03:27 +0000)
committerJason Molenda <jmolenda@apple.com>
Thu, 6 Aug 2015 03:27:10 +0000 (03:27 +0000)
commitef7d641617c523c2690f4bf97c5c6139ec5b5b75
treeaffb99c2bae8f93fc7ecfc477175dc7d5387a270
parent50fee93926c36346caee34f4e67f837d5562dcc7
Second part of indicating when the user is stopped in optimized code.

The first part was in r243508 -- the extent of the UI changes in that
patchset was to add "[opt]" to the frame-format when a stack frame was
built with optimized code.

In this change, when a stack frame built with optimization is selected,
a message will be printed to the async output channel --

opt1.c was compiled with optimization - stepping may behave oddly; variables may not be available.

The warning will be only be printed once per source file in a debug session.
These warnings may be disabled by

settings set target.process.optimization-warnings false

Internally, a new Process::PrintWarning() method has been added for
warnings that we want to print only once to the user.  It takes a type
of warning (currently only eWarningsOptimization) and an object
pointer (CompileUnit*) - the warning will only be printed once for a
given object pointer value.

This is a bit of a prototype of this change -  I think we will be
tweaking it more in the future.  But I wanted to land this and see
how it goes.  Advanced users will find these warnings unnecessary
noise and will quickly disable them - but anyone who maintains a
debugger knows that debugging optimized code, without realizing it,
is a constant source of confusion and frustation for more typical
debugger users.

I imagine there will be more of these "warn once per whatever" style
warnings that we will want to add in the future and we'll need to
come up with a better way for enabling/disabling them.  But I'm not
srue what form that warning settings should take and I didn't want
to code up something that we regret later, so for now I just added
another process setting for this one warning.

<rdar://problem/19281172>

llvm-svn: 244190
lldb/include/lldb/Target/Process.h
lldb/include/lldb/Target/Thread.h
lldb/source/Target/Process.cpp
lldb/source/Target/Thread.cpp