-
Notifications
You must be signed in to change notification settings - Fork 81
Debugging
Florian Loitsch edited this page Oct 10, 2022
·
11 revisions
Tips and tricks on how to debug code related to the Toit framework.
One can run individual test using the ctest
command:
cd build/host
ctest --verbose -R test_name
ctest
does some matching, so the test name doesn't need to be complete.
The --verbose
flag also gives the full command line that was used to run the command.
Note that some tests require to be run from specific locations. Generally, we only have two important locations, though: the root of the checkout, or the directory the test is in.
make tools
discovers the test, so make sure to run make tools
before running individual tests.
Compile the Toit executable with -O0
and in debug mode:
rm -rf build
LOCAL_CXXFLAGS="-O0" make BUILD_TYPE=Debug
By default the compiler is run with fork
(to release its memory when it's done). You can avoid that by running with the -Xno_fork
flag:
gdb --args build/host/sdk/bin/toit.run -Xno_fork hello.toit