Update contrib.
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of the License "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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
25 :iCodeSpace(0), iCurId(1), iRowBufferErrors(0), iCookBufferErrors(0), iReportMask(0)
30 for(std::vector<SymbolFile*>::iterator it = iSymbols.begin();it != iSymbols.end();it++)
34 void NonXIP::AddObyNames(const char* aSegName, const char* aOrigName)
36 iNamesMap[aSegName] = OrigName(aOrigName,iCurId++);
39 void NonXIP::CreateNamesMap()
41 for(FilesVec::const_iterator it=iObyFiles.begin();it != iObyFiles.end();it++)
43 ObyFile file(it->c_str());
47 for(FilesVec::const_iterator it_s=iSymbolFiles.begin();it_s != iSymbolFiles.end();it_s++)
49 iSymbols.push_back(new SymbolFile(it_s->c_str(), true));
55 void NonXIP::AddSegment(PC aAddress, PC aSegSize, const char *aSegName)
57 if (!iCodeSpace) return;
60 for(char * p = buf;*aSegName;aSegName++,p++)
61 *p = tolower(*aSegName);
63 NamesMap::const_iterator it = iNamesMap.find(buf);
64 if (it == iNamesMap.end()) // not found
67 const char* orig_name = it->second.iName.c_str();
69 if(TryUnDeleteSegment(aAddress, aSegSize, orig_name))
72 int id = it->second.iId;
75 seg.iSegSize = aSegSize;
77 seg.iUnloaded = false;
79 PartitionByFunction pf(0, 0);
81 MappedCodeSpace::Partition* pt;
82 if (Analyse::Action() == Analyse::EProfile && Analyse::Partition() == Analyse::EDll)
87 pt->iCodeSpace = iCodeSpace;
89 // loop on symbol files
90 for(std::vector<SymbolFile*>::iterator its = iSymbols.begin();its != iSymbols.end();its++)
91 if ((*its)->Parse(*pt, orig_name, aAddress, aSegSize, id)) // found
94 iSegData[aAddress] = seg;
98 void NonXIP::DeleteSegment(PC aAddress)
100 if (!iCodeSpace) return;
102 SegData::iterator it = iSegData.find(aAddress);
103 if (it == iSegData.end())
106 Segment seg(it->second);
107 PC high_bound = aAddress+seg.iSegSize;
109 // find aAddress in iCodeSpace->iMap
110 MappedCodeSpace::Map::iterator itm = iCodeSpace->iMap.upper_bound(aAddress);
111 for(;itm != iCodeSpace->iMap.end() && itm->first <= high_bound;itm++)
112 if (!itm->second.iUnloaded)
113 itm->second.iUnloaded = true;
115 seg.iUnloaded = true;
118 bool NonXIP::TryUnDeleteSegment(PC aAddress, PC aSegSize, const char *aSegName)
120 if (!iCodeSpace) return false;
122 SegData::iterator it = iSegData.find(aAddress);
123 if (it == iSegData.end())
126 Segment seg(it->second);
127 PC high_bound = aAddress+seg.iSegSize;
129 if(aSegSize != seg.iSegSize || strcmp(aSegName, seg.iName->second.iName.c_str()))
132 // find aAddress in iCodeSpace->iMap
133 MappedCodeSpace::Map::iterator itm = iCodeSpace->iMap.upper_bound(aAddress);
134 for(;itm != iCodeSpace->iMap.end() && itm->first <= high_bound;itm++)
135 if (itm->second.iUnloaded)
136 itm->second.iUnloaded = false;
138 seg.iUnloaded = false;