Archived

This forum has been archived. Please start a new discussion on GitHub.

problem debugging child processes

Hello

I have a problem, debugging child-processes. This problem does ONLY occur, if the process is linked to libIceUtil and if I'm trying to attach the degugger to the child-process. Otherwise(attaching to parent-process using libIceUtil, attaching to child-process using libpthread, etc.) it's possible to attach to the process without problems.
I'm using gdb 5.2, g++ 3.2.3 on a SuSe Linux with Kernel 2.4.20.

Below is a simple testprogram to replicate the behaviour (hopefully.. :) ) and the output of the debugger.

Has anyone experienced similar behaviour? Or is this a known problem with a known workaround?

Or maybe I'm doing something wrong.. :( ?

Thanx in advance for any help or suggestions.

Gerald
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <iostream>

using namespace std;

int main(int argc, char** argv) {

   pid_t pid;

   if ( (pid = fork()) <0) {
      cerr << "Couldn't start programm." << endl;;
      exit(-1);
   }else if (pid != 0) {
      cerr << "started Process " << pid << "." << endl;
      exit(0);
   }

   sleep(120);

   return 0;
}
galbe@britto:~/tmp/test/debug > g++ -g -L/vol/vampire/lib -lIceUtil testprogramm.cpp -o testprogramm
galbe@britto:~/tmp/test/debug > testprogramm
started Process 12641.
galbe@britto:~/tmp/test/debug > gdb testprogramm
GNU gdb 5.2
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-suse-linux"...
(gdb) attach 12641
Attaching to program: /homes/galbe/tmp/test/debug/testprogramm, process 12641
Reading symbols from /vol/vampire/lib/libIce.so.12...done.
Loaded symbols for /vol/vampire/lib/libIce.so.12
Reading symbols from /vol/vampire/lib/libIceUtil.so.12...done.
Loaded symbols for /vol/vampire/lib/libIceUtil.so.12
Reading symbols from /vol/vampire/gcc-3.2.3/lib/libstdc++.so.5...done.
Loaded symbols for /vol/vampire/gcc-3.2.3/lib/libstdc++.so.5
Reading symbols from /lib/libm.so.6...done.
Loaded symbols for /lib/libm.so.6
Reading symbols from /vol/vampire/gcc-3.2.3/lib/libgcc_s.so.1...done.
Loaded symbols for /vol/vampire/gcc-3.2.3/lib/libgcc_s.so.1
Reading symbols from /lib/libc.so.6...done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /usr/lib/libbz2.so.0...done.
Loaded symbols for /usr/lib/libbz2.so.0
Reading symbols from /lib/libdl.so.2...done.
Loaded symbols for /lib/libdl.so.2
Reading symbols from /lib/libpthread.so.0...done.
[New Thread 1024 (LWP 12640)]
Error while reading shared library symbols:
Can't attach LWP 12640: No such process
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
0x403e4c41 in __libc_nanosleep () at __libc_nanosleep:-1
-1 __libc_nanosleep: No such file or directory.
in __libc_nanosleep
(gdb)

Comments

  • marc
    marc Florida
    I just tried this on my RedHat 9.0, and it works fine, both the Linux threads and NPTL. I think this must be a problem with your gdb/gcc installation.
  • Thank you very much, for your help.
    I had hoped it was reproducable.. ., well, I will have a look at gdb/gcc then.

    Thanx again

    Gerald