kernel/eka/debug/crashMonitor/inc/crashlogwalker.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 31 Aug 2010 16:34:26 +0300
branchRCL_3
changeset 256 c1f20ce4abcf
parent 0 a41df078684a
child 257 3e88ff8f41d5
permissions -rw-r--r--
Revision: 201035 Kit: 201035

// Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
// All rights reserved.
// This component and the accompanying materials are made available
// under the terms of the License "Eclipse Public License v1.0"
// which accompanies this distribution, and is available
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
//
// Initial Contributors:
// Nokia Corporation - initial contribution.
//
// Contributors:
//
// Description:
// some utility classes for writing data to buffer
// 
//

/**
 @file
 @internalTechnology
*/
#ifndef __CRASH_LOG_WALKER_H_INCLUDED__
#define __CRASH_LOG_WALKER_H_INCLUDED__

#include <e32cmn.h> 

#include <scmdatatypes.h>

namespace Debug
	{
	
	/**
	 * This class provides functionality to walk through a crash log in a data buffer
	 * ensuring it is valid and getting the information we require back
	 */
	class TCrashLogWalker
		{
	public:
		TCrashLogWalker(TDesC8& aBuffer);
		
		TInt ReadLogHeader(const TInt aStartPoint);		
		TInt GetCrashSize() const;
		TInt GetCrashId() const;
		const TRmdArmExcInfo& GetCrashContext() const;		
		const TCrashInfoHeader& GetCrashHeader() const;
		const TCrashOffsetsHeader& GetOffsetsHeader() const;
		
#ifndef __KERNEL_MODE__		
		MByteStreamSerializable*  GetNextDataTypeL(TInt& aPos, SCMStructId& aId, TInt& aBufferSize);
		TRawData* GetRawDataTypeL(TInt& aPos, TInt& aBufferSize, TDes8& aRawBuf, TInt aStartRawPosition = 0);
#endif
		
		void UpdateBuffer(TDesC8& aBuffer);
		
	private:
		
		void HelpAssignRegisterToContext(const TRegisterValue& aRegVal);
		
	private:
		TDesC8& iBuffer;					//buffer containing data for the log we are walking - not all of it, just the bit of interest
		TCrashInfoHeader iCrashHeader;		//Stores the header of the log we are walking
		TCrashOffsetsHeader iOffsets;		//Stores the offsets header of the log we are walking
		TRmdArmExcInfo iContext;			//Stores the register context of the log we are walking
		
		TByteStreamReader iReader;
		
	private:
		TInt VerifyHeader();
		
		};
	
	}

#endif // __CRASH_LOG_WALKER_H_INCLUDED__