|
From: Branden A. <b.m...@gm...> - 2017-03-24 00:47:55
|
You can tackle this one of two ways. GDB: You can instruct GDB what to do on a fork using its follow-fork-mode <https://sourceware.org/gdb/onlinedocs/gdb/Forks.html>. Namely you can instruct GDB to follow the parent or child on a fork. If you set this to "child" you should then be debugging the unit test in question. You may want to disable test timeouts if you go this route, so the parent process monitoring the unit test does not kill the test for running too long. To do this, set the CK_DEFAULT_TIMEOUT <https://libcheck.github.io/check/doc/check_html/check_4.html#Test-Timeouts> environment variable to "0". Check: If you set the CK_FORK <https://libcheck.github.io/check/doc/check_html/check_4.html#No-Fork-Mode> environment variable to "no", then check will not fork to run unit tests. Good luck figuring out your crash! - Branden On Thu, Mar 23, 2017 at 6:43 PM, Nicola Spanti < nic...@ec...> wrote: > Hi. > > I have an error in one of my test, but I do not understand why. It > causes a SEGFAULT, so it should be easy to find with GDB. > But GDB seems not to follow the processes created by the test. There is > probably a way to use GDB correctly in this context, but I do not know it. > Is there a way to force check not to create process and thread (that > will enable me to use GDB in a simple way)? I would particularly > appreciate a way without recompiling check, but I found nothing in the > public API. > I am on GNU/Linux. > > user@user-ThinkPad-X200:~/workspace/PlanetWars2dRT-SDL2/externals/core$ > ./debug/bin/check_activity_manager > Running suite(s): Activity manager > 71%: Checks: 7, Failures: 0, Errors: 2 > /home/user/workspace/PlanetWars2dRT-SDL2/externals/ > core/tests/check_activity_manager.c:66:E:Current:test_ > activity_manager_start_current:0: > (after this point) Received signal 11 (Segmentation fault) > /home/user/workspace/PlanetWars2dRT-SDL2/externals/ > core/tests/check_activity_manager.c:87:E:Next:test_ > activity_manager_start_next:0: > (after this point) Received signal 11 (Segmentation fault) > user@user-ThinkPad-X200:~/workspace/PlanetWars2dRT-SDL2/externals/core$ > gdb ./debug/bin/check_activity_manager > GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.2) 7.7.1 > Copyright (C) 2014 Free Software Foundation, Inc. > License GPLv3+: GNU GPL version 3 or later > <http://gnu.org/licenses/gpl.html> > This is free software: you are free to change and redistribute it. > There is NO WARRANTY, to the extent permitted by law. Type "show copying" > and "show warranty" for details. > This GDB was configured as "x86_64-linux-gnu". > Type "show configuration" for configuration details. > For bug reporting instructions, please see: > <http://www.gnu.org/software/gdb/bugs/>. > Find the GDB manual and other documentation resources online at: > <http://www.gnu.org/software/gdb/documentation/>. > For help, type "help". > Type "apropos word" to search for commands related to "word"... > Reading symbols from ./debug/bin/check_activity_manager...done. > (gdb) b tests/check_activity_manager.c:65 > Breakpoint 1 at 0x4030f3: file > /home/user/workspace/PlanetWars2dRT-SDL2/externals/ > core/tests/check_activity_manager.c, > line 65. > (gdb) r > Starting program: > /home/user/workspace/PlanetWars2dRT-SDL2/externals/ > core/debug/bin/check_activity_manager > [Thread debugging using libthread_db enabled] > Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". > Running suite(s): Activity manager > 71%: Checks: 7, Failures: 0, Errors: 2 > /home/user/workspace/PlanetWars2dRT-SDL2/externals/ > core/tests/check_activity_manager.c:66:E:Current:test_ > activity_manager_start_current:0: > (after this point) Received signal 11 (Segmentation fault) > /home/user/workspace/PlanetWars2dRT-SDL2/externals/ > core/tests/check_activity_manager.c:87:E:Next:test_ > activity_manager_start_next:0: > (after this point) Received signal 11 (Segmentation fault) > [Inferior 1 (process 8147) exited with code 01] > > Regards. > > ------------------------------------------------------------ > ------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > Check-users mailing list > Che...@li... > https://lists.sourceforge.net/lists/listinfo/check-users > |