1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/kerneltest/e32test/smr/d_trace.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,113 @@
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 +// Bootstrap Shadow Memory Region Tests
1.18 +//
1.19 +
1.20 +#ifndef SMR_DEBUG_H
1.21 +#define SMR_DEBUG_H
1.22 +
1.23 +#include <e32err.h>
1.24 +#include <e32const.h>
1.25 +#include <e32def.h>
1.26 +#include <e32cmn.h>
1.27 +#include <e32des8.h>
1.28 +#include <kernel/kernel.h>
1.29 +
1.30 +
1.31 +// Make sure release builds get a warning if
1.32 +//#ifndef _DEBUG
1.33 +//#if (defined SMR_TRACE)
1.34 +//#warning "Use of Kern::PrintF tracing in a release build, check MMP files"
1.35 +//#endif
1.36 +//#endif
1.37 +
1.38 +// Panic category string for SMR component
1.39 +_LIT(KSMRPanicCategory, "T_SMR");
1.40 +
1.41 +
1.42 +//
1.43 +// MACROs for trace statements in client/server code.
1.44 +//
1.45 +
1.46 +#ifdef SMR_TRACE
1.47 +
1.48 +#define SMR_LOG0(_text) Kern::Printf((_text))
1.49 +#define SMR_LOG1(_text, _a1) Kern::Printf((_text), (_a1))
1.50 +#define SMR_LOG_RETURN(_r1) { Kern::Printf("!-- Function exit : %d", (_r1)); \
1.51 + return (_r1); }
1.52 +#define SMR_LOGMSG_RETURN(_s1, _r1) { Kern::Printf("!-- "_s1" (%d)", (_r1)); \
1.53 + return (_r1); }
1.54 +
1.55 +#define SMR_TRACE0(_text) Kern::Printf((_text))
1.56 +#define SMR_TRACE1(_text, _a1) Kern::Printf((_text), (_a1))
1.57 +#define SMR_TRACE2(_text, _a1, _a2) Kern::Printf((_text), (_a1), (_a2))
1.58 +#define SMR_TRACE3(_text, _a1, _a2, _a3) Kern::Printf((_text), (_a1), (_a2), (_a3))
1.59 +#define SMR_TRACE4(_text, _a1, _a2, _a3, _a4) Kern::Printf((_text), (_a1), (_a2), (_a3), (_a4))
1.60 +#define SMR_TRACE5(_text, _a1, _a2, _a3, _a4, _a5) Kern::Printf((_text), (_a1), (_a2), (_a3), (_a4), (_a5))
1.61 +#define SMR_TRACE6(_text, _a1, _a2, _a3, _a4, _a5, _a6) Kern::Printf((_text), (_a1), (_a2), (_a3), (_a4), (_a5), (_a6))
1.62 +
1.63 +#define SMR_FUNC(_text) TEntryExit _entryexit(_text)
1.64 +#define SMR_FUNCE(_text) Kern::Printf("--> "##_text)
1.65 +#define SMR_FUNCR(_text) Kern::Printf("<-- "##_text)
1.66 +#define SMR_FUNCR_return(_text, _r1) { Kern::Printf("<-- "##_text##"\n"); \
1.67 + return (_r1); }
1.68 +
1.69 +#else
1.70 +
1.71 +#define SMR_LOG0(_text) Kern::Printf(_L(_text))
1.72 +#define SMR_LOG1(_text, _a1) Kern::Printf(_L(_text), (_a1))
1.73 +#define SMR_LOG_RETURN(_r1) { return (_r1); }
1.74 +#define SMR_LOGMSG_RETURN(_s1, _r1) { return (_r1); }
1.75 +
1.76 +
1.77 +#define SMR_TRACE0(_text)
1.78 +#define SMR_TRACE1(_text, _a1)
1.79 +#define SMR_TRACE2(_text, _a1, _a2)
1.80 +#define SMR_TRACE3(_text, _a1, _a2, _a3)
1.81 +#define SMR_TRACE4(_text, _a1, _a2, _a3, _a4)
1.82 +#define SMR_TRACE5(_text, _a1, _a2, _a3, _a4, _a5)
1.83 +#define SMR_TRACE6(_text, _a1, _a2, _a3, _a4, _a5, _a6)
1.84 +
1.85 +#define SMR_FUNC(_text)
1.86 +#define SMR_FUNCE(_text)
1.87 +#define SMR_FUNCR(_text)
1.88 +#define SMR_FUNCR_return(_text, _r1) { return (_r1); }
1.89 +
1.90 +#endif
1.91 +
1.92 +
1.93 +class TEntryExit
1.94 +{
1.95 +public:
1.96 + inline TEntryExit(const char *aFn);
1.97 + inline ~TEntryExit();
1.98 +
1.99 +public:
1.100 + const char* iName;
1.101 +};
1.102 +
1.103 +TEntryExit::TEntryExit(const char* aFn)
1.104 + : iName(aFn)
1.105 + {
1.106 + SMR_TRACE1("--> %s " , iName);
1.107 + };
1.108 +
1.109 +TEntryExit::~TEntryExit()
1.110 + {
1.111 + SMR_TRACE1("<-- %s " , iName);
1.112 + };
1.113 +
1.114 +
1.115 +#endif // SMR_DEBUG_H
1.116 +