[Mesa-dev] [PATCH] configure.ac: set -O0 on --enable-debug
eero.t.tamminen at intel.com
Mon Oct 16 10:05:45 UTC 2017
On 16.10.2017 12:40, Eero Tamminen wrote:
> On 16.10.2017 02:35, Jason Ekstrand wrote:
>> I'm not sure what I think of this patch. On the one hand, I'm
>> constantly setting CFLAGS="-O0 -ggdb3" when I configure and it seems
>> like a nicer default.
> I use a script for configuring Mesa with suitable options (as CFLAGS
> isn't not the only thing one needs, there's PKG_CONFIG_PATH etc too).
> That's much less typing.
>> On the other hand, this is changing the default to something that is
>> different both from what mesa has done for a long time and from the
>> autotools default so it may have some unexpected effects.
> At least I wouldn't want to debug user complains about Mesa performance
> if Mesa start suddenly defaulting to abysmal (CPU) perf.
E.g. when one is using Mesa through Valgrind (first thing I do when Gdb
doesn't right away point the problem).
Maybe a bit more important, turning all optimizations off completely,
changes the generated code hugely. Timings change, local variables are
all in stack instead of registers, there's no inlining, no dead code
removal, no impact from aliasing, which all could remove or hide the
trigger for the problem.
Everybody doing more debugging should be comfortable reading a bit of
assembly, and know when debug symbols aren't generated properly, as
witht those, debugging optimized code should be pretty OK. When you go
up in backtrace, you can't get values for variables that are in
registers which values have been overwritten by code lower in the
backtrace , but mostly you can get that information by some other way.
 Nowadays Gdb at least shows that their value cannot be recovered,
instead of showing bogus values, like happened before GCC provided
better debug symbols.
>> On October 15, 2017 10:46:15 AM Miklós Máté <mtmkls at gmail.com> wrote:
>>> Autoconf sets CFLAGS="-g -O2" by default.
>>> Signed-off-by: Miklós Máté <mtmkls at gmail.com>
>>> configure.ac | 4 ++++
>>> 1 file changed, 4 insertions(+)
>>> diff --git a/configure.ac b/configure.ac
>>> index 62d33a1941..c833d258ed 100644
>>> --- a/configure.ac
>>> +++ b/configure.ac
>>> @@ -522,6 +522,8 @@ if test "x$enable_debug" = xyes; then
>>> if ! echo "$CFLAGS" | grep -q -e '-O'; then
>>> CFLAGS="$CFLAGS -O0"
>>> + else
>>> + CFLAGS=`echo $CFLAGS | sed -e s/-O./-O0/`
>>> if test "x$GXX" = xyes; then
>>> @@ -530,6 +532,8 @@ if test "x$enable_debug" = xyes; then
>>> if ! echo "$CXXFLAGS" | grep -q -e '-O'; then
>>> CXXFLAGS="$CXXFLAGS -O0"
>>> + else
>>> + CXXFLAGS=`echo $CXXFLAGS | sed -e s/-O./-O0/`
>>> mesa-dev mailing list
>>> mesa-dev at lists.freedesktop.org
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
More information about the mesa-dev