add --enable-debug for configure #3792

pull arowser wants to merge 2 commits into bitcoin:master from arowser:master changing 1 files +17 −0
  1. arowser commented at 6:05 AM on March 4, 2014: contributor

    ./configure --debug-enable will create a "debug" build, with all debug symbols and no optimizations.

  2. add --enable-debug for configure 69813b6769
  3. laanwj commented at 7:40 AM on March 4, 2014: member

    ACK

    Edit: are you sure that this will work at all? You're setting the debug flags in the top-level Makefile.am. I don't think these flags are actually used anywhere?

  4. laanwj commented at 7:48 AM on March 4, 2014: member

    Mesa implements it the following way, which I think is better as it requires no changes to the Makefile.ams:

    AC_ARG_ENABLE([debug],
        [AS_HELP_STRING([--enable-debug],
            [use debug compiler flags and macros @<:@default=disabled@:>@])],
        [enable_debug="$enableval"],
        [enable_debug=no]
    )
    if test "x$enable_debug" = xyes; then
        DEFINES="$DEFINES -DDEBUG"
        if test "x$GCC" = xyes; then
            CFLAGS="$CFLAGS -g -O0"
        fi
        if test "x$GXX" = xyes; then
            CXXFLAGS="$CXXFLAGS -g -O0"
        fi
    fi
    
  5. luke-jr commented at 4:39 PM on March 4, 2014: member

    -ggdb preferred over -g when supported ;)

  6. laanwj commented at 5:06 PM on March 4, 2014: member

    -ggdb implies -g3? I lost track of all the debug options, though for C++ it's essential to use the right ones because it can be pretty hellish to debug otherwise.

  7. change --enable-debug options better ae3c8ffede
  8. arowser commented at 3:35 AM on March 5, 2014: contributor

    The lannwj's change it more graceful, better compatibility.

    -ggdb3 including GDB extensions if at all possible. -g3 not I think the -ggdb3 is shoulb be best support for GDB, but for support more debugger, we should use -g3. For debug options details please see http://gcc.gnu.org/onlinedocs/gcc-4.3.3/gcc/Debugging-Options.html#Debugging-Options

    And the DEFINES="$DEFINES -DDEBUG" seems not work, so I add the -DDEBUG to CFLAGS too.

    So how about like this?

    AC_PROG_CXX
    AC_PROG_CC
    ...
    
    # Enable debug, the CFLAG="-g -O2" in here
    AC_ARG_ENABLE([debug],
        [AS_HELP_STRING([--enable-debug],
                        [use debug compiler flags and macros (default is no)])],
        [enable_debug=$enableval],
        [enable_debug=no])
    
    if test "x$enable_debug" = xyes; then
        if test "x$GCC" = xyes; then
            CFLAGS="-g3 -O0 -DDEBUG"
        fi
        if test "x$GXX" = xyes; then
            CXXFLAGS="-g3 -O0 -DDEBUG"
        fi
    fi 
    
  9. BitcoinPullTester commented at 4:05 AM on March 5, 2014: none

    Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/ae3c8ffede4d8ef04932eeac238fb4ca14ae0057 for binaries and test log. This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/ Contact BlueMatt on freenode if something looks broken.

  10. laanwj commented at 9:10 AM on March 5, 2014: member

    Tested, and works fine for me.

    With --enable-debug:

    g++ -DHAVE_CONFIG_H -I. -pthread     -pthread     -I../src/obj  -pthread -I/usr/include  -I../src/leveldb/include -I../src/leveldb/helpers/memenv -I.  
     -DBOOST_SPIRIT_THREADSAFE -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS  -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 
     -g3 -O0 -DDEBUG 
     -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter  -Wstack-protector -fstack-protector-all -fPIE -MT alert.o -MD -MP -MF $depbase.Tpo -c -o alert.o alert.cpp &&\
    

    Without --enable-debug:

    g++ -DHAVE_CONFIG_H -I. -pthread     -pthread     -I../src/obj  -pthread -I/usr/include  -I../src/leveldb/include -I../src/leveldb/helpers/memenv -I. 
     -DBOOST_SPIRIT_THREADSAFE -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS     -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 
     -g -O2 
     -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter  -Wstack-protector -fstack-protector-all -fPIE -MT addrman.o -MD -MP -MF $depbase.Tpo -c -o addrman.o addrman.cpp &&\
    
  11. laanwj commented at 8:32 AM on March 10, 2014: member

    Please squash this change into one commit, then I'll merge.

  12. arowser commented at 11:30 AM on March 10, 2014: contributor

    resent to #3833

  13. gavinandresen closed this on Mar 12, 2014

  14. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-05-03 00:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me