1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/userlibandfileserver/fileserver/shostmassstorage/msproxy/debug.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,125 @@
1.4 +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of the License "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +//
1.19 +
1.20 +/**
1.21 + @file
1.22 + @internalTechnology
1.23 +*/
1.24 +
1.25 +#ifndef PXY_DEBUG_H
1.26 +#define PXY_DEBUG_H
1.27 +
1.28 +// #define _HOST_DEBUG_TRACE_
1.29 +// #define _PROXY_DEBUG_PRINT_
1.30 +// #define _PROXY_FN_TRACE_
1.31 +
1.32 +#if defined(_PROXY_FN_TRACE_) && (defined(_DEBUG) || defined(_DEBUG_RELEASE))
1.33 +#define FUNCTION_TRACE_ENABLED
1.34 +#endif
1.35 +
1.36 +#if (defined(_DEBUG) || defined(_DEBUG_RELEASE))
1.37 +#include <e32debug.h>
1.38 +#endif
1.39 +
1.40 +#ifdef FUNCTION_TRACE_ENABLED
1.41 +/**
1.42 +Logging function to be used with static functions. Prints the function string on
1.43 +function entry and exit.
1.44 +*/
1.45 +class TLogStaticFn
1.46 + {
1.47 +public:
1.48 + static const TInt KLogBufferSize = 0xFF;
1.49 +
1.50 + TLogStaticFn(const TDesC8& aFunctionName);
1.51 +
1.52 + ~TLogStaticFn();
1.53 +
1.54 +protected:
1.55 + TBuf8<KLogBufferSize> buf;
1.56 + TPtrC8 iFunctionName;
1.57 + };
1.58 +
1.59 +
1.60 +/**
1.61 +Logging function which prints the function string on function entry and exit.
1.62 +*/
1.63 +class TLogFn
1.64 + {
1.65 +public:
1.66 + static const TInt KLogBufferSize = 0xFF;
1.67 + TLogFn(const TDesC8& aFunctionName, void* aThisPointer);
1.68 +
1.69 + ~TLogFn();
1.70 +
1.71 +private:
1.72 + TBuf8<KLogBufferSize> buf;
1.73 + TPtrC8 iFunctionName;
1.74 + void* iThisPointer;
1.75 + };
1.76 +
1.77 +#define __MSFNLOG TLogFn funcLog(TPtrC8((TUint8*)__PRETTY_FUNCTION__), this);
1.78 +#define __MSFNSLOG TLogStaticFn funcLog(TPtrC8((TUint8*)__PRETTY_FUNCTION__));
1.79 +#else // FUNCTION_TRACE_ENABLED
1.80 +#define __MSFNSLOG
1.81 +#define __MSFNLOG
1.82 +#endif // FUNCTION_TRACE_ENABLED
1.83 +
1.84 +
1.85 +#if defined (_PROXY_DEBUG_PRINT_) && (defined(_DEBUG) || defined(_DEBUG_RELEASE))
1.86 +#define __PXYPRINT(t) {RDebug::Print(t);}
1.87 +#define __PXYPRINT1(t,a) {RDebug::Print(t,a);}
1.88 +#define __PXYPRINT2(t,a,b) {RDebug::Print(t,a,b);}
1.89 +#define __PXYPRINT3(t,a,b,c) {RDebug::Print(t,a,b,c);}
1.90 +#define __PXYPRINT4(t,a,b,c,d) {RDebug::Print(t,a,b,c,d);}
1.91 +#define __PXYPRINT5(t,a,b,c,d,e) {RDebug::Print(t,a,b,c,d,e);}
1.92 +#define __PXYPRINT8BIT1(t,a) {TFileName temp;temp.Copy(a);RDebug::Print(t,&temp);}
1.93 +#define __PXYPRINT1TEMP(t,a) {TBuf<KMaxFileName>temp(a);RDebug::Print(t,&temp);}
1.94 +#else
1.95 +#define __PXYPRINT(t)
1.96 +#define __PXYPRINT1(t,a)
1.97 +#define __PXYPRINT2(t,a,b)
1.98 +#define __PXYPRINT3(t,a,b,c)
1.99 +#define __PXYPRINT4(t,a,b,c,d)
1.100 +#define __PXYPRINT5(t,a,b,c,d,e)
1.101 +#define __PXYPRINT8BIT1(t,a)
1.102 +#define __PXYPRINT1TEMP(t,a)
1.103 +#endif // _PROXY_DEBUG_PRINT_
1.104 +
1.105 +#if defined(_HOST_DEBUG_PRINT_) && (defined(_DEBUG) || defined(_DEBUG_RELEASE))
1.106 +#define __HOSTPRINT(t) {RDebug::Print(t);}
1.107 +#define __HOSTPRINT1(t,a) {RDebug::Print(t,a);}
1.108 +#define __HOSTPRINT2(t,a,b) {RDebug::Print(t,a,b);}
1.109 +#define __HOSTPRINT3(t,a,b,c) {RDebug::Print(t,a,b,c);}
1.110 +#define __HOSTPRINT4(t,a,b,c,d) {RDebug::Print(t,a,b,c,d);}
1.111 +#define __HOSTPRINT5(t,a,b,c,d,e) {RDebug::Print(t,a,b,c,d,e);}
1.112 +#define __HOSTPRINT8BIT1(t,a) {TFileName temp;temp.Copy(a);RDebug::Print(t,&temp);}
1.113 +#define __HOSTPRINT1TEMP(t,a) {TBuf<KMaxFileName>temp(a);RDebug::Print(t,&temp);}
1.114 +static const TUint KBlockSize = 0x200;
1.115 +#else
1.116 +#define __HOSTPRINT(t)
1.117 +#define __HOSTPRINT1(t,a)
1.118 +#define __HOSTPRINT2(t,a,b)
1.119 +#define __HOSTPRINT3(t,a,b,c)
1.120 +#define __HOSTPRINT4(t,a,b,c,d)
1.121 +#define __HOSTPRINT5(t,a,b,c,d,e)
1.122 +#define __HOSTPRINT8BIT1(t,a)
1.123 +#define __HOSTPRINT1TEMP(t,a)
1.124 +#endif // _HOST_DEBUG_PRINT_
1.125 +
1.126 +#endif // PXY_DEBUG_H
1.127 +
1.128 +