|
|
@ -102,13 +102,11 @@ void MemInfoManager::ParseEntry (TiXmlElement* entry, memory_info* mem, map <str
|
|
|
|
ParseEntry(knownEntries[base], mem, knownEntries);
|
|
|
|
ParseEntry(knownEntries[base], mem, knownEntries);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// mandatory attributes missing?
|
|
|
|
if (!cstr_version)
|
|
|
|
if(!(cstr_version && cstr_os))
|
|
|
|
throw Error::MemoryXmlBadAttribute("version");
|
|
|
|
{
|
|
|
|
if (!cstr_os)
|
|
|
|
cerr << "Bad entry in memory.xml detected, version or os attribute is missing.";
|
|
|
|
throw Error::MemoryXmlBadAttribute("os");
|
|
|
|
// skip if we don't have valid attributes
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
string os = cstr_os;
|
|
|
|
string os = cstr_os;
|
|
|
|
mem->setVersion(cstr_version);
|
|
|
|
mem->setVersion(cstr_version);
|
|
|
|
mem->setOS(cstr_os);
|
|
|
|
mem->setOS(cstr_os);
|
|
|
@ -139,8 +137,7 @@ void MemInfoManager::ParseEntry (TiXmlElement* entry, memory_info* mem, map <str
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
cerr << "unknown operating system " << os << endl;
|
|
|
|
throw Error::MemoryXmlBadAttribute("os");
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// process additional entries
|
|
|
|
// process additional entries
|
|
|
@ -160,10 +157,9 @@ void MemInfoManager::ParseEntry (TiXmlElement* entry, memory_info* mem, map <str
|
|
|
|
ParseVTable(pMemEntry, mem);
|
|
|
|
ParseVTable(pMemEntry, mem);
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if( !(cstr_name && cstr_value))
|
|
|
|
if(!(cstr_name && cstr_value))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
cerr << "underspecified MemInfo entry" << endl;
|
|
|
|
throw Error::MemoryXmlUnderspecifiedEntry();
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
name = cstr_name;
|
|
|
|
name = cstr_name;
|
|
|
|
value = cstr_value;
|
|
|
|
value = cstr_value;
|
|
|
@ -205,7 +201,7 @@ void MemInfoManager::ParseEntry (TiXmlElement* entry, memory_info* mem, map <str
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
cerr << "Unknown MemInfo type: " << type << endl;
|
|
|
|
throw Error::MemoryXmlUnknownType(type.c_str());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} // for
|
|
|
|
} // for
|
|
|
|
} // method
|
|
|
|
} // method
|
|
|
@ -220,30 +216,32 @@ MemInfoManager::MemInfoManager(string path_to_xml)
|
|
|
|
bool MemInfoManager::loadFile(string path_to_xml)
|
|
|
|
bool MemInfoManager::loadFile(string path_to_xml)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TiXmlDocument doc( path_to_xml.c_str() );
|
|
|
|
TiXmlDocument doc( path_to_xml.c_str() );
|
|
|
|
bool loadOkay = doc.LoadFile();
|
|
|
|
//bool loadOkay = doc.LoadFile();
|
|
|
|
|
|
|
|
if (!doc.LoadFile())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
error = true;
|
|
|
|
|
|
|
|
throw Error::MemoryXmlParse(doc.ErrorDesc(), doc.ErrorId(), doc.ErrorRow(), doc.ErrorCol());
|
|
|
|
|
|
|
|
}
|
|
|
|
TiXmlHandle hDoc(&doc);
|
|
|
|
TiXmlHandle hDoc(&doc);
|
|
|
|
TiXmlElement* pElem;
|
|
|
|
TiXmlElement* pElem;
|
|
|
|
TiXmlHandle hRoot(0);
|
|
|
|
TiXmlHandle hRoot(0);
|
|
|
|
memory_info mem;
|
|
|
|
memory_info mem;
|
|
|
|
|
|
|
|
|
|
|
|
if ( loadOkay )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// block: name
|
|
|
|
// block: name
|
|
|
|
{
|
|
|
|
{
|
|
|
|
pElem=hDoc.FirstChildElement().Element();
|
|
|
|
pElem=hDoc.FirstChildElement().Element();
|
|
|
|
// should always have a valid root but handle gracefully if it does
|
|
|
|
// should always have a valid root but handle gracefully if it does
|
|
|
|
if (!pElem)
|
|
|
|
if (!pElem)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
cerr << "no pElem found" << endl;
|
|
|
|
error = true;
|
|
|
|
return false;
|
|
|
|
throw Error::MemoryXmlNoRoot();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
string m_name=pElem->Value();
|
|
|
|
string m_name=pElem->Value();
|
|
|
|
if(m_name != "DFExtractor")
|
|
|
|
if(m_name != "DFExtractor")
|
|
|
|
{
|
|
|
|
{
|
|
|
|
cerr << "DFExtractor != " << m_name << endl;
|
|
|
|
error = true;
|
|
|
|
return false;
|
|
|
|
throw Error::MemoryXmlNoDFExtractor(m_name.c_str());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//cout << "got DFExtractor XML!" << endl;
|
|
|
|
|
|
|
|
// save this for later
|
|
|
|
// save this for later
|
|
|
|
hRoot=TiXmlHandle(pElem);
|
|
|
|
hRoot=TiXmlHandle(pElem);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -279,12 +277,4 @@ bool MemInfoManager::loadFile(string path_to_xml)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
error = false;
|
|
|
|
error = false;
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// load failed
|
|
|
|
|
|
|
|
cerr << "Can't load memory offsets from memory.xml" << endl;
|
|
|
|
|
|
|
|
error = true;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|