X-Git-Url: https://git.siccegge.de//index.cgi?p=frida%2Ffrida.git;a=blobdiff_plain;f=src%2Fcore%2FFunction.cxx;fp=src%2Fcore%2FFunction.cxx;h=781940ce71ddef42c7243ed63096f5d3155da590;hp=1df4d1dba3b6a154c337c6d06f63bedcb3a2e6cd;hb=9f53c415cf1554e2d9cc040d3d646ec22fe281f6;hpb=149f8e76d1eed5037c583bad599a27154ce3d9a9 diff --git a/src/core/Function.cxx b/src/core/Function.cxx index 1df4d1d..781940c 100644 --- a/src/core/Function.cxx +++ b/src/core/Function.cxx @@ -1,4 +1,5 @@ #include "Function.hxx" +#include "BasicBlock.hxx" #include "core/events/RenameFunctionEvent.hxx" #include "InformationManager.hxx" #include "gui/qt.hxx" @@ -25,3 +26,30 @@ void Function::serialize(QXmlStreamWriter& stream) { stream.writeEndElement(); // "function" } + +Function* Function::deserialize(QXmlStreamReader& stream, InformationManager* manager) { + Q_ASSERT(stream.name() == "function"); + + QString name = stream.attributes().value("name").toString(); + uint64_t entry = stream.attributes().value("entry").toULongLong(NULL, 16); + Function* fun = manager->newFunction(entry); + + while (QXmlStreamReader::NoToken != stream.readNext()) { + while (QXmlStreamReader::Characters == stream.tokenType() && + stream.isWhitespace()) + stream.readNext(); + if (QXmlStreamReader::EndElement == stream.tokenType()) + break; + + if (stream.name() == "block") { + BasicBlock* block = BasicBlock::deserialize(stream, manager); + fun->addBasicBlock(block); + } else { + return NULL; + } + } + + manager->finishFunction(fun); + fun->setName(name.toStdString()); + return fun; +}