Google Grupper har inte längre stöd för nya Usenet-inlägg eller -prenumerationer. Historiskt innehåll förblir synligt.
Dismiss

gdb 5.1 with shared libraries

0 visningar
Hoppa till det första olästa meddelandet

Brendan Doherty

oläst,
5 dec. 2001 22:36:442001-12-05
till
Hi,

I'm having a number of problems with shared libraries that worked fine
in 5.0 but are problems in 5.1.

I haven't seen anyone else with similar problems.. I'm wondering if
it's to do with my system setup, or the way I'm linking my libraries.

SUMMARY
=======

Problem 1 (Linux 2.4/libc 2.2.4/Debian Woody):
value of a double (in static data section of exe) get's changed when
run through 5.1.

Problem 2 (Linux 2.4/libc 2.2.4/Debian Woody):
Symbol addresses from shared library are coming up as offsets from 0
rather than offsets from start of text segment.

Problem 3 (Solaris 8):
symbol/address mapping seems to only work in one direction for shared
libaries. (EG can get address from line, but not line from address).

------------------

DETAIL
======

Problem 1 (Linux 2.4/libc 2.2.4/Debian Woody):
value of a double (in static data section of exe) get's changed when
run through 5.1.

Ok in 5.0:
----------------
$ /opt/gdb-5.0/bin/gdb tester
GNU gdb 5.0 (UI_OUT)
Copyright 2000 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"...
(gdb) break mogtest
Breakpoint 1 at 0x804b882: file main.cpp, line 95.
(gdb) r
Starting program: /home/andrewd/gomic/engine/tester
[New Thread 1024 (LWP 29708)]
[Switching to Thread 1024 (LWP 29708)]

Breakpoint 1, mogtest () at main.cpp:95
95 double d = 3.5;
(gdb) n
96 var x;
(gdb) p d
$1 = 3.5
(gdb)

----------------
But not in 5.1:
----------------

$ /opt/gdb-5.1/bin/gdb tester
GNU gdb 5.1
Copyright 2001 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"...
(gdb) break mogtest
Breakpoint 1 at 0x804b882: file main.cpp, line 95.
(gdb) r
Starting program: /home/andrewd/gomic/engine/tester
Error while mapping shared library sections:
liboraofs.so: Success.
[New Thread 1024 (LWP 29710)]
[Switching to Thread 1024 (LWP 29710)]

Breakpoint 1, mogtest () at main.cpp:95
95 double d = 3.5;
(gdb) n
96 var x;
(gdb) p d
$1 = -nan(0x8000000000000)
(gdb)
----------------

Problem 2 (Linux 2.4/libc 2.2.4/Debian Woody)

Symbol addresses from shared library are coming up as offsets from 0
rather than offsets from start of text segment.

----------
$ /opt/gdb-5.1/bin/gdb tester
GNU gdb 5.1
Copyright 2001 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"...
(gdb) break main
Breakpoint 1 at 0x8049141: file main.cpp, line 113.
(gdb) r
Starting program: /home/andrewd/gomic/engine/tester
Error while mapping shared library sections:
libgomic.so: Success.
b
Breakpoint 1, main (argc=1, argv=0xbffffcd4) at main.cpp:113
113 signal(SIGINT, sigint);
(gdb) break var.cpp:495
Breakpoint 2 at 0x33a7d: file var.cpp, line 495.
(gdb) c
Continuing.
warning: Cannot insert breakpoint 2:
Cannot access memory at address 0x33a7d
(gdb) delete 2
(gdb) call getpid()
$1 = 718
(gdb) shell cat /proc/718/maps
08048000-0804a000 r-xp 00000000 03:05 16403
/home/andrewd/gomic/engine/tester
0804a000-0804c000 rw-p 00001000 03:05 16403
/home/andrewd/gomic/engine/tester
0804c000-080c4000 rwxp 00000000 00:00 0
40000000-40014000 r-xp 00000000 03:02 20584 /lib/ld-2.2.4.so
40014000-40015000 rw-p 00013000 03:02 20584 /lib/ld-2.2.4.so
40015000-40016000 rwxp 00000000 00:00 0
40016000-40088000 r-xp 00000000 03:05 16398
/home/andrewd/gomic/engine/libgomic.so
40088000-40098000 rw-p 00071000 03:05 16398
/home/andrewd/gomic/engine/libgomic.so
40098000-40099000 rw-p 00000000 00:00 0
4009c000-40113000 r-xp 00000000 03:02 18913
/usr/lib/libstdc++.so.3.0.2
40113000-40127000 rw-p 00076000 03:02 18913
/usr/lib/libstdc++.so.3.0.2
40127000-4012c000 rw-p 00000000 00:00 0
4012c000-4014d000 r-xp 00000000 03:02 20606 /lib/libm-2.2.4.so
4014d000-4014e000 rw-p 00020000 03:02 20606 /lib/libm-2.2.4.so
4014e000-4014f000 rw-p 00000000 00:00 0
4014f000-40155000 r-xp 00000000 03:02 20674 /lib/libgcc_s.so.1
40155000-40157000 rw-p 00005000 03:02 20674 /lib/libgcc_s.so.1
40157000-4026f000 r-xp 00000000 03:02 20595 /lib/libc-2.2.4.so
4026f000-40275000 rw-p 00117000 03:02 20595 /lib/libc-2.2.4.so
40275000-4027a000 rw-p 00000000 00:00 0
4027a000-4027c000 r-xp 00000000 03:02 20605 /lib/libdl-2.2.4.so
4027c000-4027e000 rw-p 00001000 03:02 20605 /lib/libdl-2.2.4.so
bfffe000-c0000000 rwxp fffff000 00:00 0
(gdb) p 0x40016000 + 0x33a7d
$2 = 1074043517
(gdb) b *1074043517
Breakpoint 3 at 0x40049a7d
(gdb) c
Continuing.
Test:test_var_comparison(1 runs): 0.001327 secs
Test:test_dynarray(1 runs): 0.000469 secs
Test:test_del(1 runs): 0.000032 secs

Breakpoint 3, 0x40049a7d in ?? ()
(gdb)
------------
in 5.0
------------
andrewd@scrappy:~/gomic/engine$ /opt/gdb-5.0/bin/gdb tester
GNU gdb 5.0 (UI_OUT)
Copyright 2000 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"...
(gdb) break main
Breakpoint 1 at 0x8049141: file main.cpp, line 113.
(gdb) r
Starting program: /home/andrewd/gomic/engine/tester

Breakpoint 1, main (argc=1, argv=0xbffffcd4) at main.cpp:113
113 signal(SIGINT, sigint);
(gdb) break var.cpp:495
Breakpoint 2 at 0x40049a7d: file var.cpp, line 495.
(gdb) c
Continuing.
Test:test_var_comparison(1 runs): 0.001331 secs
Test:test_dynarray(1 runs): 0.000467 secs
Test:test_del(1 runs): 0.000033 secs

Breakpoint 2, _ZNK3vardvEd (this=0xbffffbc0, x=2.5) at var.cpp:495
495 return l;
(gdb)

-------------
Problem 3 (Solaris 8)

symbol/address mapping seems to only work in one direction for shared
libaries. (EG can get address from line, but not line from address).

$ /opt/gdb-5.1/bin/gdb tester
GNU gdb 5.1
Copyright 2001 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 "sparc-sun-solaris2.8"...
(gdb) b main
Breakpoint 1 at 0x1130c: file main.cpp, line 103.
(gdb) r
Starting program: /home/andrewd/gt_cpp/engine/tester

Breakpoint 1, main (argc=1, argv=0xffbef9e4) at main.cpp:103
103 signal(SIGINT, sigint);
(gdb) b var.cpp:495
Breakpoint 2 at 0xf993f8b8: file var.cpp, line 495.
(gdb) c
Continuing.
Test:test_var_comparison(1 runs): 0.001972 secs
Test:test_dynarray(1 runs): 0.000660 secs
Test:test_del(1 runs): 0.000034 secs

