bug-gdb
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Gdb crashes while attaching to a process with a linked library


From: Tschaftary Thomas
Subject: Gdb crashes while attaching to a process with a linked library
Date: Thu, 10 Apr 2003 13:57:36 +0200

Hello,

When attaching to a forked child-process in which I linked the xerces-c library 
gdb shows a very strange behaviour. Here ist my configuration:

Intel PIII, Linux Suse 8.0, gcc 2.95.3, gdb version 5.3

Here is what I did:

First I debugged a sample programm which forks a second process and sleeps 
then. (for source see attachement)
If no xerces lib is linked into the binary everything works fine. Here is the 
result:

address@hidden:~/entwicklung/gdbtest2/gdbtest2> gdb gdbtest2 14413
GNU gdb 5.3
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 "i686-pc-linux-gnu"...
Attaching to program: /home/tschaft/entwicklung/gdbtest2/gdbtest2/gdbtest2, 
process 14413
Reading symbols from /usr/lib/libstdc++-libc6.2-2.so.3...done.
Loaded symbols for /usr/lib/libstdc++-libc6.2-2.so.3
Reading symbols from /lib/libm.so.6...done.
Loaded symbols for /lib/libm.so.6
Reading symbols from /lib/libc.so.6...done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
0x40144411 in nanosleep () from /lib/libc.so.6
(gdb) break 37
Breakpoint 1 at 0x804872b: file main.cpp, line 37.
(gdb) step
Single stepping until exit from function nanosleep,
which has no line number information.
0x401443a8 in sleep () from /lib/libc.so.6
(gdb) step
Single stepping until exit from function sleep,
which has no line number information.

Breakpoint 1, main (argc=1, argv=0xbffff1e4) at main.cpp:37
37            cout << "Child exits" << endl;
(gdb) quit
The program is running.  Quit anyway (and detach it)? (y or n) y
Detaching from program: /home/tschaft/entwicklung/gdbtest2/gdbtest2/gdbtest2, 
process 14413


Fine so far. But if I link libxerces-c.so.22.0 without using any method and 
even without including any header - just linking the following happens:

In most cases setting the breakpoint and stopping at the breakpoint fails and 
the program simply finishes without an error message: 

Before attaching:
address@hidden:~> ps ax |grep gdbtest2
16566 pts/3    S      0:00 ./gdbtest2
16567 pts/3    S      0:00 ./gdbtest2
16570 pts/1    R      0:00 grep gdbtest2

After attaching to 16567:
address@hidden:~> ps ax |grep gdbtest2
16571 pts/2    S      0:00 gdb gdbtest2 16567
16567 pts/3    T      0:00 ./gdbtest2
16573 pts/1    S      0:00 grep gdbtest2

address@hidden:~/entwicklung/gdbtest2/gdbtest2> gdb gdbtest2 16567
GNU gdb 5.3
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 "i686-pc-linux-gnu"...
Attaching to program: /home/tschaft/entwicklung/gdbtest2/gdbtest2/gdbtest2, 
process 16567
Reading symbols from /usr/local/lib/libxerces-c.so.22...done.
Loaded symbols for /usr/local/lib/libxerces-c.so.22
Reading symbols from /usr/lib/libstdc++-libc6.2-2.so.3...done.
Loaded symbols for /usr/lib/libstdc++-libc6.2-2.so.3
Reading symbols from /lib/libm.so.6...done.
Loaded symbols for /lib/libm.so.6
Reading symbols from /lib/libc.so.6...done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /lib/libpthread.so.0...done.
[New Thread 1024 (LWP 16566)]
Loaded symbols for /lib/libpthread.so.0
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
0x4057c411 in nanosleep () from /lib/libc.so.6
(gdb) break 37
Breakpoint 1 at 0x804873b: file main.cpp, line 37.
(gdb) step
Single stepping until exit from function nanosleep,
which has no line number information.

Program exited normally.
(gdb) step
The program is not being run.
(gdb) quit
address@hidden:~/entwicklung/gdbtest2/gdbtest2>


After quitting there is the child process left:
address@hidden:~> ps ax |grep gdbtest2
16567 pts/3    T      0:00 ./gdbtest2
address@hidden:~>

This means it is not possible to attach and debug any child process in which 
the xerces-c lib is linked. I tried other libs which work great. The xerces-c 
lib is build from http://xml.apache.org/xerces-c/index.html with build 
configuration which was suggested there. So there should be nothing special 
with this lib.  


In some cases I got this:

(gdb) attach 21961
[New Thread 1024 (LWP 21927)]
0x4058d411 in ?? ()
(gdb) cont
lin-lwp.c:1003: gdb-internal-error: lin_lwp_wait: Assertion `WIFSTOPPED 
(status) && WSTOPSIG (status) == SIGSTOP' failed.

Unfortunately I can´t reproduce the error above. In most cases I tried it the 
first behaviour happened. 

Attached you find my short example and the binary of the xerces-c library. I 
hope you can reproduce the bug by this. If you need some more information 
please feel free to contact me.

Greetings

Thomas Tschaftary

____________________________________________
Dipl.-Ing. Thomas Tschaftary
Development AAB
Baumueller Anlagen-Systemtechnik GmbH & CO.KG
Ostendstr. 84
D-90482 Nürnberg
Mail: address@hidden
URL: http://www.baumueller.de
______________________________________________________________________________________________________________
 

Die Gesellschaft ist eine Kommanditgesellschaft mit Sitz in Nürnberg, 
Registergericht Nürnberg HR A 9435. 
Persönlich haftende Gesellschafterin ist die Baumüller Anlagen-Systemtechnik 
GmbH mit Sitz in Fürth, 
Registergericht Fürth HR B 3480.
Geschäftsführer: Dipl.-Ing. (FH) Herbert Heßlinger, Jochen Loy 
______________________________________________________________________________________________________________


Attachment: example.tgz
Description: example.tgz


reply via email to

[Prev in Thread] Current Thread [Next in Thread]