memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperCodeSegment.h
changeset 0 a03f92240627
child 18 3406c99bc375
equal deleted inserted replaced
-1:000000000000 0:a03f92240627
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "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 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef MEMSPYENGINEHELPERCODESEGMENT_H
       
    19 #define MEMSPYENGINEHELPERCODESEGMENT_H
       
    20 
       
    21 // System includes
       
    22 #include <e32base.h>
       
    23 #include <e32ldr.h>
       
    24 #include <e32ldr_private.h>
       
    25 #include <badesca.h>
       
    26 
       
    27 // User includes
       
    28 #include <memspy/engine/memspyenginetwiddlableitemarray.h>
       
    29 
       
    30 // Classes referenced
       
    31 class CMemSpyEngine;
       
    32 class CMemSpyEngineCodeSegEntry;
       
    33 class CMemSpyEngineCodeSegList;
       
    34 
       
    35 
       
    36 
       
    37 
       
    38 NONSHARABLE_CLASS( CMemSpyEngineHelperCodeSegment ) : public CBase
       
    39     {
       
    40 public:
       
    41     static CMemSpyEngineHelperCodeSegment* NewL( CMemSpyEngine& aEngine );
       
    42     ~CMemSpyEngineHelperCodeSegment();
       
    43 
       
    44 private:
       
    45     CMemSpyEngineHelperCodeSegment( CMemSpyEngine& aEngine );
       
    46     void ConstructL();
       
    47 
       
    48 public: // API
       
    49     IMPORT_C void OutputCodeSegmentsL( TUint aPid, TDes& aLine, const TDesC& aPrefix, TChar aSectionUnderlineCharacter = '=', TBool aLowerCaseSectionHeading = EFalse );
       
    50     IMPORT_C CMemSpyEngineCodeSegList* CodeSegmentListL();
       
    51     IMPORT_C CMemSpyEngineCodeSegList* CodeSegmentListL( TProcessId aProcess );
       
    52 
       
    53 public: // API - but not exported
       
    54     CMemSpyEngineCodeSegList* CodeSegmentListRamLoadedL();
       
    55     inline CMemSpyEngine& Engine() const { return iEngine; }
       
    56 
       
    57 private: // Internal 
       
    58     void GetCodeSegmentHandlesL( RArray<TAny*>& aHandles, TUint* aProcessId = NULL, TBool aRamOnly = EFalse ) const;
       
    59     CMemSpyEngineCodeSegList* ListFromHandlesLC( RArray<TAny*>& aHandles ) const;
       
    60     static TInt SortByAddress( TAny* const& aLeft, TAny* const& aRight );
       
    61 
       
    62 private:
       
    63     CMemSpyEngine& iEngine;
       
    64     };
       
    65 
       
    66 
       
    67 
       
    68 
       
    69 
       
    70 NONSHARABLE_CLASS( CMemSpyEngineCodeSegList ) : public CMemSpyEngineTwiddlableItemArray<CMemSpyEngineCodeSegEntry>, public MDesCArray
       
    71     {
       
    72 public:
       
    73     static CMemSpyEngineCodeSegList* NewLC( CMemSpyEngine& aEngine );
       
    74 
       
    75 private:
       
    76     CMemSpyEngineCodeSegList( CMemSpyEngine& aEngine );
       
    77     void ConstructL();
       
    78 
       
    79 public: // API
       
    80     IMPORT_C TInt IndexByHandle( TAny* aHandle ) const;
       
    81     IMPORT_C void SortByFileNameL();
       
    82     IMPORT_C void SortByCodeSizeL();
       
    83     IMPORT_C void SortByDataSizeL();
       
    84     IMPORT_C void SortByUidsL();
       
    85     IMPORT_C void ShowOnlyEntriesWithGlobalDataL();
       
    86     IMPORT_C static void OutputDataColumnsL( CMemSpyEngine& aEngine );
       
    87 
       
    88 public: // From MDesCArray
       
    89     IMPORT_C TInt MdcaCount() const;
       
    90     IMPORT_C TPtrC MdcaPoint( TInt aIndex ) const;
       
    91 
       
    92 public: // API - but not exported
       
    93     TInt IndexByName( const TDesC& aName ) const;
       
    94 
       
    95 private: // Internal methods
       
    96     static TInt CompareByFileName( const CMemSpyEngineCodeSegEntry& aLeft, const CMemSpyEngineCodeSegEntry& aRight );
       
    97     static TInt CompareByCodeSize( const CMemSpyEngineCodeSegEntry& aLeft, const CMemSpyEngineCodeSegEntry& aRight );
       
    98     static TInt CompareByDataSize( const CMemSpyEngineCodeSegEntry& aLeft, const CMemSpyEngineCodeSegEntry& aRight );
       
    99     static TInt CompareByUid( const CMemSpyEngineCodeSegEntry& aLeft, const CMemSpyEngineCodeSegEntry& aRight );
       
   100     static TBool VisibilityFunctionGlobalData( const CMemSpyEngineCodeSegEntry*& aItem, TAny* aRune );
       
   101     };
       
   102 
       
   103 
       
   104 
       
   105 
       
   106 
       
   107 NONSHARABLE_CLASS( CMemSpyEngineCodeSegEntry ) : public CDesCArrayFlat
       
   108     {
       
   109 public:
       
   110     static CMemSpyEngineCodeSegEntry* NewLC( TAny* aHandle, TInt aSize, const TCodeSegCreateInfo& aCreateInfo, const TProcessMemoryInfo& aMemoryInfo );
       
   111     IMPORT_C ~CMemSpyEngineCodeSegEntry();
       
   112 
       
   113 private:
       
   114     CMemSpyEngineCodeSegEntry( TAny* aHandle, TInt aSize, const TCodeSegCreateInfo& aCreateInfo, const TProcessMemoryInfo& aMemoryInfo );
       
   115     void ConstructL();
       
   116 
       
   117 public: // API
       
   118     inline TAny* Handle() const { return iHandle; }
       
   119     inline TInt Size() const { return iSize; }
       
   120     inline const TDesC& Caption() const { return *iCaption; }
       
   121     inline const TDesC& FileName() const { return *iFileName; }
       
   122     inline const TCodeSegCreateInfo& CreateInfo() const { return iCreateInfo; }
       
   123     inline const TProcessMemoryInfo& MemoryInfo() const { return iMemoryInfo; }
       
   124 
       
   125 public: // API
       
   126     IMPORT_C TBool HasCapability( TCapability aCapability ) const;
       
   127     IMPORT_C void OutputDataL( CMemSpyEngineHelperCodeSegment& aHelper ) const;
       
   128 
       
   129 private: // Internal methods
       
   130     void AddCapabilityItemsL();
       
   131     CDesCArray* CapabilityStringsLC() const;
       
   132     void AddCapabilitiesL( TUint32 aCaps, TInt aCapCount, CDesCArray& aArray ) const;
       
   133 
       
   134 private: // Member data
       
   135     TAny* iHandle;
       
   136     TInt iSize;
       
   137     HBufC* iCaption;
       
   138     HBufC* iFileName;
       
   139     TCodeSegCreateInfo iCreateInfo;
       
   140     TProcessMemoryInfo iMemoryInfo;
       
   141     };
       
   142 
       
   143 
       
   144 
       
   145 
       
   146 
       
   147 #endif