0
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of the License "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
#ifndef ISIMESSAGETRACE_H
|
|
21 |
#define ISIMESSAGETRACE_H
|
|
22 |
|
|
23 |
// INCLUDES
|
|
24 |
// CONSTANTS
|
|
25 |
|
|
26 |
// MACROS
|
|
27 |
|
|
28 |
#ifdef TRACE_MODE_KERNEL
|
|
29 |
|
|
30 |
|
|
31 |
#define _LIT_FOR_ASSERT(a) reinterpret_cast< const char* > ( ( ( const TDesC& )( a ) ).Ptr() )
|
|
32 |
#define _T(a) a
|
|
33 |
#else
|
|
34 |
|
|
35 |
// INCLUDES
|
|
36 |
#include <e32svr.h> // RDebug
|
|
37 |
#include <e32std.h>
|
|
38 |
|
|
39 |
#define _LIT_FOR_ASSERT(a) error
|
|
40 |
#define _T(a) _L(a)
|
|
41 |
|
|
42 |
#endif // TRACE_MODE_KERNEL
|
|
43 |
|
|
44 |
|
|
45 |
|
|
46 |
// macro __TRACE_PRINTF id defined because it is needed in build trace. It has also
|
|
47 |
// been included in other trace macros
|
|
48 |
|
|
49 |
#if defined TRACE_MODE_KERNEL
|
|
50 |
#define __TRACE_PRINTF(a) Kern::Printf a
|
|
51 |
#else
|
|
52 |
#define __TRACE_PRINTF(a) RDebug::Print a
|
|
53 |
#endif
|
|
54 |
|
|
55 |
|
|
56 |
#ifdef _DEBUG
|
|
57 |
|
|
58 |
void BuildTraceFunc( const TDesC& aPrefix );
|
|
59 |
void DataDumpTraceFunc( const TDesC& aPrefix, const TDesC8& aData );
|
|
60 |
|
|
61 |
#define BUILD_TRACE( a ) BuildTraceFunc( a )
|
|
62 |
#define DATA_DUMP_TRACE( a, b ) DataDumpTraceFunc( a, b )
|
|
63 |
|
|
64 |
#if defined TRACE_MODE_KERNEL
|
|
65 |
|
|
66 |
// define assertions
|
|
67 |
#define TRACE_ASSERT(a) if (!(a)) __TRACE_PRINTF(("Assertion failed: file=" __FILE__ ", line=%d, compiled=" __DATE__" "__TIME__, __LINE__ ))
|
|
68 |
#ifdef __WINS__
|
|
69 |
#define TRACE_ASSERT(a) if (!(a)) __TRACE_PRINTF((_L("Assertion failed: file= __FILE__ , line=%d, compiled=__DATE__ __TIME__ "),__LINE__ ))
|
|
70 |
#else
|
|
71 |
#define TRACE_ASSERT(a) if (!(a)) __TRACE_PRINTF((_L("Assertion failed: file=" __FILE__ ", line=%d, compiled="__DATE__" "__TIME__""),__LINE__ ))
|
|
72 |
#endif //__WINS__
|
|
73 |
|
|
74 |
#else
|
|
75 |
|
|
76 |
// define assertions
|
|
77 |
#ifdef __WINS__
|
|
78 |
#define TRACE_ASSERT(a) if (!(a)) __TRACE_PRINTF((_L("IsiMessage error, assertion failed: file= TIsi.cpp, line=%d "),__LINE__) )
|
|
79 |
#else
|
|
80 |
#define TRACE_ASSERT(a) if (!(a)) __TRACE_PRINTF((_L("IsiMessage error, assertion failed: file= TIsi.cpp, line=%d "),__LINE__) )
|
|
81 |
#endif //__WINS__
|
|
82 |
|
|
83 |
#endif // TRACE_MODE_KERNEL
|
|
84 |
|
|
85 |
|
|
86 |
#if defined COMPONENT_TRACE_FLAG
|
|
87 |
#define C_TRACE(a) __TRACE_PRINTF(a)
|
|
88 |
#else
|
|
89 |
#define C_TRACE(a)
|
|
90 |
#endif // COMPONENT_TRACE_FLAG
|
|
91 |
|
|
92 |
#if defined API_TRACE_FLAG
|
|
93 |
#define A_TRACE(a) __TRACE_PRINTF(a)
|
|
94 |
#else
|
|
95 |
#define A_TRACE(a)
|
|
96 |
#endif // API_TRACE_FLAG
|
|
97 |
|
|
98 |
#if defined EXTENDED_TRACE_FLAG
|
|
99 |
#define E_TRACE(a) __TRACE_PRINTF(a)
|
|
100 |
#else
|
|
101 |
#define E_TRACE(a)
|
|
102 |
#endif // EXTENDED_TRACE_FLAG
|
|
103 |
|
|
104 |
#else
|
|
105 |
#define TRACE_ASSERT(a)
|
|
106 |
#define C_TRACE(a)
|
|
107 |
#define A_TRACE(a)
|
|
108 |
#define E_TRACE(a)
|
|
109 |
#define BUILD_TRACE(a)
|
|
110 |
#define DATA_DUMP_TRACE(a, b)
|
|
111 |
#endif // _DEBUG
|
|
112 |
|
|
113 |
|
|
114 |
// Both in UDEB and UREL (Always traces)
|
|
115 |
#if defined TRACE_MODE_KERNEL
|
|
116 |
|
|
117 |
#define ASSERT_RESET_ALWAYS(a,b,c) if(!(a)) { __TRACE_PRINTF(("Assertion failed: file=" __FILE__ ", line=%d, compiled="__DATE__" "__TIME__, __LINE__)); Kern::Fault(b,c); }
|
|
118 |
#define TRACE_ASSERT_ALWAYS __TRACE_PRINTF( ("Assertion failed: file=" __FILE__ ", line=%d, compiled="__DATE__" "__TIME__, __LINE__) )
|
|
119 |
|
|
120 |
#ifdef __WINS__
|
|
121 |
#define ASSERT_RESET_ALWAYS(a,b,c) if(!(a)) { __TRACE_PRINTF( (_L("Assertion failed: file= __FILE__ , line=%d, compiled=__DATE__ __TIME__" ), __LINE__) ); Plat::Fault(_L(b),c); }
|
|
122 |
#define TRACE_ASSERT_ALWAYS __TRACE_PRINTF( _L("Assertion failed: file= __FILE__ , line=%d, compiled=__DATE__ __TIME__" ), __LINE__)
|
|
123 |
#else
|
|
124 |
#define ASSERT_RESET_ALWAYS(a,b,c) if(!(a)) { __TRACE_PRINTF( (_L("Assertion failed: file=" __FILE__ ", line=%d, compiled="__DATE__" "__TIME__"" ), __LINE__) ); Plat::Fault(b,c); }
|
|
125 |
#define TRACE_ASSERT_ALWAYS __TRACE_PRINTF( (_L("Assertion failed: file=" __FILE__ ", line=%d, compiled="__DATE__" "__TIME__"" ), __LINE__) )
|
|
126 |
#endif //WINS
|
|
127 |
|
|
128 |
#else
|
|
129 |
#ifdef __WINS__
|
|
130 |
#define ASSERT_RESET_ALWAYS(a,b,c) if(!(a)) { __TRACE_PRINTF( (_L("Assertion failed: file=TIsi.cpp, line=%d," ), __LINE__) ); User::Panic(b,c); }
|
|
131 |
#define TRACE_ASSERT_ALWAYS __TRACE_PRINTF( (_L("Assertion failed: file= __FILE__ , line=%d, compiled=__DATE__ __TIME__ "),__LINE__) )
|
|
132 |
#else
|
|
133 |
#define ASSERT_RESET_ALWAYS(a,b,c) if(!(a)) { __TRACE_PRINTF( (_L("Assertion failed: file=TIsi.cpp, line=%d," ), __LINE__) ); User::Panic(b,c); }
|
|
134 |
#define TRACE_ASSERT_ALWAYS __TRACE_PRINTF( (_L("Assertion failed: file=" __FILE__ ", line=%d, compiled="__DATE__ __TIME__""),__LINE__) )
|
|
135 |
#endif
|
|
136 |
#endif // kernel
|
|
137 |
|
|
138 |
|
|
139 |
// DATA TYPES
|
|
140 |
|
|
141 |
// FUNCTION PROTOTYPES
|
|
142 |
|
|
143 |
// FORWARD DECLARATIONS
|
|
144 |
|
|
145 |
#endif // ISIMESSAGETRACE_H
|
|
146 |
|
|
147 |
// End of File
|