Hi,
I am developing a two process program on RH linux 9. I am trying to debug the child process by following:
http://freebsd.active-venture.com/de...debugging.html
In the main:
int main(){
....
if ((child_pid = fork()) < 0)
printf("######### error\n");
else if (child_pid == 0) {
sleep(30);
do_sth();
exit(0);
}
....
}
void do_sth(){...}
-----------------------
After I start the program, I find out the child process id, and start gdb in another window.
# gdb
GNU gdb 6.2.1
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you ......
(gdb) attach 19495
Attaching to process 19495
.....
Using host libthread_db library "/lib/tls/libthread_db.so.1".
Reading symbols from /usr/lib/libodbc.so.1...done.
Loaded symbols for /usr/lib/libodbc.so.1
............
Reading symbols from /lib/tls/libpthread.so.0...done.
[Thread debugging using libthread_db enabled]
[New Thread 1077073120 (LWP 19492)]
Error while reading shared library symbols:
Can't attach LWP 19492: No such process
.............
Reading symbols from /usr/lib/libz.so.1...done.
Loaded symbols for /usr/lib/libz.so.1
0xffffe002 in ?? ()
(gdb) b main.cpp:200 //this is in do_sth()
Breakpoint 1 at 0x809b7cd: file ../../main.cpp, line 200.
---------------------------
In the other window which the program is started, the process just hang there. Could anyone let me know what could be the problem and what should be done? Any suggestion is appreciated.