GDB Documentation
Basically, run the code in the debugger (don't forget to compile with the -g flag).
If you believe score_function is involved, then set a breakpoint (b score_function) to test your idea.
You might want to look at where score_function is called from, which should be the code which locates a completed row.
The debugger is advantageous since
- you don't need to edit the code to observe behaviour
- you can examine all the program data
- you can examine the call stack to figure out where things are called from
- you can change data on the fly to test ideas about how things might work differently.
Or you can go for the crude approach of sprinkling debug prints through the code.
Code:
static void score_function (engine_t *engine)
{
printf("DEBUG: score_function called\n");
/// rest of code
}