1 /* |
1 /* |
2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This material, including documentation and any related computer |
4 * This material, including documentation and any related computer |
5 * programs, is protected by copyright controlled by Nokia. All |
5 * programs, is protected by copyright controlled by Nokia. All |
6 * rights are reserved. Copying, including reproducing, storing |
6 * rights are reserved. Copying, including reproducing, storing |
7 * adapting or translating, any or all of this material requires the |
7 * adapting or translating, any or all of this material requires the |
95 } |
95 } |
96 private: |
96 private: |
97 TPtrC8 iFuncName; |
97 TPtrC8 iFuncName; |
98 }; |
98 }; |
99 // =========================================================================== |
99 // =========================================================================== |
100 #else //Real-time logging |
100 #else //LOG_TO_FILE not defined |
101 // =========================================================================== |
101 // =========================================================================== |
102 #include <e32debug.h> |
102 #include <e32debug.h> |
103 |
103 |
104 // Paramters same as above. |
104 // Paramters same as above. |
105 #define LOG( str ) { RDebug::Printf( "["MODULE_NAME"] %s", str ); } |
105 #define LOG( str ) { RDebug::Printf( "["MODULE_NAME"] %s", str ); } |
125 private: |
125 private: |
126 TPtrC8 iFuncName; |
126 TPtrC8 iFuncName; |
127 }; |
127 }; |
128 #endif // LOG_TO_FILE |
128 #endif // LOG_TO_FILE |
129 |
129 |
130 #define LEAVE( exp ) {volatile TInt err = exp; \ |
130 #define LEAVE( exp ) {volatile TInt err_ = exp; \ |
131 LOG3( "LEAVE(%d) @file: %s, line: %d", err, __FILE__, __LINE__ );\ |
131 LOG3( "LEAVE(%d) @file: %s, line: %d", err_, __FILE__, __LINE__ );\ |
132 User::Leave( err );} |
132 User::Leave( err_ );} |
133 |
133 |
134 #define LEAVEIFERROR( exp ) {volatile TInt err = exp; if(err < 0) LEAVE(err);} |
134 #define LEAVEIFERROR( exp ) {volatile TInt err__ = exp; \ |
|
135 if(err__ < 0) LEAVE(err__);} |
135 |
136 |
136 #define PANIC( exp ) {volatile TInt err = exp; \ |
137 #define PANIC( exp ) {volatile TInt err_ = exp; \ |
137 LOG3( "PANIC(%d) @file: %s, line: %d", err, __FILE__, __LINE__ );\ |
138 LOG3( "PANIC(%d) @file: %s, line: %d", err_, __FILE__, __LINE__ );\ |
138 User::Panic( KUsbPanicModule, err );} |
139 User::Panic( KUsbPanicModule, err_ );} |
139 |
|
140 |
140 |
141 #define LOG_FUNC TFuncLogger __instrument(TPtrC8((TUint8*)__PRETTY_FUNCTION__)); |
141 #define LOG_FUNC TFuncLogger __instrument(TPtrC8((TUint8*)__PRETTY_FUNCTION__)); |
142 |
142 |
143 #else // _DEBUG |
143 #define ASSERT_PANIC( exp, code ) {if(!(exp)) PANIC(code)} |
|
144 |
|
145 #else // _DEBUG not defined |
144 // =========================================================================== |
146 // =========================================================================== |
145 |
147 |
146 #define LOG( s ) |
148 #define LOG( s ) |
147 #define LOG1( s, v ) |
149 #define LOG1( s, v ) |
148 #define LOG2( s, v1, v2 ) |
150 #define LOG2( s, v1, v2 ) |
149 #define LOG3( s, v1, v2, v3 ) |
151 #define LOG3( s, v1, v2, v3 ) |
150 #define LOG_FUNC_ENTRY |
152 #define LOG_FUNC_ENTRY |
151 #define LOG_FUNC_EXIT |
153 #define LOG_FUNC_EXIT |
152 #define LEAVE( exp ) User::Leave( exp ); |
154 #define LEAVE( exp ) User::Leave( exp ); |
153 #define LEAVEIFERROR( exp ) User::LeaveIfError( exp ); |
155 #define LEAVEIFERROR( exp ) User::LeaveIfError( exp ); |
154 #define PANIC( err ) User::Panic( KUsbPanicModule, err ); |
156 #define PANIC( err ) // in non-debug builds PANICs are silent |
155 #define LOG_FUNC |
157 #define LOG_FUNC |
|
158 #define ASSERT_PANIC( exp, code ) |
156 // =========================================================================== |
159 // =========================================================================== |
157 #endif // _DEBUG |
160 #endif // _DEBUG |
158 // =========================================================================== |
161 // =========================================================================== |
159 #endif // DEBUG_H |
162 #endif // DEBUG_H |
160 |
163 |