debugsrv/runmodedebug/rmdriver/src/d_debug_functionality.cpp
author hgs
Mon, 06 Sep 2010 15:00:47 +0300
changeset 51 98307c651589
parent 42 0ff24a8f6ca2
child 56 aa2539c91954
permissions -rw-r--r--
201035
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
42
hgs
parents:
diff changeset
     1
// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
hgs
parents:
diff changeset
     2
// All rights reserved.
hgs
parents:
diff changeset
     3
// This component and the accompanying materials are made available
hgs
parents:
diff changeset
     4
// under the terms of the License "Eclipse Public License v1.0"
hgs
parents:
diff changeset
     5
// which accompanies this distribution, and is available
hgs
parents:
diff changeset
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
hgs
parents:
diff changeset
     7
//
hgs
parents:
diff changeset
     8
// Initial Contributors:
hgs
parents:
diff changeset
     9
// Nokia Corporation - initial contribution.
hgs
parents:
diff changeset
    10
//
hgs
parents:
diff changeset
    11
// Contributors:
hgs
parents:
diff changeset
    12
//
hgs
parents:
diff changeset
    13
// Description:
hgs
parents:
diff changeset
    14
// Defines the DebugFunctionality class. This is responsible for
hgs
parents:
diff changeset
    15
// providing configuration data needed by a host debugger to be able
hgs
parents:
diff changeset
    16
// to correctly use the functionality provided by the run-mode debug subsystem.
hgs
parents:
diff changeset
    17
// 
hgs
parents:
diff changeset
    18
hgs
parents:
diff changeset
    19
#include <e32def.h>
hgs
parents:
diff changeset
    20
#include <e32def_private.h>
hgs
parents:
diff changeset
    21
#include <e32cmn.h>
hgs
parents:
diff changeset
    22
#include <e32cmn_private.h>
hgs
parents:
diff changeset
    23
#include <u32std.h>
hgs
parents:
diff changeset
    24
#include <kernel/kernel.h>
hgs
parents:
diff changeset
    25
#include <rm_debug_api.h>
hgs
parents:
diff changeset
    26
#include "d_rmd_breakpoints.h"
hgs
parents:
diff changeset
    27
#include "rm_debug_kerneldriver.h"
hgs
parents:
diff changeset
    28
#include "d_debug_functionality.h"
hgs
parents:
diff changeset
    29
hgs
parents:
diff changeset
    30
using namespace Debug;
hgs
parents:
diff changeset
    31
hgs
parents:
diff changeset
    32
// Core
hgs
parents:
diff changeset
    33
const TTag DebugFunctionalityCoreInfo[] =
hgs
parents:
diff changeset
    34
	{
hgs
parents:
diff changeset
    35
	{ECoreEvents,ETagTypeBoolean,0,ETrue},
hgs
parents:
diff changeset
    36
	{ECoreStartStop,ETagTypeBoolean,0,ETrue},
hgs
parents:
diff changeset
    37
	{ECoreMemory,ETagTypeBoolean,0,ETrue},
hgs
parents:
diff changeset
    38
	{ECoreRegister,ETagTypeBoolean,0,ETrue},
hgs
parents:
diff changeset
    39
	{ECoreBreakpoint,ETagTypeBoolean,0,ETrue},
hgs
parents:
diff changeset
    40
	{ECoreStepping,ETagTypeBoolean,0,ETrue},
hgs
parents:
diff changeset
    41
	{ECoreLists,ETagTypeBoolean,0,ETrue},
hgs
parents:
diff changeset
    42
	{ECoreLogging,ETagTypeBoolean,0,EFalse},
hgs
parents:
diff changeset
    43
	{ECoreHardware,ETagTypeBoolean,0,EFalse},
hgs
parents:
diff changeset
    44
	{ECoreApiConstants,ETagTypeBoolean,0,ETrue},
hgs
parents:
diff changeset
    45
	{ECoreKillObjects,ETagTypeBoolean,0,ETrue},
hgs
parents:
diff changeset
    46
	{ECoreSecurity,ETagTypeBoolean,0,ETrue},	
hgs
parents:
diff changeset
    47
	};
hgs
parents:
diff changeset
    48
hgs
parents:
diff changeset
    49
const TSubBlock DebugFunctionalityCore[] =
hgs
parents:
diff changeset
    50
	{
hgs
parents:
diff changeset
    51
	ETagHeaderIdCore,ECoreLast,
hgs
parents:
diff changeset
    52
	(TTag*)DebugFunctionalityCoreInfo
hgs
parents:
diff changeset
    53
	};
hgs
parents:
diff changeset
    54
hgs
parents:
diff changeset
    55
// Memory
hgs
parents:
diff changeset
    56
const TTag DebugFunctionalityMemoryInfo[] =
hgs
parents:
diff changeset
    57
	{
hgs
parents:
diff changeset
    58
	{EMemoryRead,ETagTypeBoolean,0,ETrue}, 
hgs
parents:
diff changeset
    59
	{EMemoryWrite,ETagTypeBoolean,0,ETrue},
hgs
parents:
diff changeset
    60
	{EMemoryAccess64,ETagTypeBoolean,0,EFalse},
hgs
parents:
diff changeset
    61
	{EMemoryAccess32,ETagTypeBoolean,0,ETrue},
hgs
parents:
diff changeset
    62
	{EMemoryAccess16,ETagTypeBoolean,0,EFalse},
hgs
parents:
diff changeset
    63
	{EMemoryAccess8,ETagTypeBoolean,0,EFalse},
hgs
parents:
diff changeset
    64
	{EMemoryBE8,ETagTypeBoolean,0,EFalse},
hgs
parents:
diff changeset
    65
	{EMemoryBE32,ETagTypeBoolean,0,EFalse},
hgs
parents:
diff changeset
    66
	{EMemoryLE8,ETagTypeBoolean,0,ETrue},
hgs
parents:
diff changeset
    67
	{EMemoryMaxBlockSize,ETagTypeTUint32,0,16 * KKilo /* 16Kbytes */}	// binaryMax size of memory requests in bytes
hgs
parents:
diff changeset
    68
	};
hgs
parents:
diff changeset
    69
hgs
parents:
diff changeset
    70
const TSubBlock DebugFunctionalityMemory[]=
hgs
parents:
diff changeset
    71
	{
hgs
parents:
diff changeset
    72
	ETagHeaderIdMemory,EMemoryLast,
hgs
parents:
diff changeset
    73
	(TTag*)DebugFunctionalityMemoryInfo
hgs
parents:
diff changeset
    74
	};
hgs
parents:
diff changeset
    75
hgs
parents:
diff changeset
    76
// Kill Objects
hgs
parents:
diff changeset
    77
const TTag DebugFunctionalityKillObjectsInfo[] =
hgs
parents:
diff changeset
    78
	{
hgs
parents:
diff changeset
    79
	{EFunctionalityKillThread,ETagTypeBoolean,0,EFalse}, 
hgs
parents:
diff changeset
    80
	{EFunctionalityKillProcess,ETagTypeBoolean,0,ETrue}
hgs
parents:
diff changeset
    81
	};
hgs
parents:
diff changeset
    82
hgs
parents:
diff changeset
    83
const TSubBlock DebugFunctionalityKillObjects[]=
hgs
parents:
diff changeset
    84
	{
hgs
parents:
diff changeset
    85
	ETagHeaderIdKillObjects,EFunctionalityKillObjectLast,
hgs
parents:
diff changeset
    86
	(TTag*)DebugFunctionalityKillObjectsInfo
hgs
parents:
diff changeset
    87
	};
hgs
parents:
diff changeset
    88
hgs
parents:
diff changeset
    89
// Core Registers
hgs
parents:
diff changeset
    90
const TTag DebugFunctionalityRegistersCoreInfo[] =
hgs
parents:
diff changeset
    91
	{
hgs
parents:
diff changeset
    92
	{ERegisterR0,ETagTypeEnum, 4,EAccessReadWrite},
hgs
parents:
diff changeset
    93
	{ERegisterR1,ETagTypeEnum, 4,EAccessReadWrite},
hgs
parents:
diff changeset
    94
	{ERegisterR2,ETagTypeEnum, 4,EAccessReadWrite},
hgs
parents:
diff changeset
    95
	{ERegisterR3,ETagTypeEnum, 4,EAccessReadWrite},
hgs
parents:
diff changeset
    96
	{ERegisterR4,ETagTypeEnum, 4,EAccessReadWrite},
hgs
parents:
diff changeset
    97
	{ERegisterR5,ETagTypeEnum, 4,EAccessReadWrite},
hgs
parents:
diff changeset
    98
	{ERegisterR6,ETagTypeEnum, 4,EAccessReadWrite},
hgs
parents:
diff changeset
    99
	{ERegisterR7,ETagTypeEnum, 4,EAccessReadWrite},
hgs
parents:
diff changeset
   100
	{ERegisterR8,ETagTypeEnum, 4,EAccessReadWrite},
hgs
parents:
diff changeset
   101
	{ERegisterR9,ETagTypeEnum, 4,EAccessReadWrite},
hgs
parents:
diff changeset
   102
	{ERegisterR10,ETagTypeEnum, 4,EAccessReadWrite},
hgs
parents:
diff changeset
   103
	{ERegisterR11,ETagTypeEnum, 4,EAccessReadWrite},
hgs
parents:
diff changeset
   104
	{ERegisterR12,ETagTypeEnum, 4,EAccessReadWrite},
hgs
parents:
diff changeset
   105
	{ERegisterR13,ETagTypeEnum, 4,EAccessReadWrite},
hgs
parents:
diff changeset
   106
	{ERegisterR14,ETagTypeEnum, 4,EAccessReadWrite},
hgs
parents:
diff changeset
   107
	{ERegisterR15,ETagTypeEnum, 4,EAccessReadWrite},
hgs
parents:
diff changeset
   108
	{ERegisterCpsr,ETagTypeEnum, 4,EAccessReadWrite},
hgs
parents:
diff changeset
   109
	{ERegisterR13Svc,ETagTypeEnum, 4,EAccessNone},
hgs
parents:
diff changeset
   110
	{ERegisterR14Svc,ETagTypeEnum, 4,EAccessNone},
hgs
parents:
diff changeset
   111
	{ERegisterSpsrSvc,ETagTypeEnum, 4,EAccessNone},
hgs
parents:
diff changeset
   112
	{ERegisterR13Abt,ETagTypeEnum, 4,EAccessNone},
hgs
parents:
diff changeset
   113
	{ERegisterR14Abt,ETagTypeEnum, 4,EAccessNone},
hgs
parents:
diff changeset
   114
	{ERegisterSpsrAbt,ETagTypeEnum, 4,EAccessNone},
hgs
parents:
diff changeset
   115
	{ERegisterR13Und,ETagTypeEnum, 4,EAccessNone},
hgs
parents:
diff changeset
   116
	{ERegisterR14Und,ETagTypeEnum, 4,EAccessNone},
hgs
parents:
diff changeset
   117
	{ERegisterSpsrUnd,ETagTypeEnum, 4,EAccessNone},
hgs
parents:
diff changeset
   118
	{ERegisterR13Irq,ETagTypeEnum, 4,EAccessNone},
hgs
parents:
diff changeset
   119
	{ERegisterR14Irq,ETagTypeEnum, 4,EAccessNone},
hgs
parents:
diff changeset
   120
	{ERegisterSpsrIrq,ETagTypeEnum, 4,EAccessNone},
hgs
parents:
diff changeset
   121
	{ERegisterR8Fiq,ETagTypeEnum, 4,EAccessNone},
hgs
parents:
diff changeset
   122
	{ERegisterR9Fiq,ETagTypeEnum, 4,EAccessNone},
hgs
parents:
diff changeset
   123
	{ERegisterR10Fiq,ETagTypeEnum, 4,EAccessNone},
hgs
parents:
diff changeset
   124
	{ERegisterR11Fiq,ETagTypeEnum, 4,EAccessNone},
hgs
parents:
diff changeset
   125
	{ERegisterR12Fiq,ETagTypeEnum, 4,EAccessNone},
hgs
parents:
diff changeset
   126
	{ERegisterR13Fiq,ETagTypeEnum, 4,EAccessNone},
hgs
parents:
diff changeset
   127
	{ERegisterR14Fiq,ETagTypeEnum, 4,EAccessNone},
hgs
parents:
diff changeset
   128
	{ERegisterSpsrFiq, ETagTypeEnum, 4,EAccessNone}
hgs
parents:
diff changeset
   129
	};
hgs
parents:
diff changeset
   130
hgs
parents:
diff changeset
   131
const TSubBlock DebugFunctionalityRegistersCore[] =
hgs
parents:
diff changeset
   132
	{
hgs
parents:
diff changeset
   133
	ETagHeaderIdRegistersCore, ERegisterLast,
hgs
parents:
diff changeset
   134
	(TTag*)DebugFunctionalityRegistersCoreInfo
hgs
parents:
diff changeset
   135
	};
hgs
parents:
diff changeset
   136
hgs
parents:
diff changeset
   137
// Co-processor registers
hgs
parents:
diff changeset
   138
const TTag DebugFunctionalityRegistersCoProInfo[]=
hgs
parents:
diff changeset
   139
	{
hgs
parents:
diff changeset
   140
	//this is the DACR register
hgs
parents:
diff changeset
   141
	{0x00300f01, ETagTypeTUint32, 4, EAccessReadWrite} 
hgs
parents:
diff changeset
   142
	};
hgs
parents:
diff changeset
   143
hgs
parents:
diff changeset
   144
const TSubBlock DebugFunctionalityRegistersCoPro[]=
hgs
parents:
diff changeset
   145
	{
hgs
parents:
diff changeset
   146
	ETagHeaderIdCoProRegisters,1,
hgs
parents:
diff changeset
   147
	(TTag*)DebugFunctionalityRegistersCoProInfo
hgs
parents:
diff changeset
   148
	};
hgs
parents:
diff changeset
   149
hgs
parents:
diff changeset
   150
// Breakpoints
hgs
parents:
diff changeset
   151
const TTag DebugFunctionalityBreakpointsInfo[]=
hgs
parents:
diff changeset
   152
	{
hgs
parents:
diff changeset
   153
	{EBreakpointThread,ETagTypeBoolean,0,ETrue},
hgs
parents:
diff changeset
   154
	{EBreakpointProcess,ETagTypeBoolean,0,ETrue},
hgs
parents:
diff changeset
   155
	{EBreakpointSystem,ETagTypeBoolean,0,EFalse},
hgs
parents:
diff changeset
   156
	{EBreakpointArm,ETagTypeBoolean,0,ETrue},
hgs
parents:
diff changeset
   157
	{EBreakpointThumb,ETagTypeBoolean,0,ETrue},
hgs
parents:
diff changeset
   158
	{EBreakpointT2EE,ETagTypeBoolean,0,ETrue},
hgs
parents:
diff changeset
   159
	{EBreakpointArmInst,ETagTypeBoolean,0,EFalse},
hgs
parents:
diff changeset
   160
	{EBreakpointThumbInst,ETagTypeBoolean,0,EFalse},
hgs
parents:
diff changeset
   161
	{EBreakpointT2EEInst,ETagTypeBoolean,0,ETrue},
hgs
parents:
diff changeset
   162
	{EBreakpointSetArmInst,ETagTypeBoolean,0,EFalse},
hgs
parents:
diff changeset
   163
	{EBreakpointSetThumbInst,ETagTypeBoolean,0,EFalse},
hgs
parents:
diff changeset
   164
	{EBreakpointSetT2EEInst,ETagTypeBoolean,0,ETrue}
hgs
parents:
diff changeset
   165
	};
hgs
parents:
diff changeset
   166
hgs
parents:
diff changeset
   167
const TSubBlock DebugFunctionalityBreakpoints[] =
hgs
parents:
diff changeset
   168
	{
hgs
parents:
diff changeset
   169
	ETagHeaderIdBreakpoints, EBreakpointLast,
hgs
parents:
diff changeset
   170
	(TTag*)DebugFunctionalityBreakpointsInfo
hgs
parents:
diff changeset
   171
	};
hgs
parents:
diff changeset
   172
hgs
parents:
diff changeset
   173
// Stepping
hgs
parents:
diff changeset
   174
const TTag DebugFunctionalitySteppingInfo[]=
hgs
parents:
diff changeset
   175
	{
hgs
parents:
diff changeset
   176
	{EStep,ETagTypeBoolean,0,ETrue}
hgs
parents:
diff changeset
   177
	};
hgs
parents:
diff changeset
   178
hgs
parents:
diff changeset
   179
const TSubBlock DebugFunctionalityStepping[] =
hgs
parents:
diff changeset
   180
	{
hgs
parents:
diff changeset
   181
	ETagHeaderIdStepping, EStepLast,
hgs
parents:
diff changeset
   182
	(TTag*)DebugFunctionalitySteppingInfo
hgs
parents:
diff changeset
   183
	};
hgs
parents:
diff changeset
   184
hgs
parents:
diff changeset
   185
// Execution Control
hgs
parents:
diff changeset
   186
const TTag DebugFunctionalityExecutionInfo[]=
hgs
parents:
diff changeset
   187
	{
hgs
parents:
diff changeset
   188
	{EExecThreadSuspendResume,ETagTypeBoolean,0,ETrue},
hgs
parents:
diff changeset
   189
	{EExecProcessSuspendResume,ETagTypeBoolean,0,EFalse},
hgs
parents:
diff changeset
   190
	{EExecSystemSuspendResume,ETagTypeBoolean,0,EFalse},
hgs
parents:
diff changeset
   191
	};
hgs
parents:
diff changeset
   192
hgs
parents:
diff changeset
   193
const TSubBlock DebugFunctionalityExecution[]=
hgs
parents:
diff changeset
   194
	{
hgs
parents:
diff changeset
   195
	ETagHeaderIdExecution, EExecLast,
hgs
parents:
diff changeset
   196
	(TTag*)DebugFunctionalityExecutionInfo
hgs
parents:
diff changeset
   197
	};
hgs
parents:
diff changeset
   198
hgs
parents:
diff changeset
   199
// Events
hgs
parents:
diff changeset
   200
const TTag DebugFunctionalityEventsInfo[]=
hgs
parents:
diff changeset
   201
	{
hgs
parents:
diff changeset
   202
	{EEventsBreakPoint,ETagTypeEnum,0,EActionSuspend},
hgs
parents:
diff changeset
   203
	{EEventsProcessBreakPoint,ETagTypeEnum,0,EActionSuspend},
hgs
parents:
diff changeset
   204
	{EEventsSwExc,ETagTypeEnum,0,EActionSuspend},
hgs
parents:
diff changeset
   205
	{EEventsHwExc,ETagTypeEnum,0,EActionSuspend},
hgs
parents:
diff changeset
   206
	{EEventsKillThread,ETagTypeEnum,0,EActionContinue},
hgs
parents:
diff changeset
   207
	{EEventsAddLibrary,ETagTypeEnum,0,EActionSuspend},
hgs
parents:
diff changeset
   208
	{EEventsRemoveLibrary,ETagTypeEnum,0,EActionSuspend},
hgs
parents:
diff changeset
   209
	{EEventsUserTrace,ETagTypeEnum,0,EActionSuspend},
hgs
parents:
diff changeset
   210
	{EEventsStartThread,ETagTypeEnum,0,EActionSuspend},
hgs
parents:
diff changeset
   211
	{EEventsBufferFull,ETagTypeEnum,0,EActionContinue},
hgs
parents:
diff changeset
   212
	{EEventsUnknown,ETagTypeEnum,0,EActionContinue},
hgs
parents:
diff changeset
   213
	{EEventsUserTracesLost, ETagTypeEnum, 0, EActionContinue},
hgs
parents:
diff changeset
   214
	{EEventsAddProcess,ETagTypeEnum,0,EActionContinue},
hgs
parents:
diff changeset
   215
	{EEventsRemoveProcess,ETagTypeEnum,0,EActionContinue}
hgs
parents:
diff changeset
   216
	};
hgs
parents:
diff changeset
   217
hgs
parents:
diff changeset
   218
const TSubBlock DebugFunctionalityEvents[] =
hgs
parents:
diff changeset
   219
	{
hgs
parents:
diff changeset
   220
	ETagHeaderIdEvents, EEventsLast,
hgs
parents:
diff changeset
   221
	(TTag*)DebugFunctionalityEventsInfo
hgs
parents:
diff changeset
   222
	};
hgs
parents:
diff changeset
   223
hgs
parents:
diff changeset
   224
// API Constants
hgs
parents:
diff changeset
   225
const TTag DebugFunctionalityApiConstantsInfo[]=
hgs
parents:
diff changeset
   226
	{
hgs
parents:
diff changeset
   227
	{EApiConstantsTEventInfoSize,ETagTypeTUint32,0,sizeof(TEventInfo)},
hgs
parents:
diff changeset
   228
	};
hgs
parents:
diff changeset
   229
hgs
parents:
diff changeset
   230
const TSubBlock DebugFunctionalityApiConstants[] =
hgs
parents:
diff changeset
   231
	{
hgs
parents:
diff changeset
   232
	ETagHeaderIdApiConstants, EApiConstantsLast,
hgs
parents:
diff changeset
   233
	(TTag*)DebugFunctionalityApiConstantsInfo
hgs
parents:
diff changeset
   234
	};
hgs
parents:
diff changeset
   235
hgs
parents:
diff changeset
   236
// Listings
hgs
parents:
diff changeset
   237
const TTag DebugFunctionalityListInfo[] =
hgs
parents:
diff changeset
   238
	{
hgs
parents:
diff changeset
   239
	{EProcesses,ETagTypeBitField,0,EScopeGlobal},
hgs
parents:
diff changeset
   240
	{EThreads,ETagTypeBitField,0,EScopeGlobal|EScopeProcessSpecific|EScopeThreadSpecific},
hgs
parents:
diff changeset
   241
	{ECodeSegs,ETagTypeBitField,0,EScopeGlobal|EScopeProcessSpecific|EScopeThreadSpecific},
hgs
parents:
diff changeset
   242
	{EXipLibraries,ETagTypeBitField,0,EScopeGlobal},
hgs
parents:
diff changeset
   243
	{EExecutables,ETagTypeBitField,0,EScopeGlobal},
hgs
parents:
diff changeset
   244
	{ELogicalDevices,ETagTypeBitField,0,EScopeNone},
hgs
parents:
diff changeset
   245
	{EMutexes,ETagTypeBitField,0,EScopeNone},
hgs
parents:
diff changeset
   246
	{EServers,ETagTypeBitField,0,EScopeNone},
hgs
parents:
diff changeset
   247
	{ESessions,ETagTypeBitField,0,EScopeNone},
hgs
parents:
diff changeset
   248
	{ESemaphores,ETagTypeBitField,0,EScopeNone},
hgs
parents:
diff changeset
   249
	{EChunks,ETagTypeBitField,0,EScopeNone},
hgs
parents:
diff changeset
   250
	{EBreakpoints,ETagTypeBitField,0,EScopeNone},
hgs
parents:
diff changeset
   251
	{ESetBreak,ETagTypeBitField,0,EScopeNone},
hgs
parents:
diff changeset
   252
	{ERemoveBreak,ETagTypeBitField,0,EScopeNone},
hgs
parents:
diff changeset
   253
	{EModifyBreak,ETagTypeBitField,0,EScopeNone},
hgs
parents:
diff changeset
   254
	};
hgs
parents:
diff changeset
   255
hgs
parents:
diff changeset
   256
const TSubBlock DebugFunctionalityList[] =
hgs
parents:
diff changeset
   257
	{
hgs
parents:
diff changeset
   258
	ETagHeaderList, EListLast,
hgs
parents:
diff changeset
   259
	(TTag*)DebugFunctionalityListInfo
hgs
parents:
diff changeset
   260
	};
hgs
parents:
diff changeset
   261
hgs
parents:
diff changeset
   262
// Security
hgs
parents:
diff changeset
   263
const TTag DebugFunctionalitySecurityInfo[]=
hgs
parents:
diff changeset
   264
	{
hgs
parents:
diff changeset
   265
	{ESecurityOEMDebugToken,ETagTypeBoolean,0,ETrue}
hgs
parents:
diff changeset
   266
	};
hgs
parents:
diff changeset
   267
hgs
parents:
diff changeset
   268
const TSubBlock DebugFunctionalitySecurity[] =
hgs
parents:
diff changeset
   269
	{
hgs
parents:
diff changeset
   270
	ETagHeaderIdSecurity, ESecurityLast,
hgs
parents:
diff changeset
   271
	(TTag*)DebugFunctionalitySecurityInfo
hgs
parents:
diff changeset
   272
	};
hgs
parents:
diff changeset
   273
hgs
parents:
diff changeset
   274
TUint32 TDebugFunctionality::GetDebugFunctionalityBufSize(void)
hgs
parents:
diff changeset
   275
	{
hgs
parents:
diff changeset
   276
	TUint32 df_size = 0;
hgs
parents:
diff changeset
   277
hgs
parents:
diff changeset
   278
	df_size += ComputeBlockSize((const TSubBlock&)DebugFunctionalityCore);
hgs
parents:
diff changeset
   279
	df_size += ComputeBlockSize((const TSubBlock&)DebugFunctionalityMemory);
hgs
parents:
diff changeset
   280
	df_size += ComputeBlockSize((const TSubBlock&)DebugFunctionalityRegistersCore);
hgs
parents:
diff changeset
   281
	df_size += ComputeBlockSize((const TSubBlock&)DebugFunctionalityRegistersCoPro);
hgs
parents:
diff changeset
   282
	df_size += ComputeBlockSize((const TSubBlock&)DebugFunctionalityBreakpoints);
hgs
parents:
diff changeset
   283
	df_size += ComputeBlockSize((const TSubBlock&)DebugFunctionalityStepping);
hgs
parents:
diff changeset
   284
	df_size += ComputeBlockSize((const TSubBlock&)DebugFunctionalityExecution);
hgs
parents:
diff changeset
   285
	df_size += ComputeBlockSize((const TSubBlock&)DebugFunctionalityEvents);
hgs
parents:
diff changeset
   286
	df_size += ComputeBlockSize((const TSubBlock&)DebugFunctionalityApiConstants);
hgs
parents:
diff changeset
   287
	df_size += ComputeBlockSize((const TSubBlock&)DebugFunctionalityList);
hgs
parents:
diff changeset
   288
	df_size += ComputeBlockSize((const TSubBlock&)DebugFunctionalityKillObjects);
hgs
parents:
diff changeset
   289
	df_size += ComputeBlockSize((const TSubBlock&)DebugFunctionalitySecurity);
hgs
parents:
diff changeset
   290
	
hgs
parents:
diff changeset
   291
	return df_size;
hgs
parents:
diff changeset
   292
	}
hgs
parents:
diff changeset
   293
hgs
parents:
diff changeset
   294
TBool TDebugFunctionality::GetDebugFunctionality(TDes8& aDFBlock)
hgs
parents:
diff changeset
   295
	{
hgs
parents:
diff changeset
   296
	if (aDFBlock.MaxLength() < GetDebugFunctionalityBufSize() )
hgs
parents:
diff changeset
   297
		{
hgs
parents:
diff changeset
   298
		// Insufficient space to contain the debug functionality block
hgs
parents:
diff changeset
   299
		return EFalse;
hgs
parents:
diff changeset
   300
		}
hgs
parents:
diff changeset
   301
hgs
parents:
diff changeset
   302
	AppendBlock((const TSubBlock&)DebugFunctionalityCore,aDFBlock);
hgs
parents:
diff changeset
   303
	AppendBlock((const TSubBlock&)DebugFunctionalityMemory,aDFBlock);
hgs
parents:
diff changeset
   304
	AppendBlock((const TSubBlock&)DebugFunctionalityRegistersCore,aDFBlock);
hgs
parents:
diff changeset
   305
	AppendBlock((const TSubBlock&)DebugFunctionalityRegistersCoPro,aDFBlock);
hgs
parents:
diff changeset
   306
	AppendBlock((const TSubBlock&)DebugFunctionalityBreakpoints,aDFBlock);
hgs
parents:
diff changeset
   307
	AppendBlock((const TSubBlock&)DebugFunctionalityStepping,aDFBlock);
hgs
parents:
diff changeset
   308
	AppendBlock((const TSubBlock&)DebugFunctionalityExecution,aDFBlock);
hgs
parents:
diff changeset
   309
	AppendBlock((const TSubBlock&)DebugFunctionalityEvents,aDFBlock);
hgs
parents:
diff changeset
   310
	AppendBlock((const TSubBlock&)DebugFunctionalityApiConstants,aDFBlock);
hgs
parents:
diff changeset
   311
	AppendBlock((const TSubBlock&)DebugFunctionalityList,aDFBlock);
hgs
parents:
diff changeset
   312
	AppendBlock((const TSubBlock&)DebugFunctionalityKillObjects,aDFBlock);
hgs
parents:
diff changeset
   313
	AppendBlock((const TSubBlock&)DebugFunctionalitySecurity,aDFBlock);
hgs
parents:
diff changeset
   314
hgs
parents:
diff changeset
   315
	return ETrue;
hgs
parents:
diff changeset
   316
	}
