os/kernelhwsrv/kernel/eka/include/drivers/rm_debug_kerneldriver.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 2004-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
//
sl@0
    15
sl@0
    16
sl@0
    17
sl@0
    18
/**
sl@0
    19
 @file
sl@0
    20
 @internalTechnology
sl@0
    21
 @released
sl@0
    22
*/
sl@0
    23
sl@0
    24
#ifndef __RM_DEBUG_KERNELDRIVER_H__
sl@0
    25
#define __RM_DEBUG_KERNELDRIVER_H__
sl@0
    26
sl@0
    27
#include <rm_debug_api.h>
sl@0
    28
sl@0
    29
/**
sl@0
    30
Used to store a value read from or written to an ARM register
sl@0
    31
*/
sl@0
    32
typedef TUint32 T4ByteRegisterValue;
sl@0
    33
sl@0
    34
sl@0
    35
/** 
sl@0
    36
Provides static methods for accessing the information stored in a TRegisterInfo
sl@0
    37
object.
sl@0
    38
*/
sl@0
    39
class Register
sl@0
    40
	{
sl@0
    41
public:
sl@0
    42
	static TBool IsCoreReg(const Debug::TRegisterInfo aRegister);
sl@0
    43
	static TBool IsCoproReg(const Debug::TRegisterInfo aRegister);
sl@0
    44
	static TUint32 GetCoreRegId(const Debug::TRegisterInfo aRegister);
sl@0
    45
	static TUint32 GetCRm(const Debug::TRegisterInfo aRegister);
sl@0
    46
	static TUint32 GetCRn(const Debug::TRegisterInfo aRegister);
sl@0
    47
	static TUint32 GetOpcode1(const Debug::TRegisterInfo aRegister);
sl@0
    48
	static TUint32 GetOpcode2(const Debug::TRegisterInfo aRegister);
sl@0
    49
	static TUint32 GetCoproNum(const Debug::TRegisterInfo aRegister);
sl@0
    50
	};
sl@0
    51
sl@0
    52
/**
sl@0
    53
Identify whether aRegister is a core register
sl@0
    54
@param aRegister register ID to analyse
sl@0
    55
@return ETrue if core register, EFalse otherwise
sl@0
    56
*/
sl@0
    57
inline TBool Register::IsCoreReg(const Debug::TRegisterInfo aRegister)
sl@0
    58
	{
sl@0
    59
	return ((aRegister & 0xff) == 0x0);
sl@0
    60
	}
sl@0
    61
sl@0
    62
/**
sl@0
    63
Identify whether aRegister is a coprocessor register
sl@0
    64
@param aRegister register ID to analyse
sl@0
    65
@return ETrue if coprocessor register, EFalse otherwise
sl@0
    66
*/
sl@0
    67
inline TBool Register::IsCoproReg(const Debug::TRegisterInfo aRegister)
sl@0
    68
	{
sl@0
    69
	return ((aRegister & 0xff) == 0x1);
sl@0
    70
	}
sl@0
    71
sl@0
    72
/**
sl@0
    73
Get the ID of the core register
sl@0
    74
@param aRegister register ID to analyse
sl@0
    75
@return ID of the core register
sl@0
    76
*/
sl@0
    77
inline TUint32 Register::GetCoreRegId(const Debug::TRegisterInfo aRegister)
sl@0
    78
	{
sl@0
    79
	return ((aRegister >> 8) & 0xff);
sl@0
    80
	}
sl@0
    81
sl@0
    82
/**
sl@0
    83
Get the CRm value of a coprocessor register
sl@0
    84
@param aRegister register ID to analyse
sl@0
    85
@return the CRm value of a coprocessor register
sl@0
    86
*/
sl@0
    87
inline TUint32 Register::GetCRm(const Debug::TRegisterInfo aRegister)
sl@0
    88
	{
sl@0
    89
	return ((aRegister >> 16) & 0xf);
sl@0
    90
	}
sl@0
    91
sl@0
    92
/**
sl@0
    93
Get the CRm value of a coprocessor register
sl@0
    94
@param aRegister register ID to analyse
sl@0
    95
@return the CRm value of a coprocessor register
sl@0
    96
*/
sl@0
    97
inline TUint32 Register::GetCRn(const Debug::TRegisterInfo aRegister)
sl@0
    98
	{
sl@0
    99
	return ((aRegister >> 20) & 0xf);
sl@0
   100
	}
sl@0
   101
sl@0
   102
/**
sl@0
   103
Get the Opcode1 value of a coprocessor register
sl@0
   104
@param aRegister register ID to analyse
sl@0
   105
@return the Opcode1 value of a coprocessor register
sl@0
   106
*/
sl@0
   107
inline TUint32 Register::GetOpcode1(const Debug::TRegisterInfo aRegister)
sl@0
   108
	{
sl@0
   109
	return ((aRegister >> 24) & 0x8);
sl@0
   110
	}
sl@0
   111
	
sl@0
   112
/**
sl@0
   113
Get the Opcode2 value of a coprocessor register
sl@0
   114
@param aRegister register ID to analyse
sl@0
   115
@return the Opcode2 value of a coprocessor register
sl@0
   116
*/
sl@0
   117
inline TUint32 Register::GetOpcode2(const Debug::TRegisterInfo aRegister)
sl@0
   118
	{
sl@0
   119
	return ((aRegister >> 27) & 0x8);
sl@0
   120
	}
sl@0
   121
sl@0
   122
/**
sl@0
   123
Get the coprocessor number of a coprocessor register
sl@0
   124
@param aRegister register ID to analyse
sl@0
   125
@return the coprocessor number of a coprocessor register
sl@0
   126
*/
sl@0
   127
