0
|
1 |
/**
|
|
2 |
* Copyright (c) 2008-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 |
/**
|
|
19 |
@file t_process_crash.h
|
|
20 |
@internalTechnology
|
|
21 |
@prototype
|
|
22 |
*/
|
|
23 |
|
|
24 |
#ifndef __CPROCESSCRASHWRAPPER_H__
|
|
25 |
#define __CPROCESSCRASHWRAPPER_H__
|
|
26 |
#include <e32property.h>
|
|
27 |
#include <datawrapper.h>
|
|
28 |
#include <e32base.h>
|
|
29 |
#include <f32file.h>
|
|
30 |
#include <bafindf.h >
|
|
31 |
#include <e32btrace.h>
|
|
32 |
#include <e32std.h>
|
|
33 |
#include <hal.h>
|
|
34 |
|
|
35 |
#include <coredumpinterface.h> //core dump interface API
|
|
36 |
#include <optionconfig.h>
|
|
37 |
#include <coredumpserverapi.h>
|
|
38 |
#include <crashdatasave.h>
|
|
39 |
|
|
40 |
#include <scmdatatypes.h>
|
|
41 |
#include <symbianelfdefs.h>
|
|
42 |
#include <scmconfigitem.h>
|
|
43 |
|
|
44 |
#include "t_common_defs.h"
|
|
45 |
|
|
46 |
const TInt MAXNUMBEROFDHDR = 200;
|
|
47 |
|
|
48 |
enum TValidateString {EValExecutable, EValThread};
|
|
49 |
|
|
50 |
class CProcessCrashWrapper;
|
|
51 |
/**
|
|
52 |
* This class implements an Active Object to test the asynchronous ProcessCrashLog
|
|
53 |
*/
|
|
54 |
class CAsyncProcessCrash : public CActive
|
|
55 |
{
|
|
56 |
public:
|
|
57 |
|
|
58 |
static CAsyncProcessCrash* NewL(CProcessCrashWrapper* );
|
|
59 |
|
|
60 |
~CAsyncProcessCrash( );
|
|
61 |
|
|
62 |
void IssueProcessCrashRequest(TUint aCrashId);
|
|
63 |
|
|
64 |
private:
|
|
65 |
|
|
66 |
void ConstructL();
|
|
67 |
|
|
68 |
CAsyncProcessCrash(CProcessCrashWrapper* );
|
|
69 |
|
|
70 |
// from CActive
|
|
71 |
void RunL();
|
|
72 |
|
|
73 |
TInt RunError(TInt aError);
|
|
74 |
|
|
75 |
void DoCancel();
|
|
76 |
|
|
77 |
CProcessCrashWrapper* iProcessCrashWrapper;
|
|
78 |
|
|
79 |
TUint iCrashId;
|
|
80 |
} ;
|
|
81 |
|
|
82 |
/**
|
|
83 |
* This class is responsible for processing the crash information
|
|
84 |
*/
|
|
85 |
class CProcessCrashWrapper : public CDataWrapper
|
|
86 |
{
|
|
87 |
|
|
88 |
public:
|
|
89 |
|
|
90 |
~CProcessCrashWrapper();
|
|
91 |
|
|
92 |
static CProcessCrashWrapper* NewL();
|
|
93 |
|
|
94 |
virtual TBool DoCommandL(const TTEFFunction& aCommand,
|
|
95 |
const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
|
|
96 |
virtual TAny* GetObject()
|
|
97 |
{
|
|
98 |
}
|
|
99 |
virtual void SetObjectL(TAny* aObject);
|
|
100 |
|
|
101 |
protected:
|
|
102 |
void ConstructL();
|
|
103 |
|
|
104 |
private:
|
|
105 |
/** Constructor */
|
|
106 |
CProcessCrashWrapper();
|
|
107 |
|
|
108 |
void PrepareTestL();
|
|
109 |
void DoCmdNewL();
|
|
110 |
void DoCmdReadCrashInfoL();
|
|
111 |
void DoCmdCheckMultipleCrashesL();
|
|
112 |
void DoCmdDeleteAllCrashL();
|
|
113 |
void DoCmdLoadPluginsL();
|
|
114 |
void DoCmdUnLoadPluginsL();
|
|
115 |
void DoCmdProcessCrashL(const TDesC&);
|
|
116 |
void DoCmdConfigurePluginsL(const TDesC& );
|
|
117 |
void DoCmdConfigureSCMZeroPriorityL();
|
|
118 |
void DoConfigureL(const TUint32& aIndex, const TUint32& aUID,
|
|
119 |
const COptionConfig::TParameterSource& aSource,
|
|
120 |
const COptionConfig::TOptionType& aType, const TDesC& aPrompt,
|
|
121 |
const TUint32& aNumOptions, const TDesC& aOptions,
|
|
122 |
const TInt32& aVal, const TDesC& aStrValue, const TUint aInstance);
|
|
123 |
|
|
124 |
void DoCmdValidateSingleELFFileL();
|
|
125 |
void DoCmdValidateAsyncProcessCrashLogL();
|
|
126 |
void DoCmdValidateAsyncProcessAndLiveCrashCrashLogL(const TDesC& );
|
|
127 |
void GenerateLiveCrashL(const TDesC& );
|
|
128 |
void ProcessSELFFileCreatedL();
|
|
129 |
void DoProcessSELFLiveandKernelL();
|
|
130 |
void DoCmdValidateMultipleELFFileL();
|
|
131 |
void DoCmdValidateCpuIDL();
|
|
132 |
void DoCmdValidateHeapSELFFileL();
|
|
133 |
void DoCmdValidateTraceSELFFileL();
|
|
134 |
void DoCmdPerformanceMeasureSELFFileL();
|
|
135 |
void DoCmdValidateCorruptCrashL();
|
|
136 |
void DoCmdConfigureSELFPluginWithInvalidnessL();
|
|
137 |
|
|
138 |
void ValidateHeaderELFFileL();
|
|
139 |
void ValidateProgramHeaderELFFileL();
|
|
140 |
void ValidateSymInfoSectionELFFileL();
|
|
141 |
void ValidateThreadInfoSectionELFFileL(TBool aValidateCpuId, const TDesC& aThreadCrashed, TBool aCheck);
|
|
142 |
void ValidateRegisterInfoSectionELFFileL();
|
|
143 |
void ValidateHeapSectionELFFileL(TBool );
|
|
144 |
void ValidateTraceSectionELFFileL(TBool );
|
|
145 |
void ValidateExceptionL(TInt ,TInt , TBool );
|
|
146 |
void ValidateStringL(TValidateString , TInt , const TDesC& , TBool );
|
|
147 |
void ValidateTraceBufferL(const TDesC8& );
|
|
148 |
void ValidatePerformanceELFFile();
|
|
149 |
|
|
150 |
void GenerateElfFileL(TUint aCrashId, TBool aTiming = EFalse);
|
|
151 |
void MonitorProgressL();
|
|
152 |
void ConfigureSELF(TBool , TInt );
|
|
153 |
void CleanupMethod(const TDesC& );
|
|
154 |
|
|
155 |
void HelpStartTestTimer(void) { iStartTick = User::NTickCount(); iStopTick = 0; };
|
|
156 |
void HelpStopTestTimer(void) { iStopTick = User::NTickCount(); };
|
|
157 |
TInt HelpGetTestTicks(void) { return (iStopTick - iStartTick); };
|
|
158 |
TInt HelpTicksPerSecond();
|
|
159 |
|
|
160 |
void PrintErrorCondition(TInt );
|
|
161 |
|
|
162 |
private:
|
|
163 |
|
|
164 |
/** Object to be tested */
|
|
165 |
//session object to the Core Dump Server
|
|
166 |
RCoreDumpSession iCoreDumpSession;
|
|
167 |
|
|
168 |
//TCrashInfo structure for crash info
|
|
169 |
RCrashInfoPointerList iCrashList;
|
|
170 |
|
|
171 |
//Active Object to handle async processing
|
|
172 |
CAsyncProcessCrash* iProcessCrash;
|
|
173 |
|
|
174 |
//File Server session
|
|
175 |
RFs iFsSession;
|
|
176 |
//File Handle for the ELF File
|
|
177 |
RFile iSELFFile;
|
|
178 |
//SELF File name
|
|
179 |
TBufC<KMaxFileName> iSELFFileName;
|
|
180 |
//stores the SELF Program Header
|
|
181 |
TUint8* iSELFPHHeader;
|
|
182 |
//Number of Program Header Entries
|
|
183 |
TInt iPHEntries;
|
|
184 |
//Program Header Offset
|
|
185 |
TInt iPHOffset;
|
|
186 |
//storing crashed thread id
|
|
187 |
TInt64 iCrashedThreadId;
|
|
188 |
//storing the thread Heap base address
|
|
189 |
TUint32 iHeapBase;
|
|
190 |
//thread heap size
|
|
191 |
TUint32 iHeapSize;
|
|
192 |
//thread name that crashed
|
|
193 |
RBuf iThreadCrashed;
|
|
194 |
//type of crash User/System
|
|
195 |
TBool iSystemCrash;
|
|
196 |
|
|
197 |
//stores the DHDR Buffers
|
|
198 |
TUint8* iDHDRBuffer[MAXNUMBEROFDHDR];
|
|
199 |
//actual SELF DHDR strcuture Sym32_dhdr
|
|
200 |
Sym32_dhdr* idhdr[MAXNUMBEROFDHDR];
|
|
201 |
|
|
202 |
//offset to the String section
|
|
203 |
TInt iOffsetStringSection;
|
|
204 |
//size of String section
|
|
205 |
TInt iSizeofStringSection;
|
|
206 |
|
|
207 |
enum TSELFSegment {EHeap, ETrace, ECode, EThread};
|
|
208 |
|
|
209 |
//start and stop tick counts
|
|
210 |
TInt iStartTick;
|
|
211 |
TInt iStopTick;
|
|
212 |
|
|
213 |
friend class CAsyncProcessCrash;
|
|
214 |
|
|
215 |
};
|
|
216 |
#endif // __CPROCESSCRASHWRAPPER_H__
|