87 buf.AppendFormat(_L8("%d at line %d in file %S"), aPanicCode, aLine, &fileName); |
87 buf.AppendFormat(_L8("%d at line %d in file %S"), aPanicCode, aLine, &fileName); |
88 Trace(buf); |
88 Trace(buf); |
89 User::Panic(aPanicCategory, aPanicCode); |
89 User::Panic(aPanicCategory, aPanicCode); |
90 } |
90 } |
91 |
91 |
92 inline void TraceLeave(char* aFile, TInt aLine, TInt aReason) |
92 inline void TraceLeaveL(char* aFile, TInt aLine, TInt aReason) |
93 { |
93 { |
94 TPtrC8 fullFileName((const TUint8*)aFile); |
94 TPtrC8 fullFileName((const TUint8*)aFile); |
95 TPtrC8 fileName(fullFileName.Ptr()+fullFileName.LocateReverse('\\')+1); |
95 TPtrC8 fileName(fullFileName.Ptr()+fullFileName.LocateReverse('\\')+1); |
96 TBuf8<KMaxLogLineLength> buf; |
96 TBuf8<KMaxLogLineLength> buf; |
97 buf.Append(KLeavePrefix8); |
97 buf.Append(KLeavePrefix8); |
112 |
112 |
113 #define TRACE_ASSERT(GUARD, CODE) {if (!(GUARD)) TracePanic(__FILE__, __LINE__, CODE, KPanicCategory);} |
113 #define TRACE_ASSERT(GUARD, CODE) {if (!(GUARD)) TracePanic(__FILE__, __LINE__, CODE, KPanicCategory);} |
114 |
114 |
115 #define PANIC(CODE) TracePanic(__FILE__, __LINE__, CODE, KPanicCategory) |
115 #define PANIC(CODE) TracePanic(__FILE__, __LINE__, CODE, KPanicCategory) |
116 |
116 |
117 #define LEAVE_IF_ERROR(REASON) {if (REASON) TraceLeave(__FILE__, __LINE__, REASON);} |
117 #define LEAVE_IF_ERROR(REASON) {if (REASON) TraceLeaveL(__FILE__, __LINE__, REASON);} |
118 |
118 |
119 #define LEAVE_IF_NULL(PTR) {if (!PTR) TraceLeave(__FILE__, __LINE__, PTR);} |
119 #define LEAVE_IF_NULL(PTR) {if (!PTR) TraceLeaveL(__FILE__, __LINE__, PTR);} |
120 |
120 |
121 #define LEAVE(REASON) {TraceLeave(__FILE__, __LINE__, REASON);} |
121 #define LEAVE(REASON) {TraceLeaveL(__FILE__, __LINE__, REASON);} |
122 |
122 |
123 #define TRACE_STATIC_FUNC_ENTRY {if(KTraceMask & KPRINTINFO) { TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); Trace(KFuncEntryFormat8, &ptr8);}} |
123 #define TRACE_STATIC_FUNC_ENTRY {if(KTraceMask & KPRINTINFO) { TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); Trace(KFuncEntryFormat8, &ptr8);}} |
124 |
124 |
125 #define TRACE_FUNC_ENTRY {if(KTraceMask & KPRINTINFO) { TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); Trace(KFuncEntryThisFormat8, &ptr8, this);}} |
125 #define TRACE_FUNC_ENTRY {if(KTraceMask & KPRINTINFO) { TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); Trace(KFuncEntryThisFormat8, &ptr8, this);}} |
126 |
126 |