inline TUint32 Register::GetCoproNum(const Debug::TRegisterInfo aRegister)
sl@0
   128
	{
sl@0
   129
	return ((aRegister >> 8) & 0xff);
sl@0
   130
	}
sl@0
   131
sl@0
   132
//
sl@0
   133
// class TCapsRM_DebugDriver
sl@0
   134
//
sl@0
   135
class TCapsRM_DebugDriver
sl@0
   136
{
sl@0
   137
public:
sl@0
   138
	TVersion	iVersion;
sl@0
   139
};
sl@0
   140
sl@0
   141
/**
sl@0
   142
Stores listings information for passing between the DSS and the kernel driver
sl@0
   143
*/
sl@0
   144
class TListInformation
sl@0
   145
{
sl@0
   146
public:
sl@0
   147
	inline TListInformation(const Debug::TListId aType=(Debug::TListId)NULL, const Debug::TListScope aListScope=(Debug::TListScope)NULL, TDes8* aBuffer=NULL, TUint32* aDataSize=NULL, TUint64 aTargetId=0)
sl@0
   148
		: iType(aType),
sl@0
   149
		  iListScope(aListScope),
sl@0
   150
		  iBuffer(aBuffer),
sl@0
   151
		  iDataSize(aDataSize),
sl@0
   152
		  iTargetId(aTargetId) {};
sl@0
   153
public:
sl@0
   154
	Debug::TListId iType;
sl@0
   155
	Debug::TListScope iListScope;
sl@0
   156
	TDes8* iBuffer;
sl@0
   157
	TUint32* iDataSize;
sl@0
   158
	TUint64 iTargetId;
sl@0
   159
};
sl@0
   160
sl@0
   161
/**
sl@0
   162
Data structure to hold information to the crash flash
sl@0
   163
(Possibly: Could be expanded to hold on configuration data too)
sl@0
   164
*/
sl@0
   165
class TFlashInfo
sl@0
   166
{
sl@0
   167
public:
sl@0
   168
	inline TFlashInfo(TUint32 aPos, TUint32* aSize, TDes8* aData)
sl@0
   169
		:iPos(aPos),
sl@0
   170
		iSize(aSize),
sl@0
   171
		iData(aData){};
sl@0
   172
public:
sl@0
   173
	TUint32 iPos;
sl@0
   174
	TUint32* iSize;	
sl@0
   175
	 TDes8* iData;	
sl@0
   176
};
sl@0
   177
//
sl@0
   178
// class TRM_DebugMemoryInfo
sl@0
   179
//
sl@0
   180
class TRM_DebugMemoryInfo
sl@0
   181
{
sl@0
   182
public:
sl@0
   183
sl@0
   184
	inline TRM_DebugMemoryInfo(const TUint32 aAddress, const TUint32 aLength, TDesC8 *aData)
sl@0
   185
				: iAddress(aAddress),
sl@0
   186
				  iLength(aLength),
sl@0
   187
				  iData(aData) {};
sl@0
   188
	
sl@0
   189
public:
sl@0
   190
sl@0
   191
	TUint32 iAddress;
sl@0
   192
	TUint32	iLength;
sl@0
   193
	TDesC8*	iData;
sl@0
   194
};
sl@0
   195
sl@0
   196
sl@0
   197
/**
sl@0
   198
@deprecated
sl@0
   199
This class is only used by TRK phase 1 functions.
sl@0
   200
sl@0
   201
@see TRM_DebugRegisterInformation which offers similar storage suitable for use
sl@0
   202
with the TRK pahse 2 API.
sl@0
   203
*/
sl@0
   204
class TRM_DebugRegisterInfo
sl@0
   205
{
sl@0
   206
public:
sl@0
   207
sl@0
   208
	inline TRM_DebugRegisterInfo(const TInt16 aFirstRegister, const TInt16 aLastRegister, TDesC8 *aValues)
sl@0
   209
				: iFirstRegister(aFirstRegister),
sl@0
   210
				  iLastRegister(aLastRegister),
sl@0
   211
				  iValues(aValues) {};
sl@0
   212
	
sl@0
   213
public:
sl@0
   214
sl@0
   215
	TInt16	iFirstRegister;
sl@0
   216
	TInt16	iLastRegister;
sl@0
   217
	TDesC8*	iValues;
sl@0
   218
};
sl@0
   219
sl@0
   220
/**
sl@0
   221
Structure used to store information about registers
sl@0
   222
*/
sl@0
   223
class TRM_DebugRegisterInformation
sl@0
   224
{
sl@0
   225
public:
sl@0
   226
sl@0
   227
	inline TRM_DebugRegisterInformation(const TDes8 *aRegisterIds=NULL, TDes8 *aRegisterValues=NULL, TDes8 *aRegisterFlags=NULL)
sl@0
   228
		: iRegisterIds(aRegisterIds),
sl@0
   229
		  iRegisterValues(aRegisterValues),
sl@0
   230
		  iRegisterFlags(aRegisterFlags) {};
sl@0
   231
	
sl@0
   232
public:
sl@0
   233
sl@0
   234
	const TDes8* iRegisterIds;
sl@0
   235
	TDes8* iRegisterValues;
sl@0
   236
	TDes8* iRegisterFlags;
sl@0
   237
};
sl@0
   238
sl@0
   239
//
sl@0
   240
// class TRM_DebugTaskInfo
sl@0
   241
//
sl@0
   242
