Skip to content

Conversation

dongcarl
Copy link
Contributor

Don't optimize even if variables adhere to as-if rule. This is a
somewhat sane default for debugging.

Fixes: #14830

This is more of a "do something dumb and have people correct you" kind of PR. The end goal is to have a configure flag that will allow for debugging without annoying "optimized out" messages, for developer experiences' sake. This is the minimal diff, but people have suggested --enable-debug-slow in the past.

@jonasschnelli
Copy link
Contributor

Yes. Please! On macOS, without that fix, debugging with lldb/gdb is impossible.
Concept ACK

configure.ac Outdated
@@ -271,11 +271,11 @@ if test "x$enable_debug" = xyes; then
if test "x$CXXFLAGS_overridden" = xno; then
CXXFLAGS=""
fi
# Prefer -Og, fall back to -O0 if that is unavailable.
# Prefer -O0, fall back to -Og if that is unavailable.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's fine to add -O0 unconditionally. E.g.: I would be very surprised if a compiler supports -Og but not -O0,

@achow101
Copy link
Member

Concept ACK.

One thing to note is that on Clang 8, I get a bunch of compiler warnings about things needing optimization if -O0 is set.

@laanwj
Copy link
Member

laanwj commented Jul 22, 2019

BTW: this effectively reverts 9e49db2 (#13005)

Don't optimize at all when --enable-debug is supplied. This makes sure
that nothing is optimized out.
@dongcarl dongcarl force-pushed the 2019-07-better-debuggability branch from e85368f to d6ac25b Compare July 30, 2019 19:59
@dongcarl
Copy link
Contributor Author

Addressed comments, there was some discussion on this here: http://gnusha.org/bitcoin-builds/2019-07-30.log

@theuni
Copy link
Member

theuni commented Jul 31, 2019

From the above discussion: -0 from me.

I would expect --enable-debug to turn on Og:

-Og Optimize debugging experience. -Og enables optimizations that do not interfere with
debugging. It should be the optimization level of choice for the standard edit-compile-debug cycle, offering a reasonable level of optimization while maintaining fast compilation and a good debugging experience.

But I don't care that much, and the people that do care seem to want --enable-debug to mean more than the "standard edit-compile-debug cycle". That seems reasonable enough, so sure.

@dongcarl dongcarl marked this pull request as ready for review July 31, 2019 22:49
@jonasschnelli
Copy link
Contributor

Tested ACK d6ac25b
Brings back debugability on macOS 10.14 with clang version Apple LLVM version 10.0.1 (clang-1001.0.46.4).

@maflcko maflcko added this to the 0.19.0 milestone Aug 8, 2019
@jonasschnelli jonasschnelli merged commit d6ac25b into bitcoin:master Aug 14, 2019
jonasschnelli added a commit that referenced this pull request Aug 14, 2019
d6ac25b autoconf: Sane --enable-debug defaults. (Carl Dong)

Pull request description:

  ```
  Don't optimize even if variables adhere to as-if rule. This is a
  somewhat sane default for debugging.
  ```

  -----

  Fixes: #14830

  This is more of a "do something dumb and have people correct you" kind of PR. The end goal is to have a configure flag that will allow for debugging without annoying "optimized out" messages, for developer experiences' sake. This is the minimal diff, but people have suggested `--enable-debug-slow` in the past.

ACKs for top commit:
  jonasschnelli:
    Tested ACK d6ac25b

Tree-SHA512: 7a5576ad1d33850aff1445ccb71b133f654b455da2d1daed2ed1b82ea773965790a62895aeeab74b23a25513ab96dddb670f9dbc593dd0b8c030694206a99ccf
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Aug 17, 2019
d6ac25b autoconf: Sane --enable-debug defaults. (Carl Dong)

Pull request description:

  ```
  Don't optimize even if variables adhere to as-if rule. This is a
  somewhat sane default for debugging.
  ```

  -----

  Fixes: bitcoin#14830

  This is more of a "do something dumb and have people correct you" kind of PR. The end goal is to have a configure flag that will allow for debugging without annoying "optimized out" messages, for developer experiences' sake. This is the minimal diff, but people have suggested `--enable-debug-slow` in the past.

ACKs for top commit:
  jonasschnelli:
    Tested ACK d6ac25b

Tree-SHA512: 7a5576ad1d33850aff1445ccb71b133f654b455da2d1daed2ed1b82ea773965790a62895aeeab74b23a25513ab96dddb670f9dbc593dd0b8c030694206a99ccf
zkbot added a commit to zcash/zcash that referenced this pull request Jan 30, 2020
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 27, 2021
d6ac25b autoconf: Sane --enable-debug defaults. (Carl Dong)

Pull request description:

  ```
  Don't optimize even if variables adhere to as-if rule. This is a
  somewhat sane default for debugging.
  ```

  -----

  Fixes: bitcoin#14830

  This is more of a "do something dumb and have people correct you" kind of PR. The end goal is to have a configure flag that will allow for debugging without annoying "optimized out" messages, for developer experiences' sake. This is the minimal diff, but people have suggested `--enable-debug-slow` in the past.

ACKs for top commit:
  jonasschnelli:
    Tested ACK d6ac25b

Tree-SHA512: 7a5576ad1d33850aff1445ccb71b133f654b455da2d1daed2ed1b82ea773965790a62895aeeab74b23a25513ab96dddb670f9dbc593dd0b8c030694206a99ccf
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 28, 2021
d6ac25b autoconf: Sane --enable-debug defaults. (Carl Dong)

Pull request description:

  ```
  Don't optimize even if variables adhere to as-if rule. This is a
  somewhat sane default for debugging.
  ```

  -----

  Fixes: bitcoin#14830

  This is more of a "do something dumb and have people correct you" kind of PR. The end goal is to have a configure flag that will allow for debugging without annoying "optimized out" messages, for developer experiences' sake. This is the minimal diff, but people have suggested `--enable-debug-slow` in the past.

ACKs for top commit:
  jonasschnelli:
    Tested ACK d6ac25b

Tree-SHA512: 7a5576ad1d33850aff1445ccb71b133f654b455da2d1daed2ed1b82ea773965790a62895aeeab74b23a25513ab96dddb670f9dbc593dd0b8c030694206a99ccf
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 29, 2021
d6ac25b autoconf: Sane --enable-debug defaults. (Carl Dong)

Pull request description:

  ```
  Don't optimize even if variables adhere to as-if rule. This is a
  somewhat sane default for debugging.
  ```

  -----

  Fixes: bitcoin#14830

  This is more of a "do something dumb and have people correct you" kind of PR. The end goal is to have a configure flag that will allow for debugging without annoying "optimized out" messages, for developer experiences' sake. This is the minimal diff, but people have suggested `--enable-debug-slow` in the past.

ACKs for top commit:
  jonasschnelli:
    Tested ACK d6ac25b

Tree-SHA512: 7a5576ad1d33850aff1445ccb71b133f654b455da2d1daed2ed1b82ea773965790a62895aeeab74b23a25513ab96dddb670f9dbc593dd0b8c030694206a99ccf
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 1, 2021
d6ac25b autoconf: Sane --enable-debug defaults. (Carl Dong)

Pull request description:

  ```
  Don't optimize even if variables adhere to as-if rule. This is a
  somewhat sane default for debugging.
  ```

  -----

  Fixes: bitcoin#14830

  This is more of a "do something dumb and have people correct you" kind of PR. The end goal is to have a configure flag that will allow for debugging without annoying "optimized out" messages, for developer experiences' sake. This is the minimal diff, but people have suggested `--enable-debug-slow` in the past.

ACKs for top commit:
  jonasschnelli:
    Tested ACK d6ac25b

Tree-SHA512: 7a5576ad1d33850aff1445ccb71b133f654b455da2d1daed2ed1b82ea773965790a62895aeeab74b23a25513ab96dddb670f9dbc593dd0b8c030694206a99ccf
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 1, 2021
d6ac25b autoconf: Sane --enable-debug defaults. (Carl Dong)

Pull request description:

  ```
  Don't optimize even if variables adhere to as-if rule. This is a
  somewhat sane default for debugging.
  ```

  -----

  Fixes: bitcoin#14830

  This is more of a "do something dumb and have people correct you" kind of PR. The end goal is to have a configure flag that will allow for debugging without annoying "optimized out" messages, for developer experiences' sake. This is the minimal diff, but people have suggested `--enable-debug-slow` in the past.

ACKs for top commit:
  jonasschnelli:
    Tested ACK d6ac25b

Tree-SHA512: 7a5576ad1d33850aff1445ccb71b133f654b455da2d1daed2ed1b82ea773965790a62895aeeab74b23a25513ab96dddb670f9dbc593dd0b8c030694206a99ccf
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 12, 2021
d6ac25b autoconf: Sane --enable-debug defaults. (Carl Dong)

Pull request description:

  ```
  Don't optimize even if variables adhere to as-if rule. This is a
  somewhat sane default for debugging.
  ```

  -----

  Fixes: bitcoin#14830

  This is more of a "do something dumb and have people correct you" kind of PR. The end goal is to have a configure flag that will allow for debugging without annoying "optimized out" messages, for developer experiences' sake. This is the minimal diff, but people have suggested `--enable-debug-slow` in the past.

ACKs for top commit:
  jonasschnelli:
    Tested ACK d6ac25b

Tree-SHA512: 7a5576ad1d33850aff1445ccb71b133f654b455da2d1daed2ed1b82ea773965790a62895aeeab74b23a25513ab96dddb670f9dbc593dd0b8c030694206a99ccf
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Dec 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

--enable-debug default flags much less useful for introspection of variables
6 participants