author | sl@SLION-WIN7.fritz.box |
Fri, 15 Jun 2012 03:10:57 +0200 | |
changeset 0 | bde4ae8d615e |
permissions | -rw-r--r-- |
sl@0 | 1 |
// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
sl@0 | 2 |
// All rights reserved. |
sl@0 | 3 |
// This component and the accompanying materials are made available |
sl@0 | 4 |
// under the terms of the License "Eclipse Public License v1.0" |
sl@0 | 5 |
// which accompanies this distribution, and is available |
sl@0 | 6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html". |
sl@0 | 7 |
// |
sl@0 | 8 |
// Initial Contributors: |
sl@0 | 9 |
// Nokia Corporation - initial contribution. |
sl@0 | 10 |
// |
sl@0 | 11 |
// Contributors: |
sl@0 | 12 |
// |
sl@0 | 13 |
// Description: |
sl@0 | 14 |
// e32\debug\crashMonitor\src\scmmulticrashinfo.cpp |
sl@0 | 15 |
// Class to store info about the crash flash to enable multiple crashes |
sl@0 | 16 |
// |
sl@0 | 17 |
// |
sl@0 | 18 |
|
sl@0 | 19 |
/** |
sl@0 | 20 |
@file |
sl@0 | 21 |
@internalTechnology |
sl@0 | 22 |
*/ |
sl@0 | 23 |
|
sl@0 | 24 |
#include <scmdatatypes.h> |
sl@0 | 25 |
|
sl@0 | 26 |
namespace Debug |
sl@0 | 27 |
{ |
sl@0 | 28 |
/** |
sl@0 | 29 |
* constructor |
sl@0 | 30 |
*/ |
sl@0 | 31 |
SCMMultiCrashInfo::SCMMultiCrashInfo() |
sl@0 | 32 |
: iFirstBlock(NULL) |
sl@0 | 33 |
, iCurrentBlock(NULL) |
sl@0 | 34 |
{ |
sl@0 | 35 |
} |
sl@0 | 36 |
|
sl@0 | 37 |
/** |
sl@0 | 38 |
* destructor |
sl@0 | 39 |
*/ |
sl@0 | 40 |
SCMMultiCrashInfo::~SCMMultiCrashInfo() |
sl@0 | 41 |
{ |
sl@0 | 42 |
ClearList(); |
sl@0 | 43 |
} |
sl@0 | 44 |
|
sl@0 | 45 |
/** add a pointer to a block to the list - takes ownership of block |
sl@0 | 46 |
* @param SCMCrashBlockEntry* aBlockEntry block to add |
sl@0 | 47 |
*/ |
sl@0 | 48 |
void SCMMultiCrashInfo::AddBlock(SCMCrashBlockEntry* aBlockEntry) |
sl@0 | 49 |
{ |
sl@0 | 50 |
if(aBlockEntry) |
sl@0 | 51 |
{ |
sl@0 | 52 |
CLTRACE4("SCMMultiCrashInfo::AddBlock iBlockOffset = [%d] [0x%X] iBlockSize = [%d] [0x%X]" |
sl@0 | 53 |
, aBlockEntry->iBlockOffset,aBlockEntry->iBlockOffset, aBlockEntry->iBlockSize, aBlockEntry->iBlockSize); |
sl@0 | 54 |
if(!iFirstBlock) |
sl@0 | 55 |
{ |
sl@0 | 56 |
// adding to empty list |
sl@0 | 57 |
iFirstBlock = aBlockEntry; |
sl@0 | 58 |
iCurrentBlock = iFirstBlock; |
sl@0 | 59 |
} |
sl@0 | 60 |
else |
sl@0 | 61 |
{ |
sl@0 | 62 |
SCMCrashBlockEntry* p = iFirstBlock; |
sl@0 | 63 |
while(p->iNext) |
sl@0 | 64 |
{ |
sl@0 | 65 |
p = p->iNext; |
sl@0 | 66 |
} |
sl@0 | 67 |
p->iNext = aBlockEntry; |
sl@0 | 68 |
} |
sl@0 | 69 |
} |
sl@0 | 70 |
else |
sl@0 | 71 |
{ |
sl@0 | 72 |
CLTRACE("SCMMultiCrashInfo::AddBlock Adding a NULL block !"); |
sl@0 | 73 |
} |
sl@0 | 74 |
} |
sl@0 | 75 |
|
sl@0 | 76 |
|
sl@0 | 77 |
/** add a pointer to a block to the list - takes ownership of block |
sl@0 | 78 |
* @return SCMCrashBlockEntry* returns NULL when no more blocks |
sl@0 | 79 |
* @param none |
sl@0 | 80 |
*/ |
sl@0 | 81 |
SCMCrashBlockEntry* SCMMultiCrashInfo::GetNextBlock() |
sl@0 | 82 |
{ |
sl@0 | 83 |
SCMCrashBlockEntry* p = iCurrentBlock; |
sl@0 | 84 |
if(iCurrentBlock) |
sl@0 | 85 |
{ |
sl@0 | 86 |
iCurrentBlock = iCurrentBlock->iNext; |
sl@0 | 87 |
} |
sl@0 | 88 |
return p; |
sl@0 | 89 |
} |
sl@0 | 90 |
|
sl@0 | 91 |
/** |
sl@0 | 92 |
* sets current block to first in list |
sl@0 | 93 |
*/ |
sl@0 | 94 |
void SCMMultiCrashInfo::Reset() |
sl@0 | 95 |
{ |
sl@0 | 96 |
iCurrentBlock = iFirstBlock; |
sl@0 | 97 |
} |
sl@0 | 98 |
|
sl@0 | 99 |
/** |
sl@0 | 100 |
* Clears all entries in the list |
sl@0 | 101 |
*/ |
sl@0 | 102 |
void SCMMultiCrashInfo::ClearList() |
sl@0 | 103 |
{ |
sl@0 | 104 |
SCMCrashBlockEntry* p = iFirstBlock; |
sl@0 | 105 |
|
sl@0 | 106 |
while(p) |
sl@0 | 107 |
{ |
sl@0 | 108 |
SCMCrashBlockEntry* tmp = p; |
sl@0 | 109 |
delete tmp; |
sl@0 | 110 |
p = p->iNext; |
sl@0 | 111 |
} |
sl@0 | 112 |
|
sl@0 | 113 |
iFirstBlock = iCurrentBlock = NULL; |
sl@0 | 114 |
} |
sl@0 | 115 |
} |
sl@0 | 116 |
|
sl@0 | 117 |
//eof |
sl@0 | 118 |