-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
ports/Makefile: Reinstate -O0 option on demand. #14076
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #14076 +/- ##
=======================================
Coverage 98.39% 98.39%
=======================================
Files 161 161
Lines 21156 21156
=======================================
Hits 20816 20816
Misses 340 340 ☔ View full report in Codecov by Sentry. |
Code size report:
|
Can we consider adding |
You mean in the same way, e.g
Does that also work with |
How about an additional compile flags option, which csn be set at the make command line. |
I'm not sure, maybe, but if you use
The manual says: |
Since the docs say
then that's probably not going to work since the ones passed on the commandline come first? |
Can we just use I'm already used to doing |
Just to be clear: is the idea behing And why is |
Yes, that is the idea. Basically, just the
Because it isn't the |
I think the simplest thing is to make more consistent use of And, I'm happy to change |
-Og introduced in for example 9ffb1ad and c5dbbf7 results in a binary with debug symbols, but essentially breaks debugging with gdb since it still allows the compiler to optimize temporaries for instance, so gdb will report 'optimized out' for a lot of variables and will often halt on other lines than where breakpoints are defined. -O0 has none of these problems, but also makes for a large binary, so allow specifying it via COPT=-O0 by making all Makefiles consistently use this flag and related CSUPEROPT as well. Signed-off-by: stijn <stijn@ignitron.net>
Ok, changed that already.
In gettingstarted.rst? It's now only in unix/README.md but that also seems to be the only one which documents DEBUG=1 whereas most ports have that.
Sounds reasonable but that should be via |
-Og introduced in for example 9ffb1ad and c5dbbf7 results in a binary with debug symbols, but essentially breaks debugging with gdb since it still allows the compiler to optimize temporaries for instance, so gdb will report 'optimized out' for a lot of variables and breakpoints will often halt at the wrong line.
-O0 has none of these problems so allow it by specifying DEBUG=2, leaving the original DEBUG=1 functionality as-is.
See for instance https://stackoverflow.com/questions/63386189/whats-the-difference-between-a-compilers-o0-option-and-og-option for some more information.
I'm not sure if DEBUG=2 is a common way of doing this, but it's definitely pretty simple. Likewise: don't know if all ports I changed this for even work with gdb?
In theory
-g3
is also better than-g
but at least with-O0 -g
stepping through the source and looking at variables and memory all just seems to work fine enough, whereas-Og
is just not usable for getting detailed information on a problem quickly.