class TRM_DebugTaskInfo
sl@0
   243
{
sl@0
   244
public:
sl@0
   245
sl@0
   246
	inline TRM_DebugTaskInfo(TUint32 aOtherId)
sl@0
   247
				: iId(0),
sl@0
   248
				  iOtherId(aOtherId),
sl@0
   249
				  iPriority(0) { iName.FillZ(); };
sl@0
   250
sl@0
   251
public:
sl@0
   252
sl@0
   253
	TUint32 iId;
sl@0
   254
	TUint32 iOtherId;
sl@0
   255
	TUint32 iPriority;	
sl@0
   256
	TBuf8<KMaxName> iName;
sl@0
   257
};
sl@0
   258
sl@0
   259
//
sl@0
   260
// class TRM_DebugStepInfo
sl@0
   261
//
sl@0
   262
class TRM_DebugStepInfo
sl@0
   263
{
sl@0
   264
public:
sl@0
   265
sl@0
   266
	inline TRM_DebugStepInfo(const TUint32 aStartAddress, const TUint32 aStopAddress, const TBool aStepInto)
sl@0
   267
				: iStartAddress(aStartAddress),
sl@0
   268
				  iStopAddress(aStopAddress),
sl@0
   269
				  iStepInto(aStepInto) {};
sl@0
   270
sl@0
   271
public:
sl@0
   272
sl@0
   273
	TUint32 iStartAddress;
sl@0
   274
	TUint32 iStopAddress;
sl@0
   275
	TBool iStepInto;
sl@0
   276
};
sl@0
   277
sl@0
   278
sl@0
   279
//
sl@0
   280
// class TRM_DebugDriverInfo
sl@0
   281
//
sl@0
   282
class TRM_DebugDriverInfo
sl@0
   283
{
sl@0
   284
public:
sl@0
   285
sl@0
   286
	TUint32 iPanic1Address;
sl@0
   287
	TUint32 iPanic2Address;
sl@0
   288
	TUint32 iException1Address;
sl@0
   289
	TUint32 iException2Address;
sl@0
   290
	TUint32 iLibraryLoadedAddress;
sl@0
   291
	TUint32 iUserLibraryEnd;
sl@0
   292
};
sl@0
   293
sl@0
   294
sl@0
   295
//
sl@0
   296
// class TRM_DebugProcessInfo
sl@0
   297
//
sl@0
   298
class TRM_DebugProcessInfo
sl@0
   299
{
sl@0
   300
public:
sl@0
   301
sl@0
   302
	inline TRM_DebugProcessInfo(TUint32 *aCodeAddress, TUint32 *aDataAddress)
sl@0
   303
				: iCodeAddress(aCodeAddress),
sl@0
   304
				  iDataAddress(aDataAddress) {};
sl@0
   305
sl@0
   306
public:
sl@0
   307
sl@0
   308
	TUint32* iCodeAddress;
sl@0
   309
	TUint32* iDataAddress;
sl@0
   310
};
sl@0
   311
sl@0
   312
//
sl@0
   313
// class TRM_DebugEventActionInfo
sl@0
   314
//
sl@0
   315
class TRM_DebugEventActionInfo
sl@0
   316
{
sl@0
   317
public:
sl@0
   318
	inline TRM_DebugEventActionInfo(TUint32 aEvent, TUint32 aAction, TUint64 aAgentId)
sl@0
   319
		: iEvent(aEvent),
sl@0
   320
		iAction(aAction),
sl@0
   321
		iAgentId(aAgentId) {};
sl@0
   322
public:
sl@0
   323
	TUint32 iEvent;
sl@0
   324
	TUint32 iAction;
sl@0
   325
	TUint64 iAgentId;
sl@0
   326
};
sl@0
   327
sl@0
   328
//
sl@0
   329
// class TRM_DebugEventInfo
sl@0
   330
//
sl@0
   331
class TRM_DebugEventInfo
sl@0
   332
{
sl@0
   333
public:
sl@0
   334
	inline TRM_DebugEventInfo(TDesC8& aProcessName, TUint32& aBufSize)
sl@0
   335
		: iProcessName(aProcessName),
sl@0
   336
		iBufSize(aBufSize) {};
sl@0
   337
sl@0
   338
public:
sl@0
   339
	TDesC8& iProcessName;
sl@0
   340
	TUint32& iBufSize;
sl@0
   341
};
sl@0
   342
sl@0
   343
//
sl@0
   344
// class TRMD_DebugAgentId
sl@0
   345
//
sl@0
   346
class TRM_DebugAgentId
sl@0
   347
{
sl@0
   348
public:
sl@0
   349
	inline TRM_DebugAgentId(TUint64 aAgentId)
sl@0
   350
		: iAgentId(aAgentId) {};
sl@0
   351
sl@0
   352
public:
sl@0
   353
	TUint64 iAgentId;
sl@0
   354
};
sl@0
   355
sl@0
   356
//
sl@0
   357
// Class TRMD_DebugCancelInfo
sl@0
   358
//
sl@0
   359
class TRMD_DebugCancelInfo
sl@0
   360
{
sl@0
   361
public:
sl@0
   362
	inline TRMD_DebugCancelInfo(TUint32 aCancelRequest,TDesC8& aProcessName, TUint64 aAgentId)
sl@0
   363
		: iCancelRequest(aCancelRequest),
sl@0
   364
		iProcessName(aProcessName),
sl@0
   365
		iAgentId(aAgentId) {};
sl@0
   366
sl@0
   367
	inline TRMD_DebugCancelInfo(void)
sl@0
   368
		: iCancelRequest(0),
sl@0
   369
	iAgentId(0)
sl@0
   370
	{
sl@0
   371
	};
sl@0
   372
sl@0
   373
public:
sl@0
   374
	TUint32 iCancelRequest;
sl@0
   375
	TBuf8<KMaxName> iProcessName;
sl@0
   376
	TUint64 iAgentId;
sl@0
   377
};
sl@0
   378
sl@0
   379
class TEventMetaData
sl@0
   380
	{
sl@0
   381
public:
sl@0
   382
	TBuf8<KMaxName> iTargetProcessName;
sl@0
   383
	TUint64 iDebugAgentProcessId;
sl@0
   384
	};
sl@0
   385
sl@0
   386
/**
sl@0
   387
@internalComponent
sl@0
   388
*/
sl@0
   389
class TSetBreakInfo
sl@0
   390
{
sl@0
   391
public:
sl@0
   392
sl@0
   393
	inline TSetBreakInfo(Debug::TBreakId* aBreakId,
sl@0
   394
		TUint64 aId,\
sl@0
   395
		TUint32 aAddress,\
sl@0
   396
		Debug::TArchitectureMode aMode,
sl@0
   397
		TBool aThreadSpecific)
sl@0
   398
				: iBreakId(aBreakId),
sl@0
   399
				  iId(aId),
sl@0
   400
				  iAddress(aAddress),
sl@0
   401
				  iMode(aMode),
sl@0
   402
       				  iThreadSpecific(aThreadSpecific) {};
sl@0
   403
sl@0
   404
inline TSetBreakInfo(void)
sl@0
   405
			: iBreakId((Debug::TBreakId*)0),
sl@0
   406
			  iId(0),
sl@0
   407
			  iAddress(0),
sl@0
   408
			  iMode(Debug::EArmMode),
sl@0
   409
       			  iThreadSpecific(ETrue) {};
sl@0
   410
sl@0
   411
sl@0
   412
public:
sl@0
   413
	Debug::TBreakId* iBreakId;
sl@0
   414
	TUint64 iId;
sl@0
   415
	TUint32 iAddress;
sl@0
   416
	Debug::TArchitectureMode iMode;
sl@0
   417
	TBool iThreadSpecific;
sl@0
   418
};
sl@0
   419
sl@0
   420
/**
sl@0
   421
@internalComponent
sl@0
   422
*/
sl@0
   423
class TModifyBreakInfo
sl@0
   424
{
sl@0
   425
public:
sl@0
   426
sl@0
   427
	inline TModifyBreakInfo(Debug::TBreakId aBreakId,\
sl@0
   428
		const TUint64 aThreadId,\
sl@0
   429
		const TUint32 aAddress,\
sl@0
   430
		const Debug::TArchitectureMode aMode)
sl@0
   431
				: iBreakId(aBreakId),
sl@0
   432
				  iThreadId(aThreadId),
sl@0
   433
				  iAddress(aAddress),
sl@0
   434
				  iMode(aMode) {};
sl@0
   435
sl@0
   436
public:
sl@0
   437
	const Debug::TBreakId iBreakId;
sl@0
   438
	const TUint64 iThreadId;
sl@0
   439
	const TUint32 iAddress;
sl@0
   440
	const Debug::TArchitectureMode iMode;
sl@0
   441
};
sl@0
   442
sl@0
   443
/**
sl@0
   444
@internalComponent
sl@0
   445
*/
sl@0
   446
class TModifyProcessBreakInfo
sl@0
   447
{
sl@0
   448
public:
sl@0
   449
sl@0
   450
	inline TModifyProcessBreakInfo(Debug::TBreakId aBreakId,\
sl@0
   451
		const TUint64 aProcessId,\
sl@0
   452
		const TUint32 aAddress,\
sl@0
   453
		const Debug::TArchitectureMode aMode)
sl@0
   454
				: iBreakId(aBreakId),
sl@0
   455
				  iProcessId(aProcessId),
sl@0
   456
				  iAddress(aAddress),
sl@0
   457
				  iMode(aMode) {};
sl@0
   458
sl@0
   459
public:
sl@0
   460
	const Debug::TBreakId iBreakId;
sl@0
   461
	const TUint64 iProcessId;
sl@0
   462
	const TUint32 iAddress;
sl@0
   463
	const Debug::TArchitectureMode iMode;
sl@0
   464
};
sl@0
   465
sl@0
   466
/**
sl@0
   467
@internalComponent
sl@0
   468
*/
sl@0
   469
class TGetBreakInfo
sl@0
   470
{
sl@0
   471
public:
sl@0
   472
sl@0
   473
	inline TGetBreakInfo(Debug::TBreakId aBreakId,\
sl@0
   474
		TUint64& aId,\
sl@0
   475
		TUint32& aAddress,\
sl@0
   476
		Debug::TArchitectureMode& aMode,
sl@0
   477
		TBool& aThreadSpecific)
sl@0
   478
				: iBreakId(aBreakId),
sl@0
   479
				  iId(&aId),
sl@0
   480
				  iAddress(&aAddress),
sl@0
   481
				  iMode(&aMode),
sl@0
   482
       				  iThreadSpecific(&aThreadSpecific) {};
sl@0
   483
sl@0
   484
	inline TGetBreakInfo()
sl@0
   485
				: iBreakId((Debug::TBreakId)0),
sl@0
   486
				  iId((TUint64*)0),
sl@0
   487
				  iAddress((TUint32*)0),
sl@0
   488
				  iMode((Debug::TArchitectureMode*)0),
sl@0
   489
       				  iThreadSpecific((TBool*)0)	{};
sl@0
   490
sl@0
   491
public:
sl@0
   492
	const Debug::TBreakId iBreakId;
sl@0
   493
	TUint64* iId;
sl@0
   494
	TUint32* iAddress;
sl@0
   495
	Debug::TArchitectureMode* iMode;
sl@0
   496
	TBool* iThreadSpecific;
sl@0
   497
};
sl@0
   498
sl@0
   499
//
sl@0
   500
// class RRM_DebugDriver
sl@0
   501
//
sl@0
   502
class RRM_DebugDriver : public RBusLogicalChannel
sl@0
   503
{
sl@0
   504
public:
sl@0
   505
sl@0
   506
	enum TControl
sl@0
   507
	{
sl@0
   508
		EControlSetBreak = 0,
sl@0
   509
		EControlClearBreak,
sl@0
   510
		EControlModifyBreak,
sl@0
   511
		EControlBreakInfo,
sl@0
   512
		EControlSuspendThread,
sl@0
   513
		EControlResumeThread,
sl@0
   514
		EControlStepRange,
sl@0
   515
		EControlReadMemory,
sl@0
   516
		EControlWriteMemory,
sl@0
   517
		EControlReadRegisters,
sl@0
   518
		EControlWriteRegisters,
sl@0
   519
		EControlGetStaticLibraryInfo,
sl@0
   520
		EControlGetDebugFunctionalityBufSize,
sl@0
   521
		EControlGetDebugFunctionality,
sl@0
   522
		EControlReadRegistersLegacy,
sl@0
   523
		EControlWriteRegistersLegacy,		
sl@0
   524
		EControlGetMemoryOperationMaxBlockSize,		
sl@0
   525
		EControlAttachProcess,
sl@0
   526
		EControlDetachProcess,
sl@0
   527
		EControlDetachAgent,
sl@0
   528
		EControlSetEventAction,
sl@0
   529
		EControlGetList,
sl@0
   530
		EControlStep,
sl@0
   531
		EControlIsDebuggable,
sl@0
   532
		EControlKillProcess,		
sl@0
   533
		EControlModifyProcessBreak,
sl@0
   534
	};
sl@0
   535
	
sl@0
   536
	enum TRequest
sl@0
   537
	{
sl@0
   538
		ERequestGetEvent=0x0, ERequestGetEventCancel=0x1
sl@0
   539
	};	
sl@0
   540
		
sl@0
   541
public:
sl@0
   542
sl@0
   543
	inline TInt Open(const TRM_DebugDriverInfo aDriverInfo);
sl@0
   544
sl@0
   545
	inline TInt	SetBreak(Debug::TBreakId &aBreakId,const TUint32 aThreadId, const TUint32 aAddress, const Debug::TArchitectureMode aThumbMode );
sl@0
   546
	inline TInt	SetProcessBreak(Debug::TBreakId &aBreakId,const TUint32 aProcessId, const TUint32 aAddress, const Debug::TArchitectureMode aThumbMode );
sl@0
   547
	
sl@0
   548
	inline TInt	ClearBreak(const TInt32 aBreakId);
sl@0
   549
	
sl@0
   550
	inline TInt	ModifyBreak(const Debug::TBreakId aBreakId, const TUint32 aThreadId, const TUint32 aAddress, const Debug::TArchitectureMode aArchitectureMode );
sl@0
   551
	inline TInt	ModifyProcessBreak(const Debug::TBreakId aBreakId, const TUint32 aProcessId, const TUint32 aAddress, const Debug::TArchitectureMode aArchitectureMode );
sl@0
   552
	
sl@0
   553
	inline TInt BreakInfo(const Debug::TBreakId aBreakId, TUint64& aId, TUint32& aAddress, Debug::TArchitectureMode& aMode, TBool& aThreadSpecific);
sl@0
   554
	
sl@0
   555
	inline TInt	SuspendThread(const TUint32 aThreadId);
sl@0
   556
	inline TInt	ResumeThread(const TUint32 aThreadId);
sl@0
   557
	inline TInt	StepRange(const TUint32 aThreadId, const TUint32 aStartAddress, const TUint32 aStopAddress, TBool aStepInto);
sl@0
   558
	inline TInt ReadMemory(const TUint32 aThreadId, const TUint32 aAddress, const TUint32 aLength, TDes8 &aData);
sl@0
   559
	inline TInt WriteMemory(const TUint32 aThreadId, const TUint32 aAddress, const TUint32 aLength, const TDesC8 &aData);
sl@0
   560
	inline TInt ReadRegisters(const TUint32 aThreadId, const TDes8 &aRegisterIds, TDes8 &aRegisterValues, TDes8 &aRegisterFlags);
sl@0
   561
	inline TInt WriteRegisters(const TUint32 aThreadId, const TDes8 &aRegisterIds, const TDes8 &aRegisterValues, TDes8 &aRegisterFlags);
sl@0
   562
	inline TInt ReadRegisters(const TUint32 aThreadId, const TInt32 aFirstRegister, const TInt32 aLastRegister, TDes8 &aValues);
sl@0
   563
	inline TInt WriteRegisters(const TUint32 aThreadId, const TInt32 aFirstRegister, const TInt32 aLastRegister, TDesC8 &aValues);
sl@0
   564
	inline void GetEvent(TDesC8& aProcessName, TUint64 aAgentId, TRequestStatus &aStatus, Debug::TEventInfo &aEventInfo);
sl@0
   565
	inline void CancelGetEvent(TDesC8& aProcessName, TUint64 aAgentId);
sl@0
   566
//	inline TInt GetProcessInfo(const TInt aIndex, TRM_DebugTaskInfo &aInfo);
sl@0
   567
//	inline TInt GetThreadInfo(const TInt aIndex, TRM_DebugTaskInfo &aInfo);
sl@0
   568
	inline TInt GetStaticLibraryInfo(const TInt aIndex, Debug::TEventInfo &aInfo);
sl@0
   569
	inline TInt GetDebugFunctionalityBufSize(TUint32 &aBufSize);
sl@0
   570
	inline TInt GetDebugFunctionality(TDes8& aDebugFunctionality);
sl@0
   571
	inline TInt GetMemoryOperationMaxBlockSize(TUint32 &aMaxSize);
sl@0
   572
	inline TInt AttachProcess(TDesC8& aProcessName, TUint64 aAgentId);
sl@0
   573
	inline TInt DetachProcess(TDesC8& aProcessName, TUint64 aAgentId);
sl@0
   574
	inline TInt DetachAgent(TUint64 aAgentId);
sl@0
   575
	inline TInt SetEventAction(TDesC8& aProcessName, Debug::TEventType aEvent, Debug::TKernelEventAction aEventAction, TUint64 aAgentId);
sl@0
   576
	inline TInt GetList(const Debug::TListId aType, const Debug::TListScope aListScope, const TUint64 aTargetId, const TUint64 aDebugProcessId, TDes8& aBuffer, TUint32& aDataSize);
sl@0
   577
	inline TInt Step(const TUint32 aThreadId, const TUint32 aNumSteps);
sl@0
   578
	inline TInt IsDebuggable(const TUint32 aProcessId);
sl@0
   579
	inline TInt KillProcess(const TUint32 aProcessId, const TInt32 aReason);
sl@0
   580
};
sl@0
   581
