Skip to content
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

Makefiles need to turn off optimizations for DEBUG=1 #4891

Open
ChipKerchner opened this issue Sep 8, 2024 · 4 comments
Open

Makefiles need to turn off optimizations for DEBUG=1 #4891

ChipKerchner opened this issue Sep 8, 2024 · 4 comments

Comments

@ChipKerchner
Copy link
Contributor

It makes it challenging to debug issues when optimizations are turned on and using gdb. All optimizations should be set to -O0 for DEBUG=1.

@martin-frbg
Copy link
Collaborator

I guess that depends on target on compiler, at least "-O2 -g" is a valid combination of options and it has been that way "forever". You can set COMMON_OPT=-O0 if needed.

@ChipKerchner
Copy link
Contributor Author

Yes, it is a valid combo but within gdb you can not inspect a lot of variables when any optimization is turned on.

Every time I want to use gdb, I have to manually modify the optimization flags in Makefile.system and Makefile.power.

It would be nice to not have to do this. I'll probably submit a PR later with the changes to Makefile.power

@ChipKerchner
Copy link
Contributor Author

Something like this

ifeq ($(DEBUG), 1)
OPT_FLAGF = -O0
OPT_FLAG1 = -O0
OPT_FLAG2 = -O0
else
OPT_FLAGF = -Ofast
OPT_FLAG1 = -O1
OPT_FLAG2 = -O2
endif

@martin-frbg
Copy link
Collaborator

OK. Makefile.power is different from the other Makefile.<arch> in this regard, which is probably not a good idea anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants