This is the mail archive of the gdb@sourceware.cygnus.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

problems loading shared libraries - with attached test case


Hi, I'm having problems loading shared libraries.  This is with a build
of gdb out of cvs that I pulled and built on March 27th and has been
there for at least a week.  I haven't gone back further than that.  This
is with the gcc that is shipping with Red Hat 6.2:

Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)

I'm using "set auto-solib-add 0" after main has been called.  If I use
"shar" to load a shared library manually once I can't use it again to
load another shared library later.  Please see the attached log for an
example of how to reproduce the problem.

--Chris

GNU gdb 20000204
Copyright 1998 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 0x8048576: file main.c, line 5.
(gdb) r
Starting program: /home/blizzard/src/gdb_test/main 

Breakpoint 1, main (argc=1, argv=0xbffff9c4) at main.c:5
5         void *handle0 = dlopen("./libdummy0.so", RTLD_LAZY);
(gdb) set auto-solib-add 0
(gdb) n
6         void *handle1 = dlopen("./libdummy1.so", RTLD_LAZY);
(gdb) n
7         void *handle2 = dlopen("./libdummy2.so", RTLD_LAZY);
(gdb) n
8         void *handle3 = dlopen("./libdummy3.so", RTLD_LAZY);
(gdb) n
9         printf("Hi.\n");
(gdb) shar dummy0
Reading symbols from /home/blizzard/src/gdb_test/./libdummy0.so...done.
Loaded symbols for /home/blizzard/src/gdb_test/./libdummy0.so
(gdb) shar dummy1
(gdb) info shar
From        To          Syms Read   Shared Object Library
0x4001a000  0x4001d08c  Yes         /lib/libdl.so.2
0x4001e000  0x4005ff90  Yes         /usr/lib/libstdc++-libc6.1-1.so.2
0x40060000  0x4007c9d8  Yes         /lib/libm.so.6
0x4007d000  0x4017185c  Yes         /lib/libc.so.6
0x40000000  0x40013ed0  Yes         /lib/ld-linux.so.2
0x40015000  0x40016cdc  Yes        
/home/blizzard/src/gdb_test/./libdummy0.so
0x40017000  0x40018cdc  No         
/home/blizzard/src/gdb_test/./libdummy1.so
0x40173000  0x40174cdc  No         
/home/blizzard/src/gdb_test/./libdummy2.so
0x40175000  0x40176cdc  No         
/home/blizzard/src/gdb_test/./libdummy3.so
(gdb) shar dummy3
(gdb) shar /home/blizzard/src/gdb_test/./libdummy2.so
(gdb) info shar
From        To          Syms Read   Shared Object Library
0x4001a000  0x4001d08c  Yes         /lib/libdl.so.2
0x4001e000  0x4005ff90  Yes         /usr/lib/libstdc++-libc6.1-1.so.2
0x40060000  0x4007c9d8  Yes         /lib/libm.so.6
0x4007d000  0x4017185c  Yes         /lib/libc.so.6
0x40000000  0x40013ed0  Yes         /lib/ld-linux.so.2
0x40015000  0x40016cdc  Yes        
/home/blizzard/src/gdb_test/./libdummy0.so
0x40017000  0x40018cdc  No         
/home/blizzard/src/gdb_test/./libdummy1.so
0x40173000  0x40174cdc  No         
/home/blizzard/src/gdb_test/./libdummy2.so
0x40175000  0x40176cdc  No         
/home/blizzard/src/gdb_test/./libdummy3.so
(gdb) 


-- 
------------
Christopher Blizzard
http://people.redhat.com/blizzard/
I bet a funny thing about driving a car off a cliff is, while
you're in midair, you still hit those brakes! Hey, better try
the emergency brake!
------------
CFLAGS = -g

SHLIBS = libdummy0.so libdummy1.so libdummy2.so libdummy3.so
TARGET = main

all: $(SHLIBS) $(TARGET)

main: main.c
	g++ $(CFLAGS) -o main main.c -ldl

libdummy0.cpp: gen_files.pl
	./gen_files.pl dummy0 > libdummy0.cpp

libdummy0.so: libdummy0.cpp
	g++ $(CFLAGS) -o libdummy0.so -shared -fPIC libdummy0.cpp

libdummy1.cpp: gen_files.pl
	./gen_files.pl dummy1 > libdummy1.cpp

libdummy1.so: libdummy1.cpp
	g++ $(CFLAGS) -o libdummy1.so -shared -fPIC libdummy1.cpp

libdummy2.cpp: gen_files.pl
	./gen_files.pl dummy2 > libdummy2.cpp

libdummy2.so: libdummy2.cpp
	g++ $(CFLAGS) -o libdummy2.so -shared -fPIC libdummy2.cpp

libdummy3.cpp: gen_files.pl
	./gen_files.pl dummy3 > libdummy3.cpp

libdummy3.so: libdummy3.cpp
	g++ $(CFLAGS) -o libdummy3.so -shared -fPIC libdummy3.cpp

clean:
	rm -f libdummy*.cpp *.so *.o *~ main

gen_files.pl

#include <dlfcn.h>
#include <stdio.h>

int main ( int argc, char **argv) {
  void *handle0 = dlopen("./libdummy0.so", RTLD_LAZY);
  void *handle1 = dlopen("./libdummy1.so", RTLD_LAZY);
  void *handle2 = dlopen("./libdummy2.so", RTLD_LAZY);
  void *handle3 = dlopen("./libdummy3.so", RTLD_LAZY);
  printf("Hi.\n");
}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]