|
1 /* |
|
2 * Copyright (c) 2004 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 "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: Utilities for Camera Application Engine. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CAEDBGUTILITIES_H |
|
20 #define CAEDBGUTILITIES_H |
|
21 |
|
22 // MACROS |
|
23 |
|
24 // Logging support |
|
25 // Serial port logging is enabled in _DEBUG builds by default |
|
26 // USE_FILE_LOGGER or USE_SERIAL_LOGGER can also be explicitely defined e.g. in MMP file. |
|
27 // |
|
28 |
|
29 // #define USE_FILE_LOGGER |
|
30 |
|
31 #if defined (_DEBUG) && !defined(USE_FILE_LOGGER) |
|
32 #define USE_SERIAL_LOGGER |
|
33 #endif |
|
34 |
|
35 #if defined (USE_FILE_LOGGER) |
|
36 #include <flogger.h> |
|
37 _LIT(KLogFile,"cae.txt"); |
|
38 _LIT(KLogFolder,"cae"); |
|
39 #define LOGTEXT(AAA) RFileLogger::Write(KLogFolder(),KLogFile(),EFileLoggingModeAppend,AAA) |
|
40 #define LOGTEXT2(AAA,BBB) RFileLogger::WriteFormat(KLogFolder(),KLogFile(),EFileLoggingModeAppend,TRefByValue<const TDesC>(AAA),BBB) |
|
41 #define LOGTEXT3(AAA,BBB,CC) RFileLogger::WriteFormat(KLogFolder(),KLogFile(),EFileLoggingModeAppend,TRefByValue<const TDesC>(AAA),BBB,CC) |
|
42 #define LOGHEXDUMP(AAA,BBB,CC,DDD) RFileLogger::HexDump(KLogFolder(),KLogFile(),EFileLoggingModeAppend,AAA,BBB,CC,DDD) |
|
43 #elif defined (USE_SERIAL_LOGGER) |
|
44 #include <e32svr.h> |
|
45 #define LOGTEXT(AAA) RDebug::Print(AAA) |
|
46 #define LOGTEXT2(AAA,BBB) RDebug::Print(AAA,BBB) |
|
47 #define LOGTEXT3(AAA,BBB,CC) RDebug::Print(AAA,BBB,CC) |
|
48 #define LOGHEXDUMP(AAA,BBB,CC,DDD) |
|
49 #else |
|
50 #define LOGTEXT(AAA) |
|
51 #define LOGTEXT2(AAA,BBB) |
|
52 #define LOGTEXT3(AAA,BBB,CC) |
|
53 #define LOGHEXDUMP(AAA,BBB,CC,DDD) |
|
54 #endif |
|
55 |
|
56 // Memory info logging. |
|
57 #ifdef _DEBUG |
|
58 #define MEM() PrintMemoryInfo() |
|
59 #else |
|
60 #define MEM() |
|
61 #endif |
|
62 |
|
63 // Define assert to include file & line number |
|
64 #define CAE_ASSERT_FILE__(s) _LIT(KPanicFileName,s) |
|
65 #define CAE_ASSERT_PANIC__(l) User::Panic(KPanicFileName().Right(12),l) // Note: RVCT compiler puts the full path in __LINE__ |
|
66 #define CAE_ASSERT_DEBUG_PANIC__(c,l) if (!(c)) {LOGTEXT3(_L("Error panic! Assert failed in file: %S, line: %d"), &KPanicFileName, l);User::Panic(KPanicFileName().Right(12),l);} |
|
67 |
|
68 #ifdef _DEBUG |
|
69 #define CAE_ASSERT_DEBUG(x) { CAE_ASSERT_FILE__(__FILE__); CAE_ASSERT_DEBUG_PANIC__(x,__LINE__);} |
|
70 #define CAE_ASSERT_ALWAYS(x) CAE_ASSERT_DEBUG(x) |
|
71 #else |
|
72 #define CAE_ASSERT_DEBUG(x) |
|
73 #define CAE_ASSERT_ALWAYS(x) { CAE_ASSERT_FILE__("CamAppEngine"); __ASSERT_ALWAYS(x, CAE_ASSERT_PANIC__(__LINE__) ); } |
|
74 #endif |
|
75 |
|
76 |
|
77 // FUNCTION PROTOTYPES |
|
78 |
|
79 #ifdef _DEBUG |
|
80 void PrintMemoryInfo(); |
|
81 #endif |
|
82 |
|
83 |
|
84 #endif // CAEDBGUTILITIES_H |
|
85 |
|
86 // End of File |