Problem with program stalling with wait4() in gdb

Hey guys. I have program that generally runs for a while. I want to make sure it works with lots of different initial values, so I've created another program that just calls it in a loop, with system(). I've also implemented multiprocessing with OpenMP.

I run it in gdb, so if it crashes I can figure out why and hopefully fix it. It has been working, but occasionally stalls (I know because it outputs some stuff while it's running). I'll do Ctrl+c to kill it, so I can do backtrace and see where it's stalling.

But when I do backtrace, it doesn't say what functions of my program it was in. It says it's in wait4():

1
2
3
4
5
6
7
8
9
10
Timestep 29 out of 1000
Timestep 30 out of 1000
Timestep 31 out of 1000
^C
Program received signal SIGINT, Interrupt.
0x90ffe18e in wait4 ()
(gdb) backtrace
#0  0x90ffe18e in wait4 ()
#1  0x90ffbcd4 in system$UNIX2003 ()
#2  0x00001ab2 in main (someNum=1, argv=0xbffff71c) at tester.cpp:35 


tester.cpp is my program that calls the other program repeatedly. Because I'm calling the other program with system(), I'm guessing system$UNIX2003 is that. And I looked up wait4(), it seems to be something that waits for a child process to finish. But what child process? It must be stuck somewhere in my program, so why isn't it showing up in backtrace?

Thanks!
The child process that got forked by system().
But why doesn't that show up in backtrace? It's gotta be somewhere in my program.
The child process is not part of your program. It is an independent program that got launched by your program.
Hmmmm, ok. Best bet is to put it in a loop in my main program rather than calling it with system(), I guess.
Topic archived. No new replies allowed.