os/kernelhwsrv/kernel/eka/debug/utrace/src/e32utrace.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200 (2012-06-15)
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of the License "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
// Trace API
sl@0
    15
//
sl@0
    16
sl@0
    17
#include <e32utf.h>
sl@0
    18
#include "traceutils.h"
sl@0
    19
sl@0
    20
sl@0
    21
//Add the Doxygen macro so that Doxygen doesn't need to know about the SYMBIAN_TRACE_EXECUTABLE_IS_INCLUDED define.
sl@0
    22
//This allows doxygen to pick up the comments for the enabled implementation of the trace API.
sl@0
    23
#ifdef __DOXYGEN__
sl@0
    24
	#define SYMBIAN_TRACE_EXECUTABLE_IS_INCLUDED
sl@0
    25
#endif //__DOXYGEN__
sl@0
    26
sl@0
    27
sl@0
    28
namespace UTF
sl@0
    29
{
sl@0
    30
sl@0
    31
sl@0
    32
/**
sl@0
    33
 * This method currently returns 0 until a fix is provided
sl@0
    34
 * for:
sl@0
    35
 * DPDEF110067	[Trace STP][ADP37] No Way for The Secondary Category to Be Set To Default
sl@0
    36
 * DEF119891	[TraceSTP] 1.4.1 Default the ModuleUid
sl@0
    37
 * This will in the future return the UID3 of the executable.
sl@0
    38
 *
sl@0
    39
 * @return Returns 0.
sl@0
    40
 */
sl@0
    41
EXPORT_C TModuleUid TTraceContext::DefaultModuleUid()
sl@0
    42
	{
sl@0
    43
	return 0;
sl@0
    44
	}
sl@0
    45
sl@0
    46
sl@0
    47
/**
sl@0
    48
 * Check if thread identification will be added by default.
sl@0
    49
 */
sl@0
    50
EXPORT_C THasThreadIdentification TTraceContext::HasThreadIdentification()  const
sl@0
    51
	{
sl@0
    52
	return iHasThreadIdentification;
sl@0
    53
	};
sl@0
    54
sl@0
    55
/**
sl@0
    56
 * Check if PC will be added by default.
sl@0
    57
 */
sl@0
    58
EXPORT_C THasProgramCounter TTraceContext::HasProgramCounter()  const
sl@0
    59
	{
sl@0
    60
	return iHasProgramCounter;
sl@0
    61
	};
sl@0
    62
sl@0
    63
sl@0
    64
/**
sl@0
    65
 * Get the current classification
sl@0
    66
 *
sl@0
    67
 * @return The current classification of the trace point context.
sl@0
    68
 */
sl@0
    69
EXPORT_C TClassification TTraceContext::Classification() const
sl@0
    70
	{
sl@0
    71
	return iClassification;
sl@0
    72
	};
sl@0
    73
sl@0
    74
/**
sl@0
    75
 * Get the current module Uid
sl@0
    76
 *
sl@0
    77
 * @return The currently set module Uid
sl@0
    78
 */
sl@0
    79
EXPORT_C TModuleUid TTraceContext::ModuleUid() const
sl@0
    80
	{
sl@0
    81
	return iModuleUid;
sl@0
    82
	}
sl@0
    83
sl@0
    84
sl@0
    85
//--------------------- UTrace compiled in ------------------------
sl@0
    86
#ifdef SYMBIAN_TRACE_EXECUTABLE_IS_INCLUDED
sl@0
    87
sl@0
    88
sl@0
    89
sl@0
    90
// --------- printf ------------
sl@0
    91
sl@0
    92
/**
sl@0
    93
Prints a string by outputting a trace packet with the format id KFormatPrintf.
sl@0
    94
sl@0
    95
If the specified string is too long to fit into a single trace packet
sl@0
    96
a multipart trace is generated.
sl@0
    97
sl@0
    98
@param aContext 	The trace packet context. @see TTraceContext
sl@0
    99
@param aDes			The string. This can be of variable length.
sl@0
   100
sl@0
   101
@return 			The trace packet was/was not output.
sl@0
   102
sl@0
   103
@See BTrace::TMultipart
sl@0
   104
*/
sl@0
   105
EXPORT_C TBool Print(const TTraceContext& aContext, const TDesC8& aDes)
sl@0
   106
	{
sl@0
   107
	if(WouldBeTracedNow(aContext))
sl@0
   108
		{
sl@0
   109
		GET_PC(pc);
sl@0
   110
		return UTRACE_SECONDARY_ANY(aContext.Classification(), aContext.ModuleUid(), aContext.HasThreadIdentification(), aContext.HasProgramCounter(), pc, KFormatPrintf, aDes.Ptr(), aDes.Size());
sl@0
   111
		}
sl@0
   112
	return EFalse;
sl@0
   113
	};
sl@0
   114
sl@0
   115
sl@0
   116
#ifdef  __KERNEL_MODE__
sl@0
   117
sl@0
   118
/**
sl@0
   119
Prints a formatted string in kernel mode only by outputting a trace packet with the format id KFormatPrintf.
sl@0
   120
sl@0
   121
The function uses Kern::AppendFormat() to do the formatting.
sl@0
   122
sl@0
   123
Although it is safe to call this function from an ISR, it polls the output
sl@0
   124
serial port and may take a long time to complete, invalidating any
sl@0
   125
real-time guarantee.
sl@0
   126
sl@0
   127
If called from an ISR, it is possible for output text to be intermingled
sl@0
   128
with other output text if one set of output interrupts or preempts another.
sl@0
   129
sl@0
   130
Some of the formatting options may not work inside an ISR.
sl@0
   131
sl@0
   132
Be careful not to use a string that is too long to fit onto the stack.
sl@0
   133
If the specified string is too long to fit into a single trace packet
sl@0
   134
a multipart trace is generated.
sl@0
   135
sl@0
   136
sl@0
   137
@param aContext 	The trace packet context. @see TTraceContext
sl@0
   138
@param aFmt 		The format string. This must not be longer than 256 characters.
sl@0
   139
@param ...			A variable number of arguments to be converted to text as dictated
sl@0
   140
					by the format string.
sl@0
   141
sl@0
   142
@return 			The trace packet was/was not output.
sl@0
   143
sl@0
   144
@pre Calling thread can either be in a critical section or not.
sl@0
   145
@pre Interrupts must be enabled.
sl@0
   146
@pre Kernel must be unlocked
sl@0
   147
@pre Call in any context.
sl@0
   148
@pre Suitable for use in a device driver
sl@0
   149
sl@0
   150
@see Kern::AppendFormat()
sl@0
   151
@See BTrace::TMultipart
sl@0
   152
sl@0
   153
Note: Until the Utrace packet format is changed this call will not add the
sl@0
   154
FormatId to the trace packet for kernel side traces.
sl@0
   155
*/
sl@0
   156
EXPORT_C TBool Printf(const TTraceContext& aContext, const char* aFmt, ...)
sl@0
   157
	{
sl@0
   158
	if(WouldBeTracedNow(aContext))
sl@0
   159
		{
sl@0
   160
		GET_PC(pc);
sl@0
   161
		TBuf8<KMaxPrintfSize> buf;
sl@0
   162
		VA_LIST list;
sl@0
   163
		VA_START(list,aFmt);
sl@0
   164
		Kern::AppendFormat(buf,aFmt,list);
sl@0
   165
		return UTRACE_SECONDARY_ANY(aContext.Classification(), aContext.ModuleUid(), aContext.HasThreadIdentification(), aContext.HasProgramCounter(), pc, KFormatPrintf, buf.Ptr(), buf.Size());
sl@0
   166
		}
sl@0
   167
	return EFalse;
sl@0
   168
	}
sl@0
   169
sl@0
   170
/**
sl@0
   171
Prints a formatted string by outputting a trace packet with the format id KFormatPrintf.
sl@0
   172
sl@0
   173
If the specified string is too long to fit into a single trace packet
sl@0
   174
a multipart trace is generated.
sl@0
   175
sl@0
   176
@param aContext 	The trace packet context. @see TTraceContext
sl@0
   177
@param aFmt 		The format string. This must not be longer than 256 characters.
sl@0
   178
@param ...			A variable number of arguments to be converted to text as dictated
sl@0
   179
					by the format string.
sl@0
   180
sl@0
   181
@return 			The trace packet was/was not output.
sl@0
   182
sl@0
   183
@See BTrace::TMultipart
sl@0
   184
*/
sl@0
   185
EXPORT_C TBool Printf(const TTraceContext& aContext, TRefByValue<const TDesC8> aFmt,...)
sl@0
   186
	{
sl@0
   187
	if(WouldBeTracedNow(aContext))
sl@0
   188
		{
sl@0
   189
		GET_PC(pc);
sl@0
   190
		TBuf8<KMaxPrintfSize> buf;
sl@0
   191
		VA_LIST list;
sl@0
   192
		VA_START(list,aFmt);
sl@0
   193
		TDesC8 fmt = aFmt;
sl@0
   194
		Kern::AppendFormat(buf,(char*)fmt.Ptr(),list);
sl@0
   195
		return UTRACE_SECONDARY_ANY(aContext.Classification(), aContext.ModuleUid(), aContext.HasThreadIdentification(), aContext.HasProgramCounter(), pc, KFormatPrintf, buf.Ptr(), buf.Size());
sl@0
   196
		}
sl@0
   197
	return EFalse;
sl@0
   198
	}
sl@0
   199
sl@0
   200
#endif // __KERNEL_MODE__
sl@0
   201
#ifndef __KERNEL_MODE__
sl@0
   202
sl@0
   203
/**
sl@0
   204
Prints a formatted string by outputting a trace packet with the format id KFormatPrintf.
sl@0
   205
sl@0
   206
sl@0
   207
If the specified string is too long to fit into a single trace packet
sl@0
   208
a multipart trace is generated.
sl@0
   209
sl@0
   210
@param aContext 	The trace packet context. @see TTraceContext
sl@0
   211
@param aFmt 		The format string. This must not be longer than 256 characters.
sl@0
   212
@param ...			A variable number of arguments to be converted to text as dictated
sl@0
   213
					by the format string.
sl@0
   214
sl@0
   215
@return 			The trace packet was/was not output.
sl@0
   216
sl@0
   217
@See BTrace::TMultipart
sl@0
   218
*/
sl@0
   219
EXPORT_C TBool Printf(const TTraceContext& aContext, const char* aFmt, ...)
sl@0
   220
	{
sl@0
   221
	if(WouldBeTracedNow(aContext))
sl@0
   222
		{
sl@0
   223
		GET_PC(pc);
sl@0
   224
		TTruncateOverflow8 overflow;
sl@0
   225
		VA_LIST list;
sl@0
   226
		VA_START(list,aFmt);
sl@0
   227
		TPtrC8 fmt((const TText8*)aFmt);
sl@0
   228
		TBuf8<KMaxPrintfSize> buf;
sl@0
   229
        // coverity[uninit_use_in_call]
sl@0
   230
		buf.AppendFormatList(fmt,list,&overflow);
sl@0
   231
		return UTRACE_SECONDARY_ANY(aContext.Classification(), aContext.ModuleUid(), aContext.HasThreadIdentification(), aContext.HasProgramCounter(), pc, KFormatPrintf, buf.Ptr(), buf.Size());
sl@0
   232
		}
sl@0
   233
	return EFalse;
sl@0
   234
	};
sl@0
   235
sl@0
   236
/**
sl@0
   237
Prints a formatted string by outputting a trace packet with the format id KFormatPrintf.
sl@0
   238
sl@0
   239
If the specified string is too long to fit into a single trace packet
sl@0
   240
a multipart trace is generated.
sl@0
   241
sl@0
   242
@param aContext 	The trace packet context. @see TTraceContext
sl@0
   243
@param aFmt 		The format string. This must not be longer than 256 characters.
sl@0
   244
@param ...			A variable number of arguments to be converted to text as dictated
sl@0
   245
					by the format string.
sl@0
   246
sl@0
   247
@return 			The trace packet was/was not output.
sl@0
   248
sl@0
   249
@See BTrace::TMultipart
sl@0
   250
*/
sl@0
   251
EXPORT_C TBool Printf(const TTraceContext& aContext, TRefByValue<const TDesC8> aFmt,...)
sl@0
   252
	{
sl@0
   253
	if(WouldBeTracedNow(aContext))
sl@0
   254
		{
sl@0
   255
		GET_PC(pc);
sl@0
   256
		TTruncateOverflow8 overflow;
sl@0
   257
		VA_LIST list;
sl@0
   258
		VA_START(list,aFmt);
sl@0
   259
		TBuf8<KMaxPrintfSize> buf;
sl@0
   260
        // coverity[uninit_use_in_call]
sl@0
   261
		buf.AppendFormatList(aFmt,list,&overflow);
sl@0
   262
		return UTRACE_SECONDARY_ANY(aContext.Classification(), aContext.ModuleUid(), aContext.HasThreadIdentification(), aContext.HasProgramCounter(), pc, KFormatPrintf, buf.Ptr(), buf.Size());
sl@0
   263
		}
sl@0
   264
	return EFalse;
sl@0
   265
	}
sl@0
   266
sl@0
   267
/**
sl@0
   268
Prints a formatted string by outputting a trace packet with the format id
sl@0
   269
KFormatPrintfUnicode for unicode strings and KFormatPrintf for other strings.
sl@0
   270
sl@0
   271
If the specified string is too long to fit into a single trace packet
sl@0
   272
a multipart trace is generated.
sl@0
   273
sl@0
   274
@param aContext 	The trace packet context. @see TTraceContext
sl@0
   275
@param aFmt 		The format string. This must not be longer than 256 characters.
sl@0
   276
@param ...			A variable number of arguments to be converted to text as dictated
sl@0
   277
					by the format string.
sl@0
   278
sl@0
   279
@return 			The trace packet was/was not output.
sl@0
   280
sl@0
   281
@See BTrace::TMultipart
sl@0
   282
*/
sl@0
   283
EXPORT_C TBool Printf(const TTraceContext& aContext, TRefByValue<const TDesC16> aFmt,...)
sl@0
   284
	{
sl@0
   285
	if(WouldBeTracedNow(aContext))
sl@0
   286
		{
sl@0
   287
		GET_PC(pc);
sl@0
   288
		TTruncateOverflow16 overflow;
sl@0
   289
		VA_LIST list;
sl@0
   290
		VA_START(list,aFmt);
sl@0
   291
		TBuf<KMaxPrintfSize> buf;
sl@0
   292
	    // coverity[uninit_use_in_call]
sl@0
   293
		buf.AppendFormatList(aFmt,list,&overflow);
sl@0
   294
		#ifndef _UNICODE
sl@0
   295
		TPtr8 p(buf.Collapse());
sl@0
   296
		return UTRACE_SECONDARY_ANY(aContext.Classification(), aContext.ModuleUid(), aContext.HasThreadIdentification(), aContext.HasProgramCounter(), myPc, KFormatPrintf, buf.PtrZ(), p.Size());
sl@0
   297
		#else //_UNICODE
sl@0
   298
		return UTRACE_SECONDARY_ANY(aContext.Classification(), aContext.ModuleUid(), aContext.HasThreadIdentification(), aContext.HasProgramCounter(), pc, KFormatPrintfUnicode, buf.PtrZ(), buf.Size());
sl@0
   299
		#endif //_UNICODE
sl@0
   300
		}
sl@0
   301
	return EFalse;
sl@0
   302
	};
sl@0
   303
sl@0
   304
sl@0
   305
/**
sl@0
   306
Prints a string by outputting a trace packet with the format id KFormatPrintf
sl@0
   307
sl@0
   308
If the specified string is too long to fit into a single trace packet
sl@0
   309
a multipart trace is generated.
sl@0
   310
sl@0
   311
@param aContext 	The trace packet context. @see TTraceContext
sl@0
   312
@param aDes			The string. This must not be longer than 256 characters.
sl@0
   313
sl@0
   314
@return 			The trace packet was/was not output.
sl@0
   315
sl@0
   316
@See BTrace::TMultipart
sl@0
   317
*/
sl@0
   318
EXPORT_C TBool Print(const TTraceContext& aContext, const TDesC16& aDes)
sl@0
   319
	{
sl@0
   320
	if(WouldBeTracedNow(aContext))
sl@0
   321
		{
sl@0
   322
		GET_PC(pc);
sl@0
   323
		return UTRACE_SECONDARY_ANY(aContext.Classification(), aContext.ModuleUid(), aContext.HasThreadIdentification(), aContext.HasProgramCounter(), pc, KFormatPrintfUnicode, aDes.Ptr(), aDes.Size());
sl@0
   324
		}
sl@0
   325
	return EFalse;
sl@0
   326
	}
sl@0
   327
#endif // __KERNEL_MODE__
sl@0
   328
sl@0
   329
sl@0
   330
// --------- trace ------------
sl@0
   331
sl@0
   332
/**
sl@0
   333
Outputs a trace packet containing no payload data.
sl@0
   334
sl@0
   335
@param aContext 	The trace packet context. @see TTraceContext
sl@0
   336
@param aFormatId	A format identifier as specified by @see TFormatId
sl@0
   337
sl@0
   338
@return		 		The trace packet was/was not output.
sl@0
   339
*/
sl@0
   340
EXPORT_C TBool Trace(const TTraceContext& aContext, TFormatId aFormatId)
sl@0
   341
	{
sl@0
   342
	GET_PC(pc);
sl@0
   343
	return UTRACE_SECONDARY_0(aContext.Classification(),aContext.ModuleUid(),aContext.HasThreadIdentification(),aContext.HasProgramCounter(), pc, aFormatId);
sl@0
   344
	}
sl@0
   345
sl@0
   346
/**
sl@0
   347
Outputs a trace packet containing 4 bytes of data.
sl@0
   348
sl@0
   349
@param aContext 	The trace packet context. @see TTraceContext
sl@0
   350
@param aFormatId	A format identifier as specified by @see TFormatId
sl@0
   351
@param aData		4 bytes of data
sl@0
   352
sl@0
   353
@return 		The trace packet was/was not output.
sl@0
   354
*/
sl@0
   355
EXPORT_C TBool Trace(const TTraceContext& aContext, TFormatId aFormatId, TUint32 aData)
sl@0
   356
	{
sl@0
   357
	GET_PC(pc);
sl@0
   358
	return UTRACE_SECONDARY_1(aContext.Classification(),aContext.ModuleUid(),aContext.HasThreadIdentification(),aContext.HasProgramCounter(),pc,aFormatId,aData);
sl@0
   359
	}
sl@0
   360
sl@0
   361
/**
sl@0
   362
Outputs a trace packet containing 8 bytes of data.
sl@0
   363
sl@0
   364
@param aContext 	The trace packet context. @see TTraceContext
sl@0
   365
@param aFormatId	A format identifier as specified by @see TFormatId
sl@0
   366
@param aData1		4 bytes of data
sl@0
   367
@param aData2		4 bytes of data
sl@0
   368
sl@0
   369
@return 		The trace packet was/was not output.
sl@0
   370
*/
sl@0
   371
EXPORT_C TBool Trace(const TTraceContext& aContext, TFormatId aFormatId, TUint32 aData1, TUint32 aData2)
sl@0
   372
	{
sl@0
   373
	GET_PC(pc);
sl@0
   374
	TUint32 packet[2];
sl@0
   375
	packet[0] = aData1;
sl@0
   376
	packet[1] = aData2;
sl@0
   377
	return UTRACE_SECONDARY_ANY(aContext.Classification(), aContext.ModuleUid(), aContext.HasThreadIdentification(), aContext.HasProgramCounter(), pc, aFormatId, &packet, 8);
sl@0
   378
	}
sl@0
   379
sl@0
   380
/**
sl@0
   381
Outputs a trace packet containing variable length data.
sl@0
   382
sl@0
   383
If the specified data is too big to fit into a single
sl@0
   384
trace packet a multipart trace is generated.
sl@0
   385
sl@0
   386
sl@0
   387
@param aContext 	The trace packet context. @see TTraceContext
sl@0
   388
@param aFormatId	A format identifier as specified by @see TFormatId
sl@0
   389
@param aData		Address of additional data to add to trace packet.
sl@0
   390
					Must be word aligned, i.e. a multiple of 4.
sl@0
   391
@param aSize		Number of bytes of additional data.
sl@0
   392
sl@0
   393
@return 			The trace packet was/was not output.
sl@0
   394
sl@0
   395
@See BTrace::TMultipart
sl@0
   396
*/
sl@0
   397
EXPORT_C TBool Trace(const TTraceContext& aContext, TFormatId aFormatId, const TAny* aData, TInt aSize)
sl@0
   398
	{
sl@0
   399
	if(WouldBeTracedNow(aContext))
sl@0
   400
		{
sl@0
   401
		GET_PC(pc);
sl@0
   402
		return UTRACE_SECONDARY_ANY(aContext.Classification(), aContext.ModuleUid(), aContext.HasThreadIdentification(), aContext.HasProgramCounter(), pc, aFormatId, aData, aSize);
sl@0
   403
		}
sl@0
   404
	return EFalse;
sl@0
   405
	}
sl@0
   406
sl@0
   407
/**
sl@0
   408
Outputs a trace packet containing 4 bytes of data.
sl@0
   409
sl@0
   410
@param aContext 	The trace packet context. @see TTraceContext
sl@0
   411
@param aFormatId	A format identifier as specified by @see TFormatId
sl@0
   412
@param aData		4 bytes of data
sl@0
   413
sl@0
   414
@return 		The trace packet was/was not output.
sl@0
   415
*/
sl@0
   416
EXPORT_C TBool Trace(const TTraceContext& aContext, const TFormatId aFormatId, const TUint16 aData)
sl@0
   417
	{
sl@0
   418
	GET_PC(pc);
sl@0
   419
	return UTRACE_SECONDARY_1(aContext.Classification(),aContext.ModuleUid(),aContext.HasThreadIdentification(),aContext.HasProgramCounter(),pc,aFormatId,aData);
sl@0
   420
	}
sl@0
   421
sl@0
   422
/**
sl@0
   423
Outputs a trace packet containing 4 bytes of data.
sl@0
   424
sl@0
   425
@param aContext 	The trace packet context. @see TTraceContext
sl@0
   426
@param aFormatId	A format identifier as specified by @see TFormatId
sl@0
   427
@param aData		4 bytes of data
sl@0
   428
sl@0
   429
@return 		The trace packet was/was not output.
sl@0
   430
*/
sl@0
   431
EXPORT_C TBool Trace(const TTraceContext& aContext, const TFormatId aFormatId, const TUint8 aData)
sl@0
   432
	{
sl@0
   433
	GET_PC(pc);
sl@0
   434
	return UTRACE_SECONDARY_1(aContext.Classification(),aContext.ModuleUid(),aContext.HasThreadIdentification(),aContext.HasProgramCounter(),pc,aFormatId,aData);
sl@0
   435
	}
sl@0
   436
sl@0
   437
#ifndef __KERNEL_MODE__
sl@0
   438
/**
sl@0
   439
Outputs a trace packet containing variable length data.
sl@0
   440
sl@0
   441
If the specified data is too big to fit into a single
sl@0
   442
trace record a multipart trace is generated.
sl@0
   443
sl@0
   444
@param aContext 	Attributes of the trace point.
sl@0
   445
@param aFormatId	A format identifier as specified by @see TFormatId
sl@0
   446
@param aData		Additional data to add to trace packet.
sl@0
   447
					Must be word aligned, i.e. a multiple of 4.
sl@0
   448
sl@0
   449
@return 			The trace packet was/was not logged.
sl@0
   450
sl@0
   451
@See BTrace::TMultipart
sl@0
   452
*/
sl@0
   453
EXPORT_C TBool Trace(const TTraceContext& aContext, const TFormatId aFormatId, const TDesC16& aData)
sl@0
   454
	{
sl@0
   455
	if(WouldBeTracedNow(aContext))
sl@0
   456
		{
sl@0
   457
		GET_PC(pc);
sl@0
   458
		return UTRACE_SECONDARY_ANY(aContext.Classification(), aContext.ModuleUid(), aContext.HasThreadIdentification(), aContext.HasProgramCounter(), pc, aFormatId, aData.Ptr(), aData.Size());
sl@0
   459
		}
sl@0
   460
	return EFalse;
sl@0
   461
	}
sl@0
   462
#endif //__KERNEL_MODE__
sl@0
   463
sl@0
   464
/**
sl@0
   465
Outputs a trace packet containing variable length data.
sl@0
   466
sl@0
   467
If the specified data is too big to fit into a single
sl@0
   468
trace record a multipart trace is generated.
sl@0
   469
sl@0
   470
@param aContext 	Attributes of the trace point.
sl@0
   471
@param aFormatId	A format identifier as specified by @see TFormatId
sl@0
   472
@param aData		Additional data to add to trace packet.
sl@0
   473
					Must be word aligned, i.e. a multiple of 4.
sl@0
   474
sl@0
   475
@return 			The trace packet was/was not logged.
sl@0
   476
sl@0
   477
@See BTrace::TMultipart
sl@0
   478
*/
sl@0
   479
EXPORT_C TBool Trace(const TTraceContext& aContext, const TFormatId aFormatId, const TDesC8& aData)
sl@0
   480
	{
sl@0
   481
	if(WouldBeTracedNow(aContext))
sl@0
   482
		{
sl@0
   483
		GET_PC(pc);
sl@0
   484
		return UTRACE_SECONDARY_ANY(aContext.Classification(), aContext.ModuleUid(), aContext.HasThreadIdentification(), aContext.HasProgramCounter(), pc, aFormatId, aData.Ptr(), aData.Size());
sl@0
   485
		}
sl@0
   486
	return EFalse;
sl@0
   487
	}
sl@0
   488
sl@0
   489
sl@0
   490
sl@0
   491
/**
sl@0
   492
 * Check whether a trace packet would be traced or not.
sl@0
   493
 *
sl@0
   494
 * @param aContext The context of the trace packet(s) to be checked.
sl@0
   495
 * @return Returns whether the trace packet would be traced or not.
sl@0
   496
 * Note: The value should never be stored since the filters can be changed without warning.
sl@0
   497
 */
sl@0
   498
EXPORT_C TBool WouldBeTracedNow(const TTraceContext& aContext)
sl@0
   499
	{
sl@0
   500
	return BTrace::CheckFilter2(aContext.Classification(), aContext.ModuleUid());
sl@0
   501
	};
sl@0
   502
sl@0
   503
//--------------------- UTrace compiled out ------------------------
sl@0
   504
sl@0
   505
#else //SYMBIAN_TRACE_EXECUTABLE_IS_INCLUDED
sl@0
   506
sl@0
   507
//--------printf
sl@0
   508
EXPORT_C TBool Printf(const TTraceContext&, const char*, ...) { return EFalse; }
sl@0
   509
EXPORT_C TBool Print(const TTraceContext&, const TDesC8&) { return EFalse; }
sl@0
   510
EXPORT_C TBool Printf(const TTraceContext&, TRefByValue<const TDesC8> ,...) { return EFalse; }
sl@0
   511
#ifndef  __KERNEL_MODE__
sl@0
   512
EXPORT_C TBool Printf(const TTraceContext&, TRefByValue<const TDesC16>,...) { return EFalse; }
sl@0
   513
EXPORT_C TBool Print(const TTraceContext&, const TDesC16&) { return EFalse; }
sl@0
   514
#endif //__KERNEL_MODE__
sl@0
   515
sl@0
   516
//--------trace
sl@0
   517
EXPORT_C TBool Trace(const TTraceContext&, TFormatId) { return EFalse; }
sl@0
   518
EXPORT_C TBool Trace(const TTraceContext&, TFormatId, TUint32) { return EFalse; }
sl@0
   519
EXPORT_C TBool Trace(const TTraceContext&, TFormatId, TUint32, TUint32) { return EFalse; }
sl@0
   520
EXPORT_C TBool Trace(const TTraceContext&, TFormatId, const TAny*, TInt) { return EFalse; }
sl@0
   521
sl@0
   522
EXPORT_C TBool Trace(const TTraceContext&, const TFormatId, const TUint8) { return EFalse; }
sl@0
   523
EXPORT_C TBool Trace(const TTraceContext&, const TFormatId, const TUint16) { return EFalse; }
sl@0
   524
EXPORT_C TBool Trace(const TTraceContext&, const TFormatId, const TDesC8&) { return EFalse; }
sl@0
   525
#ifndef __KERNEL_MODE__
sl@0
   526
EXPORT_C TBool Trace(const TTraceContext&, const TFormatId, const TDesC16&) { return EFalse; }
sl@0
   527
#endif
sl@0
   528
EXPORT_C TBool WouldBeTracedNow(const TTraceContext&) { return EFalse; }
sl@0
   529
sl@0
   530
sl@0
   531
#endif //SYMBIAN_TRACE_EXECUTABLE_IS_INCLUDED
sl@0
   532
sl@0
   533
}//namespace UTF
sl@0
   534
sl@0
   535