hgs
parents:
diff changeset
   317
hgs
parents:
diff changeset
   318
/**
hgs
parents:
diff changeset
   319
 * Get the register information associated with aRegisterInfo. If aRegisterInfo is
hgs
parents:
diff changeset
   320
 * an unsupported register then an entry of the form:
hgs
parents:
diff changeset
   321
 *   {aRegisterInfo, x, 0, EAccessUnknown}
hgs
parents:
diff changeset
   322
 *   will be returned where x is an arbitrary value.
hgs
parents:
diff changeset
   323
 *   
hgs
parents:
diff changeset
   324
 *   @param aRegisterInfo register id information
hgs
parents:
diff changeset
   325
 *   @param aTag The functionality information for this register.
hgs
parents:
diff changeset
   326
 *   @return One of the system wide error codes
hgs
parents:
diff changeset
   327
 */
hgs
parents:
diff changeset
   328
TInt TDebugFunctionality::GetRegister(const TRegisterInfo aRegisterInfo, TTag& aTag)
hgs
parents:
diff changeset
   329
	{
hgs
parents:
diff changeset
   330
	if(Register::IsCoreReg(aRegisterInfo))
hgs
parents:
diff changeset
   331
		{
hgs
parents:
diff changeset
   332
		for(TInt i=0; i<ERegisterLast; i++)
hgs
parents:
diff changeset
   333
			{
hgs
parents:
diff changeset
   334
			if(Register::GetCoreRegId(DebugFunctionalityRegistersCoreInfo[i].iTagId) == Register::GetCoreRegId(aRegisterInfo))
hgs
parents:
diff changeset
   335
				{
hgs
parents:
diff changeset
   336
				aTag = DebugFunctionalityRegistersCoreInfo[i];
hgs
parents:
diff changeset
   337
				return KErrNone;
hgs
parents:
diff changeset
   338
				}
hgs
parents:
diff changeset
   339
			}
hgs
parents:
diff changeset
   340
		}
hgs
parents:
diff changeset
   341
	else if(Register::IsCoproReg(aRegisterInfo))
hgs
parents:
diff changeset
   342
		{
hgs
parents:
diff changeset
   343
		//get aRegisterInfo's details
hgs
parents:
diff changeset
   344
		TUint32 crn = Register::GetCRn(aRegisterInfo);
hgs
parents:
diff changeset
   345
		TUint32 crm = Register::GetCRm(aRegisterInfo);
hgs
parents:
diff changeset
   346
		TUint32 opcode1 = Register::GetOpcode1(aRegisterInfo);
hgs
parents:
diff changeset
   347
		TUint32 opcode2 = Register::GetOpcode2(aRegisterInfo);
hgs
parents:
diff changeset
   348
		TUint32 coproNum = Register::GetCoproNum(aRegisterInfo);
hgs
parents:
diff changeset
   349
hgs
parents:
diff changeset
   350
		for(TInt i=0; i<sizeof(DebugFunctionalityRegistersCoProInfo)/sizeof(TTag); i++)
hgs
parents:
diff changeset
   351
			{
hgs
parents:
diff changeset
   352
			TUint32 tagId = DebugFunctionalityRegistersCoProInfo[i].iTagId;
hgs
parents:
diff changeset
   353
hgs
parents:
diff changeset
   354
			//if this entry is the DACR
hgs
parents:
diff changeset
   355
			if((Register::GetCRm(tagId) == 3) && (Register::GetCoproNum(tagId) == 15))
hgs
parents:
diff changeset
   356
				{
hgs
parents:
diff changeset
   357
				if((crm == 3) && (coproNum == 15))
hgs
parents:
diff changeset
   358
					{
hgs
parents:
diff changeset
   359
					aTag = DebugFunctionalityRegistersCoProInfo[i];
hgs
parents:
diff changeset
   360
					return KErrNone;
hgs
parents:
diff changeset
   361
					}
hgs
parents:
diff changeset
   362
				}
hgs
parents:
diff changeset
   363
			//each coprocessor register that is supported will need logic adding here
hgs
parents:
diff changeset
   364
			}
hgs
parents:
diff changeset
   365
		}
hgs
parents:
diff changeset
   366
	else // in the future there could be other types of register supported
hgs
parents:
diff changeset
   367
		{
hgs
parents:
diff changeset
   368
		//for now just fall through to unsupported case
hgs
parents:
diff changeset
   369
		}
hgs
parents:
diff changeset
   370
hgs
parents:
diff changeset
   371
	//found an unsupported register so just return EAccessUnknown as the access level
hgs
parents:
diff changeset
   372
	aTag.iTagId = aRegisterInfo;
hgs
parents:
diff changeset
   373
	aTag.iSize = 0;
hgs
parents:
diff changeset
   374
	aTag.iValue = EAccessUnknown;
hgs
parents:
diff changeset
   375
hgs
parents:
diff changeset
   376
	return KErrNotSupported;
hgs
parents:
diff changeset
   377
	}
