[SmartcardServices-Dev] How to use secdebug()

Ludovic Rousseau ludovic.rousseau at gmail.com
Tue Jan 5 06:24:59 PST 2010


Hello,

I am trying to debug Apple version of pcsc-lite. The code contains calls like:
		secdebug("pcscd", "RFCheckSharing: sharing violation, dwLockId:
0x%02X", rContext->dwLockId);

I would like to know _where_ the debug messages are sent?
And how to activate them (if needed)?

What I found for now:

>From /usr/local/SecurityPieces/Frameworks/security_utilities.framework/Headers/debugging.h
//
// The debug-log macro is now unconditionally emitted as a DTrace static probe p
oint.
//
#define secdebug(scope, format...) \
        if (__builtin_expect(SECURITY_DEBUG_LOG_ENABLED(), 0)) { \
                char __msg[500]; snprintf(__msg, sizeof(__msg), ##
format); \                volatile char c __attribute__((unused)) =
scope[0]; \
                SECURITY_DEBUG_LOG((char *)(scope), (__msg)); \
} else /* nothing */
#define secdebugf(scope, __msg) SECURITY_DEBUG_LOG((char *)(scope), (__msg))


>From /usr/local/SecurityPieces/Frameworks/security_utilities.framework/Headers/utilities_dtrace.h
#define SECURITY_DEBUG_LOG(arg0, arg1) \do { \
        __asm__ volatile(".reference " SECURITY_DEBUG_TYPEDEFS); \
        __dtrace_probe$security_debug$log$v1$63686172202a$63686172202a(arg0, arg
1); \
        __asm__ volatile(".reference " SECURITY_DEBUG_STABILITY); \
} while (0)

#define SECURITY_DEBUG_LOG_ENABLED() \
        __dtrace_isenabled$security_debug$log$v1()


It looks like it is related to DTrace. And I am a very beginner at DTrace.
So any help is welcome.

Thanks

-- 
 Dr. Ludovic Rousseau


More information about the SmartcardServices-Dev mailing list