os/kernelhwsrv/kernel/eka/include/drivers/rm_debug_kerneldriver.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kernel/eka/include/drivers/rm_debug_kerneldriver.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,777 @@
     1.4 +// Copyright (c) 2004-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 +//
    1.18 +
    1.19 +
    1.20 +
    1.21 +/**
    1.22 + @file
    1.23 + @internalTechnology
    1.24 + @released
    1.25 +*/
    1.26 +
    1.27 +#ifndef __RM_DEBUG_KERNELDRIVER_H__
    1.28 +#define __RM_DEBUG_KERNELDRIVER_H__
    1.29 +
    1.30 +#include <rm_debug_api.h>
    1.31 +
    1.32 +/**
    1.33 +Used to store a value read from or written to an ARM register
    1.34 +*/
    1.35 +typedef TUint32 T4ByteRegisterValue;
    1.36 +
    1.37 +
    1.38 +/** 
    1.39 +Provides static methods for accessing the information stored in a TRegisterInfo
    1.40 +object.
    1.41 +*/
    1.42 +class Register
    1.43 +	{
    1.44 +public:
    1.45 +	static TBool IsCoreReg(const Debug::TRegisterInfo aRegister);
    1.46 +	static TBool IsCoproReg(const Debug::TRegisterInfo aRegister);
    1.47 +	static TUint32 GetCoreRegId(const Debug::TRegisterInfo aRegister);
    1.48 +	static TUint32 GetCRm(const Debug::TRegisterInfo aRegister);
    1.49 +	static TUint32 GetCRn(const Debug::TRegisterInfo aRegister);
    1.50 +	static TUint32 GetOpcode1(const Debug::TRegisterInfo aRegister);
    1.51 +	static TUint32 GetOpcode2(const Debug::TRegisterInfo aRegister);
    1.52 +	static TUint32 GetCoproNum(const Debug::TRegisterInfo aRegister);
    1.53 +	};
    1.54 +
    1.55 +/**
    1.56 +Identify whether aRegister is a core register
    1.57 +@param aRegister register ID to analyse
    1.58 +@return ETrue if core register, EFalse otherwise
    1.59 +*/
    1.60 +inline TBool Register::IsCoreReg(const Debug::TRegisterInfo aRegister)
    1.61 +	{
    1.62 +	return ((aRegister & 0xff) == 0x0);
    1.63 +	}
    1.64 +
    1.65 +/**
    1.66 +Identify whether aRegister is a coprocessor register
    1.67 +@param aRegister register ID to analyse
    1.68 +@return ETrue if coprocessor register, EFalse otherwise
    1.69 +*/
    1.70 +inline TBool Register::IsCoproReg(const Debug::TRegisterInfo aRegister)
    1.71 +	{
    1.72 +	return ((aRegister & 0xff) == 0x1);
    1.73 +	}
    1.74 +
    1.75 +/**
    1.76 +Get the ID of the core register
    1.77 +@param aRegister register ID to analyse
    1.78 +@return ID of the core register
    1.79 +*/
    1.80 +inline TUint32 Register::GetCoreRegId(const Debug::TRegisterInfo aRegister)
    1.81 +	{
    1.82 +	return ((aRegister >> 8) & 0xff);
    1.83 +	}
    1.84 +
    1.85 +/**
    1.86 +Get the CRm value of a coprocessor register
    1.87 +@param aRegister register ID to analyse
    1.88 +@return the CRm value of a coprocessor register
    1.89 +*/
    1.90 +inline TUint32 Register::GetCRm(const Debug::TRegisterInfo aRegister)
    1.91 +	{
    1.92 +	return ((aRegister >> 16) & 0xf);
    1.93 +	}
    1.94 +
    1.95 +/**
    1.96 +Get the CRm value of a coprocessor register
    1.97 +@param aRegister register ID to analyse
    1.98 +@return the CRm value of a coprocessor register
    1.99 +*/
   1.100 +inline TUint32 Register::GetCRn(const Debug::TRegisterInfo aRegister)
   1.101 +	{
   1.102 +	return ((aRegister >> 20) & 0xf);
   1.103 +	}
   1.104 +
   1.105 +/**
   1.106 +Get the Opcode1 value of a coprocessor register
   1.107 +@param aRegister register ID to analyse
   1.108 +@return the Opcode1 value of a coprocessor register
   1.109 +*/
   1.110 +inline TUint32 Register::GetOpcode1(const Debug::TRegisterInfo aRegister)
   1.111 +	{
   1.112 +	return ((aRegister >> 24) & 0x8);
   1.113 +	}
   1.114 +	
   1.115 +/**
   1.116 +Get the Opcode2 value of a coprocessor register
   1.117 +@param aRegister register ID to analyse
   1.118 +@return the Opcode2 value of a coprocessor register
   1.119 +*/
   1.120 +inline TUint32 Register::GetOpcode2(const Debug::TRegisterInfo aRegister)
   1.121 +	{
   1.122 +	return ((aRegister >> 27) & 0x8);
   1.123 +	}
   1.124 +
   1.125 +/**
   1.126 +Get the coprocessor number of a coprocessor register
   1.127 +@param aRegister register ID to analyse
   1.128 +@return the coprocessor number of a coprocessor register
   1.129 +*/
   1.130 +inline TUint32 Register::GetCoproNum(const Debug::TRegisterInfo aRegister)
   1.131 +	{
   1.132 +	return ((aRegister >> 8) & 0xff);
   1.133 +	}
   1.134 +
   1.135 +//
   1.136 +// class TCapsRM_DebugDriver
   1.137 +//
   1.138 +class TCapsRM_DebugDriver
   1.139 +{
   1.140 +public:
   1.141 +	TVersion	iVersion;
   1.142 +};
   1.143 +
   1.144 +/**
   1.145 +Stores listings information for passing between the DSS and the kernel driver
   1.146 +*/
   1.147 +class TListInformation
   1.148 +{
   1.149 +public:
   1.150 +	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)
   1.151 +		: iType(aType),
   1.152 +		  iListScope(aListScope),
   1.153 +		  iBuffer(aBuffer),
   1.154 +		  iDataSize(aDataSize),
   1.155 +		  iTargetId(aTargetId) {};
   1.156 +public:
   1.157 +	Debug::TListId iType;
   1.158 +	Debug::TListScope iListScope;
   1.159 +	TDes8* iBuffer;
   1.160 +	TUint32* iDataSize;
   1.161 +	TUint64 iTargetId;
   1.162 +};
   1.163 +
   1.164 +/**
   1.165 +Data structure to hold information to the crash flash
   1.166 +(Possibly: Could be expanded to hold on configuration data too)
   1.167 +*/
   1.168 +class TFlashInfo
   1.169 +{
   1.170 +public:
   1.171 +	inline TFlashInfo(TUint32 aPos, TUint32* aSize, TDes8* aData)
   1.172 +		:iPos(aPos),
   1.173 +		iSize(aSize),
   1.174 +		iData(aData){};
   1.175 +public:
   1.176 +	TUint32 iPos;
   1.177 +	TUint32* iSize;	
   1.178 +	 TDes8* iData;	
   1.179 +};
   1.180 +//
   1.181 +// class TRM_DebugMemoryInfo
   1.182 +//
   1.183 +class TRM_DebugMemoryInfo
   1.184 +{
   1.185 +public:
   1.186 +
   1.187 +	inline TRM_DebugMemoryInfo(const TUint32 aAddress, const TUint32 aLength, TDesC8 *aData)
   1.188 +				: iAddress(aAddress),
   1.189 +				  iLength(aLength),
   1.190 +				  iData(aData) {};
   1.191 +	
   1.192 +public:
   1.193 +
   1.194 +	TUint32 iAddress;
   1.195 +	TUint32	iLength;
   1.196 +	TDesC8*	iData;
   1.197 +};
   1.198 +
   1.199 +
   1.200 +/**
   1.201 +@deprecated
   1.202 +This class is only used by TRK phase 1 functions.
   1.203 +
   1.204 +@see TRM_DebugRegisterInformation which offers similar storage suitable for use
   1.205 +with the TRK pahse 2 API.
   1.206 +*/
   1.207 +class TRM_DebugRegisterInfo
   1.208 +{
   1.209 +public:
   1.210 +
   1.211 +	inline TRM_DebugRegisterInfo(const TInt16 aFirstRegister, const TInt16 aLastRegister, TDesC8 *aValues)
   1.212 +				: iFirstRegister(aFirstRegister),
   1.213 +				  iLastRegister(aLastRegister),
   1.214 +				  iValues(aValues) {};
   1.215 +	
   1.216 +public:
   1.217 +
   1.218 +	TInt16	iFirstRegister;
   1.219 +	TInt16	iLastRegister;
   1.220 +	TDesC8*	iValues;
   1.221 +};
   1.222 +
   1.223 +/**
   1.224 +Structure used to store information about registers
   1.225 +*/
   1.226 +class TRM_DebugRegisterInformation
   1.227 +{
   1.228 +public:
   1.229 +
   1.230 +	inline TRM_DebugRegisterInformation(const TDes8 *aRegisterIds=NULL, TDes8 *aRegisterValues=NULL, TDes8 *aRegisterFlags=NULL)
   1.231 +		: iRegisterIds(aRegisterIds),
   1.232 +		  iRegisterValues(aRegisterValues),
   1.233 +		  iRegisterFlags(aRegisterFlags) {};
   1.234 +	
   1.235 +public:
   1.236 +
   1.237 +	const TDes8* iRegisterIds;
   1.238 +	TDes8* iRegisterValues;
   1.239 +	TDes8* iRegisterFlags;
   1.240 +};
   1.241 +
   1.242 +//
   1.243 +// class TRM_DebugTaskInfo
   1.244 +//
   1.245 +class TRM_DebugTaskInfo
   1.246 +{
   1.247 +public:
   1.248 +
   1.249 +	inline TRM_DebugTaskInfo(TUint32 aOtherId)
   1.250 +				: iId(0),
   1.251 +				  iOtherId(aOtherId),
   1.252 +				  iPriority(0) { iName.FillZ(); };
   1.253 +
   1.254 +public:
   1.255 +
   1.256 +	TUint32 iId;
   1.257 +	TUint32 iOtherId;
   1.258 +	TUint32 iPriority;	
   1.259 +	TBuf8<KMaxName> iName;
   1.260 +};
   1.261 +
   1.262 +//
   1.263 +// class TRM_DebugStepInfo
   1.264 +//
   1.265 +class TRM_DebugStepInfo
   1.266 +{
   1.267 +public:
   1.268 +
   1.269 +	inline TRM_DebugStepInfo(const TUint32 aStartAddress, const TUint32 aStopAddress, const TBool aStepInto)
   1.270 +				: iStartAddress(aStartAddress),
   1.271 +				  iStopAddress(aStopAddress),
   1.272 +				  iStepInto(aStepInto) {};
   1.273 +
   1.274 +public:
   1.275 +
   1.276 +	TUint32 iStartAddress;
   1.277 +	TUint32 iStopAddress;
   1.278 +	TBool iStepInto;
   1.279 +};
   1.280 +
   1.281 +
   1.282 +//
   1.283 +// class TRM_DebugDriverInfo
   1.284 +//
   1.285 +class TRM_DebugDriverInfo
   1.286 +{
   1.287 +public:
   1.288 +
   1.289 +	TUint32 iPanic1Address;
   1.290 +	TUint32 iPanic2Address;
   1.291 +	TUint32 iException1Address;
   1.292 +	TUint32 iException2Address;
   1.293 +	TUint32 iLibraryLoadedAddress;
   1.294 +	TUint32 iUserLibraryEnd;
   1.295 +};
   1.296 +
   1.297 +
   1.298 +//
   1.299 +// class TRM_DebugProcessInfo
   1.300 +//
   1.301 +class TRM_DebugProcessInfo
   1.302 +{
   1.303 +public:
   1.304 +
   1.305 +	inline TRM_DebugProcessInfo(TUint32 *aCodeAddress, TUint32 *aDataAddress)
   1.306 +				: iCodeAddress(aCodeAddress),
   1.307 +				  iDataAddress(aDataAddress) {};
   1.308 +
   1.309 +public:
   1.310 +
   1.311 +	TUint32* iCodeAddress;
   1.312 +	TUint32* iDataAddress;
   1.313 +};
   1.314 +
   1.315 +//
   1.316 +// class TRM_DebugEventActionInfo
   1.317 +//
   1.318 +class TRM_DebugEventActionInfo
   1.319 +{
   1.320 +public:
   1.321 +	inline TRM_DebugEventActionInfo(TUint32 aEvent, TUint32 aAction, TUint64 aAgentId)
   1.322 +		: iEvent(aEvent),
   1.323 +		iAction(aAction),
   1.324 +		iAgentId(aAgentId) {};
   1.325 +public:
   1.326 +	TUint32 iEvent;
   1.327 +	TUint32 iAction;
   1.328 +	TUint64 iAgentId;
   1.329 +};
   1.330 +
   1.331 +//
   1.332 +// class TRM_DebugEventInfo
   1.333 +//
   1.334 +class TRM_DebugEventInfo
   1.335 +{
   1.336 +public:
   1.337 +	inline TRM_DebugEventInfo(TDesC8& aProcessName, TUint32& aBufSize)
   1.338 +		: iProcessName(aProcessName),
   1.339 +		iBufSize(aBufSize) {};
   1.340 +
   1.341 +public:
   1.342 +	TDesC8& iProcessName;
   1.343 +	TUint32& iBufSize;
   1.344 +};
   1.345 +
   1.346 +//
   1.347 +// class TRMD_DebugAgentId
   1.348 +//
   1.349 +class TRM_DebugAgentId
   1.350 +{
   1.351 +public:
   1.352 +	inline TRM_DebugAgentId(TUint64 aAgentId)
   1.353 +		: iAgentId(aAgentId) {};
   1.354 +
   1.355 +public:
   1.356 +	TUint64 iAgentId;
   1.357 +};
   1.358 +
   1.359 +//
   1.360 +// Class TRMD_DebugCancelInfo
   1.361 +//
   1.362 +class TRMD_DebugCancelInfo
   1.363 +{
   1.364 +public:
   1.365 +	inline TRMD_DebugCancelInfo(TUint32 aCancelRequest,TDesC8& aProcessName, TUint64 aAgentId)
   1.366 +		: iCancelRequest(aCancelRequest),
   1.367 +		iProcessName(aProcessName),
   1.368 +		iAgentId(aAgentId) {};
   1.369 +
   1.370 +	inline TRMD_DebugCancelInfo(void)
   1.371 +		: iCancelRequest(0),
   1.372 +	iAgentId(0)
   1.373 +	{
   1.374 +	};
   1.375 +
   1.376 +public:
   1.377 +	TUint32 iCancelRequest;
   1.378 +	TBuf8<KMaxName> iProcessName;
   1.379 +	TUint64 iAgentId;
   1.380 +};
   1.381 +
   1.382 +class TEventMetaData
   1.383 +	{
   1.384 +public:
   1.385 +	TBuf8<KMaxName> iTargetProcessName;
   1.386 +	TUint64 iDebugAgentProcessId;
   1.387 +	};
   1.388 +
   1.389 +/**
   1.390 +@internalComponent
   1.391 +*/
   1.392 +class TSetBreakInfo
   1.393 +{
   1.394 +public:
   1.395 +
   1.396 +	inline TSetBreakInfo(Debug::TBreakId* aBreakId,
   1.397 +		TUint64 aId,\
   1.398 +		TUint32 aAddress,\
   1.399 +		Debug::TArchitectureMode aMode,
   1.400 +		TBool aThreadSpecific)
   1.401 +				: iBreakId(aBreakId),
   1.402 +				  iId(aId),
   1.403 +				  iAddress(aAddress),
   1.404 +				  iMode(aMode),
   1.405 +       				  iThreadSpecific(aThreadSpecific) {};
   1.406 +
   1.407 +inline TSetBreakInfo(void)
   1.408 +			: iBreakId((Debug::TBreakId*)0),
   1.409 +			  iId(0),
   1.410 +			  iAddress(0),
   1.411 +			  iMode(Debug::EArmMode),
   1.412 +       			  iThreadSpecific(ETrue) {};
   1.413 +
   1.414 +
   1.415 +public:
   1.416 +	Debug::TBreakId* iBreakId;
   1.417 +	TUint64 iId;
   1.418 +	TUint32 iAddress;
   1.419 +	Debug::TArchitectureMode iMode;
   1.420 +	TBool iThreadSpecific;
   1.421 +};
   1.422 +
   1.423 +/**
   1.424 +@internalComponent
   1.425 +*/
   1.426 +class TModifyBreakInfo
   1.427 +{
   1.428 +public:
   1.429 +
   1.430 +	inline TModifyBreakInfo(Debug::TBreakId aBreakId,\
   1.431 +		const TUint64 aThreadId,\
   1.432 +		const TUint32 aAddress,\
   1.433 +		const Debug::TArchitectureMode aMode)
   1.434 +				: iBreakId(aBreakId),
   1.435 +				  iThreadId(aThreadId),
   1.436 +				  iAddress(aAddress),
   1.437 +				  iMode(aMode) {};
   1.438 +
   1.439 +public:
   1.440 +	const Debug::TBreakId iBreakId;
   1.441 +	const TUint64 iThreadId;
   1.442 +	const TUint32 iAddress;
   1.443 +	const Debug::TArchitectureMode iMode;
   1.444 +};
   1.445 +
   1.446 +/**
   1.447 +@internalComponent
   1.448 +*/
   1.449 +class TModifyProcessBreakInfo
   1.450 +{
   1.451 +public:
   1.452 +
   1.453 +	inline TModifyProcessBreakInfo(Debug::TBreakId aBreakId,\
   1.454 +		const TUint64 aProcessId,\
   1.455 +		const TUint32 aAddress,\
   1.456 +		const Debug::TArchitectureMode aMode)
   1.457 +				: iBreakId(aBreakId),
   1.458 +				  iProcessId(aProcessId),
   1.459 +				  iAddress(aAddress),
   1.460 +				  iMode(aMode) {};
   1.461 +
   1.462 +public:
   1.463 +	const Debug::TBreakId iBreakId;
   1.464 +	const TUint64 iProcessId;
   1.465 +	const TUint32 iAddress;
   1.466 +	const Debug::TArchitectureMode iMode;
   1.467 +};
   1.468 +
   1.469 +/**
   1.470 +@internalComponent
   1.471 +*/
   1.472 +class TGetBreakInfo
   1.473 +{
   1.474 +public:
   1.475 +
   1.476 +	inline TGetBreakInfo(Debug::TBreakId aBreakId,\
   1.477 +		TUint64& aId,\
   1.478 +		TUint32& aAddress,\
   1.479 +		Debug::TArchitectureMode& aMode,
   1.480 +		TBool& aThreadSpecific)
   1.481 +				: iBreakId(aBreakId),
   1.482 +				  iId(&aId),
   1.483 +				  iAddress(&aAddress),
   1.484 +				  iMode(&aMode),
   1.485 +       				  iThreadSpecific(&aThreadSpecific) {};
   1.486 +
   1.487 +	inline TGetBreakInfo()
   1.488 +				: iBreakId((Debug::TBreakId)0),
   1.489 +				  iId((TUint64*)0),
   1.490 +				  iAddress((TUint32*)0),
   1.491 +				  iMode((Debug::TArchitectureMode*)0),
   1.492 +       				  iThreadSpecific((TBool*)0)	{};
   1.493 +
   1.494 +public:
   1.495 +	const Debug::TBreakId iBreakId;
   1.496 +	TUint64* iId;
   1.497 +	TUint32* iAddress;
   1.498 +	Debug::TArchitectureMode* iMode;
   1.499 +	TBool* iThreadSpecific;
   1.500 +};
   1.501 +
   1.502 +//
   1.503 +// class RRM_DebugDriver
   1.504 +//
   1.505 +class RRM_DebugDriver : public RBusLogicalChannel
   1.506 +{
   1.507 +public:
   1.508 +
   1.509 +	enum TControl
   1.510 +	{
   1.511 +		EControlSetBreak = 0,
   1.512 +		EControlClearBreak,
   1.513 +		EControlModifyBreak,
   1.514 +		EControlBreakInfo,
   1.515 +		EControlSuspendThread,
   1.516 +		EControlResumeThread,
   1.517 +		EControlStepRange,
   1.518 +		EControlReadMemory,
   1.519 +		EControlWriteMemory,
   1.520 +		EControlReadRegisters,
   1.521 +		EControlWriteRegisters,
   1.522 +		EControlGetStaticLibraryInfo,
   1.523 +		EControlGetDebugFunctionalityBufSize,
   1.524 +		EControlGetDebugFunctionality,
   1.525 +		EControlReadRegistersLegacy,
   1.526 +		EControlWriteRegistersLegacy,		
   1.527 +		EControlGetMemoryOperationMaxBlockSize,		
   1.528 +		EControlAttachProcess,
   1.529 +		EControlDetachProcess,
   1.530 +		EControlDetachAgent,
   1.531 +		EControlSetEventAction,
   1.532 +		EControlGetList,
   1.533 +		EControlStep,
   1.534 +		EControlIsDebuggable,
   1.535 +		EControlKillProcess,		
   1.536 +		EControlModifyProcessBreak,
   1.537 +	};
   1.538 +	
   1.539 +	enum TRequest
   1.540 +	{
   1.541 +		ERequestGetEvent=0x0, ERequestGetEventCancel=0x1
   1.542 +	};	
   1.543 +		
   1.544 +public:
   1.545 +
   1.546 +	inline TInt Open(const TRM_DebugDriverInfo aDriverInfo);
   1.547 +
   1.548 +	inline TInt	SetBreak(Debug::TBreakId &aBreakId,const TUint32 aThreadId, const TUint32 aAddress, const Debug::TArchitectureMode aThumbMode );
   1.549 +	inline TInt	SetProcessBreak(Debug::TBreakId &aBreakId,const TUint32 aProcessId, const TUint32 aAddress, const Debug::TArchitectureMode aThumbMode );
   1.550 +	
   1.551 +	inline TInt	ClearBreak(const TInt32 aBreakId);
   1.552 +	
   1.553 +	inline TInt	ModifyBreak(const Debug::TBreakId aBreakId, const TUint32 aThreadId, const TUint32 aAddress, const Debug::TArchitectureMode aArchitectureMode );
   1.554 +	inline TInt	ModifyProcessBreak(const Debug::TBreakId aBreakId, const TUint32 aProcessId, const TUint32 aAddress, const Debug::TArchitectureMode aArchitectureMode );
   1.555 +	
   1.556 +	inline TInt BreakInfo(const Debug::TBreakId aBreakId, TUint64& aId, TUint32& aAddress, Debug::TArchitectureMode& aMode, TBool& aThreadSpecific);
   1.557 +	
   1.558 +	inline TInt	SuspendThread(const TUint32 aThreadId);
   1.559 +	inline TInt	ResumeThread(const TUint32 aThreadId);
   1.560 +	inline TInt	StepRange(const TUint32 aThreadId, const TUint32 aStartAddress, const TUint32 aStopAddress, TBool aStepInto);
   1.561 +	inline TInt ReadMemory(const TUint32 aThreadId, const TUint32 aAddress, const TUint32 aLength, TDes8 &aData);
   1.562 +	inline TInt WriteMemory(const TUint32 aThreadId, const TUint32 aAddress, const TUint32 aLength, const TDesC8 &aData);
   1.563 +	inline TInt ReadRegisters(const TUint32 aThreadId, const TDes8 &aRegisterIds, TDes8 &aRegisterValues, TDes8 &aRegisterFlags);
   1.564 +	inline TInt WriteRegisters(const TUint32 aThreadId, const TDes8 &aRegisterIds, const TDes8 &aRegisterValues, TDes8 &aRegisterFlags);
   1.565 +	inline TInt ReadRegisters(const TUint32 aThreadId, const TInt32 aFirstRegister, const TInt32 aLastRegister, TDes8 &aValues);
   1.566 +	inline TInt WriteRegisters(const TUint32 aThreadId, const TInt32 aFirstRegister, const TInt32 aLastRegister, TDesC8 &aValues);
   1.567 +	inline void GetEvent(TDesC8& aProcessName, TUint64 aAgentId, TRequestStatus &aStatus, Debug::TEventInfo &aEventInfo);
   1.568 +	inline void CancelGetEvent(TDesC8& aProcessName, TUint64 aAgentId);
   1.569 +//	inline TInt GetProcessInfo(const TInt aIndex, TRM_DebugTaskInfo &aInfo);
   1.570 +//	inline TInt GetThreadInfo(const TInt aIndex, TRM_DebugTaskInfo &aInfo);
   1.571 +	inline TInt GetStaticLibraryInfo(const TInt aIndex, Debug::TEventInfo &aInfo);
   1.572 +	inline TInt GetDebugFunctionalityBufSize(TUint32 &aBufSize);
   1.573 +	inline TInt GetDebugFunctionality(TDes8& aDebugFunctionality);
   1.574 +	inline TInt GetMemoryOperationMaxBlockSize(TUint32 &aMaxSize);
   1.575 +	inline TInt AttachProcess(TDesC8& aProcessName, TUint64 aAgentId);
   1.576 +	inline TInt DetachProcess(TDesC8& aProcessName, TUint64 aAgentId);
   1.577 +	inline TInt DetachAgent(TUint64 aAgentId);
   1.578 +	inline TInt SetEventAction(TDesC8& aProcessName, Debug::TEventType aEvent, Debug::TKernelEventAction aEventAction, TUint64 aAgentId);
   1.579 +	inline TInt GetList(const Debug::TListId aType, const Debug::TListScope aListScope, const TUint64 aTargetId, const TUint64 aDebugProcessId, TDes8& aBuffer, TUint32& aDataSize);
   1.580 +	inline TInt Step(const TUint32 aThreadId, const TUint32 aNumSteps);
   1.581 +	inline TInt IsDebuggable(const TUint32 aProcessId);
   1.582 +	inline TInt KillProcess(const TUint32 aProcessId, const TInt32 aReason);
   1.583 +};
   1.584 +
   1.585 +_LIT(KRM_DebugDriverName,"RM Debug Driver");
   1.586 +
   1.587 +//priority set equal to that of KDfcThread0Priority defined in e32/kernel/sinit.cpp
   1.588 +const TInt KRmDebugDriverThreadPriority = 27;
   1.589 +
   1.590 +// Version information
   1.591 +const TInt KMajorVersionNumber=2;
   1.592 +const TInt KMinorVersionNumber=1;
   1.593 +const TInt KBuildVersionNumber=0;
   1.594 +
   1.595 +
   1.596 +inline TInt RRM_DebugDriver::Open(const TRM_DebugDriverInfo aDriverInfo)
   1.597 +{
   1.598 +	TBuf8<32> buf;
   1.599 +	buf.Append((TUint8*)&aDriverInfo.iPanic1Address, 4);
   1.600 +	buf.Append((TUint8*)&aDriverInfo.iPanic2Address, 4);
   1.601 +	buf.Append((TUint8*)&aDriverInfo.iException1Address, 4);
   1.602 +	buf.Append((TUint8*)&aDriverInfo.iException2Address, 4);
   1.603 +	buf.Append((TUint8*)&aDriverInfo.iLibraryLoadedAddress, 4);
   1.604 +	buf.Append((TUint8*)&aDriverInfo.iUserLibraryEnd, 4);
   1.605 +	
   1.606 +	#ifdef EKA2
   1.607 +	return DoCreate(KRM_DebugDriverName, TVersion(KMajorVersionNumber, KMinorVersionNumber, KBuildVersionNumber), KNullUnit, NULL, &buf);
   1.608 +	#else
   1.609 +	return DoCreate(KRM_DebugDriverName, TVersion(KMajorVersionNumber, KMinorVersionNumber, KBuildVersionNumber), NULL, KNullUnit, NULL, &buf);
   1.610 +	#endif
   1.611 +}
   1.612 +
   1.613 +inline TInt RRM_DebugDriver::SetBreak(Debug::TBreakId &aBreakId, const TUint32 aThreadId, const TUint32 aAddress, const Debug::TArchitectureMode aMode )
   1.614 +{
   1.615 +	TSetBreakInfo info(&aBreakId, aThreadId, aAddress, aMode, ETrue);
   1.616 +	return DoSvControl(EControlSetBreak, reinterpret_cast<TAny*>(&info),0);
   1.617 +}
   1.618 +inline TInt RRM_DebugDriver::SetProcessBreak(Debug::TBreakId &aBreakId, const TUint32 aProcessId, const TUint32 aAddress, const Debug::TArchitectureMode aMode )
   1.619 +{
   1.620 +	TSetBreakInfo info(&aBreakId, aProcessId, aAddress, aMode, EFalse);
   1.621 +	return DoSvControl(EControlSetBreak, reinterpret_cast<TAny*>(&info),0);
   1.622 +}
   1.623 +
   1.624 +inline TInt RRM_DebugDriver::ClearBreak(const Debug::TBreakId aBreakId)
   1.625 +{
   1.626 +	return DoSvControl(EControlClearBreak, reinterpret_cast<TAny*>(aBreakId), 0);
   1.627 +}
   1.628 +
   1.629 +inline TInt RRM_DebugDriver::ModifyBreak(const Debug::TBreakId aBreakId, const TUint32 aThreadId, const TUint32 aAddress, const Debug::TArchitectureMode aMode)
   1.630 +{
   1.631 +	TModifyBreakInfo info(aBreakId, aThreadId, aAddress, aMode);
   1.632 +	return DoControl(EControlModifyBreak, reinterpret_cast<TAny*>(&info), 0);
   1.633 +}
   1.634 +
   1.635 +inline TInt RRM_DebugDriver::ModifyProcessBreak(const Debug::TBreakId aBreakId, const TUint32 aProcessId, const TUint32 aAddress, const Debug::TArchitectureMode aMode)
   1.636 +{
   1.637 +	TModifyProcessBreakInfo info(aBreakId, aProcessId, aAddress, aMode);
   1.638 +	return DoControl(EControlModifyProcessBreak, reinterpret_cast<TAny*>(&info), 0);
   1.639 +}
   1.640 +
   1.641 +inline TInt RRM_DebugDriver::BreakInfo(const Debug::TBreakId aBreakId, TUint64& aId, TUint32& aAddress, Debug::TArchitectureMode& aMode, TBool& aThreadSpecific)
   1.642 +{
   1.643 +	TGetBreakInfo info(aBreakId, aId, aAddress, aMode, aThreadSpecific);
   1.644 +	return DoControl(EControlBreakInfo, reinterpret_cast<TAny*>(&info), 0);
   1.645 +}
   1.646 +
   1.647 +inline TInt RRM_DebugDriver::SuspendThread(const TUint32 aThreadId)
   1.648 +{
   1.649 +	return DoControl(EControlSuspendThread, reinterpret_cast<TAny*>(aThreadId));
   1.650 +}
   1.651 +
   1.652 +inline TInt RRM_DebugDriver::ResumeThread(const TUint32 aThreadId)
   1.653 +{
   1.654 +	return DoSvControl(EControlResumeThread, reinterpret_cast<TAny*>(aThreadId));
   1.655 +}
   1.656 +
   1.657 +inline TInt RRM_DebugDriver::StepRange(const TUint32 aThreadId, const TUint32 aStartAddress, const TUint32 aStopAddress, TBool aStepInto)
   1.658 +{
   1.659 +	TRM_DebugStepInfo info(aStartAddress, aStopAddress, aStepInto);
   1.660 +	return DoSvControl(EControlStepRange, reinterpret_cast<TAny*>(aThreadId), (TAny*)&info);
   1.661 +}
   1.662 +
   1.663 +inline TInt RRM_DebugDriver::ReadMemory(const TUint32 aThreadId, const TUint32 aAddress, const TUint32 aLength, TDes8 &aData)
   1.664 +{
   1.665 +	TRM_DebugMemoryInfo info(aAddress, aLength, &aData);
   1.666 +	return DoControl(EControlReadMemory, reinterpret_cast<TAny*>(aThreadId), (TAny*)&info);
   1.667 +}
   1.668 +
   1.669 +inline TInt RRM_DebugDriver::WriteMemory(const TUint32 aThreadId, const TUint32 aAddress, const TUint32 aLength, const TDesC8 &aData)
   1.670 +{
   1.671 +	TRM_DebugMemoryInfo info(aAddress, aLength, (TDesC8*)&aData);
   1.672 +	return DoControl(EControlWriteMemory, reinterpret_cast<TAny*>(aThreadId), (TAny*)&info);
   1.673 +}
   1.674 +
   1.675 +inline TInt RRM_DebugDriver::ReadRegisters(const TUint32 aThreadId, const TDes8 &aRegisterIds, TDes8 &aRegisterValues, TDes8 &aRegisterFlags)
   1.676 +	{
   1.677 +	TRM_DebugRegisterInformation info(&aRegisterIds, &aRegisterValues, &aRegisterFlags);
   1.678 +	return DoControl(EControlReadRegisters, reinterpret_cast<TAny*>(aThreadId), (TAny*)&info);	
   1.679 +	}
   1.680 +
   1.681 +inline TInt RRM_DebugDriver::WriteRegisters(const TUint32 aThreadId, const TDes8 &aRegisterIds, const TDes8 &aRegisterValues, TDes8 &aRegisterFlags)
   1.682 +	{
   1.683 +	TRM_DebugRegisterInformation info(&aRegisterIds, (TDes8*)&aRegisterValues, &aRegisterFlags);
   1.684 +	return DoControl(EControlWriteRegisters, reinterpret_cast<TAny*>(aThreadId), (TAny*)&info);
   1.685 +	}
   1.686 +
   1.687 +inline TInt RRM_DebugDriver::ReadRegisters(const TUint32 aThreadId, const TInt32 aFirstRegister, const TInt32 aLastRegister, TDes8 &aValues)
   1.688 +{
   1.689 +	TRM_DebugRegisterInfo info(aFirstRegister, aLastRegister, &aValues);
   1.690 +	return DoControl(EControlReadRegistersLegacy, reinterpret_cast<TAny*>(aThreadId), (TAny*)&info);
   1.691 +}
   1.692 +
   1.693 +inline TInt RRM_DebugDriver::WriteRegisters(const TUint32 aThreadId, const TInt32 aFirstRegister, const TInt32 aLastRegister, TDesC8 &aValues)
   1.694 +{
   1.695 +	TRM_DebugRegisterInfo info(aFirstRegister, aLastRegister, &aValues);
   1.696 +	return DoControl(EControlWriteRegistersLegacy, reinterpret_cast<TAny*>(aThreadId), (TAny*)&info);
   1.697 +}
   1.698 +
   1.699 +inline void RRM_DebugDriver::GetEvent(TDesC8& aProcessName, TUint64 aAgentId, TRequestStatus &aStatus, Debug::TEventInfo &aEventInfo)
   1.700 +{
   1.701 +	// temporary object not needed beyond the DoRequest call
   1.702 +	TEventMetaData eventMetaData;
   1.703 +	eventMetaData.iTargetProcessName.Copy(aProcessName);
   1.704 +	eventMetaData.iDebugAgentProcessId = aAgentId;
   1.705 +	DoRequest(ERequestGetEvent, aStatus, (TAny*)&aEventInfo, (TAny*)&eventMetaData);
   1.706 +}
   1.707 +
   1.708 +inline void RRM_DebugDriver::CancelGetEvent(TDesC8& aProcessName, TUint64 aAgentId)
   1.709 +{
   1.710 +	TRMD_DebugCancelInfo info(ERequestGetEventCancel,aProcessName,aAgentId);
   1.711 +	DoCancel(reinterpret_cast<TInt>(&info));
   1.712 +}
   1.713 +
   1.714 +inline TInt RRM_DebugDriver::GetStaticLibraryInfo(const TInt aIndex, Debug::TEventInfo &aInfo)
   1.715 +{
   1.716 +	return DoControl(EControlGetStaticLibraryInfo, reinterpret_cast<TAny*>(aIndex), (TAny*)&aInfo);
   1.717 +}
   1.718 +
   1.719 +inline TInt RRM_DebugDriver::GetDebugFunctionalityBufSize(TUint32 &aBufSize)
   1.720 +{
   1.721 +	return DoControl(EControlGetDebugFunctionalityBufSize, reinterpret_cast<TAny*>(&aBufSize));
   1.722 +}
   1.723 +
   1.724 +inline TInt RRM_DebugDriver::GetDebugFunctionality(TDes8& aDebugFunctionality)
   1.725 +{
   1.726 +	return DoControl(EControlGetDebugFunctionality,reinterpret_cast<TAny*>(&aDebugFunctionality));
   1.727 +}
   1.728 +
   1.729 +inline TInt RRM_DebugDriver::GetMemoryOperationMaxBlockSize(TUint32 &aMaxSize)
   1.730 +{
   1.731 +	return DoControl(EControlGetMemoryOperationMaxBlockSize, reinterpret_cast<TAny*>(&aMaxSize));
   1.732 +}
   1.733 +
   1.734 +inline TInt RRM_DebugDriver::AttachProcess(TDesC8& aProcessName, TUint64 aAgentId)
   1.735 +{
   1.736 +	TRM_DebugAgentId info(aAgentId);
   1.737 +	return DoControl(EControlAttachProcess,reinterpret_cast<TAny*>(&aProcessName),reinterpret_cast<TAny*>(&info));
   1.738 +}
   1.739 +
   1.740 +inline TInt RRM_DebugDriver::DetachProcess(TDesC8& aProcessName, TUint64 aAgentId)
   1.741 +{
   1.742 +	TRM_DebugAgentId info(aAgentId);
   1.743 +	return DoControl(EControlDetachProcess,reinterpret_cast<TAny*>(&aProcessName),reinterpret_cast<TAny*>(&info));
   1.744 +}
   1.745 +
   1.746 +inline TInt RRM_DebugDriver::DetachAgent(TUint64 aAgentId)
   1.747 +{
   1.748 +	TRM_DebugAgentId info(aAgentId);
   1.749 +	return DoControl(EControlDetachAgent,reinterpret_cast<TAny*>(&info),0);
   1.750 +}
   1.751 +
   1.752 +inline TInt RRM_DebugDriver::SetEventAction(TDesC8& aProcessName, Debug::TEventType aEvent, Debug::TKernelEventAction aEventAction, TUint64 aAgentId)
   1.753 +{
   1.754 +	TRM_DebugEventActionInfo info (aEvent,aEventAction, aAgentId);
   1.755 +	return DoControl(EControlSetEventAction,reinterpret_cast<TAny*>(&aProcessName),(TAny*)&info);
   1.756 +}
   1.757 +
   1.758 +inline TInt RRM_DebugDriver::GetList(const Debug::TListId aType, const Debug::TListScope aListScope, const TUint64 aTargetId, const TUint64 aDebugProcessId, TDes8& aBuffer, TUint32& aDataSize)
   1.759 +{
   1.760 +	TListInformation info(aType, aListScope, &aBuffer, &aDataSize, aTargetId);
   1.761 +	return DoControl(EControlGetList, (TAny*)&info);
   1.762 +}
   1.763 +
   1.764 +inline TInt RRM_DebugDriver::Step(const TUint32 aThreadId, const TUint32 aNumSteps)
   1.765 +{
   1.766 +	return DoControl(EControlStep,reinterpret_cast<TAny*>(aThreadId),reinterpret_cast<TAny*>(aNumSteps));
   1.767 +}
   1.768 +
   1.769 +inline TInt RRM_DebugDriver::IsDebuggable(const TUint32 aProcessId)
   1.770 +{
   1.771 +	return DoControl(EControlIsDebuggable,reinterpret_cast<TAny*>(aProcessId),NULL);
   1.772 +}
   1.773 +
   1.774 +inline TInt RRM_DebugDriver::KillProcess(const TUint32 aProcessId, const TInt32 aReason)
   1.775 +{
   1.776 +	return DoControl(EControlKillProcess,reinterpret_cast<TAny*>(aProcessId),reinterpret_cast<TAny*>(aReason));
   1.777 +}
   1.778 +
   1.779 +#endif // __RM_DEBUG_KERNELDRIVER_H__
   1.780 +