os/kernelhwsrv/kernel/eka/drivers/debug/smdebug/d_sm_staticinfo.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 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
// Responsible for dealing with static info in the Stop Mode framework
sl@0
    15
//
sl@0
    16
sl@0
    17
/**
sl@0
    18
 * @file
sl@0
    19
 * @internalComponent
sl@0
    20
 * @prototype
sl@0
    21
 */
sl@0
    22
sl@0
    23
#ifdef __LAUNCH_AS_EXTENSION__
sl@0
    24
sl@0
    25
#include <rm_debug_api.h>
sl@0
    26
#include <sm_debug_api.h>
sl@0
    27
#include <e32rom.h>
sl@0
    28
#include "d_rmd_breakpoints.h"
sl@0
    29
sl@0
    30
using namespace Debug;
sl@0
    31
sl@0
    32
const TInt KBUFSIZE = 128;
sl@0
    33
sl@0
    34
/**
sl@0
    35
 * Stop Mode routine to retrieve the static info and place it in the response buffer
sl@0
    36
 * @param aItem List item describing the list
sl@0
    37
 * @return One of the system wide error codes
sl@0
    38
 */
sl@0
    39
TInt StopModeDebug::GetStaticInfo(const TListItem* aItem, bool aCheckConsistent)
sl@0
    40
	{
sl@0
    41
	__KTRACE_OPT(KDEBUGGER,Kern::Printf("\nDumping the static information"));
sl@0
    42
sl@0
    43
	if(aItem->iListScope != EScopeGlobal)
sl@0
    44
		{
sl@0
    45
		return KErrArgument; //No other scope makes sense for static info
sl@0
    46
		}
sl@0
    47
sl@0
    48
	TUint8* buffer = (TUint8*)aItem->iBufferAddress;
sl@0
    49
	TUint8* bufferPos = Align4(buffer + sizeof(TListReturn));
sl@0
    50
	TUint8* bufferEnd = buffer + aItem->iBufferSize;
sl@0
    51
sl@0
    52
	TListReturn* listResp = (TListReturn*)buffer;
sl@0
    53
	listResp->iReqNo = EStaticInfo;
sl@0
    54
	listResp->iNumberItems = 1; //there in only one structure of TStaticListEntry
sl@0
    55
	listResp->iDataSize = sizeof(TStaticListEntry);
sl@0
    56
	
sl@0
    57
	if (bufferPos < bufferEnd)
sl@0
    58
		{
sl@0
    59
		// making sure we have enough space to write the static info
sl@0
    60
		TStaticListEntry& entry = *(TStaticListEntry*)(bufferPos);
sl@0
    61
sl@0
    62
		// build version and rom build time 
sl@0
    63
		TRomHeader rHdr = Epoc::RomHeader();
sl@0
    64
		entry.iTime = rHdr.iTime; 
sl@0
    65
		entry.iBuildNumber = rHdr.iVersion.iBuild;
sl@0
    66
		entry.iMajorVersion = rHdr.iVersion.iMajor;
sl@0
    67
		entry.iMinorVersion = rHdr.iVersion.iMinor;
sl@0
    68
sl@0
    69
		//Number of CPUs
sl@0
    70
		entry.iCpuNumbers = NKern::NumberOfCpus();
sl@0
    71
sl@0
    72
		TBuf<KBUFSIZE> bufTime64; 
sl@0
    73
		bufTime64.Num(rHdr.iTime); 
sl@0
    74
sl@0
    75
		__KTRACE_OPT(KDEBUGGER,Kern::Printf("Version%d.%02d(%03d) %d", rHdr.iVersion.iMajor, rHdr.iVersion.iMinor, rHdr.iVersion.iBuild));
sl@0
    76
		__KTRACE_OPT(KDEBUGGER,Kern::Printf("Build Time %S ms", &bufTime64));
sl@0
    77
		__KTRACE_OPT(KDEBUGGER,Kern::Printf("Number of CPUs in the system: %d", entry.iCpuNumbers));
sl@0
    78
		}
sl@0
    79
sl@0
    80
	return KErrNone;
sl@0
    81
	}
sl@0
    82
sl@0
    83
#endif
sl@0
    84