error in dlopen()

Andrew Haley aph@redhat.com
Sat Apr 18 09:35:00 GMT 2009


ranjith kumar wrote:

> I inserted a shared library(say 1.so)  inside a running process(say mutatee) .
> I did not use dlopen() function for this.

OK, so how did you do that, then?

> The shared library(1.so)  contains dlopen() function ie) it depends on libdl.so.
> The problem is when I tried to call dlopen() function which is inside
> the shared library(1.so) the mutatee is getting crashed.
> 
> When I call dlopen() with file="" , the mutatee is not getting
> crashed,  but when I give any other filename it is getting crashed.
> 
> What could be the reason.

It's hard to tell without an example.

> General questions about dlopen().
> 
> 1) In which section dlopen() inserts a library. Inside heap or text or
> data section??? How to know whether dlopen() has permissions for that
> section?
> 2) I want to debug dlopen() function to know where it is getting crashed.
>     I dont have gdb on my machine(armv5-linux).
>    Where can I download libdl.so souce code???...so that I will
> comiple it for arm and insert my own printf() statements inside it.

When dlopen() opens a library, it calls mmap() to allocate address space
for the library's segments.

The source code for libdl.so is part of glibc.  You must download the
source from the same place you downloaded the binary.  If you download
it from anywhere else you may have a different version, one that doesn't
correspond with your binary.

Andrew.



More information about the Gcc-help mailing list