hgs
parents:
diff changeset
   378
hgs
parents:
diff changeset
   379
/**
hgs
parents:
diff changeset
   380
 * Returns the maximum memory block size which can be read or written.
hgs
parents:
diff changeset
   381
 * @return the maximum memory block size which can be read or written
hgs
parents:
diff changeset
   382
*/
hgs
parents:
diff changeset
   383
TUint32 TDebugFunctionality::GetMemoryOperationMaxBlockSize()
hgs
parents:
diff changeset
   384
	{
hgs
parents:
diff changeset
   385
	return DebugFunctionalityMemoryInfo[EMemoryMaxBlockSize].iValue;
hgs
parents:
diff changeset
   386
	}
hgs
parents:
diff changeset
   387
hgs
parents:
diff changeset
   388
/**
hgs
parents:
diff changeset
   389
 * Helper function to append a DebugFunctionalityXXX SubBlock 
hgs
parents:
diff changeset
   390
 * into a TDes buffer
hgs
parents:
diff changeset
   391
 */
hgs
parents:
diff changeset
   392
void TDebugFunctionality::AppendBlock(const TSubBlock& aDFSubBlock, TDes8& aDFBlock)
hgs
parents:
diff changeset
   393
	{
hgs
parents:
diff changeset
   394
	// Copy the aSubDFBlock.header into aDFBlock (Note we don't put in a TSubBlock structure
hgs
parents:
diff changeset
   395
	// as the block is just that - a flat block so the pointer is not required)
hgs
parents:
diff changeset
   396
	TPtr8 SubDFBlockHdrPtr((TUint8*)&aDFSubBlock.iHeader,sizeof(TTagHeader),sizeof(TTagHeader));
hgs
parents:
diff changeset
   397
hgs
parents:
diff changeset
   398
	aDFBlock.Append(SubDFBlockHdrPtr);
hgs
parents:
diff changeset
   399
hgs
parents:
diff changeset
   400
	// Append all the Tags
hgs
parents:
diff changeset
   401
	for (TUint i=0; i<aDFSubBlock.iHeader.iNumTags; i++)
hgs
parents:
diff changeset
   402
		{
hgs
parents:
diff changeset
   403
		TPtr8 tmpPtr((TUint8*)&aDFSubBlock.iTagArray[i],sizeof(TTag),sizeof(TTag));
hgs
parents:
diff changeset
   404
hgs
parents:
diff changeset
   405
		aDFBlock.Append(tmpPtr);
hgs
parents:
diff changeset
   406
		}
hgs
parents:
diff changeset
   407
	}
hgs
parents:
diff changeset
   408
hgs
parents:
diff changeset
   409
/**
hgs
parents:
diff changeset
   410
 * Computes the size in bytes of aDFBlock
hgs
parents:
diff changeset
   411
 * @param aDFSubBlock
hgs
parents:
diff changeset
   412
 * @return TUint32 size of sub block
hgs
parents:
diff changeset
   413
 */
hgs
parents:
diff changeset
   414
TUint32 TDebugFunctionality::ComputeBlockSize(const TSubBlock& aDFSubBlock)
hgs
parents:
diff changeset
   415
	{
hgs
parents:
diff changeset
   416
	TUint32 size = 0;
hgs
parents:
diff changeset
   417
hgs
parents:
diff changeset
   418
	// Header size
hgs
parents:
diff changeset
   419
	size += sizeof(TTagHeader);
hgs
parents:
diff changeset
   420
hgs
parents:
diff changeset
   421
	// size of all the tags within the header:
hgs
parents:
diff changeset
   422
	size += aDFSubBlock.iHeader.iNumTags * sizeof(TTag); 
hgs
parents:
diff changeset
   423
hgs
parents:
diff changeset
   424
	return size;
hgs
parents:
diff changeset
   425
	}
hgs
parents:
diff changeset
   426