Program received signal SIGTRAP, Trace/breakpoint trap.
0xf993f8b8 in ?? ()
(gdb) bt
#0 0xf993f8b8 in ?? ()
#1 0xf9953adc in ?? ()
#2 0x0001146c in main (argc=1, argv=0x11c00) at cppmv.h:62
(gdb) info line var.cpp:495
Line 495 of "var.cpp" starts at address 0xf993f8b8 <_ZNK3vardvEd+56>
and ends at 0xf993f8e0 <_ZNK3vardvEd+96>.
(gdb) info line *0xf993f8b8
No line number information available for address 0xf993f8b8

------------

I'm building with:

g++-3.0 -v -g -pipe -shared -o libgomic.so basefuncs.o
basefuncs_test.o charset.o date.o dynarraytest.o file.o iconv.o
selectlist.o var.o vocmanager.o drivers/csv.o drivers/dir.o
driverlist.o call.o error.o oconv.o format.o execute.o matrix.o
locate.o var_test.o locate_test.o file_test.o transaction.o msl.o
liboraofs.so
Reading specs from /usr/lib/gcc-lib/i386-linux/3.0.2/specs
Configured with: ../src/configure -v
--enable-languages=c,c++,java,f77,proto,objc --prefix=/usr
--infodir=/share/info --mandir=/share/man --enable-shared
--with-gnu-as --with-gnu-ld --with-system-zlib --enable-long-long
--enable-nls --without-included-gettext --disable-checking
--enable-threads=posix --enable-java-gc=boehm
--with-cpp-install-dir=bin --enable-objc-gc i386-linux
Thread model: posix
gcc version 3.0.2 20010922 (Debian prerelease)
/usr/lib/gcc-lib/i386-linux/3.0.2/collect2 -m elf_i386 -shared -o
libgomic.so /usr/lib/gcc-lib/i386-linux/3.0.2/../../../crti.o
/usr/lib/gcc-lib/i386-linux/3.0.2/crtbeginS.o
-L/usr/lib/gcc-lib/i386-linux/3.0.2
-L/usr/lib/gcc-lib/i386-linux/3.0.2/../../.. basefuncs.o
basefuncs_test.o charset.o date.o dynarraytest.o file.o iconv.o
selectlist.o var.o vocmanager.o drivers/csv.o drivers/dir.o
driverlist.o call.o error.o oconv.o format.o execute.o matrix.o
locate.o var_test.o locate_test.o file_test.o transaction.o msl.o
liboraofs.so -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc
/usr/lib/gcc-lib/i386-linux/3.0.2/crtendS.o
/usr/lib/gcc-lib/i386-linux/3.0.2/../../../crtn.o

And:

g++-3.0 -v -g -pipe -o tester -L. -lgomic main.o stacktrace.o
Reading specs from /usr/lib/gcc-lib/i386-linux/3.0.2/specs
Configured with: ../src/configure -v
--enable-languages=c,c++,java,f77,proto,objc --prefix=/usr
--infodir=/share/info --mandir=/share/man --enable-shared
--with-gnu-as --with-gnu-ld --with-system-zlib --enable-long-long
--enable-nls --without-included-gettext --disable-checking
--enable-threads=posix --enable-java-gc=boehm
--with-cpp-install-dir=bin --enable-objc-gc i386-linux
Thread model: posix
gcc version 3.0.2 20010922 (Debian prerelease)
/usr/lib/gcc-lib/i386-linux/3.0.2/collect2 -m elf_i386
-dynamic-linker /lib/ld-linux.so.2 -o tester
/usr/lib/gcc-lib/i386-linux/3.0.2/../../../crt1.o
/usr/lib/gcc-lib/i386-linux/3.0.2/../../../crti.o
/usr/lib/gcc-lib/i386-linux/3.0.2/crtbegin.o -L.
-L/usr/lib/gcc-lib/i386-linux/3.0.2
-L/usr/lib/gcc-lib/i386-linux/3.0.2/../../.. -lgomic main.o
stacktrace.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc
/usr/lib/gcc-lib/i386-linux/3.0.2/crtend.o
/usr/lib/gcc-lib/i386-linux/3.0.2/../../../crtn.o

