author | Mike Kinghan <mikek@symbian.org> |
Wed, 21 Jul 2010 14:39:33 +0100 | |
branch | GCC_SURGE |
changeset 218 | cf8aa66d1b90 |
parent 160 | 30e086416910 |
permissions | -rw-r--r-- |
0 | 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 |
|
160
30e086416910
Fix for Bug 2984 - [GCCE] Illegal inline assembler in kernel/eka/debug/utrace/src/e32utrace.cpp
mikek
parents:
0
diff
changeset
|
88 |
#if defined(__GCCE__) |
30e086416910
Fix for Bug 2984 - [GCCE] Illegal inline assembler in kernel/eka/debug/utrace/src/e32utrace.cpp
mikek
parents:
0
diff
changeset
|
89 |
#define GET_PC(pc) \ |
30e086416910
Fix for Bug 2984 - [GCCE] Illegal inline assembler in kernel/eka/debug/utrace/src/e32utrace.cpp
mikek
parents:
0
diff
changeset
|
90 |
TUint32 pc = 0; \ |
30e086416910
Fix for Bug 2984 - [GCCE] Illegal inline assembler in kernel/eka/debug/utrace/src/e32utrace.cpp
mikek
parents:
0
diff
changeset
|
91 |
asm("mov %[res], %[val]" : [res] "=r" (pc) : [val] "r" (__builtin_return_address(0))) |
30e086416910
Fix for Bug 2984 - [GCCE] Illegal inline assembler in kernel/eka/debug/utrace/src/e32utrace.cpp
mikek
parents:
0
diff
changeset
|
92 |
#elif defined(__ARMCC__) |
30e086416910
Fix for Bug 2984 - [GCCE] Illegal inline assembler in kernel/eka/debug/utrace/src/e32utrace.cpp
mikek
parents:
0
diff
changeset
|
93 |
#define GET_PC(pc) \ |
30e086416910
Fix for Bug 2984 - [GCCE] Illegal inline assembler in kernel/eka/debug/utrace/src/e32utrace.cpp
mikek
parents:
0
diff
changeset
|
94 |
TUint32 pc = 0; \ |
30e086416910
Fix for Bug 2984 - [GCCE] Illegal inline assembler in kernel/eka/debug/utrace/src/e32utrace.cpp
mikek
parents:
0
diff
changeset
|
95 |
asm("mov pc, __return_address()") |
30e086416910
Fix for Bug 2984 - [GCCE] Illegal inline assembler in kernel/eka/debug/utrace/src/e32utrace.cpp
mikek
parents:
0
diff
changeset
|
96 |
#else |
30e086416910
Fix for Bug 2984 - [GCCE] Illegal inline assembler in kernel/eka/debug/utrace/src/e32utrace.cpp
mikek
parents:
0
diff
changeset
|
97 |
#error What compiler? |
30e086416910
Fix for Bug 2984 - [GCCE] Illegal inline assembler in kernel/eka/debug/utrace/src/e32utrace.cpp
mikek
parents:
0
diff
changeset
|
98 |
#endif |
0 | 99 |
#elif __MARM_ARM4__ |
100 |
//arm4 not implemented yet! |
|
101 |
#define GET_PC(pc) \ |
|
102 |
TUint32 pc = 0; |
|
103 |
#elif __WINS__ |
|
104 |
//wins |
|
105 |
#define GET_PC(pc) \ |
|
106 |
TUint32 pc = 0; \ |
|
107 |
_asm push edx \ |
|
108 |
_asm mov edx, [ebp+4] \ |
|
109 |
_asm mov [pc], edx \ |
|
110 |
_asm pop edx |
|
111 |
//This is instead of doing "asm(mov pc, ebp+4)" as that gives warnings about registers being spilled. |
|
112 |
#elif __X86__ |
|
113 |
//x86 not implemented yet! |
|
114 |
#define GET_PC(pc) \ |
|
115 |
TUint32 pc = 0; |
|
116 |
/* asm("push edx"); \ |
|
117 |
asm("mov %0, [edx+4]": "=r" (pc)); \ |
|
118 |
asm("pop edx") */ |
|
119 |
#else |
|
120 |
//other platforms |
|
121 |
#define GET_PC(pc) \ |
|
122 |
TUint32 pc = 0; |
|
123 |
#endif |
|
124 |
||
125 |
#endif /*TRACEUTILS_H_*/ |