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