N
nirnimesh
I'm intercepting a library function call using LD_PRELOAD and in-turn
calling the orignial library function. Essentially,
intercept.cc:
void (*real_func)(void) = (void (*) (void)) dlsym(RTLD_NEXT,
"_mangled_name_of_func_");
real_func(); //! Calling the original function -- SEGFAULT
This is compiled as:
g++ -shared -fPIC -Wall -o libintercept.so intercept.cc -ldl
When I run it as:
LD_PRELOAD=libintercept.so progname
it leads to a SEGFAULT at the place where real_func() is called. I've
checked to ensure that dlsym() succeeds. In fact, I've also checked
that dladdr() gives the correct function and file name for the resolved
library. The trouble, I guess, is with resolving some things since
things work OK if I replace the call to real_func() with the actual
code implemented in func().
Any leads to what's going wrong?
Machine: FC4-x86_64 with gcc-4.0.0
Regards
Nirnimesh
calling the orignial library function. Essentially,
intercept.cc:
void (*real_func)(void) = (void (*) (void)) dlsym(RTLD_NEXT,
"_mangled_name_of_func_");
real_func(); //! Calling the original function -- SEGFAULT
This is compiled as:
g++ -shared -fPIC -Wall -o libintercept.so intercept.cc -ldl
When I run it as:
LD_PRELOAD=libintercept.so progname
it leads to a SEGFAULT at the place where real_func() is called. I've
checked to ensure that dlsym() succeeds. In fact, I've also checked
that dladdr() gives the correct function and file name for the resolved
library. The trouble, I guess, is with resolving some things since
things work OK if I replace the call to real_func() with the actual
code implemented in func().
Any leads to what's going wrong?
Machine: FC4-x86_64 with gcc-4.0.0
Regards
Nirnimesh