14 | | = Compilation en mode debug (optional) = |
15 | | |
16 | | If you have to debug surprising segfaults (you know what I mean, do you? :D ) you will need to compile your code in debug mode (see below). |
17 | | Then you'll have to activate the core dump generation (in each terminal) with |
18 | | {{{ |
19 | | $ ulimit -c unlimited |
20 | | }}} |
21 | | To be sure that the kernel will generate those migthy core file you should issue this command |
22 | | {{{ |
23 | | echo core > /proc/sys/kernel/core_pattern (en sudo) |
24 | | }}} |
25 | | Then when your program crashes, it will generate a "core" file. Use gdb with your binary as the first parameter (again, compiled in debug mode) and the core file as the second parameter (use your cross compiled gdb in case of cross development, arm-poky...-gdb for instance to debug an arm code from your PC). |
26 | | It should load your program symbols. Then the "bt" command will show the backtrace, which is the sequence of function calls that resulted in the crash, allowing you to know exactly where is the problem. |
27 | | |
28 | | |
29 | | == Full framework == |
30 | | If you want to debug the framework itself, you may find beneficial to compile the full framework in debug mode you need to edit the file |
31 | | {{{ |
32 | | $ /opt/robomap3/<version>/<arch>/toochain.cmake |
33 | | }}} |
34 | | and add "-g -O0" to the CMAKE_CXX_FLAGS variable. As of this writing, and for an x86 architecture, the file to edit is "/opt/robomap3/2.1.3/core2-64/toolchain.cmake". |
35 | | Then you shall rebuild the whole framework with a call to flair_compile_all. |
36 | | |
37 | | == Flair based app == |
38 | | If you want to debug your flair based application code, but don't need to debug the framework itself, you need to edit the file |
39 | | {{{ |
40 | | <app>/build/CMakeFiles/<app>.dir/flags.cmake |
41 | | }}} |
42 | | and add the command add_definitions("-g -O0"). |