SET(frida_SOURCES
src/main.cxx
src/core/InformationManager.cxx
+ src/core/BasicBlock.cxx
src/core/Function.cxx
src/gui/Mainwindow.cxx
src/gui/widgets/BasicBlockWidget.cxx
--- /dev/null
+#include "BasicBlock.hxx"
+#include "gui/qt.hxx"
+
+void BasicBlock::serialize(QXmlStreamWriter& stream) {
+ stream.writeStartElement("block");
+ stream.writeAttribute("id", getName().c_str());
+ stream.writeTextElement("start", QString::number(getStartAddress(), 16));
+ stream.writeTextElement("end", QString::number(getEndAddress(), 16));
+ if (0 != getNextBlock(0))
+ stream.writeTextElement("next", QString::number(getNextBlock(0), 16));
+ if (0 != getNextBlock(1))
+ stream.writeTextElement("next", QString::number(getNextBlock(1), 16));
+ stream.writeEndElement(); // "block"
+}
class Disassembler;
class InformationManager;
+class QXmlStreamWriter;
class BasicBlock {
public:
InformationManager* getManager() const {
return manager;
}
+
+ void serialize(QXmlStreamWriter& stream);
private:
BasicBlock(uint64_t start_address, InformationManager* manager)
: start_address(start_address)
#include "Function.hxx"
#include "core/events/RenameFunctionEvent.hxx"
#include "InformationManager.hxx"
-
-#include <iostream>
+#include "gui/qt.hxx"
Function::Function(uint64_t start_address, InformationManager* manager)
: start_address(start_address)
manager->dispatch(&event);
}
+void Function::serialize(QXmlStreamWriter& stream) {
+ stream.writeStartElement("function");
+ stream.writeAttribute("name", getName().c_str());
+ stream.writeAttribute("entry", QString::number(getStartAddress(), 16));
+
+ for (auto& blockentry : blocks()) {
+ blockentry.second->serialize(stream);
+ }
+
+ stream.writeEndElement(); // "function"
+}
#include "BasicBlock.hxx"
class InformationManager;
+class QXmlStreamWriter;
class Function {
public:
-
uint64_t getStartAddress() const {
return start_address;
}
const std::map<uint64_t, BasicBlock*>& blocks() {
return _blocks;
}
+
+ void serialize(QXmlStreamWriter& stream);
private:
Function(uint64_t start_address, InformationManager* manager);
stream.setAutoFormatting(true);
stream.setAutoFormattingIndent(-1);
stream.writeStartDocument();
- stream.writeStartElement("function");
- stream.writeAttribute("name", fun->getName().c_str());
- stream.writeAttribute("entry", QString::number(fun->getStartAddress(), 16));
-
- for (auto& blockentry : fun->blocks()) {
- stream.writeStartElement("block");
- stream.writeAttribute("id", blockentry.second->getName().c_str());
- stream.writeTextElement("start", QString::number(blockentry.second->getStartAddress(), 16));
- stream.writeTextElement("end", QString::number(blockentry.second->getEndAddress(), 16));
- if (0 != blockentry.second->getNextBlock(0))
- stream.writeTextElement("next", QString::number(blockentry.second->getNextBlock(0), 16));
- if (0 != blockentry.second->getNextBlock(1))
- stream.writeTextElement("next", QString::number(blockentry.second->getNextBlock(1), 16));
- stream.writeEndElement(); // "block"
- }
-
- stream.writeEndElement(); // "function"
+
+ fun->serialize(stream);
+
stream.writeEndDocument();
outZipFile.close();
}