-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Update CMakeLists.txt for better debug info #677
base: master
Are you sure you want to change the base?
Conversation
Add -fstandalone-debug to emit full debug info
do you have any comparison on the debug information produced before and after this option is enabled? i.e., do you see more information in your debugger? |
Hmm. This is weird as the debug info should be already embedded in the executable file? I assume the flag only helps generating some debug symbol files outside the executable. |
Yes, it is weird. For gcc, this flag helps generating some debug symbol files outside the executable. |
the '-fstandalone-debug' flag doesn't exist in g++. The g++ does all the prints that clang with '-fstandalone-debug' does by default. The fix isn't correct. It requires a check if it's g++ or clang. |
CMakeLists.txt
Outdated
@@ -116,7 +116,7 @@ message("${BUSTUB_SANITIZER} sanitizer will be enabled in debug mode.") | |||
# Compiler flags. | |||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -Wextra -Werror") | |||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wno-unused-parameter -Wno-attributes") # TODO: remove | |||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -ggdb -fsanitize=${BUSTUB_SANITIZER} -fno-omit-frame-pointer -fno-optimize-sibling-calls") | |||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -ggdb -fsanitize=${BUSTUB_SANITIZER} -fno-omit-frame-pointer -fno-optimize-sibling-calls -fstandalone-debug") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs a check if it's clang compiler or not
Previously, the `-fstandalone-debug` flag was added unconditionally, which caused errors when using GCC. This commit adds a check to ensure the flag is only applied when using the Clang compiler, preventing issues with GCC.
Add -fstandalone-debug to emit full debug info