1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/kernel/eka/debug/ost/inc/traceutils.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,117 @@
1.4 +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of the License "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// Trace API
1.18 +//
1.19 +
1.20 +/**
1.21 +* @internalTechnology
1.22 +* @deprecated
1.23 +*/
1.24 +
1.25 +#ifndef TRACEUTILS_H_
1.26 +#define TRACEUTILS_H_
1.27 +#include <e32btrace.h>
1.28 +
1.29 +
1.30 +/**
1.31 +Maximum length of a formatted string
1.32 +*/
1.33 +const static TInt KMaxPrintfSize = 256;
1.34 +
1.35 +/**
1.36 +Dummy class to toss away overflow
1.37 +
1.38 +@internalComponent
1.39 +*/
1.40 +#ifndef __KERNEL_MODE__
1.41 +class TTruncateOverflow16 : public TDes16Overflow
1.42 + {
1.43 + public:
1.44 + virtual void Overflow(TDes&) {};
1.45 + };
1.46 +
1.47 +/**
1.48 +Dummy class to toss away overflow
1.49 +
1.50 +@internalComponent
1.51 +*/
1.52 +class TTruncateOverflow8 : public TDes8Overflow
1.53 + {
1.54 + public:
1.55 + virtual void Overflow(TDes8&) {};
1.56 + };
1.57 +#endif //__KERNEL_MODE__
1.58 +
1.59 +
1.60 +/**
1.61 +@internalComponent
1.62 +*/
1.63 +#define OST_HEADER(aSize,aGroupId,aContext,aPc) \
1.64 + ((((aSize) + (aContext?4:0) + (aPc?4:0)) << BTrace::ESizeIndex*8) \
1.65 + +(((aContext?BTrace::EContextIdPresent:0) | (aPc?BTrace::EPcPresent:0)) << BTrace::EFlagsIndex*8) \
1.66 + +((aGroupId) << BTrace::ECategoryIndex*8) \
1.67 + +((0) << BTrace::ESubCategoryIndex*8))
1.68 +
1.69 +
1.70 +/**
1.71 +@internalComponent
1.72 +*/
1.73 +#define OST_SECONDARY_0(aGroupId,aComponentId,aThreadIdPresent,aPcPresent,aPc,aTraceId) \
1.74 + BTrace::OutFilteredPcFormatBig(OST_HEADER(8,aGroupId,aThreadIdPresent,aPcPresent),(TUint32)(aComponentId),aPc,aTraceId,0,0)
1.75 +
1.76 +/**
1.77 +@internalComponent
1.78 +*/
1.79 +#define OST_SECONDARY_1(aGroupId,aComponentId,aThreadIdPresent,aPcPresent,aPc,aTraceId, aData1) \
1.80 + BTrace::OutFilteredPcFormatBig(OST_HEADER(8,aGroupId,aThreadIdPresent,aPcPresent),(TUint32)(aComponentId),aPc,aTraceId,&aData1,4)
1.81 +
1.82 +/**
1.83 +@internalComponent
1.84 +*/
1.85 +#define OST_SECONDARY_ANY(aGroupId, aComponentId, aThreadIdPresent, aPcPresent, aPc, aTraceId, aData, aDataSize) \
1.86 + BTrace::OutFilteredPcFormatBig(OST_HEADER(8,aGroupId,aThreadIdPresent,aPcPresent),(TUint32)(aComponentId),aPc,aTraceId,aData,(TInt)(aDataSize))
1.87 +
1.88 +
1.89 +#ifdef __MARM_ARMV5__
1.90 + //armv5
1.91 +#define GET_PC(pc) \
1.92 + TUint32 pc = 0; \
1.93 + asm("mov pc, __return_address()")
1.94 +#elif __MARM_ARM4__
1.95 + //arm4 not implemented yet!
1.96 +#define GET_PC(pc) \
1.97 + TUint32 pc = 0;
1.98 +#elif __WINS__
1.99 + //wins
1.100 +#define GET_PC(pc) \
1.101 + TUint32 pc = 0; \
1.102 + _asm push edx \
1.103 + _asm mov edx, [ebp+4] \
1.104 + _asm mov [pc], edx \
1.105 + _asm pop edx
1.106 + //This is instead of doing "asm(mov pc, ebp+4)" as that gives warnings about registers being spilled.
1.107 +#elif __X86__
1.108 + //x86 not implemented yet!
1.109 +#define GET_PC(pc) \
1.110 + TUint32 pc = 0;
1.111 +/* asm("push edx"); \
1.112 + asm("mov %0, [edx+4]": "=r" (pc)); \
1.113 + asm("pop edx") */
1.114 +#else
1.115 +//other platforms
1.116 +#define GET_PC(pc) \
1.117 + TUint32 pc = 0;
1.118 +#endif
1.119 +
1.120 +#endif /*TRACEUTILS_H_*/