libraries/ltkutils/inc/bsym.h
changeset 0 7f656887cf89
equal deleted inserted replaced
-1:000000000000 0:7f656887cf89
       
     1 // bsym.h
       
     2 // 
       
     3 // Copyright (c) 2010 Accenture. All rights reserved.
       
     4 // This component and the accompanying materials are made available
       
     5 // under the terms of the "Eclipse Public License v1.0"
       
     6 // which accompanies this distribution, and is available
       
     7 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 // 
       
     9 // Initial Contributors:
       
    10 // Accenture - Initial contribution
       
    11 //
       
    12 #ifndef FSHELL_BSYM_H
       
    13 #define FSHELL_BSYM_H
       
    14 
       
    15 #include <e32base.h>
       
    16 #include <f32file.h>
       
    17 #include <fshell/ioutils.h>
       
    18 #include <fshell/stringhash.h>
       
    19 class CDesC16Array;
       
    20 
       
    21 namespace LtkUtils
       
    22 	{
       
    23 	class CMapFile;
       
    24 	class CBsymFile;
       
    25 	class RNode;
       
    26 
       
    27 	NONSHARABLE_CLASS(CSymbolics) : public CBase
       
    28 		{
       
    29 	public:
       
    30 		IMPORT_C CSymbolics(RFs& aFs);
       
    31 		IMPORT_C ~CSymbolics();
       
    32 		IMPORT_C void AddBsymFileL(const TDesC& aFileName);
       
    33 		IMPORT_C void AddMapFileL(const TDesC& aFileName);
       
    34 		IMPORT_C void AddMapFileL(CMapFile* aMapFile); // Takes ownership
       
    35 		IMPORT_C void SetFallbackMapFileDirL(const TDesC& aDir);
       
    36 
       
    37 		IMPORT_C TPtrC LookupL(TUint32 aRomAddress);
       
    38 		IMPORT_C TPtrC LookupL(const TDesC& aCodeseg, TUint32 aOffset); // Need to use memaccess or similar to get codeseg name
       
    39 
       
    40 		IMPORT_C void CompleteL(const TDesC& aCodeseg, TDes& aSymbolName, CDesC16Array& aSuggestions);
       
    41 		IMPORT_C TUint32 CodesegOffsetFromSymbolNameL(const TDesC& aCodeseg, const TDesC& aSymbolName);
       
    42 
       
    43 	private:
       
    44 		CMapFile* FindOrLoadMapFileL(const TDesC& aCodeseg);
       
    45 		RNode* TreeForCodesegL(const TDesC& aCodeseg);
       
    46 
       
    47 	private:
       
    48 		RFs& iFs;
       
    49 		RStringHash<CMapFile*> iCodeSegHash;
       
    50 		RPointerArray<CBsymFile> iBsyms;
       
    51 		TFileName iFallbackMapFileDir;
       
    52 		TBuf<256> iTempString;
       
    53 		RNode* iTabCompleteTree;
       
    54 		HBufC* iTabCompleteCodeseg;
       
    55 		};
       
    56 
       
    57 	NONSHARABLE_CLASS(CBsymFile) : public CBase
       
    58 		{
       
    59 	public:
       
    60 		IMPORT_C static CBsymFile* NewL(RFs& aFs, const TDesC& aFileName);
       
    61 		IMPORT_C ~CBsymFile();
       
    62 		IMPORT_C TPtrC LookupL(TUint32 aRomAddress);
       
    63 		IMPORT_C TPtrC LookupL(const TDesC& aCodesegName, TInt aOffset);
       
    64 
       
    65 		RNode* CreateCompletionTreeL(const TDesC& aCodesegName);
       
    66 
       
    67 	protected:
       
    68 		CBsymFile();
       
    69 
       
    70 	protected:
       
    71 		RFile iFile;
       
    72 		TUint iFileSize;
       
    73 		TUint32 iVersion;
       
    74 		TUint32 iCodesegOffset;
       
    75 		TUint32 iSymbolsOffset;
       
    76 		TUint32 iTokensOffset;
       
    77 		};
       
    78 
       
    79 	NONSHARABLE_CLASS(CMapFile) : public CBase
       
    80 		{
       
    81 	public:
       
    82 		IMPORT_C static CMapFile* NewL(RFs& aFs, const TDesC& aFileName);
       
    83 		IMPORT_C ~CMapFile();
       
    84 		IMPORT_C void Lookup(TUint32 aOffsetInCodeSeg, TDes& aResult);
       
    85 		IMPORT_C void GetFileNameL(TDes& aFileName) const;
       
    86 		RNode* CreateCompletionTreeL();
       
    87 
       
    88 	protected:
       
    89 		CMapFile();
       
    90 		void ConstructL(RFs& aFs, const TDesC& aFileName);
       
    91 		TBool GetNextLine(TPtrC8& aPtr);
       
    92 
       
    93 	protected:
       
    94 		RFile iFile;
       
    95 		RBuf8 iReadBuf;
       
    96 		TInt iTextOffset;
       
    97 		HBufC* iFileName;
       
    98 		};
       
    99 	}
       
   100 #endif