mtpfws/mtpfw/common/inc/mtpdebug.h
changeset 47 63cf70d3ecd8
parent 0 d0791faffa3f
--- a/mtpfws/mtpfw/common/inc/mtpdebug.h	Thu Sep 02 21:21:26 2010 +0300
+++ b/mtpfws/mtpfw/common/inc/mtpdebug.h	Fri Sep 17 08:34:51 2010 +0300
@@ -21,6 +21,9 @@
 #ifndef MTPDEBUG_H
 #define MTPDEBUG_H
 
+/*
+ *  Todo: keep these macros temporarily, will discard them at last
+ */
 #include <comms-infras/commsdebugutility.h>
 
 __FLOG_STMT(_LIT8(KMTPSubsystem, "MTP");)
@@ -39,4 +42,42 @@
 #define __MTP_HEAP_FLOG 
 #endif // __FLOG_ACTIVE
 
+/*
+ * Unlike __FLOG_ACTIVE, every component has its own macro OST_TRACE_COMPILER_IN_USE .
+ * Thus the macro won't be used in this header file.
+ */
+#define __MTP_HEAP_OSTTRACE(r) \
+    { \
+    TInt allocated; \
+    TInt largest; \
+    TInt available(User::Heap().Available(largest)); \
+    TInt size(User::Heap().Size()); \
+    User::Heap().AllocSize(allocated); \
+    r;\
+    }
+
+#define LEAVEIFERROR(err, trace) \
+{ \
+TInt munged_err=(err); \
+if (munged_err < 0) \
+{ \
+trace; \
+User::Leave(munged_err);\
+}\
+}
+
+#define TRACEPANIC(aReason, trace) \
+        { \
+        tp; \
+        User::Panic(KMyCategory, (aReason)); \
+        }
+        
+#if defined(_DEBUG)
+#define __ASSERT_DEBUG_OST(c,trace,p) if(!c) {trace; p;}
+#else
+#define __ASSERT_DEBUG_OST(c,trace,p)
+#endif
+
+#define __ASSERT_ALWAYS_OST(c,trace,p) if(!c) {trace; p;}
+
 #endif // MTPDEBUG_H