Skip to content

Add possibility to build CDT in debug mode#59

Merged
mikelik merged 1 commit intomainfrom
mikelik/debug_fix
Nov 10, 2022
Merged

Add possibility to build CDT in debug mode#59
mikelik merged 1 commit intomainfrom
mikelik/debug_fix

Conversation

@mikelik
Copy link
Contributor

@mikelik mikelik commented Nov 8, 2022

Change Description

Add possibility to build CDT in debug mode.
Do not change CMAKE_BUILD_TYPE if provided, which allows to build project in Debug mode.
Only LLVM is needed in Release - otherwise unit tests are failing because of assertion failure.

To build in debug mode cmake command should look like:

cmake -DCMAKE_BUILD_TYPE="Debug" -DTOOLS_BUILD_TYPE="Debug" -DLIBS_BUILD_TYPE="Debug" ..

Now almost everything is built in Debug mode:

mikel@msi:~/repo/cdt/debug$ find . -type f -name "CMakeCache.txt"|xargs grep BUILD_TYPE
./libraries/CMakeCache.txt:CMAKE_BUILD_TYPE:STRING=Debug
./cdt-llvm/CMakeCache.txt:CMAKE_BUILD_TYPE:STRING=Release
./tools/toolchain-tester/CMakeCache.txt:CMAKE_BUILD_TYPE:STRING=
./tools/CMakeCache.txt:CMAKE_BUILD_TYPE:STRING=Debug
./tests/unit/CMakeCache.txt:CMAKE_BUILD_TYPE:STRING=Debug
./tests/integration/CMakeCache.txt:CMAKE_BUILD_TYPE:STRING=Debug
./CMakeCache.txt:CMAKE_BUILD_TYPE:STRING=Debug
./CMakeCache.txt:LIBS_BUILD_TYPE:UNINITIALIZED=Debug
./CMakeCache.txt:TOOLS_BUILD_TYPE:UNINITIALIZED=Debug

Debug symbols are added, i.e.:

mikel@msi:~/repo/cdt/debug$ gdb /home/mikel/repo/cdt/debug/tests/unit/asset_tests 
GNU gdb (Ubuntu 9.2-0ubuntu1~20.04.1) 9.2
(...)
(gdb) where
#0  eosio::cdt::output_stream::push (this=0x38c2c8 <std_err>, c=105 'i')
    at /home/mikel/repo/cdt/libraries/native/native/eosio/crt.hpp:15
#1  0x00000000003540bc in _prints (cstr=0x2024df "invalid symbol name", which=1 '\001')
    at /home/mikel/repo/cdt/libraries/native/crt.cpp:61
(...)

If no CMAKE_BUILD_TYPE is provided then "Release" is assumed (the same as before).

API Changes

  • API Changes

Documentation Additions

  • Documentation Additions

…ject in Debug mode. Only LLVM is needed in Release - otherwise unit tests are failing because of assertion failure.
@mikelik mikelik requested a review from larryk85 November 8, 2022 14:53
@mikelik mikelik linked an issue Nov 8, 2022 that may be closed by this pull request
@mikelik mikelik self-assigned this Nov 8, 2022
@mikelik mikelik requested a review from dimas1185 November 8, 2022 15:10
@dimas1185
Copy link
Contributor

tested local debug. looks good to me

@mikelik mikelik merged commit c010d6f into main Nov 10, 2022
@mikelik mikelik deleted the mikelik/debug_fix branch November 10, 2022 13:13
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

Successfully merging this pull request may close these issues.

Cannot build unit tests and tools in debug mode

3 participants