sl@0
   582
_LIT(KRM_DebugDriverName,"RM Debug Driver");
sl@0
   583
sl@0
   584
//priority set equal to that of KDfcThread0Priority defined in e32/kernel/sinit.cpp
sl@0
   585
const TInt KRmDebugDriverThreadPriority = 27;
sl@0
   586
sl@0
   587
// Version information
sl@0
   588
const TInt KMajorVersionNumber=2;
sl@0
   589
const TInt KMinorVersionNumber=1;
sl@0
   590
const TInt KBuildVersionNumber=0;
sl@0
   591
sl@0
   592
sl@0
   593
inline TInt RRM_DebugDriver::Open(const TRM_DebugDriverInfo aDriverInfo)
sl@0
   594
{
sl@0
   595
	TBuf8<32> buf;
sl@0
   596
	buf.Append((TUint8*)&aDriverInfo.iPanic1Address, 4);
sl@0
   597
	buf.Append((TUint8*)&aDriverInfo.iPanic2Address, 4);
sl@0
   598
	buf.Append((TUint8*)&aDriverInfo.iException1Address, 4);
sl@0
   599
	buf.Append((TUint8*)&aDriverInfo.iException2Address, 4);
sl@0
   600
	buf.Append((TUint8*)&aDriverInfo.iLibraryLoadedAddress, 4);
sl@0
   601
	buf.Append((TUint8*)&aDriverInfo.iUserLibraryEnd, 4);
sl@0
   602
	
sl@0
   603
	#ifdef EKA2
sl@0
   604
	return DoCreate(KRM_DebugDriverName, TVersion(KMajorVersionNumber, KMinorVersionNumber, KBuildVersionNumber), KNullUnit, NULL, &buf);
sl@0
   605
	#else
sl@0
   606
	return DoCreate(KRM_DebugDriverName, TVersion(KMajorVersionNumber, KMinorVersionNumber, KBuildVersionNumber), NULL, KNullUnit, NULL, &buf);
sl@0
   607
	#endif
sl@0
   608
}
sl@0
   609
sl@0
   610
inline TInt RRM_DebugDriver::SetBreak(Debug::TBreakId &aBreakId, const TUint32 aThreadId, const TUint32 aAddress, const Debug::TArchitectureMode aMode )
sl@0
   611
{
sl@0
   612
	TSetBreakInfo info(&aBreakId, aThreadId, aAddress, aMode, ETrue);
sl@0
   613
	return DoSvControl(EControlSetBreak, reinterpret_cast<TAny*>(&info),0);
sl@0
   614
}
sl@0
   615
inline TInt RRM_DebugDriver::SetProcessBreak(Debug::TBreakId &aBreakId, const TUint32 aProcessId, const TUint32 aAddress, const Debug::TArchitectureMode aMode )
sl@0
   616
{
sl@0
   617
	TSetBreakInfo info(&aBreakId, aProcessId, aAddress, aMode, EFalse);
sl@0
   618
	return DoSvControl(EControlSetBreak, reinterpret_cast<TAny*>(&info),0);
sl@0
   619
}
sl@0
   620
sl@0
   621
inline TInt RRM_DebugDriver::ClearBreak(const Debug::TBreakId aBreakId)
sl@0
   622
{
sl@0
   623
	return DoSvControl(EControlClearBreak, reinterpret_cast<TAny*>(aBreakId), 0);
sl@0
   624
}
sl@0
   625
sl@0
   626
inline TInt RRM_DebugDriver::ModifyBreak(const Debug::TBreakId aBreakId, const TUint32 aThreadId, const TUint32 aAddress, const Debug::TArchitectureMode aMode)
sl@0
   627
{
sl@0
   628
	TModifyBreakInfo info(aBreakId, aThreadId, aAddress, aMode);
sl@0
   629
	return DoControl(EControlModifyBreak, reinterpret_cast<TAny*>(&info), 0);
sl@0
   630
}
sl@0
   631
sl@0
   632