It's a problem with both g++ 3.0.2 and 2.95.4.

------------

Can someone give me some pointers as to what could be wrong / how to
debug / is it a gdb problem?

Thanks
Brendan

Kevin Buettner

oläst,
6 dec. 2001 10:07:032001-12-06
till
On Dec 5, 7:36pm, Brendan Doherty wrote:

> I'm having a number of problems with shared libraries that worked fine
> in 5.0 but are problems in 5.1.
>
> I haven't seen anyone else with similar problems.. I'm wondering if
> it's to do with my system setup, or the way I'm linking my libraries.
>
> SUMMARY
> =======
>
> Problem 1 (Linux 2.4/libc 2.2.4/Debian Woody):
> value of a double (in static data section of exe) get's changed when
> run through 5.1.
>
> Problem 2 (Linux 2.4/libc 2.2.4/Debian Woody):
> Symbol addresses from shared library are coming up as offsets from 0
> rather than offsets from start of text segment.

Do you have test cases that you can send me for these problems?

Thanks,

Kevin

Blindauer

oläst,
6 dec. 2001 12:02:182001-12-06
till
I've got a problem related to thread, using double and getting NaN...
But in my case, 4.18 was working, not 5.0 nor 5.1
http://manu.agat.net/bug.html
has a description of the bug.
perhaps these two bug are the same....

Emmanuel

Brendan Doherty wrote:
> Starting program: /home/andrewd/gomic/engine/tester
> [New Thread 1024 (LWP 29708)]
> [Switching to Thread 1024 (LWP 29708)]
>
> Breakpoint 1, mogtest () at main.cpp:95
> 95 double d = 3.5;
> (gdb) n
> 96 var x;
> (gdb) p d
> $1 = 3.5
> (gdb)
>
> ----------------
> But not in 5.1:
> ----------------
>
> $ /opt/gdb-5.1/bin/gdb tester

Kevin Buettner

oläst,
6 dec. 2001 19:03:552001-12-06
till
On Dec 6, 6:02pm, Blindauer wrote:

> I've got a problem related to thread, using double and getting NaN...
> But in my case, 4.18 was working, not 5.0 nor 5.1
> http://manu.agat.net/bug.html
> has a description of the bug.
> perhaps these two bug are the same....

I've just posted a patch which fixes this bug. See

http://sources.redhat.com/ml/gdb-patches/2001-12/msg00183.html

It hasn't been approved yet, but once it has, I'll push for getting
it into 5.1.1 too.

Thanks,

Kevin

Andrew Dixie

oläst,
6 dec. 2001 19:38:132001-12-06
till
Yes that's it (I work with Brendan).

More specifically it only occurs when you link against libpthread.

See: http://sources.redhat.com/ml/gdb/2001-12/msg00071.html

Cheers,
Andrew

Andrew Dixie

oläst,
6 dec. 2001 20:50:372001-12-06
till
> > Problem 2 (Linux 2.4/libc 2.2.4/Debian Woody):
> > Symbol addresses from shared library are coming up as offsets from 0
> > rather than offsets from start of text segment.

I've tracked this problem down to an extra ':' in LD_LIBRARY_PATH.

echo $LD_LIBRARY_PATH

/home/oracle/OraHome1/lib::/home/oracle/OraHome1/rdbms/lib:/home/andrewd/test/gomic/engine:/home/andrewd/test/gomic/common

gdb is using this to pickup the libraries from the current directory
rather than the direct paths later down the list.

0 nya meddelanden