tracesrv/tracecompiler/test/TracesInHeadersApps/multmmp_comm_source_tracesplus/dll/src/HelloTraceFn.cpp
changeset 56 aa2539c91954
parent 41 838cdffd57ce
equal deleted inserted replaced
54:a151135b0cf9 56:aa2539c91954
       
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18  
       
    19 #include "HelloTraceFn.h"
       
    20 #include "HelloTraceFnDup.h"
       
    21 #include "HelloTraceFnDup2.inl"
       
    22 #include "HelloTracePanic.h"
       
    23 
       
    24 #include "OstTraceDefinitions.h"
       
    25 #ifdef OST_TRACE_COMPILER_IN_USE
       
    26 #include "HelloTraceFnTraces.h"
       
    27 #endif
       
    28 
       
    29 CHelloTraceFn* CHelloTraceFn::NewLC()
       
    30     {
       
    31     CHelloTraceFn* self = new (ELeave) CHelloTraceFn;
       
    32     CleanupStack::PushL(self);
       
    33     return self;
       
    34     }
       
    35 
       
    36 CHelloTraceFn* CHelloTraceFn::NewL()
       
    37     {
       
    38     CHelloTraceFn* self = CHelloTraceFn::NewLC();
       
    39     CleanupStack::Pop(self);
       
    40     return self;
       
    41     }
       
    42 
       
    43 CHelloTraceFn::CHelloTraceFn()
       
    44     {
       
    45     OstTrace1( TRACE_NORMAL, CHELLOTRACEFN_CHELLOTRACEFN_CTOR, "[0x%08x] Constructor", this );    
       
    46     }
       
    47 
       
    48 CHelloTraceFn::~CHelloTraceFn()
       
    49     {
       
    50     OstTrace1( TRACE_NORMAL, CHELLOTRACEFN_CHELLOTRACEFN_DTOR, "[0x%08x] Destructor", this );    
       
    51     }
       
    52 
       
    53 void CHelloTraceFn::Simple()
       
    54     {
       
    55     OstTraceFunctionEntry1( CHELLOTRACEFN_SIMPLE_ENTRY, this );
       
    56     // ...
       
    57     OstTraceFunctionExit1( CHELLOTRACEFN_SIMPLE_EXIT, this );
       
    58     }
       
    59 
       
    60 void CHelloTraceFn::OutputsParams(TInt aParam, TFnEnum aEnumParam)
       
    61     {
       
    62     OstTraceFunctionEntryExt( CHELLOTRACEFN_OUTPUTSPARAMS_ENTRY, this );
       
    63     Simple();
       
    64     OstTraceFunctionExit1( CHELLOTRACEFN_OUTPUTSPARAMS_EXIT, this );
       
    65     }
       
    66 
       
    67 void CHelloTraceFn::StaticOutputsParamsL(TInt aParam)
       
    68     {
       
    69     OstTraceFunctionEntryExt( CHELLOTRACEFN_STATICOUTPUTSPARAMS_ENTRY, NULL );
       
    70     CHelloTraceFn* example = CHelloTraceFn::NewLC();
       
    71     example->Simple();    
       
    72     CleanupStack::PopAndDestroy(example);
       
    73     OstTraceFunctionExit0( CHELLOTRACEFN_STATICOUTPUTSPARAMS_EXIT );    
       
    74     }
       
    75 
       
    76 void CHelloTraceFn::OutputsSignedIntegers(TInt8 aParam8,   TInt16 aParam16, 
       
    77                                           TInt32 aParam32, TInt64 aParam64)
       
    78     {
       
    79     OstTraceFunctionEntryExt( CHELLOTRACEFN_OUTPUTSSIGNEDINTEGERS_ENTRY, this );
       
    80     // ...
       
    81     OstTraceFunctionExit1( CHELLOTRACEFN_OUTPUTSSIGNEDINTEGERS_EXIT, this );
       
    82     }
       
    83 
       
    84 void CHelloTraceFn::OutputsUnsignedIntegers(TUint8 aParam8,   TUint16 aParam16, 
       
    85                                             TUint32 aParam32, TUint64 aParam64)
       
    86     {
       
    87     OstTraceFunctionEntryExt( CHELLOTRACEFN_OUTPUTSUNSIGNEDINTEGERS_ENTRY, this );
       
    88     // ...
       
    89     OstTraceFunctionExit1( CHELLOTRACEFN_OUTPUTSUNSIGNEDINTEGERS_EXIT, this );
       
    90     }
       
    91 
       
    92 
       
    93 TInt CHelloTraceFn::OutputsTIntReturnValue()
       
    94     {
       
    95     OstTraceFunctionEntry1( CHELLOTRACEFN_OUTPUTSTINTRETURNVALUE_ENTRY, this );
       
    96     TInt ret = KErrNone;
       
    97     // ...
       
    98     OstTraceFunctionExitExt( CHELLOTRACEFN_OUTPUTSTINTRETURNVALUE_EXIT, this, ret );
       
    99     return ret;
       
   100     }
       
   101 
       
   102 TInt64 CHelloTraceFn::OutputsTInt64ReturnValue()
       
   103     {
       
   104     OstTraceFunctionEntry1( CHELLOTRACEFN_OUTPUTSTINT64RETURNVALUE_ENTRY, this );
       
   105     TInt64 ret = (TInt64) 2 << 40;
       
   106     // ...
       
   107     OstTraceFunctionExitExt( CHELLOTRACEFN_OUTPUTSTINT64RETURNVALUE_EXIT, this, ret );
       
   108     return ret;
       
   109     }
       
   110 
       
   111 CHelloTraceFn::TFnEnum CHelloTraceFn::OutputsTFnEnumReturnValue()
       
   112     {
       
   113     OstTraceFunctionEntry1( CHELLOTRACEFN_OUTPUTSTFNENUMRETURNVALUE_ENTRY, this );
       
   114     TFnEnum ret = EExample1;
       
   115     // ...
       
   116     OstTraceFunctionExitExt( CHELLOTRACEFN_OUTPUTSTFNENUMRETURNVALUE_EXIT, this, ret );
       
   117     return ret;    
       
   118     }
       
   119 
       
   120 CActive* CHelloTraceFn::OutputsUnknownPtrType(CActive* aActive)
       
   121     {
       
   122     OstTraceFunctionEntryExt( CHELLOTRACEFN_OUTPUTSUNKNOWNPTRTYPE_ENTRY, this );    
       
   123     // ...
       
   124     OstTraceFunctionExitExt( CHELLOTRACEFN_OUTPUTSUNKNOWNPTRTYPE_EXIT, this, (TUint) aActive );
       
   125     return aActive;
       
   126     }
       
   127 
       
   128 CActive& CHelloTraceFn::OutputsUnknownRefType(CActive& aActive)
       
   129     {
       
   130     OstTraceFunctionEntryExt( CHELLOTRACEFN_OUTPUTSUNKNOWNREFTYPE_ENTRY, this );
       
   131     // ...
       
   132     OstTraceFunctionExitExt( CHELLOTRACEFN_OUTPUTSUNKNOWNREFTYPE_EXIT, this, (TUint) &aActive );    
       
   133     return aActive;
       
   134     }
       
   135 
       
   136 // The following doesn't compile as the Trace Compiler doesn't generate
       
   137 // the correct OstTraceGenExt(...) function for it
       
   138 //void CHelloTraceFn::OutputMissingParamsBug(TInt /*aCommentParam*/, TInt)
       
   139 //    {
       
   140 //    OstTraceFunctionEntryExt( CHELLOTRACEFN_OUTPUTMISSINGPARAMSBUG_ENTRY, this );
       
   141 //    // ...
       
   142 //    OstTraceFunctionExit1( CHELLOTRACEFN_OUTPUTMISSINGPARAMSBUG_EXIT, this );    
       
   143 //    }
       
   144 
       
   145 // The following compiles and works but outputs the following warning
       
   146 // warning: HelloTraceFn.cpp, line xxx: Parameter did not have a name and was not added to trace
       
   147 // The fact that this cannot be suppressed is a known problem we're working on.
       
   148 void CHelloTraceFn::OutputMissingParams(TInt aUsedParam, TInt /*aCommentParam*/, TInt)
       
   149     {
       
   150     OstTraceFunctionEntryExt( CHELLOTRACEFN_OUTPUTMISSINGPARAMS_ENTRY, this );
       
   151     // ...
       
   152     OstTraceFunctionExit1( CHELLOTRACEFN_OUTPUTMISSINGPARAMS_EXIT, this );
       
   153     }
       
   154 
       
   155 // The following doesn't work as the Trace Compiler outputs:
       
   156 // error: HelloTraceFn.cpp, line xxx: Class / function name for trace could not be determined x3
       
   157 //#ifdef _DEBUG
       
   158 //void CHelloTraceFn::PreProcessedFn(TInt aDbgParam)
       
   159 //    {
       
   160 //    OstTraceFunctionEntryExt( PRE_PROCESSED_ENTRTY_1, this );
       
   161 //#else
       
   162 //void CHelloTraceFn::PreProcessedFn()
       
   163 //    {
       
   164 //    OstTraceFunctionEntry1( PRE_PROCESSED_ENTRTY_2, this );
       
   165 //#endif
       
   166 //    Simple();
       
   167 //    OstTraceFunctionExit1( CHELLOTRACEFN_PREPROCESSEDFN_EXIT, this );
       
   168 //    }
       
   169 
       
   170 // Workaround example code until a proper fix is provided
       
   171 #ifdef _DEBUG
       
   172 void CHelloTraceFn::PreProcessedFn(TInt aDbgParam)
       
   173     {
       
   174     OstTraceExt2( TRACE_FLOW, CHELLOTRACEFN_PREPROCESSEDFN_ENTRY_1, "CHelloTraceFn::PreProcessedFn: > CHelloTraceFn::PreProcessedFn;aDbgParam=%d;this=%x", (TInt) aDbgParam, (TUint) this);
       
   175 #else
       
   176 void CHelloTraceFn::PreProcessedFn()
       
   177     {
       
   178     OstTrace1( TRACE_FLOW, CHELLOTRACEFN_PREPROCESSEDFN_ENTRY_2, "CHelloTraceFn::PreProcessedFn: > CHelloTraceFn::PreProcessedFn;this=%x", (TUint) this);
       
   179 #endif
       
   180     Simple();
       
   181     OstTrace1( TRACE_FLOW, CHELLOTRACEFN_PREPROCESSEDFN_EXIT, "CHelloTraceFn::PreProcessedFn: < CHelloTraceFn::PreProcessedFn;this=%x", (TUint) this);
       
   182     }
       
   183