diff -r c1f20ce4abcf -r 3e88ff8f41d5 userlibandfileserver/fileserver/ftrace/f32trace.h --- a/userlibandfileserver/fileserver/ftrace/f32trace.h Tue Aug 31 16:34:26 2010 +0300 +++ b/userlibandfileserver/fileserver/ftrace/f32trace.h Wed Sep 01 12:34:56 2010 +0100 @@ -22,6 +22,20 @@ #if !defined(__FTRACE_H__) #define __FTRACE_H__ +#include +#include + + +#ifndef __KERNEL_MODE__ + #include +#endif + +#include "f32tracedef.h" + +#if defined(__EABI__) +#pragma diag_suppress 1446 // non-POD class type passed through ellipsis +#endif + /** @internalComponent @prototype @@ -29,41 +43,218 @@ #if ((defined (_DEBUG) && defined (SYMBIAN_FTRACE_ENABLE_UDEB)) || \ (!defined(_DEBUG) && defined (SYMBIAN_FTRACE_ENABLE_UREL))) - #include "OstTraceDefinitions.h" // may or may not define OST_TRACE_COMPILER_IN_USE -#else - #undef OST_TRACE_COMPILER_IN_USE - #undef OST_TRACE_CATEGORY - #define OST_TRACE_CATEGORY OST_TRACE_CATEGORY_NONE - - #undef OstTrace0 - #undef OstTrace1 - #undef OstTraceData - #undef OstTraceExt1 - #undef OstTraceExt2 - #undef OstTraceExt3 - #undef OstTraceExt4 - #undef OstTraceExt5 - - #define OstTrace0( aGroupName, aTraceName, aTraceText ) - #define OstTrace1( aGroupName, aTraceName, aTraceText, aParam ) - #define OstTraceData( aGroupName, aTraceName, aTraceText, aPtr, aLength ) - #define OstTraceExt1( aGroupName, aTraceName, aTraceText, aParam ) - #define OstTraceExt2( aGroupName, aTraceName, aTraceText, aParam1, aParam2 ) - #define OstTraceExt3( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3 ) - #define OstTraceExt4( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4 ) - #define OstTraceExt5( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4, aParam5 ) + #define SYMBIAN_FTRACE_ENABLE #endif -#if defined (OST_TRACE_COMPILER_IN_USE) - // This class is used to reconstruct an RMessage2 object from a message handle so that we can - // call RMessagePtr2::Client() and then RThread::Id() to retrieve the client's thread Id. - // This is useful for matching client requests to calls to the proxydrive - class RDummyMessage : public RMessage2 + +inline TBool Trace1(TClassification aClassification, TFormatId aFormatId, TModuleUid aUid, TUint a1) + { + return BTraceFilteredContext12( + aClassification, // Category + 0, // Sub-category + aUid, // UID + aFormatId, + a1); + } + +inline TBool TraceN(TClassification aClassification, TFormatId aFormatId, TModuleUid aUid, TInt aArgCount, TUint a1, ...) + { + const TInt KMaxArgs = 8; + if (aArgCount > KMaxArgs) + return EFalse; + TUint args[KMaxArgs]; + TInt argLen = aArgCount << 2; + memcpy(args, &a1, argLen); + + return BTraceFilteredContextN( + aClassification, // Category + 0, // Sub-category + aUid, // UID + aFormatId, + args, + argLen); + } + + +inline TBool TraceStr(TClassification aClassification, TFormatId aFormatId, TModuleUid aUid, const TAny* aData, TInt aDataSize) + { + // NB This will truncate the data (!!!) - + // we can't use BTraceFilteredContextBig for this as it doesn't have room for the format Id + return BTraceFilteredContextN( + aClassification, // Category + 0, // Sub-category + aUid, // UID + aFormatId, + aData, + aDataSize); + } + + + + + + + +class RFTrace : public RBusLogicalChannel + { +public: + enum {EMajorVersionNumber=1,EMinorVersionNumber=0,EBuildVersionNumber=1}; + enum TControl + { + ETraceMultiple, + }; + +#ifndef __KERNEL_MODE__ + +public: + inline TInt Open(TOwnerType aType) + {return DoCreate(_L("FTrace"),TVersion(),0,NULL,NULL,aType);} + + inline TBool TraceMultiple(TClassification aClassification, TFormatId aFormatId, TUint32 aUid, TInt aDescriptorCount, TUint64 aParam1, ...) { - public: - inline RDummyMessage(TInt aHandle) {iHandle = aHandle; iFunction=-1;} - }; + if (Handle() == NULL) + return EFalse; + // ARM passes first 4 parameters in registers, so.... + // parcel-up the first four parameters in an array and pass a pointer to the array to the LDD; + // the next parameter(s) should be on the stack, so we can just pass a pointer to the first element + TUint args[4] = {aClassification, aFormatId, aUid, aDescriptorCount}; + TUint64* pArg1 = &aParam1; + TInt r = DoControl(ETraceMultiple, (TAny*) args, pArg1); + if (r |= KErrNone) + User::Panic(_L("FSCLIENT Trace panic"), 0); + return ETrue; + } + + static inline TUint64 PkgData(const TDesC16& aDes) {return MAKE_TUINT64( ((TUint) aDes.Ptr()), (aDes.Length()<<1) | (EPtrC<