os/kernelhwsrv/kernel/eka/debug/ost/inc/traceutils.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // Trace API
    15 //
    16 
    17 /**
    18 * @internalTechnology
    19 * @deprecated
    20 */
    21 
    22 #ifndef TRACEUTILS_H_
    23 #define TRACEUTILS_H_
    24 #include <e32btrace.h>
    25 
    26 
    27 /**
    28 Maximum length of a formatted string
    29 */
    30 const static TInt KMaxPrintfSize = 256;
    31 
    32 /**
    33 Dummy class to toss away overflow
    34 
    35 @internalComponent
    36 */
    37 #ifndef __KERNEL_MODE__
    38 class TTruncateOverflow16 : public TDes16Overflow
    39 	{
    40 	public:
    41 	virtual void Overflow(TDes&) {};
    42 	};
    43 
    44 /**
    45 Dummy class to toss away overflow
    46 
    47 @internalComponent
    48 */
    49 class TTruncateOverflow8 : public TDes8Overflow
    50 	{
    51 	public:
    52 	virtual void Overflow(TDes8&) {};
    53 	};
    54 #endif  //__KERNEL_MODE__
    55 
    56 
    57 /**
    58 @internalComponent
    59 */
    60 #define OST_HEADER(aSize,aGroupId,aContext,aPc)																\
    61 	((((aSize) + (aContext?4:0) + (aPc?4:0)) << BTrace::ESizeIndex*8)										\
    62 	+(((aContext?BTrace::EContextIdPresent:0) | (aPc?BTrace::EPcPresent:0)) << BTrace::EFlagsIndex*8)			\
    63 	+((aGroupId) << BTrace::ECategoryIndex*8)																				\
    64 	+((0) << BTrace::ESubCategoryIndex*8))
    65 
    66 
    67 /**
    68 @internalComponent
    69 */
    70 #define OST_SECONDARY_0(aGroupId,aComponentId,aThreadIdPresent,aPcPresent,aPc,aTraceId)	\
    71 	BTrace::OutFilteredPcFormatBig(OST_HEADER(8,aGroupId,aThreadIdPresent,aPcPresent),(TUint32)(aComponentId),aPc,aTraceId,0,0)
    72 
    73 /**
    74 @internalComponent
    75 */
    76 #define OST_SECONDARY_1(aGroupId,aComponentId,aThreadIdPresent,aPcPresent,aPc,aTraceId, aData1) \
    77 	BTrace::OutFilteredPcFormatBig(OST_HEADER(8,aGroupId,aThreadIdPresent,aPcPresent),(TUint32)(aComponentId),aPc,aTraceId,&aData1,4)
    78 
    79 /**
    80 @internalComponent
    81 */
    82 #define OST_SECONDARY_ANY(aGroupId, aComponentId, aThreadIdPresent, aPcPresent, aPc, aTraceId, aData, aDataSize) \
    83 	BTrace::OutFilteredPcFormatBig(OST_HEADER(8,aGroupId,aThreadIdPresent,aPcPresent),(TUint32)(aComponentId),aPc,aTraceId,aData,(TInt)(aDataSize))
    84 
    85 
    86 #ifdef __MARM_ARMV5__
    87 	//armv5
    88 #define GET_PC(pc) \
    89 	TUint32 pc = 0; \
    90 	asm("mov pc, __return_address()")
    91 #elif __MARM_ARM4__
    92 	//arm4 not implemented yet!
    93 #define GET_PC(pc) \
    94 	TUint32 pc = 0;
    95 #elif __WINS__
    96 	//wins
    97 #define GET_PC(pc) \
    98 	TUint32 pc = 0; \
    99 	_asm push edx \
   100 	_asm mov edx, [ebp+4] \
   101 	_asm mov [pc], edx \
   102 	_asm pop edx
   103 	//This is instead of doing "asm(mov pc, ebp+4)" as that gives warnings about registers being spilled.
   104 #elif __X86__ 
   105 	//x86 not implemented yet!
   106 #define GET_PC(pc) \
   107 	TUint32 pc = 0;
   108 /*	asm("push edx"); \
   109 	asm("mov %0, [edx+4]": "=r" (pc)); \
   110 	asm("pop edx") */
   111 #else
   112 //other platforms
   113 #define GET_PC(pc) \
   114 	TUint32 pc = 0;
   115 #endif
   116 
   117 #endif /*TRACEUTILS_H_*/