'How to get gdb to stop at breakpoints in code executed via check?

How do I get gdb to stop at a breakpoint in code that is executed via check?

#include<check>
int main(int argc, char **argv)
{
    Suite *s = create_suite(); //create a test suite
    SRunner *sr = srunner_create(s);
    srunner_run_all(sr, CK_NORMAL); 
}

Somewhere in srunner_run_all(sr, CK_NORMAL) my code gets executed. I can set breakpoints within that code (it's a shared library which is no problem thanks to pending breakpoints). Once the shared library was loaded, info b prints the breakpoint correctly. Nevertheless, gdb doesn't stop at the breakpoint.

Edit: If I set a breakpoint within the code snipped above, gdb does stop though.

gdb


Solution 1:[1]

I managed to make it work by doing :

srunner_set_fork_status(sr, CK_NOFORK);
srunner_run_all(sr, CK_NORMAL);

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 LetsGoBrandon