|
1 // Copyright (c) 2008-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 // e32\debug\crashMonitor\src\scmmulticrashinfo.cpp |
|
15 // Class to store info about the crash flash to enable multiple crashes |
|
16 // |
|
17 // |
|
18 |
|
19 /** |
|
20 @file |
|
21 @internalTechnology |
|
22 */ |
|
23 |
|
24 #include <scmdatatypes.h> |
|
25 |
|
26 namespace Debug |
|
27 { |
|
28 /** |
|
29 * constructor |
|
30 */ |
|
31 SCMMultiCrashInfo::SCMMultiCrashInfo() |
|
32 : iFirstBlock(NULL) |
|
33 , iCurrentBlock(NULL) |
|
34 { |
|
35 } |
|
36 |
|
37 /** |
|
38 * destructor |
|
39 */ |
|
40 SCMMultiCrashInfo::~SCMMultiCrashInfo() |
|
41 { |
|
42 ClearList(); |
|
43 } |
|
44 |
|
45 /** add a pointer to a block to the list - takes ownership of block |
|
46 * @param SCMCrashBlockEntry* aBlockEntry block to add |
|
47 */ |
|
48 void SCMMultiCrashInfo::AddBlock(SCMCrashBlockEntry* aBlockEntry) |
|
49 { |
|
50 if(aBlockEntry) |
|
51 { |
|
52 CLTRACE4("SCMMultiCrashInfo::AddBlock iBlockOffset = [%d] [0x%X] iBlockSize = [%d] [0x%X]" |
|
53 , aBlockEntry->iBlockOffset,aBlockEntry->iBlockOffset, aBlockEntry->iBlockSize, aBlockEntry->iBlockSize); |
|
54 if(!iFirstBlock) |
|
55 { |
|
56 // adding to empty list |
|
57 iFirstBlock = aBlockEntry; |
|
58 iCurrentBlock = iFirstBlock; |
|
59 } |
|
60 else |
|
61 { |
|
62 SCMCrashBlockEntry* p = iFirstBlock; |
|
63 while(p->iNext) |
|
64 { |
|
65 p = p->iNext; |
|
66 } |
|
67 p->iNext = aBlockEntry; |
|
68 } |
|
69 } |
|
70 else |
|
71 { |
|
72 CLTRACE("SCMMultiCrashInfo::AddBlock Adding a NULL block !"); |
|
73 } |
|
74 } |
|
75 |
|
76 |
|
77 /** add a pointer to a block to the list - takes ownership of block |
|
78 * @return SCMCrashBlockEntry* returns NULL when no more blocks |
|
79 * @param none |
|
80 */ |
|
81 SCMCrashBlockEntry* SCMMultiCrashInfo::GetNextBlock() |
|
82 { |
|
83 SCMCrashBlockEntry* p = iCurrentBlock; |
|
84 if(iCurrentBlock) |
|
85 { |
|
86 iCurrentBlock = iCurrentBlock->iNext; |
|
87 } |
|
88 return p; |
|
89 } |
|
90 |
|
91 /** |
|
92 * sets current block to first in list |
|
93 */ |
|
94 void SCMMultiCrashInfo::Reset() |
|
95 { |
|
96 iCurrentBlock = iFirstBlock; |
|
97 } |
|
98 |
|
99 /** |
|
100 * Clears all entries in the list |
|
101 */ |
|
102 void SCMMultiCrashInfo::ClearList() |
|
103 { |
|
104 SCMCrashBlockEntry* p = iFirstBlock; |
|
105 |
|
106 while(p) |
|
107 { |
|
108 SCMCrashBlockEntry* tmp = p; |
|
109 delete tmp; |
|
110 p = p->iNext; |
|
111 } |
|
112 |
|
113 iFirstBlock = iCurrentBlock = NULL; |
|
114 } |
|
115 } |
|
116 |
|
117 //eof |
|
118 |