X-Git-Url: https://git.siccegge.de//index.cgi?a=blobdiff_plain;f=src%2Fcore%2FFunction.cxx;h=1560e2af98ec9aa04860afbf4a7938763ca31e52;hb=1ef802ee9a14e6274b3e60db873965b794f49abe;hp=1df4d1dba3b6a154c337c6d06f63bedcb3a2e6cd;hpb=3493bceb6690f53900d2a4524401990c601b1464;p=frida%2Ffrida.git diff --git a/src/core/Function.cxx b/src/core/Function.cxx index 1df4d1d..1560e2a 100644 --- a/src/core/Function.cxx +++ b/src/core/Function.cxx @@ -1,16 +1,18 @@ #include "Function.hxx" +#include "BasicBlock.hxx" #include "core/events/RenameFunctionEvent.hxx" #include "InformationManager.hxx" #include "gui/qt.hxx" -Function::Function(uint64_t start_address, InformationManager* manager) +Function::Function(uint64_t start_address, bool dynamic, InformationManager* manager) : start_address(start_address) + , dynamic(dynamic) , manager(manager) {} void Function::setName(const std::string& new_name) { name = new_name; - RenameFunctionEvent event(new_name, start_address); + RenameFunctionEvent event(new_name, this, start_address); manager->dispatch(&event); } @@ -25,3 +27,31 @@ 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; + } + } + + fun->name = name.toStdString(); + manager->finishFunction(fun); + + return fun; +}