os/kernelhwsrv/kerneltest/e32utils/analyse/nonxip.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 #ifndef __NONXIP__
    17 #define __NONXIP__
    18 
    19 #ifndef __MSVCDOTNET__
    20 #pragma warning(push, 3)	// cannot compile MSVC's STL at warning level 4
    21 #pragma warning(disable: 4786 4710 4530)
    22 #endif //__MSVCDOTNET__
    23 
    24 #include <map>
    25 #include <vector>
    26 #include <string>
    27 #include "trace.h"
    28 #include "codespace.h"
    29 
    30 class NonXIP
    31 	{
    32 	friend class ObyFile;
    33 	typedef std::vector<std::string> FilesVec;
    34 
    35 	struct OrigName
    36 		{
    37 		OrigName() : iName(""), iId(0) {}
    38 		OrigName(const char* aName, int aId) : iName(aName), iId(aId) {}
    39 		std::string iName;
    40 		int iId;
    41 		};
    42 	typedef std::map<std::string, OrigName> NamesMap;
    43 
    44 	struct Segment
    45 		{
    46 		PC iSegSize;
    47 		NamesMap::const_iterator iName;
    48 		bool iUnloaded;
    49 		};
    50 	typedef std::map<PC, Segment> SegData;
    51 	
    52 public:
    53 	enum TReportMask {ENonXip=1, ENodebugSupport=2};
    54 
    55 	NonXIP();
    56 	~NonXIP();
    57 
    58 	void AddObyFile(const char* aName) {iObyFiles.push_back(aName);}
    59 	void AddSymbolFile(const char* aName) {iSymbolFiles.push_back(aName);}
    60 
    61 	void CreateNamesMap();
    62 	void SetMappedCodeSpace(MappedCodeSpace* aCodeSpace) {iCodeSpace = aCodeSpace;}
    63 	
    64 	void AddSegment(PC aAddress, PC aSegSize, const char *aSegName);
    65 	void DeleteSegment(PC aAddress);
    66 
    67 	unsigned int iRowBufferErrors;
    68 	unsigned int iCookBufferErrors;
    69 	unsigned int iReportMask;
    70 
    71 private:
    72 	void AddObyNames(const char* aOrigName, const char* aSegName);
    73 	bool TryUnDeleteSegment(PC aAddress, PC aSegSize, const char *aSegName);
    74 	
    75 private:
    76 	FilesVec iObyFiles;
    77 	FilesVec iSymbolFiles;
    78 	NamesMap iNamesMap;
    79 	int iCurId;
    80 	MappedCodeSpace* iCodeSpace;
    81 	SegData  iSegData;
    82 	std::vector<SymbolFile*> iSymbols;
    83 	
    84 	};
    85 
    86 #endif // __NONXIP__