|
1 // Copyright (c) 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 "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 // Utility functions to allow us to configure the System Crash Monitor |
|
15 |
|
16 /** |
|
17 @file |
|
18 @internalTechnology |
|
19 */ |
|
20 |
|
21 #ifndef __SELF_WRAPPER_H__ |
|
22 #define __SELF_WRAPPER_H__ |
|
23 |
|
24 #include <datawrapper.h> |
|
25 #include <e32base.h> |
|
26 #include <coredumpinterface.h> |
|
27 #include <optionconfig.h> |
|
28 #include <scmconfigitem.h> |
|
29 #include <symbianelfdefs.h> |
|
30 |
|
31 #include "t_common_defs.h" |
|
32 |
|
33 //ini file keys |
|
34 _LIT(KKeyCrashSource, "source"); |
|
35 _LIT(KKeyCrashId, "crashid"); |
|
36 _LIT(KKeyCrashName, "filename"); |
|
37 _LIT(KKeyElfSection, "section"); |
|
38 |
|
39 //commands |
|
40 _LIT(KCommandGenerateFile, "GenerateSelfFile"); |
|
41 _LIT(KCommandFindSection, "VerifySectionExists"); |
|
42 _LIT(KCommandVerifyNoSection, "VerifySectionDoesNotExist"); |
|
43 |
|
44 //sources |
|
45 _LIT(KSourceSystemCrash, "systemcrash"); |
|
46 |
|
47 //sections |
|
48 _LIT(KSectionsVariantData, "variantdata"); |
|
49 |
|
50 /** |
|
51 * Can only use in void functions |
|
52 * @param x Boolean |
|
53 * @param If we fail, pop and destroy y items |
|
54 */ |
|
55 #define T_SELF_ASSERT_TRUE(x, y) \ |
|
56 if(!x){\ |
|
57 ERR_PRINTF2(_L("Assertion Error in t_self.cpp line [%d]"), __LINE__);\ |
|
58 SetBlockResult(EFail);\ |
|
59 if(y>0)\ |
|
60 CleanupStack::PopAndDestroy(y);\ |
|
61 return; \ |
|
62 } |
|
63 |
|
64 /** |
|
65 * Use for TUint returning functions |
|
66 * @param x Boolean |
|
67 * @param If we fail, pop and destroy y items |
|
68 */ |
|
69 #define T_SELF_ASSERT_TRUE_RET(x, y, z) \ |
|
70 if(!x){\ |
|
71 ERR_PRINTF2(_L("Assertion Error in t_self.cpp line [%d]"), __LINE__);\ |
|
72 SetBlockResult(EFail);\ |
|
73 if(y>0)\ |
|
74 CleanupStack::PopAndDestroy(y);\ |
|
75 return z; \ |
|
76 } |
|
77 /** |
|
78 * This class is the test wrapper we use to configure the System Crash |
|
79 * Monitor |
|
80 */ |
|
81 class CSymbianElfWrapper : public CDataWrapper |
|
82 { |
|
83 public: |
|
84 ~CSymbianElfWrapper(); |
|
85 static CSymbianElfWrapper* NewL(); |
|
86 |
|
87 virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex); |
|
88 virtual TAny* GetObject() { return NULL; } |
|
89 virtual void SetObject(TAny* aObject) { (void)aObject; } |
|
90 |
|
91 protected: |
|
92 void ConstructL(); |
|
93 |
|
94 private: |
|
95 CSymbianElfWrapper(); |
|
96 void GenerateFileFromSystemCrashL(TDesC& aCrashName, TInt aCrashId); |
|
97 |
|
98 TUint GetSectionOffset(RFile& aElfFile, ESYM_NOTE_TYPE aNoteType); |
|
99 TUint GetSectionSize(RFile& aElfFile, ESYM_NOTE_TYPE aNoteType); |
|
100 void CacheElfHeader(RFile& aElfFile); |
|
101 |
|
102 void VerifySection(TDesC& aSectionToVerify, TDesC& aCrashName, TBool aExists); |
|
103 void ValidateElfFile(RFile& aElfFile); |
|
104 void VerifyVariantData(RFile& aElfFile, TBool aExists); |
|
105 |
|
106 private: |
|
107 RCoreDumpSession iCoreDumpSession; |
|
108 RFs iFsSession; |
|
109 Elf32_Ehdr iElfHeader; |
|
110 }; |
|
111 |
|
112 #endif __SCM_CONFIG_H__ |
|
113 |
|
114 //eof |