mtpfws/mtpfw/common/inc/mtpdebug.h
author hgs
Thu, 04 Nov 2010 15:31:42 +0800
changeset 60 841f70763fbe
parent 49 c20dd21d1eb4
permissions -rw-r--r--
201044_04

// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
// All rights reserved.
// This component and the accompanying materials are made available
// under the terms of "Eclipse Public License v1.0"
// which accompanies this distribution, and is available
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
//
// Initial Contributors:
// Nokia Corporation - initial contribution.
//
// Contributors:
//
// Description:
//

/**
 @file
 @internalComponent
*/

#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");)

#ifdef __FLOG_ACTIVE
#define __MTP_HEAP_FLOG \
    { \
    TInt allocated; \
    TInt largest; \
    TInt available(User::Heap().Available(largest)); \
    TInt size(User::Heap().Size()); \
    User::Heap().AllocSize(allocated); \
    __FLOG_STATIC_VA((KMTPSubsystem, KComponent, _L8("Heap: Size = %d, Allocated = %d, Available = %d, Largest block = %d"), size, allocated, available, largest)); \
    }
#else
#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