Bug#157131: PROPOSAL] Suggest to minimize optimization when DEB_BUILD_OPTIONS contains "debug"
This would lose a feature that I find valuable: usually, recompiling
a package with the debug option will generate a binary whose symbols
are compatible with the "normal" packaged binary. I have used this
several times to chase down hard-to-find library compatibility bugs,
or to interpret core-files from crashes that are difficult to reproduce.
For that matter, there are also Heisenbugs to consider: some bugs only
appear in the optimized version, not the un-optimized. Compiling the
debugging version with different optimization flags would make tracking
down these bugs needlessly difficult.
For what it's worth, I have never had a problem with debugging optimized
code. The line numbers sometimes jump around a bit, but always in a
"I sense a disturbance in the force"
"As though millions of voices cried out, and ran apt-get."
(Anthony Towns about the Debian 3.0 release)