kerneltest/e32test/debug/d_btrace.cpp
changeset 0 a41df078684a
equal deleted inserted replaced
-1:000000000000 0:a41df078684a
       
     1 // Copyright (c) 2005-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 // e32\drivers\trace\btrace.cpp
       
    15 // 
       
    16 //
       
    17 
       
    18 #include <kernel/kern_priv.h>
       
    19 #include "platform.h"
       
    20 #include "d_btrace.h"
       
    21 
       
    22 
       
    23 class DBTraceTestFactory : public DLogicalDevice
       
    24 	{
       
    25 public:
       
    26 	virtual TInt Install();
       
    27 	virtual void GetCaps(TDes8& aDes) const;
       
    28 	virtual TInt Create(DLogicalChannelBase*& aChannel);
       
    29 	};
       
    30 
       
    31 
       
    32 class DBTraceTestChannel : public DLogicalChannelBase
       
    33 	{
       
    34 public:
       
    35 	DBTraceTestChannel();
       
    36 	virtual ~DBTraceTestChannel();
       
    37 	//	Inherited from DObject
       
    38 	virtual TInt RequestUserHandle(DThread* aThread, TOwnerType aType);
       
    39 	// Inherited from DLogicalChannelBase
       
    40 	virtual TInt DoCreate(TInt aUnit, const TDesC8* anInfo, const TVersion& aVer);
       
    41 	virtual TInt Request(TInt aReqNo, TAny* a1, TAny* a2);
       
    42 private:
       
    43 	DThread* iClient;
       
    44 public:
       
    45 	static void TestTrace(DBTraceTestChannel* aSelf);
       
    46 	static void TestUTrace(DBTraceTestChannel* aSelf);
       
    47 private:
       
    48 	TUint32 iTestType;
       
    49 	TInt iTestDataSize;
       
    50 	TUint32 iTestData[KMaxBTraceRecordSize*2/4];
       
    51 	volatile TBool iTimerExpired;
       
    52 	NTimer iTraceTimer;
       
    53 	TDfc iTraceIDFC;
       
    54 	};
       
    55 
       
    56 
       
    57 //
       
    58 // DBTraceTestFactory
       
    59 //
       
    60 
       
    61 TInt DBTraceTestFactory::Install()
       
    62 	{
       
    63 	return SetName(&RBTraceTest::Name());
       
    64 	}
       
    65 
       
    66 void DBTraceTestFactory::GetCaps(TDes8& aDes) const
       
    67 	{
       
    68 	Kern::InfoCopy(aDes,0,0);
       
    69 	}
       
    70 
       
    71 TInt DBTraceTestFactory::Create(DLogicalChannelBase*& aChannel)
       
    72 	{
       
    73 	aChannel=new DBTraceTestChannel();
       
    74 	if(!aChannel)
       
    75 		return KErrNoMemory;
       
    76 	return KErrNone;
       
    77 	}
       
    78 
       
    79 
       
    80 //
       
    81 // DBTraceTestChannel
       
    82 //
       
    83 
       
    84 DBTraceTestChannel::DBTraceTestChannel()
       
    85 	: iTraceTimer((NTimerFn)TestTrace,this),
       
    86 	iTraceIDFC((NTimerFn)TestTrace,this)
       
    87 	{
       
    88 	}
       
    89 
       
    90 DBTraceTestChannel::~DBTraceTestChannel()
       
    91 	{
       
    92 	iTraceTimer.Cancel();
       
    93 	}
       
    94 
       
    95 TInt DBTraceTestChannel::DoCreate(TInt /*aUnit*/, const TDesC8* /*aInfo*/, const TVersion& /*aVer*/)
       
    96 	{
       
    97 	iClient = &Kern::CurrentThread();
       
    98 	return KErrNone;
       
    99 	}
       
   100 
       
   101 
       
   102 TInt DBTraceTestChannel::RequestUserHandle(DThread* aThread, TOwnerType aType)
       
   103 	{
       
   104 	if (aType!=EOwnerThread || aThread!=iClient)
       
   105 		return KErrAccessDenied;
       
   106 	return KErrNone;
       
   107 	}
       
   108 
       
   109 TInt DBTraceTestChannel::Request(TInt aReqNo, TAny* a1, TAny* a2)
       
   110 	{
       
   111 	switch(aReqNo)
       
   112 		{
       
   113 	// test functions
       
   114 	case RBTraceTest::ETestSpecialTrace:
       
   115 	case RBTraceTest::ETestTrace:
       
   116 		{
       
   117 		TPtr8 data((TUint8*)&iTestData,sizeof(iTestData));
       
   118 		Kern::KUDesGet(data,*(TDesC8*)a2);
       
   119 		iTestDataSize = data.Size()-4;
       
   120 		if(aReqNo==RBTraceTest::ETestSpecialTrace)
       
   121 			{
       
   122 			iTestType = (TUint)a1;
       
   123 			iTimerExpired = EFalse;
       
   124 			if(iTestType&RBTraceTest::EContextIsr)
       
   125 				iTraceTimer.OneShot(1);
       
   126 			else if(iTestType&RBTraceTest::EContextIDFC)
       
   127 				{
       
   128 				NKern::Lock();
       
   129 				iTraceIDFC.Add();
       
   130 				NKern::Unlock();
       
   131 				}
       
   132 			else if(iTestType&RBTraceTest::EContextIntsOff)
       
   133 				{
       
   134 				TInt irq = NKern::DisableAllInterrupts();
       
   135 				TestTrace(this);
       
   136 				NKern::RestoreInterrupts(irq);
       
   137 				}
       
   138 			else
       
   139 				TestTrace(this);
       
   140 			while(!__e32_atomic_load_acq32(&iTimerExpired)) {};
       
   141 			return (TInt)NKern::CurrentThread();
       
   142 			}
       
   143 		else
       
   144 			{
       
   145 			TInt delay = (TInt)a1/NKern::TickPeriod();
       
   146 			iTestType = 0;
       
   147 			if(!delay)
       
   148 				TestTrace(this);
       
   149 			else
       
   150 				{
       
   151 				iTraceTimer.Cancel();
       
   152 				iTraceTimer.OneShot(delay+1);
       
   153 				}
       
   154 			}
       
   155 		}
       
   156 		return KErrNone;
       
   157 
       
   158 	case RBTraceTest::ETestBenchmark:
       
   159 		{
       
   160 		TInt delay = (TInt)a2/NKern::TickPeriod();
       
   161 		TInt size = (TInt)a1;
       
   162 		iTestDataSize = -1;
       
   163 
       
   164 		// wait for next tick...
       
   165 		iTraceTimer.Cancel();
       
   166 		iTimerExpired = EFalse;
       
   167 		iTraceTimer.OneShot(1);
       
   168 		while(!__e32_atomic_load_acq32(&iTimerExpired)) {};
       
   169 
       
   170 		// do benchmark...
       
   171 		iTimerExpired = EFalse;
       
   172 		iTraceTimer.OneShot(delay+1);
       
   173 		TInt count = 0;
       
   174 		if(size)
       
   175 			for(;;)
       
   176 				{
       
   177 				TBool finished = __e32_atomic_load_acq32(&iTimerExpired);
       
   178 				BTraceContextN(BTrace::ETest1,0,0,0,&iTestData,size);
       
   179 				++count;
       
   180 				if(!finished)
       
   181 					continue;
       
   182 				break;
       
   183 				}
       
   184 		else
       
   185 			for(;;)
       
   186 				{
       
   187 				TBool finished = __e32_atomic_load_acq32(&iTimerExpired);
       
   188 				BTrace0(BTrace::ETest1,0);
       
   189 				++count;
       
   190 				if(!finished)
       
   191 					continue;
       
   192 				break;
       
   193 				}
       
   194 		return count;
       
   195 		}
       
   196 
       
   197 	case RBTraceTest::ETestBenchmark2:
       
   198 		{
       
   199 		TInt delay = (TInt)a2/NKern::TickPeriod();
       
   200 		TInt size = (TInt)a1;
       
   201 		iTestDataSize = -1;
       
   202 
       
   203 		// wait for next tick...
       
   204 		iTraceTimer.Cancel();
       
   205 		iTimerExpired = EFalse;
       
   206 		iTraceTimer.OneShot(1);
       
   207 		while(!__e32_atomic_load_acq32(&iTimerExpired)) {};
       
   208 
       
   209 		// do benchmark...
       
   210 		iTimerExpired = EFalse;
       
   211 		iTraceTimer.OneShot(delay+1);
       
   212 		TInt count = 0;
       
   213 		if(size)
       
   214 			for(;;)
       
   215 				{
       
   216 				TBool finished = __e32_atomic_load_acq32(&iTimerExpired);
       
   217 				BTraceFilteredContextN(BTrace::ETest1,0,KBTraceFilterTestUid1,0,&iTestData,size);
       
   218 				++count;
       
   219 				if(!finished)
       
   220 					continue;
       
   221 				break;
       
   222 				}
       
   223 		else
       
   224 			for(;;)
       
   225 				{
       
   226 				TBool finished = __e32_atomic_load_acq32(&iTimerExpired);
       
   227 				BTraceFiltered4(BTrace::ETest1,0,KBTraceFilterTestUid1);
       
   228 				++count;
       
   229 				if(!finished)
       
   230 					continue;
       
   231 				break;
       
   232 				}
       
   233 		return count;
       
   234 		}
       
   235 
       
   236 	case RBTraceTest::ETestBenchmarkCheckFilter:
       
   237 		{
       
   238 		TInt delay = (TInt)a2/NKern::TickPeriod();
       
   239 
       
   240 		// wait for next tick...
       
   241 		iTraceTimer.Cancel();
       
   242 		iTimerExpired = EFalse;
       
   243 		iTraceTimer.OneShot(1);
       
   244 		while(!__e32_atomic_load_acq32(&iTimerExpired)) {};
       
   245 
       
   246 		// do benchmark...
       
   247 		iTimerExpired = EFalse;
       
   248 		iTraceTimer.OneShot(delay+1);
       
   249 		TInt count = 0;
       
   250 		if(a1)
       
   251 			for(;;)
       
   252 				{
       
   253 				TBool finished = __e32_atomic_load_acq32(&iTimerExpired);
       
   254 				BTrace::CheckFilter2(BTrace::ETest1,KBTraceFilterTestUid1);
       
   255 				++count;
       
   256 				if(!finished)
       
   257 					continue;
       
   258 				break;
       
   259 				}
       
   260 		else
       
   261 			for(;;)
       
   262 				{
       
   263 				TBool finished = __e32_atomic_load_acq32(&iTimerExpired);
       
   264 				BTrace::CheckFilter(BTrace::ETest1);
       
   265 				++count;
       
   266 				if(!finished)
       
   267 					continue;
       
   268 				break;
       
   269 				}
       
   270 		return count;
       
   271 		}
       
   272 	case RBTraceTest::ETestUTrace:
       
   273 		{
       
   274 		TPtr8 data((TUint8*)&iTestData,sizeof(iTestData));
       
   275 		Kern::KUDesGet(data,*(TDesC8*)a2);
       
   276 		iTestDataSize = data.Size()-4;
       
   277 		TInt delay = (TInt)a1/NKern::TickPeriod();
       
   278 		iTestType = 0;
       
   279 		if(!delay)
       
   280 			TestUTrace(this);
       
   281 		else
       
   282 			{
       
   283 			iTraceTimer.Cancel();
       
   284 			iTraceTimer.OneShot(delay+1);
       
   285 			}
       
   286 		return KErrNone;
       
   287 		}
       
   288 
       
   289 	default:
       
   290 		break;
       
   291 		}
       
   292 	return KErrNotSupported;
       
   293 	}
       
   294 
       
   295 
       
   296 void DBTraceTestChannel::TestTrace(DBTraceTestChannel* aSelf)
       
   297 	{
       
   298 	TInt size = aSelf->iTestDataSize;
       
   299 	if(size<0)
       
   300 		{
       
   301 		__e32_atomic_store_rel32(&aSelf->iTimerExpired, 1);
       
   302 		return;
       
   303 		}
       
   304 	TUint32* data = aSelf->iTestData;
       
   305 	BTrace::TCategory category = (BTrace::TCategory)((TUint8*)data)[0];
       
   306 	TUint subCategory = (BTrace::TCategory)((TUint8*)data)[1];
       
   307 	TUint type = aSelf->iTestType&0xff;
       
   308 	TBool bigTrace = aSelf->iTestType&RBTraceTest::EBigTrace;
       
   309 	TBool filter2Trace = aSelf->iTestType&RBTraceTest::EFilter2Trace;
       
   310 
       
   311 	if(!filter2Trace)
       
   312 		{
       
   313 		if(type==BTrace::EPcPresent)
       
   314 			{
       
   315 			if(bigTrace)
       
   316 				{
       
   317 				BTracePcBig(category,subCategory,data[1],data+2,size-4);
       
   318 				BTracePcBig(category,subCategory,data[1],data+2,size-4);
       
   319 				}
       
   320 			else if(size==0)
       
   321 				{
       
   322 				BTracePc0(category,subCategory);
       
   323 				BTracePc0(category,subCategory);
       
   324 				}
       
   325 			else if(size<=4)
       
   326 				{
       
   327 				BTracePc4(category,subCategory,data[1]);
       
   328 				BTracePc4(category,subCategory,data[1]);
       
   329 				}
       
   330 			else if(size<=8)
       
   331 				{
       
   332 				BTracePc8(category,subCategory,data[1],data[2]);
       
   333 				BTracePc8(category,subCategory,data[1],data[2]);
       
   334 				}
       
   335 			else
       
   336 				{
       
   337 				BTracePcN(category,subCategory,data[1],data[2],data+3,size-8);
       
   338 				BTracePcN(category,subCategory,data[1],data[2],data+3,size-8);
       
   339 				}
       
   340 			}
       
   341 		else if(type==BTrace::EContextIdPresent)
       
   342 			{
       
   343 			if(bigTrace)
       
   344 				{
       
   345 				BTraceContextBig(category,subCategory,data[1],data+2,size-4);
       
   346 				BTraceContextBig(category,subCategory,data[1],data+2,size-4);
       
   347 				}
       
   348 			else if(size==0)
       
   349 				{
       
   350 				BTraceContext0(category,subCategory);
       
   351 				BTraceContext0(category,subCategory);
       
   352 				}
       
   353 			else if(size<=4)
       
   354 				{
       
   355 				BTraceContext4(category,subCategory,data[1]);
       
   356 				BTraceContext4(category,subCategory,data[1]);
       
   357 				}
       
   358 			else if(size<=8)
       
   359 				{
       
   360 				BTraceContext8(category,subCategory,data[1],data[2]);
       
   361 				BTraceContext8(category,subCategory,data[1],data[2]);
       
   362 				}
       
   363 			else
       
   364 				{
       
   365 				BTraceContextN(category,subCategory,data[1],data[2],data+3,size-8);
       
   366 				BTraceContextN(category,subCategory,data[1],data[2],data+3,size-8);
       
   367 				}
       
   368 			}
       
   369 		else if(type==BTrace::EContextIdPresent+BTrace::EPcPresent)
       
   370 			{
       
   371 			if(bigTrace)
       
   372 				{
       
   373 				BTraceContextPcBig(category,subCategory,data[1],data+2,size-4);
       
   374 				BTraceContextPcBig(category,subCategory,data[1],data+2,size-4);
       
   375 				}
       
   376 			else if(size==0)
       
   377 				{
       
   378 				BTraceContextPc0(category,subCategory);
       
   379 				BTraceContextPc0(category,subCategory);
       
   380 				}
       
   381 			else if(size<=4)
       
   382 				{
       
   383 				BTraceContextPc4(category,subCategory,data[1]);
       
   384 				BTraceContextPc4(category,subCategory,data[1]);
       
   385 				}
       
   386 			else if(size<=8)
       
   387 				{
       
   388 				BTraceContextPc8(category,subCategory,data[1],data[2]);
       
   389 				BTraceContextPc8(category,subCategory,data[1],data[2]);
       
   390 				}
       
   391 			else
       
   392 				{
       
   393 				BTraceContextPcN(category,subCategory,data[1],data[2],data+3,size-8);
       
   394 				BTraceContextPcN(category,subCategory,data[1],data[2],data+3,size-8);
       
   395 				}
       
   396 			}
       
   397 		else
       
   398 			{
       
   399 			if(bigTrace)
       
   400 				BTraceBig(category,subCategory,data[1],data+2,size-4);
       
   401 			else if(size==0)
       
   402 				BTrace0(category,subCategory);
       
   403 			else if(size<=4)
       
   404 				BTrace4(category,subCategory,data[1]);
       
   405 			else if(size<8)
       
   406 				BTrace8(category,subCategory,data[1],data[2]);
       
   407 			else
       
   408 				BTraceN(category,subCategory,data[1],data[2],data+3,size-8);
       
   409 			}
       
   410 		}
       
   411 	else
       
   412 		{
       
   413 		if(type==BTrace::EPcPresent)
       
   414 			{
       
   415 			if(bigTrace)
       
   416 				{
       
   417 				BTraceFilteredPcBig(category,subCategory,data[1],data+2,size-4);
       
   418 				BTraceFilteredPcBig(category,subCategory,data[1],data+2,size-4);
       
   419 				}
       
   420 			else if(size<4)
       
   421 				{
       
   422 				// invalid
       
   423 				}
       
   424 			else if(size==4)
       
   425 				{
       
   426 				BTraceFilteredPc4(category,subCategory,data[1]);
       
   427 				BTraceFilteredPc4(category,subCategory,data[1]);
       
   428 				}
       
   429 			else if(size<=8)
       
   430 				{
       
   431 				BTraceFilteredPc8(category,subCategory,data[1],data[2]);
       
   432 				BTraceFilteredPc8(category,subCategory,data[1],data[2]);
       
   433 				}
       
   434 			else
       
   435 				{
       
   436 				BTraceFilteredPcN(category,subCategory,data[1],data[2],data+3,size-8);
       
   437 				BTraceFilteredPcN(category,subCategory,data[1],data[2],data+3,size-8);
       
   438 				}
       
   439 			}
       
   440 		else if(type==BTrace::EContextIdPresent)
       
   441 			{
       
   442 			if(bigTrace)
       
   443 				{
       
   444 				BTraceFilteredContextBig(category,subCategory,data[1],data+2,size-4);
       
   445 				BTraceFilteredContextBig(category,subCategory,data[1],data+2,size-4);
       
   446 				}
       
   447 			else if(size<4)
       
   448 				{
       
   449 				// invalid
       
   450 				}
       
   451 			else if(size==4)
       
   452 				{
       
   453 				BTraceFilteredContext4(category,subCategory,data[1]);
       
   454 				BTraceFilteredContext4(category,subCategory,data[1]);
       
   455 				}
       
   456 			else if(size<=8)
       
   457 				{
       
   458 				BTraceFilteredContext8(category,subCategory,data[1],data[2]);
       
   459 				BTraceFilteredContext8(category,subCategory,data[1],data[2]);
       
   460 				}
       
   461 			else
       
   462 				{
       
   463 				BTraceFilteredContextN(category,subCategory,data[1],data[2],data+3,size-8);
       
   464 				BTraceFilteredContextN(category,subCategory,data[1],data[2],data+3,size-8);
       
   465 				}
       
   466 			}
       
   467 		else if(type==BTrace::EContextIdPresent+BTrace::EPcPresent)
       
   468 			{
       
   469 			if(bigTrace)
       
   470 				{
       
   471 				BTraceFilteredContextPcBig(category,subCategory,data[1],data+2,size-4);
       
   472 				BTraceFilteredContextPcBig(category,subCategory,data[1],data+2,size-4);
       
   473 				}
       
   474 			else if(size<4)
       
   475 				{
       
   476 				// invalid
       
   477 				}
       
   478 			else if(size==4)
       
   479 				{
       
   480 				BTraceFilteredContextPc4(category,subCategory,data[1]);
       
   481 				BTraceFilteredContextPc4(category,subCategory,data[1]);
       
   482 				}
       
   483 			else if(size<=8)
       
   484 				{
       
   485 				BTraceFilteredContextPc8(category,subCategory,data[1],data[2]);
       
   486 				BTraceFilteredContextPc8(category,subCategory,data[1],data[2]);
       
   487 				}
       
   488 			else
       
   489 				{
       
   490 				BTraceFilteredContextPcN(category,subCategory,data[1],data[2],data+3,size-8);
       
   491 				BTraceFilteredContextPcN(category,subCategory,data[1],data[2],data+3,size-8);
       
   492 				}
       
   493 			}
       
   494 		else
       
   495 			{
       
   496 			if(bigTrace)
       
   497 				BTraceFilteredBig(category,subCategory,data[1],data+2,size-4);
       
   498 			else if(size<4)
       
   499 				{
       
   500 				// invalid
       
   501 				}
       
   502 			else if(size==4)
       
   503 				BTraceFiltered4(category,subCategory,data[1]);
       
   504 			else if(size<8)
       
   505 				BTraceFiltered8(category,subCategory,data[1],data[2]);
       
   506 			else
       
   507 				BTraceFilteredN(category,subCategory,data[1],data[2],data+3,size-8);
       
   508 			}
       
   509 		}
       
   510 	__e32_atomic_store_rel32(&aSelf->iTimerExpired, 1);
       
   511 	}
       
   512 
       
   513 void DBTraceTestChannel::TestUTrace(DBTraceTestChannel* aSelf)
       
   514 	{
       
   515 	aSelf->iTimerExpired = ETrue;
       
   516 	TInt size = aSelf->iTestDataSize;
       
   517 	if(size<0)
       
   518 		return;
       
   519 	TUint32* data = aSelf->iTestData;
       
   520 	BTrace::TCategory category = (BTrace::TCategory)((TUint8*)data)[0];
       
   521 	TUint subCategory = (BTrace::TCategory)((TUint8*)data)[1];
       
   522 
       
   523 	#define T_UTRACE_HEADER(aSize,aClassification,aContext,aPc)																\
       
   524 		((((aSize) + (aContext?4:0) + (aPc?4:0)) << BTrace::ESizeIndex*8)										\
       
   525 		+(((aContext?BTrace::EContextIdPresent:0) | (aPc?BTrace::EPcPresent:0)) << BTrace::EFlagsIndex*8)			\
       
   526 		+((aClassification) << BTrace::ECategoryIndex*8)																				\
       
   527 		+((subCategory) << BTrace::ESubCategoryIndex*8))
       
   528 
       
   529 	#define UTRACE_SECONDARY(aClassification,aModuleUid,aThreadIdPresent,aPcPresent,aPc,aFormatId)	\
       
   530 		BTrace::OutFilteredPcFormatBig(T_UTRACE_HEADER(8,aClassification,aThreadIdPresent,aPcPresent),(TUint32)(aModuleUid),aPc,aFormatId,0,0)
       
   531 
       
   532 	#define UTRACE_SECONDARY_4(aClassification,aModuleUid,aThreadIdPresent,aPcPresent,aPc,aFormatId, aData1) \
       
   533 		BTrace::OutFilteredPcFormatBig(T_UTRACE_HEADER(8,aClassification,aThreadIdPresent,aPcPresent),(TUint32)(aModuleUid),aPc,aFormatId,&aData1,4)
       
   534 
       
   535 	#define UTRACE_SECONDARY_ANY(aClassification, aModuleUid, aThreadIdPresent, aPcPresent, aPc, aFormatId, aData, aDataSize) \
       
   536 		BTrace::OutFilteredPcFormatBig(T_UTRACE_HEADER(8,aClassification,aThreadIdPresent,aPcPresent),(TUint32)(aModuleUid),aPc,aFormatId,aData,(TInt)(aDataSize))
       
   537 
       
   538 
       
   539 	TUint32 KUtracePcValues[3]={0, 0x123456, 0x987654};
       
   540 	TUint16 formatId = (TUint16)data[2];
       
   541 	TUint type = aSelf->iTestType&0xff;
       
   542 	if(type == BTrace::EPcPresent)
       
   543 		{
       
   544 		if(size <= 0)
       
   545 			{
       
   546 			UTRACE_SECONDARY(category, data[1], EFalse, ETrue, KUtracePcValues[1], formatId);
       
   547 			UTRACE_SECONDARY(category, data[1], EFalse, ETrue, KUtracePcValues[2], formatId);
       
   548 			}
       
   549 		else if(size <= 4)
       
   550 			{
       
   551 			UTRACE_SECONDARY_4(category, data[1], EFalse, ETrue, KUtracePcValues[1], formatId, data[3]);
       
   552 			UTRACE_SECONDARY_4(category, data[1], EFalse, ETrue, KUtracePcValues[2], formatId, data[3]);
       
   553 			}
       
   554 		else //size > 8
       
   555 			{
       
   556 			UTRACE_SECONDARY_ANY(category, data[1], EFalse, ETrue, KUtracePcValues[1], formatId, data+3, size);
       
   557 			UTRACE_SECONDARY_ANY(category, data[1], EFalse, ETrue, KUtracePcValues[2], formatId, data+3, size);
       
   558 			}
       
   559 		}
       
   560 	else if(type==BTrace::EContextIdPresent)
       
   561 		{
       
   562 		if(size <= 0)
       
   563 			{
       
   564 			UTRACE_SECONDARY(category, data[1], ETrue, EFalse, KUtracePcValues[1], formatId);
       
   565 			UTRACE_SECONDARY(category, data[1], ETrue, EFalse, KUtracePcValues[2], formatId);
       
   566 			}
       
   567 		else if(size <= 4)
       
   568 			{
       
   569 			UTRACE_SECONDARY_4(category, data[1], ETrue, EFalse, KUtracePcValues[1], formatId, data[3]);
       
   570 			UTRACE_SECONDARY_4(category, data[1], ETrue, EFalse, KUtracePcValues[2], formatId, data[3]);
       
   571 			}
       
   572 		else //size > 8
       
   573 			{
       
   574 			UTRACE_SECONDARY_ANY(category, data[1], ETrue, EFalse, KUtracePcValues[1], formatId, data+3, size);
       
   575 			UTRACE_SECONDARY_ANY(category, data[1], ETrue, EFalse, KUtracePcValues[2], formatId, data+3, size);
       
   576 			}
       
   577 		}
       
   578 	else if(type==BTrace::EContextIdPresent+BTrace::EPcPresent)
       
   579 		{
       
   580 		if(size <= 0)
       
   581 			{
       
   582 			UTRACE_SECONDARY(category, data[1], ETrue, ETrue, KUtracePcValues[1], formatId);
       
   583 			UTRACE_SECONDARY(category, data[1], ETrue, ETrue, KUtracePcValues[2], formatId);
       
   584 			}
       
   585 		else if(size <= 4)
       
   586 			{
       
   587 			UTRACE_SECONDARY_4(category, data[1], ETrue, ETrue, KUtracePcValues[1], formatId, data[3]);
       
   588 			UTRACE_SECONDARY_4(category, data[1], ETrue, ETrue, KUtracePcValues[2], formatId, data[3]);
       
   589 			}
       
   590 		else //size > 8
       
   591 			{
       
   592 			UTRACE_SECONDARY_ANY(category, data[1], ETrue, ETrue, KUtracePcValues[1], formatId, data+3, size);
       
   593 			UTRACE_SECONDARY_ANY(category, data[1], ETrue, ETrue, KUtracePcValues[2], formatId, data+3, size);
       
   594 			}
       
   595 		}
       
   596 	else
       
   597 		{
       
   598 		if(size <= 0)
       
   599 			{
       
   600 			UTRACE_SECONDARY(category, data[1], EFalse, EFalse, KUtracePcValues[1], formatId);
       
   601 			UTRACE_SECONDARY(category, data[1], EFalse, EFalse, KUtracePcValues[2], formatId);
       
   602 			}
       
   603 		else if(size <= 4)
       
   604 			{
       
   605 			UTRACE_SECONDARY_4(category, data[1], EFalse, EFalse, KUtracePcValues[1], formatId, data[3]);
       
   606 			UTRACE_SECONDARY_4(category, data[1], EFalse, EFalse, KUtracePcValues[2], formatId, data[3]);
       
   607 			}
       
   608 		else //size > 8
       
   609 			{
       
   610 			UTRACE_SECONDARY_ANY(category, data[1], EFalse, EFalse, KUtracePcValues[1], formatId, data+3, size);
       
   611 			UTRACE_SECONDARY_ANY(category, data[1], EFalse, EFalse, KUtracePcValues[2], formatId, data+3, size);
       
   612 			}
       
   613 		}
       
   614 
       
   615 	}
       
   616 
       
   617 DECLARE_STANDARD_LDD()
       
   618 	{
       
   619 	return new DBTraceTestFactory;
       
   620 	}
       
   621 
       
   622