inline TInt RRM_DebugDriver::ModifyProcessBreak(const Debug::TBreakId aBreakId, const TUint32 aProcessId, const TUint32 aAddress, const Debug::TArchitectureMode aMode)
sl@0
   633
{
sl@0
   634
	TModifyProcessBreakInfo info(aBreakId, aProcessId, aAddress, aMode);
sl@0
   635
	return DoControl(EControlModifyProcessBreak, reinterpret_cast<TAny*>(&info), 0);
sl@0
   636
}
sl@0
   637
sl@0
   638
inline TInt RRM_DebugDriver::BreakInfo(const Debug::TBreakId aBreakId, TUint64& aId, TUint32& aAddress, Debug::TArchitectureMode& aMode, TBool& aThreadSpecific)
sl@0
   639
{
sl@0
   640
	TGetBreakInfo info(aBreakId, aId, aAddress, aMode, aThreadSpecific);
sl@0
   641
	return DoControl(EControlBreakInfo, reinterpret_cast<TAny*>(&info), 0);
sl@0
   642
}
sl@0
   643
sl@0
   644
inline TInt RRM_DebugDriver::SuspendThread(const TUint32 aThreadId)
sl@0
   645
{
sl@0
   646
	return DoControl(EControlSuspendThread, reinterpret_cast<TAny*>(aThreadId));
sl@0
   647
}
sl@0
   648
sl@0
   649
inline TInt RRM_DebugDriver::ResumeThread(const TUint32 aThreadId)
sl@0
   650
{
sl@0
   651
	return DoSvControl(EControlResumeThread, reinterpret_cast<TAny*>(aThreadId));
sl@0
   652
}
sl@0
   653
sl@0
   654
inline TInt RRM_DebugDriver::StepRange(const TUint32 aThreadId, const TUint32 aStartAddress, const TUint32 aStopAddress, TBool aStepInto)
sl@0
   655
{
sl@0
   656
	TRM_DebugStepInfo info(aStartAddress, aStopAddress, aStepInto);
sl@0
   657
	return DoSvControl(EControlStepRange, reinterpret_cast<TAny*>(aThreadId), (TAny*)&info);
sl@0
   658
}
sl@0
   659
sl@0
   660
inline TInt RRM_DebugDriver::ReadMemory(const TUint32 aThreadId, const TUint32 aAddress, const TUint32 aLength, TDes8 &aData)
sl@0
   661
{
sl@0
   662
	TRM_DebugMemoryInfo info(aAddress, aLength, &aData);
sl@0
   663
	return DoControl(EControlReadMemory, reinterpret_cast<TAny*>(aThreadId), (TAny*)&info);
sl@0
   664
}
sl@0
   665
sl@0
   666
inline TInt RRM_DebugDriver::WriteMemory(const TUint32 aThreadId, const TUint32 aAddress, const TUint32 aLength, const TDesC8 &aData)
sl@0
   667
{
sl@0
   668
	TRM_DebugMemoryInfo info(aAddress, aLength, (TDesC8*)&aData);
sl@0
   669
	return DoControl(EControlWriteMemory, reinterpret_cast<TAny*>(aThreadId), (TAny*)&info);
sl@0
   670
}
sl@0
   671
sl@0
   672
inline TInt RRM_DebugDriver::ReadRegisters(const TUint32 aThreadId, const TDes8 &aRegisterIds, TDes8 &aRegisterValues, TDes8 &aRegisterFlags)
sl@0
   673
	{
sl@0
   674
	TRM_DebugRegisterInformation info(&aRegisterIds, &aRegisterValues, &aRegisterFlags);
sl@0
   675
	return DoControl(EControlReadRegisters, reinterpret_cast<TAny*>(aThreadId), (TAny*)&info);	
sl@0
   676
	}
sl@0
   677
sl@0
   678
inline TInt RRM_DebugDriver::WriteRegisters(const TUint32 aThreadId, const TDes8 &aRegisterIds, const TDes8 &aRegisterValues, TDes8 &aRegisterFlags)
sl@0
   679
	{
sl@0
   680
	TRM_DebugRegisterInformation info(&aRegisterIds, (TDes8*)&aRegisterValues, &aRegisterFlags);
sl@0
   681
	return DoControl(EControlWriteRegisters, reinterpret_cast<TAny*>(aThreadId), (TAny*)&info);
sl@0
   682
	}
sl@0
   683
sl@0
   684
inline TInt RRM_DebugDriver::ReadRegisters(const TUint32 aThreadId, const TInt32 aFirstRegister, const TInt32 aLastRegister, TDes8 &aValues)
sl@0
   685
{
sl@0
   686
	TRM_DebugRegisterInfo info(aFirstRegister, aLastRegister, &aValues);
sl@0
   687
	return DoControl(EControlReadRegistersLegacy, reinterpret_cast<TAny*>(aThreadId), (TAny*)&info);
sl@0
   688
}
sl@0
   689
sl@0
   690
inline TInt RRM_DebugDriver::WriteRegisters(const TUint32 aThreadId, const TInt32 aFirstRegister, const TInt32 aLastRegister, TDesC8 &aValues)
sl@0
   691
{
sl@0
   692
	TRM_DebugRegisterInfo info(aFirstRegister, aLastRegister, &aValues);
sl@0
   693
	return DoControl(EControlWriteRegistersLegacy, reinterpret_cast<TAny*>(aThreadId), (TAny*)&info);
sl@0
   694
}
sl@0
   695
sl@0
   696
inline void RRM_DebugDriver::GetEvent(TDesC8& aProcessName, TUint64 aAgentId, TRequestStatus &aStatus, Debug::TEventInfo &aEventInfo)
sl@0
   697
{
sl@0
   698
	// temporary object not needed beyond the DoRequest call
sl@0
   699
	TEventMetaData eventMetaData;
sl@0
   700
	eventMetaData.iTargetProcessName.Copy(aProcessName);
sl@0
   701
	eventMetaData.iDebugAgentProcessId = aAgentId;
sl@0
   702
	DoRequest(ERequestGetEvent, aStatus, (TAny*)&aEventInfo, (TAny*)&eventMetaData);
sl@0
   703
}
sl@0
   704
