Hello Douglas and Anthony, sorry for late reply and cool, thanks you for helping me with gdb :-).
Thanks to you help I was able to run with my loaded library in debug mode. Anyway, the crash (in the debug mode) looks as follows: Program received signal SIGSEGV, Segmentation fault. 0xd810b787 in ?? () where 0xd810b787 is p11->C_Initialize (checked with printf("p11 = 0x%0x, p11->C_Initialize = 0x%0x\n", p11, p11->C_Initialize);) >OK, but is 0x5810b6fa in your module? This I am not completely sure about. But I don't really know how can I find out if this is in my module or not. I suspect that there is C_Initialize defined also somewhere else and the pkcs11-tool picks it from somewhere else and not from my library. >I will ask again, does your module define the C_GetFunctionList, and does it >return a valid function list? Yes it has - in the upper layer of the library I defined it as CK_DEFINE_FUNCTION(CK_RV, C_GetFunctionList) ( CK_FUNCTION_LIST_PTR_PTR ppFunctionList // receives pointer to function list ) { try { API_ENTRY(); API_PARAM_PTR_EX("ppFunctionList", ppFunctionList); if (ppFunctionList == NULL) API_EXIT(CKR_ARGUMENTS_BAD); *ppFunctionList = &functionList; API_EXIT(CKR_OK); } catch(...) { TRACE_ERROR("Catching top-level exception", ""); API_EXIT(CKR_FUNCTION_FAILED); } } And it should return a valid function list. In fact I have my own small test tool that uses dlopen(libname, RTLD_NOW) to open the library and GetFuncList = (C_GetFunctionListPtr)dlsym(lib, "C_GetFunctionList") to get the correct address of the functions. I believe this is the same thing as done with pkcs11-tool, but somehow it works in my small test tool, I can do C_Initialize and other pkcs11 functions and in pkcs11-tool it crashes. I have Ubuntu11.10, 32bit and the OpenSC version is very recent - opensc 0.12.1-1ubuntu1 I took it from here: http://apt.gooze.eu/ubuntu/dists/oneiric/ Cheers, Anna On Mon, Dec 17, 2012 at 8:59 PM, Douglas E. Engert <deeng...@anl.gov> wrote: > gdb --args pkcs11-tool
_______________________________________________ opensc-devel mailing list opensc-devel@lists.opensc-project.org http://www.opensc-project.org/mailman/listinfo/opensc-devel