author | Sebastian Brannstrom <sebastianb@symbian.org> |
Tue, 15 Jun 2010 14:56:44 +0100 | |
branch | GCC_SURGE |
changeset 39 | 82988ef59a49 |
parent 26 | 0ae0f29418cd |
child 63 | ef2686f7597e |
permissions | -rw-r--r-- |
0
1e05558e2206
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1 |
/* |
26
0ae0f29418cd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
2 |
* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
0
1e05558e2206
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
3 |
* All rights reserved. |
26
0ae0f29418cd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
0ae0f29418cd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
5 |
* under the terms of "Eclipse Public License v1.0" |
0ae0f29418cd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
0ae0f29418cd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
0
1e05558e2206
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
8 |
* |
1e05558e2206
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
9 |
* Initial Contributors: |
1e05558e2206
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
10 |
* Nokia Corporation - initial contribution. |
1e05558e2206
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
11 |
* |
1e05558e2206
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
12 |
* Contributors: |
1e05558e2206
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
13 |
* |
26
0ae0f29418cd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
14 |
* Description: Debug macros and declarations. |
0
1e05558e2206
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
15 |
* |
1e05558e2206
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
16 |
*/ |
1e05558e2206
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
17 |
|
26
0ae0f29418cd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
18 |
|
25
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
19 |
#ifndef DEBUG_H |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
20 |
#define DEBUG_H |
0
1e05558e2206
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
21 |
|
25
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
22 |
////////////////////////////////////////////////////////////////////////////// |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
23 |
// Here are parameters need to be modified. |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
24 |
// Component name |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
25 |
#define MODULE_NAME "USBOTGWATCHER" |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
26 |
////////////////////////////////////////////////////////////////////////////// |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
27 |
|
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
28 |
|
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
29 |
// For handling unicode strings as L##MACRO is interpreted as LMACRO |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
30 |
#define WIDEN2( x ) L##x |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
31 |
#define WIDEN( x ) WIDEN2( x ) |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
32 |
|
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
33 |
_LIT( KUsbPanicModule, ""WIDEN( MODULE_NAME ) ); |
0
1e05558e2206
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
34 |
|
1e05558e2206
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
35 |
#ifdef _DEBUG |
1e05558e2206
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
36 |
|
25
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
37 |
// Comment this line out if using real-time debugging |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
38 |
//#define LOG_TO_FILE |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
39 |
// =========================================================================== |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
40 |
#if defined ( LOG_TO_FILE ) |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
41 |
// =========================================================================== |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
42 |
// Add corresponding libabry in mmp file |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
43 |
// LIBRARY flogger.lib |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
44 |
// The log file is located at |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
45 |
// c:\logs\usb\MODULE_NAME.txt |
0
1e05558e2206
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
46 |
|
1e05558e2206
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
47 |
#include <flogger.h> |
1e05558e2206
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
48 |
|
25
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
49 |
#define DESC( x ) TPtrC( ( const TText* ) ( x ) ) |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
50 |
#define DESC8( x ) TPtrC8( ( const TUint8* ) ( x ) ) |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
51 |
_LIT( KUsbLogDir, "USB" ); |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
52 |
_LIT( KUsbLogFile, ""WIDEN(MODULE_NAME)L".txt" ); |
0
1e05558e2206
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
53 |
|
25
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
54 |
// s: c string. |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
55 |
#define LOG(s) RFileLogger::WriteFormat( KUsbLogDir, \ |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
56 |
KUsbLogFile, EFileLoggingModeAppend, \ |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
57 |
DESC8( "["MODULE_NAME"] "##s ) ) |
0
1e05558e2206
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
58 |
|
25
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
59 |
// s: c string contains "%x" |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
60 |
// v: varaible corresponding to %x |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
61 |
#define LOG1(s, v) RFileLogger::WriteFormat( KUsbLogDir, \ |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
62 |
KUsbLogFile, EFileLoggingModeAppend, \ |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
63 |
DESC8( "["MODULE_NAME"] "##s ), v) |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
64 |
// s: c string contains "%x%y" |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
65 |
// v1: varaible corresponding to %x |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
66 |
// v2: varaible corresponding to %y |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
67 |
#define LOG2(s, v1, v2) RFileLogger::WriteFormat( KUsbLogDir, \ |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
68 |
KUsbLogFile, EFileLoggingModeAppend, \ |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
69 |
DESC8( "["MODULE_NAME"] "##s ), v1, v2) |
0
1e05558e2206
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
70 |
|
25
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
71 |
// s: c string contains "%x%y%z" |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
72 |
// v1: varaible corresponding to %x |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
73 |
// v2: varaible corresponding to %y |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
74 |
// v3: varaible corresponding to %z |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
75 |
#define LOG3(s, v1, v2, v3) RFileLogger::WriteFormat( KUsbLogDir, \ |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
76 |
KUsbLogFile, EFileLoggingModeAppend, \ |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
77 |
DESC8( "["MODULE_NAME"] "##s ), v1, v2, v3 ) |
0
1e05558e2206
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
78 |
|
25
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
79 |
class TFuncLogger |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
80 |
{ |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
81 |
public: |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
82 |
TFuncLogger(const TDesC8& aFuncName) |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
83 |
{ |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
84 |
iFuncName.Set( aFuncName ); |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
85 |
RFileLogger::WriteFormat( KUsbLogDir, KUsbLogFile, EFileLoggingModeAppend, |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
86 |
DESC8( "["MODULE_NAME"] >>%s" ), iFuncName.Ptr() ); |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
87 |
} |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
88 |
~TFuncLogger() |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
89 |
{ |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
90 |
RFileLogger::WriteFormat( KUsbLogDir, KUsbLogFile, |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
91 |
EFileLoggingModeAppend, |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
92 |
DESC8( "["MODULE_NAME"] <<%s" ), iFuncName.Ptr() ); |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
93 |
} |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
94 |
private: |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
95 |
TPtrC8 iFuncName; |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
96 |
}; |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
97 |
// =========================================================================== |
26
0ae0f29418cd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
98 |
#else //LOG_TO_FILE not defined |
25
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
99 |
// =========================================================================== |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
100 |
#include <e32debug.h> |
0
1e05558e2206
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
101 |
|
25
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
102 |
// Paramters same as above. |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
103 |
#define LOG( str ) { RDebug::Printf( "["MODULE_NAME"] %s", str ); } |
0
1e05558e2206
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
104 |
|
39
82988ef59a49
Bug 2961 - GCC compilation issues with debug macro string expansion fixed
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
26
diff
changeset
|
105 |
#define LOG1( s, v ) { RDebug::Printf( "["MODULE_NAME"] " s , v ); } |
0
1e05558e2206
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
106 |
|
39
82988ef59a49
Bug 2961 - GCC compilation issues with debug macro string expansion fixed
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
26
diff
changeset
|
107 |
#define LOG2( s, v1,v2 ) { RDebug::Printf( "["MODULE_NAME"] " s , v1, v2 ); } |
0
1e05558e2206
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
108 |
|
39
82988ef59a49
Bug 2961 - GCC compilation issues with debug macro string expansion fixed
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
26
diff
changeset
|
109 |
#define LOG3( s, v1, v2, v3 ) { RDebug::Printf( "["MODULE_NAME"] " s , \ |
25
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
110 |
v1, v2, v3); } |
0
1e05558e2206
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
111 |
|
25
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
112 |
class TFuncLogger |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
113 |
{ |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
114 |
public: |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
115 |
TFuncLogger(const TPtrC8& aFuncName) : iFuncName( aFuncName ) |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
116 |
{ |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
117 |
RDebug::Printf( "["MODULE_NAME"] >>%s", iFuncName.Ptr()); |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
118 |
} |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
119 |
~TFuncLogger() |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
120 |
{ |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
121 |
RDebug::Printf( "["MODULE_NAME"] <<%s", iFuncName.Ptr()); |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
122 |
} |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
123 |
private: |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
124 |
TPtrC8 iFuncName; |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
125 |
}; |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
126 |
#endif // LOG_TO_FILE |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
127 |
|
26
0ae0f29418cd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
128 |
#define LEAVE( exp ) {volatile TInt err_ = exp; \ |
0ae0f29418cd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
129 |
LOG3( "LEAVE(%d) @file: %s, line: %d", err_, __FILE__, __LINE__ );\ |
0ae0f29418cd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
130 |
User::Leave( err_ );} |
25
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
131 |
|
26
0ae0f29418cd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
132 |
#define LEAVEIFERROR( exp ) {volatile TInt err__ = exp; \ |
0ae0f29418cd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
133 |
if(err__ < 0) LEAVE(err__);} |
25
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
134 |
|
26
0ae0f29418cd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
135 |
#define PANIC( exp ) {volatile TInt err_ = exp; \ |
0ae0f29418cd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
136 |
LOG3( "PANIC(%d) @file: %s, line: %d", err_, __FILE__, __LINE__ );\ |
0ae0f29418cd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
137 |
User::Panic( KUsbPanicModule, err_ );} |
0
1e05558e2206
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
138 |
|
25
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
139 |
#define LOG_FUNC TFuncLogger __instrument(TPtrC8((TUint8*)__PRETTY_FUNCTION__)); |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
140 |
|
26
0ae0f29418cd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
141 |
#define ASSERT_PANIC( exp, code ) {if(!(exp)) PANIC(code)} |
0ae0f29418cd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
142 |
|
0ae0f29418cd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
143 |
#else // _DEBUG not defined |
25
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
144 |
// =========================================================================== |
0
1e05558e2206
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
145 |
|
25
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
146 |
#define LOG( s ) |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
147 |
#define LOG1( s, v ) |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
148 |
#define LOG2( s, v1, v2 ) |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
149 |
#define LOG3( s, v1, v2, v3 ) |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
150 |
#define LOG_FUNC_ENTRY |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
151 |
#define LOG_FUNC_EXIT |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
152 |
#define LEAVE( exp ) User::Leave( exp ); |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
153 |
#define LEAVEIFERROR( exp ) User::LeaveIfError( exp ); |
26
0ae0f29418cd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
154 |
#define PANIC( err ) // in non-debug builds PANICs are silent |
25
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
155 |
#define LOG_FUNC |
26
0ae0f29418cd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
156 |
#define ASSERT_PANIC( exp, code ) |
25
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
157 |
// =========================================================================== |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
158 |
#endif // _DEBUG |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
159 |
// =========================================================================== |
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
160 |
#endif // DEBUG_H |
0
1e05558e2206
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
161 |
|
25
8c311f9acc5e
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
162 |
// End of File |