* Solaris dynamic libraries
@ 2003-03-04 10:45 Lev Assinovsky
0 siblings, 0 replies; only message in thread
From: Lev Assinovsky @ 2003-03-04 10:45 UTC (permalink / raw)
To: Gdb (E-mail)
[-- Attachment #1: Type: text/plain, Size: 1354 bytes --]
Hello gdb guys!
The problem is I can't step into the function through the pointer
if the function resides in dynamically loaded shared object (library).
Here is the simple test case:
1. Shared object (func.cpp):
---------- cut here --------
#include <iostream>
using namespace std;
extern "C" {
void my_func()
{
cout << "This is my_func" << endl;
}
}
---------- cut here --------
2. Main (load.cpp):
#include <iostream>
#include <memory>
#include <dlfcn.h>
#include <link.h>
using namespace std;
void * handle;
typedef void ( *Func_t)();
Func_t getFunc()
{
Func_t p = (Func_t)dlsym ( handle, "my_func" );
if ( NULL == p )
{
cout << dlerror() << endl;
exit(2);
}
return p;
}
int main()
{
handle = (void*) ::dlopen("./func_so/bin/i386-sun-solaris/func_so.so", RTLD_NOW | RTLD_LOCAL | RTLD_GROUP);
if (handle == NULL)
{
cout << dlerror() << endl;
exit(2);
}
Func_t f = getFunc();
f();
}
---------- cut here --------
This testcase works, but I can't step into f() (last line) in gdb.
Is it possible to work around or fix this problem?
Thanks in advance!
----
Lev Assinovsky
Aelita Software Corporation
O&S Core Division, Programmer
ICQ# 165072909 <<load.cpp>> <<func.cpp>>
[-- Attachment #2: load.cpp --]
[-- Type: application/octet-stream, Size: 575 bytes --]
#include <iostream>
#include <memory>
#include <dlfcn.h>
#include <link.h>
using namespace std;
void * handle;
typedef void ( *Func_t)();
Func_t getFunc()
{
Func_t p = (Func_t)dlsym ( handle, "my_func" );
if ( NULL == p )
{
cout << dlerror() << endl;
exit(2);
}
return p;
}
int main()
{
handle = (void*) ::dlopen("./func_so/bin/i386-sun-solaris/func_so.so", RTLD_NOW | RTLD_LOCAL | RTLD_GROUP);
if (handle == NULL)
{
cout << dlerror() << endl;
exit(2);
}
Func_t f = getFunc();
f();
}
[-- Attachment #3: func.cpp --]
[-- Type: application/octet-stream, Size: 132 bytes --]
#include <iostream>
using namespace std;
extern "C" {
void my_func()
{
cout << "This is my_func" << endl;
}
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-03-04 10:45 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-04 10:45 Solaris dynamic libraries Lev Assinovsky
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).