[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
core dump with cp, dlclose, dlopen
From: |
ahoward |
Subject: |
core dump with cp, dlclose, dlopen |
Date: |
Tue, 9 Apr 2002 14:34:14 +0000 (GMT) |
all sources at
http://www-fd.fsl.noaa.gov/~ahoward/shared/
all-
i am having some problems which SEEM to be related to the choice of using
'cp' or 'install' as an argument to libtool in install mode - though that
seems unbelievable to me (this IS my first project using libtool so i'm
relatively clueless)
general :
i'm builing a shared lib full of configuration information,
sort of a dynamic header file - the header file only grows,
entries are never deleted - thus the -avoid-version flags... the
whole things works great EXCEPT that my daemon emulator core dumps
on dlclose when a lib is updated using cp, but NOT when using
'install'! the emulator does simply this :
dlopens the lib
retrieves data structure (just character data)
loops, printing it's contents and
waits for input to be typed
IFF refresh is typed (emulating SIGHUP) it
dlcloses the lib
re-dlopens the lib
re-retrieves data structure
re-enters loop.
note that the lib ALWAYS remains open (i am note pointing into
no-where) and that the core dump occurs on the dlclose complaining
of
REFRESHING LIB...
84 if(lib_so) dlclose(lib_so);
(gdb)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
CORE DUMP HERE IFF LIB IS UPDATED AT RUNTIME USING CP BUT NOT
INSTALL!!!
code looks like:
if refreshing...
if(lib_so) dlclose(lib_so); <- core dump!!!!!!
err stuff...
lib_so = dlopen(lib, RTLD_LAZY);
err stuf...
get_table = (table_ptr (*)(void))dlsym(lib_so, "get_table");
err stuff...
t = (*get_table)();
err stuf ...
Program received signal SIGSEGV, Segmentation fault.
0x40017774 in __do_global_dtors_aux () at eval.c:41
41 eval.c: No such file or directory.
in eval.c
files :
table.h -> interface to lib data structure
table.c -> const data structure
(const char * const * const *)
driver.c -> above daemon emulator
build :
lib:
tableinstall: libtable.la
$(LIBTOOL) $(INSTALL) $(BLDDIR)/libtable.la $(LIBDIR)/libtable.la
libtable.la: table.lo
@mkdir -p $(LIBDIR)
$(LIBTOOL) $(GCC) $(GCCFLAGS) $(LINKFLAGS) -o
$(BLDDIR)/libtable.la $(BLDDIR)/table.lo -rpath $(LIBDIR)
table.lo: $(INCDIR)/table.h
@mkdir -p $(BLDDIR)
$(LIBTOOL) $(GCC) $(GCCFLAGS) -o $(BLDDIR)/table.lo -I $(INCDIR)
-c $(SRCDIR)/table.c
driver:
$(BINDIR)/d: $(BLDDIR)/driver.o
@mkdir -p $(BINDIR)
$(GCC) $(GCCFLAGS) -o $(BINDIR)/d $(BLDDIR)/driver.o $(RPATHS)
$(ASMFLAGS) -ldl
@ printf "\n setenv LD_LIBRARY_PATH $(LIBDIR)\n"
$(BLDDIR)/driver.o: $(SRCDIR)/driver.c $(INCDIR)/table.h
$(GCC) $(GCCFLAGS) -o $(BLDDIR)/driver.o -c -I $(INCDIR)/
$(SRCDIR)/driver.c
relevant flags:
LINKFLAGS = -module -avoid-version
GASFLAGS = -Wa,-R
INSTALL = cp OR !!!
INSTALL = /usr/local/bin/install !!!
so. iff i run the driver i can always unload/load the table at will, even
if it has been rebuilt and installed but NOT if the INSTALL var is 'cp',
in which case i core dump.
the question:
any ideas anyone? more generally if a lib plans to dlopen/close a lib
multiple times during execution is there any problems with updating the
actual lib backing store at the same time? if not what is the best way to
accomplish this?
-ara
ps. source at http://www-fd.fsl.noaa.gov/~ahoward/shared/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- core dump with cp, dlclose, dlopen,
ahoward <=