diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index bdbb7cdc607..dd4b35ab3c9 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -14,7 +14,7 @@ jobs: strategy: fail-fast: false matrix: - debug-macros: ['ALL_DEBUG', 'NORMAL_DEBUG'] + debug-options: ['ALL_DEBUG', 'NORMAL_DEBUG'] os: [ubuntu-20.04] # If ccache is broken and you would like to bust the ccache cache on Github Actions, increment this: ccache-mark: [0] @@ -93,10 +93,10 @@ jobs: # This is achieved by using the "prefix-timestamp" format, # and permitting the restore-key "prefix-" without specifying a timestamp. # For this trick to work, the timestamp *must* come last, and it *must* be missing in 'restore-keys'. - key: ${{ runner.os }}-ccache-i686-v${{ matrix.ccache-mark }}-D${{ matrix.debug-macros }}-toolchain_${{steps.stamps.outputs.libc_headers}}-time${{ steps.stamps.outputs.time }} + key: ${{ runner.os }}-ccache-i686-v${{ matrix.ccache-mark }}-D${{ matrix.debug-options }}-toolchain_${{steps.stamps.outputs.libc_headers}}-time${{ steps.stamps.outputs.time }} # IMPORTANT: Keep these two in sync! restore-keys: | - ${{ runner.os }}-ccache-i686-v${{ matrix.ccache-mark }}-D${{ matrix.debug-macros }}-toolchain_${{steps.stamps.outputs.libc_headers}}- + ${{ runner.os }}-ccache-i686-v${{ matrix.ccache-mark }}-D${{ matrix.debug-options }}-toolchain_${{steps.stamps.outputs.libc_headers}}- - name: Show ccache stats before build and configure run: | # We only have 5 GiB of cache available *in total*. Beyond that, GitHub deletes caches. @@ -106,15 +106,15 @@ jobs: # Building from scratch fills the ccache cache from 0 to about 0.7 GB, so 1.5 GB is plenty. ccache -M 1500M ccache -s - - name: Create build environment with debug macros + - name: Create build environment with extra debug options working-directory: ${{ github.workspace }} - # Build the entire project with debug macros turned on, to prevent code rot. + # Build the entire project with all available debug options turned on, to prevent code rot. # However, it is unweildy and slow to run tests with them enabled, so we will build twice. run: | mkdir -p Build cd Build - cmake .. -GNinja -DBUILD_LAGOM=ON -DENABLE_ALL_THE_DEBUG_MACROS=ON -DENABLE_PCI_IDS_DOWNLOAD=OFF -DCMAKE_C_COMPILER=gcc-10 -DCMAKE_CXX_COMPILER=g++-10 - if: ${{ matrix.debug-macros == 'ALL_DEBUG' }} + cmake .. -GNinja -DBUILD_LAGOM=ON -DENABLE_ALL_DEBUG_FACILITIES=ON -DENABLE_PCI_IDS_DOWNLOAD=OFF -DCMAKE_C_COMPILER=gcc-10 -DCMAKE_CXX_COMPILER=g++-10 + if: ${{ matrix.debug-options == 'ALL_DEBUG' }} - name: Create build environment working-directory: ${{ github.workspace }} # Note that this needs to run *even if* the Toolchain was built, @@ -123,7 +123,7 @@ jobs: mkdir -p Build cd Build cmake .. -GNinja -DBUILD_LAGOM=ON -DENABLE_PCI_IDS_DOWNLOAD=OFF -DCMAKE_C_COMPILER=gcc-10 -DCMAKE_CXX_COMPILER=g++-10 - if: ${{ matrix.debug-macros == 'NORMAL_DEBUG' }} + if: ${{ matrix.debug-options == 'NORMAL_DEBUG' }} # === ACTUALLY BUILD === @@ -137,12 +137,12 @@ jobs: run: ./check-symbols.sh - name: Create Serenity Rootfs - if: ${{ matrix.debug-macros == 'NORMAL_DEBUG'}} + if: ${{ matrix.debug-options == 'NORMAL_DEBUG'}} working-directory: ${{ github.workspace }}/Build run: ninja install && ninja image - name: Run On-Target Tests - if: ${{ matrix.debug-macros == 'NORMAL_DEBUG'}} + if: ${{ matrix.debug-options == 'NORMAL_DEBUG'}} working-directory: ${{ github.workspace }}/Build env: SERENITY_QEMU_CPU: "max,vmx=off" @@ -167,7 +167,7 @@ jobs: - name: Print Target Logs # Extremely useful if Serenity hangs trying to run one of the tests - if: ${{ !cancelled() && matrix.debug-macros == 'NORMAL_DEBUG'}} + if: ${{ !cancelled() && matrix.debug-options == 'NORMAL_DEBUG'}} working-directory: ${{ github.workspace }}/Build run: '[ ! -e debug.log ] || cat debug.log' diff --git a/CMakeLists.txt b/CMakeLists.txt index f2fcdeea10a..1cf6461242c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,6 +24,7 @@ option(ENABLE_UNDEFINED_SANITIZER "Enable undefined behavior sanitizer testing i option(ENABLE_FUZZER_SANITIZER "Enable fuzzer sanitizer testing in clang" OFF) option(ENABLE_EXTRA_KERNEL_DEBUG_SYMBOLS "Enable -Og and -ggdb3 options for Kernel code for easier debugging" OFF) option(ENABLE_ALL_THE_DEBUG_MACROS "Enable all debug macros to validate they still compile" OFF) +option(ENABLE_ALL_DEBUG_FACILITIES "Enable all noisy debug symbols and options. Not recommended for normal developer use" OFF) option(ENABLE_COMPILETIME_FORMAT_CHECK "Enable compiletime format string checks" ON) option(ENABLE_PCI_IDS_DOWNLOAD "Enable download of the pci.ids database at build time" ON) option(BUILD_LAGOM "Build parts of the system targeting the host OS for fuzzing/testing" OFF) @@ -91,6 +92,11 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang$") add_compile_options(-Wno-overloaded-virtual -Wno-user-defined-literals) endif() +if (ENABLE_ALL_DEBUG_FACILITIES) + set(ENABLE_ALL_THE_DEBUG_MACROS ON) + set(ENABLE_EXTRA_KERNEL_DEBUG_SYMBOLS ON) +endif() + if (ENABLE_ALL_THE_DEBUG_MACROS) include(${CMAKE_SOURCE_DIR}/Meta/CMake/all_the_debug_macros.cmake) endif(ENABLE_ALL_THE_DEBUG_MACROS) diff --git a/Documentation/BuildInstructions.md b/Documentation/BuildInstructions.md index 5a132b99f16..ed89a9c1316 100644 --- a/Documentation/BuildInstructions.md +++ b/Documentation/BuildInstructions.md @@ -248,6 +248,7 @@ There are some optional features that can be enabled during compilation that are - `ENABLE_FUZZER_SANITIZER`: builds [fuzzers](https://en.wikipedia.org/wiki/Fuzzing) for various parts of the system. - `ENABLE_EXTRA_KERNEL_DEBUG_SYMBOLS`: sets -Og and -ggdb3 compile options for building the Kernel. Allows for easier debugging of Kernel code. By default, the Kernel is built with -Os instead. - `ENABLE_ALL_THE_DEBUG_MACROS`: used for checking whether debug code compiles on CI. This should not be set normally, as it clutters the console output and makes the system run very slowly. Instead, enable only the needed debug macros, as described below. +- `ENABLE_ALL_DEBUG_FACILITIES`: used for checking whether debug code compiles on CI. Enables both `ENABLE_ALL_THE_DEBUG_MACROS` and `ENABLE_EXTRA_KERNEL_DEBUG_SYMBOLS`. - `ENABLE_COMPILETIME_FORMAT_CHECK`: checks for the validity of `std::format`-style format string during compilation. Enabled by default. - `ENABLE_PCI_IDS_DOWNLOAD`: downloads the [`pci.ids` database](https://pci-ids.ucw.cz/) that contains information about PCI devices at build time, if not already present. Enabled by default. - `BUILD_LAGOM`: builds [Lagom](../Meta/Lagom/ReadMe.md), which makes various SerenityOS libraries and programs available on the host system.