os/kernelhwsrv/kerneltest/e32test/smr/d_trace.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // Bootstrap Shadow Memory Region Tests
    15 //
    16 
    17 #ifndef SMR_DEBUG_H
    18 #define SMR_DEBUG_H
    19 
    20 #include <e32err.h>
    21 #include <e32const.h>
    22 #include <e32def.h>
    23 #include <e32cmn.h>
    24 #include <e32des8.h>
    25 #include <kernel/kernel.h>
    26 
    27 
    28 // Make sure release builds get a warning if 
    29 //#ifndef _DEBUG
    30 //#if (defined SMR_TRACE)
    31 //#warning "Use of Kern::PrintF tracing in a release build, check MMP files"
    32 //#endif
    33 //#endif
    34 
    35 // Panic category string for SMR component
    36 _LIT(KSMRPanicCategory, "T_SMR");
    37 
    38 
    39 //
    40 // MACROs for trace statements in client/server code.
    41 //
    42 
    43 #ifdef SMR_TRACE
    44 
    45 #define SMR_LOG0(_text)		Kern::Printf((_text))
    46 #define SMR_LOG1(_text, _a1)	Kern::Printf((_text), (_a1))
    47 #define SMR_LOG_RETURN(_r1)	{ Kern::Printf("!-- Function exit : %d", (_r1)); \
    48                                 return (_r1); } 
    49 #define SMR_LOGMSG_RETURN(_s1, _r1)	{ Kern::Printf("!-- "_s1" (%d)", (_r1)); \
    50                                 return (_r1); } 
    51 
    52 #define SMR_TRACE0(_text)	Kern::Printf((_text))
    53 #define SMR_TRACE1(_text, _a1)	Kern::Printf((_text), (_a1))
    54 #define SMR_TRACE2(_text, _a1, _a2)	Kern::Printf((_text), (_a1), (_a2))
    55 #define SMR_TRACE3(_text, _a1, _a2, _a3)	Kern::Printf((_text), (_a1), (_a2), (_a3))
    56 #define SMR_TRACE4(_text, _a1, _a2, _a3, _a4)	Kern::Printf((_text), (_a1), (_a2), (_a3), (_a4))
    57 #define SMR_TRACE5(_text, _a1, _a2, _a3, _a4, _a5)	Kern::Printf((_text), (_a1), (_a2), (_a3), (_a4), (_a5))
    58 #define SMR_TRACE6(_text, _a1, _a2, _a3, _a4, _a5, _a6)	Kern::Printf((_text), (_a1), (_a2), (_a3), (_a4), (_a5), (_a6))
    59 
    60 #define SMR_FUNC(_text)     TEntryExit _entryexit(_text)
    61 #define SMR_FUNCE(_text)	 Kern::Printf("--> "##_text)
    62 #define SMR_FUNCR(_text)	 Kern::Printf("<-- "##_text) 
    63 #define SMR_FUNCR_return(_text, _r1)	 { Kern::Printf("<-- "##_text##"\n"); \
    64                                             return (_r1); }
    65 
    66 #else
    67 
    68 #define SMR_LOG0(_text)		Kern::Printf(_L(_text))
    69 #define SMR_LOG1(_text, _a1)	Kern::Printf(_L(_text), (_a1))
    70 #define SMR_LOG_RETURN(_r1)	    { return (_r1); } 
    71 #define SMR_LOGMSG_RETURN(_s1, _r1)	{ return (_r1); } 
    72 
    73 
    74 #define SMR_TRACE0(_text)			
    75 #define SMR_TRACE1(_text, _a1)		
    76 #define SMR_TRACE2(_text, _a1, _a2)
    77 #define SMR_TRACE3(_text, _a1, _a2, _a3)	
    78 #define SMR_TRACE4(_text, _a1, _a2, _a3, _a4)
    79 #define SMR_TRACE5(_text, _a1, _a2, _a3, _a4, _a5)
    80 #define SMR_TRACE6(_text, _a1, _a2, _a3, _a4, _a5, _a6)
    81 
    82 #define SMR_FUNC(_text)   
    83 #define SMR_FUNCE(_text)	 
    84 #define SMR_FUNCR(_text)
    85 #define SMR_FUNCR_return(_text, _r1)	 { return (_r1); }
    86 
    87 #endif
    88 
    89 
    90 class TEntryExit
    91 {
    92 public:
    93     inline TEntryExit(const char *aFn);
    94     inline ~TEntryExit();
    95 
    96 public:
    97     const char* iName;
    98 };
    99 
   100 TEntryExit::TEntryExit(const char* aFn)
   101  : iName(aFn)
   102     {
   103     SMR_TRACE1("--> %s " , iName);
   104     };
   105 
   106 TEntryExit::~TEntryExit()
   107     {
   108     SMR_TRACE1("<-- %s " , iName);
   109     };
   110     
   111 
   112 #endif // SMR_DEBUG_H
   113