sl@0
   705
inline void RRM_DebugDriver::CancelGetEvent(TDesC8& aProcessName, TUint64 aAgentId)
sl@0
   706
{
sl@0
   707
	TRMD_DebugCancelInfo info(ERequestGetEventCancel,aProcessName,aAgentId);
sl@0
   708
	DoCancel(reinterpret_cast<TInt>(&info));
sl@0
   709
}
sl@0
   710
sl@0
   711
inline TInt RRM_DebugDriver::GetStaticLibraryInfo(const TInt aIndex, Debug::TEventInfo &aInfo)
sl@0
   712
{
sl@0
   713
	return DoControl(EControlGetStaticLibraryInfo, reinterpret_cast<TAny*>(aIndex), (TAny*)&aInfo);
sl@0
   714
}
sl@0
   715
sl@0
   716
inline TInt RRM_DebugDriver::GetDebugFunctionalityBufSize(TUint32 &aBufSize)
sl@0
   717
{
sl@0
   718
	return DoControl(EControlGetDebugFunctionalityBufSize, reinterpret_cast<TAny*>(&aBufSize));
sl@0
   719
}
sl@0
   720
sl@0
   721
inline TInt RRM_DebugDriver::GetDebugFunctionality(TDes8& aDebugFunctionality)
sl@0
   722
{
sl@0
   723
	return DoControl(EControlGetDebugFunctionality,reinterpret_cast<TAny*>(&aDebugFunctionality));
sl@0
   724
}
sl@0
   725
sl@0
   726
inline TInt RRM_DebugDriver::GetMemoryOperationMaxBlockSize(TUint32 &aMaxSize)
sl@0
   727
{
sl@0
   728
	return DoControl(EControlGetMemoryOperationMaxBlockSize, reinterpret_cast<TAny*>(&aMaxSize));
sl@0
   729
}
sl@0
   730
sl@0
   731
inline TInt RRM_DebugDriver::AttachProcess(TDesC8& aProcessName, TUint64 aAgentId)
sl@0
   732
{
sl@0
   733
	TRM_DebugAgentId info(aAgentId);
sl@0
   734
	return DoControl(EControlAttachProcess,reinterpret_cast<TAny*>(&aProcessName),reinterpret_cast<TAny*>(&info));
sl@0
   735
}
sl@0
   736
sl@0
   737
inline TInt RRM_DebugDriver::DetachProcess(TDesC8& aProcessName, TUint64 aAgentId)
sl@0
   738
{
sl@0
   739
	TRM_DebugAgentId info(aAgentId);
sl@0
   740
	return DoControl(EControlDetachProcess,reinterpret_cast<TAny*>(&aProcessName),reinterpret_cast<TAny*>(&info));
sl@0
   741
}
sl@0
   742
sl@0
   743
inline TInt RRM_DebugDriver::DetachAgent(TUint64 aAgentId)
sl@0
   744
{
sl@0
   745
	TRM_DebugAgentId info(aAgentId);
sl@0
   746
	return DoControl(EControlDetachAgent,reinterpret_cast<TAny*>(&info),0);
sl@0
   747
}
sl@0
   748
sl@0
   749
inline TInt RRM_DebugDriver::SetEventAction(TDesC8& aProcessName, Debug::TEventType aEvent, Debug::TKernelEventAction aEventAction, TUint64 aAgentId)
sl@0
   750
{
sl@0
   751
	TRM_DebugEventActionInfo info (aEvent,aEventAction, aAgentId);
sl@0
   752
	return DoControl(EControlSetEventAction,reinterpret_cast<TAny*>(&aProcessName),(TAny*)&info);
sl@0
   753
}
sl@0
   754
sl@0
   755
inline TInt RRM_DebugDriver::GetList(const Debug::TListId aType, const Debug::TListScope aListScope, const TUint64 aTargetId, const TUint64 aDebugProcessId, TDes8& aBuffer, TUint32& aDataSize)
sl@0
   756
{
sl@0
   757
	TListInformation info(aType, aListScope, &aBuffer, &aDataSize, aTargetId);
sl@0
   758
	return DoControl(EControlGetList, (TAny*)&info);
sl@0
   759
}
sl@0
   760
sl@0
   761
inline TInt RRM_DebugDriver::Step(const TUint32 aThreadId, const TUint32 aNumSteps)
sl@0
   762
{
sl@0
   763
	return DoControl(EControlStep,reinterpret_cast<TAny*>(aThreadId),reinterpret_cast<TAny*>(aNumSteps));
sl@0
   764
}
sl@0
   765
sl@0
   766
inline TInt RRM_DebugDriver::IsDebuggable(const TUint32 aProcessId)
sl@0
   767
{
sl@0
   768
	return DoControl(EControlIsDebuggable,reinterpret_cast<TAny*>(aProcessId),NULL);
sl@0
   769
}
sl@0
   770
sl@0
   771
inline TInt RRM_DebugDriver::KillProcess(const TUint32 aProcessId, const TInt32 aReason)
sl@0
   772
{
sl@0
   773
	return DoControl(EControlKillProcess,reinterpret_cast<TAny*>(aProcessId),reinterpret_cast<TAny*>(aReason));
sl@0
   774
}
sl@0
   775
sl@0
   776
#endif // __RM_DEBUG_KERNELDRIVER_H__
sl@0
   777