This is the mail archive of the gdb@sources.redhat.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]
Other format: [Raw text]

Solaris dynamic libraries


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: load.cpp
Description: load.cpp

Attachment: func.cpp
Description: func.cpp


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